Skip to content

Commit

Permalink
sfc: Add a function pointer to abstract write of host time into NIC s…
Browse files Browse the repository at this point in the history
…hared memory

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
  • Loading branch information
Laurence Evans authored and Ben Hutchings committed Aug 27, 2013
1 parent c1d828b commit 977a5d5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/net/ethernet/sfc/net_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/ethernet/sfc/ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
14 changes: 14 additions & 0 deletions drivers/net/ethernet/sfc/siena.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,19 @@ static int siena_mtd_probe(struct efx_nic *efx)

#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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 977a5d5

Please sign in to comment.