#define pr_fmt(fmt) …
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/printk.h>
#include <linux/spi/spi.h>
#include <linux/errno.h>
#include <linux/gpio/consumer.h>
#include <linux/phylink.h>
#include <linux/of.h>
#include <linux/of_net.h>
#include <linux/of_mdio.h>
#include <linux/pcs/pcs-xpcs.h>
#include <linux/netdev_features.h>
#include <linux/netdevice.h>
#include <linux/if_bridge.h>
#include <linux/if_ether.h>
#include <linux/dsa/8021q.h>
#include <linux/units.h>
#include "sja1105.h"
#include "sja1105_tas.h"
#define SJA1105_UNKNOWN_MULTICAST …
static int sja1105_hw_reset(struct device *dev, unsigned int pulse_len,
unsigned int startup_delay)
{ … }
static void
sja1105_port_allow_traffic(struct sja1105_l2_forwarding_entry *l2_fwd,
int from, int to, bool allow)
{ … }
static bool sja1105_can_forward(struct sja1105_l2_forwarding_entry *l2_fwd,
int from, int to)
{ … }
static int sja1105_is_vlan_configured(struct sja1105_private *priv, u16 vid)
{ … }
static int sja1105_drop_untagged(struct dsa_switch *ds, int port, bool drop)
{ … }
static int sja1105_pvid_apply(struct sja1105_private *priv, int port, u16 pvid)
{ … }
static int sja1105_commit_pvid(struct dsa_switch *ds, int port)
{ … }
static int sja1105_init_mac_settings(struct sja1105_private *priv)
{ … }
static int sja1105_init_mii_settings(struct sja1105_private *priv)
{ … }
static int sja1105_init_static_fdb(struct sja1105_private *priv)
{ … }
static int sja1105_init_l2_lookup_params(struct sja1105_private *priv)
{ … }
static int sja1105_init_static_vlan(struct sja1105_private *priv)
{ … }
static int sja1105_init_l2_forwarding(struct sja1105_private *priv)
{ … }
static int sja1110_init_pcp_remapping(struct sja1105_private *priv)
{ … }
static int sja1105_init_l2_forwarding_params(struct sja1105_private *priv)
{ … }
void sja1105_frame_memory_partitioning(struct sja1105_private *priv)
{ … }
static void sja1110_select_tdmaconfigidx(struct sja1105_private *priv)
{ … }
static int sja1105_init_topology(struct sja1105_private *priv,
struct sja1105_general_params_entry *general_params)
{ … }
static int sja1105_init_general_params(struct sja1105_private *priv)
{ … }
static int sja1105_init_avb_params(struct sja1105_private *priv)
{ … }
#define SJA1105_RATE_MBPS(speed) …
static int sja1105_init_l2_policing(struct sja1105_private *priv)
{ … }
static int sja1105_static_config_load(struct sja1105_private *priv)
{ … }
static int sja1105_parse_rgmii_delays(struct sja1105_private *priv, int port,
struct device_node *port_dn)
{ … }
static int sja1105_parse_ports_node(struct sja1105_private *priv,
struct device_node *ports_node)
{ … }
static int sja1105_parse_dt(struct sja1105_private *priv)
{ … }
static int sja1105_port_speed_to_ethtool(struct sja1105_private *priv,
u64 speed)
{ … }
static int sja1105_adjust_port_config(struct sja1105_private *priv, int port,
int speed_mbps)
{ … }
static struct phylink_pcs *
sja1105_mac_select_pcs(struct phylink_config *config, phy_interface_t iface)
{ … }
static void sja1105_mac_config(struct phylink_config *config,
unsigned int mode,
const struct phylink_link_state *state)
{ … }
static void sja1105_mac_link_down(struct phylink_config *config,
unsigned int mode,
phy_interface_t interface)
{ … }
static void sja1105_mac_link_up(struct phylink_config *config,
struct phy_device *phydev,
unsigned int mode,
phy_interface_t interface,
int speed, int duplex,
bool tx_pause, bool rx_pause)
{ … }
static void sja1105_phylink_get_caps(struct dsa_switch *ds, int port,
struct phylink_config *config)
{ … }
static int
sja1105_find_static_fdb_entry(struct sja1105_private *priv, int port,
const struct sja1105_l2_lookup_entry *requested)
{ … }
static int
sja1105_static_fdb_change(struct sja1105_private *priv, int port,
const struct sja1105_l2_lookup_entry *requested,
bool keep)
{ … }
static int sja1105et_fdb_index(int bin, int way)
{ … }
static int sja1105et_is_fdb_entry_in_bin(struct sja1105_private *priv, int bin,
const u8 *addr, u16 vid,
struct sja1105_l2_lookup_entry *match,
int *last_unused)
{ … }
int sja1105et_fdb_add(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid)
{ … }
int sja1105et_fdb_del(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid)
{ … }
int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid)
{ … }
int sja1105pqrs_fdb_del(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid)
{ … }
static int sja1105_fdb_add(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid,
struct dsa_db db)
{ … }
static int __sja1105_fdb_del(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid,
struct dsa_db db)
{ … }
static int sja1105_fdb_del(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid,
struct dsa_db db)
{ … }
static int sja1105_fdb_dump(struct dsa_switch *ds, int port,
dsa_fdb_dump_cb_t *cb, void *data)
{ … }
static void sja1105_fast_age(struct dsa_switch *ds, int port)
{ … }
static int sja1105_mdb_add(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_mdb *mdb,
struct dsa_db db)
{ … }
static int sja1105_mdb_del(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_mdb *mdb,
struct dsa_db db)
{ … }
static int sja1105_manage_flood_domains(struct sja1105_private *priv)
{ … }
static int sja1105_bridge_member(struct dsa_switch *ds, int port,
struct dsa_bridge bridge, bool member)
{ … }
static void sja1105_bridge_stp_state_set(struct dsa_switch *ds, int port,
u8 state)
{ … }
static int sja1105_bridge_join(struct dsa_switch *ds, int port,
struct dsa_bridge bridge,
bool *tx_fwd_offload,
struct netlink_ext_ack *extack)
{ … }
static void sja1105_bridge_leave(struct dsa_switch *ds, int port,
struct dsa_bridge bridge)
{ … }
#define SJA1110_FIXED_CBS(port, prio) …
static int sja1105_find_cbs_shaper(struct sja1105_private *priv,
int port, int prio)
{ … }
static int sja1105_find_unused_cbs_shaper(struct sja1105_private *priv)
{ … }
static int sja1105_delete_cbs_shaper(struct sja1105_private *priv, int port,
int prio)
{ … }
static int sja1105_setup_tc_cbs(struct dsa_switch *ds, int port,
struct tc_cbs_qopt_offload *offload)
{ … }
static int sja1105_reload_cbs(struct sja1105_private *priv)
{ … }
static const char * const sja1105_reset_reasons[] = …;
int sja1105_static_config_reload(struct sja1105_private *priv,
enum sja1105_reset_reason reason)
{ … }
static enum dsa_tag_protocol
sja1105_get_tag_protocol(struct dsa_switch *ds, int port,
enum dsa_tag_protocol mp)
{ … }
int sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled,
struct netlink_ext_ack *extack)
{ … }
static int sja1105_vlan_add(struct sja1105_private *priv, int port, u16 vid,
u16 flags, bool allowed_ingress)
{ … }
static int sja1105_vlan_del(struct sja1105_private *priv, int port, u16 vid)
{ … }
static int sja1105_bridge_vlan_add(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_vlan *vlan,
struct netlink_ext_ack *extack)
{ … }
static int sja1105_bridge_vlan_del(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_vlan *vlan)
{ … }
static int sja1105_dsa_8021q_vlan_add(struct dsa_switch *ds, int port, u16 vid,
u16 flags)
{ … }
static int sja1105_dsa_8021q_vlan_del(struct dsa_switch *ds, int port, u16 vid)
{ … }
static int sja1105_prechangeupper(struct dsa_switch *ds, int port,
struct netdev_notifier_changeupper_info *info)
{ … }
static int sja1105_mgmt_xmit(struct dsa_switch *ds, int port, int slot,
struct sk_buff *skb, bool takets)
{ … }
#define work_to_xmit_work(w) …
static void sja1105_port_deferred_xmit(struct kthread_work *work)
{ … }
static int sja1105_connect_tag_protocol(struct dsa_switch *ds,
enum dsa_tag_protocol proto)
{ … }
static int sja1105_set_ageing_time(struct dsa_switch *ds,
unsigned int ageing_time)
{ … }
static int sja1105_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
{ … }
static int sja1105_get_max_mtu(struct dsa_switch *ds, int port)
{ … }
static int sja1105_port_setup_tc(struct dsa_switch *ds, int port,
enum tc_setup_type type,
void *type_data)
{ … }
static int sja1105_mirror_apply(struct sja1105_private *priv, int from, int to,
bool ingress, bool enabled)
{ … }
static int sja1105_mirror_add(struct dsa_switch *ds, int port,
struct dsa_mall_mirror_tc_entry *mirror,
bool ingress, struct netlink_ext_ack *extack)
{ … }
static void sja1105_mirror_del(struct dsa_switch *ds, int port,
struct dsa_mall_mirror_tc_entry *mirror)
{ … }
static int sja1105_port_policer_add(struct dsa_switch *ds, int port,
struct dsa_mall_policer_tc_entry *policer)
{ … }
static void sja1105_port_policer_del(struct dsa_switch *ds, int port)
{ … }
static int sja1105_port_set_learning(struct sja1105_private *priv, int port,
bool enabled)
{ … }
static int sja1105_port_ucast_bcast_flood(struct sja1105_private *priv, int to,
struct switchdev_brport_flags flags)
{ … }
static int sja1105_port_mcast_flood(struct sja1105_private *priv, int to,
struct switchdev_brport_flags flags,
struct netlink_ext_ack *extack)
{ … }
static int sja1105_port_pre_bridge_flags(struct dsa_switch *ds, int port,
struct switchdev_brport_flags flags,
struct netlink_ext_ack *extack)
{ … }
static int sja1105_port_bridge_flags(struct dsa_switch *ds, int port,
struct switchdev_brport_flags flags,
struct netlink_ext_ack *extack)
{ … }
static int sja1105_setup(struct dsa_switch *ds)
{ … }
static void sja1105_teardown(struct dsa_switch *ds)
{ … }
static const struct phylink_mac_ops sja1105_phylink_mac_ops = …;
static const struct dsa_switch_ops sja1105_switch_ops = …;
static const struct of_device_id sja1105_dt_ids[];
static int sja1105_check_device_id(struct sja1105_private *priv)
{ … }
static int sja1105_probe(struct spi_device *spi)
{ … }
static void sja1105_remove(struct spi_device *spi)
{ … }
static void sja1105_shutdown(struct spi_device *spi)
{ … }
static const struct of_device_id sja1105_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, sja1105_dt_ids);
static const struct spi_device_id sja1105_spi_ids[] = …;
MODULE_DEVICE_TABLE(spi, sja1105_spi_ids);
static struct spi_driver sja1105_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;