1 --- a/drivers/ssb/driver_chipcommon.c
2 +++ b/drivers/ssb/driver_chipcommon.c
4 ssb_write32(cc->dev, offset, value);
7 -static inline void chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset,
9 +static inline u32 chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset,
10 + u32 mask, u32 value)
13 value |= chipco_read32(cc, offset) & ~mask;
14 chipco_write32(cc, offset, value);
19 void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc,
22 return chipco_read32(cc, SSB_CHIPCO_GPIOIN) & mask;
24 +EXPORT_SYMBOL(ssb_chipco_gpio_in);
26 +u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value)
28 + return chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUT, mask, value);
30 +EXPORT_SYMBOL(ssb_chipco_gpio_out);
32 +u32 ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value)
34 + return chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUTEN, mask, value);
36 +EXPORT_SYMBOL(ssb_chipco_gpio_outen);
38 +u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc, u32 mask, u32 value)
40 + return chipco_write32_masked(cc, SSB_CHIPCO_GPIOCTL, mask, value);
42 +EXPORT_SYMBOL(ssb_chipco_gpio_control);
44 -void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value)
45 +u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc, u32 mask, u32 value)
47 - chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUT, mask, value);
48 + return chipco_write32_masked(cc, SSB_CHIPCO_GPIOIRQ, mask, value);
50 +EXPORT_SYMBOL(ssb_chipco_gpio_intmask);
52 -void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value)
53 +u32 ssb_chipco_gpio_polarity(struct ssb_chipcommon *cc, u32 mask, u32 value)
55 - chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUTEN, mask, value);
56 + return chipco_write32_masked(cc, SSB_CHIPCO_GPIOPOL, mask, value);
58 +EXPORT_SYMBOL(ssb_chipco_gpio_polarity);
60 #ifdef CONFIG_SSB_SERIAL
61 int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
62 --- a/drivers/ssb/driver_extif.c
63 +++ b/drivers/ssb/driver_extif.c
65 ssb_write32(extif->dev, offset, value);
68 -static inline void extif_write32_masked(struct ssb_extif *extif, u16 offset,
69 - u32 mask, u32 value)
70 +static inline u32 extif_write32_masked(struct ssb_extif *extif, u16 offset,
71 + u32 mask, u32 value)
74 value |= extif_read32(extif, offset) & ~mask;
75 extif_write32(extif, offset, value);
80 #ifdef CONFIG_SSB_SERIAL
83 return extif_read32(extif, SSB_EXTIF_GPIO_IN) & mask;
85 +EXPORT_SYMBOL(ssb_extif_gpio_in);
87 -void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value)
88 +u32 ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value)
90 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUT(0),
93 +EXPORT_SYMBOL(ssb_extif_gpio_out);
95 -void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value)
96 +u32 ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value)
98 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUTEN(0),
101 +EXPORT_SYMBOL(ssb_extif_gpio_outen);
103 +u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask, u32 value)
105 + return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTPOL, mask, value);
107 +EXPORT_SYMBOL(ssb_extif_gpio_polarity);
109 +u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask, u32 value)
111 + return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTMASK, mask, value);
113 +EXPORT_SYMBOL(ssb_extif_gpio_intmask);
114 --- a/include/linux/ssb/ssb_driver_chipcommon.h
115 +++ b/include/linux/ssb/ssb_driver_chipcommon.h
116 @@ -382,11 +382,13 @@
117 extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc,
120 +/* Chipcommon GPIO pin access. */
121 u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask);
123 -void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value);
125 -void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value);
126 +u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value);
127 +u32 ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value);
128 +u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc, u32 mask, u32 value);
129 +u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc, u32 mask, u32 value);
130 +u32 ssb_chipco_gpio_polarity(struct ssb_chipcommon *cc, u32 mask, u32 value);
132 #ifdef CONFIG_SSB_SERIAL
133 extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
134 --- a/include/linux/ssb/ssb_driver_extif.h
135 +++ b/include/linux/ssb/ssb_driver_extif.h
136 @@ -171,11 +171,12 @@
137 extern void ssb_extif_timing_init(struct ssb_extif *extif,
140 +/* Extif GPIO pin access */
141 u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask);
143 -void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value);
145 -void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value);
146 +u32 ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value);
147 +u32 ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value);
148 +u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask, u32 value);
149 +u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask, u32 value);
151 #ifdef CONFIG_SSB_SERIAL
152 extern int ssb_extif_serial_init(struct ssb_extif *extif,