mtd: removals and simplifications
cover mtd: removals and simplifications
This is the second version of the patch-set. This time I removed the full ID support provisioning part and decided to keep it separate, so this patch-set is basically about misc. clean-ups, code simplifications and removals of old and unused cruft.
The museum ID patch changed - it now removes only 256-byte NAND pages support.
Brian, I've addressed your review comments. I did not put your Acked-by to all of the patches, only to the one you explicitly Acked. But I can add it to all of the patches if you let me know.
Thanks,
Artem.
PATCH 1/11 mtd: nand_ids: minor clean-ups
From: Artem Bityutskiy <[email protected]>
Clean-up the code a little bit:
* clean-up commentaries.
* move macro definitions to the top of the file.
--- drivers/mtd/nand/nand_ids.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
drivers/mtd/nand/nand_ids.c +13 -17
@@ -10,17 +10,17 @@*/ #include <linux/module.h> #include <linux/mtd/nand.h> + +#define LP_OPTIONS NAND_SAMSUNG_LP_OPTIONS +#define LP_OPTIONS16 (LP_OPTIONS | NAND_BUSWIDTH_16) +/* -* Chip ID list -* -* Name. ID code, pagesize, chipsize in MegaByte, eraseblock size, -* options -* -* Pagesize; 0, 256, 512 -* 0 get this information from the extended chip ID -+ 256 256 Byte page size -* 512 512 Byte page size -*/ +* The chip ID list: +* name, device ID, page size, chip size in MiB, eraseblock size, options +* +* If page size and eraseblock size are 0, the sizes are taken from the +* extended chip ID. +*/ struct nand_flash_dev nand_flash_ids[] = {#ifdef CONFIG_MTD_NAND_MUSEUM_IDS
@@ -67,11 +67,9 @@ struct nand_flash_dev nand_flash_ids[] = { {"NAND 256MiB 3,3V 8-bit", 0x71, 512, 256, 0x4000, 0},/* -* These are the new chips with large page size. The pagesize and the -* erasesize is determined from the extended id bytes +* These are the new chips with large page size. Their page size and +* eraseblock size are determined from the extended ID bytes. */ -#define LP_OPTIONS NAND_SAMSUNG_LP_OPTIONS -#define LP_OPTIONS16 (LP_OPTIONS | NAND_BUSWIDTH_16)/* 512 Megabit */ {"NAND 64MiB 1,8V 8-bit", 0xA2, 0, 64, 0, LP_OPTIONS},
@@ -162,9 +160,7 @@ struct nand_flash_dev nand_flash_ids[] = { {NULL,} }; -/* -* Manufacturer ID list -*/ +/* Manufacturer IDs */ struct nand_manufacturers nand_manuf_ids[] = { {NAND_MFR_TOSHIBA ,"Toshiba" }, {NAND_MFR_SAMSUNG ,"Samsung" },
Signature · 1 line
1.7.10.4
PATCH 2/11 mtd: decommission the NAND museum
In reply to Artem BityutskiyFrom: Artem Bityutskiy <[email protected]>
The MTD subsystem has its own small museum of ancient NANDs in a form of the CONFIG_MTD_NAND_MUSEUM_IDS configuration option. The museum contains stone age NANDs with 256 bytes pages, as well as iron age NANDs with 512 bytes per page and up to 8MiB page size.
It is with great sorrow that I inform you that the museum is being decommissioned. The MTD subsystem is out of budget for Kconfig options and already has too many of them, and there is a general kernel trend to simplify the configuration menu.
We remove the stone age exhibits along with closing the museum, but the iron age ones are transferred to the regular NAND depot, since there is still a remote possibility that they may be useful for someone.
--- drivers/mtd/nand/Kconfig | 8 -------- drivers/mtd/nand/nand_ids.c | 28 ++++++++++------------------ 2 files changed, 10 insertions(+), 26 deletions(-)
drivers/mtd/nand/Kconfig +0 -8
@@ -41,14 +41,6 @@ config MTD_SM_COMMON tristate default n -config MTD_NAND_MUSEUM_IDS - bool "Enable chip ids for obsolete ancient NAND devices" - default n - help - Enable this option only when your board has first generation - NAND chips (page size 256 byte, erase size 4-8KiB). The IDs - of these chips were reused by later, larger chips. - config MTD_NAND_DENALI tristate "Support Denali NAND controller" help
drivers/mtd/nand/nand_ids.c +10 -18
@@ -22,24 +22,16 @@* extended chip ID. */ struct nand_flash_dev nand_flash_ids[] = { - -#ifdef CONFIG_MTD_NAND_MUSEUM_IDS - {"NAND 1MiB 5V 8-bit", 0x6e, 256, 1, 0x1000, 0}, - {"NAND 2MiB 5V 8-bit", 0x64, 256, 2, 0x1000, 0}, - {"NAND 4MiB 5V 8-bit", 0x6b, 512, 4, 0x2000, 0}, - {"NAND 1MiB 3,3V 8-bit", 0xe8, 256, 1, 0x1000, 0}, - {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, 0}, - {"NAND 2MiB 3,3V 8-bit", 0xea, 256, 2, 0x1000, 0}, - {"NAND 4MiB 3,3V 8-bit", 0xd5, 512, 4, 0x2000, 0}, - {"NAND 4MiB 3,3V 8-bit", 0xe3, 512, 4, 0x2000, 0}, - {"NAND 4MiB 3,3V 8-bit", 0xe5, 512, 4, 0x2000, 0}, - {"NAND 8MiB 3,3V 8-bit", 0xd6, 512, 8, 0x2000, 0}, - - {"NAND 8MiB 1,8V 8-bit", 0x39, 512, 8, 0x2000, 0}, - {"NAND 8MiB 3,3V 8-bit", 0xe6, 512, 8, 0x2000, 0}, - {"NAND 8MiB 1,8V 16-bit", 0x49, 512, 8, 0x2000, NAND_BUSWIDTH_16}, - {"NAND 8MiB 3,3V 16-bit", 0x59, 512, 8, 0x2000, NAND_BUSWIDTH_16}, -#endif + {"NAND 4MiB 5V 8-bit" ,0x6b ,512 ,4 ,0x2000 ,0 }, + {"NAND 4MiB 3,3V 8-bit" ,0xd5 ,512 ,4 ,0x2000 ,0 }, + {"NAND 4MiB 3,3V 8-bit" ,0xe3 ,512 ,4 ,0x2000 ,0 }, + {"NAND 4MiB 3,3V 8-bit" ,0xe5 ,512 ,4 ,0x2000 ,0 }, + {"NAND 8MiB 3,3V 8-bit" ,0xd6 ,512 ,8 ,0x2000 ,0 }, + + {"NAND 8MiB 1,8V 8-bit" ,0x39 ,512 ,8 ,0x2000 ,0 }, + {"NAND 8MiB 3,3V 8-bit" ,0xe6 ,512 ,8 ,0x2000 ,0 }, + {"NAND 8MiB 1,8V 16-bit" ,0x49 ,512 ,8 ,0x2000 ,NAND_BUSWIDTH_16 }, + {"NAND 8MiB 3,3V 16-bit" ,0x59 ,512 ,8 ,0x2000 ,NAND_BUSWIDTH_16 }, {"NAND 16MiB 1,8V 8-bit" ,0x33 ,512 ,16 ,0x4000 ,0 }, {"NAND 16MiB 3,3V 8-bit" ,0x73 ,512 ,16 ,0x4000 ,0 },
Signature · 1 line
1.7.10.4
Re: [PATCH 02/11] mtd: decommission the NAND museum
Quoted 7 lines · Artem Bityutskiy
From: Artem Bityutskiy <[email protected]>
The MTD subsystem has its own small museum of ancient NANDs in a form of the
CONFIG_MTD_NAND_MUSEUM_IDSconfiguration option. The museum contains stone age NANDs with 256 bytes pages, as well as iron age NANDs with 512 bytes per page and up to 8MiB page size.
Quoted 8 lines
It is with great sorrow that I inform you that the museum is being decommissioned. The MTD subsystem is out of budget for
Kconfigoptions and already has too many of them, and there is a general kernel trend to simplify the configuration menu.We remove the stone age exhibits along with closing the museum, but the iron age ones are transferred to the regular NAND depot, since there is still a remote possibility that they may be useful for someone.
Unfortunately, the iron age and modern age exhibits will not survive long together. The iron age will conquer the modern, as the exhibits that grew up without war have gone soft... OK, I can't draw this analogy out much further :)
What I mean to say is: some of the museum IDs that you left will conflict with the "current" ones, so that the museum IDs will always win out; they will be detected as their museum geometry, not their extended ID geometry. See below for examples.
Quoted 2 lines
Signed-off-by Artem Bityutskiy <[email protected]>Acked-by Brian Norris <[email protected]>
My ack was on the old one (which removed them entirely), not the new one :) I'll re-review the other patches quickly and comment if there are any other anti-ack's.
Quoted 10 lines
--- drivers/mtd/nand/Kconfig | 8 -------- drivers/mtd/nand/nand_ids.c | 28 ++++++++++------------------ 2 files changed, 10 insertions(+), 26 deletions(-)drivers/mtd/nand/Kconfig +0
-0
drivers/mtd/nand/Kconfig config MTD_SM_COMMON · line 50
Quoted 10 lines
drivers/mtd/nand/Kconfig +0
-7@@ -41,14 +41,6 @@ config MTD_SM_COMMON tristate default n -config MTD_NAND_MUSEUM_IDS - bool "Enable chip ids for obsolete ancient NAND devices" - default n - help - Enable this option only when your board has first generation - NAND chips (page size 256 byte, erase size 4-8KiB). The IDs - of these chips were reused by later, larger chips.
Note the keyword "reused"! Only a few of them were reused though. I marked all the repeats below. I don't know what we can do with that, though. Can we cut the repeats?
Quoted 21 lines
drivers/mtd/nand/Kconfig +0
-0config MTD_NAND_DENALI tristate "Support Denali NAND controller" helpdrivers/mtd/nand/nand_ids.c +0
-10@@ -22,24 +22,16 @@* extended chip ID. */ struct nand_flash_dev nand_flash_ids[] = { - -#ifdef CONFIG_MTD_NAND_MUSEUM_IDS - {"NAND 1MiB 5V 8-bit", 0x6e, 256, 1, 0x1000, 0}, - {"NAND 2MiB 5V 8-bit", 0x64, 256, 2, 0x1000, 0}, - {"NAND 4MiB 5V 8-bit", 0x6b, 512, 4, 0x2000, 0}, - {"NAND 1MiB 3,3V 8-bit", 0xe8, 256, 1, 0x1000, 0}, - {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, 0}, - {"NAND 2MiB 3,3V 8-bit", 0xea, 256, 2, 0x1000, 0}, - {"NAND 4MiB 3,3V 8-bit", 0xd5, 512, 4, 0x2000, 0}, - {"NAND 4MiB 3,3V 8-bit", 0xe3, 512, 4, 0x2000, 0},
drivers/mtd/nand/nand_ids.c line 26
Quoted 10 lines
drivers/mtd/nand/nand_ids.c +2
-8- {"NAND 4MiB 3,3V 8-bit", 0xe5, 512, 4, 0x2000, 0}, - {"NAND 8MiB 3,3V 8-bit", 0xd6, 512, 8, 0x2000, 0}, - - {"NAND 8MiB 1,8V 8-bit", 0x39, 512, 8, 0x2000, 0}, - {"NAND 8MiB 3,3V 8-bit", 0xe6, 512, 8, 0x2000, 0}, - {"NAND 8MiB 1,8V 16-bit", 0x49, 512, 8, 0x2000, NAND_BUSWIDTH_16}, - {"NAND 8MiB 3,3V 16-bit", 0x59, 512, 8, 0x2000, NAND_BUSWIDTH_16}, -#endif + {"NAND 4MiB 5V 8-bit", 0x6b, 512, 4, 0x2000, 0}, + {"NAND 4MiB 3,3V 8-bit", 0xd5, 512, 4, 0x2000, 0},
0xd5 is reused (with a capital 'D'!) as 16 Gbit.
drivers/mtd/nand/nand_ids.c line 31
Quoted 5 lines
drivers/mtd/nand/nand_ids.c +5
-0+ {"NAND 4MiB 3,3V 8-bit", 0xe3, 512, 4, 0x2000, 0}, + {"NAND 4MiB 3,3V 8-bit", 0xe5, 512, 4, 0x2000, 0}, + {"NAND 8MiB 3,3V 8-bit", 0xd6, 512, 8, 0x2000, 0}, + + {"NAND 8MiB 1,8V 8-bit", 0x39, 512, 8, 0x2000, 0},
Reused.
drivers/mtd/nand/nand_ids.c line 33
Quoted 2 lines
drivers/mtd/nand/nand_ids.c +2
-0+ {"NAND 8MiB 3,3V 8-bit", 0xe6, 512, 8, 0x2000, 0}, + {"NAND 8MiB 1,8V 16-bit", 0x49, 512, 8, 0x2000, NAND_BUSWIDTH_16},
Ditto.
drivers/mtd/nand/nand_ids.c line 34
Quoted 1 line
drivers/mtd/nand/nand_ids.c +1
-0+ {"NAND 8MiB 3,3V 16-bit", 0x59, 512, 8, 0x2000, NAND_BUSWIDTH_16},
Ditto.
drivers/mtd/nand/nand_ids.c
Quoted 4 lines
drivers/mtd/nand/nand_ids.c +0
-0{"NAND 16MiB 1,8V 8-bit", 0x33, 512, 16, 0x4000, 0}, {"NAND 16MiB 3,3V 8-bit", 0x73, 512, 16, 0x4000, 0},
Brian
Re: [PATCH 02/11] mtd: decommission the NAND museum
Quoted 11 lines · Brian Norris
drivers/mtd/nand/Kconfig config MTD_SM_COMMON · line 50
Quoted 7 lines
drivers/mtd/nand/Kconfig +0
-7-config MTD_NAND_MUSEUM_IDS - bool "Enable chip ids for obsolete ancient NAND devices" - default n - help - Enable this option only when your board has first generation - NAND chips (page size 256 byte, erase size 4-8KiB). The IDs - of these chips were reused by later, larger chips.Note the keyword "reused"! Only a few of them were reused though. I marked all the repeats below. I don't know what we can do with that, though. Can we cut the repeats?
Yeah, let me cut the repeats, and put a big comment to the iron age block that there is a risk of repeating, and the strategy is to kill the old records.
And thanks a lot for review!
Signature · 2 lines
Best Regards, Artem Bityutskiy
Re: [PATCH 02/11] mtd: decommission the NAND museum
In reply to Brian NorrisFrom: Artem Bityutskiy <[email protected]>
Date: Mon, 4 Mar 2013 13:44:21 +0200
Subject: [PATCH 02/15] mtd: decommission the NAND museum
The MTD subsystem has its own small museum of ancient NANDs in a form of the CONFIG_MTD_NAND_MUSEUM_IDS configuration option. The museum contains stone age NANDs with 256 bytes pages, as well as iron age NANDs with 512 bytes per page and up to 8MiB page size.
It is with great sorrow that I inform you that the museum is being decommissioned. The MTD subsystem is out of budget for Kconfig options and already has too many of them, and there is a general kernel trend to simplify the configuration menu.
We remove the stone age exhibits along with closing the museum, but some of the iron age ones are transferred to the regular NAND depot. Namely, only those which have unique device IDs are transferred, and the ones which have conflicting device IDs are removed.
---
This is version 2 of the patch where I also kill the conflicting old devices.
drivers/mtd/nand/Kconfig | 8 -------- drivers/mtd/nand/nand_ids.c | 23 +++++------------------ 2 files changed, 5 insertions(+), 26 deletions(-)
drivers/mtd/nand/Kconfig +0 -8
@@ -41,14 +41,6 @@ config MTD_SM_COMMON tristate default n -config MTD_NAND_MUSEUM_IDS - bool "Enable chip ids for obsolete ancient NAND devices" - default n - help - Enable this option only when your board has first generation - NAND chips (page size 256 byte, erase size 4-8KiB). The IDs - of these chips were reused by later, larger chips. - config MTD_NAND_DENALI tristate "Support Denali NAND controller" help
drivers/mtd/nand/nand_ids.c +5 -18
@@ -22,24 +22,11 @@* extended chip ID. */ struct nand_flash_dev nand_flash_ids[] = { - -#ifdef CONFIG_MTD_NAND_MUSEUM_IDS - {"NAND 1MiB 5V 8-bit", 0x6e, 256, 1, 0x1000, 0}, - {"NAND 2MiB 5V 8-bit", 0x64, 256, 2, 0x1000, 0}, - {"NAND 4MiB 5V 8-bit", 0x6b, 512, 4, 0x2000, 0}, - {"NAND 1MiB 3,3V 8-bit", 0xe8, 256, 1, 0x1000, 0}, - {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, 0}, - {"NAND 2MiB 3,3V 8-bit", 0xea, 256, 2, 0x1000, 0}, - {"NAND 4MiB 3,3V 8-bit", 0xd5, 512, 4, 0x2000, 0}, - {"NAND 4MiB 3,3V 8-bit", 0xe3, 512, 4, 0x2000, 0}, - {"NAND 4MiB 3,3V 8-bit", 0xe5, 512, 4, 0x2000, 0}, - {"NAND 8MiB 3,3V 8-bit", 0xd6, 512, 8, 0x2000, 0}, - - {"NAND 8MiB 1,8V 8-bit", 0x39, 512, 8, 0x2000, 0}, - {"NAND 8MiB 3,3V 8-bit", 0xe6, 512, 8, 0x2000, 0}, - {"NAND 8MiB 1,8V 16-bit", 0x49, 512, 8, 0x2000, NAND_BUSWIDTH_16}, - {"NAND 8MiB 3,3V 16-bit", 0x59, 512, 8, 0x2000, NAND_BUSWIDTH_16}, -#endif + {"NAND 4MiB 5V 8-bit" ,0x6B ,512 ,4 ,0x2000 ,0 }, + {"NAND 4MiB 3,3V 8-bit" ,0xE3 ,512 ,4 ,0x2000 ,0 }, + {"NAND 4MiB 3,3V 8-bit" ,0xE5 ,512 ,4 ,0x2000 ,0 }, + {"NAND 8MiB 3,3V 8-bit" ,0xD6 ,512 ,8 ,0x2000 ,0 }, + {"NAND 8MiB 3,3V 8-bit" ,0xE6 ,512 ,8 ,0x2000 ,0 }, {"NAND 16MiB 1,8V 8-bit" ,0x33 ,512 ,16 ,0x4000 ,0 }, {"NAND 16MiB 3,3V 8-bit" ,0x73 ,512 ,16 ,0x4000 ,0 },
Signature · 1 line
1.7.10.4
PATCH 3/11 arm: defconfigs: lpc32xx_defconfig: remove the museum NAND option
In reply to Artem BityutskiyFrom: Artem Bityutskiy <[email protected]>
The MTD_NAND_MUSEUM_IDS configuration options was removed - update the lpc32xx_defconfig file.
--- arch/arm/configs/lpc32xx_defconfig | 1 - 1 file changed, 1 deletion(-)
arch/arm/configs/lpc32xx_defconfig +0 -1
@@ -55,7 +55,6 @@ CONFIG_MTD_CHAR=y CONFIG_MTD_BLOCK=y CONFIG_MTD_M25P80=y CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_MUSEUM_IDS=y CONFIG_MTD_NAND_SLC_LPC32XX=y CONFIG_MTD_NAND_MLC_LPC32XX=y CONFIG_BLK_DEV_LOOP=y
Signature · 1 line
1.7.10.4
Re: [PATCH 03/11] arm: defconfigs: lpc32xx_defconfig: remove the museum NAND option
Quoted 15 lines · Artem Bityutskiy
From: Artem Bityutskiy <[email protected]>
The
MTD_NAND_MUSEUM_IDSconfiguration options was removed - update thelpc32xx_defconfigfile.Signed-off-by Artem Bityutskiy <[email protected]>--- arch/arm/configs/lpc32xx_defconfig | 1 - 1 file changed, 1 deletion(-)arch/arm/configs/lpc32xx_defconfig +0
-0
arch/arm/configs/lpc32xx_defconfig CONFIG_MTD_CHAR=y · line 60
Quoted 7 lines
arch/arm/configs/lpc32xx_defconfig +0
-1@@ -55,7 +55,6 @@ CONFIG_MTD_CHAR=y CONFIG_MTD_BLOCK=y CONFIG_MTD_M25P80=y CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_MUSEUM_IDS=y CONFIG_MTD_NAND_SLC_LPC32XX=y CONFIG_MTD_NAND_MLC_LPC32XX=y CONFIG_BLK_DEV_LOOP=y
Let me add Roland as this config file was added by him. Roland, FYI.
Signature · 2 lines
Best Regards, Artem Bityutskiy
Roland Stigge
Acked-byRe: [PATCH 03/11] arm: defconfigs: lpc32xx_defconfig: remove the museum NAND option
Quoted 11 lines · Artem Bityutskiy
Quoted 10 lines · Artem Bityutskiy
From: Artem Bityutskiy <[email protected]>
The
MTD_NAND_MUSEUM_IDSconfiguration options was removed - update thelpc32xx_defconfigfile.Signed-off-by Artem Bityutskiy <[email protected]>--- arch/arm/configs/lpc32xx_defconfig | 1 - 1 file changed, 1 deletion(-)
Quoted 15 lines
arch/arm/configs/lpc32xx_defconfig CONFIG_MTD_CHAR=y · line 60
Quoted 12 lines
arch/arm/configs/lpc32xx_defconfig +0
-1@@ -55,7 +55,6 @@ CONFIG_MTD_CHAR=y CONFIG_MTD_BLOCK=y CONFIG_MTD_M25P80=y CONFIG_MTD_NAND=y -CONFIG_MTD_NAND_MUSEUM_IDS=y CONFIG_MTD_NAND_SLC_LPC32XX=y CONFIG_MTD_NAND_MLC_LPC32XX=y CONFIG_BLK_DEV_LOOP=yLet me add Roland as this config file was added by him. Roland, FYI.
I'll take this via a lpc32xx branch, for arm-soc, to prevent collisions with other defconfig commits there.
Thanks,
Roland
Re: [PATCH 03/11] arm: defconfigs: lpc32xx_defconfig: remove the museum NAND option
Quoted 8 lines · Roland Stigge
Quoted 8 lines
Quoted 7 lines
CONFIG_MTD_BLOCK=y
CONFIG_MTD_M25P80=y
CONFIG_MTD_NAND=y
-CONFIG_MTD_NAND_MUSEUM_IDS=y
CONFIG_MTD_NAND_SLC_LPC32XX=y
CONFIG_MTD_NAND_MLC_LPC32XX=y
CONFIG_BLK_DEV_LOOP=y
Quoted 7 lines
Quoted 2 lines
Let me add Roland as this config file was added by him. Roland, FYI.
Acked-by Roland Stigge <[email protected]>I'll take this via a lpc32xx branch, for arm-soc, to prevent collisions with other defconfig commits there.
OK, then I am dropping it from l2-mtd.git, thanks!
Signature · 2 lines
Best Regards, Artem Bityutskiy
PATCH 4/11 mtd: nand: remove the rtc_from4 driver support
In reply to Artem BityutskiyFrom: Artem Bityutskiy <[email protected]>
The AG-AND support is about to be removed from MTD, because this technology is dead for long time. Thus, remove this the only AG-AND driver we have in the kernel tree.
--- drivers/mtd/nand/Kconfig | 10 - drivers/mtd/nand/Makefile | 1 - drivers/mtd/nand/rtc_from4.c | 624 ------------------------------------------ 3 files changed, 635 deletions(-) delete mode 100644 drivers/mtd/nand/rtc_from4.c
drivers/mtd/nand/Kconfig +0 -10
@@ -193,16 +193,6 @@ config MTD_NAND_BF5XX_BOOTROM_ECC If unsure, say N. -config MTD_NAND_RTC_FROM4 - tristate "Renesas Flash ROM 4-slot interface board (FROM_BOARD4)" - depends on SH_SOLUTION_ENGINE - select REED_SOLOMON - select REED_SOLOMON_DEC8 - select BITREVERSE - help - This enables the driver for the Renesas Technology AG-AND - flash interface board (FROM_BOARD4) - config MTD_NAND_PPCHAMELEONEVB tristate "NAND Flash device on PPChameleonEVB board" depends on PPCHAMELEONEVB && BROKEN
drivers/mtd/nand/Makefile +0 -1
@@ -22,7 +22,6 @@ 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_H1900) += h1910.o -obj-$(CONFIG_MTD_NAND_RTC_FROM4) += rtc_from4.o obj-$(CONFIG_MTD_NAND_SHARPSL) += sharpsl.o obj-$(CONFIG_MTD_NAND_NANDSIM) += nandsim.o obj-$(CONFIG_MTD_NAND_CS553X) += cs553x_nand.o
drivers/mtd/nand/rtc_from4.c deleted +0 -624
624 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH 5/11 mtd: nand: remove AG-AND support
In reply to Artem BityutskiyFrom: Artem Bityutskiy <[email protected]>
We have only one AG-AND driver and it was not touched since 2005. It looks like AG-AND was not really make it to mass-production and can be considered a dead technology.
Along with the AG-AND support, this patch removes the BBT_AUTO_REFRESH feature, because the only user of this feature is AG-AND. And even though it is implemented as a generic feature, I prefer to remove it because NAND flashes do not really need it in this form.
--- drivers/mtd/nand/nand_base.c | 80 ++---------------------------------------- drivers/mtd/nand/nand_bbt.c | 25 ------------- drivers/mtd/nand/nand_ids.c | 13 ------- include/linux/mtd/nand.h | 16 --------- 4 files changed, 2 insertions(+), 132 deletions(-)
drivers/mtd/nand/nand_base.c +2 -78
@@ -4,7 +4,6 @@* Overview: * This is the generic MTD driver for NAND flash devices. It should be * capable of working with almost all NAND chips currently available. -* Basic support for AG-AND chips is provided. * * Additional technical information is available on * http://www.linux-mtd.infradead.org/doc/nand.html
@@ -22,8 +21,6 @@* Enable cached programming for 2k page size chips * Check, if mtd->ecctype should be set to MTD_ECC_HW * if we have HW ECC support. -* The AG-AND chips have nice features for speed improvement, -* which are not supported yet. Read / program 4 pages in one go. * BBT table is not serialized, has to be fixed * * This program is free software; you can redistribute it and/or modify
@@ -836,10 +833,7 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)*/ ndelay (100 ); -if ((state ==FL_ERASING ) && (chip->options &NAND_IS_AND )) - chip->cmdfunc (mtd,NAND_CMD_STATUS_MULTI ,-1 ,-1 ); -else - chip->cmdfunc (mtd,NAND_CMD_STATUS ,-1 ,-1 ); + chip->cmdfunc (mtd,NAND_CMD_STATUS ,-1 ,-1 );if (in_interrupt () || oops_in_progress)panic_nand_wait (mtd, chip, timeo);
@@ -2465,24 +2459,6 @@ static void single_erase_cmd(struct mtd_info *mtd, int page) }/** -* multi_erase_cmd - [GENERIC] AND specific block erase command function -* @mtd: MTD device structure -* @page: the page address of the block which will be erased -* -* AND multi block erase command function. Erase 4 consecutive blocks. -*/ -static void multi_erase_cmd (struct mtd_info *mtd,int page) -{ -struct nand_chip *chip = mtd->priv; -/* Send commands to erase a block */ - chip->cmdfunc (mtd,NAND_CMD_ERASE1 ,-1 , page++); - chip->cmdfunc (mtd,NAND_CMD_ERASE1 ,-1 , page++); - chip->cmdfunc (mtd,NAND_CMD_ERASE1 ,-1 , page++); - chip->cmdfunc (mtd,NAND_CMD_ERASE1 ,-1 , page); - chip->cmdfunc (mtd,NAND_CMD_ERASE2 ,-1 ,-1 ); -} - -/** * nand_erase - [MTD Interface] erase block(s) * @mtd: MTD device structure * @instr: erase instruction
@@ -2494,7 +2470,6 @@ static int nand_erase(struct mtd_info *mtd, struct erase_info *instr)return nand_erase_nand (mtd, instr,0 ); } -#define BBT_PAGE_MASK 0xffffff3f/** * nand_erase_nand - [INTERN] erase block(s) * @mtd: MTD device structure
@@ -2508,8 +2483,6 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, {int page, status, pages_per_block, ret, chipnr;struct nand_chip *chip = mtd->priv; -loff_t rewrite_bbt[NAND_MAX_CHIPS ] = {0 }; -unsigned int bbt_masked_page =0xffffffff ;loff_t len; pr_debug("%s: start = 0x%012llx, len = %llu\n",
@@ -2540,15 +2513,6 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, goto erase_exit; } -/* -* If BBT requires refresh, set the BBT page mask to see if the BBT -* should be rewritten. Otherwise the mask is set to 0xffffffff which -* can not be matched. This is also done when the bbt is actually -* erased to avoid recursive updates. -*/ -if (chip->options &BBT_AUTO_REFRESH && !allowbbt) - bbt_masked_page = chip->bbt_td->pages[chipnr] &BBT_PAGE_MASK ; -/* Loop through the pages */ len = instr->len;
@@ -2594,15 +2558,6 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, goto erase_exit; } -/* -* If BBT requires refresh, set the BBT rewrite flag to the -* page being erased. -*/ -if (bbt_masked_page !=0xffffffff && - (page &BBT_PAGE_MASK ) == bbt_masked_page) - rewrite_bbt[chipnr] = - ((loff_t )page << chip->page_shift); -/* Increment page address and decrement length */ len -= (1 << chip->phys_erase_shift); page += pages_per_block;
@@ -2612,15 +2567,6 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, chipnr++; chip->select_chip (mtd,-1 ); chip->select_chip (mtd, chipnr); - -/* -* If BBT requires refresh and BBT-PERCHIP, set the BBT -* page mask to see if this BBT should be rewritten. -*/ -if (bbt_masked_page !=0xffffffff && - (chip->bbt_td->options &NAND_BBT_PERCHIP )) - bbt_masked_page = chip->bbt_td->pages[chipnr] & -BBT_PAGE_MASK ; } } instr->state =MTD_ERASE_DONE ;
@@ -2637,23 +2583,6 @@ erase_exit:if (!ret)mtd_erase_callback (instr); -/* -* If BBT requires refresh and erase was successful, rewrite any -* selected bad block tables. -*/ -if (bbt_masked_page ==0xffffffff || ret) -return ret; - -for (chipnr =0 ; chipnr < chip->numchips; chipnr++) { -if (!rewrite_bbt[chipnr]) -continue ; -/* Update the BBT for chip */ -pr_debug ("%s: nand_update_bbt (%d:0x%0llx 0x%0x)\n" , - __func__, chipnr, rewrite_bbt[chipnr], - chip->bbt_td->pages[chipnr]); -nand_update_bbt (mtd, rewrite_bbt[chipnr]); - } -/* Return more or less happy */ return ret; }
@@ -3286,12 +3215,7 @@ ident_done: } chip->badblockbits =8 ; - -/* Check for AND chips with 4 page planes */ -if (chip->options &NAND_4PAGE_ARRAY ) - chip->erase_cmd = multi_erase_cmd; -else - chip->erase_cmd = single_erase_cmd; + chip->erase_cmd = single_erase_cmd;/* Do not replace user supplied command function! */ if (mtd->writesize >512 && chip->cmdfunc == nand_command)
drivers/mtd/nand/nand_bbt.c +0 -25
@@ -1240,15 +1240,6 @@ int nand_update_bbt(struct mtd_info *mtd, loff_t offs)*/ static uint8_t scan_ff_pattern[] = {0xff ,0xff }; -static uint8_t scan_agand_pattern[] = {0x1C ,0x71 ,0xC7 ,0x1C ,0x71 ,0xC7 }; - -static struct nand_bbt_descr agand_flashbased = { - .options =NAND_BBT_SCANEMPTY |NAND_BBT_SCANALLPAGES , - .offs =0x20 , - .len =6 , - .pattern = scan_agand_pattern -}; -/* Generic flash bbt descriptors */ static uint8_t bbt_pattern[] = {'B' ,'b' ,'t' ,'0' };static uint8_t mirror_pattern[] = {'1' ,'t' ,'b' ,'B' };
@@ -1333,22 +1324,6 @@ int nand_default_bbt(struct mtd_info *mtd) {struct nand_chip *this = mtd->priv; -/* -* Default for AG-AND. We must use a flash based bad block table as the -* devices have factory marked _good_ blocks. Erasing those blocks -* leads to loss of the good / bad information, so we _must_ store this -* information in a good / bad table during startup. -*/ -if (this->options &NAND_IS_AND ) { -/* Use the default pattern descriptors */ -if (!this->bbt_td) { - this->bbt_td = &bbt_main_descr; - this->bbt_md = &bbt_mirror_descr; - } - this->bbt_options |=NAND_BBT_USE_FLASH ; -return nand_scan_bbt (mtd, &agand_flashbased); - } -/* Is a flash based bad block table requested? */ if (this->bbt_options &NAND_BBT_USE_FLASH ) {/* Use the default pattern descriptors */
drivers/mtd/nand/nand_ids.c +0 -13
@@ -136,19 +136,6 @@ struct nand_flash_dev nand_flash_ids[] = { {"NAND 64GiB 1,8V 16-bit", 0x2E, 0, 65536, 0, LP_OPTIONS16}, {"NAND 64GiB 3,3V 16-bit", 0x4E, 0, 65536, 0, LP_OPTIONS16}, -/* -* Renesas AND 1 Gigabit. Those chips do not support extended id and -* have a strange page/block layout ! The chosen minimum erasesize is -* 4 * 2 * 2048 = 16384 Byte, as those chips have an array of 4 page -* planes 1 block = 2 pages, but due to plane arrangement the blocks -* 0-3 consists of page 0 + 4,1 + 5, 2 + 6, 3 + 7 Anyway JFFS2 would -* increase the eraseblock size so we chose a combined one which can be -* erased in one go There are more speed improvements for reads and -* writes possible, but not implemented now -*/ - {"AND 128MiB 3,3V 8-bit", 0x01, 2048, 128, 0x4000, - NAND_IS_AND | NAND_4PAGE_ARRAY | BBT_AUTO_REFRESH}, - {NULL,} };
include/linux/mtd/nand.h +0 -16
@@ -171,22 +171,6 @@ typedef enum {#define NAND_CACHEPRG 0x00000008/* Chip has copy back function */ #define NAND_COPYBACK 0x00000010 -/* -* AND Chip which has 4 banks and a confusing page / block -* assignment. See Renesas datasheet for further information. -*/ -#define NAND_IS_AND 0x00000020 -/* -* Chip has a array of 4 pages which can be read without -* additional ready /busy waits. -*/ -#define NAND_4PAGE_ARRAY 0x00000040 -/* -* Chip requires that BBT is periodically rewritten to prevent -* bits from adjacent blocks from 'leaking' in altering data. -* This happens with the Renesas AG-AND chips, possibly others. -*/ -#define BBT_AUTO_REFRESH 0x00000080/* Chip does not allow subpage writes */ #define NAND_NO_SUBPAGE_WRITE 0x00000200
Signature · 1 line
1.7.10.4
PATCH 6/11 mtd: nand: remove a bunch of unused commands
In reply to Artem BityutskiyFrom: Artem Bityutskiy <[email protected]>
--- drivers/mtd/nand/cafe_nand.c | 6 ------ drivers/mtd/nand/nand_base.c | 10 ---------- drivers/mtd/nand/nandsim.c | 8 -------- drivers/mtd/nand/nuc900_nand.c | 9 --------- include/linux/mtd/nand.h | 20 -------------------- 5 files changed, 53 deletions(-)
drivers/mtd/nand/cafe_nand.c +0 -6
@@ -303,13 +303,7 @@ static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command,case NAND_CMD_SEQIN :case NAND_CMD_RNDIN :case NAND_CMD_STATUS : -case NAND_CMD_DEPLETE1 :case NAND_CMD_RNDOUT : -case NAND_CMD_STATUS_ERROR : -case NAND_CMD_STATUS_ERROR0 : -case NAND_CMD_STATUS_ERROR1 : -case NAND_CMD_STATUS_ERROR2 : -case NAND_CMD_STATUS_ERROR3 :cafe_writel (cafe, cafe->ctl2,NAND_CTRL2 );return ; }
drivers/mtd/nand/nand_base.c +0 -10
@@ -668,16 +668,6 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned int command,case NAND_CMD_SEQIN :case NAND_CMD_RNDIN :case NAND_CMD_STATUS : -case NAND_CMD_DEPLETE1 : -return ; - -case NAND_CMD_STATUS_ERROR : -case NAND_CMD_STATUS_ERROR0 : -case NAND_CMD_STATUS_ERROR1 : -case NAND_CMD_STATUS_ERROR2 : -case NAND_CMD_STATUS_ERROR3 : -/* Read error status commands require only a short delay */ -udelay (chip->chip_delay);return ;case NAND_CMD_RESET :
drivers/mtd/nand/nandsim.c +0 -8
@@ -218,7 +218,6 @@ MODULE_PARM_DESC(bch, "Enable BCH ecc and set how many bits should "#define STATE_CMD_READOOB 0x00000005/* read OOB area */ #define STATE_CMD_ERASE1 0x00000006/* sector erase first command */ #define STATE_CMD_STATUS 0x00000007/* read status */ -#define STATE_CMD_STATUS_M 0x00000008/* read multi-plane status (isn't implemented) */ #define STATE_CMD_SEQIN 0x00000009/* sequential data input */ #define STATE_CMD_READID 0x0000000A/* read ID */ #define STATE_CMD_ERASE2 0x0000000B/* sector erase second command */
@@ -406,8 +405,6 @@ static struct nandsim_operations { {OPT_ANY, {STATE_CMD_ERASE1, STATE_ADDR_SEC, STATE_CMD_ERASE2 | ACTION_SECERASE, STATE_READY}},/* Read status */ {OPT_ANY, {STATE_CMD_STATUS, STATE_DATAOUT_STATUS, STATE_READY}}, -/* Read multi-plane status */ - {OPT_SMARTMEDIA, {STATE_CMD_STATUS_M, STATE_DATAOUT_STATUS_M, STATE_READY}},/* Read ID */ {OPT_ANY, {STATE_CMD_READID, STATE_ADDR_ZERO, STATE_DATAOUT_ID, STATE_READY}},/* Large page devices read page */
@@ -1079,8 +1076,6 @@ static char *get_state_name(uint32_t state)return "STATE_CMD_ERASE1" ;case STATE_CMD_STATUS :return "STATE_CMD_STATUS" ; -case STATE_CMD_STATUS_M : -return "STATE_CMD_STATUS_M" ;case STATE_CMD_SEQIN :return "STATE_CMD_SEQIN" ;case STATE_CMD_READID :
@@ -1145,7 +1140,6 @@ static int check_command(int cmd)case NAND_CMD_RNDOUTSTART :return 0 ; -case NAND_CMD_STATUS_MULTI :default :return 1 ; }
@@ -1171,8 +1165,6 @@ static uint32_t get_state_by_command(unsigned command)return STATE_CMD_ERASE1 ;case NAND_CMD_STATUS :return STATE_CMD_STATUS ; -case NAND_CMD_STATUS_MULTI : -return STATE_CMD_STATUS_M ;case NAND_CMD_SEQIN :return STATE_CMD_SEQIN ;case NAND_CMD_READID :
drivers/mtd/nand/nuc900_nand.c +0 -9
@@ -177,15 +177,6 @@ static void nuc900_nand_command_lp(struct mtd_info *mtd, unsigned int command,case NAND_CMD_SEQIN :case NAND_CMD_RNDIN :case NAND_CMD_STATUS : -case NAND_CMD_DEPLETE1 : -return ; - -case NAND_CMD_STATUS_ERROR : -case NAND_CMD_STATUS_ERROR0 : -case NAND_CMD_STATUS_ERROR1 : -case NAND_CMD_STATUS_ERROR2 : -case NAND_CMD_STATUS_ERROR3 : -udelay (chip->chip_delay);return ;case NAND_CMD_RESET :
include/linux/mtd/nand.h +0 -20
@@ -86,7 +86,6 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);#define NAND_CMD_READOOB 0x50#define NAND_CMD_ERASE1 0x60#define NAND_CMD_STATUS 0x70 -#define NAND_CMD_STATUS_MULTI 0x71#define NAND_CMD_SEQIN 0x80#define NAND_CMD_RNDIN 0x85#define NAND_CMD_READID 0x90
@@ -105,25 +104,6 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);#define NAND_CMD_RNDOUTSTART 0xE0#define NAND_CMD_CACHEDPROG 0x15 -/* Extended commands for AG-AND device */ -/* -* Note: the command for NAND_CMD_DEPLETE1 is really 0x00 but -* there is no way to distinguish that from NAND_CMD_READ0 -* until the remaining sequence of commands has been completed -* so add a high order bit and mask it off in the command. -*/ -#define NAND_CMD_DEPLETE1 0x100 -#define NAND_CMD_DEPLETE2 0x38 -#define NAND_CMD_STATUS_MULTI 0x71 -#define NAND_CMD_STATUS_ERROR 0x72 -/* multi-bank error status (banks 0-3) */ -#define NAND_CMD_STATUS_ERROR0 0x73 -#define NAND_CMD_STATUS_ERROR1 0x74 -#define NAND_CMD_STATUS_ERROR2 0x75 -#define NAND_CMD_STATUS_ERROR3 0x76 -#define NAND_CMD_STATUS_RESET 0x7f -#define NAND_CMD_STATUS_CLEAR 0xff -#define NAND_CMD_NONE -1/* Status bits */
Signature · 1 line
1.7.10.4
PATCH 7/11 mtd: nand: remove NAND_NO_PADDING macro
In reply to Artem BityutskiyFrom: Artem Bityutskiy <[email protected]>
It is not used anywhere.
--- include/linux/mtd/nand.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
include/linux/mtd/nand.h +1 -5
@@ -145,8 +145,6 @@ typedef enum {*/ /* Buswidth is 16 bit */ #define NAND_BUSWIDTH_16 0x00000002 -/* Device supports partial programming without padding */ -#define NAND_NO_PADDING 0x00000004/* Chip has cache program function */ #define NAND_CACHEPRG 0x00000008/* Chip has copy back function */
@@ -164,11 +162,9 @@ typedef enum {#define NAND_SUBPAGE_READ 0x00001000/* Options valid for Samsung large page devices */ -#define NAND_SAMSUNG_LP_OPTIONS \ - (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) +#define NAND_SAMSUNG_LP_OPTIONS (NAND_CACHEPRG | NAND_COPYBACK)/* Macros to identify the above */ -#define NAND_MUST_PAD (chip) (!(chip->options & NAND_NO_PADDING))#define NAND_HAS_CACHEPROG (chip) ((chip->options & NAND_CACHEPRG))#define NAND_HAS_COPYBACK (chip) ((chip->options & NAND_COPYBACK))#define NAND_HAS_SUBPAGE_READ (chip) ((chip->options & NAND_SUBPAGE_READ))
Signature · 1 line
1.7.10.4
PATCH 8/11 mtd: nand: remove NAND_COPYBACK macro
In reply to Artem BityutskiyFrom: Artem Bityutskiy <[email protected]>
It is unused.
--- include/linux/mtd/nand.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
include/linux/mtd/nand.h +1 -4
@@ -147,8 +147,6 @@ typedef enum {#define NAND_BUSWIDTH_16 0x00000002/* Chip has cache program function */ #define NAND_CACHEPRG 0x00000008 -/* Chip has copy back function */ -#define NAND_COPYBACK 0x00000010/* Chip does not allow subpage writes */ #define NAND_NO_SUBPAGE_WRITE 0x00000200
@@ -162,11 +160,10 @@ typedef enum {#define NAND_SUBPAGE_READ 0x00001000/* Options valid for Samsung large page devices */ -#define NAND_SAMSUNG_LP_OPTIONS (NAND_CACHEPRG | NAND_COPYBACK) +#define NAND_SAMSUNG_LP_OPTIONS (NAND_CACHEPRG)/* Macros to identify the above */ #define NAND_HAS_CACHEPROG (chip) ((chip->options & NAND_CACHEPRG)) -#define NAND_HAS_COPYBACK (chip) ((chip->options & NAND_COPYBACK))#define NAND_HAS_SUBPAGE_READ (chip) ((chip->options & NAND_SUBPAGE_READ))/* Non chip related options */
Signature · 1 line
1.7.10.4
PATCH 9/11 mtd: nand: use NAND_HAS_CACHEPROG
In reply to Artem BityutskiyFrom: Artem Bityutskiy <[email protected]>
We have this unused macro, let's use it and justify its existence.
--- drivers/mtd/nand/nand_base.c | 2 +- include/linux/mtd/nand.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/nand_base.c +1 -1
@@ -2043,7 +2043,7 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,*/ cached =0 ; -if (!cached || !(chip->options &NAND_CACHEPRG )) { +if (!cached || !NAND_HAS_CACHEPROG (chip)) { chip->cmdfunc (mtd,NAND_CMD_PAGEPROG ,-1 ,-1 ); status = chip->waitfunc (mtd, chip);
include/linux/mtd/nand.h +1 -1
@@ -160,7 +160,7 @@ typedef enum {#define NAND_SUBPAGE_READ 0x00001000/* Options valid for Samsung large page devices */ -#define NAND_SAMSUNG_LP_OPTIONS (NAND_CACHEPRG) +#define NAND_SAMSUNG_LP_OPTIONS NAND_CACHEPRG/* Macros to identify the above */ #define NAND_HAS_CACHEPROG (chip) ((chip->options & NAND_CACHEPRG))
Signature · 1 line
1.7.10.4
PATCH 10/11 mtd: nand: rename the id field of 'struct nand_flash_dev'
In reply to Artem BityutskiyFrom: Artem Bityutskiy <[email protected]>
The 'id' is a bit confusing name because NAND IDs are multi-byte. Re-name it to 'dev_id' to make it clear that this is the "device ID" part (the second byte).
While on it, clean-up the commentary for 'struct nand_flash_dev'.
--- drivers/mtd/devices/doc2000.c | 2 +- drivers/mtd/devices/doc2001.c | 2 +- drivers/mtd/devices/doc2001plus.c | 2 +- drivers/mtd/nand/nand_base.c | 2 +- drivers/mtd/nand/nandsim.c | 6 +++--- drivers/mtd/nand/pxa3xx_nand.c | 2 +- include/linux/mtd/nand.h | 19 +++++++++---------- 7 files changed, 17 insertions(+), 18 deletions(-)
drivers/mtd/devices/doc2000.c +1 -1
@@ -379,7 +379,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)/* Print and store the manufacturer and ID codes. */ for (i =0 ; nand_flash_ids[i].name !=NULL ; i++) { -if (id == nand_flash_ids[i].id) { +if (id == nand_flash_ids[i].dev_id) {/* Try to identify manufacturer */ for (j =0 ; nand_manuf_ids[j].id !=0x0 ; j++) {if (nand_manuf_ids[j].id == mfr)
drivers/mtd/devices/doc2001.c +1 -1
@@ -206,7 +206,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)/* FIXME: to deal with multi-flash on multi-Millennium case more carefully */ for (i =0 ; nand_flash_ids[i].name !=NULL ; i++) { -if ( id == nand_flash_ids[i].id) { +if ( id == nand_flash_ids[i].dev_id) {/* Try to identify manufacturer */ for (j =0 ; nand_manuf_ids[j].id !=0x0 ; j++) {if (nand_manuf_ids[j].id == mfr)
drivers/mtd/devices/doc2001plus.c +1 -1
@@ -314,7 +314,7 @@ static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)return 0 ;for (i =0 ; nand_flash_ids[i].name !=NULL ; i++) { -if (id == nand_flash_ids[i].id) { +if (id == nand_flash_ids[i].dev_id) {/* Try to identify manufacturer */ for (j =0 ; nand_manuf_ids[j].id !=0x0 ; j++) {if (nand_manuf_ids[j].id == mfr)
drivers/mtd/nand/nand_base.c +1 -1
@@ -3126,7 +3126,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, type = nand_flash_ids;for (; type->name !=NULL ; type++) -if (*dev_id == type->id) +if (*dev_id == type->dev_id)break ; chip->onfi_version =0 ;
drivers/mtd/nand/nandsim.c +3 -3
@@ -766,9 +766,9 @@ static int init_nandsim(struct mtd_info *mtd) }/* Detect how many ID bytes the NAND chip outputs */ -for (i =0 ; nand_flash_ids[i].name !=NULL ; i++) { -if (second_id_byte != nand_flash_ids[i].id) -continue ; +for (i =0 ; nand_flash_ids[i].name !=NULL ; i++) { +if (second_id_byte != nand_flash_ids[i].dev_id) +continue ; }if (ns->busw ==16 )
drivers/mtd/nand/pxa3xx_nand.c +1 -1
@@ -989,7 +989,7 @@ static int pxa3xx_nand_scan(struct mtd_info *mtd) } pxa3xx_flash_ids[0 ].name = f->name; - pxa3xx_flash_ids[0 ].id = (f->chip_id >>8 ) &0xffff ; + pxa3xx_flash_ids[0 ].dev_id = (f->chip_id >>8 ) &0xffff ; pxa3xx_flash_ids[0 ].pagesize = f->page_size; chipsize = (uint64_t )f->num_blocks * f->page_per_block * f->page_size; pxa3xx_flash_ids[0 ].chipsize = chipsize >>20 ;
include/linux/mtd/nand.h +9 -10
@@ -541,19 +541,18 @@ struct nand_chip {/** * struct nand_flash_dev - NAND Flash Device ID Structure -* @name: Identify the device type -* @id: device ID code -* @pagesize: Pagesize in bytes. Either 256 or 512 or 0 -* If the pagesize is 0, then the real pagesize -* and the eraseize are determined from the -* extended id bytes in the chip -* @erasesize: Size of an erase block in the flash device. -* @chipsize: Total chipsize in Mega Bytes -* @options: Bitfield to store chip relevant options +* @name: a human-readable name of the NAND chip +* @dev_id: the device ID (the second byte of the full chip ID array) +* @pagesize: size of the NAND page in bytes; if 0, then the real page size (as +* well as the eraseblock size) is determined from the extended NAND +* chip ID array) +* @erasesize: eraseblock size in bytes (determined from the extended ID if 0) +* @chipsize: total chip size in MiB +* @options: stores various chip bit options */ struct nand_flash_dev {char *name; -int id; +int dev_id;unsigned long pagesize;unsigned long chipsize;unsigned long erasesize;
Signature · 1 line
1.7.10.4
PATCH 11/11 mtd: nand: remove few tiny page NAND bits
In reply to Artem BityutskiyFrom: Artem Bityutskiy <[email protected]>
NAND flashes with 256 bytes NAND pages are so old that probably do not exist any more. Let's remove few related pieces of code and forget about them forever. The assumption will be that 512 bytes NAND page size is the minimum possible.
--- drivers/mtd/nand/nand_base.c | 2 +- drivers/mtd/nand/nandsim.c | 10 +++------- drivers/mtd/nand/sm_common.c | 5 ----- 3 files changed, 4 insertions(+), 13 deletions(-)
drivers/mtd/nand/nand_base.c +1 -1
@@ -512,7 +512,7 @@ EXPORT_SYMBOL_GPL(nand_wait_ready);* @page_addr: the page address for this command, -1 if none * * Send command to NAND device. This function is used for small page devices -* (256/512 Bytes per page). +* (512 Bytes per page). */ static void nand_command (struct mtd_info *mtd,unsigned int command,int column,int page_addr)
drivers/mtd/nand/nandsim.c +3 -7
@@ -262,14 +262,13 @@ MODULE_PARM_DESC(bch, "Enable BCH ecc and set how many bits should "#define NS_OPER_STATES 6/* Maximum number of states in operation */ #define OPT_ANY 0xFFFFFFFF/* any chip supports this operation */ -#define OPT_PAGE256 0x00000001/* 256-byte page chips */ #define OPT_PAGE512 0x00000002/* 512-byte page chips */ #define OPT_PAGE2048 0x00000008/* 2048-byte page chips */ #define OPT_SMARTMEDIA 0x00000010/* SmartMedia technology chips */ #define OPT_PAGE512_8BIT 0x00000040/* 512-byte page chips with 8-bit bus width */ #define OPT_PAGE4096 0x00000080/* 4096-byte page chips */ #define OPT_LARGEPAGE (OPT_PAGE2048 | OPT_PAGE4096)/* 2048 & 4096-byte page chips */ -#define OPT_SMALLPAGE (OPT_PAGE256 | OPT_PAGE512)/* 256 and 512-byte page chips */ +#define OPT_SMALLPAGE (OPT_PAGE512)/* 512-byte page chips */ /* Remove action bits from state */ #define NS_STATE (x) ((x) & ~ACTION_MASK)
@@ -696,10 +695,7 @@ static int init_nandsim(struct mtd_info *mtd) ns->geom.secszoob = ns->geom.secsz + ns->geom.oobsz * ns->geom.pgsec; ns->options =0 ; -if (ns->geom.pgsz ==256 ) { - ns->options |=OPT_PAGE256 ; - } -else if (ns->geom.pgsz ==512 ) { +if (ns->geom.pgsz ==512 ) { ns->options |=OPT_PAGE512 ;if (ns->busw ==8 ) ns->options |=OPT_PAGE512_8BIT ;
@@ -2298,7 +2294,7 @@ static int __init ns_init_module(void) nand->geom.idbytes =2 ; nand->regs.status =NS_STATUS_OK (nand); nand->nxstate =STATE_UNKNOWN ; - nand->options |=OPT_PAGE256 ;/* temporary value */ + nand->options |=OPT_PAGE512 ;/* temporary value */ nand->ids[0 ] = first_id_byte; nand->ids[1 ] = second_id_byte; nand->ids[2 ] = third_id_byte;
drivers/mtd/nand/sm_common.c +0 -5
@@ -69,11 +69,6 @@ static int sm_block_markbad(struct mtd_info *mtd, loff_t ofs)static struct nand_flash_dev nand_smartmedia_flash_ids[] = { - {"SmartMedia 1MiB 5V" ,0x6e ,256 ,1 ,0x1000 ,0 }, - {"SmartMedia 1MiB 3,3V" ,0xe8 ,256 ,1 ,0x1000 ,0 }, - {"SmartMedia 1MiB 3,3V" ,0xec ,256 ,1 ,0x1000 ,0 }, - {"SmartMedia 2MiB 3,3V" ,0xea ,256 ,2 ,0x1000 ,0 }, - {"SmartMedia 2MiB 5V" ,0x64 ,256 ,2 ,0x1000 ,0 }, {"SmartMedia 2MiB 3,3V ROM" ,0x5d ,512 ,2 ,0x2000 ,NAND_ROM }, {"SmartMedia 4MiB 3,3V" ,0xe3 ,512 ,4 ,0x2000 ,0 }, {"SmartMedia 4MiB 3,3/5V" ,0xe5 ,512 ,4 ,0x2000 ,0 },
Signature · 1 line
1.7.10.4
Artem Bityutskiy
AppliedQuoted 10 lines · Artem Bityutskiy
This is the second version of the patch-set. This time I removed the full ID support provisioning part and decided to keep it separate, so this patch-set is basically about misc. clean-ups, code simplifications and removals of old and unused cruft.
The museum ID patch changed - it now removes only 256-byte NAND pages support.
Brian, I've addressed your review comments. I did not put your Acked-by to all of the patches, only to the one you explicitly Acked. But I can add it to all of the patches if you let me know.
Pushed to l2-mtd.git. If there is more review or tags coming, I can amend the patches and re-base the tree. Thanks!
Signature · 2 lines
Best Regards, Artem Bityutskiy