summaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2014-06-26 13:24:34 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-09 17:22:55 -0700
commit13a9f6c64fdc55eb6c5e129c1f56cb022613a96f (patch)
treef926e266c3aab73e17ce8a43b5ef00a0c506c5ea /drivers/tty
parent9b58bec76e8f80664a849ed788e30503463a8eb8 (diff)
downloadlinux-13a9f6c64fdc55eb6c5e129c1f56cb022613a96f.tar.bz2
serial: samsung: Consider DT alias when probing ports
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>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/samsung.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index bf9301094c41..be405c6115ca 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -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) {
@@ -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++;