blob: 54e6ccf0c25cf7c04a56d59dd9034cdbc6216c52 [file] [log] [blame]
Ajay Bhargav9dfd7ed2011-08-22 17:57:38 +05301/*
2 * (C) Copyright 2011
3 * eInfochips Ltd. <www.einfochips.com>
Ajay Bhargav0ad0b612016-12-21 13:28:06 +05304 * Written-by: Ajay Bhargav <contact@8051projects.net>
Ajay Bhargav9dfd7ed2011-08-22 17:57:38 +05305 *
6 * (C) Copyright 2010
7 * Marvell Semiconductor <www.marvell.com>
8 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02009 * SPDX-License-Identifier: GPL-2.0+
Ajay Bhargav9dfd7ed2011-08-22 17:57:38 +053010 */
11
12#ifndef _ASM_ARCH_GPIO_H
13#define _ASM_ARCH_GPIO_H
14
15#include <asm/types.h>
16#include <asm/arch/armada100.h>
17
18#define GPIO_HIGH 1
19#define GPIO_LOW 0
20
21#define GPIO_TO_REG(gp) (gp >> 5)
22#define GPIO_TO_BIT(gp) (1 << (gp & 0x1F))
23#define GPIO_VAL(gp, val) ((val >> (gp & 0x1F)) & 0x01)
24
25static inline void *get_gpio_base(int bank)
26{
27 const unsigned int offset[4] = {0, 4, 8, 0x100};
28 /* gpio register bank offset - refer Appendix A.36 */
29 return (struct gpio_reg *)(ARMD1_GPIO_BASE + offset[bank]);
30}
31
32#endif /* _ASM_ARCH_GPIO_H */