aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2008-01-24 10:40:07 -0500
committerKumar Gala <galak@kernel.crashing.org>2008-01-28 09:32:58 -0500
commitf3a2b29d932fbf92e133d814c4873fd15be51abc (patch)
treedf6c2c960540b0f648d2ae3e3648111d500b97c0 /arch/powerpc
parent59a0ea5091d309fa8338954b84cf5307dbd83ec9 (diff)
[POWERPC] fsl_spi: stop using device_type = "spi"
Also: - rename "fsl_spi" to "fsl,spi"; - add and use cell-index property, if found; - split probing code out of fsl_spi_init, thus we can call it for legacy device_type probing and new "compatible" probing. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/boot/dts/mpc8313erdb.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc832x_mds.dts8
-rw-r--r--arch/powerpc/boot/dts/mpc832x_rdb.dts8
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitx.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitxgp.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc834x_mds.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc836x_mds.dts8
-rw-r--r--arch/powerpc/boot/dts/mpc8377_mds.dts3
-rw-r--r--arch/powerpc/boot/dts/mpc8378_mds.dts3
-rw-r--r--arch/powerpc/boot/dts/mpc8379_mds.dts3
-rw-r--r--arch/powerpc/boot/dts/mpc8568mds.dts8
-rw-r--r--arch/powerpc/boot/dts/sbc8349.dts3
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c98
13 files changed, 92 insertions, 66 deletions
diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts b/arch/powerpc/boot/dts/mpc8313erdb.dts
index 9bcf2c92541f..20a03f5b5bb7 100644
--- a/arch/powerpc/boot/dts/mpc8313erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8313erdb.dts
@@ -130,8 +130,8 @@
130 }; 130 };
131 131
132 spi@7000 { 132 spi@7000 {
133 device_type = "spi"; 133 cell-index = <0>;
134 compatible = "fsl_spi"; 134 compatible = "fsl,spi";
135 reg = <7000 1000>; 135 reg = <7000 1000>;
136 interrupts = <10 8>; 136 interrupts = <10 8>;
137 interrupt-parent = < &ipic >; 137 interrupt-parent = < &ipic >;
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index 1bb75ef389ff..15bb3459ff8a 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -223,8 +223,8 @@
223 }; 223 };
224 224
225 spi@4c0 { 225 spi@4c0 {
226 device_type = "spi"; 226 cell-index = <0>;
227 compatible = "fsl_spi"; 227 compatible = "fsl,spi";
228 reg = <4c0 40>; 228 reg = <4c0 40>;
229 interrupts = <2>; 229 interrupts = <2>;
230 interrupt-parent = < &qeic >; 230 interrupt-parent = < &qeic >;
@@ -232,8 +232,8 @@
232 }; 232 };
233 233
234 spi@500 { 234 spi@500 {
235 device_type = "spi"; 235 cell-index = <1>;
236 compatible = "fsl_spi"; 236 compatible = "fsl,spi";
237 reg = <500 40>; 237 reg = <500 40>;
238 interrupts = <1>; 238 interrupts = <1>;
239 interrupt-parent = < &qeic >; 239 interrupt-parent = < &qeic >;
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index f6a86336c8e0..f086fac59219 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -184,8 +184,8 @@
184 }; 184 };
185 185
186 spi@4c0 { 186 spi@4c0 {
187 device_type = "spi"; 187 cell-index = <0>;
188 compatible = "fsl_spi"; 188 compatible = "fsl,spi";
189 reg = <4c0 40>; 189 reg = <4c0 40>;
190 interrupts = <2>; 190 interrupts = <2>;
191 interrupt-parent = <&qeic>; 191 interrupt-parent = <&qeic>;
@@ -193,8 +193,8 @@
193 }; 193 };
194 194
195 spi@500 { 195 spi@500 {
196 device_type = "spi"; 196 cell-index = <1>;
197 compatible = "fsl_spi"; 197 compatible = "fsl,spi";
198 reg = <500 40>; 198 reg = <500 40>;
199 interrupts = <1>; 199 interrupts = <1>;
200 interrupt-parent = <&qeic>; 200 interrupt-parent = <&qeic>;
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
index 04b8da4deb60..4a4ddea2d99c 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -82,8 +82,8 @@
82 }; 82 };
83 83
84 spi@7000 { 84 spi@7000 {
85 device_type = "spi"; 85 cell-index = <0>;
86 compatible = "fsl_spi"; 86 compatible = "fsl,spi";
87 reg = <7000 1000>; 87 reg = <7000 1000>;
88 interrupts = <10 8>; 88 interrupts = <10 8>;
89 interrupt-parent = < &ipic >; 89 interrupt-parent = < &ipic >;
diff --git a/arch/powerpc/boot/dts/mpc8349emitxgp.dts b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
index a06ff92cf0b1..79983d74eee4 100644
--- a/arch/powerpc/boot/dts/mpc8349emitxgp.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
@@ -80,8 +80,8 @@
80 }; 80 };
81 81
82 spi@7000 { 82 spi@7000 {
83 device_type = "spi"; 83 cell-index = <0>;
84 compatible = "fsl_spi"; 84 compatible = "fsl,spi";
85 reg = <7000 1000>; 85 reg = <7000 1000>;
86 interrupts = <10 8>; 86 interrupts = <10 8>;
87 interrupt-parent = < &ipic >; 87 interrupt-parent = < &ipic >;
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts b/arch/powerpc/boot/dts/mpc834x_mds.dts
index d2c0e8ab8b7c..8faa8bd6ed64 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -95,8 +95,8 @@
95 }; 95 };
96 96
97 spi@7000 { 97 spi@7000 {
98 device_type = "spi"; 98 cell-index = <0>;
99 compatible = "fsl_spi"; 99 compatible = "fsl,spi";
100 reg = <0x7000 0x1000>; 100 reg = <0x7000 0x1000>;
101 interrupts = <16 8>; 101 interrupts = <16 8>;
102 interrupt-parent = <&ipic>; 102 interrupt-parent = <&ipic>;
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index fa98bdf0de8c..d3b8262df686 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -225,8 +225,8 @@
225 }; 225 };
226 226
227 spi@4c0 { 227 spi@4c0 {
228 device_type = "spi"; 228 cell-index = <0>;
229 compatible = "fsl_spi"; 229 compatible = "fsl,spi";
230 reg = <4c0 40>; 230 reg = <4c0 40>;
231 interrupts = <2>; 231 interrupts = <2>;
232 interrupt-parent = < &qeic >; 232 interrupt-parent = < &qeic >;
@@ -234,8 +234,8 @@
234 }; 234 };
235 235
236 spi@500 { 236 spi@500 {
237 device_type = "spi"; 237 cell-index = <1>;
238 compatible = "fsl_spi"; 238 compatible = "fsl,spi";
239 reg = <500 40>; 239 reg = <500 40>;
240 interrupts = <1>; 240 interrupts = <1>;
241 interrupt-parent = < &qeic >; 241 interrupt-parent = < &qeic >;
diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/boot/dts/mpc8377_mds.dts
index 98b46065f45a..3b9611f189e1 100644
--- a/arch/powerpc/boot/dts/mpc8377_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
@@ -83,7 +83,8 @@
83 }; 83 };
84 84
85 spi@7000 { 85 spi@7000 {
86 compatible = "fsl_spi"; 86 cell-index = <0>;
87 compatible = "fsl,spi";
87 reg = <0x7000 0x1000>; 88 reg = <0x7000 0x1000>;
88 interrupts = <0x10 0x8>; 89 interrupts = <0x10 0x8>;
89 interrupt-parent = < &ipic >; 90 interrupt-parent = < &ipic >;
diff --git a/arch/powerpc/boot/dts/mpc8378_mds.dts b/arch/powerpc/boot/dts/mpc8378_mds.dts
index c117a6a3a8e6..386f4a037b33 100644
--- a/arch/powerpc/boot/dts/mpc8378_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8378_mds.dts
@@ -83,7 +83,8 @@
83 }; 83 };
84 84
85 spi@7000 { 85 spi@7000 {
86 compatible = "fsl_spi"; 86 cell-index = <0>;
87 compatible = "fsl,spi";
87 reg = <0x7000 0x1000>; 88 reg = <0x7000 0x1000>;
88 interrupts = <0x10 0x8>; 89 interrupts = <0x10 0x8>;
89 interrupt-parent = < &ipic >; 90 interrupt-parent = < &ipic >;
diff --git a/arch/powerpc/boot/dts/mpc8379_mds.dts b/arch/powerpc/boot/dts/mpc8379_mds.dts
index fc3ba79fb684..da9931b6c5c0 100644
--- a/arch/powerpc/boot/dts/mpc8379_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8379_mds.dts
@@ -83,7 +83,8 @@
83 }; 83 };
84 84
85 spi@7000 { 85 spi@7000 {
86 compatible = "fsl_spi"; 86 cell-index = <0>;
87 compatible = "fsl,spi";
87 reg = <0x7000 0x1000>; 88 reg = <0x7000 0x1000>;
88 interrupts = <0x10 0x8>; 89 interrupts = <0x10 0x8>;
89 interrupt-parent = < &ipic >; 90 interrupt-parent = < &ipic >;
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index 692d5bd81e70..c929fba7f399 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -302,8 +302,8 @@
302 }; 302 };
303 303
304 spi@4c0 { 304 spi@4c0 {
305 device_type = "spi"; 305 cell-index = <0>;
306 compatible = "fsl_spi"; 306 compatible = "fsl,spi";
307 reg = <4c0 40>; 307 reg = <4c0 40>;
308 interrupts = <2>; 308 interrupts = <2>;
309 interrupt-parent = <&qeic>; 309 interrupt-parent = <&qeic>;
@@ -311,8 +311,8 @@
311 }; 311 };
312 312
313 spi@500 { 313 spi@500 {
314 device_type = "spi"; 314 cell-index = <1>;
315 compatible = "fsl_spi"; 315 compatible = "fsl,spi";
316 reg = <500 40>; 316 reg = <500 40>;
317 interrupts = <1>; 317 interrupts = <1>;
318 interrupt-parent = <&qeic>; 318 interrupt-parent = <&qeic>;
diff --git a/arch/powerpc/boot/dts/sbc8349.dts b/arch/powerpc/boot/dts/sbc8349.dts
index 9c13c1a99640..0934f54b2b43 100644
--- a/arch/powerpc/boot/dts/sbc8349.dts
+++ b/arch/powerpc/boot/dts/sbc8349.dts
@@ -87,7 +87,8 @@
87 }; 87 };
88 88
89 spi@7000 { 89 spi@7000 {
90 compatible = "fsl_spi"; 90 cell-index = <0>;
91 compatible = "fsl,spi";
91 reg = <0x7000 0x1000>; 92 reg = <0x7000 0x1000>;
92 interrupts = <0x10 0x8>; 93 interrupts = <0x10 0x8>;
93 interrupt-parent = <&ipic>; 94 interrupt-parent = <&ipic>;
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 6f81dd5eb6d4..e48b20e934ca 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -1276,44 +1276,17 @@ arch_initcall(cpm_smc_uart_of_init);
1276#endif /* CONFIG_8xx */ 1276#endif /* CONFIG_8xx */
1277#endif /* CONFIG_PPC_CPM_NEW_BINDING */ 1277#endif /* CONFIG_PPC_CPM_NEW_BINDING */
1278 1278
1279int __init fsl_spi_init(struct spi_board_info *board_infos, 1279static int __init of_fsl_spi_probe(char *type, char *compatible, u32 sysclk,
1280 unsigned int num_board_infos, 1280 struct spi_board_info *board_infos,
1281 void (*activate_cs)(u8 cs, u8 polarity), 1281 unsigned int num_board_infos,
1282 void (*deactivate_cs)(u8 cs, u8 polarity)) 1282 void (*activate_cs)(u8 cs, u8 polarity),
1283 void (*deactivate_cs)(u8 cs, u8 polarity))
1283{ 1284{
1284 struct device_node *np; 1285 struct device_node *np;
1285 unsigned int i; 1286 unsigned int i = 0;
1286 u32 sysclk = -1;
1287
1288 /* SPI controller is either clocked from QE or SoC clock */
1289#ifdef CONFIG_QUICC_ENGINE
1290 sysclk = get_brgfreq();
1291#endif
1292 if (sysclk == -1) {
1293 const u32 *freq;
1294 int size;
1295
1296 np = of_find_node_by_type(NULL, "soc");
1297 if (!np)
1298 return -ENODEV;
1299
1300 freq = of_get_property(np, "clock-frequency", &size);
1301 if (!freq || size != sizeof(*freq) || *freq == 0) {
1302 freq = of_get_property(np, "bus-frequency", &size);
1303 if (!freq || size != sizeof(*freq) || *freq == 0) {
1304 of_node_put(np);
1305 return -ENODEV;
1306 }
1307 }
1308
1309 sysclk = *freq;
1310 of_node_put(np);
1311 }
1312 1287
1313 for (np = NULL, i = 1; 1288 for_each_compatible_node(np, type, compatible) {
1314 (np = of_find_compatible_node(np, "spi", "fsl_spi")) != NULL; 1289 int ret;
1315 i++) {
1316 int ret = 0;
1317 unsigned int j; 1290 unsigned int j;
1318 const void *prop; 1291 const void *prop;
1319 struct resource res[2]; 1292 struct resource res[2];
@@ -1332,6 +1305,10 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
1332 goto err; 1305 goto err;
1333 pdata.bus_num = *(u32 *)prop; 1306 pdata.bus_num = *(u32 *)prop;
1334 1307
1308 prop = of_get_property(np, "cell-index", NULL);
1309 if (prop)
1310 i = *(u32 *)prop;
1311
1335 prop = of_get_property(np, "mode", NULL); 1312 prop = of_get_property(np, "mode", NULL);
1336 if (prop && !strcmp(prop, "cpu-qe")) 1313 if (prop && !strcmp(prop, "cpu-qe"))
1337 pdata.qe_mode = 1; 1314 pdata.qe_mode = 1;
@@ -1342,7 +1319,7 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
1342 } 1319 }
1343 1320
1344 if (!pdata.max_chipselect) 1321 if (!pdata.max_chipselect)
1345 goto err; 1322 continue;
1346 1323
1347 ret = of_address_to_resource(np, 0, &res[0]); 1324 ret = of_address_to_resource(np, 0, &res[0]);
1348 if (ret) 1325 if (ret)
@@ -1369,13 +1346,58 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
1369 if (ret) 1346 if (ret)
1370 goto unreg; 1347 goto unreg;
1371 1348
1372 continue; 1349 goto next;
1373unreg: 1350unreg:
1374 platform_device_del(pdev); 1351 platform_device_del(pdev);
1375err: 1352err:
1376 continue; 1353 pr_err("%s: registration failed\n", np->full_name);
1354next:
1355 i++;
1377 } 1356 }
1378 1357
1358 return i;
1359}
1360
1361int __init fsl_spi_init(struct spi_board_info *board_infos,
1362 unsigned int num_board_infos,
1363 void (*activate_cs)(u8 cs, u8 polarity),
1364 void (*deactivate_cs)(u8 cs, u8 polarity))
1365{
1366 u32 sysclk = -1;
1367 int ret;
1368
1369#ifdef CONFIG_QUICC_ENGINE
1370 /* SPI controller is either clocked from QE or SoC clock */
1371 sysclk = get_brgfreq();
1372#endif
1373 if (sysclk == -1) {
1374 struct device_node *np;
1375 const u32 *freq;
1376 int size;
1377
1378 np = of_find_node_by_type(NULL, "soc");
1379 if (!np)
1380 return -ENODEV;
1381
1382 freq = of_get_property(np, "clock-frequency", &size);
1383 if (!freq || size != sizeof(*freq) || *freq == 0) {
1384 freq = of_get_property(np, "bus-frequency", &size);
1385 if (!freq || size != sizeof(*freq) || *freq == 0) {
1386 of_node_put(np);
1387 return -ENODEV;
1388 }
1389 }
1390
1391 sysclk = *freq;
1392 of_node_put(np);
1393 }
1394
1395 ret = of_fsl_spi_probe(NULL, "fsl,spi", sysclk, board_infos,
1396 num_board_infos, activate_cs, deactivate_cs);
1397 if (!ret)
1398 of_fsl_spi_probe("spi", "fsl_spi", sysclk, board_infos,
1399 num_board_infos, activate_cs, deactivate_cs);
1400
1379 return spi_register_board_info(board_infos, num_board_infos); 1401 return spi_register_board_info(board_infos, num_board_infos);
1380} 1402}
1381 1403