omap3: various code improvements for IGEP v2 board.
Subsystems (3)
PATCH 1/1 omap3: various code improvements for IGEP v2 board.
The comments of this post also apply to IGEP v2 board (thanks Laurent)
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg36402.html
Changes are:
- Set onenand_setup to NULL instead of adding a no-op function.
- On igep2_flash_init() function:
- Use 'for' loop instead 'while' loop.
- No need to initialize ret to 0, we're assigning it right after.
- No need to check for onenandcs < GPMC_CS_NUM here, it will always be true.
- omap_board_config_size is implicitly initialized to 0 in plat-omap/common.c, get_config() won't dereference omap_board_config, so we can remove the empty igep2_config array.
--- arch/arm/mach-omap2/board-igep0020.c | 39 ++++++++++++--------------------- 1 files changed, 14 insertions(+), 25 deletions(-)
arch/arm/mach-omap2/board-igep0020.c +14 -25
@@ -136,16 +136,10 @@ static struct mtd_partition igep2_onenand_partitions[] = { }, }; -static int igep2_onenand_setup (void __iomem *onenand_base,int freq) -{ -/* nothing is required to be setup for onenand as of now */ -return 0 ; -} -static struct omap_onenand_platform_data igep2_onenand_data = { .parts = igep2_onenand_partitions, .nr_parts =ARRAY_SIZE (igep2_onenand_partitions), - .onenand_setup = igep2_onenand_setup, + .onenand_setup =NULL , .dma_channel =-1 ,/* disable DMA in OMAP OneNAND driver */ };
@@ -159,35 +153,35 @@ static struct platform_device igep2_onenand_device = {static void __init igep2_flash_init (void ) { -u8 cs =0 ; -u8 onenandcs =GPMC_CS_NUM +1 ; +u8 cs =0 ; +u8 onenandcs =GPMC_CS_NUM +1 ; -while (cs <GPMC_CS_NUM ) { -u32 ret =0 ; +for (cs =0 ; cs <GPMC_CS_NUM ; cs++) { +u32 ret; ret =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG1 );/* Check if NAND/oneNAND is configured */ if ((ret &0xC00 ) ==0x800 )/* NAND found */ -pr_err ("IGEP v2: Unsupported NAND found\n" ); +pr_err ("IGEP2: Unsupported NAND found\n" );else { ret =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG7 ); +if ((ret &0x3F ) == (ONENAND_MAP >>24 )) -/* ONENAND found */ +/* OneNAND found */ onenandcs = cs; } - cs++; } +if (onenandcs >GPMC_CS_NUM ) { -pr_err ("IGEP v2: Unable to find configuration in GPMC\n" ); +pr_err ("IGEP2: Unable to find configuration in GPMC\n" );return ; } -if (onenandcs <GPMC_CS_NUM ) { - igep2_onenand_data.cs = onenandcs; -if (platform_device_register (&igep2_onenand_device) <0 ) -pr_err ("IGEP v2: Unable to register OneNAND device\n" ); - } + igep2_onenand_data.cs = onenandcs; + +if (platform_device_register (&igep2_onenand_device) <0 ) +pr_err ("IGEP2: Unable to register OneNAND device\n" ); }#else
@@ -254,9 +248,6 @@ static inline void __init igep2_init_smsc911x(void)static inline void __init igep2_init_smsc911x (void ) { }#endif -static struct omap_board_config_kernel igep2_config[]__initdata = { -}; -static struct regulator_consumer_supply igep2_vmmc1_supply = { .supply ="vmmc" , };
@@ -493,8 +484,6 @@ static struct platform_device *igep2_devices[] __initdata = {static void __init igep2_init_irq (void ) { - omap_board_config = igep2_config; - omap_board_config_size =ARRAY_SIZE (igep2_config);omap2_init_common_hw (m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params);omap_init_irq ();omap_gpio_init ();
Signature · 1 line
1.7.1
PATCH 1/1 omap3: various code improvements for IGEP v2 board.
Quoted 6 lines · Enric Balletbo i Serra
The comments of this post also apply to IGEP v2 board (thanks Laurent)
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg36402.html
Changes are:
Quoted 8 lines
- Set
onenand_setupto NULL instead of adding a no-op function.
- Onigep2_flash_init()function:
- Use 'for' loop instead 'while' loop.
- No need to initialize ret to 0, we're assigning it right after.
- No need to check for onenandcs <GPMC_CS_NUMhere, it will always be true.
-omap_board_config_sizeis implicitly initialized to 0 inplat-omap/common.c,get_config()won't dereferenceomap_board_config, so we can remove the emptyigep2_configarray.
you should probably split this patch in a series.
Quoted 14 lines
Signed-off-by Enric Balletbo i Serra <[email protected]>---
arch/arm/mach-omap2/board-igep0020.c| 39 ++++++++++++---------------------1 files changed, 14 insertions(+), 25 deletions(-)arch/arm/mach-omap2/board-igep0020.c +0
-1@@ -136,16 +136,10 @@ static struct mtd_partition igep2_onenand_partitions[] = { }, }; -static int igep2_onenand_setup (void __iomem *onenand_base,int freq)
arch/arm/mach-omap2/board-igep0020.c static struct mtd_partition igep2_onenand_partitions[] = { · line 142
Quoted 10 lines
arch/arm/mach-omap2/board-igep0020.c +1
-6-{ -/* nothing is required to be setup for onenand as of now */ -return 0 ; -} -static struct omap_onenand_platform_data igep2_onenand_data = { .parts = igep2_onenand_partitions, .nr_parts =ARRAY_SIZE (igep2_onenand_partitions), - .onenand_setup = igep2_onenand_setup, + .onenand_setup =NULL ,
static variable. Just remove the line ;-)
Signature · 1 line
balbi