Skip to content

Issues with i2c-bcm2708 driver #1639

@ghost

Description

I'm building a power management board for the RPI that controls the power to the RPI via software controls. Power on, power off, reboot, power on at a certain time, etc... The board is connected to the RPI via i2c.

During my tinkering, I've found a few issues with the i2c-bcm2708 driver. I've cleaned it up some and if I decide to publish it I was wondering if it would be better to publish it here or talk to Eric Anholt about sending it upstream. I saw very few differences between the downstream and upstream driver. I have absolutely no interest in trying to distribute a third i2c driver...

Here are the issues.

    1. In 4.8, the clocks are adjusted via cprman. It appears the clocks change a bit over time due to dynamic adjustment. Since the driver only computes the divider at boot time, it is often wrong.

The workaround I did was to recompute the driver on each bus transaction(not in the IRQ handler). This seems to fix things.

  1. If the driver is called through a power off handler very late in the shutdown sequence, the drive will hang do to the fact that the kernel completion mechanism and jiffies counter is shutdown.

I worked around this by switching to a polling mechanism of the i2c registers after the driver shutdown call is made. This seems to work even very late in the shutdown sequence.

  1. The tout register is computed incorrectly. Since it's integer arithmetic, it always computes to 0 which means no timeout.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions