i2c-mpc clocking scheme

Trent Piepho tpiepho at freescale.com
Tue Dec 2 09:57:46 EST 2008


On Mon, 1 Dec 2008, Scott Wood wrote:
> Trent Piepho wrote:
>>  U-boot could pass in "bus-frequency" to let software know the speed of the
>>  I2C bus from Linux.  Seems like a standard property for bus nodes.
>
> clock-frequency is standard, though it should probably be the input frequency 
> rather than the bus frequency, in case the OS really does want to change it 
> (maybe making the bus run faster when accessing faster devices).

For a bus device like an i2c controller, you really have two clocks.  The
input clock the controller runs from and the speed it runs the bus at.  One
could say that one clock is for the device node and the other clock is for
the device's sub-nodes.

Linux doesn't have an API for setting I2C bus speed.  If it did, then
adding support for it to i2c-mpc if there was demand would really be
another patch.  Right now the problem is that Linux programs the I2C
controller stupidly and undoes u-boot's (better) settings.

>>  There could be a "current-speed" property that tells linux to keep the
>>  registers the same,
>
> That would be a bit different from the way it's used in serial nodes, where 
> current-speed is simply a description of the baud rate that corresponds to 
> the current divider setting.  I'm not sure that it makes as much sense for 
> i2c, as you don't have the shared state on the other end that depends on 
> maintaining the exact same speed.

The Linux code could use current-speed to know if it should program the
registers.  I.e., if current-speed is present and non-zero, then leave the
frequency registers alone.  Otherwise u-boot or whatever might not have
programmed the I2C controller and the driver can do what it's doing now.

> When does the guest really care what the specific i2c bus frequency is, if 
> it's not going to change it?

I don't know of a real reason.  Maybe an I2C device where the clock speed
makes a difference?  Maximum polling rate or something?  Is there reason
the CPU clock and the CCB frequency need to be in the device tree?



More information about the Linuxppc-dev mailing list