.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */ |
---|
1 | 2 | /* |
---|
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. |
---|
32 | 4 | */ |
---|
33 | 5 | |
---|
34 | 6 | #ifndef __LINUX_PLATFORM_DATA_MLXREG_H |
---|
35 | 7 | #define __LINUX_PLATFORM_DATA_MLXREG_H |
---|
36 | 8 | |
---|
37 | 9 | #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 | +}; |
---|
38 | 26 | |
---|
39 | 27 | /** |
---|
40 | 28 | * struct mlxreg_hotplug_device - I2C device data: |
---|
.. | .. |
---|
61 | 49 | * @reg: attribute register; |
---|
62 | 50 | * @mask: attribute access mask; |
---|
63 | 51 | * @bit: attribute effective bit; |
---|
| 52 | + * @capability: attribute capability register; |
---|
| 53 | + * @reg_prsnt: attribute presence register; |
---|
64 | 54 | * @mode: access mode; |
---|
65 | 55 | * @np - pointer to node platform associated with attribute; |
---|
66 | 56 | * @hpdev - hotplug device data; |
---|
67 | 57 | * @health_cntr: dynamic device health indication counter; |
---|
68 | 58 | * @attached: true if device has been attached after good health indication; |
---|
| 59 | + * @regnum: number of registers occupied by multi-register attribute; |
---|
69 | 60 | */ |
---|
70 | 61 | struct mlxreg_core_data { |
---|
71 | 62 | char label[MLXREG_CORE_LABEL_MAX_SIZE]; |
---|
72 | 63 | u32 reg; |
---|
73 | 64 | u32 mask; |
---|
74 | 65 | u32 bit; |
---|
| 66 | + u32 capability; |
---|
| 67 | + u32 reg_prsnt; |
---|
75 | 68 | umode_t mode; |
---|
76 | 69 | struct device_node *np; |
---|
77 | 70 | struct mlxreg_hotplug_device hpdev; |
---|
78 | | - u8 health_cntr; |
---|
| 71 | + u32 health_cntr; |
---|
79 | 72 | bool attached; |
---|
| 73 | + u8 regnum; |
---|
80 | 74 | }; |
---|
81 | 75 | |
---|
82 | 76 | /** |
---|
.. | .. |
---|
86 | 80 | * @aggr_mask: group aggregation mask; |
---|
87 | 81 | * @reg: group interrupt status register; |
---|
88 | 82 | * @mask: group interrupt mask; |
---|
| 83 | + * @capability: group capability register; |
---|
89 | 84 | * @cache: last status value for elements fro the same group; |
---|
90 | 85 | * @count: number of available elements in the group; |
---|
91 | 86 | * @ind: element's index inside the group; |
---|
.. | .. |
---|
97 | 92 | u32 aggr_mask; |
---|
98 | 93 | u32 reg; |
---|
99 | 94 | u32 mask; |
---|
| 95 | + u32 capability; |
---|
100 | 96 | u32 cache; |
---|
101 | 97 | u8 count; |
---|
102 | 98 | u8 ind; |
---|
.. | .. |
---|
107 | 103 | /** |
---|
108 | 104 | * struct mlxreg_core_platform_data - platform data: |
---|
109 | 105 | * |
---|
110 | | - * @led_data: led private data; |
---|
| 106 | + * @data: instance private data; |
---|
111 | 107 | * @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; |
---|
113 | 113 | */ |
---|
114 | 114 | struct mlxreg_core_platform_data { |
---|
115 | 115 | struct mlxreg_core_data *data; |
---|
116 | 116 | void *regmap; |
---|
117 | 117 | int counter; |
---|
| 118 | + u32 features; |
---|
| 119 | + u32 version; |
---|
| 120 | + char identity[MLXREG_CORE_LABEL_MAX_SIZE]; |
---|
| 121 | + u32 capability; |
---|
118 | 122 | }; |
---|
119 | 123 | |
---|
120 | 124 | /** |
---|