linux/drivers/net/dsa/ocelot/felix_vsc9959.c

// SPDX-License-Identifier: (GPL-2.0 OR MIT)
/* Copyright 2017 Microsemi Corporation
 * Copyright 2018-2019 NXP
 */
#include <linux/fsl/enetc_mdio.h>
#include <soc/mscc/ocelot_qsys.h>
#include <soc/mscc/ocelot_vcap.h>
#include <soc/mscc/ocelot_ana.h>
#include <soc/mscc/ocelot_dev.h>
#include <soc/mscc/ocelot_ptp.h>
#include <soc/mscc/ocelot_sys.h>
#include <net/tc_act/tc_gate.h>
#include <soc/mscc/ocelot.h>
#include <linux/dsa/ocelot.h>
#include <linux/pcs-lynx.h>
#include <net/pkt_sched.h>
#include <linux/iopoll.h>
#include <linux/mdio.h>
#include <linux/of.h>
#include <linux/pci.h>
#include <linux/time.h>
#include "felix.h"

#define VSC9959_NUM_PORTS

#define VSC9959_TAS_GCL_ENTRY_MAX
#define VSC9959_TAS_MIN_GATE_LEN_NS
#define VSC9959_VCAP_POLICER_BASE
#define VSC9959_VCAP_POLICER_MAX
#define VSC9959_SWITCH_PCI_BAR
#define VSC9959_IMDIO_PCI_BAR

#define VSC9959_PORT_MODE_SERDES

static const u32 vsc9959_port_modes[VSC9959_NUM_PORTS] =;

static const u32 vsc9959_ana_regmap[] =;

static const u32 vsc9959_qs_regmap[] =;

static const u32 vsc9959_vcap_regmap[] =;

static const u32 vsc9959_qsys_regmap[] =;

static const u32 vsc9959_rew_regmap[] =;

static const u32 vsc9959_sys_regmap[] =;

static const u32 vsc9959_ptp_regmap[] =;

static const u32 vsc9959_gcb_regmap[] =;

static const u32 vsc9959_dev_gmii_regmap[] =;

static const u32 *vsc9959_regmap[TARGET_MAX] =;

/* Addresses are relative to the PCI device's base address */
static const struct resource vsc9959_resources[] =;

static const char * const vsc9959_resource_names[TARGET_MAX] =;

/* Port MAC 0 Internal MDIO bus through which the SerDes acting as an
 * SGMII/QSGMII MAC PCS can be found.
 */
static const struct resource vsc9959_imdio_res =;

static const struct reg_field vsc9959_regfields[REGFIELD_MAX] =;

static const struct vcap_field vsc9959_vcap_es0_keys[] =;

static const struct vcap_field vsc9959_vcap_es0_actions[] =;

static const struct vcap_field vsc9959_vcap_is1_keys[] =;

static const struct vcap_field vsc9959_vcap_is1_actions[] =;

static struct vcap_field vsc9959_vcap_is2_keys[] =;

static struct vcap_field vsc9959_vcap_is2_actions[] =;

static struct vcap_props vsc9959_vcap_props[] =;

static const struct ptp_clock_info vsc9959_ptp_caps =;

#define VSC9959_INIT_TIMEOUT
#define VSC9959_GCB_RST_SLEEP
#define VSC9959_SYS_RAMINIT_SLEEP

static int vsc9959_gcb_soft_rst_status(struct ocelot *ocelot)
{}

static int vsc9959_sys_ram_init_status(struct ocelot *ocelot)
{}

/* CORE_ENA is in SYS:SYSTEM:RESET_CFG
 * RAM_INIT is in SYS:RAM_CTRL:RAM_INIT
 */
static int vsc9959_reset(struct ocelot *ocelot)
{}

/* Watermark encode
 * Bit 8:   Unit; 0:1, 1:16
 * Bit 7-0: Value to be multiplied with unit
 */
static u16 vsc9959_wm_enc(u16 value)
{}

static u16 vsc9959_wm_dec(u16 wm)
{}

static void vsc9959_wm_stat(u32 val, u32 *inuse, u32 *maxuse)
{}

static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot)
{}

static void vsc9959_mdio_bus_free(struct ocelot *ocelot)
{}

