From: Tomasz Figa <t.figa@samsung.com>
To: linux-samsung-soc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
devicetree@vger.kernel.org, Kukjin Kim <kgene.kim@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Russell King - ARM Linux <linux@arm.linux.org.uk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.cz>, Daniel Drake <drake@endlessm.com>,
Tomasz Figa <tomasz.figa@gmail.com>,
Tomasz Figa <t.figa@samsung.com>
Subject: [PATCH 2/3] serial: samsung: Consider DT alias when probing ports
Date: Thu, 26 Jun 2014 13:24:34 +0200 [thread overview]
Message-ID: <1403781875-5425-3-git-send-email-t.figa@samsung.com> (raw)
In-Reply-To: <1403781875-5425-1-git-send-email-t.figa@samsung.com>
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>
---
drivers/tty/serial/samsung.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index c1d3ebd..a9bf024 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++;
--
1.9.3
next prev parent reply other threads:[~2014-06-26 11:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-26 11:24 [PATCH 0/3] Deterministic UART numbering on Samsung SoCs Tomasz Figa
2014-06-26 11:24 ` [PATCH 1/3] Documentation: devicetree: Update samsung UART bindings Tomasz Figa
2014-06-26 11:24 ` Tomasz Figa [this message]
2014-06-26 11:24 ` [PATCH 3/3] ARM: dts: SAMSUNG: Add aliases of UART nodes Tomasz Figa
2014-06-26 11:39 ` [PATCH 0/3] Deterministic UART numbering on Samsung SoCs Russell King - ARM Linux
2014-06-26 12:02 ` Tomasz Figa
2014-07-08 8:32 ` Daniel Drake
2014-07-08 8:40 ` Tomasz Figa
2014-07-09 13:23 ` One Thousand Gnomes
2014-07-23 6:30 ` Daniel Drake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1403781875-5425-3-git-send-email-t.figa@samsung.com \
--to=t.figa@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=drake@endlessm.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=kgene.kim@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=m.szyprowski@samsung.com \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=tomasz.figa@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®