Hi Wolfram, > -----Original Message----- > From: Biju Das > Sent: 27 February 2025 16:27 > Subject: RE: [PATCH v3 3/8] mmc: renesas_sdhi: Add support for RZ/G3E SoC > > Hi Wolfram, > > > -----Original Message----- > > From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx> > > Sent: 27 February 2025 15:30 > > Subject: RE: [PATCH v3 3/8] mmc: renesas_sdhi: Add support for RZ/G3E > > SoC > > > > Hi Wolfram, > > > > Thanks for the feedback. > > > > > -----Original Message----- > > > From: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx> > > > Sent: 27 February 2025 15:16 > > > Subject: Re: [PATCH v3 3/8] mmc: renesas_sdhi: Add support for > > > RZ/G3E SoC > > > > > > > > > > + /* > > > > + * HW reset might have toggled the regulator state in > > > > + * HW which regulator core might be unaware of so save > > > > + * and restore the regulator state during HW reset. > > > > + */ > > > > > > Since this is a hard reset, can't we just reset the regulator to an > > > initial state? It seems strange to preserve a value when the 'preserve' flag is explicitly not > set. > > > > Assume, this happens after the card is switched to UHS state and then > > the command won't work in UHS state if we bring the regulator initial > > state of 3.3V , > > > > In external regulator case, we don't toggle the regulator to initial state of 3.3V. > > That is the reason it is still working even when hard reset is applied in UHS state. > > > > Am I missing anything please let me know? I can debug further. > > Previously I got an issue, where the card was unable to detect after hot removal and plug. > Now it is working without this change. > > Not sure the previous issue related to delay associated with hard reset. > I am doing more testing without this change. I have added some debug code[1], with SDHI1 using internal regulator as it is easy to do insert/removal of SD cards: Without the regulator register restore code hot removal/plug: ------------------------------------------------------------- root@smarc-rzg3e:~# [ 31.400277] mmc1: card aaaa removed [ 31.450751] renesas_sdhi_internal_dmac 15c10000.mmc: #####renesas_sdhi_reset 595 sd_status before reset=10000 [ 31.460812] renesas_sdhi_internal_dmac 15c10000.mmc: #####renesas_sdhi_reset 607 sd_status after reset=1 [ 35.811808] SDHI1-VQMMC: disabling [ 36.526838] renesas_sdhi_internal_dmac 15c10000.mmc: #####renesas_sdhi_reset 595 sd_status before reset=0 [ 36.536642] renesas_sdhi_internal_dmac 15c10000.mmc: #####renesas_sdhi_reset 607 sd_status after reset=1 [ 39.322682] renesas_sdhi_internal_dmac 15c10000.mmc: #####renesas_sdhi_reset 607 sd_status after reset=1 [ 39.361826] mmc1: Skipping voltage switch [ 39.610915] mmc1: new high speed SDHC card at address aaaa [ 39.618237] mmcblk1: mmc1:aaaa SE32G 29.7 GiB [ 39.629668] mmcblk1: p1 With the regulator register restore code hot removal/plug: -------------------------------------------------------- root@smarc-rzg3e:~# [ 23.886933] mmc1: card aaaa removed [ 23.937416] renesas_sdhi_internal_dmac 15c10000.mmc: #####renesas_sdhi_reset 595 sd_status before reset=10000 [ 25.581984] mmc1: new UHS-I speed SDR104 SDHC card at address aaaa [ 25.589989] mmcblk1: mmc1:aaaa SE32G 29.7 GiB [ 25.600507] mmcblk1: p1 root@smarc-rzg3e:~# Please share your thoughts. [1] + dev_err(&host->pdev->dev,"#####%s %d sd_status before reset=%x",__func__,__LINE__, sd_status); reset_control_reset(priv->rstc); /* Unknown why but without polling reset status, it will hang */ read_poll_timeout(reset_control_status, ret, ret == 0, 1, 100, @@ -599,8 +602,13 @@ static void renesas_sdhi_reset(struct tmio_mmc_host *host, bool preserve) /* At least SDHI_VER_GEN2_SDR50 needs manual release of reset */ sd_ctrl_write16(host, CTL_RESET_SD, 0x0001); if (priv->rdev) - sd_ctrl_write32(host, CTL_SD_STATUS, sd_status); + sd_ctrl_read32_rep(host, CTL_SD_STATUS, &sd_status, 1); + + dev_err(&host->pdev->dev,"#####%s %d sd_status after reset=%x",__func__,__LINE__, sd_status); Cheers, Biju