Skip to contentSkip to conversation

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

PATCH Superseded Sagi Maimon 5 participants 8 messages Jul 23 – Aug 17

Subsystems (4)

v6 of 15 Superseded Latest is v15 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 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 taking ownership of this bus and exposing the required interfaces through sysfs, allowing userspace tools to perform CPLD programming.

To limit the scope of this functionality, sysfs-based I2C access is restricted to the ADVA TimeCard X1 variant and only for the two I2C slave addresses used during ISP (0x40 CPLD, 0x74 mux).

Add two sysfs attributes under /sys/class/timecard/ocpN/ (x1 only):

i2c_bus_ctrl - arbitrate the shared I2C bus from the MicroBlaze via
a three-step read/write/poll handshake

cpld_i2c_xfer - binary passthrough for I2C transactions to the CPLD
and its PCA9548 mux; one atomic request per write()

---

Addressed comments from:
- Jakub Kicinski :https://lore.kernel.org/all/[email protected]/

Changes since v5:
- ptp_ocp.c: move mutex_init(&bp->tap_i2c_lock) and bp->tap_i2c_adap_nr = -1 to before the first error path that reaches ptp_ocp_detach(), so mutex_destroy() never operates on an uninitialised mutex (CONFIG_DEBUG_MUTEXES splat on the pci_alloc_irq_vectors() failure path).
- ptp_ocp.c: reword the ordering comment above mutex_init / tap_i2c_adap_nr to correctly describe the notifier race: the -1 sentinel must precede ptp_ocp_register_resources() so that a ptp_ocp_i2c_notifier_call() firing during adapter registration is not overwritten by this initialisation line; ptp_ocp_adva_board_init() does not touch tap_i2c_adap_nr and was wrongly cited in the previous wording.
- Documentation/ABI/testing/sysfs-timecard: add entries for the two new attributes cpld_i2c_xfer (binary I2C pass-through, wire protocol, allowed addresses, response layout) and i2c_bus_ctrl (three-step handshake, magic values, release requirement, PCIe ordering note).

 Documentation/ABI/testing/sysfs-timecard |  56 ++++++
 drivers/ptp/ptp_ocp.c                    | 239 ++++++++++++++++++++++-
 2 files changed, 290 insertions(+), 5 deletions(-)
Documentation/ABI/testing/sysfs-timecard +56 -0
index 3ae41b7634ac..c62766df7a20 100644
@@ -11,6 +11,62 @@ Contact:	Jonathan Lemon <[email protected]>
 Description:	This directory contains the attributes of the Nth timecard
 		registered.
 
+What:		/sys/class/timecard/ocpN/cpld_i2c_xfer
+Date:		July 2026
+Contact:	Sagi Maimon <[email protected]>
+Description:	(RW) Binary sysfs attribute providing a raw I2C passthrough to
+		the CPLD and I2C mux on ADVA x1 TAP boards.  Only present on
+		that board variant.
+
+		Each write initiates one I2C transaction.  The write payload
+		must be exactly four header bytes followed by the write data:
+
+		  Byte 0: slave address (only 0x40 and 0x74 are permitted)
+		  Byte 1: number of bytes to write (0..67)
+		  Byte 2: number of bytes to read back (0..20)
+		  Byte 3: flags
+		            bit 0 - suppress the repeated START before the
+		                    read segment (I2C_M_NOSTART); only valid
+		                    when both write and read lengths are
+		                    non-zero
+		  Bytes 4..: write data (write_len bytes)
+
+		A subsequent read() returns:
+
+		  Byte 0: status (0 = success, positive errno on error)
+		  Bytes 1..: read data (read_len bytes), present only when
+		             status is 0 and read_len > 0
+
+		The write and read portions of the sysfs file share a single
+		per-device response buffer protected by a mutex; a single
+		open() / write() / read() sequence must be used to avoid
+		data races between concurrent users.
+
+		Only slave addresses 0x40 (Lattice CPLD) and 0x74 (PCA9548
+		I2C mux) are accepted; all others return EPERM.
+
+What:		/sys/class/timecard/ocpN/i2c_bus_ctrl
+Date:		July 2026
+Contact:	Sagi Maimon <[email protected]>
+Description:	(RW) Exposes the MicroBlaze I2C bus arbitration register for
+		the shared I2C bus on ADVA x1 and x2 TAP boards.  Only
+		present when the board has a pps_select register block.
+
+		Userspace must complete a three-step handshake before
+		driving the bus:
+
+		  1. Read  - value must be 0x00000000 (bus is free).
+		  2. Write - 0x0000ffff (request ownership).
+		  3. Poll  - read until the value is 0xffffffff (MicroBlaze
+		             has acknowledged the handover).
+
+		After all I2C traffic is complete the bus must be released
+		by writing 0x00000000.
+
+		The poll read is a PCIe non-posted read and therefore also
+		flushes the preceding posted write to the FPGA; no
+		additional read-back is required for ordering.
+
 What:		/sys/class/timecard/ocpN/available_clock_sources
 Date:		September 2021
 Contact:	Jonathan Lemon <[email protected]>
