1 /* SPDX-License-Identifier: GPL-2.0+ */
4 * eInfochips Ltd. <www.einfochips.com>
5 * Written-by: Ajay Bhargav <contact@8051projects.net>
8 * Marvell Semiconductor <www.marvell.com>
11 #ifndef _ASM_ARCH_GPIO_H
12 #define _ASM_ARCH_GPIO_H
14 #include <asm/types.h>
15 #include <asm/arch/armada100.h>
20 #define GPIO_TO_REG(gp) (gp >> 5)
21 #define GPIO_TO_BIT(gp) (1 << (gp & 0x1F))
22 #define GPIO_VAL(gp, val) ((val >> (gp & 0x1F)) & 0x01)
24 static inline void *get_gpio_base(int bank)
26 const unsigned int offset[4] = {0, 4, 8, 0x100};
27 /* gpio register bank offset - refer Appendix A.36 */
28 return (struct gpio_reg *)(ARMD1_GPIO_BASE + offset[bank]);
31 #endif /* _ASM_ARCH_GPIO_H */