aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-09-10 08:10:13 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-09-27 08:15:44 -0400
commit098e30f6558f8950ed851e874d08bab91c9d4be7 (patch)
treebcdc2bb22b1d50b0371e04a0c814c626f227bc16
parent81ded3c11eeb167c38406247914533872a82db8c (diff)
ARM: ixp4xx: stop broadcasting the custom GPIO API
Now that these custom GPIO accessors are only used from the gpio chip in this machine, move the code out of the include file and right next to the gpiochip implementation. Cc: Imre Kaloz <kaloz@openwrt.org> Cc: Alexandre Courbot <acourbot@nvidia.com> Acked-by: Krzysztof Halasa <khc@pm.waw.pl> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--arch/arm/mach-ixp4xx/common.c38
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/platform.h39
2 files changed, 38 insertions, 39 deletions
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 8708ac8f3614..9edaf4734fa8 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -81,6 +81,44 @@ void __init ixp4xx_map_io(void)
81 iotable_init(ixp4xx_io_desc, ARRAY_SIZE(ixp4xx_io_desc)); 81 iotable_init(ixp4xx_io_desc, ARRAY_SIZE(ixp4xx_io_desc));
82} 82}
83 83
84/*
85 * GPIO-functions
86 */
87/*
88 * The following converted to the real HW bits the gpio_line_config
89 */
90/* GPIO pin types */
91#define IXP4XX_GPIO_OUT 0x1
92#define IXP4XX_GPIO_IN 0x2
93
94/* GPIO signal types */
95#define IXP4XX_GPIO_LOW 0
96#define IXP4XX_GPIO_HIGH 1
97
98/* GPIO Clocks */
99#define IXP4XX_GPIO_CLK_0 14
100#define IXP4XX_GPIO_CLK_1 15
101
102static void gpio_line_config(u8 line, u32 direction)
103{
104 if (direction == IXP4XX_GPIO_IN)
105 *IXP4XX_GPIO_GPOER |= (1 << line);
106 else
107 *IXP4XX_GPIO_GPOER &= ~(1 << line);
108}
109
110static void gpio_line_get(u8 line, int *value)
111{
112 *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;
113}
114
115static void gpio_line_set(u8 line, int value)
116{
117 if (value == IXP4XX_GPIO_HIGH)
118 *IXP4XX_GPIO_GPOUTR |= (1 << line);
119 else if (value == IXP4XX_GPIO_LOW)
120 *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
121}
84 122
85/************************************************************************* 123/*************************************************************************
86 * IXP4xx chipset IRQ handling 124 * IXP4xx chipset IRQ handling
diff --git a/arch/arm/mach-ixp4xx/include/mach/platform.h b/arch/arm/mach-ixp4xx/include/mach/platform.h
index 4c4c6a6f4526..75c4c6572ad0 100644
--- a/arch/arm/mach-ixp4xx/include/mach/platform.h
+++ b/arch/arm/mach-ixp4xx/include/mach/platform.h
@@ -131,44 +131,5 @@ struct pci_sys_data;
131extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); 131extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
132extern struct pci_ops ixp4xx_ops; 132extern struct pci_ops ixp4xx_ops;
133 133
134/*
135 * GPIO-functions
136 */
137/*
138 * The following converted to the real HW bits the gpio_line_config
139 */
140/* GPIO pin types */
141#define IXP4XX_GPIO_OUT 0x1
142#define IXP4XX_GPIO_IN 0x2
143
144/* GPIO signal types */
145#define IXP4XX_GPIO_LOW 0
146#define IXP4XX_GPIO_HIGH 1
147
148/* GPIO Clocks */
149#define IXP4XX_GPIO_CLK_0 14
150#define IXP4XX_GPIO_CLK_1 15
151
152static inline void gpio_line_config(u8 line, u32 direction)
153{
154 if (direction == IXP4XX_GPIO_IN)
155 *IXP4XX_GPIO_GPOER |= (1 << line);
156 else
157 *IXP4XX_GPIO_GPOER &= ~(1 << line);
158}
159
160static inline void gpio_line_get(u8 line, int *value)
161{
162 *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;
163}
164
165static inline void gpio_line_set(u8 line, int value)
166{
167 if (value == IXP4XX_GPIO_HIGH)
168 *IXP4XX_GPIO_GPOUTR |= (1 << line);
169 else if (value == IXP4XX_GPIO_LOW)
170 *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
171}
172
173#endif // __ASSEMBLY__ 134#endif // __ASSEMBLY__
174 135