Skip to content

Commit

Permalink
[ARM] 5541/1: serial/amba-pl011.c: add support for the modified port …
Browse files Browse the repository at this point in the history
…found in Nomadik

The Nomadik 8815 SoC has a slightly modified version of the PL011 block.
The patch uses the different ID value as a key to select a vendor
structure that is used to keep track of the differences, as suggested
by Russell King.

Signed-off-by: Alessandro Rubini <rubini@unipv.it>
Acked-by: Andrea Gallo <andrea.gallo@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Alessandro Rubini authored and Russell King committed Jun 4, 2009
1 parent c7f7ff1 commit 5926a29
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
30 changes: 27 additions & 3 deletions drivers/serial/amba-pl011.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,23 @@ struct uart_amba_port {
struct clk *clk;
unsigned int im; /* interrupt mask */
unsigned int old_status;
unsigned int ifls; /* vendor-specific */
};

/* There is by now at least one vendor with differing details, so handle it */
struct vendor_data {
unsigned int ifls;
unsigned int fifosize;
};

static struct vendor_data vendor_arm = {
.ifls = UART011_IFLS_RX4_8|UART011_IFLS_TX4_8,
.fifosize = 16,
};

static struct vendor_data vendor_st = {
.ifls = UART011_IFLS_RX_HALF|UART011_IFLS_TX_HALF,
.fifosize = 64,
};

static void pl011_stop_tx(struct uart_port *port)
Expand Down Expand Up @@ -360,8 +377,7 @@ static int pl011_startup(struct uart_port *port)
if (retval)
goto clk_dis;

writew(UART011_IFLS_RX4_8|UART011_IFLS_TX4_8,
uap->port.membase + UART011_IFLS);
writew(uap->ifls, uap->port.membase + UART011_IFLS);

/*
* Provoke TX FIFO interrupt into asserting.
Expand Down Expand Up @@ -732,6 +748,7 @@ static struct uart_driver amba_reg = {
static int pl011_probe(struct amba_device *dev, struct amba_id *id)
{
struct uart_amba_port *uap;
struct vendor_data *vendor = id->data;
void __iomem *base;
int i, ret;

Expand Down Expand Up @@ -762,12 +779,13 @@ static int pl011_probe(struct amba_device *dev, struct amba_id *id)
goto unmap;
}

uap->ifls = vendor->ifls;
uap->port.dev = &dev->dev;
uap->port.mapbase = dev->res.start;
uap->port.membase = base;
uap->port.iotype = UPIO_MEM;
uap->port.irq = dev->irq[0];
uap->port.fifosize = 16;
uap->port.fifosize = vendor->fifosize;
uap->port.ops = &amba_pl011_pops;
uap->port.flags = UPF_BOOT_AUTOCONF;
uap->port.line = i;
Expand Down Expand Up @@ -812,6 +830,12 @@ static struct amba_id pl011_ids[] __initdata = {
{
.id = 0x00041011,
.mask = 0x000fffff,
.data = &vendor_arm,
},
{
.id = 0x00380802,
.mask = 0x00ffffff,
.data = &vendor_st,
},
{ 0, 0 },
};
Expand Down
3 changes: 3 additions & 0 deletions include/linux/amba/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@
#define UART011_IFLS_TX4_8 (2 << 0)
#define UART011_IFLS_TX6_8 (3 << 0)
#define UART011_IFLS_TX7_8 (4 << 0)
/* special values for ST vendor with deeper fifo */
#define UART011_IFLS_RX_HALF (5 << 3)
#define UART011_IFLS_TX_HALF (5 << 0)

#define UART011_OEIM (1 << 10) /* overrun error interrupt mask */
#define UART011_BEIM (1 << 9) /* break error interrupt mask */
Expand Down

0 comments on commit 5926a29

Please sign in to comment.