summaryrefslogtreecommitdiff
path: root/arch/arm/mvebu-common/gpio.c
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2014-10-22 10:13:11 (GMT)
committerTom Rini <trini@ti.com>2014-10-23 13:59:21 (GMT)
commitd5c5132f878394b7487d3f6da0d469aa72737318 (patch)
tree6e0879ddf2c632f0ed23cdbd6250bcf65f75b423 /arch/arm/mvebu-common/gpio.c
parent4aceea2088e04724900a9c6f22c48d99293206f2 (diff)
downloadu-boot-d5c5132f878394b7487d3f6da0d469aa72737318.tar.xz
arm: marvell: Extract kirkwood gpio functions into new common file gpio.c
This makes is possible to use those gpio functions from other MVEBU SoC's as well. Signed-off-by: Stefan Roese <sr@denx.de> Tested-by: Luka Perkov <luka@openwrt.org> Acked-by: Prafulla Wadaskar <prafulla@marvell.com>
Diffstat (limited to 'arch/arm/mvebu-common/gpio.c')
-rw-r--r--arch/arm/mvebu-common/gpio.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/arm/mvebu-common/gpio.c b/arch/arm/mvebu-common/gpio.c
new file mode 100644
index 0000000..56e54e0
--- /dev/null
+++ b/arch/arm/mvebu-common/gpio.c
@@ -0,0 +1,30 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/soc.h>
+
+/*
+ * mvebu_config_gpio - GPIO configuration
+ */
+void mvebu_config_gpio(u32 gpp0_oe_val, u32 gpp1_oe_val,
+ u32 gpp0_oe, u32 gpp1_oe)
+{
+ struct kwgpio_registers *gpio0reg =
+ (struct kwgpio_registers *)MVEBU_GPIO0_BASE;
+ struct kwgpio_registers *gpio1reg =
+ (struct kwgpio_registers *)MVEBU_GPIO1_BASE;
+
+ /* Init GPIOS to default values as per board requirement */
+ writel(gpp0_oe_val, &gpio0reg->dout);
+ writel(gpp1_oe_val, &gpio1reg->dout);
+ writel(gpp0_oe, &gpio0reg->oe);
+ writel(gpp1_oe, &gpio1reg->oe);
+}