All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: PL011: add support for extended FIFO-size of PL011-r1p5
@ 2013-04-12  9:18 ` Jongsung Kim
  0 siblings, 0 replies; 45+ messages in thread
From: Jongsung Kim @ 2013-04-12  9:18 UTC (permalink / raw)
  To: Russell King, Greg Kroah-Hartman, jslaby; +Cc: linux-serial, linux-kernel

The latest r1p5-revision of the ARM PL011 UART has 32-byte FIFOs, while all
earlier ones have 16-byte FIFOs. This patch suggests a way to set the
FIFO-size correctly & flexibly by using a
function(vendor_data::get_fifosize) rather than using the
vendor_data::fifosize variable. The function takes the UARTPeriphID, and
returns the correct size.

Signed-off-by: Jongsung Kim <neidhard.kim@lge.com>

 drivers/tty/serial/amba-pl011.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/amba-pl011.c
b/drivers/tty/serial/amba-pl011.c
index 3ea5408..22af0c8 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -72,32 +72,44 @@
 /* There is by now at least one vendor with differing details, so handle it
*/
 struct vendor_data {
 	unsigned int		ifls;
-	unsigned int		fifosize;
 	unsigned int		lcrh_tx;
 	unsigned int		lcrh_rx;
 	bool			oversampling;
 	bool			dma_threshold;
 	bool			cts_event_workaround;
+
+	unsigned int (*get_fifosize)(unsigned int periphid);
 };
 
+static unsigned int get_fifosize_arm(unsigned int periphid)
+{
+	unsigned int rev = (periphid >> 20) & 0xf;
+	return rev < 3 ? 16 : 32;
+}
+
 static struct vendor_data vendor_arm = {
 	.ifls			= UART011_IFLS_RX4_8|UART011_IFLS_TX4_8,
-	.fifosize		= 16,
 	.lcrh_tx		= UART011_LCRH,
 	.lcrh_rx		= UART011_LCRH,
 	.oversampling		= false,
 	.dma_threshold		= false,
 	.cts_event_workaround	= false,
+	.get_fifosize		= get_fifosize_arm,
 };
 
+static unsigned int get_fifosize_st(unsigned int periphid)
+{
+	return 64;
+}
+
 static struct vendor_data vendor_st = {
 	.ifls			= UART011_IFLS_RX_HALF|UART011_IFLS_TX_HALF,
-	.fifosize		= 64,
 	.lcrh_tx		= ST_UART011_LCRH_TX,
 	.lcrh_rx		= ST_UART011_LCRH_RX,
 	.oversampling		= true,
 	.dma_threshold		= true,
 	.cts_event_workaround	= true,
+	.get_fifosize		= get_fifosize_st,
 };
 
 static struct uart_amba_port *amba_ports[UART_NR];
@@ -2010,7 +2022,7 @@ static int pl011_probe(struct amba_device *dev, const
struct amba_id *id)
 	uap->lcrh_rx = vendor->lcrh_rx;
 	uap->lcrh_tx = vendor->lcrh_tx;
 	uap->old_cr = 0;
-	uap->fifosize = vendor->fifosize;
+	uap->fifosize = vendor->get_fifosize(dev->periphid);
 	uap->port.dev = &dev->dev;
 	uap->port.mapbase = dev->res.start;
 	uap->port.membase = base;


^ permalink raw reply related	[flat|nested] 45+ messages in thread
* [PATCH] ARM: bcm2835: override the HW UART periphid
@ 2013-05-30  4:07 Stephen Warren
  2013-06-01  6:43 ` Olof Johansson
  0 siblings, 1 reply; 45+ messages in thread
From: Stephen Warren @ 2013-05-30  4:07 UTC (permalink / raw)
  To: linux-arm-kernel

From: Jongsung Kim <neidhard.kim@lge.com>

Stephen Warren reported the recent commit 78506f2 (add support for
extended FIFO-size of PL011-r1p5) breaks the serial port on the
BCM2835 ARM SoC.

A UART compatible with the ARM PL011-r1p5 should have 32-deep FIFOs.
The BCM2835 UART just looks like an ARM PL011-r1p5, but has 16-deep
FIFOs just like PL011-r1p4 or earlier revisions. As a workaround for
this compatibility issue, this patch overrides the HW UART periphid
register values with the actually compatible UART periphid 0x00241011
(r1p3 or r1p4).

Reported-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Jongsung Kim <neidhard.kim@lge.com>
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
This is a fix for v3.10-rc*.

 arch/arm/boot/dts/bcm2835.dtsi |    1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
index f0052dc..1e12aef 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -44,6 +44,7 @@
 			reg = <0x7e201000 0x1000>;
 			interrupts = <2 25>;
 			clock-frequency = <3000000>;
+			arm,primecell-periphid = <0x00241011>;
 		};
 
 		gpio: gpio {
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2013-06-01  6:43 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-12  9:18 [PATCH] ARM: PL011: add support for extended FIFO-size of PL011-r1p5 Jongsung Kim
2013-04-12  9:18 ` Jongsung Kim
2013-04-19 12:58 ` Russell King - ARM Linux
2013-05-14  5:56 ` Stephen Warren
2013-05-14  5:56   ` Stephen Warren
2013-05-14  5:56   ` Stephen Warren
2013-05-14  7:15   ` Jongsung Kim
2013-05-14  7:15     ` Jongsung Kim
2013-05-14  7:15     ` Jongsung Kim
2013-05-14 21:03     ` Stephen Warren
2013-05-14 21:03       ` Stephen Warren
2013-05-14 22:50       ` Russell King - ARM Linux
2013-05-14 22:50         ` Russell King - ARM Linux
2013-05-15  1:00       ` Jongsung Kim
2013-05-15  1:00         ` Jongsung Kim
2013-05-15  1:00         ` Jongsung Kim
2013-05-15  4:59         ` Stephen Warren
2013-05-15  4:59           ` Stephen Warren
2013-05-15  9:37           ` Russell King - ARM Linux
2013-05-15  9:37             ` Russell King - ARM Linux
2013-05-16 13:26           ` Jongsung Kim
2013-05-16 13:26             ` Jongsung Kim
2013-05-16 13:26             ` Jongsung Kim
2013-05-21  1:39           ` Jongsung Kim
2013-05-21  1:39             ` Jongsung Kim
2013-05-21  1:39             ` Jongsung Kim
2013-05-21  2:12             ` Stephen Warren
2013-05-21  2:12               ` Stephen Warren
2013-05-21  6:02               ` [PATCH] ARM: bcm2835: override the HW UART periphid Jongsung Kim
2013-05-21  6:02                 ` Jongsung Kim
2013-05-21  6:07                 ` Jongsung Kim
2013-05-21  6:07                   ` Jongsung Kim
2013-05-21  6:07                   ` Jongsung Kim
2013-05-21  9:00                   ` Gordon Hollingworth
2013-05-21  9:00                     ` Gordon Hollingworth
2013-05-21  9:00                     ` Gordon Hollingworth
2013-05-21 16:34                 ` Stephen Warren
2013-05-21 16:34                   ` Stephen Warren
2013-05-22  1:43                   ` Stephen Warren
2013-05-22  1:43                     ` Stephen Warren
2013-05-22  1:52                     ` Jongsung Kim
2013-05-22  1:52                       ` Jongsung Kim
2013-05-22  1:52                       ` Jongsung Kim
2013-05-30  4:07 Stephen Warren
2013-06-01  6:43 ` Olof Johansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.