Updated switch/glue patch?

Adrian Chadd adrian at freebsd.org
Sun Dec 18 02:43:46 UTC 2011


On 16 December 2011 00:03, Stefan Bethke <stb at lassitu.de> wrote:

> There is one more problem which is not immediately apparent: the register access is slooooow.  The rtl_tick callback that runs once a second needs .8 seconds to complete, see sysctl debug.rtl8366rb.  Most of this time is spent in DELAY() in iicbb.c, making the system rather unresponsive.
>
> rtl_tick() runs mii_tick() and mii_pollstat() for all five PHYs.  We can likely leave out mii_tick() since the built-in PHYs don't need ticks for autonegotiation to work correctly.  Leaving out mii_pollstat() means that link state changes won't be detected and reported automatically but only when you run e.g. etherswitchcfg port0.
>
> I'm currently looking into iicbb.c, since I believe it is DELAY()ing way too much (running at effectively 20kHz instead of 100kZh for I2C).  I'll try to speed it up, since the RTL8366RB can go at least at 100kHz.

I'm looking at it now. Which particular part of it is delaying too much?

Each delay is only 10 microseconds, but there's a handful of these for
each _bit_ being sent. This seems a bit ridiculous.

What the heck should it be? There are delays for different parts of
i2c - setting the data output bit, toggling the clock bit, waiting for
an ACK. Should these all be tunable for each device that's on the bus?
Or just set the i2c bus speed for all devices on the bus? Or both? Or
neither? :)

(Someone with i2c clue, please stand up! :)



Adrian


More information about the freebsd-embedded mailing list