Skip to contentSkip to conversation

i.MX31: fir imx31_phycore to work after Linux reboot

PATCH New Guennadi Liakhovetski 5 participants 9 messages Feb 6, 2009 – Feb 23, 2009 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 board/imx31_phycore/imx31_phycore.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
board/imx31_phycore/imx31_phycore.c +3 -0
index 4c64cb9..6b78194 100644
@@ -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 */
 
Signature · 1 line
1.5.4
#1 lore raw

PATCH 1/1 i.MX31: fir imx31_phycore to work after Linux reboot

Dear Guennadi Liakhovetski,

Quoted 1 line · In message <[email protected]> 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.

Quoted 2 lines

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

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Children are natural mimics who act like their parents despite  every
effort to teach them good manners.
#2 lore raw

PATCH 1/1 i.MX31: fir imx31_phycore to work after Linux reboot

Quoted 6 lines · Wolfgang Denk

Dear Guennadi Liakhovetski,

Quoted 1 line · In message <[email protected]> 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.

Quoted 8 lines

This is against U-Boot design guidelines which state that U-Boot shall only activate such peripherals that it uses itself.

Quoted 2 lines

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.

Quoted 2 lines

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 at denx.de

#3 lore raw

PATCH 1/1 i.MX31: fir imx31_phycore to work after Linux reboot

Dear Guennadi Liakhovetski,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 5 lines
Quoted 1 line · In message <[email protected]> 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) ?

Quoted 5 lines
Quoted 2 lines

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

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The Gates in my computer are AND, OR and NOT; they are not Bill.
#4 lore raw

PATCH 1/1 i.MX31: fir imx31_phycore to work after Linux reboot

Quoted 7 lines · Wolfgang Denk

Dear Guennadi Liakhovetski,

Quoted 4 lines · In message <[email protected]> you wrote:
Quoted 4 lines
Quoted 1 line · In message <[email protected]> you wrote:

Upon power on i.MX31 enables most peripheral clocks, Linux disables the ones

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

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.

maintainer
#5 lore raw

PATCH 1/1 i.MX31: fir imx31_phycore to work after Linux reboot

In reply to Wolfgang Denk

Hi,

Quoted 7 lines · Wolfgang Denk

Dear Guennadi Liakhovetski,

Quoted 4 lines · In message <[email protected]> you wrote:
Quoted 4 lines
Quoted 1 line · In message <[email protected]> you wrote:

Upon power on i.MX31 enables most peripheral clocks, Linux disables the ones

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

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

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#6 lore raw

PATCH 1/1 i.MX31: fir imx31_phycore to work after Linux reboot

Quoted 12 lines · Sascha Hauer

Hi,

Quoted 9 lines · Wolfgang Denk

Dear Guennadi Liakhovetski,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 5 lines
Quoted 1 line · In message <[email protected]> you wrote:

Upon power on i.MX31 enables most peripheral clocks, Linux disables the ones

Why does U-Boot do that?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

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 at denx.de

#7 lore raw

[U-Boot] U-boot level MPC8548 Ethernet internal/External Loop back testing

In reply to Wolfgang Denk

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.

#8 lore raw

PATCH 1/1 i.MX31: fir imx31_phycore to work after Linux reboot

In reply to Guennadi Liakhovetski

maybe fix to fir :)

Quoted 18 lines · Guennadi Liakhovetski

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.

---
 board/imx31_phycore/imx31_phycore.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
board/imx31_phycore/imx31_phycore.c +0 -0
index 4c64cb9..6b78194 100644

board/imx31_phycore/imx31_phycore.c int board_init (void) · line 65

Quoted 6 lines
board/imx31_phycore/imx31_phycore.c +3 -0
@@ -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.