diff options
| author | Vadim Pasternak <vadimp@mellanox.com> | 2018-01-22 22:55:11 -0500 |
|---|---|---|
| committer | Darren Hart (VMware) <dvhart@infradead.org> | 2018-01-31 13:36:49 -0500 |
| commit | c6acad68eb2dbffd0497f91b206de5c362f59ee4 (patch) | |
| tree | 2115350d7eb993b12a15d4f18352d29681ab1278 /include/linux | |
| parent | 752849e69715fdc2190945f5532d70e8c80bf384 (diff) | |
platform/mellanox: mlxreg-hotplug: Modify to use a regmap interface
Restructure mlxreg header for unification of hotplug item definitions.
Unify hotplug items to allow any kind of item (power controller, fan
eeprom, psu eeprom, asic health) in common way.
Use a hardware independent regmap interface, enabling the support of
hotplug events over programmable devices attached to different bus
types, such as I2C, LPC, or SPI. Add a device node to the
mlxreg_core_data structure.
Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
[dvhart: spelling corrections, refactor device node introduction]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/platform_data/mlxreg.h | 126 |
1 files changed, 86 insertions, 40 deletions
diff --git a/include/linux/platform_data/mlxreg.h b/include/linux/platform_data/mlxreg.h index ffbcb7886c62..fcdc707eab99 100644 --- a/include/linux/platform_data/mlxreg.h +++ b/include/linux/platform_data/mlxreg.h | |||
| @@ -34,8 +34,11 @@ | |||
| 34 | #ifndef __LINUX_PLATFORM_DATA_MLXREG_H | 34 | #ifndef __LINUX_PLATFORM_DATA_MLXREG_H |
| 35 | #define __LINUX_PLATFORM_DATA_MLXREG_H | 35 | #define __LINUX_PLATFORM_DATA_MLXREG_H |
| 36 | 36 | ||
| 37 | #define MLXREG_CORE_LABEL_MAX_SIZE 32 | ||
| 38 | |||
| 37 | /** | 39 | /** |
| 38 | * struct mlxreg_hotplug_device - I2C device data: | 40 | * struct mlxreg_hotplug_device - I2C device data: |
| 41 | * | ||
| 39 | * @adapter: I2C device adapter; | 42 | * @adapter: I2C device adapter; |
| 40 | * @client: I2C device client; | 43 | * @client: I2C device client; |
| 41 | * @brdinfo: device board information; | 44 | * @brdinfo: device board information; |
| @@ -47,52 +50,95 @@ | |||
| 47 | struct mlxreg_hotplug_device { | 50 | struct mlxreg_hotplug_device { |
| 48 | struct i2c_adapter *adapter; | 51 | struct i2c_adapter *adapter; |
| 49 | struct i2c_client *client; | 52 | struct i2c_client *client; |
| 50 | struct i2c_board_info brdinfo; | 53 | struct i2c_board_info *brdinfo; |
| 51 | int nr; | 54 | int nr; |
| 52 | }; | 55 | }; |
| 53 | 56 | ||
| 54 | /** | 57 | /** |
| 55 | * struct mlxreg_hotplug_platform_data - device platform data: | 58 | * struct mlxreg_core_data - attributes control data: |
| 56 | * @top_aggr_offset: offset of top aggregation interrupt register; | 59 | * |
| 57 | * @top_aggr_mask: top aggregation interrupt common mask; | 60 | * @label: attribute label; |
| 58 | * @top_aggr_psu_mask: top aggregation interrupt PSU mask; | 61 | * @label: attribute register offset; |
| 59 | * @psu_reg_offset: offset of PSU interrupt register; | 62 | * @reg: attribute register; |
| 60 | * @psu_mask: PSU interrupt mask; | 63 | * @mask: attribute access mask; |
| 61 | * @psu_count: number of equipped replaceable PSUs; | 64 | * @mode: access mode; |
| 62 | * @psu: pointer to PSU devices data array; | 65 | * @bit: attribute effective bit; |
| 63 | * @top_aggr_pwr_mask: top aggregation interrupt power mask; | 66 | * @np - pointer to node platform associated with attribute; |
| 64 | * @pwr_reg_offset: offset of power interrupt register | 67 | * @hpdev - hotplug device data; |
| 65 | * @pwr_mask: power interrupt mask; | 68 | * @health_cntr: dynamic device health indication counter; |
| 66 | * @pwr_count: number of power sources; | 69 | * @attached: true if device has been attached after good health indication; |
| 67 | * @pwr: pointer to power devices data array; | 70 | */ |
| 68 | * @top_aggr_fan_mask: top aggregation interrupt FAN mask; | 71 | struct mlxreg_core_data { |
| 69 | * @fan_reg_offset: offset of FAN interrupt register; | 72 | char label[MLXREG_CORE_LABEL_MAX_SIZE]; |
| 70 | * @fan_mask: FAN interrupt mask; | 73 | u32 reg; |
| 71 | * @fan_count: number of equipped replaceable FANs; | 74 | u32 mask; |
| 72 | * @fan: pointer to FAN devices data array; | 75 | u32 bit; |
| 76 | umode_t mode; | ||
| 77 | struct device_node *np; | ||
| 78 | struct mlxreg_hotplug_device hpdev; | ||
| 79 | u8 health_cntr; | ||
| 80 | bool attached; | ||
| 81 | }; | ||
| 82 | |||
| 83 | /** | ||
| 84 | * struct mlxreg_core_item - same type components controlled by the driver: | ||
| 85 | * | ||
| 86 | * @data: component data; | ||
| 87 | * @aggr_mask: group aggregation mask; | ||
| 88 | * @reg: group interrupt status register; | ||
| 89 | * @mask: group interrupt mask; | ||
| 90 | * @cache: last status value for elements fro the same group; | ||
| 91 | * @count: number of available elements in the group; | ||
| 92 | * @ind: element's index inside the group; | ||
| 93 | * @inversed: if 0: 0 for signal status is OK, if 1 - 1 is OK; | ||
| 94 | * @health: true if device has health indication, false in other case; | ||
| 95 | */ | ||
| 96 | struct mlxreg_core_item { | ||
| 97 | struct mlxreg_core_data *data; | ||
| 98 | u32 aggr_mask; | ||
| 99 | u32 reg; | ||
| 100 | u32 mask; | ||
| 101 | u32 cache; | ||
| 102 | u8 count; | ||
| 103 | u8 ind; | ||
| 104 | u8 inversed; | ||
| 105 | u8 health; | ||
| 106 | }; | ||
| 107 | |||
| 108 | /** | ||
| 109 | * struct mlxreg_core_platform_data - platform data: | ||
| 110 | * | ||
| 111 | * @led_data: led private data; | ||
| 112 | * @regmap: register map of parent device; | ||
| 113 | * @counter: number of led instances; | ||
| 114 | */ | ||
| 115 | struct mlxreg_core_platform_data { | ||
| 116 | struct mlxreg_core_data *data; | ||
| 117 | void *regmap; | ||
| 118 | int counter; | ||
| 119 | }; | ||
| 120 | |||
| 121 | /** | ||
| 122 | * struct mlxreg_core_hotplug_platform_data - hotplug platform data: | ||
| 73 | * | 123 | * |
| 74 | * Structure represents board platform data, related to system hotplug events, | 124 | * @items: same type components with the hotplug capability; |
| 75 | * like FAN, PSU, power cable insertion and removing. This data provides the | 125 | * @irq: platform interrupt number; |
| 76 | * number of hot-pluggable devices and hardware description for event handling. | 126 | * @regmap: register map of parent device; |
| 127 | * @counter: number of the components with the hotplug capability; | ||
| 128 | * @cell: location of top aggregation interrupt register; | ||
| 129 | * @mask: top aggregation interrupt common mask; | ||
| 130 | * @cell_low: location of low aggregation interrupt register; | ||
| 131 | * @mask_low: low aggregation interrupt common mask; | ||
| 77 | */ | 132 | */ |
| 78 | struct mlxreg_hotplug_platform_data { | 133 | struct mlxreg_core_hotplug_platform_data { |
| 79 | u16 top_aggr_offset; | 134 | struct mlxreg_core_item *items; |
| 80 | u8 top_aggr_mask; | 135 | int irq; |
| 81 | u8 top_aggr_psu_mask; | 136 | void *regmap; |
| 82 | u16 psu_reg_offset; | 137 | int counter; |
| 83 | u8 psu_mask; | 138 | u32 cell; |
| 84 | u8 psu_count; | 139 | u32 mask; |
| 85 | struct mlxreg_hotplug_device *psu; | 140 | u32 cell_low; |
| 86 | u8 top_aggr_pwr_mask; | 141 | u32 mask_low; |
| 87 | u16 pwr_reg_offset; | ||
| 88 | u8 pwr_mask; | ||
| 89 | u8 pwr_count; | ||
| 90 | struct mlxreg_hotplug_device *pwr; | ||
| 91 | u8 top_aggr_fan_mask; | ||
| 92 | u16 fan_reg_offset; | ||
| 93 | u8 fan_mask; | ||
| 94 | u8 fan_count; | ||
| 95 | struct mlxreg_hotplug_device *fan; | ||
| 96 | }; | 142 | }; |
| 97 | 143 | ||
| 98 | #endif /* __LINUX_PLATFORM_DATA_MLXREG_H */ | 144 | #endif /* __LINUX_PLATFORM_DATA_MLXREG_H */ |
