xref: /openbmc/linux/drivers/net/dsa/microchip/ksz8.h (revision bacf743e)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Microchip KSZ8XXX series register access
4  *
5  * Copyright (C) 2020 Pengutronix, Michael Grzeschik <kernel@pengutronix.de>
6  */
7 
8 #ifndef __KSZ8XXX_H
9 #define __KSZ8XXX_H
10 #include <linux/kernel.h>
11 
12 enum ksz_regs {
13 	REG_IND_CTRL_0,
14 	REG_IND_DATA_8,
15 	REG_IND_DATA_CHECK,
16 	REG_IND_DATA_HI,
17 	REG_IND_DATA_LO,
18 	REG_IND_MIB_CHECK,
19 	REG_IND_BYTE,
20 	P_FORCE_CTRL,
21 	P_LINK_STATUS,
22 	P_LOCAL_CTRL,
23 	P_NEG_RESTART_CTRL,
24 	P_REMOTE_STATUS,
25 	P_SPEED_STATUS,
26 	S_TAIL_TAG_CTRL,
27 };
28 
29 enum ksz_masks {
30 	PORT_802_1P_REMAPPING,
31 	SW_TAIL_TAG_ENABLE,
32 	MIB_COUNTER_OVERFLOW,
33 	MIB_COUNTER_VALID,
34 	VLAN_TABLE_FID,
35 	VLAN_TABLE_MEMBERSHIP,
36 	VLAN_TABLE_VALID,
37 	STATIC_MAC_TABLE_VALID,
38 	STATIC_MAC_TABLE_USE_FID,
39 	STATIC_MAC_TABLE_FID,
40 	STATIC_MAC_TABLE_OVERRIDE,
41 	STATIC_MAC_TABLE_FWD_PORTS,
42 	DYNAMIC_MAC_TABLE_ENTRIES_H,
43 	DYNAMIC_MAC_TABLE_MAC_EMPTY,
44 	DYNAMIC_MAC_TABLE_NOT_READY,
45 	DYNAMIC_MAC_TABLE_ENTRIES,
46 	DYNAMIC_MAC_TABLE_FID,
47 	DYNAMIC_MAC_TABLE_SRC_PORT,
48 	DYNAMIC_MAC_TABLE_TIMESTAMP,
49 };
50 
51 enum ksz_shifts {
52 	VLAN_TABLE_MEMBERSHIP_S,
53 	VLAN_TABLE,
54 	STATIC_MAC_FWD_PORTS,
55 	STATIC_MAC_FID,
56 	DYNAMIC_MAC_ENTRIES_H,
57 	DYNAMIC_MAC_ENTRIES,
58 	DYNAMIC_MAC_FID,
59 	DYNAMIC_MAC_TIMESTAMP,
60 	DYNAMIC_MAC_SRC_PORT,
61 };
62 
63 struct ksz8 {
64 	const u8 *regs;
65 	const u32 *masks;
66 	const u8 *shifts;
67 	void *priv;
68 };
69 
70 #endif
71