linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] [POWERPC][V3] Xilinx: of_serial support for Xilinx uart 16550.
@ 2008-04-02 23:22 John Linn
  2008-04-02 23:34 ` Arnd Bergmann
  2008-04-03 12:25 ` Sergei Shtylyov
  0 siblings, 2 replies; 9+ messages in thread
From: John Linn @ 2008-04-02 23:22 UTC (permalink / raw)
  To: linuxppc-dev, grant.likely; +Cc: John Linn

The Xilinx 16550 uart core is not a standard 16550 because it uses
word-based addressing rather than byte-based addressing. With
additional properties it is compatible with the open firmware
'ns16550' compatible binding.

This code updates the of_serial driver to handle the reg-offset
and reg-shift properties to enable this core to be used.

Signed-off-by: John Linn <john.linn@xilinx.com>
---

V3 has fixes suggested by Grant. They were incorporated and tested.

 Documentation/powerpc/booting-without-of.txt |   10 ++++++++++
 drivers/serial/of_serial.c                   |   14 +++++++++++++-
 2 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index 87f4d84..4066ec8 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -2539,6 +2539,16 @@ platforms are moved over to use the flattened-device-tree model.
                       differ between different families.  May be
                       'virtex2p', 'virtex4', or 'virtex5'.
 
+      iv) Xilinx Uart 16550
+
+      Xilinx UART 16550 devices are very similar to the NS16550 but with
+      different register spacing and an offset from the base address.
+
+      Requred properties:
+       - clock-frequency : Frequency of the clock input
+       - reg-offset : A value of 3 is required
+       - reg-shift : A value of 2 is required
+
    More devices will be defined as this spec matures.
 
 VII - Specifying interrupt information for devices
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
index 2efb892..73c47a5 100644
--- a/drivers/serial/of_serial.c
+++ b/drivers/serial/of_serial.c
@@ -31,7 +31,8 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
 	struct resource resource;
 	struct device_node *np = ofdev->node;
 	const unsigned int *clk, *spd;
-	int ret;
+	const u32 *prop;
+	int ret, prop_size;
 
 	memset(port, 0, sizeof *port);
 	spd = of_get_property(np, "current-speed", NULL);
@@ -49,6 +50,17 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
 
 	spin_lock_init(&port->lock);
 	port->mapbase = resource.start;
+
+	/* Check for shifted address mapping */
+	prop = of_get_property(np, "reg-offset", &prop_size);
+	if (prop && (prop_size == sizeof(u32)))
+		port->mapbase += *prop;
+
+	/* Check for registers offset within the devices address range */
+	prop = of_get_property(np, "reg-shift", &prop_size);
+	if (prop && (prop_size == sizeof(u32)))
+		port->regshift = *prop;
+
 	port->irq = irq_of_parse_and_map(np, 0);
 	port->iotype = UPIO_MEM;
 	port->type = type;
-- 
1.5.2.1

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

end of thread, other threads:[~2008-04-08  2:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-02 23:22 [PATCH 2/3] [POWERPC][V3] Xilinx: of_serial support for Xilinx uart 16550 John Linn
2008-04-02 23:34 ` Arnd Bergmann
2008-04-03  2:43   ` Grant Likely
2008-04-03  4:16     ` Arnd Bergmann
2008-04-03 13:29       ` John Linn
2008-04-03 22:36       ` [PATCH 2/3] [POWERPC][V3] Xilinx: of_serial support for Xilinxuart 16550 Stephen Neuendorffer
2008-04-05 14:45       ` [PATCH 2/3] [POWERPC][V3] Xilinx: of_serial support for Xilinx uart 16550 Josh Boyer
2008-04-08  2:44         ` David Gibson
2008-04-03 12:25 ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).