GPMC: fix device size setup
Subsystems (5)
following statement can only change device size from 8-bit(0) to 16-bit(1), but not vice versa:
regval |= GPMC_CONFIG1_DEVICESIZE(wval);
so as this field has 1 reserved bit, that could be used in future, just clear both bits and then OR with the desired value
--- arch/arm/mach-omap2/gpmc.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/mach-omap2/gpmc.c +6 -0
@@ -528,7 +528,13 @@case GPMC_CONFIG_DEV_SIZE : regval =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG1 ); + +/* clear 2 target bits */ + regval &= ~GPMC_CONFIG1_DEVICESIZE (3 ); + +/* set the proper value */ regval |=GPMC_CONFIG1_DEVICESIZE (wval); +gpmc_cs_write_reg (cs,GPMC_CS_CONFIG1 , regval);break ;
Tony Lindgren
maintainerQuoted 7 lines · Yegor Yefremov
following statement can only change device size from 8-bit(0) to 16-bit(1), but not vice versa:
regval |=
GPMC_CONFIG1_DEVICESIZE(wval);so as this field has 1 reserved bit, that could be used in future, just clear both bits and then OR with the desired value
Looks like a valid fix to me. Care to repost it with linux-arm-kernel mailing list also Cc'd so I can apply it into my fixes branch?
Thanks,
Tony
Quoted 24 lines
Signed-off-by Yegor Yefremov <[email protected]>--- arch/arm/mach-omap2/gpmc.c | 6 ++++++ 1 file changed, 6 insertions(+)Index:
b/arch/arm/mach-omap2/gpmc.c
===================================================================arch/arm/mach-omap2/gpmc.c +6
-0@@ -528,7 +528,13 @@case GPMC_CONFIG_DEV_SIZE : regval =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG1 ); + +/* clear 2 target bits */ + regval &= ~GPMC_CONFIG1_DEVICESIZE (3 ); + +/* set the proper value */ regval |=GPMC_CONFIG1_DEVICESIZE (wval); +gpmc_cs_write_reg (cs,GPMC_CS_CONFIG1 , regval);break ;