Re: [PATCH v5] ptp: ocp: add Adva timecard support

From: Vadim Fedorenko
Date: Wed Jan 17 2024 - 16:23:48 EST


On 17/01/2024 11:43, Sagi Maimon wrote:
Adding support for the Adva timecard.
The card uses different drivers to provide access to the
firmware SPI flash (Altera based).
Other parts of the code are the same and could be reused.


Hi Sagi,

Thanks for adjusting the code. One signle still have to be
adjusted, see comments below. And this is treated as net-next
material, but net-next is closed now until merge window ends,
you will have to submit new version next week.

Please, also use '[PATCH net-next v6] ...' prefix for it.

Signed-off-by: Sagi Maimon <maimon.sagi@xxxxxxxxx>
---
Changes since version 4:
- alignment fix.


Please, preserve changes from all previous versions for next submissions.

drivers/ptp/ptp_ocp.c | 302 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 293 insertions(+), 9 deletions(-)


[ ..skip.. ]

@@ -2603,7 +2819,44 @@ ptp_ocp_art_board_init(struct ptp_ocp *bp, struct ocp_resource *r)
if (err)
return err;
- return ptp_ocp_init_clock(bp);
+ return ptp_ocp_init_clock(bp, r->extra);
+}
+
+/* ADVA specific board initializers; last "resource" registered. */
+static int
+ptp_ocp_adva_board_init(struct ptp_ocp *bp, struct ocp_resource *r)
+{
+ int err;
+ u32 version;
+
+ bp->flash_start = 0xA00000;
+ bp->eeprom_map = fb_eeprom_map;
+ bp->sma_op = &ocp_adva_sma_op;
+
+ 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;
+ }
+ bp->fw_tag = 1;

Please, use fw_tag = 3 here, other tags are for other vendors.

Thanks,
Vadim

+ bp->fw_version = version & 0xffff;
+ bp->fw_cap = OCP_CAP_BASIC | OCP_CAP_SIGNAL | OCP_CAP_FREQ;
+
+ ptp_ocp_tod_init(bp);
+ ptp_ocp_nmea_out_init(bp);
+ ptp_ocp_signal_init(bp);
+