3 @@ -296,6 +296,8 @@ config ARCH_CNS21XX
8 + select ARCH_REQUIRE_GPIOLIB
9 select ARM_L1_CACHE_SHIFT_4
11 Support for Cavium Networks CNS21xx family.
12 --- a/arch/arm/mach-cns21xx/common.h
13 +++ b/arch/arm/mach-cns21xx/common.h
16 void __init cns21xx_map_io(void);
17 void __init cns21xx_init_irq(void);
18 +void __init cns21xx_gpio_init(void);
20 extern struct sys_timer cns21xx_timer;
23 +++ b/arch/arm/mach-cns21xx/gpio.c
26 + * Copyright (c) 2010 Gabor Juhos <juhosg@openwrt.org>
28 + * This file is free software; you can redistribute it and/or modify
29 + * it under the terms of the GNU General Public License, Version 2, as
30 + * published by the Free Software Foundation.
33 +#include <plat/gpio.h>
35 +#include <mach/cns21xx.h>
36 +#include <mach/irqs.h>
38 +static struct fa_gpio_chip cns21xx_gpio_chips[] = {
46 + .map_base = CNS21XX_GPIOA_BASE,
47 + .irq_base = CNS21XX_GPIO_IRQ_BASE,
55 + .map_base = CNS21XX_GPIOB_BASE,
56 + .irq_base = CNS21XX_GPIO_IRQ_BASE + 32,
60 +static struct fa_gpio_data cns21xx_gpio_data = {
61 + .chips = cns21xx_gpio_chips,
62 + .nchips = ARRAY_SIZE(cns21xx_gpio_chips),
63 + .irq = CNS21XX_IRQ_GPIO,
66 +void __init cns21xx_gpio_init(void)
68 + fa_gpio_init(&cns21xx_gpio_data);
71 +++ b/arch/arm/mach-cns21xx/include/mach/gpio.h
74 + * Copyright (c) 2008 Cavium Networks
75 + * Copyright (c) 2010 Gabor Juhos <juhosg@openwrt.org>
77 + * This file is free software; you can redistribute it and/or modify
78 + * it under the terms of the GNU General Public License, Version 2, as
79 + * published by the Free Software Foundation.
82 +#ifndef _CNS21XX_GPIO_H
83 +#define _CNS21XX_GPIO_H
85 +#include <asm-generic/gpio.h>
86 +#include <mach/irqs.h>
88 +#define gpio_get_value __gpio_get_value
89 +#define gpio_set_value __gpio_set_value
90 +#define gpio_cansleep __gpio_cansleep
92 +static inline int gpio_to_irq(unsigned gpio)
94 + return (CNS21XX_GPIO_IRQ_BASE + gpio);
97 +static inline int irq_to_gpio(int irq)
99 + return (irq - CNS21XX_GPIO_IRQ_BASE);
102 +#endif /* _CNS21XX_GPIO_H */
103 --- a/arch/arm/mach-cns21xx/Makefile
104 +++ b/arch/arm/mach-cns21xx/Makefile
109 -obj-y := core.o devices.o irq.o mm.o time.o
110 +obj-y := core.o devices.o gpio.o irq.o mm.o time.o
112 # machine specific files