Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6
[pandora-kernel.git] / arch / powerpc / sysdev / fsl_soc.c
1 /*
2  * FSL SoC setup code
3  *
4  * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5  *
6  * 2006 (c) MontaVista Software, Inc.
7  * Vitaly Bordug <vbordug@ru.mvista.com>
8  *
9  * This program is free software; you can redistribute  it and/or modify it
10  * under  the terms of  the GNU General  Public License as published by the
11  * Free Software Foundation;  either version 2 of the  License, or (at your
12  * option) any later version.
13  */
14
15 #include <linux/stddef.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/errno.h>
19 #include <linux/major.h>
20 #include <linux/delay.h>
21 #include <linux/irq.h>
22 #include <linux/module.h>
23 #include <linux/device.h>
24 #include <linux/platform_device.h>
25 #include <linux/fsl_devices.h>
26 #include <linux/fs_enet_pd.h>
27 #include <linux/fs_uart_pd.h>
28
29 #include <asm/system.h>
30 #include <asm/atomic.h>
31 #include <asm/io.h>
32 #include <asm/irq.h>
33 #include <asm/time.h>
34 #include <asm/prom.h>
35 #include <sysdev/fsl_soc.h>
36 #include <mm/mmu_decl.h>
37 #include <asm/cpm2.h>
38
39 extern void init_fcc_ioports(struct fs_platform_info*);
40 static phys_addr_t immrbase = -1;
41
42 phys_addr_t get_immrbase(void)
43 {
44         struct device_node *soc;
45
46         if (immrbase != -1)
47                 return immrbase;
48
49         soc = of_find_node_by_type(NULL, "soc");
50         if (soc) {
51                 unsigned int size;
52                 const void *prop = get_property(soc, "reg", &size);
53
54                 if (prop)
55                         immrbase = of_translate_address(soc, prop);
56                 of_node_put(soc);
57         };
58
59         return immrbase;
60 }
61
62 EXPORT_SYMBOL(get_immrbase);
63
64 #ifdef CONFIG_CPM2
65
66 static u32 brgfreq = -1;
67
68 u32 get_brgfreq(void)
69 {
70         struct device_node *node;
71
72         if (brgfreq != -1)
73                 return brgfreq;
74
75         node = of_find_node_by_type(NULL, "cpm");
76         if (node) {
77                 unsigned int size;
78                 const unsigned int *prop = get_property(node, "brg-frequency",
79                                         &size);
80
81                 if (prop)
82                         brgfreq = *prop;
83                 of_node_put(node);
84         };
85
86         return brgfreq;
87 }
88
89 EXPORT_SYMBOL(get_brgfreq);
90
91 static u32 fs_baudrate = -1;
92
93 u32 get_baudrate(void)
94 {
95         struct device_node *node;
96
97         if (fs_baudrate != -1)
98                 return fs_baudrate;
99
100         node = of_find_node_by_type(NULL, "serial");
101         if (node) {
102                 unsigned int size;
103                 const unsigned int *prop = get_property(node, "current-speed",
104                                 &size);
105
106                 if (prop)
107                         fs_baudrate = *prop;
108                 of_node_put(node);
109         };
110
111         return fs_baudrate;
112 }
113
114 EXPORT_SYMBOL(get_baudrate);
115 #endif /* CONFIG_CPM2 */
116
117 static int __init gfar_mdio_of_init(void)
118 {
119         struct device_node *np;
120         unsigned int i;
121         struct platform_device *mdio_dev;
122         struct resource res;
123         int ret;
124
125         for (np = NULL, i = 0;
126              (np = of_find_compatible_node(np, "mdio", "gianfar")) != NULL;
127              i++) {
128                 int k;
129                 struct device_node *child = NULL;
130                 struct gianfar_mdio_data mdio_data;
131
132                 memset(&res, 0, sizeof(res));
133                 memset(&mdio_data, 0, sizeof(mdio_data));
134
135                 ret = of_address_to_resource(np, 0, &res);
136                 if (ret)
137                         goto err;
138
139                 mdio_dev =
140                     platform_device_register_simple("fsl-gianfar_mdio",
141                                                     res.start, &res, 1);
142                 if (IS_ERR(mdio_dev)) {
143                         ret = PTR_ERR(mdio_dev);
144                         goto err;
145                 }
146
147                 for (k = 0; k < 32; k++)
148                         mdio_data.irq[k] = -1;
149
150                 while ((child = of_get_next_child(np, child)) != NULL) {
151                         int irq = irq_of_parse_and_map(child, 0);
152                         if (irq != NO_IRQ) {
153                                 const u32 *id = get_property(child, "reg", NULL);
154                                 mdio_data.irq[*id] = irq;
155                         }
156                 }
157
158                 ret =
159                     platform_device_add_data(mdio_dev, &mdio_data,
160                                              sizeof(struct gianfar_mdio_data));
161                 if (ret)
162                         goto unreg;
163         }
164
165         return 0;
166
167 unreg:
168         platform_device_unregister(mdio_dev);
169 err:
170         return ret;
171 }
172
173 arch_initcall(gfar_mdio_of_init);
174
175 static const char *gfar_tx_intr = "tx";
176 static const char *gfar_rx_intr = "rx";
177 static const char *gfar_err_intr = "error";
178
179 static int __init gfar_of_init(void)
180 {
181         struct device_node *np;
182         unsigned int i;
183         struct platform_device *gfar_dev;
184         struct resource res;
185         int ret;
186
187         for (np = NULL, i = 0;
188              (np = of_find_compatible_node(np, "network", "gianfar")) != NULL;
189              i++) {
190                 struct resource r[4];
191                 struct device_node *phy, *mdio;
192                 struct gianfar_platform_data gfar_data;
193                 const unsigned int *id;
194                 const char *model;
195                 const void *mac_addr;
196                 const phandle *ph;
197                 int n_res = 2;
198
199                 memset(r, 0, sizeof(r));
200                 memset(&gfar_data, 0, sizeof(gfar_data));
201
202                 ret = of_address_to_resource(np, 0, &r[0]);
203                 if (ret)
204                         goto err;
205
206                 r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
207                 r[1].flags = IORESOURCE_IRQ;
208
209                 model = get_property(np, "model", NULL);
210
211                 /* If we aren't the FEC we have multiple interrupts */
212                 if (model && strcasecmp(model, "FEC")) {
213                         r[1].name = gfar_tx_intr;
214
215                         r[2].name = gfar_rx_intr;
216                         r[2].start = r[2].end = irq_of_parse_and_map(np, 1);
217                         r[2].flags = IORESOURCE_IRQ;
218
219                         r[3].name = gfar_err_intr;
220                         r[3].start = r[3].end = irq_of_parse_and_map(np, 2);
221                         r[3].flags = IORESOURCE_IRQ;
222
223                         n_res += 2;
224                 }
225
226                 gfar_dev =
227                     platform_device_register_simple("fsl-gianfar", i, &r[0],
228                                                     n_res);
229
230                 if (IS_ERR(gfar_dev)) {
231                         ret = PTR_ERR(gfar_dev);
232                         goto err;
233                 }
234
235                 mac_addr = get_property(np, "local-mac-address", NULL);
236                 if (mac_addr == NULL)
237                         mac_addr = get_property(np, "mac-address", NULL);
238                 if (mac_addr == NULL) {
239                         /* Obsolete */
240                         mac_addr = get_property(np, "address", NULL);
241                 }
242
243                 if (mac_addr)
244                         memcpy(gfar_data.mac_addr, mac_addr, 6);
245
246                 if (model && !strcasecmp(model, "TSEC"))
247                         gfar_data.device_flags =
248                             FSL_GIANFAR_DEV_HAS_GIGABIT |
249                             FSL_GIANFAR_DEV_HAS_COALESCE |
250                             FSL_GIANFAR_DEV_HAS_RMON |
251                             FSL_GIANFAR_DEV_HAS_MULTI_INTR;
252                 if (model && !strcasecmp(model, "eTSEC"))
253                         gfar_data.device_flags =
254                             FSL_GIANFAR_DEV_HAS_GIGABIT |
255                             FSL_GIANFAR_DEV_HAS_COALESCE |
256                             FSL_GIANFAR_DEV_HAS_RMON |
257                             FSL_GIANFAR_DEV_HAS_MULTI_INTR |
258                             FSL_GIANFAR_DEV_HAS_CSUM |
259                             FSL_GIANFAR_DEV_HAS_VLAN |
260                             FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
261
262                 ph = get_property(np, "phy-handle", NULL);
263                 phy = of_find_node_by_phandle(*ph);
264
265                 if (phy == NULL) {
266                         ret = -ENODEV;
267                         goto unreg;
268                 }
269
270                 mdio = of_get_parent(phy);
271
272                 id = get_property(phy, "reg", NULL);
273                 ret = of_address_to_resource(mdio, 0, &res);
274                 if (ret) {
275                         of_node_put(phy);
276                         of_node_put(mdio);
277                         goto unreg;
278                 }
279
280                 gfar_data.phy_id = *id;
281                 gfar_data.bus_id = res.start;
282
283                 of_node_put(phy);
284                 of_node_put(mdio);
285
286                 ret =
287                     platform_device_add_data(gfar_dev, &gfar_data,
288                                              sizeof(struct
289                                                     gianfar_platform_data));
290                 if (ret)
291                         goto unreg;
292         }
293
294         return 0;
295
296 unreg:
297         platform_device_unregister(gfar_dev);
298 err:
299         return ret;
300 }
301
302 arch_initcall(gfar_of_init);
303
304 static int __init fsl_i2c_of_init(void)
305 {
306         struct device_node *np;
307         unsigned int i;
308         struct platform_device *i2c_dev;
309         int ret;
310
311         for (np = NULL, i = 0;
312              (np = of_find_compatible_node(np, "i2c", "fsl-i2c")) != NULL;
313              i++) {
314                 struct resource r[2];
315                 struct fsl_i2c_platform_data i2c_data;
316                 const unsigned char *flags = NULL;
317
318                 memset(&r, 0, sizeof(r));
319                 memset(&i2c_data, 0, sizeof(i2c_data));
320
321                 ret = of_address_to_resource(np, 0, &r[0]);
322                 if (ret)
323                         goto err;
324
325                 r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
326                 r[1].flags = IORESOURCE_IRQ;
327
328                 i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2);
329                 if (IS_ERR(i2c_dev)) {
330                         ret = PTR_ERR(i2c_dev);
331                         goto err;
332                 }
333
334                 i2c_data.device_flags = 0;
335                 flags = get_property(np, "dfsrr", NULL);
336                 if (flags)
337                         i2c_data.device_flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
338
339                 flags = get_property(np, "fsl5200-clocking", NULL);
340                 if (flags)
341                         i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200;
342
343                 ret =
344                     platform_device_add_data(i2c_dev, &i2c_data,
345                                              sizeof(struct
346                                                     fsl_i2c_platform_data));
347                 if (ret)
348                         goto unreg;
349         }
350
351         return 0;
352
353 unreg:
354         platform_device_unregister(i2c_dev);
355 err:
356         return ret;
357 }
358
359 arch_initcall(fsl_i2c_of_init);
360
361 #ifdef CONFIG_PPC_83xx
362 static int __init mpc83xx_wdt_init(void)
363 {
364         struct resource r;
365         struct device_node *soc, *np;
366         struct platform_device *dev;
367         const unsigned int *freq;
368         int ret;
369
370         np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt");
371
372         if (!np) {
373                 ret = -ENODEV;
374                 goto nodev;
375         }
376
377         soc = of_find_node_by_type(NULL, "soc");
378
379         if (!soc) {
380                 ret = -ENODEV;
381                 goto nosoc;
382         }
383
384         freq = get_property(soc, "bus-frequency", NULL);
385         if (!freq) {
386                 ret = -ENODEV;
387                 goto err;
388         }
389
390         memset(&r, 0, sizeof(r));
391
392         ret = of_address_to_resource(np, 0, &r);
393         if (ret)
394                 goto err;
395
396         dev = platform_device_register_simple("mpc83xx_wdt", 0, &r, 1);
397         if (IS_ERR(dev)) {
398                 ret = PTR_ERR(dev);
399                 goto err;
400         }
401
402         ret = platform_device_add_data(dev, freq, sizeof(int));
403         if (ret)
404                 goto unreg;
405
406         of_node_put(soc);
407         of_node_put(np);
408
409         return 0;
410
411 unreg:
412         platform_device_unregister(dev);
413 err:
414         of_node_put(soc);
415 nosoc:
416         of_node_put(np);
417 nodev:
418         return ret;
419 }
420
421 arch_initcall(mpc83xx_wdt_init);
422 #endif
423
424 static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type)
425 {
426         if (!phy_type)
427                 return FSL_USB2_PHY_NONE;
428         if (!strcasecmp(phy_type, "ulpi"))
429                 return FSL_USB2_PHY_ULPI;
430         if (!strcasecmp(phy_type, "utmi"))
431                 return FSL_USB2_PHY_UTMI;
432         if (!strcasecmp(phy_type, "utmi_wide"))
433                 return FSL_USB2_PHY_UTMI_WIDE;
434         if (!strcasecmp(phy_type, "serial"))
435                 return FSL_USB2_PHY_SERIAL;
436
437         return FSL_USB2_PHY_NONE;
438 }
439
440 static int __init fsl_usb_of_init(void)
441 {
442         struct device_node *np;
443         unsigned int i;
444         struct platform_device *usb_dev_mph = NULL, *usb_dev_dr = NULL;
445         int ret;
446
447         for (np = NULL, i = 0;
448              (np = of_find_compatible_node(np, "usb", "fsl-usb2-mph")) != NULL;
449              i++) {
450                 struct resource r[2];
451                 struct fsl_usb2_platform_data usb_data;
452                 const unsigned char *prop = NULL;
453
454                 memset(&r, 0, sizeof(r));
455                 memset(&usb_data, 0, sizeof(usb_data));
456
457                 ret = of_address_to_resource(np, 0, &r[0]);
458                 if (ret)
459                         goto err;
460
461                 r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
462                 r[1].flags = IORESOURCE_IRQ;
463
464                 usb_dev_mph =
465                     platform_device_register_simple("fsl-ehci", i, r, 2);
466                 if (IS_ERR(usb_dev_mph)) {
467                         ret = PTR_ERR(usb_dev_mph);
468                         goto err;
469                 }
470
471                 usb_dev_mph->dev.coherent_dma_mask = 0xffffffffUL;
472                 usb_dev_mph->dev.dma_mask = &usb_dev_mph->dev.coherent_dma_mask;
473
474                 usb_data.operating_mode = FSL_USB2_MPH_HOST;
475
476                 prop = get_property(np, "port0", NULL);
477                 if (prop)
478                         usb_data.port_enables |= FSL_USB2_PORT0_ENABLED;
479
480                 prop = get_property(np, "port1", NULL);
481                 if (prop)
482                         usb_data.port_enables |= FSL_USB2_PORT1_ENABLED;
483
484                 prop = get_property(np, "phy_type", NULL);
485                 usb_data.phy_mode = determine_usb_phy(prop);
486
487                 ret =
488                     platform_device_add_data(usb_dev_mph, &usb_data,
489                                              sizeof(struct
490                                                     fsl_usb2_platform_data));
491                 if (ret)
492                         goto unreg_mph;
493         }
494
495         for (np = NULL;
496              (np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL;
497              i++) {
498                 struct resource r[2];
499                 struct fsl_usb2_platform_data usb_data;
500                 const unsigned char *prop = NULL;
501
502                 memset(&r, 0, sizeof(r));
503                 memset(&usb_data, 0, sizeof(usb_data));
504
505                 ret = of_address_to_resource(np, 0, &r[0]);
506                 if (ret)
507                         goto unreg_mph;
508
509                 r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
510                 r[1].flags = IORESOURCE_IRQ;
511
512                 usb_dev_dr =
513                     platform_device_register_simple("fsl-ehci", i, r, 2);
514                 if (IS_ERR(usb_dev_dr)) {
515                         ret = PTR_ERR(usb_dev_dr);
516                         goto err;
517                 }
518
519                 usb_dev_dr->dev.coherent_dma_mask = 0xffffffffUL;
520                 usb_dev_dr->dev.dma_mask = &usb_dev_dr->dev.coherent_dma_mask;
521
522                 usb_data.operating_mode = FSL_USB2_DR_HOST;
523
524                 prop = get_property(np, "phy_type", NULL);
525                 usb_data.phy_mode = determine_usb_phy(prop);
526
527                 ret =
528                     platform_device_add_data(usb_dev_dr, &usb_data,
529                                              sizeof(struct
530                                                     fsl_usb2_platform_data));
531                 if (ret)
532                         goto unreg_dr;
533         }
534         return 0;
535
536 unreg_dr:
537         if (usb_dev_dr)
538                 platform_device_unregister(usb_dev_dr);
539 unreg_mph:
540         if (usb_dev_mph)
541                 platform_device_unregister(usb_dev_mph);
542 err:
543         return ret;
544 }
545
546 arch_initcall(fsl_usb_of_init);
547
548 #ifdef CONFIG_CPM2
549
550 static const char fcc_regs[] = "fcc_regs";
551 static const char fcc_regs_c[] = "fcc_regs_c";
552 static const char fcc_pram[] = "fcc_pram";
553 static char bus_id[9][BUS_ID_SIZE];
554
555 static int __init fs_enet_of_init(void)
556 {
557         struct device_node *np;
558         unsigned int i;
559         struct platform_device *fs_enet_dev;
560         struct resource res;
561         int ret;
562
563         for (np = NULL, i = 0;
564              (np = of_find_compatible_node(np, "network", "fs_enet")) != NULL;
565              i++) {
566                 struct resource r[4];
567                 struct device_node *phy, *mdio;
568                 struct fs_platform_info fs_enet_data;
569                 const unsigned int *id, *phy_addr;
570                 const void *mac_addr;
571                 const phandle *ph;
572                 const char *model;
573
574                 memset(r, 0, sizeof(r));
575                 memset(&fs_enet_data, 0, sizeof(fs_enet_data));
576
577                 ret = of_address_to_resource(np, 0, &r[0]);
578                 if (ret)
579                         goto err;
580                 r[0].name = fcc_regs;
581
582                 ret = of_address_to_resource(np, 1, &r[1]);
583                 if (ret)
584                         goto err;
585                 r[1].name = fcc_pram;
586
587                 ret = of_address_to_resource(np, 2, &r[2]);
588                 if (ret)
589                         goto err;
590                 r[2].name = fcc_regs_c;
591
592                 r[3].start = r[3].end = irq_of_parse_and_map(np, 0);
593                 r[3].flags = IORESOURCE_IRQ;
594
595                 fs_enet_dev =
596                     platform_device_register_simple("fsl-cpm-fcc", i, &r[0], 4);
597
598                 if (IS_ERR(fs_enet_dev)) {
599                         ret = PTR_ERR(fs_enet_dev);
600                         goto err;
601                 }
602
603                 model = get_property(np, "model", NULL);
604                 if (model == NULL) {
605                         ret = -ENODEV;
606                         goto unreg;
607                 }
608
609                 mac_addr = get_property(np, "mac-address", NULL);
610                 memcpy(fs_enet_data.macaddr, mac_addr, 6);
611
612                 ph = get_property(np, "phy-handle", NULL);
613                 phy = of_find_node_by_phandle(*ph);
614
615                 if (phy == NULL) {
616                         ret = -ENODEV;
617                         goto unreg;
618                 }
619
620                 phy_addr = get_property(phy, "reg", NULL);
621                 fs_enet_data.phy_addr = *phy_addr;
622
623                 id = get_property(np, "device-id", NULL);
624                 fs_enet_data.fs_no = *id;
625                 strcpy(fs_enet_data.fs_type, model);
626
627                 mdio = of_get_parent(phy);
628                 ret = of_address_to_resource(mdio, 0, &res);
629                 if (ret) {
630                         of_node_put(phy);
631                         of_node_put(mdio);
632                         goto unreg;
633                 }
634
635                 fs_enet_data.clk_rx = *((u32 *) get_property(np, "rx-clock", NULL));
636                 fs_enet_data.clk_tx = *((u32 *) get_property(np, "tx-clock", NULL));
637
638                 if (strstr(model, "FCC")) {
639                         int fcc_index = *id - 1;
640
641                         fs_enet_data.dpram_offset = (u32)cpm_dpram_addr(0);
642                         fs_enet_data.rx_ring = 32;
643                         fs_enet_data.tx_ring = 32;
644                         fs_enet_data.rx_copybreak = 240;
645                         fs_enet_data.use_napi = 0;
646                         fs_enet_data.napi_weight = 17;
647                         fs_enet_data.mem_offset = FCC_MEM_OFFSET(fcc_index);
648                         fs_enet_data.cp_page = CPM_CR_FCC_PAGE(fcc_index);
649                         fs_enet_data.cp_block = CPM_CR_FCC_SBLOCK(fcc_index);
650
651                         snprintf((char*)&bus_id[(*id)], BUS_ID_SIZE, "%x:%02x",
652                                                         (u32)res.start, fs_enet_data.phy_addr);
653                         fs_enet_data.bus_id = (char*)&bus_id[(*id)];
654                         fs_enet_data.init_ioports = init_fcc_ioports;
655                 }
656
657                 of_node_put(phy);
658                 of_node_put(mdio);
659
660                 ret = platform_device_add_data(fs_enet_dev, &fs_enet_data,
661                                              sizeof(struct
662                                                     fs_platform_info));
663                 if (ret)
664                         goto unreg;
665         }
666         return 0;
667
668 unreg:
669         platform_device_unregister(fs_enet_dev);
670 err:
671         return ret;
672 }
673
674 arch_initcall(fs_enet_of_init);
675
676 static const char scc_regs[] = "regs";
677 static const char scc_pram[] = "pram";
678
679 static int __init cpm_uart_of_init(void)
680 {
681         struct device_node *np;
682         unsigned int i;
683         struct platform_device *cpm_uart_dev;
684         int ret;
685
686         for (np = NULL, i = 0;
687              (np = of_find_compatible_node(np, "serial", "cpm_uart")) != NULL;
688              i++) {
689                 struct resource r[3];
690                 struct fs_uart_platform_info cpm_uart_data;
691                 const int *id;
692                 const char *model;
693
694                 memset(r, 0, sizeof(r));
695                 memset(&cpm_uart_data, 0, sizeof(cpm_uart_data));
696
697                 ret = of_address_to_resource(np, 0, &r[0]);
698                 if (ret)
699                         goto err;
700
701                 r[0].name = scc_regs;
702
703                 ret = of_address_to_resource(np, 1, &r[1]);
704                 if (ret)
705                         goto err;
706                 r[1].name = scc_pram;
707
708                 r[2].start = r[2].end = irq_of_parse_and_map(np, 0);
709                 r[2].flags = IORESOURCE_IRQ;
710
711                 cpm_uart_dev =
712                     platform_device_register_simple("fsl-cpm-scc:uart", i, &r[0], 3);
713
714                 if (IS_ERR(cpm_uart_dev)) {
715                         ret = PTR_ERR(cpm_uart_dev);
716                         goto err;
717                 }
718
719                 id = get_property(np, "device-id", NULL);
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
725                 cpm_uart_data.uart_clk = ppc_proc_freq;
726
727                 cpm_uart_data.tx_num_fifo = 4;
728                 cpm_uart_data.tx_buf_size = 32;
729                 cpm_uart_data.rx_num_fifo = 4;
730                 cpm_uart_data.rx_buf_size = 32;
731                 cpm_uart_data.clk_rx = *((u32 *) get_property(np, "rx-clock", NULL));
732                 cpm_uart_data.clk_tx = *((u32 *) get_property(np, "tx-clock", NULL));
733
734                 ret =
735                     platform_device_add_data(cpm_uart_dev, &cpm_uart_data,
736                                              sizeof(struct
737                                                     fs_uart_platform_info));
738                 if (ret)
739                         goto unreg;
740         }
741
742         return 0;
743
744 unreg:
745         platform_device_unregister(cpm_uart_dev);
746 err:
747         return ret;
748 }
749
750 arch_initcall(cpm_uart_of_init);
751 #endif /* CONFIG_CPM2 */