[U-Boot] [PATCH] i.MX31: fir imx31_phycore to work after Linux reboot

Upon power on i.MX31 enables most peripheral clocks, Linux disables the ones that it's not using to save power. Until now U-Boot on imx31_phycore didn't enable the I2C clock explicitly, so, after a reboot under Linux, if Linux didn't use I2C, the clock would stay disabled. And U-Boot on imx31_phycore uses an I2C EEPROM for environment data. So, after a reboot U-Boot would be left with its default environment. This patch fixes this problem by enabling the I2C clock explicitly.
Signed-off-by: Guennadi Liakhovetski lg@denx.de --- board/imx31_phycore/imx31_phycore.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/board/imx31_phycore/imx31_phycore.c b/board/imx31_phycore/imx31_phycore.c index 4c64cb9..6b78194 100644 --- a/board/imx31_phycore/imx31_phycore.c +++ b/board/imx31_phycore/imx31_phycore.c @@ -60,6 +60,9 @@ int board_init (void) mx31_gpio_mux(MUX_CSPI2_MOSI__I2C2_SCL); mx31_gpio_mux(MUX_CSPI2_MISO__I2C2_SDA);
+ /* start I2C2 clock */ + __REG(CCM_CGR0) = __REG(CCM_CGR0) | (3 << 28); + gd->bd->bi_arch_number = MACH_TYPE_PCM037; /* board id for linux */ gd->bd->bi_boot_params = (0x80000100); /* adress of boot parameters */

Dear Guennadi Liakhovetski,
In message Pine.LNX.4.64.0902061002160.4970@axis700.grange you wrote:
Upon power on i.MX31 enables most peripheral clocks, Linux disables the ones
Why does U-Boot do that?
This is against U-Boot design guidelines which state that U-Boot shall only activate such peripherals that it uses itself.
didn't use I2C, the clock would stay disabled. And U-Boot on imx31_phycore uses an I2C EEPROM for environment data. So, after a reboot U-Boot would be
That's another area of bad design. Should we not change U-Boot such that it places the environment in flash?
BTW: What does "fir imx31_phycore to work after Linux reboot" mean? I cannot parse that.
Best regards,
Wolfgang Denk

On Fri, 6 Feb 2009, Wolfgang Denk wrote:
Dear Guennadi Liakhovetski,
In message Pine.LNX.4.64.0902061002160.4970@axis700.grange you wrote:
Upon power on i.MX31 enables most peripheral clocks, Linux disables the ones
Why does U-Boot do that?
i.MX31 does that - the CPU, not U-Boot. I.e., this is the default power-on mode.
This is against U-Boot design guidelines which state that U-Boot shall only activate such peripherals that it uses itself.
didn't use I2C, the clock would stay disabled. And U-Boot on imx31_phycore uses an I2C EEPROM for environment data. So, after a reboot U-Boot would be
That's another area of bad design. Should we not change U-Boot such that it places the environment in flash?
Hm, no idea who and why decided to do that. I can only guess that this comes from the original BSPs somewhere, maybe they wanted to ship various EEPROM versions while keeping the same NOR, although both are probably hard-soldered on the CPU board (cannot recognise the eeprom, can be under the barcode label). And maybe they have some user-space tools of their own to access that EEPROM... no, not defending, just trying to guess what we might break if we switch.
BTW: What does "fir imx31_phycore to work after Linux reboot" mean? I cannot parse that.
Sorry, s/fir/fix/.
Thanks Guennadi --- Guennadi Liakhovetski, Ph.D.
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@denx.de

Dear Guennadi Liakhovetski,
In message Pine.LNX.4.64.0902061353280.7686@axis700.grange you wrote:
In message Pine.LNX.4.64.0902061002160.4970@axis700.grange you wrote:
Upon power on i.MX31 enables most peripheral clocks, Linux disables the ones
Why does U-Boot do that?
i.MX31 does that - the CPU, not U-Boot. I.e., this is the default power-on mode.
Yea, but U-Boot performs h/w initialization. So why does it not - like Linux - set sane defaults (with only the necessary clocks enabled) ?
That's another area of bad design. Should we not change U-Boot such that it places the environment in flash?
Hm, no idea who and why decided to do that. I can only guess that this comes from the original BSPs somewhere, maybe they wanted to ship various
Well, submit a patch, so Sascha as board maintainer can comment?
Best regards,
Wolfgang Denk

