serial: 8250_of: Add IO space support
Currently the 8250_of driver only supports MEM IO type accesses. Some development boards (Huawei D03, specifically) require IO space access for 8250-compatible OF driver support, so add it. The modification is quite simple: just set the port iotype and associated flags depending on the device address resource type. Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
9594b5be7e
Коммит
aa95947400
|
@ -92,7 +92,14 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
|
|||
goto err_unprepare;
|
||||
}
|
||||
|
||||
port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_FIXED_PORT |
|
||||
UPF_FIXED_TYPE;
|
||||
spin_lock_init(&port->lock);
|
||||
|
||||
if (resource_type(&resource) == IORESOURCE_IO) {
|
||||
port->iotype = UPIO_PORT;
|
||||
port->iobase = resource.start;
|
||||
} else {
|
||||
port->mapbase = resource.start;
|
||||
port->mapsize = resource_size(&resource);
|
||||
|
||||
|
@ -100,20 +107,6 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
|
|||
if (of_property_read_u32(np, "reg-offset", &prop) == 0)
|
||||
port->mapbase += prop;
|
||||
|
||||
/* Check for registers offset within the devices address range */
|
||||
if (of_property_read_u32(np, "reg-shift", &prop) == 0)
|
||||
port->regshift = prop;
|
||||
|
||||
/* Check for fifo size */
|
||||
if (of_property_read_u32(np, "fifo-size", &prop) == 0)
|
||||
port->fifosize = prop;
|
||||
|
||||
/* Check for a fixed line number */
|
||||
ret = of_alias_get_id(np, "serial");
|
||||
if (ret >= 0)
|
||||
port->line = ret;
|
||||
|
||||
port->irq = irq_of_parse_and_map(np, 0);
|
||||
port->iotype = UPIO_MEM;
|
||||
if (of_property_read_u32(np, "reg-io-width", &prop) == 0) {
|
||||
switch (prop) {
|
||||
|
@ -134,6 +127,23 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
|
|||
goto err_dispose;
|
||||
}
|
||||
}
|
||||
port->flags |= UPF_IOREMAP;
|
||||
}
|
||||
|
||||
/* Check for registers offset within the devices address range */
|
||||
if (of_property_read_u32(np, "reg-shift", &prop) == 0)
|
||||
port->regshift = prop;
|
||||
|
||||
/* Check for fifo size */
|
||||
if (of_property_read_u32(np, "fifo-size", &prop) == 0)
|
||||
port->fifosize = prop;
|
||||
|
||||
/* Check for a fixed line number */
|
||||
ret = of_alias_get_id(np, "serial");
|
||||
if (ret >= 0)
|
||||
port->line = ret;
|
||||
|
||||
port->irq = irq_of_parse_and_map(np, 0);
|
||||
|
||||
info->rst = devm_reset_control_get_optional_shared(&ofdev->dev, NULL);
|
||||
if (IS_ERR(info->rst)) {
|
||||
|
@ -147,8 +157,6 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
|
|||
|
||||
port->type = type;
|
||||
port->uartclk = clk;
|
||||
port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP
|
||||
| UPF_FIXED_PORT | UPF_FIXED_TYPE;
|
||||
port->irqflags |= IRQF_SHARED;
|
||||
|
||||
if (of_property_read_bool(np, "no-loopback-test"))
|
||||
|
|
Загрузка…
Ссылка в новой задаче