aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r--arch/powerpc/sysdev/cpm1.c1
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c109
-rw-r--r--arch/powerpc/sysdev/fsl_soc.h7
3 files changed, 2 insertions, 115 deletions
diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c
index 490473ce810..82424cd7e12 100644
--- a/arch/powerpc/sysdev/cpm1.c
+++ b/arch/powerpc/sysdev/cpm1.c
@@ -119,7 +119,6 @@ static irqreturn_t cpm_error_interrupt(int irq, void *dev)
119 119
120static struct irqaction cpm_error_irqaction = { 120static struct irqaction cpm_error_irqaction = {
121 .handler = cpm_error_interrupt, 121 .handler = cpm_error_interrupt,
122 .mask = CPU_MASK_NONE,
123 .name = "error", 122 .name = "error",
124}; 123};
125 124
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index a01c89d3f9b..afe8dbc964a 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -417,115 +417,6 @@ err:
417 417
418arch_initcall(fsl_usb_of_init); 418arch_initcall(fsl_usb_of_init);
419 419
420static 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 (*activate_cs)(u8 cs, u8 polarity),
424 void (*deactivate_cs)(u8 cs, u8 polarity))
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 .activate_cs = activate_cs,
437 .deactivate_cs = deactivate_cs,
438 };
439
440 memset(res, 0, sizeof(res));
441
442 pdata.sysclk = sysclk;
443
444 prop = of_get_property(np, "reg", NULL);
445 if (!prop)
446 goto err;
447 pdata.bus_num = *(u32 *)prop;
448
449 prop = of_get_property(np, "cell-index", NULL);
450 if (prop)
451 i = *(u32 *)prop;
452
453 prop = of_get_property(np, "mode", NULL);
454 if (prop && !strcmp(prop, "cpu-qe"))
455 pdata.qe_mode = 1;
456
457 for (j = 0; j < num_board_infos; j++) {
458 if (board_infos[j].bus_num == pdata.bus_num)
459 pdata.max_chipselect++;
460 }
461
462 if (!pdata.max_chipselect)
463 continue;
464
465 ret = of_address_to_resource(np, 0, &res[0]);
466 if (ret)
467 goto err;
468
469 ret = of_irq_to_resource(np, 0, &res[1]);
470 if (ret == NO_IRQ)
471 goto err;
472
473 pdev = platform_device_alloc("mpc83xx_spi", i);
474 if (!pdev)
475 goto err;
476
477 ret = platform_device_add_data(pdev, &pdata, sizeof(pdata));
478 if (ret)
479 goto unreg;
480
481 ret = platform_device_add_resources(pdev, res,
482 ARRAY_SIZE(res));
483 if (ret)
484 goto unreg;
485
486 ret = platform_device_add(pdev);
487 if (ret)
488 goto unreg;
489
490 goto next;
491unreg:
492 platform_device_del(pdev);
493err:
494 pr_err("%s: registration failed\n", np->full_name);
495next:
496 i++;
497 }
498
499 return i;
500}
501
502int __init fsl_spi_init(struct spi_board_info *board_infos,
503 unsigned int num_board_infos,
504 void (*activate_cs)(u8 cs, u8 polarity),
505 void (*deactivate_cs)(u8 cs, u8 polarity))
506{
507 u32 sysclk = -1;
508 int ret;
509
510#ifdef CONFIG_QUICC_ENGINE
511 /* SPI controller is either clocked from QE or SoC clock */
512 sysclk = get_brgfreq();
513#endif
514 if (sysclk == -1) {
515 sysclk = fsl_get_sys_freq();
516 if (sysclk == -1)
517 return -ENODEV;
518 }
519
520 ret = of_fsl_spi_probe(NULL, "fsl,spi", sysclk, board_infos,
521 num_board_infos, activate_cs, deactivate_cs);
522 if (!ret)
523 of_fsl_spi_probe("spi", "fsl_spi", sysclk, board_infos,
524 num_board_infos, activate_cs, deactivate_cs);
525
526 return spi_register_board_info(board_infos, num_board_infos);
527}
528
529#if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx) 420#if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx)
530static __be32 __iomem *rstcr; 421static __be32 __iomem *rstcr;
531 422
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h
index 9c744e4285a..42381bb6cd5 100644
--- a/arch/powerpc/sysdev/fsl_soc.h
+++ b/arch/powerpc/sysdev/fsl_soc.h
@@ -4,6 +4,8 @@
4 4
5#include <asm/mmu.h> 5#include <asm/mmu.h>
6 6
7struct spi_device;
8
7extern phys_addr_t get_immrbase(void); 9extern phys_addr_t get_immrbase(void);
8#if defined(CONFIG_CPM2) || defined(CONFIG_QUICC_ENGINE) || defined(CONFIG_8xx) 10#if defined(CONFIG_CPM2) || defined(CONFIG_QUICC_ENGINE) || defined(CONFIG_8xx)
9extern u32 get_brgfreq(void); 11extern u32 get_brgfreq(void);
@@ -17,11 +19,6 @@ extern u32 fsl_get_sys_freq(void);
17struct spi_board_info; 19struct spi_board_info;
18struct device_node; 20struct device_node;
19 21
20extern int fsl_spi_init(struct spi_board_info *board_infos,
21 unsigned int num_board_infos,
22 void (*activate_cs)(u8 cs, u8 polarity),
23 void (*deactivate_cs)(u8 cs, u8 polarity));
24
25extern void fsl_rstcr_restart(char *cmd); 22extern void fsl_rstcr_restart(char *cmd);
26 23
27#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)