Lines Matching +full:gbe +full:- +full:50

1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
5 * Copyright (C) 2016-2018 Mellanox Technologies
6 * Copyright (C) 2016-2018 Vadim Pasternak <vadimp@mellanox.com>
12 #include <linux/i2c-mux.h>
17 #include <linux/platform_data/i2c-mux-reg.h>
330 #define MLXPLAT_CPLD_NR_NONE -1
364 #define MLXPLAT_CPLD_ETH_MODULAR_PWR_MIN 50
378 /* mlxplat_priv - platform private data
379 * @pdev_i2c - i2c controller platform device
380 * @pdev_mux - array of mux platform devices
381 * @pdev_hotplug - hotplug platform devices
382 * @pdev_led - led platform devices
383 * @pdev_io_regs - register access platform devices
384 * @pdev_fan - FAN platform devices
385 * @pdev_wd - array of watchdog platform devices
386 * pdev_dpu - array of Data Processor Unit platform devices
1510 I2C_BOARD_INFO("mlxreg-lc", MLXPLAT_CPLD_LC_ADDR),
1514 I2C_BOARD_INFO("mlxreg-lc", MLXPLAT_CPLD_LC_ADDR),
1518 I2C_BOARD_INFO("mlxreg-lc", MLXPLAT_CPLD_LC_ADDR),
1522 I2C_BOARD_INFO("mlxreg-lc", MLXPLAT_CPLD_LC_ADDR),
1526 I2C_BOARD_INFO("mlxreg-lc", MLXPLAT_CPLD_LC_ADDR),
1530 I2C_BOARD_INFO("mlxreg-lc", MLXPLAT_CPLD_LC_ADDR),
1534 I2C_BOARD_INFO("mlxreg-lc", MLXPLAT_CPLD_LC_ADDR),
1538 I2C_BOARD_INFO("mlxreg-lc", MLXPLAT_CPLD_LC_ADDR),
2804 I2C_BOARD_INFO("mlxreg-dpu", MLXPLAT_CPLD_DPU_ADDR),
2808 I2C_BOARD_INFO("mlxreg-dpu", MLXPLAT_CPLD_DPU_ADDR),
2812 I2C_BOARD_INFO("mlxreg-dpu", MLXPLAT_CPLD_DPU_ADDR),
2816 I2C_BOARD_INFO("mlxreg-dpu", MLXPLAT_CPLD_DPU_ADDR),
2854 dev_info(&mlxplat_dev->dev, "System shutdown due to short press of power button"); in mlxplat_mlxcpld_l1_switch_pwr_events_handler()
2886 err = regmap_read(priv->regmap, MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, &regval); in mlxplat_mlxcpld_l1_switch_intrusion_events_handler()
2891 dev_info(&mlxplat_dev->dev, "Detected intrusion - system latch is opened"); in mlxplat_mlxcpld_l1_switch_intrusion_events_handler()
2892 err = regmap_write(priv->regmap, MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, in mlxplat_mlxcpld_l1_switch_intrusion_events_handler()
2895 dev_info(&mlxplat_dev->dev, "System latch is properly closed"); in mlxplat_mlxcpld_l1_switch_intrusion_events_handler()
2896 err = regmap_write(priv->regmap, MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, in mlxplat_mlxcpld_l1_switch_intrusion_events_handler()
2907 dev_err(&mlxplat_dev->dev, "Register access failed"); in mlxplat_mlxcpld_l1_switch_intrusion_events_handler()
3227 /* Platform led for default data for 200GbE systems */
3359 /* Platform led for Comex based 100GbE systems */
6171 .identity = "mlx-wdt-main",
6177 .identity = "mlx-wdt-aux",
6247 .identity = "mlx-wdt-main",
6253 .identity = "mlx-wdt-aux",
6325 .identity = "mlx-wdt-main",
6331 .identity = "mlx-wdt-aux",
6855 *val = ioread8(ctx->base + reg); in mlxplat_mlxcpld_reg_read()
6864 iowrite8(val, ctx->base + reg); in mlxplat_mlxcpld_reg_write()
6967 [0] = DEFINE_RES_IRQ_NAMED(MLXPLAT_CPLD_LPC_SYSIRQ, "mlxreg-hotplug"),
6990 ret = regmap_read(priv->regmap, MLXPLAT_CPLD_LPC_REG_RESET_GP1_OFFSET, &regval); in mlxplat_reboot_notifier()
6993 regmap_write(priv->regmap, MLXPLAT_CPLD_LPC_REG_RESET_GP1_OFFSET, in mlxplat_reboot_notifier()
7010 regmap_write(priv->regmap, MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, MLXPLAT_CPLD_HALT_MASK); in mlxplat_poweroff()
7016 mlxplat_dev = platform_device_register_simple(MLX_PLAT_DEVICE_NAME, -1, in mlxplat_register_platform_device()
7038 mlxplat_hotplug->deferred_nr = in mlxplat_dmi_default_matched()
7039 mlxplat_default_channels[i - 1][MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; in mlxplat_dmi_default_matched()
7061 mlxplat_hotplug->deferred_nr = in mlxplat_dmi_default_wc_matched()
7062 mlxplat_default_channels[i - 1][MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; in mlxplat_dmi_default_wc_matched()
7084 mlxplat_hotplug->deferred_nr = in mlxplat_dmi_default_eth_wc_blade_matched()
7085 mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; in mlxplat_dmi_default_eth_wc_blade_matched()
7109 mlxplat_hotplug->deferred_nr = in mlxplat_dmi_msn21xx_matched()
7110 mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; in mlxplat_dmi_msn21xx_matched()
7132 mlxplat_hotplug->deferred_nr = in mlxplat_dmi_msn274x_matched()
7133 mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; in mlxplat_dmi_msn274x_matched()
7155 mlxplat_hotplug->deferred_nr = in mlxplat_dmi_msn201x_matched()
7156 mlxplat_default_channels[i - 1][MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; in mlxplat_dmi_msn201x_matched()
7178 mlxplat_hotplug->deferred_nr = in mlxplat_dmi_qmb7xx_matched()
7179 mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; in mlxplat_dmi_qmb7xx_matched()
7204 mlxplat_hotplug->deferred_nr = MLXPLAT_CPLD_MAX_PHYS_EXT_ADAPTER_NUM; in mlxplat_dmi_comex_matched()
7229 mlxplat_hotplug->deferred_nr = in mlxplat_dmi_ng400_matched()
7230 mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; in mlxplat_dmi_ng400_matched()
7250 mlxplat_hotplug->deferred_nr = MLXPLAT_CPLD_CH4_ETH_MODULAR; in mlxplat_dmi_modular_matched()
7270 mlxplat_hotplug->deferred_nr = in mlxplat_dmi_chassis_blade_matched()
7271 mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; in mlxplat_dmi_chassis_blade_matched()
7292 mlxplat_hotplug->deferred_nr = in mlxplat_dmi_rack_switch_matched()
7293 mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; in mlxplat_dmi_rack_switch_matched()
7313 mlxplat_hotplug->deferred_nr = in mlxplat_dmi_ng800_matched()
7314 mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; in mlxplat_dmi_ng800_matched()
7334 mlxplat_hotplug->deferred_nr = in mlxplat_dmi_l1_switch_matched()
7335 mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; in mlxplat_dmi_l1_switch_matched()
7357 mlxplat_hotplug->deferred_nr = in mlxplat_dmi_smart_switch_matched()
7358 mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; in mlxplat_dmi_smart_switch_matched()
7382 mlxplat_hotplug->deferred_nr = in mlxplat_dmi_ng400_hi171_matched()
7383 mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; in mlxplat_dmi_ng400_hi171_matched()
7616 return -ENODEV; in mlxplat_mlxcpld_verify_bus_topology()
7621 shift = *nr - mlxplat_mux_data[i].parent; in mlxplat_mlxcpld_verify_bus_topology()
7627 mlxplat_hotplug->shift_nr = shift; in mlxplat_mlxcpld_verify_bus_topology()
7658 mlxplat_mlxcpld_regmap_ctx.base = devm_ioport_map(&mlxplat_dev->dev, in mlxplat_lpc_cpld_device_init()
7661 err = -ENOMEM; in mlxplat_lpc_cpld_device_init()
7688 return -ENODEV; in mlxplat_pci_fpga_device_init()
7692 dev_err(&pci_dev->dev, "pci_enable_device failed with error %d\n", err); in mlxplat_pci_fpga_device_init()
7698 dev_err(&pci_dev->dev, "pci_request_regions failed with error %d\n", err); in mlxplat_pci_fpga_device_init()
7702 err = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64)); in mlxplat_pci_fpga_device_init()
7704 err = dma_set_mask(&pci_dev->dev, DMA_BIT_MASK(32)); in mlxplat_pci_fpga_device_init()
7706 dev_err(&pci_dev->dev, "dma_set_mask failed with error %d\n", err); in mlxplat_pci_fpga_device_init()
7713 pci_mem_addr = devm_ioremap(&pci_dev->dev, pci_resource_start(pci_dev, 0), in mlxplat_pci_fpga_device_init()
7716 dev_err(&mlxplat_dev->dev, "ioremap failed\n"); in mlxplat_pci_fpga_device_init()
7717 err = -EIO; in mlxplat_pci_fpga_device_init()
7793 if (err == -ENODEV) in mlxplat_logicdev_init()
7813 mlxplat_hotplug->regmap = priv->regmap; in mlxplat_platdevs_init()
7814 if (priv->irq_fpga) in mlxplat_platdevs_init()
7815 mlxplat_hotplug->irq = priv->irq_fpga; in mlxplat_platdevs_init()
7816 priv->pdev_hotplug = in mlxplat_platdevs_init()
7817 platform_device_register_resndata(&mlxplat_dev->dev, in mlxplat_platdevs_init()
7818 "mlxreg-hotplug", PLATFORM_DEVID_NONE, in mlxplat_platdevs_init()
7819 priv->hotplug_resources, in mlxplat_platdevs_init()
7820 priv->hotplug_resources_size, in mlxplat_platdevs_init()
7822 if (IS_ERR(priv->pdev_hotplug)) { in mlxplat_platdevs_init()
7823 err = PTR_ERR(priv->pdev_hotplug); in mlxplat_platdevs_init()
7830 mlxplat_led->regmap = priv->regmap; in mlxplat_platdevs_init()
7831 priv->pdev_led = in mlxplat_platdevs_init()
7832 platform_device_register_resndata(&mlxplat_dev->dev, "leds-mlxreg", in mlxplat_platdevs_init()
7835 if (IS_ERR(priv->pdev_led)) { in mlxplat_platdevs_init()
7836 err = PTR_ERR(priv->pdev_led); in mlxplat_platdevs_init()
7843 mlxplat_regs_io->regmap = priv->regmap; in mlxplat_platdevs_init()
7844 priv->pdev_io_regs = platform_device_register_resndata(&mlxplat_dev->dev, in mlxplat_platdevs_init()
7845 "mlxreg-io", in mlxplat_platdevs_init()
7849 if (IS_ERR(priv->pdev_io_regs)) { in mlxplat_platdevs_init()
7850 err = PTR_ERR(priv->pdev_io_regs); in mlxplat_platdevs_init()
7857 mlxplat_fan->regmap = priv->regmap; in mlxplat_platdevs_init()
7858 priv->pdev_fan = platform_device_register_resndata(&mlxplat_dev->dev, "mlxreg-fan", in mlxplat_platdevs_init()
7862 if (IS_ERR(priv->pdev_fan)) { in mlxplat_platdevs_init()
7863 err = PTR_ERR(priv->pdev_fan); in mlxplat_platdevs_init()
7869 err = mlxplat_mlxcpld_check_wd_capability(priv->regmap); in mlxplat_platdevs_init()
7874 mlxplat_wd_data[i]->regmap = priv->regmap; in mlxplat_platdevs_init()
7875 priv->pdev_wd[i] = in mlxplat_platdevs_init()
7876 platform_device_register_resndata(&mlxplat_dev->dev, "mlx-wdt", i, in mlxplat_platdevs_init()
7879 if (IS_ERR(priv->pdev_wd[i])) { in mlxplat_platdevs_init()
7880 err = PTR_ERR(priv->pdev_wd[i]); in mlxplat_platdevs_init()
7890 priv->pdev_dpu[i] = in mlxplat_platdevs_init()
7891 platform_device_register_resndata(&mlxplat_dev->dev, "mlxreg-dpu", in mlxplat_platdevs_init()
7894 if (IS_ERR(priv->pdev_dpu[i])) { in mlxplat_platdevs_init()
7895 err = PTR_ERR(priv->pdev_dpu[i]); in mlxplat_platdevs_init()
7903 while (i--) in mlxplat_platdevs_init()
7904 platform_device_unregister(priv->pdev_dpu[i]); in mlxplat_platdevs_init()
7906 while (i--) in mlxplat_platdevs_init()
7907 platform_device_unregister(priv->pdev_wd[i]); in mlxplat_platdevs_init()
7910 platform_device_unregister(priv->pdev_io_regs); in mlxplat_platdevs_init()
7913 platform_device_unregister(priv->pdev_led); in mlxplat_platdevs_init()
7916 platform_device_unregister(priv->pdev_hotplug); in mlxplat_platdevs_init()
7925 for (i = MLXPLAT_CPLD_DPU_MAX_DEVS - 1; i >= 0; i--) in mlxplat_platdevs_exit()
7926 platform_device_unregister(priv->pdev_dpu[i]); in mlxplat_platdevs_exit()
7927 for (i = MLXPLAT_CPLD_WD_MAX_DEVS - 1; i >= 0; i--) in mlxplat_platdevs_exit()
7928 platform_device_unregister(priv->pdev_wd[i]); in mlxplat_platdevs_exit()
7929 if (priv->pdev_fan) in mlxplat_platdevs_exit()
7930 platform_device_unregister(priv->pdev_fan); in mlxplat_platdevs_exit()
7931 if (priv->pdev_io_regs) in mlxplat_platdevs_exit()
7932 platform_device_unregister(priv->pdev_io_regs); in mlxplat_platdevs_exit()
7933 if (priv->pdev_led) in mlxplat_platdevs_exit()
7934 platform_device_unregister(priv->pdev_led); in mlxplat_platdevs_exit()
7935 if (priv->pdev_hotplug) in mlxplat_platdevs_exit()
7936 platform_device_unregister(priv->pdev_hotplug); in mlxplat_platdevs_exit()
7952 if (!priv->pdev_i2c) { in mlxplat_i2c_mux_topology_init()
7953 priv->i2c_main_init_status = MLXPLAT_I2C_MAIN_BUS_NOTIFIED; in mlxplat_i2c_mux_topology_init()
7957 priv->i2c_main_init_status = MLXPLAT_I2C_MAIN_BUS_HANDLE_CREATED; in mlxplat_i2c_mux_topology_init()
7959 priv->pdev_mux[i] = platform_device_register_resndata(&priv->pdev_i2c->dev, in mlxplat_i2c_mux_topology_init()
7960 "i2c-mux-reg", i, NULL, 0, in mlxplat_i2c_mux_topology_init()
7963 if (IS_ERR(priv->pdev_mux[i])) { in mlxplat_i2c_mux_topology_init()
7964 err = PTR_ERR(priv->pdev_mux[i]); in mlxplat_i2c_mux_topology_init()
7972 while (i--) in mlxplat_i2c_mux_topology_init()
7973 platform_device_unregister(priv->pdev_mux[i]); in mlxplat_i2c_mux_topology_init()
7981 for (i = mlxplat_mux_num - 1; i >= 0; i--) { in mlxplat_i2c_mux_topology_exit()
7982 if (priv->pdev_mux[i]) in mlxplat_i2c_mux_topology_exit()
7983 platform_device_unregister(priv->pdev_mux[i]); in mlxplat_i2c_mux_topology_exit()
8005 nr = (nr == mlxplat_max_adap_num) ? -1 : nr; in mlxplat_i2c_main_init()
8006 mlxplat_i2c->regmap = priv->regmap; in mlxplat_i2c_main_init()
8007 mlxplat_i2c->handle = priv; in mlxplat_i2c_main_init()
8009 /* Set mapped base address of I2C-LPC bridge over PCIe */ in mlxplat_i2c_main_init()
8011 mlxplat_i2c->addr = i2c_bridge_addr; in mlxplat_i2c_main_init()
8012 priv->pdev_i2c = platform_device_register_resndata(&mlxplat_dev->dev, "i2c_mlxcpld", in mlxplat_i2c_main_init()
8013 nr, priv->hotplug_resources, in mlxplat_i2c_main_init()
8014 priv->hotplug_resources_size, in mlxplat_i2c_main_init()
8016 if (IS_ERR(priv->pdev_i2c)) { in mlxplat_i2c_main_init()
8017 err = PTR_ERR(priv->pdev_i2c); in mlxplat_i2c_main_init()
8021 if (priv->i2c_main_init_status == MLXPLAT_I2C_MAIN_BUS_NOTIFIED) { in mlxplat_i2c_main_init()
8030 platform_device_unregister(priv->pdev_i2c); in mlxplat_i2c_main_init()
8040 if (priv->pdev_i2c) in mlxplat_i2c_main_exit()
8041 platform_device_unregister(priv->pdev_i2c); in mlxplat_i2c_main_exit()
8052 acpi_dev = ACPI_COMPANION(&pdev->dev); in mlxplat_probe()
8056 return -ENODEV; in mlxplat_probe()
8064 priv = devm_kzalloc(&mlxplat_dev->dev, sizeof(struct mlxplat_priv), in mlxplat_probe()
8067 err = -ENOMEM; in mlxplat_probe()
8071 priv->hotplug_resources = hotplug_resources; in mlxplat_probe()
8072 priv->hotplug_resources_size = hotplug_resources_size; in mlxplat_probe()
8073 priv->irq_fpga = irq_fpga; in mlxplat_probe()
8078 priv->regmap = devm_regmap_init(&mlxplat_dev->dev, NULL, in mlxplat_probe()
8081 if (IS_ERR(priv->regmap)) { in mlxplat_probe()
8082 err = PTR_ERR(priv->regmap); in mlxplat_probe()
8087 for (i = 0; i < mlxplat_regmap_config->num_reg_defaults; i++) { in mlxplat_probe()
8088 err = regmap_write(priv->regmap, in mlxplat_probe()
8089 mlxplat_regmap_config->reg_defaults[i].reg, in mlxplat_probe()
8090 mlxplat_regmap_config->reg_defaults[i].def); in mlxplat_probe()
8100 regcache_mark_dirty(priv->regmap); in mlxplat_probe()
8101 err = regcache_sync(priv->regmap); in mlxplat_probe()
8157 return -ENODEV; in mlxplat_init()