1 Index: linux-2.6.23.16/drivers/ssb/driver_chipcommon.c
2 ===================================================================
3 --- linux-2.6.23.16.orig/drivers/ssb/driver_chipcommon.c 2008-02-19 15:50:42.000000000 +0100
4 +++ linux-2.6.23.16/drivers/ssb/driver_chipcommon.c 2008-02-19 15:50:44.000000000 +0100
5 @@ -361,37 +361,31 @@ u32 ssb_chipco_gpio_in(struct ssb_chipco
7 return chipco_read32(cc, SSB_CHIPCO_GPIOIN) & mask;
9 -EXPORT_SYMBOL(ssb_chipco_gpio_in);
11 u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value)
13 return chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUT, mask, value);
15 -EXPORT_SYMBOL(ssb_chipco_gpio_out);
17 u32 ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value)
19 return chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUTEN, mask, value);
21 -EXPORT_SYMBOL(ssb_chipco_gpio_outen);
23 u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc, u32 mask, u32 value)
25 return chipco_write32_masked(cc, SSB_CHIPCO_GPIOCTL, mask, value);
27 -EXPORT_SYMBOL(ssb_chipco_gpio_control);
29 u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc, u32 mask, u32 value)
31 return chipco_write32_masked(cc, SSB_CHIPCO_GPIOIRQ, mask, value);
33 -EXPORT_SYMBOL(ssb_chipco_gpio_intmask);
35 u32 ssb_chipco_gpio_polarity(struct ssb_chipcommon *cc, u32 mask, u32 value)
37 return chipco_write32_masked(cc, SSB_CHIPCO_GPIOPOL, mask, value);
39 -EXPORT_SYMBOL(ssb_chipco_gpio_polarity);
41 #ifdef CONFIG_SSB_SERIAL
42 int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
43 Index: linux-2.6.23.16/drivers/ssb/driver_extif.c
44 ===================================================================
45 --- linux-2.6.23.16.orig/drivers/ssb/driver_extif.c 2008-02-19 15:50:42.000000000 +0100
46 +++ linux-2.6.23.16/drivers/ssb/driver_extif.c 2008-02-19 15:50:44.000000000 +0100
47 @@ -122,30 +122,25 @@ u32 ssb_extif_gpio_in(struct ssb_extif *
49 return extif_read32(extif, SSB_EXTIF_GPIO_IN) & mask;
51 -EXPORT_SYMBOL(ssb_extif_gpio_in);
53 u32 ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value)
55 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUT(0),
58 -EXPORT_SYMBOL(ssb_extif_gpio_out);
60 u32 ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value)
62 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUTEN(0),
65 -EXPORT_SYMBOL(ssb_extif_gpio_outen);
67 u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask, u32 value)
69 return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTPOL, mask, value);
71 -EXPORT_SYMBOL(ssb_extif_gpio_polarity);
73 u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask, u32 value)
75 return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTMASK, mask, value);
77 -EXPORT_SYMBOL(ssb_extif_gpio_intmask);
78 Index: linux-2.6.23.16/drivers/ssb/embedded.c
79 ===================================================================
80 --- linux-2.6.23.16.orig/drivers/ssb/embedded.c 2008-02-19 15:50:42.000000000 +0100
81 +++ linux-2.6.23.16/drivers/ssb/embedded.c 2008-02-19 15:51:01.000000000 +0100
83 #include <linux/ssb/ssb.h>
84 #include <linux/ssb/ssb_embedded.h>
86 +#include "ssb_private.h"
89 int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks)
91 @@ -24,3 +26,107 @@ int ssb_watchdog_timer_set(struct ssb_bu
96 +u32 ssb_gpio_in(struct ssb_bus *bus, u32 mask)
98 + unsigned long flags;
101 + spin_lock_irqsave(&bus->gpio_lock, flags);
102 + if (ssb_chipco_available(&bus->chipco))
103 + res = ssb_chipco_gpio_in(&bus->chipco, mask);
104 + else if (ssb_extif_available(&bus->extif))
105 + res = ssb_extif_gpio_in(&bus->extif, mask);
108 + spin_unlock_irqrestore(&bus->gpio_lock, flags);
112 +EXPORT_SYMBOL(ssb_gpio_in);
114 +u32 ssb_gpio_out(struct ssb_bus *bus, u32 mask, u32 value)
116 + unsigned long flags;
119 + spin_lock_irqsave(&bus->gpio_lock, flags);
120 + if (ssb_chipco_available(&bus->chipco))
121 + res = ssb_chipco_gpio_out(&bus->chipco, mask, value);
122 + else if (ssb_extif_available(&bus->extif))
123 + res = ssb_extif_gpio_out(&bus->extif, mask, value);
126 + spin_unlock_irqrestore(&bus->gpio_lock, flags);
130 +EXPORT_SYMBOL(ssb_gpio_out);
132 +u32 ssb_gpio_outen(struct ssb_bus *bus, u32 mask, u32 value)
134 + unsigned long flags;
137 + spin_lock_irqsave(&bus->gpio_lock, flags);
138 + if (ssb_chipco_available(&bus->chipco))
139 + res = ssb_chipco_gpio_outen(&bus->chipco, mask, value);
140 + else if (ssb_extif_available(&bus->extif))
141 + res = ssb_extif_gpio_outen(&bus->extif, mask, value);
144 + spin_unlock_irqrestore(&bus->gpio_lock, flags);
148 +EXPORT_SYMBOL(ssb_gpio_outen);
150 +u32 ssb_gpio_control(struct ssb_bus *bus, u32 mask, u32 value)
152 + unsigned long flags;
155 + spin_lock_irqsave(&bus->gpio_lock, flags);
156 + if (ssb_chipco_available(&bus->chipco))
157 + res = ssb_chipco_gpio_control(&bus->chipco, mask, value);
158 + spin_unlock_irqrestore(&bus->gpio_lock, flags);
162 +EXPORT_SYMBOL(ssb_gpio_control);
164 +u32 ssb_gpio_intmask(struct ssb_bus *bus, u32 mask, u32 value)
166 + unsigned long flags;
169 + spin_lock_irqsave(&bus->gpio_lock, flags);
170 + if (ssb_chipco_available(&bus->chipco))
171 + res = ssb_chipco_gpio_intmask(&bus->chipco, mask, value);
172 + else if (ssb_extif_available(&bus->extif))
173 + res = ssb_extif_gpio_intmask(&bus->extif, mask, value);
176 + spin_unlock_irqrestore(&bus->gpio_lock, flags);
180 +EXPORT_SYMBOL(ssb_gpio_intmask);
182 +u32 ssb_gpio_polarity(struct ssb_bus *bus, u32 mask, u32 value)
184 + unsigned long flags;
187 + spin_lock_irqsave(&bus->gpio_lock, flags);
188 + if (ssb_chipco_available(&bus->chipco))
189 + res = ssb_chipco_gpio_polarity(&bus->chipco, mask, value);
190 + else if (ssb_extif_available(&bus->extif))
191 + res = ssb_extif_gpio_polarity(&bus->extif, mask, value);
194 + spin_unlock_irqrestore(&bus->gpio_lock, flags);
198 +EXPORT_SYMBOL(ssb_gpio_polarity);
199 Index: linux-2.6.23.16/include/linux/ssb/ssb.h
200 ===================================================================
201 --- linux-2.6.23.16.orig/include/linux/ssb/ssb.h 2008-02-19 15:50:42.000000000 +0100
202 +++ linux-2.6.23.16/include/linux/ssb/ssb.h 2008-02-19 15:50:44.000000000 +0100
203 @@ -283,6 +283,11 @@ struct ssb_bus {
204 /* Contents of the SPROM. */
205 struct ssb_sprom sprom;
207 +#ifdef CONFIG_SSB_EMBEDDED
208 + /* Lock for GPIO register access. */
209 + spinlock_t gpio_lock;
210 +#endif /* EMBEDDED */
212 /* Internal-only stuff follows. Do not touch. */
213 struct list_head list;
214 #ifdef CONFIG_SSB_DEBUG
215 Index: linux-2.6.23.16/include/linux/ssb/ssb_embedded.h
216 ===================================================================
217 --- linux-2.6.23.16.orig/include/linux/ssb/ssb_embedded.h 2008-02-19 15:50:42.000000000 +0100
218 +++ linux-2.6.23.16/include/linux/ssb/ssb_embedded.h 2008-02-19 15:50:44.000000000 +0100
221 extern int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks);
223 +/* Generic GPIO API */
224 +u32 ssb_gpio_in(struct ssb_bus *bus, u32 mask);
225 +u32 ssb_gpio_out(struct ssb_bus *bus, u32 mask, u32 value);
226 +u32 ssb_gpio_outen(struct ssb_bus *bus, u32 mask, u32 value);
227 +u32 ssb_gpio_control(struct ssb_bus *bus, u32 mask, u32 value);
228 +u32 ssb_gpio_intmask(struct ssb_bus *bus, u32 mask, u32 value);
229 +u32 ssb_gpio_polarity(struct ssb_bus *bus, u32 mask, u32 value);
231 #endif /* LINUX_SSB_EMBEDDED_H_ */
232 Index: linux-2.6.23.16/drivers/ssb/main.c
233 ===================================================================
234 --- linux-2.6.23.16.orig/drivers/ssb/main.c 2008-02-19 15:50:42.000000000 +0100
235 +++ linux-2.6.23.16/drivers/ssb/main.c 2008-02-19 15:50:44.000000000 +0100
236 @@ -571,6 +571,9 @@ static int ssb_bus_register(struct ssb_b
238 spin_lock_init(&bus->bar_lock);
239 INIT_LIST_HEAD(&bus->list);
240 +#ifdef CONFIG_SSB_EMBEDDED
241 + spin_lock_init(&bus->gpio_lock);
244 /* Powerup the bus */
245 err = ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 1);