fsl_soc.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738
  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. #include <linux/stddef.h>
  15. #include <linux/kernel.h>
  16. #include <linux/init.h>
  17. #include <linux/errno.h>
  18. #include <linux/major.h>
  19. #include <linux/delay.h>
  20. #include <linux/irq.h>
  21. #include <linux/module.h>
  22. #include <linux/device.h>
  23. #include <linux/platform_device.h>
  24. #include <linux/fsl_devices.h>
  25. #include <linux/fs_enet_pd.h>
  26. #include <linux/fs_uart_pd.h>
  27. #include <asm/system.h>
  28. #include <asm/atomic.h>
  29. #include <asm/io.h>
  30. #include <asm/irq.h>
  31. #include <asm/time.h>
  32. #include <asm/prom.h>
  33. #include <sysdev/fsl_soc.h>
  34. #include <mm/mmu_decl.h>
  35. #include <asm/cpm2.h>
  36. static phys_addr_t immrbase = -1;
  37. phys_addr_t get_immrbase(void)
  38. {
  39. struct device_node *soc;
  40. if (immrbase != -1)
  41. return immrbase;
  42. soc = of_find_node_by_type(NULL, "soc");
  43. if (soc) {
  44. unsigned int size;
  45. const void *prop = get_property(soc, "reg", &size);
  46. if (prop)
  47. immrbase = of_translate_address(soc, prop);
  48. of_node_put(soc);
  49. };
  50. return immrbase;
  51. }
  52. EXPORT_SYMBOL(get_immrbase);
  53. #ifdef CONFIG_CPM2
  54. static u32 brgfreq = -1;
  55. u32 get_brgfreq(void)
  56. {
  57. struct device_node *node;
  58. if (brgfreq != -1)
  59. return brgfreq;
  60. node = of_find_node_by_type(NULL, "cpm");
  61. if (node) {
  62. unsigned int size;
  63. const unsigned int *prop = get_property(node, "brg-frequency",
  64. &size);
  65. if (prop)
  66. brgfreq = *prop;
  67. of_node_put(node);
  68. };
  69. return brgfreq;
  70. }
  71. EXPORT_SYMBOL(get_brgfreq);
  72. static u32 fs_baudrate = -1;
  73. u32 get_baudrate(void)
  74. {
  75. struct device_node *node;
  76. if (fs_baudrate != -1)
  77. return fs_baudrate;
  78. node = of_find_node_by_type(NULL, "serial");
  79. if (node) {
  80. unsigned int size;
  81. const unsigned int *prop = get_property(node, "current-speed",
  82. &size);
  83. if (prop)
  84. fs_baudrate = *prop;
  85. of_node_put(node);
  86. };
  87. return fs_baudrate;
  88. }
  89. EXPORT_SYMBOL(get_baudrate);
  90. #endif /* CONFIG_CPM2 */
  91. static int __init gfar_mdio_of_init(void)
  92. {
  93. struct device_node *np;
  94. unsigned int i;
  95. struct platform_device *mdio_dev;
  96. struct resource res;
  97. int ret;
  98. for (np = NULL, i = 0;
  99. (np = of_find_compatible_node(np, "mdio", "gianfar")) != NULL;
  100. i++) {
  101. int k;
  102. struct device_node *child = NULL;
  103. struct gianfar_mdio_data mdio_data;
  104. memset(&res, 0, sizeof(res));
  105. memset(&mdio_data, 0, sizeof(mdio_data));
  106. ret = of_address_to_resource(np, 0, &res);
  107. if (ret)
  108. goto err;
  109. mdio_dev =
  110. platform_device_register_simple("fsl-gianfar_mdio",
  111. res.start, &res, 1);
  112. if (IS_ERR(mdio_dev)) {
  113. ret = PTR_ERR(mdio_dev);
  114. goto err;
  115. }
  116. for (k = 0; k < 32; k++)
  117. mdio_data.irq[k] = -1;
  118. while ((child = of_get_next_child(np, child)) != NULL) {
  119. int irq = irq_of_parse_and_map(child, 0);
  120. if (irq != NO_IRQ) {
  121. const u32 *id = get_property(child, "reg", NULL);
  122. mdio_data.irq[*id] = irq;
  123. }
  124. }
  125. ret =
  126. platform_device_add_data(mdio_dev, &mdio_data,
  127. sizeof(struct gianfar_mdio_data));
  128. if (ret)
  129. goto unreg;
  130. }
  131. return 0;
  132. unreg:
  133. platform_device_unregister(mdio_dev);
  134. err:
  135. return ret;
  136. }
  137. arch_initcall(gfar_mdio_of_init);
  138. static const char *gfar_tx_intr = "tx";
  139. static const char *gfar_rx_intr = "rx";
  140. static const char *gfar_err_intr = "error";
  141. static int __init gfar_of_init(void)
  142. {
  143. struct device_node *np;
  144. unsigned int i;
  145. struct platform_device *gfar_dev;
  146. struct resource res;
  147. int ret;
  148. for (np = NULL, i = 0;
  149. (np = of_find_compatible_node(np, "network", "gianfar")) != NULL;
  150. i++) {
  151. struct resource r[4];
  152. struct device_node *phy, *mdio;
  153. struct gianfar_platform_data gfar_data;
  154. const unsigned int *id;
  155. const char *model;
  156. const void *mac_addr;
  157. const phandle *ph;
  158. int n_res = 2;
  159. memset(r, 0, sizeof(r));
  160. memset(&gfar_data, 0, sizeof(gfar_data));
  161. ret = of_address_to_resource(np, 0, &r[0]);
  162. if (ret)
  163. goto err;
  164. r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
  165. r[1].flags = IORESOURCE_IRQ;
  166. model = get_property(np, "model", NULL);
  167. /* If we aren't the FEC we have multiple interrupts */
  168. if (model && strcasecmp(model, "FEC")) {
  169. r[1].name = gfar_tx_intr;
  170. r[2].name = gfar_rx_intr;
  171. r[2].start = r[2].end = irq_of_parse_and_map(np, 1);
  172. r[2].flags = IORESOURCE_IRQ;
  173. r[3].name = gfar_err_intr;
  174. r[3].start = r[3].end = irq_of_parse_and_map(np, 2);
  175. r[3].flags = IORESOURCE_IRQ;
  176. n_res += 2;
  177. }
  178. gfar_dev =
  179. platform_device_register_simple("fsl-gianfar", i, &r[0],
  180. n_res);
  181. if (IS_ERR(gfar_dev)) {
  182. ret = PTR_ERR(gfar_dev);
  183. goto err;
  184. }
  185. mac_addr = get_property(np, "local-mac-address", NULL);
  186. if (mac_addr == NULL)
  187. mac_addr = get_property(np, "mac-address", NULL);
  188. if (mac_addr == NULL) {
  189. /* Obsolete */
  190. mac_addr = get_property(np, "address", NULL);
  191. }
  192. if (mac_addr)
  193. memcpy(gfar_data.mac_addr, mac_addr, 6);
  194. if (model && !strcasecmp(model, "TSEC"))
  195. gfar_data.device_flags =
  196. FSL_GIANFAR_DEV_HAS_GIGABIT |
  197. FSL_GIANFAR_DEV_HAS_COALESCE |
  198. FSL_GIANFAR_DEV_HAS_RMON |
  199. FSL_GIANFAR_DEV_HAS_MULTI_INTR;
  200. if (model && !strcasecmp(model, "eTSEC"))
  201. gfar_data.device_flags =
  202. FSL_GIANFAR_DEV_HAS_GIGABIT |
  203. FSL_GIANFAR_DEV_HAS_COALESCE |
  204. FSL_GIANFAR_DEV_HAS_RMON |
  205. FSL_GIANFAR_DEV_HAS_MULTI_INTR |
  206. FSL_GIANFAR_DEV_HAS_CSUM |
  207. FSL_GIANFAR_DEV_HAS_VLAN |
  208. FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
  209. ph = get_property(np, "phy-handle", NULL);
  210. phy = of_find_node_by_phandle(*ph);
  211. if (phy == NULL) {
  212. ret = -ENODEV;
  213. goto unreg;
  214. }
  215. mdio = of_get_parent(phy);
  216. id = get_property(phy, "reg", NULL);
  217. ret = of_address_to_resource(mdio, 0, &res);
  218. if (ret) {
  219. of_node_put(phy);
  220. of_node_put(mdio);
  221. goto unreg;
  222. }
  223. gfar_data.phy_id = *id;
  224. gfar_data.bus_id = res.start;
  225. of_node_put(phy);
  226. of_node_put(mdio);
  227. ret =
  228. platform_device_add_data(gfar_dev, &gfar_data,
  229. sizeof(struct
  230. gianfar_platform_data));
  231. if (ret)
  232. goto unreg;
  233. }
  234. return 0;
  235. unreg:
  236. platform_device_unregister(gfar_dev);
  237. err:
  238. return ret;
  239. }
  240. arch_initcall(gfar_of_init);
  241. static int __init fsl_i2c_of_init(void)
  242. {
  243. struct device_node *np;
  244. unsigned int i;
  245. struct platform_device *i2c_dev;
  246. int ret;
  247. for (np = NULL, i = 0;
  248. (np = of_find_compatible_node(np, "i2c", "fsl-i2c")) != NULL;
  249. i++) {
  250. struct resource r[2];
  251. struct fsl_i2c_platform_data i2c_data;
  252. const unsigned char *flags = NULL;
  253. memset(&r, 0, sizeof(r));
  254. memset(&i2c_data, 0, sizeof(i2c_data));
  255. ret = of_address_to_resource(np, 0, &r[0]);
  256. if (ret)
  257. goto err;
  258. r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
  259. r[1].flags = IORESOURCE_IRQ;
  260. i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2);
  261. if (IS_ERR(i2c_dev)) {
  262. ret = PTR_ERR(i2c_dev);
  263. goto err;
  264. }
  265. i2c_data.device_flags = 0;
  266. flags = get_property(np, "dfsrr", NULL);
  267. if (flags)
  268. i2c_data.device_flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
  269. flags = get_property(np, "fsl5200-clocking", NULL);
  270. if (flags)
  271. i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200;
  272. ret =
  273. platform_device_add_data(i2c_dev, &i2c_data,
  274. sizeof(struct
  275. fsl_i2c_platform_data));
  276. if (ret)
  277. goto unreg;
  278. }
  279. return 0;
  280. unreg:
  281. platform_device_unregister(i2c_dev);
  282. err:
  283. return ret;
  284. }
  285. arch_initcall(fsl_i2c_of_init);
  286. #ifdef CONFIG_PPC_83xx
  287. static int __init mpc83xx_wdt_init(void)
  288. {
  289. struct resource r;
  290. struct device_node *soc, *np;
  291. struct platform_device *dev;
  292. const unsigned int *freq;
  293. int ret;
  294. np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt");
  295. if (!np) {
  296. ret = -ENODEV;
  297. goto nodev;
  298. }
  299. soc = of_find_node_by_type(NULL, "soc");
  300. if (!soc) {
  301. ret = -ENODEV;
  302. goto nosoc;
  303. }
  304. freq = get_property(soc, "bus-frequency", NULL);
  305. if (!freq) {
  306. ret = -ENODEV;
  307. goto err;
  308. }
  309. memset(&r, 0, sizeof(r));
  310. ret = of_address_to_resource(np, 0, &r);
  311. if (ret)
  312. goto err;
  313. dev = platform_device_register_simple("mpc83xx_wdt", 0, &r, 1);
  314. if (IS_ERR(dev)) {
  315. ret = PTR_ERR(dev);
  316. goto err;
  317. }
  318. ret = platform_device_add_data(dev, freq, sizeof(int));
  319. if (ret)
  320. goto unreg;
  321. of_node_put(soc);
  322. of_node_put(np);
  323. return 0;
  324. unreg:
  325. platform_device_unregister(dev);
  326. err:
  327. of_node_put(soc);
  328. nosoc:
  329. of_node_put(np);
  330. nodev:
  331. return ret;
  332. }
  333. arch_initcall(mpc83xx_wdt_init);
  334. #endif
  335. static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type)
  336. {
  337. if (!phy_type)
  338. return FSL_USB2_PHY_NONE;
  339. if (!strcasecmp(phy_type, "ulpi"))
  340. return FSL_USB2_PHY_ULPI;
  341. if (!strcasecmp(phy_type, "utmi"))
  342. return FSL_USB2_PHY_UTMI;
  343. if (!strcasecmp(phy_type, "utmi_wide"))
  344. return FSL_USB2_PHY_UTMI_WIDE;
  345. if (!strcasecmp(phy_type, "serial"))
  346. return FSL_USB2_PHY_SERIAL;
  347. return FSL_USB2_PHY_NONE;
  348. }
  349. static int __init fsl_usb_of_init(void)
  350. {
  351. struct device_node *np;
  352. unsigned int i;
  353. struct platform_device *usb_dev_mph = NULL, *usb_dev_dr = NULL;
  354. int ret;
  355. for (np = NULL, i = 0;
  356. (np = of_find_compatible_node(np, "usb", "fsl-usb2-mph")) != NULL;
  357. i++) {
  358. struct resource r[2];
  359. struct fsl_usb2_platform_data usb_data;
  360. const unsigned char *prop = NULL;
  361. memset(&r, 0, sizeof(r));
  362. memset(&usb_data, 0, sizeof(usb_data));
  363. ret = of_address_to_resource(np, 0, &r[0]);
  364. if (ret)
  365. goto err;
  366. r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
  367. r[1].flags = IORESOURCE_IRQ;
  368. usb_dev_mph =
  369. platform_device_register_simple("fsl-ehci", i, r, 2);
  370. if (IS_ERR(usb_dev_mph)) {
  371. ret = PTR_ERR(usb_dev_mph);
  372. goto err;
  373. }
  374. usb_dev_mph->dev.coherent_dma_mask = 0xffffffffUL;
  375. usb_dev_mph->dev.dma_mask = &usb_dev_mph->dev.coherent_dma_mask;
  376. usb_data.operating_mode = FSL_USB2_MPH_HOST;
  377. prop = get_property(np, "port0", NULL);
  378. if (prop)
  379. usb_data.port_enables |= FSL_USB2_PORT0_ENABLED;
  380. prop = get_property(np, "port1", NULL);
  381. if (prop)
  382. usb_data.port_enables |= FSL_USB2_PORT1_ENABLED;
  383. prop = get_property(np, "phy_type", NULL);
  384. usb_data.phy_mode = determine_usb_phy(prop);
  385. ret =
  386. platform_device_add_data(usb_dev_mph, &usb_data,
  387. sizeof(struct
  388. fsl_usb2_platform_data));
  389. if (ret)
  390. goto unreg_mph;
  391. }
  392. for (np = NULL;
  393. (np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL;
  394. i++) {
  395. struct resource r[2];
  396. struct fsl_usb2_platform_data usb_data;
  397. const unsigned char *prop = NULL;
  398. memset(&r, 0, sizeof(r));
  399. memset(&usb_data, 0, sizeof(usb_data));
  400. ret = of_address_to_resource(np, 0, &r[0]);
  401. if (ret)
  402. goto unreg_mph;
  403. r[1].start = r[1].end = irq_of_parse_and_map(np, 0);
  404. r[1].flags = IORESOURCE_IRQ;
  405. usb_dev_dr =
  406. platform_device_register_simple("fsl-ehci", i, r, 2);
  407. if (IS_ERR(usb_dev_dr)) {
  408. ret = PTR_ERR(usb_dev_dr);
  409. goto err;
  410. }
  411. usb_dev_dr->dev.coherent_dma_mask = 0xffffffffUL;
  412. usb_dev_dr->dev.dma_mask = &usb_dev_dr->dev.coherent_dma_mask;
  413. usb_data.operating_mode = FSL_USB2_DR_HOST;
  414. prop = get_property(np, "phy_type", NULL);
  415. usb_data.phy_mode = determine_usb_phy(prop);
  416. ret =
  417. platform_device_add_data(usb_dev_dr, &usb_data,
  418. sizeof(struct
  419. fsl_usb2_platform_data));
  420. if (ret)
  421. goto unreg_dr;
  422. }
  423. return 0;
  424. unreg_dr:
  425. if (usb_dev_dr)
  426. platform_device_unregister(usb_dev_dr);
  427. unreg_mph:
  428. if (usb_dev_mph)
  429. platform_device_unregister(usb_dev_mph);
  430. err:
  431. return ret;
  432. }
  433. arch_initcall(fsl_usb_of_init);
  434. #ifdef CONFIG_CPM2
  435. static const char fcc_regs[] = "fcc_regs";
  436. static const char fcc_regs_c[] = "fcc_regs_c";
  437. static const char fcc_pram[] = "fcc_pram";
  438. static char bus_id[9][BUS_ID_SIZE];
  439. static int __init fs_enet_of_init(void)
  440. {
  441. struct device_node *np;
  442. unsigned int i;
  443. struct platform_device *fs_enet_dev;
  444. struct resource res;
  445. int ret;
  446. for (np = NULL, i = 0;
  447. (np = of_find_compatible_node(np, "network", "fs_enet")) != NULL;
  448. i++) {
  449. struct resource r[4];
  450. struct device_node *phy, *mdio;
  451. struct fs_platform_info fs_enet_data;
  452. const unsigned int *id, *phy_addr;
  453. const void *mac_addr;
  454. const phandle *ph;
  455. const char *model;
  456. memset(r, 0, sizeof(r));
  457. memset(&fs_enet_data, 0, sizeof(fs_enet_data));
  458. ret = of_address_to_resource(np, 0, &r[0]);
  459. if (ret)
  460. goto err;
  461. r[0].name = fcc_regs;
  462. ret = of_address_to_resource(np, 1, &r[1]);
  463. if (ret)
  464. goto err;
  465. r[1].name = fcc_pram;
  466. ret = of_address_to_resource(np, 2, &r[2]);
  467. if (ret)
  468. goto err;
  469. r[2].name = fcc_regs_c;
  470. r[3].start = r[3].end = irq_of_parse_and_map(np, 0);
  471. r[3].flags = IORESOURCE_IRQ;
  472. fs_enet_dev =
  473. platform_device_register_simple("fsl-cpm-fcc", i, &r[0], 4);
  474. if (IS_ERR(fs_enet_dev)) {
  475. ret = PTR_ERR(fs_enet_dev);
  476. goto err;
  477. }
  478. model = get_property(np, "model", NULL);
  479. if (model == NULL) {
  480. ret = -ENODEV;
  481. goto unreg;
  482. }
  483. mac_addr = get_property(np, "mac-address", NULL);
  484. memcpy(fs_enet_data.macaddr, mac_addr, 6);
  485. ph = get_property(np, "phy-handle", NULL);
  486. phy = of_find_node_by_phandle(*ph);
  487. if (phy == NULL) {
  488. ret = -ENODEV;
  489. goto unreg;
  490. }
  491. phy_addr = get_property(phy, "reg", NULL);
  492. fs_enet_data.phy_addr = *phy_addr;
  493. id = get_property(np, "device-id", NULL);
  494. fs_enet_data.fs_no = *id;
  495. mdio = of_get_parent(phy);
  496. ret = of_address_to_resource(mdio, 0, &res);
  497. if (ret) {
  498. of_node_put(phy);
  499. of_node_put(mdio);
  500. goto unreg;
  501. }
  502. if (strstr(model, "FCC")) {
  503. int fcc_index = fs_get_fcc_index(*id);
  504. fs_enet_data.dpram_offset = (u32)cpm_dpram_addr(0);
  505. fs_enet_data.rx_ring = 32;
  506. fs_enet_data.tx_ring = 32;
  507. fs_enet_data.rx_copybreak = 240;
  508. fs_enet_data.use_napi = 0;
  509. fs_enet_data.napi_weight = 17;
  510. fs_enet_data.mem_offset = FCC_MEM_OFFSET(fcc_index);
  511. fs_enet_data.cp_page = CPM_CR_FCC_PAGE(fcc_index);
  512. fs_enet_data.cp_block = CPM_CR_FCC_SBLOCK(fcc_index);
  513. snprintf((char*)&bus_id[(*id)], BUS_ID_SIZE, "%x:%02x",
  514. (u32)res.start, fs_enet_data.phy_addr);
  515. fs_enet_data.bus_id = (char*)&bus_id[(*id)];
  516. }
  517. of_node_put(phy);
  518. of_node_put(mdio);
  519. ret = platform_device_add_data(fs_enet_dev, &fs_enet_data,
  520. sizeof(struct
  521. fs_platform_info));
  522. if (ret)
  523. goto unreg;
  524. }
  525. return 0;
  526. unreg:
  527. platform_device_unregister(fs_enet_dev);
  528. err:
  529. return ret;
  530. }
  531. arch_initcall(fs_enet_of_init);
  532. static const char scc_regs[] = "regs";
  533. static const char scc_pram[] = "pram";
  534. static int __init cpm_uart_of_init(void)
  535. {
  536. struct device_node *np;
  537. unsigned int i;
  538. struct platform_device *cpm_uart_dev;
  539. int ret;
  540. for (np = NULL, i = 0;
  541. (np = of_find_compatible_node(np, "serial", "cpm_uart")) != NULL;
  542. i++) {
  543. struct resource r[3];
  544. struct fs_uart_platform_info cpm_uart_data;
  545. const int *id;
  546. memset(r, 0, sizeof(r));
  547. memset(&cpm_uart_data, 0, sizeof(cpm_uart_data));
  548. ret = of_address_to_resource(np, 0, &r[0]);
  549. if (ret)
  550. goto err;
  551. r[0].name = scc_regs;
  552. ret = of_address_to_resource(np, 1, &r[1]);
  553. if (ret)
  554. goto err;
  555. r[1].name = scc_pram;
  556. r[2].start = r[2].end = irq_of_parse_and_map(np, 0);
  557. r[2].flags = IORESOURCE_IRQ;
  558. cpm_uart_dev =
  559. platform_device_register_simple("fsl-cpm-scc:uart", i, &r[0], 3);
  560. if (IS_ERR(cpm_uart_dev)) {
  561. ret = PTR_ERR(cpm_uart_dev);
  562. goto err;
  563. }
  564. id = get_property(np, "device-id", NULL);
  565. cpm_uart_data.fs_no = *id;
  566. cpm_uart_data.uart_clk = ppc_proc_freq;
  567. cpm_uart_data.tx_num_fifo = 4;
  568. cpm_uart_data.tx_buf_size = 32;
  569. cpm_uart_data.rx_num_fifo = 4;
  570. cpm_uart_data.rx_buf_size = 32;
  571. ret =
  572. platform_device_add_data(cpm_uart_dev, &cpm_uart_data,
  573. sizeof(struct
  574. fs_uart_platform_info));
  575. if (ret)
  576. goto unreg;
  577. }
  578. return 0;
  579. unreg:
  580. platform_device_unregister(cpm_uart_dev);
  581. err:
  582. return ret;
  583. }
  584. arch_initcall(cpm_uart_of_init);
  585. #endif /* CONFIG_CPM2 */