aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/fsl_soc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/sysdev/fsl_soc.c')
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c90
1 files changed, 48 insertions, 42 deletions
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index d20f02927f72..8a123c71449f 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -52,7 +52,7 @@ phys_addr_t get_immrbase(void)
52 soc = of_find_node_by_type(NULL, "soc"); 52 soc = of_find_node_by_type(NULL, "soc");
53 if (soc) { 53 if (soc) {
54 unsigned int size; 54 unsigned int size;
55 const void *prop = get_property(soc, "reg", &size); 55 const void *prop = of_get_property(soc, "reg", &size);
56 56
57 if (prop) 57 if (prop)
58 immrbase = of_translate_address(soc, prop); 58 immrbase = of_translate_address(soc, prop);
@@ -78,8 +78,8 @@ u32 get_brgfreq(void)
78 node = of_find_node_by_type(NULL, "cpm"); 78 node = of_find_node_by_type(NULL, "cpm");
79 if (node) { 79 if (node) {
80 unsigned int size; 80 unsigned int size;
81 const unsigned int *prop = get_property(node, "brg-frequency", 81 const unsigned int *prop = of_get_property(node,
82 &size); 82 "brg-frequency", &size);
83 83
84 if (prop) 84 if (prop)
85 brgfreq = *prop; 85 brgfreq = *prop;
@@ -103,8 +103,8 @@ u32 get_baudrate(void)
103 node = of_find_node_by_type(NULL, "serial"); 103 node = of_find_node_by_type(NULL, "serial");
104 if (node) { 104 if (node) {
105 unsigned int size; 105 unsigned int size;
106 const unsigned int *prop = get_property(node, "current-speed", 106 const unsigned int *prop = of_get_property(node,
107 &size); 107 "current-speed", &size);
108 108
109 if (prop) 109 if (prop)
110 fs_baudrate = *prop; 110 fs_baudrate = *prop;
@@ -153,7 +153,8 @@ static int __init gfar_mdio_of_init(void)
153 while ((child = of_get_next_child(np, child)) != NULL) { 153 while ((child = of_get_next_child(np, child)) != NULL) {
154 int irq = irq_of_parse_and_map(child, 0); 154 int irq = irq_of_parse_and_map(child, 0);
155 if (irq != NO_IRQ) { 155 if (irq != NO_IRQ) {
156 const u32 *id = get_property(child, "reg", NULL); 156 const u32 *id = of_get_property(child,
157 "reg", NULL);
157 mdio_data.irq[*id] = irq; 158 mdio_data.irq[*id] = irq;
158 } 159 }
159 } 160 }
@@ -209,7 +210,7 @@ static int __init gfar_of_init(void)
209 210
210 of_irq_to_resource(np, 0, &r[1]); 211 of_irq_to_resource(np, 0, &r[1]);
211 212
212 model = get_property(np, "model", NULL); 213 model = of_get_property(np, "model", NULL);
213 214
214 /* If we aren't the FEC we have multiple interrupts */ 215 /* If we aren't the FEC we have multiple interrupts */
215 if (model && strcasecmp(model, "FEC")) { 216 if (model && strcasecmp(model, "FEC")) {
@@ -253,7 +254,7 @@ static int __init gfar_of_init(void)
253 FSL_GIANFAR_DEV_HAS_VLAN | 254 FSL_GIANFAR_DEV_HAS_VLAN |
254 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; 255 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
255 256
256 ph = get_property(np, "phy-handle", NULL); 257 ph = of_get_property(np, "phy-handle", NULL);
257 phy = of_find_node_by_phandle(*ph); 258 phy = of_find_node_by_phandle(*ph);
258 259
259 if (phy == NULL) { 260 if (phy == NULL) {
@@ -263,7 +264,7 @@ static int __init gfar_of_init(void)
263 264
264 mdio = of_get_parent(phy); 265 mdio = of_get_parent(phy);
265 266
266 id = get_property(phy, "reg", NULL); 267 id = of_get_property(phy, "reg", NULL);
267 ret = of_address_to_resource(mdio, 0, &res); 268 ret = of_address_to_resource(mdio, 0, &res);
268 if (ret) { 269 if (ret) {
269 of_node_put(phy); 270 of_node_put(phy);
@@ -325,11 +326,11 @@ static int __init fsl_i2c_of_init(void)
325 } 326 }
326 327
327 i2c_data.device_flags = 0; 328 i2c_data.device_flags = 0;
328 flags = get_property(np, "dfsrr", NULL); 329 flags = of_get_property(np, "dfsrr", NULL);
329 if (flags) 330 if (flags)
330 i2c_data.device_flags |= FSL_I2C_DEV_SEPARATE_DFSRR; 331 i2c_data.device_flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
331 332
332 flags = get_property(np, "fsl5200-clocking", NULL); 333 flags = of_get_property(np, "fsl5200-clocking", NULL);
333 if (flags) 334 if (flags)
334 i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200; 335 i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200;
335 336
@@ -374,7 +375,7 @@ static int __init mpc83xx_wdt_init(void)
374 goto nosoc; 375 goto nosoc;
375 } 376 }
376 377
377 freq = get_property(soc, "bus-frequency", NULL); 378 freq = of_get_property(soc, "bus-frequency", NULL);
378 if (!freq) { 379 if (!freq) {
379 ret = -ENODEV; 380 ret = -ENODEV;
380 goto err; 381 goto err;
@@ -466,15 +467,15 @@ static int __init fsl_usb_of_init(void)
466 467
467 usb_data.operating_mode = FSL_USB2_MPH_HOST; 468 usb_data.operating_mode = FSL_USB2_MPH_HOST;
468 469
469 prop = get_property(np, "port0", NULL); 470 prop = of_get_property(np, "port0", NULL);
470 if (prop) 471 if (prop)
471 usb_data.port_enables |= FSL_USB2_PORT0_ENABLED; 472 usb_data.port_enables |= FSL_USB2_PORT0_ENABLED;
472 473
473 prop = get_property(np, "port1", NULL); 474 prop = of_get_property(np, "port1", NULL);
474 if (prop) 475 if (prop)
475 usb_data.port_enables |= FSL_USB2_PORT1_ENABLED; 476 usb_data.port_enables |= FSL_USB2_PORT1_ENABLED;
476 477
477 prop = get_property(np, "phy_type", NULL); 478 prop = of_get_property(np, "phy_type", NULL);
478 usb_data.phy_mode = determine_usb_phy(prop); 479 usb_data.phy_mode = determine_usb_phy(prop);
479 480
480 ret = 481 ret =
@@ -501,7 +502,7 @@ static int __init fsl_usb_of_init(void)
501 502
502 of_irq_to_resource(np, 0, &r[1]); 503 of_irq_to_resource(np, 0, &r[1]);
503 504
504 prop = get_property(np, "dr_mode", NULL); 505 prop = of_get_property(np, "dr_mode", NULL);
505 506
506 if (!prop || !strcmp(prop, "host")) { 507 if (!prop || !strcmp(prop, "host")) {
507 usb_data.operating_mode = FSL_USB2_DR_HOST; 508 usb_data.operating_mode = FSL_USB2_DR_HOST;
@@ -538,7 +539,7 @@ static int __init fsl_usb_of_init(void)
538 goto err; 539 goto err;
539 } 540 }
540 541
541 prop = get_property(np, "phy_type", NULL); 542 prop = of_get_property(np, "phy_type", NULL);
542 usb_data.phy_mode = determine_usb_phy(prop); 543 usb_data.phy_mode = determine_usb_phy(prop);
543 544
544 if (usb_dev_dr_host) { 545 if (usb_dev_dr_host) {
@@ -633,7 +634,7 @@ static int __init fs_enet_of_init(void)
633 goto err; 634 goto err;
634 } 635 }
635 636
636 model = get_property(np, "model", NULL); 637 model = of_get_property(np, "model", NULL);
637 if (model == NULL) { 638 if (model == NULL) {
638 ret = -ENODEV; 639 ret = -ENODEV;
639 goto unreg; 640 goto unreg;
@@ -643,7 +644,7 @@ static int __init fs_enet_of_init(void)
643 if (mac_addr) 644 if (mac_addr)
644 memcpy(fs_enet_data.macaddr, mac_addr, 6); 645 memcpy(fs_enet_data.macaddr, mac_addr, 6);
645 646
646 ph = get_property(np, "phy-handle", NULL); 647 ph = of_get_property(np, "phy-handle", NULL);
647 phy = of_find_node_by_phandle(*ph); 648 phy = of_find_node_by_phandle(*ph);
648 649
649 if (phy == NULL) { 650 if (phy == NULL) {
@@ -651,12 +652,12 @@ static int __init fs_enet_of_init(void)
651 goto unreg; 652 goto unreg;
652 } 653 }
653 654
654 phy_addr = get_property(phy, "reg", NULL); 655 phy_addr = of_get_property(phy, "reg", NULL);
655 fs_enet_data.phy_addr = *phy_addr; 656 fs_enet_data.phy_addr = *phy_addr;
656 657
657 phy_irq = get_property(phy, "interrupts", NULL); 658 phy_irq = of_get_property(phy, "interrupts", NULL);
658 659
659 id = get_property(np, "device-id", NULL); 660 id = of_get_property(np, "device-id", NULL);
660 fs_enet_data.fs_no = *id; 661 fs_enet_data.fs_no = *id;
661 strcpy(fs_enet_data.fs_type, model); 662 strcpy(fs_enet_data.fs_type, model);
662 663
@@ -668,8 +669,10 @@ static int __init fs_enet_of_init(void)
668 goto unreg; 669 goto unreg;
669 } 670 }
670 671
671 fs_enet_data.clk_rx = *((u32 *) get_property(np, "rx-clock", NULL)); 672 fs_enet_data.clk_rx = *((u32 *)of_get_property(np,
672 fs_enet_data.clk_tx = *((u32 *) get_property(np, "tx-clock", NULL)); 673 "rx-clock", NULL));
674 fs_enet_data.clk_tx = *((u32 *)of_get_property(np,
675 "tx-clock", NULL));
673 676
674 if (strstr(model, "FCC")) { 677 if (strstr(model, "FCC")) {
675 int fcc_index = *id - 1; 678 int fcc_index = *id - 1;
@@ -690,7 +693,7 @@ static int __init fs_enet_of_init(void)
690 fs_enet_data.bus_id = (char*)&bus_id[(*id)]; 693 fs_enet_data.bus_id = (char*)&bus_id[(*id)];
691 fs_enet_data.init_ioports = init_fcc_ioports; 694 fs_enet_data.init_ioports = init_fcc_ioports;
692 695
693 mdio_bb_prop = get_property(phy, "bitbang", NULL); 696 mdio_bb_prop = of_get_property(phy, "bitbang", NULL);
694 if (mdio_bb_prop) { 697 if (mdio_bb_prop) {
695 struct platform_device *fs_enet_mdio_bb_dev; 698 struct platform_device *fs_enet_mdio_bb_dev;
696 struct fs_mii_bb_platform_info fs_enet_mdio_bb_data; 699 struct fs_mii_bb_platform_info fs_enet_mdio_bb_data;
@@ -796,10 +799,10 @@ static int __init cpm_uart_of_init(void)
796 goto err; 799 goto err;
797 } 800 }
798 801
799 id = get_property(np, "device-id", NULL); 802 id = of_get_property(np, "device-id", NULL);
800 cpm_uart_data.fs_no = *id; 803 cpm_uart_data.fs_no = *id;
801 804
802 model = (char*)get_property(np, "model", NULL); 805 model = of_get_property(np, "model", NULL);
803 strcpy(cpm_uart_data.fs_type, model); 806 strcpy(cpm_uart_data.fs_type, model);
804 807
805 cpm_uart_data.uart_clk = ppc_proc_freq; 808 cpm_uart_data.uart_clk = ppc_proc_freq;
@@ -808,8 +811,10 @@ static int __init cpm_uart_of_init(void)
808 cpm_uart_data.tx_buf_size = 32; 811 cpm_uart_data.tx_buf_size = 32;
809 cpm_uart_data.rx_num_fifo = 4; 812 cpm_uart_data.rx_num_fifo = 4;
810 cpm_uart_data.rx_buf_size = 32; 813 cpm_uart_data.rx_buf_size = 32;
811 cpm_uart_data.clk_rx = *((u32 *) get_property(np, "rx-clock", NULL)); 814 cpm_uart_data.clk_rx = *((u32 *)of_get_property(np,
812 cpm_uart_data.clk_tx = *((u32 *) get_property(np, "tx-clock", NULL)); 815 "rx-clock", NULL));
816 cpm_uart_data.clk_tx = *((u32 *)of_get_property(np,
817 "tx-clock", NULL));
813 818
814 ret = 819 ret =
815 platform_device_add_data(cpm_uart_dev, &cpm_uart_data, 820 platform_device_add_data(cpm_uart_dev, &cpm_uart_data,
@@ -833,7 +838,7 @@ arch_initcall(cpm_uart_of_init);
833#ifdef CONFIG_8xx 838#ifdef CONFIG_8xx
834 839
835extern void init_scc_ioports(struct fs_platform_info*); 840extern void init_scc_ioports(struct fs_platform_info*);
836extern int platform_device_skip(char *model, int id); 841extern int platform_device_skip(const char *model, int id);
837 842
838static int __init fs_enet_mdio_of_init(void) 843static int __init fs_enet_mdio_of_init(void)
839{ 844{
@@ -900,21 +905,22 @@ static int __init fs_enet_of_init(void)
900 struct resource r[4]; 905 struct resource r[4];
901 struct device_node *phy = NULL, *mdio = NULL; 906 struct device_node *phy = NULL, *mdio = NULL;
902 struct fs_platform_info fs_enet_data; 907 struct fs_platform_info fs_enet_data;
903 unsigned int *id, *phy_addr; 908 const unsigned int *id;
909 const unsigned int *phy_addr;
904 void *mac_addr; 910 void *mac_addr;
905 phandle *ph; 911 const phandle *ph;
906 char *model; 912 const char *model;
907 913
908 memset(r, 0, sizeof(r)); 914 memset(r, 0, sizeof(r));
909 memset(&fs_enet_data, 0, sizeof(fs_enet_data)); 915 memset(&fs_enet_data, 0, sizeof(fs_enet_data));
910 916
911 model = (char *)get_property(np, "model", NULL); 917 model = of_get_property(np, "model", NULL);
912 if (model == NULL) { 918 if (model == NULL) {
913 ret = -ENODEV; 919 ret = -ENODEV;
914 goto unreg; 920 goto unreg;
915 } 921 }
916 922
917 id = (u32 *) get_property(np, "device-id", NULL); 923 id = of_get_property(np, "device-id", NULL);
918 fs_enet_data.fs_no = *id; 924 fs_enet_data.fs_no = *id;
919 925
920 if (platform_device_skip(model, *id)) 926 if (platform_device_skip(model, *id))
@@ -929,12 +935,12 @@ static int __init fs_enet_of_init(void)
929 if (mac_addr) 935 if (mac_addr)
930 memcpy(fs_enet_data.macaddr, mac_addr, 6); 936 memcpy(fs_enet_data.macaddr, mac_addr, 6);
931 937
932 ph = (phandle *) get_property(np, "phy-handle", NULL); 938 ph = of_get_property(np, "phy-handle", NULL);
933 if (ph != NULL) 939 if (ph != NULL)
934 phy = of_find_node_by_phandle(*ph); 940 phy = of_find_node_by_phandle(*ph);
935 941
936 if (phy != NULL) { 942 if (phy != NULL) {
937 phy_addr = (u32 *) get_property(phy, "reg", NULL); 943 phy_addr = of_get_property(phy, "reg", NULL);
938 fs_enet_data.phy_addr = *phy_addr; 944 fs_enet_data.phy_addr = *phy_addr;
939 fs_enet_data.has_phy = 1; 945 fs_enet_data.has_phy = 1;
940 946
@@ -947,7 +953,7 @@ static int __init fs_enet_of_init(void)
947 } 953 }
948 } 954 }
949 955
950 model = (char*)get_property(np, "model", NULL); 956 model = of_get_property(np, "model", NULL);
951 strcpy(fs_enet_data.fs_type, model); 957 strcpy(fs_enet_data.fs_type, model);
952 958
953 if (strstr(model, "FEC")) { 959 if (strstr(model, "FEC")) {
@@ -1038,8 +1044,8 @@ static int __init cpm_smc_uart_of_init(void)
1038 i++) { 1044 i++) {
1039 struct resource r[3]; 1045 struct resource r[3];
1040 struct fs_uart_platform_info cpm_uart_data; 1046 struct fs_uart_platform_info cpm_uart_data;
1041 int *id; 1047 const int *id;
1042 char *model; 1048 const char *model;
1043 1049
1044 memset(r, 0, sizeof(r)); 1050 memset(r, 0, sizeof(r));
1045 memset(&cpm_uart_data, 0, sizeof(cpm_uart_data)); 1051 memset(&cpm_uart_data, 0, sizeof(cpm_uart_data));
@@ -1066,10 +1072,10 @@ static int __init cpm_smc_uart_of_init(void)
1066 goto err; 1072 goto err;
1067 } 1073 }
1068 1074
1069 model = (char*)get_property(np, "model", NULL); 1075 model = of_get_property(np, "model", NULL);
1070 strcpy(cpm_uart_data.fs_type, model); 1076 strcpy(cpm_uart_data.fs_type, model);
1071 1077
1072 id = (int*)get_property(np, "device-id", NULL); 1078 id = of_get_property(np, "device-id", NULL);
1073 cpm_uart_data.fs_no = *id; 1079 cpm_uart_data.fs_no = *id;
1074 cpm_uart_data.uart_clk = ppc_proc_freq; 1080 cpm_uart_data.uart_clk = ppc_proc_freq;
1075 1081