From patchwork Tue Mar 25 08:19:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 26969 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3407320062 for ; Tue, 25 Mar 2014 08:21:00 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wn1sf485104obc.9 for ; Tue, 25 Mar 2014 01:20:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=fJECuB+F1W59pBC0O1pP6ABjOq8pnDboM9RiVrs/f9c=; b=hO/ypydGielXEDG6xGC3fPpiLzg37sxSoY3yshQI67ixC8zvl44NZYm9otwTNp244j rgDll1VtTktp6qwWAp5GRdNWya7QHCLwXOpFKRQqay84M8V5PqNFNHokrItgccODGchb BT7Km1NEuaUJPVcvSMmWXsxK+21TqQ2jXsYr4aL19zMTbhonD155RIEEE5LWJ9A8onGy MLgMdQwtWFq2eQQ0ehoWObbEbwl9K2eQXkGcPvaa1CjpxfWJF2rhVu6blPm6FqytsjRL Iv9avPvouoXH86n9OwNQifvvX4nhifEX+AhfzTjbeuM22zS7AS6tUaB3z3tfIrwpz0xx cLdw== X-Gm-Message-State: ALoCoQmcwbSjp6usV5K8FbXSxA4xun0lDsTlhoIzFZ1+TIiAaENFLPhUe4Tf+qFic3ciZTIN4wiV X-Received: by 10.182.213.5 with SMTP id no5mr14361509obc.15.1395735659765; Tue, 25 Mar 2014 01:20:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.81.8 with SMTP id e8ls133103qgd.39.gmail; Tue, 25 Mar 2014 01:20:59 -0700 (PDT) X-Received: by 10.58.238.35 with SMTP id vh3mr53762695vec.16.1395735659649; Tue, 25 Mar 2014 01:20:59 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id kp12si3580235veb.174.2014.03.25.01.20.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:20:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id lh14so127518vcb.34 for ; Tue, 25 Mar 2014 01:20:59 -0700 (PDT) X-Received: by 10.52.72.48 with SMTP id a16mr4901124vdv.19.1395735659563; Tue, 25 Mar 2014 01:20:59 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp285267vck; Tue, 25 Mar 2014 01:20:58 -0700 (PDT) X-Received: by 10.68.234.2 with SMTP id ua2mr76904844pbc.81.1395735657685; Tue, 25 Mar 2014 01:20:57 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si10867939pbq.405.2014.03.25.01.20.57; Tue, 25 Mar 2014 01:20:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752533AbaCYIU3 (ORCPT + 26 others); Tue, 25 Mar 2014 04:20:29 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:37379 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752385AbaCYIUX (ORCPT ); Tue, 25 Mar 2014 04:20:23 -0400 Received: by mail-wi0-f181.google.com with SMTP id hm4so341851wib.2 for ; Tue, 25 Mar 2014 01:20:21 -0700 (PDT) X-Received: by 10.180.107.136 with SMTP id hc8mr21578594wib.11.1395735621753; Tue, 25 Mar 2014 01:20:21 -0700 (PDT) Received: from lee--X1.home (host109-148-113-193.range109-148.btcentralplus.com. [109.148.113.193]) by mx.google.com with ESMTPSA id k4sm5567676wib.19.2014.03.25.01.20.19 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:20:20 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: lee.jones@linaro.org, kernel@stlinux.com, computersforpeace@gmail.com, linux-mtd@lists.infradead.org, dwmw2@infradead.org, angus.clark@st.com, pekon@ti.com Subject: [RFC 02/47] mtd: nand: add ONFI NAND Timing Mode Specifications Date: Tue, 25 Mar 2014 08:19:19 +0000 Message-Id: <1395735604-26706-3-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1395735604-26706-1-git-send-email-lee.jones@linaro.org> References: <1395735604-26706-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch adds a new structure, 'nand_timing_spec', to capture the A/C timing characteristics of NAND devices. Unfortunately, there is no universally accepted standard for defining NAND timing parameters. Different datasheets list different sets of parameters. The ONFI standard gets close, but support is missing from some of the major NAND manufacturers (e.g. Samsung, Toshiba). Here we have followed broadly the ONFI timing definitions. We also provide specifications for the six standard ONFI timing modes, in terms of the new nand_timing_spec structure. This will allow fully automated configuration of the timing registers when using ONFI-compliant NAND. Signed-off-by: Lee Jones --- drivers/mtd/nand/nand_ids.c | 165 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/mtd/nand.h | 34 +++++++++ 2 files changed, 199 insertions(+) diff --git a/drivers/mtd/nand/nand_ids.c b/drivers/mtd/nand/nand_ids.c index a87b0a3..12f769d 100644 --- a/drivers/mtd/nand/nand_ids.c +++ b/drivers/mtd/nand/nand_ids.c @@ -175,6 +175,171 @@ struct nand_manufacturers nand_manuf_ids[] = { EXPORT_SYMBOL(nand_manuf_ids); EXPORT_SYMBOL(nand_flash_ids); +/* + * ONFI NAND Timing Mode Specifications + * + * Note, 'tR' field (maximum page read time) is extracted from the ONFI + * parameter page during device probe. + */ +struct nand_timing_spec nand_onfi_timing_specs[] = { + /* + * ONFI Timing Mode '0' (supported on all ONFI compliant devices) + */ + [0] = { + .tCLS = 50, + .tCS = 70, + .tALS = 50, + .tDS = 40, + .tWP = 50, + .tCLH = 20, + .tCH = 20, + .tALH = 20, + .tDH = 20, + .tWB = 200, + .tWH = 30, + .tWC = 100, + .tRP = 50, + .tREH = 30, + .tRC = 100, + .tREA = 40, + .tRHOH = 0, + .tCEA = 100, + .tCOH = 0, + .tCHZ = 100, + }, + + /* + * ONFI Timing Mode '1' + */ + [1] = { + .tCLS = 25, + .tCS = 35, + .tALS = 25, + .tDS = 20, + .tWP = 25, + .tCLH = 10, + .tCH = 10, + .tALH = 10, + .tDH = 10, + .tWB = 100, + .tWH = 15, + .tWC = 45, + .tRP = 25, + .tREH = 15, + .tRC = 50, + .tREA = 30, + .tRHOH = 15, + .tCEA = 45, + .tCOH = 15, + .tCHZ = 50, + }, + + /* + * ONFI Timing Mode '2' + */ + [2] = { + .tCLS = 15, + .tCS = 25, + .tALS = 15, + .tDS = 15, + .tWP = 17, + .tCLH = 10, + .tCH = 10, + .tALH = 10, + .tDH = 5, + .tWB = 100, + .tWH = 15, + .tWC = 35, + .tRP = 17, + .tREH = 16, + .tRC = 35, + .tREA = 25, + .tRHOH = 15, + .tCEA = 30, + .tCOH = 15, + .tCHZ = 50, + }, + + /* + * ONFI Timing Mode '3' + */ + [3] = { + .tCLS = 10, + .tCS = 25, + .tALS = 10, + .tDS = 10, + .tWP = 15, + .tCLH = 5, + .tCH = 5, + .tALH = 5, + .tDH = 5, + .tWB = 100, + .tWH = 10, + .tWC = 30, + .tRP = 15, + .tREH = 10, + .tRC = 30, + .tREA = 20, + .tRHOH = 15, + .tCEA = 25, + .tCOH = 15, + .tCHZ = 50, + }, + + /* + * ONFI Timing Mode '4' (EDO only) + */ + [4] = { + .tCLS = 10, + .tCS = 20, + .tALS = 10, + .tDS = 10, + .tWP = 12, + .tCLH = 5, + .tCH = 5, + .tALH = 5, + .tDH = 5, + .tWB = 100, + .tWH = 10, + .tWC = 25, + .tRP = 12, + .tREH = 10, + .tRC = 25, + .tREA = 20, + .tRHOH = 15, + .tCEA = 25, + .tCOH = 15, + .tCHZ = 30, + }, + + /* + * ONFI Timing Mode '5' (EDO only) + */ + [5] = { + .tCLS = 10, + .tCS = 15, + .tALS = 10, + .tDS = 7, + .tWP = 10, + .tCLH = 5, + .tCH = 5, + .tALH = 5, + .tDH = 5, + .tWB = 100, + .tWH = 7, + .tWC = 20, + .tRP = 10, + .tREH = 7, + .tRC = 20, + .tREA = 16, + .tRHOH = 15, + .tCEA = 25, + .tCOH = 15, + .tCHZ = 30, + } +}; +EXPORT_SYMBOL(nand_onfi_timing_specs); + MODULE_LICENSE("GPL"); MODULE_AUTHOR("Thomas Gleixner "); MODULE_DESCRIPTION("Nand device & manufacturer IDs"); diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index f7b6a53..0d456b4 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -326,6 +326,40 @@ struct onfi_ext_param_page { */ } __packed; +/* + * NAND Device Timing Specification + * + * All values in nano seconds, except where specified. + */ +struct nand_timing_spec { + int tR; /* Max Page Read delay [us]*/ + int tCLS; /* Min CLE setup time */ + int tCS; /* Min CE setup time */ + int tALS; /* Min ALE setup time */ + int tDS; /* Min Data setup time */ + int tWP; /* Min WE pulse width */ + int tCLH; /* Min CLE hold time */ + int tCH; /* Min CE hold time */ + int tALH; /* Min ALE hold time */ + int tDH; /* Min Data hold time */ + int tWB; /* Max WE high to busy */ + int tWH; /* Min WE hold time */ + int tWC; /* Min Write cycle time */ + int tRP; /* Min RE pulse width */ + int tREH; /* Min RE high hold time */ + int tRC; /* Min Read cycle time */ + int tREA; /* Max Read access time */ + int tRHOH; /* Min RE high to output hold */ + int tCEA; /* Max CE access time */ + int tCOH; /* Min CE high to output hold */ + int tCHZ; /* Max CE high to output high Z */ + int tCSD; /* Min CE high to ALE/CLE don't care */ +}; + +/* ONFI define 6 timing modes */ +#define NAND_ONFI_TIMING_MODES 6 +extern struct nand_timing_spec nand_onfi_timing_specs[]; + /** * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices * @lock: protection lock