162306a36Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * DSA driver for: 462306a36Sopenharmony_ci * Hirschmann Hellcreek TSN switch. 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * Copyright (C) 2019-2021 Linutronix GmbH 762306a36Sopenharmony_ci * Author Kurt Kanzenbach <kurt@linutronix.de> 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#ifndef _HELLCREEK_H_ 1162306a36Sopenharmony_ci#define _HELLCREEK_H_ 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#include <linux/bitmap.h> 1462306a36Sopenharmony_ci#include <linux/bitops.h> 1562306a36Sopenharmony_ci#include <linux/device.h> 1662306a36Sopenharmony_ci#include <linux/kernel.h> 1762306a36Sopenharmony_ci#include <linux/mutex.h> 1862306a36Sopenharmony_ci#include <linux/workqueue.h> 1962306a36Sopenharmony_ci#include <linux/leds.h> 2062306a36Sopenharmony_ci#include <linux/platform_data/hirschmann-hellcreek.h> 2162306a36Sopenharmony_ci#include <linux/ptp_clock_kernel.h> 2262306a36Sopenharmony_ci#include <linux/timecounter.h> 2362306a36Sopenharmony_ci#include <net/dsa.h> 2462306a36Sopenharmony_ci#include <net/pkt_sched.h> 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci/* Ports: 2762306a36Sopenharmony_ci * - 0: CPU 2862306a36Sopenharmony_ci * - 1: Tunnel 2962306a36Sopenharmony_ci * - 2: TSN front port 1 3062306a36Sopenharmony_ci * - 3: TSN front port 2 3162306a36Sopenharmony_ci * - ... 3262306a36Sopenharmony_ci */ 3362306a36Sopenharmony_ci#define CPU_PORT 0 3462306a36Sopenharmony_ci#define TUNNEL_PORT 1 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci#define HELLCREEK_VLAN_NO_MEMBER 0x0 3762306a36Sopenharmony_ci#define HELLCREEK_VLAN_UNTAGGED_MEMBER 0x1 3862306a36Sopenharmony_ci#define HELLCREEK_VLAN_TAGGED_MEMBER 0x3 3962306a36Sopenharmony_ci#define HELLCREEK_NUM_EGRESS_QUEUES 8 4062306a36Sopenharmony_ci#define HELLCREEK_DEFAULT_MAX_SDU 1536 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci/* Register definitions */ 4362306a36Sopenharmony_ci#define HR_MODID_C (0 * 2) 4462306a36Sopenharmony_ci#define HR_REL_L_C (1 * 2) 4562306a36Sopenharmony_ci#define HR_REL_H_C (2 * 2) 4662306a36Sopenharmony_ci#define HR_BLD_L_C (3 * 2) 4762306a36Sopenharmony_ci#define HR_BLD_H_C (4 * 2) 4862306a36Sopenharmony_ci#define HR_CTRL_C (5 * 2) 4962306a36Sopenharmony_ci#define HR_CTRL_C_READY BIT(14) 5062306a36Sopenharmony_ci#define HR_CTRL_C_TRANSITION BIT(13) 5162306a36Sopenharmony_ci#define HR_CTRL_C_ENABLE BIT(0) 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci#define HR_PSEL (0xa6 * 2) 5462306a36Sopenharmony_ci#define HR_PSEL_PTWSEL_SHIFT 4 5562306a36Sopenharmony_ci#define HR_PSEL_PTWSEL_MASK GENMASK(5, 4) 5662306a36Sopenharmony_ci#define HR_PSEL_PRTCWSEL_SHIFT 0 5762306a36Sopenharmony_ci#define HR_PSEL_PRTCWSEL_MASK GENMASK(2, 0) 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci#define HR_PTCFG (0xa7 * 2) 6062306a36Sopenharmony_ci#define HR_PTCFG_MLIMIT_EN BIT(13) 6162306a36Sopenharmony_ci#define HR_PTCFG_UMC_FLT BIT(10) 6262306a36Sopenharmony_ci#define HR_PTCFG_UUC_FLT BIT(9) 6362306a36Sopenharmony_ci#define HR_PTCFG_UNTRUST BIT(8) 6462306a36Sopenharmony_ci#define HR_PTCFG_TAG_REQUIRED BIT(7) 6562306a36Sopenharmony_ci#define HR_PTCFG_PPRIO_SHIFT 4 6662306a36Sopenharmony_ci#define HR_PTCFG_PPRIO_MASK GENMASK(6, 4) 6762306a36Sopenharmony_ci#define HR_PTCFG_INGRESSFLT BIT(3) 6862306a36Sopenharmony_ci#define HR_PTCFG_BLOCKED BIT(2) 6962306a36Sopenharmony_ci#define HR_PTCFG_LEARNING_EN BIT(1) 7062306a36Sopenharmony_ci#define HR_PTCFG_ADMIN_EN BIT(0) 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ci#define HR_PRTCCFG (0xa8 * 2) 7362306a36Sopenharmony_ci#define HR_PRTCCFG_PCP_TC_MAP_SHIFT 0 7462306a36Sopenharmony_ci#define HR_PRTCCFG_PCP_TC_MAP_MASK GENMASK(2, 0) 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci#define HR_PTPRTCCFG (0xa9 * 2) 7762306a36Sopenharmony_ci#define HR_PTPRTCCFG_SET_QTRACK BIT(15) 7862306a36Sopenharmony_ci#define HR_PTPRTCCFG_REJECT BIT(14) 7962306a36Sopenharmony_ci#define HR_PTPRTCCFG_MAXSDU_SHIFT 0 8062306a36Sopenharmony_ci#define HR_PTPRTCCFG_MAXSDU_MASK GENMASK(10, 0) 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci#define HR_CSEL (0x8d * 2) 8362306a36Sopenharmony_ci#define HR_CSEL_SHIFT 0 8462306a36Sopenharmony_ci#define HR_CSEL_MASK GENMASK(7, 0) 8562306a36Sopenharmony_ci#define HR_CRDL (0x8e * 2) 8662306a36Sopenharmony_ci#define HR_CRDH (0x8f * 2) 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci#define HR_SWTRC_CFG (0x90 * 2) 8962306a36Sopenharmony_ci#define HR_SWTRC0 (0x91 * 2) 9062306a36Sopenharmony_ci#define HR_SWTRC1 (0x92 * 2) 9162306a36Sopenharmony_ci#define HR_PFREE (0x93 * 2) 9262306a36Sopenharmony_ci#define HR_MFREE (0x94 * 2) 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ci#define HR_FDBAGE (0x97 * 2) 9562306a36Sopenharmony_ci#define HR_FDBMAX (0x98 * 2) 9662306a36Sopenharmony_ci#define HR_FDBRDL (0x99 * 2) 9762306a36Sopenharmony_ci#define HR_FDBRDM (0x9a * 2) 9862306a36Sopenharmony_ci#define HR_FDBRDH (0x9b * 2) 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci#define HR_FDBMDRD (0x9c * 2) 10162306a36Sopenharmony_ci#define HR_FDBMDRD_PORTMASK_SHIFT 0 10262306a36Sopenharmony_ci#define HR_FDBMDRD_PORTMASK_MASK GENMASK(3, 0) 10362306a36Sopenharmony_ci#define HR_FDBMDRD_AGE_SHIFT 4 10462306a36Sopenharmony_ci#define HR_FDBMDRD_AGE_MASK GENMASK(7, 4) 10562306a36Sopenharmony_ci#define HR_FDBMDRD_OBT BIT(8) 10662306a36Sopenharmony_ci#define HR_FDBMDRD_PASS_BLOCKED BIT(9) 10762306a36Sopenharmony_ci#define HR_FDBMDRD_STATIC BIT(11) 10862306a36Sopenharmony_ci#define HR_FDBMDRD_REPRIO_TC_SHIFT 12 10962306a36Sopenharmony_ci#define HR_FDBMDRD_REPRIO_TC_MASK GENMASK(14, 12) 11062306a36Sopenharmony_ci#define HR_FDBMDRD_REPRIO_EN BIT(15) 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci#define HR_FDBWDL (0x9d * 2) 11362306a36Sopenharmony_ci#define HR_FDBWDM (0x9e * 2) 11462306a36Sopenharmony_ci#define HR_FDBWDH (0x9f * 2) 11562306a36Sopenharmony_ci#define HR_FDBWRM0 (0xa0 * 2) 11662306a36Sopenharmony_ci#define HR_FDBWRM0_PORTMASK_SHIFT 0 11762306a36Sopenharmony_ci#define HR_FDBWRM0_PORTMASK_MASK GENMASK(3, 0) 11862306a36Sopenharmony_ci#define HR_FDBWRM0_OBT BIT(8) 11962306a36Sopenharmony_ci#define HR_FDBWRM0_PASS_BLOCKED BIT(9) 12062306a36Sopenharmony_ci#define HR_FDBWRM0_REPRIO_TC_SHIFT 12 12162306a36Sopenharmony_ci#define HR_FDBWRM0_REPRIO_TC_MASK GENMASK(14, 12) 12262306a36Sopenharmony_ci#define HR_FDBWRM0_REPRIO_EN BIT(15) 12362306a36Sopenharmony_ci#define HR_FDBWRM1 (0xa1 * 2) 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci#define HR_FDBWRCMD (0xa2 * 2) 12662306a36Sopenharmony_ci#define HR_FDBWRCMD_FDBDEL BIT(9) 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ci#define HR_SWCFG (0xa3 * 2) 12962306a36Sopenharmony_ci#define HR_SWCFG_GM_STATEMD BIT(15) 13062306a36Sopenharmony_ci#define HR_SWCFG_LAS_MODE_SHIFT 12 13162306a36Sopenharmony_ci#define HR_SWCFG_LAS_MODE_MASK GENMASK(13, 12) 13262306a36Sopenharmony_ci#define HR_SWCFG_LAS_OFF (0x00) 13362306a36Sopenharmony_ci#define HR_SWCFG_LAS_ON (0x01) 13462306a36Sopenharmony_ci#define HR_SWCFG_LAS_STATIC (0x10) 13562306a36Sopenharmony_ci#define HR_SWCFG_CT_EN BIT(11) 13662306a36Sopenharmony_ci#define HR_SWCFG_VLAN_UNAWARE BIT(10) 13762306a36Sopenharmony_ci#define HR_SWCFG_ALWAYS_OBT BIT(9) 13862306a36Sopenharmony_ci#define HR_SWCFG_FDBAGE_EN BIT(5) 13962306a36Sopenharmony_ci#define HR_SWCFG_FDBLRN_EN BIT(4) 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ci#define HR_SWSTAT (0xa4 * 2) 14262306a36Sopenharmony_ci#define HR_SWSTAT_FAIL BIT(4) 14362306a36Sopenharmony_ci#define HR_SWSTAT_BUSY BIT(0) 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_ci#define HR_SWCMD (0xa5 * 2) 14662306a36Sopenharmony_ci#define HW_SWCMD_FLUSH BIT(0) 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci#define HR_VIDCFG (0xaa * 2) 14962306a36Sopenharmony_ci#define HR_VIDCFG_VID_SHIFT 0 15062306a36Sopenharmony_ci#define HR_VIDCFG_VID_MASK GENMASK(11, 0) 15162306a36Sopenharmony_ci#define HR_VIDCFG_PVID BIT(12) 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ci#define HR_VIDMBRCFG (0xab * 2) 15462306a36Sopenharmony_ci#define HR_VIDMBRCFG_P0MBR_SHIFT 0 15562306a36Sopenharmony_ci#define HR_VIDMBRCFG_P0MBR_MASK GENMASK(1, 0) 15662306a36Sopenharmony_ci#define HR_VIDMBRCFG_P1MBR_SHIFT 2 15762306a36Sopenharmony_ci#define HR_VIDMBRCFG_P1MBR_MASK GENMASK(3, 2) 15862306a36Sopenharmony_ci#define HR_VIDMBRCFG_P2MBR_SHIFT 4 15962306a36Sopenharmony_ci#define HR_VIDMBRCFG_P2MBR_MASK GENMASK(5, 4) 16062306a36Sopenharmony_ci#define HR_VIDMBRCFG_P3MBR_SHIFT 6 16162306a36Sopenharmony_ci#define HR_VIDMBRCFG_P3MBR_MASK GENMASK(7, 6) 16262306a36Sopenharmony_ci 16362306a36Sopenharmony_ci#define HR_FEABITS0 (0xac * 2) 16462306a36Sopenharmony_ci#define HR_FEABITS0_FDBBINS_SHIFT 4 16562306a36Sopenharmony_ci#define HR_FEABITS0_FDBBINS_MASK GENMASK(7, 4) 16662306a36Sopenharmony_ci#define HR_FEABITS0_PCNT_SHIFT 8 16762306a36Sopenharmony_ci#define HR_FEABITS0_PCNT_MASK GENMASK(11, 8) 16862306a36Sopenharmony_ci#define HR_FEABITS0_MCNT_SHIFT 12 16962306a36Sopenharmony_ci#define HR_FEABITS0_MCNT_MASK GENMASK(15, 12) 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_ci#define TR_QTRACK (0xb1 * 2) 17262306a36Sopenharmony_ci#define TR_TGDVER (0xb3 * 2) 17362306a36Sopenharmony_ci#define TR_TGDVER_REV_MIN_MASK GENMASK(7, 0) 17462306a36Sopenharmony_ci#define TR_TGDVER_REV_MIN_SHIFT 0 17562306a36Sopenharmony_ci#define TR_TGDVER_REV_MAJ_MASK GENMASK(15, 8) 17662306a36Sopenharmony_ci#define TR_TGDVER_REV_MAJ_SHIFT 8 17762306a36Sopenharmony_ci#define TR_TGDSEL (0xb4 * 2) 17862306a36Sopenharmony_ci#define TR_TGDSEL_TDGSEL_MASK GENMASK(1, 0) 17962306a36Sopenharmony_ci#define TR_TGDSEL_TDGSEL_SHIFT 0 18062306a36Sopenharmony_ci#define TR_TGDCTRL (0xb5 * 2) 18162306a36Sopenharmony_ci#define TR_TGDCTRL_GATE_EN BIT(0) 18262306a36Sopenharmony_ci#define TR_TGDCTRL_CYC_SNAP BIT(4) 18362306a36Sopenharmony_ci#define TR_TGDCTRL_SNAP_EST BIT(5) 18462306a36Sopenharmony_ci#define TR_TGDCTRL_ADMINGATESTATES_MASK GENMASK(15, 8) 18562306a36Sopenharmony_ci#define TR_TGDCTRL_ADMINGATESTATES_SHIFT 8 18662306a36Sopenharmony_ci#define TR_TGDSTAT0 (0xb6 * 2) 18762306a36Sopenharmony_ci#define TR_TGDSTAT1 (0xb7 * 2) 18862306a36Sopenharmony_ci#define TR_ESTWRL (0xb8 * 2) 18962306a36Sopenharmony_ci#define TR_ESTWRH (0xb9 * 2) 19062306a36Sopenharmony_ci#define TR_ESTCMD (0xba * 2) 19162306a36Sopenharmony_ci#define TR_ESTCMD_ESTSEC_MASK GENMASK(2, 0) 19262306a36Sopenharmony_ci#define TR_ESTCMD_ESTSEC_SHIFT 0 19362306a36Sopenharmony_ci#define TR_ESTCMD_ESTARM BIT(4) 19462306a36Sopenharmony_ci#define TR_ESTCMD_ESTSWCFG BIT(5) 19562306a36Sopenharmony_ci#define TR_EETWRL (0xbb * 2) 19662306a36Sopenharmony_ci#define TR_EETWRH (0xbc * 2) 19762306a36Sopenharmony_ci#define TR_EETCMD (0xbd * 2) 19862306a36Sopenharmony_ci#define TR_EETCMD_EETSEC_MASK GEMASK(2, 0) 19962306a36Sopenharmony_ci#define TR_EETCMD_EETSEC_SHIFT 0 20062306a36Sopenharmony_ci#define TR_EETCMD_EETARM BIT(4) 20162306a36Sopenharmony_ci#define TR_CTWRL (0xbe * 2) 20262306a36Sopenharmony_ci#define TR_CTWRH (0xbf * 2) 20362306a36Sopenharmony_ci#define TR_LCNSL (0xc1 * 2) 20462306a36Sopenharmony_ci#define TR_LCNSH (0xc2 * 2) 20562306a36Sopenharmony_ci#define TR_LCS (0xc3 * 2) 20662306a36Sopenharmony_ci#define TR_GCLDAT (0xc4 * 2) 20762306a36Sopenharmony_ci#define TR_GCLDAT_GCLWRGATES_MASK GENMASK(7, 0) 20862306a36Sopenharmony_ci#define TR_GCLDAT_GCLWRGATES_SHIFT 0 20962306a36Sopenharmony_ci#define TR_GCLDAT_GCLWRLAST BIT(8) 21062306a36Sopenharmony_ci#define TR_GCLDAT_GCLOVRI BIT(9) 21162306a36Sopenharmony_ci#define TR_GCLTIL (0xc5 * 2) 21262306a36Sopenharmony_ci#define TR_GCLTIH (0xc6 * 2) 21362306a36Sopenharmony_ci#define TR_GCLCMD (0xc7 * 2) 21462306a36Sopenharmony_ci#define TR_GCLCMD_GCLWRADR_MASK GENMASK(7, 0) 21562306a36Sopenharmony_ci#define TR_GCLCMD_GCLWRADR_SHIFT 0 21662306a36Sopenharmony_ci#define TR_GCLCMD_INIT_GATE_STATES_MASK GENMASK(15, 8) 21762306a36Sopenharmony_ci#define TR_GCLCMD_INIT_GATE_STATES_SHIFT 8 21862306a36Sopenharmony_ci 21962306a36Sopenharmony_cistruct hellcreek_counter { 22062306a36Sopenharmony_ci u8 offset; 22162306a36Sopenharmony_ci const char *name; 22262306a36Sopenharmony_ci}; 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_cistruct hellcreek; 22562306a36Sopenharmony_ci 22662306a36Sopenharmony_ci/* State flags for hellcreek_port_hwtstamp::state */ 22762306a36Sopenharmony_cienum { 22862306a36Sopenharmony_ci HELLCREEK_HWTSTAMP_ENABLED, 22962306a36Sopenharmony_ci HELLCREEK_HWTSTAMP_TX_IN_PROGRESS, 23062306a36Sopenharmony_ci}; 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_ci/* A structure to hold hardware timestamping information per port */ 23362306a36Sopenharmony_cistruct hellcreek_port_hwtstamp { 23462306a36Sopenharmony_ci /* Timestamping state */ 23562306a36Sopenharmony_ci unsigned long state; 23662306a36Sopenharmony_ci 23762306a36Sopenharmony_ci /* Resources for receive timestamping */ 23862306a36Sopenharmony_ci struct sk_buff_head rx_queue; /* For synchronization messages */ 23962306a36Sopenharmony_ci 24062306a36Sopenharmony_ci /* Resources for transmit timestamping */ 24162306a36Sopenharmony_ci unsigned long tx_tstamp_start; 24262306a36Sopenharmony_ci struct sk_buff *tx_skb; 24362306a36Sopenharmony_ci 24462306a36Sopenharmony_ci /* Current timestamp configuration */ 24562306a36Sopenharmony_ci struct hwtstamp_config tstamp_config; 24662306a36Sopenharmony_ci}; 24762306a36Sopenharmony_ci 24862306a36Sopenharmony_cistruct hellcreek_port { 24962306a36Sopenharmony_ci struct hellcreek *hellcreek; 25062306a36Sopenharmony_ci unsigned long *vlan_dev_bitmap; 25162306a36Sopenharmony_ci int port; 25262306a36Sopenharmony_ci u16 ptcfg; /* ptcfg shadow */ 25362306a36Sopenharmony_ci u64 *counter_values; 25462306a36Sopenharmony_ci 25562306a36Sopenharmony_ci /* Per-port timestamping resources */ 25662306a36Sopenharmony_ci struct hellcreek_port_hwtstamp port_hwtstamp; 25762306a36Sopenharmony_ci 25862306a36Sopenharmony_ci /* Per-port Qbv schedule information */ 25962306a36Sopenharmony_ci struct tc_taprio_qopt_offload *current_schedule; 26062306a36Sopenharmony_ci struct delayed_work schedule_work; 26162306a36Sopenharmony_ci}; 26262306a36Sopenharmony_ci 26362306a36Sopenharmony_cistruct hellcreek_fdb_entry { 26462306a36Sopenharmony_ci size_t idx; 26562306a36Sopenharmony_ci unsigned char mac[ETH_ALEN]; 26662306a36Sopenharmony_ci u8 portmask; 26762306a36Sopenharmony_ci u8 age; 26862306a36Sopenharmony_ci u8 is_obt; 26962306a36Sopenharmony_ci u8 pass_blocked; 27062306a36Sopenharmony_ci u8 is_static; 27162306a36Sopenharmony_ci u8 reprio_tc; 27262306a36Sopenharmony_ci u8 reprio_en; 27362306a36Sopenharmony_ci}; 27462306a36Sopenharmony_ci 27562306a36Sopenharmony_cistruct hellcreek { 27662306a36Sopenharmony_ci const struct hellcreek_platform_data *pdata; 27762306a36Sopenharmony_ci struct device *dev; 27862306a36Sopenharmony_ci struct dsa_switch *ds; 27962306a36Sopenharmony_ci struct ptp_clock *ptp_clock; 28062306a36Sopenharmony_ci struct ptp_clock_info ptp_clock_info; 28162306a36Sopenharmony_ci struct hellcreek_port *ports; 28262306a36Sopenharmony_ci struct delayed_work overflow_work; 28362306a36Sopenharmony_ci struct led_classdev led_is_gm; 28462306a36Sopenharmony_ci struct led_classdev led_sync_good; 28562306a36Sopenharmony_ci struct mutex reg_lock; /* Switch IP register lock */ 28662306a36Sopenharmony_ci struct mutex vlan_lock; /* VLAN bitmaps lock */ 28762306a36Sopenharmony_ci struct mutex ptp_lock; /* PTP IP register lock */ 28862306a36Sopenharmony_ci struct devlink_region *vlan_region; 28962306a36Sopenharmony_ci struct devlink_region *fdb_region; 29062306a36Sopenharmony_ci void __iomem *base; 29162306a36Sopenharmony_ci void __iomem *ptp_base; 29262306a36Sopenharmony_ci u16 swcfg; /* swcfg shadow */ 29362306a36Sopenharmony_ci u8 *vidmbrcfg; /* vidmbrcfg shadow */ 29462306a36Sopenharmony_ci u64 seconds; /* PTP seconds */ 29562306a36Sopenharmony_ci u64 last_ts; /* Used for overflow detection */ 29662306a36Sopenharmony_ci u16 status_out; /* ptp.status_out shadow */ 29762306a36Sopenharmony_ci size_t fdb_entries; 29862306a36Sopenharmony_ci}; 29962306a36Sopenharmony_ci 30062306a36Sopenharmony_ci/* A Qbv schedule can only started up to 8 seconds in the future. If the delta 30162306a36Sopenharmony_ci * between the base time and the current ptp time is larger than 8 seconds, then 30262306a36Sopenharmony_ci * use periodic work to check for the schedule to be started. The delayed work 30362306a36Sopenharmony_ci * cannot be armed directly to $base_time - 8 + X, because for large deltas the 30462306a36Sopenharmony_ci * PTP frequency matters. 30562306a36Sopenharmony_ci */ 30662306a36Sopenharmony_ci#define HELLCREEK_SCHEDULE_PERIOD (2 * HZ) 30762306a36Sopenharmony_ci#define dw_to_hellcreek_port(dw) \ 30862306a36Sopenharmony_ci container_of(dw, struct hellcreek_port, schedule_work) 30962306a36Sopenharmony_ci 31062306a36Sopenharmony_ci/* Devlink resources */ 31162306a36Sopenharmony_cienum hellcreek_devlink_resource_id { 31262306a36Sopenharmony_ci HELLCREEK_DEVLINK_PARAM_ID_VLAN_TABLE, 31362306a36Sopenharmony_ci HELLCREEK_DEVLINK_PARAM_ID_FDB_TABLE, 31462306a36Sopenharmony_ci}; 31562306a36Sopenharmony_ci 31662306a36Sopenharmony_cistruct hellcreek_devlink_vlan_entry { 31762306a36Sopenharmony_ci u16 vid; 31862306a36Sopenharmony_ci u16 member; 31962306a36Sopenharmony_ci}; 32062306a36Sopenharmony_ci 32162306a36Sopenharmony_ci#endif /* _HELLCREEK_H_ */ 322