drivers/ptp/ptp_ocp.c +234 -5

287 lines not on this page · raw message

Signature · 1 line
2.47.0
maintainer
#1 lore raw
Quoted 130 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 taking ownership of this bus and exposing the required interfaces through sysfs, allowing userspace tools to perform CPLD programming.

To limit the scope of this functionality, sysfs-based I2C access is restricted to the ADVA TimeCard X1 variant and only for the two I2C slave addresses used during ISP (0x40 CPLD, 0x74 mux).

Add two sysfs attributes under /sys/class/timecard/ocpN/ (x1 only):

i2c_bus_ctrl - arbitrate the shared I2C bus from the MicroBlaze via
a three-step read/write/poll handshake

cpld_i2c_xfer - binary passthrough for I2C transactions to the CPLD
and its PCA9548 mux; one atomic request per write()

---

Addressed comments from:
- Jakub Kicinski :https://lore.kernel.org/all/[email protected]/

Changes since v5:
- ptp_ocp.c: move mutex_init(&bp->tap_i2c_lock) and bp->tap_i2c_adap_nr = -1 to before the first error path that reaches ptp_ocp_detach(), so mutex_destroy() never operates on an uninitialised mutex (CONFIG_DEBUG_MUTEXES splat on the pci_alloc_irq_vectors() failure path).
- ptp_ocp.c: reword the ordering comment above mutex_init / tap_i2c_adap_nr to correctly describe the notifier race: the -1 sentinel must precede ptp_ocp_register_resources() so that a ptp_ocp_i2c_notifier_call() firing during adapter registration is not overwritten by this initialisation line; ptp_ocp_adva_board_init() does not touch tap_i2c_adap_nr and was wrongly cited in the previous wording.
- Documentation/ABI/testing/sysfs-timecard: add entries for the two new attributes cpld_i2c_xfer (binary I2C pass-through, wire protocol, allowed addresses, response layout) and i2c_bus_ctrl (three-step handshake, magic values, release requirement, PCIe ordering note).

  Documentation/ABI/testing/sysfs-timecard |  56 ++++++
  drivers/ptp/ptp_ocp.c                    | 239 ++++++++++++++++++++++-
  2 files changed, 290 insertions(+), 5 deletions(-)
Documentation/ABI/testing/sysfs-timecard +56 -0
index 3ae41b7634ac..c62766df7a20 100644
@@ -11,6 +11,62 @@ Contact:	Jonathan Lemon <[email protected]>
  Description:	This directory contains the attributes of the Nth timecard
  		registered.
 
