aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/fsl_soc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:50:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:50:49 -0400
commit9a64388d83f6ef08dfff405a9d122e3dbcb6bf38 (patch)
treea77532ce4d6d56be6c6c7f405cd901a0184250fb /arch/powerpc/sysdev/fsl_soc.c
parente80ab411e589e00550e2e6e5a6a02d59cc730357 (diff)
parent14b3ca4022f050f8622ed282b734ddf445464583 (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/fsl_soc.c')
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c611
1 files changed, 32 insertions, 579 deletions
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 3581416905ea..5c1b246aaccc 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -75,6 +75,33 @@ phys_addr_t get_immrbase(void)
75 75
76EXPORT_SYMBOL(get_immrbase); 76EXPORT_SYMBOL(get_immrbase);
77 77
78static u32 sysfreq = -1;
79
80u32 fsl_get_sys_freq(void)
81{
82 struct device_node *soc;
83 const u32 *prop;
84 int size;
85
86 if (sysfreq != -1)
87 return sysfreq;
88
89 soc = of_find_node_by_type(NULL, "soc");
90 if (!soc)
91 return -1;
92
93 prop = of_get_property(soc, "clock-frequency", &size);
94 if (!prop || size != sizeof(*prop) || *prop == 0)
95 prop = of_get_property(soc, "bus-frequency", &size);
96
97 if (prop && size == sizeof(*prop))
98 sysfreq = *prop;
99
100 of_node_put(soc);
101 return sysfreq;
102}
103EXPORT_SYMBOL(fsl_get_sys_freq);
104
78#if defined(CONFIG_CPM2) || defined(CONFIG_QUICC_ENGINE) || defined(CONFIG_8xx) 105#if defined(CONFIG_CPM2) || defined(CONFIG_QUICC_ENGINE) || defined(CONFIG_8xx)
79 106
80static u32 brgfreq = -1; 107static u32 brgfreq = -1;
@@ -517,9 +544,9 @@ arch_initcall(fsl_i2c_of_init);
517static int __init mpc83xx_wdt_init(void) 544static int __init mpc83xx_wdt_init(void)
518{ 545{
519 struct resource r; 546 struct resource r;
520 struct device_node *soc, *np; 547 struct device_node *np;
521 struct platform_device *dev; 548 struct platform_device *dev;
522 const unsigned int *freq; 549 u32 freq = fsl_get_sys_freq();
523 int ret; 550 int ret;
524 551
525 np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt"); 552 np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt");
@@ -529,19 +556,6 @@ static int __init mpc83xx_wdt_init(void)
529 goto nodev; 556 goto nodev;
530 } 557 }
531 558
532 soc = of_find_node_by_type(NULL, "soc");
533
534 if (!soc) {
535 ret = -ENODEV;
536 goto nosoc;
537 }
538
539 freq = of_get_property(soc, "bus-frequency", NULL);
540 if (!freq) {
541 ret = -ENODEV;
542 goto err;
543 }
544
545 memset(&r, 0, sizeof(r)); 559 memset(&r, 0, sizeof(r));
546 560
547 ret = of_address_to_resource(np, 0, &r); 561 ret = of_address_to_resource(np, 0, &r);
@@ -554,20 +568,16 @@ static int __init mpc83xx_wdt_init(void)
554 goto err; 568 goto err;
555 } 569 }
556 570
557 ret = platform_device_add_data(dev, freq, sizeof(int)); 571 ret = platform_device_add_data(dev, &freq, sizeof(freq));
558 if (ret) 572 if (ret)
559 goto unreg; 573 goto unreg;
560 574
561 of_node_put(soc);
562 of_node_put(np); 575 of_node_put(np);
563
564 return 0; 576 return 0;
565 577
566unreg: 578unreg:
567 platform_device_unregister(dev); 579 platform_device_unregister(dev);
568err: 580err:
569 of_node_put(soc);
570nosoc:
571 of_node_put(np); 581 of_node_put(np);
572nodev: 582nodev:
573 return ret; 583 return ret;
@@ -736,547 +746,6 @@ err:
736 746
737arch_initcall(fsl_usb_of_init); 747arch_initcall(fsl_usb_of_init);
738 748
739#ifndef CONFIG_PPC_CPM_NEW_BINDING
740#ifdef CONFIG_CPM2
741
742extern void init_scc_ioports(struct fs_uart_platform_info*);
743
744static const char fcc_regs[] = "fcc_regs";
745static const char fcc_regs_c[] = "fcc_regs_c";
746static const char fcc_pram[] = "fcc_pram";
747static char bus_id[9][BUS_ID_SIZE];
748
749static int __init fs_enet_of_init(void)
750{
751 struct device_node *np;
752 unsigned int i;
753 struct platform_device *fs_enet_dev;
754 struct resource res;
755 int ret;
756
757 for (np = NULL, i = 0;
758 (np = of_find_compatible_node(np, "network", "fs_enet")) != NULL;
759 i++) {
760 struct resource r[4];
761 struct device_node *phy, *mdio;
762 struct fs_platform_info fs_enet_data;
763 const unsigned int *id, *phy_addr, *phy_irq;
764 const void *mac_addr;
765 const phandle *ph;
766 const char *model;
767
768 memset(r, 0, sizeof(r));
769 memset(&fs_enet_data, 0, sizeof(fs_enet_data));
770
771 ret = of_address_to_resource(np, 0, &r[0]);
772 if (ret)
773 goto err;
774 r[0].name = fcc_regs;
775
776 ret = of_address_to_resource(np, 1, &r[1]);
777 if (ret)
778 goto err;
779 r[1].name = fcc_pram;
780
781 ret = of_address_to_resource(np, 2, &r[2]);
782 if (ret)
783 goto err;
784 r[2].name = fcc_regs_c;
785 fs_enet_data.fcc_regs_c = r[2].start;
786
787 of_irq_to_resource(np, 0, &r[3]);
788
789 fs_enet_dev =
790 platform_device_register_simple("fsl-cpm-fcc", i, &r[0], 4);
791
792 if (IS_ERR(fs_enet_dev)) {
793 ret = PTR_ERR(fs_enet_dev);
794 goto err;
795 }
796
797 model = of_get_property(np, "model", NULL);
798 if (model == NULL) {
799 ret = -ENODEV;
800 goto unreg;
801 }
802
803 mac_addr = of_get_mac_address(np);
804 if (mac_addr)
805 memcpy(fs_enet_data.macaddr, mac_addr, 6);
806
807 ph = of_get_property(np, "phy-handle", NULL);
808 phy = of_find_node_by_phandle(*ph);
809
810 if (phy == NULL) {
811 ret = -ENODEV;
812 goto unreg;
813 }
814
815 phy_addr = of_get_property(phy, "reg", NULL);
816 fs_enet_data.phy_addr = *phy_addr;
817
818 phy_irq = of_get_property(phy, "interrupts", NULL);
819
820 id = of_get_property(np, "device-id", NULL);
821 fs_enet_data.fs_no = *id;
822 strcpy(fs_enet_data.fs_type, model);
823
824 mdio = of_get_parent(phy);
825 ret = of_address_to_resource(mdio, 0, &res);
826 if (ret) {
827 of_node_put(phy);
828 of_node_put(mdio);
829 goto unreg;
830 }
831
832 fs_enet_data.clk_rx = *((u32 *)of_get_property(np,
833 "rx-clock", NULL));
834 fs_enet_data.clk_tx = *((u32 *)of_get_property(np,
835 "tx-clock", NULL));
836
837 if (strstr(model, "FCC")) {
838 int fcc_index = *id - 1;
839 const unsigned char *mdio_bb_prop;
840
841 fs_enet_data.dpram_offset = (u32)cpm_dpram_addr(0);
842 fs_enet_data.rx_ring = 32;
843 fs_enet_data.tx_ring = 32;
844 fs_enet_data.rx_copybreak = 240;
845 fs_enet_data.use_napi = 0;
846 fs_enet_data.napi_weight = 17;
847 fs_enet_data.mem_offset = FCC_MEM_OFFSET(fcc_index);
848 fs_enet_data.cp_page = CPM_CR_FCC_PAGE(fcc_index);
849 fs_enet_data.cp_block = CPM_CR_FCC_SBLOCK(fcc_index);
850
851 snprintf((char*)&bus_id[(*id)], BUS_ID_SIZE, "%x:%02x",
852 (u32)res.start, fs_enet_data.phy_addr);
853 fs_enet_data.bus_id = (char*)&bus_id[(*id)];
854 fs_enet_data.init_ioports = init_fcc_ioports;
855
856 mdio_bb_prop = of_get_property(phy, "bitbang", NULL);
857 if (mdio_bb_prop) {
858 struct platform_device *fs_enet_mdio_bb_dev;
859 struct fs_mii_bb_platform_info fs_enet_mdio_bb_data;
860
861 fs_enet_mdio_bb_dev =
862 platform_device_register_simple("fsl-bb-mdio",
863 i, NULL, 0);
864 memset(&fs_enet_mdio_bb_data, 0,
865 sizeof(struct fs_mii_bb_platform_info));
866 fs_enet_mdio_bb_data.mdio_dat.bit =
867 mdio_bb_prop[0];
868 fs_enet_mdio_bb_data.mdio_dir.bit =
869 mdio_bb_prop[1];
870 fs_enet_mdio_bb_data.mdc_dat.bit =
871 mdio_bb_prop[2];
872 fs_enet_mdio_bb_data.mdio_port =
873 mdio_bb_prop[3];
874 fs_enet_mdio_bb_data.mdc_port =
875 mdio_bb_prop[4];
876 fs_enet_mdio_bb_data.delay =
877 mdio_bb_prop[5];
878
879 fs_enet_mdio_bb_data.irq[0] = phy_irq[0];
880 fs_enet_mdio_bb_data.irq[1] = -1;
881 fs_enet_mdio_bb_data.irq[2] = -1;
882 fs_enet_mdio_bb_data.irq[3] = phy_irq[0];
883 fs_enet_mdio_bb_data.irq[31] = -1;
884
885 fs_enet_mdio_bb_data.mdio_dat.offset =
886 (u32)&cpm2_immr->im_ioport.iop_pdatc;
887 fs_enet_mdio_bb_data.mdio_dir.offset =
888 (u32)&cpm2_immr->im_ioport.iop_pdirc;
889 fs_enet_mdio_bb_data.mdc_dat.offset =
890 (u32)&cpm2_immr->im_ioport.iop_pdatc;
891
892 ret = platform_device_add_data(
893 fs_enet_mdio_bb_dev,
894 &fs_enet_mdio_bb_data,
895 sizeof(struct fs_mii_bb_platform_info));
896 if (ret)
897 goto unreg;
898 }
899
900 of_node_put(phy);
901 of_node_put(mdio);
902
903 ret = platform_device_add_data(fs_enet_dev, &fs_enet_data,
904 sizeof(struct
905 fs_platform_info));
906 if (ret)
907 goto unreg;
908 }
909 }
910 return 0;
911
912unreg:
913 platform_device_unregister(fs_enet_dev);
914err:
915 return ret;
916}
917
918arch_initcall(fs_enet_of_init);
919
920static const char scc_regs[] = "regs";
921static const char scc_pram[] = "pram";
922
923static int __init cpm_uart_of_init(void)
924{
925 struct device_node *np;
926 unsigned int i;
927 struct platform_device *cpm_uart_dev;
928 int ret;
929
930 for (np = NULL, i = 0;
931 (np = of_find_compatible_node(np, "serial", "cpm_uart")) != NULL;
932 i++) {
933 struct resource r[3];
934 struct fs_uart_platform_info cpm_uart_data;
935 const int *id;
936 const char *model;
937
938 memset(r, 0, sizeof(r));
939 memset(&cpm_uart_data, 0, sizeof(cpm_uart_data));
940
941 ret = of_address_to_resource(np, 0, &r[0]);
942 if (ret)
943 goto err;
944
945 r[0].name = scc_regs;
946
947 ret = of_address_to_resource(np, 1, &r[1]);
948 if (ret)
949 goto err;
950 r[1].name = scc_pram;
951
952 of_irq_to_resource(np, 0, &r[2]);
953
954 cpm_uart_dev =
955 platform_device_register_simple("fsl-cpm-scc:uart", i, &r[0], 3);
956
957 if (IS_ERR(cpm_uart_dev)) {
958 ret = PTR_ERR(cpm_uart_dev);
959 goto err;
960 }
961
962 id = of_get_property(np, "device-id", NULL);
963 cpm_uart_data.fs_no = *id;
964
965 model = of_get_property(np, "model", NULL);
966 strcpy(cpm_uart_data.fs_type, model);
967
968 cpm_uart_data.uart_clk = ppc_proc_freq;
969
970 cpm_uart_data.tx_num_fifo = 4;
971 cpm_uart_data.tx_buf_size = 32;
972 cpm_uart_data.rx_num_fifo = 4;
973 cpm_uart_data.rx_buf_size = 32;
974 cpm_uart_data.clk_rx = *((u32 *)of_get_property(np,
975 "rx-clock", NULL));
976 cpm_uart_data.clk_tx = *((u32 *)of_get_property(np,
977 "tx-clock", NULL));
978
979 ret =
980 platform_device_add_data(cpm_uart_dev, &cpm_uart_data,
981 sizeof(struct
982 fs_uart_platform_info));
983 if (ret)
984 goto unreg;
985 }
986
987 return 0;
988
989unreg:
990 platform_device_unregister(cpm_uart_dev);
991err:
992 return ret;
993}
994
995arch_initcall(cpm_uart_of_init);
996#endif /* CONFIG_CPM2 */
997
998#ifdef CONFIG_8xx
999
1000extern void init_scc_ioports(struct fs_platform_info*);
1001extern int platform_device_skip(const char *model, int id);
1002
1003static int __init fs_enet_mdio_of_init(void)
1004{
1005 struct device_node *np;
1006 unsigned int i;
1007 struct platform_device *mdio_dev;
1008 struct resource res;
1009 int ret;
1010
1011 for (np = NULL, i = 0;
1012 (np = of_find_compatible_node(np, "mdio", "fs_enet")) != NULL;
1013 i++) {
1014 struct fs_mii_fec_platform_info mdio_data;
1015
1016 memset(&res, 0, sizeof(res));
1017 memset(&mdio_data, 0, sizeof(mdio_data));
1018
1019 ret = of_address_to_resource(np, 0, &res);
1020 if (ret)
1021 goto err;
1022
1023 mdio_dev =
1024 platform_device_register_simple("fsl-cpm-fec-mdio",
1025 res.start, &res, 1);
1026 if (IS_ERR(mdio_dev)) {
1027 ret = PTR_ERR(mdio_dev);
1028 goto err;
1029 }
1030
1031 mdio_data.mii_speed = ((((ppc_proc_freq + 4999999) / 2500000) / 2) & 0x3F) << 1;
1032
1033 ret =
1034 platform_device_add_data(mdio_dev, &mdio_data,
1035 sizeof(struct fs_mii_fec_platform_info));
1036 if (ret)
1037 goto unreg;
1038 }
1039 return 0;
1040
1041unreg:
1042 platform_device_unregister(mdio_dev);
1043err:
1044 return ret;
1045}
1046
1047arch_initcall(fs_enet_mdio_of_init);
1048
1049static const char *enet_regs = "regs";
1050static const char *enet_pram = "pram";
1051static const char *enet_irq = "interrupt";
1052static char bus_id[9][BUS_ID_SIZE];
1053
1054static int __init fs_enet_of_init(void)
1055{
1056 struct device_node *np;
1057 unsigned int i;
1058 struct platform_device *fs_enet_dev = NULL;
1059 struct resource res;
1060 int ret;
1061
1062 for (np = NULL, i = 0;
1063 (np = of_find_compatible_node(np, "network", "fs_enet")) != NULL;
1064 i++) {
1065 struct resource r[4];
1066 struct device_node *phy = NULL, *mdio = NULL;
1067 struct fs_platform_info fs_enet_data;
1068 const unsigned int *id;
1069 const unsigned int *phy_addr;
1070 const void *mac_addr;
1071 const phandle *ph;
1072 const char *model;
1073
1074 memset(r, 0, sizeof(r));
1075 memset(&fs_enet_data, 0, sizeof(fs_enet_data));
1076
1077 model = of_get_property(np, "model", NULL);
1078 if (model == NULL) {
1079 ret = -ENODEV;
1080 goto unreg;
1081 }
1082
1083 id = of_get_property(np, "device-id", NULL);
1084 fs_enet_data.fs_no = *id;
1085
1086 if (platform_device_skip(model, *id))
1087 continue;
1088
1089 ret = of_address_to_resource(np, 0, &r[0]);
1090 if (ret)
1091 goto err;
1092 r[0].name = enet_regs;
1093
1094 mac_addr = of_get_mac_address(np);
1095 if (mac_addr)
1096 memcpy(fs_enet_data.macaddr, mac_addr, 6);
1097
1098 ph = of_get_property(np, "phy-handle", NULL);
1099 if (ph != NULL)
1100 phy = of_find_node_by_phandle(*ph);
1101
1102 if (phy != NULL) {
1103 phy_addr = of_get_property(phy, "reg", NULL);
1104 fs_enet_data.phy_addr = *phy_addr;
1105 fs_enet_data.has_phy = 1;
1106
1107 mdio = of_get_parent(phy);
1108 ret = of_address_to_resource(mdio, 0, &res);
1109 if (ret) {
1110 of_node_put(phy);
1111 of_node_put(mdio);
1112 goto unreg;
1113 }
1114 }
1115
1116 model = of_get_property(np, "model", NULL);
1117 strcpy(fs_enet_data.fs_type, model);
1118
1119 if (strstr(model, "FEC")) {
1120 r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
1121 r[1].flags = IORESOURCE_IRQ;
1122 r[1].name = enet_irq;
1123
1124 fs_enet_dev =
1125 platform_device_register_simple("fsl-cpm-fec", i, &r[0], 2);
1126
1127 if (IS_ERR(fs_enet_dev)) {
1128 ret = PTR_ERR(fs_enet_dev);
1129 goto err;
1130 }
1131
1132 fs_enet_data.rx_ring = 128;
1133 fs_enet_data.tx_ring = 16;
1134 fs_enet_data.rx_copybreak = 240;
1135 fs_enet_data.use_napi = 1;
1136 fs_enet_data.napi_weight = 17;
1137
1138 snprintf((char*)&bus_id[i], BUS_ID_SIZE, "%x:%02x",
1139 (u32)res.start, fs_enet_data.phy_addr);
1140 fs_enet_data.bus_id = (char*)&bus_id[i];
1141 fs_enet_data.init_ioports = init_fec_ioports;
1142 }
1143 if (strstr(model, "SCC")) {
1144 ret = of_address_to_resource(np, 1, &r[1]);
1145 if (ret)
1146 goto err;
1147 r[1].name = enet_pram;
1148
1149 r[2].start = r[2].end = irq_of_parse_and_map(np, 0);
1150 r[2].flags = IORESOURCE_IRQ;
1151 r[2].name = enet_irq;
1152
1153 fs_enet_dev =
1154 platform_device_register_simple("fsl-cpm-scc", i, &r[0], 3);
1155
1156 if (IS_ERR(fs_enet_dev)) {
1157 ret = PTR_ERR(fs_enet_dev);
1158 goto err;
1159 }
1160
1161 fs_enet_data.rx_ring = 64;
1162 fs_enet_data.tx_ring = 8;
1163 fs_enet_data.rx_copybreak = 240;
1164 fs_enet_data.use_napi = 1;
1165 fs_enet_data.napi_weight = 17;
1166
1167 snprintf((char*)&bus_id[i], BUS_ID_SIZE, "%s", "fixed@10:1");
1168 fs_enet_data.bus_id = (char*)&bus_id[i];
1169 fs_enet_data.init_ioports = init_scc_ioports;
1170 }
1171
1172 of_node_put(phy);
1173 of_node_put(mdio);
1174
1175 ret = platform_device_add_data(fs_enet_dev, &fs_enet_data,
1176 sizeof(struct
1177 fs_platform_info));
1178 if (ret)
1179 goto unreg;
1180 }
1181 return 0;
1182
1183unreg:
1184 platform_device_unregister(fs_enet_dev);
1185err:
1186 return ret;
1187}
1188
1189arch_initcall(fs_enet_of_init);
1190
1191static int __init fsl_pcmcia_of_init(void)
1192{
1193 struct device_node *np;
1194 /*
1195 * Register all the devices which type is "pcmcia"
1196 */
1197 for_each_compatible_node(np, "pcmcia", "fsl,pq-pcmcia")
1198 of_platform_device_create(np, "m8xx-pcmcia", NULL);
1199 return 0;
1200}
1201
1202arch_initcall(fsl_pcmcia_of_init);
1203
1204static const char *smc_regs = "regs";
1205static const char *smc_pram = "pram";
1206
1207static int __init cpm_smc_uart_of_init(void)
1208{
1209 struct device_node *np;
1210 unsigned int i;
1211 struct platform_device *cpm_uart_dev;
1212 int ret;
1213
1214 for (np = NULL, i = 0;
1215 (np = of_find_compatible_node(np, "serial", "cpm_uart")) != NULL;
1216 i++) {
1217 struct resource r[3];
1218 struct fs_uart_platform_info cpm_uart_data;
1219 const int *id;
1220 const char *model;
1221
1222 memset(r, 0, sizeof(r));
1223 memset(&cpm_uart_data, 0, sizeof(cpm_uart_data));
1224
1225 ret = of_address_to_resource(np, 0, &r[0]);
1226 if (ret)
1227 goto err;
1228
1229 r[0].name = smc_regs;
1230
1231 ret = of_address_to_resource(np, 1, &r[1]);
1232 if (ret)
1233 goto err;
1234 r[1].name = smc_pram;
1235
1236 r[2].start = r[2].end = irq_of_parse_and_map(np, 0);
1237 r[2].flags = IORESOURCE_IRQ;
1238
1239 cpm_uart_dev =
1240 platform_device_register_simple("fsl-cpm-smc:uart", i, &r[0], 3);
1241
1242 if (IS_ERR(cpm_uart_dev)) {
1243 ret = PTR_ERR(cpm_uart_dev);
1244 goto err;
1245 }
1246
1247 model = of_get_property(np, "model", NULL);
1248 strcpy(cpm_uart_data.fs_type, model);
1249
1250 id = of_get_property(np, "device-id", NULL);
1251 cpm_uart_data.fs_no = *id;
1252 cpm_uart_data.uart_clk = ppc_proc_freq;
1253
1254 cpm_uart_data.tx_num_fifo = 4;
1255 cpm_uart_data.tx_buf_size = 32;
1256 cpm_uart_data.rx_num_fifo = 4;
1257 cpm_uart_data.rx_buf_size = 32;
1258
1259 ret =
1260 platform_device_add_data(cpm_uart_dev, &cpm_uart_data,
1261 sizeof(struct
1262 fs_uart_platform_info));
1263 if (ret)
1264 goto unreg;
1265 }
1266
1267 return 0;
1268
1269unreg:
1270 platform_device_unregister(cpm_uart_dev);
1271err:
1272 return ret;
1273}
1274
1275arch_initcall(cpm_smc_uart_of_init);
1276
1277#endif /* CONFIG_8xx */
1278#endif /* CONFIG_PPC_CPM_NEW_BINDING */
1279
1280static int __init of_fsl_spi_probe(char *type, char *compatible, u32 sysclk, 749static int __init of_fsl_spi_probe(char *type, char *compatible, u32 sysclk,
1281 struct spi_board_info *board_infos, 750 struct spi_board_info *board_infos,
1282 unsigned int num_board_infos, 751 unsigned int num_board_infos,
@@ -1372,25 +841,9 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,
1372 sysclk = get_brgfreq(); 841 sysclk = get_brgfreq();
1373#endif 842#endif
1374 if (sysclk == -1) { 843 if (sysclk == -1) {
1375 struct device_node *np; 844 sysclk = fsl_get_sys_freq();
1376 const u32 *freq; 845 if (sysclk == -1)
1377 int size;
1378
1379 np = of_find_node_by_type(NULL, "soc");
1380 if (!np)
1381 return -ENODEV; 846 return -ENODEV;
1382
1383 freq = of_get_property(np, "clock-frequency", &size);
1384 if (!freq || size != sizeof(*freq) || *freq == 0) {
1385 freq = of_get_property(np, "bus-frequency", &size);
1386 if (!freq || size != sizeof(*freq) || *freq == 0) {
1387 of_node_put(np);
1388 return -ENODEV;
1389 }
1390 }
1391
1392 sysclk = *freq;
1393 of_node_put(np);
1394 } 847 }
1395 848
1396 ret = of_fsl_spi_probe(NULL, "fsl,spi", sysclk, board_infos, 849 ret = of_fsl_spi_probe(NULL, "fsl,spi", sysclk, board_infos,