From patchwork Sat Feb 18 23:29:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 729775 X-Patchwork-Delegate: trini@ti.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 3vRcLg0nT6z9s8G for ; Mon, 20 Feb 2017 19:32:11 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0CE84B3FA8; Mon, 20 Feb 2017 09:25:07 +0100 (CET) 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 M5pYV4xm7pVj; Mon, 20 Feb 2017 09:25:06 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1618DB3B05; Mon, 20 Feb 2017 09:19:27 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 467504A068 for ; Sun, 19 Feb 2017 00:29:26 +0100 (CET) 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 1PFlbPyNsx3O for ; Sun, 19 Feb 2017 00:29:26 +0100 (CET) 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 cvs.linux-mips.org (eddie.linux-mips.org [148.251.95.138]) by theia.denx.de (Postfix) with ESMTP id F1CBE4A026 for ; Sun, 19 Feb 2017 00:29:25 +0100 (CET) Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23993891AbdBRX3ZdB17c (ORCPT ); Sun, 19 Feb 2017 00:29:25 +0100 Date: Sun, 19 Feb 2017 00:29:24 +0100 From: Ladislav Michl To: u-boot@lists.denx.de Message-ID: <20170218232924.kttpzgbjakiubuhn@lenoch> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Cc: Albert Aribaud Subject: [U-Boot] [PATCH] arm: OMAP2+: nandecc: propagate error to command return status 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Signed-off-by: Ladislav Michl --- arch/arm/include/asm/arch-am33xx/sys_proto.h | 2 +- arch/arm/include/asm/arch-omap3/sys_proto.h | 2 +- arch/arm/mach-omap2/omap3/board.c | 32 ++++++++++++---------------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/arch/arm/include/asm/arch-am33xx/sys_proto.h b/arch/arm/include/asm/arch-am33xx/sys_proto.h index 0c5792baa8..903398fe8f 100644 --- a/arch/arm/include/asm/arch-am33xx/sys_proto.h +++ b/arch/arm/include/asm/arch-am33xx/sys_proto.h @@ -29,7 +29,7 @@ void sdelay(unsigned long); void gpmc_init(void); void enable_gpmc_cs_config(const u32 *gpmc_config, const struct gpmc_cs *cs, u32 base, u32 size); -void omap_nand_switch_ecc(uint32_t, uint32_t); +int omap_nand_switch_ecc(uint32_t, uint32_t); void set_uart_mux_conf(void); void set_mux_conf_regs(void); diff --git a/arch/arm/include/asm/arch-omap3/sys_proto.h b/arch/arm/include/asm/arch-omap3/sys_proto.h index 5979340ac8..ddcb559928 100644 --- a/arch/arm/include/asm/arch-omap3/sys_proto.h +++ b/arch/arm/include/asm/arch-omap3/sys_proto.h @@ -68,7 +68,7 @@ u32 wait_on_value(u32, u32, void *, u32); void cancel_out(u32 *num, u32 *den, u32 den_limit); void sdelay(unsigned long); void make_cs1_contiguous(void); -void omap_nand_switch_ecc(uint32_t, uint32_t); +int omap_nand_switch_ecc(uint32_t, uint32_t); void power_init_r(void); void do_omap3_emu_romcode_call(u32 service_id, u32 parameters); void omap3_set_aux_cr_secure(u32 acr); diff --git a/arch/arm/mach-omap2/omap3/board.c b/arch/arm/mach-omap2/omap3/board.c index 5f5597772b..a727226563 100644 --- a/arch/arm/mach-omap2/omap3/board.c +++ b/arch/arm/mach-omap2/omap3/board.c @@ -269,38 +269,34 @@ void abort(void) *****************************************************************************/ static int do_switch_ecc(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { + int hw, strength = 1; + if (argc < 2 || argc > 3) goto usage; if (strncmp(argv[1], "hw", 2) == 0) { - if (argc == 2) { - omap_nand_switch_ecc(1, 1); - } else { - if (strncmp(argv[2], "hamming", 7) == 0) - omap_nand_switch_ecc(1, 1); - else if (strncmp(argv[2], "bch8", 4) == 0) - omap_nand_switch_ecc(1, 8); + hw = 1; + if (argc == 3) { + if (strncmp(argv[2], "bch8", 4) == 0) + strength = 8; else if (strncmp(argv[2], "bch16", 5) == 0) - omap_nand_switch_ecc(1, 16); - else + strength = 16; + else if (strncmp(argv[2], "hamming", 7) != 0) goto usage; } } else if (strncmp(argv[1], "sw", 2) == 0) { - if (argc == 2) { - omap_nand_switch_ecc(0, 1); - } else { - if (strncmp(argv[2], "hamming", 7) == 0) - omap_nand_switch_ecc(0, 1); - else if (strncmp(argv[2], "bch8", 4) == 0) - omap_nand_switch_ecc(0, 8); - else + hw = 0; + if (argc == 3) { + if (strncmp(argv[2], "bch8", 4) == 0) + strength = 8; + else if (strncmp(argv[2], "hamming", 7) != 0) goto usage; } } else { goto usage; } - return 0; + return -omap_nand_switch_ecc(hw, strength); usage: printf ("Usage: nandecc %s\n", cmdtp->usage);