The Ocelot PTP clock driver had been embedded into ocelot.c driver.
It had supported basic gettime64/settime64/adjtime/adjfine functions
by now which were used by both Ocelot switch and Felix switch.
This patch-set is to move current ptp clock code out of ocelot.c driver
maintaining as a single ocelot_ptp.c driver, and to implement 4
programmable pins with only PTP_PF_PEROUT function for now.
The PTP_PF_EXTTS function will be supported in the future, and it should
be implemented separately for Felix and Ocelot, because of different
hardware interrupt implementation in them.
---
Changes for v2:
- Put PTP driver under drivers/net/ethernet/mscc/.
- Dropped MAINTAINERS patch. Kept original maintaining.
- Initialized PTP separately in ocelot/felix platforms.
- Supported PPS case in programmable pin.
- Supported disabling pin function since deadlock is fixed by Richard.
- Returned -EBUSY if not finding pin available.
Changes for v3:
- Re-sent.
Yangbo Lu (7):
net: mscc: ocelot: move ocelot ptp clock code out of ocelot.c
net: mscc: ocelot: fix timestamp info if ptp clock does not work
net: mscc: ocelot: redefine PTP pins
net: mscc: ocelot: add wave programming registers definitions
net: mscc: ocelot: support 4 PTP programmable pins
net: mscc: ocelot: enable PTP programmable pin
net: dsa: felix: enable PTP programmable pin
drivers/net/dsa/ocelot/felix.c | 27 ++
drivers/net/dsa/ocelot/felix_vsc9959.c | 2 +
drivers/net/ethernet/mscc/Makefile | 2 +-
drivers/net/ethernet/mscc/ocelot.c | 212 +-------------
drivers/net/ethernet/mscc/ocelot.h | 3 +-
drivers/net/ethernet/mscc/ocelot_board.c | 27 ++
drivers/net/ethernet/mscc/ocelot_ptp.c | 324 +++++++++++++++++++++
drivers/net/ethernet/mscc/ocelot_regs.c | 2 +
include/soc/mscc/ocelot.h | 15 +-
.../net/ethernet => include/soc}/mscc/ocelot_ptp.h | 17 ++
10 files changed, 417 insertions(+), 214 deletions(-)
create mode 100644 drivers/net/ethernet/mscc/ocelot_ptp.c
rename {drivers/net/ethernet => include/soc}/mscc/ocelot_ptp.h (52%)
--
2.7.4
The timestamp info should be only software timestamp capabilities
if ptp clock does not work.
Signed-off-by: Yangbo Lu <[email protected]>
---
Changes for v2:
- None.
Changes for v3:
- None.
---
drivers/net/ethernet/mscc/ocelot.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index 6cfd6dc..bd6692a 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -1346,6 +1346,12 @@ int ocelot_get_ts_info(struct ocelot *ocelot, int port,
{
info->phc_index = ocelot->ptp_clock ?
ptp_clock_index(ocelot->ptp_clock) : -1;
+ if (info->phc_index == -1) {
+ info->so_timestamping |= SOF_TIMESTAMPING_TX_SOFTWARE |
+ SOF_TIMESTAMPING_RX_SOFTWARE |
+ SOF_TIMESTAMPING_SOFTWARE;
+ return 0;
+ }
info->so_timestamping |= SOF_TIMESTAMPING_TX_SOFTWARE |
SOF_TIMESTAMPING_RX_SOFTWARE |
SOF_TIMESTAMPING_SOFTWARE |
--
2.7.4
From: Yangbo Lu <[email protected]>
Date: Mon, 20 Apr 2020 10:46:44 +0800
> The Ocelot PTP clock driver had been embedded into ocelot.c driver.
> It had supported basic gettime64/settime64/adjtime/adjfine functions
> by now which were used by both Ocelot switch and Felix switch.
>
> This patch-set is to move current ptp clock code out of ocelot.c driver
> maintaining as a single ocelot_ptp.c driver, and to implement 4
> programmable pins with only PTP_PF_PEROUT function for now.
> The PTP_PF_EXTTS function will be supported in the future, and it should
> be implemented separately for Felix and Ocelot, because of different
> hardware interrupt implementation in them.
> ---
> Changes for v2:
> - Put PTP driver under drivers/net/ethernet/mscc/.
> - Dropped MAINTAINERS patch. Kept original maintaining.
> - Initialized PTP separately in ocelot/felix platforms.
> - Supported PPS case in programmable pin.
> - Supported disabling pin function since deadlock is fixed by Richard.
> - Returned -EBUSY if not finding pin available.
> Changes for v3:
> - Re-sent.
Series applied to net-next, thanks.