Skip to content

Commit

Permalink
serial: samsung: Consider DT alias when probing ports
Browse files Browse the repository at this point in the history
Current driver code relies on probe order of particular samsung-uart
instances, which makes it impossible to get proper initialization of
ports when not all ports are available on board, not even saying of
deterministic device naming.

This patch fixes this on DT-enabled systems by using DT aliases for
ports as instance ID, if specified, or falling back to legacy method
otherwise to provide backwards compatibility.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Tomasz Figa authored and Greg Kroah-Hartman committed Jul 10, 2014
1 parent 9b58bec commit 13a9f6c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions drivers/tty/serial/samsung.c
Original file line number Diff line number Diff line change
Expand Up @@ -1275,11 +1275,18 @@ static inline struct s3c24xx_serial_drv_data *s3c24xx_get_driver_data(
static int s3c24xx_serial_probe(struct platform_device *pdev)
{
struct s3c24xx_uart_port *ourport;
int index = probe_index;
int ret;

dbg("s3c24xx_serial_probe(%p) %d\n", pdev, probe_index);
if (pdev->dev.of_node) {
ret = of_alias_get_id(pdev->dev.of_node, "serial");
if (ret >= 0)
index = ret;
}

dbg("s3c24xx_serial_probe(%p) %d\n", pdev, index);

ourport = &s3c24xx_serial_ports[probe_index];
ourport = &s3c24xx_serial_ports[index];

ourport->drv_data = s3c24xx_get_driver_data(pdev);
if (!ourport->drv_data) {
Expand All @@ -1295,7 +1302,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)

ourport->port.fifosize = (ourport->info->fifosize) ?
ourport->info->fifosize :
ourport->drv_data->fifosize[probe_index];
ourport->drv_data->fifosize[index];

probe_index++;

Expand Down

0 comments on commit 13a9f6c

Please sign in to comment.