+What:		/sys/class/timecard/ocpN/cpld_i2c_xfer
+Date:		July 2026
+Contact:	Sagi Maimon <[email protected]>
+Description:	(RW) Binary sysfs attribute providing a raw I2C passthrough to
+		the CPLD and I2C mux on ADVA x1 TAP boards.  Only present on
+		that board variant.
+
+		Each write initiates one I2C transaction.  The write payload
+		must be exactly four header bytes followed by the write data:
+
+		  Byte 0: slave address (only 0x40 and 0x74 are permitted)
+		  Byte 1: number of bytes to write (0..67)
+		  Byte 2: number of bytes to read back (0..20)
+		  Byte 3: flags
+		            bit 0 - suppress the repeated START before the
+		                    read segment (I2C_M_NOSTART); only valid
+		                    when both write and read lengths are
+		                    non-zero
+		  Bytes 4..: write data (write_len bytes)
+
+		A subsequent read() returns:
+
+		  Byte 0: status (0 = success, positive errno on error)
+		  Bytes 1..: read data (read_len bytes), present only when
+		             status is 0 and read_len > 0
+
+		The write and read portions of the sysfs file share a single
+		per-device response buffer protected by a mutex; a single
+		open() / write() / read() sequence must be used to avoid
+		data races between concurrent users.
+
+		Only slave addresses 0x40 (Lattice CPLD) and 0x74 (PCA9548
+		I2C mux) are accepted; all others return EPERM.
+
+What:		/sys/class/timecard/ocpN/i2c_bus_ctrl
+Date:		July 2026
+Contact:	Sagi Maimon <[email protected]>
+Description:	(RW) Exposes the MicroBlaze I2C bus arbitration register for
+		the shared I2C bus on ADVA x1 and x2 TAP boards.  Only
+		present when the board has a pps_select register block.
+
+		Userspace must complete a three-step handshake before
+		driving the bus:
+
+		  1. Read  - value must be 0x00000000 (bus is free).
+		  2. Write - 0x0000ffff (request ownership).
+		  3. Poll  - read until the value is 0xffffffff (MicroBlaze
+		             has acknowledged the handover).
+
+		After all I2C traffic is complete the bus must be released
+		by writing 0x00000000.
+
+		The poll read is a PCIe non-posted read and therefore also
+		flushes the preceding posted write to the FPGA; no
+		additional read-back is required for ordering.
+
  What:		/sys/class/timecard/ocpN/available_clock_sources
  Date:		September 2021
  Contact:	Jonathan Lemon <[email protected]>
