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.

Signed-off-by: Josh Boyer <[EMAIL PROTECTED]>

diff --git a/include/asm-ppc/u-boot.h b/include/asm-ppc/u-boot.h
index 54ac01d..6673cd4 100644
--- a/include/asm-ppc/u-boot.h
+++ b/include/asm-ppc/u-boot.h
@@ -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)
diff --git a/include/ppc4xx.h b/include/ppc4xx.h
index e216663..be6696d 100644
--- a/include/ppc4xx.h
+++ b/include/ppc4xx.h
@@ -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) || \
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index c02ac62..977fc19 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -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);
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to