Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp1444710imk; Mon, 4 Jul 2022 03:16:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uU7exHjTTCRcailw2DDMgzyJ+u1aUzI9BUu7+kPCwv9WzGEQ+ic7wa5/kj85jP+VtD9tj/ X-Received: by 2002:a17:907:d19:b0:726:c8a0:c9ef with SMTP id gn25-20020a1709070d1900b00726c8a0c9efmr28200782ejc.435.1656929773995; Mon, 04 Jul 2022 03:16:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656929773; cv=none; d=google.com; s=arc-20160816; b=JrMEtbVeiCXFTcCEXd7t2vUNfsOFnZBMhTu3nX62jsavgO6iYSkbjY6pa4M84cvifz p8eckNtnlawhFZcZjLVKDecQ81Hik5bVZucuRLX6v+Hk7++Pop69GgvEJhJ/1HwpDUCp qg+Ua5+8CLNZuLUl5IcNLYDx5eEPgSJlghoYbOw3YWzHsRXSojDefsFEQXRsSZMfbRZP UPDF1kbeQWf5BzZsg9JpIUWSK3eJIEvH+1Z8KnhyfPE7//V/sCURvLVv/CtqZuJejbkY JlRUn70CLl4sbKkFEA9mOfVuuVD3glhLjnkCYpRL29peUtuAQ8k5+85pFhuYsLJ1V2/7 L3oA== 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=FaX0ahn1fJSKPj/PaJMpmE4cYLOzJ0+OtnZqVlTLG14=; b=N/R4+L92p211yWTf/Ti+PFMBm5+zylzcjpicSgSvMNjjY2PUOhotjdvJWSvTRTkhr7 uB+MTzrCgaPV3hYnRcBO9CA9y3EDL9CnRKlaC7Gh9W08Ug1AUI1+SD2ByPq/jtx7LuI6 XpDC9lzMes+rj5s3m76+tfI47Yu3BGwzzTtCS4ZtmFly2NvHPDyXUsrSc3Og5bQNxHSh WQ9zbokd36xDC37Ep6plvOc8DXF9HM2h/3Ebnw94KgvydScoR65AD2joSz3NdE8wHvzO skMmpUspcNmSceier99TUWifn7QjtNZ808COPx8rKySlzivax2A+JjNr6USIXIULUR40 EQww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lmG9yypP; 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 r13-20020a170906364d00b00726b8363630si4589734ejb.923.2022.07.04.03.15.49; Mon, 04 Jul 2022 03:16:13 -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=lmG9yypP; 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 S233785AbiGDJvi (ORCPT + 99 others); Mon, 4 Jul 2022 05:51:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232403AbiGDJvh (ORCPT ); Mon, 4 Jul 2022 05:51:37 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6EAA63FE; Mon, 4 Jul 2022 02:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656928296; x=1688464296; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=NHDN/2lSyCT1GEduT2MlDHQYpJlzlmnBsu/bQ+QOiwY=; b=lmG9yypPkV9Lasrb+xCHrXH0BqKGcHC+tjAdjgmVyd3WUy+UZPOiKxi0 HDK2hTfwQebWnP3ZHc34U2DWSquqzZzKAjuSJJ1FZJ2O0WLggpCEAJIt7 9IonfVhbA1piln5ZICEnZ5YJhEYvccjctBQt5fsaGJRUdmzEADp02u9kj v2jW+154Wmni5bzfIdFG0LQllOKcv8wjnMqUTx5LpE8d6KR8URzeqEoLl 2Dj5nbecpHPxXyh3gmkJuVCJhG8WVW+MriN8nLYZxWROSZNPzLVaeHtxZ kVlk8Mim8cjmQgw+OTJa74qaopVuZ1Y0bMz50RsabaB31Mi8zm4Nd0nR8 w==; X-IronPort-AV: E=McAfee;i="6400,9594,10397"; a="369413044" X-IronPort-AV: E=Sophos;i="5.92,243,1650956400"; d="scan'208";a="369413044" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jul 2022 02:51:36 -0700 X-IronPort-AV: E=Sophos;i="5.92,243,1650956400"; d="scan'208";a="649511538" Received: from bclindho-mobl.ger.corp.intel.com ([10.252.49.27]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jul 2022 02:51:31 -0700 Date: Mon, 4 Jul 2022 12:51:28 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Lino Sanfilippo cc: Greg Kroah-Hartman , Jiri Slaby , robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, Andy Shevchenko , vz@mleia.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-serial , LKML , Lukas Wunner , p.rosenberger@kunbus.com, Lino Sanfilippo Subject: Re: [PATCH v2 2/9] serial: core, 8250: set RS485 termination gpio in serial core In-Reply-To: <20220703170039.2058202-3-LinoSanfilippo@gmx.de> Message-ID: <355354ef-61ff-692d-aad-3b5721db420@linux.intel.com> References: <20220703170039.2058202-1-LinoSanfilippo@gmx.de> <20220703170039.2058202-3-LinoSanfilippo@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Sun, 3 Jul 2022, Lino Sanfilippo wrote: > From: Lino Sanfilippo > > In serial8250_em485_config() the termination GPIO is set with the uart_port > spinlock held. This is an issue if setting the GPIO line can sleep (e.g. > since the concerning GPIO expander is connected via SPI or I2C). > > Fix this by setting the termination line outside of the uart_port spinlock > in the serial core and using gpiod_set_value_cansleep() which instead of > gpiod_set_value() allows to sleep. > > Beside fixing the termination GPIO line setting for the 8250 driver this > change also makes setting the termination GPIO generic for all UART > drivers. > > Signed-off-by: Lino Sanfilippo > --- > drivers/tty/serial/8250/8250_port.c | 3 --- > drivers/tty/serial/serial_core.c | 12 ++++++++++++ > 2 files changed, 12 insertions(+), 3 deletions(-) > > diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c > index ed2a606f2da7..72252d956f17 100644 > --- a/drivers/tty/serial/8250/8250_port.c > +++ b/drivers/tty/serial/8250/8250_port.c > @@ -676,9 +676,6 @@ int serial8250_em485_config(struct uart_port *port, struct ktermios *termios, > rs485->flags &= ~SER_RS485_RTS_AFTER_SEND; > } > > - gpiod_set_value(port->rs485_term_gpio, > - rs485->flags & SER_RS485_TERMINATE_BUS); > - I sent a series to make .rs485_supported per uart_port and properly set SER_RS485_TERMINATE_BUS according to DT config. With that series added first, SER_RS485_TERMINATE_BUS should also be removed from serial8250_em485_supported so that serial core can properly manage it all. -- i.