Skip to content

Commit 062a68a

Browse files
committed
Revert "uart: pl011: Add support to ZTE ZX296702 uart"
This reverts commit 8cd90e5 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>
1 parent a4fdb2a commit 062a68a

3 files changed

Lines changed: 16 additions & 197 deletions

File tree

‎drivers/tty/serial/Kconfig‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ config SERIAL_AMBA_PL010_CONSOLE
4747

4848
config SERIAL_AMBA_PL011
4949
tristate "ARM AMBA PL011 serial port support"
50-
depends on ARM_AMBA || SOC_ZX296702
50+
depends on ARM_AMBA
5151
select SERIAL_CORE
5252
help
5353
This selects the ARM(R) AMBA(R) PrimeCell PL011 UART. If you have
5454
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.
5656

5757
If unsure, say N.
5858

‎drivers/tty/serial/amba-pl011.c‎

Lines changed: 14 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@
7474
/* There is by now at least one vendor with differing details, so handle it */
7575
struct vendor_data {
7676
unsigned int ifls;
77-
unsigned int fr_busy;
78-
unsigned int fr_dsr;
79-
unsigned int fr_cts;
80-
unsigned int fr_ri;
8177
unsigned int lcrh_tx;
8278
unsigned int lcrh_rx;
8379
u16 *reg_lut;
@@ -131,18 +127,13 @@ static u16 arm_reg[] = {
131127
[REG_DMACR] = UART011_DMACR,
132128
};
133129

134-
#ifdef CONFIG_ARM_AMBA
135130
static unsigned int get_fifosize_arm(struct amba_device *dev)
136131
{
137132
return amba_rev(dev) < 3 ? 16 : 32;
138133
}
139134

140135
static struct vendor_data vendor_arm = {
141136
.ifls = UART011_IFLS_RX4_8|UART011_IFLS_TX4_8,
142-
.fr_busy = UART01x_FR_BUSY,
143-
.fr_dsr = UART01x_FR_DSR,
144-
.fr_cts = UART01x_FR_CTS,
145-
.fr_ri = UART011_FR_RI,
146137
.lcrh_tx = REG_LCRH,
147138
.lcrh_rx = REG_LCRH,
148139
.reg_lut = arm_reg,
@@ -153,13 +144,8 @@ static struct vendor_data vendor_arm = {
153144
.fixed_options = false,
154145
.get_fifosize = get_fifosize_arm,
155146
};
156-
#endif
157147

158148
static struct vendor_data vendor_sbsa = {
159-
.fr_busy = UART01x_FR_BUSY,
160-
.fr_dsr = UART01x_FR_DSR,
161-
.fr_cts = UART01x_FR_CTS,
162-
.fr_ri = UART011_FR_RI,
163149
.reg_lut = arm_reg,
164150
.oversampling = false,
165151
.dma_threshold = false,
@@ -168,7 +154,6 @@ static struct vendor_data vendor_sbsa = {
168154
.fixed_options = true,
169155
};
170156

171-
#ifdef CONFIG_ARM_AMBA
172157
static u16 st_reg[] = {
173158
[REG_DR] = UART01x_DR,
174159
[REG_RSR] = UART01x_RSR,
@@ -195,10 +180,6 @@ static unsigned int get_fifosize_st(struct amba_device *dev)
195180

196181
static struct vendor_data vendor_st = {
197182
.ifls = UART011_IFLS_RX_HALF|UART011_IFLS_TX_HALF,
198-
.fr_busy = UART01x_FR_BUSY,
199-
.fr_dsr = UART01x_FR_DSR,
200-
.fr_cts = UART01x_FR_CTS,
201-
.fr_ri = UART011_FR_RI,
202183
.lcrh_tx = REG_LCRH,
203184
.lcrh_rx = REG_ST_LCRH_RX,
204185
.reg_lut = st_reg,
@@ -209,43 +190,6 @@ static struct vendor_data vendor_st = {
209190
.fixed_options = false,
210191
.get_fifosize = get_fifosize_st,
211192
};
212-
#endif
213-
214-
#ifdef CONFIG_SOC_ZX296702
215-
static u16 zte_reg[] = {
216-
[REG_DR] = ZX_UART01x_DR,
217-
[REG_RSR] = UART01x_RSR,
218-
[REG_ST_DMAWM] = ST_UART011_DMAWM,
219-
[REG_FR] = ZX_UART01x_FR,
220-
[REG_ST_LCRH_RX] = ST_UART011_LCRH_RX,
221-
[REG_ILPR] = UART01x_ILPR,
222-
[REG_IBRD] = UART011_IBRD,
223-
[REG_FBRD] = UART011_FBRD,
224-
[REG_LCRH] = ZX_UART011_LCRH_TX,
225-
[REG_CR] = ZX_UART011_CR,
226-
[REG_IFLS] = ZX_UART011_IFLS,
227-
[REG_IMSC] = ZX_UART011_IMSC,
228-
[REG_RIS] = ZX_UART011_RIS,
229-
[REG_MIS] = ZX_UART011_MIS,
230-
[REG_ICR] = ZX_UART011_ICR,
231-
[REG_DMACR] = ZX_UART011_DMACR,
232-
};
233-
234-
static struct vendor_data vendor_zte = {
235-
.ifls = UART011_IFLS_RX4_8|UART011_IFLS_TX4_8,
236-
.fr_busy = ZX_UART01x_FR_BUSY,
237-
.fr_dsr = ZX_UART01x_FR_DSR,
238-
.fr_cts = ZX_UART01x_FR_CTS,
239-
.fr_ri = ZX_UART011_FR_RI,
240-
.lcrh_tx = REG_LCRH,
241-
.lcrh_rx = REG_ST_LCRH_RX,
242-
.reg_lut = zte_reg,
243-
.oversampling = false,
244-
.dma_threshold = false,
245-
.cts_event_workaround = false,
246-
.fixed_options = false,
247-
};
248-
#endif
249193

250194
/* Deals with DMA transactions */
251195

@@ -289,10 +233,6 @@ struct uart_amba_port {
289233
unsigned int im; /* interrupt mask */
290234
unsigned int old_status;
291235
unsigned int fifosize; /* vendor-specific */
292-
unsigned int fr_busy; /* vendor-specific */
293-
unsigned int fr_dsr; /* vendor-specific */
294-
unsigned int fr_cts; /* vendor-specific */
295-
unsigned int fr_ri; /* vendor-specific */
296236
unsigned int lcrh_tx; /* vendor-specific */
297237
unsigned int lcrh_rx; /* vendor-specific */
298238
unsigned int old_cr; /* state during shutdown */
@@ -1223,7 +1163,7 @@ static void pl011_dma_shutdown(struct uart_amba_port *uap)
12231163
return;
12241164

12251165
/* Disable RX and TX DMA */
1226-
while (pl011_readw(uap, REG_FR) & uap->fr_busy)
1166+
while (pl011_readw(uap, REG_FR) & UART01x_FR_BUSY)
12271167
barrier();
12281168

12291169
spin_lock_irq(&uap->port.lock);
@@ -1472,11 +1412,11 @@ static void pl011_modem_status(struct uart_amba_port *uap)
14721412
if (delta & UART01x_FR_DCD)
14731413
uart_handle_dcd_change(&uap->port, status & UART01x_FR_DCD);
14741414

1475-
if (delta & uap->fr_dsr)
1415+
if (delta & UART01x_FR_DSR)
14761416
uap->port.icount.dsr++;
14771417

1478-
if (delta & uap->fr_cts)
1479-
uart_handle_cts_change(&uap->port, status & uap->fr_cts);
1418+
if (delta & UART01x_FR_CTS)
1419+
uart_handle_cts_change(&uap->port, status & UART01x_FR_CTS);
14801420

14811421
wake_up_interruptible(&uap->port.state->port.delta_msr_wait);
14821422
}
@@ -1547,7 +1487,7 @@ static unsigned int pl011_tx_empty(struct uart_port *port)
15471487
struct uart_amba_port *uap =
15481488
container_of(port, struct uart_amba_port, port);
15491489
unsigned int status = pl011_readw(uap, REG_FR);
1550-
return status & (uap->fr_busy|UART01x_FR_TXFF) ? 0 : TIOCSER_TEMT;
1490+
return status & (UART01x_FR_BUSY|UART01x_FR_TXFF) ? 0 : TIOCSER_TEMT;
15511491
}
15521492

15531493
static unsigned int pl011_get_mctrl(struct uart_port *port)
@@ -1562,9 +1502,9 @@ static unsigned int pl011_get_mctrl(struct uart_port *port)
15621502
result |= tiocmbit
15631503

15641504
TIOCMBIT(UART01x_FR_DCD, TIOCM_CAR);
1565-
TIOCMBIT(uap->fr_dsr, TIOCM_DSR);
1566-
TIOCMBIT(uap->fr_cts, TIOCM_CTS);
1567-
TIOCMBIT(uap->fr_ri, TIOCM_RNG);
1505+
TIOCMBIT(UART01x_FR_DSR, TIOCM_DSR);
1506+
TIOCMBIT(UART01x_FR_CTS, TIOCM_CTS);
1507+
TIOCMBIT(UART011_FR_RI, TIOCM_RNG);
15681508
#undef TIOCMBIT
15691509
return result;
15701510
}
@@ -1780,7 +1720,8 @@ static int pl011_startup(struct uart_port *port)
17801720
/*
17811721
* initialise the old status of the modem signals
17821722
*/
1783-
uap->old_status = pl011_readw(uap, REG_FR) & UART01x_FR_MODEM_ANY;
1723+
uap->old_status = pl011_readw(uap, REG_FR) &
1724+
UART01x_FR_MODEM_ANY;
17841725

17851726
/* Startup DMA */
17861727
pl011_dma_startup(uap);
@@ -1859,7 +1800,7 @@ static void pl011_disable_interrupts(struct uart_amba_port *uap)
18591800
/* mask all interrupts and clear all pending ones */
18601801
uap->im = 0;
18611802
pl011_writew(uap, uap->im, REG_IMSC);
1862-
pl011_writew(uap, 0xffff, REG_ICR);
1803+
pl011_writew(0xffff, REG_ICR);
18631804

18641805
spin_unlock_irq(&uap->port.lock);
18651806
}
@@ -2237,7 +2178,7 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
22372178
*/
22382179
do {
22392180
status = pl011_readw(uap, REG_FR);
2240-
} while (status & uap->fr_busy);
2181+
} while (status & UART01x_FR_BUSY);
22412182
if (!uap->vendor->always_enabled)
22422183
pl011_writew(uap, old_cr, REG_CR);
22432184

@@ -2354,7 +2295,7 @@ static void pl011_putc(struct uart_port *port, int c)
23542295
while (pl011_readw(uap, REG_FR) & UART01x_FR_TXFF)
23552296
;
23562297
pl011_writeb(uap, c, REG_DR);
2357-
while (pl011_readw(uap, REG_FR) & uap->fr_busy)
2298+
while (pl011_readw(uap, REG_FR) & UART01x_FR_BUSY)
23582299
;
23592300
}
23602301

