tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-sc8830 / gpio.h
1 /*
2  * Copyright (C) 2012 Spreadtrum Communications Inc.
3  *
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.
7  *
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.
12  */
13
14 #ifndef __ASM_ARM_ARCH_GPIO_H
15 #define __ASM_ARM_ARCH_GPIO_H
16
17 /*
18  * SC8825 GPIO&EIC bank and number summary:
19  *
20  * Bank   From    To    NR      Type
21  * 1      0   ~   15            16      EIC
22  * 2      16  ~   271   256     GPIO
23  * 3      272 ~   287   16      ANA EIC
24  * 4      288 ~   319   32      ANA GPIO
25  */
26
27 #define D_EIC_START             0
28 #define D_EIC_NR                16
29
30 #define D_GPIO_START    ( D_EIC_START + D_EIC_NR )
31 #define D_GPIO_NR               256
32
33 #define A_EIC_START             ( D_GPIO_START + D_GPIO_NR )
34 #define A_EIC_NR                16
35
36 #define A_GPIO_START    ( A_EIC_START + A_EIC_NR )
37 #define A_GPIO_NR               32
38
39 #define ARCH_NR_GPIOS   ( D_EIC_NR + D_GPIO_NR + A_EIC_NR + A_GPIO_NR )
40
41 #define EIC_CHARGER_DETECT              (A_EIC_START + 2)
42 #define EIC_KEY_POWER           (A_EIC_START + 3)
43
44 #include <asm/arch/sprd_reg_base.h>
45 #include <asm-generic/gpio.h>
46
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
51
52
53 /* Digital GPIO/EIC base address */
54 #define CTL_GPIO_BASE          (GPIO_BASE)
55 #define CTL_EIC_BASE           (EIC_BASE)
56
57 /* Analog GPIO/EIC base address */
58 #define ANA_CTL_GPIO_BASE      (ADI_BASE + 0x0480)
59 #define ANA_CTL_EIC_BASE       (ADI_BASE + 0x0100)
60
61
62 enum {
63        ENUM_ID_D_GPIO = 0,
64        ENUM_ID_D_EIC,
65        ENUM_ID_A_GPIO,
66        ENUM_ID_A_EIC,
67
68        ENUM_ID_END_NR,
69 };
70
71 struct eic_gpio_resource {
72        int base_addr;
73        int chip_base;
74        int chip_ngpio;
75 };
76
77 static inline int irq_to_gpio(int irq)
78 {
79         return 0;
80 }
81
82 #endif