Skip to contentSkip to conversation

mmc: host: sdhci-iproc: implement the .hw_reset callback

RFC PATCH In review Meagan Lloyd 3 participants 8 messages Mar 27 – Apr 29

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 mmc: host: sdhci-iproc: implement the .hw_reset callback

Implement the .hw_reset callback so that the eMMC can be reset as needed given cap-mmc-hw-reset is set in the devicetree and the functionality is enabled on the eMMC.

---

SDHCI_POWER_CONTROL[4] (SD Host Controller Standard) has been repurposed on my Broadcomm processor to be eMMC hardware reset (SDIO*_eMMCSDXC_CTRL[12], HRESET).

Can you confirm this repurposed bit is consistent across the Broadcomm iProc processors and thus the .hw_reset callback can be uniformly applied in this driver?

---
 drivers/mmc/host/sdhci-iproc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/mmc/host/sdhci-iproc.c +16 -0
index 35ef5c5f51467..9018ed7fe2e66 100644
@@ -181,12 +181,26 @@ static unsigned int sdhci_iproc_bcm2711_get_min_clock(struct sdhci_host *host)
 	return 200000;
 }
 
+static void sdhci_iproc_hw_reset(struct sdhci_host *host)
+{
+	u8 val = sdhci_readb(host, SDHCI_POWER_CONTROL);
+
+	/* Trigger reset and hold for at least 1us (eMMC spec requirement) */
+	sdhci_writeb(host, val | BIT(4), SDHCI_POWER_CONTROL);
+	usleep_range(2, 10);
+
+	/* Release from reset and wait for at least 200us (eMMC spec requirement) */
+	sdhci_writeb(host, val & ~BIT(4), SDHCI_POWER_CONTROL);
+	usleep_range(250, 300);
+}
+
 static const struct sdhci_ops sdhci_iproc_ops = {
 	.set_clock = sdhci_set_clock,
 	.get_max_clock = sdhci_iproc_get_max_clock,
 	.set_bus_width = sdhci_set_bus_width,
 	.reset = sdhci_reset,
 	.set_uhs_signaling = sdhci_set_uhs_signaling,
+	.hw_reset = sdhci_iproc_hw_reset,
 };
 
 static const struct sdhci_ops sdhci_iproc_32only_ops = {
@@ -201,6 +215,7 @@ static const struct sdhci_ops sdhci_iproc_32only_ops = {
 	.set_bus_width = sdhci_set_bus_width,
 	.reset = sdhci_reset,
 	.set_uhs_signaling = sdhci_set_uhs_signaling,
+	.hw_reset = sdhci_iproc_hw_reset,
 };
 
 static const struct sdhci_pltfm_data sdhci_iproc_cygnus_pltfm_data = {
@@ -283,6 +298,7 @@ static const struct sdhci_ops sdhci_iproc_bcm2711_ops = {
 	.set_bus_width = sdhci_set_bus_width,
 	.reset = sdhci_reset,
 	.set_uhs_signaling = sdhci_set_uhs_signaling,
+	.hw_reset = sdhci_iproc_hw_reset,
 };
 
 static const struct sdhci_pltfm_data sdhci_bcm2711_pltfm_data = {
Signature · 1 line
2.49.0
#1 lore raw
Quoted 7 lines · Meagan Lloyd

Implement the .hw_reset callback so that the eMMC can be reset as needed given cap-mmc-hw-reset is set in the devicetree and the functionality is enabled on the eMMC.

---

Quoted 7 lines

SDHCI_POWER_CONTROL[4] (SD Host Controller Standard) has been repurposed on my Broadcomm processor to be eMMC hardware reset (SDIO*_eMMCSDXC_CTRL[12], HRESET).

Can you confirm this repurposed bit is consistent across the Broadcomm iProc processors and thus the .hw_reset callback can be uniformly applied in this driver?

Hi Ray & Scott,

I hope you're doing well. This bit looks to have been repurposed from the SD Host Controller Standard's VDD2 Power Control to being used for toggling the hardware reset signal to eMMCs. Can you verify that it applies across the iProc processors so that I may finalize this patch?

Thank you,

Meagan

Quoted 52 lines
---
 drivers/mmc/host/sdhci-iproc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/mmc/host/sdhci-iproc.c +16 -0
index 35ef5c5f51467..9018ed7fe2e66 100644
@@ -181,12 +181,26 @@ static unsigned int sdhci_iproc_bcm2711_get_min_clock(struct sdhci_host *host)
 	return 200000;
 }
 
+static void sdhci_iproc_hw_reset(struct sdhci_host *host)
+{
+	u8 val = sdhci_readb(host, SDHCI_POWER_CONTROL);
+
+	/* Trigger reset and hold for at least 1us (eMMC spec requirement) */
+	sdhci_writeb(host, val | BIT(4), SDHCI_POWER_CONTROL);
+	usleep_range(2, 10);
+
+	/* Release from reset and wait for at least 200us (eMMC spec requirement) */
+	sdhci_writeb(host, val & ~BIT(4), SDHCI_POWER_CONTROL);
+	usleep_range(250, 300);
+}
+
 static const struct sdhci_ops sdhci_iproc_ops = {
 	.set_clock = sdhci_set_clock,
 	.get_max_clock = sdhci_iproc_get_max_clock,
 	.set_bus_width = sdhci_set_bus_width,
 	.reset = sdhci_reset,
 	.set_uhs_signaling = sdhci_set_uhs_signaling,
+	.hw_reset = sdhci_iproc_hw_reset,
 };
 
 static const struct sdhci_ops sdhci_iproc_32only_ops = {
@@ -201,6 +215,7 @@ static const struct sdhci_ops sdhci_iproc_32only_ops = {
 	.set_bus_width = sdhci_set_bus_width,
 	.reset = sdhci_reset,
 	.set_uhs_signaling = sdhci_set_uhs_signaling,
+	.hw_reset = sdhci_iproc_hw_reset,
 };
 
 static const struct sdhci_pltfm_data sdhci_iproc_cygnus_pltfm_data = {
@@ -283,6 +298,7 @@ static const struct sdhci_ops sdhci_iproc_bcm2711_ops = {
 	.set_bus_width = sdhci_set_bus_width,
 	.reset = sdhci_reset,
 	.set_uhs_signaling = sdhci_set_uhs_signaling,
+	.hw_reset = sdhci_iproc_hw_reset,
 };
 
 static const struct sdhci_pltfm_data sdhci_bcm2711_pltfm_data = {
#2 lore raw
Quoted 17 lines · Meagan Lloyd
Quoted 7 lines · Meagan Lloyd

Implement the .hw_reset callback so that the eMMC can be reset as needed given cap-mmc-hw-reset is set in the devicetree and the functionality is enabled on the eMMC.

---

Quoted 7 lines

SDHCI_POWER_CONTROL[4] (SD Host Controller Standard) has been repurposed on my Broadcomm processor to be eMMC hardware reset (SDIO*_eMMCSDXC_CTRL[12], HRESET).

Can you confirm this repurposed bit is consistent across the Broadcomm iProc processors and thus the .hw_reset callback can be uniformly applied in this driver?

Quoted 6 lines

Hi Ray & Scott,

I hope you're doing well. This bit looks to have been repurposed from the SD Host Controller Standard's VDD2 Power Control to being used for toggling the hardware reset signal to eMMCs. Can you verify that it applies across the iProc processors so that I may finalize this patch?

Which iProc process are you using? If you are not sure this applies broadly, can you at least make it specific to the SoC you are using?

Signature · 1 line
Florian
#3 lore raw
Quoted 23 lines · Florian Fainelli
Quoted 22 lines · Meagan Lloyd
Quoted 9 lines · Meagan Lloyd

Implement the .hw_reset callback so that the eMMC can be reset as needed
given cap-mmc-hw-reset is set in the devicetree and the functionality is
enabled on the eMMC.

---

Quoted 8 lines

SDHCI_POWER_CONTROL[4] (SD Host Controller Standard) has been repurposed
on my Broadcomm processor to be eMMC hardware reset (SDIO*_eMMCSDXC_CTRL[12], HRESET).

Can you confirm this repurposed bit is consistent across the Broadcomm iProc processors and thus the .hw_reset callback can be uniformly applied in this driver?

Hi Ray & Scott,

Quoted 7 lines
Quoted 4 lines

I hope you're doing well. This bit looks to have been repurposed from the SD Host Controller Standard's VDD2 Power Control to being used for toggling the hardware reset signal to eMMCs. Can you verify that it applies across the iProc processors so that I may finalize this patch?

Which iProc process are you using? If you are not sure this applies broadly, can you at least make it specific to the SoC you are using?

Yes, if it comes to that I can. I think it's overkill to roll a new compat string/associated structures over this small change, hence checking with Broadcomm iProc maintainers on this thread.

#4 lore raw

Hi Meagan,

Quoted 30 lines · Meagan Lloyd
Quoted 28 lines · Florian Fainelli
Quoted 26 lines · Meagan Lloyd
Quoted 9 lines · Meagan Lloyd

Implement the .hw_reset callback so that the eMMC can be reset as needed
given cap-mmc-hw-reset is set in the devicetree and the functionality is
enabled on the eMMC.

---

Quoted 8 lines

SDHCI_POWER_CONTROL[4] (SD Host Controller Standard) has been repurposed
on my Broadcomm processor to be eMMC hardware reset (SDIO*_eMMCSDXC_CTRL[12], HRESET).

Can you confirm this repurposed bit is consistent across the Broadcomm iProc processors and thus the .hw_reset callback can be uniformly applied in this driver?

Hi Ray & Scott,

I hope you're doing well. This bit looks to have been repurposed from the SD Host Controller Standard's VDD2 Power Control to being used for toggling the hardware reset signal to eMMCs. Can you verify that it applies across the iProc processors so that I may finalize this patch?

Quoted 6 lines
Quoted 2 lines

Which iProc process are you using? If you are not sure this applies broadly, can you at least make it specific to the SoC you are using?

Yes, if it comes to that I can. I think it's overkill to roll a new compat string/associated structures over this small change, hence checking with Broadcomm iProc maintainers on this thread.

Which iProc processor are you using? You will have to check with RaspberryPI as I think they use this driver as well.
If that family also supports it then you probably don't need a compatibility string.

#5 lore raw
Quoted 33 lines · Scott Branden

Hi Meagan,

Quoted 28 lines · Meagan Lloyd
Quoted 27 lines · Florian Fainelli
Quoted 18 lines · Meagan Lloyd
Quoted 9 lines · Meagan Lloyd

Implement the .hw_reset callback so that the eMMC can be reset as needed
given cap-mmc-hw-reset is set in the devicetree and the functionality is
enabled on the eMMC.

---

Quoted 8 lines

SDHCI_POWER_CONTROL[4] (SD Host Controller Standard) has been repurposed
on my Broadcomm processor to be eMMC hardware reset (SDIO*_eMMCSDXC_CTRL[12], HRESET).

Can you confirm this repurposed bit is consistent across the Broadcomm iProc processors and thus the .hw_reset callback can be uniformly applied in this driver?

Quoted 6 lines

Hi Ray & Scott,

I hope you're doing well. This bit looks to have been repurposed from the SD Host Controller Standard's VDD2 Power Control to being used for toggling the hardware reset signal to eMMCs. Can you verify that it applies across the iProc processors so that I may finalize this patch?

Which iProc process are you using? If you are not sure this applies broadly, can you at least make it specific to the SoC you are using?

Quoted 8 lines
Quoted 4 lines

Yes, if it comes to that I can. I think it's overkill to roll a new compat string/associated structures over this small change, hence checking with Broadcomm iProc maintainers on this thread.

Which iProc processor are you using? You will have to check with RaspberryPI as I think they use this driver as well.
If that family also supports it then you probably don't need a compatibility string.

The processor I am using is the BCM58732. Can you help direct me to someone who could comment from the RaspberryPi side?

#6 lore raw
Quoted 39 lines · Meagan Lloyd
Quoted 37 lines · Scott Branden

Hi Meagan,

Quoted 32 lines · Meagan Lloyd
Quoted 19 lines · Florian Fainelli
Quoted 18 lines · Meagan Lloyd
Quoted 17 lines · Meagan Lloyd

Implement the .hw_reset callback so that the eMMC can be reset as needed
given cap-mmc-hw-reset is set in the devicetree and the functionality is
enabled on the eMMC.

---

SDHCI_POWER_CONTROL[4] (SD Host Controller Standard) has been repurposed
on my Broadcomm processor to be eMMC hardware reset (SDIO*_eMMCSDXC_CTRL[12], HRESET).

Can you confirm this repurposed bit is consistent across the Broadcomm iProc processors and thus the .hw_reset callback can be uniformly applied in this driver?

Quoted 8 lines
Quoted 6 lines

Hi Ray & Scott,

I hope you're doing well. This bit looks to have been repurposed from the SD Host Controller Standard's VDD2 Power Control to being used for toggling the hardware reset signal to eMMCs. Can you verify that it applies across the iProc processors so that I may finalize this patch?

Which iProc process are you using? If you are not sure this applies broadly, can you at least make it specific to the SoC you are using?

Yes, if it comes to that I can. I think it's overkill to roll a new compat string/associated structures over this small change, hence checking with Broadcomm iProc maintainers on this thread.

Quoted 8 lines
Quoted 4 lines

Which iProc processor are you using? You will have to check with RaspberryPI as I think they use this driver as well.
If that family also supports it then you probably don't need a compatibility string.

The processor I am using is the BCM58732. Can you help direct me to someone who could comment from the RaspberryPi side?

I will take care of that.

Signature · 1 line
Florian
#7 lore raw
Quoted 49 lines · Florian Fainelli
Quoted 48 lines · Meagan Lloyd
Quoted 45 lines · Scott Branden

Hi Meagan,

Quoted 30 lines · Meagan Lloyd
Quoted 29 lines · Florian Fainelli
Quoted 28 lines · Meagan Lloyd
Quoted 14 lines · Meagan Lloyd

Implement the .hw_reset callback so that the eMMC can be reset as needed
given cap-mmc-hw-reset is set in the devicetree and the functionality is
enabled on the eMMC.

---

SDHCI_POWER_CONTROL[4] (SD Host Controller Standard) has been repurposed
on my Broadcomm processor to be eMMC hardware reset (SDIO*_eMMCSDXC_CTRL[12], HRESET).

Quoted 4 lines

Can you confirm this repurposed bit is consistent across the Broadcomm
iProc processors and thus the .hw_reset callback can be uniformly applied in this driver?

Hi Ray & Scott,

I hope you're doing well. This bit looks to have been repurposed from
the SD Host Controller Standard's VDD2 Power Control to being used for
toggling the hardware reset signal to eMMCs. Can you verify that it applies across the iProc processors so that I may finalize this patch?

Quoted 6 lines
Quoted 2 lines

Which iProc process are you using? If you are not sure this applies broadly, can you at least make it specific to the SoC you are using?

Yes, if it comes to that I can. I think it's overkill to roll a new compat string/associated structures over this small change, hence checking with Broadcomm iProc maintainers on this thread.

Which iProc processor are you using?  You will have to check with RaspberryPI as I think they use this driver as well.
If that family also supports it then you probably don't need a compatibility string.

Quoted 5 lines
Quoted 3 lines

The processor I am using is the BCM58732. Can you help direct me to someone who could comment from the RaspberryPi side?

I will take care of that.

Thanks, Florian. Let me know what you find out :)