based on the inclusion of i2c_simple.h, this would seem to only work on boards which also offer hardware I2C, otherwise platform_i2c_transfer() remains unimplemented and causes a linking error. Can hack around it with preprocessor guards, but not exactly pretty.

Took me a moment to figure out why: The call to platform_i2c_transfer()
is not garbage collected because the call to software_i2c_transfer() is
runtime conditional (based on the bus number).

i2c_simple is messy and will stay that way unless we define some rules
(e.g. let mainboard code assign bus numbers). The problem is that it is
designed for a single chip does everything solution (and don't you dare
to put another I2C controller on a board). It's just incompatible to this
case. For the moment, adding more Kconfig and if's, would do. But to be
scalable, it would need function pointers per bus that are registered
during runtime; and that would bring it unlikely close to `i2c_bus.h`.

There is only one entity in coreboot that can glue such things properly
together: the mainboard code. In the convenient case, this is done via
the devicetree.

View Change

To view, visit change 35726. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I7803566b64158405efc04a39f80a0ec98b44e646
Gerrit-Change-Number: 35726
Gerrit-PatchSet: 14
Gerrit-Owner: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Reviewer: Christian Walter <christian.walter@9elements.com>
Gerrit-Reviewer: Julius Werner <jwerner@chromium.org>
Gerrit-Reviewer: Martin Roth <martinroth@google.com>
Gerrit-Reviewer: Michael Niewöhner
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-Reviewer: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-Reviewer: Patrick Rudolph <siro@das-labor.org>
Gerrit-Reviewer: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Kyösti Mälkki <kyosti.malkki@gmail.com>
Gerrit-CC: Matt DeVillier <matt.devillier@gmail.com>
Gerrit-CC: Nico Huber <nico.h@gmx.de>
Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net>
Gerrit-CC: Дмитрий Понаморев <dponamorev@gmail.com>
Gerrit-Comment-Date: Wed, 18 Dec 2019 10:37:34 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment