xref: /openbmc/linux/drivers/net/dsa/microchip/ksz8.h (revision 7b7090b4)
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 
11 #include <linux/types.h>
12 
13 enum ksz_regs {
14 	REG_IND_CTRL_0,
15 	REG_IND_DATA_8,
16 	REG_IND_DATA_CHECK,
17 	REG_IND_DATA_HI,
18 	REG_IND_DATA_LO,
19 	REG_IND_MIB_CHECK,
20 	REG_IND_BYTE,
21 	P_FORCE_CTRL,
22 	P_LINK_STATUS,
23 	P_LOCAL_CTRL,
24 	P_NEG_RESTART_CTRL,
25 	P_REMOTE_STATUS,
26 	P_SPEED_STATUS,
27 	S_TAIL_TAG_CTRL,
28 };
29 
30 enum ksz_masks {
31 	PORT_802_1P_REMAPPING,
32 	SW_TAIL_TAG_ENABLE,
33 	MIB_COUNTER_OVERFLOW,
34 	MIB_COUNTER_VALID,
35 	VLAN_TABLE_FID,
36 	VLAN_TABLE_MEMBERSHIP,
37 	VLAN_TABLE_VALID,
38 	STATIC_MAC_TABLE_VALID,
39 	STATIC_MAC_TABLE_USE_FID,
40 	STATIC_MAC_TABLE_FID,
41 	STATIC_MAC_TABLE_OVERRIDE,
42 	STATIC_MAC_TABLE_FWD_PORTS,
43 	DYNAMIC_MAC_TABLE_ENTRIES_H,
44 	DYNAMIC_MAC_TABLE_MAC_EMPTY,
45 	DYNAMIC_MAC_TABLE_NOT_READY,
46 	DYNAMIC_MAC_TABLE_ENTRIES,
47 	DYNAMIC_MAC_TABLE_FID,
48 	DYNAMIC_MAC_TABLE_SRC_PORT,
49 	DYNAMIC_MAC_TABLE_TIMESTAMP,
50 };
51 
52 enum ksz_shifts {
53 	VLAN_TABLE_MEMBERSHIP_S,
54 	VLAN_TABLE,
55 	STATIC_MAC_FWD_PORTS,
56 	STATIC_MAC_FID,
57 	DYNAMIC_MAC_ENTRIES_H,
58 	DYNAMIC_MAC_ENTRIES,
59 	DYNAMIC_MAC_FID,
60 	DYNAMIC_MAC_TIMESTAMP,
61 	DYNAMIC_MAC_SRC_PORT,
62 };
63 
64 struct ksz8 {
65 	const u8 *regs;
66 	const u32 *masks;
67 	const u8 *shifts;
68 	void *priv;
69 };
70 
71 #endif
72