mtd: rawnand: Remove docg4
Subsystems (5)
PATCH v2 1/4 mtd: rawnand: Remove docg4
The diskonchip G4 driver does not fit very well in the raw/parallel NAND framework simply because such chips have an internal controller translating DoC-specific commands into NAND ones.
Keeping such a driver in the raw NAND framework is a real burden for NAND maintainers.
Not to mention that some parts of this driver are a bit worrisome:
- writes are done by subpages, even though we're interfacing with an MLC chip which are known to not support subpage writes very well (it might be that the FTL handles the complexity for us though)
- some part of the code are simply ignoring return codes of function that can fail in a few occasions
- there's a hack to support OOB writes when no data is provided. This operation is not supported by the chip and should have been rejected, and nandwrite and other userspace tools should have been patched to deal with such devices
- the driver is apparently broken when ignore_badblocks module param is not set to 1 and nobody noticed that (don't know since when this is the case, but it's not a recent change)
http://lists.infradead.org/pipermail/linux-mtd/2018-July/082472.html
Add to that the fact that we already have a docg3 driver in drivers/mtd/devices/docg3.c and, looking at the code (and regs), it seems docg3 and docg4 have a lot in common (even the author of this driver seemed to have realized that interfacing with the raw NAND framework might have been a bad idea
http://lists.infradead.org/pipermail/linux-mtd/2012-January/039517.html).
For all these reasons, I'm proposing to remove this driver. If anyone ever wants to add support for this chip back, I'd suggest extending the docg3 driver instead of adding a completely new driver.
---
Changes in v2:
- none
--- drivers/mtd/nand/raw/Kconfig | 20 - drivers/mtd/nand/raw/Makefile | 1 - drivers/mtd/nand/raw/docg4.c | 1442 ----------------------------------------- 3 files changed, 1463 deletions(-) delete mode 100644 drivers/mtd/nand/raw/docg4.c
drivers/mtd/nand/raw/Kconfig +0 -20
@@ -227,26 +227,6 @@ config MTD_NAND_DISKONCHIP_BBTWRITE load time (assuming you build diskonchip as a module) with the module parameter "inftl_bbt_write=1". -config MTD_NAND_DOCG4 - tristate "Support for DiskOnChip G4" - depends on HAS_IOMEM - select BCH - select BITREVERSE - help - Support for diskonchip G4 nand flash, found in various smartphones and - PDAs, among them the Palm Treo680, HTC Prophet and Wizard, Toshiba - Portege G900, Asus P526, and O2 XDA Zinc. - - With this driver you will be able to use UBI and create a ubifs on the - device, so you may wish to consider enabling UBI and UBIFS as well. - - These devices ship with the Mys/Sandisk SAFTL formatting, for which - there is currently no mtd parser, so you may want to use command line - partitioning to segregate write-protected blocks. On the Treo680, the - first five erase blocks (256KiB each) are write-protected, followed - by the block containing the saftl partition table. This is probably - typical. - config MTD_NAND_SHARPSL tristate "Support for NAND Flash on Sharp SL Series (C7xx + others)" depends on ARCH_PXA || COMPILE_TEST
drivers/mtd/nand/raw/Makefile +0 -1
@@ -15,7 +15,6 @@ obj-$(CONFIG_MTD_NAND_S3C2410) += s3c2410.o obj-$(CONFIG_MTD_NAND_TANGO) += tango_nand.o obj-$(CONFIG_MTD_NAND_DAVINCI) += davinci_nand.o obj-$(CONFIG_MTD_NAND_DISKONCHIP) += diskonchip.o -obj-$(CONFIG_MTD_NAND_DOCG4) += docg4.o obj-$(CONFIG_MTD_NAND_FSMC) += fsmc_nand.o obj-$(CONFIG_MTD_NAND_SHARPSL) += sharpsl.o obj-$(CONFIG_MTD_NAND_NANDSIM) += nandsim.o
drivers/mtd/nand/raw/docg4.c deleted +0 -1442
1,442 lines not on this page · raw message
Signature · 1 line
2.14.1
PATCH v2 2/4 ARM: pxa: palmtreo: Drop docg4 specific init
The docg4 driver has been removed. Remove the code that was registering a docg4 device.
---
Changes in v2:
- new patch
--- arch/arm/mach-pxa/palmtreo.c | 31 ------------------------------- 1 file changed, 31 deletions(-)
arch/arm/mach-pxa/palmtreo.c +0 -31
@@ -403,36 +403,6 @@ static void __init palmtreo_leds_init(void)platform_device_register (&palmtreo_leds); } -/****************************************************************************** -* diskonchip docg4 flash -******************************************************************************/ -#if defined(CONFIG_MACH_TREO680 ) -/* REVISIT: does the centro have this device also? */ -#if IS_ENABLED (CONFIG_MTD_NAND_DOCG4 ) -static struct resource docg4_resources[] = { - { - .start =0x00000000 , - .end =0x00001FFF , - .flags =IORESOURCE_MEM , - }, -}; - -static struct platform_device treo680_docg4_flash = { - .name ="docg4" , - .id =-1 , - .resource = docg4_resources, - .num_resources =ARRAY_SIZE (docg4_resources), -}; - -static void __init treo680_docg4_flash_init (void ) -{ -platform_device_register (&treo680_docg4_flash); -} -#else -static inline void treo680_docg4_flash_init (void ) {} -#endif -#endif -/****************************************************************************** * Machine init ******************************************************************************/
@@ -517,7 +487,6 @@ static void __init treo680_init(void)treo680_gpio_init ();palm27x_mmc_init (GPIO_NR_TREO_SD_DETECT_N ,GPIO_NR_TREO680_SD_READONLY , GPIO_NR_TREO680_SD_POWER, 0); - treo680_docg4_flash_init(); }#endif
Signature · 1 line
2.14.1
Re: [PATCH v2 2/4] ARM: pxa: palmtreo: Drop docg4 specific init
Quoted 5 lines · Boris Brezillon
The docg4 driver has been removed. Remove the code that was registering a docg4 device.
Suggested-by Miquel Raynal <[email protected]>Signed-off-by Boris Brezillon <[email protected]>
No answer for several weeks from the maintainers, so let's say they lost interest.
Cheers.
Signature · 1 line
Robert
Miquel Raynal
maintainerRe: [PATCH v2 2/4] ARM: pxa: palmtreo: Drop docg4 specific init
Hi Robert,
Robert Jarzmik <[email protected]> wrote on Sun, 19 Aug 2018 21:38:30 +0200:
Quoted 11 lines
Quoted 5 lines · Boris Brezillon
The docg4 driver has been removed. Remove the code that was registering a docg4 device.
Suggested-by Miquel Raynal <[email protected]>Signed-off-by Boris Brezillon <[email protected]>No answer for several weeks from the maintainers, so let's say they lost interest.
Acked-by Robert Jarzmik <[email protected]>
I'm about to pick this series including this patch, do you need an immutable branch?
Thanks,
Miquèl
Robert Jarzmik
maintainerRe: [PATCH v2 2/4] ARM: pxa: palmtreo: Drop docg4 specific init
Quoted 12 lines · Miquel Raynal
Hi Robert,
Robert Jarzmik <[email protected]> wrote on Sun, 19 Aug 2018 21:38:30 +0200:
Quoted 7 lines
Quoted 5 lines · Boris Brezillon
The docg4 driver has been removed. Remove the code that was registering a docg4 device.
Suggested-by Miquel Raynal <[email protected]>Signed-off-by Boris Brezillon <[email protected]>
Quoted 7 lines
Quoted 4 lines
No answer for several weeks from the maintainers, so let's say they lost interest.
Acked-by Robert Jarzmik <[email protected]>I'm about to pick this series including this patch, do you need an immutable branch?
No I don't think so. This time I expect this cycle to be lightweight for the pxa part, so go ahead.
Cheers.
Signature · 1 line
Robert
A message that is not in the archive (sent off-list or not yet received): [email protected]
Miquel Raynal
maintainerRe: [EXT] Re: nand speed test
Hi Kostya,
Kostya Porotchkin <[email protected]> wrote on Sun, 19 Aug 2018 14:12:16 +0000:
Quoted 18 lines
Hi, Miguel,
We clearly have a problem with BBT on this 8K-page NAND.
The Linux driver is unable to find BBT after reboot, even if it reports that the new table was written upon previous boot. It looks like the u-boot also lost the BBT information after reboot.
So something is not yet working well with this 4GB device.Marvell>> nand info
Device 0: nand0, sector size 1024 KiB
Page size 8192 b
OOB size 448 b
Erase size 1048576 b
subpagesize 8192 b
options 0x 200
bbt options 0x a0000
Marvell>> nand bad
Quoted 9 lines
Device 0 bad blocks:
ff800000
ff900000
ffa00000
ffb00000
ffc00000
ffd00000
ffe00000
fff00000
This enlarging list is very likely to show a mismatch between U-Boot and Linux ECC configuration, you should check that first. It will probably explain why BBT is not recognized.
Thanks,
Miquèl
RE: [EXT] Re: nand speed test
Hi, Miguel,
I see the same issue in u-boot.
When I run "nand bad", it takes some time to scan and write the BBT, so the second call to this function returns fast (I believe the BBT is cached in DRAM). However after reset the "nand bad" again takes time to return, so I believe the BBT was not written in previous session.
Regards
Kosta
Quoted 52 lines
-----Original Message-----
From: Miquel Raynal [mailto:[email protected]]
Sent: Monday, August 20, 2018 10:47
To: Kostya Porotchkin <[email protected]>
Cc: Daniel Mack <[email protected]>; Haojian Zhuang <[email protected]>; Richard Weinberger <[email protected]>; linux- [email protected]; David Woodhouse <[email protected]>; Brian Norris <[email protected]>; Marek Vasut <[email protected]>; Mike Dunn <[email protected]>; Sergey Larin <[email protected]>
Subject: Re: [EXT] Re: nand speed testHi Kostya,
Kostya Porotchkin <[email protected]> wrote on Sun, 19 Aug 2018 14:12:16 +0000:
Quoted 4 lines
Hi, Miguel,
We clearly have a problem with BBT on this 8K-page NAND.
The Linux driver is unable to find BBT after reboot, even if it reports thatthe new table was written upon previous boot.
Quoted 14 lines
It looks like the u-boot also lost the BBT information after reboot. So something is not yet working well with this 4GB device.
Marvell>> nand info
Device 0: nand0, sector size 1024 KiB
Page size 8192 b
OOB size 448 b
Erase size 1048576 b
subpagesize 8192 b
options 0x 200
bbt options 0x a0000
Marvell>> nand badQuoted 9 lines
Device 0 bad blocks:
ff800000
ff900000
ffa00000
ffb00000
ffc00000
ffd00000
ffe00000
fff00000This enlarging list is very likely to show a mismatch between U-Boot and Linux ECC configuration, you should check that first. It will probably explain why BBT is not recognized.
Thanks,
Miquèl
PATCH v2 3/4 mtd: rawnand: Make maxchips an unsigned int
In reply to Boris BrezillonThere's no good reason to make maxchips a signed integer, since only positive values are valid. Make it an unsigned int.
---
Changes in v2:
- new patch
--- drivers/mtd/nand/raw/nand_base.c | 7 ++++--- include/linux/mtd/rawnand.h | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/mtd/nand/raw/nand_base.c +4 -3
@@ -5965,11 +5965,12 @@ static int nand_dt_init(struct nand_chip *chip)* prevented dynamic allocations during this phase which was unconvenient and * as been banned for the benefit of the ->init_ecc()/cleanup_ecc() hooks. */ -static int nand_scan_ident (struct mtd_info *mtd,int maxchips, +static int nand_scan_ident (struct mtd_info *mtd,unsigned int maxchips,struct nand_flash_dev *table) { -int i, nand_maf_id, nand_dev_id; +int nand_maf_id, nand_dev_id;struct nand_chip *chip =mtd_to_nand (mtd); +unsigned int i;int ret;/* Enforce the right timings for reset/detection */
@@ -6780,7 +6781,7 @@ static void nand_detach(struct nand_chip *chip)* The flash ID is read and the mtd/chip structures are filled with the * appropriate values. */ -int nand_scan_with_ids (struct mtd_info *mtd,int maxchips, +int nand_scan_with_ids (struct mtd_info *mtd,unsigned int maxchips,struct nand_flash_dev *ids) {struct nand_chip *chip =mtd_to_nand (mtd);
include/linux/mtd/rawnand.h +2 -2
@@ -27,10 +27,10 @@struct nand_flash_dev ;/* Scan and identify a NAND device */ -int nand_scan_with_ids (struct mtd_info *mtd,int max_chips, +int nand_scan_with_ids (struct mtd_info *mtd,unsigned int max_chips,struct nand_flash_dev *ids); -static inline int nand_scan (struct mtd_info *mtd,int max_chips) +static inline int nand_scan (struct mtd_info *mtd,unsigned int max_chips) {return nand_scan_with_ids (mtd, max_chips,NULL ); }
Signature · 1 line
2.14.1
PATCH v2 4/4 mtd: rawnand: Do not treat !maxchips specially in nand_scan_with_ids()
In reply to Boris BrezillonThe only reason we were skipping nand_scan_ident() when maxchips == 0 was to make the docg4 to work. Now that this driver is gone we can remove this special case and return an error when maxchips is 0.
---
Changes in v2:
- new patch
--- drivers/mtd/nand/raw/nand_base.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/mtd/nand/raw/nand_base.c +7 -8
@@ -6772,9 +6772,7 @@ static void nand_detach(struct nand_chip *chip)/** * nand_scan_with_ids - [NAND Interface] Scan for the NAND device * @mtd: MTD device structure -* @maxchips: number of chips to scan for. @nand_scan_ident() will not be run if -* this parameter is zero (useful for specific drivers that must -* handle this part of the process themselves, e.g docg4). +* @maxchips: number of chips to scan for. * @ids: optional flash IDs table * * This fills out all the uninitialized function pointers with the defaults.
@@ -6787,11 +6785,12 @@ int nand_scan_with_ids(struct mtd_info *mtd, unsigned int maxchips,struct nand_chip *chip =mtd_to_nand (mtd);int ret; -if (maxchips) { - ret =nand_scan_ident (mtd, maxchips, ids); -if (ret) -return ret; - } +if (!maxchips) +return -EINVAL ; + + ret =nand_scan_ident (mtd, maxchips, ids); +if (ret) +return ret; ret =nand_attach (chip);if (ret)
Signature · 1 line
2.14.1
Robert Jarzmik
maintainerQuoted 6 lines · Boris Brezillon
The diskonchip G4 driver does not fit very well in the raw/parallel NAND framework simply because such chips have an internal controller translating DoC-specific commands into NAND ones.
Keeping such a driver in the raw NAND framework is a real burden for NAND maintainers.
Hi Boris,
I understand the "burden" part, yet we all have our burdens as old code maintainers. But still, you're going to remove a working driver from one of my platforms. This is not something I'm really happy about.
At least, I'd like to hear from Mike that he doesn't use this anymore.
Cheers.
--
Robert
Hi Robert,
Quoted 6 lines · On Sun, 05 Aug 2018 21:12:11 +0200 Robert Jarzmik <[email protected]>…
Quoted 4 lines · Boris Brezillon
The diskonchip G4 driver does not fit very well in the raw/parallel NAND framework simply because such chips have an internal controller translating DoC-specific commands into NAND ones.
Quoted 6 lines
Quoted 2 lines
Keeping such a driver in the raw NAND framework is a real burden for NAND maintainers.
Hi Boris,
I understand the "burden" part, yet we all have our burdens as old code maintainers.
Well, we have plenty of old drivers to maintain, but this one clearly stands out in that it should never have been interfaced with the NAND framework (the docg4 command set is completely different from the parallel NAND command set). Note that you did not put docg3 in the NAND framework, and after looking at the driver and the spec, I think you were right, because docg3/4 clearly did (and do) not fit in the NAND framework.
Quoted 2 lines
But still, you're going to remove a working driver from one of my platforms. This is not something I'm really happy about.
I wouldn't be so prompt at saying the driver works, this patch says the opposite [1], and it's apparently not something that has been broken recently.
Quoted 2 lines
At least, I'd like to hear from Mike that he doesn't use this anymore.
I'd also like to hear back from Sergey (who posted [1]). As I said in my RFC, I'm not opposed to keeping support for docg4 as long as it goes out of drivers/mtd/nand/raw, either by being merged with the docg3 driver (whose reg layout looks surprisingly similar) or be being interfaced with the recently introduced bus agnostic NAND layer. But if nobody shows interest in helping me getting this driver reworked the proper way, I'm not willing to keep it.
Regards,
Boris
Miquel Raynal
maintainerHi Boris,
Boris Brezillon <[email protected]> wrote on Sat, 4 Aug 2018 22:59:20 +0200:
Quoted 44 lines
The diskonchip G4 driver does not fit very well in the raw/parallel NAND framework simply because such chips have an internal controller translating DoC-specific commands into NAND ones.
Keeping such a driver in the raw NAND framework is a real burden for NAND maintainers.
Not to mention that some parts of this driver are a bit worrisome:
- writes are done by subpages, even though we're interfacing with an MLC chip which are known to not support subpage writes very well (it might be that the FTL handles the complexity for us though)
- some part of the code are simply ignoring return codes of function that can fail in a few occasions
- there's a hack to support OOB writes when no data is provided. This operation is not supported by the chip and should have been rejected, and nandwrite and other userspace tools should have been patched to deal with such devices
- the driver is apparently broken when
ignore_badblocksmodule param is not set to 1 and nobody noticed that (don't know since when this is the case, but it's not a recent change)
http://lists.infradead.org/pipermail/linux-mtd/2018-July/082472.htmlAdd to that the fact that we already have a docg3 driver in
drivers/mtd/devices/docg3.cand, looking at the code (and regs), it seems docg3 and docg4 have a lot in common (even the author of this driver seemed to have realized that interfacing with the raw NAND framework might have been a bad idea
http://lists.infradead.org/pipermail/linux-mtd/2012-January/039517.html).For all these reasons, I'm proposing to remove this driver. If anyone ever wants to add support for this chip back, I'd suggest extending the docg3 driver instead of adding a completely new driver.
Signed-off-by Boris Brezillon <[email protected]>Cc Mike Dunn <[email protected]>Cc Robert Jarzmik <[email protected]>Cc Sergey Larin <[email protected]>---
Changes in v2:
- none
Quoted 6 lines
--- drivers/mtd/nand/raw/Kconfig | 20 - drivers/mtd/nand/raw/Makefile | 1 - drivers/mtd/nand/raw/docg4.c | 1442 ----------------------------------------- 3 files changed, 1463 deletions(-) delete mode 100644 drivers/mtd/nand/raw/docg4.c
Series applied to nand/next.
Thanks,
Miquèl