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