platform.c 16 KB

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