From patchwork Fri Sep 23 10:14:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaehoon Chung X-Patchwork-Id: 674026 X-Patchwork-Delegate: jh80.chung@samsung.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 3sgTkj6jtTz9syB for ; Fri, 23 Sep 2016 20:15:09 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 402D6A76EF; Fri, 23 Sep 2016 12:15:06 +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 tZoDWrzV3eBh; Fri, 23 Sep 2016 12:15:05 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9067EA76D7; Fri, 23 Sep 2016 12:15:00 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 84546A76D7 for ; Fri, 23 Sep 2016 12:14:56 +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 e18tScF9FBTX for ; Fri, 23 Sep 2016 12:14:56 +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 mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by theia.denx.de (Postfix) with ESMTPS id 13E17A76D4 for ; Fri, 23 Sep 2016 12:14:54 +0200 (CEST) Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ODY01JJDCGOBV90@mailout1.samsung.com> for u-boot@lists.denx.de; Fri, 23 Sep 2016 19:14:48 +0900 (KST) Received: from epcpsbgm2new.samsung.com ( [172.20.52.112]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id AB.A2.25570.89005E75; Fri, 23 Sep 2016 19:14:48 +0900 (KST) X-AuditID: cbfee68e-f79fa6d0000063e2-6f-57e50098480c Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id EF.E7.29545.89005E75; Fri, 23 Sep 2016 03:14:48 -0700 (MST) Received: from localhost.localdomain ([10.113.62.216]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ODY00BVICGNUR80@mmp2.samsung.com>; Fri, 23 Sep 2016 19:14:48 +0900 (KST) From: Jaehoon Chung To: u-boot@lists.denx.de Date: Fri, 23 Sep 2016 19:14:46 +0900 Message-id: <1474625686-6181-2-git-send-email-jh80.chung@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1474625686-6181-1-git-send-email-jh80.chung@samsung.com> References: <1474625686-6181-1-git-send-email-jh80.chung@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGLMWRmVeSWpSXmKPExsWyRsSkQHcGw9Nwg+8HJC1u/Gpjtfi2ZRuj xdRJm9kt3u7tZHdg8ZjdcJHF49WBVeweZ+/sYPTo27KKMYAlissmJTUnsyy1SN8ugSvj4zSd gtNqFcvfz2JtYFwv18XIySEhYCJxpGURO4QtJnHh3nq2LkYuDiGBFYwSrc/+sXQxcoAVrbma ChGfxSjx6+ElNpAGIYEfjBInGmpAbDYBHYnt344zgdgiAhISv/qvMoLYzAIOEscm/2UBsYUF bCXmb3wJ1ssioCrx//NCsDivgKvEp46lLBBHyEmcPDaZFcTmFHCT2NG2EmqXq0TTphdMIEdI CDSzS+xas5sJYpCAxLfJh6AOlZXYdIAZYo6kxMEVN1gmM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xa/XyaS9ze7R3XYrNa+I/JpTwTD6waN0O92D24w7rTsnv XOc402SX28JJp7Z6zWs8t0zx8Jfb9+ev+fHYuejEHpatmRsqNmUJVnuZZ8zbkJL/PvjN9fdy VWJ6YVKm5bMurVYW/nXC8YuyEktxRqKhFnNRcSIA0ncQtaYCAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: trini@konsulko.com Subject: [U-Boot] [PATCH 2/2] mmc: sdhci: use the generic error number 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" Use the generic error number instead of meaningless value. Signed-off-by: Jaehoon Chung --- drivers/mmc/kona_sdhci.c | 6 +++--- drivers/mmc/mv_sdhci.c | 2 +- drivers/mmc/s5p_sdhci.c | 8 ++++---- drivers/mmc/sdhci.c | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/mmc/kona_sdhci.c b/drivers/mmc/kona_sdhci.c index 0c4f30e..71c06b1 100644 --- a/drivers/mmc/kona_sdhci.c +++ b/drivers/mmc/kona_sdhci.c @@ -27,7 +27,7 @@ static int init_kona_mmc_core(struct sdhci_host *host) if (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & SDHCI_RESET_ALL) { printf("%s: sd host controller reset error\n", __func__); - return 1; + return -; } /* For kona a hardware reset before anything else. */ @@ -39,7 +39,7 @@ static int init_kona_mmc_core(struct sdhci_host *host) do { if (timeout == 0) { printf("%s: reset timeout error\n", __func__); - return 1; + return -ETIMEDOUT; } timeout--; udelay(100); @@ -67,7 +67,7 @@ static int init_kona_mmc_core(struct sdhci_host *host) while (!(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT)) { if (timeout == 0) { printf("%s: CARD DETECT timeout error\n", __func__); - return 1; + return -ETIMEDOUT; } timeout--; udelay(100); diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c index ca5f872..e388ad1 100644 --- a/drivers/mmc/mv_sdhci.c +++ b/drivers/mmc/mv_sdhci.c @@ -71,7 +71,7 @@ int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks) host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host)); if (!host) { printf("sdh_host malloc fail!\n"); - return 1; + return -ENOMEM; } host->name = MVSDH_NAME; diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c index 7827b28..8930097 100644 --- a/drivers/mmc/s5p_sdhci.c +++ b/drivers/mmc/s5p_sdhci.c @@ -86,7 +86,7 @@ int s5p_sdhci_init(u32 regbase, int index, int bus_width) struct sdhci_host *host = calloc(1, sizeof(struct sdhci_host)); if (!host) { printf("sdhci__host allocation fail!\n"); - return 1; + return -ENOMEM; } host->ioaddr = (void *)regbase; host->index = index; @@ -140,7 +140,7 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host) dev_id = pinmux_decode_periph_id(blob, node); if (dev_id < PERIPH_ID_SDMMC0 && dev_id > PERIPH_ID_SDMMC3) { debug("MMC: Can't get device id\n"); - return -1; + return -EINVAL; } host->index = dev_id - PERIPH_ID_SDMMC0; @@ -148,7 +148,7 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host) bus_width = fdtdec_get_int(blob, node, "samsung,bus-width", 0); if (bus_width <= 0) { debug("MMC: Can't get bus-width\n"); - return -1; + return -EINVAL; } host->bus_width = bus_width; @@ -156,7 +156,7 @@ static int sdhci_get_config(const void *blob, int node, struct sdhci_host *host) base = fdtdec_get_addr(blob, node, "reg"); if (!base) { debug("MMC: Can't get base address\n"); - return -1; + return -EINVAL; } host->ioaddr = (void *)base; diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 7fc11c0..8df951f 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -87,7 +87,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data, if (stat & SDHCI_INT_ERROR) { printf("%s: Error detected in status(0x%X)!\n", __func__, stat); - return -1; + return -EIO; } if (stat & rdy) { if (!(sdhci_readl(host, SDHCI_PRESENT_STATE) & mask)) @@ -110,7 +110,7 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data, udelay(10); else { printf("%s: Transfer data timeout\n", __func__); - return -1; + return -ETIMEDOUT; } } while (!(stat & SDHCI_INT_DATA_END)); return 0; @@ -303,7 +303,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock) if (timeout == 0) { printf("%s: Timeout to wait cmd & data inhibit\n", __func__); - return -1; + return -EBUSY; } timeout--; @@ -352,7 +352,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock) if (timeout == 0) { printf("%s: Internal clock never stabilised.\n", __func__); - return -1; + return -EBUSY; } timeout--; udelay(1000); @@ -455,7 +455,7 @@ static int sdhci_init(struct mmc *mmc) if (!aligned_buffer) { printf("%s: Aligned buffer alloc failed!!!\n", __func__); - return -1; + return -ENOMEM; } } @@ -601,7 +601,7 @@ int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk) host->mmc = mmc_create(&host->cfg, host); if (host->mmc == NULL) { printf("%s: mmc create fail!\n", __func__); - return -1; + return -ENOMEM; } return 0;