#include <linux/etherdevice.h>
#include <linux/if_bridge.h>
#include <linux/iopoll.h>
#include <linux/mdio.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/of_irq.h>
#include <linux/of_mdio.h>
#include <linux/of_net.h>
#include <linux/of_platform.h>
#include <linux/phylink.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
#include <net/dsa.h>
#include "mt7530.h"
static struct mt753x_pcs *pcs_to_mt753x_pcs(struct phylink_pcs *pcs)
{ … }
static const struct mt7530_mib_desc mt7530_mib[] = …;
static void
mt7530_mutex_lock(struct mt7530_priv *priv)
{ … }
static void
mt7530_mutex_unlock(struct mt7530_priv *priv)
{ … }
static void
core_write(struct mt7530_priv *priv, u32 reg, u32 val)
{ … }
static void
core_rmw(struct mt7530_priv *priv, u32 reg, u32 mask, u32 set)
{ … }
static void
core_set(struct mt7530_priv *priv, u32 reg, u32 val)
{ … }
static void
core_clear(struct mt7530_priv *priv, u32 reg, u32 val)
{ … }
static int
mt7530_mii_write(struct mt7530_priv *priv, u32 reg, u32 val)
{ … }
static u32
mt7530_mii_read(struct mt7530_priv *priv, u32 reg)
{ … }
static void
mt7530_write(struct mt7530_priv *priv, u32 reg, u32 val)
{ … }
static u32
_mt7530_unlocked_read(struct mt7530_dummy_poll *p)
{ … }
static u32
_mt7530_read(struct mt7530_dummy_poll *p)
{ … }
static u32
mt7530_read(struct mt7530_priv *priv, u32 reg)
{ … }
static void
mt7530_rmw(struct mt7530_priv *priv, u32 reg,
u32 mask, u32 set)
{ … }
static void
mt7530_set(struct mt7530_priv *priv, u32 reg, u32 val)
{ … }
static void
mt7530_clear(struct mt7530_priv *priv, u32 reg, u32 val)
{ … }
static int
mt7530_fdb_cmd(struct mt7530_priv *priv, enum mt7530_fdb_cmd cmd, u32 *rsp)
{ … }
static void
mt7530_fdb_read(struct mt7530_priv *priv, struct mt7530_fdb *fdb)
{ … }
static void
mt7530_fdb_write(struct mt7530_priv *priv, u16 vid,
u8 port_mask, const u8 *mac,
u8 aging, u8 type)
{ … }
static void mt7530_pll_setup(struct mt7530_priv *priv)
{ … }
static struct dsa_port *
mt753x_preferred_default_local_cpu_port(struct dsa_switch *ds)
{ … }
static void
mt7530_setup_port6(struct dsa_switch *ds, phy_interface_t interface)
{ … }
static void
mt7531_pll_setup(struct mt7530_priv *priv)
{ … }
static void
mt7530_mib_reset(struct dsa_switch *ds)
{ … }
static int mt7530_phy_read_c22(struct mt7530_priv *priv, int port, int regnum)
{ … }
static int mt7530_phy_write_c22(struct mt7530_priv *priv, int port, int regnum,
u16 val)
{ … }
static int mt7530_phy_read_c45(struct mt7530_priv *priv, int port,
int devad, int regnum)
{ … }
static int mt7530_phy_write_c45(struct mt7530_priv *priv, int port, int devad,
int regnum, u16 val)
{ … }
static int
mt7531_ind_c45_phy_read(struct mt7530_priv *priv, int port, int devad,
int regnum)
{ … }
static int
mt7531_ind_c45_phy_write(struct mt7530_priv *priv, int port, int devad,
int regnum, u16 data)
{ … }
static int
mt7531_ind_c22_phy_read(struct mt7530_priv *priv, int port, int regnum)
{ … }
static int
mt7531_ind_c22_phy_write(struct mt7530_priv *priv, int port, int regnum,
u16 data)
{ … }
static int
mt753x_phy_read_c22(struct mii_bus *bus, int port, int regnum)
{ … }
static int
mt753x_phy_read_c45(struct mii_bus *bus, int port, int devad, int regnum)
{ … }
static int
mt753x_phy_write_c22(struct mii_bus *bus, int port, int regnum, u16 val)
{ … }
static int
mt753x_phy_write_c45(struct mii_bus *bus, int port, int devad, int regnum,
u16 val)
{ … }
static void
mt7530_get_strings(struct dsa_switch *ds, int port, u32 stringset,
uint8_t *data)
{ … }
static void
mt7530_get_ethtool_stats(struct dsa_switch *ds, int port,
uint64_t *data)
{ … }
static int
mt7530_get_sset_count(struct dsa_switch *ds, int port, int sset)
{ … }
static int
mt7530_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
{ … }
static const char *mt7530_p5_mode_str(unsigned int mode)
{ … }
static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface)
{ … }
static void
mt753x_trap_frames(struct mt7530_priv *priv)
{ … }
static void
mt753x_cpu_port_enable(struct dsa_switch *ds, int port)
{ … }
static int
mt7530_port_enable(struct dsa_switch *ds, int port,
struct phy_device *phy)
{ … }
static void
mt7530_port_disable(struct dsa_switch *ds, int port)
{ … }
static int
mt7530_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
{ … }
static int
mt7530_port_max_mtu(struct dsa_switch *ds, int port)
{ … }
static void
mt7530_stp_state_set(struct dsa_switch *ds, int port, u8 state)
{ … }
static void mt7530_update_port_member(struct mt7530_priv *priv, int port,
const struct net_device *bridge_dev,
bool join) __must_hold(&priv->reg_mutex)
{ … }
static int
mt7530_port_pre_bridge_flags(struct dsa_switch *ds, int port,
struct switchdev_brport_flags flags,
struct netlink_ext_ack *extack)
{ … }
static int
mt7530_port_bridge_flags(struct dsa_switch *ds, int port,
struct switchdev_brport_flags flags,
struct netlink_ext_ack *extack)
{ … }
static int
mt7530_port_bridge_join(struct dsa_switch *ds, int port,
struct dsa_bridge bridge, bool *tx_fwd_offload,
struct netlink_ext_ack *extack)
{ … }
static void
mt7530_port_set_vlan_unaware(struct dsa_switch *ds, int port)
{ … }
static void
mt7530_port_set_vlan_aware(struct dsa_switch *ds, int port)
{ … }
static void
mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
struct dsa_bridge bridge)
{ … }
static int
mt7530_port_fdb_add(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid,
struct dsa_db db)
{ … }
static int
mt7530_port_fdb_del(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid,
struct dsa_db db)
{ … }
static int
mt7530_port_fdb_dump(struct dsa_switch *ds, int port,
dsa_fdb_dump_cb_t *cb, void *data)
{ … }
static int
mt7530_port_mdb_add(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_mdb *mdb,
struct dsa_db db)
{ … }
static int
mt7530_port_mdb_del(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_mdb *mdb,
struct dsa_db db)
{ … }
static int
mt7530_vlan_cmd(struct mt7530_priv *priv, enum mt7530_vlan_cmd cmd, u16 vid)
{ … }
static int
mt7530_port_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,
struct netlink_ext_ack *extack)
{ … }
static void
mt7530_hw_vlan_add(struct mt7530_priv *priv,
struct mt7530_hw_vlan_entry *entry)
{ … }
static void
mt7530_hw_vlan_del(struct mt7530_priv *priv,
struct mt7530_hw_vlan_entry *entry)
{ … }
static void
mt7530_hw_vlan_update(struct mt7530_priv *priv, u16 vid,
struct mt7530_hw_vlan_entry *entry,
mt7530_vlan_op vlan_op)
{ … }
static int
mt7530_setup_vlan0(struct mt7530_priv *priv)
{ … }
static int
mt7530_port_vlan_add(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_vlan *vlan,
struct netlink_ext_ack *extack)
{ … }
static int
mt7530_port_vlan_del(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_vlan *vlan)
{ … }
static int mt753x_port_mirror_add(struct dsa_switch *ds, int port,
struct dsa_mall_mirror_tc_entry *mirror,
bool ingress, struct netlink_ext_ack *extack)
{ … }
static void mt753x_port_mirror_del(struct dsa_switch *ds, int port,
struct dsa_mall_mirror_tc_entry *mirror)
{ … }
static enum dsa_tag_protocol
mtk_get_tag_protocol(struct dsa_switch *ds, int port,
enum dsa_tag_protocol mp)
{ … }
#ifdef CONFIG_GPIOLIB
static inline u32
mt7530_gpio_to_bit(unsigned int offset)
{ … }
static int
mt7530_gpio_get(struct gpio_chip *gc, unsigned int offset)
{ … }
static void
mt7530_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
{ … }
static int
mt7530_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
{ … }
static int
mt7530_gpio_direction_input(struct gpio_chip *gc, unsigned int offset)
{ … }
static int
mt7530_gpio_direction_output(struct gpio_chip *gc, unsigned int offset, int value)
{ … }
static int
mt7530_setup_gpio(struct mt7530_priv *priv)
{ … }
#endif
static irqreturn_t
mt7530_irq_thread_fn(int irq, void *dev_id)
{ … }
static void
mt7530_irq_mask(struct irq_data *d)
{ … }
static void
mt7530_irq_unmask(struct irq_data *d)
{ … }
static void
mt7530_irq_bus_lock(struct irq_data *d)
{ … }
static void
mt7530_irq_bus_sync_unlock(struct irq_data *d)
{ … }
static struct irq_chip mt7530_irq_chip = …;
static int
mt7530_irq_map(struct irq_domain *domain, unsigned int irq,
irq_hw_number_t hwirq)
{ … }
static const struct irq_domain_ops mt7530_irq_domain_ops = …;
static void
mt7988_irq_mask(struct irq_data *d)
{ … }
static void
mt7988_irq_unmask(struct irq_data *d)
{ … }
static struct irq_chip mt7988_irq_chip = …;
static int
mt7988_irq_map(struct irq_domain *domain, unsigned int irq,
irq_hw_number_t hwirq)
{ … }
static const struct irq_domain_ops mt7988_irq_domain_ops = …;
static void
mt7530_setup_mdio_irq(struct mt7530_priv *priv)
{ … }
static int
mt7530_setup_irq(struct mt7530_priv *priv)
{ … }
static void
mt7530_free_mdio_irq(struct mt7530_priv *priv)
{ … }
static void
mt7530_free_irq_common(struct mt7530_priv *priv)
{ … }
static void
mt7530_free_irq(struct mt7530_priv *priv)
{ … }
static int
mt7530_setup_mdio(struct mt7530_priv *priv)
{ … }
static int
mt7530_setup(struct dsa_switch *ds)
{ … }
static int
mt7531_setup_common(struct dsa_switch *ds)
{ … }
static int
mt7531_setup(struct dsa_switch *ds)
{ … }
static void mt7530_mac_port_get_caps(struct dsa_switch *ds, int port,
struct phylink_config *config)
{ … }
static void mt7531_mac_port_get_caps(struct dsa_switch *ds, int port,
struct phylink_config *config)
{ … }
static void mt7988_mac_port_get_caps(struct dsa_switch *ds, int port,
struct phylink_config *config)
{ … }
static void en7581_mac_port_get_caps(struct dsa_switch *ds, int port,
struct phylink_config *config)
{ … }
static void
mt7530_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
phy_interface_t interface)
{ … }
static void mt7531_rgmii_setup(struct mt7530_priv *priv,
phy_interface_t interface,
struct phy_device *phydev)
{ … }
static void
mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
phy_interface_t interface)
{ … }
static struct phylink_pcs *
mt753x_phylink_mac_select_pcs(struct phylink_config *config,
phy_interface_t interface)
{ … }
static void
mt753x_phylink_mac_config(struct phylink_config *config, unsigned int mode,
const struct phylink_link_state *state)
{ … }
static void mt753x_phylink_mac_link_down(struct phylink_config *config,
unsigned int mode,
phy_interface_t interface)
{ … }
static void mt753x_phylink_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 mt753x_phylink_get_caps(struct dsa_switch *ds, int port,
struct phylink_config *config)
{ … }
static int mt753x_pcs_validate(struct phylink_pcs *pcs,
unsigned long *supported,
const struct phylink_link_state *state)
{ … }
static void mt7530_pcs_get_state(struct phylink_pcs *pcs,
struct phylink_link_state *state)
{ … }
static int mt753x_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
phy_interface_t interface,
const unsigned long *advertising,
bool permit_pause_to_mac)
{ … }
static void mt7530_pcs_an_restart(struct phylink_pcs *pcs)
{ … }
static const struct phylink_pcs_ops mt7530_pcs_ops = …;
static int
mt753x_setup(struct dsa_switch *ds)
{ … }
static int mt753x_get_mac_eee(struct dsa_switch *ds, int port,
struct ethtool_keee *e)
{ … }
static int mt753x_set_mac_eee(struct dsa_switch *ds, int port,
struct ethtool_keee *e)
{ … }
static void
mt753x_conduit_state_change(struct dsa_switch *ds,
const struct net_device *conduit,
bool operational)
{ … }
static int mt7988_setup(struct dsa_switch *ds)
{ … }
const struct dsa_switch_ops mt7530_switch_ops = …;
EXPORT_SYMBOL_GPL(…);
static const struct phylink_mac_ops mt753x_phylink_mac_ops = …;
const struct mt753x_info mt753x_table[] = …;
EXPORT_SYMBOL_GPL(…);
int
mt7530_probe_common(struct mt7530_priv *priv)
{ … }
EXPORT_SYMBOL_GPL(…);
void
mt7530_remove_common(struct mt7530_priv *priv)
{ … }
EXPORT_SYMBOL_GPL(…);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;