From patchwork Wed Mar 12 18:07:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 329611 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 55D942C00B5 for ; Thu, 13 Mar 2014 05:15:40 +1100 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WNnfc-0001dz-Ox; Wed, 12 Mar 2014 18:14:25 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WNnah-0006AT-F2; Wed, 12 Mar 2014 18:09:19 +0000 Received: from mail-we0-x233.google.com ([2a00:1450:400c:c03::233]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WNnZk-00060Z-3t; Wed, 12 Mar 2014 18:08:29 +0000 Received: by mail-we0-f179.google.com with SMTP id x48so11625134wes.38 for ; Wed, 12 Mar 2014 11:07:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KDVXQyfffUuuGVcRQ1RyjaB0izXhEScyKky2nwmZp7Y=; b=lNZXvY4HtsB0B7nZwWU7/Z6wPTE11Amq1F9QHtkIl0XpZ2LvDlVzk10JsvDaxUqWWB RGPie10kN+mC5hiPjMKcQ38vR9guiIhI6/hw7/LoN86I+q9jOv/GlC5sIKCo3LtsVxoZ Z7t6RwpGvQaFT5M4urf71lIeYJiRG56n/R1mYAPZmFDlxxbiQ3x822X20rCS9xFzfGPM YD6dmCoHQ5KVeADIjtsXE6HqPX4yMydqUQyJ3l/AXI9+x25Y9yfsTs+q1pDAkekMtSCG uzHDuEE7R3TpbGyOWNMKSrHsnSuiDOJxEo+1hKkk0ryqdREJhVhqD4ifiN/cXr7cMSNw z22Q== X-Received: by 10.194.1.242 with SMTP id 18mr5321099wjp.22.1394647675346; Wed, 12 Mar 2014 11:07:55 -0700 (PDT) Received: from localhost.localdomain (col31-4-88-188-80-5.fbx.proxad.net. [88.188.80.5]) by mx.google.com with ESMTPSA id bj3sm71576119wjb.14.2014.03.12.11.07.53 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Mar 2014 11:07:54 -0700 (PDT) From: Boris BREZILLON To: Maxime Ripard , Rob Herring , David Woodhouse , Grant Likely , Brian Norris , Jason Gunthorpe , Arnd Bergmann Subject: [PATCH v3 3/9] of: mtd: add NAND timing mode retrieval support Date: Wed, 12 Mar 2014 19:07:38 +0100 Message-Id: <1394647664-8258-4-git-send-email-b.brezillon.dev@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1394647664-8258-1-git-send-email-b.brezillon.dev@gmail.com> References: <1394647664-8258-1-git-send-email-b.brezillon.dev@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140312_140821_042905_4CC436BD X-CRM114-Status: GOOD ( 12.04 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (b.brezillon.dev[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: devicetree@vger.kernel.org, Boris BREZILLON , linux-doc@vger.kernel.org, dev@linux-sunxi.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add a function to retrieve NAND timing mode (ONFI timing mode) from a given DT node. Signed-off-by: Boris BREZILLON --- drivers/of/of_mtd.c | 19 +++++++++++++++++++ include/linux/of_mtd.h | 8 ++++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/of/of_mtd.c b/drivers/of/of_mtd.c index b7361ed..8bdaa0b 100644 --- a/drivers/of/of_mtd.c +++ b/drivers/of/of_mtd.c @@ -117,3 +117,22 @@ bool of_get_nand_on_flash_bbt(struct device_node *np) return of_property_read_bool(np, "nand-on-flash-bbt"); } EXPORT_SYMBOL_GPL(of_get_nand_on_flash_bbt); + +/** + * of_get_nand_timings - Get nand timings for the given device_node + * @np: Pointer to the given device_node + * + * return 0 on success errno other wise + */ +int of_get_nand_onfi_timing_mode(struct device_node *np) +{ + int err; + u32 mode; + + err = of_property_read_u32(np, "onfi,nand-timing-mode", &mode); + if (err) + return err; + + return mode; +} +EXPORT_SYMBOL_GPL(of_get_nand_onfi_timing_mode); diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h index e266caa..c8310ae 100644 --- a/include/linux/of_mtd.h +++ b/include/linux/of_mtd.h @@ -9,6 +9,8 @@ #ifndef __LINUX_OF_MTD_H #define __LINUX_OF_MTD_H +#include + #ifdef CONFIG_OF_MTD #include @@ -17,6 +19,7 @@ int of_get_nand_ecc_step_size(struct device_node *np); int of_get_nand_ecc_strength(struct device_node *np); int of_get_nand_bus_width(struct device_node *np); bool of_get_nand_on_flash_bbt(struct device_node *np); +int of_get_nand_onfi_timing_mode(struct device_node *np); #else /* CONFIG_OF_MTD */ @@ -45,6 +48,11 @@ static inline bool of_get_nand_on_flash_bbt(struct device_node *np) return false; } +static inline int of_get_nand_onfi_timing_mode(struct device_node *np) +{ + return -ENOSYS; +} + #endif /* CONFIG_OF_MTD */ #endif /* __LINUX_OF_MTD_H */