Skip to contentSkip to conversation

ptp: ocp: Expose various resources on the timecard.

PATCH Superseded Jonathan Lemon 3 participants 3 messages Jul 30, 2021 – Jul 31, 2021

Subsystems (4)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ptp: ocp: Expose various resources on the timecard.

The OpenCompute timecard driver has additional functionality besides a clock. Make the following resources available:

- The external timestamp channels (ts0/ts1)
- devlink support for flashing and health reporting
- GPS and MAC serial ports
- board serial number (obtained from i2c device)

Also add watchdog functionality for when GNSS goes into holdover.

The resources are collected under a driver procfs directory:

[jlemon@timecard ~]$ ls -g /proc/driver/ocp1
total 0
-rw-r--r--. 1 root 0 Jul 30 12:37 clock_source -r--r--r--. 1 root 0 Jul 30 12:37 gps_state
lrwxrwxrwx. 1 root 26 Jul 30 12:37 i2c -> /sys/bus/i2c/devices/i2c-2/

  lrwxrwxrwx. 1 root  9 Jul 30 12:37 pps -> /dev/pps1
  lrwxrwxrwx. 1 root  9 Jul 30 12:37 ptp -> /dev/ptp2
  -r--r--r--. 1 root  0 Jul 30 12:37 serial

lrwxrwxrwx. 1 root 10 Jul 30 12:37 ttyGPS -> /dev/ttyS7 lrwxrwxrwx. 1 root 10 Jul 30 12:37 ttyMAC -> /dev/ttyS8

---
 drivers/ptp/Kconfig   |    7 +
 drivers/ptp/ptp_ocp.c | 1307 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 1269 insertions(+), 45 deletions(-)
drivers/ptp/Kconfig +7 -0
index 8c20e524e9ad..8b08745e1ca1 100644
@@ -157,6 +157,13 @@ config PTP_1588_CLOCK_OCP
 	tristate "OpenCompute TimeCard as PTP clock"
 	depends on PTP_1588_CLOCK
 	depends on HAS_IOMEM && PCI
+	depends on SPI && I2C && MTD
+	imply SPI_MEM
+	imply SPI_XILINX
+	imply MTD_SPI_NOR
+	imply I2C_XILINX
+	select SERIAL_8250
+
 	default n
 	help
 	  This driver adds support for an OpenCompute time card.
drivers/ptp/ptp_ocp.c +1262 -45

1,460 lines not on this page · raw message

Signature · 1 line
2.31.1
#1 lore raw
I love your patch! Perhaps something to improve:

Hi Jonathan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Jonathan-Lemon/ptp-ocp-Expose-various-resources-on-the-timecard/20210731-041447
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git bc830525615df6b6b1793ac23750f32695903fd0
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 10.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/efb2c928bce8e0a5d32a5c3478398206e9aa26ff
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jonathan-Lemon/ptp-ocp-Expose-various-resources-on-the-timecard/20210731-041447 git checkout efb2c928bce8e0a5d32a5c3478398206e9aa26ff
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=arm64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

drivers/ptp/ptp_ocp.c: In function 'ptp_ocp_init':

>> drivers/ptp/ptp_ocp.c:1600:6: warning: variable 'err' set but not used [-Wunused-but-set-variable]
    1600 |  int err;
         |      ^~~

vim +/err +1600 drivers/ptp/ptp_ocp.c

efb2c928bce8e0 Jonathan Lemon 2021-07-30  1596  
a7e1abad13f3f0 Jonathan Lemon 2020-12-03  1597  static int __init
a7e1abad13f3f0 Jonathan Lemon 2020-12-03  1598  ptp_ocp_init(void)
a7e1abad13f3f0 Jonathan Lemon 2020-12-03  1599  {
a7e1abad13f3f0 Jonathan Lemon 2020-12-03 @1600  	int err;
a7e1abad13f3f0 Jonathan Lemon 2020-12-03  1601  
efb2c928bce8e0 Jonathan Lemon 2021-07-30  1602  	err = bus_register_notifier(&i2c_bus_type, &ptp_ocp_i2c_notifier);
efb2c928bce8e0 Jonathan Lemon 2021-07-30  1603  	return pci_register_driver(&ptp_ocp_driver);
a7e1abad13f3f0 Jonathan Lemon 2020-12-03  1604  }
a7e1abad13f3f0 Jonathan Lemon 2020-12-03  1605  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

maintainer
#2 lore raw
In reply to Jonathan Lemon
Quoted 9 lines · On Fri, 30 Jul 2021 13:13:54 -0700 Jonathan Lemon wrote:

The OpenCompute timecard driver has additional functionality besides a clock. Make the following resources available:

- The external timestamp channels (ts0/ts1)
- devlink support for flashing and health reporting
- GPS and MAC serial ports
- board serial number (obtained from i2c device)

Also add watchdog functionality for when GNSS goes into holdover.

drivers/ptp/ptp_ocp.c: In function ‘ptp_ocp_init’:
drivers/ptp/ptp_ocp.c:1600:6: warning: variable ‘err’ set but not used [-Wunused-but-set-variable]

1600 |  int err;
     |      ^~~

drivers/ptp/ptp_ocp.c:1153:69: warning: Using plain integer as NULL pointer drivers/ptp/ptp_ocp.c:1506:27: warning: Using plain integer as NULL pointer drivers/ptp/ptp_ocp.c:1587:31: warning: Using plain integer as NULL pointer drivers/ptp/ptp_ocp.c:881:29: warning: dereference of noderef expression drivers/ptp/ptp_ocp.c:1399:29: warning: dereference of noderef expression