diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 13:39:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 13:39:38 -0500 |
commit | 86f6f9b64a730844f1438cbedfacd6fb0170a7f7 (patch) | |
tree | cd80f8610b444ae3bd2ebfc136c2c3299a52bd9b /drivers | |
parent | d33a6291c1c577ff2272edab7416a0f7308e1cef (diff) | |
parent | 8b6f08eaef16dfcfebc32fa9a017bf70336ad9ec (diff) |
Merge branch 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (31 commits)
sh: Add support for AP-SH4AD-0A board.
sh: Add support for AP-SH4A-3A board.
sh: Add a new mach type for alpha project boards.
serial: sh-sci: build fixes.
sh: sh7372 SH4AL-DSP probe support
sh: sh7366 Enable SDIO IRQs
sh: sh7343 Enable SDIO IRQs
sh: mach-ecovec24: enable runtime PM for SDHI
sh: sh7723 / ap325rxa enable SDIO IRQs
sh: sh7722 Enable SDIO IRQs
sh: sh7724 Enable SDIO IRQs
sh: Fix up legacy PTEA space attribute mapping.
sh: Stub out legacy PCC pgprot encoding for X2 TLBs.
sh: constify prefetch pointers.
sh: Add a machvec callback for early memblock reservations.
sh: update sh7757lcr_defconfig
sh: add PVR probing for SH7757 3rd cut
sh: Use device_initcall() instead of __initcall()
sh: intc - convert board specific landisk code
sh: Move init_landisk_IRQ to header file
...
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/serial/sh-sci.c | 102 | ||||
-rw-r--r-- | drivers/serial/sh-sci.h | 153 |
2 files changed, 77 insertions, 178 deletions
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index c291b3add1d2..92c91c83edde 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO) | 4 | * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO) |
5 | * | 5 | * |
6 | * Copyright (C) 2002 - 2008 Paul Mundt | 6 | * Copyright (C) 2002 - 2011 Paul Mundt |
7 | * Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Jul 2007). | 7 | * Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Jul 2007). |
8 | * | 8 | * |
9 | * based off of the old drivers/char/sh-sci.c by: | 9 | * based off of the old drivers/char/sh-sci.c by: |
@@ -81,14 +81,22 @@ struct sci_port { | |||
81 | struct timer_list break_timer; | 81 | struct timer_list break_timer; |
82 | int break_flag; | 82 | int break_flag; |
83 | 83 | ||
84 | /* SCSCR initialization */ | ||
85 | unsigned int scscr; | ||
86 | |||
87 | /* SCBRR calculation algo */ | ||
88 | unsigned int scbrr_algo_id; | ||
89 | |||
84 | /* Interface clock */ | 90 | /* Interface clock */ |
85 | struct clk *iclk; | 91 | struct clk *iclk; |
86 | /* Function clock */ | 92 | /* Function clock */ |
87 | struct clk *fclk; | 93 | struct clk *fclk; |
88 | 94 | ||
89 | struct list_head node; | 95 | struct list_head node; |
96 | |||
90 | struct dma_chan *chan_tx; | 97 | struct dma_chan *chan_tx; |
91 | struct dma_chan *chan_rx; | 98 | struct dma_chan *chan_rx; |
99 | |||
92 | #ifdef CONFIG_SERIAL_SH_SCI_DMA | 100 | #ifdef CONFIG_SERIAL_SH_SCI_DMA |
93 | struct device *dma_dev; | 101 | struct device *dma_dev; |
94 | unsigned int slave_tx; | 102 | unsigned int slave_tx; |
@@ -415,9 +423,9 @@ static void sci_transmit_chars(struct uart_port *port) | |||
415 | if (!(status & SCxSR_TDxE(port))) { | 423 | if (!(status & SCxSR_TDxE(port))) { |
416 | ctrl = sci_in(port, SCSCR); | 424 | ctrl = sci_in(port, SCSCR); |
417 | if (uart_circ_empty(xmit)) | 425 | if (uart_circ_empty(xmit)) |
418 | ctrl &= ~SCI_CTRL_FLAGS_TIE; | 426 | ctrl &= ~SCSCR_TIE; |
419 | else | 427 | else |
420 | ctrl |= SCI_CTRL_FLAGS_TIE; | 428 | ctrl |= SCSCR_TIE; |
421 | sci_out(port, SCSCR, ctrl); | 429 | sci_out(port, SCSCR, ctrl); |
422 | return; | 430 | return; |
423 | } | 431 | } |
@@ -459,7 +467,7 @@ static void sci_transmit_chars(struct uart_port *port) | |||
459 | sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); | 467 | sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); |
460 | } | 468 | } |
461 | 469 | ||
462 | ctrl |= SCI_CTRL_FLAGS_TIE; | 470 | ctrl |= SCSCR_TIE; |
463 | sci_out(port, SCSCR, ctrl); | 471 | sci_out(port, SCSCR, ctrl); |
464 | } | 472 | } |
465 | } | 473 | } |
@@ -708,7 +716,7 @@ static irqreturn_t sci_rx_interrupt(int irq, void *ptr) | |||
708 | disable_irq_nosync(irq); | 716 | disable_irq_nosync(irq); |
709 | scr |= 0x4000; | 717 | scr |= 0x4000; |
710 | } else { | 718 | } else { |
711 | scr &= ~SCI_CTRL_FLAGS_RIE; | 719 | scr &= ~SCSCR_RIE; |
712 | } | 720 | } |
713 | sci_out(port, SCSCR, scr); | 721 | sci_out(port, SCSCR, scr); |
714 | /* Clear current interrupt */ | 722 | /* Clear current interrupt */ |
@@ -777,6 +785,18 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr) | |||
777 | return IRQ_HANDLED; | 785 | return IRQ_HANDLED; |
778 | } | 786 | } |
779 | 787 | ||
788 | static inline unsigned long port_rx_irq_mask(struct uart_port *port) | ||
789 | { | ||
790 | /* | ||
791 | * Not all ports (such as SCIFA) will support REIE. Rather than | ||
792 | * special-casing the port type, we check the port initialization | ||
793 | * IRQ enable mask to see whether the IRQ is desired at all. If | ||
794 | * it's unset, it's logically inferred that there's no point in | ||
795 | * testing for it. | ||
796 | */ | ||
797 | return SCSCR_RIE | (to_sci_port(port)->scscr & SCSCR_REIE); | ||
798 | } | ||
799 | |||
780 | static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) | 800 | static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) |
781 | { | 801 | { |
782 | unsigned short ssr_status, scr_status, err_enabled; | 802 | unsigned short ssr_status, scr_status, err_enabled; |
@@ -786,22 +806,25 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) | |||
786 | 806 | ||
787 | ssr_status = sci_in(port, SCxSR); | 807 | ssr_status = sci_in(port, SCxSR); |
788 | scr_status = sci_in(port, SCSCR); | 808 | scr_status = sci_in(port, SCSCR); |
789 | err_enabled = scr_status & (SCI_CTRL_FLAGS_REIE | SCI_CTRL_FLAGS_RIE); | 809 | err_enabled = scr_status & port_rx_irq_mask(port); |
790 | 810 | ||
791 | /* Tx Interrupt */ | 811 | /* Tx Interrupt */ |
792 | if ((ssr_status & SCxSR_TDxE(port)) && (scr_status & SCI_CTRL_FLAGS_TIE) && | 812 | if ((ssr_status & SCxSR_TDxE(port)) && (scr_status & SCSCR_TIE) && |
793 | !s->chan_tx) | 813 | !s->chan_tx) |
794 | ret = sci_tx_interrupt(irq, ptr); | 814 | ret = sci_tx_interrupt(irq, ptr); |
815 | |||
795 | /* | 816 | /* |
796 | * Rx Interrupt: if we're using DMA, the DMA controller clears RDF / | 817 | * Rx Interrupt: if we're using DMA, the DMA controller clears RDF / |
797 | * DR flags | 818 | * DR flags |
798 | */ | 819 | */ |
799 | if (((ssr_status & SCxSR_RDxF(port)) || s->chan_rx) && | 820 | if (((ssr_status & SCxSR_RDxF(port)) || s->chan_rx) && |
800 | (scr_status & SCI_CTRL_FLAGS_RIE)) | 821 | (scr_status & SCSCR_RIE)) |
801 | ret = sci_rx_interrupt(irq, ptr); | 822 | ret = sci_rx_interrupt(irq, ptr); |
823 | |||
802 | /* Error Interrupt */ | 824 | /* Error Interrupt */ |
803 | if ((ssr_status & SCxSR_ERRORS(port)) && err_enabled) | 825 | if ((ssr_status & SCxSR_ERRORS(port)) && err_enabled) |
804 | ret = sci_er_interrupt(irq, ptr); | 826 | ret = sci_er_interrupt(irq, ptr); |
827 | |||
805 | /* Break Interrupt */ | 828 | /* Break Interrupt */ |
806 | if ((ssr_status & SCxSR_BRK(port)) && err_enabled) | 829 | if ((ssr_status & SCxSR_BRK(port)) && err_enabled) |
807 | ret = sci_br_interrupt(irq, ptr); | 830 | ret = sci_br_interrupt(irq, ptr); |
@@ -951,7 +974,7 @@ static void sci_dma_tx_complete(void *arg) | |||
951 | schedule_work(&s->work_tx); | 974 | schedule_work(&s->work_tx); |
952 | } else if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { | 975 | } else if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { |
953 | u16 ctrl = sci_in(port, SCSCR); | 976 | u16 ctrl = sci_in(port, SCSCR); |
954 | sci_out(port, SCSCR, ctrl & ~SCI_CTRL_FLAGS_TIE); | 977 | sci_out(port, SCSCR, ctrl & ~SCSCR_TIE); |
955 | } | 978 | } |
956 | 979 | ||
957 | spin_unlock_irqrestore(&port->lock, flags); | 980 | spin_unlock_irqrestore(&port->lock, flags); |
@@ -1214,14 +1237,16 @@ static void sci_start_tx(struct uart_port *port) | |||
1214 | if (new != scr) | 1237 | if (new != scr) |
1215 | sci_out(port, SCSCR, new); | 1238 | sci_out(port, SCSCR, new); |
1216 | } | 1239 | } |
1240 | |||
1217 | if (s->chan_tx && !uart_circ_empty(&s->port.state->xmit) && | 1241 | if (s->chan_tx && !uart_circ_empty(&s->port.state->xmit) && |
1218 | s->cookie_tx < 0) | 1242 | s->cookie_tx < 0) |
1219 | schedule_work(&s->work_tx); | 1243 | schedule_work(&s->work_tx); |
1220 | #endif | 1244 | #endif |
1245 | |||
1221 | if (!s->chan_tx || port->type == PORT_SCIFA || port->type == PORT_SCIFB) { | 1246 | if (!s->chan_tx || port->type == PORT_SCIFA || port->type == PORT_SCIFB) { |
1222 | /* Set TIE (Transmit Interrupt Enable) bit in SCSCR */ | 1247 | /* Set TIE (Transmit Interrupt Enable) bit in SCSCR */ |
1223 | ctrl = sci_in(port, SCSCR); | 1248 | ctrl = sci_in(port, SCSCR); |
1224 | sci_out(port, SCSCR, ctrl | SCI_CTRL_FLAGS_TIE); | 1249 | sci_out(port, SCSCR, ctrl | SCSCR_TIE); |
1225 | } | 1250 | } |
1226 | } | 1251 | } |
1227 | 1252 | ||
@@ -1231,20 +1256,24 @@ static void sci_stop_tx(struct uart_port *port) | |||
1231 | 1256 | ||
1232 | /* Clear TIE (Transmit Interrupt Enable) bit in SCSCR */ | 1257 | /* Clear TIE (Transmit Interrupt Enable) bit in SCSCR */ |
1233 | ctrl = sci_in(port, SCSCR); | 1258 | ctrl = sci_in(port, SCSCR); |
1259 | |||
1234 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) | 1260 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) |
1235 | ctrl &= ~0x8000; | 1261 | ctrl &= ~0x8000; |
1236 | ctrl &= ~SCI_CTRL_FLAGS_TIE; | 1262 | |
1263 | ctrl &= ~SCSCR_TIE; | ||
1264 | |||
1237 | sci_out(port, SCSCR, ctrl); | 1265 | sci_out(port, SCSCR, ctrl); |
1238 | } | 1266 | } |
1239 | 1267 | ||
1240 | static void sci_start_rx(struct uart_port *port) | 1268 | static void sci_start_rx(struct uart_port *port) |
1241 | { | 1269 | { |
1242 | unsigned short ctrl = SCI_CTRL_FLAGS_RIE | SCI_CTRL_FLAGS_REIE; | 1270 | unsigned short ctrl; |
1271 | |||
1272 | ctrl = sci_in(port, SCSCR) | port_rx_irq_mask(port); | ||
1243 | 1273 | ||
1244 | /* Set RIE (Receive Interrupt Enable) bit in SCSCR */ | ||
1245 | ctrl |= sci_in(port, SCSCR); | ||
1246 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) | 1274 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) |
1247 | ctrl &= ~0x4000; | 1275 | ctrl &= ~0x4000; |
1276 | |||
1248 | sci_out(port, SCSCR, ctrl); | 1277 | sci_out(port, SCSCR, ctrl); |
1249 | } | 1278 | } |
1250 | 1279 | ||
@@ -1252,11 +1281,13 @@ static void sci_stop_rx(struct uart_port *port) | |||
1252 | { | 1281 | { |
1253 | unsigned short ctrl; | 1282 | unsigned short ctrl; |
1254 | 1283 | ||
1255 | /* Clear RIE (Receive Interrupt Enable) bit in SCSCR */ | ||
1256 | ctrl = sci_in(port, SCSCR); | 1284 | ctrl = sci_in(port, SCSCR); |
1285 | |||
1257 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) | 1286 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) |
1258 | ctrl &= ~0x4000; | 1287 | ctrl &= ~0x4000; |
1259 | ctrl &= ~(SCI_CTRL_FLAGS_RIE | SCI_CTRL_FLAGS_REIE); | 1288 | |
1289 | ctrl &= ~port_rx_irq_mask(port); | ||
1290 | |||
1260 | sci_out(port, SCSCR, ctrl); | 1291 | sci_out(port, SCSCR, ctrl); |
1261 | } | 1292 | } |
1262 | 1293 | ||
@@ -1296,7 +1327,7 @@ static void rx_timer_fn(unsigned long arg) | |||
1296 | scr &= ~0x4000; | 1327 | scr &= ~0x4000; |
1297 | enable_irq(s->irqs[1]); | 1328 | enable_irq(s->irqs[1]); |
1298 | } | 1329 | } |
1299 | sci_out(port, SCSCR, scr | SCI_CTRL_FLAGS_RIE); | 1330 | sci_out(port, SCSCR, scr | SCSCR_RIE); |
1300 | dev_dbg(port->dev, "DMA Rx timed out\n"); | 1331 | dev_dbg(port->dev, "DMA Rx timed out\n"); |
1301 | schedule_work(&s->work_rx); | 1332 | schedule_work(&s->work_rx); |
1302 | } | 1333 | } |
@@ -1442,12 +1473,31 @@ static void sci_shutdown(struct uart_port *port) | |||
1442 | s->disable(port); | 1473 | s->disable(port); |
1443 | } | 1474 | } |
1444 | 1475 | ||
1476 | static unsigned int sci_scbrr_calc(unsigned int algo_id, unsigned int bps, | ||
1477 | unsigned long freq) | ||
1478 | { | ||
1479 | switch (algo_id) { | ||
1480 | case SCBRR_ALGO_1: | ||
1481 | return ((freq + 16 * bps) / (16 * bps) - 1); | ||
1482 | case SCBRR_ALGO_2: | ||
1483 | return ((freq + 16 * bps) / (32 * bps) - 1); | ||
1484 | case SCBRR_ALGO_3: | ||
1485 | return (((freq * 2) + 16 * bps) / (16 * bps) - 1); | ||
1486 | case SCBRR_ALGO_4: | ||
1487 | return (((freq * 2) + 16 * bps) / (32 * bps) - 1); | ||
1488 | case SCBRR_ALGO_5: | ||
1489 | return (((freq * 1000 / 32) / bps) - 1); | ||
1490 | } | ||
1491 | |||
1492 | /* Warn, but use a safe default */ | ||
1493 | WARN_ON(1); | ||
1494 | return ((freq + 16 * bps) / (32 * bps) - 1); | ||
1495 | } | ||
1496 | |||
1445 | static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | 1497 | static void sci_set_termios(struct uart_port *port, struct ktermios *termios, |
1446 | struct ktermios *old) | 1498 | struct ktermios *old) |
1447 | { | 1499 | { |
1448 | #ifdef CONFIG_SERIAL_SH_SCI_DMA | ||
1449 | struct sci_port *s = to_sci_port(port); | 1500 | struct sci_port *s = to_sci_port(port); |
1450 | #endif | ||
1451 | unsigned int status, baud, smr_val, max_baud; | 1501 | unsigned int status, baud, smr_val, max_baud; |
1452 | int t = -1; | 1502 | int t = -1; |
1453 | u16 scfcr = 0; | 1503 | u16 scfcr = 0; |
@@ -1464,7 +1514,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1464 | 1514 | ||
1465 | baud = uart_get_baud_rate(port, termios, old, 0, max_baud); | 1515 | baud = uart_get_baud_rate(port, termios, old, 0, max_baud); |
1466 | if (likely(baud && port->uartclk)) | 1516 | if (likely(baud && port->uartclk)) |
1467 | t = SCBRR_VALUE(baud, port->uartclk); | 1517 | t = sci_scbrr_calc(s->scbrr_algo_id, baud, port->uartclk); |
1468 | 1518 | ||
1469 | do { | 1519 | do { |
1470 | status = sci_in(port, SCxSR); | 1520 | status = sci_in(port, SCxSR); |
@@ -1490,7 +1540,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1490 | sci_out(port, SCSMR, smr_val); | 1540 | sci_out(port, SCSMR, smr_val); |
1491 | 1541 | ||
1492 | dev_dbg(port->dev, "%s: SMR %x, t %x, SCSCR %x\n", __func__, smr_val, t, | 1542 | dev_dbg(port->dev, "%s: SMR %x, t %x, SCSCR %x\n", __func__, smr_val, t, |
1493 | SCSCR_INIT(port)); | 1543 | s->scscr); |
1494 | 1544 | ||
1495 | if (t > 0) { | 1545 | if (t > 0) { |
1496 | if (t >= 256) { | 1546 | if (t >= 256) { |
@@ -1506,7 +1556,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1506 | sci_init_pins(port, termios->c_cflag); | 1556 | sci_init_pins(port, termios->c_cflag); |
1507 | sci_out(port, SCFCR, scfcr | ((termios->c_cflag & CRTSCTS) ? SCFCR_MCE : 0)); | 1557 | sci_out(port, SCFCR, scfcr | ((termios->c_cflag & CRTSCTS) ? SCFCR_MCE : 0)); |
1508 | 1558 | ||
1509 | sci_out(port, SCSCR, SCSCR_INIT(port)); | 1559 | sci_out(port, SCSCR, s->scscr); |
1510 | 1560 | ||
1511 | #ifdef CONFIG_SERIAL_SH_SCI_DMA | 1561 | #ifdef CONFIG_SERIAL_SH_SCI_DMA |
1512 | /* | 1562 | /* |
@@ -1679,9 +1729,11 @@ static int __devinit sci_init_single(struct platform_device *dev, | |||
1679 | port->mapbase = p->mapbase; | 1729 | port->mapbase = p->mapbase; |
1680 | port->membase = p->membase; | 1730 | port->membase = p->membase; |
1681 | 1731 | ||
1682 | port->irq = p->irqs[SCIx_TXI_IRQ]; | 1732 | port->irq = p->irqs[SCIx_TXI_IRQ]; |
1683 | port->flags = p->flags; | 1733 | port->flags = p->flags; |
1684 | sci_port->type = port->type = p->type; | 1734 | sci_port->type = port->type = p->type; |
1735 | sci_port->scscr = p->scscr; | ||
1736 | sci_port->scbrr_algo_id = p->scbrr_algo_id; | ||
1685 | 1737 | ||
1686 | #ifdef CONFIG_SERIAL_SH_SCI_DMA | 1738 | #ifdef CONFIG_SERIAL_SH_SCI_DMA |
1687 | sci_port->dma_dev = p->dma_dev; | 1739 | sci_port->dma_dev = p->dma_dev; |
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h index 4bc614e4221c..b223d6cbf33a 100644 --- a/drivers/serial/sh-sci.h +++ b/drivers/serial/sh-sci.h | |||
@@ -15,27 +15,17 @@ | |||
15 | defined(CONFIG_CPU_SUBTYPE_SH7709) | 15 | defined(CONFIG_CPU_SUBTYPE_SH7709) |
16 | # define SCPCR 0xA4000116 /* 16 bit SCI and SCIF */ | 16 | # define SCPCR 0xA4000116 /* 16 bit SCI and SCIF */ |
17 | # define SCPDR 0xA4000136 /* 8 bit SCI and SCIF */ | 17 | # define SCPDR 0xA4000136 /* 8 bit SCI and SCIF */ |
18 | # define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ | ||
19 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) | 18 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) |
20 | # define SCIF0 0xA4400000 | 19 | # define SCIF0 0xA4400000 |
21 | # define SCIF2 0xA4410000 | 20 | # define SCIF2 0xA4410000 |
22 | # define SCSMR_Ir 0xA44A0000 | ||
23 | # define IRDA_SCIF SCIF0 | ||
24 | # define SCPCR 0xA4000116 | 21 | # define SCPCR 0xA4000116 |
25 | # define SCPDR 0xA4000136 | 22 | # define SCPDR 0xA4000136 |
26 | |||
27 | /* Set the clock source, | ||
28 | * SCIF2 (0xA4410000) -> External clock, SCK pin used as clock input | ||
29 | * SCIF0 (0xA4400000) -> Internal clock, SCK pin as serial clock output | ||
30 | */ | ||
31 | # define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0 | ||
32 | #elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \ | 23 | #elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \ |
33 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ | 24 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ |
34 | defined(CONFIG_ARCH_SH73A0) || \ | 25 | defined(CONFIG_ARCH_SH73A0) || \ |
35 | defined(CONFIG_ARCH_SH7367) || \ | 26 | defined(CONFIG_ARCH_SH7367) || \ |
36 | defined(CONFIG_ARCH_SH7377) || \ | 27 | defined(CONFIG_ARCH_SH7377) || \ |
37 | defined(CONFIG_ARCH_SH7372) | 28 | defined(CONFIG_ARCH_SH7372) |
38 | # define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */ | ||
39 | # define PORT_PTCR 0xA405011EUL | 29 | # define PORT_PTCR 0xA405011EUL |
40 | # define PORT_PVCR 0xA4050122UL | 30 | # define PORT_PVCR 0xA4050122UL |
41 | # define SCIF_ORER 0x0200 /* overrun error bit */ | 31 | # define SCIF_ORER 0x0200 /* overrun error bit */ |
@@ -43,7 +33,6 @@ | |||
43 | # define SCSPTR1 0xFFE0001C /* 8 bit SCIF */ | 33 | # define SCSPTR1 0xFFE0001C /* 8 bit SCIF */ |
44 | # define SCSPTR2 0xFFE80020 /* 16 bit SCIF */ | 34 | # define SCSPTR2 0xFFE80020 /* 16 bit SCIF */ |
45 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 35 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
46 | # define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
47 | #elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \ | 36 | #elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \ |
48 | defined(CONFIG_CPU_SUBTYPE_SH7750R) || \ | 37 | defined(CONFIG_CPU_SUBTYPE_SH7750R) || \ |
49 | defined(CONFIG_CPU_SUBTYPE_SH7750S) || \ | 38 | defined(CONFIG_CPU_SUBTYPE_SH7750S) || \ |
@@ -53,39 +42,31 @@ | |||
53 | # define SCSPTR1 0xffe0001c /* 8 bit SCI */ | 42 | # define SCSPTR1 0xffe0001c /* 8 bit SCI */ |
54 | # define SCSPTR2 0xFFE80020 /* 16 bit SCIF */ | 43 | # define SCSPTR2 0xFFE80020 /* 16 bit SCIF */ |
55 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 44 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
56 | # define SCSCR_INIT(port) (((port)->type == PORT_SCI) ? \ | ||
57 | 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ : \ | ||
58 | 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ ) | ||
59 | #elif defined(CONFIG_CPU_SUBTYPE_SH7760) | 45 | #elif defined(CONFIG_CPU_SUBTYPE_SH7760) |
60 | # define SCSPTR0 0xfe600024 /* 16 bit SCIF */ | 46 | # define SCSPTR0 0xfe600024 /* 16 bit SCIF */ |
61 | # define SCSPTR1 0xfe610024 /* 16 bit SCIF */ | 47 | # define SCSPTR1 0xfe610024 /* 16 bit SCIF */ |
62 | # define SCSPTR2 0xfe620024 /* 16 bit SCIF */ | 48 | # define SCSPTR2 0xfe620024 /* 16 bit SCIF */ |
63 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 49 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
64 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
65 | #elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) | 50 | #elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) |
66 | # define SCSPTR0 0xA4400000 /* 16 bit SCIF */ | 51 | # define SCSPTR0 0xA4400000 /* 16 bit SCIF */ |
67 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 52 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
68 | # define PACR 0xa4050100 | 53 | # define PACR 0xa4050100 |
69 | # define PBCR 0xa4050102 | 54 | # define PBCR 0xa4050102 |
70 | # define SCSCR_INIT(port) 0x3B | ||
71 | #elif defined(CONFIG_CPU_SUBTYPE_SH7343) | 55 | #elif defined(CONFIG_CPU_SUBTYPE_SH7343) |
72 | # define SCSPTR0 0xffe00010 /* 16 bit SCIF */ | 56 | # define SCSPTR0 0xffe00010 /* 16 bit SCIF */ |
73 | # define SCSPTR1 0xffe10010 /* 16 bit SCIF */ | 57 | # define SCSPTR1 0xffe10010 /* 16 bit SCIF */ |
74 | # define SCSPTR2 0xffe20010 /* 16 bit SCIF */ | 58 | # define SCSPTR2 0xffe20010 /* 16 bit SCIF */ |
75 | # define SCSPTR3 0xffe30010 /* 16 bit SCIF */ | 59 | # define SCSPTR3 0xffe30010 /* 16 bit SCIF */ |
76 | # define SCSCR_INIT(port) 0x32 /* TIE=0,RIE=0,TE=1,RE=1,REIE=0,CKE=1 */ | ||
77 | #elif defined(CONFIG_CPU_SUBTYPE_SH7722) | 60 | #elif defined(CONFIG_CPU_SUBTYPE_SH7722) |
78 | # define PADR 0xA4050120 | 61 | # define PADR 0xA4050120 |
79 | # define PSDR 0xA405013e | 62 | # define PSDR 0xA405013e |
80 | # define PWDR 0xA4050166 | 63 | # define PWDR 0xA4050166 |
81 | # define PSCR 0xA405011E | 64 | # define PSCR 0xA405011E |
82 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 65 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
83 | # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
84 | #elif defined(CONFIG_CPU_SUBTYPE_SH7366) | 66 | #elif defined(CONFIG_CPU_SUBTYPE_SH7366) |
85 | # define SCPDR0 0xA405013E /* 16 bit SCIF0 PSDR */ | 67 | # define SCPDR0 0xA405013E /* 16 bit SCIF0 PSDR */ |
86 | # define SCSPTR0 SCPDR0 | 68 | # define SCSPTR0 SCPDR0 |
87 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 69 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
88 | # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
89 | #elif defined(CONFIG_CPU_SUBTYPE_SH7723) | 70 | #elif defined(CONFIG_CPU_SUBTYPE_SH7723) |
90 | # define SCSPTR0 0xa4050160 | 71 | # define SCSPTR0 0xa4050160 |
91 | # define SCSPTR1 0xa405013e | 72 | # define SCSPTR1 0xa405013e |
@@ -94,62 +75,38 @@ | |||
94 | # define SCSPTR4 0xa4050128 | 75 | # define SCSPTR4 0xa4050128 |
95 | # define SCSPTR5 0xa4050128 | 76 | # define SCSPTR5 0xa4050128 |
96 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 77 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
97 | # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
98 | #elif defined(CONFIG_CPU_SUBTYPE_SH7724) | 78 | #elif defined(CONFIG_CPU_SUBTYPE_SH7724) |
99 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 79 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
100 | # define SCSCR_INIT(port) ((port)->type == PORT_SCIFA ? \ | ||
101 | 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ : \ | ||
102 | 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ ) | ||
103 | #elif defined(CONFIG_CPU_SUBTYPE_SH4_202) | 80 | #elif defined(CONFIG_CPU_SUBTYPE_SH4_202) |
104 | # define SCSPTR2 0xffe80020 /* 16 bit SCIF */ | 81 | # define SCSPTR2 0xffe80020 /* 16 bit SCIF */ |
105 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 82 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
106 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
107 | #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) | 83 | #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) |
108 | # define SCIF_BASE_ADDR 0x01030000 | ||
109 | # define SCIF_ADDR_SH5 PHYS_PERIPHERAL_BLOCK+SCIF_BASE_ADDR | ||
110 | # define SCIF_PTR2_OFFS 0x0000020 | 84 | # define SCIF_PTR2_OFFS 0x0000020 |
111 | # define SCIF_LSR2_OFFS 0x0000024 | ||
112 | # define SCSPTR2 ((port->mapbase)+SCIF_PTR2_OFFS) /* 16 bit SCIF */ | 85 | # define SCSPTR2 ((port->mapbase)+SCIF_PTR2_OFFS) /* 16 bit SCIF */ |
113 | # define SCLSR2 ((port->mapbase)+SCIF_LSR2_OFFS) /* 16 bit SCIF */ | ||
114 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0, TE=1,RE=1,REIE=1 */ | ||
115 | #elif defined(CONFIG_H83007) || defined(CONFIG_H83068) | 86 | #elif defined(CONFIG_H83007) || defined(CONFIG_H83068) |
116 | # define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ | ||
117 | # define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port) | 87 | # define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port) |
118 | #elif defined(CONFIG_H8S2678) | 88 | #elif defined(CONFIG_H8S2678) |
119 | # define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ | ||
120 | # define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port) | 89 | # define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port) |
121 | #elif defined(CONFIG_CPU_SUBTYPE_SH7757) | 90 | #elif defined(CONFIG_CPU_SUBTYPE_SH7757) |
122 | # define SCSPTR0 0xfe4b0020 | 91 | # define SCSPTR0 0xfe4b0020 |
123 | # define SCSPTR1 0xfe4b0020 | 92 | # define SCSPTR1 0xfe4b0020 |
124 | # define SCSPTR2 0xfe4b0020 | 93 | # define SCSPTR2 0xfe4b0020 |
125 | # define SCIF_ORER 0x0001 | 94 | # define SCIF_ORER 0x0001 |
126 | # define SCSCR_INIT(port) 0x38 | ||
127 | # define SCIF_ONLY | 95 | # define SCIF_ONLY |
128 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) | 96 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) |
129 | # define SCSPTR0 0xffe00024 /* 16 bit SCIF */ | 97 | # define SCSPTR0 0xffe00024 /* 16 bit SCIF */ |
130 | # define SCSPTR1 0xffe08024 /* 16 bit SCIF */ | 98 | # define SCSPTR1 0xffe08024 /* 16 bit SCIF */ |
131 | # define SCSPTR2 0xffe10020 /* 16 bit SCIF/IRDA */ | 99 | # define SCSPTR2 0xffe10020 /* 16 bit SCIF/IRDA */ |
132 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 100 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
133 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
134 | #elif defined(CONFIG_CPU_SUBTYPE_SH7770) | 101 | #elif defined(CONFIG_CPU_SUBTYPE_SH7770) |
135 | # define SCSPTR0 0xff923020 /* 16 bit SCIF */ | 102 | # define SCSPTR0 0xff923020 /* 16 bit SCIF */ |
136 | # define SCSPTR1 0xff924020 /* 16 bit SCIF */ | 103 | # define SCSPTR1 0xff924020 /* 16 bit SCIF */ |
137 | # define SCSPTR2 0xff925020 /* 16 bit SCIF */ | 104 | # define SCSPTR2 0xff925020 /* 16 bit SCIF */ |
138 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 105 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
139 | # define SCSCR_INIT(port) 0x3c /* TIE=0,RIE=0,TE=1,RE=1,REIE=1,cke=2 */ | ||
140 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) | 106 | #elif defined(CONFIG_CPU_SUBTYPE_SH7780) |
141 | # define SCSPTR0 0xffe00024 /* 16 bit SCIF */ | 107 | # define SCSPTR0 0xffe00024 /* 16 bit SCIF */ |
142 | # define SCSPTR1 0xffe10024 /* 16 bit SCIF */ | 108 | # define SCSPTR1 0xffe10024 /* 16 bit SCIF */ |
143 | # define SCIF_ORER 0x0001 /* Overrun error bit */ | 109 | # define SCIF_ORER 0x0001 /* Overrun error bit */ |
144 | |||
145 | #if defined(CONFIG_SH_SH2007) | ||
146 | /* TIE=0,RIE=0,TE=1,RE=1,REIE=1,CKE1=0 */ | ||
147 | # define SCSCR_INIT(port) 0x38 | ||
148 | #else | ||
149 | /* TIE=0,RIE=0,TE=1,RE=1,REIE=1,CKE1=1 */ | ||
150 | # define SCSCR_INIT(port) 0x3a | ||
151 | #endif | ||
152 | |||
153 | #elif defined(CONFIG_CPU_SUBTYPE_SH7785) || \ | 110 | #elif defined(CONFIG_CPU_SUBTYPE_SH7785) || \ |
154 | defined(CONFIG_CPU_SUBTYPE_SH7786) | 111 | defined(CONFIG_CPU_SUBTYPE_SH7786) |
155 | # define SCSPTR0 0xffea0024 /* 16 bit SCIF */ | 112 | # define SCSPTR0 0xffea0024 /* 16 bit SCIF */ |
@@ -159,7 +116,6 @@ | |||
159 | # define SCSPTR4 0xffee0024 /* 16 bit SCIF */ | 116 | # define SCSPTR4 0xffee0024 /* 16 bit SCIF */ |
160 | # define SCSPTR5 0xffef0024 /* 16 bit SCIF */ | 117 | # define SCSPTR5 0xffef0024 /* 16 bit SCIF */ |
161 | # define SCIF_ORER 0x0001 /* Overrun error bit */ | 118 | # define SCIF_ORER 0x0001 /* Overrun error bit */ |
162 | # define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
163 | #elif defined(CONFIG_CPU_SUBTYPE_SH7201) || \ | 119 | #elif defined(CONFIG_CPU_SUBTYPE_SH7201) || \ |
164 | defined(CONFIG_CPU_SUBTYPE_SH7203) || \ | 120 | defined(CONFIG_CPU_SUBTYPE_SH7203) || \ |
165 | defined(CONFIG_CPU_SUBTYPE_SH7206) || \ | 121 | defined(CONFIG_CPU_SUBTYPE_SH7206) || \ |
@@ -174,52 +130,21 @@ | |||
174 | # define SCSPTR6 0xfffeB020 /* 16 bit SCIF */ | 130 | # define SCSPTR6 0xfffeB020 /* 16 bit SCIF */ |
175 | # define SCSPTR7 0xfffeB820 /* 16 bit SCIF */ | 131 | # define SCSPTR7 0xfffeB820 /* 16 bit SCIF */ |
176 | # endif | 132 | # endif |
177 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
178 | #elif defined(CONFIG_CPU_SUBTYPE_SH7619) | 133 | #elif defined(CONFIG_CPU_SUBTYPE_SH7619) |
179 | # define SCSPTR0 0xf8400020 /* 16 bit SCIF */ | 134 | # define SCSPTR0 0xf8400020 /* 16 bit SCIF */ |
180 | # define SCSPTR1 0xf8410020 /* 16 bit SCIF */ | 135 | # define SCSPTR1 0xf8410020 /* 16 bit SCIF */ |
181 | # define SCSPTR2 0xf8420020 /* 16 bit SCIF */ | 136 | # define SCSPTR2 0xf8420020 /* 16 bit SCIF */ |
182 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 137 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
183 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
184 | #elif defined(CONFIG_CPU_SUBTYPE_SHX3) | 138 | #elif defined(CONFIG_CPU_SUBTYPE_SHX3) |
185 | # define SCSPTR0 0xffc30020 /* 16 bit SCIF */ | 139 | # define SCSPTR0 0xffc30020 /* 16 bit SCIF */ |
186 | # define SCSPTR1 0xffc40020 /* 16 bit SCIF */ | 140 | # define SCSPTR1 0xffc40020 /* 16 bit SCIF */ |
187 | # define SCSPTR2 0xffc50020 /* 16 bit SCIF */ | 141 | # define SCSPTR2 0xffc50020 /* 16 bit SCIF */ |
188 | # define SCSPTR3 0xffc60020 /* 16 bit SCIF */ | 142 | # define SCSPTR3 0xffc60020 /* 16 bit SCIF */ |
189 | # define SCIF_ORER 0x0001 /* Overrun error bit */ | 143 | # define SCIF_ORER 0x0001 /* Overrun error bit */ |
190 | # define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
191 | #else | 144 | #else |
192 | # error CPU subtype not defined | 145 | # error CPU subtype not defined |
193 | #endif | 146 | #endif |
194 | 147 | ||
195 | /* SCSCR */ | ||
196 | #define SCI_CTRL_FLAGS_TIE 0x80 /* all */ | ||
197 | #define SCI_CTRL_FLAGS_RIE 0x40 /* all */ | ||
198 | #define SCI_CTRL_FLAGS_TE 0x20 /* all */ | ||
199 | #define SCI_CTRL_FLAGS_RE 0x10 /* all */ | ||
200 | #if defined(CONFIG_CPU_SUBTYPE_SH7750) || \ | ||
201 | defined(CONFIG_CPU_SUBTYPE_SH7091) || \ | ||
202 | defined(CONFIG_CPU_SUBTYPE_SH7750R) || \ | ||
203 | defined(CONFIG_CPU_SUBTYPE_SH7722) || \ | ||
204 | defined(CONFIG_CPU_SUBTYPE_SH7750S) || \ | ||
205 | defined(CONFIG_CPU_SUBTYPE_SH7751) || \ | ||
206 | defined(CONFIG_CPU_SUBTYPE_SH7751R) || \ | ||
207 | defined(CONFIG_CPU_SUBTYPE_SH7763) || \ | ||
208 | defined(CONFIG_CPU_SUBTYPE_SH7780) || \ | ||
209 | defined(CONFIG_CPU_SUBTYPE_SH7785) || \ | ||
210 | defined(CONFIG_CPU_SUBTYPE_SH7786) || \ | ||
211 | defined(CONFIG_CPU_SUBTYPE_SHX3) | ||
212 | #define SCI_CTRL_FLAGS_REIE 0x08 /* 7750 SCIF */ | ||
213 | #elif defined(CONFIG_CPU_SUBTYPE_SH7724) | ||
214 | #define SCI_CTRL_FLAGS_REIE ((port)->type == PORT_SCIFA ? 0 : 8) | ||
215 | #else | ||
216 | #define SCI_CTRL_FLAGS_REIE 0 | ||
217 | #endif | ||
218 | /* SCI_CTRL_FLAGS_MPIE 0x08 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */ | ||
219 | /* SCI_CTRL_FLAGS_TEIE 0x04 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */ | ||
220 | /* SCI_CTRL_FLAGS_CKE1 0x02 * all */ | ||
221 | /* SCI_CTRL_FLAGS_CKE0 0x01 * 7707 SCI/SCIF, 7708 SCI, 7709 SCI/SCIF, 7750 SCI */ | ||
222 | |||
223 | /* SCxSR SCI */ | 148 | /* SCxSR SCI */ |
224 | #define SCI_TDRE 0x80 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */ | 149 | #define SCI_TDRE 0x80 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */ |
225 | #define SCI_RDRF 0x40 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */ | 150 | #define SCI_RDRF 0x40 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */ |
@@ -300,23 +225,11 @@ | |||
300 | /* SCFCR */ | 225 | /* SCFCR */ |
301 | #define SCFCR_RFRST 0x0002 | 226 | #define SCFCR_RFRST 0x0002 |
302 | #define SCFCR_TFRST 0x0004 | 227 | #define SCFCR_TFRST 0x0004 |
303 | #define SCFCR_TCRST 0x4000 | ||
304 | #define SCFCR_MCE 0x0008 | 228 | #define SCFCR_MCE 0x0008 |
305 | 229 | ||
306 | #define SCI_MAJOR 204 | 230 | #define SCI_MAJOR 204 |
307 | #define SCI_MINOR_START 8 | 231 | #define SCI_MINOR_START 8 |
308 | 232 | ||
309 | /* Generic serial flags */ | ||
310 | #define SCI_RX_THROTTLE 0x0000001 | ||
311 | |||
312 | #define SCI_MAGIC 0xbabeface | ||
313 | |||
314 | /* | ||
315 | * Events are used to schedule things to happen at timer-interrupt | ||
316 | * time, instead of at rs interrupt time. | ||
317 | */ | ||
318 | #define SCI_EVENT_WRITE_WAKEUP 0 | ||
319 | |||
320 | #define SCI_IN(size, offset) \ | 233 | #define SCI_IN(size, offset) \ |
321 | if ((size) == 8) { \ | 234 | if ((size) == 8) { \ |
322 | return ioread8(port->membase + (offset)); \ | 235 | return ioread8(port->membase + (offset)); \ |
@@ -445,8 +358,6 @@ | |||
445 | SCIF_FNS(SCSMR, 0x00, 16) | 358 | SCIF_FNS(SCSMR, 0x00, 16) |
446 | SCIF_FNS(SCBRR, 0x04, 8) | 359 | SCIF_FNS(SCBRR, 0x04, 8) |
447 | SCIF_FNS(SCSCR, 0x08, 16) | 360 | SCIF_FNS(SCSCR, 0x08, 16) |
448 | SCIF_FNS(SCTDSR, 0x0c, 8) | ||
449 | SCIF_FNS(SCFER, 0x10, 16) | ||
450 | SCIF_FNS(SCxSR, 0x14, 16) | 361 | SCIF_FNS(SCxSR, 0x14, 16) |
451 | SCIF_FNS(SCFCR, 0x18, 16) | 362 | SCIF_FNS(SCFCR, 0x18, 16) |
452 | SCIF_FNS(SCFDR, 0x1c, 16) | 363 | SCIF_FNS(SCFDR, 0x1c, 16) |
@@ -476,8 +387,6 @@ SCIx_FNS(SCxTDR, 0x20, 8, 0x0c, 8) | |||
476 | SCIx_FNS(SCxSR, 0x14, 16, 0x10, 16) | 387 | SCIx_FNS(SCxSR, 0x14, 16, 0x10, 16) |
477 | SCIx_FNS(SCxRDR, 0x24, 8, 0x14, 8) | 388 | SCIx_FNS(SCxRDR, 0x24, 8, 0x14, 8) |
478 | SCIx_FNS(SCSPTR, 0, 0, 0, 0) | 389 | SCIx_FNS(SCSPTR, 0, 0, 0, 0) |
479 | SCIF_FNS(SCTDSR, 0x0c, 8) | ||
480 | SCIF_FNS(SCFER, 0x10, 16) | ||
481 | SCIF_FNS(SCFCR, 0x18, 16) | 390 | SCIF_FNS(SCFCR, 0x18, 16) |
482 | SCIF_FNS(SCFDR, 0x1c, 16) | 391 | SCIF_FNS(SCFDR, 0x1c, 16) |
483 | SCIF_FNS(SCLSR, 0x24, 16) | 392 | SCIF_FNS(SCLSR, 0x24, 16) |
@@ -503,7 +412,6 @@ SCIF_FNS(SCLSR, 0, 0, 0x28, 16) | |||
503 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) | 412 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) |
504 | SCIF_FNS(SCFDR, 0, 0, 0x1C, 16) | 413 | SCIF_FNS(SCFDR, 0, 0, 0x1C, 16) |
505 | SCIF_FNS(SCSPTR2, 0, 0, 0x20, 16) | 414 | SCIF_FNS(SCSPTR2, 0, 0, 0x20, 16) |
506 | SCIF_FNS(SCLSR2, 0, 0, 0x24, 16) | ||
507 | SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16) | 415 | SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16) |
508 | SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16) | 416 | SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16) |
509 | SCIF_FNS(SCSPTR, 0, 0, 0x24, 16) | 417 | SCIF_FNS(SCSPTR, 0, 0, 0x24, 16) |
@@ -597,64 +505,3 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
597 | return 1; | 505 | return 1; |
598 | } | 506 | } |
599 | #endif | 507 | #endif |
600 | |||
601 | /* | ||
602 | * Values for the BitRate Register (SCBRR) | ||
603 | * | ||
604 | * The values are actually divisors for a frequency which can | ||
605 | * be internal to the SH3 (14.7456MHz) or derived from an external | ||
606 | * clock source. This driver assumes the internal clock is used; | ||
607 | * to support using an external clock source, config options or | ||
608 | * possibly command-line options would need to be added. | ||
609 | * | ||
610 | * Also, to support speeds below 2400 (why?) the lower 2 bits of | ||
611 | * the SCSMR register would also need to be set to non-zero values. | ||
612 | * | ||
613 | * -- Greg Banks 27Feb2000 | ||
614 | * | ||
615 | * Answer: The SCBRR register is only eight bits, and the value in | ||
616 | * it gets larger with lower baud rates. At around 2400 (depending on | ||
617 | * the peripherial module clock) you run out of bits. However the | ||
618 | * lower two bits of SCSMR allow the module clock to be divided down, | ||
619 | * scaling the value which is needed in SCBRR. | ||
620 | * | ||
621 | * -- Stuart Menefy - 23 May 2000 | ||
622 | * | ||
623 | * I meant, why would anyone bother with bitrates below 2400. | ||
624 | * | ||
625 | * -- Greg Banks - 7Jul2000 | ||
626 | * | ||
627 | * You "speedist"! How will I use my 110bps ASR-33 teletype with paper | ||
628 | * tape reader as a console! | ||
629 | * | ||
630 | * -- Mitch Davis - 15 Jul 2000 | ||
631 | */ | ||
632 | |||
633 | #if (defined(CONFIG_CPU_SUBTYPE_SH7780) || \ | ||
634 | defined(CONFIG_CPU_SUBTYPE_SH7785) || \ | ||
635 | defined(CONFIG_CPU_SUBTYPE_SH7786)) && \ | ||
636 | !defined(CONFIG_SH_SH2007) | ||
637 | #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1) | ||
638 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ | ||
639 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ | ||
640 | defined(CONFIG_CPU_SUBTYPE_SH7721) || \ | ||
641 | defined(CONFIG_ARCH_SH73A0) || \ | ||
642 | defined(CONFIG_ARCH_SH7367) || \ | ||
643 | defined(CONFIG_ARCH_SH7377) || \ | ||
644 | defined(CONFIG_ARCH_SH7372) | ||
645 | #define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1) | ||
646 | #elif defined(CONFIG_CPU_SUBTYPE_SH7723) ||\ | ||
647 | defined(CONFIG_CPU_SUBTYPE_SH7724) | ||
648 | static inline int scbrr_calc(struct uart_port *port, int bps, int clk) | ||
649 | { | ||
650 | if (port->type == PORT_SCIF) | ||
651 | return (clk+16*bps)/(32*bps)-1; | ||
652 | else | ||
653 | return ((clk*2)+16*bps)/(16*bps)-1; | ||
654 | } | ||
655 | #define SCBRR_VALUE(bps, clk) scbrr_calc(port, bps, clk) | ||
656 | #elif defined(__H8300H__) || defined(__H8300S__) | ||
657 | #define SCBRR_VALUE(bps, clk) (((clk*1000/32)/bps)-1) | ||
658 | #else /* Generic SH */ | ||
659 | #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(32*bps)-1) | ||
660 | #endif | ||