]> git.karo-electronics.de Git - linux-beck.git/commitdiff
sfc: Add a function pointer to abstract write of host time into NIC shared memory
authorLaurence Evans <levans@solarflare.com>
Thu, 7 Mar 2013 11:46:58 +0000 (11:46 +0000)
committerBen Hutchings <bhutchings@solarflare.com>
Tue, 27 Aug 2013 21:27:02 +0000 (22:27 +0100)
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
drivers/net/ethernet/sfc/net_driver.h
drivers/net/ethernet/sfc/ptp.c
drivers/net/ethernet/sfc/siena.c

index d33656bc40607661d18a58ff0b039efb81d3332f..21b1c2a2a1918e485379b7a61b6a91de64e76809 100644 (file)
@@ -1117,6 +1117,7 @@ struct efx_nic_type {
                         size_t *retlen, const u8 *buffer);
        int (*mtd_sync)(struct mtd_info *mtd);
 #endif
+       void (*ptp_write_host_time)(struct efx_nic *efx, u32 host_time);
 
        int revision;
        unsigned int txd_ptr_tbl_base;
index 4de2f8febd596234501444c16f0bfc73e6a1dc17..c60cabb6ff05ca4baed25f48dbe6ef7098b9ede9 100644 (file)
@@ -390,8 +390,7 @@ static void efx_ptp_send_times(struct efx_nic *efx,
                host_time = (now.ts_real.tv_sec << MC_NANOSECOND_BITS |
                             now.ts_real.tv_nsec);
                /* Update host time in NIC memory */
-               _efx_writed(efx, cpu_to_le32(host_time),
-                           FR_CZ_MC_TREG_SMEM + MC_SMEM_P0_PTP_TIME_OFST);
+               efx->type->ptp_write_host_time(efx, host_time);
        }
        *last_time = now;
 }
index a51d90c4c6cf7f82136b442a5fb758ca6c9d4854..3c0a5440026028b4efeb289d751ce61dba46c559 100644 (file)
@@ -853,6 +853,19 @@ fail:
 
 #endif /* CONFIG_SFC_MTD */
 
+/**************************************************************************
+ *
+ * PTP
+ *
+ **************************************************************************
+ */
+
+static void siena_ptp_write_host_time(struct efx_nic *efx, u32 host_time)
+{
+       _efx_writed(efx, cpu_to_le32(host_time),
+                   FR_CZ_MC_TREG_SMEM + MC_SMEM_P0_PTP_TIME_OFST);
+}
+
 /**************************************************************************
  *
  * Revision-dependent attributes used by efx.c and nic.c
@@ -943,6 +956,7 @@ const struct efx_nic_type siena_a0_nic_type = {
        .mtd_write = efx_mcdi_mtd_write,
        .mtd_sync = efx_mcdi_mtd_sync,
 #endif
+       .ptp_write_host_time = siena_ptp_write_host_time,
 
        .revision = EFX_REV_SIENA_A0,
        .txd_ptr_tbl_base = FR_BZ_TX_DESC_PTR_TBL,