diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2012-11-20 17:24:34 -0500 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2012-12-12 12:57:49 -0500 |
commit | 2da4c74dc3711275e82856e62884c99f7a45f541 (patch) | |
tree | 4d557c633a005a86c4bedebb1bd4cd32752f93d9 /arch/mips/bcm47xx | |
parent | ec43b08b5733494ad88aa618ecdf534320dd8207 (diff) |
MIPS: BCM47XX: remove GPIO driver
Instated of providing an own GPIO driver use the one provided by ssb and
bcma.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Patchwork: http://patchwork.linux-mips.org/patch/4592
Acked-by: Florian Fainelli <florian@openwrt.org>
Diffstat (limited to 'arch/mips/bcm47xx')
-rw-r--r-- | arch/mips/bcm47xx/Kconfig | 2 | ||||
-rw-r--r-- | arch/mips/bcm47xx/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/bcm47xx/gpio.c | 102 | ||||
-rw-r--r-- | arch/mips/bcm47xx/wgt634u.c | 8 |
4 files changed, 9 insertions, 105 deletions
diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig index b311be45a720..d7af29f1fcf0 100644 --- a/arch/mips/bcm47xx/Kconfig +++ b/arch/mips/bcm47xx/Kconfig | |||
@@ -9,6 +9,7 @@ config BCM47XX_SSB | |||
9 | select SSB_EMBEDDED | 9 | select SSB_EMBEDDED |
10 | select SSB_B43_PCI_BRIDGE if PCI | 10 | select SSB_B43_PCI_BRIDGE if PCI |
11 | select SSB_PCICORE_HOSTMODE if PCI | 11 | select SSB_PCICORE_HOSTMODE if PCI |
12 | select SSB_DRIVER_GPIO | ||
12 | default y | 13 | default y |
13 | help | 14 | help |
14 | Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support. | 15 | Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support. |
@@ -23,6 +24,7 @@ config BCM47XX_BCMA | |||
23 | select BCMA_DRIVER_MIPS | 24 | select BCMA_DRIVER_MIPS |
24 | select BCMA_HOST_PCI if PCI | 25 | select BCMA_HOST_PCI if PCI |
25 | select BCMA_DRIVER_PCI_HOSTMODE if PCI | 26 | select BCMA_DRIVER_PCI_HOSTMODE if PCI |
27 | select BCMA_DRIVER_GPIO | ||
26 | default y | 28 | default y |
27 | help | 29 | help |
28 | Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus. | 30 | Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus. |
diff --git a/arch/mips/bcm47xx/Makefile b/arch/mips/bcm47xx/Makefile index 4389de182eb4..1a3567f07e73 100644 --- a/arch/mips/bcm47xx/Makefile +++ b/arch/mips/bcm47xx/Makefile | |||
@@ -3,5 +3,5 @@ | |||
3 | # under Linux. | 3 | # under Linux. |
4 | # | 4 | # |
5 | 5 | ||
6 | obj-y += gpio.o irq.o nvram.o prom.o serial.o setup.o time.o sprom.o | 6 | obj-y += irq.o nvram.o prom.o serial.o setup.o time.o sprom.o |
7 | obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o | 7 | obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o |
diff --git a/arch/mips/bcm47xx/gpio.c b/arch/mips/bcm47xx/gpio.c deleted file mode 100644 index 5ebdf62e96bb..000000000000 --- a/arch/mips/bcm47xx/gpio.c +++ /dev/null | |||
@@ -1,102 +0,0 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2007 Aurelien Jarno <aurelien@aurel32.net> | ||
7 | */ | ||
8 | |||
9 | #include <linux/export.h> | ||
10 | #include <linux/ssb/ssb.h> | ||
11 | #include <linux/ssb/ssb_driver_chipcommon.h> | ||
12 | #include <linux/ssb/ssb_driver_extif.h> | ||
13 | #include <asm/mach-bcm47xx/bcm47xx.h> | ||
14 | #include <asm/mach-bcm47xx/gpio.h> | ||
15 | |||
16 | #if (BCM47XX_CHIPCO_GPIO_LINES > BCM47XX_EXTIF_GPIO_LINES) | ||
17 | static DECLARE_BITMAP(gpio_in_use, BCM47XX_CHIPCO_GPIO_LINES); | ||
18 | #else | ||
19 | static DECLARE_BITMAP(gpio_in_use, BCM47XX_EXTIF_GPIO_LINES); | ||
20 | #endif | ||
21 | |||
22 | int gpio_request(unsigned gpio, const char *tag) | ||
23 | { | ||
24 | switch (bcm47xx_bus_type) { | ||
25 | #ifdef CONFIG_BCM47XX_SSB | ||
26 | case BCM47XX_BUS_TYPE_SSB: | ||
27 | if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) && | ||
28 | ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES)) | ||
29 | return -EINVAL; | ||
30 | |||
31 | if (ssb_extif_available(&bcm47xx_bus.ssb.extif) && | ||
32 | ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES)) | ||
33 | return -EINVAL; | ||
34 | |||
35 | if (test_and_set_bit(gpio, gpio_in_use)) | ||
36 | return -EBUSY; | ||
37 | |||
38 | return 0; | ||
39 | #endif | ||
40 | #ifdef CONFIG_BCM47XX_BCMA | ||
41 | case BCM47XX_BUS_TYPE_BCMA: | ||
42 | if (gpio >= BCM47XX_CHIPCO_GPIO_LINES) | ||
43 | return -EINVAL; | ||
44 | |||
45 | if (test_and_set_bit(gpio, gpio_in_use)) | ||
46 | return -EBUSY; | ||
47 | |||
48 | return 0; | ||
49 | #endif | ||
50 | } | ||
51 | return -EINVAL; | ||
52 | } | ||
53 | EXPORT_SYMBOL(gpio_request); | ||
54 | |||
55 | void gpio_free(unsigned gpio) | ||
56 | { | ||
57 | switch (bcm47xx_bus_type) { | ||
58 | #ifdef CONFIG_BCM47XX_SSB | ||
59 | case BCM47XX_BUS_TYPE_SSB: | ||
60 | if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) && | ||
61 | ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES)) | ||
62 | return; | ||
63 | |||
64 | if (ssb_extif_available(&bcm47xx_bus.ssb.extif) && | ||
65 | ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES)) | ||
66 | return; | ||
67 | |||
68 | clear_bit(gpio, gpio_in_use); | ||
69 | return; | ||
70 | #endif | ||
71 | #ifdef CONFIG_BCM47XX_BCMA | ||
72 | case BCM47XX_BUS_TYPE_BCMA: | ||
73 | if (gpio >= BCM47XX_CHIPCO_GPIO_LINES) | ||
74 | return; | ||
75 | |||
76 | clear_bit(gpio, gpio_in_use); | ||
77 | return; | ||
78 | #endif | ||
79 | } | ||
80 | } | ||
81 | EXPORT_SYMBOL(gpio_free); | ||
82 | |||
83 | int gpio_to_irq(unsigned gpio) | ||
84 | { | ||
85 | switch (bcm47xx_bus_type) { | ||
86 | #ifdef CONFIG_BCM47XX_SSB | ||
87 | case BCM47XX_BUS_TYPE_SSB: | ||
88 | if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco)) | ||
89 | return ssb_mips_irq(bcm47xx_bus.ssb.chipco.dev) + 2; | ||
90 | else if (ssb_extif_available(&bcm47xx_bus.ssb.extif)) | ||
91 | return ssb_mips_irq(bcm47xx_bus.ssb.extif.dev) + 2; | ||
92 | else | ||
93 | return -EINVAL; | ||
94 | #endif | ||
95 | #ifdef CONFIG_BCM47XX_BCMA | ||
96 | case BCM47XX_BUS_TYPE_BCMA: | ||
97 | return bcma_core_mips_irq(bcm47xx_bus.bcma.bus.drv_cc.core) + 2; | ||
98 | #endif | ||
99 | } | ||
100 | return -EINVAL; | ||
101 | } | ||
102 | EXPORT_SYMBOL_GPL(gpio_to_irq); | ||
diff --git a/arch/mips/bcm47xx/wgt634u.c b/arch/mips/bcm47xx/wgt634u.c index e9f9ec8d443b..6c28f6d891d3 100644 --- a/arch/mips/bcm47xx/wgt634u.c +++ b/arch/mips/bcm47xx/wgt634u.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/leds.h> | 11 | #include <linux/leds.h> |
12 | #include <linux/mtd/physmap.h> | 12 | #include <linux/mtd/physmap.h> |
13 | #include <linux/ssb/ssb.h> | 13 | #include <linux/ssb/ssb.h> |
14 | #include <linux/ssb/ssb_embedded.h> | ||
14 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
15 | #include <linux/reboot.h> | 16 | #include <linux/reboot.h> |
16 | #include <linux/gpio.h> | 17 | #include <linux/gpio.h> |
@@ -116,7 +117,8 @@ static irqreturn_t gpio_interrupt(int irq, void *ignored) | |||
116 | 117 | ||
117 | /* Interrupt are level triggered, revert the interrupt polarity | 118 | /* Interrupt are level triggered, revert the interrupt polarity |
118 | to clear the interrupt. */ | 119 | to clear the interrupt. */ |
119 | gpio_polarity(WGT634U_GPIO_RESET, state); | 120 | ssb_gpio_polarity(&bcm47xx_bus.ssb, 1 << WGT634U_GPIO_RESET, |
121 | state ? 1 << WGT634U_GPIO_RESET : 0); | ||
120 | 122 | ||
121 | if (!state) { | 123 | if (!state) { |
122 | printk(KERN_INFO "Reset button pressed"); | 124 | printk(KERN_INFO "Reset button pressed"); |
@@ -150,7 +152,9 @@ static int __init wgt634u_init(void) | |||
150 | gpio_interrupt, IRQF_SHARED, | 152 | gpio_interrupt, IRQF_SHARED, |
151 | "WGT634U GPIO", &bcm47xx_bus.ssb.chipco)) { | 153 | "WGT634U GPIO", &bcm47xx_bus.ssb.chipco)) { |
152 | gpio_direction_input(WGT634U_GPIO_RESET); | 154 | gpio_direction_input(WGT634U_GPIO_RESET); |
153 | gpio_intmask(WGT634U_GPIO_RESET, 1); | 155 | ssb_gpio_intmask(&bcm47xx_bus.ssb, |
156 | 1 << WGT634U_GPIO_RESET, | ||
157 | 1 << WGT634U_GPIO_RESET); | ||
154 | ssb_chipco_irq_mask(&bcm47xx_bus.ssb.chipco, | 158 | ssb_chipco_irq_mask(&bcm47xx_bus.ssb.chipco, |
155 | SSB_CHIPCO_IRQ_GPIO, | 159 | SSB_CHIPCO_IRQ_GPIO, |
156 | SSB_CHIPCO_IRQ_GPIO); | 160 | SSB_CHIPCO_IRQ_GPIO); |