Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "uart: pl011: Add support to ZTE ZX296702 uart"

This reverts commit 8cd90e50d1408c65c355084b1c7f8f9085f49c6b as with
this patch the serial console is broken on lots of platforms.

Reported-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Jun Nie <jun.nie@linaro.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Tested-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+16 -197
+2 -2
drivers/tty/serial/Kconfig
··· 47 47 48 48 config SERIAL_AMBA_PL011 49 49 tristate "ARM AMBA PL011 serial port support" 50 - depends on ARM_AMBA || SOC_ZX296702 50 + depends on ARM_AMBA 51 51 select SERIAL_CORE 52 52 help 53 53 This selects the ARM(R) AMBA(R) PrimeCell PL011 UART. If you have 54 54 an Integrator/PP2, Integrator/CP or Versatile platform, say Y or M 55 - here. Say Y or M if you have SOC_ZX296702. 55 + here. 56 56 57 57 If unsure, say N. 58 58
+14 -181
drivers/tty/serial/amba-pl011.c
··· 74 74 /* There is by now at least one vendor with differing details, so handle it */ 75 75 struct vendor_data { 76 76 unsigned int ifls; 77 - unsigned int fr_busy; 78 - unsigned int fr_dsr; 79 - unsigned int fr_cts; 80 - unsigned int fr_ri; 81 77 unsigned int lcrh_tx; 82 78 unsigned int lcrh_rx; 83 79 u16 *reg_lut; ··· 127 131 [REG_DMACR] = UART011_DMACR, 128 132 }; 129 133 130 - #ifdef CONFIG_ARM_AMBA 131 134 static unsigned int get_fifosize_arm(struct amba_device *dev) 132 135 { 133 136 return amba_rev(dev) < 3 ? 16 : 32; ··· 134 139 135 140 static struct vendor_data vendor_arm = { 136 141 .ifls = UART011_IFLS_RX4_8|UART011_IFLS_TX4_8, 137 - .fr_busy = UART01x_FR_BUSY, 138 - .fr_dsr = UART01x_FR_DSR, 139 - .fr_cts = UART01x_FR_CTS, 140 - .fr_ri = UART011_FR_RI, 141 142 .lcrh_tx = REG_LCRH, 142 143 .lcrh_rx = REG_LCRH, 143 144 .reg_lut = arm_reg, ··· 144 153 .fixed_options = false, 145 154 .get_fifosize = get_fifosize_arm, 146 155 }; 147 - #endif 148 156 149 157 static struct vendor_data vendor_sbsa = { 150 - .fr_busy = UART01x_FR_BUSY, 151 - .fr_dsr = UART01x_FR_DSR, 152 - .fr_cts = UART01x_FR_CTS, 153 - .fr_ri = UART011_FR_RI, 154 158 .reg_lut = arm_reg, 155 159 .oversampling = false, 156 160 .dma_threshold = false, ··· 154 168 .fixed_options = true, 155 169 }; 156 170 157 - #ifdef CONFIG_ARM_AMBA 158 171 static u16 st_reg[] = { 159 172 [REG_DR] = UART01x_DR, 160 173 [REG_RSR] = UART01x_RSR, ··· 180 195 181 196 static struct vendor_data vendor_st = { 182 197 .ifls = UART011_IFLS_RX_HALF|UART011_IFLS_TX_HALF, 183 - .fr_busy = UART01x_FR_BUSY, 184 - .fr_dsr = UART01x_FR_DSR, 185 - .fr_cts = UART01x_FR_CTS, 186 - .fr_ri = UART011_FR_RI, 187 198 .lcrh_tx = REG_LCRH, 188 199 .lcrh_rx = REG_ST_LCRH_RX, 189 200 .reg_lut = st_reg, ··· 190 209 .fixed_options = false, 191 210 .get_fifosize = get_fifosize_st, 192 211 }; 193 - #endif 194 - 195 - #ifdef CONFIG_SOC_ZX296702 196 - static u16 zte_reg[] = { 197 - [REG_DR] = ZX_UART01x_DR, 198 - [REG_RSR] = UART01x_RSR, 199 - [REG_ST_DMAWM] = ST_UART011_DMAWM, 200 - [REG_FR] = ZX_UART01x_FR, 201 - [REG_ST_LCRH_RX] = ST_UART011_LCRH_RX, 202 - [REG_ILPR] = UART01x_ILPR, 203 - [REG_IBRD] = UART011_IBRD, 204 - [REG_FBRD] = UART011_FBRD, 205 - [REG_LCRH] = ZX_UART011_LCRH_TX, 206 - [REG_CR] = ZX_UART011_CR, 207 - [REG_IFLS] = ZX_UART011_IFLS, 208 - [REG_IMSC] = ZX_UART011_IMSC, 209 - [REG_RIS] = ZX_UART011_RIS, 210 - [REG_MIS] = ZX_UART011_MIS, 211 - [REG_ICR] = ZX_UART011_ICR, 212 - [REG_DMACR] = ZX_UART011_DMACR, 213 - }; 214 - 215 - static struct vendor_data vendor_zte = { 216 - .ifls = UART011_IFLS_RX4_8|UART011_IFLS_TX4_8, 217 - .fr_busy = ZX_UART01x_FR_BUSY, 218 - .fr_dsr = ZX_UART01x_FR_DSR, 219 - .fr_cts = ZX_UART01x_FR_CTS, 220 - .fr_ri = ZX_UART011_FR_RI, 221 - .lcrh_tx = REG_LCRH, 222 - .lcrh_rx = REG_ST_LCRH_RX, 223 - .reg_lut = zte_reg, 224 - .oversampling = false, 225 - .dma_threshold = false, 226 - .cts_event_workaround = false, 227 - .fixed_options = false, 228 - }; 229 - #endif 230 212 231 213 /* Deals with DMA transactions */ 232 214 ··· 233 289 unsigned int im; /* interrupt mask */ 234 290 unsigned int old_status; 235 291 unsigned int fifosize; /* vendor-specific */ 236 - unsigned int fr_busy; /* vendor-specific */ 237 - unsigned int fr_dsr; /* vendor-specific */ 238 - unsigned int fr_cts; /* vendor-specific */ 239 - unsigned int fr_ri; /* vendor-specific */ 240 292 unsigned int lcrh_tx; /* vendor-specific */ 241 293 unsigned int lcrh_rx; /* vendor-specific */ 242 294 unsigned int old_cr; /* state during shutdown */ ··· 1163 1223 return; 1164 1224 1165 1225 /* Disable RX and TX DMA */ 1166 - while (pl011_readw(uap, REG_FR) & uap->fr_busy) 1226 + while (pl011_readw(uap, REG_FR) & UART01x_FR_BUSY) 1167 1227 barrier(); 1168 1228 1169 1229 spin_lock_irq(&uap->port.lock); ··· 1412 1472 if (delta & UART01x_FR_DCD) 1413 1473 uart_handle_dcd_change(&uap->port, status & UART01x_FR_DCD); 1414 1474 1415 - if (delta & uap->fr_dsr) 1475 + if (delta & UART01x_FR_DSR) 1416 1476 uap->port.icount.dsr++; 1417 1477 1418 - if (delta & uap->fr_cts) 1419 - uart_handle_cts_change(&uap->port, status & uap->fr_cts); 1478 + if (delta & UART01x_FR_CTS) 1479 + uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS); 1420 1480 1421 1481 wake_up_interruptible(&uap->port.state->port.delta_msr_wait); 1422 1482 } ··· 1487 1547 struct uart_amba_port *uap = 1488 1548 container_of(port, struct uart_amba_port, port); 1489 1549 unsigned int status = pl011_readw(uap, REG_FR); 1490 - return status & (uap->fr_busy|UART01x_FR_TXFF) ? 0 : TIOCSER_TEMT; 1550 + return status & (UART01x_FR_BUSY|UART01x_FR_TXFF) ? 0 : TIOCSER_TEMT; 1491 1551 } 1492 1552 1493 1553 static unsigned int pl011_get_mctrl(struct uart_port *port) ··· 1502 1562 result |= tiocmbit 1503 1563 1504 1564 TIOCMBIT(UART01x_FR_DCD, TIOCM_CAR); 1505 - TIOCMBIT(uap->fr_dsr, TIOCM_DSR); 1506 - TIOCMBIT(uap->fr_cts, TIOCM_CTS); 1507 - TIOCMBIT(uap->fr_ri, TIOCM_RNG); 1565 + TIOCMBIT(UART01x_FR_DSR, TIOCM_DSR); 1566 + TIOCMBIT(UART01x_FR_CTS, TIOCM_CTS); 1567 + TIOCMBIT(UART011_FR_RI, TIOCM_RNG); 1508 1568 #undef TIOCMBIT 1509 1569 return result; 1510 1570 } ··· 1720 1780 /* 1721 1781 * initialise the old status of the modem signals 1722 1782 */ 1723 - uap->old_status = pl011_readw(uap, REG_FR) & UART01x_FR_MODEM_ANY; 1783 + uap->old_status = pl011_readw(uap, REG_FR) & 1784 + UART01x_FR_MODEM_ANY; 1724 1785 1725 1786 /* Startup DMA */ 1726 1787 pl011_dma_startup(uap); ··· 1800 1859 /* mask all interrupts and clear all pending ones */ 1801 1860 uap->im = 0; 1802 1861 pl011_writew(uap, uap->im, REG_IMSC); 1803 - pl011_writew(uap, 0xffff, REG_ICR); 1862 + pl011_writew(0xffff, REG_ICR); 1804 1863 1805 1864 spin_unlock_irq(&uap->port.lock); 1806 1865 } ··· 2178 2237 */ 2179 2238 do { 2180 2239 status = pl011_readw(uap, REG_FR); 2181 - } while (status & uap->fr_busy); 2240 + } while (status & UART01x_FR_BUSY); 2182 2241 if (!uap->vendor->always_enabled) 2183 2242 pl011_writew(uap, old_cr, REG_CR); 2184 2243 ··· 2295 2354 while (pl011_readw(uap, REG_FR) & UART01x_FR_TXFF) 2296 2355 ; 2297 2356 pl011_writeb(uap, c, REG_DR); 2298 - while (pl011_readw(uap, REG_FR) & uap->fr_busy) 2357 + while (pl011_readw(uap, REG_FR) & UART01x_FR_BUSY) 2299 2358 ; 2300 2359 } 2301 2360 ··· 2441 2500 return ret; 2442 2501 } 2443 2502 2444 - #ifdef CONFIG_ARM_AMBA 2445 2503 static int pl011_probe(struct amba_device *dev, const struct amba_id *id) 2446 2504 { 2447 2505 struct uart_amba_port *uap; ··· 2464 2524 uap->reg_lut = vendor->reg_lut; 2465 2525 uap->lcrh_rx = vendor->lcrh_rx; 2466 2526 uap->lcrh_tx = vendor->lcrh_tx; 2467 - uap->fr_busy = vendor->fr_busy; 2468 - uap->fr_dsr = vendor->fr_dsr; 2469 - uap->fr_cts = vendor->fr_cts; 2470 - uap->fr_ri = vendor->fr_ri; 2471 2527 uap->fifosize = vendor->get_fifosize(dev); 2472 2528 uap->port.irq = dev->irq[0]; 2473 2529 uap->port.ops = &amba_pl011_pops; ··· 2487 2551 pl011_unregister_port(uap); 2488 2552 return 0; 2489 2553 } 2490 - #endif 2491 - 2492 - #ifdef CONFIG_SOC_ZX296702 2493 - static int zx_uart_probe(struct platform_device *pdev) 2494 - { 2495 - struct uart_amba_port *uap; 2496 - struct vendor_data *vendor = &vendor_zte; 2497 - struct resource *res; 2498 - int portnr, ret; 2499 - 2500 - portnr = pl011_find_free_port(); 2501 - if (portnr < 0) 2502 - return portnr; 2503 - 2504 - uap = devm_kzalloc(&pdev->dev, sizeof(struct uart_amba_port), 2505 - GFP_KERNEL); 2506 - if (!uap) { 2507 - ret = -ENOMEM; 2508 - goto out; 2509 - } 2510 - 2511 - uap->clk = devm_clk_get(&pdev->dev, NULL); 2512 - if (IS_ERR(uap->clk)) { 2513 - ret = PTR_ERR(uap->clk); 2514 - goto out; 2515 - } 2516 - 2517 - uap->vendor = vendor; 2518 - uap->reg_lut = vendor->reg_lut; 2519 - uap->lcrh_rx = vendor->lcrh_rx; 2520 - uap->lcrh_tx = vendor->lcrh_tx; 2521 - uap->fr_busy = vendor->fr_busy; 2522 - uap->fr_dsr = vendor->fr_dsr; 2523 - uap->fr_cts = vendor->fr_cts; 2524 - uap->fr_ri = vendor->fr_ri; 2525 - uap->fifosize = 16; 2526 - uap->port.irq = platform_get_irq(pdev, 0); 2527 - uap->port.ops = &amba_pl011_pops; 2528 - 2529 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2530 - 2531 - ret = pl011_setup_port(&pdev->dev, uap, res, portnr); 2532 - if (ret) 2533 - return ret; 2534 - 2535 - platform_set_drvdata(pdev, uap); 2536 - 2537 - return pl011_register_port(uap); 2538 - out: 2539 - return ret; 2540 - } 2541 - 2542 - static int zx_uart_remove(struct platform_device *pdev) 2543 - { 2544 - struct uart_amba_port *uap = platform_get_drvdata(pdev); 2545 - 2546 - uart_remove_one_port(&amba_reg, &uap->port); 2547 - pl011_unregister_port(uap); 2548 - return 0; 2549 - } 2550 - #endif 2551 2554 2552 2555 #ifdef CONFIG_PM_SLEEP 2553 2556 static int pl011_suspend(struct device *dev) ··· 2544 2669 2545 2670 uap->vendor = &vendor_sbsa; 2546 2671 uap->reg_lut = vendor_sbsa.reg_lut; 2547 - uap->fr_busy = vendor_sbsa.fr_busy; 2548 - uap->fr_dsr = vendor_sbsa.fr_dsr; 2549 - uap->fr_cts = vendor_sbsa.fr_cts; 2550 - uap->fr_ri = vendor_sbsa.fr_ri; 2551 2672 uap->fifosize = 32; 2552 2673 uap->port.irq = platform_get_irq(pdev, 0); 2553 2674 uap->port.ops = &sbsa_uart_pops; ··· 2593 2722 }, 2594 2723 }; 2595 2724 2596 - #ifdef CONFIG_ARM_AMBA 2597 2725 static struct amba_id pl011_ids[] = { 2598 2726 { 2599 2727 .id = 0x00041011, ··· 2618 2748 .probe = pl011_probe, 2619 2749 .remove = pl011_remove, 2620 2750 }; 2621 - #endif 2622 - 2623 - #ifdef CONFIG_SOC_ZX296702 2624 - static const struct of_device_id zx_uart_dt_ids[] = { 2625 - { .compatible = "zte,zx296702-uart", }, 2626 - { /* sentinel */ } 2627 - }; 2628 - MODULE_DEVICE_TABLE(of, zx_uart_dt_ids); 2629 - 2630 - static struct platform_driver zx_uart_driver = { 2631 - .driver = { 2632 - .name = "zx-uart", 2633 - .owner = THIS_MODULE, 2634 - .pm = &pl011_dev_pm_ops, 2635 - .of_match_table = zx_uart_dt_ids, 2636 - }, 2637 - .probe = zx_uart_probe, 2638 - .remove = zx_uart_remove, 2639 - }; 2640 - #endif 2641 - 2642 2751 2643 2752 static int __init pl011_init(void) 2644 2753 { 2645 - int ret; 2646 2754 printk(KERN_INFO "Serial: AMBA PL011 UART driver\n"); 2647 2755 2648 2756 if (platform_driver_register(&arm_sbsa_uart_platform_driver)) 2649 2757 pr_warn("could not register SBSA UART platform driver\n"); 2650 - 2651 - #ifdef CONFIG_SOC_ZX296702 2652 - ret = platform_driver_register(&zx_uart_driver); 2653 - if (ret) 2654 - pr_warn("could not register ZX UART platform driver\n"); 2655 - #endif 2656 - 2657 - #ifdef CONFIG_ARM_AMBA 2658 - ret = amba_driver_register(&pl011_driver); 2659 - #endif 2660 - return ret; 2758 + return amba_driver_register(&pl011_driver); 2661 2759 } 2662 2760 2663 2761 static void __exit pl011_exit(void) 2664 2762 { 2665 2763 platform_driver_unregister(&arm_sbsa_uart_platform_driver); 2666 - #ifdef CONFIG_SOC_ZX296702 2667 - platform_driver_unregister(&zx_uart_driver); 2668 - #endif 2669 - #ifdef CONFIG_ARM_AMBA 2670 2764 amba_driver_unregister(&pl011_driver); 2671 - #endif 2672 2765 } 2673 2766 2674 2767 /*
-14
include/linux/amba/serial.h
··· 33 33 #define UART01x_DR 0x00 /* Data read or written from the interface. */ 34 34 #define UART01x_RSR 0x04 /* Receive status register (Read). */ 35 35 #define UART01x_ECR 0x04 /* Error clear register (Write). */ 36 - #define ZX_UART01x_DR 0x04 /* Data read or written from the interface. */ 37 36 #define UART010_LCRH 0x08 /* Line control register, high byte. */ 38 37 #define ST_UART011_DMAWM 0x08 /* DMA watermark configure register. */ 39 38 #define UART010_LCRM 0x0C /* Line control register, middle byte. */ 40 39 #define ST_UART011_TIMEOUT 0x0C /* Timeout period register. */ 41 40 #define UART010_LCRL 0x10 /* Line control register, low byte. */ 42 41 #define UART010_CR 0x14 /* Control register. */ 43 - #define ZX_UART01x_FR 0x14 /* Flag register (Read only). */ 44 42 #define UART01x_FR 0x18 /* Flag register (Read only). */ 45 43 #define UART010_IIR 0x1C /* Interrupt identification register (Read). */ 46 44 #define UART010_ICR 0x1C /* Interrupt clear register (Write). */ ··· 49 51 #define UART011_LCRH 0x2c /* Line control register. */ 50 52 #define ST_UART011_LCRH_TX 0x2c /* Tx Line control register. */ 51 53 #define UART011_CR 0x30 /* Control register. */ 52 - #define ZX_UART011_LCRH_TX 0x30 /* Tx Line control register. */ 53 54 #define UART011_IFLS 0x34 /* Interrupt fifo level select. */ 54 - #define ZX_UART011_CR 0x34 /* Control register. */ 55 - #define ZX_UART011_IFLS 0x38 /* Interrupt fifo level select. */ 56 55 #define UART011_IMSC 0x38 /* Interrupt mask. */ 57 56 #define UART011_RIS 0x3c /* Raw interrupt status. */ 58 57 #define UART011_MIS 0x40 /* Masked interrupt status. */ 59 - #define ZX_UART011_IMSC 0x40 /* Interrupt mask. */ 60 58 #define UART011_ICR 0x44 /* Interrupt clear register. */ 61 - #define ZX_UART011_RIS 0x44 /* Raw interrupt status. */ 62 59 #define UART011_DMACR 0x48 /* DMA control register. */ 63 - #define ZX_UART011_MIS 0x48 /* Masked interrupt status. */ 64 - #define ZX_UART011_ICR 0x4c /* Interrupt clear register. */ 65 60 #define ST_UART011_XFCR 0x50 /* XON/XOFF control register. */ 66 - #define ZX_UART011_DMACR 0x50 /* DMA control register. */ 67 61 #define ST_UART011_XON1 0x54 /* XON1 register. */ 68 62 #define ST_UART011_XON2 0x58 /* XON2 register. */ 69 63 #define ST_UART011_XOFF1 0x5C /* XON1 register. */ ··· 75 85 #define UART01x_RSR_PE 0x02 76 86 #define UART01x_RSR_FE 0x01 77 87 78 - #define ZX_UART01x_FR_BUSY 0x300 79 88 #define UART011_FR_RI 0x100 80 89 #define UART011_FR_TXFE 0x080 81 90 #define UART011_FR_RXFF 0x040 82 91 #define UART01x_FR_TXFF 0x020 83 92 #define UART01x_FR_RXFE 0x010 84 93 #define UART01x_FR_BUSY 0x008 85 - #define ZX_UART01x_FR_DSR 0x008 86 94 #define UART01x_FR_DCD 0x004 87 95 #define UART01x_FR_DSR 0x002 88 - #define ZX_UART01x_FR_CTS 0x002 89 96 #define UART01x_FR_CTS 0x001 90 - #define ZX_UART011_FR_RI 0x001 91 97 #define UART01x_FR_TMSK (UART01x_FR_TXFF + UART01x_FR_BUSY) 92 98 93 99 #define UART011_CR_CTSEN 0x8000 /* CTS hardware flow control */