@@ -2500,7 +2441,6 @@ static int pl011_register_port(struct uart_amba_port *uap)
25002441
return ret;
25012442
}
25022443

2503-
#ifdef CONFIG_ARM_AMBA
25042444
static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
25052445
{
25062446
struct uart_amba_port *uap;
@@ -2524,10 +2464,6 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
25242464
uap->reg_lut = vendor->reg_lut;
25252465
uap->lcrh_rx = vendor->lcrh_rx;
25262466
uap->lcrh_tx = vendor->lcrh_tx;
2527-
uap->fr_busy = vendor->fr_busy;
2528-
uap->fr_dsr = vendor->fr_dsr;
2529-
uap->fr_cts = vendor->fr_cts;
2530-
uap->fr_ri = vendor->fr_ri;
25312467
uap->fifosize = vendor->get_fifosize(dev);
25322468
uap->port.irq = dev->irq[0];
25332469
uap->port.ops = &amba_pl011_pops;
@@ -2551,67 +2487,6 @@ static int pl011_remove(struct amba_device *dev)
25512487
pl011_unregister_port(uap);
25522488
return 0;
25532489
}
2554-
#endif
2555-
2556-
#ifdef CONFIG_SOC_ZX296702
2557-
static int zx_uart_probe(struct platform_device *pdev)
2558-
{
2559-
struct uart_amba_port *uap;
2560-
struct vendor_data *vendor = &vendor_zte;
2561-
struct resource *res;
2562-
int portnr, ret;
2563-
2564-
portnr = pl011_find_free_port();
2565-
if (portnr < 0)
2566-
return portnr;
2567-
2568-
uap = devm_kzalloc(&pdev->dev, sizeof(struct uart_amba_port),
2569-
GFP_KERNEL);
2570-
if (!uap) {
2571-
ret = -ENOMEM;
2572-
goto out;
2573-
}
2574-
2575-
uap->clk = devm_clk_get(&pdev->dev, NULL);
2576-
if (IS_ERR(uap->clk)) {
2577-
ret = PTR_ERR(uap->clk);
2578-
goto out;
2579-
}
2580-
2581-
uap->vendor = vendor;
2582-
uap->reg_lut = vendor->reg_lut;
2583-
uap->lcrh_rx = vendor->lcrh_rx;
2584-
uap->lcrh_tx = vendor->lcrh_tx;
2585-
uap->fr_busy = vendor->fr_busy;
2586-
uap->fr_dsr = vendor->fr_dsr;
2587-
uap->fr_cts = vendor->fr_cts;
2588-
uap->fr_ri = vendor->fr_ri;
2589-
uap->fifosize = 16;
2590-
uap->port.irq = platform_get_irq(pdev, 0);
2591-
uap->port.ops = &amba_pl011_pops;
2592-
2593-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2594-
2595-
ret = pl011_setup_port(&pdev->dev, uap, res, portnr);
2596-
if (ret)
2597-
return ret;
2598-
2599-
platform_set_drvdata(pdev, uap);
2600-
2601-
return pl011_register_port(uap);
2602-
out:
2603-
return ret;
2604-
}
2605-
2606-
static int zx_uart_remove(struct platform_device *pdev)
2607-
{
2608-
struct uart_amba_port *uap = platform_get_drvdata(pdev);
2609-
2610-
uart_remove_one_port(&amba_reg, &uap->port);
2611-
pl011_unregister_port(uap);
2612-
return 0;
2613-
}
2614-
#endif
26152490

