[kernel] add a chip_fixup function to the plat_nand driver on 2.6.23 as well (closes...
[openwrt.git] / target / linux / brcm47xx / patches-2.6.23 / 001-ssb-fix-gpio-api.patch
1 Index: linux-2.6.23.17/drivers/ssb/driver_chipcommon.c
2 ===================================================================
3 --- linux-2.6.23.17.orig/drivers/ssb/driver_chipcommon.c
4 +++ linux-2.6.23.17/drivers/ssb/driver_chipcommon.c
5 @@ -39,12 +39,14 @@ static inline void chipco_write32(struct
6 ssb_write32(cc->dev, offset, value);
7 }
8
9 -static inline void chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset,
10 - u32 mask, u32 value)
11 +static inline u32 chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset,
12 + u32 mask, u32 value)
13 {
14 value &= mask;
15 value |= chipco_read32(cc, offset) & ~mask;
16 chipco_write32(cc, offset, value);
17 +
18 + return value;
19 }
20
21 void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc,
22 @@ -355,16 +357,37 @@ u32 ssb_chipco_gpio_in(struct ssb_chipco
23 {
24 return chipco_read32(cc, SSB_CHIPCO_GPIOIN) & mask;
25 }
26 +EXPORT_SYMBOL(ssb_chipco_gpio_in);
27 +
28 +u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value)
29 +{
30 + return chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUT, mask, value);
31 +}
32 +EXPORT_SYMBOL(ssb_chipco_gpio_out);
33 +
34 +u32 ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value)
35 +{
36 + return chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUTEN, mask, value);
37 +}
38 +EXPORT_SYMBOL(ssb_chipco_gpio_outen);
39 +
40 +u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc, u32 mask, u32 value)
41 +{
42 + return chipco_write32_masked(cc, SSB_CHIPCO_GPIOCTL, mask, value);
43 +}
44 +EXPORT_SYMBOL(ssb_chipco_gpio_control);
45
46 -void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value)
47 +u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc, u32 mask, u32 value)
48 {
49 - chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUT, mask, value);
50 + return chipco_write32_masked(cc, SSB_CHIPCO_GPIOIRQ, mask, value);
51 }
52 +EXPORT_SYMBOL(ssb_chipco_gpio_intmask);
53
54 -void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value)
55 +u32 ssb_chipco_gpio_polarity(struct ssb_chipcommon *cc, u32 mask, u32 value)
56 {
57 - chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUTEN, mask, value);
58 + return chipco_write32_masked(cc, SSB_CHIPCO_GPIOPOL, mask, value);
59 }
60 +EXPORT_SYMBOL(ssb_chipco_gpio_polarity);
61
62 #ifdef CONFIG_SSB_SERIAL
63 int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
64 Index: linux-2.6.23.17/drivers/ssb/driver_extif.c
65 ===================================================================
66 --- linux-2.6.23.17.orig/drivers/ssb/driver_extif.c
67 +++ linux-2.6.23.17/drivers/ssb/driver_extif.c
68 @@ -27,12 +27,14 @@ static inline void extif_write32(struct
69 ssb_write32(extif->dev, offset, value);
70 }
71
72 -static inline void extif_write32_masked(struct ssb_extif *extif, u16 offset,
73 - u32 mask, u32 value)
74 +static inline u32 extif_write32_masked(struct ssb_extif *extif, u16 offset,
75 + u32 mask, u32 value)
76 {
77 value &= mask;
78 value |= extif_read32(extif, offset) & ~mask;
79 extif_write32(extif, offset, value);
80 +
81 + return value;
82 }
83
84 #ifdef CONFIG_SSB_SERIAL
85 @@ -114,16 +116,30 @@ u32 ssb_extif_gpio_in(struct ssb_extif *
86 {
87 return extif_read32(extif, SSB_EXTIF_GPIO_IN) & mask;
88 }
89 +EXPORT_SYMBOL(ssb_extif_gpio_in);
90
91 -void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value)
92 +u32 ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value)
93 {
94 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUT(0),
95 mask, value);
96 }
97 +EXPORT_SYMBOL(ssb_extif_gpio_out);
98
99 -void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value)
100 +u32 ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value)
101 {
102 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUTEN(0),
103 mask, value);
104 }
105 +EXPORT_SYMBOL(ssb_extif_gpio_outen);
106 +
107 +u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask, u32 value)
108 +{
109 + return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTPOL, mask, value);
110 +}
111 +EXPORT_SYMBOL(ssb_extif_gpio_polarity);
112
113 +u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask, u32 value)
114 +{
115 + return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTMASK, mask, value);
116 +}
117 +EXPORT_SYMBOL(ssb_extif_gpio_intmask);
118 Index: linux-2.6.23.17/include/linux/ssb/ssb_driver_chipcommon.h
119 ===================================================================
120 --- linux-2.6.23.17.orig/include/linux/ssb/ssb_driver_chipcommon.h
121 +++ linux-2.6.23.17/include/linux/ssb/ssb_driver_chipcommon.h
122 @@ -382,11 +382,13 @@ extern void ssb_chipco_set_clockmode(str
123 extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc,
124 u32 ticks);
125
126 +/* Chipcommon GPIO pin access. */
127 u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask);
128 -
129 -void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value);
130 -
131 -void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value);
132 +u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value);
133 +u32 ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value);
134 +u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc, u32 mask, u32 value);
135 +u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc, u32 mask, u32 value);
136 +u32 ssb_chipco_gpio_polarity(struct ssb_chipcommon *cc, u32 mask, u32 value);
137
138 #ifdef CONFIG_SSB_SERIAL
139 extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
140 Index: linux-2.6.23.17/include/linux/ssb/ssb_driver_extif.h
141 ===================================================================
142 --- linux-2.6.23.17.orig/include/linux/ssb/ssb_driver_extif.h
143 +++ linux-2.6.23.17/include/linux/ssb/ssb_driver_extif.h
144 @@ -171,11 +171,12 @@ extern void ssb_extif_get_clockcontrol(s
145 extern void ssb_extif_timing_init(struct ssb_extif *extif,
146 unsigned long ns);
147
148 +/* Extif GPIO pin access */
149 u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask);
150 -
151 -void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value);
152 -
153 -void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value);
154 +u32 ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value);
155 +u32 ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value);
156 +u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask, u32 value);
157 +u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask, u32 value);
158
159 #ifdef CONFIG_SSB_SERIAL
160 extern int ssb_extif_serial_init(struct ssb_extif *extif,
This page took 0.058183 seconds and 5 git commands to generate.