From patchwork Mon Jul 27 20:51:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 500789 X-Patchwork-Delegate: marek.vasut@gmail.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 83F941402CD for ; Tue, 28 Jul 2015 07:11:42 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 37BC54B884; Mon, 27 Jul 2015 23:06:12 +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 qajJWJkCwwlO; Mon, 27 Jul 2015 23:06:12 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 81E984B8FB; Mon, 27 Jul 2015 23:04:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8EFA64B737 for ; Mon, 27 Jul 2015 22:54:34 +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 ekFM8L6dXXss for ; Mon, 27 Jul 2015 22:54:34 +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 mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by theia.denx.de (Postfix) with ESMTPS id 1A5C64B71E for ; Mon, 27 Jul 2015 22:54:01 +0200 (CEST) Received: from mail.nefkom.net (unknown [192.168.8.184]) by mail-out.m-online.net (Postfix) with ESMTP id 3mgCzX6NnKz3hjZ4; Mon, 27 Jul 2015 22:54:00 +0200 (CEST) X-Auth-Info: UXIHBLcSc7SPWtiopchBvLNBG4F3/d0U8uaELtX8Hzc= Received: from chi.lan (host-82-135-33-74.customer.m-online.net [82.135.33.74]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA id 3mgCzX4SPbzvdWS; Mon, 27 Jul 2015 22:54:00 +0200 (CEST) From: Marek Vasut To: u-boot@lists.denx.de Date: Mon, 27 Jul 2015 22:51:57 +0200 Message-Id: <1438030335-10631-155-git-send-email-marex@denx.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1438030335-10631-1-git-send-email-marex@denx.de> References: <1438030335-10631-1-git-send-email-marex@denx.de> Cc: Marek Vasut , trini@konsulko.com Subject: [U-Boot] [PATCH 154/172] ddr: altera: Clean up rw_mgr_mem_calibrate_vfifo_center() part 10 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" Fix the return value of the function to match common convention where 0 means success and negative means error. Fix the return values in case of an error to use errno.h codes. Signed-off-by: Marek Vasut --- drivers/ddr/altera/sequencer.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/ddr/altera/sequencer.c b/drivers/ddr/altera/sequencer.c index ee541ce..efcf283 100644 --- a/drivers/ddr/altera/sequencer.c +++ b/drivers/ddr/altera/sequencer.c @@ -2264,7 +2264,7 @@ static int rw_mgr_mem_calibrate_vfifo_center(const u32 rank_bgn, CAL_STAGE_VFIFO_AFTER_WRITES, CAL_SUBSTAGE_VFIFO_CENTER); } - return 0; + return -EIO; } min_index = get_window_mid_index(0, left_edge, right_edge, &mid_min); @@ -2319,7 +2319,10 @@ static int rw_mgr_mem_calibrate_vfifo_center(const u32 rank_bgn, */ writel(0, &sdr_scc_mgr->update); - return (dq_margin >= 0) && (dqs_margin >= 0); + if ((dq_margin < 0) || (dqs_margin < 0)) + return -EINVAL; + + return 0; } /** @@ -2459,7 +2462,7 @@ rw_mgr_mem_calibrate_dq_dqs_centering(const u32 rw_group, const u32 test_bgn, test_bgn, use_read_test, update_fom); - if (ret) + if (!ret) continue; grp_calibrated = 0; @@ -2594,7 +2597,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_end(uint32_t read_group, /* Determine if this set of ranks should be skipped entirely */ if (!param->skip_shadow_regs[sr]) { /* This is the last calibration round, update FOM here */ - if (!rw_mgr_mem_calibrate_vfifo_center(rank_bgn, + if (rw_mgr_mem_calibrate_vfifo_center(rank_bgn, read_group, test_bgn, 0, 1)) {