drivers: disk: Update NXP USDHC driver

1. Do not throw an error when FSL_FEATURE_USDHC_HAS_HS400_MODE
   is defined
2. Add support for the case when the card detect is handled
   by the USDHC module

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This commit is contained in:
Mahesh Mahadevan 2021-08-06 17:18:19 -05:00 committed by Christopher Friedt
commit 387e6a676f

View file

@ -2256,7 +2256,6 @@ static void usdhc_host_reset(struct usdhc_priv *priv)
usdhc_enable_ddr_mode(base, false, 0); usdhc_enable_ddr_mode(base, false, 0);
usdhc_tuning(base, SDHC_STANDARD_TUNING_START, SDHC_TUINIG_STEP, false); usdhc_tuning(base, SDHC_STANDARD_TUNING_START, SDHC_TUINIG_STEP, false);
#if FSL_FEATURE_USDHC_HAS_HS400_MODE #if FSL_FEATURE_USDHC_HAS_HS400_MODE
#error Not implemented!
/* Disable HS400 mode */ /* Disable HS400 mode */
/* Disable DLL */ /* Disable DLL */
#endif #endif
@ -2600,8 +2599,9 @@ static K_MUTEX_DEFINE(z_usdhc_init_lock);
static int usdhc_board_access_init(struct usdhc_priv *priv) static int usdhc_board_access_init(struct usdhc_priv *priv)
{ {
const struct usdhc_config *config = priv->config; const struct usdhc_config *config = priv->config;
int ret; int ret = 0;
uint32_t gpio_level; uint32_t gpio_level;
USDHC_Type *base = config->base;
if (config->pwr_name) { if (config->pwr_name) {
priv->pwr_gpio = device_get_binding(config->pwr_name); priv->pwr_gpio = device_get_binding(config->pwr_name);
@ -2634,10 +2634,16 @@ static int usdhc_board_access_init(struct usdhc_priv *priv)
} }
if (!priv->detect_gpio) { if (!priv->detect_gpio) {
LOG_INF("USDHC detection other than GPIO not implemented!"); LOG_INF("USDHC detection other than GPIO");
return 0; /* DATA3 does not monitor card insertion */
base->PROT_CTRL &= ~USDHC_PROT_CTRL_D3CD_MASK;
if ((base->PRES_STATE & USDHC_PRES_STATE_CINST_MASK) != 0) {
priv->inserted = true;
} else {
priv->inserted = false;
ret = -ENODEV;
} }
} else {
ret = usdhc_cd_gpio_init(priv->detect_gpio, ret = usdhc_cd_gpio_init(priv->detect_gpio,
config->detect_pin, config->detect_pin,
config->detect_flags, config->detect_flags,
@ -2661,8 +2667,8 @@ static int usdhc_board_access_init(struct usdhc_priv *priv)
priv->inserted = true; priv->inserted = true;
LOG_INF("SD inserted!"); LOG_INF("SD inserted!");
}
return 0; return ret;
} }
static int usdhc_access_init(const struct device *dev) static int usdhc_access_init(const struct device *dev)