Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp354067rdh; Sat, 23 Sep 2023 13:31:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPdhofU5JTYA+QYKJ2MVVXXzWg2TdZVK/UDMVw1hTwaJcmGT2f9TWjAtcqMQ726j2AoVo7 X-Received: by 2002:a05:6e02:b28:b0:34f:fb92:2082 with SMTP id e8-20020a056e020b2800b0034ffb922082mr4554262ilu.16.1695501107267; Sat, 23 Sep 2023 13:31:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695501107; cv=none; d=google.com; s=arc-20160816; b=IBZ+psbq4CujzYN1KNzlBf97HsAgjKxKkkBQ6r3JIWB0dxtr8zPPJxec6SIXIXymi1 chFj/D6m7mwa5oDWbnOmnSlMNvmxscnU1xEMtggSFnlN1UrcnFHTN+arrUjrXJgyrY1H FvrbtYteRkZt5LGMQtOAC0T16W+l04TrxDNEQsMO+/CCzcVd6PqGGJAft2S5Wc+3JZ1o 4Bv/TsPOcMDbuuHRvVKineGUh8zzUFZCGxSNuGcLiJXorrvcNFrIYyDVEXvAmpm1Bbd4 07BrwGnqHDnrb6REqGx5qoS2k7zCRIgCHZwyMNFzZ3viiVSxxHCUc+P7bhHs9zQfn4FJ Tzng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=vpYjMEkPgaR+j5nbb/av2E2WnTsE4WznMsWpBW0ZmAc=; fh=Zp1aR2urg9VNBrDgvSFI4VDHBhicZ0235K8WL3Y9kNA=; b=vYo4ipHMMlRjp6PkJ8+SHJXO8DOGE7yFmgfiDtlk48UD/hCSHBAo8lqKhqA/ZL2JUe Fx6lKmOYFzX42YX42ksCNzihFPS/isZysvW2gBgidqBkjZ0WDPS4IRhpHs2lz+EZWAAC 5aC4wltFH5DsSdr7vqx+2WvsMaDts8EIY31DR/MmHr8siVb6XiQSCkvqXC1QuV0KlXfG qTOBTlQXSY3UDkeg1lz94XMFMzBMxICNOmNexF99aBwlHox2amsjXFFb4AvdwluzNKBy qp3/cLlBcWeRMfop0lSy0ic77uTydADslBPvYi/4NXYL9sOLH0s+HZMANStDJfKMU2hv hJng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=TH+ihEJw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id h184-20020a6383c1000000b005777bea0b5esi4840437pge.901.2023.09.23.13.31.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 13:31:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=TH+ihEJw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 915D08078319; Sat, 23 Sep 2023 05:44:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231285AbjIWMo7 (ORCPT + 99 others); Sat, 23 Sep 2023 08:44:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230379AbjIWMo6 (ORCPT ); Sat, 23 Sep 2023 08:44:58 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EA01127; Sat, 23 Sep 2023 05:44:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1695473092; x=1727009092; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=hu5RoWjkAL+0NsE2efBSQIgp8d2u2PNDE0fCKAETueQ=; b=TH+ihEJwnYTS1fwotVj8vFma5YCJJtrPnCcOYrvypDvNQ5fwMYjPDrlD 4kWgj+csStf/vzusf3iLLAYW5FloNKtmJv8FMw87BKNaYb2NvvRJ1Fjgd 1JnJCC0tD/IvOCtRLb9ONVhwCteFrVQ0p9caaPyCWNVye8un3KUAlninH UQydZgLUvWT/F3IEb4ZBVia1zpzfnWTvAXetdQqsb4GhLBYWhAKvIqavx +YCvwb9RRJ9tZ0o8QD8WaNx326Nq10HwKw4uZAGLvrMAo1r+SSy3ptrsa K0ff3l2fzv5P5CfBfL/7rWdKzX6IKZTQ8INyJn4vd/akm/I40TqaMKsb8 g==; X-CSE-ConnectionGUID: AP7+RHyPQpK3JA0Ko4wGwA== X-CSE-MsgGUID: wDhoZVAPQGi3bNolcUsGUw== X-ThreatScanner-Verdict: Negative X-IronPort-AV: E=Sophos;i="6.03,171,1694761200"; d="scan'208";a="6214214" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 23 Sep 2023 05:44:52 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Sat, 23 Sep 2023 05:44:51 -0700 Received: from [10.171.248.13] (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Sat, 23 Sep 2023 05:44:49 -0700 Message-ID: <9a311ce3-0d29-af39-5533-c1cad6de1300@microchip.com> Date: Sat, 23 Sep 2023 14:44:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH] mmc: Fix force card detect in sdhci Content-Language: en-US To: Mathieu Moneyron , Adrian Hunter , Ulf Hansson , "Alexandre Belloni" , Eugen Hristev CC: Ludovic Desroches , Nicolas Ferre , , , References: <20230830092314.624212-1-mathieu.moneyron@gmail.com> <096e9122-23b8-5a36-7779-28994187c620@intel.com> From: Aubin Constans In-Reply-To: <096e9122-23b8-5a36-7779-28994187c620@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sat, 23 Sep 2023 05:44:57 -0700 (PDT) X-Spam-Level: * On 04/09/2023 09:38, Adrian Hunter wrote: > + Eugen Hristev > > On 30/08/23 12:23, mathieu wrote: >> 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. Hi Mathieu, On which SoC(s) exactly, has this behaviour been observed? Also, has this issue been discussed in any separate support request, in such case we could retrieve some background from it? By "unknown behaviour", do you mean "the card insertion status would follow whatever electrical level is seen on the card-detect pin"? >> >> 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) Kind regards, Aubin