From d5c5132f878394b7487d3f6da0d469aa72737318 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Wed, 22 Oct 2014 12:13:11 +0200 Subject: 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 Tested-by: Luka Perkov Acked-by: Prafulla Wadaskar --- arch/arm/mvebu-common/Makefile | 1 + arch/arm/mvebu-common/gpio.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 arch/arm/mvebu-common/gpio.c (limited to 'arch/arm/mvebu-common') diff --git a/arch/arm/mvebu-common/Makefile b/arch/arm/mvebu-common/Makefile index 391a125203c..9dcab6958c5 100644 --- a/arch/arm/mvebu-common/Makefile +++ b/arch/arm/mvebu-common/Makefile @@ -7,5 +7,6 @@ # obj-y = dram.o +obj-y += gpio.o obj-$(CONFIG_ARMADA_XP) += mbus.o obj-y += timer.o diff --git a/arch/arm/mvebu-common/gpio.c b/arch/arm/mvebu-common/gpio.c new file mode 100644 index 00000000000..56e54e0a621 --- /dev/null +++ b/arch/arm/mvebu-common/gpio.c @@ -0,0 +1,30 @@ +/* + * (C) Copyright 2009 + * Marvell Semiconductor + * Written-by: Prafulla Wadaskar + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include + +/* + * 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); +} -- cgit v1.2.3