/* The switch considers any frame (regardless of size) as eligible for
 * transmission if the traffic class gate is open for at least 33 ns.
 * Overruns are prevented by cropping an interval at the end of the gate time
 * slot for which egress scheduling is blocked, but we need to still keep 33 ns
 * available for one packet to be transmitted, otherwise the port tc will hang.
 * This function returns the size of a gate interval that remains available for
 * setting the guard band, after reserving the space for one egress frame.
 */
static u64 vsc9959_tas_remaining_gate_len_ps(u64 gate_len_ns)
{}

/* Extract shortest continuous gate open intervals in ns for each traffic class
 * of a cyclic tc-taprio schedule. If a gate is always open, the duration is
 * considered U64_MAX. If the gate is always closed, it is considered 0.
 */
static void vsc9959_tas_min_gate_lengths(struct tc_taprio_qopt_offload *taprio,
					 u64 min_gate_len[OCELOT_NUM_TC])
{}

/* ocelot_write_rix is a macro that concatenates QSYS_MAXSDU_CFG_* with _RSZ,
 * so we need to spell out the register access to each traffic class in helper
 * functions, to simplify callers
 */
static void vsc9959_port_qmaxsdu_set(struct ocelot *ocelot, int port, int tc,
				     u32 max_sdu)
{}

static u32 vsc9959_port_qmaxsdu_get(struct ocelot *ocelot, int port, int tc)
{}

static u32 vsc9959_tas_tc_max_sdu(struct tc_taprio_qopt_offload *taprio, int tc)
{}

/* Update QSYS_PORT_MAX_SDU to make sure the static guard bands added by the
 * switch (see the ALWAYS_GUARD_BAND_SCH_Q comment) are correct at all MTU
 * values (the default value is 1518). Also, for traffic class windows smaller
 * than one MTU sized frame, update QSYS_QMAXSDU_CFG to enable oversized frame
 * dropping, such that these won't hang the port, as they will never be sent.
 */
static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port)
{}

static void vsc9959_sched_speed_set(struct ocelot *ocelot, int port,
				    u32 speed)
{}

static void vsc9959_new_base_time(struct ocelot *ocelot, ktime_t base_time,
				  u64 cycle_time,
				  struct timespec64 *new_base_ts)
{}

static u32 vsc9959_tas_read_cfg_status(struct ocelot *ocelot)
{}

static void vsc9959_tas_gcl_set(struct ocelot *ocelot, const u32 gcl_ix,
				struct tc_taprio_sched_entry *entry)
{}

static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port,
				    struct tc_taprio_qopt_offload *taprio)
{}

static void vsc9959_tas_clock_adjust(struct ocelot *ocelot)
{}

static int vsc9959_qos_port_cbs_set(struct dsa_switch *ds, int port,
				    struct tc_cbs_qopt_offload *cbs_qopt)
{}

static int vsc9959_qos_query_caps(struct tc_query_caps_base *base)
{}

static int vsc9959_qos_port_mqprio(struct ocelot *ocelot, int port,
				   struct tc_mqprio_qopt_offload *mqprio)
{}

static int vsc9959_port_setup_tc(struct dsa_switch *ds, int port,
				 enum tc_setup_type type,
				 void *type_data)
{}

#define VSC9959_PSFP_SFID_MAX
#define VSC9959_PSFP_GATE_ID_MAX
#define VSC9959_PSFP_POLICER_BASE
#define VSC9959_PSFP_POLICER_MAX
#define VSC9959_PSFP_GATE_LIST_NUM
#define VSC9959_PSFP_GATE_CYCLETIME_MIN

struct felix_stream {};

struct felix_stream_filter_counters {};

struct felix_stream_filter {};

struct felix_stream_gate {};

struct felix_stream_gate_entry {};

static int vsc9959_stream_identify(struct flow_cls_offload *f,
				   struct felix_stream *stream)
{}

static int vsc9959_mact_stream_set(struct ocelot *ocelot,
				   struct felix_stream *stream,
				   struct netlink_ext_ack *extack)
{}

static struct felix_stream *
vsc9959_stream_table_lookup(struct list_head *stream_list,
			    struct felix_stream *stream)
{}

