Skip to content

Commit 6a7abc6

Browse files
Marek Vasutdavem330
authored andcommitted
net: dsa: ksz: Merge ksz_priv.h into ksz_common.h
Merge the two headers into one, no functional change. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Andrew Lunn <andrew@lunn.ch> Cc: David S. Miller <davem@davemloft.net> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Tristram Ha <Tristram.Ha@microchip.com> Cc: Vivien Didelot <vivien.didelot@gmail.com> Cc: Woojung Huh <woojung.huh@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ffc60b5 commit 6a7abc6

File tree

7 files changed

+144
-161
lines changed

7 files changed

+144
-161
lines changed

drivers/net/dsa/microchip/ksz8795.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <net/dsa.h>
1919
#include <net/switchdev.h>
2020

21-
#include "ksz_priv.h"
2221
#include "ksz_common.h"
2322
#include "ksz8795_reg.h"
2423

drivers/net/dsa/microchip/ksz8795_spi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <linux/regmap.h>
1515
#include <linux/spi/spi.h>
1616

17-
#include "ksz_priv.h"
1817
#include "ksz_common.h"
1918

2019
#define SPI_ADDR_SHIFT 12

drivers/net/dsa/microchip/ksz9477.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <net/dsa.h>
1515
#include <net/switchdev.h>
1616

17-
#include "ksz_priv.h"
1817
#include "ksz9477_reg.h"
1918
#include "ksz_common.h"
2019

drivers/net/dsa/microchip/ksz9477_spi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <linux/regmap.h>
1414
#include <linux/spi/spi.h>
1515

16-
#include "ksz_priv.h"
1716
#include "ksz_common.h"
1817

1918
#define SPI_ADDR_SHIFT 24

drivers/net/dsa/microchip/ksz_common.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <net/dsa.h>
1919
#include <net/switchdev.h>
2020

21-
#include "ksz_priv.h"
2221
#include "ksz_common.h"
2322

2423
void ksz_update_port_member(struct ksz_device *dev, int port)

drivers/net/dsa/microchip/ksz_common.h

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,151 @@
77
#ifndef __KSZ_COMMON_H
88
#define __KSZ_COMMON_H
99

