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