diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/block/floppy.c | 2 | ||||
| -rw-r--r-- | drivers/input/serio/i8042-io.h | 4 | ||||
| -rw-r--r-- | drivers/serial/cpm_uart/cpm_uart.h | 49 | ||||
| -rw-r--r-- | drivers/serial/cpm_uart/cpm_uart_core.c | 280 | ||||
| -rw-r--r-- | drivers/serial/cpm_uart/cpm_uart_cpm1.c | 54 | ||||
| -rw-r--r-- | drivers/serial/cpm_uart/cpm_uart_cpm2.c | 14 |
6 files changed, 268 insertions, 135 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index bedb689b051f..dff1e67b1dd4 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
| @@ -4301,7 +4301,7 @@ static int __init floppy_init(void) | |||
| 4301 | } | 4301 | } |
| 4302 | 4302 | ||
| 4303 | use_virtual_dma = can_use_virtual_dma & 1; | 4303 | use_virtual_dma = can_use_virtual_dma & 1; |
| 4304 | #if defined(CONFIG_PPC64) | 4304 | #if defined(CONFIG_PPC_MERGE) |
| 4305 | if (check_legacy_ioport(FDC1)) { | 4305 | if (check_legacy_ioport(FDC1)) { |
| 4306 | del_timer(&fd_timeout); | 4306 | del_timer(&fd_timeout); |
| 4307 | err = -ENODEV; | 4307 | err = -ENODEV; |
diff --git a/drivers/input/serio/i8042-io.h b/drivers/input/serio/i8042-io.h index 9a9221644250..cc21914fbc72 100644 --- a/drivers/input/serio/i8042-io.h +++ b/drivers/input/serio/i8042-io.h | |||
| @@ -67,14 +67,14 @@ static inline int i8042_platform_init(void) | |||
| 67 | * On some platforms touching the i8042 data register region can do really | 67 | * On some platforms touching the i8042 data register region can do really |
| 68 | * bad things. Because of this the region is always reserved on such boxes. | 68 | * bad things. Because of this the region is always reserved on such boxes. |
| 69 | */ | 69 | */ |
| 70 | #if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__) && !defined(CONFIG_PPC64) | 70 | #if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__) && !defined(CONFIG_PPC_MERGE) |
| 71 | if (!request_region(I8042_DATA_REG, 16, "i8042")) | 71 | if (!request_region(I8042_DATA_REG, 16, "i8042")) |
| 72 | return -EBUSY; | 72 | return -EBUSY; |
| 73 | #endif | 73 | #endif |
| 74 | 74 | ||
| 75 | i8042_reset = 1; | 75 | i8042_reset = 1; |
| 76 | 76 | ||
| 77 | #if defined(CONFIG_PPC64) | 77 | #if defined(CONFIG_PPC_MERGE) |
| 78 | if (check_legacy_ioport(I8042_DATA_REG)) | 78 | if (check_legacy_ioport(I8042_DATA_REG)) |
| 79 | return -EBUSY; | 79 | return -EBUSY; |
| 80 | if (!request_region(I8042_DATA_REG, 16, "i8042")) | 80 | if (!request_region(I8042_DATA_REG, 16, "i8042")) |
diff --git a/drivers/serial/cpm_uart/cpm_uart.h b/drivers/serial/cpm_uart/cpm_uart.h index 73c8a088c160..aa5eb7ddeda9 100644 --- a/drivers/serial/cpm_uart/cpm_uart.h +++ b/drivers/serial/cpm_uart/cpm_uart.h | |||
| @@ -10,6 +10,8 @@ | |||
| 10 | #define CPM_UART_H | 10 | #define CPM_UART_H |
| 11 | 11 | ||
| 12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
| 13 | #include <linux/platform_device.h> | ||
| 14 | #include <linux/fs_uart_pd.h> | ||
| 13 | 15 | ||
| 14 | #if defined(CONFIG_CPM2) | 16 | #if defined(CONFIG_CPM2) |
| 15 | #include "cpm_uart_cpm2.h" | 17 | #include "cpm_uart_cpm2.h" |
| @@ -26,14 +28,14 @@ | |||
| 26 | #define FLAG_SMC 0x00000002 | 28 | #define FLAG_SMC 0x00000002 |
| 27 | #define FLAG_CONSOLE 0x00000001 | 29 | #define FLAG_CONSOLE 0x00000001 |
| 28 | 30 | ||
| 29 | #define UART_SMC1 0 | 31 | #define UART_SMC1 fsid_smc1_uart |
| 30 | #define UART_SMC2 1 | 32 | #define UART_SMC2 fsid_smc2_uart |
| 31 | #define UART_SCC1 2 | 33 | #define UART_SCC1 fsid_scc1_uart |
| 32 | #define UART_SCC2 3 | 34 | #define UART_SCC2 fsid_scc2_uart |
| 33 | #define UART_SCC3 4 | 35 | #define UART_SCC3 fsid_scc3_uart |
| 34 | #define UART_SCC4 5 | 36 | #define UART_SCC4 fsid_scc4_uart |
| 35 | 37 | ||
| 36 | #define UART_NR 6 | 38 | #define UART_NR fs_uart_nr |
| 37 | 39 | ||
| 38 | #define RX_NUM_FIFO 4 | 40 | #define RX_NUM_FIFO 4 |
| 39 | #define RX_BUF_SIZE 32 | 41 | #define RX_BUF_SIZE 32 |
| @@ -64,6 +66,7 @@ struct uart_cpm_port { | |||
| 64 | uint dp_addr; | 66 | uint dp_addr; |
| 65 | void *mem_addr; | 67 | void *mem_addr; |
| 66 | dma_addr_t dma_addr; | 68 | dma_addr_t dma_addr; |
| 69 | u32 mem_size; | ||
| 67 | /* helpers */ | 70 | /* helpers */ |
| 68 | int baud; | 71 | int baud; |
| 69 | int bits; | 72 | int bits; |
| @@ -90,4 +93,36 @@ void scc2_lineif(struct uart_cpm_port *pinfo); | |||
| 90 | void scc3_lineif(struct uart_cpm_port *pinfo); | 93 | void scc3_lineif(struct uart_cpm_port *pinfo); |
| 91 | void scc4_lineif(struct uart_cpm_port *pinfo); | 94 | void scc4_lineif(struct uart_cpm_port *pinfo); |
| 92 | 95 | ||
| 96 | /* | ||
| 97 | virtual to phys transtalion | ||
| 98 | */ | ||
| 99 | static inline unsigned long cpu2cpm_addr(void* addr, struct uart_cpm_port *pinfo) | ||
| 100 | { | ||
| 101 | int offset; | ||
| 102 | u32 val = (u32)addr; | ||
| 103 | /* sane check */ | ||
| 104 | if ((val >= (u32)pinfo->mem_addr) && | ||
| 105 | (val<((u32)pinfo->mem_addr + pinfo->mem_size))) { | ||
| 106 | offset = val - (u32)pinfo->mem_addr; | ||
| 107 | return pinfo->dma_addr+offset; | ||
| 108 | } | ||
| 109 | printk("%s(): address %x to translate out of range!\n", __FUNCTION__, val); | ||
| 110 | return 0; | ||
| 111 | } | ||
| 112 | |||
| 113 | static inline void *cpm2cpu_addr(unsigned long addr, struct uart_cpm_port *pinfo) | ||
| 114 | { | ||
| 115 | int offset; | ||
| 116 | u32 val = addr; | ||
| 117 | /* sane check */ | ||
| 118 | if ((val >= pinfo->dma_addr) && | ||
| 119 | (val<(pinfo->dma_addr + pinfo->mem_size))) { | ||
| 120 | offset = val - (u32)pinfo->dma_addr; | ||
| 121 | return (void*)(pinfo->mem_addr+offset); | ||
| 122 | } | ||
| 123 | printk("%s(): address %x to translate out of range!\n", __FUNCTION__, val); | ||
| 124 | return 0; | ||
| 125 | } | ||
| 126 | |||
| 127 | |||
| 93 | #endif /* CPM_UART_H */ | 128 | #endif /* CPM_UART_H */ |
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c index b7bf4c698a47..ced193bf9e1e 100644 --- a/drivers/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/serial/cpm_uart/cpm_uart_core.c | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | #include <linux/device.h> | 41 | #include <linux/device.h> |
| 42 | #include <linux/bootmem.h> | 42 | #include <linux/bootmem.h> |
| 43 | #include <linux/dma-mapping.h> | 43 | #include <linux/dma-mapping.h> |
| 44 | #include <linux/fs_uart_pd.h> | ||
| 44 | 45 | ||
| 45 | #include <asm/io.h> | 46 | #include <asm/io.h> |
| 46 | #include <asm/irq.h> | 47 | #include <asm/irq.h> |
| @@ -60,7 +61,7 @@ | |||
| 60 | /* Track which ports are configured as uarts */ | 61 | /* Track which ports are configured as uarts */ |
| 61 | int cpm_uart_port_map[UART_NR]; | 62 | int cpm_uart_port_map[UART_NR]; |
| 62 | /* How many ports did we config as uarts */ | 63 | /* How many ports did we config as uarts */ |
| 63 | int cpm_uart_nr; | 64 | int cpm_uart_nr = 0; |
| 64 | 65 | ||
| 65 | /**************************************************************/ | 66 | /**************************************************************/ |
| 66 | 67 | ||
| @@ -71,18 +72,36 @@ static void cpm_uart_initbd(struct uart_cpm_port *pinfo); | |||
| 71 | 72 | ||
| 72 | /**************************************************************/ | 73 | /**************************************************************/ |
| 73 | 74 | ||
| 74 | static inline unsigned long cpu2cpm_addr(void *addr) | 75 | |
| 76 | /* Place-holder for board-specific stuff */ | ||
| 77 | struct platform_device* __attribute__ ((weak)) __init | ||
| 78 | early_uart_get_pdev(int index) | ||
| 75 | { | 79 | { |
| 76 | if ((unsigned long)addr >= CPM_ADDR) | 80 | return NULL; |
| 77 | return (unsigned long)addr; | ||
| 78 | return virt_to_bus(addr); | ||
| 79 | } | 81 | } |
| 80 | 82 | ||
| 81 | static inline void *cpm2cpu_addr(unsigned long addr) | 83 | |
| 84 | void cpm_uart_count(void) | ||
| 82 | { | 85 | { |
| 83 | if (addr >= CPM_ADDR) | 86 | cpm_uart_nr = 0; |
| 84 | return (void *)addr; | 87 | #ifdef CONFIG_SERIAL_CPM_SMC1 |
| 85 | return bus_to_virt(addr); | 88 | cpm_uart_port_map[cpm_uart_nr++] = UART_SMC1; |
| 89 | #endif | ||
| 90 | #ifdef CONFIG_SERIAL_CPM_SMC2 | ||
| 91 | cpm_uart_port_map[cpm_uart_nr++] = UART_SMC2; | ||
| 92 | #endif | ||
| 93 | #ifdef CONFIG_SERIAL_CPM_SCC1 | ||
| 94 | cpm_uart_port_map[cpm_uart_nr++] = UART_SCC1; | ||
| 95 | #endif | ||
| 96 | #ifdef CONFIG_SERIAL_CPM_SCC2 | ||
| 97 | cpm_uart_port_map[cpm_uart_nr++] = UART_SCC2; | ||
| 98 | #endif | ||
| 99 | #ifdef CONFIG_SERIAL_CPM_SCC3 | ||
| 100 | cpm_uart_port_map[cpm_uart_nr++] = UART_SCC3; | ||
| 101 | #endif | ||
| 102 | #ifdef CONFIG_SERIAL_CPM_SCC4 | ||
| 103 | cpm_uart_port_map[cpm_uart_nr++] = UART_SCC4; | ||
| 104 | #endif | ||
| 86 | } | 105 | } |
| 87 | 106 | ||
| 88 | /* | 107 | /* |
| @@ -258,7 +277,7 @@ static void cpm_uart_int_rx(struct uart_port *port, struct pt_regs *regs) | |||
| 258 | } | 277 | } |
| 259 | 278 | ||
| 260 | /* get pointer */ | 279 | /* get pointer */ |
| 261 | cp = cpm2cpu_addr(bdp->cbd_bufaddr); | 280 | cp = cpm2cpu_addr(bdp->cbd_bufaddr, pinfo); |
| 262 | 281 | ||
| 263 | /* loop through the buffer */ | 282 | /* loop through the buffer */ |
| 264 | while (i-- > 0) { | 283 | while (i-- > 0) { |
| @@ -601,7 +620,7 @@ static int cpm_uart_tx_pump(struct uart_port *port) | |||
| 601 | /* Pick next descriptor and fill from buffer */ | 620 | /* Pick next descriptor and fill from buffer */ |
| 602 | bdp = pinfo->tx_cur; | 621 | bdp = pinfo->tx_cur; |
| 603 | 622 | ||
| 604 | p = cpm2cpu_addr(bdp->cbd_bufaddr); | 623 | p = cpm2cpu_addr(bdp->cbd_bufaddr, pinfo); |
| 605 | 624 | ||
| 606 | *p++ = port->x_char; | 625 | *p++ = port->x_char; |
| 607 | bdp->cbd_datlen = 1; | 626 | bdp->cbd_datlen = 1; |
| @@ -628,7 +647,7 @@ static int cpm_uart_tx_pump(struct uart_port *port) | |||
| 628 | 647 | ||
| 629 | while (!(bdp->cbd_sc & BD_SC_READY) && (xmit->tail != xmit->head)) { | 648 | while (!(bdp->cbd_sc & BD_SC_READY) && (xmit->tail != xmit->head)) { |
| 630 | count = 0; | 649 | count = 0; |
| 631 | p = cpm2cpu_addr(bdp->cbd_bufaddr); | 650 | p = cpm2cpu_addr(bdp->cbd_bufaddr, pinfo); |
| 632 | while (count < pinfo->tx_fifosize) { | 651 | while (count < pinfo->tx_fifosize) { |
| 633 | *p++ = xmit->buf[xmit->tail]; | 652 | *p++ = xmit->buf[xmit->tail]; |
| 634 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); | 653 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); |
| @@ -677,12 +696,12 @@ static void cpm_uart_initbd(struct uart_cpm_port *pinfo) | |||
| 677 | mem_addr = pinfo->mem_addr; | 696 | mem_addr = pinfo->mem_addr; |
| 678 | bdp = pinfo->rx_cur = pinfo->rx_bd_base; | 697 | bdp = pinfo->rx_cur = pinfo->rx_bd_base; |
| 679 | for (i = 0; i < (pinfo->rx_nrfifos - 1); i++, bdp++) { | 698 | for (i = 0; i < (pinfo->rx_nrfifos - 1); i++, bdp++) { |
| 680 | bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr); | 699 | bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr, pinfo); |
| 681 | bdp->cbd_sc = BD_SC_EMPTY | BD_SC_INTRPT; | 700 | bdp->cbd_sc = BD_SC_EMPTY | BD_SC_INTRPT; |
| 682 | mem_addr += pinfo->rx_fifosize; | 701 | mem_addr += pinfo->rx_fifosize; |
| 683 | } | 702 | } |
| 684 | 703 | ||
| 685 | bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr); | 704 | bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr, pinfo); |
| 686 | bdp->cbd_sc = BD_SC_WRAP | BD_SC_EMPTY | BD_SC_INTRPT; | 705 | bdp->cbd_sc = BD_SC_WRAP | BD_SC_EMPTY | BD_SC_INTRPT; |
| 687 | 706 | ||
| 688 | /* Set the physical address of the host memory | 707 | /* Set the physical address of the host memory |
| @@ -692,12 +711,12 @@ static void cpm_uart_initbd(struct uart_cpm_port *pinfo) | |||
| 692 | mem_addr = pinfo->mem_addr + L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize); | 711 | mem_addr = pinfo->mem_addr + L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize); |
| 693 | bdp = pinfo->tx_cur = pinfo->tx_bd_base; | 712 | bdp = pinfo->tx_cur = pinfo->tx_bd_base; |
| 694 | for (i = 0; i < (pinfo->tx_nrfifos - 1); i++, bdp++) { | 713 | for (i = 0; i < (pinfo->tx_nrfifos - 1); i++, bdp++) { |
| 695 | bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr); | 714 | bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr, pinfo); |
| 696 | bdp->cbd_sc = BD_SC_INTRPT; | 715 | bdp->cbd_sc = BD_SC_INTRPT; |
| 697 | mem_addr += pinfo->tx_fifosize; | 716 | mem_addr += pinfo->tx_fifosize; |
| 698 | } | 717 | } |
| 699 | 718 | ||
| 700 | bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr); | 719 | bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr, pinfo); |
| 701 | bdp->cbd_sc = BD_SC_WRAP | BD_SC_INTRPT; | 720 | bdp->cbd_sc = BD_SC_WRAP | BD_SC_INTRPT; |
| 702 | } | 721 | } |
| 703 | 722 | ||
| @@ -829,14 +848,6 @@ static int cpm_uart_request_port(struct uart_port *port) | |||
| 829 | if (pinfo->flags & FLAG_CONSOLE) | 848 | if (pinfo->flags & FLAG_CONSOLE) |
| 830 | return 0; | 849 | return 0; |
| 831 | 850 | ||
| 832 | /* | ||
| 833 | * Setup any port IO, connect any baud rate generators, | ||
| 834 | * etc. This is expected to be handled by board | ||
| 835 | * dependant code | ||
| 836 | */ | ||
| 837 | if (pinfo->set_lineif) | ||
| 838 | pinfo->set_lineif(pinfo); | ||
| 839 | |||
| 840 | if (IS_SMC(pinfo)) { | 851 | if (IS_SMC(pinfo)) { |
| 841 | pinfo->smcp->smc_smcm &= ~(SMCM_RX | SMCM_TX); | 852 | pinfo->smcp->smc_smcm &= ~(SMCM_RX | SMCM_TX); |
| 842 | pinfo->smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); | 853 | pinfo->smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); |
| @@ -988,6 +999,54 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = { | |||
| 988 | }, | 999 | }, |
| 989 | }; | 1000 | }; |
| 990 | 1001 | ||
| 1002 | int cpm_uart_drv_get_platform_data(struct platform_device *pdev, int is_con) | ||
| 1003 | { | ||
| 1004 | struct resource *r; | ||
| 1005 | struct fs_uart_platform_info *pdata = pdev->dev.platform_data; | ||
| 1006 | int idx = pdata->fs_no; /* It is UART_SMCx or UART_SCCx index */ | ||
| 1007 | struct uart_cpm_port *pinfo; | ||
| 1008 | int line; | ||
| 1009 | u32 mem, pram; | ||
| 1010 | |||
| 1011 | for (line=0; line<UART_NR && cpm_uart_port_map[line]!=pdata->fs_no; line++); | ||
| 1012 | |||
| 1013 | pinfo = (struct uart_cpm_port *) &cpm_uart_ports[idx]; | ||
| 1014 | |||
| 1015 | pinfo->brg = pdata->brg; | ||
| 1016 | |||
| 1017 | if (!is_con) { | ||
| 1018 | pinfo->port.line = line; | ||
| 1019 | pinfo->port.flags = UPF_BOOT_AUTOCONF; | ||
| 1020 | } | ||
| 1021 | |||
| 1022 | if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"))) | ||
| 1023 | return -EINVAL; | ||
| 1024 | mem = r->start; | ||
| 1025 | |||
| 1026 | if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pram"))) | ||
| 1027 | return -EINVAL; | ||
| 1028 | pram = r->start; | ||
| 1029 | |||
| 1030 | if(idx > fsid_smc2_uart) { | ||
| 1031 | pinfo->sccp = (scc_t *)mem; | ||
| 1032 | pinfo->sccup = (scc_uart_t *)pram; | ||
| 1033 | } else { | ||
| 1034 | pinfo->smcp = (smc_t *)mem; | ||
| 1035 | pinfo->smcup = (smc_uart_t *)pram; | ||
| 1036 | } | ||
| 1037 | pinfo->tx_nrfifos = pdata->tx_num_fifo; | ||
| 1038 | pinfo->tx_fifosize = pdata->tx_buf_size; | ||
| 1039 | |||
| 1040 | pinfo->rx_nrfifos = pdata->rx_num_fifo; | ||
| 1041 | pinfo->rx_fifosize = pdata->rx_buf_size; | ||
| 1042 | |||
| 1043 | pinfo->port.uartclk = pdata->uart_clk; | ||
| 1044 | pinfo->port.mapbase = (unsigned long)mem; | ||
| 1045 | pinfo->port.irq = platform_get_irq(pdev, 0); | ||
| 1046 | |||
| 1047 | return 0; | ||
| 1048 | } | ||
| 1049 | |||
| 991 | #ifdef CONFIG_SERIAL_CPM_CONSOLE | 1050 | #ifdef CONFIG_SERIAL_CPM_CONSOLE |
| 992 | /* | 1051 | /* |
| 993 | * Print a string to the serial port trying not to disturb | 1052 | * Print a string to the serial port trying not to disturb |
| @@ -1027,7 +1086,7 @@ static void cpm_uart_console_write(struct console *co, const char *s, | |||
| 1027 | * If the buffer address is in the CPM DPRAM, don't | 1086 | * If the buffer address is in the CPM DPRAM, don't |
| 1028 | * convert it. | 1087 | * convert it. |
| 1029 | */ | 1088 | */ |
| 1030 | cp = cpm2cpu_addr(bdp->cbd_bufaddr); | 1089 | cp = cpm2cpu_addr(bdp->cbd_bufaddr, pinfo); |
| 1031 | 1090 | ||
| 1032 | *cp = *s; | 1091 | *cp = *s; |
| 1033 | 1092 | ||
| @@ -1044,7 +1103,7 @@ static void cpm_uart_console_write(struct console *co, const char *s, | |||
| 1044 | while ((bdp->cbd_sc & BD_SC_READY) != 0) | 1103 | while ((bdp->cbd_sc & BD_SC_READY) != 0) |
| 1045 | ; | 1104 | ; |
| 1046 | 1105 | ||
| 1047 | cp = cpm2cpu_addr(bdp->cbd_bufaddr); | 1106 | cp = cpm2cpu_addr(bdp->cbd_bufaddr, pinfo); |
| 1048 | 1107 | ||
| 1049 | *cp = 13; | 1108 | *cp = 13; |
| 1050 | bdp->cbd_datlen = 1; | 1109 | bdp->cbd_datlen = 1; |
| @@ -1067,9 +1126,7 @@ static void cpm_uart_console_write(struct console *co, const char *s, | |||
| 1067 | pinfo->tx_cur = (volatile cbd_t *) bdp; | 1126 | pinfo->tx_cur = (volatile cbd_t *) bdp; |
| 1068 | } | 1127 | } |
| 1069 | 1128 | ||
| 1070 | /* | 1129 | |
| 1071 | * Setup console. Be careful is called early ! | ||
| 1072 | */ | ||
| 1073 | static int __init cpm_uart_console_setup(struct console *co, char *options) | 1130 | static int __init cpm_uart_console_setup(struct console *co, char *options) |
| 1074 | { | 1131 | { |
| 1075 | struct uart_port *port; | 1132 | struct uart_port *port; |
| @@ -1080,9 +1137,27 @@ static int __init cpm_uart_console_setup(struct console *co, char *options) | |||
| 1080 | int flow = 'n'; | 1137 | int flow = 'n'; |
| 1081 | int ret; | 1138 | int ret; |
| 1082 | 1139 | ||
| 1140 | struct fs_uart_platform_info *pdata; | ||
| 1141 | struct platform_device* pdev = early_uart_get_pdev(co->index); | ||
| 1142 | |||
| 1083 | port = | 1143 | port = |
| 1084 | (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]]; | 1144 | (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]]; |
| 1085 | pinfo = (struct uart_cpm_port *)port; | 1145 | pinfo = (struct uart_cpm_port *)port; |
| 1146 | if (!pdev) { | ||
| 1147 | pr_info("cpm_uart: console: compat mode\n"); | ||
| 1148 | /* compatibility - will be cleaned up */ | ||
| 1149 | cpm_uart_init_portdesc(); | ||
| 1150 | |||
| 1151 | if (pinfo->set_lineif) | ||
| 1152 | pinfo->set_lineif(pinfo); | ||
| 1153 | } else { | ||
| 1154 | pdata = pdev->dev.platform_data; | ||
| 1155 | if (pdata) | ||
| 1156 | if (pdata->init_ioports) | ||
| 1157 | pdata->init_ioports(); | ||
| 1158 | |||
| 1159 | cpm_uart_drv_get_platform_data(pdev, 1); | ||
| 1160 | } | ||
| 1086 | 1161 | ||
| 1087 | pinfo->flags |= FLAG_CONSOLE; | 1162 | pinfo->flags |= FLAG_CONSOLE; |
| 1088 | 1163 | ||
| @@ -1097,14 +1172,6 @@ static int __init cpm_uart_console_setup(struct console *co, char *options) | |||
| 1097 | baud = 9600; | 1172 | baud = 9600; |
| 1098 | } | 1173 | } |
| 1099 | 1174 | ||
| 1100 | /* | ||
| 1101 | * Setup any port IO, connect any baud rate generators, | ||
| 1102 | * etc. This is expected to be handled by board | ||
| 1103 | * dependant code | ||
| 1104 | */ | ||
| 1105 | if (pinfo->set_lineif) | ||
| 1106 | pinfo->set_lineif(pinfo); | ||
| 1107 | |||
| 1108 | if (IS_SMC(pinfo)) { | 1175 | if (IS_SMC(pinfo)) { |
| 1109 | pinfo->smcp->smc_smcm &= ~(SMCM_RX | SMCM_TX); | 1176 | pinfo->smcp->smc_smcm &= ~(SMCM_RX | SMCM_TX); |
| 1110 | pinfo->smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); | 1177 | pinfo->smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); |
| @@ -1143,11 +1210,8 @@ static struct console cpm_scc_uart_console = { | |||
| 1143 | 1210 | ||
| 1144 | int __init cpm_uart_console_init(void) | 1211 | int __init cpm_uart_console_init(void) |
| 1145 | { | 1212 | { |
| 1146 | int ret = cpm_uart_init_portdesc(); | 1213 | register_console(&cpm_scc_uart_console); |
| 1147 | 1214 | return 0; | |
| 1148 | if (!ret) | ||
| 1149 | register_console(&cpm_scc_uart_console); | ||
| 1150 | return ret; | ||
| 1151 | } | 1215 | } |
| 1152 | 1216 | ||
| 1153 | console_initcall(cpm_uart_console_init); | 1217 | console_initcall(cpm_uart_console_init); |
| @@ -1165,44 +1229,130 @@ static struct uart_driver cpm_reg = { | |||
| 1165 | .minor = SERIAL_CPM_MINOR, | 1229 | .minor = SERIAL_CPM_MINOR, |
| 1166 | .cons = CPM_UART_CONSOLE, | 1230 | .cons = CPM_UART_CONSOLE, |
| 1167 | }; | 1231 | }; |
| 1168 | 1232 | static int cpm_uart_drv_probe(struct device *dev) | |
| 1169 | static int __init cpm_uart_init(void) | ||
| 1170 | { | 1233 | { |
| 1171 | int ret, i; | 1234 | struct platform_device *pdev = to_platform_device(dev); |
| 1172 | 1235 | struct fs_uart_platform_info *pdata; | |
| 1173 | printk(KERN_INFO "Serial: CPM driver $Revision: 0.01 $\n"); | 1236 | int ret = -ENODEV; |
| 1174 | 1237 | ||
| 1175 | #ifndef CONFIG_SERIAL_CPM_CONSOLE | 1238 | if(!pdev) { |
| 1176 | ret = cpm_uart_init_portdesc(); | 1239 | printk(KERN_ERR"CPM UART: platform data missing!\n"); |
| 1177 | if (ret) | ||
| 1178 | return ret; | 1240 | return ret; |
| 1179 | #endif | 1241 | } |
| 1180 | 1242 | ||
| 1181 | cpm_reg.nr = cpm_uart_nr; | 1243 | pdata = pdev->dev.platform_data; |
| 1182 | ret = uart_register_driver(&cpm_reg); | 1244 | pr_debug("cpm_uart_drv_probe: Adding CPM UART %d\n", |
| 1245 | cpm_uart_port_map[pdata->fs_no]); | ||
| 1183 | 1246 | ||
| 1184 | if (ret) | 1247 | if ((ret = cpm_uart_drv_get_platform_data(pdev, 0))) |
| 1185 | return ret; | 1248 | return ret; |
| 1186 | 1249 | ||
| 1187 | for (i = 0; i < cpm_uart_nr; i++) { | 1250 | if (pdata->init_ioports) |
| 1188 | int con = cpm_uart_port_map[i]; | 1251 | pdata->init_ioports(); |
| 1189 | cpm_uart_ports[con].port.line = i; | ||
| 1190 | cpm_uart_ports[con].port.flags = UPF_BOOT_AUTOCONF; | ||
| 1191 | uart_add_one_port(&cpm_reg, &cpm_uart_ports[con].port); | ||
| 1192 | } | ||
| 1193 | 1252 | ||
| 1194 | return ret; | 1253 | ret = uart_add_one_port(&cpm_reg, &cpm_uart_ports[pdata->fs_no].port); |
| 1254 | |||
| 1255 | return ret; | ||
| 1195 | } | 1256 | } |
| 1196 | 1257 | ||
| 1197 | static void __exit cpm_uart_exit(void) | 1258 | static int cpm_uart_drv_remove(struct device *dev) |
| 1259 | { | ||
| 1260 | struct platform_device *pdev = to_platform_device(dev); | ||
| 1261 | struct fs_uart_platform_info *pdata = pdev->dev.platform_data; | ||
| 1262 | |||
| 1263 | pr_debug("cpm_uart_drv_remove: Removing CPM UART %d\n", | ||
| 1264 | cpm_uart_port_map[pdata->fs_no]); | ||
| 1265 | |||
| 1266 | uart_remove_one_port(&cpm_reg, &cpm_uart_ports[pdata->fs_no].port); | ||
| 1267 | return 0; | ||
| 1268 | } | ||
| 1269 | |||
| 1270 | static struct device_driver cpm_smc_uart_driver = { | ||
| 1271 | .name = "fsl-cpm-smc:uart", | ||
| 1272 | .bus = &platform_bus_type, | ||
| 1273 | .probe = cpm_uart_drv_probe, | ||
| 1274 | .remove = cpm_uart_drv_remove, | ||
| 1275 | }; | ||
| 1276 | |||
| 1277 | static struct device_driver cpm_scc_uart_driver = { | ||
| 1278 | .name = "fsl-cpm-scc:uart", | ||
| 1279 | .bus = &platform_bus_type, | ||
| 1280 | .probe = cpm_uart_drv_probe, | ||
| 1281 | .remove = cpm_uart_drv_remove, | ||
| 1282 | }; | ||
| 1283 | |||
| 1284 | /* | ||
| 1285 | This is supposed to match uart devices on platform bus, | ||
| 1286 | */ | ||
| 1287 | static int match_is_uart (struct device* dev, void* data) | ||
| 1198 | { | 1288 | { |
| 1289 | struct platform_device* pdev = container_of(dev, struct platform_device, dev); | ||
| 1290 | int ret = 0; | ||
| 1291 | /* this was setfunc as uart */ | ||
| 1292 | if(strstr(pdev->name,":uart")) { | ||
| 1293 | ret = 1; | ||
| 1294 | } | ||
| 1295 | return ret; | ||
| 1296 | } | ||
| 1297 | |||
| 1298 | |||
| 1299 | static int cpm_uart_init(void) { | ||
| 1300 | |||
| 1301 | int ret; | ||
| 1199 | int i; | 1302 | int i; |
| 1303 | struct device *dev; | ||
| 1304 | printk(KERN_INFO "Serial: CPM driver $Revision: 0.02 $\n"); | ||
| 1305 | |||
| 1306 | /* lookup the bus for uart devices */ | ||
| 1307 | dev = bus_find_device(&platform_bus_type, NULL, 0, match_is_uart); | ||
| 1308 | |||
| 1309 | /* There are devices on the bus - all should be OK */ | ||
| 1310 | if (dev) { | ||
| 1311 | cpm_uart_count(); | ||
| 1312 | cpm_reg.nr = cpm_uart_nr; | ||
| 1313 | |||
| 1314 | if (!(ret = uart_register_driver(&cpm_reg))) { | ||
| 1315 | if ((ret = driver_register(&cpm_smc_uart_driver))) { | ||
| 1316 | uart_unregister_driver(&cpm_reg); | ||
| 1317 | return ret; | ||
| 1318 | } | ||
| 1319 | if ((ret = driver_register(&cpm_scc_uart_driver))) { | ||
| 1320 | driver_unregister(&cpm_scc_uart_driver); | ||
| 1321 | uart_unregister_driver(&cpm_reg); | ||
| 1322 | } | ||
| 1323 | } | ||
| 1324 | } else { | ||
| 1325 | /* No capable platform devices found - falling back to legacy mode */ | ||
| 1326 | pr_info("cpm_uart: WARNING: no UART devices found on platform bus!\n"); | ||
| 1327 | pr_info( | ||
| 1328 | "cpm_uart: the driver will guess configuration, but this mode is no longer supported.\n"); | ||
| 1329 | #ifndef CONFIG_SERIAL_CPM_CONSOLE | ||
| 1330 | ret = cpm_uart_init_portdesc(); | ||
| 1331 | if (ret) | ||
| 1332 | return ret; | ||
| 1333 | #endif | ||
| 1334 | |||
| 1335 | cpm_reg.nr = cpm_uart_nr; | ||
| 1336 | ret = uart_register_driver(&cpm_reg); | ||
| 1337 | |||
| 1338 | if (ret) | ||
| 1339 | return ret; | ||
| 1340 | |||
| 1341 | for (i = 0; i < cpm_uart_nr; i++) { | ||
| 1342 | int con = cpm_uart_port_map[i]; | ||
| 1343 | cpm_uart_ports[con].port.line = i; | ||
| 1344 | cpm_uart_ports[con].port.flags = UPF_BOOT_AUTOCONF; | ||
| 1345 | uart_add_one_port(&cpm_reg, &cpm_uart_ports[con].port); | ||
| 1346 | } | ||
| 1200 | 1347 | ||
| 1201 | for (i = 0; i < cpm_uart_nr; i++) { | ||
| 1202 | int con = cpm_uart_port_map[i]; | ||
| 1203 | uart_remove_one_port(&cpm_reg, &cpm_uart_ports[con].port); | ||
| 1204 | } | 1348 | } |
| 1349 | return ret; | ||
| 1350 | } | ||
| 1205 | 1351 | ||
| 1352 | static void __exit cpm_uart_exit(void) | ||
| 1353 | { | ||
| 1354 | driver_unregister(&cpm_scc_uart_driver); | ||
| 1355 | driver_unregister(&cpm_smc_uart_driver); | ||
| 1206 | uart_unregister_driver(&cpm_reg); | 1356 | uart_unregister_driver(&cpm_reg); |
| 1207 | } | 1357 | } |
| 1208 | 1358 | ||
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c index d789ee55cbb7..a5a30622637a 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c | |||
| @@ -81,58 +81,11 @@ void cpm_line_cr_cmd(int line, int cmd) | |||
| 81 | 81 | ||
| 82 | void smc1_lineif(struct uart_cpm_port *pinfo) | 82 | void smc1_lineif(struct uart_cpm_port *pinfo) |
| 83 | { | 83 | { |
| 84 | volatile cpm8xx_t *cp = cpmp; | ||
| 85 | |||
| 86 | (void)cp; /* fix warning */ | ||
| 87 | #if defined (CONFIG_MPC885ADS) | ||
| 88 | /* Enable SMC1 transceivers */ | ||
| 89 | { | ||
| 90 | cp->cp_pepar |= 0x000000c0; | ||
| 91 | cp->cp_pedir &= ~0x000000c0; | ||
| 92 | cp->cp_peso &= ~0x00000040; | ||
| 93 | cp->cp_peso |= 0x00000080; | ||
| 94 | } | ||
| 95 | #elif defined (CONFIG_MPC86XADS) | ||
| 96 | unsigned int iobits = 0x000000c0; | ||
| 97 | |||
| 98 | if (!pinfo->is_portb) { | ||
| 99 | cp->cp_pbpar |= iobits; | ||
| 100 | cp->cp_pbdir &= ~iobits; | ||
| 101 | cp->cp_pbodr &= ~iobits; | ||
| 102 | } else { | ||
| 103 | ((immap_t *)IMAP_ADDR)->im_ioport.iop_papar |= iobits; | ||
| 104 | ((immap_t *)IMAP_ADDR)->im_ioport.iop_padir &= ~iobits; | ||
| 105 | ((immap_t *)IMAP_ADDR)->im_ioport.iop_paodr &= ~iobits; | ||
| 106 | } | ||
| 107 | #endif | ||
| 108 | pinfo->brg = 1; | 84 | pinfo->brg = 1; |
| 109 | } | 85 | } |
| 110 | 86 | ||
| 111 | void smc2_lineif(struct uart_cpm_port *pinfo) | 87 | void smc2_lineif(struct uart_cpm_port *pinfo) |
| 112 | { | 88 | { |
| 113 | volatile cpm8xx_t *cp = cpmp; | ||
| 114 | |||
| 115 | (void)cp; /* fix warning */ | ||
| 116 | #if defined (CONFIG_MPC885ADS) | ||
| 117 | cp->cp_pepar |= 0x00000c00; | ||
| 118 | cp->cp_pedir &= ~0x00000c00; | ||
| 119 | cp->cp_peso &= ~0x00000400; | ||
| 120 | cp->cp_peso |= 0x00000800; | ||
| 121 | #elif defined (CONFIG_MPC86XADS) | ||
| 122 | unsigned int iobits = 0x00000c00; | ||
| 123 | |||
| 124 | if (!pinfo->is_portb) { | ||
| 125 | cp->cp_pbpar |= iobits; | ||
| 126 | cp->cp_pbdir &= ~iobits; | ||
| 127 | cp->cp_pbodr &= ~iobits; | ||
| 128 | } else { | ||
| 129 | ((immap_t *)IMAP_ADDR)->im_ioport.iop_papar |= iobits; | ||
| 130 | ((immap_t *)IMAP_ADDR)->im_ioport.iop_padir &= ~iobits; | ||
| 131 | ((immap_t *)IMAP_ADDR)->im_ioport.iop_paodr &= ~iobits; | ||
| 132 | } | ||
| 133 | |||
| 134 | #endif | ||
| 135 | |||
| 136 | pinfo->brg = 2; | 89 | pinfo->brg = 2; |
| 137 | } | 90 | } |
| 138 | 91 | ||
| @@ -191,7 +144,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
| 191 | /* was hostalloc but changed cause it blows away the */ | 144 | /* was hostalloc but changed cause it blows away the */ |
| 192 | /* large tlb mapping when pinning the kernel area */ | 145 | /* large tlb mapping when pinning the kernel area */ |
| 193 | mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8)); | 146 | mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8)); |
| 194 | dma_addr = 0; | 147 | dma_addr = (u32)mem_addr; |
| 195 | } else | 148 | } else |
| 196 | mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, | 149 | mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, |
| 197 | GFP_KERNEL); | 150 | GFP_KERNEL); |
| @@ -204,8 +157,9 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
| 204 | } | 157 | } |
| 205 | 158 | ||
| 206 | pinfo->dp_addr = dp_offset; | 159 | pinfo->dp_addr = dp_offset; |
| 207 | pinfo->mem_addr = mem_addr; | 160 | pinfo->mem_addr = mem_addr; /* virtual address*/ |
| 208 | pinfo->dma_addr = dma_addr; | 161 | pinfo->dma_addr = dma_addr; /* physical address*/ |
| 162 | pinfo->mem_size = memsz; | ||
| 209 | 163 | ||
| 210 | pinfo->rx_buf = mem_addr; | 164 | pinfo->rx_buf = mem_addr; |
| 211 | pinfo->tx_buf = pinfo->rx_buf + L1_CACHE_ALIGN(pinfo->rx_nrfifos | 165 | pinfo->tx_buf = pinfo->rx_buf + L1_CACHE_ALIGN(pinfo->rx_nrfifos |
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c index fd9e53ed3feb..7c6b07aeea92 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c | |||
| @@ -142,14 +142,6 @@ void scc2_lineif(struct uart_cpm_port *pinfo) | |||
| 142 | * be supported in a sane fashion. | 142 | * be supported in a sane fashion. |
| 143 | */ | 143 | */ |
| 144 | #ifndef CONFIG_STX_GP3 | 144 | #ifndef CONFIG_STX_GP3 |
| 145 | #ifdef CONFIG_MPC8560_ADS | ||
| 146 | volatile iop_cpm2_t *io = &cpm2_immr->im_ioport; | ||
| 147 | io->iop_ppard |= 0x00000018; | ||
| 148 | io->iop_psord &= ~0x00000008; /* Rx */ | ||
| 149 | io->iop_psord &= ~0x00000010; /* Tx */ | ||
| 150 | io->iop_pdird &= ~0x00000008; /* Rx */ | ||
| 151 | io->iop_pdird |= 0x00000010; /* Tx */ | ||
| 152 | #else | ||
| 153 | volatile iop_cpm2_t *io = &cpm2_immr->im_ioport; | 145 | volatile iop_cpm2_t *io = &cpm2_immr->im_ioport; |
| 154 | io->iop_pparb |= 0x008b0000; | 146 | io->iop_pparb |= 0x008b0000; |
| 155 | io->iop_pdirb |= 0x00880000; | 147 | io->iop_pdirb |= 0x00880000; |
| @@ -157,7 +149,6 @@ void scc2_lineif(struct uart_cpm_port *pinfo) | |||
| 157 | io->iop_pdirb &= ~0x00030000; | 149 | io->iop_pdirb &= ~0x00030000; |
| 158 | io->iop_psorb &= ~0x00030000; | 150 | io->iop_psorb &= ~0x00030000; |
| 159 | #endif | 151 | #endif |
| 160 | #endif | ||
| 161 | cpm2_immr->im_cpmux.cmx_scr &= 0xff00ffff; | 152 | cpm2_immr->im_cpmux.cmx_scr &= 0xff00ffff; |
| 162 | cpm2_immr->im_cpmux.cmx_scr |= 0x00090000; | 153 | cpm2_immr->im_cpmux.cmx_scr |= 0x00090000; |
| 163 | pinfo->brg = 2; | 154 | pinfo->brg = 2; |
| @@ -218,8 +209,10 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
| 218 | 209 | ||
| 219 | memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) + | 210 | memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) + |
| 220 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize); | 211 | L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize); |
| 221 | if (is_con) | 212 | if (is_con) { |
| 222 | mem_addr = alloc_bootmem(memsz); | 213 | mem_addr = alloc_bootmem(memsz); |
| 214 | dma_addr = mem_addr; | ||
| 215 | } | ||
| 223 | else | 216 | else |
| 224 | mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, | 217 | mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, |
| 225 | GFP_KERNEL); | 218 | GFP_KERNEL); |
| @@ -234,6 +227,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
| 234 | pinfo->dp_addr = dp_offset; | 227 | pinfo->dp_addr = dp_offset; |
| 235 | pinfo->mem_addr = mem_addr; | 228 | pinfo->mem_addr = mem_addr; |
| 236 | pinfo->dma_addr = dma_addr; | 229 | pinfo->dma_addr = dma_addr; |
| 230 | pinfo->mem_size = memsz; | ||
| 237 | 231 | ||
| 238 | pinfo->rx_buf = mem_addr; | 232 | pinfo->rx_buf = mem_addr; |
| 239 | pinfo->tx_buf = pinfo->rx_buf + L1_CACHE_ALIGN(pinfo->rx_nrfifos | 233 | pinfo->tx_buf = pinfo->rx_buf + L1_CACHE_ALIGN(pinfo->rx_nrfifos |
