diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 18:50:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 18:50:49 -0400 |
commit | 9a64388d83f6ef08dfff405a9d122e3dbcb6bf38 (patch) | |
tree | a77532ce4d6d56be6c6c7f405cd901a0184250fb /arch/powerpc/sysdev/mv64x60_dev.c | |
parent | e80ab411e589e00550e2e6e5a6a02d59cc730357 (diff) | |
parent | 14b3ca4022f050f8622ed282b734ddf445464583 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (202 commits)
[POWERPC] Fix compile breakage for 64-bit UP configs
[POWERPC] Define copy_siginfo_from_user32
[POWERPC] Add compat handler for PTRACE_GETSIGINFO
[POWERPC] i2c: Fix build breakage introduced by OF helpers
[POWERPC] Optimize fls64() on 64-bit processors
[POWERPC] irqtrace support for 64-bit powerpc
[POWERPC] Stacktrace support for lockdep
[POWERPC] Move stackframe definitions to common header
[POWERPC] Fix device-tree locking vs. interrupts
[POWERPC] Make pci_bus_to_host()'s struct pci_bus * argument const
[POWERPC] Remove unused __max_memory variable
[POWERPC] Simplify xics direct/lpar irq_host setup
[POWERPC] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ()
[POWERPC] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade()
[POWERPC] Move xics_setup_8259_cascade() into platforms/pseries/setup.c
[POWERPC] Use asm-generic/bitops/find.h in bitops.h
[POWERPC] 83xx: mpc8315 - fix USB UTMI Host setup
[POWERPC] 85xx: Fix the size of qe muram for MPC8568E
[POWERPC] 86xx: mpc86xx_hpcn - Temporarily accept old dts node identifier.
[POWERPC] 86xx: mark functions static, other minor cleanups
...
Diffstat (limited to 'arch/powerpc/sysdev/mv64x60_dev.c')
-rw-r--r-- | arch/powerpc/sysdev/mv64x60_dev.c | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c index efda0028909d..047b31027fa6 100644 --- a/arch/powerpc/sysdev/mv64x60_dev.c +++ b/arch/powerpc/sysdev/mv64x60_dev.c | |||
@@ -127,7 +127,7 @@ static int __init mv64x60_mpsc_device_setup(struct device_node *np, int id) | |||
127 | if (err) | 127 | if (err) |
128 | return err; | 128 | return err; |
129 | 129 | ||
130 | prop = of_get_property(np, "block-index", NULL); | 130 | prop = of_get_property(np, "cell-index", NULL); |
131 | if (!prop) | 131 | if (!prop) |
132 | return -ENODEV; | 132 | return -ENODEV; |
133 | port_number = *(int *)prop; | 133 | port_number = *(int *)prop; |
@@ -136,6 +136,7 @@ static int __init mv64x60_mpsc_device_setup(struct device_node *np, int id) | |||
136 | 136 | ||
137 | pdata.cache_mgmt = 1; /* All current revs need this set */ | 137 | pdata.cache_mgmt = 1; /* All current revs need this set */ |
138 | 138 | ||
139 | pdata.max_idle = 40; /* default */ | ||
139 | prop = of_get_property(np, "max_idle", NULL); | 140 | prop = of_get_property(np, "max_idle", NULL); |
140 | if (prop) | 141 | if (prop) |
141 | pdata.max_idle = *prop; | 142 | pdata.max_idle = *prop; |
@@ -205,30 +206,24 @@ error: | |||
205 | /* | 206 | /* |
206 | * Create mv64x60_eth platform devices | 207 | * Create mv64x60_eth platform devices |
207 | */ | 208 | */ |
208 | static int __init eth_register_shared_pdev(struct device_node *np) | 209 | static struct platform_device * __init mv64x60_eth_register_shared_pdev( |
210 | struct device_node *np, int id) | ||
209 | { | 211 | { |
210 | struct platform_device *pdev; | 212 | struct platform_device *pdev; |
211 | struct resource r[1]; | 213 | struct resource r[1]; |
212 | int err; | 214 | int err; |
213 | 215 | ||
214 | np = of_get_parent(np); | ||
215 | if (!np) | ||
216 | return -ENODEV; | ||
217 | |||
218 | err = of_address_to_resource(np, 0, &r[0]); | 216 | err = of_address_to_resource(np, 0, &r[0]); |
219 | of_node_put(np); | ||
220 | if (err) | 217 | if (err) |
221 | return err; | 218 | return ERR_PTR(err); |
222 | 219 | ||
223 | pdev = platform_device_register_simple(MV643XX_ETH_SHARED_NAME, 0, | 220 | pdev = platform_device_register_simple(MV643XX_ETH_SHARED_NAME, id, |
224 | r, 1); | 221 | r, 1); |
225 | if (IS_ERR(pdev)) | 222 | return pdev; |
226 | return PTR_ERR(pdev); | ||
227 | |||
228 | return 0; | ||
229 | } | 223 | } |
230 | 224 | ||
231 | static int __init mv64x60_eth_device_setup(struct device_node *np, int id) | 225 | static int __init mv64x60_eth_device_setup(struct device_node *np, int id, |
226 | struct platform_device *shared_pdev) | ||
232 | { | 227 | { |
233 | struct resource r[1]; | 228 | struct resource r[1]; |
234 | struct mv643xx_eth_platform_data pdata; | 229 | struct mv643xx_eth_platform_data pdata; |
@@ -239,16 +234,12 @@ static int __init mv64x60_eth_device_setup(struct device_node *np, int id) | |||
239 | const phandle *ph; | 234 | const phandle *ph; |
240 | int err; | 235 | int err; |
241 | 236 | ||
242 | /* only register the shared platform device the first time through */ | ||
243 | if (id == 0 && (err = eth_register_shared_pdev(np))) | ||
244 | return err; | ||
245 | |||
246 | memset(r, 0, sizeof(r)); | 237 | memset(r, 0, sizeof(r)); |
247 | of_irq_to_resource(np, 0, &r[0]); | 238 | of_irq_to_resource(np, 0, &r[0]); |
248 | 239 | ||
249 | memset(&pdata, 0, sizeof(pdata)); | 240 | memset(&pdata, 0, sizeof(pdata)); |
250 | 241 | ||
251 | prop = of_get_property(np, "block-index", NULL); | 242 | prop = of_get_property(np, "reg", NULL); |
252 | if (!prop) | 243 | if (!prop) |
253 | return -ENODEV; | 244 | return -ENODEV; |
254 | pdata.port_number = *prop; | 245 | pdata.port_number = *prop; |
@@ -301,7 +292,7 @@ static int __init mv64x60_eth_device_setup(struct device_node *np, int id) | |||
301 | 292 | ||
302 | of_node_put(phy); | 293 | of_node_put(phy); |
303 | 294 | ||
304 | pdev = platform_device_alloc(MV643XX_ETH_NAME, pdata.port_number); | 295 | pdev = platform_device_alloc(MV643XX_ETH_NAME, id); |
305 | if (!pdev) | 296 | if (!pdev) |
306 | return -ENOMEM; | 297 | return -ENOMEM; |
307 | 298 | ||
@@ -345,21 +336,19 @@ static int __init mv64x60_i2c_device_setup(struct device_node *np, int id) | |||
345 | 336 | ||
346 | memset(&pdata, 0, sizeof(pdata)); | 337 | memset(&pdata, 0, sizeof(pdata)); |
347 | 338 | ||
339 | pdata.freq_m = 8; /* default */ | ||
348 | prop = of_get_property(np, "freq_m", NULL); | 340 | prop = of_get_property(np, "freq_m", NULL); |
349 | if (!prop) | 341 | if (!prop) |
350 | return -ENODEV; | 342 | return -ENODEV; |
351 | pdata.freq_m = *prop; | 343 | pdata.freq_m = *prop; |
352 | 344 | ||
345 | pdata.freq_m = 3; /* default */ | ||
353 | prop = of_get_property(np, "freq_n", NULL); | 346 | prop = of_get_property(np, "freq_n", NULL); |
354 | if (!prop) | 347 | if (!prop) |
355 | return -ENODEV; | 348 | return -ENODEV; |
356 | pdata.freq_n = *prop; | 349 | pdata.freq_n = *prop; |
357 | 350 | ||
358 | prop = of_get_property(np, "timeout", NULL); | 351 | pdata.timeout = 1000; /* default: 1 second */ |
359 | if (prop) | ||
360 | pdata.timeout = *prop; | ||
361 | else | ||
362 | pdata.timeout = 1000; /* 1 second */ | ||
363 | 352 | ||
364 | pdev = platform_device_alloc(MV64XXX_I2C_CTLR_NAME, id); | 353 | pdev = platform_device_alloc(MV64XXX_I2C_CTLR_NAME, id); |
365 | if (!pdev) | 354 | if (!pdev) |
@@ -401,10 +390,7 @@ static int __init mv64x60_wdt_device_setup(struct device_node *np, int id) | |||
401 | 390 | ||
402 | memset(&pdata, 0, sizeof(pdata)); | 391 | memset(&pdata, 0, sizeof(pdata)); |
403 | 392 | ||
404 | prop = of_get_property(np, "timeout", NULL); | 393 | pdata.timeout = 10; /* Default: 10 seconds */ |
405 | if (!prop) | ||
406 | return -ENODEV; | ||
407 | pdata.timeout = *prop; | ||
408 | 394 | ||
409 | np = of_get_parent(np); | 395 | np = of_get_parent(np); |
410 | if (!np) | 396 | if (!np) |
@@ -441,27 +427,43 @@ error: | |||
441 | 427 | ||
442 | static int __init mv64x60_device_setup(void) | 428 | static int __init mv64x60_device_setup(void) |
443 | { | 429 | { |
444 | struct device_node *np = NULL; | 430 | struct device_node *np, *np2; |
445 | int id; | 431 | struct platform_device *pdev; |
432 | int id, id2; | ||
446 | int err; | 433 | int err; |
447 | 434 | ||
448 | id = 0; | 435 | id = 0; |
449 | for_each_compatible_node(np, "serial", "marvell,mpsc") | 436 | for_each_compatible_node(np, "serial", "marvell,mv64360-mpsc") |
450 | if ((err = mv64x60_mpsc_device_setup(np, id++))) | 437 | if ((err = mv64x60_mpsc_device_setup(np, id++))) |
451 | goto error; | 438 | goto error; |
452 | 439 | ||
453 | id = 0; | 440 | id = 0; |
454 | for_each_compatible_node(np, "network", "marvell,mv64x60-eth") | 441 | id2 = 0; |
455 | if ((err = mv64x60_eth_device_setup(np, id++))) | 442 | for_each_compatible_node(np, NULL, "marvell,mv64360-eth-group") { |
443 | pdev = mv64x60_eth_register_shared_pdev(np, id++); | ||
444 | if (IS_ERR(pdev)) { | ||
445 | err = PTR_ERR(pdev); | ||
456 | goto error; | 446 | goto error; |
447 | } | ||
448 | for_each_child_of_node(np, np2) { | ||
449 | if (!of_device_is_compatible(np2, | ||
450 | "marvell,mv64360-eth")) | ||
451 | continue; | ||
452 | err = mv64x60_eth_device_setup(np2, id2++, pdev); | ||
453 | if (err) { | ||
454 | of_node_put(np2); | ||
455 | goto error; | ||
456 | } | ||
457 | } | ||
458 | } | ||
457 | 459 | ||
458 | id = 0; | 460 | id = 0; |
459 | for_each_compatible_node(np, "i2c", "marvell,mv64x60-i2c") | 461 | for_each_compatible_node(np, "i2c", "marvell,mv64360-i2c") |
460 | if ((err = mv64x60_i2c_device_setup(np, id++))) | 462 | if ((err = mv64x60_i2c_device_setup(np, id++))) |
461 | goto error; | 463 | goto error; |
462 | 464 | ||
463 | /* support up to one watchdog timer */ | 465 | /* support up to one watchdog timer */ |
464 | np = of_find_compatible_node(np, NULL, "marvell,mv64x60-wdt"); | 466 | np = of_find_compatible_node(np, NULL, "marvell,mv64360-wdt"); |
465 | if (np) { | 467 | if (np) { |
466 | if ((err = mv64x60_wdt_device_setup(np, id))) | 468 | if ((err = mv64x60_wdt_device_setup(np, id))) |
467 | goto error; | 469 | goto error; |
@@ -489,10 +491,10 @@ static int __init mv64x60_add_mpsc_console(void) | |||
489 | if (!np) | 491 | if (!np) |
490 | goto not_mpsc; | 492 | goto not_mpsc; |
491 | 493 | ||
492 | if (!of_device_is_compatible(np, "marvell,mpsc")) | 494 | if (!of_device_is_compatible(np, "marvell,mv64360-mpsc")) |
493 | goto not_mpsc; | 495 | goto not_mpsc; |
494 | 496 | ||
495 | prop = of_get_property(np, "block-index", NULL); | 497 | prop = of_get_property(np, "cell-index", NULL); |
496 | if (!prop) | 498 | if (!prop) |
497 | goto not_mpsc; | 499 | goto not_mpsc; |
498 | 500 | ||