drivers/ptp/ptp_ocp.c +2 -1
index 35e911f1ad78..79fec5161c99 100644
@@ -163,7 +163,8 @@ struct gpio_reg {
  	u32	gpio1;
  	u32	__pad0;
  	u32	gpio2;
-	u32	__pad1;
+	/* adva_x1: I2C bus ownership register; reserved on other variants */
+	u32	i2c_bus_ctrl;
  };
 
  struct irig_master_reg {

drivers/ptp/ptp_ocp.c struct ptp_ocp { · line 423

Quoted 7 lines
drivers/ptp/ptp_ocp.c +4 -0
@@ -416,6 +417,11 @@ struct ptp_ocp {
  	dpll_tracker tracker;
  	int signals_nr;
  	int freq_in_nr;
+	/* cpld_i2c_xfer sysfs (adva_x1) */
+	struct mutex		tap_i2c_lock;
+	int			tap_i2c_adap_nr; /* adapter nr; -1 if absent */
+	u8			tap_i2c_rsp[21]; /* [status, read_data...] */

I don't like the idea of having a buffer in a global structure. And it doesn't look like you can actually serialize access. Imaging 2 processes manipulating this i2c bus. I can be that mutex will put them like:

1. process1 -> write cmd
2. process2 -> write cmd
3. process1 -> read result

That means the data will be a mess.

That's why it is a really bad thing to allow direct access from the user space. Is it possible to add a property per command?

Quoted 3 lines
drivers/ptp/ptp_ocp.c +1 -0
+	size_t			tap_i2c_rsp_len;
  };
 

[...]

maintainer
#2 lore raw
Quoted 4 lines · On Mon, 27 Jul 2026 12:02:53 +0100 Vadim Fedorenko wrote:

I don't like the idea of having a buffer in a global structure. And it doesn't look like you can actually serialize access. Imaging 2 processes manipulating this i2c bus. I can be that mutex will put them like:

Quoted 8 lines

1. process1 -> write cmd
2. process2 -> write cmd
3. process1 -> read result

That means the data will be a mess.

That's why it is a really bad thing to allow direct access from the user space. Is it possible to add a property per command?

At a glance - adding I2C support via 2 magic files in sysfs is rather odd. Either expose a real i2c bus or make the driver sends the appropriate commands. We are opposed to raw device write interfaces in netdev.

#3 lore raw

Thanks for the feedback.

My initial implementation actually exposed a real I2C bus to user space. However, following Vadim Fedorenko's review comments:

https://lore.kernel.org/all/[email protected]/

I changed the design and switched to a sysfs-based interface for the ADVA device only.

From your comment, it sounds like neither of these approaches is acceptable in its current form. Could you please clarify what implementation you would consider appropriate for this use case?

Specifically, would you prefer:

exposing a proper I2C adapter/bus to user space, or implementing the required device operations directly in the driver and exposing only higher-level controls?

I'd like to understand the expected direction before respinning the patch.

Quoted 19 lines · Jakub Kicinski
Quoted 4 lines · On Mon, 27 Jul 2026 12:02:53 +0100 Vadim Fedorenko wrote:

I don't like the idea of having a buffer in a global structure. And it doesn't look like you can actually serialize access. Imaging 2 processes manipulating this i2c bus. I can be that mutex will put them like:

Quoted 8 lines

1. process1 -> write cmd
2. process2 -> write cmd
3. process1 -> read result

That means the data will be a mess.

That's why it is a really bad thing to allow direct access from the user space. Is it possible to add a property per command?

At a glance - adding I2C support via 2 magic files in sysfs is rather odd. Either expose a real i2c bus or make the driver sends the appropriate commands. We are opposed to raw device write interfaces in netdev.

maintainer
#4 lore raw
Quoted 14 lines · On Tue, 28 Jul 2026 09:09:33 +0300 Sagi Maimon wrote:

Thanks for the feedback.

My initial implementation actually exposed a real I2C bus to user space. However, following Vadim Fedorenko's review comments:

https://lore.kernel.org/all/[email protected]/

I changed the design and switched to a sysfs-based interface for the ADVA device only.

From your comment, it sounds like neither of these approaches is acceptable in its current form. Could you please clarify what implementation you would consider appropriate for this use case?

Quoted 7 lines

Specifically, would you prefer:

exposing a proper I2C adapter/bus to user space, or implementing the required device operations directly in the driver and exposing only higher-level controls?

I'd like to understand the expected direction before respinning the patch.

Reminder: please don't top post.

I'm not sure what hangs on that bus. The commit message seemed to go into the topology but not into the "why" of the patch.

Assuming this is a fixed function bus within the device sysfs attributes dedicated to what the user wants to do are likely best. Again, hard to say for sure since I don't know what sits on that bus.

Exposing what is effectively raw write over a custom attribute is the worst possible choice. Neither does it use the standard i2c infra, nor does it avoid raw access and per-vendor tooling.

Ideally you'd add dedicated attributes that are human-readable/writable and have the driver translate the user intent into transactions on the bus. I'd assume this is what Vadim expected in the email you quoted.

#5 lore raw
In reply to Sagi Maimon
kernel test robot noticed the following build warnings:

Hi Sagi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]
[also build test WARNING on net/main linus/master v7.2-rc7 next-20260814] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sagi-Maimon/ptp-ocp-add-CPLD-ISP-support-for-ADVA-TimeCard-X1/20260813-075719
base:   net-next/main
patch link:    https://lore.kernel.org/r/20260723143908.4019-1-maimon.sagi%40gmail.com
patch subject: [PATCH v6] ptp: ocp: add CPLD ISP support for ADVA TimeCard X1
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
docutils: docutils (Docutils 0.21.2, Python 3.13.5, on linux)
reproduce: (https://download.01.org/0day-ci/archive/20260816/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

WARNING: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/os_mode is defined 2 times: Documentation/ABI/testing/sysfs-driver-hid-lenovo-go:364; Documentation/ABI/testing/sysfs-driver-hid-lenovo-go-s:234
WARNING: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/os_mode_index is defined 2 times: Documentation/ABI/testing/sysfs-driver-hid-lenovo-go:373; Documentation/ABI/testing/sysfs-driver-hid-lenovo-go-s:243
WARNING: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/touchpad/enabled is defined 2 times: Documentation/ABI/testing/sysfs-driver-hid-lenovo-go:636; Documentation/ABI/testing/sysfs-driver-hid-lenovo-go-s:252
WARNING: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/touchpad/enabled_index is defined 2 times: Documentation/ABI/testing/sysfs-driver-hid-lenovo-go:645; Documentation/ABI/testing/sysfs-driver-hid-lenovo-go-s:261 Documentation/ABI/testing/sysfs-timecard:14: ERROR: Unexpected indentation. [docutils]

>> Documentation/ABI/testing/sysfs-timecard:14: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils]
   Documentation/ABI/testing/sysfs-timecard:14: ERROR: Unexpected indentation. [docutils]
   WARNING: ./block/blk-map.c:366 Excess function parameter 'op' description in 'bio_copy_kern'
   Documentation/driver-api/basics:42: ./kernel/time/time.c:370: WARNING: Duplicate C declaration, also defined at driver-api/basics:436.
   Declaration is '.. c:function:: unsigned int jiffies_to_msecs (const unsigned long j)'. [duplicate_declaration.c]
   Documentation/driver-api/basics:42: ./kernel/time/time.c:393: WARNING: Duplicate C declaration, also defined at driver-api/basics:453.

vim +14 Documentation/ABI/testing/sysfs-timecard

  > 14	What:		/sys/class/timecard/ocpN/cpld_i2c_xfer

15 Date: July 2026
16 Contact: Sagi Maimon <[email protected]>
17 Description: (RW) Binary sysfs attribute providing a raw I2C passthrough to
18 the CPLD and I2C mux on ADVA x1 TAP boards. Only present on
19 that board variant.
20
21 Each write initiates one I2C transaction. The write payload
22 must be exactly four header bytes followed by the write data:
23
24 Byte 0: slave address (only 0x40 and 0x74 are permitted)
25 Byte 1: number of bytes to write (0..67)
26 Byte 2: number of bytes to read back (0..20)
27 Byte 3: flags
28 bit 0 - suppress the repeated START before the
29 read segment (I2C_M_NOSTART); only valid
30 when both write and read lengths are
31 non-zero
32 Bytes 4..: write data (write_len bytes)
33
34 A subsequent read() returns:
35
36 Byte 0: status (0 = success, positive errno on error)
37 Bytes 1..: read data (read_len bytes), present only when
38 status is 0 and read_len > 0
39
40 The write and read portions of the sysfs file share a single
41 per-device response buffer protected by a mutex; a single
42 open() / write() / read() sequence must be used to avoid
43 data races between concurrent users.
44
45 Only slave addresses 0x40 (Lattice CPLD) and 0x74 (PCA9548
46 I2C mux) are accepted; all others return EPERM.
47

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

#6 lore raw
Quoted 76 lines · kernel test robot

Hi Sagi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]
[also build test WARNING on net/main linus/master v7.2-rc7 next-20260814] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sagi-Maimon/ptp-ocp-add-CPLD-ISP-support-for-ADVA-TimeCard-X1/20260813-075719
base:   net-next/main
patch link:    https://lore.kernel.org/r/20260723143908.4019-1-maimon.sagi%40gmail.com
patch subject: [PATCH v6] ptp: ocp: add CPLD ISP support for ADVA TimeCard X1
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
docutils: docutils (Docutils 0.21.2, Python 3.13.5, on linux)
reproduce: (https://download.01.org/0day-ci/archive/20260816/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

WARNING: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/os_mode is defined 2 times: Documentation/ABI/testing/sysfs-driver-hid-lenovo-go:364; Documentation/ABI/testing/sysfs-driver-hid-lenovo-go-s:234
WARNING: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/os_mode_index is defined 2 times: Documentation/ABI/testing/sysfs-driver-hid-lenovo-go:373; Documentation/ABI/testing/sysfs-driver-hid-lenovo-go-s:243
WARNING: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/touchpad/enabled is defined 2 times: Documentation/ABI/testing/sysfs-driver-hid-lenovo-go:636; Documentation/ABI/testing/sysfs-driver-hid-lenovo-go-s:252
WARNING: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/touchpad/enabled_index is defined 2 times: Documentation/ABI/testing/sysfs-driver-hid-lenovo-go:645; Documentation/ABI/testing/sysfs-driver-hid-lenovo-go-s:261 Documentation/ABI/testing/sysfs-timecard:14: ERROR: Unexpected indentation. [docutils]

Quoted 1 line
Quoted 1 line

Documentation/ABI/testing/sysfs-timecard:14: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils]

