Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3657537rwb; Fri, 30 Sep 2022 06:42:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4CJ9CRwdma73rBON1jKtNqXfcPhhHh9kaJGyv5UtvbYAanmSf1golTnS/UBhWbfMXJmRJ0 X-Received: by 2002:a05:6402:42d0:b0:457:d16e:283d with SMTP id i16-20020a05640242d000b00457d16e283dmr7837238edc.395.1664545334045; Fri, 30 Sep 2022 06:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664545334; cv=none; d=google.com; s=arc-20160816; b=JbWJKrqUiSP50P6yzFTdy58oF6aEhKG2goO5XZLPxu7MougvDJ8lCn95qHIkl9bIW0 oBJYh0+WQEbWn+B/TVq1+BCFlBReANm4f1ifYwM8tjhI+sHOxm2hbiBEf3Fxd1hHsTfT b9H2FDAWlmj/soBStg9ne8ZAFleJCj6+k4u4Qoju59DnN+3jxSy+4jXeQFfkdm7Fp/fY A8ycSZCCk+qp1OlqESU0IGOBGG3MoMjMO4DeyW/F/5CDIE4WSSjgSRM/2Dse1zbsJFaQ tsJ+ndQuNVxMuIKb1RBzWeTnscCiMz7Dw4sK5VLv6pi2nPIjAxRW7bEUi5GYfQQ4HPLS 29hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=g+SlRn5pJD4XsDGHGV/wglYs5CQVpAtpAzeBJ3yxK8Q=; b=082hOniU5aR8lti5zwkql7hgnfDxfXBgvlqajG/RAmhqxKYWBvXK++g/DQxya0bNCx sXK5EtIgd40jL7Jx+P35ktkmTGOsiIahrqdmkqd6X4lZOJz6FQoxomb2PyXpdmMDH9Fs BIxWhhfiZEbD+y07gjqa3uAdUijh3wKMrzJif8FLDA/Lq4nKSRwqzdZbTLrbBn9yDCXS 0812HMU4F4RkB6XlaaKsdtUm7Kr8x0VqRBT0n9TjvTlKNDmU5LVvXnZkwsyWipxdQHbx 1f8Swc+P8x53aAJPtyjupLxGsOoCy9feJoqwiLyByVeIxhG/SVJdsn9y5obs99CoHNU2 QIZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PMJ4OoyC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a1709064fcd00b0073cd3a15f42si2000581ejw.394.2022.09.30.06.41.43; Fri, 30 Sep 2022 06:42:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PMJ4OoyC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231305AbiI3M70 (ORCPT + 99 others); Fri, 30 Sep 2022 08:59:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231376AbiI3M7U (ORCPT ); Fri, 30 Sep 2022 08:59:20 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59BC617C204; Fri, 30 Sep 2022 05:59:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664542754; x=1696078754; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=aGb+VH6pr8odLrfr0RoPw5oUpFWoUrgu1R8DknSYFIw=; b=PMJ4OoyCEFsNpRDTsYSDv4Q3t4Ma0xa0Y7lY6S5HCc5/mBfIuHqocpDA IVCeAK/ax0tuh1H1WSZ+AvBCvMuiYigTg3W7ghaWJJhPyWgLbnHXd3cIq K55A6vduamfhjwTGilEBmTGYrpGfMgeiy3D7p60mFOF0Sm9E7o82oq1Rq wmwXtoO63hJiqLUZmIqmRWZ8wRO+JgKapwa57HjQel3BMZZQvwecm1Hcn mummpvz3aThsVYr/tnaf9VW8HqnfJDTzeUzF/k3ECK4GVa4fuuNgF/smy tufGwBtX6uzMrYWM9pEl4m3omIhjizFc5OsEkFVwGdJQmJ03UqMz8gM7p g==; X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="303094755" X-IronPort-AV: E=Sophos;i="5.93,358,1654585200"; d="scan'208";a="303094755" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2022 05:59:04 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="748221566" X-IronPort-AV: E=Sophos;i="5.93,358,1654585200"; d="scan'208";a="748221566" Received: from hbetts-mobl1.ger.corp.intel.com ([10.249.34.100]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2022 05:59:02 -0700 Date: Fri, 30 Sep 2022 15:59:00 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Sherry Sun cc: Greg Kroah-Hartman , Jiri Slaby , Lukas Wunner , linux-serial , LKML , dl-linux-imx Subject: RE: [PATCH] Revert "serial: fsl_lpuart: Reset prior to registration" In-Reply-To: Message-ID: References: <20220929085318.5268-1-sherry.sun@nxp.com> <1265873d-28f9-d39c-5cce-858dbed1e8e8@linux.intel.com> <39c68295-947-2353-d9b-3bd654c38c7@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 30 Sep 2022, Sherry Sun wrote: > > On Thu, 29 Sep 2022, Sherry Sun wrote: > > > > > > > This reverts commit 60f361722ad2ae5ee667d0b0545d40c42f754daf. > > > > > > > > > > commit 60f361722ad2 ("serial: fsl_lpuart: Reset prior to > > > > > registration") causes the lpuart console cannot work any more. > > > > > Since the console is registered in the uart_add_one_port(), the > > > > > driver cannot identify the console port before call > > > > > uart_add_one_port(), which causes all the uart ports including the > > > > > console port will be global > > > > reset. > > > > > So need to revert this patch to avoid breaking the lpuart console. > > > > > > > > > > Signed-off-by: Sherry Sun > > > > > --- > > > > > drivers/tty/serial/fsl_lpuart.c | 10 +++++----- > > > > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > > > > > > > diff --git a/drivers/tty/serial/fsl_lpuart.c > > > > > b/drivers/tty/serial/fsl_lpuart.c index 67fa113f77d4..7da46557fcb3 > > > > > 100644 > > > > > --- a/drivers/tty/serial/fsl_lpuart.c > > > > > +++ b/drivers/tty/serial/fsl_lpuart.c > > > > > @@ -2722,10 +2722,6 @@ static int lpuart_probe(struct > > > > > platform_device > > > > *pdev) > > > > > handler = lpuart_int; > > > > > } > > > > > > > > > > - ret = lpuart_global_reset(sport); > > > > > - if (ret) > > > > > - goto failed_reset; > > > > > - > > > > > > > > So the problem with this being so early is uart_console() in > > > > lpuart_global_reset() that doesn't detect a console because > > > > sport->cons is not yet assigned? Couldn't that be worked around > > differently? > > > > > > > > Or is there something else in addition to that I'm missing? > > > > > > > Hi Ilpo, > > > > > > Yes, the root cause of the console cannot work after apply the commit > > > 60f361722ad2 ("serial: fsl_lpuart: Reset prior to registration") is > > > lpuart_global_reset() cannot identify the console port, so reset all > > > uart ports. > > > > This didn't answer my question. Is the main cause just lacking the ->cons > > from sport at this point which, I guess, could be just assigned from lpuart_reg > > similar to what uart_add_one_port() does before calling to reset? > > > > Hi Ilpo, > > Actually not only the (port)->cons need to be assigned, but also to get the right (port)->cons->index. > 23 #define uart_console(port) \ > 24 ((port)->cons && (port)->cons->index == (port)->line) > > The (port)->cons is assigned in uart_add_one_port(), quite simple. > 3076 uport->cons = drv->cons; > > But the (port)->cons->index is not that easy to get in lpuart driver, > now the value is assigned by calling register_console() from > uart_configure_port(). I've some skepticism to this claim. I now played with 8250 myself and confirmed it does have non-NULL ->cons for the console ports before to calls to uart_add_one_port() and index is setup up correctly for cons too! The reason for the cons being setup is this being done in univ8250_console_setup(): /* link port to console */ port->cons = co; (which I think could be easily be done in lpuart_console_setup() too). -- i.