Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2384213imm; Mon, 24 Sep 2018 03:31:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV629mt2D79zz5DLY/BobeKvutKu3HD7XsG7wYi0D6n9IKyKnOIae2EzT5m4NpUTDGWXQUEv1 X-Received: by 2002:a17:902:8b8b:: with SMTP id ay11-v6mr9913778plb.1.1537785106343; Mon, 24 Sep 2018 03:31:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537785106; cv=none; d=google.com; s=arc-20160816; b=H2+UoWfUInEh76FwhbXD+gE28njyWWrIUqKb6Bmh08NH5vsGKja7knNe0/Dj97vRBO LzA21bNQ0NBm8JY05nClaD7+9puQJ5NNVXsnccCKnlnVB89CObfnLWPiP4YUJ5pnDsYV z1fdUmXGclWpSUJzwI4re5Ja0Am0ElN3StDe5oOR5FVDIHAY1wodBwpjcyUynDx5nfM3 LCXNdPQLMRAeRPvoRtFsvOrT5DFTUOtMfGLOh2+5ND/sApkrp+3yCeZwVkA2D0vFJzGI 7oXGAZ8AT80JCSMJaOdHl4wF6/9pDjGAspgflXTwcttwi7ymW82R3z5FDdMp09xXyahk d4Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=sOGhL8krhe+/Au46L4KC22f6W12s4eLC9uOaGMAeo5U=; b=Qi1hZgqHXnmqykxv6dflYd8pkjVfXIV1rNB2/3g2D5SH9Njl1NRhL506Qo9qNV0/Gi EufO76fYXPTsjj2QpSQ3EwTi94CTTQEBSNnSs4p4xSvcG4KQeBEbemYW3+8JgFR8vnYA yPC5Y7poB4EmGtdpeo2HYVY1X/pNc+6sdykidltvN3cuc5DM5aXNOJ0kT7MhLzHroXZr WAiYruRlL2yJjQxbfP6bB6jJ27m7uxJt8uKPyUA/5fR+l256DMjX0/1irALjyHZAslAD gaPhQEsksaFDPve83tusiCwcQBxAycWOg3AVvKROhAxXeX5og5XtwwNGnBgj2APLM7/m /8dQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w15-v6si10001342pgg.529.2018.09.24.03.31.31; Mon, 24 Sep 2018 03:31:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728745AbeIXQbA (ORCPT + 99 others); Mon, 24 Sep 2018 12:31:00 -0400 Received: from mga17.intel.com ([192.55.52.151]:3840 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727567AbeIXQa7 (ORCPT ); Mon, 24 Sep 2018 12:30:59 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Sep 2018 03:29:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,297,1534834800"; d="scan'208";a="266167973" Received: from sgsxdev001.isng.intel.com (HELO localhost) ([10.226.88.11]) by fmsmga006.fm.intel.com with ESMTP; 24 Sep 2018 03:28:35 -0700 From: Songjun Wu To: yixin.zhu@linux.intel.com, chuanhua.lei@linux.intel.com, hauke.mehrtens@intel.com Cc: Songjun Wu , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Jiri Slaby Subject: [PATCH 03/14] serial: lantiq: Get serial id from dts Date: Mon, 24 Sep 2018 18:27:52 +0800 Message-Id: <20180924102803.30263-4-songjun.wu@linux.intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180924102803.30263-1-songjun.wu@linux.intel.com> References: <20180924102803.30263-1-songjun.wu@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Get serial id from dts, also keep backward compatible when dts is not updated. Signed-off-by: Songjun Wu --- 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