mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-11-10 20:48:12 +00:00
ptp: ocp: add TAP CPLD access for ADVA TimeCard X1
The ADVA TimeCard X1 carries a Lattice MachXO3 CPLD on its TMC I2C bus. Reaching it means taking that bus from the on-card MicroBlaze first. The card has two I2C controllers. Linux registers only the one at 0x00150000, normally routed to the config EEPROMs; the one at 0x00120000 belongs to the MicroBlaze and is routed to the TMC or M.2 bus as its firmware selects. A request/grant handshake re-routes the host controller onto the TMC bus, where the PCA9548 and the CPLD behind its channel 0 live. An operation takes the i2c core adapter lock for the whole grant window and uses __i2c_transfer() internally; without that, a concurrent transfer from ptp_ocp_read_eeprom(), from the nvmem attributes or from the at24 sysfs files would be issued onto the TMC bus instead of to the EEPROM. The hand-back waits for the firmware to drop the grant before the adapter lock is released, for the same reason. On top of the arbitration this adds two read-only interfaces: a root-only cpld_status attribute reporting the flags in the CPLD status register, and the Lattice device ID as the fixed devlink version cpld.id. Reading the ID claims the bus, so it must not sit on DEVLINK_CMD_INFO_GET, which carries no GENL_ADMIN_PERM; the driver reads it once from its own worker, as soon as the i2c adapter has registered, and info_get() reports the cached value. Signed-off-by: Sagi Maimon <maimon.sagi@gmail.com> Link: https://patch.msgid.link/20260916153242.157171-4-sagi.maimon@adtran.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
65ca1f70c4
commit
3b815e2996
5 changed files with 571 additions and 4 deletions
Loading…
Add table
Add a link
Reference in a new issue