mmc: fsl_esdhc_imx: Use esdhc_soc_data flags to set host caps
Subsystems (2)
RFC 1/1 mmc: fsl_esdhc_imx: Use esdhc_soc_data flags to set host caps
The Linux driver automatically can detect and enable UHS, HS200, HS400 and HS400_ES automatically without extra flags being placed into the device tree.
Right now, for U-Boot to use UHS, HS200 or HS400, the extra flags are needed. Let's go through the esdhc_soc_data flags and enable the host caps where applicable.
---
I am not an expert on the SD/MMC standards, but I used the Linux driver as a model, and made the assumption that the USDHC flag needs to be set in order to use the extra speeds.
drivers/mmc/fsl_esdhc_imx.c +23 -1
@@ -1293,8 +1293,30 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv, val |=ESDHC_TUNING_CMD_CRC_CHECK_DISABLE ;esdhc_write32 (®s->tuning_ctrl, val); } - } +if (CONFIG_IS_ENABLED (MMC_UHS_SUPPORT )) { + cfg->host_caps |=MMC_CAP (UHS_SDR12 ); + cfg->host_caps |=MMC_CAP (UHS_SDR25 ); + cfg->host_caps |=MMC_CAP (UHS_SDR50 ); + cfg->host_caps |=MMC_CAP (UHS_SDR104 ); + cfg->host_caps |=MMC_CAP (UHS_DDR50 ); + } + +if (CONFIG_IS_ENABLED (MMC_HS200_SUPPORT )) { +if (priv->flags &ESDHC_FLAG_HS200 ) + cfg->host_caps |=MMC_CAP (MMC_HS_200 ); + } + +if (CONFIG_IS_ENABLED (MMC_HS400_SUPPORT )) { +if (priv->flags &ESDHC_FLAG_HS400 ) + cfg->host_caps |=MMC_CAP (MMC_HS_400 ); + } + +if (CONFIG_IS_ENABLED (MMC_HS400_ES_SUPPORT )) { +if (priv->flags &ESDHC_FLAG_HS400_ES ) + cfg->host_caps |=MMC_CAP (MMC_HS_400_ES ); + } + }return 0 ; }
Signature · 1 line
2.25.1
Hi Adam,
Quoted 8 lines · Adam Ford
The Linux driver automatically can detect and enable UHS, HS200, HS400 and
HS400_ESautomatically without extra flags being placed into the device tree.Right now, for U-Boot to use UHS, HS200 or HS400, the extra flags are needed. Let's go through the
esdhc_soc_dataflags and enable the host caps where applicable.
Quoted 6 lines
Suggested-by Fabio Estevam <[email protected]>Signed-off-by Adam Ford <[email protected]>---
I am not an expert on the SD/MMC standards, but I used the Linux driver as a model, and made the assumption that the USDHC flag needs to be set in order to use the extra speeds.
Looks good to me. If it can't parse property from device-tree, it needs to set host_caps as proper mode. Does it work fine about UHS mode? AFAIK, there was an issue about not detecting host capabilities.
Quoted 7 lines
drivers/mmc/fsl_esdhc_imx.c +0
-0@@ -1293,8 +1293,30 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv, val |=ESDHC_TUNING_CMD_CRC_CHECK_DISABLE ;
drivers/mmc/fsl_esdhc_imx.c static int fsl_esdhc_init(struct fsl_esdhc_priv *priv, · line 1302
Quoted 10 lines
drivers/mmc/fsl_esdhc_imx.c +6
-1esdhc_write32 (®s->tuning_ctrl, val); } - } +if (CONFIG_IS_ENABLED (MMC_UHS_SUPPORT )) { + cfg->host_caps |=MMC_CAP (UHS_SDR12 ); + cfg->host_caps |=MMC_CAP (UHS_SDR25 ); + cfg->host_caps |=MMC_CAP (UHS_SDR50 ); + cfg->host_caps |=MMC_CAP (UHS_SDR104 ); + cfg->host_caps |=MMC_CAP (UHS_DDR50 );
If it needs to set all capabilities, then you can use UHS_CAPS instead of them.
Quoted 21 lines
drivers/mmc/fsl_esdhc_imx.c +17
-0+ } + +if (CONFIG_IS_ENABLED (MMC_HS200_SUPPORT )) { +if (priv->flags &ESDHC_FLAG_HS200 ) + cfg->host_caps |=MMC_CAP (MMC_HS_200 ); + } + +if (CONFIG_IS_ENABLED (MMC_HS400_SUPPORT )) { +if (priv->flags &ESDHC_FLAG_HS400 ) + cfg->host_caps |=MMC_CAP (MMC_HS_400 ); + } + +if (CONFIG_IS_ENABLED (MMC_HS400_ES_SUPPORT )) { +if (priv->flags &ESDHC_FLAG_HS400_ES ) + cfg->host_caps |=MMC_CAP (MMC_HS_400_ES ); + } + }return 0 ; }
Quoted 3 lines · Jaehoon Chung
Hi Adam,
+CC: Tim Harvey,
Quoted 16 lines · Adam Ford
Quoted 8 lines
The Linux driver automatically can detect and enable UHS, HS200, HS400 and
HS400_ESautomatically without extra flags being placed into the device tree.Right now, for U-Boot to use UHS, HS200 or HS400, the extra flags are needed. Let's go through the
esdhc_soc_dataflags and enable the host caps where applicable.Quoted 6 lines
Suggested-by Fabio Estevam <[email protected]>Signed-off-by Adam Ford <[email protected]>---
I am not an expert on the SD/MMC standards, but I used the Linux driver as a model, and made the assumption that the USDHC flag needs to be set in order to use the extra speeds.
Quoted 2 lines
Looks good to me. If it can't parse property from device-tree, it needs to set
host_capsas proper mode. Does it work fine about UHS mode? AFAIK, there was an issue about not detecting host capabilities.
From the troubleshooting I've done, without this patch the host didn't show it was capable of UHS, but with this patch, the card doesn't show UHS, so I think there is something wrong still, but this at least gets us past it being a host caps issue.
I was able to get it working with HS400ES.
If you want me to hold off until we get UHS working, I can hold off. I know Tim was having issues as well.
I was able to confirm the UHS SDR104 works on the Renesas RZ/G2H board that I have using the same care, so I think the issue may be unique to the esdhc driver.
adam
Quoted 43 lines
Quoted 8 lines
drivers/mmc/fsl_esdhc_imx.c +0
-0@@ -1293,8 +1293,30 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv, val |=ESDHC_TUNING_CMD_CRC_CHECK_DISABLE ;drivers/mmc/fsl_esdhc_imx.c static int fsl_esdhc_init(struct fsl_esdhc_priv *priv, · line 1302
Quoted 10 lines
drivers/mmc/fsl_esdhc_imx.c +6
-1esdhc_write32 (®s->tuning_ctrl, val); } - } +if (CONFIG_IS_ENABLED (MMC_UHS_SUPPORT )) { + cfg->host_caps |=MMC_CAP (UHS_SDR12 ); + cfg->host_caps |=MMC_CAP (UHS_SDR25 ); + cfg->host_caps |=MMC_CAP (UHS_SDR50 ); + cfg->host_caps |=MMC_CAP (UHS_SDR104 ); + cfg->host_caps |=MMC_CAP (UHS_DDR50 );If it needs to set all capabilities, then you can use
UHS_CAPSinstead of them.Quoted 21 lines
drivers/mmc/fsl_esdhc_imx.c +17
-0+ } + +if (CONFIG_IS_ENABLED (MMC_HS200_SUPPORT )) { +if (priv->flags &ESDHC_FLAG_HS200 ) + cfg->host_caps |=MMC_CAP (MMC_HS_200 ); + } + +if (CONFIG_IS_ENABLED (MMC_HS400_SUPPORT )) { +if (priv->flags &ESDHC_FLAG_HS400 ) + cfg->host_caps |=MMC_CAP (MMC_HS_400 ); + } + +if (CONFIG_IS_ENABLED (MMC_HS400_ES_SUPPORT )) { +if (priv->flags &ESDHC_FLAG_HS400_ES ) + cfg->host_caps |=MMC_CAP (MMC_HS_400_ES ); + } + }return 0 ; }
Quoted 32 lines · Adam Ford
Quoted 3 lines · Jaehoon Chung
Hi Adam,
+CC: Tim Harvey,
Quoted 16 lines · Adam Ford
Quoted 8 lines
The Linux driver automatically can detect and enable UHS, HS200, HS400 and
HS400_ESautomatically without extra flags being placed into the device tree.Right now, for U-Boot to use UHS, HS200 or HS400, the extra flags are needed. Let's go through the
esdhc_soc_dataflags and enable the host caps where applicable.Quoted 6 lines
Suggested-by Fabio Estevam <[email protected]>Signed-off-by Adam Ford <[email protected]>---
I am not an expert on the SD/MMC standards, but I used the Linux driver as a model, and made the assumption that the USDHC flag needs to be set in order to use the extra speeds.Quoted 2 lines
Looks good to me. If it can't parse property from device-tree, it needs to set
host_capsas proper mode. Does it work fine about UHS mode? AFAIK, there was an issue about not detecting host capabilities.From the troubleshooting I've done, without this patch the host didn't show it was capable of UHS, but with this patch, the card doesn't show UHS, so I think there is something wrong still, but this at least gets us past it being a host caps issue.
I was able to get it working with HS400ES.
Quoted 7 lines
If you want me to hold off until we get UHS working, I can hold off. I know Tim was having issues as well.
I was able to confirm the UHS SDR104 works on the Renesas RZ/G2H board that I have using the same care, so I think the issue may be unique to the esdhc driver.
I'm all for this patch and getting rid of the custom u-boot props that were added to enable UHS.
I don't think there is any need to wait as this patch does not cause any issue with microSD, just exposes something and if you hit the issue we are hitting with the microSD failing to acknowledge the voltage switch at least it falls back to legacy mode so it doesn't hurt to have this in place, esp given the benefit of enabling HS200/HS400/HS400ES. I could use some help understanding the microSD failing to acknowledge the voltage switch as I'm completely out of ideas.
The IMX6 SDHC supports UHS as well but it isn't enabled by this patch
- have you tried enabling UHS for IMX6?
Best regards,
Tim
Quoted 54 lines · Tim Harvey
Quoted 32 lines · Adam Ford
Quoted 3 lines · Jaehoon Chung
Hi Adam,
+CC: Tim Harvey,
Quoted 16 lines · Adam Ford
Quoted 8 lines
The Linux driver automatically can detect and enable UHS, HS200, HS400 and
HS400_ESautomatically without extra flags being placed into the device tree.Right now, for U-Boot to use UHS, HS200 or HS400, the extra flags are needed. Let's go through the
esdhc_soc_dataflags and enable the host caps where applicable.Quoted 6 lines
Suggested-by Fabio Estevam <[email protected]>Signed-off-by Adam Ford <[email protected]>---
I am not an expert on the SD/MMC standards, but I used the Linux driver as a model, and made the assumption that the USDHC flag needs to be set in order to use the extra speeds.Quoted 2 lines
Looks good to me. If it can't parse property from device-tree, it needs to set
host_capsas proper mode. Does it work fine about UHS mode? AFAIK, there was an issue about not detecting host capabilities.From the troubleshooting I've done, without this patch the host didn't show it was capable of UHS, but with this patch, the card doesn't show UHS, so I think there is something wrong still, but this at least gets us past it being a host caps issue.
I was able to get it working with HS400ES.Quoted 7 lines
If you want me to hold off until we get UHS working, I can hold off. I know Tim was having issues as well.
I was able to confirm the UHS SDR104 works on the Renesas RZ/G2H board that I have using the same care, so I think the issue may be unique to the esdhc driver.
I'm all for this patch and getting rid of the custom u-boot props that were added to enable UHS.
I don't think there is any need to wait as this patch does not cause any issue with microSD, just exposes something and if you hit the issue we are hitting with the microSD failing to acknowledge the voltage switch at least it falls back to legacy mode so it doesn't hurt to have this in place, esp given the benefit of enabling HS200/HS400/HS400ES. I could use some help understanding the microSD failing to acknowledge the voltage switch as I'm completely out of ideas.
Quoted 2 lines
The IMX6 SDHC supports UHS as well but it isn't enabled by this patch
- have you tried enabling UHS for IMX6?
I have an i.MX6Q laying around somewhere, but I haven't tested it. I would expect the patch to enable the settings based on the host caps. If they're not set in the host flag, I think a separate patch would be appropriate to update the i.MX6 flags regardless of whether or not this patch gets accepted. There are so many variants of i.MX6, I am reluctant to do it for fear of breaking something.
adam
Quoted 4 lines
Best regards,
Tim