aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorEnric Balletbo i Serra <eballetbo@gmail.com>2010-10-23 12:49:00 -0400
committerTony Lindgren <tony@atomide.com>2010-11-30 16:48:25 -0500
commit235228ba21e34ba732b413c12259bac386f83283 (patch)
tree81030414fee969d5c4e2bd30de2d7b584c3e6752 /arch/arm/mach-omap2
parentae3e033362430f2684bb3519456c88d14e182f01 (diff)
omap3: IGEP v2: Improve igep2_flash_init() function
The changes are: - 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. Signed-off-by: Enric Balletbo i Serra <eballetbo@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 42dcbf4f1602..fe76b59b13ed 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -152,35 +152,34 @@ static struct platform_device igep2_onenand_device = {
152 152
153static void __init igep2_flash_init(void) 153static void __init igep2_flash_init(void)
154{ 154{
155 u8 cs = 0; 155 u8 cs = 0;
156 u8 onenandcs = GPMC_CS_NUM + 1; 156 u8 onenandcs = GPMC_CS_NUM + 1;
157 157
158 while (cs < GPMC_CS_NUM) { 158 for (cs = 0; cs < GPMC_CS_NUM; cs++) {
159 u32 ret = 0; 159 u32 ret;
160 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); 160 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
161 161
162 /* Check if NAND/oneNAND is configured */ 162 /* Check if NAND/oneNAND is configured */
163 if ((ret & 0xC00) == 0x800) 163 if ((ret & 0xC00) == 0x800)
164 /* NAND found */ 164 /* NAND found */
165 pr_err("IGEP v2: Unsupported NAND found\n"); 165 pr_err("IGEP2: Unsupported NAND found\n");
166 else { 166 else {
167 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); 167 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
168 if ((ret & 0x3F) == (ONENAND_MAP >> 24)) 168 if ((ret & 0x3F) == (ONENAND_MAP >> 24))
169 /* ONENAND found */ 169 /* ONENAND found */
170 onenandcs = cs; 170 onenandcs = cs;
171 } 171 }
172 cs++;
173 } 172 }
173
174 if (onenandcs > GPMC_CS_NUM) { 174 if (onenandcs > GPMC_CS_NUM) {
175 pr_err("IGEP v2: Unable to find configuration in GPMC\n"); 175 pr_err("IGEP2: Unable to find configuration in GPMC\n");
176 return; 176 return;
177 } 177 }
178 178
179 if (onenandcs < GPMC_CS_NUM) { 179 igep2_onenand_data.cs = onenandcs;
180 igep2_onenand_data.cs = onenandcs; 180
181 if (platform_device_register(&igep2_onenand_device) < 0) 181 if (platform_device_register(&igep2_onenand_device) < 0)
182 pr_err("IGEP v2: Unable to register OneNAND device\n"); 182 pr_err("IGEP2: Unable to register OneNAND device\n");
183 }
184} 183}
185 184
186#else 185#else