From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 330C1C433F5 for ; Wed, 22 Sep 2021 03:05:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EE9856058D for ; Wed, 22 Sep 2021 03:04:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EE9856058D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qSmQrDEYYGwOPlFd/ooVZAAh/5oFTloLagFcxGyrA6c=; b=ipvwac8WPB1XqF jBSpGqMpCH5K+34rOgIzRM/34cemZSRjay8/YBZ9c3nlrIivY3gff5ObMb2xxGV3WGQm73B6F36Gw cw+Ud2gLNtnGqO+HWlG2nPsP9LoF/lOtwvNEZYy5c5KH0sTGP3nnqXxlwuFjJKeduAJAcWOPpEVkD RToPROxwpIZKNhp7gUuyw7xrVBd6DyBL5qk0JQwCRHGOZBmJCr4nYP03TCS1/AfxUfnmOvgiOiGg4 QF+j0UzMe87tZ48B1QLkyxwJPNQ1+dVjztfZsAlX4tzX6ShsevjnSonmbDu3+QpF47WosJQ33eX/C 2wkhQpM8b1B0WH9wXE7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mSsXG-006mXa-Vk; Wed, 22 Sep 2021 03:03:04 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mSsX9-006mWA-Mk for linux-arm-kernel@lists.infradead.org; Wed, 22 Sep 2021 03:02:57 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 803B36115A; Wed, 22 Sep 2021 03:02:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632279775; bh=gbXp1OzhltdwABWo8FCeRIcFrFdZB3m50p38nWgs0WU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=As8U2FRekFDz2u20MA8TTVsTjIePZesyhM0KkdR7OiS8ad6YYxRGPGTpns49S5tnX n8yUuqFUN/eD2XbCcnkrOARbPtyknmFZY+ozxzKhS30Yryb6H1Vc1Tu5l3l9KXJuIj dapkQHT3UFhzw0kPC1rTD3rHzM0+1Q3Fwv+87Wz2T6CNkP5TaFmRpuWqHE2U/doj1o wnOSQuTBVR7l9Rzd1AVatPOXGoBz+MsSfZAW2xyJwLBFRNME45W/IOHHilxu2DOIkg +22f6tUvkQ/ilp+qvmKLR5qg5bilutxkJia3uccSR5DV3ardN2TPFKiOb2Qn2bK6GN Ln4xpY2TioUsw== Date: Wed, 22 Sep 2021 11:02:50 +0800 From: Shawn Guo To: Fabio Estevam Cc: linux-arm-kernel@lists.infradead.org, o.rempel@pengutronix.de, Markus.Niebel@tq-group.com Subject: Re: [PATCH 2/4] ARM: dts: imx6qp-prtwd3: Fix the SPI chipselect polarity Message-ID: <20210922030250.GF10217@dragon> References: <20210716133659.3372047-1-festevam@gmail.com> <20210716133659.3372047-2-festevam@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210716133659.3372047-2-festevam@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210921_200255_862355_C44A143F X-CRM114-Status: GOOD ( 24.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Jul 16, 2021 at 10:36:57AM -0300, Fabio Estevam wrote: > The conversion of the spi-imx driver to use GPIO descriptors > in commit 8cdcd8aeee28 ("spi: imx/fsl-lpspi: Convert to GPIO descriptors") > helped to detect the following SPI chipselect polarity mismatch on an > imx6q-sabresd for example: > > [ 4.854337] m25p80@0 enforce active low on chipselect handle > > Prior to the above commit, the chipselect polarity passed via cs-gpios > property was ignored and considered active-low. > > The reason for such mismatch is clearly explained in the comments inside > drivers/gpio/gpiolib-of.c: > > * SPI children have active low chip selects > * by default. This can be specified negatively > * by just omitting "spi-cs-high" in the > * device node, or actively by tagging on > * GPIO_ACTIVE_LOW as flag in the device > * tree. If the line is simultaneously > * tagged as active low in the device tree > * and has the "spi-cs-high" set, we get a > * conflict and the "spi-cs-high" flag will > * take precedence. > > To properly represent the SPI chipselect polarity, change it to active-low > when the "spi-cs-high" property is absent. ... > The conversion of the spi-imx driver to use GPIO descriptors > in commit 8cdcd8aeee28 ("spi: imx/fsl-lpspi: Convert to GPIO descriptors") > helped to detect the following SPI chipselect polarity mismatch on an > imx6q-sabresd for example: > > [ 4.854337] m25p80@0 enforce active low on chipselect handle > > Prior to the above commit, the chipselect polarity passed via cs-gpios > property was ignored and considered active-low. > > The reason for such mismatch is clearly explained in the comments inside > drivers/gpio/gpiolib-of.c: > > * SPI children have active low chip selects > * by default. This can be specified negatively > * by just omitting "spi-cs-high" in the > * device node, or actively by tagging on > * GPIO_ACTIVE_LOW as flag in the device > * tree. If the line is simultaneously > * tagged as active low in the device tree > * and has the "spi-cs-high" set, we get a > * conflict and the "spi-cs-high" flag will > * take precedence. > > To properly represent the SPI chipselect polarity, change it to active-low > when the "spi-cs-high" property is absent. So the commit log was written twice? I will fix it up. Shawn > > Signed-off-by: Fabio Estevam > --- > arch/arm/boot/dts/imx6qp-prtwd3.dts | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/boot/dts/imx6qp-prtwd3.dts b/arch/arm/boot/dts/imx6qp-prtwd3.dts > index c42723989bc0..1a334918f9ca 100644 > --- a/arch/arm/boot/dts/imx6qp-prtwd3.dts > +++ b/arch/arm/boot/dts/imx6qp-prtwd3.dts > @@ -123,7 +123,7 @@ &can1 { > }; > > &ecspi2 { > - cs-gpios = <&gpio2 26 GPIO_ACTIVE_HIGH>; > + cs-gpios = <&gpio2 26 GPIO_ACTIVE_LOW>; > pinctrl-names = "default"; > pinctrl-0 = <&pinctrl_ecspi2>; > status = "okay"; > @@ -189,7 +189,7 @@ fixed-link { > }; > > &ecspi3 { > - cs-gpios = <&gpio4 24 GPIO_ACTIVE_HIGH>; > + cs-gpios = <&gpio4 24 GPIO_ACTIVE_LOW>; > pinctrl-names = "default"; > pinctrl-0 = <&pinctrl_ecspi3>; > status = "okay"; > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel