Hello,
On Sun, 28 Sep 2025 11:32:23 +0000
"Jason R Thorpe" <thorpej%netbsd.org@localhost> wrote:
Module Name:	src
Committed By:	thorpej
Date:		Sun Sep 28 11:32:23 UTC 2025
Modified Files:
	src/sys/arch/macppc/dev: ki2c.c
Log Message:
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.
It's depressingly common, my 11,2 has this:
ff994c50: /ht@0,f2000000/pci@4000,0,0/mac-io@7/i2c@18000/i2c-bus@0
#address-cells          00000001 ........ ........ ........     1
#size-cells             00000000 ........ ........ ........     0
built-in
compatible              6932632d 62757300 ........ ........   "i2c-bus"
             0008:       6b657977 6573742d 6932632d 62757300   "keywest-i2c-bus"
             0018:       00...... ........ ........ ........   ""
device_type             6932632d 62757300 ........ ........   "i2c-bus"
name                    6932632d 62757300 ........ ........   "i2c-bus"
reg                     00000000 ........ ........ ........   ....
--------------------------------------------------------------------------------
ff994e18: /ht@0,f2000000/pci@4000,0,0/mac-io@7/i2c@18000/i2c-bus@0/codec@8c
built-in
compatible              70636d33 30353200 ........ ........   "pcm3052"
             0008:       636f6465 6300.... ........ ........   "codec"
             000e:       00...... ........ ........ ........   ""
device_type             636f6465 6300.... ........ ........   "codec"
name                    636f6465 6300.... ........ ........   "codec"
platform-do-onyx-codec-ref
                         ff995740 08000000 00000027 ........   ..W@.......'
reg                     0000008c ........ ........ ........   ....
--------------------------------------------------------------------------------
ff994f50: /ht@0,f2000000/pci@4000,0,0/mac-io@7/i2c@18000/i2c-bus@0/codec@24
built-in
compatible              63733834 313600.. ........ ........   "cs8416"
             0007:       636f6465 6300.... ........ ........   "codec"
             000d:       00...... ........ ........ ........   ""
device_type             636f6465 6300.... ........ ........   "codec"
name                    636f6465 6300.... ........ ........   "codec"
platform-do-topaz-codec-ref
                         ff995a88 08000000 00000027 ........   ..Z........'
reg                     00000024 ........ ........ ........   ...$
--------------------------------------------------------------------------------
ff995088: /ht@0,f2000000/pci@4000,0,0/mac-io@7/i2c@18000/i2c-bus@0
#address-cells          00000001 ........ ........ ........     1
#size-cells             00000000 ........ ........ ........     0
built-in
compatible              6932632d 62757300 ........ ........   "i2c-bus"
             0008:       6b657977 6573742d 6932632d 62757300   "keywest-i2c-bus"
             0018:       00...... ........ ........ ........   ""
device_type             6932632d 62757300 ........ ........   "i2c-bus"
name                    6932632d 62757300 ........ ........   "i2c-bus"
reg                     00000000 ........ ........ ........   ....
--------------------------------------------------------------------------------
ff995250: /ht@0,f2000000/pci@4000,0,0/mac-io@7/i2c@18000/i2c-bus@0/codec@8c
built-in
compatible              70636d33 30353200 ........ ........   "pcm3052"
             0008:       636f6465 6300.... ........ ........   "codec"
             000e:       00...... ........ ........ ........   ""
device_type             636f6465 6300.... ........ ........   "codec"
name                    636f6465 6300.... ........ ........   "codec"
reg                     0000008c ........ ........ ........   ....
note that the 2nd i2c-bus@0 node only has one codec. I wouldn't bet on
the good node always being the first either.