![]() |
|
|||
0001 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */ 0002 /* 0003 * Copyright (C) 2017-2020 Mellanox Technologies Ltd. 0004 */ 0005 0006 #ifndef __LINUX_PLATFORM_DATA_MLXREG_H 0007 #define __LINUX_PLATFORM_DATA_MLXREG_H 0008 0009 #define MLXREG_CORE_LABEL_MAX_SIZE 32 0010 #define MLXREG_CORE_WD_FEATURE_NOWAYOUT BIT(0) 0011 #define MLXREG_CORE_WD_FEATURE_START_AT_BOOT BIT(1) 0012 0013 /** 0014 * enum mlxreg_wdt_type - type of HW watchdog 0015 * 0016 * TYPE1 HW watchdog implementation exist in old systems. 0017 * All new systems have TYPE2 HW watchdog. 0018 * TYPE3 HW watchdog can exist on all systems with new CPLD. 0019 * TYPE3 is selected by WD capability bit. 0020 */ 0021 enum mlxreg_wdt_type { 0022 MLX_WDT_TYPE1, 0023 MLX_WDT_TYPE2, 0024 MLX_WDT_TYPE3, 0025 }; 0026 0027 /** 0028 * enum mlxreg_hotplug_kind - kind of hotplug entry 0029 * 0030 * @MLXREG_HOTPLUG_DEVICE_NA: do not care; 0031 * @MLXREG_HOTPLUG_LC_PRESENT: entry for line card presence in/out events; 0032 * @MLXREG_HOTPLUG_LC_VERIFIED: entry for line card verification status events 0033 * coming after line card security signature validation; 0034 * @MLXREG_HOTPLUG_LC_POWERED: entry for line card power on/off events; 0035 * @MLXREG_HOTPLUG_LC_SYNCED: entry for line card synchronization events, coming 0036 * after hardware-firmware synchronization handshake; 0037 * @MLXREG_HOTPLUG_LC_READY: entry for line card ready events, indicating line card 0038 PHYs ready / unready state; 0039 * @MLXREG_HOTPLUG_LC_ACTIVE: entry for line card active events, indicating firmware 0040 * availability / unavailability for the ports on line card; 0041 * @MLXREG_HOTPLUG_LC_THERMAL: entry for line card thermal shutdown events, positive 0042 * event indicates that system should power off the line 0043 * card for which this event has been received; 0044 */ 0045 enum mlxreg_hotplug_kind { 0046 MLXREG_HOTPLUG_DEVICE_NA = 0, 0047 MLXREG_HOTPLUG_LC_PRESENT = 1, 0048 MLXREG_HOTPLUG_LC_VERIFIED = 2, 0049 MLXREG_HOTPLUG_LC_POWERED = 3, 0050 MLXREG_HOTPLUG_LC_SYNCED = 4, 0051 MLXREG_HOTPLUG_LC_READY = 5, 0052 MLXREG_HOTPLUG_LC_ACTIVE = 6, 0053 MLXREG_HOTPLUG_LC_THERMAL = 7, 0054 }; 0055 0056 /** 0057 * enum mlxreg_hotplug_device_action - hotplug device action required for 0058 * driver's connectivity 0059 * 0060 * @MLXREG_HOTPLUG_DEVICE_DEFAULT_ACTION: probe device for 'on' event, remove 0061 * for 'off' event; 0062 * @MLXREG_HOTPLUG_DEVICE_PLATFORM_ACTION: probe platform device for 'on' 0063 * event, remove for 'off' event; 0064 * @MLXREG_HOTPLUG_DEVICE_NO_ACTION: no connectivity action is required; 0065 */ 0066 enum mlxreg_hotplug_device_action { 0067 MLXREG_HOTPLUG_DEVICE_DEFAULT_ACTION = 0, 0068 MLXREG_HOTPLUG_DEVICE_PLATFORM_ACTION = 1, 0069 MLXREG_HOTPLUG_DEVICE_NO_ACTION = 2, 0070 }; 0071 0072 /** 0073 * struct mlxreg_core_hotplug_notifier - hotplug notifier block: 0074 * 0075 * @identity: notifier identity name; 0076 * @handle: user handle to be passed by user handler function; 0077 * @user_handler: user handler function associated with the event; 0078 */ 0079 struct mlxreg_core_hotplug_notifier { 0080 char identity[MLXREG_CORE_LABEL_MAX_SIZE]; 0081 void *handle; 0082 int (*user_handler)(void *handle, enum mlxreg_hotplug_kind kind, u8 action); 0083 }; 0084 0085 /** 0086 * struct mlxreg_hotplug_device - I2C device data: 0087 * 0088 * @adapter: I2C device adapter; 0089 * @client: I2C device client; 0090 * @brdinfo: device board information; 0091 * @nr: I2C device adapter number, to which device is to be attached; 0092 * @pdev: platform device, if device is instantiated as a platform device; 0093 * @action: action to be performed upon event receiving; 0094 * @handle: user handle to be passed by user handler function; 0095 * @user_handler: user handler function associated with the event; 0096 * @notifier: pointer to event notifier block; 0097 * 0098 * Structure represents I2C hotplug device static data (board topology) and 0099 * dynamic data (related kernel objects handles). 0100 */ 0101 struct mlxreg_hotplug_device { 0102 struct i2c_adapter *adapter; 0103 struct i2c_client *client; 0104 struct i2c_board_info *brdinfo; 0105 int nr; 0106 struct platform_device *pdev; 0107 enum mlxreg_hotplug_device_action action; 0108 void *handle; 0109 int (*user_handler)(void *handle, enum mlxreg_hotplug_kind kind, u8 action); 0110 struct mlxreg_core_hotplug_notifier *notifier; 0111 }; 0112 0113 /** 0114 * struct mlxreg_core_data - attributes control data: 0115 * 0116 * @label: attribute label; 0117 * @reg: attribute register; 0118 * @mask: attribute access mask; 0119 * @bit: attribute effective bit; 0120 * @capability: attribute capability register; 0121 * @reg_prsnt: attribute presence register; 0122 * @reg_sync: attribute synch register; 0123 * @reg_pwr: attribute power register; 0124 * @reg_ena: attribute enable register; 0125 * @mode: access mode; 0126 * @np - pointer to node platform associated with attribute; 0127 * @hpdev - hotplug device data; 0128 * @notifier: pointer to event notifier block; 0129 * @health_cntr: dynamic device health indication counter; 0130 * @attached: true if device has been attached after good health indication; 0131 * @regnum: number of registers occupied by multi-register attribute; 0132 * @slot: slot number, at which device is located; 0133 * @secured: if set indicates that entry access is secured; 0134 */ 0135 struct mlxreg_core_data { 0136 char label[MLXREG_CORE_LABEL_MAX_SIZE]; 0137 u32 reg; 0138 u32 mask; 0139 u32 bit; 0140 u32 capability; 0141 u32 reg_prsnt; 0142 u32 reg_sync; 0143 u32 reg_pwr; 0144 u32 reg_ena; 0145 umode_t mode; 0146 struct device_node *np; 0147 struct mlxreg_hotplug_device hpdev; 0148 struct mlxreg_core_hotplug_notifier *notifier; 0149 u32 health_cntr; 0150 bool attached; 0151 u8 regnum; 0152 u8 slot; 0153 u8 secured; 0154 }; 0155 0156 /** 0157 * struct mlxreg_core_item - same type components controlled by the driver: 0158 * 0159 * @data: component data; 0160 * @kind: kind of hotplug attribute; 0161 * @aggr_mask: group aggregation mask; 0162 * @reg: group interrupt status register; 0163 * @mask: group interrupt mask; 0164 * @capability: group capability register; 0165 * @cache: last status value for elements fro the same group; 0166 * @count: number of available elements in the group; 0167 * @ind: element's index inside the group; 0168 * @inversed: if 0: 0 for signal status is OK, if 1 - 1 is OK; 0169 * @health: true if device has health indication, false in other case; 0170 */ 0171 struct mlxreg_core_item { 0172 struct mlxreg_core_data *data; 0173 enum mlxreg_hotplug_kind kind; 0174 u32 aggr_mask; 0175 u32 reg; 0176 u32 mask; 0177 u32 capability; 0178 u32 cache; 0179 u8 count; 0180 u8 ind; 0181 u8 inversed; 0182 u8 health; 0183 }; 0184 0185 /** 0186 * struct mlxreg_core_platform_data - platform data: 0187 * 0188 * @data: instance private data; 0189 * @regmap: register map of parent device; 0190 * @counter: number of instances; 0191 * @features: supported features of device; 0192 * @version: implementation version; 0193 * @identity: device identity name; 0194 * @capability: device capability register; 0195 */ 0196 struct mlxreg_core_platform_data { 0197 struct mlxreg_core_data *data; 0198 void *regmap; 0199 int counter; 0200 u32 features; 0201 u32 version; 0202 char identity[MLXREG_CORE_LABEL_MAX_SIZE]; 0203 u32 capability; 0204 }; 0205 0206 /** 0207 * struct mlxreg_core_hotplug_platform_data - hotplug platform data: 0208 * 0209 * @items: same type components with the hotplug capability; 0210 * @irq: platform interrupt number; 0211 * @regmap: register map of parent device; 0212 * @counter: number of the components with the hotplug capability; 0213 * @cell: location of top aggregation interrupt register; 0214 * @mask: top aggregation interrupt common mask; 0215 * @cell_low: location of low aggregation interrupt register; 0216 * @mask_low: low aggregation interrupt common mask; 0217 * @deferred_nr: I2C adapter number must be exist prior probing execution; 0218 * @shift_nr: I2C adapter numbers must be incremented by this value; 0219 * @handle: handle to be passed by callback; 0220 * @completion_notify: callback to notify when platform driver probing is done; 0221 */ 0222 struct mlxreg_core_hotplug_platform_data { 0223 struct mlxreg_core_item *items; 0224 int irq; 0225 void *regmap; 0226 int counter; 0227 u32 cell; 0228 u32 mask; 0229 u32 cell_low; 0230 u32 mask_low; 0231 int deferred_nr; 0232 int shift_nr; 0233 void *handle; 0234 int (*completion_notify)(void *handle, int id); 0235 }; 0236 0237 #endif /* __LINUX_PLATFORM_DATA_MLXREG_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |