Add MTD core & partition
PATCH 1/1 Add MTD core & partition
It's preparation for UBI codes.
UBI uses partition and get & put mtd devices
---
drivers/mtd/Makefile +1 -0
@@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk LIB := $(obj)libmtd.a +COBJS-$(CONFIG_CMD_UBI) += mtdcore.o mtdpart.o COBJS-$(CONFIG_HAS_DATAFLASH) += at45.o COBJS-$(CONFIG_FLASH_CFI_DRIVER) += cfi_flash.o COBJS-$(CONFIG_HAS_DATAFLASH) += dataflash.o
drivers/mtd/mtdcore.c new file +142 -0
142 lines not on this page · raw message
drivers/mtd/mtdpart.c new file +531 -0
531 lines not on this page · raw message
PATCH 1/1 Add MTD core & partition
Dear Kyungmin Park,
Quoted 2 lines · In message <20080829081323.GA4269@july> you wrote:
It's preparation for UBI codes.
UBI uses partition and get & put mtd devices
Please co-ordinate any UBI-related work with Stefan Roese.
I will not apply any UBI related patches unless I have his ACK.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Tactical? TACTICAL!?!? Hey, buddy, we went from kilotons to megatons several minutes ago. We don't need no stinkin' tactical nukes. (By the way, do you have change for 10 million people?) - lwall
PATCH 1/1 Add MTD core & partition
Dear Wolfgang,
Quoted 8 lines
Quoted 2 lines · In message <20080829081323.GA4269@july> you wrote:
It's preparation for UBI codes.
UBI uses partition and get & put mtd devicesPlease co-ordinate any UBI-related work with Stefan Roese.
I will not apply any UBI related patches unless I have his ACK.
Sure, I agreed your opinions.
Then how about to crate u-boot-ubi tree for others?
Now we are using UBI both NAND and OneNAND. To do this, we also change OneNAND command to support UBI fully. but previous patch it doesn't have.
I want to share our works at least UBI.
If you have more opinions please let me know.
Thank you,
Kyungmin Park
PATCH 1/1 Add MTD core & partition
Kyungmi,
Quoted 6 lines · Kyungmin Park
Quoted 6 lines
Quoted 2 lines
It's preparation for UBI codes.
UBI uses partition and get & put mtd devicesPlease co-ordinate any UBI-related work with Stefan Roese.
I will not apply any UBI related patches unless I have his ACK.
I have no objections to this patch. So here my:
But I think it would be a good idea if Scott Wood could also take a look at this patch (and the whole UBI integration) since this UBI integration also touches "his" NAND infrastructure.
Scott, any comments?
Quoted 2 lines
Sure, I agreed your opinions.
Then how about to crate u-boot-ubi tree for others?
Good idea. Please see below.
Quoted 5 lines
Now we are using UBI both NAND and OneNAND. To do this, we also change OneNAND command to support UBI fully. but previous patch it doesn't have.
I want to share our works at least UBI.
We really appreciate this. Thanks a lot.
Quoted 1 line
If you have more opinions please let me know.
We will add an new u-boot-ubi repository and would like you to become the custodian. Would you accept this? Do you (or anybody else) have other volunteers for this job?
If you accept this and nobody objects, please send your public SSH key to Wolfgang in a private mail, so that he can create the new repository for you.
Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH 1/1 Add MTD core & partition
In reply to Kyungmin ParkQuoted 2 lines · Kyungmin Park
It's preparation for UBI codes.
UBI uses partition and get & put mtd devices
Please import the latest MTD code; there have been several cleanups/fixes in mtdpart.c recently (in particular, the patches from Atsushi Nemoto dated Jul 19).
As for the #if 0 blocks, I'd rather leave them out entirely -- I think the increased readability would be worth the occasional extra merge conflict when importing new upstream code.
drivers/mtd/Makefile include $(TOPDIR)/config.mk · line 28
Quoted 11 lines
Signed-off-by Kyungmin Park <[email protected]>---
drivers/mtd/Makefile +1
-0@@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk LIB := $(obj)libmtd.a +COBJS-$(CONFIG_CMD_UBI) += mtdcore.o mtdpart.o
Is UBI the only case where we want the generic MTD infrastructure? Maybe we can remove some duplication and/or add partition support elsewhere.
Quoted 9 lines
drivers/mtd/Makefile +0
-0COBJS-$(CONFIG_HAS_DATAFLASH) += at45.o COBJS-$(CONFIG_FLASH_CFI_DRIVER) += cfi_flash.o COBJS-$(CONFIG_HAS_DATAFLASH) += dataflash.odrivers/mtd/mtdcore.c new file +0
-0
drivers/mtd/mtdcore.c line 10
Quoted 10 lines
drivers/mtd/mtdcore.c new file +10
-0@@ -0,0 +1,142 @@ +/* +* $Id: mtdcore.c,v 1.47 2005/11/07 11:14:20 gleixner Exp $ +* +* Core registration and callback routines for MTD +* drivers and users. +*/ + +#include <linux/mtd/mtd.h> +#include <mtd_uboot.h> +#include <ubi_uboot.h>
I don't see mtd_uboot.h or ubi_uboot.h in the current tree, nor are they added by this patch.
Is this patch supposed to depend on the giant UBI patch (I'd think not, since the changelog says it's preparing for UBI)?
Quoted 19 lines
drivers/mtd/mtdcore.c new file +19
-0+/** +* del_mtd_device - unregister an MTD device +* @mtd: pointer to MTD device info structure +* +* Remove a device from the list of MTD devices present in the system, +* and notify each currently active MTD 'user' of its departure. +* Returns zero on success or 1 on failure, which currently will happen +* if the requested device does not appear to be present in the list. +*/ +int del_mtd_device (struct mtd_info *mtd) +{ +int ret; + +if (mtd_table[mtd->index] != mtd) { + ret = -ENODEV ; + }else if (mtd->usecount) { +printk (KERN_NOTICE "Removing MTD device #%d (%s) with use count %d\n" , + mtd->index, mtd->name, mtd->usecount); + ret = -EBUSY ;
drivers/mtd/mtdcore.c line 68
Quoted 10 lines
drivers/mtd/mtdcore.c new file +10
-0+ }else { +/* No need to get a refcount on the module containing +* the notifier, since we hold the mtd_table_mutex */ + mtd_table[mtd->index] =NULL ; + + ret =0 ; + } + +return ret; +}
We should remove all the refcounting/removal stuff -- it's just bloat in u-boot.
-Scott
PATCH 1/1 Add MTD core & partition
Quoted 4 lines · Scott Wood
Quoted 2 lines · Kyungmin Park
It's preparation for UBI codes.
UBI uses partition and get & put mtd devices
Quoted 8 lines
Please import the latest MTD code; there have been several cleanups/fixes in
mtdpart.crecently (in particular, the patches from Atsushi Nemoto dated Jul 19).As for the #if 0 blocks, I'd rather leave them out entirely -- I think the increased readability would be worth the occasional extra merge conflict when importing new upstream code.
That's the reason I want to create new tree to sync u-boot tree. At that time there's no point, ecc_stats, and ... fields at mtd_info, So I disable it. Now it's included and we can remove #if 0.
Quoted 7 lines
Quoted 7 lines
---
drivers/mtd/Makefile +0
-0@@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk
Quoted 6 lines
drivers/mtd/Makefile include $(TOPDIR)/config.mk · line 28
Quoted 3 lines
drivers/mtd/Makefile +1
-0LIB := $(obj)libmtd.a +COBJS-$(CONFIG_CMD_UBI) += mtdcore.o mtdpart.oIs UBI the only case where we want the generic MTD infrastructure? Maybe we can remove some duplication and/or add partition support elsewhere.
Yes I agree. As I know there's no users to use mtdpart. Instead it used another mtdpart format at mtdpart command. Next time it changes from previous one to MTD infrastructure.
Quoted 51 lines
Quoted 10 lines
drivers/mtd/Makefile +0
-0COBJS-$(CONFIG_HAS_DATAFLASH) += at45.o COBJS-$(CONFIG_FLASH_CFI_DRIVER) += cfi_flash.o COBJS-$(CONFIG_HAS_DATAFLASH) += dataflash.odrivers/mtd/mtdcore.c new file +0
-0drivers/mtd/mtdcore.c line 10
Quoted 10 lines
drivers/mtd/mtdcore.c new file +10
-0@@ -0,0 +1,142 @@ +/* +* $Id: mtdcore.c,v 1.47 2005/11/07 11:14:20 gleixner Exp $ +* +* Core registration and callback routines for MTD +* drivers and users. +*/ + +#include <linux/mtd/mtd.h> +#include <mtd_uboot.h> +#include <ubi_uboot.h> I don't see
mtd_uboot.horubi_uboot.hin the current tree, nor are they added by this patch.Is this patch supposed to depend on the giant UBI patch (I'd think not, since the changelog says it's preparing for UBI)?
Quoted 24 lines
drivers/mtd/mtdcore.c new file +24
-0+/** +* del_mtd_device - unregister an MTD device +* @mtd: pointer to MTD device info structure +* +* Remove a device from the list of MTD devices present in the system, +* and notify each currently active MTD 'user' of its departure. +* Returns zero on success or 1 on failure, which currently will happen +* if the requested device does not appear to be present in the list. +*/ +int del_mtd_device (struct mtd_info *mtd) +{ +int ret; + +if (mtd_table[mtd->index] != mtd) { + ret = -ENODEV ; + }else if (mtd->usecount) { +printk (KERN_NOTICE "Removing MTD device #%d (%s) with use count %d\n" , + mtd->index, mtd->name, mtd->usecount); + ret = -EBUSY ; + }else { +/* No need to get a refcount on the module containing +* the notifier, since we hold the mtd_table_mutex */ + mtd_table[mtd->index] =NULL ; +
Quoted 8 lines
drivers/mtd/mtdcore.c line 68
Quoted 5 lines
drivers/mtd/mtdcore.c new file +5
-0+ ret =0 ; + } + +return ret; +}We should remove all the refcounting/removal stuff -- it's just bloat in u-boot.
I don't want to remove or modify imported codes at least MTD & UBI codes.
Thank you,
Kyungmin Park
PATCH 1/1 Add MTD core & partition
In reply to Kyungmin ParkQuoted 4 lines · Kyungmin Park <kmpark <at> infradead.org> writes:
It's preparation for UBI codes.
UBI uses partition and get & put mtd devices
...
Hi,
how far have you got?
We are planning to integrate UBI in u-boot too (NOR flashes), so if all is already done - or will be in next time - we could spare some hours ...
Kind Regards,
Michael
PATCH 1/1 Add MTD core & partition
Quoted 3 lines · Michael Lawnick
how far have you got?
We are planning to integrate UBI in u-boot too (NOR flashes), so if all is already done - or will be in next time - we could spare some hours ...
We also have a project to integrate UBI support into U-Boot. The real UBI work will start in 2-3 weeks. We really should coordinate our work on this.
BTW: Which NOR FLASH driver are you using? The common CFI driver? It has no real connection to the MTD layer which is needed for the UBI port from Kyungmin. Did you think about this?
Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH 1/1 Add MTD core & partition
Quoted 6 lines · Stefan Roese <sr <at> denx.de> writes:
Quoted 3 lines · Michael Lawnick
how far have you got?
We are planning to integrate UBI in u-boot too (NOR flashes), so if all is already done - or will be in next time - we could spare some hours ...
Quoted 7 lines
We also have a project to integrate UBI support into U-Boot. The real UBI work will start in 2-3 weeks. We really should coordinate our work on this.
BTW: Which NOR FLASH driver are you using? The common CFI driver? It has no real connection to the MTD layer which is needed for the UBI port from Kyungmin. Did you think about this?
We are using CFI driver for AM29GL512.
As said we are _planning_ to integrate, i.e. I'm currently gathering information. We need r/o access from u-boot to find our kernel and boot it. Writing to flash could be done from Linux.
What are the problems to face?
Kind Regards,
Michael
PATCH 1/1 Add MTD core & partition
Quoted 8 lines · Michael Lawnick
Quoted 3 lines
BTW: Which NOR FLASH driver are you using? The common CFI driver? It has no real connection to the MTD layer which is needed for the UBI port from Kyungmin. Did you think about this?
We are using CFI driver for AM29GL512.
As said we are _planning_ to integrate, i.e. I'm currently gathering information. We need r/o access from u-boot to find our kernel and boot it. Writing to flash could be done from Linux.
Understood.
Quoted 1 line
What are the problems to face?
As I mentioned the CFI driver is missing the interface to the MTD layer. This is available for NAND and OneNAND but missing for NOR in the U-Boot CFI implementation. It really is not needed right now and such an extension has to be made carefully since it adds new code which increases the image size of all boards using this driver. The only option (I can think of) to not increase the image size for those boards would be to add this MTD connection via #ifdef's. But this will not help to make the code more readable. :-(
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH 1/1 Add MTD core & partition
Quoted 15 lines · Stefan Roese <sr <at> denx.de> writes:
Quoted 8 lines · Michael Lawnick
Quoted 3 lines
BTW: Which NOR FLASH driver are you using? The common CFI driver? It has no real connection to the MTD layer which is needed for the UBI port from Kyungmin. Did you think about this?
We are using CFI driver for AM29GL512.
As said we are _planning_ to integrate, i.e. I'm currently gathering information. We need r/o access from u-boot to find our kernel and boot it. Writing to flash could be done from Linux.Understood.
Quoted 1 line
What are the problems to face?
Quoted 8 lines
As I mentioned the CFI driver is missing the interface to the MTD layer. This is available for NAND and OneNAND but missing for NOR in the U-Boot CFI implementation. It really is not needed right now and such an extension has to be made carefully since it adds new code which increases the image size of all boards using this driver. The only option (I can think of) to not increase the image size for those boards would be to add this MTD connection via #ifdef's. But this will not help to make the code more readable.
Hmm, seems I've got some problems to understand.
If there is a clearly defined API (which I haven't found yet) it should be independent from H/W (NAND/NOR/SRAM/...) IMHO. If not, UBI will be NAND-only :-( Could you give me a kick into the right direction, so I will find e.g. a .h file where the functions are listed that have to be supported by H/W-layer driver?
#ifdef's could be avoided by using a different sort of driver for the same H/W, e.g. cfi_flash and cfi_ubi_flash.
Kind regards,
Michael