From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751958AbcFJFHw (ORCPT ); Fri, 10 Jun 2016 01:07:52 -0400 Received: from mail-oi0-f48.google.com ([209.85.218.48]:34479 "EHLO mail-oi0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750994AbcFJFHv (ORCPT ); Fri, 10 Jun 2016 01:07:51 -0400 MIME-Version: 1.0 In-Reply-To: <20160609222307.5db4e67f@bbrezillon> References: <20160603165909.09f27ee0@bbrezillon> <20160609200128.5b7a6e29@bbrezillon> <20160609222307.5db4e67f@bbrezillon> From: Mychaela Falconia Date: Thu, 9 Jun 2016 21:07:49 -0800 Message-ID: Subject: Re: [PATCH 3/4] mtd: nand: Add support for Evatronix NANDFLASH-CTRL To: Boris Brezillon Cc: Ricard Wanderlof , devicetree@vger.kernel.org, Tony Lindgren , linux-kernel@vger.kernel.org, Oleksij Rempel , Linux mtd , Benoit Cousson , Brian Norris , David Woodhouse Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/9/16, Boris Brezillon wrote: > Hm, I think it's changing now that a lot of SoCs are advertised to be > running Linux. But you're right in that existing IPs might not support > this low-level mode. Faraday (the IP vendor in the present case) advertise Linux support as well, but they never mainlined any of it, and instead they provide their own vendor Linux trees. The one I got is based on linux-3.3; I don't know if they have a newer one. They do "support" FTNANDC024 under Linux as well, but their driver for it is gawdawful - see below. > Hm, I don't understand why it's not possible to implement basic > sequences, but I don't know anything about FTNANDC024, so let's assume > you're right. Read the datasheet (link below) and tell me what you think. > Sure, feel free to send it to me, I'll have a look. And maybe you can > also share your code (both the new and old versions of the driver). I decided to go ahead and abuse my personal web space on another (nothing to do with Linux or with NAND flash) project's server for the purpose of sharing this stuff: https://www.freecalypso.org/members/falcon/linux-mtd/ There you will find the IP datasheet, the vendor's driver (GPL), and a current snapshot of my work-in-progress replacement. > Hm, so you can't even move the column pointer within a page > (NAND_CMD_RNDOUT)? See the FTNANDC024 microcode listings on datasheet PDF pages 108 through 117. Every FTNANDC024 operation is an execution of one of these complete microcode routines from start to finish. Just because a given microcode flow includes the issuance of a given NAND command (such as Change Read Column or Change Write Column) does not mean that you could just ask the controller to issue that command by itself, without executing a complete microcode flow which also includes the Read Page or Program Page command. The only workaround would be to write our own microcode. I think this approach would actually work: we could write shorter microcode routines which *just* issue a given NAND opcode and then stop there, and another separate microcode routine (to be invoked via a separate command) which would only do what they call "RD_SP" or "WR_SP" (raw byte transfers of 1 to 32 bytes), without issuing a Read Page command before or a Program Page command after. This approach would allow us to perform truly raw page reads and writes, but it would be very ugly and inefficient. It would also require a separate microcode routine for each different command, NOT one generic microcode routine that would correspond to ->cmd_ctrl() or ->cmdfunc(). M~