linux/drivers/net/dsa/hirschmann/hellcreek.c

// SPDX-License-Identifier: (GPL-2.0 OR MIT)
/*
 * DSA driver for:
 * Hirschmann Hellcreek TSN switch.
 *
 * Copyright (C) 2019-2021 Linutronix GmbH
 * Author Kurt Kanzenbach <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/of.h>
#include <linux/of_mdio.h>
#include <linux/platform_device.h>
#include <linux/bitops.h>
#include <linux/if_bridge.h>
#include <linux/if_vlan.h>
#include <linux/etherdevice.h>
#include <linux/random.h>
#include <linux/iopoll.h>
#include <linux/mutex.h>
#include <linux/delay.h>
#include <net/dsa.h>

#include "hellcreek.h"
#include "hellcreek_ptp.h"
#include "hellcreek_hwtstamp.h"

static const struct hellcreek_counter hellcreek_counter[] =;

static u16 hellcreek_read(struct hellcreek *hellcreek, unsigned int offset)
{}

static u16 hellcreek_read_ctrl(struct hellcreek *hellcreek)
{}

static u16 hellcreek_read_stat(struct hellcreek *hellcreek)
{}

static void hellcreek_write(struct hellcreek *hellcreek, u16 data,
			    unsigned int offset)
{}

static void hellcreek_select_port(struct hellcreek *hellcreek, int port)
{}

static void hellcreek_select_prio(struct hellcreek *hellcreek, int prio)
{}

static void hellcreek_select_port_prio(struct hellcreek *hellcreek, int port,
				       int prio)
{}

static void hellcreek_select_counter(struct hellcreek *hellcreek, int counter)
{}

static void hellcreek_select_vlan(struct hellcreek *hellcreek, int vid,
				  bool pvid)
{}

static void hellcreek_select_tgd(struct hellcreek *hellcreek, int port)
{}

static int hellcreek_wait_until_ready(struct hellcreek *hellcreek)
{}

static int hellcreek_wait_until_transitioned(struct hellcreek *hellcreek)
{}

static int hellcreek_wait_fdb_ready(struct hellcreek *hellcreek)
{}

static int hellcreek_detect(struct hellcreek *hellcreek)
{}

static void hellcreek_feature_detect(struct hellcreek *hellcreek)
{}

static enum dsa_tag_protocol hellcreek_get_tag_protocol(struct dsa_switch *ds,
							int port,
							enum dsa_tag_protocol mp)
{}

static int hellcreek_port_enable(struct dsa_switch *ds, int port,
				 struct phy_device *phy)
{}

static void hellcreek_port_disable(struct dsa_switch *ds, int port)
{}

static void hellcreek_get_strings(struct dsa_switch *ds, int port,
				  u32 stringset, uint8_t *data)
{}

static int hellcreek_get_sset_count(struct dsa_switch *ds, int port, int sset)
{}

static void hellcreek_get_ethtool_stats(struct dsa_switch *ds, int port,
					uint64_t *data)
{}

static u16 hellcreek_private_vid(int port)
{}

static int hellcreek_vlan_prepare(struct dsa_switch *ds, int port,
				  const struct switchdev_obj_port_vlan *vlan,
				  struct netlink_ext_ack *extack)
{}

static void hellcreek_select_vlan_params(struct hellcreek *hellcreek, int port,
					 int *shift, int *mask)
{}

static void hellcreek_apply_vlan(struct hellcreek *hellcreek, int port, u16 vid,
				 bool pvid, bool untagged)
{}

static void hellcreek_unapply_vlan(struct hellcreek *hellcreek, int port,
				   u16 vid)
{}

static int hellcreek_vlan_add(struct dsa_switch *ds, int port,
			      const struct switchdev_obj_port_vlan *vlan,
			      struct netlink_ext_ack *extack)
{}

static int hellcreek_vlan_del(struct dsa_switch *ds, int port,
			      const struct switchdev_obj_port_vlan *vlan)
{}

static void hellcreek_port_stp_state_set(struct dsa_switch *ds, int port,
					 u8 state)
{}

static void hellcreek_setup_ingressflt(struct hellcreek *hellcreek, int port,
				       bool enable)
{}

static void hellcreek_setup_vlan_awareness(struct hellcreek *hellcreek,
					   bool enable)
{}

/* Default setup for DSA: VLAN <X>: CPU and Port <X> egress untagged. */
static void hellcreek_setup_vlan_membership(struct dsa_switch *ds, int port,
					    bool enabled)
{}

static void hellcreek_port_set_ucast_flood(struct hellcreek *hellcreek,
					   int port, bool enable)
{}

static void hellcreek_port_set_mcast_flood(struct hellcreek *hellcreek,
					   int port, bool enable)
{}

static int hellcreek_pre_bridge_flags(struct dsa_switch *ds, int port,
				      struct switchdev_brport_flags flags,
				      struct netlink_ext_ack *extack)
{}

static int hellcreek_bridge_flags(struct dsa_switch *ds, int port,
				  struct switchdev_brport_flags flags,
				  struct netlink_ext_ack *extack)
{}

static int hellcreek_port_bridge_join(struct dsa_switch *ds, int port,
				      struct dsa_bridge bridge,
				      bool *tx_fwd_offload,
				      struct netlink_ext_ack *extack)
{}

