Home | History | Annotate | Download | only in i2c
History log of /src/sys/dev/i2c/gttwsi_core.c
RevisionDateAuthorComments
 1.20  25-Sep-2025  thorpej Don't use a property to set a value in the front end that can simply
be set directly in the softc instead.
 1.19  15-Sep-2025  thorpej Encapsulate what's needed to attach an I2C bus into a iicbus_attach()
inline.
 1.18  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.17  24-Apr-2021  thorpej branches: 1.17.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.16  15-Feb-2020  thorpej branches: 1.16.8;
Interrupt-driven I/O seems to completely go off the rails, at least
on AllWinner implementations of this controller, so force polled mode
for now.
 1.15  13-Jan-2020  thorpej Fix silly mistake in rev 1.12.
 1.14  13-Jan-2020  martin Fix debug printf formats.
 1.13  13-Jan-2020  thorpej Improve diagnostic messages:
- Pass an additional argument to gttwsi_wait() to indicate what's
going on, and report that, along with the error code from
cv_timedwait(), if a timeout occurs.
- In gttwsi_send_stop(), if we don't get the expected NRS status,
report which status we *did* get when a timeout occurs.
 1.12  12-Jan-2020  thorpej Clean up gttwsi's register access stuff:
- Garbage-collect the obsolete GTTWSI_ALLWINNER option; it hasn't been
needed since FDT'ization of the Allwinner support code.
- Redefine thw "TWSI_*" register definitions to clearly call out:
-> The Marvell flavor of the offsets
-> The Allwinner flavor of the offsets
...and make the regular definitions indices into a register map.
- Pass the appropriate register map from the front-end to the core.
- Remove the customer register read/write callbacks -- they are no longer
needed now that each front-end passes an appropriate register map to
the core.
 1.11  11-Jan-2020  thorpej In gttwsi_wait(), don't use cv_timedwait_sig() -- there's no reason to
catch signals here, and the code would need to handle them properly, which
this code does not.
 1.10  25-Dec-2019  thorpej branches: 1.10.2;
Remove assertions that no longer make sense now that the bus acquire / release
logic is handled by the upper layer.
 1.9  22-Dec-2019  thorpej Cleanup i2c bus acquire / release, centralizing all of the logic into
iic_acquire_bus() / iic_release_bus(). "acquire" and "release" hooks
no longer need to be provided by back-end controller drivers (only if
they need special handling, e.g. powering on the i2c controller).
This results in the removal of a bunch of rendundant code from each
back-end controller driver.

Assert that we are not in hard interrupt context in iic_acquire_bus(),
iic_exec(), and iic_release_bus().
 1.8  01-Oct-2018  bouyer Expand code covered by sc->sc_mtx, to make sure an interrupt would not be
handled before the cv_timedwait_sig() call, or while polling.
Seems to fix "sunxitwi0: send STOP failed" messages frequently seen related
to axp20x0 sensors.
 1.7  18-Jun-2018  jakllsch branches: 1.7.2;
Bail early if gttwsi_send_start() fails in gttwsi_initiate_xfer() to
avoid unexpected state error message later (on Allwinner H5).
 1.6  12-Jun-2018  thorpej When initiating a transfer, if a device isn't present, we won't
get an ACK after sending the address. Check for this alternate
state and suppress the error message when it occurs.

Fixes PR kern/53356.
 1.5  07-May-2018  jmcneill Don't sleep with IPL_VM lock held.
 1.4  03-May-2018  jmcneill Use IPL_VM for bus lock so we can do i2c xfers from interrupt context
 1.3  29-Oct-2017  jmcneill branches: 1.3.2;
Allow drivers to provide their own read/write register functions. While
here, sprinkle KASSERTs to verify that the i2c lock is held where it
should be.
 1.2  23-Nov-2014  jmcneill branches: 1.2.12;
On Allwinner A31 you need to set the CONTROL_IFLG bit to clear it. Add
a "iflg-rwc" property to enable this behaviour.
 1.1  06-Sep-2013  matt branches: 1.1.2; 1.1.6; 1.1.8; 1.1.10; 1.1.12;
Make gttswi MI and usuable from non-Marvell SoCs.
(should rename to mvi2c but ...)
 1.1.12.3  03-Dec-2017  jdolecek update from HEAD
 1.1.12.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.12.1  06-Sep-2013  tls file gttwsi_core.c was added on branch tls-maxphys on 2014-08-20 00:03:37 +0000
 1.1.10.1  25-Nov-2014  snj Pull up following revision(s) (requested by jmcneill in ticket #257):
sys/arch/arm/allwinner/awin_twi.c: revision 1.5
sys/arch/arm/allwinner/awin_reg.h: revision 1.53
sys/arch/evbarm/conf/HUMMINGBIRD_A31: revision 1.20
sys/dev/i2c/gttwsi_core.c: revision 1.2
sys/dev/i2c/gttwsivar.h: revision 1.2
On Allwinner A31 you need to set the CONTROL_IFLG bit to clear it. Add
a "iflg-rwc" property to enable this behaviour.
--
Don't assume that U-Boot has enabled the TWI clock. Also, for A31, set
the "iflg-rwc" device property for gttwsi.
--
The SoC RTC works on this board but does not seem to be hooked up to the
battery. Thankfully, there is a PCF8563 attached to TWI2 at address 51h,
so use that instead.
 1.1.8.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.8.1  06-Sep-2013  yamt file gttwsi_core.c was added on branch yamt-pagecache on 2014-05-22 11:40:21 +0000
 1.1.6.2  18-May-2014  rmind sync with head
 1.1.6.1  06-Sep-2013  rmind file gttwsi_core.c was added on branch rmind-smpnet on 2014-05-18 17:45:37 +0000
 1.1.2.2  24-Mar-2014  matt Merge mvi2c from HEAD
 1.1.2.1  06-Sep-2013  matt file gttwsi_core.c was added on branch matt-nb5-mips64 on 2014-03-24 18:48:52 +0000
 1.2.12.1  15-Oct-2018  snj Pull up following revision(s) (requested by bouyer in ticket #1061):
sys/dev/i2c/gttwsi_core.c: revision 1.4-1.8 via patch
sys/dev/i2c/gttwsivar.h: revision 1.4 via patch
Use IPL_VM for bus lock so we can do i2c xfers from interrupt context
Don't sleep with IPL_VM lock held.
When initiating a transfer, if a device isn't present, we won't
get an ACK after sending the address. Check for this alternate
state and suppress the error message when it occurs.
Fixes PR kern/53356.
Bail early if gttwsi_send_start() fails in gttwsi_initiate_xfer() to
avoid unexpected state error message later (on Allwinner H5).
Expand code covered by sc->sc_mtx, to make sure an interrupt would not be
handled before the cv_timedwait_sig() call, or while polling.
Seems to fix "sunxitwi0: send STOP failed" messages frequently seen related
to axp20x0 sensors.
 1.3.2.3  20-Oct-2018  pgoyette Sync with head
 1.3.2.2  25-Jun-2018  pgoyette Sync with HEAD
 1.3.2.1  21-May-2018  pgoyette Sync with HEAD
 1.7.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.7.2.1  10-Jun-2019  christos Sync with HEAD
 1.10.2.2  29-Feb-2020  ad Sync with head.
 1.10.2.1  17-Jan-2020  ad Sync with head.
 1.16.8.1  02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.17.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed