Support programmable pins for Ocelot PTP driver
Subsystems (4)
v3 cover Support programmable pins for Ocelot PTP driver
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%)Signature · 1 line
2.7.4
PATCH v3 1/7 net: mscc: ocelot: move ocelot ptp clock code out of ocelot.c
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 is to move current ptp clock code out of ocelot.c driver maintaining as a single ocelot_ptp.c.
For futher new features implementation, the common code could be put in ocelot_ptp.c and the switch specific code should be in specific switch driver. The interrupt implementation in SoC is different between Ocelot and Felix.
---
Changes for v2:
- Put PTP driver under drivers/net/ethernet/mscc/.
- Initialized PTP separately in ocelot/felix platforms.
Changes for v3:
- None.
---
drivers/net/dsa/ocelot/felix.c | 25 +++
drivers/net/ethernet/mscc/Makefile | 2 +-
drivers/net/ethernet/mscc/ocelot.c | 206 ---------------------
drivers/net/ethernet/mscc/ocelot.h | 3 +-
drivers/net/ethernet/mscc/ocelot_board.c | 25 +++
drivers/net/ethernet/mscc/ocelot_ptp.c | 203 ++++++++++++++++++++
include/soc/mscc/ocelot.h | 1 -
.../net/ethernet => include/soc}/mscc/ocelot_ptp.h | 11 ++
8 files changed, 266 insertions(+), 210 deletions(-)
create mode 100644 drivers/net/ethernet/mscc/ocelot_ptp.c
rename {drivers/net/ethernet => include/soc}/mscc/ocelot_ptp.h (64%)drivers/net/dsa/ocelot/felix.c +25 -0
@@ -7,6 +7,7 @@#include <soc/mscc/ocelot_sys.h> #include <soc/mscc/ocelot_dev.h> #include <soc/mscc/ocelot_ana.h> +#include <soc/mscc/ocelot_ptp.h> #include <soc/mscc/ocelot.h> #include <linux/packing.h> #include <linux/module.h>
@@ -497,6 +498,21 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)return 0 ; } +static struct ptp_clock_info ocelot_ptp_clock_info = { + .owner =THIS_MODULE , + .name ="felix ptp" , + .max_adj =0x7fffffff , + .n_alarm =0 , + .n_ext_ts =0 , + .n_per_out =0 , + .n_pins =0 , + .pps =0 , + .gettime64 = ocelot_ptp_gettime64, + .settime64 = ocelot_ptp_settime64, + .adjtime = ocelot_ptp_adjtime, + .adjfine = ocelot_ptp_adjfine, +}; +/* Hardware initialization done here so that we can allocate structures with * devm without fear of dsa_register_switch returning -EPROBE_DEFER and causing * us to allocate structures twice (leak memory) and map PCI memory twice
@@ -513,6 +529,14 @@ static int felix_setup(struct dsa_switch *ds)return err;ocelot_init (ocelot); +if (ocelot->ptp) { + err =ocelot_init_timestamp (ocelot, &ocelot_ptp_clock_info); +if (err) { +dev_err (ocelot->dev, +"Timestamp initialization failed\n" ); + ocelot->ptp =0 ; + } + }for (port =0 ; port < ds->num_ports; port++) {ocelot_init_port (ocelot, port);
@@ -551,6 +575,7 @@ static void felix_teardown(struct dsa_switch *ds)if (felix->info->mdio_bus_free) felix->info->mdio_bus_free (ocelot); +ocelot_deinit_timestamp (ocelot);/* stop workqueue thread */ ocelot_deinit (ocelot); }
drivers/net/ethernet/mscc/Makefile +1 -1
@@ -1,5 +1,5 @@ # SPDX-License-Identifier: (GPL-2.0 OR MIT) obj-$(CONFIG_MSCC_OCELOT_SWITCH) += mscc_ocelot_common.o mscc_ocelot_common-y := ocelot.o ocelot_io.o -mscc_ocelot_common-y += ocelot_regs.o ocelot_tc.o ocelot_police.o ocelot_ace.o ocelot_flower.o +mscc_ocelot_common-y += ocelot_regs.o ocelot_tc.o ocelot_police.o ocelot_ace.o ocelot_flower.o ocelot_ptp.o obj-$(CONFIG_MSCC_OCELOT_SWITCH_OCELOT) += ocelot_board.o
drivers/net/ethernet/mscc/ocelot.c +0 -206
230 lines not on this page · raw message
drivers/net/ethernet/mscc/ocelot.h +1 -2
@@ -15,18 +15,17 @@#include <linux/phy.h> #include <linux/phy/phy.h> #include <linux/platform_device.h> -#include <linux/ptp_clock_kernel.h> #include <linux/regmap.h> #include <soc/mscc/ocelot_qsys.h> #include <soc/mscc/ocelot_sys.h> #include <soc/mscc/ocelot_dev.h> #include <soc/mscc/ocelot_ana.h> +#include <soc/mscc/ocelot_ptp.h> #include <soc/mscc/ocelot.h> #include "ocelot_rew.h" #include "ocelot_qs.h" #include "ocelot_tc.h" -#include "ocelot_ptp.h" #define OCELOT_BUFFER_CELL_SZ 60
drivers/net/ethernet/mscc/ocelot_board.c +25 -0
@@ -366,6 +366,21 @@ static const struct vcap_props vsc7514_vcap_props[] = { }, }; +static struct ptp_clock_info ocelot_ptp_clock_info = { + .owner =THIS_MODULE , + .name ="ocelot ptp" , + .max_adj =0x7fffffff , + .n_alarm =0 , + .n_ext_ts =0 , + .n_per_out =0 , + .n_pins =0 , + .pps =0 , + .gettime64 = ocelot_ptp_gettime64, + .settime64 = ocelot_ptp_settime64, + .adjtime = ocelot_ptp_adjtime, + .adjfine = ocelot_ptp_adjfine, +}; +static int mscc_ocelot_probe (struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node;
@@ -469,6 +484,15 @@ static int mscc_ocelot_probe(struct platform_device *pdev) ocelot->vcap = vsc7514_vcap_props;ocelot_init (ocelot); +if (ocelot->ptp) { + err =ocelot_init_timestamp (ocelot, &ocelot_ptp_clock_info); +if (err) { +dev_err (ocelot->dev, +"Timestamp initialization failed\n" ); + ocelot->ptp =0 ; + } + } +/* No NPI port */ ocelot_configure_cpu (ocelot,-1 ,OCELOT_TAG_PREFIX_NONE ,OCELOT_TAG_PREFIX_NONE );
@@ -574,6 +598,7 @@ static int mscc_ocelot_remove(struct platform_device *pdev) {struct ocelot *ocelot =platform_get_drvdata (pdev); +ocelot_deinit_timestamp (ocelot);ocelot_deinit (ocelot);unregister_switchdev_blocking_notifier (&ocelot_switchdev_blocking_nb);unregister_switchdev_notifier (&ocelot_switchdev_nb);
drivers/net/ethernet/mscc/ocelot_ptp.c new file +203 -0
203 lines not on this page · raw message
include/soc/mscc/ocelot.h +0 -1
@@ -618,7 +618,6 @@ int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,int ocelot_vlan_del (struct ocelot *ocelot,int port,u16 vid);int ocelot_hwstamp_get (struct ocelot *ocelot,int port,struct ifreq *ifr);int ocelot_hwstamp_set (struct ocelot *ocelot,int port,struct ifreq *ifr); -int ocelot_ptp_gettime64 (struct ptp_clock_info *ptp,struct timespec64 *ts);int ocelot_port_add_txtstamp_skb (struct ocelot_port *ocelot_port,struct sk_buff *skb);void ocelot_get_txtstamp (struct ocelot *ocelot);
include/soc/mscc/ocelot_ptp.h renamed from drivers/net/ethernet/mscc/ocelot_ptp.h +11 -0
@@ -4,11 +4,15 @@* * License: Dual MIT/GPL * Copyright (c) 2017 Microsemi Corporation +* Copyright 2020 NXP */ #ifndef _MSCC_OCELOT_PTP_H_#define _MSCC_OCELOT_PTP_H_ +#include <linux/ptp_clock_kernel.h> +#include <soc/mscc/ocelot.h> +#define PTP_PIN_CFG_RSZ 0x20#define PTP_PIN_TOD_SEC_MSB_RSZ PTP_PIN_CFG_RSZ#define PTP_PIN_TOD_SEC_LSB_RSZ PTP_PIN_CFG_RSZ
@@ -38,4 +42,11 @@ enum {#define PTP_CFG_CLK_ADJ_FREQ_NS BIT(30) +int ocelot_ptp_gettime64 (struct ptp_clock_info *ptp,struct timespec64 *ts); +int ocelot_ptp_settime64 (struct ptp_clock_info *ptp, +const struct timespec64 *ts); +int ocelot_ptp_adjtime (struct ptp_clock_info *ptp,s64 delta); +int ocelot_ptp_adjfine (struct ptp_clock_info *ptp,long scaled_ppm); +int ocelot_init_timestamp (struct ocelot *ocelot,struct ptp_clock_info *info); +int ocelot_deinit_timestamp (struct ocelot *ocelot);#endif
Signature · 1 line
2.7.4
PATCH v3 2/7 net: mscc: ocelot: fix timestamp info if ptp clock does not work
In reply to Yangbo LuThe timestamp info should be only software timestamp capabilities if ptp clock does not work.
---
Changes for v2:
- None.
Changes for v3:
- None.
--- drivers/net/ethernet/mscc/ocelot.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/mscc/ocelot.c +6 -0
@@ -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 |
Signature · 1 line
2.7.4
PATCH v3 3/7 net: mscc: ocelot: redefine PTP pins
In reply to Yangbo LuThere are 5 PTP_PINS register groups on Ocelot switch. Except the one used for TOD operations, there are still 4 register groups for programmable pins. So redefine the 4 programmable pins.
---
Changes for v2:
- None.
Changes for v3:
- None.
--- include/soc/mscc/ocelot.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
include/soc/mscc/ocelot.h +5 -4
@@ -440,10 +440,11 @@ enum ocelot_regfield { REGFIELD_MAX }; -enum ocelot_clk_pins { -ALT_PPS_PIN =1 , -EXT_CLK_PIN , -ALT_LDST_PIN , +enum ocelot_ptp_pins { +PTP_PIN_0 , +PTP_PIN_1 , +PTP_PIN_2 , +PTP_PIN_3 ,TOD_ACC_PIN };
Signature · 1 line
2.7.4
PATCH v3 4/7 net: mscc: ocelot: add wave programming registers definitions
In reply to Yangbo LuAdd wave programming registers definitions for Ocelot platforms.
---
Changes for v2:
- None.
Changes for v3:
- None.
--- drivers/net/dsa/ocelot/felix_vsc9959.c | 2 ++ drivers/net/ethernet/mscc/ocelot_regs.c | 2 ++ include/soc/mscc/ocelot.h | 2 ++ include/soc/mscc/ocelot_ptp.h | 2 ++ 4 files changed, 8 insertions(+)
drivers/net/dsa/ocelot/felix_vsc9959.c +2 -0
@@ -313,6 +313,8 @@ static const u32 vsc9959_ptp_regmap[] = {REG (PTP_PIN_TOD_SEC_MSB ,0x000004 ),REG (PTP_PIN_TOD_SEC_LSB ,0x000008 ),REG (PTP_PIN_TOD_NSEC ,0x00000c ), +REG (PTP_PIN_WF_HIGH_PERIOD ,0x000014 ), +REG (PTP_PIN_WF_LOW_PERIOD ,0x000018 ),REG (PTP_CFG_MISC ,0x0000a0 ),REG (PTP_CLK_CFG_ADJ_CFG ,0x0000a4 ), REG(PTP_CLK_CFG_ADJ_FREQ, 0x0000a8),
drivers/net/ethernet/mscc/ocelot_regs.c +2 -0
@@ -239,6 +239,8 @@ static const u32 ocelot_ptp_regmap[] = {REG (PTP_PIN_TOD_SEC_MSB ,0x000004 ),REG (PTP_PIN_TOD_SEC_LSB ,0x000008 ),REG (PTP_PIN_TOD_NSEC ,0x00000c ), +REG (PTP_PIN_WF_HIGH_PERIOD ,0x000014 ), +REG (PTP_PIN_WF_LOW_PERIOD ,0x000018 ),REG (PTP_CFG_MISC ,0x0000a0 ),REG (PTP_CLK_CFG_ADJ_CFG ,0x0000a4 ), REG(PTP_CLK_CFG_ADJ_FREQ, 0x0000a8),
include/soc/mscc/ocelot.h +2 -0
@@ -385,6 +385,8 @@ enum ocelot_reg {PTP_PIN_TOD_SEC_MSB ,PTP_PIN_TOD_SEC_LSB ,PTP_PIN_TOD_NSEC , +PTP_PIN_WF_HIGH_PERIOD , +PTP_PIN_WF_LOW_PERIOD ,PTP_CFG_MISC ,PTP_CLK_CFG_ADJ_CFG , PTP_CLK_CFG_ADJ_FREQ,
include/soc/mscc/ocelot_ptp.h +2 -0
@@ -17,6 +17,8 @@#define PTP_PIN_TOD_SEC_MSB_RSZ PTP_PIN_CFG_RSZ#define PTP_PIN_TOD_SEC_LSB_RSZ PTP_PIN_CFG_RSZ#define PTP_PIN_TOD_NSEC_RSZ PTP_PIN_CFG_RSZ +#define PTP_PIN_WF_HIGH_PERIOD_RSZ PTP_PIN_CFG_RSZ +#define PTP_PIN_WF_LOW_PERIOD_RSZ PTP_PIN_CFG_RSZ#define PTP_PIN_CFG_DOM BIT(0)#define PTP_PIN_CFG_SYNC BIT(2)
Signature · 1 line
2.7.4
PATCH v3 5/7 net: mscc: ocelot: support 4 PTP programmable pins
In reply to Yangbo LuSupport 4 PTP 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.
Since the hardware is not able to support absolute start time, the periodic clock request only allows start time 0 0. But nsec could be accepted for PPS case for phase adjustment.
---
Changes for v2:
- 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:
- None.
--- drivers/net/ethernet/mscc/ocelot_ptp.c | 121 +++++++++++++++++++++++++++++++++ include/soc/mscc/ocelot.h | 3 + include/soc/mscc/ocelot_ptp.h | 4 ++ 3 files changed, 128 insertions(+)
drivers/net/ethernet/mscc/ocelot_ptp.c +121 -0
@@ -165,11 +165,132 @@ int ocelot_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) }EXPORT_SYMBOL (ocelot_ptp_adjfine); +int ocelot_ptp_verify (struct ptp_clock_info *ptp,unsigned int pin, +enum ptp_pin_function func,unsigned int chan) +{ +switch (func) { +case PTP_PF_NONE : +case PTP_PF_PEROUT : +break ; +case PTP_PF_EXTTS : +case PTP_PF_PHYSYNC : +return -1 ; + } +return 0 ; +} +EXPORT_SYMBOL (ocelot_ptp_verify); + +int ocelot_ptp_enable (struct ptp_clock_info *ptp, +struct ptp_clock_request *rq,int on) +{ + struct ocelot *ocelot = container_of(ptp, struct ocelot, ptp_info); +struct timespec64 ts_start, ts_period; +enum ocelot_ptp_pins ptp_pin; +unsigned long flags; +bool pps = false; +int pin =-1 ; +u32 val; +s64 ns; + +switch (rq->type) { +case PTP_CLK_REQ_PEROUT : +/* Reject requests with unsupported flags */ +if (rq->perout.flags) +return -EOPNOTSUPP ; + + pin =ptp_find_pin (ocelot->ptp_clock,PTP_PF_PEROUT , + rq->perout.index); +if (pin ==0 ) + ptp_pin =PTP_PIN_0 ; +else if (pin ==1 ) + ptp_pin =PTP_PIN_1 ; +else if (pin ==2 ) + ptp_pin =PTP_PIN_2 ; +else if (pin ==3 ) + ptp_pin =PTP_PIN_3 ; +else +return -EBUSY ; + + ts_start.tv_sec = rq->perout.start.sec; + ts_start.tv_nsec = rq->perout.start.nsec; + ts_period.tv_sec = rq->perout.period.sec; + ts_period.tv_nsec = rq->perout.period.nsec; + +if (ts_period.tv_sec ==1 && ts_period.tv_nsec ==0 ) + pps = true; + +if (ts_start.tv_sec || (ts_start.tv_nsec && !pps)) { +dev_warn (ocelot->dev, +"Absolute start time not supported!\n" ); +dev_warn (ocelot->dev, +"Accept nsec for PPS phase adjustment, otherwise start time should be 0 0.\n" ); +return -EINVAL ; + } + +/* Handle turning off */ +if (!on) { +spin_lock_irqsave (&ocelot->ptp_clock_lock, flags); + val =PTP_PIN_CFG_ACTION (PTP_PIN_ACTION_IDLE ); +ocelot_write_rix (ocelot, val,PTP_PIN_CFG , ptp_pin); +spin_unlock_irqrestore (&ocelot->ptp_clock_lock, flags); +break ; + } + +/* Handle PPS request */ +if (pps) { +spin_lock_irqsave (&ocelot->ptp_clock_lock, flags); +/* Pulse generated perout.start.nsec after TOD has +* increased seconds. +* Pulse width is set to 1us. +*/ +ocelot_write_rix (ocelot, ts_start.tv_nsec, +PTP_PIN_WF_LOW_PERIOD , ptp_pin); +ocelot_write_rix (ocelot,1000 , +PTP_PIN_WF_HIGH_PERIOD , ptp_pin); + val =PTP_PIN_CFG_ACTION (PTP_PIN_ACTION_CLOCK ); + val |=PTP_PIN_CFG_SYNC ; +ocelot_write_rix (ocelot, val,PTP_PIN_CFG , ptp_pin); +spin_unlock_irqrestore (&ocelot->ptp_clock_lock, flags); +break ; + } + +/* Handle periodic clock */ + ns =timespec64_to_ns (&ts_period); + ns = ns >>1 ; +if (ns >0x3fffffff || ns <=0x6 ) +return -EINVAL ; + +spin_lock_irqsave (&ocelot->ptp_clock_lock, flags); +ocelot_write_rix (ocelot, ns,PTP_PIN_WF_LOW_PERIOD , ptp_pin); +ocelot_write_rix (ocelot, ns,PTP_PIN_WF_HIGH_PERIOD , ptp_pin); + val =PTP_PIN_CFG_ACTION (PTP_PIN_ACTION_CLOCK ); +ocelot_write_rix (ocelot, val,PTP_PIN_CFG , ptp_pin); +spin_unlock_irqrestore (&ocelot->ptp_clock_lock, flags); +break ; +default : +return -EOPNOTSUPP ; + } +return 0 ; +} +EXPORT_SYMBOL (ocelot_ptp_enable); +int ocelot_init_timestamp (struct ocelot *ocelot,struct ptp_clock_info *info) {struct ptp_clock *ptp_clock; +int i; ocelot->ptp_info = *info; + +for (i =0 ; i <OCELOT_PTP_PINS_NUM ; i++) { +struct ptp_pin_desc *p = &ocelot->ptp_pins[i]; + +snprintf (p->name,sizeof (p->name),"switch_1588_dat%d" , i); + p->index = i; + p->func =PTP_PF_NONE ; + } + + ocelot->ptp_info.pin_config = &ocelot->ptp_pins[0 ]; + ptp_clock =ptp_clock_register (&ocelot->ptp_info, ocelot->dev);if (IS_ERR (ptp_clock))return PTR_ERR (ptp_clock);
include/soc/mscc/ocelot.h +3 -0
@@ -92,6 +92,8 @@#define OCELOT_SPEED_100 2#define OCELOT_SPEED_10 3 +#define OCELOT_PTP_PINS_NUM 4 +#define TARGET_OFFSET 24#define REG_MASK GENMASK(TARGET_OFFSET - 1, 0)#define REG (reg, offset) [reg & REG_MASK] = offset
@@ -550,6 +552,7 @@ struct ocelot {struct mutex ptp_lock;/* Protects the PTP clock */ spinlock_t ptp_clock_lock; +struct ptp_pin_desc ptp_pins[OCELOT_PTP_PINS_NUM ]; };struct ocelot_policer {
include/soc/mscc/ocelot_ptp.h +4 -0
@@ -49,6 +49,10 @@ int ocelot_ptp_settime64(struct ptp_clock_info *ptp, const struct timespec64 *ts);int ocelot_ptp_adjtime (struct ptp_clock_info *ptp,s64 delta);int ocelot_ptp_adjfine (struct ptp_clock_info *ptp,long scaled_ppm); +int ocelot_ptp_verify (struct ptp_clock_info *ptp,unsigned int pin, +enum ptp_pin_function func,unsigned int chan); +int ocelot_ptp_enable (struct ptp_clock_info *ptp, +struct ptp_clock_request *rq,int on);int ocelot_init_timestamp (struct ocelot *ocelot,struct ptp_clock_info *info);int ocelot_deinit_timestamp (struct ocelot *ocelot);#endif
Signature · 1 line
2.7.4
PATCH v3 6/7 net: mscc: ocelot: enable PTP programmable pin
In reply to Yangbo LuEnable PTP programmable pin.
---
Changes for v2:
- Added this patch.
Changes for v3:
- None.
--- drivers/net/ethernet/mscc/ocelot_board.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/mscc/ocelot_board.c +4 -2
@@ -372,13 +372,15 @@ static struct ptp_clock_info ocelot_ptp_clock_info = { .max_adj = 0x7fffffff, .n_alarm = 0, .n_ext_ts = 0, - .n_per_out = 0, - .n_pins = 0, + .n_per_out = OCELOT_PTP_PINS_NUM, + .n_pins = OCELOT_PTP_PINS_NUM, .pps = 0, .gettime64 = ocelot_ptp_gettime64, .settime64 = ocelot_ptp_settime64, .adjtime = ocelot_ptp_adjtime, .adjfine = ocelot_ptp_adjfine, + .verify = ocelot_ptp_verify, + .enable = ocelot_ptp_enable, };static int mscc_ocelot_probe (struct platform_device *pdev)
Signature · 1 line
2.7.4
PATCH v3 7/7 net: dsa: felix: enable PTP programmable pin
In reply to Yangbo LuEnable PTP programmable pin.
---
Changes for v2:
- Added this patch.
Changes for v3:
- None.
--- drivers/net/dsa/ocelot/felix.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/dsa/ocelot/felix.c +4 -2
@@ -504,13 +504,15 @@ static struct ptp_clock_info ocelot_ptp_clock_info = { .max_adj = 0x7fffffff, .n_alarm = 0, .n_ext_ts = 0, - .n_per_out = 0, - .n_pins = 0, + .n_per_out = OCELOT_PTP_PINS_NUM, + .n_pins = OCELOT_PTP_PINS_NUM, .pps = 0, .gettime64 = ocelot_ptp_gettime64, .settime64 = ocelot_ptp_settime64, .adjtime = ocelot_ptp_adjtime, .adjfine = ocelot_ptp_adjfine, + .verify = ocelot_ptp_verify, + .enable = ocelot_ptp_enable, };/* Hardware initialization done here so that we can allocate structures with
Signature · 1 line
2.7.4
David Miller
maintainerFrom: Yangbo Lu <[email protected]>
Date: Mon, 20 Apr 2020 10:46:44 +0800
Quoted 4 lines
The Ocelot PTP clock driver had been embedded into
ocelot.cdriver. It had supported basic gettime64/settime64/adjtime/adjfine functions by now which were used by both Ocelot switch and Felix switch.
Quoted 16 lines
This patch-set is to move current ptp clock code out of
ocelot.cdriver maintaining as a singleocelot_ptp.cdriver, and to implement 4 programmable pins with onlyPTP_PF_PEROUTfunction for now.
ThePTP_PF_EXTTSfunction 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 underdrivers/net/ethernet/mscc/.
- DroppedMAINTAINERSpatch. 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-EBUSYif not finding pin available.
Changes for v3:
- Re-sent.
Series applied to net-next, thanks.