cns21xx: add support for 3.10
[openwrt.git] / target / linux / cns21xx / patches-3.10 / 102-cns21xx-gpiolib-support.patch
1 --- a/arch/arm/Kconfig
2 +++ b/arch/arm/Kconfig
3 @@ -371,6 +371,8 @@ config ARCH_CNS21XX
4         select CPU_FA526
5         select PLAT_FA
6         select PLAT_FA_TIME
7 +       select PLAT_FA_GPIO
8 +       select ARCH_REQUIRE_GPIOLIB
9         select ARM_L1_CACHE_SHIFT_4
10         help
11           Support for Cavium Networks CNS21xx family.
12 --- /dev/null
13 +++ b/arch/arm/mach-cns21xx/gpio.c
14 @@ -0,0 +1,45 @@
15 +/*
16 + *  Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org>
17 + *
18 + *  This file is free software; you can redistribute it and/or modify
19 + *  it under the terms of the GNU General Public License, Version 2, as
20 + *  published by the Free Software Foundation.
21 + */
22 +
23 +#include <plat/gpio.h>
24 +
25 +#include <mach/cns21xx.h>
26 +#include <mach/irqs.h>
27 +
28 +static struct fa_gpio_chip cns21xx_gpio_chips[] = {
29 +       {
30 +               .gpio_chip = {
31 +                       .label  = "GPIOA",
32 +                       .base   = 0,
33 +                       .ngpio  = 32,
34 +               },
35 +
36 +               .map_base       = CNS21XX_GPIOA_BASE,
37 +               .irq_base       = CNS21XX_GPIO_IRQ_BASE,
38 +       }, {
39 +               .gpio_chip = {
40 +                       .label  = "GPIOB",
41 +                       .base   = 32,
42 +                       .ngpio  = 32,
43 +               },
44 +
45 +               .map_base       = CNS21XX_GPIOB_BASE,
46 +               .irq_base       = CNS21XX_GPIO_IRQ_BASE + 32,
47 +       }
48 +};
49 +
50 +static struct fa_gpio_data cns21xx_gpio_data = {
51 +       .chips  = cns21xx_gpio_chips,
52 +       .nchips = ARRAY_SIZE(cns21xx_gpio_chips),
53 +       .irq    = CNS21XX_IRQ_GPIO,
54 +};
55 +
56 +void __init cns21xx_gpio_init(void)
57 +{
58 +       fa_gpio_init(&cns21xx_gpio_data);
59 +}
60 --- /dev/null
61 +++ b/arch/arm/mach-cns21xx/include/mach/gpio.h
62 @@ -0,0 +1,2 @@
63 +/* empty */
64 +
65 --- a/arch/arm/mach-cns21xx/Makefile
66 +++ b/arch/arm/mach-cns21xx/Makefile
67 @@ -4,7 +4,7 @@
68  
69  # Object file lists.
70  
71 -obj-y          := core.o irq.o mm.o time.o idle.o devices.o
72 +obj-y          := core.o irq.o gpio.o mm.o time.o idle.o devices.o
73  
74  # machine specific files
75  
76 --- a/arch/arm/mach-cns21xx/common.h
77 +++ b/arch/arm/mach-cns21xx/common.h
78 @@ -14,6 +14,7 @@ void cns21xx_restart(char mode, const ch
79  void cns21xx_map_io(void);
80  void cns21xx_init_irq(void);
81  void cns21xx_timer_init(void);
82 +void cns21xx_gpio_init(void);
83  
84  extern struct sys_timer cns21xx_timer;
85