From patchwork Thu May 22 23:06:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Fritz X-Patchwork-Id: 4227181 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 215D8BF90B for ; Thu, 22 May 2014 23:10:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 447FD2037E for ; Thu, 22 May 2014 23:10:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6D1892037A for ; Thu, 22 May 2014 23:10:46 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wnc5T-0002Os-OY; Thu, 22 May 2014 23:07:47 +0000 Received: from mail-la0-x236.google.com ([2a00:1450:4010:c03::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wnc52-0002Ir-74 for linux-arm-kernel@lists.infradead.org; Thu, 22 May 2014 23:07:21 +0000 Received: by mail-la0-f54.google.com with SMTP id pv20so3245534lab.41 for ; Thu, 22 May 2014 16:07:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kW2yuwzTewSVgiST3echxh68tNj1BuGJV8DfiPcKX30=; b=pIJhkKZ20ilnDoiqQIhpBBw9FsX/6+mKsyqeDbiRHePChK7M5ycPeIKfe3cvDZ1XMU yDQGl2p0huPfye3WQSCtlsW9cQlf7nQ9Rr2T1VewyBauJomR4xFS6FBtDuMf0GCmAYrv eU1rxzQcOYI4IWUFBrfZbeXUKU8q/rZS2/VABOgRc+DSae23wYdwK/JIFMme7YpfGZ+Q XxqP1jMjD1fmuTl158B5CA4kcw2CvX7ot4CcdJNz3f1pnTtK6SsbeGur0lSrMgE7TcXx H6IvRZ33giL2F5Zo8H5AsZ/7bYpRY7iwd/+mgskpoZoeQRlj3awWyKNWEkMCJIW/zsoF VzFg== X-Received: by 10.112.149.71 with SMTP id ty7mr464154lbb.34.1400800020217; Thu, 22 May 2014 16:07:00 -0700 (PDT) Received: from mars.ipredator.se (anon-40-223.vpn.ipredator.se. [46.246.40.223]) by mx.google.com with ESMTPSA id z1sm934544lal.6.2014.05.22.16.06.57 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 22 May 2014 16:06:59 -0700 (PDT) From: Christoph Fritz To: Tony Lindgren , Grygorii Strashko , Pekon Gupta , =?UTF-8?q?Beno=C3=AEt=20Cousson?= Subject: [PATCH 4/5] [RFC] ARM: OMAP2+: gpmc: fix gpmc_hwecc_bch_capable Date: Fri, 23 May 2014 01:06:25 +0200 Message-Id: <1400799986-20043-5-git-send-email-chf.fritz@googlemail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1400799986-20043-1-git-send-email-chf.fritz@googlemail.com> References: <1400799986-20043-1-git-send-email-chf.fritz@googlemail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140522_160720_506054_73C11353 X-CRM114-Status: GOOD ( 12.97 ) X-Spam-Score: -0.1 (/) Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Daniel Mack X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Most dt omap3 boards configure nand-ecc-opt as bch8. Due to lack of hardware elm support, bch8 software implementation gets set. Since commit 0611c41934ab35ce84dea "ARM: OMAP2+: gpmc: update gpmc_hwecc_bch_capable() for new platforms and ECC schemes", nand support stops working. This patch allows ecc software fallback. --- arch/arm/mach-omap2/gpmc-nand.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c index 4349e82..52c4834 100644 --- a/arch/arm/mach-omap2/gpmc-nand.c +++ b/arch/arm/mach-omap2/gpmc-nand.c @@ -43,13 +43,17 @@ static struct platform_device gpmc_nand_device = { .resource = gpmc_nand_resource, }; -static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt) +static bool gpmc_ecc_bch_capable(enum omap_ecc ecc_opt) { /* platforms which support all ECC schemes */ if (soc_is_am33xx() || cpu_is_omap44xx() || soc_is_omap54xx() || soc_is_dra7xx()) return 1; + if ((ecc_opt == OMAP_ECC_BCH4_CODE_HW_DETECTION_SW) || + (ecc_opt == OMAP_ECC_BCH8_CODE_HW_DETECTION_SW)) + return 1; + /* OMAP3xxx do not have ELM engine, so cannot support ECC schemes * which require H/W based ECC error detection */ if ((cpu_is_omap34xx() || cpu_is_omap3630()) && @@ -57,14 +61,6 @@ static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt) (ecc_opt == OMAP_ECC_BCH8_CODE_HW))) return 0; - /* - * For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1 - * and AM33xx derivates. Other chips may be added if confirmed to work. - */ - if ((ecc_opt == OMAP_ECC_BCH4_CODE_HW_DETECTION_SW) && - (!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0))) - return 0; - /* legacy platforms support only HAM1 (1-bit Hamming) ECC scheme */ if (ecc_opt == OMAP_ECC_HAM1_CODE_HW) return 1; @@ -140,7 +136,7 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data, gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs); - if (!gpmc_hwecc_bch_capable(gpmc_nand_data->ecc_opt)) { + if (!gpmc_ecc_bch_capable(gpmc_nand_data->ecc_opt)) { dev_err(dev, "Unsupported NAND ECC scheme selected\n"); return -EINVAL; }