aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/of_serial.c
diff options
context:
space:
mode:
authorJohn Linn <john.linn@xilinx.com>2008-04-02 19:22:19 -0400
committerJosh Boyer <jwboyer@linux.vnet.ibm.com>2008-04-24 14:32:46 -0400
commitb912b5e2cfb35c02c9c79d3f6e31753f3be4dd83 (patch)
treef9b09696b097dc85cb69d0b28c321cdc92c6afe4 /drivers/serial/of_serial.c
parent2f0b45f846735b486c0383740d3959941c4721a4 (diff)
[POWERPC] Xilinx: of_serial support for Xilinx uart 16550.
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> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/serial/of_serial.c')
-rw-r--r--drivers/serial/of_serial.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
index 8aacfb78deab..25029c7570b6 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,
31 struct resource resource; 31 struct resource resource;
32 struct device_node *np = ofdev->node; 32 struct device_node *np = ofdev->node;
33 const unsigned int *clk, *spd; 33 const unsigned int *clk, *spd;
34 int ret; 34 const u32 *prop;
35 int ret, prop_size;
35 36
36 memset(port, 0, sizeof *port); 37 memset(port, 0, sizeof *port);
37 spd = of_get_property(np, "current-speed", NULL); 38 spd = of_get_property(np, "current-speed", NULL);
@@ -49,6 +50,17 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
49 50
50 spin_lock_init(&port->lock); 51 spin_lock_init(&port->lock);
51 port->mapbase = resource.start; 52 port->mapbase = resource.start;
53
54 /* Check for shifted address mapping */
55 prop = of_get_property(np, "reg-offset", &prop_size);
56 if (prop && (prop_size == sizeof(u32)))
57 port->mapbase += *prop;
58
59 /* Check for registers offset within the devices address range */
60 prop = of_get_property(np, "reg-shift", &prop_size);
61 if (prop && (prop_size == sizeof(u32)))
62 port->regshift = *prop;
63
52 port->irq = irq_of_parse_and_map(np, 0); 64 port->irq = irq_of_parse_and_map(np, 0);
53 port->iotype = UPIO_MEM; 65 port->iotype = UPIO_MEM;
54 port->type = type; 66 port->type = type;