1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
3 * Copyright 2013-2016 Freescale Semiconductor Inc.
4 * Copyright 2018-2019 NXP
7 #ifndef _FSL_DPDMUX_CMD_H
8 #define _FSL_DPDMUX_CMD_H
11 #define DPDMUX_VER_MAJOR 6
12 #define DPDMUX_VER_MINOR 3
14 #define DPDMUX_CMD_BASE_VERSION 1
15 #define DPDMUX_CMD_VERSION_2 2
16 #define DPDMUX_CMD_ID_OFFSET 4
18 #define DPDMUX_CMD(id) (((id) << DPDMUX_CMD_ID_OFFSET) |\
19 DPDMUX_CMD_BASE_VERSION)
20 #define DPDMUX_CMD_V2(id) (((id) << DPDMUX_CMD_ID_OFFSET) | \
24 #define DPDMUX_CMDID_CLOSE DPDMUX_CMD(0x800)
25 #define DPDMUX_CMDID_OPEN DPDMUX_CMD(0x806)
26 #define DPDMUX_CMDID_CREATE DPDMUX_CMD(0x906)
27 #define DPDMUX_CMDID_DESTROY DPDMUX_CMD(0x986)
28 #define DPDMUX_CMDID_GET_API_VERSION DPDMUX_CMD(0xa06)
30 #define DPDMUX_CMDID_ENABLE DPDMUX_CMD(0x002)
31 #define DPDMUX_CMDID_DISABLE DPDMUX_CMD(0x003)
32 #define DPDMUX_CMDID_GET_ATTR DPDMUX_CMD(0x004)
33 #define DPDMUX_CMDID_RESET DPDMUX_CMD(0x005)
34 #define DPDMUX_CMDID_IS_ENABLED DPDMUX_CMD(0x006)
36 #define DPDMUX_CMDID_SET_MAX_FRAME_LENGTH DPDMUX_CMD(0x0a1)
38 #define DPDMUX_CMDID_UL_RESET_COUNTERS DPDMUX_CMD(0x0a3)
40 #define DPDMUX_CMDID_IF_SET_ACCEPTED_FRAMES DPDMUX_CMD(0x0a7)
41 #define DPDMUX_CMDID_IF_GET_ATTR DPDMUX_CMD(0x0a8)
42 #define DPDMUX_CMDID_IF_ENABLE DPDMUX_CMD(0x0a9)
43 #define DPDMUX_CMDID_IF_DISABLE DPDMUX_CMD(0x0aa)
45 #define DPDMUX_CMDID_IF_ADD_L2_RULE DPDMUX_CMD(0x0b0)
46 #define DPDMUX_CMDID_IF_REMOVE_L2_RULE DPDMUX_CMD(0x0b1)
47 #define DPDMUX_CMDID_IF_GET_COUNTER DPDMUX_CMD(0x0b2)
48 #define DPDMUX_CMDID_IF_SET_LINK_CFG DPDMUX_CMD_V2(0x0b3)
49 #define DPDMUX_CMDID_IF_GET_LINK_STATE DPDMUX_CMD_V2(0x0b4)
51 #define DPDMUX_CMDID_SET_CUSTOM_KEY DPDMUX_CMD(0x0b5)
52 #define DPDMUX_CMDID_ADD_CUSTOM_CLS_ENTRY DPDMUX_CMD(0x0b6)
53 #define DPDMUX_CMDID_REMOVE_CUSTOM_CLS_ENTRY DPDMUX_CMD(0x0b7)
55 #define DPDMUX_CMDID_IF_SET_DEFAULT DPDMUX_CMD(0x0b8)
56 #define DPDMUX_CMDID_IF_GET_DEFAULT DPDMUX_CMD(0x0b9)
58 #define DPDMUX_MASK(field) \
59 GENMASK(DPDMUX_##field##_SHIFT + DPDMUX_##field##_SIZE - 1, \
60 DPDMUX_##field##_SHIFT)
61 #define dpdmux_set_field(var, field, val) \
62 ((var) |= (((val) << DPDMUX_##field##_SHIFT) & DPDMUX_MASK(field)))
63 #define dpdmux_get_field(var, field) \
64 (((var) & DPDMUX_MASK(field)) >> DPDMUX_##field##_SHIFT)
67 struct dpdmux_cmd_open {
71 struct dpdmux_cmd_create {
77 uint16_t adv_max_dmat_entries;
78 uint16_t adv_max_mc_groups;
79 uint16_t adv_max_vlan_ids;
85 struct dpdmux_cmd_destroy {
89 #define DPDMUX_ENABLE_SHIFT 0
90 #define DPDMUX_ENABLE_SIZE 1
91 #define DPDMUX_IS_DEFAULT_SHIFT 1
92 #define DPDMUX_IS_DEFAULT_SIZE 1
94 struct dpdmux_rsp_is_enabled {
98 struct dpdmux_rsp_get_attr {
113 struct dpdmux_cmd_set_max_frame_length {
114 uint16_t max_frame_length;
117 #define DPDMUX_ACCEPTED_FRAMES_TYPE_SHIFT 0
118 #define DPDMUX_ACCEPTED_FRAMES_TYPE_SIZE 4
119 #define DPDMUX_UNACCEPTED_FRAMES_ACTION_SHIFT 4
120 #define DPDMUX_UNACCEPTED_FRAMES_ACTION_SIZE 4
122 struct dpdmux_cmd_if_set_accepted_frames {
124 uint8_t frames_options;
127 struct dpdmux_cmd_if {
131 struct dpdmux_rsp_if_get_attr {
135 uint8_t accepted_frames_type;
139 struct dpdmux_cmd_if_l2_rule {
152 struct dpdmux_cmd_if_get_counter {
154 uint8_t counter_type;
157 struct dpdmux_rsp_if_get_counter {
162 struct dpdmux_cmd_if_set_link_cfg {
170 uint64_t advertising;
173 struct dpdmux_cmd_if_get_link_state {
177 #define DPDMUX_UP_SHIFT 0
178 #define DPDMUX_UP_SIZE 1
179 #define DPDMUX_STATE_VALID_SHIFT 1
180 #define DPDMUX_STATE_VALID_SIZE 1
181 struct dpdmux_rsp_if_get_link_state {
191 uint64_t advertising;
194 struct dpdmux_rsp_get_api_version {
199 struct dpdmux_set_custom_key {
201 uint64_t key_cfg_iova;
204 struct dpdmux_cmd_add_custom_cls_entry {
213 struct dpdmux_cmd_remove_custom_cls_entry {
221 #endif /* _FSL_DPDMUX_CMD_H */