summaryrefslogtreecommitdiff
path: root/target/linux/generic-2.6/patches-2.6.23/930-ssb_fixes.patch
blob: ce3a007b67a16534fd7b2c682522c35f2ede36a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
Index: linux-2.6.23.16/drivers/ssb/driver_mipscore.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/driver_mipscore.c	2008-02-19 01:35:53.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_mipscore.c	2008-02-19 02:01:16.000000000 +0100
@@ -222,3 +222,5 @@ void ssb_mipscore_init(struct ssb_mipsco
 	ssb_mips_serial_init(mcore);
 	ssb_mips_flash_detect(mcore);
 }
+
+EXPORT_SYMBOL(ssb_mips_irq);
Index: linux-2.6.23.16/include/linux/ssb/ssb_driver_chipcommon.h
===================================================================
--- linux-2.6.23.16.orig/include/linux/ssb/ssb_driver_chipcommon.h	2008-02-19 01:35:53.000000000 +0100
+++ linux-2.6.23.16/include/linux/ssb/ssb_driver_chipcommon.h	2008-02-19 02:01:10.000000000 +0100
@@ -382,11 +382,45 @@ extern void ssb_chipco_set_clockmode(str
 extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc,
 					  u32 ticks);
 
-u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask);
+/* GPIO functions */
+static inline u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc,
+                                     u32 mask)
+{
+	return ssb_read32(cc->dev, SSB_CHIPCO_GPIOIN) & mask;
+}
 
-void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value);
+static inline u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc,
+                                      u32 mask, u32 value)
+{
+	return ssb_write32_masked(cc->dev, SSB_CHIPCO_GPIOOUT, mask, value);
+}
 
-void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value);
+static inline u32 ssb_chipco_gpio_outen(struct ssb_chipcommon *cc,
+                                        u32 mask, u32 value)
+{
+	return ssb_write32_masked(cc->dev, SSB_CHIPCO_GPIOOUTEN, mask, value);
+}
+
+static inline u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc,
+                                          u32 mask, u32 value)
+{
+	return ssb_write32_masked(cc->dev, SSB_CHIPCO_GPIOCTL, mask, value);
+}
+
+static inline u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc,
+                                          u32 mask, u32 value)
+{
+	return ssb_write32_masked(cc->dev, SSB_CHIPCO_GPIOIRQ, mask, value);
+}
+
+static inline u32 ssb_chipco_gpio_polarity(struct ssb_chipcommon *cc,
+                                           u32 mask, u32 value)
+{
+	return ssb_write32_masked(cc->dev, SSB_CHIPCO_GPIOPOL, mask, value);
+}
+/* TODO: GPIO reservation */
+
+extern int ssb_chipco_watchdog(struct ssb_chipcommon *cc, uint ticks);
 
 #ifdef CONFIG_SSB_SERIAL
 extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
Index: linux-2.6.23.16/include/linux/ssb/ssb_driver_extif.h
===================================================================
--- linux-2.6.23.16.orig/include/linux/ssb/ssb_driver_extif.h	2008-02-19 01:35:53.000000000 +0100
+++ linux-2.6.23.16/include/linux/ssb/ssb_driver_extif.h	2008-02-19 01:39:40.000000000 +0100
@@ -153,7 +153,6 @@
 #define SSB_EXTIF_WATCHDOG_CLK		48000000	/* Hz */
 
 
-
 #ifdef CONFIG_SSB_DRIVER_EXTIF
 
 struct ssb_extif {
@@ -171,17 +170,42 @@ extern void ssb_extif_get_clockcontrol(s
 extern void ssb_extif_timing_init(struct ssb_extif *extif,
 				  unsigned long ns);
 
-u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask);
-
-void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value);
-
-void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value);
-
 #ifdef CONFIG_SSB_SERIAL
 extern int ssb_extif_serial_init(struct ssb_extif *extif,
 				 struct ssb_serial_port *ports);
 #endif /* CONFIG_SSB_SERIAL */
 
