Generic Platform NAND Driver

Semih Hazar semih.hazar at indefia.com
Tue May 22 07:53:06 EDT 2007


Vladimir A. Barinov wrote:
>>
>> +ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned 
>> int ctrl)
>> +{
>> +    struct nand_chip *this = mtd->priv;
>> +    int offset = (int)this->priv;
>>
>> Here offset is read from nand_chip->priv, which actually points to 
>> struct plat_nand_data of plat_nand.c
>>
>> Am I wrong ? 
> I agree with you.
> And you are right that all things work fine because the 
> mtd_info->priv->priv that points to plat_nand_data is not used.
>
> I agree that the line 54 in plat_nand.c should be removed:
>
> -    data->chip.priv = &data;
>
>
> But does it really usefull to create void * host pointer if it could 
> be done in arch code like the above patch does?
I thought board-specific code can make use of this area (just as in your 
patch) so it's good to be able pass some _known_ data there.

My code which uses generic nand and is very much like the patch you've 
sent. But we may have board specific CLE, ACE, CE pins so they're not 
#define'd in the machine code, rather they're passed in a struct from 
the board code. And I thought the right thing to so that would be to 
pass that data to the priv member rather than accessing it in a static way.

If it's better to access have these board-specific in a static manner, 
then I'll just go ahead and change my code that way.

Thanks for your feedback.

Regards,
-- 
Semih Hazar







More information about the linux-mtd mailing list