From: Tristram Ha <tristram...@microchip.com> Break ksz_priv.h into two files: private and public. The public one is put in include/linux/dsa/ksz_dsa.h.
This allows the tail tagging code tag_ksz.c to access the switch driver as the tail tag format can be different when certain switch functions are enabled. Signed-off-by: Tristram Ha <tristram...@microchip.com> --- drivers/net/dsa/microchip/ksz_priv.h | 86 +--------------------------------- include/linux/dsa/ksz_dsa.h | 90 ++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 84 deletions(-) create mode 100644 include/linux/dsa/ksz_dsa.h diff --git a/drivers/net/dsa/microchip/ksz_priv.h b/drivers/net/dsa/microchip/ksz_priv.h index 1955ea6..5d93822 100644 --- a/drivers/net/dsa/microchip/ksz_priv.h +++ b/drivers/net/dsa/microchip/ksz_priv.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 * - * Microchip KSZ series switch common definitions + * Microchip KSZ series switch private definitions * * Copyright (C) 2017-2018 Microchip Technology Inc. */ @@ -13,89 +13,7 @@ #include <linux/phy.h> #include <linux/etherdevice.h> #include <net/dsa.h> - -struct ksz_io_ops; - -struct vlan_table { - u32 table[3]; -}; - -struct ksz_port_mib { - struct mutex cnt_mutex; /* structure access */ - u8 cnt_ptr; - u64 *counters; -}; - -struct ksz_port { - u16 member; - u16 vid_member; - int stp_state; - struct phy_device phydev; - - u32 on:1; /* port is not disabled by hardware */ - u32 phy:1; /* port has a PHY */ - u32 fiber:1; /* port is fiber */ - u32 sgmii:1; /* port is SGMII */ - u32 force:1; - u32 link_just_down:1; /* link just goes down */ - u32 freeze:1; /* MIB counter freeze is enabled */ - - struct ksz_port_mib mib; -}; - -struct ksz_device { - struct dsa_switch *ds; - struct ksz_platform_data *pdata; - const char *name; - - struct mutex reg_mutex; /* register access */ - struct mutex stats_mutex; /* status access */ - struct mutex alu_mutex; /* ALU access */ - struct mutex vlan_mutex; /* vlan access */ - const struct ksz_io_ops *ops; - const struct ksz_dev_ops *dev_ops; - - struct device *dev; - - void *priv; - - /* chip specific data */ - u32 chip_id; - int num_vlans; - int num_alus; - int num_statics; - int cpu_port; /* port connected to CPU */ - int cpu_ports; /* port bitmap can be cpu port */ - int phy_port_cnt; - int port_cnt; - int reg_mib_cnt; - int mib_cnt; - int mib_port_cnt; - int last_port; /* ports after that not used */ - phy_interface_t interface; - u32 regs_size; - - struct vlan_table *vlan_cache; - - u8 *txbuf; - - struct ksz_port *ports; - struct timer_list mib_read_timer; - struct work_struct mib_read; - unsigned long mib_read_interval; - u16 br_member; - u16 member; - u16 live_ports; - u16 on_ports; /* ports enabled by DSA */ - u16 rx_ports; - u16 tx_ports; - u16 mirror_rx; - u16 mirror_tx; - u32 features; /* chip specific features */ - u32 overrides; /* chip functions set by user */ - u16 host_mask; - u16 port_mask; -}; +#include <linux/dsa/ksz_dsa.h> struct ksz_io_ops { int (*read8)(struct ksz_device *dev, u32 reg, u8 *value); diff --git a/include/linux/dsa/ksz_dsa.h b/include/linux/dsa/ksz_dsa.h new file mode 100644 index 0000000..3148cae --- /dev/null +++ b/include/linux/dsa/ksz_dsa.h @@ -0,0 +1,90 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * Microchip KSZ series switch common definitions + * + * Copyright (C) 2017-2018 Microchip Technology Inc. + */ + +#include <linux/phy.h> + +struct vlan_table { + u32 table[3]; +}; + +struct ksz_port_mib { + struct mutex cnt_mutex; /* structure access */ + u8 cnt_ptr; + u64 *counters; +}; + +struct ksz_port { + u16 member; + u16 vid_member; + int stp_state; + struct phy_device phydev; + + u32 on:1; /* port is not disabled by hardware */ + u32 phy:1; /* port has a PHY */ + u32 fiber:1; /* port is fiber */ + u32 sgmii:1; /* port is SGMII */ + u32 force:1; + u32 link_just_down:1; /* link just goes down */ + u32 freeze:1; /* MIB counter freeze is enabled */ + + struct ksz_port_mib mib; +}; + +struct ksz_device { + struct dsa_switch *ds; + struct ksz_platform_data *pdata; + const char *name; + + struct mutex reg_mutex; /* register access */ + struct mutex stats_mutex; /* status access */ + struct mutex alu_mutex; /* ALU access */ + struct mutex vlan_mutex; /* vlan access */ + const struct ksz_io_ops *ops; + const struct ksz_dev_ops *dev_ops; + + struct device *dev; + + void *priv; + + /* chip specific data */ + u32 chip_id; + int num_vlans; + int num_alus; + int num_statics; + int cpu_port; /* port connected to CPU */ + int cpu_ports; /* port bitmap can be cpu port */ + int phy_port_cnt; + int port_cnt; + int reg_mib_cnt; + int mib_cnt; + int mib_port_cnt; + int last_port; /* ports after that not used */ + phy_interface_t interface; + u32 regs_size; + + struct vlan_table *vlan_cache; + + u8 *txbuf; + + struct ksz_port *ports; + struct timer_list mib_read_timer; + struct work_struct mib_read; + unsigned long mib_read_interval; + u16 br_member; + u16 member; + u16 live_ports; + u16 on_ports; /* ports enabled by DSA */ + u16 rx_ports; + u16 tx_ports; + u16 mirror_rx; + u16 mirror_tx; + u32 features; /* chip specific features */ + u32 overrides; /* chip functions set by user */ + u16 host_mask; + u16 port_mask; +}; + -- 1.9.1