From: Sagi Maimon <maimon.sagi@gmail.com>
To: netdev@vger.kernel.org
Cc: vadim.fedorenko@linux.dev, richardcochran@gmail.com,
kuba@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com,
linux-kernel@vger.kernel.org, Sagi Maimon <maimon.sagi@gmail.com>
Subject: [PATCH net-next v13 0/2] ptp: ocp: add TAP CPLD support for ADVA TimeCard X1
Date: Tue, 8 Sep 2026 15:23:26 +0300 [thread overview]
Message-ID: <20260908122328.52641-1-maimon.sagi@gmail.com> (raw)
The ADVA TimeCard X1 (PCI device 0x0410) carries a Lattice MachXO3 CPLD
on the TMC I2C bus. This series adds access to it and an update path
through the kernel firmware-upload subsystem.
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 on-card 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. Everything here is built on that handshake.
Patch 1 adds the arbitration and the read-only interfaces on top of it.
Patch 2 adds the flashing.
v12: https://lore.kernel.org/netdev/20260902044232.21188-1-maimon.sagi@gmail.com/T/#u
Changes since v12 - all from the automated review of v12:
- The CPLD device ID is no longer read from ptp_ocp_devlink_info_get().
DEVLINK_CMD_INFO_GET carries no GENL_ADMIN_PERM, and that read claims
the i2c adapter and drives the on-card mux for up to two seconds,
which any user could have repeated to keep the EEPROM, nvmem and at24
paths off the controller. The same operation is root-only through
cpld_status. The driver now reads the ID once from its own worker,
as soon as the i2c adapter has registered, and info_get() reports the
cached value. Patch 1.
- As a result info_get() can no longer fail because of the CPLD: it
skips cpld.id when the value is not available. Returning an error
there made devlink discard the whole reply, and -ENODEV was reachable
on any card where the i2c adapter never bound, which also aborted
'devlink dev info' for every other instance on the host. Patch 1.
- cpld.id is now reported before the EEPROM data rather than after its
early return, so it no longer depends on the EEPROM having been read.
Patch 1.
- adva_x1_bus_claim() re-checks that the adapter it just took a
reference to is still this card's: i2c_del_adapter() frees the idr
slot before the bus notifier clears the cached number, so the number
could already have been recycled. Patch 1.
- The probe error paths unregister devlink before ptp_ocp_detach(),
which destroys cpld_lock and releases the i2c controller. Patch 1.
- I2C_M_DMA_SAFE is no longer set. No adapter that can bind here does
DMA, and the read half of the scratch buffer is an interior pointer
that does not satisfy the flag's alignment contract; the core is left
free to bounce. Patch 1.
- The firmware-upload callbacks map errnos onto the documented
fw_upload_err categories: -ENODEV and a failed transfer are no longer
reported as a timeout, and a CPLD FAILED status is no longer reported
as one either. Patch 2.
- adva_cpld_prepare() checks for a cancellation on entry, as its own
comment promised, instead of cycling the CPLD into configuration mode
for an upload that was already aborted. Patch 2.
- Added Documentation/networking/devlink/ptp_ocp.rst describing the
driver-specific cpld.id version, with the index and MAINTAINERS
entries. Patch 1.
- Comments in patch 1 no longer describe the firmware-upload path that
only patch 2 adds, and the lines that exceeded 80 columns are wrapped.
Three points from that review are deliberately not addressed here,
because changing them needs a full programming cycle on the card to
validate and I would rather not fold untested changes into a respin:
- poll_complete() samples DONE before REFRESH only, and does not check
the sysCONFIG error field the way drivers/fpga/lattice-sysconfig.c
does.
- adva_x1_mblaze_release() does not wait for the firmware to route the
controller back before the adapter lock is dropped.
- A cancel arriving between cleanup() and fw_upload_prog_complete()
stays set and aborts the next upload.
Tested on an ADVA TimeCard X1: the driver loads with the i2c adapter
registering after probe, cpld.id and cpld_status read back correctly,
and the wire byte sequences are unchanged from v12, which programmed the
part successfully.
Sagi Maimon (2):
ptp: ocp: add TAP CPLD access for ADVA TimeCard X1
ptp: ocp: add TAP CPLD firmware upload for ADVA TimeCard X1
Documentation/ABI/testing/sysfs-timecard | 24 +
Documentation/networking/devlink/index.rst | 1 +
Documentation/networking/devlink/ptp_ocp.rst | 35 +
MAINTAINERS | 1 +
drivers/ptp/Kconfig | 2 +
drivers/ptp/ptp_ocp.c | 761 ++++++++++++++++++-
6 files changed, 818 insertions(+), 6 deletions(-)
create mode 100644 Documentation/networking/devlink/ptp_ocp.rst
base-commit: c29b37ed7a4d9856ed758a82282456d69cee2ed1
--
2.47.0
next reply other threads:[~2026-09-08 12:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 12:23 Sagi Maimon [this message]
2026-09-08 12:23 ` [PATCH net-next v13 1/2] ptp: ocp: add TAP CPLD access " Sagi Maimon
2026-09-10 15:23 ` netdev-bot+sashiko
2026-09-11 23:52 ` Jakub Kicinski
2026-09-08 12:23 ` [PATCH net-next v13 2/2] ptp: ocp: add TAP CPLD firmware upload " Sagi Maimon
2026-09-10 15:23 ` netdev-bot+sashiko
2026-09-11 23:51 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260908122328.52641-1-maimon.sagi@gmail.com \
--to=maimon.sagi@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=vadim.fedorenko@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®