aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShubhrajyoti Datta <shubhrajyoti.datta@amd.com>2022-08-26 17:35:59 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-08-30 13:26:48 +0200
commit81db9e8edf7a886af0e6985d2562003976322cdf (patch)
tree4b672eba20a97be828febad21d48aaef53240798
parentdt-bindings: serial: pl011: Add a reg-io-width parameter (diff)
downloadlinux-dev-81db9e8edf7a886af0e6985d2562003976322cdf.tar.xz
linux-dev-81db9e8edf7a886af0e6985d2562003976322cdf.zip
serial: pl011: Add reg-io-width parameters
Some of the implementations can read only 32 bits because of the interface limitations of the port they are connected to. Add a parameter reg-io-width for supporting such platforms. Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com> Link: https://lore.kernel.org/r/20220826120559.2122-3-shubhrajyoti.datta@amd.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/amba-pl011.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 15f0e4d88c5a..033bf8699540 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2777,6 +2777,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
struct uart_amba_port *uap;
struct vendor_data *vendor = id->data;
int portnr, ret;
+ u32 val;
portnr = pl011_find_free_port();
if (portnr < 0)
@@ -2801,6 +2802,21 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
uap->port.rs485_supported = pl011_rs485_supported;
snprintf(uap->type, sizeof(uap->type), "PL011 rev%u", amba_rev(dev));
+ if (device_property_read_u32(&dev->dev, "reg-io-width", &val) == 0) {
+ switch (val) {
+ case 1:
+ uap->port.iotype = UPIO_MEM;
+ break;
+ case 4:
+ uap->port.iotype = UPIO_MEM32;
+ break;
+ default:
+ dev_warn(&dev->dev, "unsupported reg-io-width (%d)\n",
+ val);
+ return -EINVAL;
+ }
+ }
+
ret = pl011_setup_port(&dev->dev, uap, &dev->res, portnr);
if (ret)
return ret;