de9197c9f8755ff23773c69c8c981573f865a61a
[openwrt/openwrt.git] / target / linux / ixp4xx / patches-3.14 / 030-gpio_line_config.patch
1 Index: linux-3.14.25/arch/arm/mach-ixp4xx/common.c
2 ===================================================================
3 --- linux-3.14.25.orig/arch/arm/mach-ixp4xx/common.c 2014-11-21 18:23:44.000000000 +0100
4 +++ linux-3.14.25/arch/arm/mach-ixp4xx/common.c 2014-12-01 07:16:02.172180453 +0100
5 @@ -84,22 +84,7 @@
6 /*
7 * GPIO-functions
8 */
9 -/*
10 - * The following converted to the real HW bits the gpio_line_config
11 - */
12 -/* GPIO pin types */
13 -#define IXP4XX_GPIO_OUT 0x1
14 -#define IXP4XX_GPIO_IN 0x2
15 -
16 -/* GPIO signal types */
17 -#define IXP4XX_GPIO_LOW 0
18 -#define IXP4XX_GPIO_HIGH 1
19 -
20 -/* GPIO Clocks */
21 -#define IXP4XX_GPIO_CLK_0 14
22 -#define IXP4XX_GPIO_CLK_1 15
23 -
24 -static void gpio_line_config(u8 line, u32 direction)
25 +void gpio_line_config(u8 line, u32 direction)
26 {
27 if (direction == IXP4XX_GPIO_IN)
28 *IXP4XX_GPIO_GPOER |= (1 << line);
29 @@ -107,12 +92,12 @@
30 *IXP4XX_GPIO_GPOER &= ~(1 << line);
31 }
32
33 -static void gpio_line_get(u8 line, int *value)
34 +void gpio_line_get(u8 line, int *value)
35 {
36 *value = (*IXP4XX_GPIO_GPINR >> line) & 0x1;
37 }
38
39 -static void gpio_line_set(u8 line, int value)
40 +void gpio_line_set(u8 line, int value)
41 {
42 if (value == IXP4XX_GPIO_HIGH)
43 *IXP4XX_GPIO_GPOUTR |= (1 << line);
44 Index: linux-3.14.25/arch/arm/mach-ixp4xx/include/mach/platform.h
45 ===================================================================
46 --- linux-3.14.25.orig/arch/arm/mach-ixp4xx/include/mach/platform.h 2014-11-30 15:26:43.020130937 +0100
47 +++ linux-3.14.25/arch/arm/mach-ixp4xx/include/mach/platform.h 2014-12-01 07:16:22.024919689 +0100
48 @@ -142,5 +142,21 @@
49 extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
50 extern struct pci_ops ixp4xx_ops;
51
52 +/* GPIO pin types */
53 +#define IXP4XX_GPIO_OUT 0x1
54 +#define IXP4XX_GPIO_IN 0x2
55 +
56 +/* GPIO signal types */
57 +#define IXP4XX_GPIO_LOW 0
58 +#define IXP4XX_GPIO_HIGH 1
59 +
60 +/* GPIO Clocks */
61 +#define IXP4XX_GPIO_CLK_0 14
62 +#define IXP4XX_GPIO_CLK_1 15
63 +
64 +void gpio_line_config(u8 line, u32 direction);
65 +void gpio_line_get(u8 line, int *value);
66 +void gpio_line_set(u8 line, int value);
67 +
68 #endif // __ASSEMBLY__
69