Commit 14193ea2 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

can: mcp251xfd: mcp251xfd_chip_timestamp_init(): factor out into separate function

This patch factors out the timestamp initialization from the clock
initialization.

This is a preparation patch for the PLL support, where clock and
timestamp init must be done separately.

Link: https://lore.kernel.org/all/20220207131047.282110-11-mkl@pengutronix.deSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 01a80d68
...@@ -421,6 +421,11 @@ static int mcp251xfd_chip_clock_init(const struct mcp251xfd_priv *priv) ...@@ -421,6 +421,11 @@ static int mcp251xfd_chip_clock_init(const struct mcp251xfd_priv *priv)
if (err) if (err)
return err; return err;
return 0;
}
static int mcp251xfd_chip_timestamp_init(const struct mcp251xfd_priv *priv)
{
/* Set Time Base Counter Prescaler to 1. /* Set Time Base Counter Prescaler to 1.
* *
* This means an overflow of the 32 bit Time Base Counter * This means an overflow of the 32 bit Time Base Counter
...@@ -683,6 +688,10 @@ static int mcp251xfd_chip_start(struct mcp251xfd_priv *priv) ...@@ -683,6 +688,10 @@ static int mcp251xfd_chip_start(struct mcp251xfd_priv *priv)
if (err) if (err)
goto out_chip_stop; goto out_chip_stop;
err = mcp251xfd_chip_timestamp_init(priv);
if (err)
goto out_chip_stop;
err = mcp251xfd_set_bittiming(priv); err = mcp251xfd_set_bittiming(priv);
if (err) if (err)
goto out_chip_stop; goto out_chip_stop;
......
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