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=-10.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=unavailable 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 CA777C433B4 for ; Tue, 13 Apr 2021 11:03:39 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 5AC4961249 for ; Tue, 13 Apr 2021 11:03:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5AC4961249 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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=MK/jWCy3XHjZLEp0tXbyMerfrVxUEFQrQ5hqIuEr0f0=; b=khR5JMOSof2bmIjYt+E/KMwlo 4xtn0ToRwWksqPSFR+UjUe0eBXLQu8FkQ1/aNHtE1w2mSwY2/GRD7ozx1v3l2KaQ9blObu1AWKYpk dHriJq2dzeZncQnvsTQk6dAPUi6LzvsIV32vpxnAhsy6m3H0K1sFSF4iBkPPf8E4yFlFnqm54hEOM /wER2DXP4mVElwrDX3HCwEonCRkrRWKzVu8AUxZnSiYPj72Q9tfr1C3LMs60HLKwTeBPz3dMdISQ5 goFakgFpwu46WspRnPSYnCY0YEOk1qJs74P6JWeIwvaSCK6tbo38iLpRmxGfJz80gLDSD/9KfFrv2 jg0DigW3g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lWGml-008wGR-3d; Tue, 13 Apr 2021 11:00:47 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWGl9-008w31-Is for linux-arm-kernel@desiato.infradead.org; Tue, 13 Apr 2021 10:59:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Sender:Reply-To:Content-ID:Content-Description; bh=Lyhk+eXcOM667zPPfyonrJY/+k3pFO7U7HmaEV1xA9c=; b=mIDMye9xGcBJJOfUfmM26SJWhn fo4Mtrj58p6Ff+PMGepbuGGJ023Zy6E6ezvW4IZo8JlJ/axu48kxMXcIYx2tuRwPkxwvz8XZ4UzVl VoCTDfGtdSQWIZr/mud/wHK5b3ZybqJn3tx50KPdliPX6mcqGxXtrwHDgHnPZidkfWLNC31W/gBsT ZERL1wYbPjoHf9TUIJjmz7Bzd23dhujtg75Nt1AisIBFy87X9Qgr0610A10+FW1MGRhDIy3omLeQ7 JWxU/oW6Wph7bGht4z62CNX3Ptemu4KgkVHwVjcsR94bv+iuT/fvqakTNc8cGadFU2yoz4VnIv81G i9JHRmtA==; Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lWGl6-006waP-Mh for linux-arm-kernel@lists.infradead.org; Tue, 13 Apr 2021 10:59:06 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C50E7113E; Tue, 13 Apr 2021 03:58:57 -0700 (PDT) Received: from slackpad.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5D3033F882; Tue, 13 Apr 2021 03:58:56 -0700 (PDT) Date: Tue, 13 Apr 2021 11:58:37 +0100 From: Andre Przywara To: Michael Weiser Cc: Chen-Yu Tsai , Rob Herring , Maxime Ripard , Jernej Skrabec , devicetree , linux-arm-kernel , linux-sunxi , Daniel Kulesz Subject: Re: [linux-sunxi] [PATCH] arm64: dts: allwinner: Revert SD card CD GPIO for Pine64-LTS Message-ID: <20210413115837.232c465a@slackpad.fritz.box> In-Reply-To: References: <20210412000813.13071-1-andre.przywara@arm.com> <20210412174558.4ba90cf8@slackpad.fritz.box> Organization: Arm Ltd. X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.31; x86_64-slackware-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210413_035904_868119_435B07F3 X-CRM114-Status: GOOD ( 34.03 ) 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 Mon, 12 Apr 2021 19:41:25 +0200 Michael Weiser wrote: Hi Michael, > Hi Andre, ChenYu, > > On Mon, Apr 12, 2021 at 05:45:58PM +0100, Andre Przywara wrote: > > > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dts > > > > index e79ce49e7e6a..843338e19694 100644 > > > > --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dts > > > > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dts > > > > @@ -21,5 +21,5 @@ > > > > }; > > > > > > > > &mmc0 { > > > > - cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 push-push switch */ > > > > + non-removable; /* card detect is broken on some boards */ > > > > > > So a revert is good, but has anyone tried using the "broken-cd" instead? > > Ha, that's a good idea, I totally forgot about this property! > > > > That way, at least on Linux, the mmc core resorts to polling for a card. > > > At least this way the card is still removable. > > Yes indeed, I tested it on my "stuck at 1" Pine64-LTS, and it works like > > a charm! > > > Daniel, Michael, can you test this on your boards? So removing the > > cd-gpios property, and adding "broken-cd;" instead? > > Yes, it works fine. What flummoxed me at first was that obviously I also > have to disable the ACTIVE_LOW definition in sun50i-a64-sopine.dtsi > after having added and disabled an ACTIVE_HIGH definition in > sun50i-a64-pine64-lts.dts. Why? From my experiments it should not matter, the actual card presence is typically detected via the SD bus anyway (if I understand the code correctly). broken-cd just prevents installation of an interrupt handler, so it's less efficient and prevents wakeup on card detect, AFAICS. But also: ACTIVE_HIGH *is* the right polarity, even for the Pine64-LTS. At least that's what an earlier report from Daniel suggested: => gpio input pf6 card inserted: value is 1 card removed: value is 0 So for your particular board (version) you could actually remove the whole &mmc0 node override, use the same node as the SOPine (working active-high CD) and it should work. > BTW: My boards have a marking "PINE64-R18-V1_1" and below it > "2017-08-03" on their upper side. On the back it says on one sticker > "Model:PineA64 2GB LTS" and on another "2O1-PINE64R18-00" and > "PINE64-R18-V1.1 2G". Is CD being stuck at 1 a bug of revision 1.0 > perhaps? Is there a way to detect this difference in software and add > some sort of quirk handler for it? As Jernej mentioned, this would be U-Boot's task, but I don't see a good reason for it. Firstly, you would need to find a good automatic way of determining the board revision, which I doubt there is. And secondly, I don't see the benefit: It works quite nicely with broken-cd: card removals and insertions are detected automatically, it's just not as efficient (interrupt-driven) as it could be. Or do you see any problems with broken-cd? Cheers, Andre _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel