History log of /src/sys/arch/macppc/dev/ki2c.c |
Revision | | Date | Author | Comments |
1.44 |
| 28-Sep-2025 |
thorpej | There are PowerMac G5 11.2 units in the wild with an OFW device tree containing 2 "i2c-bus@0" nodes on the mac-io ki2c, each containing audio codec ICs. Work around this apparent error in the OFW device tree by skipping the channel if it's already been initialized.
Patch provided by rin@, tweaked slightly to add a debug log breadcrumb.
PR port-macppc/59673.
|
1.43 |
| 21-Sep-2025 |
thorpej | Use direct device tree enumeration support for ki2c. Cleanly separate the two ki2c channels rather than mixing them all together and using an artificial i2c address bit to distinguish the channels.
|
1.42 |
| 21-Sep-2025 |
thorpej | It's no longer necessary to scan for sensor descriptive information in the macppc i2c controller drivers; device_register() does it for us.
|
1.41 |
| 18-Sep-2025 |
thorpej | In the "i2c-child-devices" array, don't pass in a "cookie" and "cookietype". Instead, just create the appropriate devhandle and pass that along as a data object.
|
1.40 |
| 15-Sep-2025 |
thorpej | Encapsulate what's needed to attach an I2C bus into a iicbus_attach() inline.
|
1.39 |
| 20-Aug-2025 |
macallan | my Xserve G4's firmware doesn't provide sensor names, so we add them ourselves since the fan control code needs them
|
1.38 |
| 07-Jul-2025 |
macallan | do a better job finding out openpic's base address on G4s
|
1.37 |
| 05-Jul-2025 |
macallan | deal with G5s that have two openpics by: - checking interrupt-parent, trying to find the corresponding PIC, and adjusting our IRQ number accordingly - fall back to polling if we have interrupt-parent but no matching PIC - if there is no interrupt-parent, assume we have only one PIC ... this should probably be handled by intr_establish*
|
1.36 |
| 05-Jul-2025 |
macallan | - don't enable I2C_INT_START, we don't do anything with it - don't cv_signal() unless we are done
|
1.35 |
| 05-Jul-2025 |
macallan | use interrupts so we can sleep instead of busy waiting on i2c transfers
|
1.34 |
| 30-Jun-2025 |
macallan | deal with PowerMac7,2 sensor name encoding
|
1.33 |
| 29-Jun-2022 |
mlelstv | branches: 1.33.10; Use old limit of 32 + 32 bytes to keep combining buffer on stack. There are no devices on this platform that need more and for larger values, the driver should be better rewritten.
|
1.32 |
| 07-Aug-2021 |
thorpej | branches: 1.32.2; Merge thorpej-cfargs2.
|
1.31 |
| 24-Apr-2021 |
thorpej | branches: 1.31.2; 1.31.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.30 |
| 12-Jun-2020 |
macallan | branches: 1.30.4; more proplib API catchup
|
1.29 |
| 09-Jan-2020 |
macallan | defflag KI2C_DEBUG
|
1.28 |
| 09-Jan-2020 |
macallan | if we have more than one i2c-bus node, look for children on both now we find the light sensor in my shiny new toy
|
1.27 |
| 22-Dec-2019 |
thorpej | branches: 1.27.2; 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.26 |
| 15-Aug-2019 |
macallan | pass sensor location info to drivers if we can find it
|
1.25 |
| 08-Mar-2018 |
macallan | branches: 1.25.2; use channel info and set MODE bits accordingly instead of hoping OF set them for us now iic devices on different channels work properly
|
1.24 |
| 24-Jan-2018 |
macallan | branches: 1.24.2; note to self: OF_getprop() returns -1 on error now this works properly on sevan's iMac G4
|
1.23 |
| 27-Sep-2017 |
macallan | pass the right OF node to i2c devices
|
1.22 |
| 22-Sep-2017 |
macallan | follow sparc64 and do direct config for i2c-devices while there, make sure we play nice with smbus single byte reads
|
1.21 |
| 15-Sep-2017 |
macallan | bus_space-ify
|
1.20 |
| 05-Sep-2017 |
macallan | first step to clean up & bus-spacification: - use i2c addresses with the direction bit shifted out in iic_exec and when attaching drivers so things attaching to iic* have a chance of working - add an empty i2c-devices prop_array_t to keep drivers we don't want from attaching to iic* - printf -> DPRINTF / aprint_* - usa mapiodev() for now to make this work on G5
|
1.19 |
| 14-Feb-2016 |
chs | zero the i2c_attach_args structure before filling it in. fixes occasional crashes in iic_attach().
|
1.18 |
| 26-Jul-2011 |
macallan | branches: 1.18.12; 1.18.30; finish device_t-ification
|
1.17 |
| 18-Jun-2011 |
matt | struct device * -> device_t struct cfdata * -> cfdata_t use device accessors, use device_private. some softc/device_t splits (macppc needs a bunch more) aprint*_dev used considerably more
|
1.16 |
| 20-Dec-2010 |
matt | branches: 1.16.6; Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
|
1.15 |
| 14-Mar-2009 |
dsl | branches: 1.15.4; ANSIfy another 1261 function definitions. The only ones left in sys are beyond by sed script! (or in sys/dist or sys/external) Mostly they have function pointer parameters.
|
1.14 |
| 14-Mar-2009 |
dsl | Change about 4500 of the K&R function definitions to ANSI ones. There are still about 1600 left, but they have ',' or /* ... */ in the actual variable definitions - which my awk script doesn't handle. There are also many that need () -> (void). (The script does handle misordered arguments.)
|
1.13 |
| 14-Mar-2009 |
dsl | Remove all the __P() from sys (excluding sys/dist) Diff checked with grep and MK1 eyeball. i386 and amd64 GENERIC and sys still build.
|
1.12 |
| 08-Feb-2009 |
pgoyette | branches: 1.12.2; Avoid asking the controller to transfer zero bytes of data, since we have no clue if this works or not. This prevents the i2c quick_{read,write} protocols from working, but the only place those protocols are used is in the code that enumerates the i2c bus and that just doesn't make sense for ki2c anyway.
While here, make sure that i2c send_{byte,word} operations will work even if the caller provides the cmd (ie, register to modify) and the data in separate args. This is the normal calling sequence for iic_exec() routines and will enable dbcool (4) driver to update device registers.
OK'd macallan@
|
1.11 |
| 06-Dec-2007 |
ad | branches: 1.11.16; 1.11.24; lockmgr -> mutex
|
1.10 |
| 17-Oct-2007 |
garbled | branches: 1.10.2; 1.10.4; Merge the ppcoea-renovation branch to HEAD.
This branch was a major cleanup and rototill of many of the various OEA cpu based PPC ports that focused on sharing as much code as possible between the various ports to eliminate near-identical copies of files in every tree. Additionally there is a new PIC system that unifies the interface to interrupt code for all different OEA ppc arches. The work for this branch was done by a variety of people, too long to list here.
TODO: bebox still needs work to complete the transition to -renovation. ofppc still needs a bunch of work, which I will be looking at. ev64260 still needs to be renovated amigappc was not attempted.
NOTES: pmppc was removed as an arch, and moved to a evbppc target.
|
1.9 |
| 27-Sep-2007 |
dogcow | branches: 1.9.2; struct cfattach -> CFATTACH_DECL; compiles again.
|
1.8 |
| 26-Jun-2006 |
drochner | branches: 1.8.14; 1.8.18; 1.8.22; 1.8.32; 1.8.34; 1.8.36; Better explicitely specify the "ki2c" interface attribute, so that the "config_found" can't hit "i2cbus". Up to now, this relied on the fact that the i2cbus and ki2c attach args both had a string as first element which was used to distinguish. Now, interface attributes should take care that attach arguments are not misinterpreted.
|
1.7 |
| 26-Jun-2006 |
drochner | use the "i2cbus" interface attribute rather than putting a string name into the i2cbus attach args
|
1.6 |
| 24-Dec-2005 |
perry | branches: 1.6.4; 1.6.8; 1.6.16; bare asm -> __asm
|
1.5 |
| 11-Dec-2005 |
christos | merge ktrace-lwp.
|
1.4 |
| 07-Oct-2005 |
macallan | Check for 'i2c-bus' child and if found look for i2c devices there instead of directly under the ki2c node. Needed for newer ( 2005? ) OpenFirmware.
|
1.3 |
| 10-Aug-2005 |
macallan | allow to attach a normal iic bus, implements only iic_exec() and locking functions so far.
|
1.2 |
| 05-Jun-2005 |
nathanw | branches: 1.2.2; In ki2c_write() Apply __UNCONST() to the data parameter passed to ki2c_start(). The same back-end routine does reads and writes, so there's no real type-safety to be had here.
|
1.1 |
| 27-Dec-2003 |
grant | branches: 1.1.4; add support for the Keywest I2C and snapper audio device, as found on some iBook and PowerBook models.
this driver was written by Tsubai Masanari and further hacked on by Jared D. McNeill to work on his iBook.
the driver is limited (master volume control only, and I haven't tested recording) but has been functioning perfectly on my PowerBook g4 DVI (ivory) for some time.
ok'd by matt.
|
1.1.4.5 |
| 10-Nov-2005 |
skrll | Sync with HEAD. Here we go again...
|
1.1.4.4 |
| 21-Sep-2004 |
skrll | Fix the sync with head I botched.
|
1.1.4.3 |
| 18-Sep-2004 |
skrll | Sync with HEAD.
|
1.1.4.2 |
| 03-Aug-2004 |
skrll | Sync with HEAD
|
1.1.4.1 |
| 27-Dec-2003 |
skrll | file ki2c.c was added on branch ktrace-lwp on 2004-08-03 10:37:21 +0000
|
1.2.2.4 |
| 07-Dec-2007 |
yamt | sync with head
|
1.2.2.3 |
| 27-Oct-2007 |
yamt | sync with head.
|
1.2.2.2 |
| 30-Dec-2006 |
yamt | sync with head.
|
1.2.2.1 |
| 21-Jun-2006 |
yamt | sync with head.
|
1.6.16.1 |
| 13-Jul-2006 |
gdamore | Merge from HEAD.
|
1.6.8.1 |
| 11-Aug-2006 |
yamt | sync with head
|
1.6.4.1 |
| 09-Sep-2006 |
rpaulo | sync with head
|
1.8.36.2 |
| 18-Oct-2007 |
yamt | sync with head.
|
1.8.36.1 |
| 06-Oct-2007 |
yamt | sync with head.
|
1.8.34.2 |
| 09-Jan-2008 |
matt | sync with HEAD
|
1.8.34.1 |
| 06-Nov-2007 |
matt | sync with HEAD
|
1.8.32.3 |
| 09-Dec-2007 |
jmcneill | Sync with HEAD.
|
1.8.32.2 |
| 26-Oct-2007 |
joerg | Sync with HEAD.
Follow the merge of pmap.c on i386 and amd64 and move pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup code to restore CR4 before jumping back into kernel space as the large page option might cover that.
|
1.8.32.1 |
| 02-Oct-2007 |
joerg | Sync with HEAD.
|
1.8.22.2 |
| 03-Oct-2007 |
garbled | Sync with HEAD
|
1.8.22.1 |
| 27-Sep-2007 |
macallan | use CFATTACH_DECL()
|
1.8.18.1 |
| 09-Dec-2007 |
reinoud | Pullup to HEAD
|
1.8.14.2 |
| 23-Oct-2007 |
ad | Sync with head.
|
1.8.14.1 |
| 09-Oct-2007 |
ad | Sync with head.
|
1.9.2.1 |
| 25-Oct-2007 |
bouyer | Sync with HEAD.
|
1.10.4.1 |
| 08-Dec-2007 |
ad | Sync with head.
|
1.10.2.1 |
| 08-Dec-2007 |
mjf | Sync with HEAD.
|
1.11.24.2 |
| 28-Apr-2009 |
skrll | Sync with HEAD.
|
1.11.24.1 |
| 03-Mar-2009 |
skrll | Sync with HEAD.
|
1.11.16.1 |
| 04-May-2009 |
yamt | sync with head.
|
1.12.2.1 |
| 13-May-2009 |
jym | Sync with HEAD.
Commit is split, to avoid a "too many arguments" protocol error.
|
1.15.4.1 |
| 05-Mar-2011 |
rmind | sync with head
|
1.16.6.1 |
| 23-Jun-2011 |
cherry | Catchup with rmind-uvmplock merge.
|
1.18.30.1 |
| 19-Mar-2016 |
skrll | Sync with HEAD
|
1.18.12.1 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|
1.24.2.1 |
| 15-Mar-2018 |
pgoyette | Synch with HEAD
|
1.25.2.1 |
| 13-Apr-2020 |
martin | Mostly merge changes from HEAD upto 20200411
|
1.27.2.1 |
| 17-Jan-2020 |
ad | Sync with head.
|
1.30.4.1 |
| 23-Mar-2021 |
thorpej | Convert config_found_ia() call sites where the device only carries a single interface attribute to bare config_found() calls.
|
1.31.8.1 |
| 04-Aug-2021 |
thorpej | Adapt to CFARGS().
|
1.31.2.2 |
| 14-May-2021 |
thorpej | Move the bus/channel number for multi-channel / mux controllers out of i2cbus_attach_args and stash it in the i2c_tag_t instead. This makes it accessible to platform device tree code when enumerating devices.
|
1.31.2.1 |
| 08-May-2021 |
thorpej | Adapt the Keywest i2c controller driver to the new i2c device enumeration mechanism. We need to provide our own enumeration callback because these controllers do not use the standard OpenFirmware bindings.
The Keywest controller supports 2 physical i2c busses on a single controller, so we logically split it up that way now, rather than encoding the channel in in the i2c address as was done previously.
Different systems have different I2C device tree topologies.
Some systems use a scheme like this:
/u3@0,f8000000/i2c@f8001000/temp-monitor@98 /u3@0,f8000000/i2c@f8001000/fan@15e
Here, we see the channel encoded in bit #8 of the address.
Other systems use a scheme like this:
/ht@0,f2000000/pci@4000,0,0/mac-io@7/i2c@18000/i2c-bus@0 /ht@0,f2000000/pci@4000,0,0/mac-io@7/i2c@18000/i2c-bus@0/codec@8c
/u4@0,f8000000/i2c@f8001000/i2c-bus@1 /u4@0,f8000000/i2c@f8001000/i2c-bus@1/temp-monitor@94
Here, a separate device tree node represents the channel. Note that in BOTH cases, the I2C address of the devices are shifted left by 1 (as it would be on the wire to leave room for the read/write bit).
|
1.32.2.4 |
| 11-Sep-2021 |
thorpej | Add a devhandle_subclass() helper function to simplify the common case and use it. Improve some comments.
|
1.32.2.3 |
| 11-Sep-2021 |
thorpej | Fix a memory leak if the "compatible" property is > 32 bytes.
|
1.32.2.2 |
| 10-Sep-2021 |
thorpej | Remove unnecessary references to i2c_attach_args::ia_prop and mark the ones that remain as XXX.
|
1.32.2.1 |
| 09-Aug-2021 |
thorpej | Port over the changes from thorpej-i2c-spi-conf to thorpej-i2c-spi-conf2, which is based on a newer HEAD revision.
|
1.33.10.1 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|