From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Wed, 17 Sep 2008 06:11:45 +0200 Subject: [U-Boot] [PATCH] TQM8xx: Fix CFI flash driver support for all TQM8xx based boards In-Reply-To: <1221594389-27663-1-git-send-email-wd@denx.de> References: <1221594389-27663-1-git-send-email-wd@denx.de> Message-ID: <200809170611.45914.sr@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Wolfgang, On Tuesday 16 September 2008, Wolfgang Denk wrote: > After switching to using the CFI flash driver, the correct remapping > of the flash banks was forgotten. > > Also, some boards were not adapted, and the old legacy flash driver > was not removed yet. Please find some nitpicking comments below. > diff --git a/board/tqc/tqm8xx/tqm8xx.c b/board/tqc/tqm8xx/tqm8xx.c > index 96b6103..59bbdbc 100644 > --- a/board/tqc/tqm8xx/tqm8xx.c > +++ b/board/tqc/tqm8xx/tqm8xx.c > @@ -1,5 +1,5 @@ > /* > - * (C) Copyright 2000-2006 > + * (C) Copyright 2000-2008 > * Wolfgang Denk, DENX Software Engineering, wd at denx.de. > * > * See file CREDITS for list of people who contributed to this > @@ -21,16 +21,14 @@ > * MA 02111-1307 USA > */ > > -#if 0 > -#define DEBUG > -#endif > - > #include > #include > #ifdef CONFIG_PS2MULT > #include > #endif > > +extern flash_info_t flash_info[]; /* FLASH chips info */ > + > DECLARE_GLOBAL_DATA_PTR; > > static long int dram_size (long int, long int *, long int); > @@ -451,24 +449,107 @@ int board_early_init_r (void) > > #endif /* CONFIG_PS2MULT */ > > -/* > --------------------------------------------------------------------------- >- */ -/* HMI10 specific stuff */ > -/* > --------------------------------------------------------------------------- >- */ -#ifdef CONFIG_HMI10 > > +#ifdef CONFIG_MISC_INIT_R > int misc_init_r (void) > { > -# ifdef CONFIG_IDE_LED > - volatile immap_t *immap = (immap_t *) CFG_IMMR; > + volatile immap_t *immap = (immap_t *)CFG_IMMR; > + volatile memctl8xx_t *memctl = &immap->im_memctl; > + > +#ifdef CFG_OR_TIMING_FLASH_AT_50MHZ > + int scy, trlx, flash_or_timing, clk_diff; > + > + scy = (CFG_OR_TIMING_FLASH_AT_50MHZ & OR_SCY_MSK) >> 4; > + if (CFG_OR_TIMING_FLASH_AT_50MHZ & OR_TRLX) { > + trlx = OR_TRLX; > + scy *= 2; > + } else > + trlx = 0; > + > + /* > + * We assume that each 10MHz of bus clock require 1-clk SCY > + * adjustment. > + */ > + clk_diff = (gd->bus_clk / 1000000) - 50; Indentation looks wrong here. > + > + /* > + * We need proper rounding here. This is what the "+5" and "-5" > + * are here for. > + */ > + if (clk_diff >= 0) > + scy += (clk_diff + 5) / 10; > + else > + scy += (clk_diff - 5) / 10; And here. And other places below too. Best regards, Stefan ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================