diff options
-rw-r--r-- | arch/powerpc/boot/dts/mpc8560ads.dts | 8 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.c | 8 | ||||
-rw-r--r-- | drivers/net/fs_enet/fs_enet-main.c | 3 | ||||
-rw-r--r-- | drivers/serial/cpm_uart/cpm_uart_core.c | 9 | ||||
-rw-r--r-- | include/linux/fs_enet_pd.h | 37 | ||||
-rw-r--r-- | include/linux/fs_uart_pd.h | 10 |
6 files changed, 66 insertions, 9 deletions
diff --git a/arch/powerpc/boot/dts/mpc8560ads.dts b/arch/powerpc/boot/dts/mpc8560ads.dts index ba5c943a6fe9..2b168486aeba 100644 --- a/arch/powerpc/boot/dts/mpc8560ads.dts +++ b/arch/powerpc/boot/dts/mpc8560ads.dts | |||
@@ -244,7 +244,7 @@ | |||
244 | device_type = "serial"; | 244 | device_type = "serial"; |
245 | compatible = "cpm_uart"; | 245 | compatible = "cpm_uart"; |
246 | model = "SCC"; | 246 | model = "SCC"; |
247 | device-id = <2>; | 247 | device-id = <1>; |
248 | reg = <91a00 20 88000 100>; | 248 | reg = <91a00 20 88000 100>; |
249 | clock-setup = <00ffffff 0>; | 249 | clock-setup = <00ffffff 0>; |
250 | rx-clock = <1>; | 250 | rx-clock = <1>; |
@@ -258,7 +258,7 @@ | |||
258 | device_type = "serial"; | 258 | device_type = "serial"; |
259 | compatible = "cpm_uart"; | 259 | compatible = "cpm_uart"; |
260 | model = "SCC"; | 260 | model = "SCC"; |
261 | device-id = <3>; | 261 | device-id = <2>; |
262 | reg = <91a20 20 88100 100>; | 262 | reg = <91a20 20 88100 100>; |
263 | clock-setup = <ff00ffff 90000>; | 263 | clock-setup = <ff00ffff 90000>; |
264 | rx-clock = <2>; | 264 | rx-clock = <2>; |
@@ -272,7 +272,7 @@ | |||
272 | device_type = "network"; | 272 | device_type = "network"; |
273 | compatible = "fs_enet"; | 273 | compatible = "fs_enet"; |
274 | model = "FCC"; | 274 | model = "FCC"; |
275 | device-id = <3>; | 275 | device-id = <2>; |
276 | reg = <91320 20 88500 100 913a0 30>; | 276 | reg = <91320 20 88500 100 913a0 30>; |
277 | mac-address = [ 00 00 0C 00 02 FD ]; | 277 | mac-address = [ 00 00 0C 00 02 FD ]; |
278 | clock-setup = <ff00ffff 250000>; | 278 | clock-setup = <ff00ffff 250000>; |
@@ -287,7 +287,7 @@ | |||
287 | device_type = "network"; | 287 | device_type = "network"; |
288 | compatible = "fs_enet"; | 288 | compatible = "fs_enet"; |
289 | model = "FCC"; | 289 | model = "FCC"; |
290 | device-id = <4>; | 290 | device-id = <3>; |
291 | reg = <91340 20 88600 100 913d0 30>; | 291 | reg = <91340 20 88600 100 913d0 30>; |
292 | mac-address = [ 00 00 0C 00 03 FD ]; | 292 | mac-address = [ 00 00 0C 00 03 FD ]; |
293 | clock-setup = <ffff00ff 3700>; | 293 | clock-setup = <ffff00ff 3700>; |
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 4e72bb983636..022ed275ea68 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
@@ -622,6 +622,7 @@ static int __init fs_enet_of_init(void) | |||
622 | 622 | ||
623 | id = get_property(np, "device-id", NULL); | 623 | id = get_property(np, "device-id", NULL); |
624 | fs_enet_data.fs_no = *id; | 624 | fs_enet_data.fs_no = *id; |
625 | strcpy(fs_enet_data.fs_type, model); | ||
625 | 626 | ||
626 | mdio = of_get_parent(phy); | 627 | mdio = of_get_parent(phy); |
627 | ret = of_address_to_resource(mdio, 0, &res); | 628 | ret = of_address_to_resource(mdio, 0, &res); |
@@ -635,7 +636,7 @@ static int __init fs_enet_of_init(void) | |||
635 | fs_enet_data.clk_tx = *((u32 *) get_property(np, "tx-clock", NULL)); | 636 | fs_enet_data.clk_tx = *((u32 *) get_property(np, "tx-clock", NULL)); |
636 | 637 | ||
637 | if (strstr(model, "FCC")) { | 638 | if (strstr(model, "FCC")) { |
638 | int fcc_index = fs_get_fcc_index(*id); | 639 | int fcc_index = *id - 1; |
639 | 640 | ||
640 | fs_enet_data.dpram_offset = (u32)cpm_dpram_addr(0); | 641 | fs_enet_data.dpram_offset = (u32)cpm_dpram_addr(0); |
641 | fs_enet_data.rx_ring = 32; | 642 | fs_enet_data.rx_ring = 32; |
@@ -688,6 +689,7 @@ static int __init cpm_uart_of_init(void) | |||
688 | struct resource r[3]; | 689 | struct resource r[3]; |
689 | struct fs_uart_platform_info cpm_uart_data; | 690 | struct fs_uart_platform_info cpm_uart_data; |
690 | const int *id; | 691 | const int *id; |
692 | const char *model; | ||
691 | 693 | ||
692 | memset(r, 0, sizeof(r)); | 694 | memset(r, 0, sizeof(r)); |
693 | memset(&cpm_uart_data, 0, sizeof(cpm_uart_data)); | 695 | memset(&cpm_uart_data, 0, sizeof(cpm_uart_data)); |
@@ -716,6 +718,10 @@ static int __init cpm_uart_of_init(void) | |||
716 | 718 | ||
717 | id = get_property(np, "device-id", NULL); | 719 | id = get_property(np, "device-id", NULL); |
718 | cpm_uart_data.fs_no = *id; | 720 | cpm_uart_data.fs_no = *id; |
721 | |||
722 | model = (char*)get_property(np, "model", NULL); | ||
723 | strcpy(cpm_uart_data.fs_type, model); | ||
724 | |||
719 | cpm_uart_data.uart_clk = ppc_proc_freq; | 725 | cpm_uart_data.uart_clk = ppc_proc_freq; |
720 | 726 | ||
721 | cpm_uart_data.tx_num_fifo = 4; | 727 | cpm_uart_data.tx_num_fifo = 4; |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index f358ee61d9b9..3e2a3a20d50a 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -944,12 +944,13 @@ extern int fs_mii_connect(struct net_device *dev); | |||
944 | extern void fs_mii_disconnect(struct net_device *dev); | 944 | extern void fs_mii_disconnect(struct net_device *dev); |
945 | 945 | ||
946 | static struct net_device *fs_init_instance(struct device *dev, | 946 | static struct net_device *fs_init_instance(struct device *dev, |
947 | const struct fs_platform_info *fpi) | 947 | struct fs_platform_info *fpi) |
948 | { | 948 | { |
949 | struct net_device *ndev = NULL; | 949 | struct net_device *ndev = NULL; |
950 | struct fs_enet_private *fep = NULL; | 950 | struct fs_enet_private *fep = NULL; |
951 | int privsize, i, r, err = 0, registered = 0; | 951 | int privsize, i, r, err = 0, registered = 0; |
952 | 952 | ||
953 | fpi->fs_no = fs_get_id(fpi); | ||
953 | /* guard */ | 954 | /* guard */ |
954 | if ((unsigned int)fpi->fs_no >= FS_MAX_INDEX) | 955 | if ((unsigned int)fpi->fs_no >= FS_MAX_INDEX) |
955 | return ERR_PTR(-EINVAL); | 956 | return ERR_PTR(-EINVAL); |
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c index 24613a68f5cc..a0d6136deb9b 100644 --- a/drivers/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/serial/cpm_uart/cpm_uart_core.c | |||
@@ -1023,15 +1023,17 @@ int cpm_uart_drv_get_platform_data(struct platform_device *pdev, int is_con) | |||
1023 | { | 1023 | { |
1024 | struct resource *r; | 1024 | struct resource *r; |
1025 | struct fs_uart_platform_info *pdata = pdev->dev.platform_data; | 1025 | struct fs_uart_platform_info *pdata = pdev->dev.platform_data; |
1026 | int idx = pdata->fs_no; /* It is UART_SMCx or UART_SCCx index */ | 1026 | int idx; /* It is UART_SMCx or UART_SCCx index */ |
1027 | struct uart_cpm_port *pinfo; | 1027 | struct uart_cpm_port *pinfo; |
1028 | int line; | 1028 | int line; |
1029 | u32 mem, pram; | 1029 | u32 mem, pram; |
1030 | 1030 | ||
1031 | idx = pdata->fs_no = fs_uart_get_id(pdata); | ||
1032 | |||
1031 | line = cpm_uart_id2nr(idx); | 1033 | line = cpm_uart_id2nr(idx); |
1032 | if(line < 0) { | 1034 | if(line < 0) { |
1033 | printk(KERN_ERR"%s(): port %d is not registered", __FUNCTION__, idx); | 1035 | printk(KERN_ERR"%s(): port %d is not registered", __FUNCTION__, idx); |
1034 | return -1; | 1036 | return -EINVAL; |
1035 | } | 1037 | } |
1036 | 1038 | ||
1037 | pinfo = (struct uart_cpm_port *) &cpm_uart_ports[idx]; | 1039 | pinfo = (struct uart_cpm_port *) &cpm_uart_ports[idx]; |
@@ -1263,11 +1265,12 @@ static int cpm_uart_drv_probe(struct device *dev) | |||
1263 | } | 1265 | } |
1264 | 1266 | ||
1265 | pdata = pdev->dev.platform_data; | 1267 | pdata = pdev->dev.platform_data; |
1266 | pr_debug("cpm_uart_drv_probe: Adding CPM UART %d\n", cpm_uart_id2nr(pdata->fs_no)); | ||
1267 | 1268 | ||
1268 | if ((ret = cpm_uart_drv_get_platform_data(pdev, 0))) | 1269 | if ((ret = cpm_uart_drv_get_platform_data(pdev, 0))) |
1269 | return ret; | 1270 | return ret; |
1270 | 1271 | ||
1272 | pr_debug("cpm_uart_drv_probe: Adding CPM UART %d\n", cpm_uart_id2nr(pdata->fs_no)); | ||
1273 | |||
1271 | if (pdata->init_ioports) | 1274 | if (pdata->init_ioports) |
1272 | pdata->init_ioports(pdata); | 1275 | pdata->init_ioports(pdata); |
1273 | 1276 | ||
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h index 932223550aca..543cd3cd9e77 100644 --- a/include/linux/fs_enet_pd.h +++ b/include/linux/fs_enet_pd.h | |||
@@ -55,6 +55,30 @@ static inline int fs_get_scc_index(enum fs_id id) | |||
55 | return -1; | 55 | return -1; |
56 | } | 56 | } |
57 | 57 | ||
58 | static inline int fs_fec_index2id(int index) | ||
59 | { | ||
60 | int id = fsid_fec1 + index - 1; | ||
61 | if (id >= fsid_fec1 && id <= fsid_fec2) | ||
62 | return id; | ||
63 | return FS_MAX_INDEX; | ||
64 | } | ||
65 | |||
66 | static inline int fs_fcc_index2id(int index) | ||
67 | { | ||
68 | int id = fsid_fcc1 + index - 1; | ||
69 | if (id >= fsid_fcc1 && id <= fsid_fcc3) | ||
70 | return id; | ||
71 | return FS_MAX_INDEX; | ||
72 | } | ||
73 | |||
74 | static inline int fs_scc_index2id(int index) | ||
75 | { | ||
76 | int id = fsid_scc1 + index - 1; | ||
77 | if (id >= fsid_scc1 && id <= fsid_scc4) | ||
78 | return id; | ||
79 | return FS_MAX_INDEX; | ||
80 | } | ||
81 | |||
58 | enum fs_mii_method { | 82 | enum fs_mii_method { |
59 | fsmii_fixed, | 83 | fsmii_fixed, |
60 | fsmii_fec, | 84 | fsmii_fec, |
@@ -91,6 +115,7 @@ struct fs_platform_info { | |||
91 | void(*init_ioports)(struct fs_platform_info *); | 115 | void(*init_ioports)(struct fs_platform_info *); |
92 | /* device specific information */ | 116 | /* device specific information */ |
93 | int fs_no; /* controller index */ | 117 | int fs_no; /* controller index */ |
118 | char fs_type[4]; /* controller type */ | ||
94 | 119 | ||
95 | u32 cp_page; /* CPM page */ | 120 | u32 cp_page; /* CPM page */ |
96 | u32 cp_block; /* CPM sblock */ | 121 | u32 cp_block; /* CPM sblock */ |
@@ -126,4 +151,16 @@ struct fs_mii_fec_platform_info { | |||
126 | u32 irq[32]; | 151 | u32 irq[32]; |
127 | u32 mii_speed; | 152 | u32 mii_speed; |
128 | }; | 153 | }; |
154 | |||
155 | static inline int fs_get_id(struct fs_platform_info *fpi) | ||
156 | { | ||
157 | if(strstr(fpi->fs_type, "SCC")) | ||
158 | return fs_scc_index2id(fpi->fs_no); | ||
159 | if(strstr(fpi->fs_type, "FCC")) | ||
160 | return fs_fcc_index2id(fpi->fs_no); | ||
161 | if(strstr(fpi->fs_type, "FEC")) | ||
162 | return fs_fec_index2id(fpi->fs_no); | ||
163 | return fpi->fs_no; | ||
164 | } | ||
165 | |||
129 | #endif | 166 | #endif |
diff --git a/include/linux/fs_uart_pd.h b/include/linux/fs_uart_pd.h index a99a020f95c2..809bb9ffc788 100644 --- a/include/linux/fs_uart_pd.h +++ b/include/linux/fs_uart_pd.h | |||
@@ -49,6 +49,7 @@ struct fs_uart_platform_info { | |||
49 | void(*init_ioports)(struct fs_uart_platform_info *); | 49 | void(*init_ioports)(struct fs_uart_platform_info *); |
50 | /* device specific information */ | 50 | /* device specific information */ |
51 | int fs_no; /* controller index */ | 51 | int fs_no; /* controller index */ |
52 | char fs_type[4]; /* controller type */ | ||
52 | u32 uart_clk; | 53 | u32 uart_clk; |
53 | u8 tx_num_fifo; | 54 | u8 tx_num_fifo; |
54 | u8 tx_buf_size; | 55 | u8 tx_buf_size; |
@@ -59,4 +60,13 @@ struct fs_uart_platform_info { | |||
59 | u8 clk_tx; | 60 | u8 clk_tx; |
60 | }; | 61 | }; |
61 | 62 | ||
63 | static inline int fs_uart_get_id(struct fs_uart_platform_info *fpi) | ||
64 | { | ||
65 | if(strstr(fpi->fs_type, "SMC")) | ||
66 | return fs_uart_id_smc2fsid(fpi->fs_no); | ||
67 | if(strstr(fpi->fs_type, "SCC")) | ||
68 | return fs_uart_id_scc2fsid(fpi->fs_no); | ||
69 | return fpi->fs_no; | ||
70 | } | ||
71 | |||
62 | #endif | 72 | #endif |