diff options
Diffstat (limited to 'drivers/tty/serial/xilinx_uartps.c')
-rw-r--r-- | drivers/tty/serial/xilinx_uartps.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index b2f929e48ddd..2cd0cd456c7a 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c | |||
@@ -1031,17 +1031,21 @@ static struct uart_port xuartps_port[2]; | |||
1031 | * xuartps_get_port - Configure the port from the platform device resource | 1031 | * xuartps_get_port - Configure the port from the platform device resource |
1032 | * info | 1032 | * info |
1033 | * | 1033 | * |
1034 | * @id: Port id | ||
1035 | * | ||
1034 | * Return: a pointer to a uart_port or NULL for failure | 1036 | * Return: a pointer to a uart_port or NULL for failure |
1035 | */ | 1037 | */ |
1036 | static struct uart_port *xuartps_get_port(void) | 1038 | static struct uart_port *xuartps_get_port(int id) |
1037 | { | 1039 | { |
1038 | struct uart_port *port; | 1040 | struct uart_port *port; |
1039 | int id; | ||
1040 | 1041 | ||
1041 | /* Find the next unused port */ | 1042 | /* Try the given port id if failed use default method */ |
1042 | for (id = 0; id < XUARTPS_NR_PORTS; id++) | 1043 | if (xuartps_port[id].mapbase != 0) { |
1043 | if (xuartps_port[id].mapbase == 0) | 1044 | /* Find the next unused port */ |
1044 | break; | 1045 | for (id = 0; id < XUARTPS_NR_PORTS; id++) |
1046 | if (xuartps_port[id].mapbase == 0) | ||
1047 | break; | ||
1048 | } | ||
1045 | 1049 | ||
1046 | if (id >= XUARTPS_NR_PORTS) | 1050 | if (id >= XUARTPS_NR_PORTS) |
1047 | return NULL; | 1051 | return NULL; |
@@ -1329,7 +1333,7 @@ static SIMPLE_DEV_PM_OPS(xuartps_dev_pm_ops, xuartps_suspend, xuartps_resume); | |||
1329 | */ | 1333 | */ |
1330 | static int xuartps_probe(struct platform_device *pdev) | 1334 | static int xuartps_probe(struct platform_device *pdev) |
1331 | { | 1335 | { |
1332 | int rc; | 1336 | int rc, id; |
1333 | struct uart_port *port; | 1337 | struct uart_port *port; |
1334 | struct resource *res, *res2; | 1338 | struct resource *res, *res2; |
1335 | struct xuartps *xuartps_data; | 1339 | struct xuartps *xuartps_data; |
@@ -1380,9 +1384,13 @@ static int xuartps_probe(struct platform_device *pdev) | |||
1380 | &xuartps_data->clk_rate_change_nb)) | 1384 | &xuartps_data->clk_rate_change_nb)) |
1381 | dev_warn(&pdev->dev, "Unable to register clock notifier.\n"); | 1385 | dev_warn(&pdev->dev, "Unable to register clock notifier.\n"); |
1382 | #endif | 1386 | #endif |
1387 | /* Look for a serialN alias */ | ||
1388 | id = of_alias_get_id(pdev->dev.of_node, "serial"); | ||
1389 | if (id < 0) | ||
1390 | id = 0; | ||
1383 | 1391 | ||
1384 | /* Initialize the port structure */ | 1392 | /* Initialize the port structure */ |
1385 | port = xuartps_get_port(); | 1393 | port = xuartps_get_port(id); |
1386 | 1394 | ||
1387 | if (!port) { | 1395 | if (!port) { |
1388 | dev_err(&pdev->dev, "Cannot get uart_port structure\n"); | 1396 | dev_err(&pdev->dev, "Cannot get uart_port structure\n"); |