Documentation/ABI/testing/sysfs-timecard:14: ERROR: Unexpected indentation. [docutils]

   WARNING: ./block/blk-map.c:366 Excess function parameter 'op' description in 'bio_copy_kern'
   Documentation/driver-api/basics:42: ./kernel/time/time.c:370: WARNING: Duplicate C declaration, also defined at driver-api/basics:436.
   Declaration is '.. c:function:: unsigned int jiffies_to_msecs (const unsigned long j)'. [duplicate_declaration.c]
   Documentation/driver-api/basics:42: ./kernel/time/time.c:393: WARNING: Duplicate C declaration, also defined at driver-api/basics:453.

vim +14 Documentation/ABI/testing/sysfs-timecard

Quoted 1 line

14 What: /sys/class/timecard/ocpN/cpld_i2c_xfer

    15  Date:           July 2026
    16  Contact:        Sagi Maimon <[email protected]>
    17  Description:    (RW) Binary sysfs attribute providing a raw I2C passthrough to
    18                  the CPLD and I2C mux on ADVA x1 TAP boards.  Only present on
    19                  that board variant.

20
21 Each write initiates one I2C transaction. The write payload
22 must be exactly four header bytes followed by the write data:
23
24 Byte 0: slave address (only 0x40 and 0x74 are permitted)
25 Byte 1: number of bytes to write (0..67)
26 Byte 2: number of bytes to read back (0..20)
27 Byte 3: flags
28 bit 0 - suppress the repeated START before the
29 read segment (I2C_M_NOSTART); only valid
30 when both write and read lengths are
31 non-zero
32 Bytes 4..: write data (write_len bytes)
33
34 A subsequent read() returns:
35
36 Byte 0: status (0 = success, positive errno on error)
37 Bytes 1..: read data (read_len bytes), present only when
38 status is 0 and read_len > 0
39
40 The write and read portions of the sysfs file share a single
41 per-device response buffer protected by a mutex; a single
42 open() / write() / read() sequence must be used to avoid
43 data races between concurrent users.
44
45 Only slave addresses 0x40 (Lattice CPLD) and 0x74 (PCA9548
46 I2C mux) are accepted; all others return EPERM.
47

