serial.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. /*
  2. * arch/arm/mach-omap2/serial.c
  3. *
  4. * OMAP2 serial support.
  5. *
  6. * Copyright (C) 2005-2008 Nokia Corporation
  7. * Author: Paul Mundt <paul.mundt@nokia.com>
  8. *
  9. * Major rework for PM support by Kevin Hilman
  10. *
  11. * Based off of arch/arm/mach-omap/omap1/serial.c
  12. *
  13. * Copyright (C) 2009 Texas Instruments
  14. * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com
  15. *
  16. * This file is subject to the terms and conditions of the GNU General Public
  17. * License. See the file "COPYING" in the main directory of this archive
  18. * for more details.
  19. */
  20. #include <linux/kernel.h>
  21. #include <linux/init.h>
  22. #include <linux/serial_8250.h>
  23. #include <linux/serial_reg.h>
  24. #include <linux/clk.h>
  25. #include <linux/io.h>
  26. #include <plat/common.h>
  27. #include <plat/board.h>
  28. #include <plat/clock.h>
  29. #include <plat/control.h>
  30. #include "prm.h"
  31. #include "pm.h"
  32. #include "prm-regbits-34xx.h"
  33. #define UART_OMAP_WER 0x17 /* Wake-up enable register */
  34. #define DEFAULT_TIMEOUT (5 * HZ)
  35. struct omap_uart_state {
  36. int num;
  37. int can_sleep;
  38. struct timer_list timer;
  39. u32 timeout;
  40. void __iomem *wk_st;
  41. void __iomem *wk_en;
  42. u32 wk_mask;
  43. u32 padconf;
  44. struct clk *ick;
  45. struct clk *fck;
  46. int clocked;
  47. struct plat_serial8250_port *p;
  48. struct list_head node;
  49. struct platform_device pdev;
  50. #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
  51. int context_valid;
  52. /* Registers to be saved/restored for OFF-mode */
  53. u16 dll;
  54. u16 dlh;
  55. u16 ier;
  56. u16 sysc;
  57. u16 scr;
  58. u16 wer;
  59. #endif
  60. };
  61. static LIST_HEAD(uart_list);
  62. static struct plat_serial8250_port serial_platform_data0[] = {
  63. {
  64. .mapbase = OMAP_UART1_BASE,
  65. .irq = 72,
  66. .flags = UPF_BOOT_AUTOCONF,
  67. .iotype = UPIO_MEM,
  68. .regshift = 2,
  69. .uartclk = OMAP24XX_BASE_BAUD * 16,
  70. }, {
  71. .flags = 0
  72. }
  73. };
  74. static struct plat_serial8250_port serial_platform_data1[] = {
  75. {
  76. .mapbase = OMAP_UART2_BASE,
  77. .irq = 73,
  78. .flags = UPF_BOOT_AUTOCONF,
  79. .iotype = UPIO_MEM,
  80. .regshift = 2,
  81. .uartclk = OMAP24XX_BASE_BAUD * 16,
  82. }, {
  83. .flags = 0
  84. }
  85. };
  86. static struct plat_serial8250_port serial_platform_data2[] = {
  87. {
  88. .mapbase = OMAP_UART3_BASE,
  89. .irq = 74,
  90. .flags = UPF_BOOT_AUTOCONF,
  91. .iotype = UPIO_MEM,
  92. .regshift = 2,
  93. .uartclk = OMAP24XX_BASE_BAUD * 16,
  94. }, {
  95. #ifdef CONFIG_ARCH_OMAP4
  96. .membase = OMAP2_IO_ADDRESS(OMAP_UART4_BASE),
  97. .mapbase = OMAP_UART4_BASE,
  98. .irq = 70,
  99. .flags = UPF_BOOT_AUTOCONF,
  100. .iotype = UPIO_MEM,
  101. .regshift = 2,
  102. .uartclk = OMAP24XX_BASE_BAUD * 16,
  103. }, {
  104. #endif
  105. .flags = 0
  106. }
  107. };
  108. #ifdef CONFIG_ARCH_OMAP4
  109. static struct plat_serial8250_port serial_platform_data3[] = {
  110. {
  111. .mapbase = OMAP_UART4_BASE,
  112. .irq = 70,
  113. .flags = UPF_BOOT_AUTOCONF,
  114. .iotype = UPIO_MEM,
  115. .regshift = 2,
  116. .uartclk = OMAP24XX_BASE_BAUD * 16,
  117. }, {
  118. .flags = 0
  119. }
  120. };
  121. #endif
  122. static inline unsigned int serial_read_reg(struct plat_serial8250_port *up,
  123. int offset)
  124. {
  125. offset <<= up->regshift;
  126. return (unsigned int)__raw_readb(up->membase + offset);
  127. }
  128. static inline void serial_write_reg(struct plat_serial8250_port *p, int offset,
  129. int value)
  130. {
  131. offset <<= p->regshift;
  132. __raw_writeb(value, p->membase + offset);
  133. }
  134. /*
  135. * Internal UARTs need to be initialized for the 8250 autoconfig to work
  136. * properly. Note that the TX watermark initialization may not be needed
  137. * once the 8250.c watermark handling code is merged.
  138. */
  139. static inline void __init omap_uart_reset(struct omap_uart_state *uart)
  140. {
  141. struct plat_serial8250_port *p = uart->p;
  142. serial_write_reg(p, UART_OMAP_MDR1, 0x07);
  143. serial_write_reg(p, UART_OMAP_SCR, 0x08);
  144. serial_write_reg(p, UART_OMAP_MDR1, 0x00);
  145. serial_write_reg(p, UART_OMAP_SYSC, (0x02 << 3) | (1 << 2) | (1 << 0));
  146. }
  147. #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3)
  148. static int enable_off_mode; /* to be removed by full off-mode patches */
  149. static void omap_uart_save_context(struct omap_uart_state *uart)
  150. {
  151. u16 lcr = 0;
  152. struct plat_serial8250_port *p = uart->p;
  153. if (!enable_off_mode)
  154. return;
  155. lcr = serial_read_reg(p, UART_LCR);
  156. serial_write_reg(p, UART_LCR, 0xBF);
  157. uart->dll = serial_read_reg(p, UART_DLL);
  158. uart->dlh = serial_read_reg(p, UART_DLM);
  159. serial_write_reg(p, UART_LCR, lcr);
  160. uart->ier = serial_read_reg(p, UART_IER);
  161. uart->sysc = serial_read_reg(p, UART_OMAP_SYSC);
  162. uart->scr = serial_read_reg(p, UART_OMAP_SCR);
  163. uart->wer = serial_read_reg(p, UART_OMAP_WER);
  164. uart->context_valid = 1;
  165. }
  166. static void omap_uart_restore_context(struct omap_uart_state *uart)
  167. {
  168. u16 efr = 0;
  169. struct plat_serial8250_port *p = uart->p;
  170. if (!enable_off_mode)
  171. return;
  172. if (!uart->context_valid)
  173. return;
  174. uart->context_valid = 0;
  175. serial_write_reg(p, UART_OMAP_MDR1, 0x7);
  176. serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
  177. efr = serial_read_reg(p, UART_EFR);
  178. serial_write_reg(p, UART_EFR, UART_EFR_ECB);
  179. serial_write_reg(p, UART_LCR, 0x0); /* Operational mode */
  180. serial_write_reg(p, UART_IER, 0x0);
  181. serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
  182. serial_write_reg(p, UART_DLL, uart->dll);
  183. serial_write_reg(p, UART_DLM, uart->dlh);
  184. serial_write_reg(p, UART_LCR, 0x0); /* Operational mode */
  185. serial_write_reg(p, UART_IER, uart->ier);
  186. serial_write_reg(p, UART_FCR, 0xA1);
  187. serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
  188. serial_write_reg(p, UART_EFR, efr);
  189. serial_write_reg(p, UART_LCR, UART_LCR_WLEN8);
  190. serial_write_reg(p, UART_OMAP_SCR, uart->scr);
  191. serial_write_reg(p, UART_OMAP_WER, uart->wer);
  192. serial_write_reg(p, UART_OMAP_SYSC, uart->sysc);
  193. serial_write_reg(p, UART_OMAP_MDR1, 0x00); /* UART 16x mode */
  194. }
  195. #else
  196. static inline void omap_uart_save_context(struct omap_uart_state *uart) {}
  197. static inline void omap_uart_restore_context(struct omap_uart_state *uart) {}
  198. #endif /* CONFIG_PM && CONFIG_ARCH_OMAP3 */
  199. static inline void omap_uart_enable_clocks(struct omap_uart_state *uart)
  200. {
  201. if (uart->clocked)
  202. return;
  203. clk_enable(uart->ick);
  204. clk_enable(uart->fck);
  205. uart->clocked = 1;
  206. omap_uart_restore_context(uart);
  207. }
  208. #ifdef CONFIG_PM
  209. static inline void omap_uart_disable_clocks(struct omap_uart_state *uart)
  210. {
  211. if (!uart->clocked)
  212. return;
  213. omap_uart_save_context(uart);
  214. uart->clocked = 0;
  215. clk_disable(uart->ick);
  216. clk_disable(uart->fck);
  217. }
  218. static void omap_uart_enable_wakeup(struct omap_uart_state *uart)
  219. {
  220. /* Set wake-enable bit */
  221. if (uart->wk_en && uart->wk_mask) {
  222. u32 v = __raw_readl(uart->wk_en);
  223. v |= uart->wk_mask;
  224. __raw_writel(v, uart->wk_en);
  225. }
  226. /* Ensure IOPAD wake-enables are set */
  227. if (cpu_is_omap34xx() && uart->padconf) {
  228. u16 v = omap_ctrl_readw(uart->padconf);
  229. v |= OMAP3_PADCONF_WAKEUPENABLE0;
  230. omap_ctrl_writew(v, uart->padconf);
  231. }
  232. }
  233. static void omap_uart_disable_wakeup(struct omap_uart_state *uart)
  234. {
  235. /* Clear wake-enable bit */
  236. if (uart->wk_en && uart->wk_mask) {
  237. u32 v = __raw_readl(uart->wk_en);
  238. v &= ~uart->wk_mask;
  239. __raw_writel(v, uart->wk_en);
  240. }
  241. /* Ensure IOPAD wake-enables are cleared */
  242. if (cpu_is_omap34xx() && uart->padconf) {
  243. u16 v = omap_ctrl_readw(uart->padconf);
  244. v &= ~OMAP3_PADCONF_WAKEUPENABLE0;
  245. omap_ctrl_writew(v, uart->padconf);
  246. }
  247. }
  248. static void omap_uart_smart_idle_enable(struct omap_uart_state *uart,
  249. int enable)
  250. {
  251. struct plat_serial8250_port *p = uart->p;
  252. u16 sysc;
  253. sysc = serial_read_reg(p, UART_OMAP_SYSC) & 0x7;
  254. if (enable)
  255. sysc |= 0x2 << 3;
  256. else
  257. sysc |= 0x1 << 3;
  258. serial_write_reg(p, UART_OMAP_SYSC, sysc);
  259. }
  260. static void omap_uart_block_sleep(struct omap_uart_state *uart)
  261. {
  262. omap_uart_enable_clocks(uart);
  263. omap_uart_smart_idle_enable(uart, 0);
  264. uart->can_sleep = 0;
  265. if (uart->timeout)
  266. mod_timer(&uart->timer, jiffies + uart->timeout);
  267. else
  268. del_timer(&uart->timer);
  269. }
  270. static void omap_uart_allow_sleep(struct omap_uart_state *uart)
  271. {
  272. if (device_may_wakeup(&uart->pdev.dev))
  273. omap_uart_enable_wakeup(uart);
  274. else
  275. omap_uart_disable_wakeup(uart);
  276. if (!uart->clocked)
  277. return;
  278. omap_uart_smart_idle_enable(uart, 1);
  279. uart->can_sleep = 1;
  280. del_timer(&uart->timer);
  281. }
  282. static void omap_uart_idle_timer(unsigned long data)
  283. {
  284. struct omap_uart_state *uart = (struct omap_uart_state *)data;
  285. omap_uart_allow_sleep(uart);
  286. }
  287. void omap_uart_prepare_idle(int num)
  288. {
  289. struct omap_uart_state *uart;
  290. list_for_each_entry(uart, &uart_list, node) {
  291. if (num == uart->num && uart->can_sleep) {
  292. omap_uart_disable_clocks(uart);
  293. return;
  294. }
  295. }
  296. }
  297. void omap_uart_resume_idle(int num)
  298. {
  299. struct omap_uart_state *uart;
  300. list_for_each_entry(uart, &uart_list, node) {
  301. if (num == uart->num) {
  302. omap_uart_enable_clocks(uart);
  303. /* Check for IO pad wakeup */
  304. if (cpu_is_omap34xx() && uart->padconf) {
  305. u16 p = omap_ctrl_readw(uart->padconf);
  306. if (p & OMAP3_PADCONF_WAKEUPEVENT0)
  307. omap_uart_block_sleep(uart);
  308. }
  309. /* Check for normal UART wakeup */
  310. if (__raw_readl(uart->wk_st) & uart->wk_mask)
  311. omap_uart_block_sleep(uart);
  312. return;
  313. }
  314. }
  315. }
  316. void omap_uart_prepare_suspend(void)
  317. {
  318. struct omap_uart_state *uart;
  319. list_for_each_entry(uart, &uart_list, node) {
  320. omap_uart_allow_sleep(uart);
  321. }
  322. }
  323. int omap_uart_can_sleep(void)
  324. {
  325. struct omap_uart_state *uart;
  326. int can_sleep = 1;
  327. list_for_each_entry(uart, &uart_list, node) {
  328. if (!uart->clocked)
  329. continue;
  330. if (!uart->can_sleep) {
  331. can_sleep = 0;
  332. continue;
  333. }
  334. /* This UART can now safely sleep. */
  335. omap_uart_allow_sleep(uart);
  336. }
  337. return can_sleep;
  338. }
  339. /**
  340. * omap_uart_interrupt()
  341. *
  342. * This handler is used only to detect that *any* UART interrupt has
  343. * occurred. It does _nothing_ to handle the interrupt. Rather,
  344. * any UART interrupt will trigger the inactivity timer so the
  345. * UART will not idle or sleep for its timeout period.
  346. *
  347. **/
  348. static irqreturn_t omap_uart_interrupt(int irq, void *dev_id)
  349. {
  350. struct omap_uart_state *uart = dev_id;
  351. omap_uart_block_sleep(uart);
  352. return IRQ_NONE;
  353. }
  354. static void omap_uart_idle_init(struct omap_uart_state *uart)
  355. {
  356. struct plat_serial8250_port *p = uart->p;
  357. int ret;
  358. uart->can_sleep = 0;
  359. uart->timeout = DEFAULT_TIMEOUT;
  360. setup_timer(&uart->timer, omap_uart_idle_timer,
  361. (unsigned long) uart);
  362. mod_timer(&uart->timer, jiffies + uart->timeout);
  363. omap_uart_smart_idle_enable(uart, 0);
  364. if (cpu_is_omap34xx()) {
  365. u32 mod = (uart->num == 2) ? OMAP3430_PER_MOD : CORE_MOD;
  366. u32 wk_mask = 0;
  367. u32 padconf = 0;
  368. uart->wk_en = OMAP34XX_PRM_REGADDR(mod, PM_WKEN1);
  369. uart->wk_st = OMAP34XX_PRM_REGADDR(mod, PM_WKST1);
  370. switch (uart->num) {
  371. case 0:
  372. wk_mask = OMAP3430_ST_UART1_MASK;
  373. padconf = 0x182;
  374. break;
  375. case 1:
  376. wk_mask = OMAP3430_ST_UART2_MASK;
  377. padconf = 0x17a;
  378. break;
  379. case 2:
  380. wk_mask = OMAP3430_ST_UART3_MASK;
  381. padconf = 0x19e;
  382. break;
  383. }
  384. uart->wk_mask = wk_mask;
  385. uart->padconf = padconf;
  386. } else if (cpu_is_omap24xx()) {
  387. u32 wk_mask = 0;
  388. if (cpu_is_omap2430()) {
  389. uart->wk_en = OMAP2430_PRM_REGADDR(CORE_MOD, PM_WKEN1);
  390. uart->wk_st = OMAP2430_PRM_REGADDR(CORE_MOD, PM_WKST1);
  391. } else if (cpu_is_omap2420()) {
  392. uart->wk_en = OMAP2420_PRM_REGADDR(CORE_MOD, PM_WKEN1);
  393. uart->wk_st = OMAP2420_PRM_REGADDR(CORE_MOD, PM_WKST1);
  394. }
  395. switch (uart->num) {
  396. case 0:
  397. wk_mask = OMAP24XX_ST_UART1_MASK;
  398. break;
  399. case 1:
  400. wk_mask = OMAP24XX_ST_UART2_MASK;
  401. break;
  402. case 2:
  403. wk_mask = OMAP24XX_ST_UART3_MASK;
  404. break;
  405. }
  406. uart->wk_mask = wk_mask;
  407. } else {
  408. uart->wk_en = 0;
  409. uart->wk_st = 0;
  410. uart->wk_mask = 0;
  411. uart->padconf = 0;
  412. }
  413. p->irqflags |= IRQF_SHARED;
  414. ret = request_irq(p->irq, omap_uart_interrupt, IRQF_SHARED,
  415. "serial idle", (void *)uart);
  416. WARN_ON(ret);
  417. }
  418. void omap_uart_enable_irqs(int enable)
  419. {
  420. int ret;
  421. struct omap_uart_state *uart;
  422. list_for_each_entry(uart, &uart_list, node) {
  423. if (enable)
  424. ret = request_irq(uart->p->irq, omap_uart_interrupt,
  425. IRQF_SHARED, "serial idle", (void *)uart);
  426. else
  427. free_irq(uart->p->irq, (void *)uart);
  428. }
  429. }
  430. static ssize_t sleep_timeout_show(struct device *dev,
  431. struct device_attribute *attr,
  432. char *buf)
  433. {
  434. struct platform_device *pdev = container_of(dev,
  435. struct platform_device, dev);
  436. struct omap_uart_state *uart = container_of(pdev,
  437. struct omap_uart_state, pdev);
  438. return sprintf(buf, "%u\n", uart->timeout / HZ);
  439. }
  440. static ssize_t sleep_timeout_store(struct device *dev,
  441. struct device_attribute *attr,
  442. const char *buf, size_t n)
  443. {
  444. struct platform_device *pdev = container_of(dev,
  445. struct platform_device, dev);
  446. struct omap_uart_state *uart = container_of(pdev,
  447. struct omap_uart_state, pdev);
  448. unsigned int value;
  449. if (sscanf(buf, "%u", &value) != 1) {
  450. printk(KERN_ERR "sleep_timeout_store: Invalid value\n");
  451. return -EINVAL;
  452. }
  453. uart->timeout = value * HZ;
  454. if (uart->timeout)
  455. mod_timer(&uart->timer, jiffies + uart->timeout);
  456. else
  457. /* A zero value means disable timeout feature */
  458. omap_uart_block_sleep(uart);
  459. return n;
  460. }
  461. DEVICE_ATTR(sleep_timeout, 0644, sleep_timeout_show, sleep_timeout_store);
  462. #define DEV_CREATE_FILE(dev, attr) WARN_ON(device_create_file(dev, attr))
  463. #else
  464. static inline void omap_uart_idle_init(struct omap_uart_state *uart) {}
  465. #define DEV_CREATE_FILE(dev, attr)
  466. #endif /* CONFIG_PM */
  467. static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS] = {
  468. {
  469. .pdev = {
  470. .name = "serial8250",
  471. .id = PLAT8250_DEV_PLATFORM,
  472. .dev = {
  473. .platform_data = serial_platform_data0,
  474. },
  475. },
  476. }, {
  477. .pdev = {
  478. .name = "serial8250",
  479. .id = PLAT8250_DEV_PLATFORM1,
  480. .dev = {
  481. .platform_data = serial_platform_data1,
  482. },
  483. },
  484. }, {
  485. .pdev = {
  486. .name = "serial8250",
  487. .id = PLAT8250_DEV_PLATFORM2,
  488. .dev = {
  489. .platform_data = serial_platform_data2,
  490. },
  491. },
  492. },
  493. #ifdef CONFIG_ARCH_OMAP4
  494. {
  495. .pdev = {
  496. .name = "serial8250",
  497. .id = 3,
  498. .dev = {
  499. .platform_data = serial_platform_data3,
  500. },
  501. },
  502. },
  503. #endif
  504. };
  505. void __init omap_serial_early_init(void)
  506. {
  507. int i;
  508. char name[16];
  509. /*
  510. * Make sure the serial ports are muxed on at this point.
  511. * You have to mux them off in device drivers later on
  512. * if not needed.
  513. */
  514. for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
  515. struct omap_uart_state *uart = &omap_uart[i];
  516. struct platform_device *pdev = &uart->pdev;
  517. struct device *dev = &pdev->dev;
  518. struct plat_serial8250_port *p = dev->platform_data;
  519. /*
  520. * Module 4KB + L4 interconnect 4KB
  521. * Static mapping, never released
  522. */
  523. p->membase = ioremap(p->mapbase, SZ_8K);
  524. if (!p->membase) {
  525. printk(KERN_ERR "ioremap failed for uart%i\n", i + 1);
  526. continue;
  527. }
  528. sprintf(name, "uart%d_ick", i+1);
  529. uart->ick = clk_get(NULL, name);
  530. if (IS_ERR(uart->ick)) {
  531. printk(KERN_ERR "Could not get uart%d_ick\n", i+1);
  532. uart->ick = NULL;
  533. }
  534. sprintf(name, "uart%d_fck", i+1);
  535. uart->fck = clk_get(NULL, name);
  536. if (IS_ERR(uart->fck)) {
  537. printk(KERN_ERR "Could not get uart%d_fck\n", i+1);
  538. uart->fck = NULL;
  539. }
  540. /* FIXME: Remove this once the clkdev is ready */
  541. if (!cpu_is_omap44xx()) {
  542. if (!uart->ick || !uart->fck)
  543. continue;
  544. }
  545. uart->num = i;
  546. p->private_data = uart;
  547. uart->p = p;
  548. list_add_tail(&uart->node, &uart_list);
  549. if (cpu_is_omap44xx())
  550. p->irq += 32;
  551. omap_uart_enable_clocks(uart);
  552. }
  553. }
  554. void __init omap_serial_init(void)
  555. {
  556. int i;
  557. for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
  558. struct omap_uart_state *uart = &omap_uart[i];
  559. struct platform_device *pdev = &uart->pdev;
  560. struct device *dev = &pdev->dev;
  561. omap_uart_reset(uart);
  562. omap_uart_idle_init(uart);
  563. if (WARN_ON(platform_device_register(pdev)))
  564. continue;
  565. if ((cpu_is_omap34xx() && uart->padconf) ||
  566. (uart->wk_en && uart->wk_mask)) {
  567. device_init_wakeup(dev, true);
  568. DEV_CREATE_FILE(dev, &dev_attr_sleep_timeout);
  569. }
  570. }
  571. }