comodore-iec-emu/kernel/dts/iec-overlay.dts
Christian Werner b2e4f9710d
All checks were successful
Build kernel module / build (1:6.12.93-1+rpt1, bookworm) (pull_request) Successful in 1m1s
Build kernel module / build (1:6.18.34-1+rpt1, trixie) (pull_request) Successful in 1m8s
Build kernel module / package (pull_request) Successful in 29s
Build kernel module / release (pull_request) Has been skipped
refactor(kernel): align GPIO pin layout with the reference listener
Adopt the confirmed-working reference's pin assignment so the module runs
on that proven wiring: DATA=BCM2 (pin 3), CLK=BCM3 (pin 5), ATN=BCM4
(pin 7). RESET is kept and relocated to BCM17 (pin 11), the pin freed by
moving CLK. All five GPIOs stay in bank 0, so the direct-register hot
path and ATN IRQ are unchanged -- only the IEC_GPIO_* defines, the
device-tree overlay, and the docs/self-test move.

DATA/CLK now sit on the ARM I2C pins (GPIO2/3) with the SoC's fixed
~1.8k pull-ups; keep dtparam=i2c_arm off. The bare-board self-test
expectation changes from 0x15 to 0x0b accordingly.

Generated by Clanker
2026-06-20 16:09:10 +02:00

45 lines
1.5 KiB
Plaintext

/*
* iec-overlay.dts - pin reservation + pull configuration for the IEC listener.
*
* GPIO 4 = ATN (input, pull-up: bus idle = 5 V = high)
* GPIO 3 = CLK (input, pull-up)
* GPIO 17 = RESET (input, pull-up)
* GPIO 2 = DATA (bidirectional; starts as input/Hi-Z, the module flips it)
*
* NOTE: DATA (GPIO2) and CLK (GPIO3) are the ARM I2C pins and carry the SoC's
* fixed ~1.8 kOhm pull-ups, which the overlay's pull settings cannot fully
* override. Benign here (DATA is open-drain). Keep dtparam=i2c_arm OFF so I2C
* does not claim these pins.
*
* The module drives GPIO via direct registers, so this overlay's main job is to
* reserve the pins and set sane pull defaults. Build & install:
* dtc -@ -I dts -O dtb -o iec-overlay.dtbo iec-overlay.dts
* sudo cp iec-overlay.dtbo /boot/firmware/overlays/ # Bookworm path
* echo "dtoverlay=iec-overlay" | sudo tee -a /boot/firmware/config.txt
* # reboot, then: dtoverlay -l
*
* See _research/pi-kernel-module-rt-gpio-2026-06-18.md §4.1.
*/
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2837";
fragment@0 {
target = <&gpio>;
__overlay__ {
iec_input_pins: iec_input_pins {
brcm,pins = <4 3 17>; /* ATN, CLK, RESET */
brcm,function = <0>; /* 0 = input */
brcm,pull = <2>; /* 2 = pull-up */
};
iec_data_pin: iec_data_pin {
brcm,pins = <2>; /* DATA */
brcm,function = <0>; /* start as input (Hi-Z) */
brcm,pull = <0>; /* 0 = none (shifter drives) */
};
};
};
};