mtd: nand: denali: max_banks calculation changed in revision 5.1
Subsystems (2)
PATCH 1/1 mtd: nand: denali: max_banks calculation changed in revision 5.1
Read Denali hardware revision number and use it to calculate max_banks, The encoding of max_banks changed in Denali revision 5.1.
--- drivers/mtd/nand/denali.c | 11 ++++++++++- drivers/mtd/nand/denali.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/mtd/nand/denali.c +10 -1
@@ -458,8 +458,17 @@ static void find_valid_banks(struct denali_nand_info *denali)static void detect_max_banks (struct denali_nand_info *denali) {uint32_t features =ioread32 (denali->flash_reg +FEATURES ); +/* +* Read the revision register, so we can calculate the max_banks +* properly: the encoding changed from rev 5.0 to 5.1 +*/ +u32 revision =MAKE_COMPARABLE_REVISION ( +ioread32 (denali->flash_reg +REVISION )); - denali->max_banks =2 << (features &FEATURES__N_BANKS ); +if (revision <REVISION_5_1 ) + denali->max_banks =2 << (features &FEATURES__N_BANKS ); +else + denali->max_banks =1 << (features &FEATURES__N_BANKS ); }static void detect_partition_feature (struct denali_nand_info *denali)
drivers/mtd/nand/denali.h +2 -0
@@ -178,6 +178,8 @@#define REVISION 0x370#define REVISION__VALUE 0xffff +#define MAKE_COMPARABLE_REVISION (x) swab16(x & REVISION__VALUE) +#define REVISION_5_1 0x00000501#define ONFI_DEVICE_FEATURES 0x380#define ONFI_DEVICE_FEATURES__VALUE 0x003f
Signature · 1 line
1.7.9.5
Howdy folks,
Any comment on this patch? Is anyone else using Denali NAND rev 5.1 controller?
Thanks,
Graham
Quoted 47 lines · Graham Moore
Read Denali hardware revision number and use it to calculate
max_banks, The encoding ofmax_bankschanged in Denali revision 5.1.Signed-off-by Graham Moore <[email protected]>--- drivers/mtd/nand/denali.c | 11 ++++++++++- drivers/mtd/nand/denali.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-)drivers/mtd/nand/denali.c +10
-1@@ -458,8 +458,17 @@ static void find_valid_banks(struct denali_nand_info *denali)static void detect_max_banks (struct denali_nand_info *denali) {uint32_t features =ioread32 (denali->flash_reg +FEATURES ); +/* +* Read the revision register, so we can calculate the max_banks +* properly: the encoding changed from rev 5.0 to 5.1 +*/ +u32 revision =MAKE_COMPARABLE_REVISION ( +ioread32 (denali->flash_reg +REVISION )); - denali->max_banks =2 << (features &FEATURES__N_BANKS ); +if (revision <REVISION_5_1 ) + denali->max_banks =2 << (features &FEATURES__N_BANKS ); +else + denali->max_banks =1 << (features &FEATURES__N_BANKS ); }static void detect_partition_feature (struct denali_nand_info *denali)drivers/mtd/nand/denali.h +2
-0@@ -178,6 +178,8 @@#define REVISION 0x370#define REVISION__VALUE 0xffff +#define MAKE_COMPARABLE_REVISION (x) swab16(x & REVISION__VALUE) +#define REVISION_5_1 0x00000501#define ONFI_DEVICE_FEATURES 0x380#define ONFI_DEVICE_FEATURES__VALUE 0x003f
Quoted 3 lines · Graham Moore
Howdy folks,
Any comment on this patch?
A tiny comment below.
Quoted 2 lines
Is anyone else using Denali NAND rev 5.1
controller?
I have no devices to test, but CC'ing Enrico, who sent a denali patch recently.
In general, MTD has a lot of drivers for various hardware, and I have few of them to test. If anyone is interested in getting CC's (so they can test, review, and otherwise help expedite the process), I'd be happy to ack an addition to MAINTAINERS, perhaps as 'R:' (reviewer)...
Quoted 43 lines
Thanks,
GrahamQuoted 39 lines · Graham Moore
Read Denali hardware revision number and use it to calculate
max_banks, The encoding ofmax_bankschanged in Denali revision 5.1.Signed-off-by Graham Moore <[email protected]>--- drivers/mtd/nand/denali.c | 11 ++++++++++- drivers/mtd/nand/denali.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-)drivers/mtd/nand/denali.c +10
-1@@ -458,8 +458,17 @@ static void find_valid_banks(struct denali_nand_info *denali)static void detect_max_banks (struct denali_nand_info *denali) {uint32_t features =ioread32 (denali->flash_reg +FEATURES ); +/* +* Read the revision register, so we can calculate the max_banks +* properly: the encoding changed from rev 5.0 to 5.1 +*/ +u32 revision =MAKE_COMPARABLE_REVISION ( +ioread32 (denali->flash_reg +REVISION )); - denali->max_banks =2 << (features &FEATURES__N_BANKS ); +if (revision <REVISION_5_1 ) + denali->max_banks =2 << (features &FEATURES__N_BANKS ); +else + denali->max_banks =1 << (features &FEATURES__N_BANKS ); }static void detect_partition_feature (struct denali_nand_info *denali)drivers/mtd/nand/denali.h +0
-0@@ -178,6 +178,8 @@
Quoted 3 lines
drivers/mtd/nand/denali.h line 181
Quoted 3 lines
drivers/mtd/nand/denali.h +1
-0#define REVISION 0x370#define REVISION__VALUE 0xffff +#define MAKE_COMPARABLE_REVISION (x) swab16(x & REVISION__VALUE)
It's probably best to add parentheses around the 'x'.
Quoted 6 lines
drivers/mtd/nand/denali.h line 185
Quoted 5 lines
drivers/mtd/nand/denali.h +1
-0+#define REVISION_5_1 0x00000501#define ONFI_DEVICE_FEATURES 0x380#define ONFI_DEVICE_FEATURES__VALUE 0x003f
I can fix that up and apply, if no objections.
Brian
Brian Norris
AppliedQuoted 14 lines · Brian Norris
Quoted 10 lines · Graham Moore
drivers/mtd/nand/denali.h line 181
Quoted 9 lines · Graham Moore
drivers/mtd/nand/denali.h +1
-0@@ -178,6 +178,8 @@#define REVISION 0x370#define REVISION__VALUE 0xffff +#define MAKE_COMPARABLE_REVISION (x) swab16(x & REVISION__VALUE)It's probably best to add parentheses around the 'x'.
Quoted 8 lines
Quoted 6 lines
drivers/mtd/nand/denali.h line 185
Quoted 5 lines
drivers/mtd/nand/denali.h +1
-0+#define REVISION_5_1 0x00000501#define ONFI_DEVICE_FEATURES 0x380#define ONFI_DEVICE_FEATURES__VALUE 0x003fI can fix that up and apply, if no objections.
Pushed to l2-mtd.git with that fixup.