diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2016-08-25 14:52:37 +0900 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2016-08-28 12:39:49 +0900 |
commit | 8be12e28394efce2844e0a08e8c6e38e60f36d31 (patch) | |
tree | ba93efedad74378e92a858085c9701065534e052 /drivers/mmc/uniphier-sd.c | |
parent | 4eb008460cf4b9da316d97874a32680209324107 (diff) | |
download | u-boot-8be12e28394efce2844e0a08e8c6e38e60f36d31.tar.gz |
mmc: uniphier-sd: return error code if unsupported width is given
With the CONFIG_DM_MMC_OPS migration, the .set_ios callback can
return an integer now. Return an appropriate error value rather
than sudden death by BUG().
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'drivers/mmc/uniphier-sd.c')
-rw-r--r-- | drivers/mmc/uniphier-sd.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c index b254c70857..40a5c85e37 100644 --- a/drivers/mmc/uniphier-sd.c +++ b/drivers/mmc/uniphier-sd.c @@ -496,8 +496,8 @@ static int uniphier_sd_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, return ret; } -static void uniphier_sd_set_bus_width(struct uniphier_sd_priv *priv, - struct mmc *mmc) +static int uniphier_sd_set_bus_width(struct uniphier_sd_priv *priv, + struct mmc *mmc) { u32 val, tmp; @@ -512,14 +512,15 @@ static void uniphier_sd_set_bus_width(struct uniphier_sd_priv *priv, val = UNIPHIER_SD_OPTION_WIDTH_8; break; default: - BUG(); - break; + return -EINVAL; } tmp = readl(priv->regbase + UNIPHIER_SD_OPTION); tmp &= ~UNIPHIER_SD_OPTION_WIDTH_MASK; tmp |= val; writel(tmp, priv->regbase + UNIPHIER_SD_OPTION); + + return 0; } static void uniphier_sd_set_ddr_mode(struct uniphier_sd_priv *priv, @@ -587,11 +588,14 @@ static int uniphier_sd_set_ios(struct udevice *dev) { struct uniphier_sd_priv *priv = dev_get_priv(dev); struct mmc *mmc = mmc_get_mmc_dev(dev); + int ret; dev_dbg(dev, "clock %uHz, DDRmode %d, width %u\n", mmc->clock, mmc->ddr_mode, mmc->bus_width); - uniphier_sd_set_bus_width(priv, mmc); + ret = uniphier_sd_set_bus_width(priv, mmc); + if (ret) + return ret; uniphier_sd_set_ddr_mode(priv, mmc); uniphier_sd_set_clk_rate(priv, mmc); |