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
27 #ifdef CONFIG_ARCH_SCX35
28 #define D_GPIO_START 0
31 #define A_GPIO_START ( D_GPIO_START + D_GPIO_NR )
32 #if defined(CONFIG_ARCH_SCX15)
38 #define D_EIC_START ( A_GPIO_START + A_GPIO_NR)
41 #define A_EIC_START ( D_EIC_START + D_EIC_NR )
47 #define D_GPIO_START ( D_EIC_START + D_EIC_NR )
50 #define A_EIC_START ( D_GPIO_START + D_GPIO_NR )
53 #define A_GPIO_START ( A_EIC_START + A_EIC_NR )
57 #define ARCH_NR_GPIOS ( D_EIC_NR + D_GPIO_NR + A_EIC_NR + A_GPIO_NR )
60 #include <asm-generic/gpio.h>
61 #include <soc/sprd/irqs.h>
63 #include <asm-generic/gpio.h>
64 #include <mach/irqs.h>
67 #define gpio_get_value __gpio_get_value
68 #define gpio_set_value __gpio_set_value
69 #define gpio_cansleep __gpio_cansleep
70 #define gpio_to_irq __gpio_to_irq
73 /* Digital GPIO/EIC base address */
74 #define CTL_GPIO_BASE (SPRD_GPIO_BASE)
75 #define CTL_EIC_BASE (SPRD_EIC_BASE)
77 /* Analog GPIO/EIC base address */
79 #if defined(CONFIG_ARCH_SCX35)
80 #define ANA_CTL_EIC_BASE (ANA_EIC_BASE)
81 #define ANA_CTL_GPIO_BASE (ANA_GPIO_INT_BASE)
83 #define ANA_CTL_EIC_BASE (SPRD_MISC_BASE + 0x0100)
84 #define ANA_CTL_GPIO_BASE (SPRD_MISC_BASE + 0x0480)
97 struct eic_gpio_resource {
104 static inline int irq_to_gpio(int irq)
106 return irq - GPIO_IRQ_START;