26162491
#ifdef CONFIG_PM_SLEEP
26172492
static int pl011_suspend(struct device *dev)
@@ -2669,10 +2544,6 @@ static int sbsa_uart_probe(struct platform_device *pdev)
26692544

26702545
uap->vendor = &vendor_sbsa;
26712546
uap->reg_lut = vendor_sbsa.reg_lut;
2672-
uap->fr_busy = vendor_sbsa.fr_busy;
2673-
uap->fr_dsr = vendor_sbsa.fr_dsr;
2674-
uap->fr_cts = vendor_sbsa.fr_cts;
2675-
uap->fr_ri = vendor_sbsa.fr_ri;
26762547
uap->fifosize = 32;
26772548
uap->port.irq = platform_get_irq(pdev, 0);
26782549
uap->port.ops = &sbsa_uart_pops;
@@ -2722,7 +2593,6 @@ static struct platform_driver arm_sbsa_uart_platform_driver = {
27222593
},
27232594
};
27242595

2725-
#ifdef CONFIG_ARM_AMBA
27262596
static struct amba_id pl011_ids[] = {
27272597
{
27282598
.id = 0x00041011,
@@ -2748,57 +2618,20 @@ static struct amba_driver pl011_driver = {
27482618
.probe = pl011_probe,
27492619
.remove = pl011_remove,
27502620
};
2751-
#endif
2752-
2753-
#ifdef CONFIG_SOC_ZX296702
2754-
static const struct of_device_id zx_uart_dt_ids[] = {
2755-
{ .compatible = "zte,zx296702-uart", },
2756-
{ /* sentinel */ }
2757-
};
2758-
MODULE_DEVICE_TABLE(of, zx_uart_dt_ids);
2759-
2760-
static struct platform_driver zx_uart_driver = {
2761-
.driver = {
2762-
.name = "zx-uart",
2763-
.owner = THIS_MODULE,
2764-
.pm = &pl011_dev_pm_ops,
2765-
.of_match_table = zx_uart_dt_ids,
2766-
},
2767-
.probe = zx_uart_probe,
2768-
.remove = zx_uart_remove,
2769-
};
2770-
#endif
2771-
27722621

27732622
static int __init pl011_init(void)
27742623
{
2775-
int ret;
27762624
printk(KERN_INFO "Serial: AMBA PL011 UART driver\n");
27772625

27782626
if (platform_driver_register(&arm_sbsa_uart_platform_driver))
27792627
pr_warn("could not register SBSA UART platform driver\n");
2780-
2781-
#ifdef CONFIG_SOC_ZX296702
2782-
ret = platform_driver_register(&zx_uart_driver);
2783-
if (ret)
2784-
pr_warn("could not register ZX UART platform driver\n");
2785-
#endif
2786-
2787-
#ifdef CONFIG_ARM_AMBA
2788-
ret = amba_driver_register(&pl011_driver);
2789-
#endif
2790-
return ret;
2628+
return amba_driver_register(&pl011_driver);
27912629
}
27922630

27932631
static void __exit pl011_exit(void)
27942632
{
27952633
platform_driver_unregister(&arm_sbsa_uart_platform_driver);
2796-
#ifdef CONFIG_SOC_ZX296702
2797-
platform_driver_unregister(&zx_uart_driver);
2798-
#endif
2799-
#ifdef CONFIG_ARM_AMBA
28002634
amba_driver_unregister(&pl011_driver);
2801-
#endif
28022635
}
28032636

28042637
/*

0 commit comments

Comments
 (0)