[ar71xx] WP543: add static mtd partitions
[openwrt.git] / target / linux / brcm47xx / patches-2.6.23 / 001-ssb-fix-gpio-api.patch
1 --- a/drivers/ssb/driver_chipcommon.c
2 +++ b/drivers/ssb/driver_chipcommon.c
3 @@ -39,12 +39,14 @@
4 ssb_write32(cc->dev, offset, value);
5 }
6
7 -static inline void chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset,
8 - u32 mask, u32 value)
9 +static inline u32 chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset,
10 + u32 mask, u32 value)
11 {
12 value &= mask;
13 value |= chipco_read32(cc, offset) & ~mask;
14 chipco_write32(cc, offset, value);
15 +
16 + return value;
17 }
18
19 void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc,
20 @@ -355,16 +357,37 @@
21 {
22 return chipco_read32(cc, SSB_CHIPCO_GPIOIN) & mask;
23 }
24 +EXPORT_SYMBOL(ssb_chipco_gpio_in);
25 +
26 +u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value)
27 +{
28 + return chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUT, mask, value);
29 +}
30 +EXPORT_SYMBOL(ssb_chipco_gpio_out);
31 +
32 +u32 ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value)
33 +{
34 + return chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUTEN, mask, value);
35 +}
36 +EXPORT_SYMBOL(ssb_chipco_gpio_outen);
37 +
38 +u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc, u32 mask, u32 value)
39 +{
40 + return chipco_write32_masked(cc, SSB_CHIPCO_GPIOCTL, mask, value);
41 +}
42 +EXPORT_SYMBOL(ssb_chipco_gpio_control);
43
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)
46 {
47 - chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUT, mask, value);
48 + return chipco_write32_masked(cc, SSB_CHIPCO_GPIOIRQ, mask, value);
49 }
50 +EXPORT_SYMBOL(ssb_chipco_gpio_intmask);
51
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)
54 {
55 - chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUTEN, mask, value);
56 + return chipco_write32_masked(cc, SSB_CHIPCO_GPIOPOL, mask, value);
57 }
58 +EXPORT_SYMBOL(ssb_chipco_gpio_polarity);
59
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
64 @@ -27,12 +27,14 @@
65 ssb_write32(extif->dev, offset, value);
66 }
67
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)
72 {
73 value &= mask;
74 value |= extif_read32(extif, offset) & ~mask;
75 extif_write32(extif, offset, value);
76 +
77 + return value;
78 }
79
80 #ifdef CONFIG_SSB_SERIAL
81 @@ -114,16 +116,30 @@
82 {
83 return extif_read32(extif, SSB_EXTIF_GPIO_IN) & mask;
84 }
85 +EXPORT_SYMBOL(ssb_extif_gpio_in);
86
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)
89 {
90 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUT(0),
91 mask, value);
92 }
93 +EXPORT_SYMBOL(ssb_extif_gpio_out);
94
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)
97 {
98 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUTEN(0),
99 mask, value);
100 }
101 +EXPORT_SYMBOL(ssb_extif_gpio_outen);
102 +
103 +u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask, u32 value)
104 +{
105 + return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTPOL, mask, value);
106 +}
107 +EXPORT_SYMBOL(ssb_extif_gpio_polarity);
108
109 +u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask, u32 value)
110 +{
111 + return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTMASK, mask, value);
112 +}
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,
118 u32 ticks);
119
120 +/* Chipcommon GPIO pin access. */
121 u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask);
122 -
123 -void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value);
124 -
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);
131
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,
138 unsigned long ns);
139
140 +/* Extif GPIO pin access */
141 u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask);
142 -
143 -void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value);
144 -
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);
150
151 #ifdef CONFIG_SSB_SERIAL
152 extern int ssb_extif_serial_init(struct ssb_extif *extif,
This page took 0.044651 seconds and 5 git commands to generate.