platform.c 16 KB

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