From patchwork Thu Aug 25 05:52:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 662643 X-Patchwork-Delegate: yamada.m@jp.panasonic.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3sKYb31qZ9z9sBc for ; Thu, 25 Aug 2016 16:06:23 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b=btqI3aF5; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 51E474BDBD; Thu, 25 Aug 2016 07:51:22 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3tSqNQWkwpkD; Thu, 25 Aug 2016 07:51:22 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 92596A753A; Thu, 25 Aug 2016 07:51:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E71FA4B98B for ; Thu, 25 Aug 2016 07:51:13 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 206t-5OSmkPm for ; Thu, 25 Aug 2016 07:51:13 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from conuserg-11.nifty.com (conuserg-11.nifty.com [210.131.2.78]) by theia.denx.de (Postfix) with ESMTPS id 4802F4B9B0 for ; Thu, 25 Aug 2016 07:51:09 +0200 (CEST) Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id u7P5oZi3017421; Thu, 25 Aug 2016 14:50:37 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com u7P5oZi3017421 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1472104237; bh=bnJTzJXVUwHcpJZaJ5O/9V6khRQsVbd5j/nDdpYI2+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=btqI3aF5HuSkPrEbQtzWnxZZSmO/qxgcPO1kIcHpPTL7QZnooJON3pauZEMDMAT2S VgpvrWMJ4IkkWmgHvqL3zmnCwXI/jNsuPfghQDFjmWtNAvMdImi0/C+L9/FFi+E04L xrdCBA6D+XiTq7nO84+QzPsFetOVLIhU0LMaAC5ArLVkOxHfrvBIsCwXvmh9gxtE6A F5KLmmem/UDANjtcu1+p9dkQ+CdfXrWPlq98YXN62VEgg6I8Nz6v4pNXZ6Rrq7VXTR JMbDFkuYicqPxYRtmmn+ELxl9TOCU82pcgYuebHw6F0UkSmrGr2LIYIHVasw8YdrpL R43ffYtCpF/Yg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Thu, 25 Aug 2016 14:52:37 +0900 Message-Id: <1472104359-23551-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1472104359-23551-1-git-send-email-yamada.masahiro@socionext.com> References: <1472104359-23551-1-git-send-email-yamada.masahiro@socionext.com> Subject: [U-Boot] [PATCH 3/5] mmc: uniphier-sd: return error code if unsupported width is given X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 --- drivers/mmc/uniphier-sd.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c index b254c70..40a5c85 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);