hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/include/linux/platform_data/mlxreg.h
....@@ -1,40 +1,28 @@
1
+/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
12 /*
2
- * Copyright (c) 2017 Mellanox Technologies. All rights reserved.
3
- * Copyright (c) 2017 Vadim Pasternak <vadimp@mellanox.com>
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
7
- *
8
- * 1. Redistributions of source code must retain the above copyright
9
- * notice, this list of conditions and the following disclaimer.
10
- * 2. Redistributions in binary form must reproduce the above copyright
11
- * notice, this list of conditions and the following disclaimer in the
12
- * documentation and/or other materials provided with the distribution.
13
- * 3. Neither the names of the copyright holders nor the names of its
14
- * contributors may be used to endorse or promote products derived from
15
- * this software without specific prior written permission.
16
- *
17
- * Alternatively, this software may be distributed under the terms of the
18
- * GNU General Public License ("GPL") version 2 as published by the Free
19
- * Software Foundation.
20
- *
21
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
- * POSSIBILITY OF SUCH DAMAGE.
3
+ * Copyright (C) 2017-2020 Mellanox Technologies Ltd.
324 */
335
346 #ifndef __LINUX_PLATFORM_DATA_MLXREG_H
357 #define __LINUX_PLATFORM_DATA_MLXREG_H
368
379 #define MLXREG_CORE_LABEL_MAX_SIZE 32
10
+#define MLXREG_CORE_WD_FEATURE_NOWAYOUT BIT(0)
11
+#define MLXREG_CORE_WD_FEATURE_START_AT_BOOT BIT(1)
12
+
13
+/**
14
+ * enum mlxreg_wdt_type - type of HW watchdog
15
+ *
16
+ * TYPE1 HW watchdog implementation exist in old systems.
17
+ * All new systems have TYPE2 HW watchdog.
18
+ * TYPE3 HW watchdog can exist on all systems with new CPLD.
19
+ * TYPE3 is selected by WD capability bit.
20
+ */
21
+enum mlxreg_wdt_type {
22
+ MLX_WDT_TYPE1,
23
+ MLX_WDT_TYPE2,
24
+ MLX_WDT_TYPE3,
25
+};
3826
3927 /**
4028 * struct mlxreg_hotplug_device - I2C device data:
....@@ -61,22 +49,28 @@
6149 * @reg: attribute register;
6250 * @mask: attribute access mask;
6351 * @bit: attribute effective bit;
52
+ * @capability: attribute capability register;
53
+ * @reg_prsnt: attribute presence register;
6454 * @mode: access mode;
6555 * @np - pointer to node platform associated with attribute;
6656 * @hpdev - hotplug device data;
6757 * @health_cntr: dynamic device health indication counter;
6858 * @attached: true if device has been attached after good health indication;
59
+ * @regnum: number of registers occupied by multi-register attribute;
6960 */
7061 struct mlxreg_core_data {
7162 char label[MLXREG_CORE_LABEL_MAX_SIZE];
7263 u32 reg;
7364 u32 mask;
7465 u32 bit;
66
+ u32 capability;
67
+ u32 reg_prsnt;
7568 umode_t mode;
7669 struct device_node *np;
7770 struct mlxreg_hotplug_device hpdev;
78
- u8 health_cntr;
71
+ u32 health_cntr;
7972 bool attached;
73
+ u8 regnum;
8074 };
8175
8276 /**
....@@ -86,6 +80,7 @@
8680 * @aggr_mask: group aggregation mask;
8781 * @reg: group interrupt status register;
8882 * @mask: group interrupt mask;
83
+ * @capability: group capability register;
8984 * @cache: last status value for elements fro the same group;
9085 * @count: number of available elements in the group;
9186 * @ind: element's index inside the group;
....@@ -97,6 +92,7 @@
9792 u32 aggr_mask;
9893 u32 reg;
9994 u32 mask;
95
+ u32 capability;
10096 u32 cache;
10197 u8 count;
10298 u8 ind;
....@@ -107,14 +103,22 @@
107103 /**
108104 * struct mlxreg_core_platform_data - platform data:
109105 *
110
- * @led_data: led private data;
106
+ * @data: instance private data;
111107 * @regmap: register map of parent device;
112
- * @counter: number of led instances;
108
+ * @counter: number of instances;
109
+ * @features: supported features of device;
110
+ * @version: implementation version;
111
+ * @identity: device identity name;
112
+ * @capability: device capability register;
113113 */
114114 struct mlxreg_core_platform_data {
115115 struct mlxreg_core_data *data;
116116 void *regmap;
117117 int counter;
118
+ u32 features;
119
+ u32 version;
120
+ char identity[MLXREG_CORE_LABEL_MAX_SIZE];
121
+ u32 capability;
118122 };
119123
120124 /**