Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp4758997imc; Mon, 25 Feb 2019 10:27:13 -0800 (PST) X-Google-Smtp-Source: AHgI3IZWIdSMhVUAuOWPvFKxl99IU+Jb8eVZcbduZ8/rktp8g4vOUHh3+cygmn5LyrKcRN3tqe7v X-Received: by 2002:a63:1616:: with SMTP id w22mr20012640pgl.200.1551119233580; Mon, 25 Feb 2019 10:27:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551119233; cv=none; d=google.com; s=arc-20160816; b=FEv9+BNll75LZT43sPjbafhP0cHfjNT5SqwW/T/1PV6ywrOzx7pwdCPaCYfZGMkjnf oNYfnqMhP2+teV80rimwSqpgdzE7t3a2oeERWdOouZOSNNogF10ptgf+WvqXDoTkWAVL X4A+HEPruehenHWkLtbtHL2nliCPdypjZ+JNymAfDGYseiybpliyGzrRuFHZEx/byS4a 7j7ryvHjp038EFH+Fe/uSxDgDpiOYla2tZilaUgnIeKvbufaVWhOoIcOfY8NqGKW4Hlr boR3ttipOa6/2NcnlcOMPvuy7CWvYkl/0Z0WBZbkaRYIGwf301yEtqN88xh1jCkrCdt8 eQ0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=ykpzer4RBcU0VcCznMZdvt8qKc+1G2JLswY5vEVF8KE=; b=hYrebVyGUURhY3PPTm8UUjs2W1rn2C/qy7Ay1OKkzPf504stqBptN4HH13y3+FVvWT nrJMpwpfb+fkEUDay9XFv4JycbppwlY+UKd3yBBAH0oCt6kez1GMljjmS227gWO6t4Fe bvW6fJoV09T5D7sbjbaUi8fRcxtBexhrb/4RJb3VwHWR/qFDP2iO21fh+8wt0SyH2oFU aCLzuV4Fkm2ewWKcRDkQ3f40p8S2pUItJIumQsuzPV3u3b6QZCM9eb3CDrJDe/LbsIOS sIftW9bZLe65NuorFj3Wi5VUPLsGNO13h1tjxuFPGr31Yf7jP2TRTFoyfgLjMdPYe1j2 xE0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cogentembedded-com.20150623.gappssmtp.com header.s=20150623 header.b=cnVrZkEa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s36si10302025pld.46.2019.02.25.10.26.58; Mon, 25 Feb 2019 10:27:13 -0800 (PST) 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; Authentication-Results: mx.google.com; dkim=pass header.i=@cogentembedded-com.20150623.gappssmtp.com header.s=20150623 header.b=cnVrZkEa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728843AbfBYS0b (ORCPT + 99 others); Mon, 25 Feb 2019 13:26:31 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:35222 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725936AbfBYS0a (ORCPT ); Mon, 25 Feb 2019 13:26:30 -0500 Received: by mail-lj1-f196.google.com with SMTP id t13so3949771lji.2 for ; Mon, 25 Feb 2019 10:26:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ykpzer4RBcU0VcCznMZdvt8qKc+1G2JLswY5vEVF8KE=; b=cnVrZkEa0+E2BDaBa9Bqu+PZyTg/T7u4ILs8kHP+zOTrFDaY6CjejkKtzzEEs9+41m vOFG5x/+cOvsmCEPzFpbmwzfS8YGkytQ0V9jHaNRK+YlguIxVhQhxsdz6wtu7IpcFmOV TFGwvuKdNFUFn2lX6lKSWWhjuSYnNdgmMn13s+++3g7cSe3DqeIbQP6s27DVSsDLCUtm yV6GIRG3JqhVcYviv7X/pFadwNA8qIhASPBvjxbX52UL1WGej1xpgqkRv/P14viBCgQC GL4q/kjMb8xMzz3qlJ36Byy5pMDu4ufxkU/NHX3naueT2/4qVC3F1aCZetbcdj7nX4Ly rWtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=ykpzer4RBcU0VcCznMZdvt8qKc+1G2JLswY5vEVF8KE=; b=X2UF7l1w4v53vFZHh6w/82KCpaCbi9iFFyvGylJJW7cWjfeOmLqk59N4JkSCKptTJT u/0hv8EhpWgaRHhl0Hj9MpkcDK7ONkqYuTgED57tjhtKK16XlSTvOahf7aFBcj2/T570 ydU9K88oI8Qio7qi8jGPM94uM7VW68AFBoqTyAt0HsVqMOIHngIMG799SZiYtOctZiTQ jT9FFCmCkoCO2LiQL3xztMA7v+pK3wCsHc5bEStDErxY/ndF3lBFwDjeTSDNPUku2KMP De7gZQ3UEkN2z7HEG3EY8l/VnqLU3hLJrNWRfeWocId5h0Awr4C3O4m4FQ8DGzXilGHt HxjA== X-Gm-Message-State: AHQUAuY2rcPWakaMH/w59eg24dp5uXrf0kuA/+j59l6UmtIxFTq2Ebuh qJxzYcGJD16YfX28jyLue6XFBw== X-Received: by 2002:a2e:7806:: with SMTP id t6mr9568859ljc.188.1551119187463; Mon, 25 Feb 2019 10:26:27 -0800 (PST) Received: from wasted.cogentembedded.com ([31.173.84.85]) by smtp.gmail.com with ESMTPSA id r64sm1608761lff.77.2019.02.25.10.26.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Feb 2019 10:26:26 -0800 (PST) Subject: Re: [RFC PATCH 3/5] mtd: Add support for Hyperbus memory devices To: "Vignesh R (by way of Boris Brezillon )" , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Rob Herring Cc: devicetree@vger.kernel.org, Arnd Bergmann , tudor.ambarus@microchip.com, Greg Kroah-Hartman , nsekhar@ti.com, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org References: <20190219063607.29949-1-vigneshr@ti.com> <20190219063607.29949-4-vigneshr@ti.com> From: Sergei Shtylyov Organization: Cogent Embedded Message-ID: <92bfdbf8-cc78-c691-298d-d2eb6193e1be@cogentembedded.com> Date: Mon, 25 Feb 2019 21:26:25 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20190219063607.29949-4-vigneshr@ti.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-MW Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/19/2019 09:36 AM, Vignesh R (by way of Boris Brezillon ) wrote: > Cypress HyperBus is Low Signal Count, High Performance Double Data Rate Bus > interface between a host system master and one or more slave interfaces. > HyperBus is used to connect microprocessor, microcontroller, or ASIC > devices with random access NOR flash memory(called HyperFlash) or > self refresh DRAM(called HyperRAM). > > Its a 8-bit data bus (DQ[7:0]) with Read-Write Data Strobe (RWDS) > signal and either Single-ended clock(3.0V parts) or Differential clock > (1.8V parts). It uses ChipSelect lines to select b/w multiple slaves. > At bus level, it follows a separate protocol described in HyperBus > specification[1]. > > HyperFlash follows CFI AMD/Fujitsu Extended Command Set (0x0002) similar > to that of existing parallel NORs. Since Hyperbus is x8 DDR bus, HyperBus, please be consistent. > its equivalent to x16 parallel NOR flash wrt bits per clk. But Hyperbus Again... > operates at >166MHz frequencies. > HyperRAM provides direct random read/write access to flash memory > array. > > But, Hyperbus memory controllers seem to abstract implementation details And again. > and expose a simple MMIO interface to access connected flash. > > Add support for registering HyperFlash devices with MTD framework. MTD > maps framework along with CFI chip support framework are used to support > communicate with flash. > > Framework is modelled along the lines of spi-nor framework. HyperBus > memory controller(HBMC) drivers call hb_register_device() to register a > single HyperFlash device. HyperFlash core parses MMIO access > information from DT, sets up the map_info struct, probes CFI flash and > registers it with MTD framework. > > Some HBMC masters need calibration/training sequence[3] to be carried > out, in order for DLL inside the controller to lock, by reading a known > string/pattern. This is done by repeatedly reading CFI Query > Identification String. Calibration needs to be done before try to detect > flash as part of CFI flash probe. > > HyperRAM is not supported atm. > > HyperBus specification can be found at[1] > HyperFlash datasheet can be found at[2] > > [1] https://www.cypress.com/file/213356/download > [2] https://www.cypress.com/file/213346/download > [3] http://www.ti.com/lit/ug/spruid7b/spruid7b.pdf > Table 12-5741. HyperFlash Access Sequence > > Signed-off-by: Vignesh R [...] > diff --git a/drivers/mtd/hyperbus/core.c b/drivers/mtd/hyperbus/core.c > new file mode 100644 > index 000000000000..d3d44aab7503 > --- /dev/null > +++ b/drivers/mtd/hyperbus/core.c > @@ -0,0 +1,167 @@ [...] > +/* Calibrate HBMC by repeatedly reading "QRY" string from CFI space */ > +static int hb_calibrate(struct hb_device *hbdev) > +{ > + struct map_info *map = &hbdev->map; > + struct cfi_private cfi; > + int count = HB_CALIB_COUNT; > + int ret; > + > + cfi.interleave = 1; > + cfi.device_type = CFI_DEVICETYPE_X16; > + cfi_send_gen_cmd(0xF0, 0, 0, map, &cfi, cfi.device_type, NULL); > + cfi_send_gen_cmd(0x98, 0x55, 0, map, &cfi, cfi.device_type, NULL); > + > + while (count--) > + cfi_qry_present(map, 0, &cfi); Why do all 25 reads if you can encounter valid QRY in less reads than 25? > + > + ret = cfi_qry_present(map, 0, &cfi); > + cfi_qry_mode_off(0, map, &cfi); > + > + return ret; > +} [...] MBR, Sergei