Skip to contentSkip to conversation

I2C bus clock on MPC85XX systems

DISCUSSION Felix Radensky 2 participants 6 messages Dec 22, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

Almost all MPC85XX based systems have the compatible=:"fsl-i2c" in respective i2c device tree nodes. This causes FSL i2c driver to use the following "backward compatible" values: FSR=0x31 DFSR=0x10. This is regardless of CCB clock frequency and i2c clock prescaler.

On my custom MPC8536 based board with 432MHz CCB clock this results in 65KHz i2c clock frequency (checked with scope). U-Boot correctly configures the clock to 400KHz.

I've fixed the problem by modifying device tree to use different compatible value, similar to what socrates board does. Is this the right approach ?

Thanks.

Felix.

#1 lore raw
Quoted 9 lines · Felix Radensky

Hi,

Almost all MPC85XX based systems have the compatible=:"fsl-i2c" in respective
i2c device tree nodes. This causes FSL i2c driver to use the following "backward
compatible" values: FSR=0x31 DFSR=0x10. This is regardless of CCB clock frequency and i2c clock prescaler.

Quoted 7 lines

On my custom MPC8536 based board with 432MHz CCB clock this results in 65KHz i2c clock frequency (checked with scope). U-Boot correctly configures the clock to 400KHz.

I've fixed the problem by modifying device tree to use different compatible value,
similar to what socrates board does. Is this the right approach ?

Are you aware of the properties described in
"Documentation/powerpc/dts-bindings/fsl/i2c.txt":

http://lxr.linux.no/#linux+v2.6.32/Documentation/powerpc/dts-bindings/fsl/i2c.txt

Wolfgang.

#2 lore raw

Hi, Wolfgang

Quoted 20 lines · Wolfgang Grandegger
Quoted 9 lines · Felix Radensky

Hi,

Almost all MPC85XX based systems have the compatible=:"fsl-i2c" in respective
i2c device tree nodes. This causes FSL i2c driver to use the following "backward
compatible" values: FSR=0x31 DFSR=0x10. This is regardless of CCB clock frequency and i2c clock prescaler.

Quoted 8 lines

On my custom MPC8536 based board with 432MHz CCB clock this results in 65KHz i2c clock frequency (checked with scope). U-Boot correctly configures the clock to 400KHz.

I've fixed the problem by modifying device tree to use different compatible value,
similar to what socrates board does. Is this the right approach ?

Quoted 8 lines

Are you aware of the properties described in
"Documentation/powerpc/dts-bindings/fsl/i2c.txt":

http://lxr.linux.no/#linux+v2.6.32/Documentation/powerpc/dts-bindings/fsl/i2c.txt

Wolfgang.

Sure, I'm aware of these properties. I've used

compatible = "fsl,mpc8543-i2c", "fsl-i2c";
clock-frequency = <400000>;

for my custom board.

I think, however, that device trees for FSL reference designs should use them as well, to avoid setting i2c clock to some strange values. I may be wrong, but I think most custom board developers borrow from reference device trees, so having a sane starting point would help.

Thanks.

Felix.

#3 lore raw
Quoted 35 lines · Felix Radensky

Hi, Wolfgang

Quoted 21 lines · Wolfgang Grandegger
Quoted 9 lines · Felix Radensky

Hi,

Almost all MPC85XX based systems have the compatible=:"fsl-i2c" in respective
i2c device tree nodes. This causes FSL i2c driver to use the following "backward
compatible" values: FSR=0x31 DFSR=0x10. This is regardless of CCB clock frequency and i2c clock prescaler.

Quoted 9 lines

On my custom MPC8536 based board with 432MHz CCB clock this results in 65KHz i2c clock frequency (checked with scope). U-Boot correctly configures
the clock to 400KHz.

I've fixed the problem by modifying device tree to use different compatible value,
similar to what socrates board does. Is this the right approach ?

Quoted 9 lines

Are you aware of the properties described in
"Documentation/powerpc/dts-bindings/fsl/i2c.txt":

http://lxr.linux.no/#linux+v2.6.32/Documentation/powerpc/dts-bindings/fsl/i2c.txt

Wolfgang.

Sure, I'm aware of these properties. I've used

Quoted 8 lines

compatible = "fsl,mpc8543-i2c", "fsl-i2c";
clock-frequency = <400000>;

for my custom board.

I think, however, that device trees for FSL reference designs should use them as well, to avoid setting i2c
clock to some strange values. I may be wrong, but I think most custom

The FSR=0x31 DFSR=0x10 are not strange values. They have been used in mainline kernels (< 2.6.30) for a long time.

Quoted 2 lines

board developers borrow from
reference device trees, so having a sane starting point would help.

The trees provided by Freescale are usually based on older kernel version. Borrow from such trees is OK, but the project developers should use a recent kernel version for development.

Wolfgang.

#4 lore raw

Hi, Wolfgang

Quoted 54 lines · Wolfgang Grandegger
Quoted 38 lines · Felix Radensky

Hi, Wolfgang

Quoted 22 lines · Wolfgang Grandegger
Quoted 9 lines · Felix Radensky

Hi,

Almost all MPC85XX based systems have the compatible=:"fsl-i2c" in respective
i2c device tree nodes. This causes FSL i2c driver to use the following "backward
compatible" values: FSR=0x31 DFSR=0x10. This is regardless of CCB clock frequency and i2c clock prescaler.

Quoted 10 lines

On my custom MPC8536 based board with 432MHz CCB clock this results in 65KHz i2c clock frequency (checked with scope). U-Boot correctly configures
the clock to 400KHz.

I've fixed the problem by modifying device tree to use different compatible value,
similar to what socrates board does. Is this the right approach ?

Quoted 10 lines

Are you aware of the properties described in
"Documentation/powerpc/dts-bindings/fsl/i2c.txt":

http://lxr.linux.no/#linux+v2.6.32/Documentation/powerpc/dts-bindings/fsl/i2c.txt

Wolfgang.

Sure, I'm aware of these properties. I've used

Quoted 9 lines

compatible = "fsl,mpc8543-i2c", "fsl-i2c";
clock-frequency = <400000>;

for my custom board.

I think, however, that device trees for FSL reference designs should use them as well, to avoid setting i2c
clock to some strange values. I may be wrong, but I think most custom

The FSR=0x31 DFSR=0x10 are not strange values. They have been used in mainline kernels (< 2.6.30) for a long time.

Quoted 8 lines
Quoted 3 lines

board developers borrow from
reference device trees, so having a sane starting point would help.

The trees provided by Freescale are usually based on older kernel version. Borrow from such trees is OK, but the project developers should use a recent kernel version for development.

I was talking about modern vanilla kernels for Freescale reference boards. See, for example
http://lxr.linux.no/#linux+v2.6.32/arch/powerpc/boot/dts/mpc8536ds.dts

Felix.

#5 lore raw

Hi Felix,

Quoted 3 lines · Felix Radensky

Hi, Wolfgang

Wolfgang Grandegger wrote:

[snip]

Quoted 8 lines
Quoted 4 lines

The trees provided by Freescale are usually based on older kernel version. Borrow from such trees is OK, but the project developers should use a recent kernel version for development.

I was talking about modern vanilla kernels for Freescale reference boards. See, for example
http://lxr.linux.no/#linux+v2.6.32/arch/powerpc/boot/dts/mpc8536ds.dts

Only a few boards use these new properties to set a reasonable I2C clock. But I agree, adding "clock-frequency = <100000>;" would make it more obvious to the users how to define a proper frequency.

Wolfgang.