blob: b85f6a53d98b1338cb90925268fa3efc315402e2 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Ajay Bhargav9dfd7ed2011-08-22 17:57:38 +05302/*
3 * (C) Copyright 2011
4 * eInfochips Ltd. <www.einfochips.com>
Ajay Bhargav0ad0b612016-12-21 13:28:06 +05305 * Written-by: Ajay Bhargav <contact@8051projects.net>
Ajay Bhargav9dfd7ed2011-08-22 17:57:38 +05306 *
7 * (C) Copyright 2010
8 * Marvell Semiconductor <www.marvell.com>
Ajay Bhargav9dfd7ed2011-08-22 17:57:38 +05309 */
10
11#ifndef _ASM_ARCH_GPIO_H
12#define _ASM_ARCH_GPIO_H
13
14#include <asm/types.h>
15#include <asm/arch/armada100.h>
16
17#define GPIO_HIGH 1
18#define GPIO_LOW 0
19
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)
23
24static inline void *get_gpio_base(int bank)
25{
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]);
29}
30
31#endif /* _ASM_ARCH_GPIO_H */