On 22:32 Sat 21 Feb , Wolfgang Denk wrote:
Dear Guennadi Liakhovetski,
In message Pine.LNX.4.64.0902061353280.7686@axis700.grange you wrote:
In message Pine.LNX.4.64.0902061002160.4970@axis700.grange you wrote:
Upon power on i.MX31 enables most peripheral clocks, Linux disables the ones
Why does U-Boot do that?
i.MX31 does that - the CPU, not U-Boot. I.e., this is the default power-on mode.
Yea, but U-Boot performs h/w initialization. So why does it not - like Linux - set sane defaults (with only the necessary clocks enabled) ?
it's the case in the last version
Best Regards, J.

Hi,
On Sat, Feb 21, 2009 at 10:32:33PM +0100, Wolfgang Denk wrote:
Dear Guennadi Liakhovetski,
In message Pine.LNX.4.64.0902061353280.7686@axis700.grange you wrote:
In message Pine.LNX.4.64.0902061002160.4970@axis700.grange you wrote:
Upon power on i.MX31 enables most peripheral clocks, Linux disables the ones
Why does U-Boot do that?
i.MX31 does that - the CPU, not U-Boot. I.e., this is the default power-on mode.
Yea, but U-Boot performs h/w initialization. So why does it not - like Linux - set sane defaults (with only the necessary clocks enabled) ?
I simply forgot it. The clock registers do not get resetted on reset, only on power up.
Sascha

On Mon, 23 Feb 2009, Sascha Hauer wrote:
Hi,
On Sat, Feb 21, 2009 at 10:32:33PM +0100, Wolfgang Denk wrote:
Dear Guennadi Liakhovetski,
In message Pine.LNX.4.64.0902061353280.7686@axis700.grange you wrote:
In message Pine.LNX.4.64.0902061002160.4970@axis700.grange you wrote:
Upon power on i.MX31 enables most peripheral clocks, Linux disables the ones
Why does U-Boot do that?
i.MX31 does that - the CPU, not U-Boot. I.e., this is the default power-on mode.
Yea, but U-Boot performs h/w initialization. So why does it not - like Linux - set sane defaults (with only the necessary clocks enabled) ?
I simply forgot it. The clock registers do not get resetted on reset, only on power up.
Well, it depends. On U-Boot reset they do get resetted, but not on Linux reboot. Reason - U-Boot uses the watchdog for reset, Linux just jumps to address 0. I tried using watchdog under Linux for reset - it just hung the system. You might want to investigate it further...
Thanks Guennadi --- Guennadi Liakhovetski, Ph.D.
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@denx.de

Hi Wolfgang,
We have a custom board with MPC8548E processor, please help me in suggesting/sharing Ethernet Internal/External Loopback testing code piece. Also any Phy level loop back too.
Please do help me in this regard.
Thanks, Ajeesh Kumar
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments contained in it.

maybe fix to fir :) On 10:03 Fri 06 Feb , Guennadi Liakhovetski wrote:
Upon power on i.MX31 enables most peripheral clocks, Linux disables the ones that it's not using to save power. Until now U-Boot on imx31_phycore didn't enable the I2C clock explicitly, so, after a reboot under Linux, if Linux didn't use I2C, the clock would stay disabled. And U-Boot on imx31_phycore uses an I2C EEPROM for environment data. So, after a reboot U-Boot would be left with its default environment. This patch fixes this problem by enabling the I2C clock explicitly.
Signed-off-by: Guennadi Liakhovetski lg@denx.de
board/imx31_phycore/imx31_phycore.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/board/imx31_phycore/imx31_phycore.c b/board/imx31_phycore/imx31_phycore.c index 4c64cb9..6b78194 100644 --- a/board/imx31_phycore/imx31_phycore.c +++ b/board/imx31_phycore/imx31_phycore.c @@ -60,6 +60,9 @@ int board_init (void) mx31_gpio_mux(MUX_CSPI2_MOSI__I2C2_SCL); mx31_gpio_mux(MUX_CSPI2_MISO__I2C2_SDA);
- /* start I2C2 clock */
- __REG(CCM_CGR0) = __REG(CCM_CGR0) | (3 << 28);
is not better to ahve this in the I2C driver?
Best Regards, J.
participants (5)
-
Ajeesh Kumar
-
Guennadi Liakhovetski
-
Jean-Christophe PLAGNIOL-VILLARD
-
Sascha Hauer
-
Wolfgang Denk