Commit 977a5d5d authored by Laurence Evans's avatar Laurence Evans Committed by Ben Hutchings

sfc: Add a function pointer to abstract write of host time into NIC shared memory

Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
parent c1d828bd
...@@ -1117,6 +1117,7 @@ struct efx_nic_type { ...@@ -1117,6 +1117,7 @@ struct efx_nic_type {
size_t *retlen, const u8 *buffer); size_t *retlen, const u8 *buffer);
int (*mtd_sync)(struct mtd_info *mtd); int (*mtd_sync)(struct mtd_info *mtd);
#endif #endif
void (*ptp_write_host_time)(struct efx_nic *efx, u32 host_time);
int revision; int revision;
unsigned int txd_ptr_tbl_base; unsigned int txd_ptr_tbl_base;
......
...@@ -390,8 +390,7 @@ static void efx_ptp_send_times(struct efx_nic *efx, ...@@ -390,8 +390,7 @@ static void efx_ptp_send_times(struct efx_nic *efx,
host_time = (now.ts_real.tv_sec << MC_NANOSECOND_BITS | host_time = (now.ts_real.tv_sec << MC_NANOSECOND_BITS |
now.ts_real.tv_nsec); now.ts_real.tv_nsec);
/* Update host time in NIC memory */ /* Update host time in NIC memory */
_efx_writed(efx, cpu_to_le32(host_time), efx->type->ptp_write_host_time(efx, host_time);
FR_CZ_MC_TREG_SMEM + MC_SMEM_P0_PTP_TIME_OFST);
} }
*last_time = now; *last_time = now;
} }
......
...@@ -853,6 +853,19 @@ static int siena_mtd_probe(struct efx_nic *efx) ...@@ -853,6 +853,19 @@ static int siena_mtd_probe(struct efx_nic *efx)
#endif /* CONFIG_SFC_MTD */ #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 * Revision-dependent attributes used by efx.c and nic.c
...@@ -943,6 +956,7 @@ const struct efx_nic_type siena_a0_nic_type = { ...@@ -943,6 +956,7 @@ const struct efx_nic_type siena_a0_nic_type = {
.mtd_write = efx_mcdi_mtd_write, .mtd_write = efx_mcdi_mtd_write,
.mtd_sync = efx_mcdi_mtd_sync, .mtd_sync = efx_mcdi_mtd_sync,
#endif #endif
.ptp_write_host_time = siena_ptp_write_host_time,
.revision = EFX_REV_SIENA_A0, .revision = EFX_REV_SIENA_A0,
.txd_ptr_tbl_base = FR_BZ_TX_DESC_PTR_TBL, .txd_ptr_tbl_base = FR_BZ_TX_DESC_PTR_TBL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment