[PATCH V2] mtd: basic (read only) driver for BCMA serial flash

Rafał Miłecki zajec5 at gmail.com
Tue Sep 11 06:35:18 EDT 2012


2012/9/11 Artem Bityutskiy <dedekind1 at gmail.com>:
> On Mon, 2012-09-03 at 21:07 +0200, Rafał Miłecki wrote:
>> This registers MTD driver for serial flash platform device. Right now it
>> supports reading only, writing still has to be implemented.
>> At this point it's marked as BROKEN, because it requires code present in
>> net tree that wasn't mainlined yet.
>>
>> Signed-off-by: Rafał Miłecki <zajec5 at gmail.com>
>
> What are exactly the changes it depends on? URL? Are they staged for
> 3.7?

http://git.kernel.org/?p=linux/kernel/git/linville/wireless-testing.git;a=commitdiff;h=23cb3b2121323443834296a8ecb582b8aeb78d75
http://git.kernel.org/?p=linux/kernel/git/linville/wireless-testing.git;a=commitdiff;h=d57ef3a6a2eeb88df47e892c66692e3f59722ffe

(Yes, there are queued to be pulled during 3.7 merge window)


>> +static void bcm47xxsflash_fill_mtd(struct bcma_sflash *sflash,
>> +                                struct mtd_info *mtd)
>> +{
>> +     mtd->priv = sflash;
>> +     mtd->name = "bcm47xxsflash";
>> +     mtd->owner = THIS_MODULE;
>> +     mtd->type = MTD_ROM;
>> +     mtd->size = sflash->size;
>> +     mtd->_read = bcm47xxsflash_read;
>
> I guess also
> mtd->flags = MTD_CAP_ROM;
> would be good to add.

Thanks.


>> +     mtd->writesize = 1; /* FIXME */
>
> Is "FIXME" needed? Why? If needed, write a more descriptive comment.
>
> Also I guess
> mtd->writebufsize = mtd->writesize;

Well, I just didn't implement writing yet (it's more complicated than
that trivial reads) and I didn't know the correct values for the above
ones. I just set writesize to 1 to avoid some WARN/BUG (not remember
right now).


>> +static int __devexit bcm47xxsflash_remove(struct platform_device *pdev)
>> +{
>> +     struct bcma_sflash *sflash = dev_get_platdata(&pdev->dev);
>> +
>> +     if (!sflash->mtd) {
>> +             WARN_ON(1);
>> +             return -ENODEV;
>> +     }
>
> Why do you need this check with a warning? Can this happen, in which
> cases?

In case some other driver handling platform device was loaded earlier.
Is that wrong?

-- 
Rafał



More information about the linux-mtd mailing list