summaryrefslogtreecommitdiff
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2015-09-21 11:17:25 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-04 17:38:45 (GMT)
commit1bd8edba10e6aa275434a8daa7ddcaf849fe49ad (patch)
tree5087f03ba444b555868c6b6957fe2283d3ec8875 /drivers/tty/serial
parent78d3da75d54ac7c1984ff19ba6034db2f549df89 (diff)
downloadlinux-1bd8edba10e6aa275434a8daa7ddcaf849fe49ad.tar.xz
serial: 8250_dw: adapt to unified device property interface
This makes the properties available for all types of platforms instead of just the ones using DT. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/8250/8250_dw.c80
1 files changed, 37 insertions, 43 deletions
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index f031e25..3460617 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -286,7 +286,6 @@ static int dw8250_probe_of(struct uart_port *p,
{
struct device_node *np = p->dev->of_node;
struct uart_8250_port *up = up_to_u8250p(p);
- u32 val;
bool has_ucv = true;
int id;
@@ -298,22 +297,8 @@ static int dw8250_probe_of(struct uart_port *p,
p->type = PORT_OCTEON;
data->usr_reg = 0x27;
has_ucv = false;
- } else
-#endif
- if (!of_property_read_u32(np, "reg-io-width", &val)) {
- switch (val) {
- case 1:
- break;
- case 4:
- p->iotype = UPIO_MEM32;
- p->serial_in = dw8250_serial_in32;
- p->serial_out = dw8250_serial_out32;
- break;
- default:
- dev_err(p->dev, "unsupported reg-io-width (%u)\n", val);
- return -EINVAL;
- }
}
+#endif
if (has_ucv)
dw8250_setup_port(up);
@@ -325,38 +310,11 @@ static int dw8250_probe_of(struct uart_port *p,
up->dma->txconf.dst_maxburst = p->fifosize / 4;
}
- if (!of_property_read_u32(np, "reg-shift", &val))
- p->regshift = val;
-
/* get index of serial line, if found in DT aliases */
id = of_alias_get_id(np, "serial");
if (id >= 0)
p->line = id;
- if (of_property_read_bool(np, "dcd-override")) {
- /* Always report DCD as active */
- data->msr_mask_on |= UART_MSR_DCD;
- data->msr_mask_off |= UART_MSR_DDCD;
- }
-
- if (of_property_read_bool(np, "dsr-override")) {
- /* Always report DSR as active */
- data->msr_mask_on |= UART_MSR_DSR;
- data->msr_mask_off |= UART_MSR_DDSR;
- }
-
- if (of_property_read_bool(np, "cts-override")) {
- /* Always report CTS as active */
- data->msr_mask_on |= UART_MSR_CTS;
- data->msr_mask_off |= UART_MSR_DCTS;
- }
-
- if (of_property_read_bool(np, "ri-override")) {
- /* Always report Ring indicator as inactive */
- data->msr_mask_off |= UART_MSR_RI;
- data->msr_mask_off |= UART_MSR_TERI;
- }
-
return 0;
}
@@ -407,6 +365,7 @@ static int dw8250_probe(struct platform_device *pdev)
struct uart_port *p = &uart.port;
struct dw8250_data *data;
int err;
+ u32 val;
if (!regs) {
dev_err(&pdev->dev, "no registers defined\n");
@@ -442,6 +401,41 @@ static int dw8250_probe(struct platform_device *pdev)
data->usr_reg = DW_UART_USR;
p->private_data = data;
+ err = device_property_read_u32(p->dev, "reg-shift", &val);
+ if (!err)
+ p->regshift = val;
+
+ err = device_property_read_u32(p->dev, "reg-io-width", &val);
+ if (!err && val == 4) {
+ p->iotype = UPIO_MEM32;
+ p->serial_in = dw8250_serial_in32;
+ p->serial_out = dw8250_serial_out32;
+ }
+
+ if (device_property_read_bool(p->dev, "dcd-override")) {
+ /* Always report DCD as active */
+ data->msr_mask_on |= UART_MSR_DCD;
+ data->msr_mask_off |= UART_MSR_DDCD;
+ }
+
+ if (device_property_read_bool(p->dev, "dsr-override")) {
+ /* Always report DSR as active */
+ data->msr_mask_on |= UART_MSR_DSR;
+ data->msr_mask_off |= UART_MSR_DDSR;
+ }
+
+ if (device_property_read_bool(p->dev, "cts-override")) {
+ /* Always report CTS as active */
+ data->msr_mask_on |= UART_MSR_CTS;
+ data->msr_mask_off |= UART_MSR_DCTS;
+ }
+
+ if (device_property_read_bool(p->dev, "ri-override")) {
+ /* Always report Ring indicator as inactive */
+ data->msr_mask_off |= UART_MSR_RI;
+ data->msr_mask_off |= UART_MSR_TERI;
+ }
+
/* Always ask for fixed clock rate from a property. */
device_property_read_u32(p->dev, "clock-frequency", &p->uartclk);