Skip to content

Commit f77d55a

Browse files
julienchauveaugregkh
authored andcommitted
serial: 8250_dw: get index of serial line from DT aliases
Get index of serial line from device tree using function of_alias_get_id(). If no alias is found, the 8250 core takes care of incrementing the line number. Signed-off-by: Julien CHAUVEAU <julien.chauveau@neo-technologies.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1bd8324 commit f77d55a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/tty/serial/8250/8250_dw.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ static int dw8250_probe_of(struct uart_port *p,
258258
struct uart_8250_port *up = up_to_u8250p(p);
259259
u32 val;
260260
bool has_ucv = true;
261+
int id;
261262

262263
if (of_device_is_compatible(np, "cavium,octeon-3860-uart")) {
263264
#ifdef __BIG_ENDIAN
@@ -301,6 +302,11 @@ static int dw8250_probe_of(struct uart_port *p,
301302
if (!of_property_read_u32(np, "reg-shift", &val))
302303
p->regshift = val;
303304

305+
/* get index of serial line, if found in DT aliases */
306+
id = of_alias_get_id(np, "serial");
307+
if (id >= 0)
308+
p->line = id;
309+
304310
/* clock got configured through clk api, all done */
305311
if (p->uartclk)
306312
return 0;

0 commit comments

Comments
 (0)