10+
#include <linux/etherdevice.h>
11+
#include <linux/kernel.h>
12+
#include <linux/mutex.h>
13+
#include <linux/phy.h>
1014
#include <linux/regmap.h>
15+
#include <net/dsa.h>
16+
17+
struct vlan_table {
18+
u32 table[3];
19+
};
20+
21+
struct ksz_port_mib {
22+
struct mutex cnt_mutex; /* structure access */
23+
u8 cnt_ptr;
24+
u64 *counters;
25+
};
26+
27+
struct ksz_port {
28+
u16 member;
29+
u16 vid_member;
30+
int stp_state;
31+
struct phy_device phydev;
32+
33+
u32 on:1; /* port is not disabled by hardware */
34+
u32 phy:1; /* port has a PHY */
35+
u32 fiber:1; /* port is fiber */
36+
u32 sgmii:1; /* port is SGMII */
37+
u32 force:1;
38+
u32 read:1; /* read MIB counters in background */
39+
u32 freeze:1; /* MIB counter freeze is enabled */
40+
41+
struct ksz_port_mib mib;
42+
};
43+
44+
struct ksz_device {
45+
struct dsa_switch *ds;
46+
struct ksz_platform_data *pdata;
47+
const char *name;
48+
49+
struct mutex dev_mutex; /* device access */
50+
struct mutex stats_mutex; /* status access */
51+
struct mutex alu_mutex; /* ALU access */
52+
struct mutex vlan_mutex; /* vlan access */
53+
const struct ksz_dev_ops *dev_ops;
54+
55+
struct device *dev;
56+
struct regmap *regmap[3];
57+
58+
void *priv;
59+
60+
struct gpio_desc *reset_gpio; /* Optional reset GPIO */
61+
62+
/* chip specific data */
63+
u32 chip_id;
64+
int num_vlans;
65+
int num_alus;
66+
int num_statics;
67+
int cpu_port; /* port connected to CPU */
68+
int cpu_ports; /* port bitmap can be cpu port */
69+
int phy_port_cnt;
70+
int port_cnt;
71+
int reg_mib_cnt;
72+
int mib_cnt;
73+
int mib_port_cnt;
74+
int last_port; /* ports after that not used */
75+
phy_interface_t interface;
76+
u32 regs_size;
77+
bool phy_errata_9477;
78+
bool synclko_125;
79+
80+
struct vlan_table *vlan_cache;
81+
82+
struct ksz_port *ports;
83+
struct timer_list mib_read_timer;
84+
struct work_struct mib_read;
85+
unsigned long mib_read_interval;
86+
u16 br_member;
87+
u16 member;
88+
u16 live_ports;
89+
u16 on_ports; /* ports enabled by DSA */
90+
u16 rx_ports;
91+
u16 tx_ports;
92+
u16 mirror_rx;
93+
u16 mirror_tx;
94+
u32 features; /* chip specific features */
95+
u32 overrides; /* chip functions set by user */
96+
u16 host_mask;
97+
u16 port_mask;
98+
};
99+
100+
struct alu_struct {
101+
/* entry 1 */
102+
u8 is_static:1;
103+
u8 is_src_filter:1;
104+
u8 is_dst_filter:1;
105+
u8 prio_age:3;
106+
u32 _reserv_0_1:23;
107+
u8 mstp:3;
108+
/* entry 2 */
109+
u8 is_override:1;
110+
u8 is_use_fid:1;
111+
u32 _reserv_1_1:23;
112+
u8 port_forward:7;
113+
/* entry 3 & 4*/
114+
u32 _reserv_2_1:9;
115+
u8 fid:7;
116+
u8 mac[ETH_ALEN];
117+
};
118+
119+
struct ksz_dev_ops {
120+
u32 (*get_port_addr)(int port, int offset);
121+
void (*cfg_port_member)(struct ksz_device *dev, int port, u8 member);
122+
void (*flush_dyn_mac_table)(struct ksz_device *dev, int port);
123+
void (*phy_setup)(struct ksz_device *dev, int port,
124+
struct phy_device *phy);
125+
void (*port_cleanup)(struct ksz_device *dev, int port);
126+
void (*port_setup)(struct ksz_device *dev, int port, bool cpu_port);
127+
void (*r_phy)(struct ksz_device *dev, u16 phy, u16 reg, u16 *val);
128+
void (*w_phy)(struct ksz_device *dev, u16 phy, u16 reg, u16 val);
129+
int (*r_dyn_mac_table)(struct ksz_device *dev, u16 addr, u8 *mac_addr,
130+
u8 *fid, u8 *src_port, u8 *timestamp,
131+
u16 *entries);
132+
int (*r_sta_mac_table)(struct ksz_device *dev, u16 addr,
133+
struct alu_struct *alu);
134+
void (*w_sta_mac_table)(struct ksz_device *dev, u16 addr,
135+
struct alu_struct *alu);
136+
void (*r_mib_cnt)(struct ksz_device *dev, int port, u16 addr,
137+
u64 *cnt);
138+
void (*r_mib_pkt)(struct ksz_device *dev, int port, u16 addr,
139+
u64 *dropped, u64 *cnt);
140+
void (*freeze_mib)(struct ksz_device *dev, int port, bool freeze);
141+
void (*port_init_cnt)(struct ksz_device *dev, int port);
142+
int (*shutdown)(struct ksz_device *dev);
143+
int (*detect)(struct ksz_device *dev);
144+
int (*init)(struct ksz_device *dev);
145+
void (*exit)(struct ksz_device *dev);
146+
};
147+
148+
struct ksz_device *ksz_switch_alloc(struct device *base, void *priv);
149+
int ksz_switch_register(struct ksz_device *dev,
150+
const struct ksz_dev_ops *ops);
151+
void ksz_switch_remove(struct ksz_device *dev);
152+
153+
int ksz8795_switch_register(struct ksz_device *dev);
154+
int ksz9477_switch_register(struct ksz_device *dev);
11155

12156
void ksz_update_port_member(struct ksz_device *dev, int port);
13157
void ksz_init_mib_timer(struct ksz_device *dev);

drivers/net/dsa/microchip/ksz_priv.h

Lines changed: 0 additions & 156 deletions
This file was deleted.

0 commit comments

Comments
 (0)