[U-Boot-Users] Peripheral initialization hooks

Hello all,
I have a PPC852T platform running U-Boot. My platform has the ability to enable or disable the Ethernet PHY directly, and at boot the PHY is disabled. It must be enabled, through a register in an FPGA that is accessed through a separate chip select.
Is it acceptable to modify board_init_r() to include a call to an enable/disable function that would only apply if my board were defined? Or are there any hooks for board-specific initializations?
Also, given that this is related to Ethernet, I think it's best that I enable the PHY immediately before querying the config for 'ethaddr' in board_init_r(). Agree/disagree?
TIA,
Steve
------
Steve Strublic
Network Solutions Group
Hypercom Corporation
Phoenix, AZ

Is it acceptable to modify board_init_r() to include a call to an enable/disable function that would only apply if my board were defined? Or are there any hooks for board-specific initializations?
The hooks are already there. I would recommend board_early_init_f() or board_early_init_r() which can be turned on/off by the board configuration header file.
Regards, -Shawn.

Steve,
Steve Strublic wrote:
I have a PPC852T platform running U-Boot. My platform has the ability to enable or disable the Ethernet PHY directly, and at boot the PHY is disabled. It must be enabled, through a register in an FPGA that is accessed through a separate chip select.
Is it acceptable to modify board_init_r() to include a call to an enable/disable function that would only apply if my board were defined? Or are there any hooks for board-specific initializations?
Also, given that this is related to Ethernet, I think it’s best that I enable the PHY immediately before querying the config for ‘ethaddr’ in board_init_r(). Agree/disagree?
I personally would stay away modifying common code if there is a way to do it. You surely will make it modifications conditional for your board but still it is a distribution of your board programming logic into other files that are not obvious immediately.
What if you enable CONFIG_BOARD_EARLY_INIT_F in your board config file and create a board_early_init_f() that enables all your PHYs and leave it enabled?
Unless there is a serious issues with that, I would choose to keep all your PHYs enabled. This assumes that you have initialized your FPGA CS in your board initialization.
I use early init to initialize PLL to generate correct frquency for my external serial console clock and a number of other clocks.
Tolunay

In message 482F3C06ECF00C44AEC226520C6FCB1A51ECB9@EXCHANGEVS.HYPERCOM.COM you wrote:
Is it acceptable to modify board_init_r() to include a call to an enable/disable function that would only apply if my board were defined?
No, it is not, as there are already too many such hooks available.
Or are there any hooks for board-specific initializations?
Yes, there are.
Best regards,
Wolfgang Denk
participants (4)
-
Shawn Jin
-
Steve Strublic
-
Tolunay Orkun
-
Wolfgang Denk