Merge branch 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/linville...
[sfrench/cifs-2.6.git] / drivers / serial / cpm_uart / cpm_uart_core.c
index 0abb544ae63dbc34a7acc19eaad39c84e5152a17..f23972bc00c0e7a2552bc9015aebc4965462ee8c 100644 (file)
@@ -195,10 +195,8 @@ static void cpm_uart_start_tx(struct uart_port *port)
        if (cpm_uart_tx_pump(port) != 0) {
                if (IS_SMC(pinfo)) {
                        smcp->smc_smcm |= SMCM_TX;
-                       smcp->smc_smcmr |= SMCMR_TEN;
                } else {
                        sccp->scc_sccm |= UART_SCCM_TX;
-                       pinfo->sccp->scc_gsmrl |= SCC_GSMRL_ENT;
                }
        }
 }
@@ -421,9 +419,10 @@ static int cpm_uart_startup(struct uart_port *port)
        /* Startup rx-int */
        if (IS_SMC(pinfo)) {
                pinfo->smcp->smc_smcm |= SMCM_RX;
-               pinfo->smcp->smc_smcmr |= SMCMR_REN;
+               pinfo->smcp->smc_smcmr |= (SMCMR_REN | SMCMR_TEN);
        } else {
                pinfo->sccp->scc_sccm |= UART_SCCM_RX;
+               pinfo->sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
        }
 
        if (!(pinfo->flags & FLAG_CONSOLE))
@@ -935,7 +934,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
                        .irq            = SMC1_IRQ,
                        .ops            = &cpm_uart_pops,
                        .iotype         = UPIO_MEM,
-                       .lock           = SPIN_LOCK_UNLOCKED,
+                       .lock           = __SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SMC1].port.lock),
                },
                .flags = FLAG_SMC,
                .tx_nrfifos = TX_NUM_FIFO,
@@ -949,7 +948,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
                        .irq            = SMC2_IRQ,
                        .ops            = &cpm_uart_pops,
                        .iotype         = UPIO_MEM,
-                       .lock           = SPIN_LOCK_UNLOCKED,
+                       .lock           = __SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SMC2].port.lock),
                },
                .flags = FLAG_SMC,
                .tx_nrfifos = TX_NUM_FIFO,
@@ -966,7 +965,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
                        .irq            = SCC1_IRQ,
                        .ops            = &cpm_uart_pops,
                        .iotype         = UPIO_MEM,
-                       .lock           = SPIN_LOCK_UNLOCKED,
+                       .lock           = __SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SCC1].port.lock),
                },
                .tx_nrfifos = TX_NUM_FIFO,
                .tx_fifosize = TX_BUF_SIZE,
@@ -980,7 +979,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
                        .irq            = SCC2_IRQ,
                        .ops            = &cpm_uart_pops,
                        .iotype         = UPIO_MEM,
-                       .lock           = SPIN_LOCK_UNLOCKED,
+                       .lock           = __SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SCC2].port.lock),
                },
                .tx_nrfifos = TX_NUM_FIFO,
                .tx_fifosize = TX_BUF_SIZE,
@@ -994,7 +993,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
                        .irq            = SCC3_IRQ,
                        .ops            = &cpm_uart_pops,
                        .iotype         = UPIO_MEM,
-                       .lock           = SPIN_LOCK_UNLOCKED,
+                       .lock           = __SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SCC3].port.lock),
                },
                .tx_nrfifos = TX_NUM_FIFO,
                .tx_fifosize = TX_BUF_SIZE,
@@ -1008,7 +1007,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
                        .irq            = SCC4_IRQ,
                        .ops            = &cpm_uart_pops,
                        .iotype         = UPIO_MEM,
-                       .lock           = SPIN_LOCK_UNLOCKED,
+                       .lock           = __SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SCC4].port.lock),
                },
                .tx_nrfifos = TX_NUM_FIFO,
                .tx_fifosize = TX_BUF_SIZE,
@@ -1350,11 +1349,10 @@ static int cpm_uart_init(void) {
                pr_info("cpm_uart: WARNING: no UART devices found on platform bus!\n");
                pr_info(
                "cpm_uart: the driver will guess configuration, but this mode is no longer supported.\n");
-#ifndef CONFIG_SERIAL_CPM_CONSOLE
-               ret = cpm_uart_init_portdesc();
-               if (ret)
-                       return ret;
-#endif
+
+               /* Don't run this again, if the console driver did it already */
+               if (cpm_uart_nr == 0)
+                       cpm_uart_init_portdesc();
 
                cpm_reg.nr = cpm_uart_nr;
                ret = uart_register_driver(&cpm_reg);
@@ -1366,6 +1364,8 @@ static int cpm_uart_init(void) {
                        int con = cpm_uart_port_map[i];
                        cpm_uart_ports[con].port.line = i;
                        cpm_uart_ports[con].port.flags = UPF_BOOT_AUTOCONF;
+                       if (cpm_uart_ports[con].set_lineif)
+                               cpm_uart_ports[con].set_lineif(&cpm_uart_ports[con]);
                        uart_add_one_port(&cpm_reg, &cpm_uart_ports[con].port);
                }