[U-Boot] SUNXI NAND CONTROLLER Driver Model (WIP)
Simon Glass
sjg at chromium.org
Fri Oct 10 01:15:40 CEST 2014
Hi Yassin,
On 8 October 2014 18:36, Yassin Jaffer <yassinjaffer at gmail.com> wrote:
>
> Hi
> I'm developing a u-boot driver for the sunxi nand controller https://github.com/yassinjaffer/u-boot. My work is based on bbrezillon mainline driver https://github.com/bbrezillon/linux-sunxi.
> I would like to move the driver to use the DM framework so I'm wondering if someone could kindly give some suggestions on how to accomplish this. I do know that DM is still WIP but I believe that the nand driver can take advantage of the DM since I'm using the FDT for the run-time configuration.
Here are my thoughts. Please be aware that until you actually get into
it it's hard to know exactly which path to take.
Also I think you need to be careful about this as some of the files
are synced with the Linux kernel and that limits your options. You
don't want to turn the code into spaghetti. I think there is a path
forward though, but I suggest starting cautiously.
Start with the 'nand' command, which makes mtd calls. You can see the
calls that it makes and work from there testing as you go.
Add CONFIG_DM_MTD and use that to change between the old code and the
driver model code.
Add a uclass for a NAND driver. I think this corresponds to struct nand_chip.
Then struct nand_chip should become the uclass_priv data for each
device (e.g. the sunxi nand controller). You can see how this was done
with SPI by looking at the SPI uclass. That means that every device
will have this information.
The nand operations should really go in a separate 'ops' structure
that is private to the device, so you could #ifdef those out of struct
nand_chip.
Once you have an approach please check in with the NAND maintainer too.
Regards,
Simon
More information about the U-Boot
mailing list