+/* GPIO functions */
+static inline u32 ssb_extif_gpio_in(struct ssb_extif *extif,
+                                    u32 mask)
+{
+	return ssb_read32(extif->dev, SSB_EXTIF_GPIO_IN) & mask;
+}
+
+static inline u32 ssb_extif_gpio_out(struct ssb_extif *extif,
+                                     u32 mask, u32 value)
+{
+	return ssb_write32_masked(extif->dev, SSB_EXTIF_GPIO_OUT(0), mask, value);
+}
+
+static inline u32 ssb_extif_gpio_outen(struct ssb_extif *extif,
+                                       u32 mask, u32 value)
+{
+	return ssb_write32_masked(extif->dev, SSB_EXTIF_GPIO_OUTEN(0), mask, value);
+}
+
+static inline u32 ssb_extif_gpio_polarity(struct ssb_extif *extif,
+                                          u32 mask, u32 value)
+{
+	return ssb_write32_masked(extif->dev, SSB_EXTIF_GPIO_INTPOL, mask, value);
+}
+
+static inline u32 ssb_extif_gpio_intmask(struct ssb_extif *extif,
+                                         u32 mask, u32 value)
+{
+	return ssb_write32_masked(extif->dev, SSB_EXTIF_GPIO_INTMASK, mask, value);
+}
+
 
 #else /* CONFIG_SSB_DRIVER_EXTIF */
 /* extif disabled */
Index: linux-2.6.23.16/include/linux/ssb/ssb.h
===================================================================
--- linux-2.6.23.16.orig/include/linux/ssb/ssb.h	2008-02-19 01:35:53.000000000 +0100
+++ linux-2.6.23.16/include/linux/ssb/ssb.h	2008-02-19 01:39:40.000000000 +0100
@@ -217,6 +217,12 @@ enum ssb_bustype {
 #define SSB_CHIPPACK_BCM4712M	2	/* Medium 225pin 4712 */
 #define SSB_CHIPPACK_BCM4712L	0	/* Large 340pin 4712 */
 
+static inline u16 ssb_read16(struct ssb_device *dev, u16 offset);
+static inline u32 ssb_read32(struct ssb_device *dev, u16 offset);
+static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value);
+static inline void ssb_write32(struct ssb_device *dev, u16 offset, u32 value);
+static inline u32 ssb_write32_masked(struct ssb_device *dev, u16 offset, u32 mask, u32 value);
+
 #include <linux/ssb/ssb_driver_chipcommon.h>
 #include <linux/ssb/ssb_driver_mips.h>
 #include <linux/ssb/ssb_driver_extif.h>
@@ -349,6 +355,16 @@ static inline void ssb_write32(struct ss
 	dev->ops->write32(dev, offset, value);
 }
 
+static inline u32 ssb_write32_masked(struct ssb_device *dev,
+                                     u16 offset,
+                                     u32 mask,
+                                     u32 value)
+{
+	value &= mask;
+	value |= ssb_read32(dev, offset) & ~mask;
+	ssb_write32(dev, offset, value);
+	return value;
+}
 
 /* Translation (routing) bits that need to be ORed to DMA
  * addresses before they are given to a device. */
Index: linux-2.6.23.16/drivers/ssb/driver_chipcommon.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/driver_chipcommon.c	2008-02-19 01:35:53.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_chipcommon.c	2008-02-19 02:01:16.000000000 +0100
@@ -351,21 +351,6 @@ void ssb_chipco_watchdog_timer_set(struc
 	chipco_write32(cc, SSB_CHIPCO_WATCHDOG, ticks);
 }
 
-u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask)
-{
-	return chipco_read32(cc, SSB_CHIPCO_GPIOIN) & mask;
-}
-
-void ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value)
-{
-	chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUT, mask, value);
-}
-
-void ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value)
-{
-	chipco_write32_masked(cc, SSB_CHIPCO_GPIOOUTEN, mask, value);
-}
-
 #ifdef CONFIG_SSB_SERIAL
 int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
 			   struct ssb_serial_port *ports)
Index: linux-2.6.23.16/drivers/ssb/driver_extif.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/driver_extif.c	2008-02-19 01:35:53.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_extif.c	2008-02-19 01:39:40.000000000 +0100
@@ -110,20 +110,4 @@ void ssb_extif_get_clockcontrol(struct s
 	*m = extif_read32(extif, SSB_EXTIF_CLOCK_SB);
 }
 
