From: Songjun Wu <songjun.wu@linux.intel.com>
To: yixin.zhu@linux.intel.com, chuanhua.lei@linux.intel.com,
hauke.mehrtens@intel.com
Cc: Songjun Wu <songjun.wu@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
Jiri Slaby <jslaby@suse.com>
Subject: [PATCH 03/14] serial: lantiq: Get serial id from dts
Date: Mon, 24 Sep 2018 18:27:52 +0800 [thread overview]
Message-ID: <20180924102803.30263-4-songjun.wu@linux.intel.com> (raw)
In-Reply-To: <20180924102803.30263-1-songjun.wu@linux.intel.com>
Get serial id from dts, also keep backward compatible when dts is not
updated.
Signed-off-by: Songjun Wu <songjun.wu@linux.intel.com>
---
drivers/tty/serial/lantiq.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/lantiq.c b/drivers/tty/serial/lantiq.c
index 044128277248..66c671677761 100644
--- a/drivers/tty/serial/lantiq.c
+++ b/drivers/tty/serial/lantiq.c
@@ -688,7 +688,7 @@ lqasc_probe(struct platform_device *pdev)
struct ltq_uart_port *ltq_port;
struct uart_port *port;
struct resource *mmres, irqres[3];
- int line = 0;
+ int line;
int ret;
mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -699,9 +699,20 @@ lqasc_probe(struct platform_device *pdev)
return -ENODEV;
}
- /* check if this is the console port */
- if (mmres->start != CPHYSADDR(LTQ_EARLY_ASC))
- line = 1;
+ /* get serial id */
+ line = of_alias_get_id(node, "serial");
+ if (line < 0) {
+ if (IS_ENABLED(CONFIG_LANTIQ)) {
+ if (mmres->start == CPHYSADDR(LTQ_EARLY_ASC))
+ line = 0;
+ else
+ line = 1;
+ } else {
+ dev_err(&pdev->dev, "failed to get alias id, errno %d\n",
+ line);
+ return line;
+ }
+ }
if (lqasc_port[line]) {
dev_err(&pdev->dev, "port %d already allocated\n", line);
--
2.11.0
next prev parent reply other threads:[~2018-09-24 10:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-24 10:27 [PATCH 00/14] serial: langtiq: Add CCF suppport Songjun Wu
2018-09-24 10:27 ` [PATCH 01/14] MIPS: dts: Change upper case to lower case Songjun Wu
2018-09-24 10:27 ` [PATCH 02/14] MIPS: dts: Add aliases node for lantiq danube serial Songjun Wu
2018-09-24 10:27 ` Songjun Wu [this message]
2018-09-24 10:27 ` [PATCH 04/14] serial: lantiq: Change ltq_w32_mask to asc_update_bits Songjun Wu
2018-09-24 10:27 ` [PATCH 05/14] MIPS: lantiq: Unselect SWAP_IO_SPACE when LANTIQ is selected Songjun Wu
2018-09-24 10:27 ` [PATCH 06/14] serial: lantiq: Use readl/writel instead of ltq_r32/ltq_w32 Songjun Wu
2018-09-24 10:27 ` [PATCH 07/14] serial: lantiq: Rename fpiclk to freqclk Songjun Wu
2018-09-24 10:27 ` [PATCH 08/14] serial: lantiq: Replace clk_enable/clk_disable with clk generic API Songjun Wu
2018-09-24 10:27 ` [PATCH 09/14] serial: lantiq: Add CCF support Songjun Wu
2018-09-24 10:27 ` [PATCH 10/14] serial: lantiq: Reorder the head files Songjun Wu
2018-09-24 10:28 ` [PATCH 11/14] include: Add lantiq.h in include/linux/ Songjun Wu
2018-09-24 10:28 ` [PATCH 12/14] serial: lantiq: Replace lantiq_soc.h with lantiq.h Songjun Wu
2018-09-24 10:28 ` [PATCH 13/14] serial: lantiq: Change init_lqasc to static declaration Songjun Wu
2018-09-24 10:28 ` [PATCH 14/14] dt-bindings: serial: lantiq: Add optional properties for CCF Songjun Wu
2018-10-15 21:58 ` [PATCH 00/14] serial: langtiq: Add CCF suppport Paul Burton
2018-10-16 9:05 ` Wu, Songjun
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=20180924102803.30263-4-songjun.wu@linux.intel.com \
--to=songjun.wu@linux.intel.com \
--cc=chuanhua.lei@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hauke.mehrtens@intel.com \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=yixin.zhu@linux.intel.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;
as well as URLs for NNTP newsgroup(s).