aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/mach-bcm47xx
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2011-07-22 19:20:14 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-08 14:29:32 -0400
commitc1d1c5d4213ee96e054c4d195117368972a4c01f (patch)
tree4ce75f49f1b46835ab613bd85084b9ce863c5853 /arch/mips/include/asm/mach-bcm47xx
parenta656ffcbc7a98a80d2136ae6bbdd8ae2eb48c78a (diff)
bcm47xx: add support for bcma bus
This patch add support for the bcma bus. Broadcom uses only Mips 74K CPUs on the new SoC and on the old ons using ssb bus there are no Mips 74K CPUs. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'arch/mips/include/asm/mach-bcm47xx')
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/bcm47xx.h8
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/gpio.h41
2 files changed, 49 insertions, 0 deletions
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
index d037afb6677e..de95e0723e2b 100644
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
@@ -20,17 +20,25 @@
20#define __ASM_BCM47XX_H 20#define __ASM_BCM47XX_H
21 21
22#include <linux/ssb/ssb.h> 22#include <linux/ssb/ssb.h>
23#include <linux/bcma/bcma.h>
24#include <linux/bcma/bcma_soc.h>
23 25
24enum bcm47xx_bus_type { 26enum bcm47xx_bus_type {
25#ifdef CONFIG_BCM47XX_SSB 27#ifdef CONFIG_BCM47XX_SSB
26 BCM47XX_BUS_TYPE_SSB, 28 BCM47XX_BUS_TYPE_SSB,
27#endif 29#endif
30#ifdef CONFIG_BCM47XX_BCMA
31 BCM47XX_BUS_TYPE_BCMA,
32#endif
28}; 33};
29 34
30union bcm47xx_bus { 35union bcm47xx_bus {
31#ifdef CONFIG_BCM47XX_SSB 36#ifdef CONFIG_BCM47XX_SSB
32 struct ssb_bus ssb; 37 struct ssb_bus ssb;
33#endif 38#endif
39#ifdef CONFIG_BCM47XX_BCMA
40 struct bcma_soc bcma;
41#endif
34}; 42};
35 43
36extern union bcm47xx_bus bcm47xx_bus; 44extern union bcm47xx_bus bcm47xx_bus;
diff --git a/arch/mips/include/asm/mach-bcm47xx/gpio.h b/arch/mips/include/asm/mach-bcm47xx/gpio.h
index 1d5f5af56b5f..76961cabeedf 100644
--- a/arch/mips/include/asm/mach-bcm47xx/gpio.h
+++ b/arch/mips/include/asm/mach-bcm47xx/gpio.h
@@ -10,6 +10,7 @@
10#define __BCM47XX_GPIO_H 10#define __BCM47XX_GPIO_H
11 11
12#include <linux/ssb/ssb_embedded.h> 12#include <linux/ssb/ssb_embedded.h>
13#include <linux/bcma/bcma.h>
13#include <asm/mach-bcm47xx/bcm47xx.h> 14#include <asm/mach-bcm47xx/bcm47xx.h>
14 15
15#define BCM47XX_EXTIF_GPIO_LINES 5 16#define BCM47XX_EXTIF_GPIO_LINES 5
@@ -26,6 +27,11 @@ static inline int gpio_get_value(unsigned gpio)
26 case BCM47XX_BUS_TYPE_SSB: 27 case BCM47XX_BUS_TYPE_SSB:
27 return ssb_gpio_in(&bcm47xx_bus.ssb, 1 << gpio); 28 return ssb_gpio_in(&bcm47xx_bus.ssb, 1 << gpio);
28#endif 29#endif
30#ifdef CONFIG_BCM47XX_BCMA
31 case BCM47XX_BUS_TYPE_BCMA:
32 return bcma_chipco_gpio_in(&bcm47xx_bus.bcma.bus.drv_cc,
33 1 << gpio);
34#endif
29 } 35 }
30 return -EINVAL; 36 return -EINVAL;
31} 37}
@@ -37,6 +43,13 @@ static inline void gpio_set_value(unsigned gpio, int value)
37 case BCM47XX_BUS_TYPE_SSB: 43 case BCM47XX_BUS_TYPE_SSB:
38 ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio, 44 ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio,
39 value ? 1 << gpio : 0); 45 value ? 1 << gpio : 0);
46 return;
47#endif
48#ifdef CONFIG_BCM47XX_BCMA
49 case BCM47XX_BUS_TYPE_BCMA:
50 bcma_chipco_gpio_out(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
51 value ? 1 << gpio : 0);
52 return;
40#endif 53#endif
41 } 54 }
42} 55}
@@ -49,6 +62,12 @@ static inline int gpio_direction_input(unsigned gpio)
49 ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 0); 62 ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 0);
50 return 0; 63 return 0;
51#endif 64#endif
65#ifdef CONFIG_BCM47XX_BCMA
66 case BCM47XX_BUS_TYPE_BCMA:
67 bcma_chipco_gpio_outen(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
68 0);
69 return 0;
70#endif
52 } 71 }
53 return -EINVAL; 72 return -EINVAL;
54} 73}
@@ -65,6 +84,16 @@ static inline int gpio_direction_output(unsigned gpio, int value)
65 ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 1 << gpio); 84 ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 1 << gpio);
66 return 0; 85 return 0;
67#endif 86#endif
87#ifdef CONFIG_BCM47XX_BCMA
88 case BCM47XX_BUS_TYPE_BCMA:
89 /* first set the gpio out value */
90 bcma_chipco_gpio_out(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
91 value ? 1 << gpio : 0);
92 /* then set the gpio mode */
93 bcma_chipco_gpio_outen(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
94 1 << gpio);
95 return 0;
96#endif
68 } 97 }
69 return -EINVAL; 98 return -EINVAL;
70} 99}
@@ -78,6 +107,12 @@ static inline int gpio_intmask(unsigned gpio, int value)
78 value ? 1 << gpio : 0); 107 value ? 1 << gpio : 0);
79 return 0; 108 return 0;
80#endif 109#endif
110#ifdef CONFIG_BCM47XX_BCMA
111 case BCM47XX_BUS_TYPE_BCMA:
112 bcma_chipco_gpio_intmask(&bcm47xx_bus.bcma.bus.drv_cc,
113 1 << gpio, value ? 1 << gpio : 0);
114 return 0;
115#endif
81 } 116 }
82 return -EINVAL; 117 return -EINVAL;
83} 118}
@@ -91,6 +126,12 @@ static inline int gpio_polarity(unsigned gpio, int value)
91 value ? 1 << gpio : 0); 126 value ? 1 << gpio : 0);
92 return 0; 127 return 0;
93#endif 128#endif
129#ifdef CONFIG_BCM47XX_BCMA
130 case BCM47XX_BUS_TYPE_BCMA:
131 bcma_chipco_gpio_polarity(&bcm47xx_bus.bcma.bus.drv_cc,
132 1 << gpio, value ? 1 << gpio : 0);
133 return 0;
134#endif
94 } 135 }
95 return -EINVAL; 136 return -EINVAL;
96} 137}