2 * Copyright (C) 2012 Spreadtrum Communications Inc.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #ifndef __ASM_ARM_ARCH_GPIO_H
15 #define __ASM_ARM_ARCH_GPIO_H
18 * SC8825 GPIO&EIC bank and number summary:
20 * Bank From To NR Type
23 * 3 272 ~ 287 16 ANA EIC
24 * 4 288 ~ 319 32 ANA GPIO
30 #define D_GPIO_START ( D_EIC_START + D_EIC_NR )
33 #define A_EIC_START ( D_GPIO_START + D_GPIO_NR )
36 #define A_GPIO_START ( A_EIC_START + A_EIC_NR )
39 #define ARCH_NR_GPIOS ( D_EIC_NR + D_GPIO_NR + A_EIC_NR + A_GPIO_NR )
41 #define EIC_CHARGER_DETECT (A_EIC_START + 2)
42 #define EIC_KEY_POWER (A_EIC_START + 3)
44 #include <asm/arch/sc8810_reg_base.h>
45 #include <asm-generic/gpio.h>
47 #define gpio_get_value __gpio_get_value
48 #define gpio_set_value __gpio_set_value
49 #define gpio_cansleep __gpio_cansleep
50 #define gpio_to_irq __gpio_to_irq
53 /* Digital GPIO/EIC base address */
54 #define CTL_GPIO_BASE (GPIO_BASE)
55 #define CTL_EIC_BASE (EIC_BASE)
57 /* Analog GPIO/EIC base address */
58 #define ANA_CTL_GPIO_BASE (ADI_BASE + 0x0480)
59 #define ANA_CTL_EIC_BASE (ADI_BASE + 0x0100)
71 struct eic_gpio_resource {
77 static inline int irq_to_gpio(int irq)