sirfsoc_uart.c 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000
  1. /*
  2. * Driver for CSR SiRFprimaII onboard UARTs.
  3. *
  4. * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
  5. *
  6. * Licensed under GPLv2 or later.
  7. */
  8. #include <linux/module.h>
  9. #include <linux/ioport.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/init.h>
  12. #include <linux/sysrq.h>
  13. #include <linux/console.h>
  14. #include <linux/tty.h>
  15. #include <linux/tty_flip.h>
  16. #include <linux/serial_core.h>
  17. #include <linux/serial.h>
  18. #include <linux/clk.h>
  19. #include <linux/of.h>
  20. #include <linux/slab.h>
  21. #include <linux/io.h>
  22. #include <asm/irq.h>
  23. #include <asm/mach/irq.h>
  24. #include <linux/pinctrl/consumer.h>
  25. #include "sirfsoc_uart.h"
  26. static unsigned int
  27. sirfsoc_uart_pio_tx_chars(struct sirfsoc_uart_port *sirfport, int count);
  28. static unsigned int
  29. sirfsoc_uart_pio_rx_chars(struct uart_port *port, unsigned int max_rx_count);
  30. static struct uart_driver sirfsoc_uart_drv;
  31. static const struct sirfsoc_baudrate_to_regv baudrate_to_regv[] = {
  32. {4000000, 2359296},
  33. {3500000, 1310721},
  34. {3000000, 1572865},
  35. {2500000, 1245186},
  36. {2000000, 1572866},
  37. {1500000, 1245188},
  38. {1152000, 1638404},
  39. {1000000, 1572869},
  40. {921600, 1114120},
  41. {576000, 1245196},
  42. {500000, 1245198},
  43. {460800, 1572876},
  44. {230400, 1310750},
  45. {115200, 1310781},
  46. {57600, 1310843},
  47. {38400, 1114328},
  48. {19200, 1114545},
  49. {9600, 1114979},
  50. };
  51. static struct sirfsoc_uart_port sirfsoc_uart_ports[SIRFSOC_UART_NR] = {
  52. [0] = {
  53. .port = {
  54. .iotype = UPIO_MEM,
  55. .flags = UPF_BOOT_AUTOCONF,
  56. .line = 0,
  57. },
  58. },
  59. [1] = {
  60. .port = {
  61. .iotype = UPIO_MEM,
  62. .flags = UPF_BOOT_AUTOCONF,
  63. .line = 1,
  64. },
  65. },
  66. [2] = {
  67. .port = {
  68. .iotype = UPIO_MEM,
  69. .flags = UPF_BOOT_AUTOCONF,
  70. .line = 2,
  71. },
  72. },
  73. [3] = {
  74. .port = {
  75. .iotype = UPIO_MEM,
  76. .flags = UPF_BOOT_AUTOCONF,
  77. .line = 3,
  78. },
  79. },
  80. [4] = {
  81. .port = {
  82. .iotype = UPIO_MEM,
  83. .flags = UPF_BOOT_AUTOCONF,
  84. .line = 4,
  85. },
  86. },
  87. };
  88. static inline struct sirfsoc_uart_port *to_sirfport(struct uart_port *port)
  89. {
  90. return container_of(port, struct sirfsoc_uart_port, port);
  91. }
  92. static inline unsigned int sirfsoc_uart_tx_empty(struct uart_port *port)
  93. {
  94. unsigned long reg;
  95. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  96. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  97. struct sirfsoc_fifo_status *ufifo_st = &sirfport->uart_reg->fifo_status;
  98. reg = rd_regl(port, ureg->sirfsoc_tx_fifo_status);
  99. return (reg & ufifo_st->ff_empty(port->line)) ? TIOCSER_TEMT : 0;
  100. }
  101. static unsigned int sirfsoc_uart_get_mctrl(struct uart_port *port)
  102. {
  103. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  104. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  105. if (!(sirfport->ms_enabled)) {
  106. goto cts_asserted;
  107. } else if (sirfport->hw_flow_ctrl) {
  108. if (!(rd_regl(port, ureg->sirfsoc_afc_ctrl) &
  109. SIRFUART_AFC_CTS_STATUS))
  110. goto cts_asserted;
  111. else
  112. goto cts_deasserted;
  113. }
  114. cts_deasserted:
  115. return TIOCM_CAR | TIOCM_DSR;
  116. cts_asserted:
  117. return TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
  118. }
  119. static void sirfsoc_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
  120. {
  121. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  122. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  123. unsigned int assert = mctrl & TIOCM_RTS;
  124. unsigned int val = assert ? SIRFUART_AFC_CTRL_RX_THD : 0x0;
  125. unsigned int current_val;
  126. if (sirfport->hw_flow_ctrl) {
  127. current_val = rd_regl(port, ureg->sirfsoc_afc_ctrl) & ~0xFF;
  128. val |= current_val;
  129. wr_regl(port, ureg->sirfsoc_afc_ctrl, val);
  130. }
  131. }
  132. static void sirfsoc_uart_stop_tx(struct uart_port *port)
  133. {
  134. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  135. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  136. struct sirfsoc_int_en *uint_en = &sirfport->uart_reg->uart_int_en;
  137. unsigned int regv;
  138. if (!sirfport->is_marco) {
  139. regv = rd_regl(port, ureg->sirfsoc_int_en_reg);
  140. wr_regl(port, ureg->sirfsoc_int_en_reg,
  141. regv & ~uint_en->sirfsoc_txfifo_empty_en);
  142. } else
  143. wr_regl(port, SIRFUART_INT_EN_CLR,
  144. uint_en->sirfsoc_txfifo_empty_en);
  145. }
  146. static void sirfsoc_uart_start_tx(struct uart_port *port)
  147. {
  148. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  149. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  150. struct sirfsoc_int_en *uint_en = &sirfport->uart_reg->uart_int_en;
  151. unsigned long regv;
  152. sirfsoc_uart_pio_tx_chars(sirfport, 1);
  153. wr_regl(port, ureg->sirfsoc_tx_fifo_op, SIRFUART_FIFO_START);
  154. if (!sirfport->is_marco) {
  155. regv = rd_regl(port, ureg->sirfsoc_int_en_reg);
  156. wr_regl(port, ureg->sirfsoc_int_en_reg, regv |
  157. uint_en->sirfsoc_txfifo_empty_en);
  158. } else
  159. wr_regl(port, ureg->sirfsoc_int_en_reg,
  160. uint_en->sirfsoc_txfifo_empty_en);
  161. }
  162. static void sirfsoc_uart_stop_rx(struct uart_port *port)
  163. {
  164. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  165. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  166. struct sirfsoc_int_en *uint_en = &sirfport->uart_reg->uart_int_en;
  167. unsigned long reg;
  168. wr_regl(port, ureg->sirfsoc_rx_fifo_op, 0);
  169. if (!sirfport->is_marco) {
  170. reg = rd_regl(port, ureg->sirfsoc_int_en_reg);
  171. wr_regl(port, ureg->sirfsoc_int_en_reg,
  172. reg & ~(SIRFUART_RX_IO_INT_EN(port, uint_en)));
  173. } else
  174. wr_regl(port, SIRFUART_INT_EN_CLR,
  175. SIRFUART_RX_IO_INT_EN(port, uint_en));
  176. }
  177. static void sirfsoc_uart_disable_ms(struct uart_port *port)
  178. {
  179. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  180. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  181. struct sirfsoc_int_en *uint_en = &sirfport->uart_reg->uart_int_en;
  182. unsigned long reg;
  183. sirfport->ms_enabled = 0;
  184. if (!sirfport->hw_flow_ctrl)
  185. return;
  186. reg = rd_regl(port, ureg->sirfsoc_afc_ctrl);
  187. wr_regl(port, ureg->sirfsoc_afc_ctrl, reg & ~0x3FF);
  188. if (!sirfport->is_marco) {
  189. reg = rd_regl(port, ureg->sirfsoc_int_en_reg);
  190. wr_regl(port, ureg->sirfsoc_int_en_reg,
  191. reg & ~uint_en->sirfsoc_cts_en);
  192. } else
  193. wr_regl(port, SIRFUART_INT_EN_CLR,
  194. uint_en->sirfsoc_cts_en);
  195. }
  196. static void sirfsoc_uart_enable_ms(struct uart_port *port)
  197. {
  198. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  199. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  200. struct sirfsoc_int_en *uint_en = &sirfport->uart_reg->uart_int_en;
  201. unsigned long reg;
  202. unsigned long flg;
  203. if (!sirfport->hw_flow_ctrl)
  204. return;
  205. flg = SIRFUART_AFC_TX_EN | SIRFUART_AFC_RX_EN;
  206. reg = rd_regl(port, ureg->sirfsoc_afc_ctrl);
  207. wr_regl(port, ureg->sirfsoc_afc_ctrl, reg | flg);
  208. if (!sirfport->is_marco) {
  209. reg = rd_regl(port, ureg->sirfsoc_int_en_reg);
  210. wr_regl(port, ureg->sirfsoc_int_en_reg,
  211. reg | uint_en->sirfsoc_cts_en);
  212. } else
  213. wr_regl(port, ureg->sirfsoc_int_en_reg,
  214. uint_en->sirfsoc_cts_en);
  215. uart_handle_cts_change(port,
  216. !(rd_regl(port, ureg->sirfsoc_afc_ctrl) &
  217. SIRFUART_AFC_CTS_STATUS));
  218. sirfport->ms_enabled = 1;
  219. }
  220. static void sirfsoc_uart_break_ctl(struct uart_port *port, int break_state)
  221. {
  222. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  223. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  224. if (sirfport->uart_reg->uart_type == SIRF_REAL_UART) {
  225. unsigned long ulcon = rd_regl(port, ureg->sirfsoc_line_ctrl);
  226. if (break_state)
  227. ulcon |= SIRFUART_SET_BREAK;
  228. else
  229. ulcon &= ~SIRFUART_SET_BREAK;
  230. wr_regl(port, ureg->sirfsoc_line_ctrl, ulcon);
  231. }
  232. }
  233. static unsigned int
  234. sirfsoc_uart_pio_rx_chars(struct uart_port *port, unsigned int max_rx_count)
  235. {
  236. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  237. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  238. struct sirfsoc_fifo_status *ufifo_st = &sirfport->uart_reg->fifo_status;
  239. unsigned int ch, rx_count = 0;
  240. struct tty_struct *tty;
  241. tty = tty_port_tty_get(&port->state->port);
  242. if (!tty)
  243. return -ENODEV;
  244. while (!(rd_regl(port, ureg->sirfsoc_rx_fifo_status) &
  245. ufifo_st->ff_empty(port->line))) {
  246. ch = rd_regl(port, ureg->sirfsoc_rx_fifo_data) |
  247. SIRFUART_DUMMY_READ;
  248. if (unlikely(uart_handle_sysrq_char(port, ch)))
  249. continue;
  250. uart_insert_char(port, 0, 0, ch, TTY_NORMAL);
  251. rx_count++;
  252. if (rx_count >= max_rx_count)
  253. break;
  254. }
  255. port->icount.rx += rx_count;
  256. tty_flip_buffer_push(&port->state->port);
  257. return rx_count;
  258. }
  259. static unsigned int
  260. sirfsoc_uart_pio_tx_chars(struct sirfsoc_uart_port *sirfport, int count)
  261. {
  262. struct uart_port *port = &sirfport->port;
  263. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  264. struct sirfsoc_fifo_status *ufifo_st = &sirfport->uart_reg->fifo_status;
  265. struct circ_buf *xmit = &port->state->xmit;
  266. unsigned int num_tx = 0;
  267. while (!uart_circ_empty(xmit) &&
  268. !(rd_regl(port, ureg->sirfsoc_tx_fifo_status) &
  269. ufifo_st->ff_full(port->line)) &&
  270. count--) {
  271. wr_regl(port, ureg->sirfsoc_tx_fifo_data,
  272. xmit->buf[xmit->tail]);
  273. xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
  274. port->icount.tx++;
  275. num_tx++;
  276. }
  277. if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
  278. uart_write_wakeup(port);
  279. return num_tx;
  280. }
  281. static irqreturn_t sirfsoc_uart_isr(int irq, void *dev_id)
  282. {
  283. unsigned long intr_status;
  284. unsigned long cts_status;
  285. unsigned long flag = TTY_NORMAL;
  286. struct sirfsoc_uart_port *sirfport = (struct sirfsoc_uart_port *)dev_id;
  287. struct uart_port *port = &sirfport->port;
  288. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  289. struct sirfsoc_fifo_status *ufifo_st = &sirfport->uart_reg->fifo_status;
  290. struct sirfsoc_int_status *uint_st = &sirfport->uart_reg->uart_int_st;
  291. struct sirfsoc_int_en *uint_en = &sirfport->uart_reg->uart_int_en;
  292. struct uart_state *state = port->state;
  293. struct circ_buf *xmit = &port->state->xmit;
  294. spin_lock(&port->lock);
  295. intr_status = rd_regl(port, ureg->sirfsoc_int_st_reg);
  296. wr_regl(port, ureg->sirfsoc_int_st_reg, intr_status);
  297. if (unlikely(intr_status & (SIRFUART_ERR_INT_STAT(port, uint_st)))) {
  298. if (intr_status & uint_st->sirfsoc_rxd_brk) {
  299. port->icount.brk++;
  300. if (uart_handle_break(port))
  301. goto recv_char;
  302. }
  303. if (intr_status & uint_st->sirfsoc_rx_oflow)
  304. port->icount.overrun++;
  305. if (intr_status & uint_st->sirfsoc_frm_err) {
  306. port->icount.frame++;
  307. flag = TTY_FRAME;
  308. }
  309. if (intr_status & uint_st->sirfsoc_parity_err)
  310. flag = TTY_PARITY;
  311. wr_regl(port, ureg->sirfsoc_rx_fifo_op, SIRFUART_FIFO_RESET);
  312. wr_regl(port, ureg->sirfsoc_rx_fifo_op, 0);
  313. wr_regl(port, ureg->sirfsoc_rx_fifo_op, SIRFUART_FIFO_START);
  314. intr_status &= port->read_status_mask;
  315. uart_insert_char(port, intr_status,
  316. uint_en->sirfsoc_rx_oflow_en, 0, flag);
  317. tty_flip_buffer_push(&state->port);
  318. }
  319. recv_char:
  320. if ((sirfport->uart_reg->uart_type == SIRF_REAL_UART) &&
  321. (intr_status & SIRFUART_CTS_INT_ST(uint_st))) {
  322. cts_status = rd_regl(port, ureg->sirfsoc_afc_ctrl) &
  323. SIRFUART_AFC_CTS_STATUS;
  324. if (cts_status != 0)
  325. cts_status = 0;
  326. else
  327. cts_status = 1;
  328. uart_handle_cts_change(port, cts_status);
  329. wake_up_interruptible(&state->port.delta_msr_wait);
  330. }
  331. if (intr_status & SIRFUART_RX_IO_INT_ST(uint_st))
  332. sirfsoc_uart_pio_rx_chars(port, SIRFSOC_UART_IO_RX_MAX_CNT);
  333. if (intr_status & uint_st->sirfsoc_txfifo_empty) {
  334. if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
  335. spin_unlock(&port->lock);
  336. return IRQ_HANDLED;
  337. } else {
  338. sirfsoc_uart_pio_tx_chars(sirfport,
  339. SIRFSOC_UART_IO_TX_REASONABLE_CNT);
  340. if ((uart_circ_empty(xmit)) &&
  341. (rd_regl(port, ureg->sirfsoc_tx_fifo_status) &
  342. ufifo_st->ff_empty(port->line)))
  343. sirfsoc_uart_stop_tx(port);
  344. }
  345. }
  346. spin_unlock(&port->lock);
  347. return IRQ_HANDLED;
  348. }
  349. static void sirfsoc_uart_start_rx(struct uart_port *port)
  350. {
  351. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  352. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  353. struct sirfsoc_int_en *uint_en = &sirfport->uart_reg->uart_int_en;
  354. unsigned long regv;
  355. if (!sirfport->is_marco) {
  356. regv = rd_regl(port, ureg->sirfsoc_int_en_reg);
  357. wr_regl(port, ureg->sirfsoc_int_en_reg, regv |
  358. SIRFUART_RX_IO_INT_EN(port, uint_en));
  359. } else
  360. wr_regl(port, ureg->sirfsoc_int_en_reg,
  361. SIRFUART_RX_IO_INT_EN(port, uint_en));
  362. wr_regl(port, ureg->sirfsoc_rx_fifo_op, SIRFUART_FIFO_RESET);
  363. wr_regl(port, ureg->sirfsoc_rx_fifo_op, 0);
  364. wr_regl(port, ureg->sirfsoc_rx_fifo_op, SIRFUART_FIFO_START);
  365. }
  366. static unsigned int
  367. sirfsoc_usp_calc_sample_div(unsigned long set_rate,
  368. unsigned long ioclk_rate, unsigned long *sample_reg)
  369. {
  370. unsigned long min_delta = ~0UL;
  371. unsigned short sample_div;
  372. unsigned long ioclk_div = 0;
  373. unsigned long temp_delta;
  374. for (sample_div = SIRF_MIN_SAMPLE_DIV;
  375. sample_div <= SIRF_MAX_SAMPLE_DIV; sample_div++) {
  376. temp_delta = ioclk_rate -
  377. (ioclk_rate + (set_rate * sample_div) / 2)
  378. / (set_rate * sample_div) * set_rate * sample_div;
  379. temp_delta = (temp_delta > 0) ? temp_delta : -temp_delta;
  380. if (temp_delta < min_delta) {
  381. ioclk_div = (2 * ioclk_rate /
  382. (set_rate * sample_div) + 1) / 2 - 1;
  383. if (ioclk_div > SIRF_IOCLK_DIV_MAX)
  384. continue;
  385. min_delta = temp_delta;
  386. *sample_reg = sample_div;
  387. if (!temp_delta)
  388. break;
  389. }
  390. }
  391. return ioclk_div;
  392. }
  393. static unsigned int
  394. sirfsoc_uart_calc_sample_div(unsigned long baud_rate,
  395. unsigned long ioclk_rate, unsigned long *set_baud)
  396. {
  397. unsigned long min_delta = ~0UL;
  398. unsigned short sample_div;
  399. unsigned int regv = 0;
  400. unsigned long ioclk_div;
  401. unsigned long baud_tmp;
  402. int temp_delta;
  403. for (sample_div = SIRF_MIN_SAMPLE_DIV;
  404. sample_div <= SIRF_MAX_SAMPLE_DIV; sample_div++) {
  405. ioclk_div = (ioclk_rate / (baud_rate * (sample_div + 1))) - 1;
  406. if (ioclk_div > SIRF_IOCLK_DIV_MAX)
  407. continue;
  408. baud_tmp = ioclk_rate / ((ioclk_div + 1) * (sample_div + 1));
  409. temp_delta = baud_tmp - baud_rate;
  410. temp_delta = (temp_delta > 0) ? temp_delta : -temp_delta;
  411. if (temp_delta < min_delta) {
  412. regv = regv & (~SIRF_IOCLK_DIV_MASK);
  413. regv = regv | ioclk_div;
  414. regv = regv & (~SIRF_SAMPLE_DIV_MASK);
  415. regv = regv | (sample_div << SIRF_SAMPLE_DIV_SHIFT);
  416. min_delta = temp_delta;
  417. *set_baud = baud_tmp;
  418. }
  419. }
  420. return regv;
  421. }
  422. static void sirfsoc_uart_set_termios(struct uart_port *port,
  423. struct ktermios *termios,
  424. struct ktermios *old)
  425. {
  426. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  427. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  428. struct sirfsoc_int_en *uint_en = &sirfport->uart_reg->uart_int_en;
  429. unsigned long config_reg = 0;
  430. unsigned long baud_rate;
  431. unsigned long set_baud;
  432. unsigned long flags;
  433. unsigned long ic;
  434. unsigned int clk_div_reg = 0;
  435. unsigned long temp_reg_val, ioclk_rate;
  436. unsigned long rx_time_out;
  437. int threshold_div;
  438. int temp;
  439. u32 data_bit_len, stop_bit_len, len_val;
  440. unsigned long sample_div_reg = 0xf;
  441. ioclk_rate = port->uartclk;
  442. switch (termios->c_cflag & CSIZE) {
  443. default:
  444. case CS8:
  445. data_bit_len = 8;
  446. config_reg |= SIRFUART_DATA_BIT_LEN_8;
  447. break;
  448. case CS7:
  449. data_bit_len = 7;
  450. config_reg |= SIRFUART_DATA_BIT_LEN_7;
  451. break;
  452. case CS6:
  453. data_bit_len = 6;
  454. config_reg |= SIRFUART_DATA_BIT_LEN_6;
  455. break;
  456. case CS5:
  457. data_bit_len = 5;
  458. config_reg |= SIRFUART_DATA_BIT_LEN_5;
  459. break;
  460. }
  461. if (termios->c_cflag & CSTOPB) {
  462. config_reg |= SIRFUART_STOP_BIT_LEN_2;
  463. stop_bit_len = 2;
  464. } else
  465. stop_bit_len = 1;
  466. spin_lock_irqsave(&port->lock, flags);
  467. port->read_status_mask = uint_en->sirfsoc_rx_oflow_en;
  468. port->ignore_status_mask = 0;
  469. if (sirfport->uart_reg->uart_type == SIRF_REAL_UART) {
  470. if (termios->c_iflag & INPCK)
  471. port->read_status_mask |= uint_en->sirfsoc_frm_err_en |
  472. uint_en->sirfsoc_parity_err_en;
  473. }
  474. if (sirfport->uart_reg->uart_type == SIRF_USP_UART) {
  475. if (termios->c_iflag & INPCK)
  476. port->read_status_mask |= uint_en->sirfsoc_frm_err_en;
  477. }
  478. if (termios->c_iflag & (BRKINT | PARMRK))
  479. port->read_status_mask |= uint_en->sirfsoc_rxd_brk_en;
  480. if (sirfport->uart_reg->uart_type == SIRF_REAL_UART) {
  481. if (termios->c_iflag & IGNPAR)
  482. port->ignore_status_mask |=
  483. uint_en->sirfsoc_frm_err_en |
  484. uint_en->sirfsoc_parity_err_en;
  485. if (termios->c_cflag & PARENB) {
  486. if (termios->c_cflag & CMSPAR) {
  487. if (termios->c_cflag & PARODD)
  488. config_reg |= SIRFUART_STICK_BIT_MARK;
  489. else
  490. config_reg |= SIRFUART_STICK_BIT_SPACE;
  491. } else if (termios->c_cflag & PARODD) {
  492. config_reg |= SIRFUART_STICK_BIT_ODD;
  493. } else {
  494. config_reg |= SIRFUART_STICK_BIT_EVEN;
  495. }
  496. }
  497. }
  498. if (sirfport->uart_reg->uart_type == SIRF_USP_UART) {
  499. if (termios->c_iflag & IGNPAR)
  500. port->ignore_status_mask |=
  501. uint_en->sirfsoc_frm_err_en;
  502. if (termios->c_cflag & PARENB)
  503. dev_warn(port->dev,
  504. "USP-UART not support parity err\n");
  505. }
  506. if (termios->c_iflag & IGNBRK) {
  507. port->ignore_status_mask |=
  508. uint_en->sirfsoc_rxd_brk_en;
  509. if (termios->c_iflag & IGNPAR)
  510. port->ignore_status_mask |=
  511. uint_en->sirfsoc_rx_oflow_en;
  512. }
  513. if ((termios->c_cflag & CREAD) == 0)
  514. port->ignore_status_mask |= SIRFUART_DUMMY_READ;
  515. /* Hardware Flow Control Settings */
  516. if (UART_ENABLE_MS(port, termios->c_cflag)) {
  517. if (!sirfport->ms_enabled)
  518. sirfsoc_uart_enable_ms(port);
  519. } else {
  520. if (sirfport->ms_enabled)
  521. sirfsoc_uart_disable_ms(port);
  522. }
  523. baud_rate = uart_get_baud_rate(port, termios, old, 0, 4000000);
  524. if (ioclk_rate == 150000000) {
  525. for (ic = 0; ic < SIRF_BAUD_RATE_SUPPORT_NR; ic++)
  526. if (baud_rate == baudrate_to_regv[ic].baud_rate)
  527. clk_div_reg = baudrate_to_regv[ic].reg_val;
  528. }
  529. set_baud = baud_rate;
  530. if (sirfport->uart_reg->uart_type == SIRF_REAL_UART) {
  531. if (unlikely(clk_div_reg == 0))
  532. clk_div_reg = sirfsoc_uart_calc_sample_div(baud_rate,
  533. ioclk_rate, &set_baud);
  534. wr_regl(port, ureg->sirfsoc_divisor, clk_div_reg);
  535. }
  536. if (sirfport->uart_reg->uart_type == SIRF_USP_UART) {
  537. clk_div_reg = sirfsoc_usp_calc_sample_div(baud_rate,
  538. ioclk_rate, &sample_div_reg);
  539. sample_div_reg--;
  540. set_baud = ((ioclk_rate / (clk_div_reg+1) - 1) /
  541. (sample_div_reg + 1));
  542. /* setting usp mode 2 */
  543. len_val = ((1 << 0) | (1 << 8));
  544. len_val |= ((clk_div_reg & 0x3ff) << 21);
  545. wr_regl(port, ureg->sirfsoc_mode2,
  546. len_val);
  547. }
  548. if (tty_termios_baud_rate(termios))
  549. tty_termios_encode_baud_rate(termios, set_baud, set_baud);
  550. /* set receive timeout && data bits len */
  551. rx_time_out = SIRFSOC_UART_RX_TIMEOUT(set_baud, 20000);
  552. rx_time_out = SIRFUART_RECV_TIMEOUT_VALUE(rx_time_out);
  553. temp_reg_val = rd_regl(port, ureg->sirfsoc_tx_fifo_op);
  554. wr_regl(port, ureg->sirfsoc_rx_fifo_op, 0);
  555. wr_regl(port, ureg->sirfsoc_tx_fifo_op,
  556. (temp_reg_val & ~SIRFUART_FIFO_START));
  557. if (sirfport->uart_reg->uart_type == SIRF_REAL_UART) {
  558. config_reg |= SIRFUART_RECV_TIMEOUT(port, rx_time_out);
  559. wr_regl(port, ureg->sirfsoc_line_ctrl, config_reg);
  560. }
  561. if (sirfport->uart_reg->uart_type == SIRF_USP_UART) {
  562. /*tx frame ctrl*/
  563. len_val = (data_bit_len - 1) << 0;
  564. len_val |= (data_bit_len + 1 + stop_bit_len - 1) << 16;
  565. len_val |= ((data_bit_len - 1) << 24);
  566. len_val |= (((clk_div_reg & 0xc00) >> 10) << 30);
  567. wr_regl(port, ureg->sirfsoc_tx_frame_ctrl, len_val);
  568. /*rx frame ctrl*/
  569. len_val = (data_bit_len - 1) << 0;
  570. len_val |= (data_bit_len + 1 + stop_bit_len - 1) << 8;
  571. len_val |= (data_bit_len - 1) << 16;
  572. len_val |= (((clk_div_reg & 0xf000) >> 12) << 24);
  573. wr_regl(port, ureg->sirfsoc_rx_frame_ctrl, len_val);
  574. /*async param*/
  575. wr_regl(port, ureg->sirfsoc_async_param_reg,
  576. (SIRFUART_RECV_TIMEOUT(port, rx_time_out)) |
  577. (sample_div_reg & 0x3f) << 16);
  578. }
  579. wr_regl(port, ureg->sirfsoc_tx_dma_io_ctrl, SIRFUART_IO_MODE);
  580. wr_regl(port, ureg->sirfsoc_rx_dma_io_ctrl, SIRFUART_IO_MODE);
  581. /* Reset Rx/Tx FIFO Threshold level for proper baudrate */
  582. if (set_baud < 1000000)
  583. threshold_div = 1;
  584. else
  585. threshold_div = 2;
  586. temp = SIRFUART_FIFO_THD(port);
  587. wr_regl(port, ureg->sirfsoc_tx_fifo_ctrl, temp / threshold_div);
  588. wr_regl(port, ureg->sirfsoc_rx_fifo_ctrl, temp / threshold_div);
  589. temp_reg_val |= SIRFUART_FIFO_START;
  590. wr_regl(port, ureg->sirfsoc_tx_fifo_op, temp_reg_val);
  591. uart_update_timeout(port, termios->c_cflag, set_baud);
  592. sirfsoc_uart_start_rx(port);
  593. wr_regl(port, ureg->sirfsoc_tx_rx_en, SIRFUART_TX_EN | SIRFUART_RX_EN);
  594. spin_unlock_irqrestore(&port->lock, flags);
  595. }
  596. static void startup_uart_controller(struct uart_port *port)
  597. {
  598. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  599. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  600. unsigned long temp_regv;
  601. int temp;
  602. temp_regv = rd_regl(port, ureg->sirfsoc_tx_dma_io_ctrl);
  603. wr_regl(port, ureg->sirfsoc_tx_dma_io_ctrl, temp_regv |
  604. SIRFUART_IO_MODE);
  605. temp_regv = rd_regl(port, ureg->sirfsoc_rx_dma_io_ctrl);
  606. wr_regl(port, ureg->sirfsoc_rx_dma_io_ctrl, temp_regv |
  607. SIRFUART_IO_MODE);
  608. wr_regl(port, ureg->sirfsoc_tx_dma_io_len, 0);
  609. wr_regl(port, ureg->sirfsoc_rx_dma_io_len, 0);
  610. wr_regl(port, ureg->sirfsoc_tx_rx_en, SIRFUART_RX_EN | SIRFUART_TX_EN);
  611. if (sirfport->uart_reg->uart_type == SIRF_USP_UART)
  612. wr_regl(port, ureg->sirfsoc_mode1,
  613. SIRFSOC_USP_ENDIAN_CTRL_LSBF |
  614. SIRFSOC_USP_EN);
  615. wr_regl(port, ureg->sirfsoc_tx_fifo_op, SIRFUART_FIFO_RESET);
  616. wr_regl(port, ureg->sirfsoc_tx_fifo_op, 0);
  617. wr_regl(port, ureg->sirfsoc_rx_fifo_op, SIRFUART_FIFO_RESET);
  618. wr_regl(port, ureg->sirfsoc_rx_fifo_op, 0);
  619. temp = SIRFUART_FIFO_THD(port);
  620. wr_regl(port, ureg->sirfsoc_tx_fifo_ctrl, temp);
  621. wr_regl(port, ureg->sirfsoc_rx_fifo_ctrl, temp);
  622. }
  623. static int sirfsoc_uart_startup(struct uart_port *port)
  624. {
  625. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  626. unsigned int index = port->line;
  627. int ret;
  628. set_irq_flags(port->irq, IRQF_VALID | IRQF_NOAUTOEN);
  629. ret = request_irq(port->irq,
  630. sirfsoc_uart_isr,
  631. 0,
  632. SIRFUART_PORT_NAME,
  633. sirfport);
  634. if (ret != 0) {
  635. dev_err(port->dev, "UART%d request IRQ line (%d) failed.\n",
  636. index, port->irq);
  637. goto irq_err;
  638. }
  639. startup_uart_controller(port);
  640. enable_irq(port->irq);
  641. irq_err:
  642. return ret;
  643. }
  644. static void sirfsoc_uart_shutdown(struct uart_port *port)
  645. {
  646. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  647. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  648. if (!sirfport->is_marco)
  649. wr_regl(port, ureg->sirfsoc_int_en_reg, 0);
  650. else
  651. wr_regl(port, SIRFUART_INT_EN_CLR, ~0UL);
  652. free_irq(port->irq, sirfport);
  653. if (sirfport->ms_enabled) {
  654. sirfsoc_uart_disable_ms(port);
  655. sirfport->ms_enabled = 0;
  656. }
  657. }
  658. static const char *sirfsoc_uart_type(struct uart_port *port)
  659. {
  660. return port->type == SIRFSOC_PORT_TYPE ? SIRFUART_PORT_NAME : NULL;
  661. }
  662. static int sirfsoc_uart_request_port(struct uart_port *port)
  663. {
  664. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  665. struct sirfsoc_uart_param *uart_param = &sirfport->uart_reg->uart_param;
  666. void *ret;
  667. ret = request_mem_region(port->mapbase,
  668. SIRFUART_MAP_SIZE, uart_param->port_name);
  669. return ret ? 0 : -EBUSY;
  670. }
  671. static void sirfsoc_uart_release_port(struct uart_port *port)
  672. {
  673. release_mem_region(port->mapbase, SIRFUART_MAP_SIZE);
  674. }
  675. static void sirfsoc_uart_config_port(struct uart_port *port, int flags)
  676. {
  677. if (flags & UART_CONFIG_TYPE) {
  678. port->type = SIRFSOC_PORT_TYPE;
  679. sirfsoc_uart_request_port(port);
  680. }
  681. }
  682. static struct uart_ops sirfsoc_uart_ops = {
  683. .tx_empty = sirfsoc_uart_tx_empty,
  684. .get_mctrl = sirfsoc_uart_get_mctrl,
  685. .set_mctrl = sirfsoc_uart_set_mctrl,
  686. .stop_tx = sirfsoc_uart_stop_tx,
  687. .start_tx = sirfsoc_uart_start_tx,
  688. .stop_rx = sirfsoc_uart_stop_rx,
  689. .enable_ms = sirfsoc_uart_enable_ms,
  690. .break_ctl = sirfsoc_uart_break_ctl,
  691. .startup = sirfsoc_uart_startup,
  692. .shutdown = sirfsoc_uart_shutdown,
  693. .set_termios = sirfsoc_uart_set_termios,
  694. .type = sirfsoc_uart_type,
  695. .release_port = sirfsoc_uart_release_port,
  696. .request_port = sirfsoc_uart_request_port,
  697. .config_port = sirfsoc_uart_config_port,
  698. };
  699. #ifdef CONFIG_SERIAL_SIRFSOC_CONSOLE
  700. static int __init
  701. sirfsoc_uart_console_setup(struct console *co, char *options)
  702. {
  703. unsigned int baud = 115200;
  704. unsigned int bits = 8;
  705. unsigned int parity = 'n';
  706. unsigned int flow = 'n';
  707. struct uart_port *port = &sirfsoc_uart_ports[co->index].port;
  708. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  709. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  710. if (co->index < 0 || co->index >= SIRFSOC_UART_NR)
  711. return -EINVAL;
  712. if (!port->mapbase)
  713. return -ENODEV;
  714. /* enable usp in mode1 register */
  715. if (sirfport->uart_reg->uart_type == SIRF_USP_UART)
  716. wr_regl(port, ureg->sirfsoc_mode1, SIRFSOC_USP_EN |
  717. SIRFSOC_USP_ENDIAN_CTRL_LSBF);
  718. if (options)
  719. uart_parse_options(options, &baud, &parity, &bits, &flow);
  720. port->cons = co;
  721. return uart_set_options(port, co, baud, parity, bits, flow);
  722. }
  723. static void sirfsoc_uart_console_putchar(struct uart_port *port, int ch)
  724. {
  725. struct sirfsoc_uart_port *sirfport = to_sirfport(port);
  726. struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
  727. struct sirfsoc_fifo_status *ufifo_st = &sirfport->uart_reg->fifo_status;
  728. while (rd_regl(port,
  729. ureg->sirfsoc_tx_fifo_status) & ufifo_st->ff_full(port->line))
  730. cpu_relax();
  731. wr_regb(port, ureg->sirfsoc_tx_fifo_data, ch);
  732. }
  733. static void sirfsoc_uart_console_write(struct console *co, const char *s,
  734. unsigned int count)
  735. {
  736. struct uart_port *port = &sirfsoc_uart_ports[co->index].port;
  737. uart_console_write(port, s, count, sirfsoc_uart_console_putchar);
  738. }
  739. static struct console sirfsoc_uart_console = {
  740. .name = SIRFSOC_UART_NAME,
  741. .device = uart_console_device,
  742. .flags = CON_PRINTBUFFER,
  743. .index = -1,
  744. .write = sirfsoc_uart_console_write,
  745. .setup = sirfsoc_uart_console_setup,
  746. .data = &sirfsoc_uart_drv,
  747. };
  748. static int __init sirfsoc_uart_console_init(void)
  749. {
  750. register_console(&sirfsoc_uart_console);
  751. return 0;
  752. }
  753. console_initcall(sirfsoc_uart_console_init);
  754. #endif
  755. static struct uart_driver sirfsoc_uart_drv = {
  756. .owner = THIS_MODULE,
  757. .driver_name = SIRFUART_PORT_NAME,
  758. .nr = SIRFSOC_UART_NR,
  759. .dev_name = SIRFSOC_UART_NAME,
  760. .major = SIRFSOC_UART_MAJOR,
  761. .minor = SIRFSOC_UART_MINOR,
  762. #ifdef CONFIG_SERIAL_SIRFSOC_CONSOLE
  763. .cons = &sirfsoc_uart_console,
  764. #else
  765. .cons = NULL,
  766. #endif
  767. };
  768. static struct of_device_id sirfsoc_uart_ids[] = {
  769. { .compatible = "sirf,prima2-uart", .data = &sirfsoc_uart,},
  770. { .compatible = "sirf,marco-uart", .data = &sirfsoc_uart},
  771. { .compatible = "sirf,prima2-usp-uart", .data = &sirfsoc_usp},
  772. {}
  773. };
  774. MODULE_DEVICE_TABLE(of, sirfsoc_uart_ids);
  775. static int sirfsoc_uart_probe(struct platform_device *pdev)
  776. {
  777. struct sirfsoc_uart_port *sirfport;
  778. struct uart_port *port;
  779. struct resource *res;
  780. int ret;
  781. const struct of_device_id *match;
  782. match = of_match_node(sirfsoc_uart_ids, pdev->dev.of_node);
  783. if (of_property_read_u32(pdev->dev.of_node, "cell-index", &pdev->id)) {
  784. dev_err(&pdev->dev,
  785. "Unable to find cell-index in uart node.\n");
  786. ret = -EFAULT;
  787. goto err;
  788. }
  789. if (of_device_is_compatible(pdev->dev.of_node, "sirf,prima2-usp-uart"))
  790. pdev->id += ((struct sirfsoc_uart_register *)
  791. match->data)->uart_param.register_uart_nr;
  792. sirfport = &sirfsoc_uart_ports[pdev->id];
  793. port = &sirfport->port;
  794. port->dev = &pdev->dev;
  795. port->private_data = sirfport;
  796. sirfport->uart_reg = (struct sirfsoc_uart_register *)match->data;
  797. if (of_device_is_compatible(pdev->dev.of_node, "sirf,prima2-uart"))
  798. sirfport->uart_reg->uart_type = SIRF_REAL_UART;
  799. if (of_device_is_compatible(pdev->dev.of_node, "sirf,prima2-usp-uart"))
  800. sirfport->uart_reg->uart_type = SIRF_USP_UART;
  801. if (of_device_is_compatible(pdev->dev.of_node, "sirf,marco-uart"))
  802. sirfport->is_marco = true;
  803. if (of_find_property(pdev->dev.of_node, "hw_flow_ctrl", NULL))
  804. sirfport->hw_flow_ctrl = 1;
  805. if (of_property_read_u32(pdev->dev.of_node,
  806. "fifosize",
  807. &port->fifosize)) {
  808. dev_err(&pdev->dev,
  809. "Unable to find fifosize in uart node.\n");
  810. ret = -EFAULT;
  811. goto err;
  812. }
  813. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  814. if (res == NULL) {
  815. dev_err(&pdev->dev, "Insufficient resources.\n");
  816. ret = -EFAULT;
  817. goto err;
  818. }
  819. port->mapbase = res->start;
  820. port->membase = devm_ioremap(&pdev->dev, res->start, resource_size(res));
  821. if (!port->membase) {
  822. dev_err(&pdev->dev, "Cannot remap resource.\n");
  823. ret = -ENOMEM;
  824. goto err;
  825. }
  826. res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
  827. if (res == NULL) {
  828. dev_err(&pdev->dev, "Insufficient resources.\n");
  829. ret = -EFAULT;
  830. goto err;
  831. }
  832. port->irq = res->start;
  833. if (sirfport->hw_flow_ctrl) {
  834. sirfport->p = pinctrl_get_select_default(&pdev->dev);
  835. ret = IS_ERR(sirfport->p);
  836. if (ret)
  837. goto err;
  838. }
  839. sirfport->clk = clk_get(&pdev->dev, NULL);
  840. if (IS_ERR(sirfport->clk)) {
  841. ret = PTR_ERR(sirfport->clk);
  842. goto clk_err;
  843. }
  844. clk_prepare_enable(sirfport->clk);
  845. port->uartclk = clk_get_rate(sirfport->clk);
  846. port->ops = &sirfsoc_uart_ops;
  847. spin_lock_init(&port->lock);
  848. platform_set_drvdata(pdev, sirfport);
  849. ret = uart_add_one_port(&sirfsoc_uart_drv, port);
  850. if (ret != 0) {
  851. dev_err(&pdev->dev, "Cannot add UART port(%d).\n", pdev->id);
  852. goto port_err;
  853. }
  854. return 0;
  855. port_err:
  856. clk_disable_unprepare(sirfport->clk);
  857. clk_put(sirfport->clk);
  858. clk_err:
  859. if (sirfport->hw_flow_ctrl)
  860. pinctrl_put(sirfport->p);
  861. err:
  862. return ret;
  863. }
  864. static int sirfsoc_uart_remove(struct platform_device *pdev)
  865. {
  866. struct sirfsoc_uart_port *sirfport = platform_get_drvdata(pdev);
  867. struct uart_port *port = &sirfport->port;
  868. if (sirfport->hw_flow_ctrl)
  869. pinctrl_put(sirfport->p);
  870. clk_disable_unprepare(sirfport->clk);
  871. clk_put(sirfport->clk);
  872. uart_remove_one_port(&sirfsoc_uart_drv, port);
  873. return 0;
  874. }
  875. static int
  876. sirfsoc_uart_suspend(struct platform_device *pdev, pm_message_t state)
  877. {
  878. struct sirfsoc_uart_port *sirfport = platform_get_drvdata(pdev);
  879. struct uart_port *port = &sirfport->port;
  880. uart_suspend_port(&sirfsoc_uart_drv, port);
  881. return 0;
  882. }
  883. static int sirfsoc_uart_resume(struct platform_device *pdev)
  884. {
  885. struct sirfsoc_uart_port *sirfport = platform_get_drvdata(pdev);
  886. struct uart_port *port = &sirfport->port;
  887. uart_resume_port(&sirfsoc_uart_drv, port);
  888. return 0;
  889. }
  890. static struct platform_driver sirfsoc_uart_driver = {
  891. .probe = sirfsoc_uart_probe,
  892. .remove = sirfsoc_uart_remove,
  893. .suspend = sirfsoc_uart_suspend,
  894. .resume = sirfsoc_uart_resume,
  895. .driver = {
  896. .name = SIRFUART_PORT_NAME,
  897. .owner = THIS_MODULE,
  898. .of_match_table = sirfsoc_uart_ids,
  899. },
  900. };
  901. static int __init sirfsoc_uart_init(void)
  902. {
  903. int ret = 0;
  904. ret = uart_register_driver(&sirfsoc_uart_drv);
  905. if (ret)
  906. goto out;
  907. ret = platform_driver_register(&sirfsoc_uart_driver);
  908. if (ret)
  909. uart_unregister_driver(&sirfsoc_uart_drv);
  910. out:
  911. return ret;
  912. }
  913. module_init(sirfsoc_uart_init);
  914. static void __exit sirfsoc_uart_exit(void)
  915. {
  916. platform_driver_unregister(&sirfsoc_uart_driver);
  917. uart_unregister_driver(&sirfsoc_uart_drv);
  918. }
  919. module_exit(sirfsoc_uart_exit);
  920. MODULE_LICENSE("GPL v2");
  921. MODULE_AUTHOR("Bin Shi <Bin.Shi@csr.com>, Rong Wang<Rong.Wang@csr.com>");
  922. MODULE_DESCRIPTION("CSR SiRFprimaII Uart Driver");