| 1 | --- a/arch/arm/Kconfig |
| 2 | +++ b/arch/arm/Kconfig |
| 3 | @@ -365,6 +365,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 | --- a/arch/arm/mach-cns21xx/common.h |
| 13 | +++ b/arch/arm/mach-cns21xx/common.h |
| 14 | @@ -13,6 +13,7 @@ |
| 15 | void cns21xx_restart(char mode, const char *cmd); |
| 16 | void cns21xx_map_io(void); |
| 17 | void cns21xx_init_irq(void); |
| 18 | +void cns21xx_gpio_init(void); |
| 19 | |
| 20 | extern struct sys_timer cns21xx_timer; |
| 21 | |
| 22 | --- /dev/null |
| 23 | +++ b/arch/arm/mach-cns21xx/gpio.c |
| 24 | @@ -0,0 +1,45 @@ |
| 25 | +/* |
| 26 | + * Copyright (c) 2010-2012 Gabor Juhos <juhosg@openwrt.org> |
| 27 | + * |
| 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. |
| 31 | + */ |
| 32 | + |
| 33 | +#include <plat/gpio.h> |
| 34 | + |
| 35 | +#include <mach/cns21xx.h> |
| 36 | +#include <mach/irqs.h> |
| 37 | + |
| 38 | +static struct fa_gpio_chip cns21xx_gpio_chips[] = { |
| 39 | + { |
| 40 | + .gpio_chip = { |
| 41 | + .label = "GPIOA", |
| 42 | + .base = 0, |
| 43 | + .ngpio = 32, |
| 44 | + }, |
| 45 | + |
| 46 | + .map_base = CNS21XX_GPIOA_BASE, |
| 47 | + .irq_base = CNS21XX_GPIO_IRQ_BASE, |
| 48 | + }, { |
| 49 | + .gpio_chip = { |
| 50 | + .label = "GPIOB", |
| 51 | + .base = 32, |
| 52 | + .ngpio = 32, |
| 53 | + }, |
| 54 | + |
| 55 | + .map_base = CNS21XX_GPIOB_BASE, |
| 56 | + .irq_base = CNS21XX_GPIO_IRQ_BASE + 32, |
| 57 | + } |
| 58 | +}; |
| 59 | + |
| 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, |
| 64 | +}; |
| 65 | + |
| 66 | +void __init cns21xx_gpio_init(void) |
| 67 | +{ |
| 68 | + fa_gpio_init(&cns21xx_gpio_data); |
| 69 | +} |
| 70 | --- /dev/null |
| 71 | +++ b/arch/arm/mach-cns21xx/include/mach/gpio.h |
| 72 | @@ -0,0 +1,2 @@ |
| 73 | +/* empty */ |
| 74 | + |
| 75 | --- a/arch/arm/mach-cns21xx/Makefile |
| 76 | +++ b/arch/arm/mach-cns21xx/Makefile |
| 77 | @@ -4,7 +4,7 @@ |
| 78 | |
| 79 | # Object file lists. |
| 80 | |
| 81 | -obj-y := core.o devices.o irq.o mm.o time.o |
| 82 | +obj-y := core.o devices.o gpio.o irq.o mm.o time.o |
| 83 | |
| 84 | # machine specific files |
| 85 | |
| 86 | |