18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Mellanox platform driver 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2016-2018 Mellanox Technologies 68c2ecf20Sopenharmony_ci * Copyright (C) 2016-2018 Vadim Pasternak <vadimp@mellanox.com> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <linux/device.h> 108c2ecf20Sopenharmony_ci#include <linux/dmi.h> 118c2ecf20Sopenharmony_ci#include <linux/i2c.h> 128c2ecf20Sopenharmony_ci#include <linux/i2c-mux.h> 138c2ecf20Sopenharmony_ci#include <linux/io.h> 148c2ecf20Sopenharmony_ci#include <linux/module.h> 158c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 168c2ecf20Sopenharmony_ci#include <linux/platform_data/i2c-mux-reg.h> 178c2ecf20Sopenharmony_ci#include <linux/platform_data/mlxreg.h> 188c2ecf20Sopenharmony_ci#include <linux/regmap.h> 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define MLX_PLAT_DEVICE_NAME "mlxplat" 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* LPC bus IO offsets */ 238c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_I2C_BASE_ADRR 0x2000 248c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_BASE_ADRR 0x2500 258c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_CPLD1_VER_OFFSET 0x00 268c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_CPLD2_VER_OFFSET 0x01 278c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_CPLD3_VER_OFFSET 0x02 288c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_CPLD4_VER_OFFSET 0x03 298c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_CPLD1_PN_OFFSET 0x04 308c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_CPLD2_PN_OFFSET 0x06 318c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_CPLD3_PN_OFFSET 0x08 328c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_CPLD4_PN_OFFSET 0x0a 338c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET 0x1d 348c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_RST_CAUSE1_OFFSET 0x1e 358c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_RST_CAUSE2_OFFSET 0x1f 368c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_LED1_OFFSET 0x20 378c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_LED2_OFFSET 0x21 388c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_LED3_OFFSET 0x22 398c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_LED4_OFFSET 0x23 408c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_LED5_OFFSET 0x24 418c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_FAN_DIRECTION 0x2a 428c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_GP0_RO_OFFSET 0x2b 438c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_GP0_OFFSET 0x2e 448c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_GP1_OFFSET 0x30 458c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_WP1_OFFSET 0x31 468c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_GP2_OFFSET 0x32 478c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_WP2_OFFSET 0x33 488c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET 0x37 498c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET 0x3a 508c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_AGGR_MASK_OFFSET 0x3b 518c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET 0x40 528c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_AGGRLO_MASK_OFFSET 0x41 538c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_AGGRCO_OFFSET 0x42 548c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_AGGRCO_MASK_OFFSET 0x43 558c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_AGGRCX_OFFSET 0x44 568c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_AGGRCX_MASK_OFFSET 0x45 578c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET 0x50 588c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_ASIC_EVENT_OFFSET 0x51 598c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_ASIC_MASK_OFFSET 0x52 608c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_PSU_OFFSET 0x58 618c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_PSU_EVENT_OFFSET 0x59 628c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_PSU_MASK_OFFSET 0x5a 638c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_PWR_OFFSET 0x64 648c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_PWR_EVENT_OFFSET 0x65 658c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_PWR_MASK_OFFSET 0x66 668c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_FAN_OFFSET 0x88 678c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_FAN_EVENT_OFFSET 0x89 688c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_FAN_MASK_OFFSET 0x8a 698c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_WD_CLEAR_OFFSET 0xc7 708c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_WD_CLEAR_WP_OFFSET 0xc8 718c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_WD1_TMR_OFFSET 0xc9 728c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_WD1_ACT_OFFSET 0xcb 738c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_WD2_TMR_OFFSET 0xcd 748c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_WD2_TLEFT_OFFSET 0xce 758c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_WD2_ACT_OFFSET 0xcf 768c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET 0xd1 778c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET 0xd2 788c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET 0xd3 798c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_CPLD1_MVER_OFFSET 0xde 808c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_CPLD2_MVER_OFFSET 0xdf 818c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_CPLD3_MVER_OFFSET 0xe0 828c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_CPLD4_MVER_OFFSET 0xe1 838c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_UFM_VERSION_OFFSET 0xe2 848c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_PWM1_OFFSET 0xe3 858c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_TACHO1_OFFSET 0xe4 868c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_TACHO2_OFFSET 0xe5 878c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_TACHO3_OFFSET 0xe6 888c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_TACHO4_OFFSET 0xe7 898c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_TACHO5_OFFSET 0xe8 908c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_TACHO6_OFFSET 0xe9 918c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_TACHO7_OFFSET 0xeb 928c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_TACHO8_OFFSET 0xec 938c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_TACHO9_OFFSET 0xed 948c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_TACHO10_OFFSET 0xee 958c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_TACHO11_OFFSET 0xef 968c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_TACHO12_OFFSET 0xf0 978c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_FAN_CAP1_OFFSET 0xf5 988c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_FAN_CAP2_OFFSET 0xf6 998c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET 0xf7 1008c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_TACHO_SPEED_OFFSET 0xf8 1018c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET 0xf9 1028c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_CONFIG1_OFFSET 0xfb 1038c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG_CONFIG2_OFFSET 0xfc 1048c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_IO_RANGE 0x100 1058c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_I2C_CH1_OFF 0xdb 1068c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_I2C_CH2_OFF 0xda 1078c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_I2C_CH3_OFF 0xdc 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_PIO_OFFSET 0x10000UL 1108c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG1 ((MLXPLAT_CPLD_LPC_REG_BASE_ADRR + \ 1118c2ecf20Sopenharmony_ci MLXPLAT_CPLD_LPC_I2C_CH1_OFF) | \ 1128c2ecf20Sopenharmony_ci MLXPLAT_CPLD_LPC_PIO_OFFSET) 1138c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG2 ((MLXPLAT_CPLD_LPC_REG_BASE_ADRR + \ 1148c2ecf20Sopenharmony_ci MLXPLAT_CPLD_LPC_I2C_CH2_OFF) | \ 1158c2ecf20Sopenharmony_ci MLXPLAT_CPLD_LPC_PIO_OFFSET) 1168c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_REG3 ((MLXPLAT_CPLD_LPC_REG_BASE_ADRR + \ 1178c2ecf20Sopenharmony_ci MLXPLAT_CPLD_LPC_I2C_CH3_OFF) | \ 1188c2ecf20Sopenharmony_ci MLXPLAT_CPLD_LPC_PIO_OFFSET) 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci/* Masks for aggregation, psu, pwr and fan event in CPLD related registers. */ 1218c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_AGGR_ASIC_MASK_DEF 0x04 1228c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_AGGR_PSU_MASK_DEF 0x08 1238c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_AGGR_PWR_MASK_DEF 0x08 1248c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_AGGR_FAN_MASK_DEF 0x40 1258c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_AGGR_MASK_DEF (MLXPLAT_CPLD_AGGR_ASIC_MASK_DEF | \ 1268c2ecf20Sopenharmony_ci MLXPLAT_CPLD_AGGR_PSU_MASK_DEF | \ 1278c2ecf20Sopenharmony_ci MLXPLAT_CPLD_AGGR_FAN_MASK_DEF) 1288c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_AGGR_ASIC_MASK_NG 0x01 1298c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_AGGR_MASK_NG_DEF 0x04 1308c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_AGGR_MASK_COMEX BIT(0) 1318c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LOW_AGGR_MASK_LOW 0xc1 1328c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LOW_AGGR_MASK_I2C BIT(6) 1338c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_PSU_MASK GENMASK(1, 0) 1348c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_PWR_MASK GENMASK(1, 0) 1358c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_PSU_EXT_MASK GENMASK(3, 0) 1368c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_PWR_EXT_MASK GENMASK(3, 0) 1378c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_FAN_MASK GENMASK(3, 0) 1388c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_ASIC_MASK GENMASK(1, 0) 1398c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_FAN_NG_MASK GENMASK(5, 0) 1408c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LED_LO_NIBBLE_MASK GENMASK(7, 4) 1418c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LED_HI_NIBBLE_MASK GENMASK(3, 0) 1428c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_VOLTREG_UPD_MASK GENMASK(5, 4) 1438c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_I2C_CAP_BIT 0x04 1448c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_I2C_CAP_MASK GENMASK(5, MLXPLAT_CPLD_I2C_CAP_BIT) 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci/* Masks for aggregation for comex carriers */ 1478c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_AGGR_MASK_CARRIER BIT(1) 1488c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_AGGR_MASK_CARR_DEF (MLXPLAT_CPLD_AGGR_ASIC_MASK_DEF | \ 1498c2ecf20Sopenharmony_ci MLXPLAT_CPLD_AGGR_MASK_CARRIER) 1508c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LOW_AGGRCX_MASK 0xc1 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci/* Default I2C parent bus number */ 1538c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR 1 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci/* Maximum number of possible physical buses equipped on system */ 1568c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM 16 1578c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_MAX_PHYS_EXT_ADAPTER_NUM 24 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci/* Number of channels in group */ 1608c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_GRP_CHNL_NUM 8 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci/* Start channel numbers */ 1638c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_CH1 2 1648c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_CH2 10 1658c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_CH3 18 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci/* Number of LPC attached MUX platform devices */ 1688c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_LPC_MUX_DEVS 3 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci/* Hotplug devices adapter numbers */ 1718c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_NR_NONE -1 1728c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_PSU_DEFAULT_NR 10 1738c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_PSU_MSNXXXX_NR 4 1748c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_FAN1_DEFAULT_NR 11 1758c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_FAN2_DEFAULT_NR 12 1768c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_FAN3_DEFAULT_NR 13 1778c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_FAN4_DEFAULT_NR 14 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci/* Masks and default values for watchdogs */ 1808c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_WD1_CLEAR_MASK GENMASK(7, 1) 1818c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_WD2_CLEAR_MASK (GENMASK(7, 0) & ~BIT(1)) 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_WD_TYPE1_TO_MASK GENMASK(7, 4) 1848c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_WD_TYPE2_TO_MASK 0 1858c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_WD_RESET_ACT_MASK GENMASK(7, 1) 1868c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_WD_FAN_ACT_MASK (GENMASK(7, 0) & ~BIT(4)) 1878c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_WD_COUNT_ACT_MASK (GENMASK(7, 0) & ~BIT(7)) 1888c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_WD_CPBLTY_MASK (GENMASK(7, 0) & ~BIT(6)) 1898c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_WD_DFLT_TIMEOUT 30 1908c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_WD3_DFLT_TIMEOUT 600 1918c2ecf20Sopenharmony_ci#define MLXPLAT_CPLD_WD_MAX_DEVS 2 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci/* mlxplat_priv - platform private data 1948c2ecf20Sopenharmony_ci * @pdev_i2c - i2c controller platform device 1958c2ecf20Sopenharmony_ci * @pdev_mux - array of mux platform devices 1968c2ecf20Sopenharmony_ci * @pdev_hotplug - hotplug platform devices 1978c2ecf20Sopenharmony_ci * @pdev_led - led platform devices 1988c2ecf20Sopenharmony_ci * @pdev_io_regs - register access platform devices 1998c2ecf20Sopenharmony_ci * @pdev_fan - FAN platform devices 2008c2ecf20Sopenharmony_ci * @pdev_wd - array of watchdog platform devices 2018c2ecf20Sopenharmony_ci * @regmap: device register map 2028c2ecf20Sopenharmony_ci */ 2038c2ecf20Sopenharmony_cistruct mlxplat_priv { 2048c2ecf20Sopenharmony_ci struct platform_device *pdev_i2c; 2058c2ecf20Sopenharmony_ci struct platform_device *pdev_mux[MLXPLAT_CPLD_LPC_MUX_DEVS]; 2068c2ecf20Sopenharmony_ci struct platform_device *pdev_hotplug; 2078c2ecf20Sopenharmony_ci struct platform_device *pdev_led; 2088c2ecf20Sopenharmony_ci struct platform_device *pdev_io_regs; 2098c2ecf20Sopenharmony_ci struct platform_device *pdev_fan; 2108c2ecf20Sopenharmony_ci struct platform_device *pdev_wd[MLXPLAT_CPLD_WD_MAX_DEVS]; 2118c2ecf20Sopenharmony_ci void *regmap; 2128c2ecf20Sopenharmony_ci}; 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci/* Regions for LPC I2C controller and LPC base register space */ 2158c2ecf20Sopenharmony_cistatic const struct resource mlxplat_lpc_resources[] = { 2168c2ecf20Sopenharmony_ci [0] = DEFINE_RES_NAMED(MLXPLAT_CPLD_LPC_I2C_BASE_ADRR, 2178c2ecf20Sopenharmony_ci MLXPLAT_CPLD_LPC_IO_RANGE, 2188c2ecf20Sopenharmony_ci "mlxplat_cpld_lpc_i2c_ctrl", IORESOURCE_IO), 2198c2ecf20Sopenharmony_ci [1] = DEFINE_RES_NAMED(MLXPLAT_CPLD_LPC_REG_BASE_ADRR, 2208c2ecf20Sopenharmony_ci MLXPLAT_CPLD_LPC_IO_RANGE, 2218c2ecf20Sopenharmony_ci "mlxplat_cpld_lpc_regs", 2228c2ecf20Sopenharmony_ci IORESOURCE_IO), 2238c2ecf20Sopenharmony_ci}; 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_ci/* Platform i2c next generation systems data */ 2268c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_i2c_ng_items_data[] = { 2278c2ecf20Sopenharmony_ci { 2288c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET, 2298c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_I2C_CAP_MASK, 2308c2ecf20Sopenharmony_ci .bit = MLXPLAT_CPLD_I2C_CAP_BIT, 2318c2ecf20Sopenharmony_ci }, 2328c2ecf20Sopenharmony_ci}; 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_cistatic struct mlxreg_core_item mlxplat_mlxcpld_i2c_ng_items[] = { 2358c2ecf20Sopenharmony_ci { 2368c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_i2c_ng_items_data, 2378c2ecf20Sopenharmony_ci }, 2388c2ecf20Sopenharmony_ci}; 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci/* Platform next generation systems i2c data */ 2418c2ecf20Sopenharmony_cistatic struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_i2c_ng_data = { 2428c2ecf20Sopenharmony_ci .items = mlxplat_mlxcpld_i2c_ng_items, 2438c2ecf20Sopenharmony_ci .cell = MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET, 2448c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_AGGR_MASK_COMEX, 2458c2ecf20Sopenharmony_ci .cell_low = MLXPLAT_CPLD_LPC_REG_AGGRCO_OFFSET, 2468c2ecf20Sopenharmony_ci .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_I2C, 2478c2ecf20Sopenharmony_ci}; 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci/* Platform default channels */ 2508c2ecf20Sopenharmony_cistatic const int mlxplat_default_channels[][MLXPLAT_CPLD_GRP_CHNL_NUM] = { 2518c2ecf20Sopenharmony_ci { 2528c2ecf20Sopenharmony_ci MLXPLAT_CPLD_CH1, MLXPLAT_CPLD_CH1 + 1, MLXPLAT_CPLD_CH1 + 2, 2538c2ecf20Sopenharmony_ci MLXPLAT_CPLD_CH1 + 3, MLXPLAT_CPLD_CH1 + 4, MLXPLAT_CPLD_CH1 + 2548c2ecf20Sopenharmony_ci 5, MLXPLAT_CPLD_CH1 + 6, MLXPLAT_CPLD_CH1 + 7 2558c2ecf20Sopenharmony_ci }, 2568c2ecf20Sopenharmony_ci { 2578c2ecf20Sopenharmony_ci MLXPLAT_CPLD_CH2, MLXPLAT_CPLD_CH2 + 1, MLXPLAT_CPLD_CH2 + 2, 2588c2ecf20Sopenharmony_ci MLXPLAT_CPLD_CH2 + 3, MLXPLAT_CPLD_CH2 + 4, MLXPLAT_CPLD_CH2 + 2598c2ecf20Sopenharmony_ci 5, MLXPLAT_CPLD_CH2 + 6, MLXPLAT_CPLD_CH2 + 7 2608c2ecf20Sopenharmony_ci }, 2618c2ecf20Sopenharmony_ci}; 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ci/* Platform channels for MSN21xx system family */ 2648c2ecf20Sopenharmony_cistatic const int mlxplat_msn21xx_channels[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci/* Platform mux data */ 2678c2ecf20Sopenharmony_cistatic struct i2c_mux_reg_platform_data mlxplat_default_mux_data[] = { 2688c2ecf20Sopenharmony_ci { 2698c2ecf20Sopenharmony_ci .parent = 1, 2708c2ecf20Sopenharmony_ci .base_nr = MLXPLAT_CPLD_CH1, 2718c2ecf20Sopenharmony_ci .write_only = 1, 2728c2ecf20Sopenharmony_ci .reg = (void __iomem *)MLXPLAT_CPLD_LPC_REG1, 2738c2ecf20Sopenharmony_ci .reg_size = 1, 2748c2ecf20Sopenharmony_ci .idle_in_use = 1, 2758c2ecf20Sopenharmony_ci }, 2768c2ecf20Sopenharmony_ci { 2778c2ecf20Sopenharmony_ci .parent = 1, 2788c2ecf20Sopenharmony_ci .base_nr = MLXPLAT_CPLD_CH2, 2798c2ecf20Sopenharmony_ci .write_only = 1, 2808c2ecf20Sopenharmony_ci .reg = (void __iomem *)MLXPLAT_CPLD_LPC_REG2, 2818c2ecf20Sopenharmony_ci .reg_size = 1, 2828c2ecf20Sopenharmony_ci .idle_in_use = 1, 2838c2ecf20Sopenharmony_ci }, 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci}; 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_ci/* Platform mux configuration variables */ 2888c2ecf20Sopenharmony_cistatic int mlxplat_max_adap_num; 2898c2ecf20Sopenharmony_cistatic int mlxplat_mux_num; 2908c2ecf20Sopenharmony_cistatic struct i2c_mux_reg_platform_data *mlxplat_mux_data; 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_ci/* Platform extended mux data */ 2938c2ecf20Sopenharmony_cistatic struct i2c_mux_reg_platform_data mlxplat_extended_mux_data[] = { 2948c2ecf20Sopenharmony_ci { 2958c2ecf20Sopenharmony_ci .parent = 1, 2968c2ecf20Sopenharmony_ci .base_nr = MLXPLAT_CPLD_CH1, 2978c2ecf20Sopenharmony_ci .write_only = 1, 2988c2ecf20Sopenharmony_ci .reg = (void __iomem *)MLXPLAT_CPLD_LPC_REG1, 2998c2ecf20Sopenharmony_ci .reg_size = 1, 3008c2ecf20Sopenharmony_ci .idle_in_use = 1, 3018c2ecf20Sopenharmony_ci }, 3028c2ecf20Sopenharmony_ci { 3038c2ecf20Sopenharmony_ci .parent = 1, 3048c2ecf20Sopenharmony_ci .base_nr = MLXPLAT_CPLD_CH2, 3058c2ecf20Sopenharmony_ci .write_only = 1, 3068c2ecf20Sopenharmony_ci .reg = (void __iomem *)MLXPLAT_CPLD_LPC_REG3, 3078c2ecf20Sopenharmony_ci .reg_size = 1, 3088c2ecf20Sopenharmony_ci .idle_in_use = 1, 3098c2ecf20Sopenharmony_ci }, 3108c2ecf20Sopenharmony_ci { 3118c2ecf20Sopenharmony_ci .parent = 1, 3128c2ecf20Sopenharmony_ci .base_nr = MLXPLAT_CPLD_CH3, 3138c2ecf20Sopenharmony_ci .write_only = 1, 3148c2ecf20Sopenharmony_ci .reg = (void __iomem *)MLXPLAT_CPLD_LPC_REG2, 3158c2ecf20Sopenharmony_ci .reg_size = 1, 3168c2ecf20Sopenharmony_ci .idle_in_use = 1, 3178c2ecf20Sopenharmony_ci }, 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_ci}; 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ci/* Platform hotplug devices */ 3228c2ecf20Sopenharmony_cistatic struct i2c_board_info mlxplat_mlxcpld_pwr[] = { 3238c2ecf20Sopenharmony_ci { 3248c2ecf20Sopenharmony_ci I2C_BOARD_INFO("dps460", 0x59), 3258c2ecf20Sopenharmony_ci }, 3268c2ecf20Sopenharmony_ci { 3278c2ecf20Sopenharmony_ci I2C_BOARD_INFO("dps460", 0x58), 3288c2ecf20Sopenharmony_ci }, 3298c2ecf20Sopenharmony_ci}; 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_cistatic struct i2c_board_info mlxplat_mlxcpld_ext_pwr[] = { 3328c2ecf20Sopenharmony_ci { 3338c2ecf20Sopenharmony_ci I2C_BOARD_INFO("dps460", 0x5b), 3348c2ecf20Sopenharmony_ci }, 3358c2ecf20Sopenharmony_ci { 3368c2ecf20Sopenharmony_ci I2C_BOARD_INFO("dps460", 0x5a), 3378c2ecf20Sopenharmony_ci }, 3388c2ecf20Sopenharmony_ci}; 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_cistatic struct i2c_board_info mlxplat_mlxcpld_fan[] = { 3418c2ecf20Sopenharmony_ci { 3428c2ecf20Sopenharmony_ci I2C_BOARD_INFO("24c32", 0x50), 3438c2ecf20Sopenharmony_ci }, 3448c2ecf20Sopenharmony_ci { 3458c2ecf20Sopenharmony_ci I2C_BOARD_INFO("24c32", 0x50), 3468c2ecf20Sopenharmony_ci }, 3478c2ecf20Sopenharmony_ci { 3488c2ecf20Sopenharmony_ci I2C_BOARD_INFO("24c32", 0x50), 3498c2ecf20Sopenharmony_ci }, 3508c2ecf20Sopenharmony_ci { 3518c2ecf20Sopenharmony_ci I2C_BOARD_INFO("24c32", 0x50), 3528c2ecf20Sopenharmony_ci }, 3538c2ecf20Sopenharmony_ci}; 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ci/* Platform hotplug comex carrier system family data */ 3568c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_comex_psu_items_data[] = { 3578c2ecf20Sopenharmony_ci { 3588c2ecf20Sopenharmony_ci .label = "psu1", 3598c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 3608c2ecf20Sopenharmony_ci .mask = BIT(0), 3618c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 3628c2ecf20Sopenharmony_ci }, 3638c2ecf20Sopenharmony_ci { 3648c2ecf20Sopenharmony_ci .label = "psu2", 3658c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 3668c2ecf20Sopenharmony_ci .mask = BIT(1), 3678c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 3688c2ecf20Sopenharmony_ci }, 3698c2ecf20Sopenharmony_ci}; 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_ci/* Platform hotplug default data */ 3728c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_default_psu_items_data[] = { 3738c2ecf20Sopenharmony_ci { 3748c2ecf20Sopenharmony_ci .label = "psu1", 3758c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 3768c2ecf20Sopenharmony_ci .mask = BIT(0), 3778c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 3788c2ecf20Sopenharmony_ci }, 3798c2ecf20Sopenharmony_ci { 3808c2ecf20Sopenharmony_ci .label = "psu2", 3818c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 3828c2ecf20Sopenharmony_ci .mask = BIT(1), 3838c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 3848c2ecf20Sopenharmony_ci }, 3858c2ecf20Sopenharmony_ci}; 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_default_pwr_items_data[] = { 3888c2ecf20Sopenharmony_ci { 3898c2ecf20Sopenharmony_ci .label = "pwr1", 3908c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 3918c2ecf20Sopenharmony_ci .mask = BIT(0), 3928c2ecf20Sopenharmony_ci .hpdev.brdinfo = &mlxplat_mlxcpld_pwr[0], 3938c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_PSU_DEFAULT_NR, 3948c2ecf20Sopenharmony_ci }, 3958c2ecf20Sopenharmony_ci { 3968c2ecf20Sopenharmony_ci .label = "pwr2", 3978c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 3988c2ecf20Sopenharmony_ci .mask = BIT(1), 3998c2ecf20Sopenharmony_ci .hpdev.brdinfo = &mlxplat_mlxcpld_pwr[1], 4008c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_PSU_DEFAULT_NR, 4018c2ecf20Sopenharmony_ci }, 4028c2ecf20Sopenharmony_ci}; 4038c2ecf20Sopenharmony_ci 4048c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_default_fan_items_data[] = { 4058c2ecf20Sopenharmony_ci { 4068c2ecf20Sopenharmony_ci .label = "fan1", 4078c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 4088c2ecf20Sopenharmony_ci .mask = BIT(0), 4098c2ecf20Sopenharmony_ci .hpdev.brdinfo = &mlxplat_mlxcpld_fan[0], 4108c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_FAN1_DEFAULT_NR, 4118c2ecf20Sopenharmony_ci }, 4128c2ecf20Sopenharmony_ci { 4138c2ecf20Sopenharmony_ci .label = "fan2", 4148c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 4158c2ecf20Sopenharmony_ci .mask = BIT(1), 4168c2ecf20Sopenharmony_ci .hpdev.brdinfo = &mlxplat_mlxcpld_fan[1], 4178c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_FAN2_DEFAULT_NR, 4188c2ecf20Sopenharmony_ci }, 4198c2ecf20Sopenharmony_ci { 4208c2ecf20Sopenharmony_ci .label = "fan3", 4218c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 4228c2ecf20Sopenharmony_ci .mask = BIT(2), 4238c2ecf20Sopenharmony_ci .hpdev.brdinfo = &mlxplat_mlxcpld_fan[2], 4248c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_FAN3_DEFAULT_NR, 4258c2ecf20Sopenharmony_ci }, 4268c2ecf20Sopenharmony_ci { 4278c2ecf20Sopenharmony_ci .label = "fan4", 4288c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 4298c2ecf20Sopenharmony_ci .mask = BIT(3), 4308c2ecf20Sopenharmony_ci .hpdev.brdinfo = &mlxplat_mlxcpld_fan[3], 4318c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_FAN4_DEFAULT_NR, 4328c2ecf20Sopenharmony_ci }, 4338c2ecf20Sopenharmony_ci}; 4348c2ecf20Sopenharmony_ci 4358c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_default_asic_items_data[] = { 4368c2ecf20Sopenharmony_ci { 4378c2ecf20Sopenharmony_ci .label = "asic1", 4388c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET, 4398c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_ASIC_MASK, 4408c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 4418c2ecf20Sopenharmony_ci }, 4428c2ecf20Sopenharmony_ci}; 4438c2ecf20Sopenharmony_ci 4448c2ecf20Sopenharmony_cistatic struct mlxreg_core_item mlxplat_mlxcpld_default_items[] = { 4458c2ecf20Sopenharmony_ci { 4468c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_psu_items_data, 4478c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_PSU_MASK_DEF, 4488c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 4498c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_PSU_MASK, 4508c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_psu_items_data), 4518c2ecf20Sopenharmony_ci .inversed = 1, 4528c2ecf20Sopenharmony_ci .health = false, 4538c2ecf20Sopenharmony_ci }, 4548c2ecf20Sopenharmony_ci { 4558c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_pwr_items_data, 4568c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_PWR_MASK_DEF, 4578c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 4588c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_PWR_MASK, 4598c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_pwr_items_data), 4608c2ecf20Sopenharmony_ci .inversed = 0, 4618c2ecf20Sopenharmony_ci .health = false, 4628c2ecf20Sopenharmony_ci }, 4638c2ecf20Sopenharmony_ci { 4648c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_fan_items_data, 4658c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_FAN_MASK_DEF, 4668c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 4678c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_FAN_MASK, 4688c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_fan_items_data), 4698c2ecf20Sopenharmony_ci .inversed = 1, 4708c2ecf20Sopenharmony_ci .health = false, 4718c2ecf20Sopenharmony_ci }, 4728c2ecf20Sopenharmony_ci { 4738c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_asic_items_data, 4748c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_ASIC_MASK_DEF, 4758c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET, 4768c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_ASIC_MASK, 4778c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_asic_items_data), 4788c2ecf20Sopenharmony_ci .inversed = 0, 4798c2ecf20Sopenharmony_ci .health = true, 4808c2ecf20Sopenharmony_ci }, 4818c2ecf20Sopenharmony_ci}; 4828c2ecf20Sopenharmony_ci 4838c2ecf20Sopenharmony_cistatic struct mlxreg_core_item mlxplat_mlxcpld_comex_items[] = { 4848c2ecf20Sopenharmony_ci { 4858c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_comex_psu_items_data, 4868c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_CARRIER, 4878c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 4888c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_PSU_MASK, 4898c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_psu_items_data), 4908c2ecf20Sopenharmony_ci .inversed = 1, 4918c2ecf20Sopenharmony_ci .health = false, 4928c2ecf20Sopenharmony_ci }, 4938c2ecf20Sopenharmony_ci { 4948c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_pwr_items_data, 4958c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_CARRIER, 4968c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 4978c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_PWR_MASK, 4988c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_pwr_items_data), 4998c2ecf20Sopenharmony_ci .inversed = 0, 5008c2ecf20Sopenharmony_ci .health = false, 5018c2ecf20Sopenharmony_ci }, 5028c2ecf20Sopenharmony_ci { 5038c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_fan_items_data, 5048c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_CARRIER, 5058c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 5068c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_FAN_MASK, 5078c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_fan_items_data), 5088c2ecf20Sopenharmony_ci .inversed = 1, 5098c2ecf20Sopenharmony_ci .health = false, 5108c2ecf20Sopenharmony_ci }, 5118c2ecf20Sopenharmony_ci { 5128c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_asic_items_data, 5138c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_ASIC_MASK_DEF, 5148c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET, 5158c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_ASIC_MASK, 5168c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_asic_items_data), 5178c2ecf20Sopenharmony_ci .inversed = 0, 5188c2ecf20Sopenharmony_ci .health = true, 5198c2ecf20Sopenharmony_ci }, 5208c2ecf20Sopenharmony_ci}; 5218c2ecf20Sopenharmony_ci 5228c2ecf20Sopenharmony_cistatic 5238c2ecf20Sopenharmony_cistruct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_default_data = { 5248c2ecf20Sopenharmony_ci .items = mlxplat_mlxcpld_default_items, 5258c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_default_items), 5268c2ecf20Sopenharmony_ci .cell = MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET, 5278c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_AGGR_MASK_DEF, 5288c2ecf20Sopenharmony_ci .cell_low = MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET, 5298c2ecf20Sopenharmony_ci .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_LOW, 5308c2ecf20Sopenharmony_ci}; 5318c2ecf20Sopenharmony_ci 5328c2ecf20Sopenharmony_cistatic 5338c2ecf20Sopenharmony_cistruct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_comex_data = { 5348c2ecf20Sopenharmony_ci .items = mlxplat_mlxcpld_comex_items, 5358c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_comex_items), 5368c2ecf20Sopenharmony_ci .cell = MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET, 5378c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_AGGR_MASK_CARR_DEF, 5388c2ecf20Sopenharmony_ci .cell_low = MLXPLAT_CPLD_LPC_REG_AGGRCX_OFFSET, 5398c2ecf20Sopenharmony_ci .mask_low = MLXPLAT_CPLD_LOW_AGGRCX_MASK, 5408c2ecf20Sopenharmony_ci}; 5418c2ecf20Sopenharmony_ci 5428c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_msn21xx_pwr_items_data[] = { 5438c2ecf20Sopenharmony_ci { 5448c2ecf20Sopenharmony_ci .label = "pwr1", 5458c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 5468c2ecf20Sopenharmony_ci .mask = BIT(0), 5478c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 5488c2ecf20Sopenharmony_ci }, 5498c2ecf20Sopenharmony_ci { 5508c2ecf20Sopenharmony_ci .label = "pwr2", 5518c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 5528c2ecf20Sopenharmony_ci .mask = BIT(1), 5538c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 5548c2ecf20Sopenharmony_ci }, 5558c2ecf20Sopenharmony_ci}; 5568c2ecf20Sopenharmony_ci 5578c2ecf20Sopenharmony_ci/* Platform hotplug MSN21xx system family data */ 5588c2ecf20Sopenharmony_cistatic struct mlxreg_core_item mlxplat_mlxcpld_msn21xx_items[] = { 5598c2ecf20Sopenharmony_ci { 5608c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_msn21xx_pwr_items_data, 5618c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_PWR_MASK_DEF, 5628c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 5638c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_PWR_MASK, 5648c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_msn21xx_pwr_items_data), 5658c2ecf20Sopenharmony_ci .inversed = 0, 5668c2ecf20Sopenharmony_ci .health = false, 5678c2ecf20Sopenharmony_ci }, 5688c2ecf20Sopenharmony_ci { 5698c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_asic_items_data, 5708c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_ASIC_MASK_DEF, 5718c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET, 5728c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_ASIC_MASK, 5738c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_asic_items_data), 5748c2ecf20Sopenharmony_ci .inversed = 0, 5758c2ecf20Sopenharmony_ci .health = true, 5768c2ecf20Sopenharmony_ci }, 5778c2ecf20Sopenharmony_ci}; 5788c2ecf20Sopenharmony_ci 5798c2ecf20Sopenharmony_cistatic 5808c2ecf20Sopenharmony_cistruct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_msn21xx_data = { 5818c2ecf20Sopenharmony_ci .items = mlxplat_mlxcpld_msn21xx_items, 5828c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_msn21xx_items), 5838c2ecf20Sopenharmony_ci .cell = MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET, 5848c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_AGGR_MASK_DEF, 5858c2ecf20Sopenharmony_ci .cell_low = MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET, 5868c2ecf20Sopenharmony_ci .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_LOW, 5878c2ecf20Sopenharmony_ci}; 5888c2ecf20Sopenharmony_ci 5898c2ecf20Sopenharmony_ci/* Platform hotplug msn274x system family data */ 5908c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_msn274x_psu_items_data[] = { 5918c2ecf20Sopenharmony_ci { 5928c2ecf20Sopenharmony_ci .label = "psu1", 5938c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 5948c2ecf20Sopenharmony_ci .mask = BIT(0), 5958c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 5968c2ecf20Sopenharmony_ci }, 5978c2ecf20Sopenharmony_ci { 5988c2ecf20Sopenharmony_ci .label = "psu2", 5998c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 6008c2ecf20Sopenharmony_ci .mask = BIT(1), 6018c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 6028c2ecf20Sopenharmony_ci }, 6038c2ecf20Sopenharmony_ci}; 6048c2ecf20Sopenharmony_ci 6058c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_default_ng_pwr_items_data[] = { 6068c2ecf20Sopenharmony_ci { 6078c2ecf20Sopenharmony_ci .label = "pwr1", 6088c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 6098c2ecf20Sopenharmony_ci .mask = BIT(0), 6108c2ecf20Sopenharmony_ci .hpdev.brdinfo = &mlxplat_mlxcpld_pwr[0], 6118c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, 6128c2ecf20Sopenharmony_ci }, 6138c2ecf20Sopenharmony_ci { 6148c2ecf20Sopenharmony_ci .label = "pwr2", 6158c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 6168c2ecf20Sopenharmony_ci .mask = BIT(1), 6178c2ecf20Sopenharmony_ci .hpdev.brdinfo = &mlxplat_mlxcpld_pwr[1], 6188c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, 6198c2ecf20Sopenharmony_ci }, 6208c2ecf20Sopenharmony_ci}; 6218c2ecf20Sopenharmony_ci 6228c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_msn274x_fan_items_data[] = { 6238c2ecf20Sopenharmony_ci { 6248c2ecf20Sopenharmony_ci .label = "fan1", 6258c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 6268c2ecf20Sopenharmony_ci .mask = BIT(0), 6278c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 6288c2ecf20Sopenharmony_ci }, 6298c2ecf20Sopenharmony_ci { 6308c2ecf20Sopenharmony_ci .label = "fan2", 6318c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 6328c2ecf20Sopenharmony_ci .mask = BIT(1), 6338c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 6348c2ecf20Sopenharmony_ci }, 6358c2ecf20Sopenharmony_ci { 6368c2ecf20Sopenharmony_ci .label = "fan3", 6378c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 6388c2ecf20Sopenharmony_ci .mask = BIT(2), 6398c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 6408c2ecf20Sopenharmony_ci }, 6418c2ecf20Sopenharmony_ci { 6428c2ecf20Sopenharmony_ci .label = "fan4", 6438c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 6448c2ecf20Sopenharmony_ci .mask = BIT(3), 6458c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 6468c2ecf20Sopenharmony_ci }, 6478c2ecf20Sopenharmony_ci}; 6488c2ecf20Sopenharmony_ci 6498c2ecf20Sopenharmony_cistatic struct mlxreg_core_item mlxplat_mlxcpld_msn274x_items[] = { 6508c2ecf20Sopenharmony_ci { 6518c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_msn274x_psu_items_data, 6528c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, 6538c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 6548c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_PSU_MASK, 6558c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_msn274x_psu_items_data), 6568c2ecf20Sopenharmony_ci .inversed = 1, 6578c2ecf20Sopenharmony_ci .health = false, 6588c2ecf20Sopenharmony_ci }, 6598c2ecf20Sopenharmony_ci { 6608c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_ng_pwr_items_data, 6618c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, 6628c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 6638c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_PWR_MASK, 6648c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_ng_pwr_items_data), 6658c2ecf20Sopenharmony_ci .inversed = 0, 6668c2ecf20Sopenharmony_ci .health = false, 6678c2ecf20Sopenharmony_ci }, 6688c2ecf20Sopenharmony_ci { 6698c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_msn274x_fan_items_data, 6708c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, 6718c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 6728c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_FAN_MASK, 6738c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_msn274x_fan_items_data), 6748c2ecf20Sopenharmony_ci .inversed = 1, 6758c2ecf20Sopenharmony_ci .health = false, 6768c2ecf20Sopenharmony_ci }, 6778c2ecf20Sopenharmony_ci { 6788c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_asic_items_data, 6798c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, 6808c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET, 6818c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_ASIC_MASK, 6828c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_asic_items_data), 6838c2ecf20Sopenharmony_ci .inversed = 0, 6848c2ecf20Sopenharmony_ci .health = true, 6858c2ecf20Sopenharmony_ci }, 6868c2ecf20Sopenharmony_ci}; 6878c2ecf20Sopenharmony_ci 6888c2ecf20Sopenharmony_cistatic 6898c2ecf20Sopenharmony_cistruct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_msn274x_data = { 6908c2ecf20Sopenharmony_ci .items = mlxplat_mlxcpld_msn274x_items, 6918c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_msn274x_items), 6928c2ecf20Sopenharmony_ci .cell = MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET, 6938c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, 6948c2ecf20Sopenharmony_ci .cell_low = MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET, 6958c2ecf20Sopenharmony_ci .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_LOW, 6968c2ecf20Sopenharmony_ci}; 6978c2ecf20Sopenharmony_ci 6988c2ecf20Sopenharmony_ci/* Platform hotplug MSN201x system family data */ 6998c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_msn201x_pwr_items_data[] = { 7008c2ecf20Sopenharmony_ci { 7018c2ecf20Sopenharmony_ci .label = "pwr1", 7028c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 7038c2ecf20Sopenharmony_ci .mask = BIT(0), 7048c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 7058c2ecf20Sopenharmony_ci }, 7068c2ecf20Sopenharmony_ci { 7078c2ecf20Sopenharmony_ci .label = "pwr2", 7088c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 7098c2ecf20Sopenharmony_ci .mask = BIT(1), 7108c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 7118c2ecf20Sopenharmony_ci }, 7128c2ecf20Sopenharmony_ci}; 7138c2ecf20Sopenharmony_ci 7148c2ecf20Sopenharmony_cistatic struct mlxreg_core_item mlxplat_mlxcpld_msn201x_items[] = { 7158c2ecf20Sopenharmony_ci { 7168c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_msn201x_pwr_items_data, 7178c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_PWR_MASK_DEF, 7188c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 7198c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_PWR_MASK, 7208c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_msn201x_pwr_items_data), 7218c2ecf20Sopenharmony_ci .inversed = 0, 7228c2ecf20Sopenharmony_ci .health = false, 7238c2ecf20Sopenharmony_ci }, 7248c2ecf20Sopenharmony_ci { 7258c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_asic_items_data, 7268c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_ASIC_MASK_DEF, 7278c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET, 7288c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_ASIC_MASK, 7298c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_asic_items_data), 7308c2ecf20Sopenharmony_ci .inversed = 0, 7318c2ecf20Sopenharmony_ci .health = true, 7328c2ecf20Sopenharmony_ci }, 7338c2ecf20Sopenharmony_ci}; 7348c2ecf20Sopenharmony_ci 7358c2ecf20Sopenharmony_cistatic 7368c2ecf20Sopenharmony_cistruct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_msn201x_data = { 7378c2ecf20Sopenharmony_ci .items = mlxplat_mlxcpld_msn201x_items, 7388c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_msn201x_items), 7398c2ecf20Sopenharmony_ci .cell = MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET, 7408c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_AGGR_MASK_DEF, 7418c2ecf20Sopenharmony_ci .cell_low = MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET, 7428c2ecf20Sopenharmony_ci .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_LOW, 7438c2ecf20Sopenharmony_ci}; 7448c2ecf20Sopenharmony_ci 7458c2ecf20Sopenharmony_ci/* Platform hotplug next generation system family data */ 7468c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_default_ng_psu_items_data[] = { 7478c2ecf20Sopenharmony_ci { 7488c2ecf20Sopenharmony_ci .label = "psu1", 7498c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 7508c2ecf20Sopenharmony_ci .mask = BIT(0), 7518c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 7528c2ecf20Sopenharmony_ci }, 7538c2ecf20Sopenharmony_ci { 7548c2ecf20Sopenharmony_ci .label = "psu2", 7558c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 7568c2ecf20Sopenharmony_ci .mask = BIT(1), 7578c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 7588c2ecf20Sopenharmony_ci }, 7598c2ecf20Sopenharmony_ci}; 7608c2ecf20Sopenharmony_ci 7618c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_default_ng_fan_items_data[] = { 7628c2ecf20Sopenharmony_ci { 7638c2ecf20Sopenharmony_ci .label = "fan1", 7648c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 7658c2ecf20Sopenharmony_ci .mask = BIT(0), 7668c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 7678c2ecf20Sopenharmony_ci .bit = BIT(0), 7688c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 7698c2ecf20Sopenharmony_ci }, 7708c2ecf20Sopenharmony_ci { 7718c2ecf20Sopenharmony_ci .label = "fan2", 7728c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 7738c2ecf20Sopenharmony_ci .mask = BIT(1), 7748c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 7758c2ecf20Sopenharmony_ci .bit = BIT(1), 7768c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 7778c2ecf20Sopenharmony_ci }, 7788c2ecf20Sopenharmony_ci { 7798c2ecf20Sopenharmony_ci .label = "fan3", 7808c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 7818c2ecf20Sopenharmony_ci .mask = BIT(2), 7828c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 7838c2ecf20Sopenharmony_ci .bit = BIT(2), 7848c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 7858c2ecf20Sopenharmony_ci }, 7868c2ecf20Sopenharmony_ci { 7878c2ecf20Sopenharmony_ci .label = "fan4", 7888c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 7898c2ecf20Sopenharmony_ci .mask = BIT(3), 7908c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 7918c2ecf20Sopenharmony_ci .bit = BIT(3), 7928c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 7938c2ecf20Sopenharmony_ci }, 7948c2ecf20Sopenharmony_ci { 7958c2ecf20Sopenharmony_ci .label = "fan5", 7968c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 7978c2ecf20Sopenharmony_ci .mask = BIT(4), 7988c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 7998c2ecf20Sopenharmony_ci .bit = BIT(4), 8008c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 8018c2ecf20Sopenharmony_ci }, 8028c2ecf20Sopenharmony_ci { 8038c2ecf20Sopenharmony_ci .label = "fan6", 8048c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 8058c2ecf20Sopenharmony_ci .mask = BIT(5), 8068c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 8078c2ecf20Sopenharmony_ci .bit = BIT(5), 8088c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 8098c2ecf20Sopenharmony_ci }, 8108c2ecf20Sopenharmony_ci}; 8118c2ecf20Sopenharmony_ci 8128c2ecf20Sopenharmony_cistatic struct mlxreg_core_item mlxplat_mlxcpld_default_ng_items[] = { 8138c2ecf20Sopenharmony_ci { 8148c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_ng_psu_items_data, 8158c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, 8168c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 8178c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_PSU_MASK, 8188c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_ng_psu_items_data), 8198c2ecf20Sopenharmony_ci .inversed = 1, 8208c2ecf20Sopenharmony_ci .health = false, 8218c2ecf20Sopenharmony_ci }, 8228c2ecf20Sopenharmony_ci { 8238c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_ng_pwr_items_data, 8248c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, 8258c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 8268c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_PWR_MASK, 8278c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_ng_pwr_items_data), 8288c2ecf20Sopenharmony_ci .inversed = 0, 8298c2ecf20Sopenharmony_ci .health = false, 8308c2ecf20Sopenharmony_ci }, 8318c2ecf20Sopenharmony_ci { 8328c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_ng_fan_items_data, 8338c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, 8348c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 8358c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_FAN_NG_MASK, 8368c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_ng_fan_items_data), 8378c2ecf20Sopenharmony_ci .inversed = 1, 8388c2ecf20Sopenharmony_ci .health = false, 8398c2ecf20Sopenharmony_ci }, 8408c2ecf20Sopenharmony_ci { 8418c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_asic_items_data, 8428c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, 8438c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET, 8448c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_ASIC_MASK, 8458c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_asic_items_data), 8468c2ecf20Sopenharmony_ci .inversed = 0, 8478c2ecf20Sopenharmony_ci .health = true, 8488c2ecf20Sopenharmony_ci }, 8498c2ecf20Sopenharmony_ci}; 8508c2ecf20Sopenharmony_ci 8518c2ecf20Sopenharmony_cistatic 8528c2ecf20Sopenharmony_cistruct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_default_ng_data = { 8538c2ecf20Sopenharmony_ci .items = mlxplat_mlxcpld_default_ng_items, 8548c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_default_ng_items), 8558c2ecf20Sopenharmony_ci .cell = MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET, 8568c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF | MLXPLAT_CPLD_AGGR_MASK_COMEX, 8578c2ecf20Sopenharmony_ci .cell_low = MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET, 8588c2ecf20Sopenharmony_ci .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_LOW, 8598c2ecf20Sopenharmony_ci}; 8608c2ecf20Sopenharmony_ci 8618c2ecf20Sopenharmony_ci/* Platform hotplug extended system family data */ 8628c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_ext_psu_items_data[] = { 8638c2ecf20Sopenharmony_ci { 8648c2ecf20Sopenharmony_ci .label = "psu1", 8658c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 8668c2ecf20Sopenharmony_ci .mask = BIT(0), 8678c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 8688c2ecf20Sopenharmony_ci }, 8698c2ecf20Sopenharmony_ci { 8708c2ecf20Sopenharmony_ci .label = "psu2", 8718c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 8728c2ecf20Sopenharmony_ci .mask = BIT(1), 8738c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 8748c2ecf20Sopenharmony_ci }, 8758c2ecf20Sopenharmony_ci { 8768c2ecf20Sopenharmony_ci .label = "psu3", 8778c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 8788c2ecf20Sopenharmony_ci .mask = BIT(2), 8798c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 8808c2ecf20Sopenharmony_ci }, 8818c2ecf20Sopenharmony_ci { 8828c2ecf20Sopenharmony_ci .label = "psu4", 8838c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 8848c2ecf20Sopenharmony_ci .mask = BIT(3), 8858c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_NR_NONE, 8868c2ecf20Sopenharmony_ci }, 8878c2ecf20Sopenharmony_ci}; 8888c2ecf20Sopenharmony_ci 8898c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_ext_pwr_items_data[] = { 8908c2ecf20Sopenharmony_ci { 8918c2ecf20Sopenharmony_ci .label = "pwr1", 8928c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 8938c2ecf20Sopenharmony_ci .mask = BIT(0), 8948c2ecf20Sopenharmony_ci .hpdev.brdinfo = &mlxplat_mlxcpld_pwr[0], 8958c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, 8968c2ecf20Sopenharmony_ci }, 8978c2ecf20Sopenharmony_ci { 8988c2ecf20Sopenharmony_ci .label = "pwr2", 8998c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 9008c2ecf20Sopenharmony_ci .mask = BIT(1), 9018c2ecf20Sopenharmony_ci .hpdev.brdinfo = &mlxplat_mlxcpld_pwr[1], 9028c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, 9038c2ecf20Sopenharmony_ci }, 9048c2ecf20Sopenharmony_ci { 9058c2ecf20Sopenharmony_ci .label = "pwr3", 9068c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 9078c2ecf20Sopenharmony_ci .mask = BIT(2), 9088c2ecf20Sopenharmony_ci .hpdev.brdinfo = &mlxplat_mlxcpld_ext_pwr[0], 9098c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, 9108c2ecf20Sopenharmony_ci }, 9118c2ecf20Sopenharmony_ci { 9128c2ecf20Sopenharmony_ci .label = "pwr4", 9138c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 9148c2ecf20Sopenharmony_ci .mask = BIT(3), 9158c2ecf20Sopenharmony_ci .hpdev.brdinfo = &mlxplat_mlxcpld_ext_pwr[1], 9168c2ecf20Sopenharmony_ci .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, 9178c2ecf20Sopenharmony_ci }, 9188c2ecf20Sopenharmony_ci}; 9198c2ecf20Sopenharmony_ci 9208c2ecf20Sopenharmony_cistatic struct mlxreg_core_item mlxplat_mlxcpld_ext_items[] = { 9218c2ecf20Sopenharmony_ci { 9228c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_ext_psu_items_data, 9238c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, 9248c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, 9258c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_PSU_EXT_MASK, 9268c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET, 9278c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_ext_psu_items_data), 9288c2ecf20Sopenharmony_ci .inversed = 1, 9298c2ecf20Sopenharmony_ci .health = false, 9308c2ecf20Sopenharmony_ci }, 9318c2ecf20Sopenharmony_ci { 9328c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_ext_pwr_items_data, 9338c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, 9348c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, 9358c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_PWR_EXT_MASK, 9368c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET, 9378c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_ext_pwr_items_data), 9388c2ecf20Sopenharmony_ci .inversed = 0, 9398c2ecf20Sopenharmony_ci .health = false, 9408c2ecf20Sopenharmony_ci }, 9418c2ecf20Sopenharmony_ci { 9428c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_ng_fan_items_data, 9438c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, 9448c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 9458c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_FAN_NG_MASK, 9468c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_ng_fan_items_data), 9478c2ecf20Sopenharmony_ci .inversed = 1, 9488c2ecf20Sopenharmony_ci .health = false, 9498c2ecf20Sopenharmony_ci }, 9508c2ecf20Sopenharmony_ci { 9518c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_asic_items_data, 9528c2ecf20Sopenharmony_ci .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, 9538c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET, 9548c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_ASIC_MASK, 9558c2ecf20Sopenharmony_ci .count = ARRAY_SIZE(mlxplat_mlxcpld_default_asic_items_data), 9568c2ecf20Sopenharmony_ci .inversed = 0, 9578c2ecf20Sopenharmony_ci .health = true, 9588c2ecf20Sopenharmony_ci }, 9598c2ecf20Sopenharmony_ci}; 9608c2ecf20Sopenharmony_ci 9618c2ecf20Sopenharmony_cistatic 9628c2ecf20Sopenharmony_cistruct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_ext_data = { 9638c2ecf20Sopenharmony_ci .items = mlxplat_mlxcpld_ext_items, 9648c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_ext_items), 9658c2ecf20Sopenharmony_ci .cell = MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET, 9668c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF | MLXPLAT_CPLD_AGGR_MASK_COMEX, 9678c2ecf20Sopenharmony_ci .cell_low = MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET, 9688c2ecf20Sopenharmony_ci .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_LOW, 9698c2ecf20Sopenharmony_ci}; 9708c2ecf20Sopenharmony_ci 9718c2ecf20Sopenharmony_ci/* Platform led default data */ 9728c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_default_led_data[] = { 9738c2ecf20Sopenharmony_ci { 9748c2ecf20Sopenharmony_ci .label = "status:green", 9758c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, 9768c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 9778c2ecf20Sopenharmony_ci }, 9788c2ecf20Sopenharmony_ci { 9798c2ecf20Sopenharmony_ci .label = "status:red", 9808c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, 9818c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK 9828c2ecf20Sopenharmony_ci }, 9838c2ecf20Sopenharmony_ci { 9848c2ecf20Sopenharmony_ci .label = "psu:green", 9858c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, 9868c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 9878c2ecf20Sopenharmony_ci }, 9888c2ecf20Sopenharmony_ci { 9898c2ecf20Sopenharmony_ci .label = "psu:red", 9908c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, 9918c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 9928c2ecf20Sopenharmony_ci }, 9938c2ecf20Sopenharmony_ci { 9948c2ecf20Sopenharmony_ci .label = "fan1:green", 9958c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, 9968c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 9978c2ecf20Sopenharmony_ci }, 9988c2ecf20Sopenharmony_ci { 9998c2ecf20Sopenharmony_ci .label = "fan1:red", 10008c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, 10018c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 10028c2ecf20Sopenharmony_ci }, 10038c2ecf20Sopenharmony_ci { 10048c2ecf20Sopenharmony_ci .label = "fan2:green", 10058c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, 10068c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 10078c2ecf20Sopenharmony_ci }, 10088c2ecf20Sopenharmony_ci { 10098c2ecf20Sopenharmony_ci .label = "fan2:red", 10108c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, 10118c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 10128c2ecf20Sopenharmony_ci }, 10138c2ecf20Sopenharmony_ci { 10148c2ecf20Sopenharmony_ci .label = "fan3:green", 10158c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, 10168c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 10178c2ecf20Sopenharmony_ci }, 10188c2ecf20Sopenharmony_ci { 10198c2ecf20Sopenharmony_ci .label = "fan3:red", 10208c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, 10218c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 10228c2ecf20Sopenharmony_ci }, 10238c2ecf20Sopenharmony_ci { 10248c2ecf20Sopenharmony_ci .label = "fan4:green", 10258c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, 10268c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 10278c2ecf20Sopenharmony_ci }, 10288c2ecf20Sopenharmony_ci { 10298c2ecf20Sopenharmony_ci .label = "fan4:red", 10308c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, 10318c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 10328c2ecf20Sopenharmony_ci }, 10338c2ecf20Sopenharmony_ci}; 10348c2ecf20Sopenharmony_ci 10358c2ecf20Sopenharmony_cistatic struct mlxreg_core_platform_data mlxplat_default_led_data = { 10368c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_led_data, 10378c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_default_led_data), 10388c2ecf20Sopenharmony_ci}; 10398c2ecf20Sopenharmony_ci 10408c2ecf20Sopenharmony_ci/* Platform led MSN21xx system family data */ 10418c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_msn21xx_led_data[] = { 10428c2ecf20Sopenharmony_ci { 10438c2ecf20Sopenharmony_ci .label = "status:green", 10448c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, 10458c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 10468c2ecf20Sopenharmony_ci }, 10478c2ecf20Sopenharmony_ci { 10488c2ecf20Sopenharmony_ci .label = "status:red", 10498c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, 10508c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK 10518c2ecf20Sopenharmony_ci }, 10528c2ecf20Sopenharmony_ci { 10538c2ecf20Sopenharmony_ci .label = "fan:green", 10548c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, 10558c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 10568c2ecf20Sopenharmony_ci }, 10578c2ecf20Sopenharmony_ci { 10588c2ecf20Sopenharmony_ci .label = "fan:red", 10598c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, 10608c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 10618c2ecf20Sopenharmony_ci }, 10628c2ecf20Sopenharmony_ci { 10638c2ecf20Sopenharmony_ci .label = "psu1:green", 10648c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED4_OFFSET, 10658c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 10668c2ecf20Sopenharmony_ci }, 10678c2ecf20Sopenharmony_ci { 10688c2ecf20Sopenharmony_ci .label = "psu1:red", 10698c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED4_OFFSET, 10708c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 10718c2ecf20Sopenharmony_ci }, 10728c2ecf20Sopenharmony_ci { 10738c2ecf20Sopenharmony_ci .label = "psu2:green", 10748c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED4_OFFSET, 10758c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 10768c2ecf20Sopenharmony_ci }, 10778c2ecf20Sopenharmony_ci { 10788c2ecf20Sopenharmony_ci .label = "psu2:red", 10798c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED4_OFFSET, 10808c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 10818c2ecf20Sopenharmony_ci }, 10828c2ecf20Sopenharmony_ci { 10838c2ecf20Sopenharmony_ci .label = "uid:blue", 10848c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED5_OFFSET, 10858c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 10868c2ecf20Sopenharmony_ci }, 10878c2ecf20Sopenharmony_ci}; 10888c2ecf20Sopenharmony_ci 10898c2ecf20Sopenharmony_cistatic struct mlxreg_core_platform_data mlxplat_msn21xx_led_data = { 10908c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_msn21xx_led_data, 10918c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_msn21xx_led_data), 10928c2ecf20Sopenharmony_ci}; 10938c2ecf20Sopenharmony_ci 10948c2ecf20Sopenharmony_ci/* Platform led for default data for 200GbE systems */ 10958c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_default_ng_led_data[] = { 10968c2ecf20Sopenharmony_ci { 10978c2ecf20Sopenharmony_ci .label = "status:green", 10988c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, 10998c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 11008c2ecf20Sopenharmony_ci }, 11018c2ecf20Sopenharmony_ci { 11028c2ecf20Sopenharmony_ci .label = "status:orange", 11038c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, 11048c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK 11058c2ecf20Sopenharmony_ci }, 11068c2ecf20Sopenharmony_ci { 11078c2ecf20Sopenharmony_ci .label = "psu:green", 11088c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, 11098c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 11108c2ecf20Sopenharmony_ci }, 11118c2ecf20Sopenharmony_ci { 11128c2ecf20Sopenharmony_ci .label = "psu:orange", 11138c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, 11148c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 11158c2ecf20Sopenharmony_ci }, 11168c2ecf20Sopenharmony_ci { 11178c2ecf20Sopenharmony_ci .label = "fan1:green", 11188c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, 11198c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 11208c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 11218c2ecf20Sopenharmony_ci .bit = BIT(0), 11228c2ecf20Sopenharmony_ci }, 11238c2ecf20Sopenharmony_ci { 11248c2ecf20Sopenharmony_ci .label = "fan1:orange", 11258c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, 11268c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 11278c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 11288c2ecf20Sopenharmony_ci .bit = BIT(0), 11298c2ecf20Sopenharmony_ci }, 11308c2ecf20Sopenharmony_ci { 11318c2ecf20Sopenharmony_ci .label = "fan2:green", 11328c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, 11338c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 11348c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 11358c2ecf20Sopenharmony_ci .bit = BIT(1), 11368c2ecf20Sopenharmony_ci }, 11378c2ecf20Sopenharmony_ci { 11388c2ecf20Sopenharmony_ci .label = "fan2:orange", 11398c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, 11408c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 11418c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 11428c2ecf20Sopenharmony_ci .bit = BIT(1), 11438c2ecf20Sopenharmony_ci }, 11448c2ecf20Sopenharmony_ci { 11458c2ecf20Sopenharmony_ci .label = "fan3:green", 11468c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, 11478c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 11488c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 11498c2ecf20Sopenharmony_ci .bit = BIT(2), 11508c2ecf20Sopenharmony_ci }, 11518c2ecf20Sopenharmony_ci { 11528c2ecf20Sopenharmony_ci .label = "fan3:orange", 11538c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, 11548c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 11558c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 11568c2ecf20Sopenharmony_ci .bit = BIT(2), 11578c2ecf20Sopenharmony_ci }, 11588c2ecf20Sopenharmony_ci { 11598c2ecf20Sopenharmony_ci .label = "fan4:green", 11608c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, 11618c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 11628c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 11638c2ecf20Sopenharmony_ci .bit = BIT(3), 11648c2ecf20Sopenharmony_ci }, 11658c2ecf20Sopenharmony_ci { 11668c2ecf20Sopenharmony_ci .label = "fan4:orange", 11678c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, 11688c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 11698c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 11708c2ecf20Sopenharmony_ci .bit = BIT(3), 11718c2ecf20Sopenharmony_ci }, 11728c2ecf20Sopenharmony_ci { 11738c2ecf20Sopenharmony_ci .label = "fan5:green", 11748c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED4_OFFSET, 11758c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 11768c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 11778c2ecf20Sopenharmony_ci .bit = BIT(4), 11788c2ecf20Sopenharmony_ci }, 11798c2ecf20Sopenharmony_ci { 11808c2ecf20Sopenharmony_ci .label = "fan5:orange", 11818c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED4_OFFSET, 11828c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 11838c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 11848c2ecf20Sopenharmony_ci .bit = BIT(4), 11858c2ecf20Sopenharmony_ci }, 11868c2ecf20Sopenharmony_ci { 11878c2ecf20Sopenharmony_ci .label = "fan6:green", 11888c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED4_OFFSET, 11898c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 11908c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 11918c2ecf20Sopenharmony_ci .bit = BIT(5), 11928c2ecf20Sopenharmony_ci }, 11938c2ecf20Sopenharmony_ci { 11948c2ecf20Sopenharmony_ci .label = "fan6:orange", 11958c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED4_OFFSET, 11968c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 11978c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 11988c2ecf20Sopenharmony_ci .bit = BIT(5), 11998c2ecf20Sopenharmony_ci }, 12008c2ecf20Sopenharmony_ci { 12018c2ecf20Sopenharmony_ci .label = "uid:blue", 12028c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED5_OFFSET, 12038c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 12048c2ecf20Sopenharmony_ci }, 12058c2ecf20Sopenharmony_ci}; 12068c2ecf20Sopenharmony_ci 12078c2ecf20Sopenharmony_cistatic struct mlxreg_core_platform_data mlxplat_default_ng_led_data = { 12088c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_ng_led_data, 12098c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_default_ng_led_data), 12108c2ecf20Sopenharmony_ci}; 12118c2ecf20Sopenharmony_ci 12128c2ecf20Sopenharmony_ci/* Platform led for Comex based 100GbE systems */ 12138c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_comex_100G_led_data[] = { 12148c2ecf20Sopenharmony_ci { 12158c2ecf20Sopenharmony_ci .label = "status:green", 12168c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, 12178c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 12188c2ecf20Sopenharmony_ci }, 12198c2ecf20Sopenharmony_ci { 12208c2ecf20Sopenharmony_ci .label = "status:red", 12218c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, 12228c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK 12238c2ecf20Sopenharmony_ci }, 12248c2ecf20Sopenharmony_ci { 12258c2ecf20Sopenharmony_ci .label = "psu:green", 12268c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, 12278c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 12288c2ecf20Sopenharmony_ci }, 12298c2ecf20Sopenharmony_ci { 12308c2ecf20Sopenharmony_ci .label = "psu:red", 12318c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, 12328c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 12338c2ecf20Sopenharmony_ci }, 12348c2ecf20Sopenharmony_ci { 12358c2ecf20Sopenharmony_ci .label = "fan1:green", 12368c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, 12378c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 12388c2ecf20Sopenharmony_ci }, 12398c2ecf20Sopenharmony_ci { 12408c2ecf20Sopenharmony_ci .label = "fan1:red", 12418c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, 12428c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 12438c2ecf20Sopenharmony_ci }, 12448c2ecf20Sopenharmony_ci { 12458c2ecf20Sopenharmony_ci .label = "fan2:green", 12468c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, 12478c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 12488c2ecf20Sopenharmony_ci }, 12498c2ecf20Sopenharmony_ci { 12508c2ecf20Sopenharmony_ci .label = "fan2:red", 12518c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, 12528c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 12538c2ecf20Sopenharmony_ci }, 12548c2ecf20Sopenharmony_ci { 12558c2ecf20Sopenharmony_ci .label = "fan3:green", 12568c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, 12578c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 12588c2ecf20Sopenharmony_ci }, 12598c2ecf20Sopenharmony_ci { 12608c2ecf20Sopenharmony_ci .label = "fan3:red", 12618c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, 12628c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 12638c2ecf20Sopenharmony_ci }, 12648c2ecf20Sopenharmony_ci { 12658c2ecf20Sopenharmony_ci .label = "fan4:green", 12668c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, 12678c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 12688c2ecf20Sopenharmony_ci }, 12698c2ecf20Sopenharmony_ci { 12708c2ecf20Sopenharmony_ci .label = "fan4:red", 12718c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, 12728c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, 12738c2ecf20Sopenharmony_ci }, 12748c2ecf20Sopenharmony_ci { 12758c2ecf20Sopenharmony_ci .label = "uid:blue", 12768c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_LED5_OFFSET, 12778c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, 12788c2ecf20Sopenharmony_ci }, 12798c2ecf20Sopenharmony_ci}; 12808c2ecf20Sopenharmony_ci 12818c2ecf20Sopenharmony_cistatic struct mlxreg_core_platform_data mlxplat_comex_100G_led_data = { 12828c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_comex_100G_led_data, 12838c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_comex_100G_led_data), 12848c2ecf20Sopenharmony_ci}; 12858c2ecf20Sopenharmony_ci 12868c2ecf20Sopenharmony_ci/* Platform register access default */ 12878c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_default_regs_io_data[] = { 12888c2ecf20Sopenharmony_ci { 12898c2ecf20Sopenharmony_ci .label = "cpld1_version", 12908c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD1_VER_OFFSET, 12918c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 12928c2ecf20Sopenharmony_ci .mode = 0444, 12938c2ecf20Sopenharmony_ci }, 12948c2ecf20Sopenharmony_ci { 12958c2ecf20Sopenharmony_ci .label = "cpld2_version", 12968c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD2_VER_OFFSET, 12978c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 12988c2ecf20Sopenharmony_ci .mode = 0444, 12998c2ecf20Sopenharmony_ci }, 13008c2ecf20Sopenharmony_ci { 13018c2ecf20Sopenharmony_ci .label = "cpld1_pn", 13028c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD1_PN_OFFSET, 13038c2ecf20Sopenharmony_ci .bit = GENMASK(15, 0), 13048c2ecf20Sopenharmony_ci .mode = 0444, 13058c2ecf20Sopenharmony_ci .regnum = 2, 13068c2ecf20Sopenharmony_ci }, 13078c2ecf20Sopenharmony_ci { 13088c2ecf20Sopenharmony_ci .label = "cpld2_pn", 13098c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD2_PN_OFFSET, 13108c2ecf20Sopenharmony_ci .bit = GENMASK(15, 0), 13118c2ecf20Sopenharmony_ci .mode = 0444, 13128c2ecf20Sopenharmony_ci .regnum = 2, 13138c2ecf20Sopenharmony_ci }, 13148c2ecf20Sopenharmony_ci { 13158c2ecf20Sopenharmony_ci .label = "cpld1_version_min", 13168c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD1_MVER_OFFSET, 13178c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 13188c2ecf20Sopenharmony_ci .mode = 0444, 13198c2ecf20Sopenharmony_ci }, 13208c2ecf20Sopenharmony_ci { 13218c2ecf20Sopenharmony_ci .label = "cpld2_version_min", 13228c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD2_MVER_OFFSET, 13238c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 13248c2ecf20Sopenharmony_ci .mode = 0444, 13258c2ecf20Sopenharmony_ci }, 13268c2ecf20Sopenharmony_ci { 13278c2ecf20Sopenharmony_ci .label = "reset_long_pb", 13288c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 13298c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(0), 13308c2ecf20Sopenharmony_ci .mode = 0444, 13318c2ecf20Sopenharmony_ci }, 13328c2ecf20Sopenharmony_ci { 13338c2ecf20Sopenharmony_ci .label = "reset_short_pb", 13348c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 13358c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(1), 13368c2ecf20Sopenharmony_ci .mode = 0444, 13378c2ecf20Sopenharmony_ci }, 13388c2ecf20Sopenharmony_ci { 13398c2ecf20Sopenharmony_ci .label = "reset_aux_pwr_or_ref", 13408c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 13418c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(2), 13428c2ecf20Sopenharmony_ci .mode = 0444, 13438c2ecf20Sopenharmony_ci }, 13448c2ecf20Sopenharmony_ci { 13458c2ecf20Sopenharmony_ci .label = "reset_main_pwr_fail", 13468c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 13478c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(3), 13488c2ecf20Sopenharmony_ci .mode = 0444, 13498c2ecf20Sopenharmony_ci }, 13508c2ecf20Sopenharmony_ci { 13518c2ecf20Sopenharmony_ci .label = "reset_sw_reset", 13528c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 13538c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(4), 13548c2ecf20Sopenharmony_ci .mode = 0444, 13558c2ecf20Sopenharmony_ci }, 13568c2ecf20Sopenharmony_ci { 13578c2ecf20Sopenharmony_ci .label = "reset_fw_reset", 13588c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 13598c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(5), 13608c2ecf20Sopenharmony_ci .mode = 0444, 13618c2ecf20Sopenharmony_ci }, 13628c2ecf20Sopenharmony_ci { 13638c2ecf20Sopenharmony_ci .label = "reset_hotswap_or_wd", 13648c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 13658c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(6), 13668c2ecf20Sopenharmony_ci .mode = 0444, 13678c2ecf20Sopenharmony_ci }, 13688c2ecf20Sopenharmony_ci { 13698c2ecf20Sopenharmony_ci .label = "reset_asic_thermal", 13708c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 13718c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(7), 13728c2ecf20Sopenharmony_ci .mode = 0444, 13738c2ecf20Sopenharmony_ci }, 13748c2ecf20Sopenharmony_ci { 13758c2ecf20Sopenharmony_ci .label = "psu1_on", 13768c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, 13778c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(0), 13788c2ecf20Sopenharmony_ci .mode = 0200, 13798c2ecf20Sopenharmony_ci }, 13808c2ecf20Sopenharmony_ci { 13818c2ecf20Sopenharmony_ci .label = "psu2_on", 13828c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, 13838c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(1), 13848c2ecf20Sopenharmony_ci .mode = 0200, 13858c2ecf20Sopenharmony_ci }, 13868c2ecf20Sopenharmony_ci { 13878c2ecf20Sopenharmony_ci .label = "pwr_cycle", 13888c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, 13898c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(2), 13908c2ecf20Sopenharmony_ci .mode = 0200, 13918c2ecf20Sopenharmony_ci }, 13928c2ecf20Sopenharmony_ci { 13938c2ecf20Sopenharmony_ci .label = "pwr_down", 13948c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, 13958c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(3), 13968c2ecf20Sopenharmony_ci .mode = 0200, 13978c2ecf20Sopenharmony_ci }, 13988c2ecf20Sopenharmony_ci { 13998c2ecf20Sopenharmony_ci .label = "select_iio", 14008c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP2_OFFSET, 14018c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(6), 14028c2ecf20Sopenharmony_ci .mode = 0644, 14038c2ecf20Sopenharmony_ci }, 14048c2ecf20Sopenharmony_ci { 14058c2ecf20Sopenharmony_ci .label = "asic_health", 14068c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET, 14078c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_ASIC_MASK, 14088c2ecf20Sopenharmony_ci .bit = 1, 14098c2ecf20Sopenharmony_ci .mode = 0444, 14108c2ecf20Sopenharmony_ci }, 14118c2ecf20Sopenharmony_ci}; 14128c2ecf20Sopenharmony_ci 14138c2ecf20Sopenharmony_cistatic struct mlxreg_core_platform_data mlxplat_default_regs_io_data = { 14148c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_regs_io_data, 14158c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_default_regs_io_data), 14168c2ecf20Sopenharmony_ci}; 14178c2ecf20Sopenharmony_ci 14188c2ecf20Sopenharmony_ci/* Platform register access MSN21xx, MSN201x, MSN274x systems families data */ 14198c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_msn21xx_regs_io_data[] = { 14208c2ecf20Sopenharmony_ci { 14218c2ecf20Sopenharmony_ci .label = "cpld1_version", 14228c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD1_VER_OFFSET, 14238c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 14248c2ecf20Sopenharmony_ci .mode = 0444, 14258c2ecf20Sopenharmony_ci }, 14268c2ecf20Sopenharmony_ci { 14278c2ecf20Sopenharmony_ci .label = "cpld2_version", 14288c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD2_VER_OFFSET, 14298c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 14308c2ecf20Sopenharmony_ci .mode = 0444, 14318c2ecf20Sopenharmony_ci }, 14328c2ecf20Sopenharmony_ci { 14338c2ecf20Sopenharmony_ci .label = "cpld1_pn", 14348c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD1_PN_OFFSET, 14358c2ecf20Sopenharmony_ci .bit = GENMASK(15, 0), 14368c2ecf20Sopenharmony_ci .mode = 0444, 14378c2ecf20Sopenharmony_ci .regnum = 2, 14388c2ecf20Sopenharmony_ci }, 14398c2ecf20Sopenharmony_ci { 14408c2ecf20Sopenharmony_ci .label = "cpld2_pn", 14418c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD2_PN_OFFSET, 14428c2ecf20Sopenharmony_ci .bit = GENMASK(15, 0), 14438c2ecf20Sopenharmony_ci .mode = 0444, 14448c2ecf20Sopenharmony_ci .regnum = 2, 14458c2ecf20Sopenharmony_ci }, 14468c2ecf20Sopenharmony_ci { 14478c2ecf20Sopenharmony_ci .label = "cpld1_version_min", 14488c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD1_MVER_OFFSET, 14498c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 14508c2ecf20Sopenharmony_ci .mode = 0444, 14518c2ecf20Sopenharmony_ci }, 14528c2ecf20Sopenharmony_ci { 14538c2ecf20Sopenharmony_ci .label = "cpld2_version_min", 14548c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD2_MVER_OFFSET, 14558c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 14568c2ecf20Sopenharmony_ci .mode = 0444, 14578c2ecf20Sopenharmony_ci }, 14588c2ecf20Sopenharmony_ci { 14598c2ecf20Sopenharmony_ci .label = "reset_long_pb", 14608c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 14618c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(0), 14628c2ecf20Sopenharmony_ci .mode = 0444, 14638c2ecf20Sopenharmony_ci }, 14648c2ecf20Sopenharmony_ci { 14658c2ecf20Sopenharmony_ci .label = "reset_short_pb", 14668c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 14678c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(1), 14688c2ecf20Sopenharmony_ci .mode = 0444, 14698c2ecf20Sopenharmony_ci }, 14708c2ecf20Sopenharmony_ci { 14718c2ecf20Sopenharmony_ci .label = "reset_aux_pwr_or_ref", 14728c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 14738c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(2), 14748c2ecf20Sopenharmony_ci .mode = 0444, 14758c2ecf20Sopenharmony_ci }, 14768c2ecf20Sopenharmony_ci { 14778c2ecf20Sopenharmony_ci .label = "reset_sw_reset", 14788c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 14798c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(3), 14808c2ecf20Sopenharmony_ci .mode = 0444, 14818c2ecf20Sopenharmony_ci }, 14828c2ecf20Sopenharmony_ci { 14838c2ecf20Sopenharmony_ci .label = "reset_main_pwr_fail", 14848c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 14858c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(4), 14868c2ecf20Sopenharmony_ci .mode = 0444, 14878c2ecf20Sopenharmony_ci }, 14888c2ecf20Sopenharmony_ci { 14898c2ecf20Sopenharmony_ci .label = "reset_asic_thermal", 14908c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 14918c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(5), 14928c2ecf20Sopenharmony_ci .mode = 0444, 14938c2ecf20Sopenharmony_ci }, 14948c2ecf20Sopenharmony_ci { 14958c2ecf20Sopenharmony_ci .label = "reset_hotswap_or_halt", 14968c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 14978c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(6), 14988c2ecf20Sopenharmony_ci .mode = 0444, 14998c2ecf20Sopenharmony_ci }, 15008c2ecf20Sopenharmony_ci { 15018c2ecf20Sopenharmony_ci .label = "reset_sff_wd", 15028c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE1_OFFSET, 15038c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(6), 15048c2ecf20Sopenharmony_ci .mode = 0444, 15058c2ecf20Sopenharmony_ci }, 15068c2ecf20Sopenharmony_ci { 15078c2ecf20Sopenharmony_ci .label = "psu1_on", 15088c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, 15098c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(0), 15108c2ecf20Sopenharmony_ci .mode = 0200, 15118c2ecf20Sopenharmony_ci }, 15128c2ecf20Sopenharmony_ci { 15138c2ecf20Sopenharmony_ci .label = "psu2_on", 15148c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, 15158c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(1), 15168c2ecf20Sopenharmony_ci .mode = 0200, 15178c2ecf20Sopenharmony_ci }, 15188c2ecf20Sopenharmony_ci { 15198c2ecf20Sopenharmony_ci .label = "pwr_cycle", 15208c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, 15218c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(2), 15228c2ecf20Sopenharmony_ci .mode = 0200, 15238c2ecf20Sopenharmony_ci }, 15248c2ecf20Sopenharmony_ci { 15258c2ecf20Sopenharmony_ci .label = "pwr_down", 15268c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, 15278c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(3), 15288c2ecf20Sopenharmony_ci .mode = 0200, 15298c2ecf20Sopenharmony_ci }, 15308c2ecf20Sopenharmony_ci { 15318c2ecf20Sopenharmony_ci .label = "select_iio", 15328c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP2_OFFSET, 15338c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(6), 15348c2ecf20Sopenharmony_ci .mode = 0644, 15358c2ecf20Sopenharmony_ci }, 15368c2ecf20Sopenharmony_ci { 15378c2ecf20Sopenharmony_ci .label = "asic_health", 15388c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET, 15398c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_ASIC_MASK, 15408c2ecf20Sopenharmony_ci .bit = 1, 15418c2ecf20Sopenharmony_ci .mode = 0444, 15428c2ecf20Sopenharmony_ci }, 15438c2ecf20Sopenharmony_ci}; 15448c2ecf20Sopenharmony_ci 15458c2ecf20Sopenharmony_cistatic struct mlxreg_core_platform_data mlxplat_msn21xx_regs_io_data = { 15468c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_msn21xx_regs_io_data, 15478c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_msn21xx_regs_io_data), 15488c2ecf20Sopenharmony_ci}; 15498c2ecf20Sopenharmony_ci 15508c2ecf20Sopenharmony_ci/* Platform register access for next generation systems families data */ 15518c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_default_ng_regs_io_data[] = { 15528c2ecf20Sopenharmony_ci { 15538c2ecf20Sopenharmony_ci .label = "cpld1_version", 15548c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD1_VER_OFFSET, 15558c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 15568c2ecf20Sopenharmony_ci .mode = 0444, 15578c2ecf20Sopenharmony_ci }, 15588c2ecf20Sopenharmony_ci { 15598c2ecf20Sopenharmony_ci .label = "cpld2_version", 15608c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD2_VER_OFFSET, 15618c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 15628c2ecf20Sopenharmony_ci .mode = 0444, 15638c2ecf20Sopenharmony_ci }, 15648c2ecf20Sopenharmony_ci { 15658c2ecf20Sopenharmony_ci .label = "cpld3_version", 15668c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD3_VER_OFFSET, 15678c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 15688c2ecf20Sopenharmony_ci .mode = 0444, 15698c2ecf20Sopenharmony_ci }, 15708c2ecf20Sopenharmony_ci { 15718c2ecf20Sopenharmony_ci .label = "cpld4_version", 15728c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD4_VER_OFFSET, 15738c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 15748c2ecf20Sopenharmony_ci .mode = 0444, 15758c2ecf20Sopenharmony_ci }, 15768c2ecf20Sopenharmony_ci { 15778c2ecf20Sopenharmony_ci .label = "cpld1_pn", 15788c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD1_PN_OFFSET, 15798c2ecf20Sopenharmony_ci .bit = GENMASK(15, 0), 15808c2ecf20Sopenharmony_ci .mode = 0444, 15818c2ecf20Sopenharmony_ci .regnum = 2, 15828c2ecf20Sopenharmony_ci }, 15838c2ecf20Sopenharmony_ci { 15848c2ecf20Sopenharmony_ci .label = "cpld2_pn", 15858c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD2_PN_OFFSET, 15868c2ecf20Sopenharmony_ci .bit = GENMASK(15, 0), 15878c2ecf20Sopenharmony_ci .mode = 0444, 15888c2ecf20Sopenharmony_ci .regnum = 2, 15898c2ecf20Sopenharmony_ci }, 15908c2ecf20Sopenharmony_ci { 15918c2ecf20Sopenharmony_ci .label = "cpld3_pn", 15928c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD3_PN_OFFSET, 15938c2ecf20Sopenharmony_ci .bit = GENMASK(15, 0), 15948c2ecf20Sopenharmony_ci .mode = 0444, 15958c2ecf20Sopenharmony_ci .regnum = 2, 15968c2ecf20Sopenharmony_ci }, 15978c2ecf20Sopenharmony_ci { 15988c2ecf20Sopenharmony_ci .label = "cpld4_pn", 15998c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD4_PN_OFFSET, 16008c2ecf20Sopenharmony_ci .bit = GENMASK(15, 0), 16018c2ecf20Sopenharmony_ci .mode = 0444, 16028c2ecf20Sopenharmony_ci .regnum = 2, 16038c2ecf20Sopenharmony_ci }, 16048c2ecf20Sopenharmony_ci { 16058c2ecf20Sopenharmony_ci .label = "cpld1_version_min", 16068c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD1_MVER_OFFSET, 16078c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 16088c2ecf20Sopenharmony_ci .mode = 0444, 16098c2ecf20Sopenharmony_ci }, 16108c2ecf20Sopenharmony_ci { 16118c2ecf20Sopenharmony_ci .label = "cpld2_version_min", 16128c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD2_MVER_OFFSET, 16138c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 16148c2ecf20Sopenharmony_ci .mode = 0444, 16158c2ecf20Sopenharmony_ci }, 16168c2ecf20Sopenharmony_ci { 16178c2ecf20Sopenharmony_ci .label = "cpld3_version_min", 16188c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD3_MVER_OFFSET, 16198c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 16208c2ecf20Sopenharmony_ci .mode = 0444, 16218c2ecf20Sopenharmony_ci }, 16228c2ecf20Sopenharmony_ci { 16238c2ecf20Sopenharmony_ci .label = "cpld4_version_min", 16248c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CPLD4_MVER_OFFSET, 16258c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 16268c2ecf20Sopenharmony_ci .mode = 0444, 16278c2ecf20Sopenharmony_ci }, 16288c2ecf20Sopenharmony_ci { 16298c2ecf20Sopenharmony_ci .label = "reset_long_pb", 16308c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 16318c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(0), 16328c2ecf20Sopenharmony_ci .mode = 0444, 16338c2ecf20Sopenharmony_ci }, 16348c2ecf20Sopenharmony_ci { 16358c2ecf20Sopenharmony_ci .label = "reset_short_pb", 16368c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 16378c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(1), 16388c2ecf20Sopenharmony_ci .mode = 0444, 16398c2ecf20Sopenharmony_ci }, 16408c2ecf20Sopenharmony_ci { 16418c2ecf20Sopenharmony_ci .label = "reset_aux_pwr_or_ref", 16428c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 16438c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(2), 16448c2ecf20Sopenharmony_ci .mode = 0444, 16458c2ecf20Sopenharmony_ci }, 16468c2ecf20Sopenharmony_ci { 16478c2ecf20Sopenharmony_ci .label = "reset_from_comex", 16488c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 16498c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(4), 16508c2ecf20Sopenharmony_ci .mode = 0444, 16518c2ecf20Sopenharmony_ci }, 16528c2ecf20Sopenharmony_ci { 16538c2ecf20Sopenharmony_ci .label = "reset_from_asic", 16548c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 16558c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(5), 16568c2ecf20Sopenharmony_ci .mode = 0444, 16578c2ecf20Sopenharmony_ci }, 16588c2ecf20Sopenharmony_ci { 16598c2ecf20Sopenharmony_ci .label = "reset_swb_wd", 16608c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 16618c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(6), 16628c2ecf20Sopenharmony_ci .mode = 0444, 16638c2ecf20Sopenharmony_ci }, 16648c2ecf20Sopenharmony_ci { 16658c2ecf20Sopenharmony_ci .label = "reset_asic_thermal", 16668c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 16678c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(7), 16688c2ecf20Sopenharmony_ci .mode = 0444, 16698c2ecf20Sopenharmony_ci }, 16708c2ecf20Sopenharmony_ci { 16718c2ecf20Sopenharmony_ci .label = "reset_comex_pwr_fail", 16728c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE1_OFFSET, 16738c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(3), 16748c2ecf20Sopenharmony_ci .mode = 0444, 16758c2ecf20Sopenharmony_ci }, 16768c2ecf20Sopenharmony_ci { 16778c2ecf20Sopenharmony_ci .label = "reset_platform", 16788c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE1_OFFSET, 16798c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(4), 16808c2ecf20Sopenharmony_ci .mode = 0444, 16818c2ecf20Sopenharmony_ci }, 16828c2ecf20Sopenharmony_ci { 16838c2ecf20Sopenharmony_ci .label = "reset_soc", 16848c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE1_OFFSET, 16858c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(5), 16868c2ecf20Sopenharmony_ci .mode = 0444, 16878c2ecf20Sopenharmony_ci }, 16888c2ecf20Sopenharmony_ci { 16898c2ecf20Sopenharmony_ci .label = "reset_comex_wd", 16908c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE1_OFFSET, 16918c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(6), 16928c2ecf20Sopenharmony_ci .mode = 0444, 16938c2ecf20Sopenharmony_ci }, 16948c2ecf20Sopenharmony_ci { 16958c2ecf20Sopenharmony_ci .label = "reset_voltmon_upgrade_fail", 16968c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE2_OFFSET, 16978c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(0), 16988c2ecf20Sopenharmony_ci .mode = 0444, 16998c2ecf20Sopenharmony_ci }, 17008c2ecf20Sopenharmony_ci { 17018c2ecf20Sopenharmony_ci .label = "reset_system", 17028c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE2_OFFSET, 17038c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(1), 17048c2ecf20Sopenharmony_ci .mode = 0444, 17058c2ecf20Sopenharmony_ci }, 17068c2ecf20Sopenharmony_ci { 17078c2ecf20Sopenharmony_ci .label = "reset_sw_pwr_off", 17088c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE2_OFFSET, 17098c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(2), 17108c2ecf20Sopenharmony_ci .mode = 0444, 17118c2ecf20Sopenharmony_ci }, 17128c2ecf20Sopenharmony_ci { 17138c2ecf20Sopenharmony_ci .label = "reset_comex_thermal", 17148c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE2_OFFSET, 17158c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(3), 17168c2ecf20Sopenharmony_ci .mode = 0444, 17178c2ecf20Sopenharmony_ci }, 17188c2ecf20Sopenharmony_ci { 17198c2ecf20Sopenharmony_ci .label = "reset_reload_bios", 17208c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE2_OFFSET, 17218c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(5), 17228c2ecf20Sopenharmony_ci .mode = 0444, 17238c2ecf20Sopenharmony_ci }, 17248c2ecf20Sopenharmony_ci { 17258c2ecf20Sopenharmony_ci .label = "reset_ac_pwr_fail", 17268c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE2_OFFSET, 17278c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(6), 17288c2ecf20Sopenharmony_ci .mode = 0444, 17298c2ecf20Sopenharmony_ci }, 17308c2ecf20Sopenharmony_ci { 17318c2ecf20Sopenharmony_ci .label = "psu1_on", 17328c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, 17338c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(0), 17348c2ecf20Sopenharmony_ci .mode = 0200, 17358c2ecf20Sopenharmony_ci }, 17368c2ecf20Sopenharmony_ci { 17378c2ecf20Sopenharmony_ci .label = "psu2_on", 17388c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, 17398c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(1), 17408c2ecf20Sopenharmony_ci .mode = 0200, 17418c2ecf20Sopenharmony_ci }, 17428c2ecf20Sopenharmony_ci { 17438c2ecf20Sopenharmony_ci .label = "pwr_cycle", 17448c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, 17458c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(2), 17468c2ecf20Sopenharmony_ci .mode = 0200, 17478c2ecf20Sopenharmony_ci }, 17488c2ecf20Sopenharmony_ci { 17498c2ecf20Sopenharmony_ci .label = "pwr_down", 17508c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, 17518c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(3), 17528c2ecf20Sopenharmony_ci .mode = 0200, 17538c2ecf20Sopenharmony_ci }, 17548c2ecf20Sopenharmony_ci { 17558c2ecf20Sopenharmony_ci .label = "jtag_enable", 17568c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP2_OFFSET, 17578c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(4), 17588c2ecf20Sopenharmony_ci .mode = 0644, 17598c2ecf20Sopenharmony_ci }, 17608c2ecf20Sopenharmony_ci { 17618c2ecf20Sopenharmony_ci .label = "asic_health", 17628c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET, 17638c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_ASIC_MASK, 17648c2ecf20Sopenharmony_ci .bit = 1, 17658c2ecf20Sopenharmony_ci .mode = 0444, 17668c2ecf20Sopenharmony_ci }, 17678c2ecf20Sopenharmony_ci { 17688c2ecf20Sopenharmony_ci .label = "fan_dir", 17698c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_FAN_DIRECTION, 17708c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 17718c2ecf20Sopenharmony_ci .mode = 0444, 17728c2ecf20Sopenharmony_ci }, 17738c2ecf20Sopenharmony_ci { 17748c2ecf20Sopenharmony_ci .label = "voltreg_update_status", 17758c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP0_RO_OFFSET, 17768c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_VOLTREG_UPD_MASK, 17778c2ecf20Sopenharmony_ci .bit = 5, 17788c2ecf20Sopenharmony_ci .mode = 0444, 17798c2ecf20Sopenharmony_ci }, 17808c2ecf20Sopenharmony_ci { 17818c2ecf20Sopenharmony_ci .label = "vpd_wp", 17828c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP0_OFFSET, 17838c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(3), 17848c2ecf20Sopenharmony_ci .mode = 0644, 17858c2ecf20Sopenharmony_ci }, 17868c2ecf20Sopenharmony_ci { 17878c2ecf20Sopenharmony_ci .label = "pcie_asic_reset_dis", 17888c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_GP0_OFFSET, 17898c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(4), 17908c2ecf20Sopenharmony_ci .mode = 0644, 17918c2ecf20Sopenharmony_ci }, 17928c2ecf20Sopenharmony_ci { 17938c2ecf20Sopenharmony_ci .label = "config1", 17948c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CONFIG1_OFFSET, 17958c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 17968c2ecf20Sopenharmony_ci .mode = 0444, 17978c2ecf20Sopenharmony_ci }, 17988c2ecf20Sopenharmony_ci { 17998c2ecf20Sopenharmony_ci .label = "config2", 18008c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_CONFIG2_OFFSET, 18018c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 18028c2ecf20Sopenharmony_ci .mode = 0444, 18038c2ecf20Sopenharmony_ci }, 18048c2ecf20Sopenharmony_ci { 18058c2ecf20Sopenharmony_ci .label = "ufm_version", 18068c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_UFM_VERSION_OFFSET, 18078c2ecf20Sopenharmony_ci .bit = GENMASK(7, 0), 18088c2ecf20Sopenharmony_ci .mode = 0444, 18098c2ecf20Sopenharmony_ci }, 18108c2ecf20Sopenharmony_ci}; 18118c2ecf20Sopenharmony_ci 18128c2ecf20Sopenharmony_cistatic struct mlxreg_core_platform_data mlxplat_default_ng_regs_io_data = { 18138c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_ng_regs_io_data, 18148c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_default_ng_regs_io_data), 18158c2ecf20Sopenharmony_ci}; 18168c2ecf20Sopenharmony_ci 18178c2ecf20Sopenharmony_ci/* Platform FAN default */ 18188c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_default_fan_data[] = { 18198c2ecf20Sopenharmony_ci { 18208c2ecf20Sopenharmony_ci .label = "pwm1", 18218c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_PWM1_OFFSET, 18228c2ecf20Sopenharmony_ci }, 18238c2ecf20Sopenharmony_ci { 18248c2ecf20Sopenharmony_ci .label = "tacho1", 18258c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_TACHO1_OFFSET, 18268c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0), 18278c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_CAP1_OFFSET, 18288c2ecf20Sopenharmony_ci .bit = BIT(0), 18298c2ecf20Sopenharmony_ci .reg_prsnt = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 18308c2ecf20Sopenharmony_ci 18318c2ecf20Sopenharmony_ci }, 18328c2ecf20Sopenharmony_ci { 18338c2ecf20Sopenharmony_ci .label = "tacho2", 18348c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_TACHO2_OFFSET, 18358c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0), 18368c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_CAP1_OFFSET, 18378c2ecf20Sopenharmony_ci .bit = BIT(1), 18388c2ecf20Sopenharmony_ci .reg_prsnt = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 18398c2ecf20Sopenharmony_ci }, 18408c2ecf20Sopenharmony_ci { 18418c2ecf20Sopenharmony_ci .label = "tacho3", 18428c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_TACHO3_OFFSET, 18438c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0), 18448c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_CAP1_OFFSET, 18458c2ecf20Sopenharmony_ci .bit = BIT(2), 18468c2ecf20Sopenharmony_ci .reg_prsnt = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 18478c2ecf20Sopenharmony_ci }, 18488c2ecf20Sopenharmony_ci { 18498c2ecf20Sopenharmony_ci .label = "tacho4", 18508c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_TACHO4_OFFSET, 18518c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0), 18528c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_CAP1_OFFSET, 18538c2ecf20Sopenharmony_ci .bit = BIT(3), 18548c2ecf20Sopenharmony_ci .reg_prsnt = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 18558c2ecf20Sopenharmony_ci }, 18568c2ecf20Sopenharmony_ci { 18578c2ecf20Sopenharmony_ci .label = "tacho5", 18588c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_TACHO5_OFFSET, 18598c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0), 18608c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_CAP1_OFFSET, 18618c2ecf20Sopenharmony_ci .bit = BIT(4), 18628c2ecf20Sopenharmony_ci .reg_prsnt = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 18638c2ecf20Sopenharmony_ci }, 18648c2ecf20Sopenharmony_ci { 18658c2ecf20Sopenharmony_ci .label = "tacho6", 18668c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_TACHO6_OFFSET, 18678c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0), 18688c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_CAP1_OFFSET, 18698c2ecf20Sopenharmony_ci .bit = BIT(5), 18708c2ecf20Sopenharmony_ci .reg_prsnt = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 18718c2ecf20Sopenharmony_ci }, 18728c2ecf20Sopenharmony_ci { 18738c2ecf20Sopenharmony_ci .label = "tacho7", 18748c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_TACHO7_OFFSET, 18758c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0), 18768c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_CAP1_OFFSET, 18778c2ecf20Sopenharmony_ci .bit = BIT(6), 18788c2ecf20Sopenharmony_ci .reg_prsnt = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 18798c2ecf20Sopenharmony_ci }, 18808c2ecf20Sopenharmony_ci { 18818c2ecf20Sopenharmony_ci .label = "tacho8", 18828c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_TACHO8_OFFSET, 18838c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0), 18848c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_CAP1_OFFSET, 18858c2ecf20Sopenharmony_ci .bit = BIT(7), 18868c2ecf20Sopenharmony_ci .reg_prsnt = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 18878c2ecf20Sopenharmony_ci }, 18888c2ecf20Sopenharmony_ci { 18898c2ecf20Sopenharmony_ci .label = "tacho9", 18908c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_TACHO9_OFFSET, 18918c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0), 18928c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_CAP2_OFFSET, 18938c2ecf20Sopenharmony_ci .bit = BIT(0), 18948c2ecf20Sopenharmony_ci .reg_prsnt = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 18958c2ecf20Sopenharmony_ci }, 18968c2ecf20Sopenharmony_ci { 18978c2ecf20Sopenharmony_ci .label = "tacho10", 18988c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_TACHO10_OFFSET, 18998c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0), 19008c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_CAP2_OFFSET, 19018c2ecf20Sopenharmony_ci .bit = BIT(1), 19028c2ecf20Sopenharmony_ci .reg_prsnt = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 19038c2ecf20Sopenharmony_ci }, 19048c2ecf20Sopenharmony_ci { 19058c2ecf20Sopenharmony_ci .label = "tacho11", 19068c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_TACHO11_OFFSET, 19078c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0), 19088c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_CAP2_OFFSET, 19098c2ecf20Sopenharmony_ci .bit = BIT(2), 19108c2ecf20Sopenharmony_ci .reg_prsnt = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 19118c2ecf20Sopenharmony_ci }, 19128c2ecf20Sopenharmony_ci { 19138c2ecf20Sopenharmony_ci .label = "tacho12", 19148c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_TACHO12_OFFSET, 19158c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0), 19168c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_CAP2_OFFSET, 19178c2ecf20Sopenharmony_ci .bit = BIT(3), 19188c2ecf20Sopenharmony_ci .reg_prsnt = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, 19198c2ecf20Sopenharmony_ci }, 19208c2ecf20Sopenharmony_ci { 19218c2ecf20Sopenharmony_ci .label = "conf", 19228c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_TACHO_SPEED_OFFSET, 19238c2ecf20Sopenharmony_ci }, 19248c2ecf20Sopenharmony_ci}; 19258c2ecf20Sopenharmony_ci 19268c2ecf20Sopenharmony_cistatic struct mlxreg_core_platform_data mlxplat_default_fan_data = { 19278c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_default_fan_data, 19288c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_default_fan_data), 19298c2ecf20Sopenharmony_ci .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, 19308c2ecf20Sopenharmony_ci}; 19318c2ecf20Sopenharmony_ci 19328c2ecf20Sopenharmony_ci/* Watchdog type1: hardware implementation version1 19338c2ecf20Sopenharmony_ci * (MSN2700, MSN2410, MSN2740, MSN2100 and MSN2140 systems). 19348c2ecf20Sopenharmony_ci */ 19358c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_wd_main_regs_type1[] = { 19368c2ecf20Sopenharmony_ci { 19378c2ecf20Sopenharmony_ci .label = "action", 19388c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD1_ACT_OFFSET, 19398c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_RESET_ACT_MASK, 19408c2ecf20Sopenharmony_ci .bit = 0, 19418c2ecf20Sopenharmony_ci }, 19428c2ecf20Sopenharmony_ci { 19438c2ecf20Sopenharmony_ci .label = "timeout", 19448c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD1_TMR_OFFSET, 19458c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_TYPE1_TO_MASK, 19468c2ecf20Sopenharmony_ci .health_cntr = MLXPLAT_CPLD_WD_DFLT_TIMEOUT, 19478c2ecf20Sopenharmony_ci }, 19488c2ecf20Sopenharmony_ci { 19498c2ecf20Sopenharmony_ci .label = "ping", 19508c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD_CLEAR_OFFSET, 19518c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD1_CLEAR_MASK, 19528c2ecf20Sopenharmony_ci .bit = 0, 19538c2ecf20Sopenharmony_ci }, 19548c2ecf20Sopenharmony_ci { 19558c2ecf20Sopenharmony_ci .label = "reset", 19568c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 19578c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(6), 19588c2ecf20Sopenharmony_ci .bit = 6, 19598c2ecf20Sopenharmony_ci }, 19608c2ecf20Sopenharmony_ci}; 19618c2ecf20Sopenharmony_ci 19628c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_wd_aux_regs_type1[] = { 19638c2ecf20Sopenharmony_ci { 19648c2ecf20Sopenharmony_ci .label = "action", 19658c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD2_ACT_OFFSET, 19668c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_FAN_ACT_MASK, 19678c2ecf20Sopenharmony_ci .bit = 4, 19688c2ecf20Sopenharmony_ci }, 19698c2ecf20Sopenharmony_ci { 19708c2ecf20Sopenharmony_ci .label = "timeout", 19718c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD2_TMR_OFFSET, 19728c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_TYPE1_TO_MASK, 19738c2ecf20Sopenharmony_ci .health_cntr = MLXPLAT_CPLD_WD_DFLT_TIMEOUT, 19748c2ecf20Sopenharmony_ci }, 19758c2ecf20Sopenharmony_ci { 19768c2ecf20Sopenharmony_ci .label = "ping", 19778c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD_CLEAR_OFFSET, 19788c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD1_CLEAR_MASK, 19798c2ecf20Sopenharmony_ci .bit = 1, 19808c2ecf20Sopenharmony_ci }, 19818c2ecf20Sopenharmony_ci}; 19828c2ecf20Sopenharmony_ci 19838c2ecf20Sopenharmony_cistatic struct mlxreg_core_platform_data mlxplat_mlxcpld_wd_set_type1[] = { 19848c2ecf20Sopenharmony_ci { 19858c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_wd_main_regs_type1, 19868c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_wd_main_regs_type1), 19878c2ecf20Sopenharmony_ci .version = MLX_WDT_TYPE1, 19888c2ecf20Sopenharmony_ci .identity = "mlx-wdt-main", 19898c2ecf20Sopenharmony_ci }, 19908c2ecf20Sopenharmony_ci { 19918c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_wd_aux_regs_type1, 19928c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_wd_aux_regs_type1), 19938c2ecf20Sopenharmony_ci .version = MLX_WDT_TYPE1, 19948c2ecf20Sopenharmony_ci .identity = "mlx-wdt-aux", 19958c2ecf20Sopenharmony_ci }, 19968c2ecf20Sopenharmony_ci}; 19978c2ecf20Sopenharmony_ci 19988c2ecf20Sopenharmony_ci/* Watchdog type2: hardware implementation version 2 19998c2ecf20Sopenharmony_ci * (all systems except (MSN2700, MSN2410, MSN2740, MSN2100 and MSN2140). 20008c2ecf20Sopenharmony_ci */ 20018c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_wd_main_regs_type2[] = { 20028c2ecf20Sopenharmony_ci { 20038c2ecf20Sopenharmony_ci .label = "action", 20048c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD2_ACT_OFFSET, 20058c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_RESET_ACT_MASK, 20068c2ecf20Sopenharmony_ci .bit = 0, 20078c2ecf20Sopenharmony_ci }, 20088c2ecf20Sopenharmony_ci { 20098c2ecf20Sopenharmony_ci .label = "timeout", 20108c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD2_TMR_OFFSET, 20118c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_TYPE2_TO_MASK, 20128c2ecf20Sopenharmony_ci .health_cntr = MLXPLAT_CPLD_WD_DFLT_TIMEOUT, 20138c2ecf20Sopenharmony_ci }, 20148c2ecf20Sopenharmony_ci { 20158c2ecf20Sopenharmony_ci .label = "timeleft", 20168c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD2_TLEFT_OFFSET, 20178c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_TYPE2_TO_MASK, 20188c2ecf20Sopenharmony_ci }, 20198c2ecf20Sopenharmony_ci { 20208c2ecf20Sopenharmony_ci .label = "ping", 20218c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD2_ACT_OFFSET, 20228c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_RESET_ACT_MASK, 20238c2ecf20Sopenharmony_ci .bit = 0, 20248c2ecf20Sopenharmony_ci }, 20258c2ecf20Sopenharmony_ci { 20268c2ecf20Sopenharmony_ci .label = "reset", 20278c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 20288c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(6), 20298c2ecf20Sopenharmony_ci .bit = 6, 20308c2ecf20Sopenharmony_ci }, 20318c2ecf20Sopenharmony_ci}; 20328c2ecf20Sopenharmony_ci 20338c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_wd_aux_regs_type2[] = { 20348c2ecf20Sopenharmony_ci { 20358c2ecf20Sopenharmony_ci .label = "action", 20368c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET, 20378c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_FAN_ACT_MASK, 20388c2ecf20Sopenharmony_ci .bit = 4, 20398c2ecf20Sopenharmony_ci }, 20408c2ecf20Sopenharmony_ci { 20418c2ecf20Sopenharmony_ci .label = "timeout", 20428c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET, 20438c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_TYPE2_TO_MASK, 20448c2ecf20Sopenharmony_ci .health_cntr = MLXPLAT_CPLD_WD_DFLT_TIMEOUT, 20458c2ecf20Sopenharmony_ci }, 20468c2ecf20Sopenharmony_ci { 20478c2ecf20Sopenharmony_ci .label = "timeleft", 20488c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET, 20498c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_TYPE2_TO_MASK, 20508c2ecf20Sopenharmony_ci }, 20518c2ecf20Sopenharmony_ci { 20528c2ecf20Sopenharmony_ci .label = "ping", 20538c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET, 20548c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_FAN_ACT_MASK, 20558c2ecf20Sopenharmony_ci .bit = 4, 20568c2ecf20Sopenharmony_ci }, 20578c2ecf20Sopenharmony_ci}; 20588c2ecf20Sopenharmony_ci 20598c2ecf20Sopenharmony_cistatic struct mlxreg_core_platform_data mlxplat_mlxcpld_wd_set_type2[] = { 20608c2ecf20Sopenharmony_ci { 20618c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_wd_main_regs_type2, 20628c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_wd_main_regs_type2), 20638c2ecf20Sopenharmony_ci .version = MLX_WDT_TYPE2, 20648c2ecf20Sopenharmony_ci .identity = "mlx-wdt-main", 20658c2ecf20Sopenharmony_ci }, 20668c2ecf20Sopenharmony_ci { 20678c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_wd_aux_regs_type2, 20688c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_wd_aux_regs_type2), 20698c2ecf20Sopenharmony_ci .version = MLX_WDT_TYPE2, 20708c2ecf20Sopenharmony_ci .identity = "mlx-wdt-aux", 20718c2ecf20Sopenharmony_ci }, 20728c2ecf20Sopenharmony_ci}; 20738c2ecf20Sopenharmony_ci 20748c2ecf20Sopenharmony_ci/* Watchdog type3: hardware implementation version 3 20758c2ecf20Sopenharmony_ci * Can be on all systems. It's differentiated by WD capability bit. 20768c2ecf20Sopenharmony_ci * Old systems (MSN2700, MSN2410, MSN2740, MSN2100 and MSN2140) 20778c2ecf20Sopenharmony_ci * still have only one main watchdog. 20788c2ecf20Sopenharmony_ci */ 20798c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_wd_main_regs_type3[] = { 20808c2ecf20Sopenharmony_ci { 20818c2ecf20Sopenharmony_ci .label = "action", 20828c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD2_ACT_OFFSET, 20838c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_RESET_ACT_MASK, 20848c2ecf20Sopenharmony_ci .bit = 0, 20858c2ecf20Sopenharmony_ci }, 20868c2ecf20Sopenharmony_ci { 20878c2ecf20Sopenharmony_ci .label = "timeout", 20888c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD2_TMR_OFFSET, 20898c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_TYPE2_TO_MASK, 20908c2ecf20Sopenharmony_ci .health_cntr = MLXPLAT_CPLD_WD3_DFLT_TIMEOUT, 20918c2ecf20Sopenharmony_ci }, 20928c2ecf20Sopenharmony_ci { 20938c2ecf20Sopenharmony_ci .label = "timeleft", 20948c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD2_TMR_OFFSET, 20958c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_TYPE2_TO_MASK, 20968c2ecf20Sopenharmony_ci }, 20978c2ecf20Sopenharmony_ci { 20988c2ecf20Sopenharmony_ci .label = "ping", 20998c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD2_ACT_OFFSET, 21008c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_RESET_ACT_MASK, 21018c2ecf20Sopenharmony_ci .bit = 0, 21028c2ecf20Sopenharmony_ci }, 21038c2ecf20Sopenharmony_ci { 21048c2ecf20Sopenharmony_ci .label = "reset", 21058c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, 21068c2ecf20Sopenharmony_ci .mask = GENMASK(7, 0) & ~BIT(6), 21078c2ecf20Sopenharmony_ci .bit = 6, 21088c2ecf20Sopenharmony_ci }, 21098c2ecf20Sopenharmony_ci}; 21108c2ecf20Sopenharmony_ci 21118c2ecf20Sopenharmony_cistatic struct mlxreg_core_data mlxplat_mlxcpld_wd_aux_regs_type3[] = { 21128c2ecf20Sopenharmony_ci { 21138c2ecf20Sopenharmony_ci .label = "action", 21148c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET, 21158c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_FAN_ACT_MASK, 21168c2ecf20Sopenharmony_ci .bit = 4, 21178c2ecf20Sopenharmony_ci }, 21188c2ecf20Sopenharmony_ci { 21198c2ecf20Sopenharmony_ci .label = "timeout", 21208c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET, 21218c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_TYPE2_TO_MASK, 21228c2ecf20Sopenharmony_ci .health_cntr = MLXPLAT_CPLD_WD3_DFLT_TIMEOUT, 21238c2ecf20Sopenharmony_ci }, 21248c2ecf20Sopenharmony_ci { 21258c2ecf20Sopenharmony_ci .label = "timeleft", 21268c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET, 21278c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_TYPE2_TO_MASK, 21288c2ecf20Sopenharmony_ci }, 21298c2ecf20Sopenharmony_ci { 21308c2ecf20Sopenharmony_ci .label = "ping", 21318c2ecf20Sopenharmony_ci .reg = MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET, 21328c2ecf20Sopenharmony_ci .mask = MLXPLAT_CPLD_WD_FAN_ACT_MASK, 21338c2ecf20Sopenharmony_ci .bit = 4, 21348c2ecf20Sopenharmony_ci }, 21358c2ecf20Sopenharmony_ci}; 21368c2ecf20Sopenharmony_ci 21378c2ecf20Sopenharmony_cistatic struct mlxreg_core_platform_data mlxplat_mlxcpld_wd_set_type3[] = { 21388c2ecf20Sopenharmony_ci { 21398c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_wd_main_regs_type3, 21408c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_wd_main_regs_type3), 21418c2ecf20Sopenharmony_ci .version = MLX_WDT_TYPE3, 21428c2ecf20Sopenharmony_ci .identity = "mlx-wdt-main", 21438c2ecf20Sopenharmony_ci }, 21448c2ecf20Sopenharmony_ci { 21458c2ecf20Sopenharmony_ci .data = mlxplat_mlxcpld_wd_aux_regs_type3, 21468c2ecf20Sopenharmony_ci .counter = ARRAY_SIZE(mlxplat_mlxcpld_wd_aux_regs_type3), 21478c2ecf20Sopenharmony_ci .version = MLX_WDT_TYPE3, 21488c2ecf20Sopenharmony_ci .identity = "mlx-wdt-aux", 21498c2ecf20Sopenharmony_ci }, 21508c2ecf20Sopenharmony_ci}; 21518c2ecf20Sopenharmony_ci 21528c2ecf20Sopenharmony_cistatic bool mlxplat_mlxcpld_writeable_reg(struct device *dev, unsigned int reg) 21538c2ecf20Sopenharmony_ci{ 21548c2ecf20Sopenharmony_ci switch (reg) { 21558c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_LED1_OFFSET: 21568c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_LED2_OFFSET: 21578c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_LED3_OFFSET: 21588c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_LED4_OFFSET: 21598c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_LED5_OFFSET: 21608c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_GP0_OFFSET: 21618c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_GP1_OFFSET: 21628c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WP1_OFFSET: 21638c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_GP2_OFFSET: 21648c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WP2_OFFSET: 21658c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGR_MASK_OFFSET: 21668c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGRLO_MASK_OFFSET: 21678c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGRCO_MASK_OFFSET: 21688c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGRCX_MASK_OFFSET: 21698c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_ASIC_EVENT_OFFSET: 21708c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_ASIC_MASK_OFFSET: 21718c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PSU_EVENT_OFFSET: 21728c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PSU_MASK_OFFSET: 21738c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PWR_EVENT_OFFSET: 21748c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PWR_MASK_OFFSET: 21758c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_EVENT_OFFSET: 21768c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_MASK_OFFSET: 21778c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD_CLEAR_OFFSET: 21788c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD_CLEAR_WP_OFFSET: 21798c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD1_TMR_OFFSET: 21808c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD1_ACT_OFFSET: 21818c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD2_TMR_OFFSET: 21828c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD2_TLEFT_OFFSET: 21838c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD2_ACT_OFFSET: 21848c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET: 21858c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET: 21868c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET: 21878c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PWM1_OFFSET: 21888c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET: 21898c2ecf20Sopenharmony_ci return true; 21908c2ecf20Sopenharmony_ci } 21918c2ecf20Sopenharmony_ci return false; 21928c2ecf20Sopenharmony_ci} 21938c2ecf20Sopenharmony_ci 21948c2ecf20Sopenharmony_cistatic bool mlxplat_mlxcpld_readable_reg(struct device *dev, unsigned int reg) 21958c2ecf20Sopenharmony_ci{ 21968c2ecf20Sopenharmony_ci switch (reg) { 21978c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD1_VER_OFFSET: 21988c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD2_VER_OFFSET: 21998c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD3_VER_OFFSET: 22008c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD4_VER_OFFSET: 22018c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD1_PN_OFFSET: 22028c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD2_PN_OFFSET: 22038c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD3_PN_OFFSET: 22048c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD4_PN_OFFSET: 22058c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET: 22068c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_RST_CAUSE1_OFFSET: 22078c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_RST_CAUSE2_OFFSET: 22088c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_LED1_OFFSET: 22098c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_LED2_OFFSET: 22108c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_LED3_OFFSET: 22118c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_LED4_OFFSET: 22128c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_LED5_OFFSET: 22138c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_DIRECTION: 22148c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_GP0_RO_OFFSET: 22158c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_GP0_OFFSET: 22168c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_GP1_OFFSET: 22178c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WP1_OFFSET: 22188c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_GP2_OFFSET: 22198c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WP2_OFFSET: 22208c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET: 22218c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGR_MASK_OFFSET: 22228c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET: 22238c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGRLO_MASK_OFFSET: 22248c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGRCO_OFFSET: 22258c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGRCO_MASK_OFFSET: 22268c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGRCX_OFFSET: 22278c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGRCX_MASK_OFFSET: 22288c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET: 22298c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_ASIC_EVENT_OFFSET: 22308c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_ASIC_MASK_OFFSET: 22318c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PSU_OFFSET: 22328c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PSU_EVENT_OFFSET: 22338c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PSU_MASK_OFFSET: 22348c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PWR_OFFSET: 22358c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PWR_EVENT_OFFSET: 22368c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PWR_MASK_OFFSET: 22378c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_OFFSET: 22388c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_EVENT_OFFSET: 22398c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_MASK_OFFSET: 22408c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD_CLEAR_OFFSET: 22418c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD_CLEAR_WP_OFFSET: 22428c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD1_TMR_OFFSET: 22438c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD1_ACT_OFFSET: 22448c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD2_TMR_OFFSET: 22458c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD2_TLEFT_OFFSET: 22468c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD2_ACT_OFFSET: 22478c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET: 22488c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET: 22498c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET: 22508c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD1_MVER_OFFSET: 22518c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD2_MVER_OFFSET: 22528c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD3_MVER_OFFSET: 22538c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD4_MVER_OFFSET: 22548c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PWM1_OFFSET: 22558c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO1_OFFSET: 22568c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO2_OFFSET: 22578c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO3_OFFSET: 22588c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO4_OFFSET: 22598c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO5_OFFSET: 22608c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO6_OFFSET: 22618c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO7_OFFSET: 22628c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO8_OFFSET: 22638c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO9_OFFSET: 22648c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO10_OFFSET: 22658c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO11_OFFSET: 22668c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO12_OFFSET: 22678c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET: 22688c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_CAP1_OFFSET: 22698c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_CAP2_OFFSET: 22708c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET: 22718c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO_SPEED_OFFSET: 22728c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET: 22738c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CONFIG1_OFFSET: 22748c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CONFIG2_OFFSET: 22758c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_UFM_VERSION_OFFSET: 22768c2ecf20Sopenharmony_ci return true; 22778c2ecf20Sopenharmony_ci } 22788c2ecf20Sopenharmony_ci return false; 22798c2ecf20Sopenharmony_ci} 22808c2ecf20Sopenharmony_ci 22818c2ecf20Sopenharmony_cistatic bool mlxplat_mlxcpld_volatile_reg(struct device *dev, unsigned int reg) 22828c2ecf20Sopenharmony_ci{ 22838c2ecf20Sopenharmony_ci switch (reg) { 22848c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD1_VER_OFFSET: 22858c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD2_VER_OFFSET: 22868c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD3_VER_OFFSET: 22878c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD4_VER_OFFSET: 22888c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD1_PN_OFFSET: 22898c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD2_PN_OFFSET: 22908c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD3_PN_OFFSET: 22918c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD4_PN_OFFSET: 22928c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET: 22938c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_RST_CAUSE1_OFFSET: 22948c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_RST_CAUSE2_OFFSET: 22958c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_LED1_OFFSET: 22968c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_LED2_OFFSET: 22978c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_LED3_OFFSET: 22988c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_LED4_OFFSET: 22998c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_LED5_OFFSET: 23008c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_DIRECTION: 23018c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_GP0_RO_OFFSET: 23028c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_GP0_OFFSET: 23038c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_GP1_OFFSET: 23048c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_GP2_OFFSET: 23058c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET: 23068c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGR_MASK_OFFSET: 23078c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET: 23088c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGRLO_MASK_OFFSET: 23098c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGRCO_OFFSET: 23108c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGRCO_MASK_OFFSET: 23118c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGRCX_OFFSET: 23128c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_AGGRCX_MASK_OFFSET: 23138c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET: 23148c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_ASIC_EVENT_OFFSET: 23158c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_ASIC_MASK_OFFSET: 23168c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PSU_OFFSET: 23178c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PSU_EVENT_OFFSET: 23188c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PSU_MASK_OFFSET: 23198c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PWR_OFFSET: 23208c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PWR_EVENT_OFFSET: 23218c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PWR_MASK_OFFSET: 23228c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_OFFSET: 23238c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_EVENT_OFFSET: 23248c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_MASK_OFFSET: 23258c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD2_TMR_OFFSET: 23268c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD2_TLEFT_OFFSET: 23278c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET: 23288c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET: 23298c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD1_MVER_OFFSET: 23308c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD2_MVER_OFFSET: 23318c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD3_MVER_OFFSET: 23328c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CPLD4_MVER_OFFSET: 23338c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PWM1_OFFSET: 23348c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO1_OFFSET: 23358c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO2_OFFSET: 23368c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO3_OFFSET: 23378c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO4_OFFSET: 23388c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO5_OFFSET: 23398c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO6_OFFSET: 23408c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO7_OFFSET: 23418c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO8_OFFSET: 23428c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO9_OFFSET: 23438c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO10_OFFSET: 23448c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO11_OFFSET: 23458c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO12_OFFSET: 23468c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET: 23478c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_CAP1_OFFSET: 23488c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_CAP2_OFFSET: 23498c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET: 23508c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_TACHO_SPEED_OFFSET: 23518c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET: 23528c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CONFIG1_OFFSET: 23538c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_CONFIG2_OFFSET: 23548c2ecf20Sopenharmony_ci case MLXPLAT_CPLD_LPC_REG_UFM_VERSION_OFFSET: 23558c2ecf20Sopenharmony_ci return true; 23568c2ecf20Sopenharmony_ci } 23578c2ecf20Sopenharmony_ci return false; 23588c2ecf20Sopenharmony_ci} 23598c2ecf20Sopenharmony_ci 23608c2ecf20Sopenharmony_cistatic const struct reg_default mlxplat_mlxcpld_regmap_default[] = { 23618c2ecf20Sopenharmony_ci { MLXPLAT_CPLD_LPC_REG_WP1_OFFSET, 0x00 }, 23628c2ecf20Sopenharmony_ci { MLXPLAT_CPLD_LPC_REG_WP2_OFFSET, 0x00 }, 23638c2ecf20Sopenharmony_ci { MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET, 0x00 }, 23648c2ecf20Sopenharmony_ci { MLXPLAT_CPLD_LPC_REG_WD_CLEAR_WP_OFFSET, 0x00 }, 23658c2ecf20Sopenharmony_ci}; 23668c2ecf20Sopenharmony_ci 23678c2ecf20Sopenharmony_cistatic const struct reg_default mlxplat_mlxcpld_regmap_ng[] = { 23688c2ecf20Sopenharmony_ci { MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET, 0x00 }, 23698c2ecf20Sopenharmony_ci { MLXPLAT_CPLD_LPC_REG_WD_CLEAR_WP_OFFSET, 0x00 }, 23708c2ecf20Sopenharmony_ci}; 23718c2ecf20Sopenharmony_ci 23728c2ecf20Sopenharmony_cistatic const struct reg_default mlxplat_mlxcpld_regmap_comex_default[] = { 23738c2ecf20Sopenharmony_ci { MLXPLAT_CPLD_LPC_REG_AGGRCX_MASK_OFFSET, 23748c2ecf20Sopenharmony_ci MLXPLAT_CPLD_LOW_AGGRCX_MASK }, 23758c2ecf20Sopenharmony_ci { MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET, 0x00 }, 23768c2ecf20Sopenharmony_ci}; 23778c2ecf20Sopenharmony_ci 23788c2ecf20Sopenharmony_cistatic const struct reg_default mlxplat_mlxcpld_regmap_ng400[] = { 23798c2ecf20Sopenharmony_ci { MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET, 0x00 }, 23808c2ecf20Sopenharmony_ci { MLXPLAT_CPLD_LPC_REG_WD1_ACT_OFFSET, 0x00 }, 23818c2ecf20Sopenharmony_ci { MLXPLAT_CPLD_LPC_REG_WD2_ACT_OFFSET, 0x00 }, 23828c2ecf20Sopenharmony_ci { MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET, 0x00 }, 23838c2ecf20Sopenharmony_ci}; 23848c2ecf20Sopenharmony_ci 23858c2ecf20Sopenharmony_cistruct mlxplat_mlxcpld_regmap_context { 23868c2ecf20Sopenharmony_ci void __iomem *base; 23878c2ecf20Sopenharmony_ci}; 23888c2ecf20Sopenharmony_ci 23898c2ecf20Sopenharmony_cistatic struct mlxplat_mlxcpld_regmap_context mlxplat_mlxcpld_regmap_ctx; 23908c2ecf20Sopenharmony_ci 23918c2ecf20Sopenharmony_cistatic int 23928c2ecf20Sopenharmony_cimlxplat_mlxcpld_reg_read(void *context, unsigned int reg, unsigned int *val) 23938c2ecf20Sopenharmony_ci{ 23948c2ecf20Sopenharmony_ci struct mlxplat_mlxcpld_regmap_context *ctx = context; 23958c2ecf20Sopenharmony_ci 23968c2ecf20Sopenharmony_ci *val = ioread8(ctx->base + reg); 23978c2ecf20Sopenharmony_ci return 0; 23988c2ecf20Sopenharmony_ci} 23998c2ecf20Sopenharmony_ci 24008c2ecf20Sopenharmony_cistatic int 24018c2ecf20Sopenharmony_cimlxplat_mlxcpld_reg_write(void *context, unsigned int reg, unsigned int val) 24028c2ecf20Sopenharmony_ci{ 24038c2ecf20Sopenharmony_ci struct mlxplat_mlxcpld_regmap_context *ctx = context; 24048c2ecf20Sopenharmony_ci 24058c2ecf20Sopenharmony_ci iowrite8(val, ctx->base + reg); 24068c2ecf20Sopenharmony_ci return 0; 24078c2ecf20Sopenharmony_ci} 24088c2ecf20Sopenharmony_ci 24098c2ecf20Sopenharmony_cistatic const struct regmap_config mlxplat_mlxcpld_regmap_config = { 24108c2ecf20Sopenharmony_ci .reg_bits = 8, 24118c2ecf20Sopenharmony_ci .val_bits = 8, 24128c2ecf20Sopenharmony_ci .max_register = 255, 24138c2ecf20Sopenharmony_ci .cache_type = REGCACHE_FLAT, 24148c2ecf20Sopenharmony_ci .writeable_reg = mlxplat_mlxcpld_writeable_reg, 24158c2ecf20Sopenharmony_ci .readable_reg = mlxplat_mlxcpld_readable_reg, 24168c2ecf20Sopenharmony_ci .volatile_reg = mlxplat_mlxcpld_volatile_reg, 24178c2ecf20Sopenharmony_ci .reg_defaults = mlxplat_mlxcpld_regmap_default, 24188c2ecf20Sopenharmony_ci .num_reg_defaults = ARRAY_SIZE(mlxplat_mlxcpld_regmap_default), 24198c2ecf20Sopenharmony_ci .reg_read = mlxplat_mlxcpld_reg_read, 24208c2ecf20Sopenharmony_ci .reg_write = mlxplat_mlxcpld_reg_write, 24218c2ecf20Sopenharmony_ci}; 24228c2ecf20Sopenharmony_ci 24238c2ecf20Sopenharmony_cistatic const struct regmap_config mlxplat_mlxcpld_regmap_config_ng = { 24248c2ecf20Sopenharmony_ci .reg_bits = 8, 24258c2ecf20Sopenharmony_ci .val_bits = 8, 24268c2ecf20Sopenharmony_ci .max_register = 255, 24278c2ecf20Sopenharmony_ci .cache_type = REGCACHE_FLAT, 24288c2ecf20Sopenharmony_ci .writeable_reg = mlxplat_mlxcpld_writeable_reg, 24298c2ecf20Sopenharmony_ci .readable_reg = mlxplat_mlxcpld_readable_reg, 24308c2ecf20Sopenharmony_ci .volatile_reg = mlxplat_mlxcpld_volatile_reg, 24318c2ecf20Sopenharmony_ci .reg_defaults = mlxplat_mlxcpld_regmap_ng, 24328c2ecf20Sopenharmony_ci .num_reg_defaults = ARRAY_SIZE(mlxplat_mlxcpld_regmap_ng), 24338c2ecf20Sopenharmony_ci .reg_read = mlxplat_mlxcpld_reg_read, 24348c2ecf20Sopenharmony_ci .reg_write = mlxplat_mlxcpld_reg_write, 24358c2ecf20Sopenharmony_ci}; 24368c2ecf20Sopenharmony_ci 24378c2ecf20Sopenharmony_cistatic const struct regmap_config mlxplat_mlxcpld_regmap_config_comex = { 24388c2ecf20Sopenharmony_ci .reg_bits = 8, 24398c2ecf20Sopenharmony_ci .val_bits = 8, 24408c2ecf20Sopenharmony_ci .max_register = 255, 24418c2ecf20Sopenharmony_ci .cache_type = REGCACHE_FLAT, 24428c2ecf20Sopenharmony_ci .writeable_reg = mlxplat_mlxcpld_writeable_reg, 24438c2ecf20Sopenharmony_ci .readable_reg = mlxplat_mlxcpld_readable_reg, 24448c2ecf20Sopenharmony_ci .volatile_reg = mlxplat_mlxcpld_volatile_reg, 24458c2ecf20Sopenharmony_ci .reg_defaults = mlxplat_mlxcpld_regmap_comex_default, 24468c2ecf20Sopenharmony_ci .num_reg_defaults = ARRAY_SIZE(mlxplat_mlxcpld_regmap_comex_default), 24478c2ecf20Sopenharmony_ci .reg_read = mlxplat_mlxcpld_reg_read, 24488c2ecf20Sopenharmony_ci .reg_write = mlxplat_mlxcpld_reg_write, 24498c2ecf20Sopenharmony_ci}; 24508c2ecf20Sopenharmony_ci 24518c2ecf20Sopenharmony_cistatic const struct regmap_config mlxplat_mlxcpld_regmap_config_ng400 = { 24528c2ecf20Sopenharmony_ci .reg_bits = 8, 24538c2ecf20Sopenharmony_ci .val_bits = 8, 24548c2ecf20Sopenharmony_ci .max_register = 255, 24558c2ecf20Sopenharmony_ci .cache_type = REGCACHE_FLAT, 24568c2ecf20Sopenharmony_ci .writeable_reg = mlxplat_mlxcpld_writeable_reg, 24578c2ecf20Sopenharmony_ci .readable_reg = mlxplat_mlxcpld_readable_reg, 24588c2ecf20Sopenharmony_ci .volatile_reg = mlxplat_mlxcpld_volatile_reg, 24598c2ecf20Sopenharmony_ci .reg_defaults = mlxplat_mlxcpld_regmap_ng400, 24608c2ecf20Sopenharmony_ci .num_reg_defaults = ARRAY_SIZE(mlxplat_mlxcpld_regmap_ng400), 24618c2ecf20Sopenharmony_ci .reg_read = mlxplat_mlxcpld_reg_read, 24628c2ecf20Sopenharmony_ci .reg_write = mlxplat_mlxcpld_reg_write, 24638c2ecf20Sopenharmony_ci}; 24648c2ecf20Sopenharmony_ci 24658c2ecf20Sopenharmony_cistatic struct resource mlxplat_mlxcpld_resources[] = { 24668c2ecf20Sopenharmony_ci [0] = DEFINE_RES_IRQ_NAMED(17, "mlxreg-hotplug"), 24678c2ecf20Sopenharmony_ci}; 24688c2ecf20Sopenharmony_ci 24698c2ecf20Sopenharmony_cistatic struct platform_device *mlxplat_dev; 24708c2ecf20Sopenharmony_cistatic struct mlxreg_core_hotplug_platform_data *mlxplat_i2c; 24718c2ecf20Sopenharmony_cistatic struct mlxreg_core_hotplug_platform_data *mlxplat_hotplug; 24728c2ecf20Sopenharmony_cistatic struct mlxreg_core_platform_data *mlxplat_led; 24738c2ecf20Sopenharmony_cistatic struct mlxreg_core_platform_data *mlxplat_regs_io; 24748c2ecf20Sopenharmony_cistatic struct mlxreg_core_platform_data *mlxplat_fan; 24758c2ecf20Sopenharmony_cistatic struct mlxreg_core_platform_data 24768c2ecf20Sopenharmony_ci *mlxplat_wd_data[MLXPLAT_CPLD_WD_MAX_DEVS]; 24778c2ecf20Sopenharmony_cistatic const struct regmap_config *mlxplat_regmap_config; 24788c2ecf20Sopenharmony_ci 24798c2ecf20Sopenharmony_cistatic int __init mlxplat_dmi_default_matched(const struct dmi_system_id *dmi) 24808c2ecf20Sopenharmony_ci{ 24818c2ecf20Sopenharmony_ci int i; 24828c2ecf20Sopenharmony_ci 24838c2ecf20Sopenharmony_ci mlxplat_max_adap_num = MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM; 24848c2ecf20Sopenharmony_ci mlxplat_mux_num = ARRAY_SIZE(mlxplat_default_mux_data); 24858c2ecf20Sopenharmony_ci mlxplat_mux_data = mlxplat_default_mux_data; 24868c2ecf20Sopenharmony_ci for (i = 0; i < mlxplat_mux_num; i++) { 24878c2ecf20Sopenharmony_ci mlxplat_mux_data[i].values = mlxplat_default_channels[i]; 24888c2ecf20Sopenharmony_ci mlxplat_mux_data[i].n_values = 24898c2ecf20Sopenharmony_ci ARRAY_SIZE(mlxplat_default_channels[i]); 24908c2ecf20Sopenharmony_ci } 24918c2ecf20Sopenharmony_ci mlxplat_hotplug = &mlxplat_mlxcpld_default_data; 24928c2ecf20Sopenharmony_ci mlxplat_hotplug->deferred_nr = 24938c2ecf20Sopenharmony_ci mlxplat_default_channels[i - 1][MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; 24948c2ecf20Sopenharmony_ci mlxplat_led = &mlxplat_default_led_data; 24958c2ecf20Sopenharmony_ci mlxplat_regs_io = &mlxplat_default_regs_io_data; 24968c2ecf20Sopenharmony_ci mlxplat_wd_data[0] = &mlxplat_mlxcpld_wd_set_type1[0]; 24978c2ecf20Sopenharmony_ci 24988c2ecf20Sopenharmony_ci return 1; 24998c2ecf20Sopenharmony_ci} 25008c2ecf20Sopenharmony_ci 25018c2ecf20Sopenharmony_cistatic int __init mlxplat_dmi_msn21xx_matched(const struct dmi_system_id *dmi) 25028c2ecf20Sopenharmony_ci{ 25038c2ecf20Sopenharmony_ci int i; 25048c2ecf20Sopenharmony_ci 25058c2ecf20Sopenharmony_ci mlxplat_max_adap_num = MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM; 25068c2ecf20Sopenharmony_ci mlxplat_mux_num = ARRAY_SIZE(mlxplat_default_mux_data); 25078c2ecf20Sopenharmony_ci mlxplat_mux_data = mlxplat_default_mux_data; 25088c2ecf20Sopenharmony_ci for (i = 0; i < mlxplat_mux_num; i++) { 25098c2ecf20Sopenharmony_ci mlxplat_mux_data[i].values = mlxplat_msn21xx_channels; 25108c2ecf20Sopenharmony_ci mlxplat_mux_data[i].n_values = 25118c2ecf20Sopenharmony_ci ARRAY_SIZE(mlxplat_msn21xx_channels); 25128c2ecf20Sopenharmony_ci } 25138c2ecf20Sopenharmony_ci mlxplat_hotplug = &mlxplat_mlxcpld_msn21xx_data; 25148c2ecf20Sopenharmony_ci mlxplat_hotplug->deferred_nr = 25158c2ecf20Sopenharmony_ci mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; 25168c2ecf20Sopenharmony_ci mlxplat_led = &mlxplat_msn21xx_led_data; 25178c2ecf20Sopenharmony_ci mlxplat_regs_io = &mlxplat_msn21xx_regs_io_data; 25188c2ecf20Sopenharmony_ci mlxplat_wd_data[0] = &mlxplat_mlxcpld_wd_set_type1[0]; 25198c2ecf20Sopenharmony_ci 25208c2ecf20Sopenharmony_ci return 1; 25218c2ecf20Sopenharmony_ci} 25228c2ecf20Sopenharmony_ci 25238c2ecf20Sopenharmony_cistatic int __init mlxplat_dmi_msn274x_matched(const struct dmi_system_id *dmi) 25248c2ecf20Sopenharmony_ci{ 25258c2ecf20Sopenharmony_ci int i; 25268c2ecf20Sopenharmony_ci 25278c2ecf20Sopenharmony_ci mlxplat_max_adap_num = MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM; 25288c2ecf20Sopenharmony_ci mlxplat_mux_num = ARRAY_SIZE(mlxplat_default_mux_data); 25298c2ecf20Sopenharmony_ci mlxplat_mux_data = mlxplat_default_mux_data; 25308c2ecf20Sopenharmony_ci for (i = 0; i < mlxplat_mux_num; i++) { 25318c2ecf20Sopenharmony_ci mlxplat_mux_data[i].values = mlxplat_msn21xx_channels; 25328c2ecf20Sopenharmony_ci mlxplat_mux_data[i].n_values = 25338c2ecf20Sopenharmony_ci ARRAY_SIZE(mlxplat_msn21xx_channels); 25348c2ecf20Sopenharmony_ci } 25358c2ecf20Sopenharmony_ci mlxplat_hotplug = &mlxplat_mlxcpld_msn274x_data; 25368c2ecf20Sopenharmony_ci mlxplat_hotplug->deferred_nr = 25378c2ecf20Sopenharmony_ci mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; 25388c2ecf20Sopenharmony_ci mlxplat_led = &mlxplat_default_led_data; 25398c2ecf20Sopenharmony_ci mlxplat_regs_io = &mlxplat_msn21xx_regs_io_data; 25408c2ecf20Sopenharmony_ci mlxplat_wd_data[0] = &mlxplat_mlxcpld_wd_set_type1[0]; 25418c2ecf20Sopenharmony_ci 25428c2ecf20Sopenharmony_ci return 1; 25438c2ecf20Sopenharmony_ci} 25448c2ecf20Sopenharmony_ci 25458c2ecf20Sopenharmony_cistatic int __init mlxplat_dmi_msn201x_matched(const struct dmi_system_id *dmi) 25468c2ecf20Sopenharmony_ci{ 25478c2ecf20Sopenharmony_ci int i; 25488c2ecf20Sopenharmony_ci 25498c2ecf20Sopenharmony_ci mlxplat_max_adap_num = MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM; 25508c2ecf20Sopenharmony_ci mlxplat_mux_num = ARRAY_SIZE(mlxplat_default_mux_data); 25518c2ecf20Sopenharmony_ci mlxplat_mux_data = mlxplat_default_mux_data; 25528c2ecf20Sopenharmony_ci for (i = 0; i < mlxplat_mux_num; i++) { 25538c2ecf20Sopenharmony_ci mlxplat_mux_data[i].values = mlxplat_msn21xx_channels; 25548c2ecf20Sopenharmony_ci mlxplat_mux_data[i].n_values = 25558c2ecf20Sopenharmony_ci ARRAY_SIZE(mlxplat_msn21xx_channels); 25568c2ecf20Sopenharmony_ci } 25578c2ecf20Sopenharmony_ci mlxplat_hotplug = &mlxplat_mlxcpld_msn201x_data; 25588c2ecf20Sopenharmony_ci mlxplat_hotplug->deferred_nr = 25598c2ecf20Sopenharmony_ci mlxplat_default_channels[i - 1][MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; 25608c2ecf20Sopenharmony_ci mlxplat_led = &mlxplat_msn21xx_led_data; 25618c2ecf20Sopenharmony_ci mlxplat_regs_io = &mlxplat_msn21xx_regs_io_data; 25628c2ecf20Sopenharmony_ci mlxplat_wd_data[0] = &mlxplat_mlxcpld_wd_set_type1[0]; 25638c2ecf20Sopenharmony_ci 25648c2ecf20Sopenharmony_ci return 1; 25658c2ecf20Sopenharmony_ci} 25668c2ecf20Sopenharmony_ci 25678c2ecf20Sopenharmony_cistatic int __init mlxplat_dmi_qmb7xx_matched(const struct dmi_system_id *dmi) 25688c2ecf20Sopenharmony_ci{ 25698c2ecf20Sopenharmony_ci int i; 25708c2ecf20Sopenharmony_ci 25718c2ecf20Sopenharmony_ci mlxplat_max_adap_num = MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM; 25728c2ecf20Sopenharmony_ci mlxplat_mux_num = ARRAY_SIZE(mlxplat_default_mux_data); 25738c2ecf20Sopenharmony_ci mlxplat_mux_data = mlxplat_default_mux_data; 25748c2ecf20Sopenharmony_ci for (i = 0; i < mlxplat_mux_num; i++) { 25758c2ecf20Sopenharmony_ci mlxplat_mux_data[i].values = mlxplat_msn21xx_channels; 25768c2ecf20Sopenharmony_ci mlxplat_mux_data[i].n_values = 25778c2ecf20Sopenharmony_ci ARRAY_SIZE(mlxplat_msn21xx_channels); 25788c2ecf20Sopenharmony_ci } 25798c2ecf20Sopenharmony_ci mlxplat_hotplug = &mlxplat_mlxcpld_default_ng_data; 25808c2ecf20Sopenharmony_ci mlxplat_hotplug->deferred_nr = 25818c2ecf20Sopenharmony_ci mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; 25828c2ecf20Sopenharmony_ci mlxplat_led = &mlxplat_default_ng_led_data; 25838c2ecf20Sopenharmony_ci mlxplat_regs_io = &mlxplat_default_ng_regs_io_data; 25848c2ecf20Sopenharmony_ci mlxplat_fan = &mlxplat_default_fan_data; 25858c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(mlxplat_mlxcpld_wd_set_type2); i++) 25868c2ecf20Sopenharmony_ci mlxplat_wd_data[i] = &mlxplat_mlxcpld_wd_set_type2[i]; 25878c2ecf20Sopenharmony_ci mlxplat_i2c = &mlxplat_mlxcpld_i2c_ng_data; 25888c2ecf20Sopenharmony_ci mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config_ng; 25898c2ecf20Sopenharmony_ci 25908c2ecf20Sopenharmony_ci return 1; 25918c2ecf20Sopenharmony_ci} 25928c2ecf20Sopenharmony_ci 25938c2ecf20Sopenharmony_cistatic int __init mlxplat_dmi_comex_matched(const struct dmi_system_id *dmi) 25948c2ecf20Sopenharmony_ci{ 25958c2ecf20Sopenharmony_ci int i; 25968c2ecf20Sopenharmony_ci 25978c2ecf20Sopenharmony_ci mlxplat_max_adap_num = MLXPLAT_CPLD_MAX_PHYS_EXT_ADAPTER_NUM; 25988c2ecf20Sopenharmony_ci mlxplat_mux_num = ARRAY_SIZE(mlxplat_extended_mux_data); 25998c2ecf20Sopenharmony_ci mlxplat_mux_data = mlxplat_extended_mux_data; 26008c2ecf20Sopenharmony_ci for (i = 0; i < mlxplat_mux_num; i++) { 26018c2ecf20Sopenharmony_ci mlxplat_mux_data[i].values = mlxplat_msn21xx_channels; 26028c2ecf20Sopenharmony_ci mlxplat_mux_data[i].n_values = 26038c2ecf20Sopenharmony_ci ARRAY_SIZE(mlxplat_msn21xx_channels); 26048c2ecf20Sopenharmony_ci } 26058c2ecf20Sopenharmony_ci mlxplat_hotplug = &mlxplat_mlxcpld_comex_data; 26068c2ecf20Sopenharmony_ci mlxplat_hotplug->deferred_nr = MLXPLAT_CPLD_MAX_PHYS_EXT_ADAPTER_NUM; 26078c2ecf20Sopenharmony_ci mlxplat_led = &mlxplat_comex_100G_led_data; 26088c2ecf20Sopenharmony_ci mlxplat_regs_io = &mlxplat_default_ng_regs_io_data; 26098c2ecf20Sopenharmony_ci mlxplat_fan = &mlxplat_default_fan_data; 26108c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(mlxplat_mlxcpld_wd_set_type2); i++) 26118c2ecf20Sopenharmony_ci mlxplat_wd_data[i] = &mlxplat_mlxcpld_wd_set_type2[i]; 26128c2ecf20Sopenharmony_ci mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config_comex; 26138c2ecf20Sopenharmony_ci 26148c2ecf20Sopenharmony_ci return 1; 26158c2ecf20Sopenharmony_ci} 26168c2ecf20Sopenharmony_ci 26178c2ecf20Sopenharmony_cistatic int __init mlxplat_dmi_ng400_matched(const struct dmi_system_id *dmi) 26188c2ecf20Sopenharmony_ci{ 26198c2ecf20Sopenharmony_ci int i; 26208c2ecf20Sopenharmony_ci 26218c2ecf20Sopenharmony_ci mlxplat_max_adap_num = MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM; 26228c2ecf20Sopenharmony_ci mlxplat_mux_num = ARRAY_SIZE(mlxplat_default_mux_data); 26238c2ecf20Sopenharmony_ci mlxplat_mux_data = mlxplat_default_mux_data; 26248c2ecf20Sopenharmony_ci for (i = 0; i < mlxplat_mux_num; i++) { 26258c2ecf20Sopenharmony_ci mlxplat_mux_data[i].values = mlxplat_msn21xx_channels; 26268c2ecf20Sopenharmony_ci mlxplat_mux_data[i].n_values = 26278c2ecf20Sopenharmony_ci ARRAY_SIZE(mlxplat_msn21xx_channels); 26288c2ecf20Sopenharmony_ci } 26298c2ecf20Sopenharmony_ci mlxplat_hotplug = &mlxplat_mlxcpld_ext_data; 26308c2ecf20Sopenharmony_ci mlxplat_hotplug->deferred_nr = 26318c2ecf20Sopenharmony_ci mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; 26328c2ecf20Sopenharmony_ci mlxplat_led = &mlxplat_default_ng_led_data; 26338c2ecf20Sopenharmony_ci mlxplat_regs_io = &mlxplat_default_ng_regs_io_data; 26348c2ecf20Sopenharmony_ci mlxplat_fan = &mlxplat_default_fan_data; 26358c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(mlxplat_mlxcpld_wd_set_type2); i++) 26368c2ecf20Sopenharmony_ci mlxplat_wd_data[i] = &mlxplat_mlxcpld_wd_set_type2[i]; 26378c2ecf20Sopenharmony_ci mlxplat_i2c = &mlxplat_mlxcpld_i2c_ng_data; 26388c2ecf20Sopenharmony_ci mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config_ng400; 26398c2ecf20Sopenharmony_ci 26408c2ecf20Sopenharmony_ci return 1; 26418c2ecf20Sopenharmony_ci} 26428c2ecf20Sopenharmony_ci 26438c2ecf20Sopenharmony_cistatic const struct dmi_system_id mlxplat_dmi_table[] __initconst = { 26448c2ecf20Sopenharmony_ci { 26458c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_default_matched, 26468c2ecf20Sopenharmony_ci .matches = { 26478c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "VMOD0001"), 26488c2ecf20Sopenharmony_ci }, 26498c2ecf20Sopenharmony_ci }, 26508c2ecf20Sopenharmony_ci { 26518c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_msn21xx_matched, 26528c2ecf20Sopenharmony_ci .matches = { 26538c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "VMOD0002"), 26548c2ecf20Sopenharmony_ci }, 26558c2ecf20Sopenharmony_ci }, 26568c2ecf20Sopenharmony_ci { 26578c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_msn274x_matched, 26588c2ecf20Sopenharmony_ci .matches = { 26598c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "VMOD0003"), 26608c2ecf20Sopenharmony_ci }, 26618c2ecf20Sopenharmony_ci }, 26628c2ecf20Sopenharmony_ci { 26638c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_msn201x_matched, 26648c2ecf20Sopenharmony_ci .matches = { 26658c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "VMOD0004"), 26668c2ecf20Sopenharmony_ci }, 26678c2ecf20Sopenharmony_ci }, 26688c2ecf20Sopenharmony_ci { 26698c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_qmb7xx_matched, 26708c2ecf20Sopenharmony_ci .matches = { 26718c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "VMOD0005"), 26728c2ecf20Sopenharmony_ci }, 26738c2ecf20Sopenharmony_ci }, 26748c2ecf20Sopenharmony_ci { 26758c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_qmb7xx_matched, 26768c2ecf20Sopenharmony_ci .matches = { 26778c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "VMOD0007"), 26788c2ecf20Sopenharmony_ci }, 26798c2ecf20Sopenharmony_ci }, 26808c2ecf20Sopenharmony_ci { 26818c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_comex_matched, 26828c2ecf20Sopenharmony_ci .matches = { 26838c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "VMOD0009"), 26848c2ecf20Sopenharmony_ci }, 26858c2ecf20Sopenharmony_ci }, 26868c2ecf20Sopenharmony_ci { 26878c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_ng400_matched, 26888c2ecf20Sopenharmony_ci .matches = { 26898c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_NAME, "VMOD0010"), 26908c2ecf20Sopenharmony_ci }, 26918c2ecf20Sopenharmony_ci }, 26928c2ecf20Sopenharmony_ci { 26938c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_msn274x_matched, 26948c2ecf20Sopenharmony_ci .matches = { 26958c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_VENDOR, "Mellanox Technologies"), 26968c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "MSN274"), 26978c2ecf20Sopenharmony_ci }, 26988c2ecf20Sopenharmony_ci }, 26998c2ecf20Sopenharmony_ci { 27008c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_default_matched, 27018c2ecf20Sopenharmony_ci .matches = { 27028c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_VENDOR, "Mellanox Technologies"), 27038c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "MSN24"), 27048c2ecf20Sopenharmony_ci }, 27058c2ecf20Sopenharmony_ci }, 27068c2ecf20Sopenharmony_ci { 27078c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_default_matched, 27088c2ecf20Sopenharmony_ci .matches = { 27098c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_VENDOR, "Mellanox Technologies"), 27108c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "MSN27"), 27118c2ecf20Sopenharmony_ci }, 27128c2ecf20Sopenharmony_ci }, 27138c2ecf20Sopenharmony_ci { 27148c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_default_matched, 27158c2ecf20Sopenharmony_ci .matches = { 27168c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_VENDOR, "Mellanox Technologies"), 27178c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "MSB"), 27188c2ecf20Sopenharmony_ci }, 27198c2ecf20Sopenharmony_ci }, 27208c2ecf20Sopenharmony_ci { 27218c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_default_matched, 27228c2ecf20Sopenharmony_ci .matches = { 27238c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_VENDOR, "Mellanox Technologies"), 27248c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "MSX"), 27258c2ecf20Sopenharmony_ci }, 27268c2ecf20Sopenharmony_ci }, 27278c2ecf20Sopenharmony_ci { 27288c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_msn21xx_matched, 27298c2ecf20Sopenharmony_ci .matches = { 27308c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_VENDOR, "Mellanox Technologies"), 27318c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "MSN21"), 27328c2ecf20Sopenharmony_ci }, 27338c2ecf20Sopenharmony_ci }, 27348c2ecf20Sopenharmony_ci { 27358c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_msn201x_matched, 27368c2ecf20Sopenharmony_ci .matches = { 27378c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_VENDOR, "Mellanox Technologies"), 27388c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "MSN201"), 27398c2ecf20Sopenharmony_ci }, 27408c2ecf20Sopenharmony_ci }, 27418c2ecf20Sopenharmony_ci { 27428c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_qmb7xx_matched, 27438c2ecf20Sopenharmony_ci .matches = { 27448c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_VENDOR, "Mellanox Technologies"), 27458c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "MQM87"), 27468c2ecf20Sopenharmony_ci }, 27478c2ecf20Sopenharmony_ci }, 27488c2ecf20Sopenharmony_ci { 27498c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_qmb7xx_matched, 27508c2ecf20Sopenharmony_ci .matches = { 27518c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_VENDOR, "Mellanox Technologies"), 27528c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "MSN37"), 27538c2ecf20Sopenharmony_ci }, 27548c2ecf20Sopenharmony_ci }, 27558c2ecf20Sopenharmony_ci { 27568c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_qmb7xx_matched, 27578c2ecf20Sopenharmony_ci .matches = { 27588c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_VENDOR, "Mellanox Technologies"), 27598c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "MSN34"), 27608c2ecf20Sopenharmony_ci }, 27618c2ecf20Sopenharmony_ci }, 27628c2ecf20Sopenharmony_ci { 27638c2ecf20Sopenharmony_ci .callback = mlxplat_dmi_qmb7xx_matched, 27648c2ecf20Sopenharmony_ci .matches = { 27658c2ecf20Sopenharmony_ci DMI_MATCH(DMI_BOARD_VENDOR, "Mellanox Technologies"), 27668c2ecf20Sopenharmony_ci DMI_MATCH(DMI_PRODUCT_NAME, "MSN38"), 27678c2ecf20Sopenharmony_ci }, 27688c2ecf20Sopenharmony_ci }, 27698c2ecf20Sopenharmony_ci { } 27708c2ecf20Sopenharmony_ci}; 27718c2ecf20Sopenharmony_ci 27728c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(dmi, mlxplat_dmi_table); 27738c2ecf20Sopenharmony_ci 27748c2ecf20Sopenharmony_cistatic int mlxplat_mlxcpld_verify_bus_topology(int *nr) 27758c2ecf20Sopenharmony_ci{ 27768c2ecf20Sopenharmony_ci struct i2c_adapter *search_adap; 27778c2ecf20Sopenharmony_ci int shift, i; 27788c2ecf20Sopenharmony_ci 27798c2ecf20Sopenharmony_ci /* Scan adapters from expected id to verify it is free. */ 27808c2ecf20Sopenharmony_ci *nr = MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR; 27818c2ecf20Sopenharmony_ci for (i = MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR; i < 27828c2ecf20Sopenharmony_ci mlxplat_max_adap_num; i++) { 27838c2ecf20Sopenharmony_ci search_adap = i2c_get_adapter(i); 27848c2ecf20Sopenharmony_ci if (search_adap) { 27858c2ecf20Sopenharmony_ci i2c_put_adapter(search_adap); 27868c2ecf20Sopenharmony_ci continue; 27878c2ecf20Sopenharmony_ci } 27888c2ecf20Sopenharmony_ci 27898c2ecf20Sopenharmony_ci /* Return if expected parent adapter is free. */ 27908c2ecf20Sopenharmony_ci if (i == MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR) 27918c2ecf20Sopenharmony_ci return 0; 27928c2ecf20Sopenharmony_ci break; 27938c2ecf20Sopenharmony_ci } 27948c2ecf20Sopenharmony_ci 27958c2ecf20Sopenharmony_ci /* Return with error if free id for adapter is not found. */ 27968c2ecf20Sopenharmony_ci if (i == mlxplat_max_adap_num) 27978c2ecf20Sopenharmony_ci return -ENODEV; 27988c2ecf20Sopenharmony_ci 27998c2ecf20Sopenharmony_ci /* Shift adapter ids, since expected parent adapter is not free. */ 28008c2ecf20Sopenharmony_ci *nr = i; 28018c2ecf20Sopenharmony_ci for (i = 0; i < mlxplat_mux_num; i++) { 28028c2ecf20Sopenharmony_ci shift = *nr - mlxplat_mux_data[i].parent; 28038c2ecf20Sopenharmony_ci mlxplat_mux_data[i].parent = *nr; 28048c2ecf20Sopenharmony_ci mlxplat_mux_data[i].base_nr += shift; 28058c2ecf20Sopenharmony_ci if (shift > 0) 28068c2ecf20Sopenharmony_ci mlxplat_hotplug->shift_nr = shift; 28078c2ecf20Sopenharmony_ci } 28088c2ecf20Sopenharmony_ci 28098c2ecf20Sopenharmony_ci return 0; 28108c2ecf20Sopenharmony_ci} 28118c2ecf20Sopenharmony_ci 28128c2ecf20Sopenharmony_cistatic int mlxplat_mlxcpld_check_wd_capability(void *regmap) 28138c2ecf20Sopenharmony_ci{ 28148c2ecf20Sopenharmony_ci u32 regval; 28158c2ecf20Sopenharmony_ci int i, rc; 28168c2ecf20Sopenharmony_ci 28178c2ecf20Sopenharmony_ci rc = regmap_read(regmap, MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET, 28188c2ecf20Sopenharmony_ci ®val); 28198c2ecf20Sopenharmony_ci if (rc) 28208c2ecf20Sopenharmony_ci return rc; 28218c2ecf20Sopenharmony_ci 28228c2ecf20Sopenharmony_ci if (!(regval & ~MLXPLAT_CPLD_WD_CPBLTY_MASK)) { 28238c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(mlxplat_mlxcpld_wd_set_type3); i++) { 28248c2ecf20Sopenharmony_ci if (mlxplat_wd_data[i]) 28258c2ecf20Sopenharmony_ci mlxplat_wd_data[i] = 28268c2ecf20Sopenharmony_ci &mlxplat_mlxcpld_wd_set_type3[i]; 28278c2ecf20Sopenharmony_ci } 28288c2ecf20Sopenharmony_ci } 28298c2ecf20Sopenharmony_ci 28308c2ecf20Sopenharmony_ci return 0; 28318c2ecf20Sopenharmony_ci} 28328c2ecf20Sopenharmony_ci 28338c2ecf20Sopenharmony_cistatic int __init mlxplat_init(void) 28348c2ecf20Sopenharmony_ci{ 28358c2ecf20Sopenharmony_ci struct mlxplat_priv *priv; 28368c2ecf20Sopenharmony_ci int i, j, nr, err; 28378c2ecf20Sopenharmony_ci 28388c2ecf20Sopenharmony_ci if (!dmi_check_system(mlxplat_dmi_table)) 28398c2ecf20Sopenharmony_ci return -ENODEV; 28408c2ecf20Sopenharmony_ci 28418c2ecf20Sopenharmony_ci mlxplat_dev = platform_device_register_simple(MLX_PLAT_DEVICE_NAME, -1, 28428c2ecf20Sopenharmony_ci mlxplat_lpc_resources, 28438c2ecf20Sopenharmony_ci ARRAY_SIZE(mlxplat_lpc_resources)); 28448c2ecf20Sopenharmony_ci 28458c2ecf20Sopenharmony_ci if (IS_ERR(mlxplat_dev)) 28468c2ecf20Sopenharmony_ci return PTR_ERR(mlxplat_dev); 28478c2ecf20Sopenharmony_ci 28488c2ecf20Sopenharmony_ci priv = devm_kzalloc(&mlxplat_dev->dev, sizeof(struct mlxplat_priv), 28498c2ecf20Sopenharmony_ci GFP_KERNEL); 28508c2ecf20Sopenharmony_ci if (!priv) { 28518c2ecf20Sopenharmony_ci err = -ENOMEM; 28528c2ecf20Sopenharmony_ci goto fail_alloc; 28538c2ecf20Sopenharmony_ci } 28548c2ecf20Sopenharmony_ci platform_set_drvdata(mlxplat_dev, priv); 28558c2ecf20Sopenharmony_ci 28568c2ecf20Sopenharmony_ci mlxplat_mlxcpld_regmap_ctx.base = devm_ioport_map(&mlxplat_dev->dev, 28578c2ecf20Sopenharmony_ci mlxplat_lpc_resources[1].start, 1); 28588c2ecf20Sopenharmony_ci if (!mlxplat_mlxcpld_regmap_ctx.base) { 28598c2ecf20Sopenharmony_ci err = -ENOMEM; 28608c2ecf20Sopenharmony_ci goto fail_alloc; 28618c2ecf20Sopenharmony_ci } 28628c2ecf20Sopenharmony_ci 28638c2ecf20Sopenharmony_ci if (!mlxplat_regmap_config) 28648c2ecf20Sopenharmony_ci mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config; 28658c2ecf20Sopenharmony_ci 28668c2ecf20Sopenharmony_ci priv->regmap = devm_regmap_init(&mlxplat_dev->dev, NULL, 28678c2ecf20Sopenharmony_ci &mlxplat_mlxcpld_regmap_ctx, 28688c2ecf20Sopenharmony_ci mlxplat_regmap_config); 28698c2ecf20Sopenharmony_ci if (IS_ERR(priv->regmap)) { 28708c2ecf20Sopenharmony_ci err = PTR_ERR(priv->regmap); 28718c2ecf20Sopenharmony_ci goto fail_alloc; 28728c2ecf20Sopenharmony_ci } 28738c2ecf20Sopenharmony_ci 28748c2ecf20Sopenharmony_ci err = mlxplat_mlxcpld_verify_bus_topology(&nr); 28758c2ecf20Sopenharmony_ci if (nr < 0) 28768c2ecf20Sopenharmony_ci goto fail_alloc; 28778c2ecf20Sopenharmony_ci 28788c2ecf20Sopenharmony_ci nr = (nr == mlxplat_max_adap_num) ? -1 : nr; 28798c2ecf20Sopenharmony_ci if (mlxplat_i2c) 28808c2ecf20Sopenharmony_ci mlxplat_i2c->regmap = priv->regmap; 28818c2ecf20Sopenharmony_ci priv->pdev_i2c = platform_device_register_resndata( 28828c2ecf20Sopenharmony_ci &mlxplat_dev->dev, "i2c_mlxcpld", 28838c2ecf20Sopenharmony_ci nr, mlxplat_mlxcpld_resources, 28848c2ecf20Sopenharmony_ci ARRAY_SIZE(mlxplat_mlxcpld_resources), 28858c2ecf20Sopenharmony_ci mlxplat_i2c, sizeof(*mlxplat_i2c)); 28868c2ecf20Sopenharmony_ci if (IS_ERR(priv->pdev_i2c)) { 28878c2ecf20Sopenharmony_ci err = PTR_ERR(priv->pdev_i2c); 28888c2ecf20Sopenharmony_ci goto fail_alloc; 28898c2ecf20Sopenharmony_ci } 28908c2ecf20Sopenharmony_ci 28918c2ecf20Sopenharmony_ci for (i = 0; i < mlxplat_mux_num; i++) { 28928c2ecf20Sopenharmony_ci priv->pdev_mux[i] = platform_device_register_resndata( 28938c2ecf20Sopenharmony_ci &priv->pdev_i2c->dev, 28948c2ecf20Sopenharmony_ci "i2c-mux-reg", i, NULL, 28958c2ecf20Sopenharmony_ci 0, &mlxplat_mux_data[i], 28968c2ecf20Sopenharmony_ci sizeof(mlxplat_mux_data[i])); 28978c2ecf20Sopenharmony_ci if (IS_ERR(priv->pdev_mux[i])) { 28988c2ecf20Sopenharmony_ci err = PTR_ERR(priv->pdev_mux[i]); 28998c2ecf20Sopenharmony_ci goto fail_platform_mux_register; 29008c2ecf20Sopenharmony_ci } 29018c2ecf20Sopenharmony_ci } 29028c2ecf20Sopenharmony_ci 29038c2ecf20Sopenharmony_ci /* Add hotplug driver */ 29048c2ecf20Sopenharmony_ci mlxplat_hotplug->regmap = priv->regmap; 29058c2ecf20Sopenharmony_ci priv->pdev_hotplug = platform_device_register_resndata( 29068c2ecf20Sopenharmony_ci &mlxplat_dev->dev, "mlxreg-hotplug", 29078c2ecf20Sopenharmony_ci PLATFORM_DEVID_NONE, 29088c2ecf20Sopenharmony_ci mlxplat_mlxcpld_resources, 29098c2ecf20Sopenharmony_ci ARRAY_SIZE(mlxplat_mlxcpld_resources), 29108c2ecf20Sopenharmony_ci mlxplat_hotplug, sizeof(*mlxplat_hotplug)); 29118c2ecf20Sopenharmony_ci if (IS_ERR(priv->pdev_hotplug)) { 29128c2ecf20Sopenharmony_ci err = PTR_ERR(priv->pdev_hotplug); 29138c2ecf20Sopenharmony_ci goto fail_platform_mux_register; 29148c2ecf20Sopenharmony_ci } 29158c2ecf20Sopenharmony_ci 29168c2ecf20Sopenharmony_ci /* Set default registers. */ 29178c2ecf20Sopenharmony_ci for (j = 0; j < mlxplat_regmap_config->num_reg_defaults; j++) { 29188c2ecf20Sopenharmony_ci err = regmap_write(priv->regmap, 29198c2ecf20Sopenharmony_ci mlxplat_regmap_config->reg_defaults[j].reg, 29208c2ecf20Sopenharmony_ci mlxplat_regmap_config->reg_defaults[j].def); 29218c2ecf20Sopenharmony_ci if (err) 29228c2ecf20Sopenharmony_ci goto fail_platform_mux_register; 29238c2ecf20Sopenharmony_ci } 29248c2ecf20Sopenharmony_ci 29258c2ecf20Sopenharmony_ci /* Add LED driver. */ 29268c2ecf20Sopenharmony_ci mlxplat_led->regmap = priv->regmap; 29278c2ecf20Sopenharmony_ci priv->pdev_led = platform_device_register_resndata( 29288c2ecf20Sopenharmony_ci &mlxplat_dev->dev, "leds-mlxreg", 29298c2ecf20Sopenharmony_ci PLATFORM_DEVID_NONE, NULL, 0, 29308c2ecf20Sopenharmony_ci mlxplat_led, sizeof(*mlxplat_led)); 29318c2ecf20Sopenharmony_ci if (IS_ERR(priv->pdev_led)) { 29328c2ecf20Sopenharmony_ci err = PTR_ERR(priv->pdev_led); 29338c2ecf20Sopenharmony_ci goto fail_platform_hotplug_register; 29348c2ecf20Sopenharmony_ci } 29358c2ecf20Sopenharmony_ci 29368c2ecf20Sopenharmony_ci /* Add registers io access driver. */ 29378c2ecf20Sopenharmony_ci if (mlxplat_regs_io) { 29388c2ecf20Sopenharmony_ci mlxplat_regs_io->regmap = priv->regmap; 29398c2ecf20Sopenharmony_ci priv->pdev_io_regs = platform_device_register_resndata( 29408c2ecf20Sopenharmony_ci &mlxplat_dev->dev, "mlxreg-io", 29418c2ecf20Sopenharmony_ci PLATFORM_DEVID_NONE, NULL, 0, 29428c2ecf20Sopenharmony_ci mlxplat_regs_io, 29438c2ecf20Sopenharmony_ci sizeof(*mlxplat_regs_io)); 29448c2ecf20Sopenharmony_ci if (IS_ERR(priv->pdev_io_regs)) { 29458c2ecf20Sopenharmony_ci err = PTR_ERR(priv->pdev_io_regs); 29468c2ecf20Sopenharmony_ci goto fail_platform_led_register; 29478c2ecf20Sopenharmony_ci } 29488c2ecf20Sopenharmony_ci } 29498c2ecf20Sopenharmony_ci 29508c2ecf20Sopenharmony_ci /* Add FAN driver. */ 29518c2ecf20Sopenharmony_ci if (mlxplat_fan) { 29528c2ecf20Sopenharmony_ci mlxplat_fan->regmap = priv->regmap; 29538c2ecf20Sopenharmony_ci priv->pdev_fan = platform_device_register_resndata( 29548c2ecf20Sopenharmony_ci &mlxplat_dev->dev, "mlxreg-fan", 29558c2ecf20Sopenharmony_ci PLATFORM_DEVID_NONE, NULL, 0, 29568c2ecf20Sopenharmony_ci mlxplat_fan, 29578c2ecf20Sopenharmony_ci sizeof(*mlxplat_fan)); 29588c2ecf20Sopenharmony_ci if (IS_ERR(priv->pdev_fan)) { 29598c2ecf20Sopenharmony_ci err = PTR_ERR(priv->pdev_fan); 29608c2ecf20Sopenharmony_ci goto fail_platform_io_regs_register; 29618c2ecf20Sopenharmony_ci } 29628c2ecf20Sopenharmony_ci } 29638c2ecf20Sopenharmony_ci 29648c2ecf20Sopenharmony_ci /* Add WD drivers. */ 29658c2ecf20Sopenharmony_ci err = mlxplat_mlxcpld_check_wd_capability(priv->regmap); 29668c2ecf20Sopenharmony_ci if (err) 29678c2ecf20Sopenharmony_ci goto fail_platform_wd_register; 29688c2ecf20Sopenharmony_ci for (j = 0; j < MLXPLAT_CPLD_WD_MAX_DEVS; j++) { 29698c2ecf20Sopenharmony_ci if (mlxplat_wd_data[j]) { 29708c2ecf20Sopenharmony_ci mlxplat_wd_data[j]->regmap = priv->regmap; 29718c2ecf20Sopenharmony_ci priv->pdev_wd[j] = platform_device_register_resndata( 29728c2ecf20Sopenharmony_ci &mlxplat_dev->dev, "mlx-wdt", 29738c2ecf20Sopenharmony_ci j, NULL, 0, 29748c2ecf20Sopenharmony_ci mlxplat_wd_data[j], 29758c2ecf20Sopenharmony_ci sizeof(*mlxplat_wd_data[j])); 29768c2ecf20Sopenharmony_ci if (IS_ERR(priv->pdev_wd[j])) { 29778c2ecf20Sopenharmony_ci err = PTR_ERR(priv->pdev_wd[j]); 29788c2ecf20Sopenharmony_ci goto fail_platform_wd_register; 29798c2ecf20Sopenharmony_ci } 29808c2ecf20Sopenharmony_ci } 29818c2ecf20Sopenharmony_ci } 29828c2ecf20Sopenharmony_ci 29838c2ecf20Sopenharmony_ci /* Sync registers with hardware. */ 29848c2ecf20Sopenharmony_ci regcache_mark_dirty(priv->regmap); 29858c2ecf20Sopenharmony_ci err = regcache_sync(priv->regmap); 29868c2ecf20Sopenharmony_ci if (err) 29878c2ecf20Sopenharmony_ci goto fail_platform_wd_register; 29888c2ecf20Sopenharmony_ci 29898c2ecf20Sopenharmony_ci return 0; 29908c2ecf20Sopenharmony_ci 29918c2ecf20Sopenharmony_cifail_platform_wd_register: 29928c2ecf20Sopenharmony_ci while (--j >= 0) 29938c2ecf20Sopenharmony_ci platform_device_unregister(priv->pdev_wd[j]); 29948c2ecf20Sopenharmony_ci if (mlxplat_fan) 29958c2ecf20Sopenharmony_ci platform_device_unregister(priv->pdev_fan); 29968c2ecf20Sopenharmony_cifail_platform_io_regs_register: 29978c2ecf20Sopenharmony_ci if (mlxplat_regs_io) 29988c2ecf20Sopenharmony_ci platform_device_unregister(priv->pdev_io_regs); 29998c2ecf20Sopenharmony_cifail_platform_led_register: 30008c2ecf20Sopenharmony_ci platform_device_unregister(priv->pdev_led); 30018c2ecf20Sopenharmony_cifail_platform_hotplug_register: 30028c2ecf20Sopenharmony_ci platform_device_unregister(priv->pdev_hotplug); 30038c2ecf20Sopenharmony_cifail_platform_mux_register: 30048c2ecf20Sopenharmony_ci while (--i >= 0) 30058c2ecf20Sopenharmony_ci platform_device_unregister(priv->pdev_mux[i]); 30068c2ecf20Sopenharmony_ci platform_device_unregister(priv->pdev_i2c); 30078c2ecf20Sopenharmony_cifail_alloc: 30088c2ecf20Sopenharmony_ci platform_device_unregister(mlxplat_dev); 30098c2ecf20Sopenharmony_ci 30108c2ecf20Sopenharmony_ci return err; 30118c2ecf20Sopenharmony_ci} 30128c2ecf20Sopenharmony_cimodule_init(mlxplat_init); 30138c2ecf20Sopenharmony_ci 30148c2ecf20Sopenharmony_cistatic void __exit mlxplat_exit(void) 30158c2ecf20Sopenharmony_ci{ 30168c2ecf20Sopenharmony_ci struct mlxplat_priv *priv = platform_get_drvdata(mlxplat_dev); 30178c2ecf20Sopenharmony_ci int i; 30188c2ecf20Sopenharmony_ci 30198c2ecf20Sopenharmony_ci for (i = MLXPLAT_CPLD_WD_MAX_DEVS - 1; i >= 0 ; i--) 30208c2ecf20Sopenharmony_ci platform_device_unregister(priv->pdev_wd[i]); 30218c2ecf20Sopenharmony_ci if (priv->pdev_fan) 30228c2ecf20Sopenharmony_ci platform_device_unregister(priv->pdev_fan); 30238c2ecf20Sopenharmony_ci if (priv->pdev_io_regs) 30248c2ecf20Sopenharmony_ci platform_device_unregister(priv->pdev_io_regs); 30258c2ecf20Sopenharmony_ci platform_device_unregister(priv->pdev_led); 30268c2ecf20Sopenharmony_ci platform_device_unregister(priv->pdev_hotplug); 30278c2ecf20Sopenharmony_ci 30288c2ecf20Sopenharmony_ci for (i = mlxplat_mux_num - 1; i >= 0 ; i--) 30298c2ecf20Sopenharmony_ci platform_device_unregister(priv->pdev_mux[i]); 30308c2ecf20Sopenharmony_ci 30318c2ecf20Sopenharmony_ci platform_device_unregister(priv->pdev_i2c); 30328c2ecf20Sopenharmony_ci platform_device_unregister(mlxplat_dev); 30338c2ecf20Sopenharmony_ci} 30348c2ecf20Sopenharmony_cimodule_exit(mlxplat_exit); 30358c2ecf20Sopenharmony_ci 30368c2ecf20Sopenharmony_ciMODULE_AUTHOR("Vadim Pasternak (vadimp@mellanox.com)"); 30378c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("Mellanox platform driver"); 30388c2ecf20Sopenharmony_ciMODULE_LICENSE("Dual BSD/GPL"); 3039