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 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E757ECCA47D for ; Wed, 22 Jun 2022 13:31:20 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A4D0B83E71; Wed, 22 Jun 2022 15:31:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="xIWEZ1s9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 47ABC83E9F; Wed, 22 Jun 2022 15:31:17 +0200 (CEST) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 39BEC83AB5 for ; Wed, 22 Jun 2022 15:31:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Sergiu.Moga@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1655904674; x=1687440674; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=/ZcmtxzHQbtQsdR+uLQE64TcZi68tgJ3c9/meJaGw4s=; b=xIWEZ1s9eWlFBIGxyctCPes0WwJKTu6WDbJj3mPnkis/MVled3a2JtXb usoy2lvHvprAxGxHZ7X9NO1lcGiUZY0VOz7TfXtbhgwwQFtZ9tnRgWDMS GklkPeTaKHAcN5Cyoq4LR+j9UzllPqHxWq4rPJ1sDZ0TAk8DoW8+6kGWK 1MFYi4G6g4694yH2ySKKrH+2O4uts2ev15YDRKOyapM7i2y59ScLHPtEe KSTIl1yePZ54hC3rWfo4OZjssABJMBqWU9ZMDd6b79itJJHLxBuD6GLzI S5iP+yqlRFKG/QYtw9RY0KBVH6lLniouB7x6LOzGH/xc08ZHCF+j08UyH A==; X-IronPort-AV: E=Sophos;i="5.92,212,1650956400"; d="scan'208";a="101227500" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 22 Jun 2022 06:31:10 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Wed, 22 Jun 2022 06:31:08 -0700 Received: from ROB-ULT-M68701.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Wed, 22 Jun 2022 06:31:06 -0700 From: Sergiu Moga To: , CC: , Sergiu Moga , "Mihai Sain" , Eugen Hristev Subject: [PATCH] mmc: atmel_sdhci: re-enable sdhci after SD Card re-insertion Date: Wed, 22 Jun 2022 16:30:47 +0300 Message-ID: <20220622133047.33844-1-sergiu.moga@microchip.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Whenever the SD Card would be removed and then re-inserted while in the U-Boot command line, the `SDBPWR` bit of the `SDMMC_PCR` register would remain unset afterwards. In order for the bit to be set again after re-insertion, register an additional `deferred_probe` method that the DM would then transparently call. This method will call the generic `sdhci_probe` which will, during its execution flow, set this bit to 1. Signed-off-by: Sergiu Moga Reported-by: Mihai Sain Reviewed-by: Eugen Hristev --- drivers/mmc/atmel_sdhci.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/mmc/atmel_sdhci.c b/drivers/mmc/atmel_sdhci.c index 2b5ceeab94..37b0beeed4 100644 --- a/drivers/mmc/atmel_sdhci.c +++ b/drivers/mmc/atmel_sdhci.c @@ -52,6 +52,17 @@ struct atmel_sdhci_plat { struct mmc mmc; }; +static int atmel_sdhci_deferred_probe(struct sdhci_host *host) +{ + struct udevice *dev = host->mmc->dev; + + return sdhci_probe(dev); +} + +static const struct sdhci_ops atmel_sdhci_ops = { + .deferred_probe = atmel_sdhci_deferred_probe, +}; + static int atmel_sdhci_probe(struct udevice *dev) { struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); @@ -104,6 +115,7 @@ static int atmel_sdhci_probe(struct udevice *dev) return ret; host->mmc->priv = host; + host->ops = &atmel_sdhci_ops; upriv->mmc = host->mmc; clk_free(&clk); -- 2.25.1