1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
3 * Copyright (C) 2017-2020 Mellanox Technologies Ltd.
6 #ifndef __LINUX_PLATFORM_DATA_MLXREG_H
7 #define __LINUX_PLATFORM_DATA_MLXREG_H
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)
14 * enum mlxreg_wdt_type - type of HW watchdog
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.
21 enum mlxreg_wdt_type {
28 * struct mlxreg_hotplug_device - I2C device data:
30 * @adapter: I2C device adapter;
31 * @client: I2C device client;
32 * @brdinfo: device board information;
33 * @nr: I2C device adapter number, to which device is to be attached;
35 * Structure represents I2C hotplug device static data (board topology) and
36 * dynamic data (related kernel objects handles).
38 struct mlxreg_hotplug_device {
39 struct i2c_adapter *adapter;
40 struct i2c_client *client;
41 struct i2c_board_info *brdinfo;
46 * struct mlxreg_core_data - attributes control data:
48 * @label: attribute label;
49 * @reg: attribute register;
50 * @mask: attribute access mask;
51 * @bit: attribute effective bit;
52 * @capability: attribute capability register;
53 * @reg_prsnt: attribute presence register;
55 * @np - pointer to node platform associated with attribute;
56 * @hpdev - hotplug device data;
57 * @health_cntr: dynamic device health indication counter;
58 * @attached: true if device has been attached after good health indication;
59 * @regnum: number of registers occupied by multi-register attribute;
61 struct mlxreg_core_data {
62 char label[MLXREG_CORE_LABEL_MAX_SIZE];
69 struct device_node *np;
70 struct mlxreg_hotplug_device hpdev;
77 * struct mlxreg_core_item - same type components controlled by the driver:
79 * @data: component data;
80 * @aggr_mask: group aggregation mask;
81 * @reg: group interrupt status register;
82 * @mask: group interrupt mask;
83 * @capability: group capability register;
84 * @cache: last status value for elements fro the same group;
85 * @count: number of available elements in the group;
86 * @ind: element's index inside the group;
87 * @inversed: if 0: 0 for signal status is OK, if 1 - 1 is OK;
88 * @health: true if device has health indication, false in other case;
90 struct mlxreg_core_item {
91 struct mlxreg_core_data *data;
104 * struct mlxreg_core_platform_data - platform data:
106 * @data: instance private data;
107 * @regmap: register map of parent device;
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;
114 struct mlxreg_core_platform_data {
115 struct mlxreg_core_data *data;
120 char identity[MLXREG_CORE_LABEL_MAX_SIZE];
125 * struct mlxreg_core_hotplug_platform_data - hotplug platform data:
127 * @items: same type components with the hotplug capability;
128 * @irq: platform interrupt number;
129 * @regmap: register map of parent device;
130 * @counter: number of the components with the hotplug capability;
131 * @cell: location of top aggregation interrupt register;
132 * @mask: top aggregation interrupt common mask;
133 * @cell_low: location of low aggregation interrupt register;
134 * @mask_low: low aggregation interrupt common mask;
135 * @deferred_nr: I2C adapter number must be exist prior probing execution;
136 * @shift_nr: I2C adapter numbers must be incremented by this value;
138 struct mlxreg_core_hotplug_platform_data {
139 struct mlxreg_core_item *items;
151 #endif /* __LINUX_PLATFORM_DATA_MLXREG_H */