Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[firefly-linux-kernel-4.4.55.git] / drivers / serial / cpm_uart / cpm_uart_cpm2.c
index 787a8f134677c0a1b7f0f8ab17778bb267dd247a..882dbc17d590bc700e5c6d8af6fa086314197924 100644 (file)
 
 /**************************************************************/
 
-void cpm_line_cr_cmd(int line, int cmd)
+#ifdef CONFIG_PPC_CPM_NEW_BINDING
+void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
+{
+       cpm_cpm2_t __iomem *cp = cpm2_map(im_cpm);
+
+       out_be32(&cp->cp_cpcr, port->command | cmd | CPM_CR_FLG);
+       while (in_be32(&cp->cp_cpcr) & CPM_CR_FLG)
+               ;
+
+       cpm2_unmap(cp);
+}
+#else
+void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
 {
        ulong val;
+       int line = port - cpm_uart_ports;
        volatile cpm_cpm2_t *cp = cpm2_map(im_cpm);
 
 
@@ -211,6 +224,7 @@ void scc4_lineif(struct uart_cpm_port *pinfo)
        cpm2_unmap(cpmux);
        cpm2_unmap(io);
 }
+#endif
 
 /*
  * Allocate DP-Ram and memory buffers. We need to allocate a transmit and 
@@ -221,8 +235,8 @@ void scc4_lineif(struct uart_cpm_port *pinfo)
 int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
 {
        int dpmemsz, memsz;
-       u8 *dp_mem;
-       uint dp_offset;
+       u8 __iomem *dp_mem;
+       unsigned long dp_offset;
        u8 *mem_addr;
        dma_addr_t dma_addr = 0;
 
@@ -230,7 +244,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
 
        dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos);
        dp_offset = cpm_dpalloc(dpmemsz, 8);
-       if (IS_DPERR(dp_offset)) {
+       if (IS_ERR_VALUE(dp_offset)) {
                printk(KERN_ERR
                       "cpm_uart_cpm.c: could not allocate buffer descriptors\n");
                return -ENOMEM;
@@ -264,7 +278,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
        pinfo->tx_buf = pinfo->rx_buf + L1_CACHE_ALIGN(pinfo->rx_nrfifos
                                                       * pinfo->rx_fifosize);
 
-       pinfo->rx_bd_base = (volatile cbd_t *)dp_mem;
+       pinfo->rx_bd_base = (cbd_t __iomem *)dp_mem;
        pinfo->tx_bd_base = pinfo->rx_bd_base + pinfo->rx_nrfifos;
 
        return 0;
@@ -275,17 +289,18 @@ void cpm_uart_freebuf(struct uart_cpm_port *pinfo)
        dma_free_coherent(NULL, L1_CACHE_ALIGN(pinfo->rx_nrfifos *
                                               pinfo->rx_fifosize) +
                          L1_CACHE_ALIGN(pinfo->tx_nrfifos *
-                                        pinfo->tx_fifosize), pinfo->mem_addr,
+                                        pinfo->tx_fifosize), (void __force *)pinfo->mem_addr,
                          pinfo->dma_addr);
 
        cpm_dpfree(pinfo->dp_addr);
 }
 
+#ifndef CONFIG_PPC_CPM_NEW_BINDING
 /* Setup any dynamic params in the uart desc */
-int __init cpm_uart_init_portdesc(void)
+int cpm_uart_init_portdesc(void)
 {
 #if defined(CONFIG_SERIAL_CPM_SMC1) || defined(CONFIG_SERIAL_CPM_SMC2)
-       u32 addr;
+       u16 *addr;
 #endif
        pr_debug("CPM uart[-]:init portdesc\n");
 
@@ -386,3 +401,4 @@ int __init cpm_uart_init_portdesc(void)
 
        return 0;
 }
+#endif