From patchwork Tue Aug 9 17:15:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karl Beldan X-Patchwork-Id: 9271931 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BA74E60839 for ; Tue, 9 Aug 2016 17:17:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A895328375 for ; Tue, 9 Aug 2016 17:17:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D81828389; Tue, 9 Aug 2016 17:17:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2AEA028375 for ; Tue, 9 Aug 2016 17:17:48 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bXAdb-00064z-W6; Tue, 09 Aug 2016 17:16:24 +0000 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bXAcu-0005vK-Rx for linux-arm-kernel@lists.infradead.org; Tue, 09 Aug 2016 17:15:42 +0000 Received: by mail-wm0-x22d.google.com with SMTP id q128so46301988wma.1 for ; Tue, 09 Aug 2016 10:15:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AMo98mFScpaA5nRIytAGkQZTGK7MfChO+V9/i/17EoA=; b=WXTQODcXYnypLg+bzhFXUlP9MUxM6/tnuWXyV1FV/p6egZW8yL6xaEv0CQzqtwHJZr N3Kb9Xp06S2bXNrTXRZIAf947Zwz7V2I4n5gcM6iUfGb9JWDVaxBZnv7gOjlCUEzV8jt 9tA2sToWwp7PIDF0xyonQpcpwZmwVrAT/3IPxy4uH++7IwygqHodYTYjhA2T4PHfp/eO judbP0o3FYy6NuGFxsd2gCgyIcZzwH1yKvi7RXaxWET47pO5pEAIFGZX+U+d00QH4RDq CcTWfhyi4jS98dsHWiM6pdYjfAK1JvmkCYetictx0vJzOCO+k8ai7JZWUnU1JaOlaZqj OAEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AMo98mFScpaA5nRIytAGkQZTGK7MfChO+V9/i/17EoA=; b=JV0I/DKDJjLp1YT5v+ZVGWSMiaUmT2hY8M/cpC6m0XkqZLmZBCMHEt7ddVRwe+9h4E AhQVGsW4SzJ5Q7fddXAxsaSRdijHtL/yJsXxB1aLBm+Xc++1wWng/F316neops1W0RvO 2zGUukcMe1SzzIEX5WjX6D03/xFmZOkfzhhkQNi5qqmK8KA/ZhX7UsVcoImi4t7z8s1S ZWQ9/BIJuKxVWNk+n0tRhE7fRf/IZ79GPcI1D13NwLiDYG2EpBjyw3P24fwrFJa4Sd6U oc2S+jq+nIPsW422Gt/J4H1v5ZYeXLT0EVNxgyHOw6pWfRc4ucCBDcJvX/7o67qH/bs3 50gA== X-Gm-Message-State: AEkooutzLrF+/pR55XLavBatKCeNI7pw/fZTHb8127VtiRe5jLJbw7d+n8Y6mP/5+lcn/pQ5 X-Received: by 10.194.118.70 with SMTP id kk6mr30234832wjb.180.1470762923092; Tue, 09 Aug 2016 10:15:23 -0700 (PDT) Received: from localhost.localdomain (ppp-seco11pa2-46-193-138-19.wb.wifirst.net. [46.193.138.19]) by smtp.gmail.com with ESMTPSA id b186sm4226145wmg.23.2016.08.09.10.15.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Aug 2016 10:15:22 -0700 (PDT) From: Karl Beldan To: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/4] ARM: dts: da850-lcdk: Add NAND to DT Date: Tue, 9 Aug 2016 17:15:17 +0000 Message-Id: <20160809171518.22690-4-kbeldan@baylibre.com> X-Mailer: git-send-email 2.9.2 In-Reply-To: <20160809171518.22690-1-kbeldan@baylibre.com> References: <20160809171518.22690-1-kbeldan@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160809_101541_142267_95B31612 X-CRM114-Status: GOOD ( 17.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Karl Beldan , Kevin Hilman , Sekhar Nori , linux-kernel@vger.kernel.org, Russell King , Rob Herring , Karl Beldan , Santosh Shilimkar MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds DT support for the NAND connected to the SoC AEMIF. The parameters (timings, ecc) are the same as what the board ships with (default AEMIF timings, 1bit ECC) and improvements will be handled in due course. This passed elementary tests hashing a 20MB file on top of ubifs on my LCDK. Signed-off-by: Karl Beldan --- arch/arm/boot/dts/da850-lcdk.dts | 108 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/arch/arm/boot/dts/da850-lcdk.dts b/arch/arm/boot/dts/da850-lcdk.dts index dbcca0b..033380b 100644 --- a/arch/arm/boot/dts/da850-lcdk.dts +++ b/arch/arm/boot/dts/da850-lcdk.dts @@ -27,6 +27,27 @@ &pmx_core { status = "okay"; + + nand_pins: nand_pins { + pinctrl-single,bits = < + /* EMA_WAIT[0], EMA_OE, EMA_WE, EMA_CS[3] */ + 0x1c 0x10110010 0xf0ff00f0 + /* + * EMA_D[0], EMA_D[1], EMA_D[2], + * EMA_D[3], EMA_D[4], EMA_D[5], + * EMA_D[6], EMA_D[7] + */ + 0x24 0x11111111 0xffffffff + /* + * EMA_D[8], EMA_D[9], EMA_D[10], + * EMA_D[11], EMA_D[12], EMA_D[13], + * EMA_D[14], EMA_D[15] + */ + 0x20 0x11111111 0xffffffff + /* EMA_A[1], EMA_A[2] */ + 0x30 0x01100000 0x0ff00000 + >; + }; }; &serial2 { @@ -68,3 +89,90 @@ cd-gpios = <&gpio 64 GPIO_ACTIVE_HIGH>; status = "okay"; }; + +&aemif { + pinctrl-names = "default"; + pinctrl-0 = <&nand_pins>; + status = "ok"; + cs2 { + #address-cells = <2>; + #size-cells = <1>; + clock-ranges; + ranges; + + ti,cs-chipselect = <2>; + + nand@2000000,0 { + compatible = "ti,davinci-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0 0x02000000 0x02000000 + 1 0x00000000 0x00008000>; + + ti,davinci-chipselect = <1>; + ti,davinci-mask-ale = <0>; + ti,davinci-mask-cle = <0>; + ti,davinci-mask-chipsel = <0>; + + /* + * nand_ecc_strength_good will emit a warning + * but the LCDK ships with these settings [1]. + * Also HW 4bits ECC with 16bits NAND seems to + * require some attention. + * + * ATM nand_davinci_probe handling of nand-ecc-* + * is broken, e.g. + * chip.ecc.strength = pdata->ecc_bits occurs after + * scan_ident(), otherwise I would have used: + * nand-ecc-mode = "hw"; + * nand-ecc-strength = <1>; + * nand-ecc-step-size = <512>; + */ + ti,davinci-ecc-mode = "hw"; + ti,davinci-ecc-bits = <1>; + + nand-bus-width= <16>; + nand-on-flash-bbt; + + /* + * LCDK original partitions: + * 0x000000000000-0x000000020000 : "u-boot env" + * 0x000000020000-0x0000000a0000 : "u-boot" + * 0x0000000a0000-0x0000002a0000 : "kernel" + * 0x0000002a0000-0x000020000000 : "filesystem" + * + * The 1st NAND block being guaranted to be valid w/o ECC (> 1k cycles), + * it makes a perfect candidate as an SPL for the BootROM to jump to. + * However the OMAP-L132/L138 Bootloader doc SPRAB41E reads: + * "To boot from NAND Flash, the AIS should be written to NAND block 1 + * (NAND block 0 is not used by default)", which matches the LCDK + * original partitioning. + * Also, the LCDK ships with only the u-boot partition provisioned and + * boots on it in its default configuration while using the MMC for the + * kernel and rootfs, so preserve that one as is for now. + * [1]: Ensuring for example that U-Boot LCDK SPL can handle it properly + * and a proper boot chain ROM->SPL->U-Boot->Linux wrt ECC, would allow + * for a better partitioning. + */ + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot env"; + reg = <0 0x020000>; + }; + partition@0x020000 { + /* The LCDK defaults to booting from this partition */ + label = "u-boot"; + reg = <0x020000 0x080000>; + }; + partition@0x0a0000 { + label = "space"; + reg = <0x0a0000 0>; + }; + }; + }; + }; +};