-u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask)
-{
-	return extif_read32(extif, SSB_EXTIF_GPIO_IN) & mask;
-}
-
-void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value)
-{
-	return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUT(0),
-				   mask, value);
-}
-
-void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value)
-{
-	return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUTEN(0),
-				   mask, value);
-}
 
Index: linux-2.6.23.16/include/linux/mod_devicetable.h
===================================================================
--- linux-2.6.23.16.orig/include/linux/mod_devicetable.h	2008-02-19 01:35:53.000000000 +0100
+++ linux-2.6.23.16/include/linux/mod_devicetable.h	2008-02-19 01:39:40.000000000 +0100
@@ -340,4 +340,19 @@ struct parisc_device_id {
 #define PA_HVERSION_ANY_ID	0xffff
 #define PA_SVERSION_ANY_ID	0xffffffff
 
+/* SSB core, see drivers/ssb/ */
+struct ssb_device_id {
+	__u16	vendor;
+	__u16	coreid;
+	__u8	revision;
+};
+#define SSB_DEVICE(_vendor, _coreid, _revision)  \
+	{ .vendor = _vendor, .coreid = _coreid, .revision = _revision, }
+#define SSB_DEVTABLE_END  \
+	{ 0, },
+
+#define SSB_ANY_VENDOR		0xFFFF
+#define SSB_ANY_ID		0xFFFF
+#define SSB_ANY_REV		0xFF
+
 #endif /* LINUX_MOD_DEVICETABLE_H */
Index: linux-2.6.23.16/drivers/ssb/main.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/main.c	2008-02-19 01:45:24.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/main.c	2008-02-19 02:01:16.000000000 +0100
@@ -321,14 +321,16 @@ static int ssb_bus_match(struct device *
 	return 0;
 }
 
-static int ssb_device_uevent(struct device *dev, struct kobj_uevent_env *env)
+static int ssb_device_uevent(struct device *dev, char **envp,
+			     int num_envp, char *buffer, int buffer_size)
 {
 	struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
+	int i = 0, len = 0;
 
 	if (!dev)
 		return -ENODEV;
 
-	return add_uevent_var(env,
+	return add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len,
 			     "MODALIAS=ssb:v%04Xid%04Xrev%02X",
 			     ssb_dev->id.vendor, ssb_dev->id.coreid,
 			     ssb_dev->id.revision);
Index: linux-2.6.23.16/drivers/ssb/scan.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/scan.c	2008-02-16 19:08:13.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/scan.c	2008-02-19 01:56:02.000000000 +0100
@@ -391,12 +391,14 @@ int ssb_bus_scan(struct ssb_bus *bus,
 			if (bus->bustype == SSB_BUSTYPE_PCI) {
 				/* Ignore PCI cores on PCI-E cards.
 				 * Ignore PCI-E cores on PCI cards. */
+				//FIXME kernel 2.6.23 doesn't have is_pcie. Add this check back when updating to 2.6.24 or later.
 				if (dev->id.coreid == SSB_DEV_PCI) {
-					if (bus->host_pci->is_pcie)
-						continue;
+//FIXME					if (bus->host_pci->is_pcie)
+//FIXME						continue;
 				} else {
-					if (!bus->host_pci->is_pcie)
-						continue;
+					continue; //FIXME
+//FIXME					if (!bus->host_pci->is_pcie)
+//FIXME						continue;
 				}
 			}
 			if (bus->pcicore.dev) {
Index: linux-2.6.23.16/drivers/ssb/driver_pcicore.c
===================================================================
--- linux-2.6.23.16.orig/drivers/ssb/driver_pcicore.c	2008-02-19 02:01:11.000000000 +0100
+++ linux-2.6.23.16/drivers/ssb/driver_pcicore.c	2008-02-19 02:01:32.000000000 +0100
@@ -362,7 +362,7 @@ static int pcicore_is_in_hostmode(struct
 	    chipid_top != 0x5300)
 		return 0;
 
-	if (bus->sprom.r1.boardflags_lo & SSB_PCICORE_BFL_NOPCI)
+	if (bus->sprom.boardflags_lo & SSB_PCICORE_BFL_NOPCI)
 		return 0;
 
 	/* The 200-pin BCM4712 package does not bond out PCI. Even when