static int vsc9959_stream_table_add(struct ocelot *ocelot,
				    struct list_head *stream_list,
				    struct felix_stream *stream,
				    struct netlink_ext_ack *extack)
{}

static struct felix_stream *
vsc9959_stream_table_get(struct list_head *stream_list, unsigned long id)
{}

static void vsc9959_stream_table_del(struct ocelot *ocelot,
				     struct felix_stream *stream)
{}

static u32 vsc9959_sfi_access_status(struct ocelot *ocelot)
{}

static int vsc9959_psfp_sfi_set(struct ocelot *ocelot,
				struct felix_stream_filter *sfi)
{}

static int vsc9959_psfp_sfidmask_set(struct ocelot *ocelot, u32 sfid, int ports)
{}

static int vsc9959_psfp_sfi_list_add(struct ocelot *ocelot,
				     struct felix_stream_filter *sfi,
				     struct list_head *pos)
{}

static int vsc9959_psfp_sfi_table_add(struct ocelot *ocelot,
				      struct felix_stream_filter *sfi)
{}

static int vsc9959_psfp_sfi_table_add2(struct ocelot *ocelot,
				       struct felix_stream_filter *sfi,
				       struct felix_stream_filter *sfi2)
{}

static struct felix_stream_filter *
vsc9959_psfp_sfi_table_get(struct list_head *sfi_list, u32 index)
{}

static void vsc9959_psfp_sfi_table_del(struct ocelot *ocelot, u32 index)
{}

static void vsc9959_psfp_parse_gate(const struct flow_action_entry *entry,
				    struct felix_stream_gate *sgi)
{}

static u32 vsc9959_sgi_cfg_status(struct ocelot *ocelot)
{}

static int vsc9959_psfp_sgi_set(struct ocelot *ocelot,
				struct felix_stream_gate *sgi)
{}

static int vsc9959_psfp_sgi_table_add(struct ocelot *ocelot,
				      struct felix_stream_gate *sgi)
{}

static void vsc9959_psfp_sgi_table_del(struct ocelot *ocelot,
				       u32 index)
{}

static int vsc9959_psfp_filter_add(struct ocelot *ocelot, int port,
				   struct flow_cls_offload *f)
{}

static int vsc9959_psfp_filter_del(struct ocelot *ocelot,
				   struct flow_cls_offload *f)
{}

static void vsc9959_update_sfid_stats(struct ocelot *ocelot,
				      struct felix_stream_filter *sfi)
{}

/* Caller must hold &ocelot->stat_view_lock */
static void vsc9959_update_stats(struct ocelot *ocelot)
{}

static int vsc9959_psfp_stats_get(struct ocelot *ocelot,
				  struct flow_cls_offload *f,
				  struct flow_stats *stats)
{}

static void vsc9959_psfp_init(struct ocelot *ocelot)
{}

/* When using cut-through forwarding and the egress port runs at a higher data
 * rate than the ingress port, the packet currently under transmission would
 * suffer an underrun since it would be transmitted faster than it is received.
 * The Felix switch implementation of cut-through forwarding does not check in
 * hardware whether this condition is satisfied or not, so we must restrict the
 * list of ports that have cut-through forwarding enabled on egress to only be
 * the ports operating at the lowest link speed within their respective
 * forwarding domain.
 */
static void vsc9959_cut_through_fwd(struct ocelot *ocelot)
{}

/* The INTB interrupt is shared between for PTP TX timestamp availability
 * notification and MAC Merge status change on each port.
 */
static irqreturn_t vsc9959_irq_handler(int irq, void *data)
{}

static int vsc9959_request_irq(struct ocelot *ocelot)
{}

static const struct ocelot_ops vsc9959_ops =;

static const struct felix_info felix_info_vsc9959 =;

static int felix_pci_probe(struct pci_dev *pdev,
			   const struct pci_device_id *id)
{}

static void felix_pci_remove(struct pci_dev *pdev)
{}

static void felix_pci_shutdown(struct pci_dev *pdev)
{}

static struct pci_device_id felix_ids[] =;
MODULE_DEVICE_TABLE(pci, felix_ids);

static struct pci_driver felix_vsc9959_pci_driver =;
module_pci_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();