diff options
author | Vitaly Bordug <vbordug@ru.mvista.com> | 2006-10-02 14:41:50 -0400 |
---|---|---|
committer | Vitaly Bordug <vbordug@ru.mvista.com> | 2006-10-03 13:36:00 -0400 |
commit | ed943c1faba53d9a0bde56007ee27762b29dccbd (patch) | |
tree | 3749e45c7ecc20a134b4d9230d21108c1b102fc8 /arch/powerpc/sysdev/fsl_soc.c | |
parent | e02f73e9fd69f1c6d16c207f7a91ce721fe8beab (diff) |
POWERPC: 8272ads merge to powerpc: common stuff
This has modules of common directories related to the
mpc8272ADS board, mainly common cpm2 changes and fsl_soc.c
portions related to the bitbang MDIO and other mechanisms specific
for this family.
Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>
Diffstat (limited to 'arch/powerpc/sysdev/fsl_soc.c')
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.c | 62 |
1 files changed, 55 insertions, 7 deletions
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 022ed275ea68..7d759f1c26b1 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <asm/cpm2.h> | 37 | #include <asm/cpm2.h> |
38 | 38 | ||
39 | extern void init_fcc_ioports(struct fs_platform_info*); | 39 | extern void init_fcc_ioports(struct fs_platform_info*); |
40 | extern void init_scc_ioports(struct fs_uart_platform_info*); | ||
40 | static phys_addr_t immrbase = -1; | 41 | static phys_addr_t immrbase = -1; |
41 | 42 | ||
42 | phys_addr_t get_immrbase(void) | 43 | phys_addr_t get_immrbase(void) |
@@ -566,7 +567,7 @@ static int __init fs_enet_of_init(void) | |||
566 | struct resource r[4]; | 567 | struct resource r[4]; |
567 | struct device_node *phy, *mdio; | 568 | struct device_node *phy, *mdio; |
568 | struct fs_platform_info fs_enet_data; | 569 | struct fs_platform_info fs_enet_data; |
569 | const unsigned int *id, *phy_addr; | 570 | const unsigned int *id, *phy_addr, phy_irq; |
570 | const void *mac_addr; | 571 | const void *mac_addr; |
571 | const phandle *ph; | 572 | const phandle *ph; |
572 | const char *model; | 573 | const char *model; |
@@ -588,6 +589,7 @@ static int __init fs_enet_of_init(void) | |||
588 | if (ret) | 589 | if (ret) |
589 | goto err; | 590 | goto err; |
590 | r[2].name = fcc_regs_c; | 591 | r[2].name = fcc_regs_c; |
592 | fs_enet_data.fcc_regs_c = r[2].start; | ||
591 | 593 | ||
592 | r[3].start = r[3].end = irq_of_parse_and_map(np, 0); | 594 | r[3].start = r[3].end = irq_of_parse_and_map(np, 0); |
593 | r[3].flags = IORESOURCE_IRQ; | 595 | r[3].flags = IORESOURCE_IRQ; |
@@ -620,6 +622,8 @@ static int __init fs_enet_of_init(void) | |||
620 | phy_addr = get_property(phy, "reg", NULL); | 622 | phy_addr = get_property(phy, "reg", NULL); |
621 | fs_enet_data.phy_addr = *phy_addr; | 623 | fs_enet_data.phy_addr = *phy_addr; |
622 | 624 | ||
625 | phy_irq = get_property(phy, "interrupts", NULL); | ||
626 | |||
623 | id = get_property(np, "device-id", NULL); | 627 | id = get_property(np, "device-id", NULL); |
624 | fs_enet_data.fs_no = *id; | 628 | fs_enet_data.fs_no = *id; |
625 | strcpy(fs_enet_data.fs_type, model); | 629 | strcpy(fs_enet_data.fs_type, model); |
@@ -637,6 +641,7 @@ static int __init fs_enet_of_init(void) | |||
637 | 641 | ||
638 | if (strstr(model, "FCC")) { | 642 | if (strstr(model, "FCC")) { |
639 | int fcc_index = *id - 1; | 643 | int fcc_index = *id - 1; |
644 | unsigned char* mdio_bb_prop; | ||
640 | 645 | ||
641 | fs_enet_data.dpram_offset = (u32)cpm_dpram_addr(0); | 646 | fs_enet_data.dpram_offset = (u32)cpm_dpram_addr(0); |
642 | fs_enet_data.rx_ring = 32; | 647 | fs_enet_data.rx_ring = 32; |
@@ -652,14 +657,57 @@ static int __init fs_enet_of_init(void) | |||
652 | (u32)res.start, fs_enet_data.phy_addr); | 657 | (u32)res.start, fs_enet_data.phy_addr); |
653 | fs_enet_data.bus_id = (char*)&bus_id[(*id)]; | 658 | fs_enet_data.bus_id = (char*)&bus_id[(*id)]; |
654 | fs_enet_data.init_ioports = init_fcc_ioports; | 659 | fs_enet_data.init_ioports = init_fcc_ioports; |
655 | } | ||
656 | 660 | ||
657 | of_node_put(phy); | 661 | mdio_bb_prop = get_property(phy, "bitbang", NULL); |
658 | of_node_put(mdio); | 662 | if (mdio_bb_prop) { |
663 | struct platform_device *fs_enet_mdio_bb_dev; | ||
664 | struct fs_mii_bb_platform_info fs_enet_mdio_bb_data; | ||
665 | |||
666 | fs_enet_mdio_bb_dev = | ||
667 | platform_device_register_simple("fsl-bb-mdio", | ||
668 | i, NULL, 0); | ||
669 | memset(&fs_enet_mdio_bb_data, 0, | ||
670 | sizeof(struct fs_mii_bb_platform_info)); | ||
671 | fs_enet_mdio_bb_data.mdio_dat.bit = | ||
672 | mdio_bb_prop[0]; | ||
673 | fs_enet_mdio_bb_data.mdio_dir.bit = | ||
674 | mdio_bb_prop[1]; | ||
675 | fs_enet_mdio_bb_data.mdc_dat.bit = | ||
676 | mdio_bb_prop[2]; | ||
677 | fs_enet_mdio_bb_data.mdio_port = | ||
678 | mdio_bb_prop[3]; | ||
679 | fs_enet_mdio_bb_data.mdc_port = | ||
680 | mdio_bb_prop[4]; | ||
681 | fs_enet_mdio_bb_data.delay = | ||
682 | mdio_bb_prop[5]; | ||
683 | |||
684 | fs_enet_mdio_bb_data.irq[0] = phy_irq[0]; | ||
685 | fs_enet_mdio_bb_data.irq[1] = -1; | ||
686 | fs_enet_mdio_bb_data.irq[2] = -1; | ||
687 | fs_enet_mdio_bb_data.irq[3] = phy_irq[0]; | ||
688 | fs_enet_mdio_bb_data.irq[31] = -1; | ||
689 | |||
690 | fs_enet_mdio_bb_data.mdio_dat.offset = | ||
691 | (u32)&cpm2_immr->im_ioport.iop_pdatc; | ||
692 | fs_enet_mdio_bb_data.mdio_dir.offset = | ||
693 | (u32)&cpm2_immr->im_ioport.iop_pdirc; | ||
694 | fs_enet_mdio_bb_data.mdc_dat.offset = | ||
695 | (u32)&cpm2_immr->im_ioport.iop_pdatc; | ||
696 | |||
697 | ret = platform_device_add_data( | ||
698 | fs_enet_mdio_bb_dev, | ||
699 | &fs_enet_mdio_bb_data, | ||
700 | sizeof(struct fs_mii_bb_platform_info)); | ||
701 | if (ret) | ||
702 | goto unreg; | ||
703 | } | ||
704 | |||
705 | of_node_put(phy); | ||
706 | of_node_put(mdio); | ||
659 | 707 | ||
660 | ret = platform_device_add_data(fs_enet_dev, &fs_enet_data, | 708 | ret = platform_device_add_data(fs_enet_dev, &fs_enet_data, |
661 | sizeof(struct | 709 | sizeof(struct |
662 | fs_platform_info)); | 710 | fs_platform_info)); |
663 | if (ret) | 711 | if (ret) |
664 | goto unreg; | 712 | goto unreg; |
665 | } | 713 | } |