static void hellcreek_port_bridge_leave(struct dsa_switch *ds, int port,
					struct dsa_bridge bridge)
{}

static int __hellcreek_fdb_add(struct hellcreek *hellcreek,
			       const struct hellcreek_fdb_entry *entry)
{}

static int __hellcreek_fdb_del(struct hellcreek *hellcreek,
			       const struct hellcreek_fdb_entry *entry)
{}

static void hellcreek_populate_fdb_entry(struct hellcreek *hellcreek,
					 struct hellcreek_fdb_entry *entry,
					 size_t idx)
{}

/* Retrieve the index of a FDB entry by mac address. Currently we search through
 * the complete table in hardware. If that's too slow, we might have to cache
 * the complete FDB table in software.
 */
static int hellcreek_fdb_get(struct hellcreek *hellcreek,
			     const unsigned char *dest,
			     struct hellcreek_fdb_entry *entry)
{}

static int hellcreek_fdb_add(struct dsa_switch *ds, int port,
			     const unsigned char *addr, u16 vid,
			     struct dsa_db db)
{}

static int hellcreek_fdb_del(struct dsa_switch *ds, int port,
			     const unsigned char *addr, u16 vid,
			     struct dsa_db db)
{}

static int hellcreek_fdb_dump(struct dsa_switch *ds, int port,
			      dsa_fdb_dump_cb_t *cb, void *data)
{}

static int hellcreek_vlan_filtering(struct dsa_switch *ds, int port,
				    bool vlan_filtering,
				    struct netlink_ext_ack *extack)
{}

static int hellcreek_enable_ip_core(struct hellcreek *hellcreek)
{}

static void hellcreek_setup_cpu_and_tunnel_port(struct hellcreek *hellcreek)
{}

static void hellcreek_setup_tc_identity_mapping(struct hellcreek *hellcreek)
{}

static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
{}

static int hellcreek_devlink_info_get(struct dsa_switch *ds,
				      struct devlink_info_req *req,
				      struct netlink_ext_ack *extack)
{}

static u64 hellcreek_devlink_vlan_table_get(void *priv)
{}

static u64 hellcreek_devlink_fdb_table_get(void *priv)
{}

static int hellcreek_setup_devlink_resources(struct dsa_switch *ds)
{}

static int hellcreek_devlink_region_vlan_snapshot(struct devlink *dl,
						  const struct devlink_region_ops *ops,
						  struct netlink_ext_ack *extack,
						  u8 **data)
{}

static int hellcreek_devlink_region_fdb_snapshot(struct devlink *dl,
						 const struct devlink_region_ops *ops,
						 struct netlink_ext_ack *extack,
						 u8 **data)
{}

static struct devlink_region_ops hellcreek_region_vlan_ops =;

static struct devlink_region_ops hellcreek_region_fdb_ops =;

static int hellcreek_setup_devlink_regions(struct dsa_switch *ds)
{}

static void hellcreek_teardown_devlink_regions(struct dsa_switch *ds)
{}

static int hellcreek_setup(struct dsa_switch *ds)
{}

static void hellcreek_teardown(struct dsa_switch *ds)
{}

static void hellcreek_phylink_get_caps(struct dsa_switch *ds, int port,
				       struct phylink_config *config)
{}

static int
hellcreek_port_prechangeupper(struct dsa_switch *ds, int port,
			      struct netdev_notifier_changeupper_info *info)
{}

static void hellcreek_setup_maxsdu(struct hellcreek *hellcreek, int port,
				   const struct tc_taprio_qopt_offload *schedule)
{}

static void hellcreek_reset_maxsdu(struct hellcreek *hellcreek, int port)
{}

static void hellcreek_setup_gcl(struct hellcreek *hellcreek, int port,
				const struct tc_taprio_qopt_offload *schedule)
{}

static void hellcreek_set_cycle_time(struct hellcreek *hellcreek,
				     const struct tc_taprio_qopt_offload *schedule)
{}

static void hellcreek_switch_schedule(struct hellcreek *hellcreek,
				      ktime_t start_time)
{}

static bool hellcreek_schedule_startable(struct hellcreek *hellcreek, int port)
{}

static void hellcreek_start_schedule(struct hellcreek *hellcreek, int port)
{}

static void hellcreek_check_schedule(struct work_struct *work)
{}

static int hellcreek_port_set_schedule(struct dsa_switch *ds, int port,
				       struct tc_taprio_qopt_offload *taprio)
{}

static int hellcreek_port_del_schedule(struct dsa_switch *ds, int port)
{}

static bool hellcreek_validate_schedule(struct hellcreek *hellcreek,
					struct tc_taprio_qopt_offload *schedule)
{}

static int hellcreek_tc_query_caps(struct tc_query_caps_base *base)
{}

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

static const struct dsa_switch_ops hellcreek_ds_ops =;

static int hellcreek_probe(struct platform_device *pdev)
{}

static void hellcreek_remove(struct platform_device *pdev)
{}

static void hellcreek_shutdown(struct platform_device *pdev)
{}

static const struct hellcreek_platform_data de1soc_r1_pdata =;

static const struct of_device_id hellcreek_of_match[] =;
MODULE_DEVICE_TABLE(of, hellcreek_of_match);

static struct platform_driver hellcreek_driver =;
module_platform_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();