Re: [U-Boot] [PATCH 6/7] powerpc/qe: supports loading QE firmware from nand flash
Dear Haiying Wang, In message <1282028890.2814.95.ca...@localhost.localdomain> you wrote: > > > > arch/powerpc/cpu/mpc83xx/cpu_init.c |8 > > > arch/powerpc/cpu/mpc85xx/cpu_init.c |8 > > > arch/powerpc/lib/board.c| 31 > > > +++ > > > 3 files changed, 31 insertions(+), 16 deletions(-) > > > > Please do not throw such stuff into common code. Use board / > > architecture specific implementations instead (say, provide some > > misc_init_r() or so). > QE is not a misc feature for the SOCs with QE. It actually makes more > sense to enable it in cpu init code. But P1021 doesn't have ROM in QE, > and P1021mds doesn't have NOR flash on board, so I move this cpu feature > to board.c. How about re-spin this patch as: Maybe. But it has no place in arch/powerpc/lib/board.c > arch/powerpc/cpu/mpc85xx/cpu_init.c |2 +- > arch/powerpc/lib/board.c| 15 +++ > 2 files changed, 16 insertions(+), 1 deletions(-) NAK for the same reason - I don't want to see this in common code like arch/powerpc/lib/board.c 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 "You know, after a woman's raised a family and so on, she wants to start living her own life." "Whose life she's _been_ living, then?" - Terry Pratchett, _Witches Abroad_ ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 6/7] powerpc/qe: supports loading QE firmware from nand flash
On Mon, 2010-16-08 at 12:40 +0200, Wolfgang Denk wrote: > Dear Haiying Wang, > > In message <1281947090.24612.23.ca...@localhost.localdomain> you wrote: > > and because some platforms need to load QE firmware from NAND flash(no NOR > > flash), it makes qe_init to be called after nand_init. > > > > Signed-off-by: Haiying Wang > > --- > > arch/powerpc/cpu/mpc83xx/cpu_init.c |8 > > arch/powerpc/cpu/mpc85xx/cpu_init.c |8 > > arch/powerpc/lib/board.c| 31 +++ > > 3 files changed, 31 insertions(+), 16 deletions(-) > > Please do not throw such stuff into common code. Use board / > architecture specific implementations instead (say, provide some > misc_init_r() or so). QE is not a misc feature for the SOCs with QE. It actually makes more sense to enable it in cpu init code. But P1021 doesn't have ROM in QE, and P1021mds doesn't have NOR flash on board, so I move this cpu feature to board.c. How about re-spin this patch as: --- arch/powerpc/cpu/mpc85xx/cpu_init.c |2 +- arch/powerpc/lib/board.c| 15 +++ 2 files changed, 16 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c index 1fbc0cc..1021575 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c @@ -369,7 +369,7 @@ int cpu_init_r(void) enable_cpc(); -#ifdef CONFIG_QE +#if defined(CONFIG_QE) && !defined(CONFIG_SYS_QE_FW_IN_NAND) uint qe_base = CONFIG_SYS_IMMR + 0x0008; /* QE immr base */ qe_init(qe_base); qe_reset(); diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 0e00d86..aae6e23 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -783,6 +783,21 @@ void board_init_r (gd_t *id, ulong dest_addr) nand_init();/* go init the NAND */ #endif + /* QE needs to be initialized after nand_init because some boards have +* to save QE firmware in NAND flash. +*/ +#if defined(CONFIG_QE) && defined(CONFIG_SYS_QE_FW_IN_NAND) +#ifdef CONFIG_SYS_QE_FW_IN_NAND + /* load QE firmware from NAND flash to DDR first */ + ret = nand_read(&nand_info[0], (loff_t)CONFIG_SYS_QE_FW_IN_NAND, + &fw_length, (u_char *)CONFIG_SYS_QE_FW_ADDR); + + if (ret && ret == -EUCLEAN) { + printf ("NAND read for QE firmware at offset %x failed %d\n", + (loff_t)CONFIG_SYS_QE_FW_IN_NAND, ret); + } +#endif /* CONFIG_QE && CONFIG_SYS_QE_FW_IN_NAND */ + /* relocate environment function pointers etc. */ env_relocate (); ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 6/7] powerpc/qe: supports loading QE firmware from nand flash
Dear Haiying Wang, In message <1281947090.24612.23.ca...@localhost.localdomain> you wrote: > and because some platforms need to load QE firmware from NAND flash(no NOR > flash), it makes qe_init to be called after nand_init. > > Signed-off-by: Haiying Wang > --- > arch/powerpc/cpu/mpc83xx/cpu_init.c |8 > arch/powerpc/cpu/mpc85xx/cpu_init.c |8 > arch/powerpc/lib/board.c| 31 +++ > 3 files changed, 31 insertions(+), 16 deletions(-) Please do not throw such stuff into common code. Use board / architecture specific implementations instead (say, provide some misc_init_r() or so). 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 A list is only as strong as its weakest link.-- Don Knuth ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 6/7] powerpc/qe: supports loading QE firmware from nand flash
and because some platforms need to load QE firmware from NAND flash(no NOR flash), it makes qe_init to be called after nand_init. Signed-off-by: Haiying Wang --- arch/powerpc/cpu/mpc83xx/cpu_init.c |8 arch/powerpc/cpu/mpc85xx/cpu_init.c |8 arch/powerpc/lib/board.c| 31 +++ 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/arch/powerpc/cpu/mpc83xx/cpu_init.c b/arch/powerpc/cpu/mpc83xx/cpu_init.c index 83cba93..6d40037 100644 --- a/arch/powerpc/cpu/mpc83xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc83xx/cpu_init.c @@ -34,8 +34,6 @@ DECLARE_GLOBAL_DATA_PTR; extern qe_iop_conf_t qe_iop_conf_tab[]; extern void qe_config_iopin(u8 port, u8 pin, int dir, int open_drain, int assign); -extern void qe_init(uint qe_base); -extern void qe_reset(void); static void config_qe_ioports(void) { @@ -333,12 +331,6 @@ void cpu_init_f (volatile immap_t * im) int cpu_init_r (void) { -#ifdef CONFIG_QE - uint qe_base = CONFIG_SYS_IMMR + 0x0010; /* QE immr base */ - - qe_init(qe_base); - qe_reset(); -#endif return 0; } diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c index 1fbc0cc..f799773 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c @@ -44,8 +44,6 @@ DECLARE_GLOBAL_DATA_PTR; extern qe_iop_conf_t qe_iop_conf_tab[]; extern void qe_config_iopin(u8 port, u8 pin, int dir, int open_drain, int assign); -extern void qe_init(uint qe_base); -extern void qe_reset(void); static void config_qe_ioports(void) { @@ -369,12 +367,6 @@ int cpu_init_r(void) enable_cpc(); -#ifdef CONFIG_QE - uint qe_base = CONFIG_SYS_IMMR + 0x0008; /* QE immr base */ - qe_init(qe_base); - qe_reset(); -#endif - #if defined(CONFIG_SYS_HAS_SERDES) /* needs to be in ram since code uses global static vars */ fsl_serdes_init(); diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 0e00d86..3fa865d 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -87,6 +87,15 @@ #include #endif +#ifdef CONFIG_QE +#ifdef CONFIG_SYS_QE_FW_IN_NAND +#include +#include +#endif +extern void qe_init(uint qe_base); +extern void qe_reset(void); +#endif + #ifdef CONFIG_SYS_UPDATE_FLASH_SIZE extern int update_flash_size (int flash_size); #endif @@ -631,6 +640,10 @@ void board_init_r (gd_t *id, ulong dest_addr) char *s; bd_t *bd; ulong malloc_start; +#ifdef CONFIG_SYS_QE_FW_IN_NAND + int ret; + size_t fw_length = CONFIG_SYS_QE_FW_LENGTH; +#endif #ifndef CONFIG_SYS_NO_FLASH ulong flash_size; @@ -783,6 +796,24 @@ void board_init_r (gd_t *id, ulong dest_addr) nand_init();/* go init the NAND */ #endif + /* QE needs to be initialized after nand_init because some boards have +* to save QE firmware in NAND flash. +*/ +#ifdef CONFIG_QE +#ifdef CONFIG_SYS_QE_FW_IN_NAND + /* load QE firmware from NAND flash to DDR first */ + ret = nand_read(&nand_info[0], (loff_t)CONFIG_SYS_QE_FW_IN_NAND, + &fw_length, (u_char *)CONFIG_SYS_QE_FW_ADDR); + + if (ret && ret == -EUCLEAN) { + printf ("NAND read for QE firmware at offset %x failed %d\n", + (loff_t)CONFIG_SYS_QE_FW_IN_NAND, ret); + } +#endif /* CONFIG_SYS_QE_FW_IN_NAND */ + qe_init(CONFIG_SYS_IMMR + 0x0008); + qe_reset(); +#endif /* CONFIG_QE */ + /* relocate environment function pointers etc. */ env_relocate (); -- 1.7.0 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot