Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B706AC6FA8F for ; Wed, 30 Aug 2023 09:24:02 +0000 (UTC) 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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ejVxQfUOygpefH41hRAaay2OUINQ0lA4oRCoyXrISE4=; b=tHCpA5FPme1MgK cotyKAKSnETdCl9Q3dwoSeGRK/85HSImMfU9D2eN/s/pjqjuL5Lpz3Nm280FE/4cu70nmWOLixXGK GVerXOC5+k2p/LEzDl22J5V1wsNtE5srikYeauUydKjK694ntffbZeVLyR8/Sks+X+t3mkaRUOqZ7 FWiym+ZFgJi6bdBLNGOj4G7y4qZMHbzdGmab/XQgqa2nXTiTJkfnYtPcmYFxFfDChNML+jP4c1obW z2aGeeaaQwr1XAqCSUL8gZ55b+UzXywaeNsW7h+fmScXx4xp0unTUb9CdHuASMzdQKTtxcrBcmFZ9 CmNsn0wlkih8AXsfGgIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qbHQG-00D9BQ-2X; Wed, 30 Aug 2023 09:23:36 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qbHQD-00D9Av-2g for linux-arm-kernel@lists.infradead.org; Wed, 30 Aug 2023 09:23:35 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-401ec23be82so3170615e9.0 for ; Wed, 30 Aug 2023 02:23:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693387410; x=1693992210; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=t/81QQGv6+7ZEp2Cu2UEv1g4xNamuWwLFUQrjsypzac=; b=eMNENrOSzM7MK6vRbTkp3RC92vATxwnuCvm9jnnvQ8lnA7EbqoFAlDOlZ42UkMpXzZ gE+j4Styb9J3AT2l+Qhgz6VMKMouZ52OBRQQD0PuTcnJyIcaE/NpDdfnNBauoawFAR96 fTqsnlsLV2nm7jUcHPmEbkLn4tvQzpL3aKmIU3RH+S74BT6agaDhCKAM0WhZuZEi1Zgz MZlkxKoyQ1MrFfxYQtFGmIZnHmkUB7ahIEuzkoL0DFliEkjpsufNPz/y/vXlhyzQDsh3 DVZG6sDr31lYmkCyaKEORgWhZ8D4bPS7zTW67IuRyjhPHELnQ9DNE4WXhpw9gsvsLI6t Ditw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693387410; x=1693992210; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=t/81QQGv6+7ZEp2Cu2UEv1g4xNamuWwLFUQrjsypzac=; b=NY65RHxfpGgldiS4x30lcjGGakTXUpMWSThwkaqWkl3zMd65YU6hJnP+VtJ+k9R0w0 Lws4CmR/6eejM00++nsMku4QzpwiyFLrrDB4QLC8Q20wxU0P8lqV+q5wEsi+GdMnTIyc e5clQ0lRHzozQgC54Jm329gojiflEJgXNvGdXYOjxEPB1uRIXIgKiYsJOzSh8GuelLPw KUuvRSFxDP3W45FrIPgWIRrtkAUOQ8AyDuFoWTOYQu7O6Ybu9wr3w0hVdyHU1YeelP1V DulHSLh0EI1rTf+45g+iWmWdWecT+sYnWi6+NWoWCNzMNU/H6yc9jmVN5RofL4eOOukM u+xw== X-Gm-Message-State: AOJu0Yz63uFN3j8/aIkB+utLjBqfKi4UQ9x9r077aCJrxA6hAkzUwgWb CCEG/B66nXlX6wxJ3sry1ck= X-Google-Smtp-Source: AGHT+IHtj4ByG/r/IQgNm1JKGqbW9lPk50KHeW15cvf2mdpCbUSgOA4+5UHSmOOIOWyB+U6lZ6Pbhg== X-Received: by 2002:a7b:cb8a:0:b0:401:b2c7:349b with SMTP id m10-20020a7bcb8a000000b00401b2c7349bmr1358248wmi.7.1693387410198; Wed, 30 Aug 2023 02:23:30 -0700 (PDT) Received: from latitude-5411.. (elsys-cachan-ftto-main-190-130.fib.nerim.net. [194.79.190.130]) by smtp.gmail.com with ESMTPSA id c24-20020a7bc858000000b003feef5b0bb7sm1631028wml.40.2023.08.30.02.23.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 02:23:29 -0700 (PDT) From: mathieu To: ludovic.desroches@microchip.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com Cc: Mathieu Moneyron , linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] mmc: Fix force card detect in sdhci Date: Wed, 30 Aug 2023 11:23:14 +0200 Message-Id: <20230830092314.624212-1-mathieu.moneyron@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230830_022333_868252_A1541C69 X-CRM114-Status: GOOD ( 13.10 ) 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 From: Mathieu Moneyron On the ATMEL at91 when using the non-removable flag in device tree and not using the card-detect pin inside the device-tree pinctrl, the card detect pin is physically still used which can cause unknown behaviour when this pin is used for other purposes. From my interpretation this seems to be caused by a hardware design flaw and the real hardware is not working as intended by the documentation. Signed-off-by: Mathieu Moneyron --- drivers/mmc/host/sdhci-of-at91.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c index 69fef88e7..4fd6bfbf6 100644 --- a/drivers/mmc/host/sdhci-of-at91.c +++ b/drivers/mmc/host/sdhci-of-at91.c @@ -51,10 +51,15 @@ struct sdhci_at91_priv { static void sdhci_at91_set_force_card_detect(struct sdhci_host *host) { u8 mc1r; + u8 ctrl; mc1r = readb(host->ioaddr + SDMMC_MC1R); mc1r |= SDMMC_MC1R_FCD; writeb(mc1r, host->ioaddr + SDMMC_MC1R); + + ctrl = readb(host->ioaddr + SDHCI_HOST_CONTROL); + ctrl |= SDHCI_CTRL_CDTEST_INS | SDHCI_CTRL_CDTEST_EN; + writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL); } static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock) -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel