Skip to contentSkip to conversation

ptp: ocp: add CPLD ISP support for ADVA TimeCard X1

PATCH Superseded Sagi Maimon 2 participants 2 messages Aug 3 – Aug 4

Subsystems (4)

v9 of 15 Superseded Latest is v15 →

lore
Share & tools
lore
#0 lore raw

PATCH v9 1/1 ptp: ocp: add CPLD ISP support for ADVA TimeCard X1

The ADVA TimeCard X1 (PCI device 0x0410) uses a Lattice MachXO3 CPLD that is programmed over I2C using in-system programming (ISP).

The CPLD is connected to a secondary I2C bus shared with the onboard MicroBlaze soft CPU.

Add support for CPLD access and firmware updates on the ADVA TimeCard X1 board by arbitration of the shared I2C bus, CPLD ISP command handling, status polling, and firmware upload operations using the firmware-upload subsystem.

Add the following X1-only user-visible interfaces:

/sys/class/timecard/ocpN/cpld_device_id
report the 32-bit Lattice MachXO3 CPLD device ID

/sys/class/timecard/ocpN/cpld_status
report the CPLD status register, including the DONE, BUSY, and FAILED indicators

Firmware updates are performed through the firmware-upload framework, which acquires ownership of the shared I2C bus, erases the CPLD configuration flash, programs the image page-by-page, and activates the new image using the MachXO3 REFRESH command.

All CPLD operations are serialized and coordinated with the MicroBlaze firmware to ensure exclusive access to the shared I2C bus. The added interfaces are available only on ADVA TimeCard X1 boards.

---

Changes since v8:
- Use dedicated MicroBlaze handshake values instead of 0xffffffff, which may be returned by failed PCI reads.

 Documentation/ABI/testing/sysfs-timecard |  34 ++
 drivers/ptp/ptp_ocp.c                    | 498 ++++++++++++++++++++++-
 2 files changed, 528 insertions(+), 4 deletions(-)
Documentation/ABI/testing/sysfs-timecard +34 -0
index 3ae41b7634ac..f7c9955acb0a 100644
@@ -11,6 +11,40 @@ Contact:	Jonathan Lemon <[email protected]>
 Description:	This directory contains the attributes of the Nth timecard
 		registered.
 
+What:		/sys/class/timecard/ocpN/cpld_device_id
+Date:		July 2026
+Contact:	Sagi Maimon <[email protected]>
+Description:	(RO) The 32-bit Lattice device ID of the TAP CPLD, reported as
+		a hex string, e.g. "0xe12bc043".
+
+		Only present on ADVA x1 TAP boards (PCI ID 0xad5a:0x0410).
+		The Lattice LCMXO3LF-210 reports 0xe12bc043.
+
+		The driver acquires the MicroBlaze I2C bus internally before
+		issuing the READ_IDCODE command; no bus arbitration is required
+		from userspace.
+
+What:		/sys/class/timecard/ocpN/cpld_status
+Date:		July 2026
+Contact:	Sagi Maimon <[email protected]>
+Description:	(RO) The status register of the TAP CPLD, in human-readable
+		form:
+
+		  done=<0|1> busy=<0|1> failed=<0|1>
+
+		Only present on ADVA x1 TAP boards (PCI ID 0xad5a:0x0410).
+
+		done=1 indicates the configuration flash was successfully
+		programmed and is active.  busy=1 means an internal operation
+		is in progress.  failed=1 means the last ISC operation failed.
+
+		The driver acquires the MicroBlaze I2C bus internally; no bus
+		arbitration is required from userspace.
+
+		To program new CPLD firmware use the standard kernel
+		firmware-upload interface registered at:
+		/sys/class/firmware/adva-cpld/
+
 What:		/sys/class/timecard/ocpN/available_clock_sources
 Date:		September 2021
 Contact:	Jonathan Lemon <[email protected]>
drivers/ptp/ptp_ocp.c +494 -4

572 lines not on this page · raw message

Signature · 1 line
2.47.0
maintainer
#1 lore raw
Quoted 29 lines · Sagi Maimon

The ADVA TimeCard X1 (PCI device 0x0410) uses a Lattice MachXO3 CPLD that is programmed over I2C using in-system programming (ISP).

The CPLD is connected to a secondary I2C bus shared with the onboard MicroBlaze soft CPU.

Add support for CPLD access and firmware updates on the ADVA TimeCard X1 board by arbitration of the shared I2C bus, CPLD ISP command handling, status polling, and firmware upload operations using the firmware-upload subsystem.

Add the following X1-only user-visible interfaces:

/sys/class/timecard/ocpN/cpld_device_id
report the 32-bit Lattice MachXO3 CPLD device ID

/sys/class/timecard/ocpN/cpld_status
report the CPLD status register, including the DONE, BUSY, and FAILED indicators

Firmware updates are performed through the firmware-upload framework, which acquires ownership of the shared I2C bus, erases the CPLD configuration flash, programs the image page-by-page, and activates the new image using the MachXO3 REFRESH command.

All CPLD operations are serialized and coordinated with the MicroBlaze firmware to ensure exclusive access to the shared I2C bus. The added interfaces are available only on ADVA TimeCard X1 boards.

Quoted 6 lines

---

Changes since v8:
- Use dedicated MicroBlaze handshake values instead of 0xffffffff, which may be returned by failed PCI reads.

Please, combine it with comments on v8

--
pw-bot: cr