Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2969201imm; Fri, 10 Aug 2018 01:14:43 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwqSt1GdxLvAxdCS1eKhWSFWk6Q3oSpzXLS+pTsgW+cvsUNCVvImbYSUVjdcsb5Z19hNsHC X-Received: by 2002:a17:902:1566:: with SMTP id b35-v6mr5168154plh.135.1533888883052; Fri, 10 Aug 2018 01:14:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533888883; cv=none; d=google.com; s=arc-20160816; b=EgW3AfDSeCFMmh5MZxg4TdmG2BpbkXAYoWgH25LztkLzaOZKTCc657itJAanB9H7Fw 5ivVE35Ch0O2IOaPc0XJbUiASEeHO0eE7UzTwF2+UlqWLmzq2QVsXzbOzGsM4H6PJUw5 mWcKVlVsb1BCOmI9QEli0CVr0C6q5swi+ZcDqtdlCbuRfDVJ3e1t4gfgfNz8rEai2m8f O2+fIQYp5EWTEjLHzWb0LvRsLCb4MJBqy86mTpL8XfofK/iqXwOH71VRJ7TJwh5tscbM fkabQmORsF2fXWsVAAoGWQiRXBSJbIBOzTqnQI0jbBET73aXBVX2foNYADxTEcccqtDi TDJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=TbWS3bk5twMPND4XCW/7McXhDHkdONwmxdCCc1g4oUA=; b=TSG/PrwBN4gNrRj9T5s31ts5OOydSECCQa+9YZHQdA7O4Yt5fCbfJE0EMuVV/iQtCB SbgszTtbY7Y6DAn0tKhIMu6G7KM6AXDiWzhVrl5Vamxxk2/hfZEcR8zJrFp3WGe9RvWb 3kLsGpuF0ECCuxG6cVDM/5vq2egOVXMgDHRcZdfLaCSul6l3+FO1mVofG/zfps8YEuxd uDByN4UCJGyfYGosnwRnL1TPyUShZ39hdnffsq+lyDu/oCfVgMH3BpgF8J0/ooEXM1bT 6chudbMiOkpDI3+L8m6/5mmexJhAQxCsmmV6rgFk9qYhkqIPK9a1+XVWMfa1hUwo1FTp jN+g== 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 y6-v6si10164953pgr.684.2018.08.10.01.14.28; Fri, 10 Aug 2018 01:14:43 -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 S1727316AbeHJKm0 (ORCPT + 99 others); Fri, 10 Aug 2018 06:42:26 -0400 Received: from mga07.intel.com ([134.134.136.100]:16472 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726610AbeHJKm0 (ORCPT ); Fri, 10 Aug 2018 06:42:26 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Aug 2018 01:13:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,218,1531810800"; d="scan'208";a="247714793" Received: from songjunw-mobl1.ger.corp.intel.com (HELO [10.226.39.42]) ([10.226.39.42]) by orsmga005.jf.intel.com with ESMTP; 10 Aug 2018 01:13:35 -0700 Subject: Re: [PATCH v2 08/18] serial: intel: Get serial id from dts To: Geert Uytterhoeven Cc: hua.ma@linux.intel.com, yixin.zhu@linux.intel.com, chuanhua.lei@linux.intel.com, qi-ming.wu@intel.com, Linux MIPS Mailing List , linux-clk , "open list:SERIAL DRIVERS" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Greg KH , Linux Kernel Mailing List , Jiri Slaby References: <20180803030237.3366-1-songjun.wu@linux.intel.com> <20180803030237.3366-9-songjun.wu@linux.intel.com> <734bddbc-a5aa-d50d-0e7b-d8adc4d1afb2@linux.intel.com> From: "Wu, Songjun" Message-ID: Date: Fri, 10 Aug 2018 16:13:34 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/8/2018 4:33 PM, Geert Uytterhoeven wrote: > Hi Songjun, > > On Wed, Aug 8, 2018 at 6:05 AM Wu, Songjun wrote: >> On 8/7/2018 3:33 PM, Geert Uytterhoeven wrote: >>> On Fri, Aug 3, 2018 at 5:04 AM Songjun Wu wrote: >>>> 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 >>> Thanks for your patch! >>> >>>> @@ -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; >>> Please note that not providing a fallback here makes life harder when using >>> DT overlays. >>> See the description of commit 7678f4c20fa7670f ("serial: sh-sci: Add support >>> for dynamic instances") for background info. >> Thanks for your comment. >> The logic in commit 7678f4c20fa7670f is not suitable here. >> We need to know which serial instance is used for console. >> We cannot use dynamic serial instance here. > Why does the driver need to use which serial instance is used for the console? > Hardcoding that is not an option, as the board DTS may specify the console using > chosen/stdout-path. In legacy platform in open source, it only defined asc1 in dts. There's no asc0 in legacy dts.While in the new platform, asc0 is defined in dts. There's no asc1 in new platform dts. To avoid hard code in driver, alias serial0 is used to unified driver code. Actually only one serial is supported in SoC. aliases {         serial0 = &asc0; }; chosen {     bootargs = "earlycon  clk_ignore_unused";     stdout-path = "serial0"; };