platform.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  1. /*
  2. * Copyright (C) 2006,2007 Felix Fietkau <nbd@openwrt.org>
  3. * Copyright (C) 2006,2007 Eugene Konev <ejka@openwrt.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #include <linux/init.h>
  20. #include <linux/types.h>
  21. #include <linux/module.h>
  22. #include <linux/delay.h>
  23. #include <linux/dma-mapping.h>
  24. #include <linux/platform_device.h>
  25. #include <linux/mtd/physmap.h>
  26. #include <linux/serial.h>
  27. #include <linux/serial_8250.h>
  28. #include <linux/ioport.h>
  29. #include <linux/io.h>
  30. #include <linux/vlynq.h>
  31. #include <linux/leds.h>
  32. #include <linux/string.h>
  33. #include <linux/etherdevice.h>
  34. #include <linux/phy.h>
  35. #include <linux/phy_fixed.h>
  36. #include <linux/gpio.h>
  37. #include <linux/clk.h>
  38. #include <asm/addrspace.h>
  39. #include <asm/mach-ar7/ar7.h>
  40. #include <asm/mach-ar7/prom.h>
  41. /*****************************************************************************
  42. * VLYNQ Bus
  43. ****************************************************************************/
  44. struct plat_vlynq_data {
  45. struct plat_vlynq_ops ops;
  46. int gpio_bit;
  47. int reset_bit;
  48. };
  49. static int vlynq_on(struct vlynq_device *dev)
  50. {
  51. int ret;
  52. struct plat_vlynq_data *pdata = dev->dev.platform_data;
  53. ret = gpio_request(pdata->gpio_bit, "vlynq");
  54. if (ret)
  55. goto out;
  56. ar7_device_reset(pdata->reset_bit);
  57. ret = ar7_gpio_disable(pdata->gpio_bit);
  58. if (ret)
  59. goto out_enabled;
  60. ret = ar7_gpio_enable(pdata->gpio_bit);
  61. if (ret)
  62. goto out_enabled;
  63. ret = gpio_direction_output(pdata->gpio_bit, 0);
  64. if (ret)
  65. goto out_gpio_enabled;
  66. msleep(50);
  67. gpio_set_value(pdata->gpio_bit, 1);
  68. msleep(50);
  69. return 0;
  70. out_gpio_enabled:
  71. ar7_gpio_disable(pdata->gpio_bit);
  72. out_enabled:
  73. ar7_device_disable(pdata->reset_bit);
  74. gpio_free(pdata->gpio_bit);
  75. out:
  76. return ret;
  77. }
  78. static void vlynq_off(struct vlynq_device *dev)
  79. {
  80. struct plat_vlynq_data *pdata = dev->dev.platform_data;
  81. ar7_gpio_disable(pdata->gpio_bit);
  82. gpio_free(pdata->gpio_bit);
  83. ar7_device_disable(pdata->reset_bit);
  84. }
  85. static struct resource vlynq_low_res[] = {
  86. {
  87. .name = "regs",
  88. .flags = IORESOURCE_MEM,
  89. .start = AR7_REGS_VLYNQ0,
  90. .end = AR7_REGS_VLYNQ0 + 0xff,
  91. },
  92. {
  93. .name = "irq",
  94. .flags = IORESOURCE_IRQ,
  95. .start = 29,
  96. .end = 29,
  97. },
  98. {
  99. .name = "mem",
  100. .flags = IORESOURCE_MEM,
  101. .start = 0x04000000,
  102. .end = 0x04ffffff,
  103. },
  104. {
  105. .name = "devirq",
  106. .flags = IORESOURCE_IRQ,
  107. .start = 80,
  108. .end = 111,
  109. },
  110. };
  111. static struct resource vlynq_high_res[] = {
  112. {
  113. .name = "regs",
  114. .flags = IORESOURCE_MEM,
  115. .start = AR7_REGS_VLYNQ1,
  116. .end = AR7_REGS_VLYNQ1 + 0xff,
  117. },
  118. {
  119. .name = "irq",
  120. .flags = IORESOURCE_IRQ,
  121. .start = 33,
  122. .end = 33,
  123. },
  124. {
  125. .name = "mem",
  126. .flags = IORESOURCE_MEM,
  127. .start = 0x0c000000,
  128. .end = 0x0cffffff,
  129. },
  130. {
  131. .name = "devirq",
  132. .flags = IORESOURCE_IRQ,
  133. .start = 112,
  134. .end = 143,
  135. },
  136. };
  137. static struct plat_vlynq_data vlynq_low_data = {
  138. .ops = {
  139. .on = vlynq_on,
  140. .off = vlynq_off,
  141. },
  142. .reset_bit = 20,
  143. .gpio_bit = 18,
  144. };
  145. static struct plat_vlynq_data vlynq_high_data = {
  146. .ops = {
  147. .on = vlynq_on,
  148. .off = vlynq_off,
  149. },
  150. .reset_bit = 16,
  151. .gpio_bit = 19,
  152. };
  153. static struct platform_device vlynq_low = {
  154. .id = 0,
  155. .name = "vlynq",
  156. .dev = {
  157. .platform_data = &vlynq_low_data,
  158. },
  159. .resource = vlynq_low_res,
  160. .num_resources = ARRAY_SIZE(vlynq_low_res),
  161. };
  162. static struct platform_device vlynq_high = {
  163. .id = 1,
  164. .name = "vlynq",
  165. .dev = {
  166. .platform_data = &vlynq_high_data,
  167. },
  168. .resource = vlynq_high_res,
  169. .num_resources = ARRAY_SIZE(vlynq_high_res),
  170. };
  171. /*****************************************************************************
  172. * Flash
  173. ****************************************************************************/
  174. static struct resource physmap_flash_resource = {
  175. .name = "mem",
  176. .flags = IORESOURCE_MEM,
  177. .start = 0x10000000,
  178. .end = 0x107fffff,
  179. };
  180. static const char *ar7_probe_types[] = { "ar7part", NULL };
  181. static struct physmap_flash_data physmap_flash_data = {
  182. .width = 2,
  183. .part_probe_types = ar7_probe_types,
  184. };
  185. static struct platform_device physmap_flash = {
  186. .name = "physmap-flash",
  187. .dev = {
  188. .platform_data = &physmap_flash_data,
  189. },
  190. .resource = &physmap_flash_resource,
  191. .num_resources = 1,
  192. };
  193. /*****************************************************************************
  194. * Ethernet
  195. ****************************************************************************/
  196. static struct resource cpmac_low_res[] = {
  197. {
  198. .name = "regs",
  199. .flags = IORESOURCE_MEM,
  200. .start = AR7_REGS_MAC0,
  201. .end = AR7_REGS_MAC0 + 0x7ff,
  202. },
  203. {
  204. .name = "irq",
  205. .flags = IORESOURCE_IRQ,
  206. .start = 27,
  207. .end = 27,
  208. },
  209. };
  210. static struct resource cpmac_high_res[] = {
  211. {
  212. .name = "regs",
  213. .flags = IORESOURCE_MEM,
  214. .start = AR7_REGS_MAC1,
  215. .end = AR7_REGS_MAC1 + 0x7ff,
  216. },
  217. {
  218. .name = "irq",
  219. .flags = IORESOURCE_IRQ,
  220. .start = 41,
  221. .end = 41,
  222. },
  223. };
  224. static struct fixed_phy_status fixed_phy_status __initdata = {
  225. .link = 1,
  226. .speed = 100,
  227. .duplex = 1,
  228. };
  229. static struct plat_cpmac_data cpmac_low_data = {
  230. .reset_bit = 17,
  231. .power_bit = 20,
  232. .phy_mask = 0x80000000,
  233. };
  234. static struct plat_cpmac_data cpmac_high_data = {
  235. .reset_bit = 21,
  236. .power_bit = 22,
  237. .phy_mask = 0x7fffffff,
  238. };
  239. static u64 cpmac_dma_mask = DMA_BIT_MASK(32);
  240. static struct platform_device cpmac_low = {
  241. .id = 0,
  242. .name = "cpmac",
  243. .dev = {
  244. .dma_mask = &cpmac_dma_mask,
  245. .coherent_dma_mask = DMA_BIT_MASK(32),
  246. .platform_data = &cpmac_low_data,
  247. },
  248. .resource = cpmac_low_res,
  249. .num_resources = ARRAY_SIZE(cpmac_low_res),
  250. };
  251. static struct platform_device cpmac_high = {
  252. .id = 1,
  253. .name = "cpmac",
  254. .dev = {
  255. .dma_mask = &cpmac_dma_mask,
  256. .coherent_dma_mask = DMA_BIT_MASK(32),
  257. .platform_data = &cpmac_high_data,
  258. },
  259. .resource = cpmac_high_res,
  260. .num_resources = ARRAY_SIZE(cpmac_high_res),
  261. };
  262. static void __init cpmac_get_mac(int instance, unsigned char *dev_addr)
  263. {
  264. char name[5], *mac;
  265. sprintf(name, "mac%c", 'a' + instance);
  266. mac = prom_getenv(name);
  267. if (!mac && instance) {
  268. sprintf(name, "mac%c", 'a');
  269. mac = prom_getenv(name);
  270. }
  271. if (mac) {
  272. if (!mac_pton(mac, dev_addr)) {
  273. pr_warn("cannot parse mac address, using random address\n");
  274. eth_random_addr(dev_addr);
  275. }
  276. } else
  277. eth_random_addr(dev_addr);
  278. }
  279. /*****************************************************************************
  280. * USB
  281. ****************************************************************************/
  282. static struct resource usb_res[] = {
  283. {
  284. .name = "regs",
  285. .flags = IORESOURCE_MEM,
  286. .start = AR7_REGS_USB,
  287. .end = AR7_REGS_USB + 0xff,
  288. },
  289. {
  290. .name = "irq",
  291. .flags = IORESOURCE_IRQ,
  292. .start = 32,
  293. .end = 32,
  294. },
  295. {
  296. .name = "mem",
  297. .flags = IORESOURCE_MEM,
  298. .start = 0x03400000,
  299. .end = 0x03401fff,
  300. },
  301. };
  302. static struct platform_device ar7_udc = {
  303. .name = "ar7_udc",
  304. .resource = usb_res,
  305. .num_resources = ARRAY_SIZE(usb_res),
  306. };
  307. /*****************************************************************************
  308. * LEDs
  309. ****************************************************************************/
  310. static struct gpio_led default_leds[] = {
  311. {
  312. .name = "status",
  313. .gpio = 8,
  314. .active_low = 1,
  315. },
  316. };
  317. static struct gpio_led titan_leds[] = {
  318. { .name = "status", .gpio = 8, .active_low = 1, },
  319. { .name = "wifi", .gpio = 13, .active_low = 1, },
  320. };
  321. static struct gpio_led dsl502t_leds[] = {
  322. {
  323. .name = "status",
  324. .gpio = 9,
  325. .active_low = 1,
  326. },
  327. {
  328. .name = "ethernet",
  329. .gpio = 7,
  330. .active_low = 1,
  331. },
  332. {
  333. .name = "usb",
  334. .gpio = 12,
  335. .active_low = 1,
  336. },
  337. };
  338. static struct gpio_led dg834g_leds[] = {
  339. {
  340. .name = "ppp",
  341. .gpio = 6,
  342. .active_low = 1,
  343. },
  344. {
  345. .name = "status",
  346. .gpio = 7,
  347. .active_low = 1,
  348. },
  349. {
  350. .name = "adsl",
  351. .gpio = 8,
  352. .active_low = 1,
  353. },
  354. {
  355. .name = "wifi",
  356. .gpio = 12,
  357. .active_low = 1,
  358. },
  359. {
  360. .name = "power",
  361. .gpio = 14,
  362. .active_low = 1,
  363. .default_trigger = "default-on",
  364. },
  365. };
  366. static struct gpio_led fb_sl_leds[] = {
  367. {
  368. .name = "1",
  369. .gpio = 7,
  370. },
  371. {
  372. .name = "2",
  373. .gpio = 13,
  374. .active_low = 1,
  375. },
  376. {
  377. .name = "3",
  378. .gpio = 10,
  379. .active_low = 1,
  380. },
  381. {
  382. .name = "4",
  383. .gpio = 12,
  384. .active_low = 1,
  385. },
  386. {
  387. .name = "5",
  388. .gpio = 9,
  389. .active_low = 1,
  390. },
  391. };
  392. static struct gpio_led fb_fon_leds[] = {
  393. {
  394. .name = "1",
  395. .gpio = 8,
  396. },
  397. {
  398. .name = "2",
  399. .gpio = 3,
  400. .active_low = 1,
  401. },
  402. {
  403. .name = "3",
  404. .gpio = 5,
  405. },
  406. {
  407. .name = "4",
  408. .gpio = 4,
  409. .active_low = 1,
  410. },
  411. {
  412. .name = "5",
  413. .gpio = 11,
  414. .active_low = 1,
  415. },
  416. };
  417. static struct gpio_led gt701_leds[] = {
  418. {
  419. .name = "inet:green",
  420. .gpio = 13,
  421. .active_low = 1,
  422. },
  423. {
  424. .name = "usb",
  425. .gpio = 12,
  426. .active_low = 1,
  427. },
  428. {
  429. .name = "inet:red",
  430. .gpio = 9,
  431. .active_low = 1,
  432. },
  433. {
  434. .name = "power:red",
  435. .gpio = 7,
  436. .active_low = 1,
  437. },
  438. {
  439. .name = "power:green",
  440. .gpio = 8,
  441. .active_low = 1,
  442. .default_trigger = "default-on",
  443. },
  444. {
  445. .name = "ethernet",
  446. .gpio = 10,
  447. .active_low = 1,
  448. },
  449. };
  450. static struct gpio_led_platform_data ar7_led_data;
  451. static struct platform_device ar7_gpio_leds = {
  452. .name = "leds-gpio",
  453. .dev = {
  454. .platform_data = &ar7_led_data,
  455. }
  456. };
  457. static void __init detect_leds(void)
  458. {
  459. char *prid, *usb_prod;
  460. /* Default LEDs */
  461. ar7_led_data.num_leds = ARRAY_SIZE(default_leds);
  462. ar7_led_data.leds = default_leds;
  463. /* FIXME: the whole thing is unreliable */
  464. prid = prom_getenv("ProductID");
  465. usb_prod = prom_getenv("usb_prod");
  466. /* If we can't get the product id from PROM, use the default LEDs */
  467. if (!prid)
  468. return;
  469. if (strstr(prid, "Fritz_Box_FON")) {
  470. ar7_led_data.num_leds = ARRAY_SIZE(fb_fon_leds);
  471. ar7_led_data.leds = fb_fon_leds;
  472. } else if (strstr(prid, "Fritz_Box_")) {
  473. ar7_led_data.num_leds = ARRAY_SIZE(fb_sl_leds);
  474. ar7_led_data.leds = fb_sl_leds;
  475. } else if ((!strcmp(prid, "AR7RD") || !strcmp(prid, "AR7DB"))
  476. && usb_prod != NULL && strstr(usb_prod, "DSL-502T")) {
  477. ar7_led_data.num_leds = ARRAY_SIZE(dsl502t_leds);
  478. ar7_led_data.leds = dsl502t_leds;
  479. } else if (strstr(prid, "DG834")) {
  480. ar7_led_data.num_leds = ARRAY_SIZE(dg834g_leds);
  481. ar7_led_data.leds = dg834g_leds;
  482. } else if (strstr(prid, "CYWM") || strstr(prid, "CYWL")) {
  483. ar7_led_data.num_leds = ARRAY_SIZE(titan_leds);
  484. ar7_led_data.leds = titan_leds;
  485. } else if (strstr(prid, "GT701")) {
  486. ar7_led_data.num_leds = ARRAY_SIZE(gt701_leds);
  487. ar7_led_data.leds = gt701_leds;
  488. }
  489. }
  490. /*****************************************************************************
  491. * Watchdog
  492. ****************************************************************************/
  493. static struct resource ar7_wdt_res = {
  494. .name = "regs",
  495. .flags = IORESOURCE_MEM,
  496. .start = -1, /* Filled at runtime */
  497. .end = -1, /* Filled at runtime */
  498. };
  499. static struct platform_device ar7_wdt = {
  500. .name = "ar7_wdt",
  501. .resource = &ar7_wdt_res,
  502. .num_resources = 1,
  503. };
  504. /*****************************************************************************
  505. * Init
  506. ****************************************************************************/
  507. static int __init ar7_register_uarts(void)
  508. {
  509. #ifdef CONFIG_SERIAL_8250
  510. static struct uart_port uart_port __initdata;
  511. struct clk *bus_clk;
  512. int res;
  513. memset(&uart_port, 0, sizeof(struct uart_port));
  514. bus_clk = clk_get(NULL, "bus");
  515. if (IS_ERR(bus_clk))
  516. panic("unable to get bus clk");
  517. uart_port.type = PORT_AR7;
  518. uart_port.uartclk = clk_get_rate(bus_clk) / 2;
  519. uart_port.iotype = UPIO_MEM32;
  520. uart_port.flags = UPF_FIXED_TYPE | UPF_BOOT_AUTOCONF;
  521. uart_port.regshift = 2;
  522. uart_port.line = 0;
  523. uart_port.irq = AR7_IRQ_UART0;
  524. uart_port.mapbase = AR7_REGS_UART0;
  525. uart_port.membase = ioremap(uart_port.mapbase, 256);
  526. res = early_serial_setup(&uart_port);
  527. if (res)
  528. return res;
  529. /* Only TNETD73xx have a second serial port */
  530. if (ar7_has_second_uart()) {
  531. uart_port.line = 1;
  532. uart_port.irq = AR7_IRQ_UART1;
  533. uart_port.mapbase = UR8_REGS_UART1;
  534. uart_port.membase = ioremap(uart_port.mapbase, 256);
  535. res = early_serial_setup(&uart_port);
  536. if (res)
  537. return res;
  538. }
  539. #endif
  540. return 0;
  541. }
  542. static void __init titan_fixup_devices(void)
  543. {
  544. /* Set vlynq0 data */
  545. vlynq_low_data.reset_bit = 15;
  546. vlynq_low_data.gpio_bit = 14;
  547. /* Set vlynq1 data */
  548. vlynq_high_data.reset_bit = 16;
  549. vlynq_high_data.gpio_bit = 7;
  550. /* Set vlynq0 resources */
  551. vlynq_low_res[0].start = TITAN_REGS_VLYNQ0;
  552. vlynq_low_res[0].end = TITAN_REGS_VLYNQ0 + 0xff;
  553. vlynq_low_res[1].start = 33;
  554. vlynq_low_res[1].end = 33;
  555. vlynq_low_res[2].start = 0x0c000000;
  556. vlynq_low_res[2].end = 0x0fffffff;
  557. vlynq_low_res[3].start = 80;
  558. vlynq_low_res[3].end = 111;
  559. /* Set vlynq1 resources */
  560. vlynq_high_res[0].start = TITAN_REGS_VLYNQ1;
  561. vlynq_high_res[0].end = TITAN_REGS_VLYNQ1 + 0xff;
  562. vlynq_high_res[1].start = 34;
  563. vlynq_high_res[1].end = 34;
  564. vlynq_high_res[2].start = 0x40000000;
  565. vlynq_high_res[2].end = 0x43ffffff;
  566. vlynq_high_res[3].start = 112;
  567. vlynq_high_res[3].end = 143;
  568. /* Set cpmac0 data */
  569. cpmac_low_data.phy_mask = 0x40000000;
  570. /* Set cpmac1 data */
  571. cpmac_high_data.phy_mask = 0x80000000;
  572. /* Set cpmac0 resources */
  573. cpmac_low_res[0].start = TITAN_REGS_MAC0;
  574. cpmac_low_res[0].end = TITAN_REGS_MAC0 + 0x7ff;
  575. /* Set cpmac1 resources */
  576. cpmac_high_res[0].start = TITAN_REGS_MAC1;
  577. cpmac_high_res[0].end = TITAN_REGS_MAC1 + 0x7ff;
  578. }
  579. static int __init ar7_register_devices(void)
  580. {
  581. void __iomem *bootcr;
  582. u32 val;
  583. int res;
  584. res = ar7_gpio_init();
  585. if (res)
  586. pr_warn("unable to register gpios: %d\n", res);
  587. res = ar7_register_uarts();
  588. if (res)
  589. pr_err("unable to setup uart(s): %d\n", res);
  590. res = platform_device_register(&physmap_flash);
  591. if (res)
  592. pr_warn("unable to register physmap-flash: %d\n", res);
  593. if (ar7_is_titan())
  594. titan_fixup_devices();
  595. ar7_device_disable(vlynq_low_data.reset_bit);
  596. res = platform_device_register(&vlynq_low);
  597. if (res)
  598. pr_warn("unable to register vlynq-low: %d\n", res);
  599. if (ar7_has_high_vlynq()) {
  600. ar7_device_disable(vlynq_high_data.reset_bit);
  601. res = platform_device_register(&vlynq_high);
  602. if (res)
  603. pr_warn("unable to register vlynq-high: %d\n", res);
  604. }
  605. if (ar7_has_high_cpmac()) {
  606. res = fixed_phy_add(PHY_POLL, cpmac_high.id,
  607. &fixed_phy_status, -1);
  608. if (!res) {
  609. cpmac_get_mac(1, cpmac_high_data.dev_addr);
  610. res = platform_device_register(&cpmac_high);
  611. if (res)
  612. pr_warn("unable to register cpmac-high: %d\n",
  613. res);
  614. } else
  615. pr_warn("unable to add cpmac-high phy: %d\n", res);
  616. } else
  617. cpmac_low_data.phy_mask = 0xffffffff;
  618. res = fixed_phy_add(PHY_POLL, cpmac_low.id, &fixed_phy_status, -1);
  619. if (!res) {
  620. cpmac_get_mac(0, cpmac_low_data.dev_addr);
  621. res = platform_device_register(&cpmac_low);
  622. if (res)
  623. pr_warn("unable to register cpmac-low: %d\n", res);
  624. } else
  625. pr_warn("unable to add cpmac-low phy: %d\n", res);
  626. detect_leds();
  627. res = platform_device_register(&ar7_gpio_leds);
  628. if (res)
  629. pr_warn("unable to register leds: %d\n", res);
  630. res = platform_device_register(&ar7_udc);
  631. if (res)
  632. pr_warn("unable to register usb slave: %d\n", res);
  633. /* Register watchdog only if enabled in hardware */
  634. bootcr = ioremap_nocache(AR7_REGS_DCL, 4);
  635. val = readl(bootcr);
  636. iounmap(bootcr);
  637. if (val & AR7_WDT_HW_ENA) {
  638. if (ar7_has_high_vlynq())
  639. ar7_wdt_res.start = UR8_REGS_WDT;
  640. else
  641. ar7_wdt_res.start = AR7_REGS_WDT;
  642. ar7_wdt_res.end = ar7_wdt_res.start + 0x20;
  643. res = platform_device_register(&ar7_wdt);
  644. if (res)
  645. pr_warn("unable to register watchdog: %d\n", res);
  646. }
  647. return 0;
  648. }
  649. device_initcall(ar7_register_devices);