
The following is the code fragment from lib_ppc/board.c.
%%% begin fragment %%%
#if defined(CONFIG_405GP) || defined(CONFIG_405EP) bd->bi_pci_busfreq = get_PCI_freq ();
#ifdef CFG_OPB_FREQ bd->bi_opbfreq = CFG_OPB_FREQ; #else bd->bi_opbfreq = 50000000; #endif bd->bi_iic_fast[0] = 0; bd->bi_iic_fast[1] = 0; #endif #endif
%%% end fragment %%%
Why is bi_opbfreq not initialized as:
bd->bi_opbfreq = get_OPB_freq();
get_OPB_freq() returns the actual OPB frequency based on PLB freq and PLB:OPB divisor (based on pllmr & strap read only registers in PPC405).
This value is not used by u-boot but Linux uses it in I2C divisor initialization (linux/drivers/i2c/i2c-ibm_iic.c). On Cogent CSB272 board the OPB freq is set to 16.67Mhz so the effective I2C clock was much lower because wrong value was communicated to Linux.
I patched my version of board.c to use get_OPB_freq() in the else case (replaced constant 50000000 with get_OPB_freq() call) and it worked well. I personally do not see why CFG_OPB_FREQ is needed at all (only one board is using it and set to 50Mhz). If nobody objects, I would like to send a patch for it.
2 choice for the patch:
1) I can send a patch so CFG_OPB_FREQ is removed and bi_opbfreq is always initialied to correct value via get_OPB_freq().
2) I can keep CFG_OPB_FREQ override (for that one board) and change the default in else case to get_OPB_freq().
Which one would you favor?
Regards, Tolunay