serial: sh-sci: Add more register documentation
[cascardo/linux.git] / drivers / tty / serial / sh-sci.c
index be33d2b..22a508a 100644 (file)
@@ -428,7 +428,7 @@ static int sci_probe_regmap(struct plat_sci_port *cfg)
                cfg->regtype = SCIx_HSCIF_REGTYPE;
                break;
        default:
-               printk(KERN_ERR "Can't probe register map for given port\n");
+               pr_err("Can't probe register map for given port\n");
                return -EINVAL;
        }
 
@@ -911,7 +911,7 @@ static irqreturn_t sci_rx_interrupt(int irq, void *ptr)
                /* Disable future Rx interrupts */
                if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) {
                        disable_irq_nosync(irq);
-                       scr |= 0x4000;
+                       scr |= SCSCR_RDRQE;
                } else {
                        scr &= ~SCSCR_RIE;
                }
@@ -1200,7 +1200,9 @@ static void sci_set_mctrl(struct uart_port *port, unsigned int mctrl)
                 */
                reg = sci_getreg(port, SCFCR);
                if (reg->size)
-                       serial_port_out(port, SCFCR, serial_port_in(port, SCFCR) | 1);
+                       serial_port_out(port, SCFCR,
+                                       serial_port_in(port, SCFCR) |
+                                       SCFCR_LOOP);
        }
 }
 
@@ -1496,9 +1498,9 @@ static void sci_start_tx(struct uart_port *port)
        if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) {
                u16 new, scr = serial_port_in(port, SCSCR);
                if (s->chan_tx)
-                       new = scr | 0x8000;
+                       new = scr | SCSCR_TDRQE;
                else
-                       new = scr & ~0x8000;
+                       new = scr & ~SCSCR_TDRQE;
                if (new != scr)
                        serial_port_out(port, SCSCR, new);
        }
@@ -1525,7 +1527,7 @@ static void sci_stop_tx(struct uart_port *port)
        ctrl = serial_port_in(port, SCSCR);
 
        if (port->type == PORT_SCIFA || port->type == PORT_SCIFB)
-               ctrl &= ~0x8000;
+               ctrl &= ~SCSCR_TDRQE;
 
        ctrl &= ~SCSCR_TIE;
 
@@ -1539,7 +1541,7 @@ static void sci_start_rx(struct uart_port *port)
        ctrl = serial_port_in(port, SCSCR) | port_rx_irq_mask(port);
 
        if (port->type == PORT_SCIFA || port->type == PORT_SCIFB)
-               ctrl &= ~0x4000;
+               ctrl &= ~SCSCR_RDRQE;
 
        serial_port_out(port, SCSCR, ctrl);
 }
@@ -1551,7 +1553,7 @@ static void sci_stop_rx(struct uart_port *port)
        ctrl = serial_port_in(port, SCSCR);
 
        if (port->type == PORT_SCIFA || port->type == PORT_SCIFB)
-               ctrl &= ~0x4000;
+               ctrl &= ~SCSCR_RDRQE;
 
        ctrl &= ~port_rx_irq_mask(port);
 
@@ -1614,7 +1616,7 @@ static void rx_timer_fn(unsigned long arg)
        u16 scr = serial_port_in(port, SCSCR);
 
        if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) {
-               scr &= ~0x4000;
+               scr &= ~SCSCR_RDRQE;
                enable_irq(s->irqs[SCIx_RXI_IRQ]);
        }
        serial_port_out(port, SCSCR, scr | SCSCR_RIE);
@@ -1871,13 +1873,13 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
        smr_val = serial_port_in(port, SCSMR) & 3;
 
        if ((termios->c_cflag & CSIZE) == CS7)
-               smr_val |= 0x40;
+               smr_val |= SCSMR_CHR;
        if (termios->c_cflag & PARENB)
-               smr_val |= 0x20;
+               smr_val |= SCSMR_PE;
        if (termios->c_cflag & PARODD)
-               smr_val |= 0x30;
+               smr_val |= SCSMR_PE | SCSMR_ODD;
        if (termios->c_cflag & CSTOPB)
-               smr_val |= 0x08;
+               smr_val |= SCSMR_STOP;
 
        uart_update_timeout(port, termios->c_cflag, baud);
 
@@ -1885,7 +1887,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
                __func__, smr_val, cks, t, s->cfg->scscr);
 
        if (t >= 0) {
-               serial_port_out(port, SCSMR, (smr_val & ~3) | cks);
+               serial_port_out(port, SCSMR, (smr_val & ~SCSMR_CKS) | cks);
                serial_port_out(port, SCBRR, t);
                reg = sci_getreg(port, HSSRR);
                if (reg->size)
@@ -2018,7 +2020,7 @@ static int sci_remap_port(struct uart_port *port)
                 * need to do any remapping, just cast the cookie
                 * directly.
                 */
-               port->membase = (void __iomem *)port->mapbase;
+               port->membase = (void __iomem *)(uintptr_t)port->mapbase;
        }
 
        return 0;
@@ -2389,8 +2391,7 @@ static inline int sci_probe_earlyprintk(struct platform_device *pdev)
 
 #endif /* CONFIG_SERIAL_SH_SCI_CONSOLE */
 
-static char banner[] __initdata =
-       KERN_INFO "SuperH (H)SCI(F) driver initialized\n";
+static const char banner[] __initconst = "SuperH (H)SCI(F) driver initialized";
 
 static struct uart_driver sci_uart_driver = {
        .owner          = THIS_MODULE,
@@ -2424,25 +2425,25 @@ struct sci_port_info {
 static const struct of_device_id of_sci_match[] = {
        {
                .compatible = "renesas,scif",
-               .data = (void *)&(const struct sci_port_info) {
+               .data = &(const struct sci_port_info) {
                        .type = PORT_SCIF,
                        .regtype = SCIx_SH4_SCIF_REGTYPE,
                },
        }, {
                .compatible = "renesas,scifa",
-               .data = (void *)&(const struct sci_port_info) {
+               .data = &(const struct sci_port_info) {
                        .type = PORT_SCIFA,
                        .regtype = SCIx_SCIFA_REGTYPE,
                },
        }, {
                .compatible = "renesas,scifb",
-               .data = (void *)&(const struct sci_port_info) {
+               .data = &(const struct sci_port_info) {
                        .type = PORT_SCIFB,
                        .regtype = SCIx_SCIFB_REGTYPE,
                },
        }, {
                .compatible = "renesas,hscif",
-               .data = (void *)&(const struct sci_port_info) {
+               .data = &(const struct sci_port_info) {
                        .type = PORT_HSCIF,
                        .regtype = SCIx_HSCIF_REGTYPE,
                },
@@ -2564,6 +2565,7 @@ static int sci_probe(struct platform_device *dev)
        ret = cpufreq_register_notifier(&sp->freq_transition,
                                        CPUFREQ_TRANSITION_NOTIFIER);
        if (unlikely(ret < 0)) {
+               uart_remove_one_port(&sci_uart_driver, &sp->port);
                sci_cleanup_single(sp);
                return ret;
        }
@@ -2615,7 +2617,7 @@ static int __init sci_init(void)
 {
        int ret;
 
-       printk(banner);
+       pr_info("%s\n", banner);
 
        ret = uart_register_driver(&sci_uart_driver);
        if (likely(ret == 0)) {