powerpc/qe: supports loading QE firmware from nand flash
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.
--- 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(-)
arch/powerpc/cpu/mpc83xx/cpu_init.c +0 -8
@@ -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 +0x00100000 ;/* QE immr base */ - -qe_init (qe_base); -qe_reset (); -#endif return 0 ; }
arch/powerpc/cpu/mpc85xx/cpu_init.c +0 -8
@@ -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 +0x00080000 ;/* 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 ();
arch/powerpc/lib/board.c +31 -0
@@ -87,6 +87,15 @@#include <miiphy.h> #endif +#ifdef CONFIG_QE +#ifdef CONFIG_SYS_QE_FW_IN_NAND +#include <nand.h> +#include <asm/errno.h> +#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 +0x00080000 ); +qe_reset (); +#endif /* CONFIG_QE */ +/* relocate environment function pointers etc. */ env_relocate ();
Signature · 1 line
1.7.0
PATCH 6/7 powerpc/qe: supports loading QE firmware from nand flash
Dear Haiying Wang,
Quoted 9 lines · In message <[email protected]> you wrote:
and because some platforms need to load QE firmware from NAND flash(no NOR flash), it makes
qe_initto be called afternand_init.Signed-off-by Haiying Wang <[email protected]>--- 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
Signature · 4 lines
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: wd at denx.de A list is only as strong as its weakest link. -- Don Knuth
PATCH 6/7 powerpc/qe: supports loading QE firmware from nand flash
Quoted 13 lines · Wolfgang Denk
Dear Haiying Wang,
Quoted 9 lines · In message <[email protected]> you wrote:
and because some platforms need to load QE firmware from NAND flash(no NOR flash), it makes
qe_initto be called afternand_init.Signed-off-by Haiying Wang <[email protected]>--- 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(-)
Quoted 3 lines
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(-)
arch/powerpc/cpu/mpc85xx/cpu_init.c +1 -1
@@ -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 +0x00080000 ;/* QE immr base */ qe_init (qe_base);qe_reset ();
arch/powerpc/lib/board.c +15 -0
@@ -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 ();
PATCH 6/7 powerpc/qe: supports loading QE firmware from nand flash
Dear Haiying Wang,
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 6 lines
Quoted 5 lines
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(-)
Quoted 7 lines
Quoted 3 lines
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
Quoted 3 lines
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
Signature · 6 lines
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: wd at 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_