From b38354aa216e4b68573a153fdc45360826d30cd8 Mon Sep 17 00:00:00 2001 From: Pradchaya Phucharoen Date: Fri, 15 May 2020 16:15:34 +0700 Subject: [PATCH] Remove SPD temperature sensors from platform * [platform-driver]Remove TSoD probe on IMC bus. * [platform-api]Remove jc42 from platform thermal list. --- .../sonic_platform/chassis.py | 2 +- .../sonic_platform/thermal.py | 1 - .../debian/platform-modules-questone2bd.init | 11 +- .../questone2bd/modules/Makefile | 2 +- .../questone2bd/modules/dimm-bus.c | 107 ------------------ .../questone2bd/modules/dimm-bus.h | 18 --- .../questone2bd/modules/i2c-imc.c | 3 - 7 files changed, 7 insertions(+), 137 deletions(-) delete mode 100644 platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/dimm-bus.c delete mode 100644 platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/dimm-bus.h diff --git a/device/celestica/x86_64-cel_questone2bd-r0/sonic_platform/chassis.py b/device/celestica/x86_64-cel_questone2bd-r0/sonic_platform/chassis.py index 7f439d2048f0..d3aa2b6cd24e 100644 --- a/device/celestica/x86_64-cel_questone2bd-r0/sonic_platform/chassis.py +++ b/device/celestica/x86_64-cel_questone2bd-r0/sonic_platform/chassis.py @@ -22,7 +22,7 @@ NUM_FAN_TRAY = 4 NUM_FAN = 2 NUM_PSU = 2 -NUM_THERMAL = 12 +NUM_THERMAL = 11 NUM_SFP = 56 NUM_COMPONENT = 7 REBOOT_CAUSE_REG = "0xA106" diff --git a/device/celestica/x86_64-cel_questone2bd-r0/sonic_platform/thermal.py b/device/celestica/x86_64-cel_questone2bd-r0/sonic_platform/thermal.py index ee84a9e1f681..31bfda53d54a 100644 --- a/device/celestica/x86_64-cel_questone2bd-r0/sonic_platform/thermal.py +++ b/device/celestica/x86_64-cel_questone2bd-r0/sonic_platform/thermal.py @@ -41,7 +41,6 @@ def __init__(self, thermal_index): ('TEMP_dps1100_i2c_76_59_1', 'dps1100', 76, 0, '59', False, 1), ('TEMP_dps1100_i2c_76_59_2', 'dps1100', 76, 0, '59', False, 2), ('TEMP_syscpld_i2c_70_0d', 'syscpld', 70, 0, '0d', False, 1), - ('TEMP_jc42_i2c_1_18', 'jc42', 1, 0, '18', False, 1), ('TEMP_core_tmp_1', 'coretemp', 0, 0, '00', False, 1), ('TEMP_core_tmp_2', 'coretemp', 0, 0, '00', False, 2), ('TEMP_core_tmp_3', 'coretemp', 0, 0, '00', False, 3), diff --git a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-questone2bd.init b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-questone2bd.init index b3348b2ad11d..a7ed2957814e 100644 --- a/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-questone2bd.init +++ b/platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-questone2bd.init @@ -17,7 +17,6 @@ start) # Loads kernel modules modprobe i2c-dev - modprobe dimm-bus modprobe pmbus_core modprobe i2c-imc allow_unsafe_access=1 modprobe baseboard_cpld @@ -38,7 +37,7 @@ start) ## Populate FAN CPLD device echo fancpld 0x0d > /sys/bus/i2c/devices/i2c-66/new_device - + ## Populate SYSTEM cpld device echo syscpld 0x0d > /sys/bus/i2c/devices/i2c-70/new_device @@ -47,7 +46,7 @@ start) echo dps1100 0x58 > /sys/bus/i2c/devices/i2c-75/new_device sleep 1 echo dps1100 0x59 > /sys/bus/i2c/devices/i2c-76/new_device - + # Populate temperature sensors echo lm75b 0x48 > /sys/bus/i2c/devices/i2c-9/new_device echo lm75b 0x4d > /sys/bus/i2c/devices/i2c-67/new_device @@ -59,11 +58,11 @@ start) echo 24lc64t 0x50 > /sys/bus/i2c/devices/i2c-6/new_device echo 24lc64t 0x50 > /sys/bus/i2c/devices/i2c-8/new_device echo 24lc64t 0x56 > /sys/bus/i2c/devices/i2c-9/new_device - - ## PSU + + ## PSU echo 24lc64t 0x50 > /sys/bus/i2c/devices/i2c-75/new_device echo 24lc64t 0x51 > /sys/bus/i2c/devices/i2c-76/new_device - + ## SYSTEM echo 24lc64t 0x57 > /sys/bus/i2c/devices/i2c-69/new_device diff --git a/platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/Makefile b/platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/Makefile index 81adc9ef04e6..60a70645f18e 100644 --- a/platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/Makefile @@ -1,2 +1,2 @@ -obj-m := mc24lc64t.o baseboard_cpld.o switchboard_fpga.o i2c-imc.o dimm-bus.o +obj-m := mc24lc64t.o baseboard_cpld.o switchboard_fpga.o i2c-imc.o obj-m += i2c_dev_sysfs.o syscpld.o fancpld.o dps1100.o diff --git a/platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/dimm-bus.c b/platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/dimm-bus.c deleted file mode 100644 index 9f30945e1d1c..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/dimm-bus.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2013-2016 Andrew Lutomirski - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ -#include -#include -#include -#include "dimm-bus.h" -static bool probe_addr(struct i2c_adapter *adapter, int addr) -{ - /* - * So far, all known devices that live on DIMMs can be safely - * and reliably detected by trying to read a byte at address - * zero. (The exception is the SPD write protection control, - * which can't be probed and requires special hardware and/or - * quick writes to access, and has no driver.) - */ - union i2c_smbus_data dummy; - return i2c_smbus_xfer(adapter, addr, 0, I2C_SMBUS_READ, 0, - I2C_SMBUS_BYTE_DATA, &dummy) >= 0; -} -/** - * i2c_scan_dimm_bus() - Scans an SMBUS segment known to contain DIMMs - * @adapter: The SMBUS adapter to scan - * - * This function tells the DIMM-bus code that the adapter is known to - * contain DIMMs. i2c_scan_dimm_bus will probe for devices known to - * live on DIMMs. - * - * Do NOT call this function on general-purpose system SMBUS segments - * unless you know that the only things on the bus are DIMMs. - * Otherwise is it very likely to mis-identify other things on the - * bus. - * - * Callers are advised not to set adapter->class = I2C_CLASS_SPD to - * avoid having two separate mechanisms trying to automatically claim - * devices on the bus. - */ -void i2c_scan_dimm_bus(struct i2c_adapter *adapter) -{ - struct i2c_board_info info = {}; - int slot; - /* - * We probe with "read byte data". If any DIMM SMBUS driver can't - * support that access type, this function should be updated. - */ - if (WARN_ON(!i2c_check_functionality(adapter, - I2C_FUNC_SMBUS_READ_BYTE_DATA))) - return; - /* - * Addresses on DIMMs use the three low bits to identify the slot - * and the four high bits to identify the device type. Known - * devices include: - * - * - 0x10 - 0x17: NVDIMM controller (pre-standard) - * - 0x18 - 0x1f: TSOD (Temperature Sensor on DIMM) - * - 0x40 - 0x47: JESD245 Byte Addressable Energy Backed Interface - * - 0x50 - 0x57: SPD (Serial Presence Detect) EEPROM - * - 0x30 - 0x37: SPD WP control -- not easy to probe - * - * There's no point in trying to probe the SPD WP control: we'd - * want to probe using quick reads, which i2c-imc doesn't - * support, we don't have a driver for it, we can't really use - * it without special hardware (it's not a normal i2c slave -- - * see the JEDEC docs), and using it risks bricking the DIMM - * it's on anyway. - * - * NB: There's no need to save the return value from - * i2c_new_device, as the core code will unregister it for us - * when the adapter is removed. If users want to bind a - * different driver, nothing stops them from unbinding the - * drivers we request here. - */ - for (slot = 0; slot < 8; slot++) { - /* If there's no SPD, then assume there's no DIMM here. */ - if (!probe_addr(adapter, 0x50 | slot)) - continue; - strcpy(info.type, "ee1004"); - info.addr = 0x50 | slot; - i2c_new_device(adapter, &info); - if (probe_addr(adapter, 0x18 | slot)) { - /* - * This is a temperature sensor. The interface is - * defined in the JEDEC TSE2004av specification. - * Linux's driver for this is called "jc42", which - * is a bit nonsensical (JC-42 is the name of the - * committee, not the sensor). - */ - strcpy(info.type, "jc42"); - info.addr = 0x18 | slot; - i2c_new_device(adapter, &info); - } - } -} -EXPORT_SYMBOL(i2c_scan_dimm_bus); -MODULE_AUTHOR("Andrew Lutomirski "); -MODULE_DESCRIPTION("i2c DIMM bus support"); -MODULE_LICENSE("GPL v2"); - diff --git a/platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/dimm-bus.h b/platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/dimm-bus.h deleted file mode 100644 index 8f14d5fb973f..000000000000 --- a/platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/dimm-bus.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2013-2016 Andrew Lutomirski - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ -#ifndef _I2C_DIMM_BUS -#define _I2C_DIMM_BUS -struct i2c_adapter; -void i2c_scan_dimm_bus(struct i2c_adapter *adapter); -#endif /* _I2C_DIMM_BUS */ - diff --git a/platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/i2c-imc.c b/platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/i2c-imc.c index 7b053f43916e..f75069f919b3 100644 --- a/platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/i2c-imc.c +++ b/platform/broadcom/sonic-platform-modules-cel/questone2bd/modules/i2c-imc.c @@ -19,7 +19,6 @@ #include #include #include -#include "dimm-bus.h" /* * The datasheet can be found here, for example: @@ -422,8 +421,6 @@ static int imc_init_channel(struct imc_priv *priv, int i, int socket) return err; } - i2c_scan_dimm_bus(&ch->adapter); - return 0; }