Quoted 3 lines

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

This report is against v6 ([email protected]). The cpld_i2c_xfer attribute it flags was dropped after that revision; the current posting is v11:

https://lore.kernel.org/netdev/[email protected]/

I checked v11's sysfs-timecard through the ABI parser and docutils - no indentation warnings.

#7 lore raw
Quoted 80 lines · Sagi Maimon
Quoted 76 lines · kernel test robot

Hi Sagi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]
[also build test WARNING on net/main linus/master v7.2-rc7 next-20260814] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sagi-Maimon/ptp-ocp-add-CPLD-ISP-support-for-ADVA-TimeCard-X1/20260813-075719
base:   net-next/main
patch link:    https://lore.kernel.org/r/20260723143908.4019-1-maimon.sagi%40gmail.com
patch subject: [PATCH v6] ptp: ocp: add CPLD ISP support for ADVA TimeCard X1
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
docutils: docutils (Docutils 0.21.2, Python 3.13.5, on linux)
reproduce: (https://download.01.org/0day-ci/archive/20260816/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

WARNING: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/os_mode is defined 2 times: Documentation/ABI/testing/sysfs-driver-hid-lenovo-go:364; Documentation/ABI/testing/sysfs-driver-hid-lenovo-go-s:234
WARNING: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/os_mode_index is defined 2 times: Documentation/ABI/testing/sysfs-driver-hid-lenovo-go:373; Documentation/ABI/testing/sysfs-driver-hid-lenovo-go-s:243
WARNING: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/touchpad/enabled is defined 2 times: Documentation/ABI/testing/sysfs-driver-hid-lenovo-go:636; Documentation/ABI/testing/sysfs-driver-hid-lenovo-go-s:252
WARNING: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/touchpad/enabled_index is defined 2 times: Documentation/ABI/testing/sysfs-driver-hid-lenovo-go:645; Documentation/ABI/testing/sysfs-driver-hid-lenovo-go-s:261 Documentation/ABI/testing/sysfs-timecard:14: ERROR: Unexpected indentation. [docutils]

Quoted 1 line
Quoted 1 line

Documentation/ABI/testing/sysfs-timecard:14: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils]

