xref: /openbmc/u-boot/arch/arm/mach-mvebu/gpio.c (revision cbd2fba1)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2009
4  * Marvell Semiconductor <www.marvell.com>
5  * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
6  */
7 
8 #include <common.h>
9 #include <asm/io.h>
10 #include <asm/arch/cpu.h>
11 #include <asm/arch/soc.h>
12 
13 /*
14  * mvebu_config_gpio - GPIO configuration
15  */
16 void mvebu_config_gpio(u32 gpp0_oe_val, u32 gpp1_oe_val,
17 		       u32 gpp0_oe, u32 gpp1_oe)
18 {
19 	struct kwgpio_registers *gpio0reg =
20 		(struct kwgpio_registers *)MVEBU_GPIO0_BASE;
21 	struct kwgpio_registers *gpio1reg =
22 		(struct kwgpio_registers *)MVEBU_GPIO1_BASE;
23 
24 	/* Init GPIOS to default values as per board requirement */
25 	writel(gpp0_oe_val, &gpio0reg->dout);
26 	writel(gpp1_oe_val, &gpio1reg->dout);
27 	writel(gpp0_oe, &gpio0reg->oe);
28 	writel(gpp1_oe, &gpio1reg->oe);
29 }
30