Re: [U-Boot] [PATCH 3/3 v5] SAMSUNG: SMDKC100: Adds ethernet support.
HI Kang, On 26 February 2010 08:12, Minkyu Kang wrote: > Dear Naveen Krishna CH, > > On 25 February 2010 21:28, wrote: > > From: Naveen Krishna CH > > > > Add setup for ethernet on SMDKC100, allowing kernel/ramdisk to be > > loaded over tftp. > > > > The preinit function will configure GPIO (GPK0CON) & SROMC to look > > for environment in SROM Bank 3. > > > > Signed-off-by: Naveen Krishna Ch > > --- > > Changes since V1: > > > > 1. The CONFIG_BOOTP* and Net config Macros are removed from config > header. > > Comments from Ben Warren are fixed > > 2. The GPIO configuration is modified & Macro and Function are renamed. > > Comments from Minkyu Kang are fixedChanges since V2 > > > > Changes since V2: > > 1. GPIO configurations function has been implemented. > > > > Changes since V3: > > 1. Comments from Minkyu Kang are fixed. > > > > Changes since V4: > > None > > > > board/samsung/smdkc100/smdkc100.c | 39 > + > > include/configs/smdkc100.h| 12 ++- > > 2 files changed, 50 insertions(+), 1 deletions(-) > > Patch have compiler warnings. > > smdkc100.c: In function 'smc9115_pre_init': > smdkc100.c:37: warning: unused variable 'tmp' > smdkc100.c: In function 'board_eth_init': > smdkc100.c:87: warning: implicit declaration of function > 'smc911x_initialize' > > please fix it. > I fixed the warning, I wil wait till the end of the day and send the v6 patch set. > > > > > diff --git a/board/samsung/smdkc100/smdkc100.c > b/board/samsung/smdkc100/smdkc100.c > > index 15a1a27..4fc802e 100644 > > --- a/board/samsung/smdkc100/smdkc100.c > > +++ b/board/samsung/smdkc100/smdkc100.c > > @@ -23,10 +23,40 @@ > > */ > > > > #include > > +#include > > +#include > > +#include > > + > > DECLARE_GLOBAL_DATA_PTR; > > > > +/* > > + * Miscellaneous platform dependent initialisations > > + */ > > +static void smc9115_pre_init(void) > > +{ > > + u32 tmp; > remove it. > > + u32 smc_bw_conf, smc_bc_conf; > > + > > + struct s5pc100_gpio *const gpio = > > + (struct s5pc100_gpio *)S5PC100_GPIO_BASE; > > + > > + /* gpio configuration GPK0CON */ > > + gpio_cfg_pin(&gpio->gpio_k0, CONFIG_ENV_SROM_BANK, GPIO_FUNC(2)); > > + > > + /* Ethernet needs bus width of 16 bits */ > > + smc_bw_conf = SMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK); > > + smc_bc_conf = SMC_BC_TACS(0x0) | SMC_BC_TCOS(0x4) | > SMC_BC_TACC(0xe) > > + | SMC_BC_TCOH(0x1) | SMC_BC_TAH(0x4) > > + | SMC_BC_TACP(0x6) | SMC_BC_PMC(0x0); > > + > > + /* Select and configure the SROMC bank */ > > + s5pc1xx_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, > smc_bc_conf); > > +} > > + > > int board_init(void) > > { > > + smc9115_pre_init(); > > + > >gd->bd->bi_arch_number = MACH_TYPE_SMDKC100; > >gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; > > > > @@ -49,3 +79,12 @@ int checkboard(void) > >return 0; > > } > > #endif > > + > > +int board_eth_init(bd_t *bis) > > +{ > > + int rc = 0; > > +#ifdef CONFIG_SMC911X > > + rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); > need netdev.h > Thanks for ur comments and help. > > +#endif > > + return rc; > > +} > > diff --git a/include/configs/smdkc100.h b/include/configs/smdkc100.h > > index f12fea3..c8abad6 100644 > > --- a/include/configs/smdkc100.h > > +++ b/include/configs/smdkc100.h > > @@ -83,7 +83,6 @@ > > #undef CONFIG_CMD_FLASH > > #undef CONFIG_CMD_IMLS > > #undef CONFIG_CMD_NAND > > -#undef CONFIG_CMD_NET > > > > #define CONFIG_CMD_CACHE > > #define CONFIG_CMD_REGINFO > > @@ -235,4 +234,15 @@ > > > > #define CONFIG_DOS_PARTITION 1 > > > > +/* > > + * Ethernet Contoller driver > > + */ > > +#ifdef CONFIG_CMD_NET > > +#define CONFIG_NET_MULTI > > +#define CONFIG_SMC911X 1 /* we have a SMC9115 on-board > */ > > +#define CONFIG_SMC911X_16_BIT 1 /* SMC911X_16_BIT Mode > */ > > +#define CONFIG_SMC911X_BASE0x98800300 /* SMC911X Drive Base > */ > > +#define CONFIG_ENV_SROM_BANK 3 /* Select SROM Bank-3 for > Ethernet*/ > > +#endif /* CONFIG_CMD_NET */ > > + > > #endif /* __CONFIG_H */ > > -- > > 1.6.6 > > > > ___ > > U-Boot mailing list > > U-Boot@lists.denx.de > > http://lists.denx.de/mailman/listinfo/u-boot > > > > Thanks > Minkyu Kang > -- > from. prom. > www.promsoft.net > ___ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot > -- Shine bright, (: Naveen Krishna Ch :) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/3 v5] SAMSUNG: SMDKC100: Adds ethernet support.
Dear Naveen Krishna CH, On 25 February 2010 21:28, wrote: > From: Naveen Krishna CH > > Add setup for ethernet on SMDKC100, allowing kernel/ramdisk to be > loaded over tftp. > > The preinit function will configure GPIO (GPK0CON) & SROMC to look > for environment in SROM Bank 3. > > Signed-off-by: Naveen Krishna Ch > --- > Changes since V1: > > 1. The CONFIG_BOOTP* and Net config Macros are removed from config header. > Comments from Ben Warren are fixed > 2. The GPIO configuration is modified & Macro and Function are renamed. > Comments from Minkyu Kang are fixedChanges since V2 > > Changes since V2: > 1. GPIO configurations function has been implemented. > > Changes since V3: > 1. Comments from Minkyu Kang are fixed. > > Changes since V4: > None > > board/samsung/smdkc100/smdkc100.c | 39 > + > include/configs/smdkc100.h | 12 ++- > 2 files changed, 50 insertions(+), 1 deletions(-) Patch have compiler warnings. smdkc100.c: In function 'smc9115_pre_init': smdkc100.c:37: warning: unused variable 'tmp' smdkc100.c: In function 'board_eth_init': smdkc100.c:87: warning: implicit declaration of function 'smc911x_initialize' please fix it. > > diff --git a/board/samsung/smdkc100/smdkc100.c > b/board/samsung/smdkc100/smdkc100.c > index 15a1a27..4fc802e 100644 > --- a/board/samsung/smdkc100/smdkc100.c > +++ b/board/samsung/smdkc100/smdkc100.c > @@ -23,10 +23,40 @@ > */ > > #include > +#include > +#include > +#include > + > DECLARE_GLOBAL_DATA_PTR; > > +/* > + * Miscellaneous platform dependent initialisations > + */ > +static void smc9115_pre_init(void) > +{ > + u32 tmp; remove it. > + u32 smc_bw_conf, smc_bc_conf; > + > + struct s5pc100_gpio *const gpio = > + (struct s5pc100_gpio *)S5PC100_GPIO_BASE; > + > + /* gpio configuration GPK0CON */ > + gpio_cfg_pin(&gpio->gpio_k0, CONFIG_ENV_SROM_BANK, GPIO_FUNC(2)); > + > + /* Ethernet needs bus width of 16 bits */ > + smc_bw_conf = SMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK); > + smc_bc_conf = SMC_BC_TACS(0x0) | SMC_BC_TCOS(0x4) | SMC_BC_TACC(0xe) > + | SMC_BC_TCOH(0x1) | SMC_BC_TAH(0x4) > + | SMC_BC_TACP(0x6) | SMC_BC_PMC(0x0); > + > + /* Select and configure the SROMC bank */ > + s5pc1xx_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, smc_bc_conf); > +} > + > int board_init(void) > { > + smc9115_pre_init(); > + > gd->bd->bi_arch_number = MACH_TYPE_SMDKC100; > gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; > > @@ -49,3 +79,12 @@ int checkboard(void) > return 0; > } > #endif > + > +int board_eth_init(bd_t *bis) > +{ > + int rc = 0; > +#ifdef CONFIG_SMC911X > + rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); need netdev.h > +#endif > + return rc; > +} > diff --git a/include/configs/smdkc100.h b/include/configs/smdkc100.h > index f12fea3..c8abad6 100644 > --- a/include/configs/smdkc100.h > +++ b/include/configs/smdkc100.h > @@ -83,7 +83,6 @@ > #undef CONFIG_CMD_FLASH > #undef CONFIG_CMD_IMLS > #undef CONFIG_CMD_NAND > -#undef CONFIG_CMD_NET > > #define CONFIG_CMD_CACHE > #define CONFIG_CMD_REGINFO > @@ -235,4 +234,15 @@ > > #define CONFIG_DOS_PARTITION 1 > > +/* > + * Ethernet Contoller driver > + */ > +#ifdef CONFIG_CMD_NET > +#define CONFIG_NET_MULTI > +#define CONFIG_SMC911X 1 /* we have a SMC9115 on-board */ > +#define CONFIG_SMC911X_16_BIT 1 /* SMC911X_16_BIT Mode */ > +#define CONFIG_SMC911X_BASE 0x98800300 /* SMC911X Drive Base */ > +#define CONFIG_ENV_SROM_BANK 3 /* Select SROM Bank-3 for Ethernet*/ > +#endif /* CONFIG_CMD_NET */ > + > #endif /* __CONFIG_H */ > -- > 1.6.6 > > ___ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot > Thanks Minkyu Kang -- from. prom. www.promsoft.net ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] Add bootcount to AT91
Anders Darander wrote: > Use AT91_GPBR 3 as a bootcount register. > The bootmagic and the bootcount shares AT91_GPBR 3. This has been applied to ARM Thanks. Tom ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2 rev2] ep93xx: Refactoring of timer code
Matthias Kaehlcke wrote: > Hi Tom, > > El Thu, Feb 25, 2010 at 09:54:59AM -0600 Tom ha dit: > >> Matthias Kaehlcke wrote: >>> ep93xx: Refactoring of the timer code, including the following changes >>> >>> * use a free running timer instead of a periodical one >>> * use unsigned long long for total number of ticks >>> * hold the timer state in a structure instead of separate variables >>> * increment the timer counter instead of decrementing it >>> * remove unused function udelay_masked() >>> * remove unused function set_timer() >>> >>> Signed-off-by: Matthias Kaehlcke >> This set has been applied to ARM. > > i was/am working on a new version of the patch, taking into account > your remarks about the unit of TIMER_FREQ and fixing some issues > discussed with Alessandro Rubini off-list, who worked on a similar > patch. > > what do you prefer, a patch based on the ones you just applied, or > revert them and get one with all fixes (only one patch, cause > the function clk_to_systicks() fixed in the first patch of the set is > removed) > > i apologize for not having taken the time to notify about this and > causing you overhead :( > Its ok with me if you just rebase and submit a smaller patch. Tom ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2 rev2] ep93xx: Refactoring of timer code
Hi, El Thu, Feb 25, 2010 at 08:22:59PM +0100 Alessandro Rubini ha dit: > > i was/am working on a new version of the patch, taking into account > > your remarks about the unit of TIMER_FREQ and fixing some issues > > discussed with Alessandro Rubini off-list, who worked on a similar > > patch. > > Actually, I checked the point we disagreed about, which is the unit of > get_ticks() and get_tbclk(). You currently return hw-ticks in > get_ticks, and CONFIG_SYS_HZ (i.e. 1000) in get_tbclk. However, these > two functions are expected to be used together, so they must be > consistent in their return value. actually there is no disagreement between us, i totally agree with you that the return value of get_ticks() should be in CONFIG_SYS_HZ resolution and consistent with get_tbclk(). the patch i sent you yesterday off-list fixes exactly this. > It's true that the functions are little used (they are mostly used in > ppc code, within cpu/*/interrupts), and that's why I didn't even > provide them in cpu/arm926ejs/nomadik/timer.c. All few users assume > they are consistent, but there is no documentation: > > tornado% grep -qr get_tbclk README* doc || echo not found > not found > tornado% grep -qr get_ticks README* doc/* || echo not found > not found > > I've made a quick tour of all definitions in cpu/ and here is the result. > As you see, at91 (which you used as reference, I understand) is wrong, > while all the others use either hwticks or SYS_HZ consistently. yes, i used precisely at91 as reference, i liked it's code structure and didn't notice that it is wrong in this point. thanks for your research! -- Matthias Kaehlcke Embedded Linux Developer Barcelona We build too many walls and not enough bridges (Isaac Newton) .''`. using free software / Debian GNU/Linux | http://debian.org : :' : `. `'` gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `- ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2 rev2] ep93xx: Refactoring of timer code
> i was/am working on a new version of the patch, taking into account > your remarks about the unit of TIMER_FREQ and fixing some issues > discussed with Alessandro Rubini off-list, who worked on a similar > patch. Actually, I checked the point we disagreed about, which is the unit of get_ticks() and get_tbclk(). You currently return hw-ticks in get_ticks, and CONFIG_SYS_HZ (i.e. 1000) in get_tbclk. However, these two functions are expected to be used together, so they must be consistent in their return value. It's true that the functions are little used (they are mostly used in ppc code, within cpu/*/interrupts), and that's why I didn't even provide them in cpu/arm926ejs/nomadik/timer.c. All few users assume they are consistent, but there is no documentation: tornado% grep -qr get_tbclk README* doc || echo not found not found tornado% grep -qr get_ticks README* doc/* || echo not found not found I've made a quick tour of all definitions in cpu/ and here is the result. As you see, at91 (which you used as reference, I understand) is wrong, while all the others use either hwticks or SYS_HZ consistently. source-fileget_ticks() get_tbclk arm920t/at91/timer.c get_timer() CONFIG_SYS_HZ arm920t/a320/timer.c get_timer() CONFIG_SYS_HZ arm920t/s3c24x0/timer.c hw-ticks (I didn't understand) arm920t/imx/timer.c get_timer() CONFIG_SYS_HZ arm920t/at91rm9200/timer.c get_timer() CONFIG_SYS_HZ pxa/timer.c hw-ticks-32bits TIMER_FREQ_HZ arm_cortexa8/omap3/timer.c get_timer() CONFIG_SYS_HZ arm_cortexa8/s5pc1xx/timer.c get_timer() CONFIG_SYS_HZ arm925t/timer.c get_timer() CONFIG_SYS_HZ ppc4xx/cpu.c lib_ppc/ticks.S freqProcessor blackfin/interrupts.cget_timer() CONFIG_SYS_HZ sa1100/timer.c get_timer() CONFIG_SYS_HZ mpc824x/cpu.clib_ppc/ticks.S bus_freq mpc8xx/cpu.c lib_ppc/ticks.S timebase mpc512x/cpu.clib_ppc/ticks.S timebase mpc5xxx/cpu.clib_ppc/ticks.S timebase mpc8220/cpu.clib_ppc/ticks.S timebase at32ap/interrupts.c hw-ticks cpu_hz mpc85xx/cpu.clib_ppc/ticks.S timebase 74xx_7xx/cpu.c lib_ppc/ticks.S timebase arm1136/omap24xx/timer.c get_timer() CONFIG_SYS_HZ mpc86xx/cpu.clib_ppc/ticks.S timebase mpc8260/cpu.clib_ppc/ticks.S timebase arm926ejs/omap/timer.c get_timer() CONFIG_SYS_HZ arm926ejs/davinci/timer.cget_timer() CONFIG_SYS_HZ arm926ejs/versatile/timer.c get_timer() CONFIG_SYS_HZ arm926ejs/at91/timer.c hwticks CONFIG_SYS_HZ arm926ejs/spear/timer.c hwticks CONFIG_SYS_HZ arm1176/s3c64xx/timer.c hwrticks (I didn't understand) lh7a40x/timer.c get_timer(I didn't understand) mpc5xx/cpu.c lib_ppc/ticks.S timebase /alessandro ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2 rev2] ep93xx: Refactoring of timer code
Hi Tom, El Thu, Feb 25, 2010 at 09:54:59AM -0600 Tom ha dit: > Matthias Kaehlcke wrote: > >ep93xx: Refactoring of the timer code, including the following changes > > > > * use a free running timer instead of a periodical one > > * use unsigned long long for total number of ticks > > * hold the timer state in a structure instead of separate variables > > * increment the timer counter instead of decrementing it > > * remove unused function udelay_masked() > > * remove unused function set_timer() > > > >Signed-off-by: Matthias Kaehlcke > > This set has been applied to ARM. i was/am working on a new version of the patch, taking into account your remarks about the unit of TIMER_FREQ and fixing some issues discussed with Alessandro Rubini off-list, who worked on a similar patch. what do you prefer, a patch based on the ones you just applied, or revert them and get one with all fixes (only one patch, cause the function clk_to_systicks() fixed in the first patch of the set is removed) i apologize for not having taken the time to notify about this and causing you overhead :( -- Matthias Kaehlcke Embedded Linux Developer Barcelona Someone has said that it requires less mental effort to condemn than to think (Emma Goldman) .''`. using free software / Debian GNU/Linux | http://debian.org : :' : `. `'` gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `- ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] EBC_NUM_BANKS for Virtex5 PPC440?
I'm working on a custom board that is similar to the ml507 (with a virtex 5 powerpc 440), and I ran across this error compiling u-boot: fdt.c: In function '__ft_board_setup': fdt.c:43: error: 'EBC_NUM_BANKS' undeclared (first use in this function) fdt.c:43: error: (Each undeclared identifier is reported only once fdt.c:43: error: for each function it appears in.) fdt.c:43: warning: unused variable 'ranges' I looked in ppc4xx-ebc.h and EBC_NUM_BANKS is only defined for 405xx and 440xx variants. I tried setting it to zero and it works so far (see the following diff), but is there a more proper way of disabling EBC? diff --git a/include/asm-ppc/ppc4xx-ebc.h b/include/asm-ppc/ppc4xx-ebc.h index 9680f70..61beb8d 100644 --- a/include/asm-ppc/ppc4xx-ebc.h +++ b/include/asm-ppc/ppc4xx-ebc.h @@ -41,26 +41,33 @@ #if defined(CONFIG_405CR) || defined(CONFIG_405GP) || \ defined(CONFIG_405EZ) || \ defined(CONFIG_440GP) || defined(CONFIG_440GX) + #define EBC_NUM_BANKS 8 -#endif -#if defined(CONFIG_405EP) +#elif defined(CONFIG_405EP) + #define EBC_NUM_BANKS 5 -#endif -#if defined(CONFIG_405EX) || \ +#elif defined(CONFIG_405EX) || \ defined(CONFIG_460SX) + #define EBC_NUM_BANKS 4 -#endif -#if defined(CONFIG_440EP) || defined(CONFIG_440GR) || \ +#elif defined(CONFIG_440EP) || defined(CONFIG_440GR) || \ defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \ defined(CONFIG_460EX) || defined(CONFIG_460GT) + #define EBC_NUM_BANKS 6 -#endif -#if defined(CONFIG_440SP) || defined(CONFIG_440SPE) +#elif defined(CONFIG_440SP) || defined(CONFIG_440SPE) + #define EBC_NUM_BANKS 3 + +#else + +/* TBD, what if CONFIG_440 but none of those others? */ +#define EBC_NUM_BANKS 0 + #endif /* Bank Configuration Register */ Thank you, Lucas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] ppc4xx fix unstable 440EPx bootstrap options
440EPx fixed bootstrap options A, B, D, and E sets PLL FWDVA to a value = 1. This results in the PLLOUTB being greater than the CPU clock frequency resulting unstable 440EPx operation resulting in various software hang conditions. Signed-off-by: Rupjyoti Sarmah Acked-by : Victor Gallardo --- cpu/ppc4xx/cpu_init.c | 67 +--- 1 files changed, 62 insertions(+), 5 deletions(-) diff --git a/cpu/ppc4xx/cpu_init.c b/cpu/ppc4xx/cpu_init.c index ccd9993..9b7caff 100644 --- a/cpu/ppc4xx/cpu_init.c +++ b/cpu/ppc4xx/cpu_init.c @@ -35,6 +35,10 @@ DECLARE_GLOBAL_DATA_PTR; #ifndef CONFIG_SYS_PLL_RECONFIG #define CONFIG_SYS_PLL_RECONFIG0 #endif +#define BOOT_STRAP_OPTION_A 0x +#define BOOT_STRAP_OPTION_B 0x0001 +#define BOOT_STRAP_OPTION_D 0x0003 +#define BOOT_STRAP_OPTION_E 0x0004 void reconfigure_pll(u32 new_cpu_freq) { @@ -111,17 +115,70 @@ void reconfigure_pll(u32 new_cpu_freq) mtcpr(CPR0_SPCID, reg); reset_needed = 1; } + } + /* Get current value of FWDVA.*/ + mfcpr(CPR0_PLLD, reg); + temp = (reg & PLLD_FWDVA_MASK) >> 16; + /* +* Check to see if FWDVA has been set to value of 1. if it has we must +* modify it. +*/ + if (temp == 1) { + mfcpr(CPR0_PLLD, reg); + /* Get current value of fbdv. */ + temp = (reg & PLLD_FBDV_MASK) >> 24; + fbdv = temp ? temp : 32; + /* Get current value of lfbdv. */ + temp = (reg & PLLD_LFBDV_MASK); + lfbdv = temp ? temp : 64; + /* +* Load register that contains current boot strapping option. +*/ + mfcpr(CPR0_ICFG, reg); + /* Shift strapping option into low 3 bits.*/ + reg = (reg >> 28); + + if (reg == BOOT_STRAP_OPTION_A || reg == BOOT_STRAP_OPTION_B || + reg == BOOT_STRAP_OPTION_D || reg == BOOT_STRAP_OPTION_E) { + /* +* Get current value of FWDVA. Assign current FWDVA to +* new FWDVB. +*/ + mfcpr(CPR0_PLLD, reg); + target_fwdvb = (reg & PLLD_FWDVA_MASK) >> 16; + fwdvb = target_fwdvb ? target_fwdvb : 8; + /* +* Get current value of FWDVB. Assign current FWDVB to +* new FWDVA. +*/ + target_fwdva = (reg & PLLD_FWDVB_MASK) >> 8; + fwdva = target_fwdva ? target_fwdva : 16; + /* +* Update CPR0_PLLD with switched FWDVA and FWDVB. +*/ + reg &= ~(PLLD_FWDVA_MASK | PLLD_FWDVB_MASK | + PLLD_FBDV_MASK | PLLD_LFBDV_MASK); + reg |= ((fwdva == 16 ? 0 : fwdva) << 16) | + ((fwdvb == 8 ? 0 : fwdvb) << 8) | + ((fbdv == 32 ? 0 : fbdv) << 24) | + (lfbdv == 64 ? 0 : lfbdv); + mtcpr(CPR0_PLLD, reg); + /* Acknowledge that a reset is required. */ + reset_needed = 1; + } + } - /* Set reload inhibit so configuration will persist across -* processor resets */ + if (reset_needed) { + /* +* Set reload inhibit so configuration will persist across +* processor resets +*/ mfcpr(CPR0_ICFG, reg); reg &= ~CPR0_ICFG_RLI_MASK; reg |= 1 << 31; mtcpr(CPR0_ICFG, reg); - } - /* Reset processor if configuration changed */ - if (reset_needed) { + /* Reset processor if configuration changed */ __asm__ __volatile__ ("sync; isync"); mtspr(SPRN_DBCR0, 0x2000); } -- 1.5.6.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] mpc8315erdb: fix out-of-tree building for NAND config
On Tue, Feb 23, 2010 at 06:48:15PM -0600, Kim Phillips wrote: [...] > > Can you please look into this? Thanks. > > it seems a complete merge of mpc8313 and mpc8315 into mpc831x is in > order. I'll see what I can do. IIRC some 837x boards can boot from nand too, and I guess there isn't much differencies between 831x and 837x SPLs. Maybe there is some way to merge 831x SPL into 83xx SPL? Thanks, -- Anton Vorontsov email: cbouatmai...@gmail.com irc://irc.freenode.net/bd2 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] About Die ID When Booting u-boot
huadong2008 wrote: > Hi, > I'm studying porting Android onto Beagleboard(OMAP3530 based). > When booting u-boot version 2009 11 from SD card, the terminal show "Die ID > #7fa2000304013f7806011011 ". > Could you please tell me what is Die ID? Or where can I download relative > document about it? > > I'm sorry for my poor English, and hope it will not puzzle you. This function is a unique identifier for the specific board. Please review function dieid_num_r in cpu/arm_cortex8/sys_info.c This will show you what the register are. Please find these registers in omap3530 reference manual This is a good place to start http://focus.ti.com/docs/prod/folders/print/omap3530.html Tom > > 2010-02-25 > > > > My thanks and best regards > Huadong > > > > > > ___ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] memory display question
Detlev Zundel wrote: > Hi Steve, > >> I'm currently getting an error when I try to do a secure boot (internal >> to the processor). So the next step is to verify that my u-boot image is >> loaded where I think it should be loaded (at TEXT_BASE (0x83F0_)). >> >> When I do a md.w 0x83F0 0x20 it display's all zero's which is wrong. >> It should have my reset vector and some other things there. The image >> header is really at offset 0x400. >> >> So I tried md.w 0x83F00400 0x20 and still all 0's. > > Why do you do a "md.w" to explicitely select 16-bit entities? Did you > try without (i.e. correpsonding to .l) and .b? Maybe your system has > problems with different access widths. > Yes I've tried both md.b and md.l, same deal. >> This makes no sense because the darn thing boots! >> >> When I hook my Lauterbach to it and do a view memory through the JTAG >> the memory looks as I expect. This makes complete sense because if this >> wasn't the case I wasn't sure how my system was going to boot. > > What accesses do you perform in this setup to read the memory? > Oh good question.. I'll look at that... Thanks. -- Steve Iribarne Sr. Software Engineer Embedded Devices This e-mail and any of its attachments may contain proprietary information, which is privileged, confidential or subject to copyright belonging to Grid Net, Inc. This e-mail is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, copying or action taken in relation to the contents of this e-mail is strictly prohibited and may be unlawful. If you have received this e-mail in error, please notify the sender immediately and permanently delete. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2 rev2] ep93xx: Refactoring of timer code
Matthias Kaehlcke wrote: > ep93xx: Refactoring of the timer code, including the following changes > > * use a free running timer instead of a periodical one > * use unsigned long long for total number of ticks > * hold the timer state in a structure instead of separate variables > * increment the timer counter instead of decrementing it > * remove unused function udelay_masked() > * remove unused function set_timer() > > Signed-off-by: Matthias Kaehlcke This set has been applied to ARM. Thanks Tom ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2] Add bootcount to AT91
Use AT91_GPBR 3 as a bootcount register. The bootmagic and the bootcount shares AT91_GPBR 3. Signed-off-by: Anders Darander --- Changes since V1: * Corrected multiline comment. * Added a comment about why a common register is used for the bootmagic and the bootcount. * Mask the input to bootcount_store to 16 bits. cpu/arm926ejs/at91/cpu.c | 34 ++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/cpu/arm926ejs/at91/cpu.c b/cpu/arm926ejs/at91/cpu.c index 993b299..99a4c49 100644 --- a/cpu/arm926ejs/at91/cpu.c +++ b/cpu/arm926ejs/at91/cpu.c @@ -35,6 +35,13 @@ #define AT91_MAIN_CLOCK 0 #endif +/* + * The at91sam9260 has 4 GPBR (0-3), we'll use the last one, nr 3, + * to keep track of the bootcount. + */ +#define AT91_GPBR_BOOTCOUNT_REGISTER 3 +#define AT91_BOOTCOUNT_ADDRESS (AT91_GPBR + 4*AT91_GPBR_BOOTCOUNT_REGISTER) + int arch_cpu_init(void) { return at91_clock_init(AT91_MAIN_CLOCK); @@ -56,3 +63,30 @@ int print_cpuinfo(void) return 0; } #endif + +#ifdef CONFIG_BOOTCOUNT_LIMIT +/* + * Just as the mpc5xxx, we combine the BOOTCOUNT_MAGIC and boocount + * in one 32-bit register. This is done, as the AT91SAM9260 only has + * 4 GPBR. + */ +void bootcount_store (ulong a) +{ + volatile ulong *save_addr = + (volatile ulong *)(AT91_BASE_SYS + AT91_BOOTCOUNT_ADDRESS); + + *save_addr = (BOOTCOUNT_MAGIC & 0x) | (a & 0x); +} + +ulong bootcount_load (void) +{ + volatile ulong *save_addr = + (volatile ulong *)(AT91_BASE_SYS + AT91_BOOTCOUNT_ADDRESS); + + if ((*save_addr & 0x) != (BOOTCOUNT_MAGIC & 0x)) + return 0; + else + return (*save_addr & 0x); +} + +#endif /* CONFIG_BOOTCOUNT_LIMIT */ -- 1.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Add bootcount to AT91
Hi Tom, Thanks for your comments. On Thu, Feb 25, 2010 at 15:24, Tom wrote: > Anders Darander wrote: >> >> From: Anders Darander >> --- a/cpu/arm926ejs/at91/cpu.c >> +++ b/cpu/arm926ejs/at91/cpu.c >> @@ -31,6 +31,11 @@ >> #define AT91_MAIN_CLOCK 0 >> #endif >> +/* The at91sam9260 has 4 GPBR (0-3), we'll use the last one, nr 3, >> + * to keep track of the bootcount. */ > > multi-line comments are > /* > *Comment lines > */ Correct, I'll fix this. >> +#define AT91_GPBR_BOOTCOUNT_REGISTER 3 >> +#define AT91_BOOTCOUNT_ADDRESS (AT91_GPBR + >> 4*AT91_GPBR_BOOTCOUNT_REGISTER) >> + >> int arch_cpu_init(void) >> { >> return at91_clock_init(AT91_MAIN_CLOCK); >> @@ -52,3 +57,26 @@ int print_cpuinfo(void) >> return 0; >> } >> #endif >> + >> +#ifdef CONFIG_BOOTCOUNT_LIMIT >> + >> +void bootcount_store (ulong a) >> +{ >> + volatile ulong *save_addr = >> + (volatile ulong *)(AT91_BASE_SYS + >> AT91_BOOTCOUNT_ADDRESS); >> + >> + *save_addr = (BOOTCOUNT_MAGIC & 0x) | a; > > implied length of a is 16 bits. > the parameter type passed in should be explicitly cast/masked to u16. Correct, I'll fix this. > I see sharing the 32 bits this way is how mpc5xxx does it.. > > But > > mpc8260, mpc83xx, mpc8xx, ppc4xx, ipx store the bootcount_magic and the > parameter as 2 32bit values. > > Is there a memory limitation on why you can not follow what most of the > others > are doing ? If there is, please add the explanation as a comment. Well, I think I'd prefer to keep the boocount and the magic to share a 32-bit register; the main reason being that the AT91SAM9260 only has 4 GPBR, i.e. only four registers that keep it's data between resets. I'll add a comment about this. Best regards, Anders -- Anders Darander EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims." ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] OMAP3: workaround for ARM Cortex-A8 erratum 725233
Paulraj, Sandeep wrote: >> Siarhei Siamashka wrote: >>> 725233: PLD instructions executed with PLD data forwarding >>> enabled can result in a processor deadlock >>> >>> This deadlock can happen when NEON load instructions are used together >>> with cache preload instructions (PLD). The problematic conditions >>> can be triggered in-the-wild by NEON optimized functions from pixman >>> library (http://cgit.freedesktop.org/pixman), which perform dynamic >>> adjustment of prefetch distance. >>> >>> The workaround disables PLD data forwarding by setting PLD_FWD bit >>> in L2 Cache Auxiliary Control Register as recommended in ARM Cortex-A8 >>> errata list. >>> >>> The deadlock can only happen on r1pX revisions of Cortex-A8 (used in >>> OMAP34xx/OMAP35xx). Performance impact of the workaround is practically >>> non-existant. >>> >>> Signed-off-by: Siarhei Siamashka >> Thank you for the improvements on the comment. >> Ack-ed. > Seems important to me. > I'm going to push it to u-boot-ti and send a pull request for the same I saw the merge on TI so I went ahead and pulled. Applied to ARM. Thanks Tom > >> Tom ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Add bootcount to AT91
Anders Darander wrote: > From: Anders Darander > > Use AT91_GPBR 3 as a bootcount register. > > Signed-off-by: Anders Darander > --- > cpu/arm926ejs/at91/cpu.c | 28 > 1 files changed, 28 insertions(+), 0 deletions(-) > > diff --git a/cpu/arm926ejs/at91/cpu.c b/cpu/arm926ejs/at91/cpu.c > index f2f7b62..09c1376 100644 > --- a/cpu/arm926ejs/at91/cpu.c > +++ b/cpu/arm926ejs/at91/cpu.c > @@ -31,6 +31,11 @@ > #define AT91_MAIN_CLOCK 0 > #endif > > +/* The at91sam9260 has 4 GPBR (0-3), we'll use the last one, nr 3, > + * to keep track of the bootcount. */ multi-line comments are /* *Comment lines */ > +#define AT91_GPBR_BOOTCOUNT_REGISTER 3 > +#define AT91_BOOTCOUNT_ADDRESS (AT91_GPBR + 4*AT91_GPBR_BOOTCOUNT_REGISTER) > + > int arch_cpu_init(void) > { > return at91_clock_init(AT91_MAIN_CLOCK); > @@ -52,3 +57,26 @@ int print_cpuinfo(void) > return 0; > } > #endif > + > +#ifdef CONFIG_BOOTCOUNT_LIMIT > + > +void bootcount_store (ulong a) > +{ > + volatile ulong *save_addr = > + (volatile ulong *)(AT91_BASE_SYS + AT91_BOOTCOUNT_ADDRESS); > + > + *save_addr = (BOOTCOUNT_MAGIC & 0x) | a; implied length of a is 16 bits. the parameter type passed in should be explicitly cast/masked to u16. I see sharing the 32 bits this way is how mpc5xxx does it.. But mpc8260, mpc83xx, mpc8xx, ppc4xx, ipx store the bootcount_magic and the parameter as 2 32bit values. Is there a memory limitation on why you can not follow what most of the others are doing ? If there is, please add the explanation as a comment. Thank you for pinging me, Tom ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] setexpr syntax
Dear Frans Meulenbroeks, In message you wrote: > > I noticed setexpr help says: > can be &, |, ^, +, -, *, /, % > > However, when one uses the hush shell additional escapes might be needed. Well, yes, of course. > Not sure whether we should document this somewhere (or modify the help text). > It took me a few minutes to realise what is going on, so a warning > somewhere seems in place. Please feel free to extend / update the documentation, but eventually necessary shell escapes are beyond the scope of the help message. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de Build a system that even a fool can use and only a fool will want to use it. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] cmd_mmc remove \n
This patch removed the \n after the help message for mmcinfo. This one resulted in an empty line being displayed after the mmcinfo line when the help command was given. Signed-off-by: Frans Meulenbroeks --- common/cmd_mmc.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 0e3393b..c67c9cf 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -136,7 +136,7 @@ int do_mmcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } U_BOOT_CMD(mmcinfo, 2, 0, do_mmcinfo, - "mmcinfo -- display MMC info\n", + "mmcinfo -- display MMC info", "" ); -- 1.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 7/7] cmd_setexpr: allow memory addresses and env vars in expressions
Resubmitted the patch (see previous message) as I noticed a \n in the help was missing. Apologies for any inconvenience. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] setexpr syntax
Dear all, I noticed setexpr help says: can be &, |, ^, +, -, *, /, % However, when one uses the hush shell additional escapes might be needed. => setexpr tst 3 & f syntax error => setexpr tst 3 | f syntax error This works: => setexpr tst 3 \| f => print tst tst=f Not sure whether we should document this somewhere (or modify the help text). It took me a few minutes to realise what is going on, so a warning somewhere seems in place. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 7/7] cmd_setexpr: allow memory addresses and env vars in expressions
This patch add functionality to use memory addresses and environment variables in expressions. This increases the power of expressions substantially It adheres to the standard convemtions: memory addresses can be given in the format *address (e.g. *1000), environment variables as $this_var. environment variables are not processed recursively but can contain both constants and memory addresses. Rationale for this change is that it allows masking off bits from a byte that is obtained by reading data from e.g. i2c. Signed-off-by: Frans Meulenbroeks --- If recursive environment vars is desired: this can be added easily by changing the if statement into a while statement. I figured that would be somewhat over the top though (and, unless you take special precautions you can run into an endless loop if an env var contains its own name. If it is desired, please let me know and I happily will add it. And a snippet from the test log: => mm.b 1000 1000: de ? 12 1001: ad ? 34 1002: be ? 56 1003: ef ? 78 1004: de ? 1005: ad ? . => setexpr aap 3 + *1000 => echo $aap 1234567b => setexpr.b aap 3 + *1000 => echo $aap 15 => setexpr.w nut $aap + *1000 => echo $nut 1249 --- common/cmd_setexpr.c | 33 + 1 files changed, 29 insertions(+), 4 deletions(-) diff --git a/common/cmd_setexpr.c b/common/cmd_setexpr.c index f8b5d4d..6ea9296 100644 --- a/common/cmd_setexpr.c +++ b/common/cmd_setexpr.c @@ -28,10 +28,32 @@ #include #include +static ulong get_arg(char *s, int w) +{ + ulong *p; + + /* if the parameter starts with a $ replace it with the environment value */ + if (s[0] == '$') { + s = getenv(&s[1]); + } + /* if the parameter starts with a * then assume is a pointer to the value we want */ + if (s[0] == '*') { + p = (ulong *)simple_strtoul(&s[1], NULL, 16); + switch (w) { + case 1: return((ulong)(*(uchar *)p)); + case 2: return((ulong)(*(ushort *)p)); + case 4: return(*p); + } + } else { + return simple_strtoul(s, NULL, 16); + } +} + int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { ulong a, b; char buf[16]; + int w; /* Validate arguments */ if ((argc != 5) || (strlen(argv[3]) != 1)) { @@ -39,8 +61,10 @@ int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } - a = simple_strtoul(argv[2], NULL, 16); - b = simple_strtoul(argv[4], NULL, 16); + w = cmd_get_data_size(argv[0], 4); + + a = get_arg(argv[2], w); + b = get_arg(argv[4], w); switch (argv[3][0]) { case '|': sprintf(buf, "%lx", (a | b)); break; @@ -64,7 +88,8 @@ int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( setexpr, 5, 0, do_setexpr, "set environment variable as the result of eval expression", - "name value1 value2\n" + "[.b, .w, .l] name value1 value2\n" "- set environment variable 'name' to the result of the evaluated\n" - " express specified by . can be &, |, ^, +, -, *, /, %" + " express specified by . can be &, |, ^, +, -, *, /, %\n" + " size argument is only meaningful if value1 and/or value2 are memory addresses" ); -- 1.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 7/7] cmd_setexpr: allow memory addresses and env vars in expressions
btw no idea why this patch became 7/7. I did not use -n in format-patch (but indeed I am 7 patches ahead the first 5 then an unnumbered one (which is independent of the earlier ones) and this one (which is again independent of earlier ones. Ah well, the mysteries of git I assume. Frans ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/3 v5] SAMSUNG: SMDKC100: Adds ethernet support.
From: Naveen Krishna CH Add setup for ethernet on SMDKC100, allowing kernel/ramdisk to be loaded over tftp. The preinit function will configure GPIO (GPK0CON) & SROMC to look for environment in SROM Bank 3. Signed-off-by: Naveen Krishna Ch --- Changes since V1: 1. The CONFIG_BOOTP* and Net config Macros are removed from config header. Comments from Ben Warren are fixed 2. The GPIO configuration is modified & Macro and Function are renamed. Comments from Minkyu Kang are fixedChanges since V2 Changes since V2: 1. GPIO configurations function has been implemented. Changes since V3: 1. Comments from Minkyu Kang are fixed. Changes since V4: None board/samsung/smdkc100/smdkc100.c | 39 + include/configs/smdkc100.h| 12 ++- 2 files changed, 50 insertions(+), 1 deletions(-) diff --git a/board/samsung/smdkc100/smdkc100.c b/board/samsung/smdkc100/smdkc100.c index 15a1a27..4fc802e 100644 --- a/board/samsung/smdkc100/smdkc100.c +++ b/board/samsung/smdkc100/smdkc100.c @@ -23,10 +23,40 @@ */ #include +#include +#include +#include + DECLARE_GLOBAL_DATA_PTR; +/* + * Miscellaneous platform dependent initialisations + */ +static void smc9115_pre_init(void) +{ + u32 tmp; + u32 smc_bw_conf, smc_bc_conf; + + struct s5pc100_gpio *const gpio = + (struct s5pc100_gpio *)S5PC100_GPIO_BASE; + + /* gpio configuration GPK0CON */ + gpio_cfg_pin(&gpio->gpio_k0, CONFIG_ENV_SROM_BANK, GPIO_FUNC(2)); + + /* Ethernet needs bus width of 16 bits */ + smc_bw_conf = SMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK); + smc_bc_conf = SMC_BC_TACS(0x0) | SMC_BC_TCOS(0x4) | SMC_BC_TACC(0xe) + | SMC_BC_TCOH(0x1) | SMC_BC_TAH(0x4) + | SMC_BC_TACP(0x6) | SMC_BC_PMC(0x0); + + /* Select and configure the SROMC bank */ + s5pc1xx_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, smc_bc_conf); +} + int board_init(void) { + smc9115_pre_init(); + gd->bd->bi_arch_number = MACH_TYPE_SMDKC100; gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; @@ -49,3 +79,12 @@ int checkboard(void) return 0; } #endif + +int board_eth_init(bd_t *bis) +{ + int rc = 0; +#ifdef CONFIG_SMC911X + rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); +#endif + return rc; +} diff --git a/include/configs/smdkc100.h b/include/configs/smdkc100.h index f12fea3..c8abad6 100644 --- a/include/configs/smdkc100.h +++ b/include/configs/smdkc100.h @@ -83,7 +83,6 @@ #undef CONFIG_CMD_FLASH #undef CONFIG_CMD_IMLS #undef CONFIG_CMD_NAND -#undef CONFIG_CMD_NET #define CONFIG_CMD_CACHE #define CONFIG_CMD_REGINFO @@ -235,4 +234,15 @@ #define CONFIG_DOS_PARTITION 1 +/* + * Ethernet Contoller driver + */ +#ifdef CONFIG_CMD_NET +#define CONFIG_NET_MULTI +#define CONFIG_SMC911X 1 /* we have a SMC9115 on-board */ +#define CONFIG_SMC911X_16_BIT 1 /* SMC911X_16_BIT Mode */ +#define CONFIG_SMC911X_BASE0x98800300 /* SMC911X Drive Base */ +#define CONFIG_ENV_SROM_BANK 3 /* Select SROM Bank-3 for Ethernet*/ +#endif /* CONFIG_CMD_NET */ + #endif /* __CONFIG_H */ -- 1.6.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/3 v5] S5PC100: Function to configure the SROMC registers.
From: Naveen Krishna CH Nand Flash, Ethernet, other features might need to configure the SROMC registers accordingly. The config_sromc() functions helps with this. Signed-off-by: Naveen Krishna Ch --- Changes since V1: 1. Funtion config_sromc() is renamed to s5pc1xx_config_sromc(). Comments from Minkyu Kang are fixed Changes since V2: 1.cpu_is_s5pc100() function is used instead of Macros. Changes since V3: 1. Comments from Minkyu Kang are fixed. Changes since V4: None cpu/arm_cortexa8/s5pc1xx/Makefile |1 + cpu/arm_cortexa8/s5pc1xx/sromc.c | 53 include/asm-arm/arch-s5pc1xx/smc.h |3 ++ 3 files changed, 57 insertions(+), 0 deletions(-) create mode 100644 cpu/arm_cortexa8/s5pc1xx/sromc.c diff --git a/cpu/arm_cortexa8/s5pc1xx/Makefile b/cpu/arm_cortexa8/s5pc1xx/Makefile index 7290c2f..01c93fe 100644 --- a/cpu/arm_cortexa8/s5pc1xx/Makefile +++ b/cpu/arm_cortexa8/s5pc1xx/Makefile @@ -34,6 +34,7 @@ SOBJS += reset.o COBJS += clock.o COBJS += cpu_info.o COBJS += gpio.o +COBJS += sromc.o COBJS += timer.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) diff --git a/cpu/arm_cortexa8/s5pc1xx/sromc.c b/cpu/arm_cortexa8/s5pc1xx/sromc.c new file mode 100644 index 000..380be81 --- /dev/null +++ b/cpu/arm_cortexa8/s5pc1xx/sromc.c @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Samsung Electronics + * Naveen Krishna Ch + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include +#include + +/* + * s5pc1xx_config_sromc() - select the proper SROMC Bank and configure the + * band width control and bank control registers + * srom_bank - SROM Bank 0 to 5 + * smc_bw_conf - SMC Band witdh reg configuration value + * smc_bc_conf - SMC Bank Control reg configuration value + */ +void s5pc1xx_config_sromc(u32 srom_bank, u32 smc_bw_conf, u32 smc_bc_conf) +{ + u32 tmp; + struct s5pc1xx_smc *srom; + + if (cpu_is_s5pc100()) + srom = (struct s5pc1xx_smc *)S5PC100_SROMC_BASE; + else + srom = (struct s5pc1xx_smc *)S5PC110_SROMC_BASE; + + /* Configure SMC_BW register to handle proper SROMC bank */ + tmp = srom->bw; + tmp &= ~(0xF << (srom_bank * 4)); + tmp |= smc_bw_conf; + srom->bw = tmp; + + /* Configure SMC_BC register */ + srom->bc[srom_bank] = smc_bc_conf; +} diff --git a/include/asm-arm/arch-s5pc1xx/smc.h b/include/asm-arm/arch-s5pc1xx/smc.h index e1a5399..88f4ffe 100644 --- a/include/asm-arm/arch-s5pc1xx/smc.h +++ b/include/asm-arm/arch-s5pc1xx/smc.h @@ -47,4 +47,7 @@ struct s5pc1xx_smc { }; #endif /* __ASSEMBLY__ */ +/* Configure the Band Width and Bank Control Regs for required SROMC Bank */ +void s5pc1xx_config_sromc(u32 srom_bank, u32 smc_bw_conf, u32 smc_bc_conf); + #endif /* __ASM_ARCH_SMC_H_ */ -- 1.6.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/3 v5] S5PC100: Memory SubSystem Header file, register description(SROMC).
From: Naveen Krishna CH Memory subsystem of S5PC100 handles SROM, SRAM, OneDRAM, OneNand, NAND Flash, DDRs. smc.h is a common place for the register description of Memory subsystem of S5PC100. Note: Only SROM related registers are descibed now. Signed-off-by: Naveen Krishna Ch --- Changes since V1: 1. The header file is renamed to smc.h from smc.h 2. The Macros are renamed according to TRM. Comments from Minkyu kang are fixed. Changes since V2: 1. Macros have been modified to be generic. Comments from Minkyu kang are fixed Changes since V3: 1. No Changes. Changes since v4: 1. The header file name int he Description was changed. include/asm-arm/arch-s5pc1xx/smc.h | 50 1 files changed, 50 insertions(+), 0 deletions(-) create mode 100644 include/asm-arm/arch-s5pc1xx/smc.h diff --git a/include/asm-arm/arch-s5pc1xx/smc.h b/include/asm-arm/arch-s5pc1xx/smc.h new file mode 100644 index 000..e1a5399 --- /dev/null +++ b/include/asm-arm/arch-s5pc1xx/smc.h @@ -0,0 +1,50 @@ +/* + * (C) Copyright 2010 Samsung Electronics + * Naveen Krishna Ch + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * Note: This file contains the register description for Memory subsystem + * (SROM, NAND Flash, OneNand, DDR, OneDRAM) on S5PC1XX. + * + * Only SROMC is defined as of now + */ + +#ifndef __ASM_ARCH_SMC_H_ +#define __ASM_ARCH_SMC_H_ + +#define SMC_DATA16_WIDTH(x)(1<<((x*4)+0)) +#define SMC_BYTE_ADDR_MODE(x) (1<<((x*4)+1)) /* 0-> Half-word base address*/ + /* 1-> Byte base address*/ +#define SMC_WAIT_ENABLE(x) (1<<((x*4)+2)) +#define SMC_BYTE_ENABLE(x) (1<<((x*4)+3)) + +#define SMC_BC_TACS(x) (x << 28) /* 0clk address set-up */ +#define SMC_BC_TCOS(x) (x << 24) /* 4clk chip selection set-up */ +#define SMC_BC_TACC(x) (x << 16) /* 14clkaccess cycle */ +#define SMC_BC_TCOH(x) (x << 12) /* 1clk chip selection hold */ +#define SMC_BC_TAH(x) (x << 8) /* 4clk address holding time */ +#define SMC_BC_TACP(x) (x << 4) /* 6clk page mode access cycle */ +#define SMC_BC_PMC(x) (x << 0) /* normal(1data)page mode configuration */ + +#ifndef __ASSEMBLY__ +struct s5pc1xx_smc { + unsigned intbw; + unsigned intbc[6]; +}; +#endif /* __ASSEMBLY__ */ + +#endif /* __ASM_ARCH_SMC_H_ */ -- 1.6.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] imx27lite board support no longer compile
Heiko Schocher wrote: > Hello Stefano, > Hi Heiko, > your following commit breaks building the imx27lite board > (and all boards, which uses the ./drivers/net/fec_mxc.c > I think), because the following function is missing: > > [...@pollux u-boot]$ grep -lr imx_get_fecclk . > ./drivers/net/fec_mxc.c > ./drivers/net/fec_mxc.o > ./drivers/net/libnet.a > ./LOG/imx27lite.ERR > [...@pollux u-boot]$ > > and this function is only used in this driver ... > > --- > > authorStefano Babic > commit4294b2485bf0e8d68c893190a96bb0e7856b12c4 > > fec_mxc: add support for MX51 processor > > The patch add support for the Freescale mx51 processor > > to the FEC ethernet driver. > > > Signed-off-by: Stefano Babic > Signed-off-by: Ben Warren > --- > > ... any ideas? Yes, at the same time two patches for the fec_imx was sent by me and by John. John sends to me and to the ML a comment informing that he made patches to factor a lot of SOC specific, cleaning up code and avoiding nasty #ifdef. I see his patch in archive as http://www.mail-archive.com/u-boot@lists.denx.de/msg27481.html. I have already used the proposed function, but John's patch is not already in the mainline - probably it is still in the imx queue. Jason is working to bring a lot of MX patches in the mainline this week. Regards, Stefano -- = 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: off...@denx.de = ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/3 v4] S5PC100: Memory SubSystem Header file, register description(SROMC).
Naveen Krishna Ch, On 25 February 2010 20:37, Naveen Krishna Ch wrote: > Sure sure, > Do i need to send as v5 > or can i send this patch alone Please don't top posting. And please send v5. > > On 25 February 2010 17:03, Minkyu Kang wrote: >> >> Dear Naveen Krishna CH, >> >> On 23 February 2010 18:21, wrote: >> > From: Naveen Krishna CH >> > >> > Memory subsystem of S5PC100 handles SROM, SRAM, OneDRAM, OneNand, >> > NAND Flash, DDRs. >> > mem.h is a common place for the register description of Memory subsystem >> > of S5PC100. >> > Note: Only SROM related registers are descibed now. >> > >> >> Now, your patchset looks fine >> but sorry, please fix this commit message. >> It's not mem.h >> >> Thanks >> Minkyu Kang >> -- >> from. prom. >> www.promsoft.net >> ___ >> U-Boot mailing list >> U-Boot@lists.denx.de >> http://lists.denx.de/mailman/listinfo/u-boot > > > > -- > Shine bright, > (: Naveen Krishna Ch :) > Thanks Minkyu Kang -- from. prom. www.promsoft.net ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] imx27lite board support no longer compile
Hello Stefano, your following commit breaks building the imx27lite board (and all boards, which uses the ./drivers/net/fec_mxc.c I think), because the following function is missing: [...@pollux u-boot]$ grep -lr imx_get_fecclk . ./drivers/net/fec_mxc.c ./drivers/net/fec_mxc.o ./drivers/net/libnet.a ./LOG/imx27lite.ERR [...@pollux u-boot]$ and this function is only used in this driver ... --- author Stefano Babic commit 4294b2485bf0e8d68c893190a96bb0e7856b12c4 fec_mxc: add support for MX51 processor The patch add support for the Freescale mx51 processor to the FEC ethernet driver. Signed-off-by: Stefano Babic Signed-off-by: Ben Warren --- ... any ideas? bye Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/3 v4] S5PC100: Memory SubSystem Header file, register description(SROMC).
Sure sure, Do i need to send as v5 or can i send this patch alone On 25 February 2010 17:03, Minkyu Kang wrote: > Dear Naveen Krishna CH, > > On 23 February 2010 18:21, wrote: > > From: Naveen Krishna CH > > > > Memory subsystem of S5PC100 handles SROM, SRAM, OneDRAM, OneNand, > > NAND Flash, DDRs. > > mem.h is a common place for the register description of Memory subsystem > > of S5PC100. > > Note: Only SROM related registers are descibed now. > > > > Now, your patchset looks fine > but sorry, please fix this commit message. > It's not mem.h > > Thanks > Minkyu Kang > -- > from. prom. > www.promsoft.net > ___ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot > -- Shine bright, (: Naveen Krishna Ch :) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/3 v4] S5PC100: Memory SubSystem Header file, register description(SROMC).
Dear Naveen Krishna CH, On 23 February 2010 18:21, wrote: > From: Naveen Krishna CH > > Memory subsystem of S5PC100 handles SROM, SRAM, OneDRAM, OneNand, > NAND Flash, DDRs. > mem.h is a common place for the register description of Memory subsystem > of S5PC100. > Note: Only SROM related registers are descibed now. > Now, your patchset looks fine but sorry, please fix this commit message. It's not mem.h Thanks Minkyu Kang -- from. prom. www.promsoft.net ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] coldfire support
Hi all, so unfortunately (for me), MCF5307 is still not supported. I took a fast look inside these supported models, to start up a new 5307 support, but every starting point, for the specific 5307 internal memory layout, is too different, and can't have the time to accomplish it now. Hope that someday it will be added also. greetings, Angelo TC Liew wrote: > Thirumalai, > > These ColdFire processors (MCF52277, MCF5235, MCF5249, MCF5253, > MCF5271, MCF5272, MCF5275, MCF5282, MCF5329, MCF5373, MCF5445x, and > MCF547x_8x) are supported by u-boot. > > Like Wolfgang Wegner mentioned, you can download the ToolChain at > http://www.codesourcery.com/sgpp/lite/coldfire. > > As for the Linux, we use different repository site. > http://www.bitshrine.org/gpp/ > > Regards, > TsiChung > > On Mon, Feb 22, 2010 at 5:00 AM, Thirumalai > wrote: > >> Hi denx, >>I just want to know whether the coldfire processor is supported by >> u-boot and what toolchains need to be used for compilation. Whether ELDK >> will support or not ? >> >> Thank you >> Thirumalai >> >> ___ >> U-Boot mailing list >> U-Boot@lists.denx.de >> http://lists.denx.de/mailman/listinfo/u-boot >> >> > ___ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot > ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] memory display question
Hi Steve, > > I'm currently getting an error when I try to do a secure boot (internal > to the processor). So the next step is to verify that my u-boot image is > loaded where I think it should be loaded (at TEXT_BASE (0x83F0_)). > > When I do a md.w 0x83F0 0x20 it display's all zero's which is wrong. > It should have my reset vector and some other things there. The image > header is really at offset 0x400. > > So I tried md.w 0x83F00400 0x20 and still all 0's. Why do you do a "md.w" to explicitely select 16-bit entities? Did you try without (i.e. correpsonding to .l) and .b? Maybe your system has problems with different access widths. > This makes no sense because the darn thing boots! > > When I hook my Lauterbach to it and do a view memory through the JTAG > the memory looks as I expect. This makes complete sense because if this > wasn't the case I wasn't sure how my system was going to boot. What accesses do you perform in this setup to read the memory? Cheers Detlev -- You get 3 opportunities to advertise your Rock band, no more. -- Proposed Symbolics guidelines for mail messages (1984) -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 7/7] cmd_setexpr: allow memory addresses and env vars in expressions
This patch add functionality to use memory addresses and environment variables in expressions. This increases the power of expressions substantially It adheres to the standard convemtions: memory addresses can be given in the format *address (e.g. *1000), environment variables as $this_var. environment variables are not processed recursively but can contain both constants and memory addresses. Rationale for this change is that it allows masking off bits from a byte that is obtained by reading data from e.g. i2c. Signed-off-by: Frans Meulenbroeks --- If recursive environment vars is desired: this can be added easily by changing the if statement into a while statement. I figured that would be somewhat over the top though (and, unless you take special precautions you can run into an endless loop if an env var contains its own name. If it is desired, please let me know and I happily will add it. And a snippet from the test log: => mm.b 1000 1000: de ? 12 1001: ad ? 34 1002: be ? 56 1003: ef ? 78 1004: de ? 1005: ad ? . => setexpr aap 3 + *1000 => echo $aap 1234567b => setexpr.b aap 3 + *1000 => echo $aap 15 => setexpr.w nut $aap + *1000 => echo $nut 1249 --- common/cmd_setexpr.c | 31 --- 1 files changed, 28 insertions(+), 3 deletions(-) diff --git a/common/cmd_setexpr.c b/common/cmd_setexpr.c index f8b5d4d..a7c6f53 100644 --- a/common/cmd_setexpr.c +++ b/common/cmd_setexpr.c @@ -28,10 +28,32 @@ #include #include +static ulong get_arg(char *s, int w) +{ + ulong *p; + + /* if the parameter starts with a $ replace it with the environment value */ + if (s[0] == '$') { + s = getenv(&s[1]); + } + /* if the parameter starts with a * then assume is a pointer to the value we want */ + if (s[0] == '*') { + p = (ulong *)simple_strtoul(&s[1], NULL, 16); + switch (w) { + case 1: return((ulong)(*(uchar *)p)); + case 2: return((ulong)(*(ushort *)p)); + case 4: return(*p); + } + } else { + return simple_strtoul(s, NULL, 16); + } +} + int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { ulong a, b; char buf[16]; + int w; /* Validate arguments */ if ((argc != 5) || (strlen(argv[3]) != 1)) { @@ -39,8 +61,10 @@ int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } - a = simple_strtoul(argv[2], NULL, 16); - b = simple_strtoul(argv[4], NULL, 16); + w = cmd_get_data_size(argv[0], 4); + + a = get_arg(argv[2], w); + b = get_arg(argv[4], w); switch (argv[3][0]) { case '|': sprintf(buf, "%lx", (a | b)); break; @@ -64,7 +88,8 @@ int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( setexpr, 5, 0, do_setexpr, "set environment variable as the result of eval expression", - "name value1 value2\n" + "[.b, .w, .l] name value1 value2\n" "- set environment variable 'name' to the result of the evaluated\n" " express specified by . can be &, |, ^, +, -, *, /, %" + " size argument is only meaningful if value1 and/or value2 are memory addresses" ); -- 1.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] About Die ID When Booting u-boot
Hi, I'm studying porting Android onto Beagleboard(OMAP3530 based). When booting u-boot version 2009 11 from SD card, the terminal show "Die ID #7fa2000304013f7806011011 ". Could you please tell me what is Die ID? Or where can I download relative document about it? I'm sorry for my poor English, and hope it will not puzzle you. 2010-02-25 My thanks and best regards Huadong ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] cmd_itest.c: also support environment variables as arguments
Signed-off-by: Frans Meulenbroeks --- common/cmd_itest.c |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/common/cmd_itest.c b/common/cmd_itest.c index 58c5e7b..78a4082 100644 --- a/common/cmd_itest.c +++ b/common/cmd_itest.c @@ -69,6 +69,10 @@ static long evalexp(char *s, int w) long l = 0; long *p; + /* if the parameter starts with a $ replace it with the environment value */ + if (s[0] == '$') { + s = getenv(&s[1]); + } /* if the parameter starts with a * then assume is a pointer to the value we want */ if (s[0] == '*') { p = (long *)simple_strtoul(&s[1], NULL, 16); @@ -86,6 +90,10 @@ static long evalexp(char *s, int w) static char * evalstr(char *s) { + /* if the parameter starts with a $ replace it with the environment value */ + if (s[0] == '$') { + s = getenv(&s[1]); + } /* if the parameter starts with a * then assume a string pointer else its a literal */ if (s[0] == '*') { return (char *)simple_strtoul(&s[1], NULL, 16); -- 1.5.4.3 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 4/5] cmd_i2c.c: sorted commands alphabetically
Signed-off-by: Frans Meulenbroeks --- common/cmd_i2c.c | 11 +-- 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index e54fc20..b51e3f4 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -1302,25 +1302,24 @@ int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( i2c, 6, 1, do_i2c, "I2C sub-system", - "speed [speed] - show or set I2C bus speed\n" #if defined(CONFIG_I2C_MUX) - "i2c bus [muxtype:muxaddr:muxchannel] - add a new bus reached over muxes\n" + "bus [muxtype:muxaddr:muxchannel] - add a new bus reached over muxes\ni2c " #endif /* CONFIG_I2C_MUX */ + "crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n" #if defined(CONFIG_I2C_MULTI_BUS) "i2c dev [dev] - show or set current I2C bus\n" #endif /* CONFIG_I2C_MULTI_BUS */ + "i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device\n" "i2c md chip address[.0, .1, .2] [# of objects] - read from I2C device\n" "i2c mm chip address[.0, .1, .2] - write to I2C device (auto-incrementing)\n" "i2c mw chip address[.0, .1, .2] value [count] - write to I2C device (fill)\n" "i2c nm chip address[.0, .1, .2] - write to I2C device (constant address)\n" - "i2c crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n" "i2c probe - show devices on the I2C bus\n" "i2c reset - re-init the I2C Controller\n" - "i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device" #if defined(CONFIG_CMD_SDRAM) - "\n" - "i2c sdram chip - print SDRAM configuration information" + "i2c sdram chip - print SDRAM configuration information\n" #endif + "i2c speed [speed] - show or set I2C bus speed" ); #if defined(CONFIG_I2C_MUX) -- 1.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/5] i2c patches. Again!
Below are my i2c patches again, (and the bootm one but that is pretty minor) Now decently numbered and with the remarks of Heiko applied. Thanks go to - Heiko for the comments - Eric and Wolfgang for teaching me a little bit more git (btw: what happend to sccs? :-) ) - everyone for having patience with me while I am struggling to submit patches in a proper way. I have a few more things I'm working on, but would like to see feedback or at least acks for these, so I avoid a lot of rework because something in this patches is not considered proper. (I saw some code in i2c that can be refactored; also might implement subcommand handling in a few other files). Have fun, Frans. Frans Meulenbroeks (5): cmd_i2c.c: reduced subaddress length to 3 bytes cmd_bootm.c: made subcommand array static cmd_i2c.c: reworked subcommand handling cmd_i2c.c: sorted commands alphabetically cmd_i2c.c: added i2c read to memory function common/cmd_bootm.c |2 +- common/cmd_i2c.c | 160 +--- 2 files changed, 116 insertions(+), 46 deletions(-) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/5] cmd_bootm.c: made subcommand array static
Signed-off-by: Frans Meulenbroeks --- common/cmd_bootm.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 23ab0c4..827d542 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -462,7 +462,7 @@ static int bootm_start_standalone(ulong iflag, int argc, char *argv[]) /* we overload the cmd field with our state machine info instead of a * function pointer */ -cmd_tbl_t cmd_bootm_sub[] = { +static cmd_tbl_t cmd_bootm_sub[] = { U_BOOT_CMD_MKENT(start, 0, 1, (void *)BOOTM_STATE_START, "", ""), U_BOOT_CMD_MKENT(loados, 0, 1, (void *)BOOTM_STATE_LOADOS, "", ""), #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC) -- 1.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/5] cmd_i2c.c: reworked subcommand handling
Signed-off-by: Frans Meulenbroeks --- common/cmd_i2c.c | 77 +++-- 1 files changed, 45 insertions(+), 32 deletions(-) diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 7531702..e54fc20 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -1242,46 +1242,59 @@ int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return ret; } -int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +int do_i2c_mm(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) { - /* Strip off leading 'i2c' command argument */ - argc--; - argv++; + return mod_i2c_mem (cmdtp, 1, flag, argc, argv); +} + +int do_i2c_nm(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +{ + return mod_i2c_mem (cmdtp, 0, flag, argc, argv); +} +int do_i2c_reset(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +{ + i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + return 0; +} + +static cmd_tbl_t cmd_i2c_sub[] = { #if defined(CONFIG_I2C_MUX) - if (!strncmp(argv[0], "bu", 2)) - return do_i2c_add_bus(cmdtp, flag, argc, argv); + U_BOOT_CMD_MKENT(bus, 1, 1, do_i2c_add_bus, "", ""), #endif /* CONFIG_I2C_MUX */ - if (!strncmp(argv[0], "sp", 2)) - return do_i2c_bus_speed(cmdtp, flag, argc, argv); + U_BOOT_CMD_MKENT(crc32, 3, 1, do_i2c_crc, "", ""), #if defined(CONFIG_I2C_MULTI_BUS) - if (!strncmp(argv[0], "de", 2)) - return do_i2c_bus_num(cmdtp, flag, argc, argv); + U_BOOT_CMD_MKENT(dev, 1, 1, do_i2c_bus_num, "", ""), #endif /* CONFIG_I2C_MULTI_BUS */ - if (!strncmp(argv[0], "md", 2)) - return do_i2c_md(cmdtp, flag, argc, argv); - if (!strncmp(argv[0], "mm", 2)) - return mod_i2c_mem (cmdtp, 1, flag, argc, argv); - if (!strncmp(argv[0], "mw", 2)) - return do_i2c_mw(cmdtp, flag, argc, argv); - if (!strncmp(argv[0], "nm", 2)) - return mod_i2c_mem (cmdtp, 0, flag, argc, argv); - if (!strncmp(argv[0], "cr", 2)) - return do_i2c_crc(cmdtp, flag, argc, argv); - if (!strncmp(argv[0], "pr", 2)) - return do_i2c_probe(cmdtp, flag, argc, argv); - if (!strncmp(argv[0], "re", 2)) { - i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); - return 0; - } - if (!strncmp(argv[0], "lo", 2)) - return do_i2c_loop(cmdtp, flag, argc, argv); + U_BOOT_CMD_MKENT(loop, 3, 1, do_i2c_loop, "", ""), + U_BOOT_CMD_MKENT(md, 3, 1, do_i2c_md, "", ""), + U_BOOT_CMD_MKENT(mm, 2, 1, do_i2c_mm, "", ""), + U_BOOT_CMD_MKENT(mw, 3, 1, do_i2c_mw, "", ""), + U_BOOT_CMD_MKENT(nm, 2, 1, do_i2c_nm, "", ""), + U_BOOT_CMD_MKENT(probe, 0, 1, do_i2c_probe, "", ""), + U_BOOT_CMD_MKENT(reset, 0, 1, do_i2c_reset, "", ""), #if defined(CONFIG_CMD_SDRAM) - if (!strncmp(argv[0], "sd", 2)) - return do_sdram(cmdtp, flag, argc, argv); + U_BOOT_CMD_MKENT(sdram, 1, 1, do_i2c_sdram, "", ""), #endif - cmd_usage(cmdtp); - return 0; + U_BOOT_CMD_MKENT(speed, 1, 1, do_i2c_bus_speed, "", ""), +}; + +int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +{ + cmd_tbl_t *c; + + /* Strip off leading 'i2c' command argument */ + argc--; + argv++; + + c = find_cmd_tbl(argv[0], &cmd_i2c_sub[0], ARRAY_SIZE(cmd_i2c_sub)); + + if (c) { + return c->cmd(cmdtp, flag, argc, argv); + } else { + cmd_usage(cmdtp); + return 1; + } } /***/ -- 1.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/5] cmd_i2c.c: reduced subaddress length to 3 bytes
according to some of the comments the subaddress length is 1 or 2, but we are being prepared for the case it becomes 3. However the code also accepted 4. This repairs this by changing the constand 4 to 3. Signed-off-by: Frans Meulenbroeks --- common/cmd_i2c.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 62cbd33..7531702 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -193,7 +193,7 @@ int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) for (j = 0; j < 8; j++) { if (argv[2][j] == '.') { alen = argv[2][j+1] - '0'; - if (alen > 4) { + if (alen > 3) { cmd_usage(cmdtp); return 1; } @@ -287,7 +287,7 @@ int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) for (j = 0; j < 8; j++) { if (argv[2][j] == '.') { alen = argv[2][j+1] - '0'; - if (alen > 4) { + if (alen > 3) { cmd_usage(cmdtp); return 1; } @@ -361,7 +361,7 @@ int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) for (j = 0; j < 8; j++) { if (argv[2][j] == '.') { alen = argv[2][j+1] - '0'; - if (alen > 4) { + if (alen > 3) { cmd_usage(cmdtp); return 1; } @@ -451,7 +451,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]) for (j = 0; j < 8; j++) { if (argv[2][j] == '.') { alen = argv[2][j+1] - '0'; - if (alen > 4) { + if (alen > 3) { cmd_usage(cmdtp); return 1; } @@ -607,7 +607,7 @@ int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) for (j = 0; j < 8; j++) { if (argv[2][j] == '.') { alen = argv[2][j+1] - '0'; - if (alen > 4) { + if (alen > 3) { cmd_usage(cmdtp); return 1; } -- 1.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 5/5] cmd_i2c.c: added i2c read to memory function
Signed-off-by: Frans Meulenbroeks --- common/cmd_i2c.c | 62 - 1 files changed, 60 insertions(+), 2 deletions(-) diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index b51e3f4..9e7143a 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -154,6 +154,63 @@ int i2c_set_bus_speed(unsigned int) */ #define DISP_LINE_LEN 16 +/* + * Syntax: + * i2c read {i2c_chip} {devaddr}{.0, .1, .2} {len} {memaddr} + */ + +int do_i2c_read ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +{ + u_char chip; + uintdevaddr, alen, length; + u_char *memaddr; + int j; + + if (argc != 5) { + cmd_usage(cmdtp); + return 1; + } + + /* +* I2C chip address +*/ + chip = simple_strtoul(argv[1], NULL, 16); + + /* +* I2C data address within the chip. This can be 1 or +* 2 bytes long. Some day it might be 3 bytes long :-). +*/ + devaddr = simple_strtoul(argv[2], NULL, 16); + alen = 1; + for (j = 0; j < 8; j++) { + if (argv[2][j] == '.') { + alen = argv[2][j+1] - '0'; + if (alen > 3) { + cmd_usage(cmdtp); + return 1; + } + break; + } else if (argv[2][j] == '\0') + break; + } + + /* +* Length is the number of objects, not number of bytes. +*/ + length = simple_strtoul(argv[3], NULL, 16); + + /* +* memaddr is the address where to store things in memory +*/ + memaddr = (u_char *)simple_strtoul(argv[4], NULL, 16); + + if (i2c_read(chip, devaddr, alen, memaddr, length) != 0) { + puts ("Error reading the chip.\n"); + return 1; + } + return 0; +} + int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { u_char chip; @@ -1272,6 +1329,7 @@ static cmd_tbl_t cmd_i2c_sub[] = { U_BOOT_CMD_MKENT(mw, 3, 1, do_i2c_mw, "", ""), U_BOOT_CMD_MKENT(nm, 2, 1, do_i2c_nm, "", ""), U_BOOT_CMD_MKENT(probe, 0, 1, do_i2c_probe, "", ""), + U_BOOT_CMD_MKENT(read, 5, 1, do_i2c_read, "", ""), U_BOOT_CMD_MKENT(reset, 0, 1, do_i2c_reset, "", ""), #if defined(CONFIG_CMD_SDRAM) U_BOOT_CMD_MKENT(sdram, 1, 1, do_i2c_sdram, "", ""), @@ -1315,6 +1373,7 @@ U_BOOT_CMD( "i2c mw chip address[.0, .1, .2] value [count] - write to I2C device (fill)\n" "i2c nm chip address[.0, .1, .2] - write to I2C device (constant address)\n" "i2c probe - show devices on the I2C bus\n" + "i2c read chip address[.0, .1, .2] length memaddress - read to memory \n" "i2c reset - re-init the I2C Controller\n" #if defined(CONFIG_CMD_SDRAM) "i2c sdram chip - print SDRAM configuration information\n" @@ -1322,8 +1381,7 @@ U_BOOT_CMD( "i2c speed [speed] - show or set I2C bus speed" ); -#if defined(CONFIG_I2C_MUX) - +#if defined(CONFIG_I2C_MUX) int i2c_mux_add_device(I2C_MUX_DEVICE *dev) { I2C_MUX_DEVICE *devtmp = i2c_mux_devices; -- 1.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] cmd_i2c.c: added i2c read to memory function
Hello Frans, Frans Meulenbroeks wrote: > Signed-off-by: Frans Meulenbroeks > --- > common/cmd_i2c.c | 60 > ++ > 1 files changed, 60 insertions(+), 0 deletions(-) > > diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c > index 1dd4df3..552b4e5 100644 > --- a/common/cmd_i2c.c > +++ b/common/cmd_i2c.c > @@ -154,6 +154,64 @@ int i2c_set_bus_speed(unsigned int) [...] > + /* > + * memaddr is the address where to store things in memory > + */ > + memaddr = (u_char *)simple_strtoul(argv[4], NULL, 16); > + > + if (i2c_read(chip, devaddr, alen, memaddr, length) != 0) > + { as Wolfgang suggested to your first post, incorrect brace style, please fix. > + puts ("Error reading the chip.\n"); > + return 1; > + } > + return 0; > +} > + > int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) > { > u_char chip; > @@ -1272,6 +1330,7 @@ static cmd_tbl_t cmd_i2c_sub[] = { > U_BOOT_CMD_MKENT(mw, 3, 1, do_i2c_mw, "", ""), > U_BOOT_CMD_MKENT(nm, 2, 1, do_i2c_nm, "", ""), > U_BOOT_CMD_MKENT(probe, 0, 1, do_i2c_probe, "", ""), > + U_BOOT_CMD_MKENT(read, 5, 1, do_i2c_read, "", ""), > U_BOOT_CMD_MKENT(reset, 0, 1, do_i2c_reset, "", ""), > #if defined(CONFIG_CMD_SDRAM) > U_BOOT_CMD_MKENT(sdram, 1, 1, do_i2c_sdram, "", ""), > @@ -1316,6 +1375,7 @@ U_BOOT_CMD( > "i2c nm chip address[.0, .1, .2] - write to I2C device (constant > address)\n" > "i2c crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n" > "i2c probe - show devices on the I2C bus\n" > + "i2c read chip address[.0, .1, .2] length memaddress - read to memory > \n" > "i2c reset - re-init the I2C Controller\n" > #if defined(CONFIG_CMD_SDRAM) > "i2c sdram chip - print SDRAM configuration information\n" Rest looks good, thanks! bye Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] cmd_i2c.c: sorted commands alphabetically
Hello Frans, First, thanks for your patches! They look good to me, just one nitpicking comment. Frans Meulenbroeks wrote: > Signed-off-by: Frans Meulenbroeks > --- > common/cmd_i2c.c | 10 +- > 1 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c > index e54fc20..1dd4df3 100644 > --- a/common/cmd_i2c.c > +++ b/common/cmd_i2c.c > @@ -1302,13 +1302,14 @@ int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, > char *argv[]) > U_BOOT_CMD( > i2c, 6, 1, do_i2c, > "I2C sub-system", > - "speed [speed] - show or set I2C bus speed\n" > #if defined(CONFIG_I2C_MUX) > - "i2c bus [muxtype:muxaddr:muxchannel] - add a new bus reached over > muxes\n" > + "bus [muxtype:muxaddr:muxchannel] - add a new bus reached over > muxes\ni2c " > #endif /* CONFIG_I2C_MUX */ > + "crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n" > #if defined(CONFIG_I2C_MULTI_BUS) > "i2c dev [dev] - show or set current I2C bus\n" > #endif /* CONFIG_I2C_MULTI_BUS */ > + "i2c loop chip address[.0, .1, .2] [# of objects] - looping read of > device\n" > "i2c md chip address[.0, .1, .2] [# of objects] - read from I2C > device\n" > "i2c mm chip address[.0, .1, .2] - write to I2C device > (auto-incrementing)\n" > "i2c mw chip address[.0, .1, .2] value [count] - write to I2C device > (fill)\n" > @@ -1316,11 +1317,10 @@ U_BOOT_CMD( > "i2c crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n" You should delete this here, otherwise it will show the "i2c crc32" command twice in this help list. > "i2c probe - show devices on the I2C bus\n" > "i2c reset - re-init the I2C Controller\n" > - "i2c loop chip address[.0, .1, .2] [# of objects] - looping read of > device" > #if defined(CONFIG_CMD_SDRAM) > - "\n" > - "i2c sdram chip - print SDRAM configuration information" > + "i2c sdram chip - print SDRAM configuration information\n" > #endif > + "i2c speed [speed] - show or set I2C bus speed" > ); > > #if defined(CONFIG_I2C_MUX) bye Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot