Implementing NAND driver on a PrimeCell SMC PL350 series

Daniel Tang dt.tangr at gmail.com
Sat Jan 12 05:01:50 EST 2013


On 11/01/2013, at 10:02 PM, Ricard Wanderlof <ricard.wanderlof at axis.com> wrote:

> 
> On Fri, 11 Jan 2013, Daniel Tang wrote:
> 
>> I'm trying to write a NAND driver for the PL350 memory controller.
>> 
>> The problem is that the memory controller abstracts quite a lot of the processes needed to access the NAND. For example, the controller handles all the hardware controlling (like dealing with the CLE and ALE lines). This makes it difficult to write a driver that integrates cleanly with the current NAND subsystem of the kernel.
>> 
>> The issue specifically is the cmd_ctrl function that my driver needs to provide. When the kernel needs to write a command and address, it calls the function multiple times to write all the information. E.g. set CLE, write command, set ALE, then write one byte of the page address at a time. The controller, on the other hand, needs all that information to be in a single write to the controller. It does this by embedding the command into the address and have the data value be the page address.
> 
> Have you looked among the existing NAND controller drivers in drivers/mtd/nand to see if there's another driver which has similar requirements which you could use as a starting point? It's not unusual for NAND controllers to do some of the operations automatically, and the mtd framework supports this by letting you replace higher-level functions with functions from the driver, and not just the low-level functions such as hwcontrol and read_byte.
> 
> /Ricard
> -- 
> Ricard Wolf Wanderlöf                           ricardw(at)axis.com
> Axis Communications AB, Lund, Sweden            www.axis.com
> Phone +46 46 272 2016                           Fax +46 46 13 61 30


I didn't know high level functions could be overridden. Most of the drivers I looked through didn't override the 'nand_command' function for example, so I wasn't aware it was possible.

As per your advice, I also read through some of the other NAND drivers. Although they didn't have anything similar to what I need, I have a good idea of where to head. 

Thanks,


More information about the linux-mtd mailing list