summaryrefslogtreecommitdiffstats
path: root/drivers/serial/amba-pl011.c
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-08-17 16:23:50 +0800
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-09-11 12:48:34 +0800
commit09d593b6706a09b22d41cb831548a6b08289660a (patch)
treecfed7a05d09f48dbfa14826de1b529619ca112be /drivers/serial/amba-pl011.c
parent7492e8632925fd2b4d8bfeec3af7fc53bb649073 (diff)
downloadbarebox-09d593b6706a09b22d41cb831548a6b08289660a.tar.gz
barebox-09d593b6706a09b22d41cb831548a6b08289660a.tar.xz
amba-pl011: switch to amba bus
switch as the same time the nomadik and versatile arch that use the driver. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'drivers/serial/amba-pl011.c')
-rw-r--r--drivers/serial/amba-pl011.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index f8c55c4b54..77f8c8ad92 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -35,6 +35,7 @@
#include <linux/amba/serial.h>
#include <linux/clk.h>
#include <linux/err.h>
+#include <linux/amba/bus.h>
/*
* We wrap our port structure around the generic console_device.
@@ -118,11 +119,8 @@ static int pl011_tstc(struct console_device *cdev)
int pl011_init_port (struct console_device *cdev)
{
- struct device_d *dev = cdev->dev;
struct amba_uart_port *uart = to_amba_uart_port(cdev);
- uart->base = dev_request_mem_region(dev, 0);
-
/*
** First, disable everything.
*/
@@ -154,19 +152,20 @@ int pl011_init_port (struct console_device *cdev)
return 0;
}
-static int pl011_probe(struct device_d *dev)
+static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
{
struct amba_uart_port *uart;
struct console_device *cdev;
uart = xzalloc(sizeof(struct amba_uart_port));
- uart->clk = clk_get(dev, NULL);
+ uart->clk = clk_get(&dev->dev, NULL);
+ uart->base = amba_get_mem_region(dev);
if (IS_ERR(uart->clk))
return PTR_ERR(uart->clk);
cdev = &uart->uart;
- cdev->dev = dev;
+ cdev->dev = &dev->dev;
cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
cdev->tstc = pl011_tstc;
cdev->putc = pl011_putc;
@@ -182,14 +181,29 @@ static int pl011_probe(struct device_d *dev)
return 0;
}
-static struct driver_d pl011_driver = {
- .name = "uart-pl011",
- .probe = pl011_probe,
+static struct amba_id pl011_ids[] = {
+ {
+ .id = 0x00041011,
+ .mask = 0x000fffff,
+ },
+ {
+ .id = 0x00380802,
+ .mask = 0x00ffffff,
+ },
+ { 0, 0 },
+};
+
+struct amba_driver pl011_driver = {
+ .drv = {
+ .name = "uart-pl011",
+ },
+ .probe = pl011_probe,
+ .id_table = pl011_ids,
};
static int pl011_init(void)
{
- register_driver(&pl011_driver);
+ amba_driver_register(&pl011_driver);
return 0;
}