mtd: basic (read only) driver for BCMA serial flash
PATCH v2 1/1 mtd: basic (read only) driver for BCMA serial flash
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.
---
V2: fix mem leak (add failure path in init)
signed-off-by
--- drivers/mtd/devices/Kconfig | 8 ++ drivers/mtd/devices/Makefile | 1 + drivers/mtd/devices/bcm47xxsflash.c | 132 +++++++++++++++++++++++++++++++++++ 3 files changed, 141 insertions(+), 0 deletions(-) create mode 100644 drivers/mtd/devices/bcm47xxsflash.c
drivers/mtd/devices/Kconfig +8 -0
@@ -120,6 +120,14 @@ config MTD_SST25L Set up your spi devices with the right board-specific platform data, if you want to specify device partitioning. +config MTD_BCM47XXSFLASH + tristate "Support for serial flash on BCMA bus" + depends on BCMA_SFLASH && BROKEN + help + BCMA bus can have various flash memories attached, they are + registered by bcma as platform devices. This enables driver for + serial flash memories. + config MTD_SLRAM tristate "Uncached system RAM" help
drivers/mtd/devices/Makefile +1 -0
@@ -19,5 +19,6 @@ obj-$(CONFIG_MTD_DATAFLASH) += mtd_dataflash.o obj-$(CONFIG_MTD_M25P80) += m25p80.o obj-$(CONFIG_MTD_SPEAR_SMI) += spear_smi.o obj-$(CONFIG_MTD_SST25L) += sst25l.o +obj-$(CONFIG_MTD_BCM47XXSFLASH) += bcm47xxsflash.o CFLAGS_docg3.o += -I$(src)
drivers/mtd/devices/bcm47xxsflash.c new file +132 -0
132 lines not on this page · raw message
Signature · 1 line
1.7.7
Quoted 6 lines · Rafał Miłecki
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 <[email protected]>
What are exactly the changes it depends on? URL? Are they staged for 3.7?
drivers/mtd/devices/bcm47xxsflash.c line 62
Quoted 9 lines
drivers/mtd/devices/bcm47xxsflash.c new file +9
-0+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 alsomtd->flags = MTD_CAP_ROM;
would be good to add.
drivers/mtd/devices/bcm47xxsflash.c line 63
Quoted 1 line
drivers/mtd/devices/bcm47xxsflash.c new file +1
-0+ mtd->writesize =1 ;/* FIXME */
Is "FIXME" needed? Why? If needed, write a more descriptive comment.
Also I guessmtd->writebufsize = mtd->writesize;
drivers/mtd/devices/bcm47xxsflash.c line 99
Quoted 8 lines
drivers/mtd/devices/bcm47xxsflash.c new file +8
-0+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?
Signature · 2 lines
Best Regards, Artem Bityutskiy
2012/9/11 Artem Bityutskiy <[email protected]>:
Quoted 10 lines · Rafał Miłecki
Quoted 6 lines
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 <[email protected]>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)
Quoted 5 lines
Quoted 5 lines
drivers/mtd/devices/bcm47xxsflash.c new file +5
-0+static void bcm47xxsflash_fill_mtd (struct bcma_sflash *sflash, +struct mtd_info *mtd) +{ + mtd->priv = sflash; + mtd->name ="bcm47xxsflash" ;
Quoted 8 lines
drivers/mtd/devices/bcm47xxsflash.c line 62
Quoted 4 lines
drivers/mtd/devices/bcm47xxsflash.c new file +4
-0+ 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.
Quoted 6 lines
Quoted 1 line
+
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).
Quoted 11 lines
drivers/mtd/devices/bcm47xxsflash.c line 99
Quoted 8 lines
drivers/mtd/devices/bcm47xxsflash.c new file +8
-0+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?
Signature · 1 line
Rafał
Quoted 9 lines · Rafał Miłecki
2012/9/11 Artem Bityutskiy <[email protected]>:
Quoted 8 lines · Rafał Miłecki
Quoted 6 lines
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 <[email protected]>
Quoted 7 lines
Quoted 2 lines
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)
CCing John. I am not 100% sure how the net drivers are handled, but if John does not rebase and just sends a pull request to David Miller, who also does not rebase, then we could pull John's tree into the MTD tree.
Signature · 2 lines
Best Regards, Artem Bityutskiy
Quoted 13 lines · Artem Bityutskiy
Quoted 12 lines · Rafał Miłecki
2012/9/11 Artem Bityutskiy <[email protected]>:
Quoted 10 lines · Rafał Miłecki
Quoted 6 lines
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 <[email protected]>What are exactly the changes it depends on? URL? Are they staged for 3.7?
Quoted 8 lines
Quoted 4 lines
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)
CCing John. I am not 100% sure how the net drivers are handled, but if John does not rebase and just sends a pull request to David Miller, who also does not rebase, then we could pull John's tree into the MTD tree.
OK, so...never, _ever_ pull from wireless-testing into another tree. The wireless-testing tree is a community sandbox, and sometimes gets messy and sometimes gets rebased.
OTOH, those exact commits are already in wireless-next (and in net-next). That tree will not be rebased, so you can pull from it if you so choose. But, it would generally be better if you only pull from head commits that are already in net-next "just in case". :-)
Let me know if I can be helpful...
John
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.
2012/9/11 Artem Bityutskiy <[email protected]>:
Quoted 13 lines · Rafał Miłecki
Quoted 12 lines
2012/9/11 Artem Bityutskiy <[email protected]>:
Quoted 10 lines · Rafał Miłecki
Quoted 6 lines
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 <[email protected]>What are exactly the changes it depends on? URL? Are they staged for 3.7?
Quoted 8 lines
Quoted 4 lines
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)
CCing John. I am not 100% sure how the net drivers are handled, but if John does not rebase and just sends a pull request to David Miller, who also does not rebase, then we could pull John's tree into the MTD tree.
Not sure if my plans were clear since beginning so just for sure, order I imagined:
1) Me adding mtd drivers
2) Linus releasing 3.7-rc1 with disabled mtd driver and changes from wireless tree
3) Me sending trivial patch enabling mtd driver for -fixes tree
Signature · 1 line
Rafał
Quoted 4 lines · John W. Linville
OTOH, those exact commits are already in wireless-next (and in net-next). That tree will not be rebased, so you can pull from it if you so choose. But, it would generally be better if you only pull from head commits that are already in net-next "just in case". :-)
Thanks, I've pulled 'net-next' to my 'l2-mtd' tree instead, up to the commit Rafał needs:
commit 70f389f0fbbde0d00a5ec4ba4817c09e80a3ae47
Merge: 44e42b9 371a004
Author: Artem Bityutskiy <[email protected]>
Date: Sun Sep 16 14:42:38 2012 +0300
Merge commit '371a00448f95adaa612cf1a0b31a11e7093bc706' of 'git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git'
We need the following 2 patches from the 'net-next' tree for the BCMA flash driver:
371a004 bcma: detect and register NAND flash device d57ef3a bcma: detect and register serial flash device
and this is why we are merging the net-next tree (presumably persistent) up to commit '371a004'.
Signature · 2 lines
Best Regards, Artem Bityutskiy
Quoted 7 lines · Rafał Miłecki
2012/9/11 Artem Bityutskiy <[email protected]>:
Quoted 6 lines · Rafał Miłecki
Quoted 5 lines
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.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Rafał Miłecki <[email protected]>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
Please, remove "BROKEN" and re-send the compilable patch against the l2-mtd.git tree. I've pulled Dave Miller's tree with your patches into l2-mtd.git. Thanks!
Quoted 4 lines
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).
OK. Just add 'mtd->writebufsize = mtd->writesize = 1; for now.
Quoted 2 lines
In case some other driver handling platform device was loaded earlier. Is that wrong?
I do not really understand why you need this - can the general code really call the removal method and the platform data be NULL? If not, kill this check - if this happens, this is a bug and we'll end up with an oops. If it can, please, explain in more details how this can happen.
Signature · 2 lines
Best Regards, Artem Bityutskiy