From: Clark Wang On i.MX952 (NETC revision 4.6) the NETC system clock runs at 133 MHz instead of 333 MHz. If no reference clock is given in the device tree, the timer uses the system clock, so its default frequency must match, otherwise the PTP clock runs at the wrong rate. The revision is read before the device tree is parsed, so it can be used to select the default frequency. Signed-off-by: Clark Wang [fs: from NXP 8af062154e48] Signed-off-by: Frieder Schrempf --- drivers/ptp/ptp_netc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/ptp/ptp_netc.c b/drivers/ptp/ptp_netc.c index 1a327a7561e39..7b9c0a4cbb4c3 100644 --- a/drivers/ptp/ptp_netc.c +++ b/drivers/ptp/ptp_netc.c @@ -72,6 +72,7 @@ #define NETC_GLOBAL_IPBRR0 0xbf8 #define IPBRR0_IP_REV GENMASK(15, 0) #define NETC_REV_4_1 0x0401 +#define NETC_REV_4_6 0x0406 #define NETC_TMR_FIPER_NUM 3 #define NETC_TMR_INVALID_CHANNEL NETC_TMR_FIPER_NUM @@ -88,6 +89,7 @@ #define NETC_TMR_EXT_OSC 2 /* tmr_1588_clk, from IO pins */ #define NETC_TMR_SYSCLK_333M 333333333U +#define NETC_TMR_SYSCLK_133M 133333333U enum netc_pp_type { NETC_PP_PPS = 1, @@ -858,7 +860,10 @@ static int netc_timer_get_reference_clk_source(struct netc_timer *priv) /* Select NETC system clock as the reference clock by default */ priv->clk_select = NETC_TMR_SYSTEM_CLK; - priv->clk_freq = NETC_TMR_SYSCLK_333M; + if (priv->revision == NETC_REV_4_6) + priv->clk_freq = NETC_TMR_SYSCLK_133M; + else + priv->clk_freq = NETC_TMR_SYSCLK_333M; /* Update the clock source of the reference clock if the clock * is specified in DT node. -- 2.56.0