Documentation/ABI/testing/sysfs-timecard:14: ERROR: Unexpected indentation. [docutils]

   WARNING: ./block/blk-map.c:366 Excess function parameter 'op' description in 'bio_copy_kern'
   Documentation/driver-api/basics:42: ./kernel/time/time.c:370: WARNING: Duplicate C declaration, also defined at driver-api/basics:436.
   Declaration is '.. c:function:: unsigned int jiffies_to_msecs (const unsigned long j)'. [duplicate_declaration.c]
   Documentation/driver-api/basics:42: ./kernel/time/time.c:393: WARNING: Duplicate C declaration, also defined at driver-api/basics:453.

vim +14 Documentation/ABI/testing/sysfs-timecard

Quoted 1 line

14 What: /sys/class/timecard/ocpN/cpld_i2c_xfer

    15  Date:           July 2026
    16  Contact:        Sagi Maimon <[email protected]>
    17  Description:    (RW) Binary sysfs attribute providing a raw I2C passthrough to
    18                  the CPLD and I2C mux on ADVA x1 TAP boards.  Only present on
    19                  that board variant.

20
21 Each write initiates one I2C transaction. The write payload
22 must be exactly four header bytes followed by the write data:
23
24 Byte 0: slave address (only 0x40 and 0x74 are permitted)
25 Byte 1: number of bytes to write (0..67)
26 Byte 2: number of bytes to read back (0..20)
27 Byte 3: flags
28 bit 0 - suppress the repeated START before the
29 read segment (I2C_M_NOSTART); only valid
30 when both write and read lengths are
31 non-zero
32 Bytes 4..: write data (write_len bytes)
33
34 A subsequent read() returns:
35
36 Byte 0: status (0 = success, positive errno on error)
37 Bytes 1..: read data (read_len bytes), present only when
38 status is 0 and read_len > 0
39
40 The write and read portions of the sysfs file share a single
41 per-device response buffer protected by a mutex; a single
42 open() / write() / read() sequence must be used to avoid
43 data races between concurrent users.
44
45 Only slave addresses 0x40 (Lattice CPLD) and 0x74 (PCA9548
46 I2C mux) are accepted; all others return EPERM.
47

Quoted 3 lines

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Quoted 8 lines

This report is against v6 ([email protected]). The cpld_i2c_xfer attribute it flags was dropped after that revision; the current posting is v11:

https://lore.kernel.org/netdev/[email protected]/

I checked v11's sysfs-timecard through the ABI parser and docutils - no indentation warnings.

Thanks for the info and sorry for this meaningless report. I will fix the bot logic to avoid such report.

Quoted 1 line