bfin_5xx.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228
  1. /*
  2. * Blackfin On-Chip Serial Driver
  3. *
  4. * Copyright 2006-2008 Analog Devices Inc.
  5. *
  6. * Enter bugs at http://blackfin.uclinux.org/
  7. *
  8. * Licensed under the GPL-2 or later.
  9. */
  10. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
  11. #define SUPPORT_SYSRQ
  12. #endif
  13. #include <linux/module.h>
  14. #include <linux/ioport.h>
  15. #include <linux/init.h>
  16. #include <linux/console.h>
  17. #include <linux/sysrq.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/tty.h>
  20. #include <linux/tty_flip.h>
  21. #include <linux/serial_core.h>
  22. #ifdef CONFIG_KGDB_UART
  23. #include <linux/kgdb.h>
  24. #include <asm/irq_regs.h>
  25. #endif
  26. #include <asm/gpio.h>
  27. #include <mach/bfin_serial_5xx.h>
  28. #ifdef CONFIG_SERIAL_BFIN_DMA
  29. #include <linux/dma-mapping.h>
  30. #include <asm/io.h>
  31. #include <asm/irq.h>
  32. #include <asm/cacheflush.h>
  33. #endif
  34. /* UART name and device definitions */
  35. #define BFIN_SERIAL_NAME "ttyBF"
  36. #define BFIN_SERIAL_MAJOR 204
  37. #define BFIN_SERIAL_MINOR 64
  38. /*
  39. * Setup for console. Argument comes from the menuconfig
  40. */
  41. #define DMA_RX_XCOUNT 512
  42. #define DMA_RX_YCOUNT (PAGE_SIZE / DMA_RX_XCOUNT)
  43. #define DMA_RX_FLUSH_JIFFIES (HZ / 50)
  44. #define CTS_CHECK_JIFFIES (HZ / 50)
  45. #ifdef CONFIG_SERIAL_BFIN_DMA
  46. static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart);
  47. #else
  48. static void bfin_serial_tx_chars(struct bfin_serial_port *uart);
  49. #endif
  50. static void bfin_serial_mctrl_check(struct bfin_serial_port *uart);
  51. /*
  52. * interrupts are disabled on entry
  53. */
  54. static void bfin_serial_stop_tx(struct uart_port *port)
  55. {
  56. struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
  57. struct circ_buf *xmit = &uart->port.info->xmit;
  58. while (!(UART_GET_LSR(uart) & TEMT))
  59. cpu_relax();
  60. #ifdef CONFIG_SERIAL_BFIN_DMA
  61. disable_dma(uart->tx_dma_channel);
  62. xmit->tail = (xmit->tail + uart->tx_count) & (UART_XMIT_SIZE - 1);
  63. uart->port.icount.tx += uart->tx_count;
  64. uart->tx_count = 0;
  65. uart->tx_done = 1;
  66. #else
  67. #ifdef CONFIG_BF54x
  68. /* Clear TFI bit */
  69. UART_PUT_LSR(uart, TFI);
  70. #endif
  71. UART_CLEAR_IER(uart, ETBEI);
  72. #endif
  73. }
  74. /*
  75. * port is locked and interrupts are disabled
  76. */
  77. static void bfin_serial_start_tx(struct uart_port *port)
  78. {
  79. struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
  80. #ifdef CONFIG_SERIAL_BFIN_DMA
  81. if (uart->tx_done)
  82. bfin_serial_dma_tx_chars(uart);
  83. #else
  84. UART_SET_IER(uart, ETBEI);
  85. bfin_serial_tx_chars(uart);
  86. #endif
  87. }
  88. /*
  89. * Interrupts are enabled
  90. */
  91. static void bfin_serial_stop_rx(struct uart_port *port)
  92. {
  93. struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
  94. #ifdef CONFIG_KGDB_UART
  95. if (uart->port.line != CONFIG_KGDB_UART_PORT)
  96. #endif
  97. UART_CLEAR_IER(uart, ERBFI);
  98. }
  99. /*
  100. * Set the modem control timer to fire immediately.
  101. */
  102. static void bfin_serial_enable_ms(struct uart_port *port)
  103. {
  104. }
  105. #ifdef CONFIG_KGDB_UART
  106. static int kgdb_entry_state;
  107. void kgdb_put_debug_char(int chr)
  108. {
  109. struct bfin_serial_port *uart;
  110. if (CONFIG_KGDB_UART_PORT < 0
  111. || CONFIG_KGDB_UART_PORT >= BFIN_UART_NR_PORTS)
  112. uart = &bfin_serial_ports[0];
  113. else
  114. uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT];
  115. while (!(UART_GET_LSR(uart) & THRE)) {
  116. SSYNC();
  117. }
  118. UART_CLEAR_DLAB(uart);
  119. UART_PUT_CHAR(uart, (unsigned char)chr);
  120. SSYNC();
  121. }
  122. int kgdb_get_debug_char(void)
  123. {
  124. struct bfin_serial_port *uart;
  125. unsigned char chr;
  126. if (CONFIG_KGDB_UART_PORT < 0
  127. || CONFIG_KGDB_UART_PORT >= BFIN_UART_NR_PORTS)
  128. uart = &bfin_serial_ports[0];
  129. else
  130. uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT];
  131. while(!(UART_GET_LSR(uart) & DR)) {
  132. SSYNC();
  133. }
  134. UART_CLEAR_DLAB(uart);
  135. chr = UART_GET_CHAR(uart);
  136. SSYNC();
  137. return chr;
  138. }
  139. #endif
  140. #if ANOMALY_05000363 && defined(CONFIG_SERIAL_BFIN_PIO)
  141. # define UART_GET_ANOMALY_THRESHOLD(uart) ((uart)->anomaly_threshold)
  142. # define UART_SET_ANOMALY_THRESHOLD(uart, v) ((uart)->anomaly_threshold = (v))
  143. #else
  144. # define UART_GET_ANOMALY_THRESHOLD(uart) 0
  145. # define UART_SET_ANOMALY_THRESHOLD(uart, v)
  146. #endif
  147. #ifdef CONFIG_SERIAL_BFIN_PIO
  148. static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
  149. {
  150. struct tty_struct *tty = uart->port.info->port.tty;
  151. unsigned int status, ch, flg;
  152. static struct timeval anomaly_start = { .tv_sec = 0 };
  153. status = UART_GET_LSR(uart);
  154. UART_CLEAR_LSR(uart);
  155. ch = UART_GET_CHAR(uart);
  156. uart->port.icount.rx++;
  157. #ifdef CONFIG_KGDB_UART
  158. if (uart->port.line == CONFIG_KGDB_UART_PORT) {
  159. struct pt_regs *regs = get_irq_regs();
  160. if (uart->port.cons->index == CONFIG_KGDB_UART_PORT && ch == 0x1) { /* Ctrl + A */
  161. kgdb_breakkey_pressed(regs);
  162. return;
  163. } else if (kgdb_entry_state == 0 && ch == '$') {/* connection from KGDB */
  164. kgdb_entry_state = 1;
  165. } else if (kgdb_entry_state == 1 && ch == 'q') {
  166. kgdb_entry_state = 0;
  167. kgdb_breakkey_pressed(regs);
  168. return;
  169. } else if (ch == 0x3) {/* Ctrl + C */
  170. kgdb_entry_state = 0;
  171. kgdb_breakkey_pressed(regs);
  172. return;
  173. } else {
  174. kgdb_entry_state = 0;
  175. }
  176. }
  177. #endif
  178. if (ANOMALY_05000363) {
  179. /* The BF533 (and BF561) family of processors have a nice anomaly
  180. * where they continuously generate characters for a "single" break.
  181. * We have to basically ignore this flood until the "next" valid
  182. * character comes across. Due to the nature of the flood, it is
  183. * not possible to reliably catch bytes that are sent too quickly
  184. * after this break. So application code talking to the Blackfin
  185. * which sends a break signal must allow at least 1.5 character
  186. * times after the end of the break for things to stabilize. This
  187. * timeout was picked as it must absolutely be larger than 1
  188. * character time +/- some percent. So 1.5 sounds good. All other
  189. * Blackfin families operate properly. Woo.
  190. */
  191. if (anomaly_start.tv_sec) {
  192. struct timeval curr;
  193. suseconds_t usecs;
  194. if ((~ch & (~ch + 1)) & 0xff)
  195. goto known_good_char;
  196. do_gettimeofday(&curr);
  197. if (curr.tv_sec - anomaly_start.tv_sec > 1)
  198. goto known_good_char;
  199. usecs = 0;
  200. if (curr.tv_sec != anomaly_start.tv_sec)
  201. usecs += USEC_PER_SEC;
  202. usecs += curr.tv_usec - anomaly_start.tv_usec;
  203. if (usecs > UART_GET_ANOMALY_THRESHOLD(uart))
  204. goto known_good_char;
  205. if (ch)
  206. anomaly_start.tv_sec = 0;
  207. else
  208. anomaly_start = curr;
  209. return;
  210. known_good_char:
  211. anomaly_start.tv_sec = 0;
  212. }
  213. }
  214. if (status & BI) {
  215. if (ANOMALY_05000363)
  216. if (bfin_revid() < 5)
  217. do_gettimeofday(&anomaly_start);
  218. uart->port.icount.brk++;
  219. if (uart_handle_break(&uart->port))
  220. goto ignore_char;
  221. status &= ~(PE | FE);
  222. }
  223. if (status & PE)
  224. uart->port.icount.parity++;
  225. if (status & OE)
  226. uart->port.icount.overrun++;
  227. if (status & FE)
  228. uart->port.icount.frame++;
  229. status &= uart->port.read_status_mask;
  230. if (status & BI)
  231. flg = TTY_BREAK;
  232. else if (status & PE)
  233. flg = TTY_PARITY;
  234. else if (status & FE)
  235. flg = TTY_FRAME;
  236. else
  237. flg = TTY_NORMAL;
  238. if (uart_handle_sysrq_char(&uart->port, ch))
  239. goto ignore_char;
  240. uart_insert_char(&uart->port, status, OE, ch, flg);
  241. ignore_char:
  242. tty_flip_buffer_push(tty);
  243. }
  244. static void bfin_serial_tx_chars(struct bfin_serial_port *uart)
  245. {
  246. struct circ_buf *xmit = &uart->port.info->xmit;
  247. /*
  248. * Check the modem control lines before
  249. * transmitting anything.
  250. */
  251. bfin_serial_mctrl_check(uart);
  252. if (uart_circ_empty(xmit) || uart_tx_stopped(&uart->port)) {
  253. bfin_serial_stop_tx(&uart->port);
  254. return;
  255. }
  256. if (uart->port.x_char) {
  257. UART_PUT_CHAR(uart, uart->port.x_char);
  258. uart->port.icount.tx++;
  259. uart->port.x_char = 0;
  260. }
  261. while ((UART_GET_LSR(uart) & THRE) && xmit->tail != xmit->head) {
  262. UART_PUT_CHAR(uart, xmit->buf[xmit->tail]);
  263. xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
  264. uart->port.icount.tx++;
  265. SSYNC();
  266. }
  267. if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
  268. uart_write_wakeup(&uart->port);
  269. if (uart_circ_empty(xmit))
  270. bfin_serial_stop_tx(&uart->port);
  271. }
  272. static irqreturn_t bfin_serial_rx_int(int irq, void *dev_id)
  273. {
  274. struct bfin_serial_port *uart = dev_id;
  275. spin_lock(&uart->port.lock);
  276. while (UART_GET_LSR(uart) & DR)
  277. bfin_serial_rx_chars(uart);
  278. spin_unlock(&uart->port.lock);
  279. return IRQ_HANDLED;
  280. }
  281. static irqreturn_t bfin_serial_tx_int(int irq, void *dev_id)
  282. {
  283. struct bfin_serial_port *uart = dev_id;
  284. spin_lock(&uart->port.lock);
  285. if (UART_GET_LSR(uart) & THRE)
  286. bfin_serial_tx_chars(uart);
  287. spin_unlock(&uart->port.lock);
  288. return IRQ_HANDLED;
  289. }
  290. #endif
  291. #ifdef CONFIG_SERIAL_BFIN_DMA
  292. static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
  293. {
  294. struct circ_buf *xmit = &uart->port.info->xmit;
  295. uart->tx_done = 0;
  296. /*
  297. * Check the modem control lines before
  298. * transmitting anything.
  299. */
  300. bfin_serial_mctrl_check(uart);
  301. if (uart_circ_empty(xmit) || uart_tx_stopped(&uart->port)) {
  302. uart->tx_count = 0;
  303. uart->tx_done = 1;
  304. return;
  305. }
  306. if (uart->port.x_char) {
  307. UART_PUT_CHAR(uart, uart->port.x_char);
  308. uart->port.icount.tx++;
  309. uart->port.x_char = 0;
  310. }
  311. uart->tx_count = CIRC_CNT(xmit->head, xmit->tail, UART_XMIT_SIZE);
  312. if (uart->tx_count > (UART_XMIT_SIZE - xmit->tail))
  313. uart->tx_count = UART_XMIT_SIZE - xmit->tail;
  314. blackfin_dcache_flush_range((unsigned long)(xmit->buf+xmit->tail),
  315. (unsigned long)(xmit->buf+xmit->tail+uart->tx_count));
  316. set_dma_config(uart->tx_dma_channel,
  317. set_bfin_dma_config(DIR_READ, DMA_FLOW_STOP,
  318. INTR_ON_BUF,
  319. DIMENSION_LINEAR,
  320. DATA_SIZE_8,
  321. DMA_SYNC_RESTART));
  322. set_dma_start_addr(uart->tx_dma_channel, (unsigned long)(xmit->buf+xmit->tail));
  323. set_dma_x_count(uart->tx_dma_channel, uart->tx_count);
  324. set_dma_x_modify(uart->tx_dma_channel, 1);
  325. enable_dma(uart->tx_dma_channel);
  326. UART_SET_IER(uart, ETBEI);
  327. }
  328. static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
  329. {
  330. struct tty_struct *tty = uart->port.info->port.tty;
  331. int i, flg, status;
  332. status = UART_GET_LSR(uart);
  333. UART_CLEAR_LSR(uart);
  334. uart->port.icount.rx +=
  335. CIRC_CNT(uart->rx_dma_buf.head, uart->rx_dma_buf.tail,
  336. UART_XMIT_SIZE);
  337. if (status & BI) {
  338. uart->port.icount.brk++;
  339. if (uart_handle_break(&uart->port))
  340. goto dma_ignore_char;
  341. status &= ~(PE | FE);
  342. }
  343. if (status & PE)
  344. uart->port.icount.parity++;
  345. if (status & OE)
  346. uart->port.icount.overrun++;
  347. if (status & FE)
  348. uart->port.icount.frame++;
  349. status &= uart->port.read_status_mask;
  350. if (status & BI)
  351. flg = TTY_BREAK;
  352. else if (status & PE)
  353. flg = TTY_PARITY;
  354. else if (status & FE)
  355. flg = TTY_FRAME;
  356. else
  357. flg = TTY_NORMAL;
  358. for (i = uart->rx_dma_buf.tail; i != uart->rx_dma_buf.head; i++) {
  359. if (i >= UART_XMIT_SIZE)
  360. i = 0;
  361. if (!uart_handle_sysrq_char(&uart->port, uart->rx_dma_buf.buf[i]))
  362. uart_insert_char(&uart->port, status, OE,
  363. uart->rx_dma_buf.buf[i], flg);
  364. }
  365. dma_ignore_char:
  366. tty_flip_buffer_push(tty);
  367. }
  368. void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
  369. {
  370. int x_pos, pos;
  371. uart->rx_dma_nrows = get_dma_curr_ycount(uart->rx_dma_channel);
  372. x_pos = get_dma_curr_xcount(uart->rx_dma_channel);
  373. uart->rx_dma_nrows = DMA_RX_YCOUNT - uart->rx_dma_nrows;
  374. if (uart->rx_dma_nrows == DMA_RX_YCOUNT)
  375. uart->rx_dma_nrows = 0;
  376. x_pos = DMA_RX_XCOUNT - x_pos;
  377. if (x_pos == DMA_RX_XCOUNT)
  378. x_pos = 0;
  379. pos = uart->rx_dma_nrows * DMA_RX_XCOUNT + x_pos;
  380. if (pos != uart->rx_dma_buf.tail) {
  381. uart->rx_dma_buf.head = pos;
  382. bfin_serial_dma_rx_chars(uart);
  383. uart->rx_dma_buf.tail = uart->rx_dma_buf.head;
  384. }
  385. mod_timer(&(uart->rx_dma_timer), jiffies + DMA_RX_FLUSH_JIFFIES);
  386. }
  387. static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id)
  388. {
  389. struct bfin_serial_port *uart = dev_id;
  390. struct circ_buf *xmit = &uart->port.info->xmit;
  391. spin_lock(&uart->port.lock);
  392. if (!(get_dma_curr_irqstat(uart->tx_dma_channel)&DMA_RUN)) {
  393. disable_dma(uart->tx_dma_channel);
  394. clear_dma_irqstat(uart->tx_dma_channel);
  395. UART_CLEAR_IER(uart, ETBEI);
  396. xmit->tail = (xmit->tail + uart->tx_count) & (UART_XMIT_SIZE - 1);
  397. uart->port.icount.tx += uart->tx_count;
  398. if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
  399. uart_write_wakeup(&uart->port);
  400. bfin_serial_dma_tx_chars(uart);
  401. }
  402. spin_unlock(&uart->port.lock);
  403. return IRQ_HANDLED;
  404. }
  405. static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id)
  406. {
  407. struct bfin_serial_port *uart = dev_id;
  408. unsigned short irqstat;
  409. spin_lock(&uart->port.lock);
  410. irqstat = get_dma_curr_irqstat(uart->rx_dma_channel);
  411. clear_dma_irqstat(uart->rx_dma_channel);
  412. spin_unlock(&uart->port.lock);
  413. mod_timer(&(uart->rx_dma_timer), jiffies);
  414. return IRQ_HANDLED;
  415. }
  416. #endif
  417. /*
  418. * Return TIOCSER_TEMT when transmitter is not busy.
  419. */
  420. static unsigned int bfin_serial_tx_empty(struct uart_port *port)
  421. {
  422. struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
  423. unsigned short lsr;
  424. lsr = UART_GET_LSR(uart);
  425. if (lsr & TEMT)
  426. return TIOCSER_TEMT;
  427. else
  428. return 0;
  429. }
  430. static unsigned int bfin_serial_get_mctrl(struct uart_port *port)
  431. {
  432. #ifdef CONFIG_SERIAL_BFIN_CTSRTS
  433. struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
  434. if (uart->cts_pin < 0)
  435. return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
  436. if (UART_GET_CTS(uart))
  437. return TIOCM_DSR | TIOCM_CAR;
  438. else
  439. #endif
  440. return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
  441. }
  442. static void bfin_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
  443. {
  444. #ifdef CONFIG_SERIAL_BFIN_CTSRTS
  445. struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
  446. if (uart->rts_pin < 0)
  447. return;
  448. if (mctrl & TIOCM_RTS)
  449. UART_CLEAR_RTS(uart);
  450. else
  451. UART_SET_RTS(uart);
  452. #endif
  453. }
  454. /*
  455. * Handle any change of modem status signal since we were last called.
  456. */
  457. static void bfin_serial_mctrl_check(struct bfin_serial_port *uart)
  458. {
  459. #ifdef CONFIG_SERIAL_BFIN_CTSRTS
  460. unsigned int status;
  461. struct uart_info *info = uart->port.info;
  462. struct tty_struct *tty = info->port.tty;
  463. status = bfin_serial_get_mctrl(&uart->port);
  464. uart_handle_cts_change(&uart->port, status & TIOCM_CTS);
  465. if (!(status & TIOCM_CTS)) {
  466. tty->hw_stopped = 1;
  467. uart->cts_timer.data = (unsigned long)(uart);
  468. uart->cts_timer.function = (void *)bfin_serial_mctrl_check;
  469. uart->cts_timer.expires = jiffies + CTS_CHECK_JIFFIES;
  470. add_timer(&(uart->cts_timer));
  471. } else {
  472. tty->hw_stopped = 0;
  473. }
  474. #endif
  475. }
  476. /*
  477. * Interrupts are always disabled.
  478. */
  479. static void bfin_serial_break_ctl(struct uart_port *port, int break_state)
  480. {
  481. struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
  482. u16 lcr = UART_GET_LCR(uart);
  483. if (break_state)
  484. lcr |= SB;
  485. else
  486. lcr &= ~SB;
  487. UART_PUT_LCR(uart, lcr);
  488. SSYNC();
  489. }
  490. static int bfin_serial_startup(struct uart_port *port)
  491. {
  492. struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
  493. #ifdef CONFIG_SERIAL_BFIN_DMA
  494. dma_addr_t dma_handle;
  495. if (request_dma(uart->rx_dma_channel, "BFIN_UART_RX") < 0) {
  496. printk(KERN_NOTICE "Unable to attach Blackfin UART RX DMA channel\n");
  497. return -EBUSY;
  498. }
  499. if (request_dma(uart->tx_dma_channel, "BFIN_UART_TX") < 0) {
  500. printk(KERN_NOTICE "Unable to attach Blackfin UART TX DMA channel\n");
  501. free_dma(uart->rx_dma_channel);
  502. return -EBUSY;
  503. }
  504. set_dma_callback(uart->rx_dma_channel, bfin_serial_dma_rx_int, uart);
  505. set_dma_callback(uart->tx_dma_channel, bfin_serial_dma_tx_int, uart);
  506. uart->rx_dma_buf.buf = (unsigned char *)dma_alloc_coherent(NULL, PAGE_SIZE, &dma_handle, GFP_DMA);
  507. uart->rx_dma_buf.head = 0;
  508. uart->rx_dma_buf.tail = 0;
  509. uart->rx_dma_nrows = 0;
  510. set_dma_config(uart->rx_dma_channel,
  511. set_bfin_dma_config(DIR_WRITE, DMA_FLOW_AUTO,
  512. INTR_ON_ROW, DIMENSION_2D,
  513. DATA_SIZE_8,
  514. DMA_SYNC_RESTART));
  515. set_dma_x_count(uart->rx_dma_channel, DMA_RX_XCOUNT);
  516. set_dma_x_modify(uart->rx_dma_channel, 1);
  517. set_dma_y_count(uart->rx_dma_channel, DMA_RX_YCOUNT);
  518. set_dma_y_modify(uart->rx_dma_channel, 1);
  519. set_dma_start_addr(uart->rx_dma_channel, (unsigned long)uart->rx_dma_buf.buf);
  520. enable_dma(uart->rx_dma_channel);
  521. uart->rx_dma_timer.data = (unsigned long)(uart);
  522. uart->rx_dma_timer.function = (void *)bfin_serial_rx_dma_timeout;
  523. uart->rx_dma_timer.expires = jiffies + DMA_RX_FLUSH_JIFFIES;
  524. add_timer(&(uart->rx_dma_timer));
  525. #else
  526. if (request_irq(uart->port.irq, bfin_serial_rx_int, IRQF_DISABLED,
  527. "BFIN_UART_RX", uart)) {
  528. # ifdef CONFIG_KGDB_UART
  529. if (uart->port.line != CONFIG_KGDB_UART_PORT) {
  530. # endif
  531. printk(KERN_NOTICE "Unable to attach BlackFin UART RX interrupt\n");
  532. return -EBUSY;
  533. # ifdef CONFIG_KGDB_UART
  534. }
  535. # endif
  536. }
  537. if (request_irq
  538. (uart->port.irq+1, bfin_serial_tx_int, IRQF_DISABLED,
  539. "BFIN_UART_TX", uart)) {
  540. printk(KERN_NOTICE "Unable to attach BlackFin UART TX interrupt\n");
  541. free_irq(uart->port.irq, uart);
  542. return -EBUSY;
  543. }
  544. #endif
  545. UART_SET_IER(uart, ERBFI);
  546. return 0;
  547. }
  548. static void bfin_serial_shutdown(struct uart_port *port)
  549. {
  550. struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
  551. #ifdef CONFIG_SERIAL_BFIN_DMA
  552. disable_dma(uart->tx_dma_channel);
  553. free_dma(uart->tx_dma_channel);
  554. disable_dma(uart->rx_dma_channel);
  555. free_dma(uart->rx_dma_channel);
  556. del_timer(&(uart->rx_dma_timer));
  557. dma_free_coherent(NULL, PAGE_SIZE, uart->rx_dma_buf.buf, 0);
  558. #else
  559. #ifdef CONFIG_KGDB_UART
  560. if (uart->port.line != CONFIG_KGDB_UART_PORT)
  561. #endif
  562. free_irq(uart->port.irq, uart);
  563. free_irq(uart->port.irq+1, uart);
  564. #endif
  565. }
  566. static void
  567. bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
  568. struct ktermios *old)
  569. {
  570. struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
  571. unsigned long flags;
  572. unsigned int baud, quot;
  573. unsigned short val, ier, lcr = 0;
  574. switch (termios->c_cflag & CSIZE) {
  575. case CS8:
  576. lcr = WLS(8);
  577. break;
  578. case CS7:
  579. lcr = WLS(7);
  580. break;
  581. case CS6:
  582. lcr = WLS(6);
  583. break;
  584. case CS5:
  585. lcr = WLS(5);
  586. break;
  587. default:
  588. printk(KERN_ERR "%s: word lengh not supported\n",
  589. __func__);
  590. }
  591. if (termios->c_cflag & CSTOPB)
  592. lcr |= STB;
  593. if (termios->c_cflag & PARENB)
  594. lcr |= PEN;
  595. if (!(termios->c_cflag & PARODD))
  596. lcr |= EPS;
  597. if (termios->c_cflag & CMSPAR)
  598. lcr |= STP;
  599. port->read_status_mask = OE;
  600. if (termios->c_iflag & INPCK)
  601. port->read_status_mask |= (FE | PE);
  602. if (termios->c_iflag & (BRKINT | PARMRK))
  603. port->read_status_mask |= BI;
  604. /*
  605. * Characters to ignore
  606. */
  607. port->ignore_status_mask = 0;
  608. if (termios->c_iflag & IGNPAR)
  609. port->ignore_status_mask |= FE | PE;
  610. if (termios->c_iflag & IGNBRK) {
  611. port->ignore_status_mask |= BI;
  612. /*
  613. * If we're ignoring parity and break indicators,
  614. * ignore overruns too (for real raw support).
  615. */
  616. if (termios->c_iflag & IGNPAR)
  617. port->ignore_status_mask |= OE;
  618. }
  619. baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
  620. quot = uart_get_divisor(port, baud);
  621. spin_lock_irqsave(&uart->port.lock, flags);
  622. UART_SET_ANOMALY_THRESHOLD(uart, USEC_PER_SEC / baud * 15);
  623. /* Disable UART */
  624. ier = UART_GET_IER(uart);
  625. UART_DISABLE_INTS(uart);
  626. /* Set DLAB in LCR to Access DLL and DLH */
  627. UART_SET_DLAB(uart);
  628. UART_PUT_DLL(uart, quot & 0xFF);
  629. UART_PUT_DLH(uart, (quot >> 8) & 0xFF);
  630. SSYNC();
  631. /* Clear DLAB in LCR to Access THR RBR IER */
  632. UART_CLEAR_DLAB(uart);
  633. UART_PUT_LCR(uart, lcr);
  634. /* Enable UART */
  635. UART_ENABLE_INTS(uart, ier);
  636. val = UART_GET_GCTL(uart);
  637. val |= UCEN;
  638. UART_PUT_GCTL(uart, val);
  639. spin_unlock_irqrestore(&uart->port.lock, flags);
  640. }
  641. static const char *bfin_serial_type(struct uart_port *port)
  642. {
  643. struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
  644. return uart->port.type == PORT_BFIN ? "BFIN-UART" : NULL;
  645. }
  646. /*
  647. * Release the memory region(s) being used by 'port'.
  648. */
  649. static void bfin_serial_release_port(struct uart_port *port)
  650. {
  651. }
  652. /*
  653. * Request the memory region(s) being used by 'port'.
  654. */
  655. static int bfin_serial_request_port(struct uart_port *port)
  656. {
  657. return 0;
  658. }
  659. /*
  660. * Configure/autoconfigure the port.
  661. */
  662. static void bfin_serial_config_port(struct uart_port *port, int flags)
  663. {
  664. struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
  665. if (flags & UART_CONFIG_TYPE &&
  666. bfin_serial_request_port(&uart->port) == 0)
  667. uart->port.type = PORT_BFIN;
  668. }
  669. /*
  670. * Verify the new serial_struct (for TIOCSSERIAL).
  671. * The only change we allow are to the flags and type, and
  672. * even then only between PORT_BFIN and PORT_UNKNOWN
  673. */
  674. static int
  675. bfin_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
  676. {
  677. return 0;
  678. }
  679. /*
  680. * Enable the IrDA function if tty->ldisc.num is N_IRDA.
  681. * In other cases, disable IrDA function.
  682. */
  683. static void bfin_serial_set_ldisc(struct uart_port *port)
  684. {
  685. int line = port->line;
  686. unsigned short val;
  687. if (line >= port->info->port.tty->driver->num)
  688. return;
  689. switch (port->info->port.tty->termios->c_line) {
  690. case N_IRDA:
  691. val = UART_GET_GCTL(&bfin_serial_ports[line]);
  692. val |= (IREN | RPOLC);
  693. UART_PUT_GCTL(&bfin_serial_ports[line], val);
  694. break;
  695. default:
  696. val = UART_GET_GCTL(&bfin_serial_ports[line]);
  697. val &= ~(IREN | RPOLC);
  698. UART_PUT_GCTL(&bfin_serial_ports[line], val);
  699. }
  700. }
  701. static struct uart_ops bfin_serial_pops = {
  702. .tx_empty = bfin_serial_tx_empty,
  703. .set_mctrl = bfin_serial_set_mctrl,
  704. .get_mctrl = bfin_serial_get_mctrl,
  705. .stop_tx = bfin_serial_stop_tx,
  706. .start_tx = bfin_serial_start_tx,
  707. .stop_rx = bfin_serial_stop_rx,
  708. .enable_ms = bfin_serial_enable_ms,
  709. .break_ctl = bfin_serial_break_ctl,
  710. .startup = bfin_serial_startup,
  711. .shutdown = bfin_serial_shutdown,
  712. .set_termios = bfin_serial_set_termios,
  713. .set_ldisc = bfin_serial_set_ldisc,
  714. .type = bfin_serial_type,
  715. .release_port = bfin_serial_release_port,
  716. .request_port = bfin_serial_request_port,
  717. .config_port = bfin_serial_config_port,
  718. .verify_port = bfin_serial_verify_port,
  719. };
  720. static void __init bfin_serial_init_ports(void)
  721. {
  722. static int first = 1;
  723. int i;
  724. if (!first)
  725. return;
  726. first = 0;
  727. for (i = 0; i < nr_ports; i++) {
  728. bfin_serial_ports[i].port.uartclk = get_sclk();
  729. bfin_serial_ports[i].port.ops = &bfin_serial_pops;
  730. bfin_serial_ports[i].port.line = i;
  731. bfin_serial_ports[i].port.iotype = UPIO_MEM;
  732. bfin_serial_ports[i].port.membase =
  733. (void __iomem *)bfin_serial_resource[i].uart_base_addr;
  734. bfin_serial_ports[i].port.mapbase =
  735. bfin_serial_resource[i].uart_base_addr;
  736. bfin_serial_ports[i].port.irq =
  737. bfin_serial_resource[i].uart_irq;
  738. bfin_serial_ports[i].port.flags = UPF_BOOT_AUTOCONF;
  739. #ifdef CONFIG_SERIAL_BFIN_DMA
  740. bfin_serial_ports[i].tx_done = 1;
  741. bfin_serial_ports[i].tx_count = 0;
  742. bfin_serial_ports[i].tx_dma_channel =
  743. bfin_serial_resource[i].uart_tx_dma_channel;
  744. bfin_serial_ports[i].rx_dma_channel =
  745. bfin_serial_resource[i].uart_rx_dma_channel;
  746. init_timer(&(bfin_serial_ports[i].rx_dma_timer));
  747. #endif
  748. #ifdef CONFIG_SERIAL_BFIN_CTSRTS
  749. init_timer(&(bfin_serial_ports[i].cts_timer));
  750. bfin_serial_ports[i].cts_pin =
  751. bfin_serial_resource[i].uart_cts_pin;
  752. bfin_serial_ports[i].rts_pin =
  753. bfin_serial_resource[i].uart_rts_pin;
  754. #endif
  755. bfin_serial_hw_init(&bfin_serial_ports[i]);
  756. }
  757. }
  758. #ifdef CONFIG_SERIAL_BFIN_CONSOLE
  759. /*
  760. * If the port was already initialised (eg, by a boot loader),
  761. * try to determine the current setup.
  762. */
  763. static void __init
  764. bfin_serial_console_get_options(struct bfin_serial_port *uart, int *baud,
  765. int *parity, int *bits)
  766. {
  767. unsigned short status;
  768. status = UART_GET_IER(uart) & (ERBFI | ETBEI);
  769. if (status == (ERBFI | ETBEI)) {
  770. /* ok, the port was enabled */
  771. u16 lcr, dlh, dll;
  772. lcr = UART_GET_LCR(uart);
  773. *parity = 'n';
  774. if (lcr & PEN) {
  775. if (lcr & EPS)
  776. *parity = 'e';
  777. else
  778. *parity = 'o';
  779. }
  780. switch (lcr & 0x03) {
  781. case 0: *bits = 5; break;
  782. case 1: *bits = 6; break;
  783. case 2: *bits = 7; break;
  784. case 3: *bits = 8; break;
  785. }
  786. /* Set DLAB in LCR to Access DLL and DLH */
  787. UART_SET_DLAB(uart);
  788. dll = UART_GET_DLL(uart);
  789. dlh = UART_GET_DLH(uart);
  790. /* Clear DLAB in LCR to Access THR RBR IER */
  791. UART_CLEAR_DLAB(uart);
  792. *baud = get_sclk() / (16*(dll | dlh << 8));
  793. }
  794. pr_debug("%s:baud = %d, parity = %c, bits= %d\n", __func__, *baud, *parity, *bits);
  795. }
  796. #endif
  797. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  798. static struct uart_driver bfin_serial_reg;
  799. static int __init
  800. bfin_serial_console_setup(struct console *co, char *options)
  801. {
  802. struct bfin_serial_port *uart;
  803. # ifdef CONFIG_SERIAL_BFIN_CONSOLE
  804. int baud = 57600;
  805. int bits = 8;
  806. int parity = 'n';
  807. # ifdef CONFIG_SERIAL_BFIN_CTSRTS
  808. int flow = 'r';
  809. # else
  810. int flow = 'n';
  811. # endif
  812. # endif
  813. /*
  814. * Check whether an invalid uart number has been specified, and
  815. * if so, search for the first available port that does have
  816. * console support.
  817. */
  818. if (co->index == -1 || co->index >= nr_ports)
  819. co->index = 0;
  820. uart = &bfin_serial_ports[co->index];
  821. # ifdef CONFIG_SERIAL_BFIN_CONSOLE
  822. if (options)
  823. uart_parse_options(options, &baud, &parity, &bits, &flow);
  824. else
  825. bfin_serial_console_get_options(uart, &baud, &parity, &bits);
  826. return uart_set_options(&uart->port, co, baud, parity, bits, flow);
  827. # else
  828. return 0;
  829. # endif
  830. }
  831. #endif /* defined (CONFIG_SERIAL_BFIN_CONSOLE) ||
  832. defined (CONFIG_EARLY_PRINTK) */
  833. #ifdef CONFIG_SERIAL_BFIN_CONSOLE
  834. static void bfin_serial_console_putchar(struct uart_port *port, int ch)
  835. {
  836. struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
  837. while (!(UART_GET_LSR(uart) & THRE))
  838. barrier();
  839. UART_PUT_CHAR(uart, ch);
  840. SSYNC();
  841. }
  842. /*
  843. * Interrupts are disabled on entering
  844. */
  845. static void
  846. bfin_serial_console_write(struct console *co, const char *s, unsigned int count)
  847. {
  848. struct bfin_serial_port *uart = &bfin_serial_ports[co->index];
  849. int flags = 0;
  850. spin_lock_irqsave(&uart->port.lock, flags);
  851. uart_console_write(&uart->port, s, count, bfin_serial_console_putchar);
  852. spin_unlock_irqrestore(&uart->port.lock, flags);
  853. }
  854. static struct console bfin_serial_console = {
  855. .name = BFIN_SERIAL_NAME,
  856. .write = bfin_serial_console_write,
  857. .device = uart_console_device,
  858. .setup = bfin_serial_console_setup,
  859. .flags = CON_PRINTBUFFER,
  860. .index = -1,
  861. .data = &bfin_serial_reg,
  862. };
  863. static int __init bfin_serial_rs_console_init(void)
  864. {
  865. bfin_serial_init_ports();
  866. register_console(&bfin_serial_console);
  867. #ifdef CONFIG_KGDB_UART
  868. kgdb_entry_state = 0;
  869. init_kgdb_uart();
  870. #endif
  871. return 0;
  872. }
  873. console_initcall(bfin_serial_rs_console_init);
  874. #define BFIN_SERIAL_CONSOLE &bfin_serial_console
  875. #else
  876. #define BFIN_SERIAL_CONSOLE NULL
  877. #endif /* CONFIG_SERIAL_BFIN_CONSOLE */
  878. #ifdef CONFIG_EARLY_PRINTK
  879. static __init void early_serial_putc(struct uart_port *port, int ch)
  880. {
  881. unsigned timeout = 0xffff;
  882. struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
  883. while ((!(UART_GET_LSR(uart) & THRE)) && --timeout)
  884. cpu_relax();
  885. UART_PUT_CHAR(uart, ch);
  886. }
  887. static __init void early_serial_write(struct console *con, const char *s,
  888. unsigned int n)
  889. {
  890. struct bfin_serial_port *uart = &bfin_serial_ports[con->index];
  891. unsigned int i;
  892. for (i = 0; i < n; i++, s++) {
  893. if (*s == '\n')
  894. early_serial_putc(&uart->port, '\r');
  895. early_serial_putc(&uart->port, *s);
  896. }
  897. }
  898. static struct __initdata console bfin_early_serial_console = {
  899. .name = "early_BFuart",
  900. .write = early_serial_write,
  901. .device = uart_console_device,
  902. .flags = CON_PRINTBUFFER,
  903. .setup = bfin_serial_console_setup,
  904. .index = -1,
  905. .data = &bfin_serial_reg,
  906. };
  907. struct console __init *bfin_earlyserial_init(unsigned int port,
  908. unsigned int cflag)
  909. {
  910. struct bfin_serial_port *uart;
  911. struct ktermios t;
  912. if (port == -1 || port >= nr_ports)
  913. port = 0;
  914. bfin_serial_init_ports();
  915. bfin_early_serial_console.index = port;
  916. uart = &bfin_serial_ports[port];
  917. t.c_cflag = cflag;
  918. t.c_iflag = 0;
  919. t.c_oflag = 0;
  920. t.c_lflag = ICANON;
  921. t.c_line = port;
  922. bfin_serial_set_termios(&uart->port, &t, &t);
  923. return &bfin_early_serial_console;
  924. }
  925. #endif /* CONFIG_SERIAL_BFIN_CONSOLE */
  926. static struct uart_driver bfin_serial_reg = {
  927. .owner = THIS_MODULE,
  928. .driver_name = "bfin-uart",
  929. .dev_name = BFIN_SERIAL_NAME,
  930. .major = BFIN_SERIAL_MAJOR,
  931. .minor = BFIN_SERIAL_MINOR,
  932. .nr = BFIN_UART_NR_PORTS,
  933. .cons = BFIN_SERIAL_CONSOLE,
  934. };
  935. static int bfin_serial_suspend(struct platform_device *dev, pm_message_t state)
  936. {
  937. int i;
  938. for (i = 0; i < nr_ports; i++) {
  939. if (bfin_serial_ports[i].port.dev != &dev->dev)
  940. continue;
  941. uart_suspend_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
  942. }
  943. return 0;
  944. }
  945. static int bfin_serial_resume(struct platform_device *dev)
  946. {
  947. int i;
  948. for (i = 0; i < nr_ports; i++) {
  949. if (bfin_serial_ports[i].port.dev != &dev->dev)
  950. continue;
  951. uart_resume_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
  952. }
  953. return 0;
  954. }
  955. static int bfin_serial_probe(struct platform_device *dev)
  956. {
  957. struct resource *res = dev->resource;
  958. int i;
  959. for (i = 0; i < dev->num_resources; i++, res++)
  960. if (res->flags & IORESOURCE_MEM)
  961. break;
  962. if (i < dev->num_resources) {
  963. for (i = 0; i < nr_ports; i++, res++) {
  964. if (bfin_serial_ports[i].port.mapbase != res->start)
  965. continue;
  966. bfin_serial_ports[i].port.dev = &dev->dev;
  967. uart_add_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
  968. }
  969. }
  970. return 0;
  971. }
  972. static int bfin_serial_remove(struct platform_device *dev)
  973. {
  974. int i;
  975. for (i = 0; i < nr_ports; i++) {
  976. if (bfin_serial_ports[i].port.dev != &dev->dev)
  977. continue;
  978. uart_remove_one_port(&bfin_serial_reg, &bfin_serial_ports[i].port);
  979. bfin_serial_ports[i].port.dev = NULL;
  980. #ifdef CONFIG_SERIAL_BFIN_CTSRTS
  981. gpio_free(bfin_serial_ports[i].cts_pin);
  982. gpio_free(bfin_serial_ports[i].rts_pin);
  983. #endif
  984. }
  985. return 0;
  986. }
  987. static struct platform_driver bfin_serial_driver = {
  988. .probe = bfin_serial_probe,
  989. .remove = bfin_serial_remove,
  990. .suspend = bfin_serial_suspend,
  991. .resume = bfin_serial_resume,
  992. .driver = {
  993. .name = "bfin-uart",
  994. .owner = THIS_MODULE,
  995. },
  996. };
  997. static int __init bfin_serial_init(void)
  998. {
  999. int ret;
  1000. #ifdef CONFIG_KGDB_UART
  1001. struct bfin_serial_port *uart = &bfin_serial_ports[CONFIG_KGDB_UART_PORT];
  1002. struct ktermios t;
  1003. #endif
  1004. pr_info("Serial: Blackfin serial driver\n");
  1005. bfin_serial_init_ports();
  1006. ret = uart_register_driver(&bfin_serial_reg);
  1007. if (ret == 0) {
  1008. ret = platform_driver_register(&bfin_serial_driver);
  1009. if (ret) {
  1010. pr_debug("uart register failed\n");
  1011. uart_unregister_driver(&bfin_serial_reg);
  1012. }
  1013. }
  1014. #ifdef CONFIG_KGDB_UART
  1015. if (uart->port.cons->index != CONFIG_KGDB_UART_PORT) {
  1016. request_irq(uart->port.irq, bfin_serial_rx_int,
  1017. IRQF_DISABLED, "BFIN_UART_RX", uart);
  1018. pr_info("Request irq for kgdb uart port\n");
  1019. UART_SET_IER(uart, ERBFI);
  1020. SSYNC();
  1021. t.c_cflag = CS8|B57600;
  1022. t.c_iflag = 0;
  1023. t.c_oflag = 0;
  1024. t.c_lflag = ICANON;
  1025. t.c_line = CONFIG_KGDB_UART_PORT;
  1026. bfin_serial_set_termios(&uart->port, &t, &t);
  1027. }
  1028. #endif
  1029. return ret;
  1030. }
  1031. static void __exit bfin_serial_exit(void)
  1032. {
  1033. platform_driver_unregister(&bfin_serial_driver);
  1034. uart_unregister_driver(&bfin_serial_reg);
  1035. }
  1036. module_init(bfin_serial_init);
  1037. module_exit(bfin_serial_exit);
  1038. MODULE_AUTHOR("Aubrey.Li <aubrey.li@analog.com>");
  1039. MODULE_DESCRIPTION("Blackfin generic serial port driver");
  1040. MODULE_LICENSE("GPL");
  1041. MODULE_ALIAS_CHARDEV_MAJOR(BFIN_SERIAL_MAJOR);
  1042. MODULE_ALIAS("platform:bfin-uart");