summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/partition.c
Commit message (Collapse)AuthorAgeFilesLines
* mtd: nand: Update to Linux-5.9Sascha Hauer2020-11-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This updates the barebox NAND layer and parts of the mtd layer to Linux-5.9. This patch is huge, but the barebox NAND layer is so far away from the Linux NAND layer that a step by step update would have taken ages. Unlike Linux barebox has functions to mark a block as good. This feature has been preserved. Also barebox used to make NAND write support optional, this feature is lost during the update for the sake of better compatibility to the Linux NAND layer. This patch has been tested: - GPMI aka nand_mxs on i.MX6 - nand_imx on i.MX25 - nand_omap_gpmc on AM335x - atmel_nand on Atmel sama5d3 - nand_denali on SoCFPGA Currently untested: - nand_orion - nand_mrvl_nfc - nand_s3c24xx The nand_denali driver is tested with the update of that driver to Linux-5.9 following in the next patch. I could only test the drivers with the NAND chips found on my boards, so there's still enough room for regressions, especially given that the NAND drivers themselves are mostly not updated. With the NAND layer being up-to-date with Linux it should hopefully be easy to update drivers to their Linux counterpart as well if necessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Add ecc_step_sizeSascha Hauer2020-11-091-0/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: rename master to parentSascha Hauer2020-11-091-15/+15
| | | | | | | In Linux mtd->parent is what in barebox is mtd->master. Rename this to get closer to the Linux mtd layer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: rename class_dev to devSascha Hauer2020-11-091-1/+1
| | | | | | | | The mtds own device is named 'dev' in the Kernel whereas it's named 'class_dev' in barebox. Rename it to 'dev' for better compatilibility to the Kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Use classdev->parentSascha Hauer2020-11-091-1/+1
| | | | | | | | | | Instead of mtd->parent we can use mtd->classdev.parent which points to the same device. With this we can remove the 'parent' member of struct mtd_info. This member exists in the Linux kernel as well, but is of type struct mtd_info, so this is done as preparation to re-add mtd->parent with the same type as in Linux. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Add underscore prefix to mtd hooksSascha Hauer2020-11-061-23/+23
| | | | | | | In the Kernel the mtd function hooks begin with an underscore. Do the same in barebox to be better comparable to the Kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fs: devfs-core: replace DEVFS_IS_PARTITION flag with pointer to the master cdevSascha Hauer2017-03-311-0/+2
| | | | | | | | Instead of having a flag indicating a cdev is a partition on some master cdev, just add a master pointer to the cdev, so that we can also find out who the master is. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: mtdpart: Add oob_read functionSascha Hauer2016-03-151-0/+22
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Add support for marking blocks as goodSascha Hauer2016-03-151-0/+16
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: partition: implement write_oobSascha Hauer2015-06-121-0/+13
| | | | | | To enable mtd_write_oob for partitions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Use flags parameter in mtd_add_partitionSascha Hauer2015-02-121-0/+1
| | | | | | | | mtd_add_partition is passed a flag parameter. This has been unused so the DEVFS_PARTITION_FIXED and DEVFS_PARTITION_READONLY were ignored. Fix this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: partitions: Add error checkSascha Hauer2015-02-121-1/+10
| | | | | | add_mtd_device can fail. Add an error check and bail out properly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: partitions: Use xstrdupSascha Hauer2015-02-121-1/+1
| | | | | | The return value of strdup is not checked. Use xstrdup instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers/mtd: fix NULL pointer dereference in partition lock/unlockZahari Doychev2014-07-091-0/+6
| | | | | | | | Some mtd device does not support lock and unlock functions. Adding this check avoids crashing when mtd_part_lock/unlock are called for such devices. Signed-off-by: Zahari Doychev <zahari.doychev@linux.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: delete partition erase size initialisationRenaud Barbier2014-07-031-1/+0
| | | | | | | Delete the partition erase size initialisation to let the code that follows determine the biggest partition erase size. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: partition: implement lock/unlockSascha Hauer2014-06-101-0/+28
| | | | | | | CFI Nor flashes need lock/unlock which is not implemented for partitions. Fix this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: partition: Fix multi eraseregion chipsSascha Hauer2014-06-101-17/+24
| | | | | | | | | | | | | The current code counts the eraseregions a new partition spans and sets the partitions number of eraseregions accordingly, but the code forgets to allocate and fill in the eraseregions for the partition mtd device. This makes the erase operation crash with a NULL pointer exception. This patch fixes this with the same approach the kernel uses: Set the number of eraseregions to 1 unconditionally and the eraseregion size to the maximum of the eraseregions found in the partition. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: partitions: only add write functions when mtd write support is enabledSascha Hauer2014-05-151-3/+6
| | | | | | Makes the binary a few bytes smaller. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: partition: Remove unused variableAlexander Shiyan2014-04-231-3/+0
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Support for 4GB partitionsDmitry Lavnikevich2014-03-121-2/+2
| | | | | | | | | This patch implements correct way of creating partitions on mtd devices with size >= 4GB. Signed-off-by: Dmitry Lavnikevich <d.lavnikevich@sam-solutions.com> Signed-off-by: Grigory Milev <g.milev@sam-solutions.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: register mtd partitions as real mtd devicesSascha Hauer2014-02-261-0/+8
| | | | | | | | So far mtd partitions were mtd devices, but these were not registered. This patch changes this. mtd partitions are now registered like real mtd devices. This makes them part of the device hierarchy. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: partition: make the mtd device the parent of the partitionSascha Hauer2014-02-261-1/+1
| | | | | | | Parent of a partition should be the parent mtd device, not its parent. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: partition: only copy selected fields to partitionSascha Hauer2014-02-261-1/+12
| | | | | | | | struct mtd_info contains members which should not be copied to the new partition, like for example the class_dev, so only copy selected members of struct mtd_info to the partition. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Simplify partitionsSascha Hauer2014-02-131-45/+31
| | | | | | | Embed the partition information in struct mtd_info. This makes the mtd partition code simpler. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: introduce mtd_block_isbadJean-Christophe PLAGNIOL-VILLARD2012-11-031-1/+1
| | | | | | | | this allow to do not provide block_isbad at mtd driver level as example spi flash Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* add partition mtd supportSascha Hauer2010-07-051-0/+143
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>