diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2009-03-31 18:24:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 11:59:23 -0400 |
commit | e2801806de1c9c1d03b7d1bfcb2e01dd4d389e80 (patch) | |
tree | db061987cacc20ba4962605188248b17c67a69c0 /arch/powerpc/sysdev | |
parent | 754582853120a9ec8b8293b5147b605b1c6a39f1 (diff) |
powerpc/fsl_soc: isolate legacy fsl_spi support to mpc832x_rdb boards
The advantages of this:
- Don't encourage legacy support;
- Less external symbols, less code to compile-in for !MPC832x_RDB
platforms.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: David Brownell <david-b@pacbell.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Kumar Gala <galak@gate.crashing.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.c | 107 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.h | 4 |
2 files changed, 0 insertions, 111 deletions
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index a46c1c867930..afe8dbc964aa 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
@@ -417,113 +417,6 @@ err: | |||
417 | 417 | ||
418 | arch_initcall(fsl_usb_of_init); | 418 | arch_initcall(fsl_usb_of_init); |
419 | 419 | ||
420 | static int __init of_fsl_spi_probe(char *type, char *compatible, u32 sysclk, | ||
421 | struct spi_board_info *board_infos, | ||
422 | unsigned int num_board_infos, | ||
423 | void (*cs_control)(struct spi_device *dev, | ||
424 | bool on)) | ||
425 | { | ||
426 | struct device_node *np; | ||
427 | unsigned int i = 0; | ||
428 | |||
429 | for_each_compatible_node(np, type, compatible) { | ||
430 | int ret; | ||
431 | unsigned int j; | ||
432 | const void *prop; | ||
433 | struct resource res[2]; | ||
434 | struct platform_device *pdev; | ||
435 | struct fsl_spi_platform_data pdata = { | ||
436 | .cs_control = cs_control, | ||
437 | }; | ||
438 | |||
439 | memset(res, 0, sizeof(res)); | ||
440 | |||
441 | pdata.sysclk = sysclk; | ||
442 | |||
443 | prop = of_get_property(np, "reg", NULL); | ||
444 | if (!prop) | ||
445 | goto err; | ||
446 | pdata.bus_num = *(u32 *)prop; | ||
447 | |||
448 | prop = of_get_property(np, "cell-index", NULL); | ||
449 | if (prop) | ||
450 | i = *(u32 *)prop; | ||
451 | |||
452 | prop = of_get_property(np, "mode", NULL); | ||
453 | if (prop && !strcmp(prop, "cpu-qe")) | ||
454 | pdata.qe_mode = 1; | ||
455 | |||
456 | for (j = 0; j < num_board_infos; j++) { | ||
457 | if (board_infos[j].bus_num == pdata.bus_num) | ||
458 | pdata.max_chipselect++; | ||
459 | } | ||
460 | |||
461 | if (!pdata.max_chipselect) | ||
462 | continue; | ||
463 | |||
464 | ret = of_address_to_resource(np, 0, &res[0]); | ||
465 | if (ret) | ||
466 | goto err; | ||
467 | |||
468 | ret = of_irq_to_resource(np, 0, &res[1]); | ||
469 | if (ret == NO_IRQ) | ||
470 | goto err; | ||
471 | |||
472 | pdev = platform_device_alloc("mpc83xx_spi", i); | ||
473 | if (!pdev) | ||
474 | goto err; | ||
475 | |||
476 | ret = platform_device_add_data(pdev, &pdata, sizeof(pdata)); | ||
477 | if (ret) | ||
478 | goto unreg; | ||
479 | |||
480 | ret = platform_device_add_resources(pdev, res, | ||
481 | ARRAY_SIZE(res)); | ||
482 | if (ret) | ||
483 | goto unreg; | ||
484 | |||
485 | ret = platform_device_add(pdev); | ||
486 | if (ret) | ||
487 | goto unreg; | ||
488 | |||
489 | goto next; | ||
490 | unreg: | ||
491 | platform_device_del(pdev); | ||
492 | err: | ||
493 | pr_err("%s: registration failed\n", np->full_name); | ||
494 | next: | ||
495 | i++; | ||
496 | } | ||
497 | |||
498 | return i; | ||
499 | } | ||
500 | |||
501 | int __init fsl_spi_init(struct spi_board_info *board_infos, | ||
502 | unsigned int num_board_infos, | ||
503 | void (*cs_control)(struct spi_device *spi, bool on)) | ||
504 | { | ||
505 | u32 sysclk = -1; | ||
506 | int ret; | ||
507 | |||
508 | #ifdef CONFIG_QUICC_ENGINE | ||
509 | /* SPI controller is either clocked from QE or SoC clock */ | ||
510 | sysclk = get_brgfreq(); | ||
511 | #endif | ||
512 | if (sysclk == -1) { | ||
513 | sysclk = fsl_get_sys_freq(); | ||
514 | if (sysclk == -1) | ||
515 | return -ENODEV; | ||
516 | } | ||
517 | |||
518 | ret = of_fsl_spi_probe(NULL, "fsl,spi", sysclk, board_infos, | ||
519 | num_board_infos, cs_control); | ||
520 | if (!ret) | ||
521 | of_fsl_spi_probe("spi", "fsl_spi", sysclk, board_infos, | ||
522 | num_board_infos, cs_control); | ||
523 | |||
524 | return spi_register_board_info(board_infos, num_board_infos); | ||
525 | } | ||
526 | |||
527 | #if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx) | 420 | #if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx) |
528 | static __be32 __iomem *rstcr; | 421 | static __be32 __iomem *rstcr; |
529 | 422 | ||
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h index b5f3456780b8..42381bb6cd51 100644 --- a/arch/powerpc/sysdev/fsl_soc.h +++ b/arch/powerpc/sysdev/fsl_soc.h | |||
@@ -19,10 +19,6 @@ extern u32 fsl_get_sys_freq(void); | |||
19 | struct spi_board_info; | 19 | struct spi_board_info; |
20 | struct device_node; | 20 | struct device_node; |
21 | 21 | ||
22 | extern int fsl_spi_init(struct spi_board_info *board_infos, | ||
23 | unsigned int num_board_infos, | ||
24 | void (*cs_control)(struct spi_device *spi, bool on)); | ||
25 | |||
26 | extern void fsl_rstcr_restart(char *cmd); | 22 | extern void fsl_rstcr_restart(char *cmd); |
27 | 23 | ||
28 | #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) | 24 | #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) |