From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.176 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796049118; b=DhJ9gcrUIBKm1XAiV6Tt7gmn0fTb5+UrC7dbxJP/W2roZ6Op2NWkk0jXe4UCgtpdQShk bBDs5nJbwEY3CsyKv7CHaGll9PL2+v0A+wosJ7Kteuw/xb9w3fzT0ni0l4sCxv40D9W0G D/BD128wbqRtJwDpxm3HtvzVkJ3P/9SeIlZ7eMVWC89xDGzzUce9Z/BVMP5ivWjQVleRF EVysMduw+QUQtgjPduRtYYCoiUUO7lQvfp1Bk1rXsaZkR0TizD2GCztaek7Cq2G6MStuE jiUVTj64jlRI+HXNkci4e5dSKRCo/Mp7NDizobHH0VPVA0V9L+QRC9dTBF8TWwIn3Tw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796049118; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=AX62Nh1JSn1GrdUXs6RxhLlHQZMmuURSKdLNWe5bYVI=; b=BAcc0GbtqttXOHULMGipup7ktH/O0Rxm+ziOzPS1eU1ioT0OFNa9uZemNaCOHbhmzC0v pa+9HXQvKjH1dmJ7N1XX0VghxVnBYoV0/hdUgp1ZM93iL9u0DlSGQc6D5YBrgNVoFMqrF ZLY8Q7P0RmL3RtSCloni6M9I8d9vFtoWEehnHai22qSiUFMLErKttgCps0xm8ylnBPcuN /ZLHnKwq90+186pCz/CKgqUT/l5kZAnjufFn1WUwdpr/P93++fJR18kOO10BMNdcrXBa6 OrhBbnnDXIsVLYs4/TCouhJZV51XGykBm2t0jQv83nOQwwBNFSVg/8OIwuPoGaHae5g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=vVy5Endf; arc=none smtp.remote-ip=209.85.208.176 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2351A606A330 for ; Mon, 30 Nov 2026 14:31:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2351A606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=vVy5Endf Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-3ae0d0b9db2so98338601fa.1 for ; Mon, 30 Nov 2026 06:31:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796049115; x=1796653915; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=AX62Nh1JSn1GrdUXs6RxhLlHQZMmuURSKdLNWe5bYVI=; b=vVy5EndfwBHxbWlcPM4CSS2F8FNA4BtcaB4YbdkdCehxe50nKcu9CIdK6qJdkRiBKp 7FpVEX5P5XSFO9UyJf8Xt8F4LmYcs2VDD70BDkcPkUE/PuXP5+y7n9BDLEbHwnkvQiRQ vIbE679X6t1WWLAs9J0jNSTiTYSGK17OcB16b26RumUaxdzUl46yL9Xifba3lu47lCgZ cd1wYex5XD5y8GKHZ3Ye/E5Cwie1wrEBBDiLZ5rpcolgQ/e/wmyUOHHTm1zv1ZiOfyDm Y3/ulN4WypMZnqSdS1YJmqS03QUBFgXyUBaNlEAsqshCYnoJvzTX3SO6CfHKWosu0sC3 Up3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796049115; x=1796653915; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=AX62Nh1JSn1GrdUXs6RxhLlHQZMmuURSKdLNWe5bYVI=; b=chVboQlez2qqW2T5S06InzOyPVbOK2C1HtO24XSO3zaumr0dswRd45bAM8NP5yW3Sb Pi8oUy6IISsFq1lyJ5V+AC7emYtALWF++CdhUfJTy/6kLd71NWsWWRLY13//h2kpNj1a OVkR9nnCtCzNiOzbpHFl+/5ZWUpLZp8xPpIdX2VKVx3CTWbf/POMzEtQCQP+X8iYs5cB JWUDP7hEb8WDzmQBIU/tIrJz9zTOZcX0qMMTvTRZxX07HYkMemHSBZquws6eYqO87pef 3d8ZjzA2ZoimuFDMS+711/WwmDoE/sF61aNm69HRynd8MBdS/lsDBWIxJbPfL6RGhYCT LDPw== X-Gm-Message-State: APuU4Z/pkyMW1sHPn6oS4wXnCNJYxxXFAC+x/rakhuHgs7SgS/4eFN69 Lw57eh6mxTDOonH2S7YVG5CC+l6C3B5vHQrtP2rUXyMWUwwO6MRgCGsAvInth4JI X-Gm-Gg: AZFdTZdiq0HmFm3iqqk4WjfDJ6oEZe2Tblx96P3j8soMXJBNbrBcuIPyH31/UmKJZ12 anP4KGDcmG2zQmU/guircE/+sKs9pzU6crrbvWqmV7PAso+8puDO3S05alWLRDnh1Jq63aYq7qh KGvbFICxufVInTXyhyC+QhI51iFMwDFUxgliSPy9Ja3n1UkZFkIZFzgLA6ixUW3GQuiEyntwRby hOCJCiq3auav9krEeVO1FWcCtoelMXIIe43winbPom3UEMu9P43ES+SUuYrIchlgLL3G4NV5sHL Vs9IIvm1nJIj42CJAs8ViRmdzWXAGfx5BK5O6j6j7UJ+c85MdILdpJk/i1b6DNr/f9Dlff9Fupx 2QhY/mi2E/H22cwoskN/igqcHGQcBMSAuosHRaAym+IWUql2BDKHzjZScuZF1zmAgEJIhz/6goi hPnP0OzYKyI/RcSfkKztDrZBI2Pyu3mTv7PgUESKuj01Z3pl5Ev3I6T0AHWGTNQnpVdkuG1dIp6 VOhtZ7LyHTV6bkLT7+MrxrBW2BxjHH5pH6Q/wsH5pE2cOI+30HSVitAlKWGU06JhVjg06Nkt5RX dbNigEcMoJO/CZJArntvpB7APPCO4d0vKqKAeN/b/1HCGTbV/sHPpxjOjJ2cmDFHBZI46fLcHIc 1PDdGs9aImVgzseGo8G6qpaon7pHOMAImdlOuU9Ii7zwUQ8pL X-Received: by 2002:ac2:4bcb:0:b0:5c1:4e39:cc93 with SMTP id 2adb3069b0e04-5c1bc717120mr10562327e87.6.1796049114900; Mon, 30 Nov 2026 06:31:54 -0800 (PST) Received: from fedora-tap.advaoptical.com ([82.166.23.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6bb989b3sm65042280f8f.51.2026.11.30.06.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 06:31:54 -0800 (PST) From: Sagi Maimon To: netdev@vger.kernel.org Cc: vadim.fedorenko@linux.dev, richardcochran@gmail.com, jiri@resnulli.us, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, willemb@google.com, corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, linux-doc@vger.kernel.org, Sagi Maimon Subject: [PATCH net-next] ptp: ocp: add support for the ADVA TimeCard X2 Date: Mon, 30 Nov 2026 16:31:49 +0200 Message-ID: <20261130143150.326311-1-maimon.sagi@gmail.com> X-Mailer: git-send-email 2.47.0 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The ADVA TimeCard X2 (PCI ID ad5a:0420) keeps the PPS timestamper, the NMEA serial port, the I2C controller with the board EEPROMs and the TAP CPLD of the X1. It has no signal generators or frequency counters, its firmware rather than the host keeps the clock's time of day on GNSS, its FPGA image is not updated from the host, and its two SMA connectors are internal to the card, out of the user's reach. Add a resource table for it on top of ptp_ocp_adva_board_init(), with: - no TOD block, since the firmware sets the time of day; - no SMA op, since there are no connectors to configure; - no SPI flash, since there is no FPGA image to write; - a reduced attribute group: serial number, GNSS sync and CPLD status; - has_cpld set, so the CPLD is identified and can be flashed through devlink as on the X1. - osa_version set: the image version register carries the release and build of the card's OSA software instead of the X1 layout - bit 31 marks the loader, bits 23:16 hold the release and bits 15:0 the build - and devlink reports it as .. Every board so far has a TOD block, SMA connectors and an FPGA flash, so allow all three to be absent. ptp_ocp_tod_init() dereferenced bp->tod unconditionally; it now returns early when there is no TOD block. When sma_op is unset, ptp_ocp_adva_board_init() sets up no PTP pins and no SMA state, probe registers the dpll device without pins, and the debugfs summary neither prints SMA lines nor names an SMA as a signal source. When there is no SPI flash, a devlink flash update without a component fails with -EOPNOTSUPP, rather than letting ptp_ocp_find_flash() walk the children of an invalid pointer derived from the NULL spi_flash. The CPLD component is unaffected, and all other boards have all three and are unaffected. Update the devlink documentation to match: the CPLD versions and the fw.cpld component now apply to the X2 as well, a flash update without a component is not supported there, and the fw version is the OSA software release and build. The card also carries an AXI Ethernet MAC, which is added separately. Tested on an ADVA TimeCard X2 with FPGA image 136.1089: the card probes, devlink reports the board, firmware and CPLD versions, read from the EEPROMs and the CPLD, and phc2sys tracks its PTP clock. Assisted-by: LLM sparse Signed-off-by: Sagi Maimon --- Documentation/networking/devlink/ptp_ocp.rst | 30 +-- drivers/ptp/ptp_ocp.c | 182 ++++++++++++++++--- 2 files changed, 172 insertions(+), 40 deletions(-) diff --git a/Documentation/networking/devlink/ptp_ocp.rst b/Documentation/networking/devlink/ptp_ocp.rst index f94b759d9cd6..36c4104662cf 100644 --- a/Documentation/networking/devlink/ptp_ocp.rst +++ b/Documentation/networking/devlink/ptp_ocp.rst @@ -21,15 +21,17 @@ The ``ptp_ocp`` driver reports the following versions * - ``fw`` - running - Version of the firmware running on the card. Reported as ``loader`` - instead when the card is running the firmware loader. + instead when the card is running the firmware loader. On ADVA + TimeCard X2 boards it is the release and build of the card's OSA + software, as ``.``. * - ``board.id`` - fixed - Board identifier, read from the on-card EEPROM. * - ``cpld.id`` - fixed - Lattice device ID (IDCODE) of the TAP CPLD, formatted as ``0x%08x``. - Only present on ADVA TimeCard X1 boards, which are the only ones - carrying that CPLD. Reading it claims the shared I2C bus and + Only present on ADVA TimeCard X1 and X2 boards, which are the only + ones carrying that CPLD. Reading it claims the shared I2C bus and reprograms the on-card mux, so the driver does that from its own worker and reports the cached value here; the version is omitted until that read has succeeded. The read is made once per binding @@ -54,17 +56,19 @@ selected with the component name. - Description * - (none) - The card's own flash, written through the SPI controller the driver - exposes. The card runs the new image after its next reset. + exposes. The card runs the new image after its next reset. Not + supported on ADVA TimeCard X2 boards, whose FPGA image is not + updated from the host; the request fails with ``EOPNOTSUPP``. * - ``fw.cpld`` - - The configuration flash of the TAP CPLD on ADVA TimeCard X1 boards, - programmed over I2C with the MachXO3 in-system programming commands - and activated with a REFRESH, so the new image runs immediately. - The image is the raw configuration bitstream. The only check the - driver makes is that its length is a non-zero multiple of the - 16-byte page size, so a container such as ``.jed`` has to be - converted first rather than passed through - one whose length - happens to be a multiple of 16 would be programmed as if it were - a bitstream. + - The configuration flash of the TAP CPLD on ADVA TimeCard X1 and X2 + boards, programmed over I2C with the MachXO3 in-system programming + commands and activated with a REFRESH, so the new image runs + immediately. The image is the raw configuration bitstream. The + only check the driver makes is that its length is a non-zero + multiple of the 16-byte page size, so a container such as ``.jed`` + has to be converted first rather than passed through - one whose + length happens to be a multiple of 16 would be programmed as if it + were a bitstream. Programming the CPLD claims the shared I2C bus for the whole cycle, so reads of the card's EEPROM block until it completes. Progress is reported diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index decc56892059..f88939a3e932 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -41,6 +41,7 @@ #define PCI_VENDOR_ID_ADVA 0xad5a #define PCI_DEVICE_ID_ADVA_TIMECARD 0x0400 #define PCI_DEVICE_ID_ADVA_TIMECARD_X1 0x0410 +#define PCI_DEVICE_ID_ADVA_TIMECARD_X2 0x0420 static struct class timecard_class = { .name = "timecard", @@ -81,7 +82,7 @@ struct ptp_ocp_servo_conf { /* * Combined servo + board-variant parameters for ADVA boards. * Embedded in the resource table .extra so a single ptp_ocp_adva_board_init() - * can handle both ADVA and ADVA-X1 without per-variant init functions. + * can handle ADVA, ADVA-X1 and ADVA-X2 without per-variant init functions. */ struct ptp_ocp_adva_info { struct ptp_ocp_servo_conf servo; @@ -92,6 +93,8 @@ struct ptp_ocp_adva_info { const struct ocp_attr_group *attr_groups; /* x1: TAP CPLD present */ bool has_cpld; + /* x2: image version in the OSA software format */ + bool osa_version; }; #define OCP_CTRL_ENABLE BIT(0) @@ -170,7 +173,7 @@ struct gpio_reg { u32 gpio1; u32 __pad0; u32 gpio2; - /* adva_x1: I2C bus ownership register; reserved on other variants */ + /* adva_x1/x2: I2C bus ownership register; reserved on other variants */ u32 i2c_bus_ctrl; }; @@ -499,6 +502,7 @@ static const struct ocp_attr_group art_timecard_groups[]; static const struct ocp_attr_group adva_timecard_groups[]; static const struct ocp_attr_group adva_timecard_x1_groups[]; +static const struct ocp_attr_group adva_timecard_x2_groups[]; struct ptp_ocp_eeprom_map { u16 off; @@ -1319,12 +1323,91 @@ static struct ocp_resource ocp_adva_x1_resource[] = { { } }; +static struct ocp_resource ocp_adva_x2_resource[] = { + { + OCP_MEM_RESOURCE(reg), + .offset = 0x01000000, .size = 0x10000, + }, + { + OCP_MEM_RESOURCE(pps_to_clk), + .offset = 0x01040000, .size = 0x10000, + }, + { + /* + * PPS timestamper. X2 exposes no external timestampers, but + * this block is what raises the per-second interrupt behind + * PTP_ENABLE_PPS, so /dev/ppsN stays silent without it. + */ + OCP_EXT_RESOURCE(pps), + .offset = 0x010C0000, .size = 0x10000, .irq_vec = 0, + .extra = &(struct ptp_ocp_ext_info) { + .index = 5, + .irq_fcn = ptp_ocp_ts_irq, + .enable = ptp_ocp_ts_enable, + }, + }, + { + OCP_MEM_RESOURCE(image), + .offset = 0x00020000, .size = 0x1000, + }, + { + /* + * The gpio_reg block. X2 has no SMA routing to configure, but + * the window's i2c_bus_ctrl word carries the MicroBlaze I2C + * bus-ownership handshake that CPLD access needs; see + * adva_x1_bus_claim(). The X2 FPGA places it at 0x70000 + * rather than at 0x130000 as on the other ADVA boards. + */ + OCP_MEM_RESOURCE(pps_select), + .offset = 0x00070000, .size = 0x1000, + }, + { + OCP_SERIAL_RESOURCE(port[PORT_NMEA]), + .offset = 0x00190000 + 0x1000, .irq_vec = 10, + }, + { + OCP_I2C_RESOURCE(i2c_ctrl), + .offset = 0x00150000, .size = 0x10000, .irq_vec = 7, + .extra = &(struct ptp_ocp_i2c_info) { + .name = "xiic-i2c", + .fixed_rate = 50000000, + .data_size = sizeof(struct xiic_i2c_platform_data), + .data = &(struct xiic_i2c_platform_data) { + .num_devices = 2, + .devices = (struct i2c_board_info[]) { + { I2C_BOARD_INFO("24c02", 0x50) }, + { I2C_BOARD_INFO("24mac402", 0x58), + .platform_data = "mac" }, + }, + }, + }, + }, + { + .setup = ptp_ocp_adva_board_init, + .extra = &(struct ptp_ocp_adva_info) { + .servo = { + .servo_offset_p = 0xc000, + .servo_offset_i = 0x1000, + .servo_drift_p = 0, + .servo_drift_i = 0, + }, + .signals_nr = 0, + .freq_in_nr = 0, + .attr_groups = adva_timecard_x2_groups, + .has_cpld = true, + .osa_version = true, + }, + }, + { } +}; + static const struct pci_device_id ptp_ocp_pcidev_id[] = { { PCI_DEVICE_DATA(META, TIMECARD, &ocp_fb_resource) }, { PCI_DEVICE_DATA(CELESTICA, TIMECARD, &ocp_fb_resource) }, { PCI_DEVICE_DATA(OROLIA, ARTCARD, &ocp_art_resource) }, { PCI_DEVICE_DATA(ADVA, TIMECARD, &ocp_adva_resource) }, { PCI_DEVICE_DATA(ADVA, TIMECARD_X1, &ocp_adva_x1_resource) }, + { PCI_DEVICE_DATA(ADVA, TIMECARD_X2, &ocp_adva_x2_resource) }, { } }; MODULE_DEVICE_TABLE(pci, ptp_ocp_pcidev_id); @@ -1933,6 +2016,12 @@ ptp_ocp_tod_init(struct ptp_ocp *bp) { u32 ctrl, reg; + /* The X2 maps no TOD block: its firmware keeps the clock's time of + * day on GNSS. + */ + if (!bp->tod) + return; + ctrl = ioread32(&bp->tod->ctrl); ctrl |= TOD_CTRL_PROTOCOL | TOD_CTRL_ENABLE; ctrl &= ~(TOD_CTRL_DISABLE_FMT_A | TOD_CTRL_DISABLE_FMT_B); @@ -2189,6 +2278,11 @@ ptp_ocp_devlink_flash_update(struct devlink *devlink, return err; } + if (!bp->spi_flash) { + NL_SET_ERR_MSG_MOD(extack, "FPGA image update not supported"); + return -EOPNOTSUPP; + } + dev = ptp_ocp_find_flash(bp); if (!dev) { dev_err(&bp->pdev->dev, "Can't find Flash SPI adapter\n"); @@ -3271,13 +3365,20 @@ ptp_ocp_adva_board_init(struct ptp_ocp *bp, struct ocp_resource *r) bp->freq_in_nr = info->freq_in_nr; version = ioread32(&bp->image->version); - /* if lower 16 bits are empty, this is the fw loader. */ - if ((version & 0xffff) == 0) { - version = version >> 16; - bp->fw_loader = true; + if (info->osa_version) { + /* OSA: bit 31 loader, bits 23:16 release, bits 15:0 build */ + bp->fw_loader = !!(version & BIT(31)); + bp->fw_tag = (version >> 16) & 0xff; + bp->fw_version = version & 0xffff; + } else { + /* if lower 16 bits are empty, this is the fw loader. */ + if ((version & 0xffff) == 0) { + version = version >> 16; + bp->fw_loader = true; + } + bp->fw_tag = 3; + bp->fw_version = version & 0xffff; } - bp->fw_tag = 3; - bp->fw_version = version & 0xffff; bp->fw_cap = OCP_CAP_BASIC | OCP_CAP_SIGNAL | OCP_CAP_FREQ; ptp_ocp_tod_init(bp); @@ -3288,10 +3389,13 @@ ptp_ocp_adva_board_init(struct ptp_ocp *bp, struct ocp_resource *r) if (err) return err; - err = ptp_ocp_set_pins(bp); - if (err) - return err; - ptp_ocp_sma_init(bp); + /* boards without user-accessible SMA connectors have no sma_op */ + if (bp->sma_op) { + err = ptp_ocp_set_pins(bp); + if (err) + return err; + ptp_ocp_sma_init(bp); + } bp->has_cpld = info->has_cpld; @@ -5180,13 +5284,35 @@ static const struct ocp_attr_group adva_timecard_x1_groups[] = { { }, }; +/* + * X2 exposes the basic identity attributes plus the TAP CPLD status. It + * has no user-accessible SMA connectors, signal generators or frequency + * inputs, so none of the SMA, signal or freq groups apply. + */ +static struct attribute *adva_timecard_x2_attrs[] = { + &dev_attr_serialnum.attr, + &dev_attr_gnss_sync.attr, + &dev_attr_cpld_status.attr, + NULL, +}; + +static const struct attribute_group adva_timecard_x2_group = { + .attrs = adva_timecard_x2_attrs, +}; + +static const struct ocp_attr_group adva_timecard_x2_groups[] = { + { .cap = OCP_CAP_BASIC, .group = &adva_timecard_x2_group }, + { .cap = OCP_CAP_BASIC, .group = &ptp_ocp_timecard_tty_group }, + { }, +}; + static void gpio_input_map(char *buf, struct ptp_ocp *bp, u16 map[][2], u16 bit, const char *def) { int i; - for (i = 0; i < 4; i++) { + for (i = 0; bp->sma_op && i < 4; i++) { if (bp->sma[i].mode != SMA_MODE_IN) continue; if (map[i][0] & (1 << bit)) { @@ -5206,7 +5332,7 @@ gpio_output_map(char *buf, struct ptp_ocp *bp, u16 map[][2], u16 bit) int i; strcpy(ans, "----"); - for (i = 0; i < 4; i++) { + for (i = 0; bp->sma_op && i < 4; i++) { if (bp->sma[i].mode != SMA_MODE_OUT) continue; if (map[i][1] & (1 << bit)) @@ -5316,21 +5442,23 @@ ptp_ocp_summary_show(struct seq_file *s, void *data) sma_val[1][1] = reg >> 16; } - sma1_show(dev, NULL, buf); - seq_printf(s, " sma1: %04x,%04x %s", - sma_val[0][0], sma_val[0][1], buf); + if (bp->sma_op) { + sma1_show(dev, NULL, buf); + seq_printf(s, " sma1: %04x,%04x %s", + sma_val[0][0], sma_val[0][1], buf); - sma2_show(dev, NULL, buf); - seq_printf(s, " sma2: %04x,%04x %s", - sma_val[1][0], sma_val[1][1], buf); + sma2_show(dev, NULL, buf); + seq_printf(s, " sma2: %04x,%04x %s", + sma_val[1][0], sma_val[1][1], buf); - sma3_show(dev, NULL, buf); - seq_printf(s, " sma3: %04x,%04x %s", - sma_val[2][0], sma_val[2][1], buf); + sma3_show(dev, NULL, buf); + seq_printf(s, " sma3: %04x,%04x %s", + sma_val[2][0], sma_val[2][1], buf); - sma4_show(dev, NULL, buf); - seq_printf(s, " sma4: %04x,%04x %s", - sma_val[3][0], sma_val[3][1], buf); + sma4_show(dev, NULL, buf); + seq_printf(s, " sma4: %04x,%04x %s", + sma_val[3][0], sma_val[3][1], buf); + } if (bp->ts0) { ts_reg = bp->ts0->mem; @@ -6032,7 +6160,7 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (err) goto out_dpll_put; - for (i = 0; i < OCP_SMA_NUM; i++) { + for (i = 0; bp->sma_op && i < OCP_SMA_NUM; i++) { bp->sma[i].dpll_pin = dpll_pin_get(clkid, i, THIS_MODULE, &bp->sma[i].dpll_prop, &bp->sma[i].tracker); base-commit: 02e8a63b4685a4321c60d562edabecc097f4a0d9 -- 2.47.0