Introduce CONFIG_4xx_HAS_OPB
PATCH 1/1 Introduce CONFIG_4xx_HAS_OPB
The lib_ppc/board.c file will fill in the bi_opbfreq variable in the bd_t structure for PowerPC 4xx platforms. However, it currently seems to be coupled together with the bi_pci_busfreq variable under a series of ifdefs for particular CPU types. As a result, it is rather easy to miss getting bi_opbfreq populated on boards when doing a board port. This is the case for CONFIG_405EZ for example.
This patch introduces a CONFIG_4xx_HAS_OPB option that is set to indicate that the platform uses that variable in the bd_t structure. It decouples this from the PCI bus setting and sets is properly for CPUs that have this defined.
include/asm-ppc/u-boot.h +3 -1
@@ -112,12 +112,14 @@ typedef struct bd_info {unsigned char bi_enet3addr[6 ];#endif +#if defined(CONFIG_4xx_HAS_OPB) +unsigned int bi_opbfreq;/* OPB clock in Hz */ +#endif #if defined(CONFIG_405GP ) || defined(CONFIG_405EP ) || \ defined(CONFIG_405EZ ) || defined(CONFIG_440GX ) || \ defined(CONFIG_440EP ) || defined(CONFIG_440GR ) || \ defined(CONFIG_440EPX ) || defined(CONFIG_440GRX ) || \ defined(CONFIG_460EX ) || defined(CONFIG_460GT ) -unsigned int bi_opbfreq;/* OPB clock in Hz */ int bi_iic_fast[2 ];/* Use fast i2c mode */ #endif #if defined(CONFIG_NX823 )
include/ppc4xx.h +9 -0
@@ -46,6 +46,15 @@#define CONFIG_SDRAM_PPC4xx_IBM_DDR2/* IBM DDR(2) controller */ #endif +/* Configure the OPB variable */ +#if defined(CONFIG_405GP ) || defined(CONFIG_405EP ) || \ + defined(CONFIG_405EZ ) || defined(CONFIG_440GX ) || \ + defined(CONFIG_440EP ) || defined(CONFIG_440GR ) || \ + defined(CONFIG_440EPX ) || defined(CONFIG_440GRX ) || \ + defined(CONFIG_460EX ) || defined(CONFIG_460GT ) +#define CONFIG_4xx_HAS_OPB +#endif +/* PLB4 CrossBar Arbiter Core supported across PPC4xx families */ #if defined(CONFIG_405EX) || \ defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
lib_ppc/board.c +3 -1
@@ -611,10 +611,12 @@ void board_init_f (ulong bootflag)defined (CONFIG_440EP ) ||defined (CONFIG_440GR ) || \defined (CONFIG_440EPX ) ||defined (CONFIG_440GRX ) bd->bi_pci_busfreq = get_PCI_freq (); - bd->bi_opbfreq =get_OPB_freq ();#elif defined(CONFIG_XILINX_405 ) bd->bi_pci_busfreq =get_PCI_freq ();#endif +#if defined(CONFIG_4xx_HAS_OPB) + bd->bi_opbfreq =get_OPB_freq (); +#endif #endif debug ("New Stack Pointer is: %08lx\n" , addr_sp);
PATCH 1/1 Introduce CONFIG_4xx_HAS_OPB
Josh,
Quoted 8 lines · Josh Boyer
The
lib_ppc/board.cfile will fill in thebi_opbfreqvariable in thebd_tstructure for PowerPC 4xx platforms. However, it currently seems to be coupled together with thebi_pci_busfreqvariable under a series of ifdefs for particular CPU types. As a result, it is rather easy to miss gettingbi_opbfreqpopulated on boards when doing a board port. This is the case forCONFIG_405EZfor example.
Quoted 4 lines
This patch introduces a
CONFIG_4xx_HAS_OPBoption that is set to indicate that the platform uses that variable in thebd_tstructure. It decouples this from the PCI bus setting and sets is properly for CPUs that have this defined.
I thought about it a little more. Some comments below...
include/asm-ppc/u-boot.h typedef struct bd_info { · line 117
Quoted 13 lines
Signed-off-by Josh Boyer <[email protected]>include/asm-ppc/u-boot.h +3
-0@@ -112,12 +112,14 @@ typedef struct bd_info {unsigned char bi_enet3addr[6 ];#endif +#if defined(CONFIG_4xx_HAS_OPB) +unsigned int bi_opbfreq;/* OPB clock in Hz */ +#endif
It just occurred to me that this change break Linux compatibility. Usually you can just copy this file to the include/asm-ppc directory in Linux to have the same bd_info as in U-Boot (that's old arch/ppc of course). But Linux doesn't know about this CONFIG_4xx_HAS_OPB define. So this will not work.
You should probably better leave this file untouched as the 405EZ is correct.
Quoted 15 lines
include/asm-ppc/u-boot.h +0
-1#if defined(CONFIG_405GP ) || defined(CONFIG_405EP ) || \ defined(CONFIG_405EZ ) || defined(CONFIG_440GX ) || \ defined(CONFIG_440EP ) || defined(CONFIG_440GR ) || \ defined(CONFIG_440EPX ) || defined(CONFIG_440GRX ) || \ defined(CONFIG_460EX ) || defined(CONFIG_460GT ) -unsigned int bi_opbfreq;/* OPB clock in Hz */ int bi_iic_fast[2 ];/* Use fast i2c mode */ #endif #if defined(CONFIG_NX823 )include/ppc4xx.h +0
-0@@ -46,6 +46,15 @@#define CONFIG_SDRAM_PPC4xx_IBM_DDR2/* IBM DDR(2) controller */
include/ppc4xx.h line 56
Quoted 10 lines
include/ppc4xx.h +8
-0#endif +/* Configure the OPB variable */ +#if defined(CONFIG_405GP ) || defined(CONFIG_405EP ) || \ + defined(CONFIG_405EZ ) || defined(CONFIG_440GX ) || \ + defined(CONFIG_440EP ) || defined(CONFIG_440GR ) || \ + defined(CONFIG_440EPX ) || defined(CONFIG_440GRX ) || \ + defined(CONFIG_460EX ) || defined(CONFIG_460GT ) +#define CONFIG_4xx_HAS_OPB +#endif
Hmmm. Why not something like this:
#if !defined(CONFIG_XILINX_405) && !defined(CONFIG_XILINX_440) #define CONFIG_4xx_HAS_OPB
#endif
Does this work?
Quoted 12 lines
include/ppc4xx.h +1
-0+/* PLB4 CrossBar Arbiter Core supported across PPC4xx families */ #if defined(CONFIG_405EX) || \ defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \lib_ppc/board.c +0
-0@@ -611,10 +611,12 @@ void board_init_f (ulong bootflag)defined (CONFIG_440EP ) ||defined (CONFIG_440GR ) || \defined (CONFIG_440EPX ) ||defined (CONFIG_440GRX ) bd->bi_pci_busfreq = get_PCI_freq ();
lib_ppc/board.c void board_init_f (ulong bootflag) · line 622
Quoted 10 lines
lib_ppc/board.c +3
-1- bd->bi_opbfreq =get_OPB_freq ();#elif defined(CONFIG_XILINX_405 ) bd->bi_pci_busfreq =get_PCI_freq ();#endif +#if defined(CONFIG_4xx_HAS_OPB) + bd->bi_opbfreq =get_OPB_freq (); +#endif #endif debug ("New Stack Pointer is: %08lx\n" , addr_sp);
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH 1/1 Introduce CONFIG_4xx_HAS_OPB
Quoted 37 lines · On Fri, 10 Oct 2008 09:33:03 +0200 Stefan Roese <[email protected]> wrote:
Josh,
Quoted 8 lines · Josh Boyer
The
lib_ppc/board.cfile will fill in thebi_opbfreqvariable in thebd_tstructure for PowerPC 4xx platforms. However, it currently seems to be coupled together with thebi_pci_busfreqvariable under a series of ifdefs for particular CPU types. As a result, it is rather easy to miss gettingbi_opbfreqpopulated on boards when doing a board port. This is the case forCONFIG_405EZfor example.Quoted 4 lines
This patch introduces a
CONFIG_4xx_HAS_OPBoption that is set to indicate that the platform uses that variable in thebd_tstructure. It decouples this from the PCI bus setting and sets is properly for CPUs that have this defined.I thought about it a little more. Some comments below...
include/asm-ppc/u-boot.h typedef struct bd_info { · line 117
Quoted 13 lines
Signed-off-by Josh Boyer <[email protected]>include/asm-ppc/u-boot.h +3
-0@@ -112,12 +112,14 @@ typedef struct bd_info {unsigned char bi_enet3addr[6 ];#endif +#if defined(CONFIG_4xx_HAS_OPB) +unsigned int bi_opbfreq;/* OPB clock in Hz */ +#endif It just occurred to me that this change break Linux compatibility. Usually you can just copy this file to the
include/asm-ppcdirectory in Linux to have the samebd_infoas in U-Boot (that's oldarch/ppcof course). But Linux doesn't know about thisCONFIG_4xx_HAS_OPBdefine. So this will not work.
Quoted 1 line
You should probably better leave this file untouched as the 405EZ is correct.
Except the list that was originally here isn't really complete. And as far as Linux compatibility, it already is incompatible. The ppcboot.h file simply has bi_opbfreq under a #if defined(TARGET_4xx), which is how I ran into this problem to begin with.
Quoted 29 lines
Quoted 16 lines
include/asm-ppc/u-boot.h +0
-1#if defined(CONFIG_405GP ) || defined(CONFIG_405EP ) || \ defined(CONFIG_405EZ ) || defined(CONFIG_440GX ) || \ defined(CONFIG_440EP ) || defined(CONFIG_440GR ) || \ defined(CONFIG_440EPX ) || defined(CONFIG_440GRX ) || \ defined(CONFIG_460EX ) || defined(CONFIG_460GT ) -unsigned int bi_opbfreq;/* OPB clock in Hz */ int bi_iic_fast[2 ];/* Use fast i2c mode */ #endif #if defined(CONFIG_NX823 )include/ppc4xx.h +0
-0@@ -46,6 +46,15 @@#define CONFIG_SDRAM_PPC4xx_IBM_DDR2/* IBM DDR(2) controller */ include/ppc4xx.h line 56
Quoted 10 lines
include/ppc4xx.h +8
-0#endif +/* Configure the OPB variable */ +#if defined(CONFIG_405GP ) || defined(CONFIG_405EP ) || \ + defined(CONFIG_405EZ ) || defined(CONFIG_440GX ) || \ + defined(CONFIG_440EP ) || defined(CONFIG_440GR ) || \ + defined(CONFIG_440EPX ) || defined(CONFIG_440GRX ) || \ + defined(CONFIG_460EX ) || defined(CONFIG_460GT ) +#define CONFIG_4xx_HAS_OPB +#endif Hmmm. Why not something like this:
Quoted 5 lines
#if !defined(CONFIG_XILINX_405) && !defined(CONFIG_XILINX_440) #define
CONFIG_4xx_HAS_OPB
#endifDoes this work?
It would in theory, yes. I had something like that originally, but I did not know if boards with CPUs that weren't in the original list of CONFIG_4nn options would break if this member suddenly showed up. I can't see why it would, but I have no way of testing.
josh