Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp322248imm; Thu, 2 Aug 2018 20:06:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcT+bg9KbA5m5BuVH+QiqqLpwAgZ+Y4Ham6Cwauya205Qto+ggQGPBogr5cuhSR2q49otUw X-Received: by 2002:a65:428b:: with SMTP id j11-v6mr1882001pgp.200.1533265571820; Thu, 02 Aug 2018 20:06:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533265571; cv=none; d=google.com; s=arc-20160816; b=Bw3FRv1NyW3qKRvBjW00LRhAGmRgtOV5TJ6mUlMSKSkOQ/srTgxk0pUMYRP/uGtbQ1 6TNYImiSMdTn9KjGaWupjLsc+ov3Qa3/NStrCRpT/VtM85zU0iQ/OI1CjxqCPM5flv4a h4gkHKZ2+qnXS2xywc380ilXjGoQ2MkByl1LrWYohjrKZzV482cfYo2CpKOtRGDvlUk/ ZUPpjaNXcQMgzsXfCzlcqGar/1liAlVPDUszonc1psED8BcIRloaEuYH0GGgzM0o1C7C AYBkqCk0udtQM6TXJROIzmoV18Fkmf7igRfQWMlQg0EsN6LIUp0L9gxlDH9vhoS2hssq nEqg== 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:arc-authentication-results; bh=Zu8UyAS9Rfbc+QVq6Hw8lcZEGej6yVCwXl+2DpQGBxY=; b=Lco6gR7iJ7K2J+CuHtNqPMl1emNaIxH/mrcdLkJZQSKN3Pwgtm+SzBhklbqXrtK5+D UTNG3V+xJRhL9XnUxxgra/Y1md/j6E4Bte5zcNP1DTm+82mohQMt8/qqQ+SGQWnhWRn6 9IfbRod/lmfKkOhN5ZaIXzyt74d9diiJ6lbEZcM4YYZComkxhtMtZUXDvIboQzia0qDJ hy03fw8sX9bjhrEGTrs2D5aIpqpI03DzOdZe86fEYuV1+xBnpSF4Np8/rSAtdsGAqNgr SDbapqYF9Rnzl1jwut/6z4A0XrjgJrOui3Th6NPX9tySmuwOvm0D8xSLz/itLoisAMuV R8Iw== 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 2-v6si3892603pgq.479.2018.08.02.20.05.57; Thu, 02 Aug 2018 20:06:11 -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 S1728457AbeHCE6O (ORCPT + 99 others); Fri, 3 Aug 2018 00:58:14 -0400 Received: from mga09.intel.com ([134.134.136.24]:36429 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726841AbeHCE6N (ORCPT ); Fri, 3 Aug 2018 00:58:13 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Aug 2018 20:04:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,437,1526367600"; d="scan'208";a="61696583" Received: from sgsxdev001.isng.intel.com (HELO localhost) ([10.226.88.11]) by orsmga007.jf.intel.com with ESMTP; 02 Aug 2018 20:04:03 -0700 From: Songjun Wu To: hua.ma@linux.intel.com, yixin.zhu@linux.intel.com, chuanhua.lei@linux.intel.com, qi-ming.wu@intel.com Cc: linux-mips@linux-mips.org, linux-clk@vger.kernel.org, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, Songjun Wu , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Jiri Slaby Subject: [PATCH v2 08/18] serial: intel: Get serial id from dts Date: Fri, 3 Aug 2018 11:02:27 +0800 Message-Id: <20180803030237.3366-9-songjun.wu@linux.intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180803030237.3366-1-songjun.wu@linux.intel.com> References: <20180803030237.3366-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. "#ifdef CONFIG_LANTIQ" preprocessor is used because LTQ_EARLY_ASC macro is defined in lantiq_soc.h. lantiq_soc.h is in arch path for legacy product support. arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h If "#ifdef preprocessor" is changed to "if (IS_ENABLED(CONFIG_LANTIQ))", when CONFIG_LANTIQ is not enabled, code using LTQ_EARLY_ASC is compiled. Compilation will fail for no LTQ_EARLY_ASC defined. Signed-off-by: Songjun Wu --- Changes in v2: None 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..836ca51460f2 100644 --- a/drivers/tty/serial/lantiq.c +++ b/drivers/tty/serial/lantiq.c @@ -6,6 +6,7 @@ * Copyright (C) 2007 Felix Fietkau * Copyright (C) 2007 John Crispin * Copyright (C) 2010 Thomas Langer, + * Copyright (C) 2018 Intel Corporation. */ #include @@ -688,7 +689,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 +700,19 @@ 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) { +#ifdef 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; +#endif + } if (lqasc_port[line]) { dev_err(&pdev->dev, "port %d already allocated\n", line); -- 2.11.0