diff options
author | Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com> | 2011-02-22 20:03:15 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-02-22 20:22:03 -0500 |
commit | 23877fdc6df3306037d81d2ac71c2d6e26ec08f4 (patch) | |
tree | 2ae96a2839058a38afc5985da6b5f229c8fc4bfe /drivers/tty | |
parent | 1822076cf324dde1eb9678ae2174dc8b4662417c (diff) |
pch_uart : Use dev_xxx not pr_xxx
For easy to understad which port the message is out,
replace pr_xxx with dev_xxx.
Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/pch_uart.c | 77 |
1 files changed, 49 insertions, 28 deletions
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 0e171b8f0700..68855351c76e 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c | |||
@@ -282,7 +282,7 @@ static int pch_uart_hal_set_line(struct eg20t_port *priv, int baud, | |||
282 | 282 | ||
283 | div = DIV_ROUND(priv->base_baud / 16, baud); | 283 | div = DIV_ROUND(priv->base_baud / 16, baud); |
284 | if (div < 0 || USHRT_MAX <= div) { | 284 | if (div < 0 || USHRT_MAX <= div) { |
285 | pr_err("Invalid Baud(div=0x%x)\n", div); | 285 | dev_err(priv->port.dev, "Invalid Baud(div=0x%x)\n", div); |
286 | return -EINVAL; | 286 | return -EINVAL; |
287 | } | 287 | } |
288 | 288 | ||
@@ -290,17 +290,17 @@ static int pch_uart_hal_set_line(struct eg20t_port *priv, int baud, | |||
290 | dlm = ((unsigned int)div >> 8) & 0x00FFU; | 290 | dlm = ((unsigned int)div >> 8) & 0x00FFU; |
291 | 291 | ||
292 | if (parity & ~(PCH_UART_LCR_PEN | PCH_UART_LCR_EPS | PCH_UART_LCR_SP)) { | 292 | if (parity & ~(PCH_UART_LCR_PEN | PCH_UART_LCR_EPS | PCH_UART_LCR_SP)) { |
293 | pr_err("Invalid parity(0x%x)\n", parity); | 293 | dev_err(priv->port.dev, "Invalid parity(0x%x)\n", parity); |
294 | return -EINVAL; | 294 | return -EINVAL; |
295 | } | 295 | } |
296 | 296 | ||
297 | if (bits & ~PCH_UART_LCR_WLS) { | 297 | if (bits & ~PCH_UART_LCR_WLS) { |
298 | pr_err("Invalid bits(0x%x)\n", bits); | 298 | dev_err(priv->port.dev, "Invalid bits(0x%x)\n", bits); |
299 | return -EINVAL; | 299 | return -EINVAL; |
300 | } | 300 | } |
301 | 301 | ||
302 | if (stb & ~PCH_UART_LCR_STB) { | 302 | if (stb & ~PCH_UART_LCR_STB) { |
303 | pr_err("Invalid STB(0x%x)\n", stb); | 303 | dev_err(priv->port.dev, "Invalid STB(0x%x)\n", stb); |
304 | return -EINVAL; | 304 | return -EINVAL; |
305 | } | 305 | } |
306 | 306 | ||
@@ -308,7 +308,7 @@ static int pch_uart_hal_set_line(struct eg20t_port *priv, int baud, | |||
308 | lcr |= bits; | 308 | lcr |= bits; |
309 | lcr |= stb; | 309 | lcr |= stb; |
310 | 310 | ||
311 | pr_debug("%s:baud = %d, div = %04x, lcr = %02x (%lu)\n", | 311 | dev_dbg(priv->port.dev, "%s:baud = %d, div = %04x, lcr = %02x (%lu)\n", |
312 | __func__, baud, div, lcr, jiffies); | 312 | __func__, baud, div, lcr, jiffies); |
313 | iowrite8(PCH_UART_LCR_DLAB, priv->membase + UART_LCR); | 313 | iowrite8(PCH_UART_LCR_DLAB, priv->membase + UART_LCR); |
314 | iowrite8(dll, priv->membase + PCH_UART_DLL); | 314 | iowrite8(dll, priv->membase + PCH_UART_DLL); |
@@ -322,7 +322,8 @@ static int pch_uart_hal_fifo_reset(struct eg20t_port *priv, | |||
322 | unsigned int flag) | 322 | unsigned int flag) |
323 | { | 323 | { |
324 | if (flag & ~(PCH_UART_FCR_TFR | PCH_UART_FCR_RFR)) { | 324 | if (flag & ~(PCH_UART_FCR_TFR | PCH_UART_FCR_RFR)) { |
325 | pr_err("%s:Invalid flag(0x%x)\n", __func__, flag); | 325 | dev_err(priv->port.dev, "%s:Invalid flag(0x%x)\n", |
326 | __func__, flag); | ||
326 | return -EINVAL; | 327 | return -EINVAL; |
327 | } | 328 | } |
328 | 329 | ||
@@ -341,17 +342,20 @@ static int pch_uart_hal_set_fifo(struct eg20t_port *priv, | |||
341 | u8 fcr; | 342 | u8 fcr; |
342 | 343 | ||
343 | if (dmamode & ~PCH_UART_FCR_DMS) { | 344 | if (dmamode & ~PCH_UART_FCR_DMS) { |
344 | pr_err("%s:Invalid DMA Mode(0x%x)\n", __func__, dmamode); | 345 | dev_err(priv->port.dev, "%s:Invalid DMA Mode(0x%x)\n", |
346 | __func__, dmamode); | ||
345 | return -EINVAL; | 347 | return -EINVAL; |
346 | } | 348 | } |
347 | 349 | ||
348 | if (fifo_size & ~(PCH_UART_FCR_FIFOE | PCH_UART_FCR_FIFO256)) { | 350 | if (fifo_size & ~(PCH_UART_FCR_FIFOE | PCH_UART_FCR_FIFO256)) { |
349 | pr_err("%s:Invalid FIFO SIZE(0x%x)\n", __func__, fifo_size); | 351 | dev_err(priv->port.dev, "%s:Invalid FIFO SIZE(0x%x)\n", |
352 | __func__, fifo_size); | ||
350 | return -EINVAL; | 353 | return -EINVAL; |
351 | } | 354 | } |
352 | 355 | ||
353 | if (trigger & ~PCH_UART_FCR_RFTL) { | 356 | if (trigger & ~PCH_UART_FCR_RFTL) { |
354 | pr_err("%s:Invalid TRIGGER(0x%x)\n", __func__, trigger); | 357 | dev_err(priv->port.dev, "%s:Invalid TRIGGER(0x%x)\n", |
358 | __func__, trigger); | ||
355 | return -EINVAL; | 359 | return -EINVAL; |
356 | } | 360 | } |
357 | 361 | ||
@@ -455,7 +459,7 @@ static int push_rx(struct eg20t_port *priv, const unsigned char *buf, | |||
455 | port = &priv->port; | 459 | port = &priv->port; |
456 | tty = tty_port_tty_get(&port->state->port); | 460 | tty = tty_port_tty_get(&port->state->port); |
457 | if (!tty) { | 461 | if (!tty) { |
458 | pr_debug("%s:tty is busy now", __func__); | 462 | dev_dbg(priv->port.dev, "%s:tty is busy now", __func__); |
459 | return -EBUSY; | 463 | return -EBUSY; |
460 | } | 464 | } |
461 | 465 | ||
@@ -472,8 +476,8 @@ static int pop_tx_x(struct eg20t_port *priv, unsigned char *buf) | |||
472 | struct uart_port *port = &priv->port; | 476 | struct uart_port *port = &priv->port; |
473 | 477 | ||
474 | if (port->x_char) { | 478 | if (port->x_char) { |
475 | pr_debug("%s:X character send %02x (%lu)\n", __func__, | 479 | dev_dbg(priv->port.dev, "%s:X character send %02x (%lu)\n", |
476 | port->x_char, jiffies); | 480 | __func__, port->x_char, jiffies); |
477 | buf[0] = port->x_char; | 481 | buf[0] = port->x_char; |
478 | port->x_char = 0; | 482 | port->x_char = 0; |
479 | ret = 1; | 483 | ret = 1; |
@@ -493,7 +497,7 @@ static int dma_push_rx(struct eg20t_port *priv, int size) | |||
493 | port = &priv->port; | 497 | port = &priv->port; |
494 | tty = tty_port_tty_get(&port->state->port); | 498 | tty = tty_port_tty_get(&port->state->port); |
495 | if (!tty) { | 499 | if (!tty) { |
496 | pr_debug("%s:tty is busy now", __func__); | 500 | dev_dbg(priv->port.dev, "%s:tty is busy now", __func__); |
497 | return 0; | 501 | return 0; |
498 | } | 502 | } |
499 | 503 | ||
@@ -567,7 +571,8 @@ static void pch_request_dma(struct uart_port *port) | |||
567 | param->tx_reg = port->mapbase + UART_TX; | 571 | param->tx_reg = port->mapbase + UART_TX; |
568 | chan = dma_request_channel(mask, filter, param); | 572 | chan = dma_request_channel(mask, filter, param); |
569 | if (!chan) { | 573 | if (!chan) { |
570 | pr_err("%s:dma_request_channel FAILS(Tx)\n", __func__); | 574 | dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Tx)\n", |
575 | __func__); | ||
571 | return; | 576 | return; |
572 | } | 577 | } |
573 | priv->chan_tx = chan; | 578 | priv->chan_tx = chan; |
@@ -579,7 +584,8 @@ static void pch_request_dma(struct uart_port *port) | |||
579 | param->rx_reg = port->mapbase + UART_RX; | 584 | param->rx_reg = port->mapbase + UART_RX; |
580 | chan = dma_request_channel(mask, filter, param); | 585 | chan = dma_request_channel(mask, filter, param); |
581 | if (!chan) { | 586 | if (!chan) { |
582 | pr_err("%s:dma_request_channel FAILS(Rx)\n", __func__); | 587 | dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Rx)\n", |
588 | __func__); | ||
583 | dma_release_channel(priv->chan_tx); | 589 | dma_release_channel(priv->chan_tx); |
584 | return; | 590 | return; |
585 | } | 591 | } |
@@ -598,7 +604,7 @@ static void pch_dma_rx_complete(void *arg) | |||
598 | int count; | 604 | int count; |
599 | 605 | ||
600 | if (!tty) { | 606 | if (!tty) { |
601 | pr_debug("%s:tty is busy now", __func__); | 607 | dev_dbg(priv->port.dev, "%s:tty is busy now", __func__); |
602 | return; | 608 | return; |
603 | } | 609 | } |
604 | 610 | ||
@@ -652,7 +658,7 @@ static int pop_tx(struct eg20t_port *priv, int size) | |||
652 | } while (!uart_circ_empty(xmit) && count < size); | 658 | } while (!uart_circ_empty(xmit) && count < size); |
653 | 659 | ||
654 | pop_tx_end: | 660 | pop_tx_end: |
655 | pr_debug("%d characters. Remained %d characters. (%lu)\n", | 661 | dev_dbg(priv->port.dev, "%d characters. Remained %d characters.(%lu)\n", |
656 | count, size - count, jiffies); | 662 | count, size - count, jiffies); |
657 | 663 | ||
658 | return count; | 664 | return count; |
@@ -728,7 +734,8 @@ static unsigned int handle_tx(struct eg20t_port *priv) | |||
728 | int tx_empty; | 734 | int tx_empty; |
729 | 735 | ||
730 | if (!priv->start_tx) { | 736 | if (!priv->start_tx) { |
731 | pr_info("%s:Tx isn't started. (%lu)\n", __func__, jiffies); | 737 | dev_info(priv->port.dev, "%s:Tx isn't started. (%lu)\n", |
738 | __func__, jiffies); | ||
732 | pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); | 739 | pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); |
733 | priv->tx_empty = 1; | 740 | priv->tx_empty = 1; |
734 | return 0; | 741 | return 0; |
@@ -778,7 +785,8 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) | |||
778 | int rem; | 785 | int rem; |
779 | 786 | ||
780 | if (!priv->start_tx) { | 787 | if (!priv->start_tx) { |
781 | pr_info("%s:Tx isn't started. (%lu)\n", __func__, jiffies); | 788 | dev_info(priv->port.dev, "%s:Tx isn't started. (%lu)\n", |
789 | __func__, jiffies); | ||
782 | pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); | 790 | pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); |
783 | priv->tx_empty = 1; | 791 | priv->tx_empty = 1; |
784 | return 0; | 792 | return 0; |
@@ -797,6 +805,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) | |||
797 | UART_XMIT_SIZE), CIRC_CNT_TO_END(xmit->head, | 805 | UART_XMIT_SIZE), CIRC_CNT_TO_END(xmit->head, |
798 | xmit->tail, UART_XMIT_SIZE)); | 806 | xmit->tail, UART_XMIT_SIZE)); |
799 | if (!bytes) { | 807 | if (!bytes) { |
808 | dev_dbg(priv->port.dev, "%s 0 bytes return\n", __func__); | ||
800 | pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); | 809 | pch_uart_hal_disable_interrupt(priv, PCH_UART_HAL_TX_INT); |
801 | uart_write_wakeup(port); | 810 | uart_write_wakeup(port); |
802 | return 0; | 811 | return 0; |
@@ -812,6 +821,9 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) | |||
812 | rem = bytes; | 821 | rem = bytes; |
813 | } | 822 | } |
814 | 823 | ||
824 | dev_dbg(priv->port.dev, "%s num=%d size=%d rem=%d\n", | ||
825 | __func__, num, size, rem); | ||
826 | |||
815 | priv->tx_dma_use = 1; | 827 | priv->tx_dma_use = 1; |
816 | 828 | ||
817 | priv->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC); | 829 | priv->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC); |
@@ -831,7 +843,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) | |||
831 | sg = priv->sg_tx_p; | 843 | sg = priv->sg_tx_p; |
832 | nent = dma_map_sg(port->dev, sg, num, DMA_TO_DEVICE); | 844 | nent = dma_map_sg(port->dev, sg, num, DMA_TO_DEVICE); |
833 | if (!nent) { | 845 | if (!nent) { |
834 | pr_err("%s:dma_map_sg Failed\n", __func__); | 846 | dev_err(priv->port.dev, "%s:dma_map_sg Failed\n", __func__); |
835 | return 0; | 847 | return 0; |
836 | } | 848 | } |
837 | priv->nent = nent; | 849 | priv->nent = nent; |
@@ -851,7 +863,8 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) | |||
851 | priv->sg_tx_p, nent, DMA_TO_DEVICE, | 863 | priv->sg_tx_p, nent, DMA_TO_DEVICE, |
852 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 864 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
853 | if (!desc) { | 865 | if (!desc) { |
854 | pr_err("%s:device_prep_slave_sg Failed\n", __func__); | 866 | dev_err(priv->port.dev, "%s:device_prep_slave_sg Failed\n", |
867 | __func__); | ||
855 | return 0; | 868 | return 0; |
856 | } | 869 | } |
857 | dma_sync_sg_for_device(port->dev, priv->sg_tx_p, nent, DMA_TO_DEVICE); | 870 | dma_sync_sg_for_device(port->dev, priv->sg_tx_p, nent, DMA_TO_DEVICE); |
@@ -935,7 +948,8 @@ static irqreturn_t pch_uart_interrupt(int irq, void *dev_id) | |||
935 | ret = PCH_UART_HANDLED_MS_INT; | 948 | ret = PCH_UART_HANDLED_MS_INT; |
936 | break; | 949 | break; |
937 | default: /* Never junp to this label */ | 950 | default: /* Never junp to this label */ |
938 | pr_err("%s:iid=%d (%lu)\n", __func__, iid, jiffies); | 951 | dev_err(priv->port.dev, "%s:iid=%d (%lu)\n", __func__, |
952 | iid, jiffies); | ||
939 | ret = -1; | 953 | ret = -1; |
940 | break; | 954 | break; |
941 | } | 955 | } |
@@ -1024,9 +1038,13 @@ static void pch_uart_start_tx(struct uart_port *port) | |||
1024 | 1038 | ||
1025 | priv = container_of(port, struct eg20t_port, port); | 1039 | priv = container_of(port, struct eg20t_port, port); |
1026 | 1040 | ||
1027 | if (priv->use_dma) | 1041 | if (priv->use_dma) { |
1028 | if (priv->tx_dma_use) | 1042 | if (priv->tx_dma_use) { |
1043 | dev_dbg(priv->port.dev, "%s : Tx DMA is NOT empty.\n", | ||
1044 | __func__); | ||
1029 | return; | 1045 | return; |
1046 | } | ||
1047 | } | ||
1030 | 1048 | ||
1031 | priv->start_tx = 1; | 1049 | priv->start_tx = 1; |
1032 | pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); | 1050 | pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); |
@@ -1142,7 +1160,8 @@ static void pch_uart_shutdown(struct uart_port *port) | |||
1142 | ret = pch_uart_hal_set_fifo(priv, PCH_UART_HAL_DMA_MODE0, | 1160 | ret = pch_uart_hal_set_fifo(priv, PCH_UART_HAL_DMA_MODE0, |
1143 | PCH_UART_HAL_FIFO_DIS, PCH_UART_HAL_TRIGGER1); | 1161 | PCH_UART_HAL_FIFO_DIS, PCH_UART_HAL_TRIGGER1); |
1144 | if (ret) | 1162 | if (ret) |
1145 | pr_err("pch_uart_hal_set_fifo Failed(ret=%d)\n", ret); | 1163 | dev_err(priv->port.dev, |
1164 | "pch_uart_hal_set_fifo Failed(ret=%d)\n", ret); | ||
1146 | 1165 | ||
1147 | if (priv->use_dma_flag) | 1166 | if (priv->use_dma_flag) |
1148 | pch_free_dma(port); | 1167 | pch_free_dma(port); |
@@ -1263,17 +1282,19 @@ static int pch_uart_verify_port(struct uart_port *port, | |||
1263 | 1282 | ||
1264 | priv = container_of(port, struct eg20t_port, port); | 1283 | priv = container_of(port, struct eg20t_port, port); |
1265 | if (serinfo->flags & UPF_LOW_LATENCY) { | 1284 | if (serinfo->flags & UPF_LOW_LATENCY) { |
1266 | pr_info("PCH UART : Use PIO Mode (without DMA)\n"); | 1285 | dev_info(priv->port.dev, |
1286 | "PCH UART : Use PIO Mode (without DMA)\n"); | ||
1267 | priv->use_dma = 0; | 1287 | priv->use_dma = 0; |
1268 | serinfo->flags &= ~UPF_LOW_LATENCY; | 1288 | serinfo->flags &= ~UPF_LOW_LATENCY; |
1269 | } else { | 1289 | } else { |
1270 | #ifndef CONFIG_PCH_DMA | 1290 | #ifndef CONFIG_PCH_DMA |
1271 | pr_err("%s : PCH DMA is not Loaded.\n", __func__); | 1291 | dev_err(priv->port.dev, "%s : PCH DMA is not Loaded.\n", |
1292 | __func__); | ||
1272 | return -EOPNOTSUPP; | 1293 | return -EOPNOTSUPP; |
1273 | #endif | 1294 | #endif |
1274 | priv->use_dma = 1; | 1295 | priv->use_dma = 1; |
1275 | priv->use_dma_flag = 1; | 1296 | priv->use_dma_flag = 1; |
1276 | pr_info("PCH UART : Use DMA Mode\n"); | 1297 | dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n"); |
1277 | } | 1298 | } |
1278 | 1299 | ||
1279 | return 0; | 1300 | return 0; |