From patchwork Wed Feb 8 06:33:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 13132480 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8302EC636D3 for ; Wed, 8 Feb 2023 06:34:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229509AbjBHGeL (ORCPT ); Wed, 8 Feb 2023 01:34:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjBHGeK (ORCPT ); Wed, 8 Feb 2023 01:34:10 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2050.outbound.protection.outlook.com [40.107.92.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97A9943904 for ; Tue, 7 Feb 2023 22:34:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gA4WuPTL/7KGwwdiIydqA0FpaNWlR4rC6jgYFrs7vVifUOKPNIJ94pNxQhP2c3H9TpZdY2hXcONKRiXMMy1SDN7zKFJJjlk2WKLxhsTCSbzraAO3W8stwexGsV39nvmsKlnNhH/IiXd+UD9SaAJbqKZpipZj5eWx+2WdSqJ/2DVyGxKEWdLllMD405dqRQv77lS/NjP06ThHxtra20qGhLy4cwj7w8U1riZfiUzOZAgR3u28tKbhdlU4FgRtkJi9QXChBQ/II+kNaEPx9VQkqpblqQcIebce5ucyBQcdAPnu/JDx40lP5cn5q6+T+Y7VmPdqUuTIepLhTOifoRrQeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Sl6MRsdHe9fYFRkV9PHUcUv+mI0m/M1yXI8zt+1qJgY=; b=FEDiBsBxpSpAa11bUJI5ScNEaptvOPzQ5zk+gWM9jKMdigVrtYBDo4RpIGkhdqsfa79/VwVWzKJFUM0tujJblUTm4m87AM4mQMPyx48IpD+BUMe2sZRNodinzgC41LkgyB+gy3JUtnpgucsVVuH+rbWETObOaiR+T7YDffesjZPK39yDYadmJeFjsj5DZA6HPwrup1ILFwJ3tBfukeaXs89AlyOaBvzEmFWMsVutGiwILW2qm9BRmL6Lkpe1GRuF/DJyqPOJLdebMXdjd5OJ+6qo1m6JVR6l8dy2iIq42HO3MUMWmMLM9PGDROTbJgWo7izapoz5v2ejU/Sq+7G9gQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Sl6MRsdHe9fYFRkV9PHUcUv+mI0m/M1yXI8zt+1qJgY=; b=iJ9pbeTGJaQ99ipttDe3Rv+PbGyXeqgxMVfPsnzrN4QiUnX84/s9dobVckq1s9spKzco3s890ZHuPL6V/TBBPh07NtFsPPYkW2MZkx6gFSjWjh4DsDKERjJjHmnNLocxw52DHkoR3V9xIXH2yrzDzWKwgikC89KQXh4hgYUKC9B7ADbbKmdXzzjgnV3pESiHuzOTt8PQ/Hhl5y3md7KSMOs8loD0Quc4wUBR8pqyUx6csy7ZaFrViDcoq8u23xB2Jh9x8vEx6Xq5LsfNVo45v6AhldvUTKdjD5laF625MROFIj8g0ILlI6YK2L9v4i5c6qmoqyKTWraMDK+fjXD5lQ== Received: from DS7PR03CA0326.namprd03.prod.outlook.com (2603:10b6:8:2b::28) by DS0PR12MB8368.namprd12.prod.outlook.com (2603:10b6:8:fe::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Wed, 8 Feb 2023 06:34:06 +0000 Received: from DM6NAM11FT087.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2b:cafe::5e) by DS7PR03CA0326.outlook.office365.com (2603:10b6:8:2b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:34:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT087.mail.protection.outlook.com (10.13.172.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:34:05 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:34:00 -0800 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:33:58 -0800 From: Vadim Pasternak To: CC: , Vadim Pasternak Subject: [PATCH platform-next 01/13] platform: mellanox: Introduce support for rack manager switch Date: Wed, 8 Feb 2023 08:33:18 +0200 Message-ID: <20230208063331.15560-2-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230208063331.15560-1-vadimp@nvidia.com> References: <20230208063331.15560-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT087:EE_|DS0PR12MB8368:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f37e7b0-07d7-4393-5cb5-08db099e7a10 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AeGQDqySwg0ErFoJ6lrZ95UndCxy5Nb+A8g8Tz0jqCbWEjD3SpiardDX1psnE2i+VUPk9y9nG78Mh34dpOpiuiIzV6yzGG5u9SM/O30/1cYPlwTJNZcEXVc9v5Cf/eTkAwjE18DNmBXjp99afoYWBosXaA7uukFrBRe1bg3rnXbxG7vvt8xvvisk8+8BTCS9n6YwZLZ3coIP+QDco8wW4dnv2Tbe0AZkaghPGvF8U5qlgvsSDvSLGExkuYrE7iu8SYrXCiZ2ABoz/ZD6cfgj5ocX5NZHEhWw5goOYK6fDSvuqWgLyzrvMWygpgBj7d0G9QYx3aGxq/Wtv+jGL7g8da75X1Dpcl7OjPv+yCF46NcyRkMR7ZQGRn9isx5V1mJpxg/NGgkkvE90vGUBo0qB/rl8ql1shWn3IQIHX8hFdpmteOwbuuFOVVBYgOx08inWKEwVbJL6WiI4PAq446hRKEgf6dAIC/zgaTOGHtLAiqUsNVBTpc4SJ72UammmjSFsc+gz6c7/0iED/G5LZ0aDvm/YTcov1D8fyNTaGU1V/ejSXMr+38VH9vF0nbiTNtG4ImK6S73c59ZARegLXDHTZ3h2pZcy2HVQX8PcHets7yHISZsQ808DfSRxzdweNFwwnpbiyYtug33BGgm97kBmy3clKBf0DBvZmxta5kloNg/NarGdS8M55qibfI99Ni89fP6hvrDkA1T+B2vjGr+XCQ== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(396003)(346002)(136003)(39860400002)(376002)(451199018)(36840700001)(40470700004)(46966006)(82310400005)(30864003)(54906003)(356005)(1076003)(8676002)(40480700001)(16526019)(186003)(316002)(86362001)(6666004)(107886003)(7636003)(82740400003)(26005)(478600001)(426003)(41300700001)(8936002)(336012)(83380400001)(40460700003)(47076005)(5660300002)(36756003)(4326008)(2616005)(70586007)(36860700001)(70206006)(6916009)(2906002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 06:34:05.8870 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3f37e7b0-07d7-4393-5cb5-08db099e7a10 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT087.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8368 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org The rack switch is designed to provide high bandwidth, low latency connectivity using optical fiber as the primary interconnect. System supports 32 OSFP ports, non-blocking switching capacity of 25.6Tbps. System equipped with: - 2 replaceable power supplies (AC) with 1+1 redundancy model. - 7 replaceable fan drawers with 6+1 redundancy model. - 2 External Root of Trust or EROT (Glacier) devices for securing ASICs firmware. Signed-off-by: Vadim Pasternak Reviewed-by: Michael Shych --- drivers/platform/x86/mlx-platform.c | 261 ++++++++++++++++++++++++++++ 1 file changed, 261 insertions(+) diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c index 2fac05a17a5c..3e4adeb20a7e 100644 --- a/drivers/platform/x86/mlx-platform.c +++ b/drivers/platform/x86/mlx-platform.c @@ -90,6 +90,12 @@ #define MLXPLAT_CPLD_LPC_REG_FAN_OFFSET 0x88 #define MLXPLAT_CPLD_LPC_REG_FAN_EVENT_OFFSET 0x89 #define MLXPLAT_CPLD_LPC_REG_FAN_MASK_OFFSET 0x8a +#define MLXPLAT_CPLD_LPC_REG_EROT_OFFSET 0x91 +#define MLXPLAT_CPLD_LPC_REG_EROT_EVENT_OFFSET 0x92 +#define MLXPLAT_CPLD_LPC_REG_EROT_MASK_OFFSET 0x93 +#define MLXPLAT_CPLD_LPC_REG_EROTE_OFFSET 0x94 +#define MLXPLAT_CPLD_LPC_REG_EROTE_EVENT_OFFSET 0x95 +#define MLXPLAT_CPLD_LPC_REG_EROTE_MASK_OFFSET 0x96 #define MLXPLAT_CPLD_LPC_REG_LC_VR_OFFSET 0x9a #define MLXPLAT_CPLD_LPC_REG_LC_VR_EVENT_OFFSET 0x9b #define MLXPLAT_CPLD_LPC_REG_LC_VR_MASK_OFFSET 0x9c @@ -109,6 +115,8 @@ #define MLXPLAT_CPLD_LPC_REG_LC_SD_EVENT_OFFSET 0xaa #define MLXPLAT_CPLD_LPC_REG_LC_SD_MASK_OFFSET 0xab #define MLXPLAT_CPLD_LPC_REG_LC_PWR_ON 0xb2 +#define MLXPLAT_CPLD_LPC_REG_GP4_RO_OFFSET 0xc2 +#define MLXPLAT_CPLD_LPC_REG_SPI_CHNL_SELECT 0xc3 #define MLXPLAT_CPLD_LPC_REG_WD_CLEAR_OFFSET 0xc7 #define MLXPLAT_CPLD_LPC_REG_WD_CLEAR_WP_OFFSET 0xc8 #define MLXPLAT_CPLD_LPC_REG_WD1_TMR_OFFSET 0xc9 @@ -214,6 +222,7 @@ #define MLXPLAT_CPLD_LED_HI_NIBBLE_MASK GENMASK(3, 0) #define MLXPLAT_CPLD_VOLTREG_UPD_MASK GENMASK(5, 4) #define MLXPLAT_CPLD_GWP_MASK GENMASK(0, 0) +#define MLXPLAT_CPLD_EROT_MASK GENMASK(1, 0) #define MLXPLAT_CPLD_I2C_CAP_BIT 0x04 #define MLXPLAT_CPLD_I2C_CAP_MASK GENMASK(5, MLXPLAT_CPLD_I2C_CAP_BIT) @@ -243,6 +252,7 @@ #define MLXPLAT_CPLD_CH2_ETH_MODULAR 3 #define MLXPLAT_CPLD_CH3_ETH_MODULAR 43 #define MLXPLAT_CPLD_CH4_ETH_MODULAR 51 +#define MLXPLAT_CPLD_CH2_RACK_SWITCH 18 /* Number of LPC attached MUX platform devices */ #define MLXPLAT_CPLD_LPC_MUX_DEVS 4 @@ -280,6 +290,9 @@ /* Minimum power required for turning on Ethernet modular system (WATT) */ #define MLXPLAT_CPLD_ETH_MODULAR_PWR_MIN 50 +/* Default value for PWM control register for rack switch system */ +#define MLXPLAT_REGMAP_NVSWITCH_PWM_DEFAULT 0xf4 + /* mlxplat_priv - platform private data * @pdev_i2c - i2c controller platform device * @pdev_mux - array of mux platform devices @@ -460,6 +473,36 @@ static struct i2c_mux_reg_platform_data mlxplat_modular_mux_data[] = { }, }; +/* Platform channels for rack swicth system family */ +static const int mlxplat_rack_switch_channels[] = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, +}; + +/* Platform rack switch mux data */ +static struct i2c_mux_reg_platform_data mlxplat_rack_switch_mux_data[] = { + { + .parent = 1, + .base_nr = MLXPLAT_CPLD_CH1, + .write_only = 1, + .reg = (void __iomem *)MLXPLAT_CPLD_LPC_REG1, + .reg_size = 1, + .idle_in_use = 1, + .values = mlxplat_rack_switch_channels, + .n_values = ARRAY_SIZE(mlxplat_rack_switch_channels), + }, + { + .parent = 1, + .base_nr = MLXPLAT_CPLD_CH2_RACK_SWITCH, + .write_only = 1, + .reg = (void __iomem *)MLXPLAT_CPLD_LPC_REG2, + .reg_size = 1, + .idle_in_use = 1, + .values = mlxplat_msn21xx_channels, + .n_values = ARRAY_SIZE(mlxplat_msn21xx_channels), + }, + +}; + /* Platform hotplug devices */ static struct i2c_board_info mlxplat_mlxcpld_pwr[] = { { @@ -2064,6 +2107,97 @@ struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_nvlink_blade_data = { .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_LOW, }; +/* Platform hotplug for switch systems family data */ +static struct mlxreg_core_data mlxplat_mlxcpld_erot_ap_items_data[] = { + { + .label = "erot1_ap", + .reg = MLXPLAT_CPLD_LPC_REG_EROT_OFFSET, + .mask = BIT(0), + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, + }, + { + .label = "erot2_ap", + .reg = MLXPLAT_CPLD_LPC_REG_EROT_OFFSET, + .mask = BIT(1), + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, + }, +}; + +static struct mlxreg_core_data mlxplat_mlxcpld_erot_error_items_data[] = { + { + .label = "erot1_error", + .reg = MLXPLAT_CPLD_LPC_REG_EROTE_OFFSET, + .mask = BIT(0), + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, + }, + { + .label = "erot2_error", + .reg = MLXPLAT_CPLD_LPC_REG_EROTE_OFFSET, + .mask = BIT(1), + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, + }, +}; + +static struct mlxreg_core_item mlxplat_mlxcpld_rack_switch_items[] = { + { + .data = mlxplat_mlxcpld_ext_psu_items_data, + .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, + .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, + .mask = MLXPLAT_CPLD_PSU_EXT_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET, + .count = ARRAY_SIZE(mlxplat_mlxcpld_ext_psu_items_data), + .inversed = 1, + .health = false, + }, + { + .data = mlxplat_mlxcpld_ext_pwr_items_data, + .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, + .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, + .mask = MLXPLAT_CPLD_PWR_EXT_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET, + .count = ARRAY_SIZE(mlxplat_mlxcpld_ext_pwr_items_data), + .inversed = 0, + .health = false, + }, + { + .data = mlxplat_mlxcpld_default_ng_fan_items_data, + .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, + .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, + .mask = MLXPLAT_CPLD_FAN_NG_MASK, + .count = ARRAY_SIZE(mlxplat_mlxcpld_default_ng_fan_items_data), + .inversed = 1, + .health = false, + }, + { + .data = mlxplat_mlxcpld_erot_ap_items_data, + .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, + .reg = MLXPLAT_CPLD_LPC_REG_EROT_OFFSET, + .mask = MLXPLAT_CPLD_EROT_MASK, + .count = ARRAY_SIZE(mlxplat_mlxcpld_erot_ap_items_data), + .inversed = 1, + .health = false, + }, + { + .data = mlxplat_mlxcpld_erot_error_items_data, + .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, + .reg = MLXPLAT_CPLD_LPC_REG_EROTE_OFFSET, + .mask = MLXPLAT_CPLD_EROT_MASK, + .count = ARRAY_SIZE(mlxplat_mlxcpld_erot_error_items_data), + .inversed = 1, + .health = false, + }, +}; + +static +struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_rack_switch_data = { + .items = mlxplat_mlxcpld_rack_switch_items, + .counter = ARRAY_SIZE(mlxplat_mlxcpld_rack_switch_items), + .cell = MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET, + .mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF | MLXPLAT_CPLD_AGGR_MASK_COMEX, + .cell_low = MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET, + .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_LOW, +}; + /* Platform led default data */ static struct mlxreg_core_data mlxplat_mlxcpld_default_led_data[] = { { @@ -2947,6 +3081,44 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_regs_io_data[] = { .mask = GENMASK(7, 0) & ~BIT(2), .mode = 0200, }, + { + .label = "erot1_reset", + .reg = MLXPLAT_CPLD_LPC_REG_RESET_GP2_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(6), + .mode = 0644, + }, + { + .label = "erot2_reset", + .reg = MLXPLAT_CPLD_LPC_REG_RESET_GP2_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(7), + .mode = 0644, + }, + { + .label = "erot1_recovery", + .reg = MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(6), + .mode = 0644, + }, + { + .label = "erot2_recovery", + .reg = MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(7), + .mode = 0644, + }, + { + .label = "erot1_wp", + .reg = MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(4), + .mode = 0644, + .secured = 1, + }, + { + .label = "erot2_wp", + .reg = MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(5), + .mode = 0644, + .secured = 1, + }, { .label = "reset_long_pb", .reg = MLXPLAT_CPLD_LPC_REG_RESET_CAUSE_OFFSET, @@ -3142,6 +3314,25 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_regs_io_data[] = { .mask = GENMASK(7, 0) & ~BIT(4), .mode = 0644, }, + { + .label = "erot1_ap_reset", + .reg = MLXPLAT_CPLD_LPC_REG_GP4_RO_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(0), + .mode = 0444, + }, + { + .label = "erot2_ap_reset", + .reg = MLXPLAT_CPLD_LPC_REG_GP4_RO_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(1), + .mode = 0444, + }, + { + .label = "spi_chnl_select", + .reg = MLXPLAT_CPLD_LPC_REG_SPI_CHNL_SELECT, + .mask = GENMASK(7, 0), + .bit = 1, + .mode = 0644, + }, { .label = "config1", .reg = MLXPLAT_CPLD_LPC_REG_CONFIG1_OFFSET, @@ -4257,6 +4448,10 @@ static bool mlxplat_mlxcpld_writeable_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_PWR_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_FAN_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_FAN_MASK_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROT_EVENT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROT_MASK_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROTE_EVENT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROTE_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRLC_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_LC_IN_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_LC_IN_MASK_OFFSET: @@ -4274,6 +4469,7 @@ static bool mlxplat_mlxcpld_writeable_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_LC_SD_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_LC_SD_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_LC_PWR_ON: + case MLXPLAT_CPLD_LPC_REG_SPI_CHNL_SELECT: case MLXPLAT_CPLD_LPC_REG_WD_CLEAR_OFFSET: case MLXPLAT_CPLD_LPC_REG_WD_CLEAR_WP_OFFSET: case MLXPLAT_CPLD_LPC_REG_WD1_TMR_OFFSET: @@ -4358,6 +4554,12 @@ static bool mlxplat_mlxcpld_readable_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_FAN_OFFSET: case MLXPLAT_CPLD_LPC_REG_FAN_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_FAN_MASK_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROT_EVENT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROT_MASK_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROTE_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROTE_EVENT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROTE_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRLC_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRLC_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_LC_IN_OFFSET: @@ -4382,6 +4584,8 @@ static bool mlxplat_mlxcpld_readable_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_LC_SD_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_LC_SD_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_LC_PWR_ON: + case MLXPLAT_CPLD_LPC_REG_GP4_RO_OFFSET: + case MLXPLAT_CPLD_LPC_REG_SPI_CHNL_SELECT: case MLXPLAT_CPLD_LPC_REG_WD_CLEAR_OFFSET: case MLXPLAT_CPLD_LPC_REG_WD_CLEAR_WP_OFFSET: case MLXPLAT_CPLD_LPC_REG_WD1_TMR_OFFSET: @@ -4492,6 +4696,12 @@ static bool mlxplat_mlxcpld_volatile_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_FAN_OFFSET: case MLXPLAT_CPLD_LPC_REG_FAN_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_FAN_MASK_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROT_EVENT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROT_MASK_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROTE_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROTE_EVENT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_EROTE_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRLC_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRLC_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_LC_IN_OFFSET: @@ -4516,6 +4726,8 @@ static bool mlxplat_mlxcpld_volatile_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_LC_SD_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_LC_SD_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_LC_PWR_ON: + case MLXPLAT_CPLD_LPC_REG_GP4_RO_OFFSET: + case MLXPLAT_CPLD_LPC_REG_SPI_CHNL_SELECT: case MLXPLAT_CPLD_LPC_REG_WD2_TMR_OFFSET: case MLXPLAT_CPLD_LPC_REG_WD2_TLEFT_OFFSET: case MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET: @@ -4583,6 +4795,13 @@ static const struct reg_default mlxplat_mlxcpld_regmap_ng400[] = { { MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET, 0x00 }, }; +static const struct reg_default mlxplat_mlxcpld_regmap_rack_switch[] = { + { MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET, MLXPLAT_REGMAP_NVSWITCH_PWM_DEFAULT }, + { MLXPLAT_CPLD_LPC_REG_WD1_ACT_OFFSET, 0x00 }, + { MLXPLAT_CPLD_LPC_REG_WD2_ACT_OFFSET, 0x00 }, + { MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET, 0x00 }, +}; + static const struct reg_default mlxplat_mlxcpld_regmap_eth_modular[] = { { MLXPLAT_CPLD_LPC_REG_GP2_OFFSET, 0x61 }, { MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET, 0x00 }, @@ -4676,6 +4895,20 @@ static const struct regmap_config mlxplat_mlxcpld_regmap_config_ng400 = { .reg_write = mlxplat_mlxcpld_reg_write, }; +static const struct regmap_config mlxplat_mlxcpld_regmap_config_rack_switch = { + .reg_bits = 8, + .val_bits = 8, + .max_register = 255, + .cache_type = REGCACHE_FLAT, + .writeable_reg = mlxplat_mlxcpld_writeable_reg, + .readable_reg = mlxplat_mlxcpld_readable_reg, + .volatile_reg = mlxplat_mlxcpld_volatile_reg, + .reg_defaults = mlxplat_mlxcpld_regmap_rack_switch, + .num_reg_defaults = ARRAY_SIZE(mlxplat_mlxcpld_regmap_rack_switch), + .reg_read = mlxplat_mlxcpld_reg_read, + .reg_write = mlxplat_mlxcpld_reg_write, +}; + static const struct regmap_config mlxplat_mlxcpld_regmap_config_eth_modular = { .reg_bits = 8, .val_bits = 8, @@ -4957,6 +5190,27 @@ static int __init mlxplat_dmi_nvlink_blade_matched(const struct dmi_system_id *d return 1; } +static int __init mlxplat_dmi_rack_switch_matched(const struct dmi_system_id *dmi) +{ + int i; + + mlxplat_max_adap_num = MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM; + mlxplat_mux_num = ARRAY_SIZE(mlxplat_rack_switch_mux_data); + mlxplat_mux_data = mlxplat_rack_switch_mux_data; + mlxplat_hotplug = &mlxplat_mlxcpld_rack_switch_data; + mlxplat_hotplug->deferred_nr = + mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; + mlxplat_led = &mlxplat_default_ng_led_data; + mlxplat_regs_io = &mlxplat_default_ng_regs_io_data; + mlxplat_fan = &mlxplat_default_fan_data; + for (i = 0; i < ARRAY_SIZE(mlxplat_mlxcpld_wd_set_type2); i++) + mlxplat_wd_data[i] = &mlxplat_mlxcpld_wd_set_type2[i]; + mlxplat_i2c = &mlxplat_mlxcpld_i2c_ng_data; + mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config_rack_switch; + + return 1; +} + static const struct dmi_system_id mlxplat_dmi_table[] __initconst = { { .callback = mlxplat_dmi_default_wc_matched, @@ -5014,6 +5268,13 @@ static const struct dmi_system_id mlxplat_dmi_table[] __initconst = { DMI_MATCH(DMI_BOARD_NAME, "VMOD0009"), }, }, + { + .callback = mlxplat_dmi_rack_switch_matched, + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "VMOD0010"), + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "HI142"), + }, + }, { .callback = mlxplat_dmi_ng400_matched, .matches = { From patchwork Wed Feb 8 06:33:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 13132481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 933CFC636D4 for ; Wed, 8 Feb 2023 06:34:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230244AbjBHGeR (ORCPT ); Wed, 8 Feb 2023 01:34:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229548AbjBHGeQ (ORCPT ); Wed, 8 Feb 2023 01:34:16 -0500 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2044.outbound.protection.outlook.com [40.107.96.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83628442C0 for ; Tue, 7 Feb 2023 22:34:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JthoUST8sknTUzhkMxzoxJbiRZP3yF/CUJw4ltxGLkBglzXXfW0CGsPz+B6PE6nsGkD9URVLMrT95Quoadq79C1IC4IeR0iP1yRf/cz6a+5HRK3qScbTqqyKEjTuZsOXj4CR2RFdpnhaO63yqRTZPSpyTTxiULGg2zL4BWhof373OJFA7Z7LY/DYB5LQr7+XTU/ihwz6rV9qX8eJR9haFtdZfCAhfRipQvhwB0kOCCjJxYluiC9cvxZool+t+vCNjkcEcwuM1o1Zk6vs9BBU1SJXHLIzStL6knZ787qFOk3JbsLoqzNlJmnJIqRUzviUOdNWquDLGPwLpohMLXrZvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Sym00mgbFb8a8okYnHuXOJU3vxc+KbFzCsXFRER6iqc=; b=fEvq3idpas4wc2VXcZcb8osCyFppjKaha6MJ416iOYNI54SpgMI4c/1QBfvmJQLIR6qeoBCsllnHY4m978fhrrFp7Wtd9ZUpwDxOt+64OhNvcaFSUwZ4ysQt9JWS3ue7uCCV9vduqBZHxgroWea2MUwaFTXmwGmYzgjHpdP30wfIIMM8yhZRjcRXDTLPeGK+OvDoYngedZLZtyP0oZvw310hW/dE/zxOaphk4bSiZsxhDPgE0LNhmnQwSBq5Dl6kajNmHNThJ6LSIST57Scxks9oJIYnyEvOiRipjMWnaFohJ/lXSrDWppBr8163homfEbXYyUCvTRBVaA0cudh9Iw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Sym00mgbFb8a8okYnHuXOJU3vxc+KbFzCsXFRER6iqc=; b=ePM92HyQKWYjljyy/v4PJQLx4aj5WaEA3XjBMqOGl98UqxT7rfWivBH6IcXmijtvdQp28gvZj05HU/z/vMSefWwujU/iDDe8PzbQcxYKv+KOs0H32+vgBY2NRwj/8mFcDaSoZsO461LoRK3e1fmj8oHw6uzOfWiAXpBmV91L7v5vPJ5PfxmDCsdVpceHmJMLHmjKAAd2T2QsFy6LCxSSoZJZfwug8XP+dKPnaA8JOwSX08ADww+9mCqi6NDcMU0ZMMklpYk+0h1XcUKderPoB3HZFC0Tt01lU2sFMNf09fIecAYJv0keaDzeWZ2PCECO8wqhjYz6SSIjestoI18aTw== Received: from MW4PR03CA0240.namprd03.prod.outlook.com (2603:10b6:303:b9::35) by PH7PR12MB7871.namprd12.prod.outlook.com (2603:10b6:510:27d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.32; Wed, 8 Feb 2023 06:34:12 +0000 Received: from CO1NAM11FT040.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b9:cafe::48) by MW4PR03CA0240.outlook.office365.com (2603:10b6:303:b9::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:34:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT040.mail.protection.outlook.com (10.13.174.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:34:12 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:34:02 -0800 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:34:01 -0800 From: Vadim Pasternak To: CC: , Vadim Pasternak Subject: [PATCH platform-next 02/13] platform: mellanox: Change "reset_pwr_converter_fail" attribute Date: Wed, 8 Feb 2023 08:33:19 +0200 Message-ID: <20230208063331.15560-3-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230208063331.15560-1-vadimp@nvidia.com> References: <20230208063331.15560-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT040:EE_|PH7PR12MB7871:EE_ X-MS-Office365-Filtering-Correlation-Id: c7d1a34f-0e6f-4333-a9ff-08db099e7dd9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WuIU7jSolrnKUk3SiMCfBOzIB2WZnZjgBr1EydBcblWN0C363tr8MiW2AVh6Piv9S3/oSYljiaaz/krANvJ27GaKIrcUZ7L9rKa/vkb2ByegCBuRgIImCCCXgSiHUHlBMsDPKQNmB6QjpMcuqa5bupWsUjvK4w0s9J82oPHvqC9TyxPVuMSXnZNeG7OOnc4EEgFaX4/ajGQF2e4e35KVzxRL7aIg3ictZWkwvOjCvK4V4ogFI12w2mcfmX+s2PQq9PioDqDKqCbF8BCQ3Jj9QGEoLF/gmKMe9uJ/NXzsJkVScMArV7HWhZYEwA/wD8nmTj3BG8EAiLYxZiDV1b8PbsZH+zLyP/VykScdx1c2E1gts4zBHpk9pZ8S0v/L/szdnKDA23a4cpyRWJqWWkvoAbpMJa9yA6akjwawC44XNVWqHAbNA0njDC2eIv/q3kCJrKqoAmJnFxQ1GWjOOac4W8tu+HW7b0AwTblMGZmk69lrIZ+0pih8HvczFAy0i2GUHbI2d2hvob2omIHJI6M58sCG5N2VbCFPkJT9V4o/q+5NK6ACLI3KBNthZu00AehWcDhphQhOQPUR+5wWILTuV5q2LUwPuxpWdgG9ynI98KLIBZ8ovlKRJtv76tx9C3i/E3TDIIgfTr4XCxheRIehmME6dV/OTWbd8Fzyhpu2VjBS+66aqc8imqWcMwbIyOrMUo3DxqMmFNNLbLq2GG513A== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(396003)(136003)(346002)(376002)(39860400002)(451199018)(46966006)(40470700004)(36840700001)(36756003)(336012)(40460700003)(186003)(26005)(4326008)(70586007)(2616005)(426003)(83380400001)(36860700001)(47076005)(16526019)(8676002)(82740400003)(7636003)(5660300002)(478600001)(41300700001)(8936002)(86362001)(6916009)(2906002)(54906003)(40480700001)(70206006)(1076003)(6666004)(356005)(107886003)(316002)(82310400005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 06:34:12.2863 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7d1a34f-0e6f-4333-a9ff-08db099e7dd9 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT040.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7871 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Change "reset_voltmon_upgrade_fail" attribute name to "reset_pwr_converter_fail". For systems using "mlxplat_mlxcpld_default_ng_regs_io_data", relevant CPLD 'register.bit' indicates the failure of power converter, while on older systems same 'register.bit' indicates failure of voltage monitor devices upgrade failure. Signed-off-by: Vadim Pasternak Reviewed-by: Michael Shych --- drivers/platform/x86/mlx-platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c index 3e4adeb20a7e..c53eca49c47f 100644 --- a/drivers/platform/x86/mlx-platform.c +++ b/drivers/platform/x86/mlx-platform.c @@ -3186,7 +3186,7 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_regs_io_data[] = { .mode = 0444, }, { - .label = "reset_voltmon_upgrade_fail", + .label = "reset_pwr_converter_fail", .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE2_OFFSET, .mask = GENMASK(7, 0) & ~BIT(0), .mode = 0444, From patchwork Wed Feb 8 06:33:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 13132482 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8828CC05027 for ; Wed, 8 Feb 2023 06:34:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229548AbjBHGeU (ORCPT ); Wed, 8 Feb 2023 01:34:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjBHGeT (ORCPT ); Wed, 8 Feb 2023 01:34:19 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2057.outbound.protection.outlook.com [40.107.243.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E5B74390D for ; Tue, 7 Feb 2023 22:34:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QTu5AyEvwjv4SgXLaTZIOBgnUBCbDJ/KSEiY6NYuzLXFCnQfUzLGopfmhaTkWOCiUDiAvH79WWlR9EK8WATAe7P1AkUDs9E5h2SBeiw/hmHhmO0CVP41MCAJpaZpAzpKdr0c4ypOUDmfPGVWrqEyYIaCORHRDVRjp0tv+Ne4N4ro1rtD6F1r5glYetL+u/X1uPtJxwR9uViuAfkZiYRVvvmXADkdM5KhEslPeEa9JQlG+0H8n6IzNxYPnxwPQNvGTYFRtmOekg/K6QweeZBup3zPNE6EH0LY5KTDf7YYVdzISsM7vf8Q7vASi2yMgeTsu4FrgPH9Zan2Aq/iNhFgsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oiPVLT6pJcoB1/WRQvSEdDJqUwDlz9/1+f++oPW7Txo=; b=WAFQd5q4n4NwNuE5oaQedyhPFJupe6XJaJIzvLr3cKcgTf+4Q+mK0pd8G75PET3AFVglJBFIh0fqUrk3l6hGSiY1eHy9t0A4Wc9XXUqhFjy40IyNQEyDoO+K6ASmvRyhT/EVxCnxFxjQBpWhPsEboR/hnejFBhrZNdEBWezD/0h/LqFOsFDpg/B5n6MaL+5ECSrRdTCEkXfNnbzyII/Rdwv9CmXZ/lnxqZusmF4ecW+Yoi0r+CniQhUm5gJtpN0kOC8Rxk9ij7QH4jE6EVH05FLLfrIVZwD5Lln2w1zKjkO3ED/9XMbgzqTAyvx1B6BGM2HiPe5Te+Ynl49Dq7UmnQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oiPVLT6pJcoB1/WRQvSEdDJqUwDlz9/1+f++oPW7Txo=; b=U09+6htyVeYlYgVcDUoEJiMhAiO0laQNFsl53uXBI+AXdFGGBwkksWsikP+BF6kT3+NrBoMfh1PCi7+ExMdGBWbM0SGBrrZAjxcuCLmTOTAYLjCtL688qXfRAQmNbnN4p5CgZXxG/vIrNbZb+X9SjuyVonV4SSGBvtP7L4jbadNT2HpO1fUZIqU5g6cm7W+HVdWjHqo/ZoCXhlLuWh7R84wIgr5Lo0Uh0QLEx1ldoKQxiIkDuMG/PAErNyXj/gUVg3lxCie8hvmsxbuvfbrGCDVYlrIRYc3/j+GfX7PUD6xD7iVmm36+sdlyqsr7pYKuIaSvR8H8VYEg/kZJou7uow== Received: from DM6PR11CA0065.namprd11.prod.outlook.com (2603:10b6:5:14c::42) by BN9PR12MB5162.namprd12.prod.outlook.com (2603:10b6:408:11b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17; Wed, 8 Feb 2023 06:34:14 +0000 Received: from DM6NAM11FT057.eop-nam11.prod.protection.outlook.com (2603:10b6:5:14c:cafe::f4) by DM6PR11CA0065.outlook.office365.com (2603:10b6:5:14c::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.35 via Frontend Transport; Wed, 8 Feb 2023 06:34:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT057.mail.protection.outlook.com (10.13.172.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:34:13 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:34:05 -0800 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:34:04 -0800 From: Vadim Pasternak To: CC: , Vadim Pasternak Subject: [PATCH platform-next 03/13] platform: mellanox: Cosmetic changes - rename to more common name Date: Wed, 8 Feb 2023 08:33:20 +0200 Message-ID: <20230208063331.15560-4-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230208063331.15560-1-vadimp@nvidia.com> References: <20230208063331.15560-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT057:EE_|BN9PR12MB5162:EE_ X-MS-Office365-Filtering-Correlation-Id: e1504cda-d372-44d4-b116-08db099e7edd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w5QXJ6s7/KI+mkhUCJ7Aevqk4t8VNevb2nYaguqAu91nu9SIwMeJgJlNcIIhOnXUU4QZGer4VcvWitUmy3b2S59x+EpkSPc43I3n55BtU5hTIpe84/PnOYVcbErj/qIvFpnQeVQ0ZjwS5+j1HbTM8gcNN6iRTo26DN54p2SpWAduR3TurP9RabesuVQBdzqfKpMwn7FPeMNMJttgZT3YzEYE3EzbRLqZLuKZjdaSW1IpHXf0BWxFQahJUyLU0Qv1iUDN23t0r/QvLxmmwxzhauBl0FVFgIT7e4hJJ0H6YPSnSbK47fw8YyejD5/fQ5NlX06zsuXrKn+/jxD8D4CBurLbj5VIKV8eN9rIMEPL4wx1EL2xNW2lhIi5Vnsj6zQG5278ru5StwZROMJ+hZTE5IWa1gozsUXOLdS8L3c6llG/u/rYyzuwAr6Jcv9GVjlg7u2C0GqrWb84Zt8vHUzrThdN+jRJtaax8Tkm/+0Z3jaqIjauIxESeh2urFEQIi06/R6p+Nb+cYvkqIQAlH3O2LJUUIZLaA5v8YIJ6IAIk/7/clNZAI8aasHNIks9veQPW/GDwEYdJptI2Yyh6cTc6TOH9ksq+N5vUXCL0iAXVcZysbPB0oUO2t4M6AQIiiRjY9ILG90ZqfjLEfzS/aV6mPlaYhmSevSLJa7q+8b2CcFgl/8K0Nx/zmzmcOq2xNKiMf+aKgtcsfOAsnAOyJo92A== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(39860400002)(346002)(396003)(376002)(136003)(451199018)(46966006)(36840700001)(40470700004)(36860700001)(316002)(70586007)(82310400005)(70206006)(2906002)(40480700001)(356005)(54906003)(8936002)(5660300002)(40460700003)(86362001)(6916009)(8676002)(4326008)(41300700001)(1076003)(82740400003)(107886003)(7636003)(6666004)(186003)(16526019)(26005)(36756003)(478600001)(47076005)(426003)(83380400001)(2616005)(336012);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 06:34:13.9435 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1504cda-d372-44d4-b116-08db099e7edd X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT057.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5162 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Rename 'nvlink_blade' in several declaration to more common name "chassis_blade", since these names are going to be used for different kinds of blades. Fix 'swicth' to 'switch' in comment. Signed-off-by: Vadim Pasternak Reviewed-by: Michael Shych --- drivers/platform/x86/mlx-platform.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c index c53eca49c47f..e629ec8a2a2f 100644 --- a/drivers/platform/x86/mlx-platform.c +++ b/drivers/platform/x86/mlx-platform.c @@ -473,7 +473,7 @@ static struct i2c_mux_reg_platform_data mlxplat_modular_mux_data[] = { }, }; -/* Platform channels for rack swicth system family */ +/* Platform channels for rack switch system family */ static const int mlxplat_rack_switch_channels[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, }; @@ -2085,7 +2085,7 @@ static struct mlxreg_core_data mlxplat_mlxcpld_global_wp_items_data[] = { }, }; -static struct mlxreg_core_item mlxplat_mlxcpld_nvlink_blade_items[] = { +static struct mlxreg_core_item mlxplat_mlxcpld_chassis_blade_items[] = { { .data = mlxplat_mlxcpld_global_wp_items_data, .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, @@ -2098,9 +2098,9 @@ static struct mlxreg_core_item mlxplat_mlxcpld_nvlink_blade_items[] = { }; static -struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_nvlink_blade_data = { - .items = mlxplat_mlxcpld_nvlink_blade_items, - .counter = ARRAY_SIZE(mlxplat_mlxcpld_nvlink_blade_items), +struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_chassis_blade_data = { + .items = mlxplat_mlxcpld_chassis_blade_items, + .counter = ARRAY_SIZE(mlxplat_mlxcpld_chassis_blade_items), .cell = MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET, .mask = MLXPLAT_CPLD_AGGR_MASK_COMEX, .cell_low = MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET, @@ -3848,8 +3848,8 @@ static struct mlxreg_core_platform_data mlxplat_modular_regs_io_data = { .counter = ARRAY_SIZE(mlxplat_mlxcpld_modular_regs_io_data), }; -/* Platform register access for NVLink blade systems family data */ -static struct mlxreg_core_data mlxplat_mlxcpld_nvlink_blade_regs_io_data[] = { +/* Platform register access for chassis blade systems family data */ +static struct mlxreg_core_data mlxplat_mlxcpld_chassis_blade_regs_io_data[] = { { .label = "cpld1_version", .reg = MLXPLAT_CPLD_LPC_REG_CPLD1_VER_OFFSET, @@ -4046,9 +4046,9 @@ static struct mlxreg_core_data mlxplat_mlxcpld_nvlink_blade_regs_io_data[] = { }, }; -static struct mlxreg_core_platform_data mlxplat_nvlink_blade_regs_io_data = { - .data = mlxplat_mlxcpld_nvlink_blade_regs_io_data, - .counter = ARRAY_SIZE(mlxplat_mlxcpld_nvlink_blade_regs_io_data), +static struct mlxreg_core_platform_data mlxplat_chassis_blade_regs_io_data = { + .data = mlxplat_mlxcpld_chassis_blade_regs_io_data, + .counter = ARRAY_SIZE(mlxplat_mlxcpld_chassis_blade_regs_io_data), }; /* Platform FAN default */ @@ -5168,14 +5168,14 @@ static int __init mlxplat_dmi_modular_matched(const struct dmi_system_id *dmi) return 1; } -static int __init mlxplat_dmi_nvlink_blade_matched(const struct dmi_system_id *dmi) +static int __init mlxplat_dmi_chassis_blade_matched(const struct dmi_system_id *dmi) { int i; mlxplat_max_adap_num = MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM; mlxplat_mux_num = ARRAY_SIZE(mlxplat_default_mux_data); mlxplat_mux_data = mlxplat_default_mux_data; - mlxplat_hotplug = &mlxplat_mlxcpld_nvlink_blade_data; + mlxplat_hotplug = &mlxplat_mlxcpld_chassis_blade_data; mlxplat_hotplug->deferred_nr = mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; for (i = 0; i < mlxplat_mux_num; i++) { @@ -5183,7 +5183,7 @@ static int __init mlxplat_dmi_nvlink_blade_matched(const struct dmi_system_id *d mlxplat_mux_data[i].n_values = ARRAY_SIZE(mlxplat_msn21xx_channels); } - mlxplat_regs_io = &mlxplat_nvlink_blade_regs_io_data; + mlxplat_regs_io = &mlxplat_chassis_blade_regs_io_data; mlxplat_i2c = &mlxplat_mlxcpld_i2c_ng_data; mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config_ng400; @@ -5288,7 +5288,7 @@ static const struct dmi_system_id mlxplat_dmi_table[] __initconst = { }, }, { - .callback = mlxplat_dmi_nvlink_blade_matched, + .callback = mlxplat_dmi_chassis_blade_matched, .matches = { DMI_MATCH(DMI_BOARD_NAME, "VMOD0015"), }, From patchwork Wed Feb 8 06:33:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 13132483 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D0DEC636CC for ; Wed, 8 Feb 2023 06:34:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230252AbjBHGeY (ORCPT ); Wed, 8 Feb 2023 01:34:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjBHGeX (ORCPT ); Wed, 8 Feb 2023 01:34:23 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2085.outbound.protection.outlook.com [40.107.237.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4E064390D for ; Tue, 7 Feb 2023 22:34:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bJ3wTnewQv5JDzEK7luJFRSvI6fP50g5jZkcKSYldh4MzAL/LFgQ9CgrjYu3lUchjwBxZzkIns1Z6vZch2uxp4b3jwlDAnVuICSyN6x+kUKNhhZzhksDUeFOxBUYcg9drhAwQ7ohsF2fJBVvx7RoYGFnUbQx868nqZt4ekwldnKICYJewiuQOJe3tweAsQNIeDqF4Bckr2/Z5uiNP/0+oWCw2qBrpmDrgYjvMP5/3X7Fjoz2nsiUTw7C811Ju9pf3GMRloN+6oC2EvlHKBgr7aRfpQvpkB8/8Kb1aWKlzCaAG7H1un6TWQDgndoD7iy3BNLfAtyD1H+qOBnGvGRdBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GFQWyNggelTX+arAvbx9+D1Kch9ioV0sSdhv98UCrgA=; b=NDN+oAYZM+EO1Stt7Q1O5vPntcHb6W2+vmb8XwcsGi6Zk8qVDGIT8PNqm7g+6Y4uS159lXN0PdCPrdQ5eOFLgeL0FRFNrfIlF6kmda8lF55t8091iIb24Qi8nY9YkOBXJKUtY2cGBPbUZIb0qaZPPXJJR2ZdGr33tnFhblu3SSZK+qNCp1VZgMQwX4BjNeoekyosfH9YNZoGexfuDTvTROZLDj7PT6RfnkEaq9dFtg8KLnpIIpFTbu7ITQNYjc9llUc7feifNKH51czTbWy6iQDP+h0ncS3YWOetxr5d0yNmvvB+7KTj51cu4uacNUfsV2N24MPlgkT7DE0hVBVgyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GFQWyNggelTX+arAvbx9+D1Kch9ioV0sSdhv98UCrgA=; b=iQjYVBEpRVN4KnOuElptYVm8twOu6GSv/ddAUXlnybgOaZvKjz+gNFSAB8ZGGtMKtV7viQ2XIYtjK2esEsc5x8oZqQeSTsqQ6ZPbV5EVyeCs8bFbVNFa85Jc3NmTDK7ELGEKC3gozVkPIAw9FVqFvXNicRihqyynt00vexsAZAppNSkQnKFSMV5ZsbnR7J1vh7V/P+eQp45IzZEFDxv0J+nMthO6IYySL8s4nu1FAz35h5q35dPSJGB8OyK7auyZaCkiqInoPw2c/ir2vq2q9jx8W7k5+/H//3xOHK5YRHM4jvA6yKeC5sMKNoVSNJG8+NYDJHo1EIDIflMXc3Kn2Q== Received: from MW4PR03CA0223.namprd03.prod.outlook.com (2603:10b6:303:b9::18) by BL1PR12MB5756.namprd12.prod.outlook.com (2603:10b6:208:393::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Wed, 8 Feb 2023 06:34:18 +0000 Received: from CO1NAM11FT040.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b9::4) by MW4PR03CA0223.outlook.office365.com (2603:10b6:303:b9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36 via Frontend Transport; Wed, 8 Feb 2023 06:34:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT040.mail.protection.outlook.com (10.13.174.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:34:18 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:34:08 -0800 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:34:07 -0800 From: Vadim Pasternak To: CC: , Vadim Pasternak Subject: [PATCH platform-next 04/13] platform: mellanox: Introduce support for next-generation 800GB/s switch Date: Wed, 8 Feb 2023 08:33:21 +0200 Message-ID: <20230208063331.15560-5-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230208063331.15560-1-vadimp@nvidia.com> References: <20230208063331.15560-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT040:EE_|BL1PR12MB5756:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c7469a6-1b90-4580-fc9c-08db099e8165 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4cJRGE3kU0cZ7mOgeOOCGFzFyRXDfx3rHik/0hK284tQFH9vx1T7lY9JOu8mAmb3wgz36Z2MwLY/UDcuYSV0JPaJ7bXoovrALciyTMC+zlYmT7tJ7nkG0FpiPXW6X4dXmKxTjaEiTeRFClX6qoPMJLbWnHoyWDhBkRwGQQzYNammAbQHoUB3xAjT1O97tIXhjIn6q6UBKPEZxZvITiGq9rFgtVZ8ojrvVxNZA2WqkD/PqvtBxKoGeheoUUP6cyiiQVmO+IcrCYQzE4ZwYdjELvC1MlyYxErgrJKWPqcFJ6OPv8LjCudWiQSfZ6io7sUBMmTneXtSANu2E/+PHTJwEnCJ4OonU5J592iWFaztihb2LfkCIsyR21jKaDcEF/C/fn9eQcz65dN8XB9hj8FuqC7Elja8htvNrI8UVBI+6cY52HNAgeQ7UioBhjdZabYpKF5HrqYFTQ9eAlyvfSpKSWPTV/YgIPsTmutT0/0AaZzT7N00XG+8z/7IbJ2Ay3zOZLv/bQQfcn/hJUzdIRV5/ejfuiFQRn0Y4tq9Xl36QxiDmjqidXhDK4J9o28Jm+hlKUIAJbFP7kVnun9EjhdrL+agHBa7izqzNJXxdPmF3g59X9/gIjYBH+Gf9YscBR7IamLjE9GlMwFFgM6sapLEd/i0iYgpBEQBACWn0pmBYogY4X1B2LZZBH7F2rXrhTvL5YCdOyrcU4rmcxxEvNboCA== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(396003)(346002)(136003)(39860400002)(376002)(451199018)(36840700001)(40470700004)(46966006)(82310400005)(54906003)(356005)(1076003)(8676002)(40480700001)(16526019)(186003)(316002)(86362001)(6666004)(107886003)(7636003)(82740400003)(26005)(478600001)(426003)(41300700001)(8936002)(336012)(83380400001)(40460700003)(47076005)(5660300002)(36756003)(4326008)(2616005)(70586007)(36860700001)(70206006)(6916009)(2906002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 06:34:18.2547 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1c7469a6-1b90-4580-fc9c-08db099e8165 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT040.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5756 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Introduce support for Nvidia next-generation 800GB/s ethernet switch SN5600. SN5600 is 51.2 Tbps Ethernet switch based on Nvidia Spectrum-4 ASIC. It can provide up to 64x800Gb/s (ETH) full bidirectional bandwidth per port using PAM-4 modulations. The system supports 64 Belly to Belly 2x4 OSFP cages. The switch was designed to fit standard 2U racks. Features: - 64 OSFP ports support 800GbE - 10GbE speed. - Additional 25GbE - 1GbE service port on the front panel. - Air-cooled with 3 + 1 redundant fan units. - 1 + 1 redundant 3000W or 3600W PSUs. - System management board is based on Intel Coffee-lake CPU E-2276 with secure-boot support. Signed-off-by: Vadim Pasternak Reviewed-by: Michael Shych --- drivers/platform/x86/mlx-platform.c | 180 ++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c index e629ec8a2a2f..cd7f6ff11b1e 100644 --- a/drivers/platform/x86/mlx-platform.c +++ b/drivers/platform/x86/mlx-platform.c @@ -253,6 +253,7 @@ #define MLXPLAT_CPLD_CH3_ETH_MODULAR 43 #define MLXPLAT_CPLD_CH4_ETH_MODULAR 51 #define MLXPLAT_CPLD_CH2_RACK_SWITCH 18 +#define MLXPLAT_CPLD_CH2_NG800 34 /* Number of LPC attached MUX platform devices */ #define MLXPLAT_CPLD_LPC_MUX_DEVS 4 @@ -503,6 +504,37 @@ static struct i2c_mux_reg_platform_data mlxplat_rack_switch_mux_data[] = { }; +/* Platform channels for ng800 system family */ +static const int mlxplat_ng800_channels[] = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 +}; + +/* Platform ng800 mux data */ +static struct i2c_mux_reg_platform_data mlxplat_ng800_mux_data[] = { + { + .parent = 1, + .base_nr = MLXPLAT_CPLD_CH1, + .write_only = 1, + .reg = (void __iomem *)MLXPLAT_CPLD_LPC_REG1, + .reg_size = 1, + .idle_in_use = 1, + .values = mlxplat_ng800_channels, + .n_values = ARRAY_SIZE(mlxplat_ng800_channels), + }, + { + .parent = 1, + .base_nr = MLXPLAT_CPLD_CH2_NG800, + .write_only = 1, + .reg = (void __iomem *)MLXPLAT_CPLD_LPC_REG2, + .reg_size = 1, + .idle_in_use = 1, + .values = mlxplat_msn21xx_channels, + .n_values = ARRAY_SIZE(mlxplat_msn21xx_channels), + }, + +}; + /* Platform hotplug devices */ static struct i2c_board_info mlxplat_mlxcpld_pwr[] = { { @@ -522,6 +554,15 @@ static struct i2c_board_info mlxplat_mlxcpld_ext_pwr[] = { }, }; +static struct i2c_board_info mlxplat_mlxcpld_pwr_ng800[] = { + { + I2C_BOARD_INFO("dps460", 0x59), + }, + { + I2C_BOARD_INFO("dps460", 0x5a), + }, +}; + static struct i2c_board_info mlxplat_mlxcpld_fan[] = { { I2C_BOARD_INFO("24c32", 0x50), @@ -601,6 +642,23 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_pwr_wc_items_data[] = { }, }; +static struct mlxreg_core_data mlxplat_mlxcpld_default_pwr_ng800_items_data[] = { + { + .label = "pwr1", + .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, + .mask = BIT(0), + .hpdev.brdinfo = &mlxplat_mlxcpld_pwr_ng800[0], + .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, + }, + { + .label = "pwr2", + .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, + .mask = BIT(1), + .hpdev.brdinfo = &mlxplat_mlxcpld_pwr_ng800[1], + .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, + }, +}; + static struct mlxreg_core_data mlxplat_mlxcpld_default_fan_items_data[] = { { .label = "fan1", @@ -1224,6 +1282,47 @@ static struct mlxreg_core_item mlxplat_mlxcpld_ext_items[] = { } }; +static struct mlxreg_core_item mlxplat_mlxcpld_ng800_items[] = { + { + .data = mlxplat_mlxcpld_default_ng_psu_items_data, + .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, + .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, + .mask = MLXPLAT_CPLD_PSU_EXT_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET, + .count = ARRAY_SIZE(mlxplat_mlxcpld_default_ng_psu_items_data), + .inversed = 1, + .health = false, + }, + { + .data = mlxplat_mlxcpld_default_pwr_ng800_items_data, + .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, + .reg = MLXPLAT_CPLD_LPC_REG_PWR_OFFSET, + .mask = MLXPLAT_CPLD_PWR_EXT_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_PSU_I2C_CAP_OFFSET, + .count = ARRAY_SIZE(mlxplat_mlxcpld_default_pwr_ng800_items_data), + .inversed = 0, + .health = false, + }, + { + .data = mlxplat_mlxcpld_default_ng_fan_items_data, + .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, + .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, + .mask = MLXPLAT_CPLD_FAN_NG_MASK, + .count = ARRAY_SIZE(mlxplat_mlxcpld_default_ng_fan_items_data), + .inversed = 1, + .health = false, + }, + { + .data = mlxplat_mlxcpld_default_asic_items_data, + .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, + .reg = MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET, + .mask = MLXPLAT_CPLD_ASIC_MASK, + .count = ARRAY_SIZE(mlxplat_mlxcpld_default_asic_items_data), + .inversed = 0, + .health = true, + }, +}; + static struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_ext_data = { .items = mlxplat_mlxcpld_ext_items, @@ -1234,6 +1333,16 @@ struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_ext_data = { .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_LOW | MLXPLAT_CPLD_LOW_AGGR_MASK_ASIC2, }; +static +struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_ng800_data = { + .items = mlxplat_mlxcpld_ng800_items, + .counter = ARRAY_SIZE(mlxplat_mlxcpld_ng800_items), + .cell = MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET, + .mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF | MLXPLAT_CPLD_AGGR_MASK_COMEX, + .cell_low = MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET, + .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_LOW | MLXPLAT_CPLD_LOW_AGGR_MASK_ASIC2, +}; + static struct mlxreg_core_data mlxplat_mlxcpld_modular_pwr_items_data[] = { { .label = "pwr1", @@ -3093,6 +3202,13 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_regs_io_data[] = { .mask = GENMASK(7, 0) & ~BIT(7), .mode = 0644, }, + { + .label = "clk_brd_prog_en", + .reg = MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(1), + .mode = 0644, + .secured = 1, + }, { .label = "erot1_recovery", .reg = MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET, @@ -3221,6 +3337,12 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_regs_io_data[] = { .mask = GENMASK(7, 0) & ~BIT(6), .mode = 0444, }, + { + .label = "reset_ac_ok_fail", + .reg = MLXPLAT_CPLD_LPC_REG_RST_CAUSE2_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(7), + .mode = 0444, + }, { .label = "psu1_on", .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, @@ -3302,6 +3424,13 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_regs_io_data[] = { .bit = 5, .mode = 0444, }, + { + .label = "pwr_converter_prog_en", + .reg = MLXPLAT_CPLD_LPC_REG_GP0_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(0), + .mode = 0644, + .secured = 1, + }, { .label = "vpd_wp", .reg = MLXPLAT_CPLD_LPC_REG_GP0_OFFSET, @@ -3326,6 +3455,30 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_regs_io_data[] = { .mask = GENMASK(7, 0) & ~BIT(1), .mode = 0444, }, + { + .label = "clk_brd1_boot_fail", + .reg = MLXPLAT_CPLD_LPC_REG_GP4_RO_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(4), + .mode = 0444, + }, + { + .label = "clk_brd2_boot_fail", + .reg = MLXPLAT_CPLD_LPC_REG_GP4_RO_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(5), + .mode = 0444, + }, + { + .label = "clk_brd_fail", + .reg = MLXPLAT_CPLD_LPC_REG_GP4_RO_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(6), + .mode = 0444, + }, + { + .label = "asic_pg_fail", + .reg = MLXPLAT_CPLD_LPC_REG_GP4_RO_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(7), + .mode = 0444, + }, { .label = "spi_chnl_select", .reg = MLXPLAT_CPLD_LPC_REG_SPI_CHNL_SELECT, @@ -5211,6 +5364,27 @@ static int __init mlxplat_dmi_rack_switch_matched(const struct dmi_system_id *dm return 1; } +static int __init mlxplat_dmi_ng800_matched(const struct dmi_system_id *dmi) +{ + int i; + + mlxplat_max_adap_num = MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM; + mlxplat_mux_num = ARRAY_SIZE(mlxplat_ng800_mux_data); + mlxplat_mux_data = mlxplat_ng800_mux_data; + mlxplat_hotplug = &mlxplat_mlxcpld_ng800_data; + mlxplat_hotplug->deferred_nr = + mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; + mlxplat_led = &mlxplat_default_ng_led_data; + mlxplat_regs_io = &mlxplat_default_ng_regs_io_data; + mlxplat_fan = &mlxplat_default_fan_data; + for (i = 0; i < ARRAY_SIZE(mlxplat_mlxcpld_wd_set_type2); i++) + mlxplat_wd_data[i] = &mlxplat_mlxcpld_wd_set_type2[i]; + mlxplat_i2c = &mlxplat_mlxcpld_i2c_ng_data; + mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config_ng400; + + return 1; +} + static const struct dmi_system_id mlxplat_dmi_table[] __initconst = { { .callback = mlxplat_dmi_default_wc_matched, @@ -5287,6 +5461,12 @@ static const struct dmi_system_id mlxplat_dmi_table[] __initconst = { DMI_MATCH(DMI_BOARD_NAME, "VMOD0011"), }, }, + { + .callback = mlxplat_dmi_ng800_matched, + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "VMOD0013"), + }, + }, { .callback = mlxplat_dmi_chassis_blade_matched, .matches = { From patchwork Wed Feb 8 06:33:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 13132485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5715C636CC for ; Wed, 8 Feb 2023 06:35:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229732AbjBHGfr (ORCPT ); Wed, 8 Feb 2023 01:35:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229630AbjBHGfq (ORCPT ); Wed, 8 Feb 2023 01:35:46 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2054.outbound.protection.outlook.com [40.107.243.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 753B838B67 for ; Tue, 7 Feb 2023 22:35:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HhK3XlG60NXQkLN+iiX0zdznRdKbCy25MsXOC70UpumDwtHND9m4cnGViDp0LDIJ8kBTRuMYKnmK0CLUTXkHsIDw18eWTZauZJ0mzTiGNgx4cd3DKzPtvMm3366BKkmTu5Ey1pUoZDPJM07uee06j/Nv0OPWOQQuQYDJqrblmG+ziMYsEUQcX70UdU/dBjWOpURFSho2rMnA91N2Hn/p2fIDd8s+BIhhFlodnQcBces1U9xfpkxWzZ/k3/FKtek+ZzCcoUA1n1cia08Q1ooYuF4KXJo+SzlYe79UfWz/wRl6Fa8Trs8RCHYoRc/u1kHvGv06C0mKKfQ31hfKIZet2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=k12UtvTSol6Jx2O0zeocFEate1dgpUCIUrTcfxVVASs=; b=MXFWhYgqeQV7e4P1CPgBzCe7+0jTjepaydiKRy3g5Q9m3cfRx9aXx2n/FNTrFoeBn0imlE1nwVnC7HIA/YXCypc4Uk1ha+OoMRGZ1zHb138tdVw5BCbjXscUCHaRQr94QGmecfHjI9i6TD4ylNiczDZi8ORTVRidkCsIvZ0O6U2MCdochVtiBy/Ls9U4KGuv7C1vBek9gMmngJHIhjqlv4AtYbRkVWfA1hPwlwyr9TGJTvoXOJQkpMPPc61x6BI/w+HjAZ22JSysKuysfg++y/7qUP4zI8riCAzGl7GL0mAsYxj1fymrgMR+BELh3JKIaA0yQXCLa7cWfTO2AJb3/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k12UtvTSol6Jx2O0zeocFEate1dgpUCIUrTcfxVVASs=; b=KgTCT0D6bEjDksThUsmk7rcCHU3nAw/VllCXDob3Y85a+kJUdQhUarsrDHgTyBjx85hr7NUkYGjujbKlDNmVgOVHmMumEkeYrm5Off6P4NDk3itgb1O799uuOEUqtjJZWenrzH//vRJfpnoyH8Otr8SveC3DP36JQbc+ryOF2qETdZK+kxjd7++jhsVjBwNv6vyACzAa1JDP7z7oiPlOluL4UJqTiJAsSc5F5SDrulkIFIAcO6bY1qnY1Ue72sByil3jR7VYLWTlV9JaZlVFMB8B8yGPD6CQNMUjVZXVyBPsTscL9MDFHdwAJfvTruBMM//TdyU+U+trLNL9w7mPZQ== Received: from DS7PR03CA0024.namprd03.prod.outlook.com (2603:10b6:5:3b8::29) by CY5PR12MB6324.namprd12.prod.outlook.com (2603:10b6:930:f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.35; Wed, 8 Feb 2023 06:35:40 +0000 Received: from DM6NAM11FT087.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b8:cafe::19) by DS7PR03CA0024.outlook.office365.com (2603:10b6:5:3b8::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36 via Frontend Transport; Wed, 8 Feb 2023 06:35:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT087.mail.protection.outlook.com (10.13.172.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:35:40 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:35:32 -0800 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:35:30 -0800 From: Vadim Pasternak To: CC: , Vadim Pasternak Subject: [PATCH platform-next 05/13] platform: mellanox: Introduce support of new Nvidia L1 switch Date: Wed, 8 Feb 2023 08:33:22 +0200 Message-ID: <20230208063331.15560-6-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230208063331.15560-1-vadimp@nvidia.com> References: <20230208063331.15560-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT087:EE_|CY5PR12MB6324:EE_ X-MS-Office365-Filtering-Correlation-Id: 488feb46-0510-45f4-5293-08db099eb25c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OTL7CfLLY9vPtU1fxcB/nhApecVN4P1pWH21teviYqDZEsQdKZnze+3wCVQZ2fYNZQE5qBOiPkaE4iZCHIv7rk196TW9cDpr7sw87WzaHahaadQX9p4l1+crHUZAS5BdXiLjhlOd4KYITIoIwEmYRjVPLR3iqSxvcHNl1jU7EK7Jif+G2tJAAfD0J10ORcTLxfXH+xZzQZ7FmSlOtYZkjmBD87pOBCCzA6cq9cTn0eAgI4m81JnhahU3eRGqRvV94rTG4Wu08/+TmWYUXzRBnMkGckMCiN3UpYQRMw0XBu46mr/CzoR2AfkphHRYzElsWd8yN4tCPSZUPpGKy36ZKzSgPSA7n46QGrMfN/ZiLZYmHX1u+jjfHvf2ga/QzAro0m1b0Md5U8MH0H5ZMfIT+9pO2t3h3HzmAl7Fh/+2cpV8OEdA7ycFF17dGohZ7wxNunApfC/hOQYRh1Sl2hyQosW/bwU011/CxGUrgFbW60kHTcH65h++dgaHQU8x63VbvmGcR7tfldvSKlilLnzhyU/GvNddE1daPOLsHzy8OZpHDeVMReEGMnbe8ACbeBMvDnb6fViJaU3rFGKQi2+0PdCo+9JhhqCINbDS+a9TzmWwIoHt8ToUWGV8PdxruudAz7e6MRHpcyn0X0HfcKt5254089CaDAeU1IMjv72mmstBfGno1+oq8d/NbFDuQZr5M1qGVEopf3SlzwZ+CvXnKw== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(346002)(396003)(39860400002)(136003)(376002)(451199018)(36840700001)(46966006)(40470700004)(54906003)(356005)(316002)(426003)(47076005)(41300700001)(36860700001)(2906002)(36756003)(8936002)(82740400003)(7636003)(30864003)(5660300002)(40480700001)(83380400001)(70586007)(70206006)(40460700003)(8676002)(6916009)(4326008)(107886003)(6666004)(16526019)(2616005)(82310400005)(478600001)(186003)(26005)(86362001)(1076003)(336012);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 06:35:40.3372 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 488feb46-0510-45f4-5293-08db099eb25c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT087.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6324 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Add support for new L1 switch nodes providing L1 connectivity for multi-node networking chassis. The purpose is to provide compute server with full management and IO subsystems with connections to L1 switches. System contains the following components: - COMe module based on Intel Coffee Lake CPU - Switch baseboard with two ASICs, while 24 ports of each ASICs are connected to one backplane connector 32 ports of each ASIC are connected to 8 OSFPs - Integrated 60mm dual-rotor FANs inside L1 node (N+2 redundancy) - Support 48V or 54V DC input from the external power server. Add the structures related to the new systems to allow proper activation of the all required platform driver. Add poweroff callback to support deep power cycle flow, which should include special actions against CPLD device for performing graceful operation. Signed-off-by: Vadim Pasternak Reviewed-by: Michael Shych --- drivers/platform/x86/mlx-platform.c | 392 +++++++++++++++++++++++++++- 1 file changed, 391 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c index cd7f6ff11b1e..1a07a9994f05 100644 --- a/drivers/platform/x86/mlx-platform.c +++ b/drivers/platform/x86/mlx-platform.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #define MLX_PLAT_DEVICE_NAME "mlxplat" @@ -61,12 +62,19 @@ #define MLXPLAT_CPLD_LPC_REG_PWM_CONTROL_OFFSET 0x37 #define MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET 0x3a #define MLXPLAT_CPLD_LPC_REG_AGGR_MASK_OFFSET 0x3b +#define MLXPLAT_CPLD_LPC_REG_DBG1_OFFSET 0x3c +#define MLXPLAT_CPLD_LPC_REG_DBG2_OFFSET 0x3d +#define MLXPLAT_CPLD_LPC_REG_DBG3_OFFSET 0x3e +#define MLXPLAT_CPLD_LPC_REG_DBG4_OFFSET 0x3f #define MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET 0x40 #define MLXPLAT_CPLD_LPC_REG_AGGRLO_MASK_OFFSET 0x41 #define MLXPLAT_CPLD_LPC_REG_AGGRCO_OFFSET 0x42 #define MLXPLAT_CPLD_LPC_REG_AGGRCO_MASK_OFFSET 0x43 #define MLXPLAT_CPLD_LPC_REG_AGGRCX_OFFSET 0x44 #define MLXPLAT_CPLD_LPC_REG_AGGRCX_MASK_OFFSET 0x45 +#define MLXPLAT_CPLD_LPC_REG_BRD_OFFSET 0x47 +#define MLXPLAT_CPLD_LPC_REG_BRD_EVENT_OFFSET 0x48 +#define MLXPLAT_CPLD_LPC_REG_BRD_MASK_OFFSET 0x49 #define MLXPLAT_CPLD_LPC_REG_GWP_OFFSET 0x4a #define MLXPLAT_CPLD_LPC_REG_GWP_EVENT_OFFSET 0x4b #define MLXPLAT_CPLD_LPC_REG_GWP_MASK_OFFSET 0x4c @@ -96,6 +104,9 @@ #define MLXPLAT_CPLD_LPC_REG_EROTE_OFFSET 0x94 #define MLXPLAT_CPLD_LPC_REG_EROTE_EVENT_OFFSET 0x95 #define MLXPLAT_CPLD_LPC_REG_EROTE_MASK_OFFSET 0x96 +#define MLXPLAT_CPLD_LPC_REG_PWRB_OFFSET 0x97 +#define MLXPLAT_CPLD_LPC_REG_PWRB_EVENT_OFFSET 0x98 +#define MLXPLAT_CPLD_LPC_REG_PWRB_MASK_OFFSET 0x99 #define MLXPLAT_CPLD_LPC_REG_LC_VR_OFFSET 0x9a #define MLXPLAT_CPLD_LPC_REG_LC_VR_EVENT_OFFSET 0x9b #define MLXPLAT_CPLD_LPC_REG_LC_VR_MASK_OFFSET 0x9c @@ -127,6 +138,7 @@ #define MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET 0xd1 #define MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET 0xd2 #define MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET 0xd3 +#define MLXPLAT_CPLD_LPC_REG_DBG_CTRL_OFFSET 0xd9 #define MLXPLAT_CPLD_LPC_REG_CPLD1_MVER_OFFSET 0xde #define MLXPLAT_CPLD_LPC_REG_CPLD2_MVER_OFFSET 0xdf #define MLXPLAT_CPLD_LPC_REG_CPLD3_MVER_OFFSET 0xe0 @@ -210,6 +222,7 @@ MLXPLAT_CPLD_AGGR_MASK_LC_SDWN) #define MLXPLAT_CPLD_LOW_AGGR_MASK_LOW 0xc1 #define MLXPLAT_CPLD_LOW_AGGR_MASK_ASIC2 BIT(2) +#define MLXPLAT_CPLD_LOW_AGGR_MASK_PWR_BUT BIT(4) #define MLXPLAT_CPLD_LOW_AGGR_MASK_I2C BIT(6) #define MLXPLAT_CPLD_PSU_MASK GENMASK(1, 0) #define MLXPLAT_CPLD_PWR_MASK GENMASK(1, 0) @@ -223,6 +236,16 @@ #define MLXPLAT_CPLD_VOLTREG_UPD_MASK GENMASK(5, 4) #define MLXPLAT_CPLD_GWP_MASK GENMASK(0, 0) #define MLXPLAT_CPLD_EROT_MASK GENMASK(1, 0) +#define MLXPLAT_CPLD_PWR_BUTTON_MASK BIT(0) +#define MLXPLAT_CPLD_LATCH_RST_MASK BIT(5) +#define MLXPLAT_CPLD_THERMAL1_PDB_MASK BIT(3) +#define MLXPLAT_CPLD_THERMAL2_PDB_MASK BIT(4) +#define MLXPLAT_CPLD_INTRUSION_MASK BIT(6) +#define MLXPLAT_CPLD_PWM_PG_MASK BIT(7) +#define MLXPLAT_CPLD_L1_CHA_HEALTH_MASK (MLXPLAT_CPLD_THERMAL1_PDB_MASK | \ + MLXPLAT_CPLD_THERMAL2_PDB_MASK | \ + MLXPLAT_CPLD_INTRUSION_MASK |\ + MLXPLAT_CPLD_PWM_PG_MASK) #define MLXPLAT_CPLD_I2C_CAP_BIT 0x04 #define MLXPLAT_CPLD_I2C_CAP_MASK GENMASK(5, MLXPLAT_CPLD_I2C_CAP_BIT) @@ -235,6 +258,8 @@ /* Masks for aggregation for modular systems */ #define MLXPLAT_CPLD_LPC_LC_MASK GENMASK(7, 0) +#define MLXPLAT_CPLD_HALT_MASK BIT(3) + /* Default I2C parent bus number */ #define MLXPLAT_CPLD_PHYS_ADAPTER_DEF_NR 1 @@ -315,6 +340,8 @@ struct mlxplat_priv { void *regmap; }; +static struct platform_device *mlxplat_dev; + /* Regions for LPC I2C controller and LPC base register space */ static const struct resource mlxplat_lpc_resources[] = { [0] = DEFINE_RES_NAMED(MLXPLAT_CPLD_LPC_I2C_BASE_ADRR, @@ -2307,6 +2334,156 @@ struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_rack_switch_data = { .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_LOW, }; +/* Callback performs graceful shutdown after notification about power button event */ +static int +mlxplat_mlxcpld_l1_switch_pwr_events_handler(void *handle, enum mlxreg_hotplug_kind kind, + u8 action) +{ + dev_info(&mlxplat_dev->dev, "System shutdown due to short press of power button"); + kernel_halt(); + return 0; +} + +static struct mlxreg_core_hotplug_notifier mlxplat_mlxcpld_l1_switch_pwr_events_notifier = { + .user_handler = mlxplat_mlxcpld_l1_switch_pwr_events_handler, +}; + +/* Platform hotplug for l1 switch systems family data */ +static struct mlxreg_core_data mlxplat_mlxcpld_l1_switch_pwr_events_items_data[] = { + { + .label = "power_button", + .reg = MLXPLAT_CPLD_LPC_REG_PWRB_OFFSET, + .mask = MLXPLAT_CPLD_PWR_BUTTON_MASK, + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, + .hpdev.notifier = &mlxplat_mlxcpld_l1_switch_pwr_events_notifier, + }, +}; + +/* Callback activates latch reset flow after notification about intrusion event */ +static int +mlxplat_mlxcpld_l1_switch_intrusion_events_handler(void *handle, enum mlxreg_hotplug_kind kind, + u8 action) +{ + struct mlxplat_priv *priv = platform_get_drvdata(mlxplat_dev); + u32 regval; + int err; + + err = regmap_read(priv->regmap, MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, ®val); + if (err) + goto fail_regmap_read; + + if (action) { + dev_info(&mlxplat_dev->dev, "Detected intrusion - system latch is opened"); + err = regmap_write(priv->regmap, MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, + regval | MLXPLAT_CPLD_LATCH_RST_MASK); + } else { + dev_info(&mlxplat_dev->dev, "System latch is properly closed"); + err = regmap_write(priv->regmap, MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, + regval & ~MLXPLAT_CPLD_LATCH_RST_MASK); + } + + if (err) + goto fail_regmap_write; + + return 0; + +fail_regmap_read: +fail_regmap_write: + dev_err(&mlxplat_dev->dev, "Register access failed"); + return err; +} + +static struct mlxreg_core_hotplug_notifier mlxplat_mlxcpld_l1_switch_intrusion_events_notifier = { + .user_handler = mlxplat_mlxcpld_l1_switch_intrusion_events_handler, +}; + +static struct mlxreg_core_data mlxplat_mlxcpld_l1_switch_health_events_items_data[] = { + { + .label = "thermal1_pdb", + .reg = MLXPLAT_CPLD_LPC_REG_BRD_OFFSET, + .mask = MLXPLAT_CPLD_THERMAL1_PDB_MASK, + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, + }, + { + .label = "thermal2_pdb", + .reg = MLXPLAT_CPLD_LPC_REG_BRD_OFFSET, + .mask = MLXPLAT_CPLD_THERMAL2_PDB_MASK, + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, + }, + { + .label = "intrusion", + .reg = MLXPLAT_CPLD_LPC_REG_BRD_OFFSET, + .mask = MLXPLAT_CPLD_INTRUSION_MASK, + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, + .hpdev.notifier = &mlxplat_mlxcpld_l1_switch_intrusion_events_notifier, + }, + { + .label = "pwm_pg", + .reg = MLXPLAT_CPLD_LPC_REG_BRD_OFFSET, + .mask = MLXPLAT_CPLD_PWM_PG_MASK, + .hpdev.nr = MLXPLAT_CPLD_NR_NONE, + }, +}; + +static struct mlxreg_core_item mlxplat_mlxcpld_l1_switch_events_items[] = { + { + .data = mlxplat_mlxcpld_default_ng_fan_items_data, + .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, + .reg = MLXPLAT_CPLD_LPC_REG_FAN_OFFSET, + .mask = MLXPLAT_CPLD_FAN_NG_MASK, + .count = ARRAY_SIZE(mlxplat_mlxcpld_default_ng_fan_items_data), + .inversed = 1, + .health = false, + }, + { + .data = mlxplat_mlxcpld_erot_ap_items_data, + .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, + .reg = MLXPLAT_CPLD_LPC_REG_EROT_OFFSET, + .mask = MLXPLAT_CPLD_EROT_MASK, + .count = ARRAY_SIZE(mlxplat_mlxcpld_erot_ap_items_data), + .inversed = 1, + .health = false, + }, + { + .data = mlxplat_mlxcpld_erot_error_items_data, + .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, + .reg = MLXPLAT_CPLD_LPC_REG_EROTE_OFFSET, + .mask = MLXPLAT_CPLD_EROT_MASK, + .count = ARRAY_SIZE(mlxplat_mlxcpld_erot_error_items_data), + .inversed = 1, + .health = false, + }, + { + .data = mlxplat_mlxcpld_l1_switch_pwr_events_items_data, + .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, + .reg = MLXPLAT_CPLD_LPC_REG_PWRB_OFFSET, + .mask = MLXPLAT_CPLD_PWR_BUTTON_MASK, + .count = ARRAY_SIZE(mlxplat_mlxcpld_l1_switch_pwr_events_items_data), + .inversed = 0, + .health = false, + }, + { + .data = mlxplat_mlxcpld_l1_switch_health_events_items_data, + .aggr_mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF, + .reg = MLXPLAT_CPLD_LPC_REG_BRD_OFFSET, + .mask = MLXPLAT_CPLD_L1_CHA_HEALTH_MASK, + .count = ARRAY_SIZE(mlxplat_mlxcpld_l1_switch_health_events_items_data), + .inversed = 0, + .health = false, + .ind = 8, + }, +}; + +static +struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_l1_switch_data = { + .items = mlxplat_mlxcpld_l1_switch_events_items, + .counter = ARRAY_SIZE(mlxplat_mlxcpld_l1_switch_events_items), + .cell = MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET, + .mask = MLXPLAT_CPLD_AGGR_MASK_NG_DEF | MLXPLAT_CPLD_AGGR_MASK_COMEX, + .cell_low = MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET, + .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_LOW | MLXPLAT_CPLD_LOW_AGGR_MASK_PWR_BUT, +}; + /* Platform led default data */ static struct mlxreg_core_data mlxplat_mlxcpld_default_led_data[] = { { @@ -2836,6 +3013,114 @@ static struct mlxreg_core_platform_data mlxplat_modular_led_data = { .counter = ARRAY_SIZE(mlxplat_mlxcpld_modular_led_data), }; +/* Platform led data for chassis system */ +static struct mlxreg_core_data mlxplat_mlxcpld_l1_switch_led_data[] = { + { + .label = "status:green", + .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, + .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, + }, + { + .label = "status:orange", + .reg = MLXPLAT_CPLD_LPC_REG_LED1_OFFSET, + .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK + }, + { + .label = "fan1:green", + .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, + .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, + .bit = BIT(0), + }, + { + .label = "fan1:orange", + .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, + .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, + .bit = BIT(0), + }, + { + .label = "fan2:green", + .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, + .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, + .bit = BIT(1), + }, + { + .label = "fan2:orange", + .reg = MLXPLAT_CPLD_LPC_REG_LED2_OFFSET, + .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, + .bit = BIT(1), + }, + { + .label = "fan3:green", + .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, + .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, + .bit = BIT(2), + }, + { + .label = "fan3:orange", + .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, + .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, + .bit = BIT(2), + }, + { + .label = "fan4:green", + .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, + .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, + .bit = BIT(3), + }, + { + .label = "fan4:orange", + .reg = MLXPLAT_CPLD_LPC_REG_LED3_OFFSET, + .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, + .bit = BIT(3), + }, + { + .label = "fan5:green", + .reg = MLXPLAT_CPLD_LPC_REG_LED4_OFFSET, + .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, + .bit = BIT(4), + }, + { + .label = "fan5:orange", + .reg = MLXPLAT_CPLD_LPC_REG_LED4_OFFSET, + .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, + .bit = BIT(4), + }, + { + .label = "fan6:green", + .reg = MLXPLAT_CPLD_LPC_REG_LED4_OFFSET, + .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, + .bit = BIT(5), + }, + { + .label = "fan6:orange", + .reg = MLXPLAT_CPLD_LPC_REG_LED4_OFFSET, + .mask = MLXPLAT_CPLD_LED_HI_NIBBLE_MASK, + .capability = MLXPLAT_CPLD_LPC_REG_FAN_DRW_CAP_OFFSET, + .bit = BIT(5), + }, + { + .label = "uid:blue", + .reg = MLXPLAT_CPLD_LPC_REG_LED5_OFFSET, + .mask = MLXPLAT_CPLD_LED_LO_NIBBLE_MASK, + }, +}; + +static struct mlxreg_core_platform_data mlxplat_l1_switch_led_data = { + .data = mlxplat_mlxcpld_l1_switch_led_data, + .counter = ARRAY_SIZE(mlxplat_mlxcpld_l1_switch_led_data), +}; + /* Platform register access default */ static struct mlxreg_core_data mlxplat_mlxcpld_default_regs_io_data[] = { { @@ -3367,12 +3652,48 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_regs_io_data[] = { .mask = GENMASK(7, 0) & ~BIT(3), .mode = 0200, }, + { + .label = "deep_pwr_cycle", + .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(5), + .mode = 0200, + }, + { + .label = "latch_reset", + .reg = MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, + .mask = GENMASK(7, 0) & ~BIT(5), + .mode = 0200, + }, { .label = "jtag_enable", .reg = MLXPLAT_CPLD_LPC_REG_GP2_OFFSET, .mask = GENMASK(7, 0) & ~BIT(4), .mode = 0644, }, + { + .label = "dbg1", + .reg = MLXPLAT_CPLD_LPC_REG_DBG1_OFFSET, + .bit = GENMASK(7, 0), + .mode = 0644, + }, + { + .label = "dbg2", + .reg = MLXPLAT_CPLD_LPC_REG_DBG2_OFFSET, + .bit = GENMASK(7, 0), + .mode = 0644, + }, + { + .label = "dbg3", + .reg = MLXPLAT_CPLD_LPC_REG_DBG3_OFFSET, + .bit = GENMASK(7, 0), + .mode = 0644, + }, + { + .label = "dbg4", + .reg = MLXPLAT_CPLD_LPC_REG_DBG4_OFFSET, + .bit = GENMASK(7, 0), + .mode = 0644, + }, { .label = "asic_health", .reg = MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET, @@ -4586,11 +4907,18 @@ static bool mlxplat_mlxcpld_writeable_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_SAFE_BIOS_OFFSET: case MLXPLAT_CPLD_LPC_SAFE_BIOS_WP_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGR_MASK_OFFSET: + case MLXPLAT_CPLD_LPC_REG_DBG1_OFFSET: + case MLXPLAT_CPLD_LPC_REG_DBG2_OFFSET: + case MLXPLAT_CPLD_LPC_REG_DBG3_OFFSET: + case MLXPLAT_CPLD_LPC_REG_DBG4_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRLO_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRCO_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRCX_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_GWP_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_GWP_MASK_OFFSET: + case MLXPLAT_CPLD_LPC_REG_BRD_OFFSET: + case MLXPLAT_CPLD_LPC_REG_BRD_EVENT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_BRD_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_ASIC_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_ASIC_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_ASIC2_EVENT_OFFSET: @@ -4605,6 +4933,8 @@ static bool mlxplat_mlxcpld_writeable_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_EROT_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_EROTE_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_EROTE_MASK_OFFSET: + case MLXPLAT_CPLD_LPC_REG_PWRB_EVENT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_PWRB_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRLC_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_LC_IN_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_LC_IN_MASK_OFFSET: @@ -4633,6 +4963,7 @@ static bool mlxplat_mlxcpld_writeable_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET: case MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET: case MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_DBG_CTRL_OFFSET: case MLXPLAT_CPLD_LPC_REG_PWM1_OFFSET: case MLXPLAT_CPLD_LPC_REG_PWM2_OFFSET: case MLXPLAT_CPLD_LPC_REG_PWM3_OFFSET: @@ -4683,6 +5014,10 @@ static bool mlxplat_mlxcpld_readable_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_SAFE_BIOS_WP_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGR_MASK_OFFSET: + case MLXPLAT_CPLD_LPC_REG_DBG1_OFFSET: + case MLXPLAT_CPLD_LPC_REG_DBG2_OFFSET: + case MLXPLAT_CPLD_LPC_REG_DBG3_OFFSET: + case MLXPLAT_CPLD_LPC_REG_DBG4_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRLO_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRCO_OFFSET: @@ -4692,6 +5027,9 @@ static bool mlxplat_mlxcpld_readable_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_GWP_OFFSET: case MLXPLAT_CPLD_LPC_REG_GWP_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_GWP_MASK_OFFSET: + case MLXPLAT_CPLD_LPC_REG_BRD_OFFSET: + case MLXPLAT_CPLD_LPC_REG_BRD_EVENT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_BRD_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET: case MLXPLAT_CPLD_LPC_REG_ASIC_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_ASIC_MASK_OFFSET: @@ -4713,6 +5051,9 @@ static bool mlxplat_mlxcpld_readable_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_EROTE_OFFSET: case MLXPLAT_CPLD_LPC_REG_EROTE_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_EROTE_MASK_OFFSET: + case MLXPLAT_CPLD_LPC_REG_PWRB_OFFSET: + case MLXPLAT_CPLD_LPC_REG_PWRB_EVENT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_PWRB_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRLC_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRLC_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_LC_IN_OFFSET: @@ -4749,6 +5090,7 @@ static bool mlxplat_mlxcpld_readable_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET: case MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET: case MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_DBG_CTRL_OFFSET: case MLXPLAT_CPLD_LPC_REG_CPLD1_MVER_OFFSET: case MLXPLAT_CPLD_LPC_REG_CPLD2_MVER_OFFSET: case MLXPLAT_CPLD_LPC_REG_CPLD3_MVER_OFFSET: @@ -4825,6 +5167,10 @@ static bool mlxplat_mlxcpld_volatile_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_SAFE_BIOS_WP_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGR_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGR_MASK_OFFSET: + case MLXPLAT_CPLD_LPC_REG_DBG1_OFFSET: + case MLXPLAT_CPLD_LPC_REG_DBG2_OFFSET: + case MLXPLAT_CPLD_LPC_REG_DBG3_OFFSET: + case MLXPLAT_CPLD_LPC_REG_DBG4_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRLO_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRLO_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRCO_OFFSET: @@ -4834,6 +5180,9 @@ static bool mlxplat_mlxcpld_volatile_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_GWP_OFFSET: case MLXPLAT_CPLD_LPC_REG_GWP_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_GWP_MASK_OFFSET: + case MLXPLAT_CPLD_LPC_REG_BRD_OFFSET: + case MLXPLAT_CPLD_LPC_REG_BRD_EVENT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_BRD_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_ASIC_HEALTH_OFFSET: case MLXPLAT_CPLD_LPC_REG_ASIC_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_ASIC_MASK_OFFSET: @@ -4855,6 +5204,9 @@ static bool mlxplat_mlxcpld_volatile_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_EROTE_OFFSET: case MLXPLAT_CPLD_LPC_REG_EROTE_EVENT_OFFSET: case MLXPLAT_CPLD_LPC_REG_EROTE_MASK_OFFSET: + case MLXPLAT_CPLD_LPC_REG_PWRB_OFFSET: + case MLXPLAT_CPLD_LPC_REG_PWRB_EVENT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_PWRB_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRLC_OFFSET: case MLXPLAT_CPLD_LPC_REG_AGGRLC_MASK_OFFSET: case MLXPLAT_CPLD_LPC_REG_LC_IN_OFFSET: @@ -4885,6 +5237,7 @@ static bool mlxplat_mlxcpld_volatile_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_WD2_TLEFT_OFFSET: case MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET: case MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET: + case MLXPLAT_CPLD_LPC_REG_DBG_CTRL_OFFSET: case MLXPLAT_CPLD_LPC_REG_CPLD1_MVER_OFFSET: case MLXPLAT_CPLD_LPC_REG_CPLD2_MVER_OFFSET: case MLXPLAT_CPLD_LPC_REG_CPLD3_MVER_OFFSET: @@ -5080,7 +5433,6 @@ static struct resource mlxplat_mlxcpld_resources[] = { [0] = DEFINE_RES_IRQ_NAMED(MLXPLAT_CPLD_LPC_SYSIRQ, "mlxreg-hotplug"), }; -static struct platform_device *mlxplat_dev; static struct mlxreg_core_hotplug_platform_data *mlxplat_i2c; static struct mlxreg_core_hotplug_platform_data *mlxplat_hotplug; static struct mlxreg_core_platform_data *mlxplat_led; @@ -5090,6 +5442,14 @@ static struct mlxreg_core_platform_data *mlxplat_wd_data[MLXPLAT_CPLD_WD_MAX_DEVS]; static const struct regmap_config *mlxplat_regmap_config; +/* Platform default poweroff function */ +static void mlxplat_poweroff(void) +{ + struct mlxplat_priv *priv = platform_get_drvdata(mlxplat_dev); + + regmap_write(priv->regmap, MLXPLAT_CPLD_LPC_REG_GP1_OFFSET, MLXPLAT_CPLD_HALT_MASK); +} + static int __init mlxplat_dmi_default_matched(const struct dmi_system_id *dmi) { int i; @@ -5385,6 +5745,28 @@ static int __init mlxplat_dmi_ng800_matched(const struct dmi_system_id *dmi) return 1; } +static int __init mlxplat_dmi_l1_switch_matched(const struct dmi_system_id *dmi) +{ + int i; + + mlxplat_max_adap_num = MLXPLAT_CPLD_MAX_PHYS_ADAPTER_NUM; + mlxplat_mux_num = ARRAY_SIZE(mlxplat_rack_switch_mux_data); + mlxplat_mux_data = mlxplat_rack_switch_mux_data; + mlxplat_hotplug = &mlxplat_mlxcpld_l1_switch_data; + mlxplat_hotplug->deferred_nr = + mlxplat_msn21xx_channels[MLXPLAT_CPLD_GRP_CHNL_NUM - 1]; + mlxplat_led = &mlxplat_l1_switch_led_data; + mlxplat_regs_io = &mlxplat_default_ng_regs_io_data; + mlxplat_fan = &mlxplat_default_fan_data; + for (i = 0; i < ARRAY_SIZE(mlxplat_mlxcpld_wd_set_type2); i++) + mlxplat_wd_data[i] = &mlxplat_mlxcpld_wd_set_type2[i]; + mlxplat_i2c = &mlxplat_mlxcpld_i2c_ng_data; + mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config_rack_switch; + pm_power_off = mlxplat_poweroff; + + return 1; +} + static const struct dmi_system_id mlxplat_dmi_table[] __initconst = { { .callback = mlxplat_dmi_default_wc_matched, @@ -5473,6 +5855,12 @@ static const struct dmi_system_id mlxplat_dmi_table[] __initconst = { DMI_MATCH(DMI_BOARD_NAME, "VMOD0015"), }, }, + { + .callback = mlxplat_dmi_l1_switch_matched, + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "VMOD0017"), + }, + }, { .callback = mlxplat_dmi_msn274x_matched, .matches = { @@ -5802,6 +6190,8 @@ static void __exit mlxplat_exit(void) struct mlxplat_priv *priv = platform_get_drvdata(mlxplat_dev); int i; + if (pm_power_off) + pm_power_off = NULL; for (i = MLXPLAT_CPLD_WD_MAX_DEVS - 1; i >= 0 ; i--) platform_device_unregister(priv->pdev_wd[i]); if (priv->pdev_fan) From patchwork Wed Feb 8 06:33:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 13132484 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E902C636D3 for ; Wed, 8 Feb 2023 06:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229559AbjBHGfr (ORCPT ); Wed, 8 Feb 2023 01:35:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbjBHGfq (ORCPT ); Wed, 8 Feb 2023 01:35:46 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2056.outbound.protection.outlook.com [40.107.94.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B369442C2 for ; Tue, 7 Feb 2023 22:35:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OGdAuhCczTnTY7mNw2vicWwcgwMZx4Paa/lKE5/eeN77ehFaCziArFJ7b+YIJuqMgDP7y9u1tRal9caAbjvk+Y01O4oYnXp/yOHSN7hVkJEw78ipCWyDblg6emPRJii77PSimAzJ0eYb3K4mL42aku2B+AYxcxfmMwUovPgn6UPY0164xicqdXgb/SJnwWSXe8mX+36OY4SoxSBlWX0VV79i9bsOvt39zToCuqDqUG4abwj25qoH5m7PTNFKFbDMsaiIBxDfiRZiCz5zcirPExTUA6KeeRS58QVLrcilshyDWJRNVCHNyaIxImkbvGhtZWUMd1j7c4J42S81PuFGNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DEV6TBKtc9+XbpTz68e9Vux5FR/vXlDRTqKAFC6NgZU=; b=kHvxI86NhKdXUdtp238w2QtEPqd4B26GLs9Uf70b9XNdMRK2IGd8/IPDTiHCX6tz3qOz/s6o/ak4jRs1jdWVmuUR7q+BSkxjyhhVU3Q/lJ9u0LBF7t9+Kmxa0Y5tNaBhCKzA5GkS4kEIHMXvF7eK2R3kKAVcbexN8q4Nd6gyFJfy5iEAEejP2ffvh8Ob+1BciapOtg+Kw+DC0CM30i/VBLNTHMYuv0/Sitd0QJqXjyH+J/qlKU56Drwd9DmbzSQG0vjtuyA3QTbwnCj8NG40PItmx5VDyyaSi13f1NJW5PsRyd1eFMojOdwz/JWFxdMdnqUqN4GmLbj+XwmeLD7upQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DEV6TBKtc9+XbpTz68e9Vux5FR/vXlDRTqKAFC6NgZU=; b=EmuXyXp2QO3bOTB0tDc7aNLbSzEtf1bZ+JT9dLrCpqVZkaur2gC92CL4uSFDFNpdXgb3PTECOc/05KuyWfkK3mfQOdJD0Ffok5GMXZn98Ig+bjuQ/pJLz8n7QigwTPjxDEKkpADOoMsHOHQx64cfiMal7fubnls54cTuFpZo2+VBr7jKiJE2tkbsxdL7Qj9WisrmMpIyjr1ATEVtMvtVyNYNDuMHkEFt+JEQNIe8FA3qX8QjIW+G53vawBFQhJW2GAycwPdxGxe7JX7flZThF8X/ag/gYSGNWIZPNeKwH8shpSCrlq7Y5l5FZMOvzi1LPM9/AoPhjxZxHlLusENOpA== Received: from DM6PR07CA0129.namprd07.prod.outlook.com (2603:10b6:5:330::23) by CH2PR12MB4971.namprd12.prod.outlook.com (2603:10b6:610:6b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.35; Wed, 8 Feb 2023 06:35:43 +0000 Received: from DM6NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:5:330:cafe::bf) by DM6PR07CA0129.outlook.office365.com (2603:10b6:5:330::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.35 via Frontend Transport; Wed, 8 Feb 2023 06:35:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT009.mail.protection.outlook.com (10.13.173.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.16 via Frontend Transport; Wed, 8 Feb 2023 06:35:43 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:35:35 -0800 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:35:34 -0800 From: Vadim Pasternak To: CC: , Vadim Pasternak Subject: [PATCH platform-next 06/13] platform: mellanox: Split initialization procedure Date: Wed, 8 Feb 2023 08:33:23 +0200 Message-ID: <20230208063331.15560-7-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230208063331.15560-1-vadimp@nvidia.com> References: <20230208063331.15560-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT009:EE_|CH2PR12MB4971:EE_ X-MS-Office365-Filtering-Correlation-Id: 453f8300-9168-41fd-6958-08db099eb40f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TsuMT2Glz+G94FMGq50eiwWfwCuJ5jEPhBMbFu/Ow/jkLCftiG5hgYRsC0m3MXMaV2MuZqa7ru/kcl9QFHt0LAcqWJk0JnpXjltpdXtzg4Bq40DFdaRrisPZpvU/5LJXagqx2+rbsv/nrmYqQFUdhojEAHaj4XVQbsp1oNQaRjycxBc2C3hiCK+UvHEz714WSm8oq6D2c9Z1FJMzklB0U9TXxYwGyYprIEuNctKFPL06mle+6fxHpRX9lVNpe6KX/2Ji6M023mK7ItKIt3TRfF3a6xLq6jBcdll9pSsScXsP5vIc5+4W31qaDW8lcVRtz7Sd8MhDrP8bfk1S+Z3Qt8jwNLSGbutdrUK6m5Moo+L2E4oXM1mKr27Z1VseKKQGdn9vzTuiMuuVjqAL21HxkMU14WMpxfxgBEhMVg0whOi8MrO3W83cUCs4DY9vA0ZWHGW82gbnz4XV/ZVdb6qJylHru497oTXpRhG9hWZDQzDna7LbpIPaf71BnZQJTzXwXCXooSx0iHLXCdZnB96rIRnpplOXFneBbh8edUquuSIiZbHaQvmuUh0qaXWur13AdADkcuRQjZkjNh9qpDWKM6Nit24rLQlBxT+gYAT8K7Z28NomzDZBZfGsf4ftz78yek5T95mnYHxT5PLeB7HOiRAwfU1o4J5ac/9DitepB47Z/KaZHLiAGGaUmlyVr9UBx/GSBR/0pM6p8V0jHMbwMw== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(376002)(346002)(396003)(136003)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(36756003)(86362001)(36860700001)(70206006)(70586007)(7636003)(2616005)(316002)(54906003)(40460700003)(8676002)(4326008)(6916009)(478600001)(5660300002)(2906002)(40480700001)(82310400005)(82740400003)(6666004)(8936002)(41300700001)(47076005)(1076003)(16526019)(26005)(186003)(426003)(107886003)(336012)(83380400001)(356005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 06:35:43.1886 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 453f8300-9168-41fd-6958-08db099eb40f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4971 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Split mlxplat_init() into two by adding mlxplat_pre_init(). Motivation is to prepare 'mlx-platform' driver to support systems equipped PCIe based programming logic device. Such systems are supposed to use different system resources, thus this commit separates resources allocation related code. Signed-off-by: Vadim Pasternak Reviewed-by: Michael Shych --- drivers/platform/x86/mlx-platform.c | 78 ++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 18 deletions(-) diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c index 1a07a9994f05..2d33d1e5d427 100644 --- a/drivers/platform/x86/mlx-platform.c +++ b/drivers/platform/x86/mlx-platform.c @@ -328,6 +328,8 @@ * @pdev_fan - FAN platform devices * @pdev_wd - array of watchdog platform devices * @regmap: device register map + * @hotplug_resources: system hotplug resources + * @hotplug_resources_size: size of system hotplug resources */ struct mlxplat_priv { struct platform_device *pdev_i2c; @@ -338,6 +340,8 @@ struct mlxplat_priv { struct platform_device *pdev_fan; struct platform_device *pdev_wd[MLXPLAT_CPLD_WD_MAX_DEVS]; void *regmap; + struct resource *hotplug_resources; + unsigned int hotplug_resources_size; }; static struct platform_device *mlxplat_dev; @@ -6002,20 +6006,63 @@ static int mlxplat_mlxcpld_check_wd_capability(void *regmap) return 0; } +static int mlxplat_lpc_cpld_device_init(struct resource **hotplug_resources, + unsigned int *hotplug_resources_size) +{ + int err; + + mlxplat_dev = platform_device_register_simple(MLX_PLAT_DEVICE_NAME, PLATFORM_DEVID_NONE, + mlxplat_lpc_resources, + ARRAY_SIZE(mlxplat_lpc_resources)); + if (IS_ERR(mlxplat_dev)) + return PTR_ERR(mlxplat_dev); + + mlxplat_mlxcpld_regmap_ctx.base = devm_ioport_map(&mlxplat_dev->dev, + mlxplat_lpc_resources[1].start, 1); + if (!mlxplat_mlxcpld_regmap_ctx.base) { + err = -ENOMEM; + goto fail_devm_ioport_map; + } + + *hotplug_resources = mlxplat_mlxcpld_resources; + *hotplug_resources_size = ARRAY_SIZE(mlxplat_mlxcpld_resources); + + return 0; + +fail_devm_ioport_map: + platform_device_unregister(mlxplat_dev); + return err; +} + +static void mlxplat_lpc_cpld_device_exit(void) +{ + platform_device_unregister(mlxplat_dev); +} + +static int +mlxplat_pre_init(struct resource **hotplug_resources, unsigned int *hotplug_resources_size) +{ + return mlxplat_lpc_cpld_device_init(hotplug_resources, hotplug_resources_size); +} + +static void mlxplat_post_exit(void) +{ + mlxplat_lpc_cpld_device_exit(); +} + static int __init mlxplat_init(void) { + unsigned int hotplug_resources_size; + struct resource *hotplug_resources; struct mlxplat_priv *priv; int i, j, nr, err; if (!dmi_check_system(mlxplat_dmi_table)) return -ENODEV; - mlxplat_dev = platform_device_register_simple(MLX_PLAT_DEVICE_NAME, PLATFORM_DEVID_NONE, - mlxplat_lpc_resources, - ARRAY_SIZE(mlxplat_lpc_resources)); - - if (IS_ERR(mlxplat_dev)) - return PTR_ERR(mlxplat_dev); + err = mlxplat_pre_init(&hotplug_resources, &hotplug_resources_size); + if (err) + return err; priv = devm_kzalloc(&mlxplat_dev->dev, sizeof(struct mlxplat_priv), GFP_KERNEL); @@ -6025,12 +6072,8 @@ static int __init mlxplat_init(void) } platform_set_drvdata(mlxplat_dev, priv); - mlxplat_mlxcpld_regmap_ctx.base = devm_ioport_map(&mlxplat_dev->dev, - mlxplat_lpc_resources[1].start, 1); - if (!mlxplat_mlxcpld_regmap_ctx.base) { - err = -ENOMEM; - goto fail_alloc; - } + priv->hotplug_resources = hotplug_resources; + priv->hotplug_resources_size = hotplug_resources_size; if (!mlxplat_regmap_config) mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config; @@ -6051,8 +6094,8 @@ static int __init mlxplat_init(void) if (mlxplat_i2c) mlxplat_i2c->regmap = priv->regmap; priv->pdev_i2c = platform_device_register_resndata(&mlxplat_dev->dev, "i2c_mlxcpld", - nr, mlxplat_mlxcpld_resources, - ARRAY_SIZE(mlxplat_mlxcpld_resources), + nr, priv->hotplug_resources, + priv->hotplug_resources_size, mlxplat_i2c, sizeof(*mlxplat_i2c)); if (IS_ERR(priv->pdev_i2c)) { err = PTR_ERR(priv->pdev_i2c); @@ -6076,8 +6119,8 @@ static int __init mlxplat_init(void) priv->pdev_hotplug = platform_device_register_resndata(&mlxplat_dev->dev, "mlxreg-hotplug", PLATFORM_DEVID_NONE, - mlxplat_mlxcpld_resources, - ARRAY_SIZE(mlxplat_mlxcpld_resources), + priv->hotplug_resources, + priv->hotplug_resources_size, mlxplat_hotplug, sizeof(*mlxplat_hotplug)); if (IS_ERR(priv->pdev_hotplug)) { err = PTR_ERR(priv->pdev_hotplug); @@ -6179,7 +6222,6 @@ static int __init mlxplat_init(void) platform_device_unregister(priv->pdev_mux[i]); platform_device_unregister(priv->pdev_i2c); fail_alloc: - platform_device_unregister(mlxplat_dev); return err; } @@ -6207,7 +6249,7 @@ static void __exit mlxplat_exit(void) platform_device_unregister(priv->pdev_mux[i]); platform_device_unregister(priv->pdev_i2c); - platform_device_unregister(mlxplat_dev); + mlxplat_post_exit(); } module_exit(mlxplat_exit); From patchwork Wed Feb 8 06:33:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 13132486 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3923C636CC for ; Wed, 8 Feb 2023 06:35:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229706AbjBHGfx (ORCPT ); Wed, 8 Feb 2023 01:35:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229630AbjBHGfw (ORCPT ); Wed, 8 Feb 2023 01:35:52 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2061.outbound.protection.outlook.com [40.107.93.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3EBD442C3 for ; Tue, 7 Feb 2023 22:35:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ky9/jP1xSxodxZHSozfbRu1KigYpPFgFayvGc4eEek7x3REQIsJulS4XqfMxoSY/AilhnNeHZgwzDCJtR1ARaZX1tob2njO/Zl5yLgf/FS38zYHsyiq5Vs3bZevkHA6NlKYPvTFOfrLfhuGM79aH6Ls1kmdL8C6s5D56uH3QPl3LtEVAA1hU7t1lBWM1rVR9/WP5+n7509oiW6ogrilLy44q2geU2bWVDHUMznQx4JmQ3m79PDdQSvtm3CngXr/+wvn1VroO8kkxr5it0TsxWAtsbHV9SPnU3w4qHfQt3OxvHNWRb128dLS7C8xKupssVW/ZgK162RizWGP5UsGW5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HyeZUrMUkn5HwQUd9K0PbXivy7iMwxiYUy5cuJxBrqk=; b=akUWgwZAdUpY3AjgbJKFpsyDIB1PgaBlMFKddut0hw0UDr0hbw7j3/md4pz2s+Ke8IZcZ3og+H7VW02xHzyw050fCfAvoBJ8uLLOxfzccMuO7OADyDEhs4bvWPd9y1u8ugxch7ag4Mrw09Qa9v3S+eS7PQL6y0J4bSmHxTtl8bF6A5xn5uunS1wk98HwAC04tlYwnkyMBeCHP2GvputpFD+tvT6tZnhQUQ8qw3P6S4xUwWEdrLJnB6wil6myK7/o2hIUp4EjsZhINUywttznM8VyImAI9NvsChn9hcS5ZrSS601fSBLIlrke8GbKuqDE55gatBIOvsk6tVJ6Nn13tQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HyeZUrMUkn5HwQUd9K0PbXivy7iMwxiYUy5cuJxBrqk=; b=K8o8fIatjDklj+9fqUdnVqhouWY4KFi4Z8X1JkD8EpCKuS+6j2NF/FDMqntpR9PTJ551Xnv2VGDBo7C7VHOzrA8RHUmYsFi0K4aD19ZaY6VHadlxWJ9lzesqSfLHsHao00K0jC3bHNUyCL1Afklu/myrgfk+T2GVttCimDnEq9/TCcf88lNRztLJNuO8R1DD/Ah+k4rC7VnYPopEzDusFiUEqq9GizpqfYrT6guxe0FqbEwxmIL6Lkoi72gshGjVhz62vQcUyFZUCgkyL/VoPYYxeiPf20LGKCQDleIDS4k5dyyUIr/++wt8EEn5qwwI7/nMS2xXwUOsPYn5VY+h1A== Received: from DS7PR03CA0123.namprd03.prod.outlook.com (2603:10b6:5:3b4::8) by SA1PR12MB7441.namprd12.prod.outlook.com (2603:10b6:806:2b3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36; Wed, 8 Feb 2023 06:35:48 +0000 Received: from DM6NAM11FT084.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b4:cafe::69) by DS7PR03CA0123.outlook.office365.com (2603:10b6:5:3b4::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36 via Frontend Transport; Wed, 8 Feb 2023 06:35:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT084.mail.protection.outlook.com (10.13.172.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:35:48 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:35:38 -0800 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:35:37 -0800 From: Vadim Pasternak To: CC: , Vadim Pasternak Subject: [PATCH platform-next 07/13] platform: mellanox: Split logic in init and exit flow Date: Wed, 8 Feb 2023 08:33:24 +0200 Message-ID: <20230208063331.15560-8-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230208063331.15560-1-vadimp@nvidia.com> References: <20230208063331.15560-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT084:EE_|SA1PR12MB7441:EE_ X-MS-Office365-Filtering-Correlation-Id: 6dd02ab9-1bc5-4b36-50a2-08db099eb702 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pXQRl7pKI4WgYM1L/g3OyPwFkqrLnh3TTE8RKpA6nuthy05CTxDbSR8y8uV3vqFoYnUwu3Pis/ii9j9pJDYiHkUqH5WF2LMnkDmHrb1olPbz/bcpAIomQZMRMptOFbiBpDTS31G12W7e4GMPLuGRQJVH6mIYmPixFRQ3I10kiIwviGQAdlKn4r8Fkf/mxjA0EiuG8y+HU38QtWk9XZckcfzT96Db/yj3R2BucKitbhkOQLtbtxV0w+MpIw+CCYtldS7ViMjztKtuH8quKRFeo08UYx0cZGWFDpifXTGWNQATzmG4mkBYclgvj0MEALt4QZwCQmACSA+fmLmMFw5Ky7AG6A1YVx/ECDW3BkFbx47iKLc3qMc3sTUuFjTgB7bcEYVUNWfdLnDTUpEwOmoZdxeAP7qWKpCtCnxMj7KCgBTan/FvoTi8MwV1LW9IYedvTBZX6AxwUnqxMW+mWzBnLvH+iDkUKC2P3J92ujBtqoQCwPdGgFBQdTWVf3sc/MxZezQdQgOfW0XUAXAQALPQCmxgkmjzIcZyetOhxrkkcic2TcAF2EVVLY0VVc4orDD6em4Jb5Qm90eJVFnfwepuBg4lCa5vZq6+g7mnLEai476KK4hGIXSmHrgZ5n1o38deOSuLHh301jUA15Zysg/gEOZUD7SjNbeCKFw+XP5Dfwa6K0/luRjfgn20w7IDt+hpkM7IM5DwSc2sLhDAvjthQA== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(396003)(376002)(346002)(39860400002)(136003)(451199018)(36840700001)(40470700004)(46966006)(82310400005)(426003)(83380400001)(36756003)(86362001)(2906002)(8936002)(30864003)(5660300002)(4326008)(6916009)(70206006)(8676002)(40480700001)(70586007)(41300700001)(356005)(7636003)(82740400003)(36860700001)(316002)(54906003)(47076005)(6666004)(107886003)(40460700003)(336012)(2616005)(16526019)(478600001)(1076003)(26005)(186003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 06:35:48.1359 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6dd02ab9-1bc5-4b36-50a2-08db099eb702 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT084.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7441 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Split logic in mlxplat_init()/mlxplat_exit() routines. Separate initialization of I2C infrastructure and others platform drivers. Motivation is to provide synchronization between I2C bus and mux drivers and other drivers using this infrastructure. I2C main bus and MUX busses are implemented in FPGA logic. On some new systems the numbers allocated for these busses could be variable depending on order of initialization of I2C native busses. Since bus numbers are passed to some other platform drivers during initialization flow, it is necessary to synchronize completion of I2C infrastructure drivers and activation of rest of drivers. Thus initialization flow will be performed in synchronized order. Signed-off-by: Vadim Pasternak Reviewed-by: Michael Shych --- drivers/platform/x86/mlx-platform.c | 313 ++++++++++++++++++---------- 1 file changed, 204 insertions(+), 109 deletions(-) diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c index 2d33d1e5d427..30998b0a8bc8 100644 --- a/drivers/platform/x86/mlx-platform.c +++ b/drivers/platform/x86/mlx-platform.c @@ -319,6 +319,9 @@ /* Default value for PWM control register for rack switch system */ #define MLXPLAT_REGMAP_NVSWITCH_PWM_DEFAULT 0xf4 +#define MLXPLAT_I2C_MAIN_BUS_NOTIFIED 0x01 +#define MLXPLAT_I2C_MAIN_BUS_HANDLE_CREATED 0x02 + /* mlxplat_priv - platform private data * @pdev_i2c - i2c controller platform device * @pdev_mux - array of mux platform devices @@ -330,6 +333,7 @@ * @regmap: device register map * @hotplug_resources: system hotplug resources * @hotplug_resources_size: size of system hotplug resources + * @hi2c_main_init_status: init status of I2C main bus */ struct mlxplat_priv { struct platform_device *pdev_i2c; @@ -342,9 +346,11 @@ struct mlxplat_priv { void *regmap; struct resource *hotplug_resources; unsigned int hotplug_resources_size; + u8 i2c_main_init_status; }; static struct platform_device *mlxplat_dev; +static int mlxplat_i2c_main_complition_notify(void *handle, int id); /* Regions for LPC I2C controller and LPC base register space */ static const struct resource mlxplat_lpc_resources[] = { @@ -379,6 +385,7 @@ static struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_i2c_ng_data = { .mask = MLXPLAT_CPLD_AGGR_MASK_COMEX, .cell_low = MLXPLAT_CPLD_LPC_REG_AGGRCO_OFFSET, .mask_low = MLXPLAT_CPLD_LOW_AGGR_MASK_I2C, + .completion_notify = mlxplat_i2c_main_complition_notify, }; /* Platform default channels */ @@ -6050,68 +6057,9 @@ static void mlxplat_post_exit(void) mlxplat_lpc_cpld_device_exit(); } -static int __init mlxplat_init(void) +static int mlxplat_post_init(struct mlxplat_priv *priv) { - unsigned int hotplug_resources_size; - struct resource *hotplug_resources; - struct mlxplat_priv *priv; - int i, j, nr, err; - - if (!dmi_check_system(mlxplat_dmi_table)) - return -ENODEV; - - err = mlxplat_pre_init(&hotplug_resources, &hotplug_resources_size); - if (err) - return err; - - priv = devm_kzalloc(&mlxplat_dev->dev, sizeof(struct mlxplat_priv), - GFP_KERNEL); - if (!priv) { - err = -ENOMEM; - goto fail_alloc; - } - platform_set_drvdata(mlxplat_dev, priv); - - priv->hotplug_resources = hotplug_resources; - priv->hotplug_resources_size = hotplug_resources_size; - - if (!mlxplat_regmap_config) - mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config; - - priv->regmap = devm_regmap_init(&mlxplat_dev->dev, NULL, - &mlxplat_mlxcpld_regmap_ctx, - mlxplat_regmap_config); - if (IS_ERR(priv->regmap)) { - err = PTR_ERR(priv->regmap); - goto fail_alloc; - } - - err = mlxplat_mlxcpld_verify_bus_topology(&nr); - if (nr < 0) - goto fail_alloc; - - nr = (nr == mlxplat_max_adap_num) ? -1 : nr; - if (mlxplat_i2c) - mlxplat_i2c->regmap = priv->regmap; - priv->pdev_i2c = platform_device_register_resndata(&mlxplat_dev->dev, "i2c_mlxcpld", - nr, priv->hotplug_resources, - priv->hotplug_resources_size, - mlxplat_i2c, sizeof(*mlxplat_i2c)); - if (IS_ERR(priv->pdev_i2c)) { - err = PTR_ERR(priv->pdev_i2c); - goto fail_alloc; - } - - for (i = 0; i < mlxplat_mux_num; i++) { - priv->pdev_mux[i] = platform_device_register_resndata(&priv->pdev_i2c->dev, - "i2c-mux-reg", i, NULL, 0, - &mlxplat_mux_data[i], - sizeof(mlxplat_mux_data[i])); - if (IS_ERR(priv->pdev_mux[i])) { - err = PTR_ERR(priv->pdev_mux[i]); - goto fail_platform_mux_register; - } - } + int i, err; /* Add hotplug driver */ if (mlxplat_hotplug) { @@ -6124,19 +6072,10 @@ static int __init mlxplat_init(void) mlxplat_hotplug, sizeof(*mlxplat_hotplug)); if (IS_ERR(priv->pdev_hotplug)) { err = PTR_ERR(priv->pdev_hotplug); - goto fail_platform_mux_register; + goto fail_platform_hotplug_register; } } - /* Set default registers. */ - for (j = 0; j < mlxplat_regmap_config->num_reg_defaults; j++) { - err = regmap_write(priv->regmap, - mlxplat_regmap_config->reg_defaults[j].reg, - mlxplat_regmap_config->reg_defaults[j].def); - if (err) - goto fail_platform_mux_register; - } - /* Add LED driver. */ if (mlxplat_led) { mlxplat_led->regmap = priv->regmap; @@ -6146,7 +6085,7 @@ static int __init mlxplat_init(void) sizeof(*mlxplat_led)); if (IS_ERR(priv->pdev_led)) { err = PTR_ERR(priv->pdev_led); - goto fail_platform_hotplug_register; + goto fail_platform_leds_register; } } @@ -6160,7 +6099,7 @@ static int __init mlxplat_init(void) sizeof(*mlxplat_regs_io)); if (IS_ERR(priv->pdev_io_regs)) { err = PTR_ERR(priv->pdev_io_regs); - goto fail_platform_led_register; + goto fail_platform_io_register; } } @@ -6173,7 +6112,7 @@ static int __init mlxplat_init(void) sizeof(*mlxplat_fan)); if (IS_ERR(priv->pdev_fan)) { err = PTR_ERR(priv->pdev_fan); - goto fail_platform_io_regs_register; + goto fail_platform_fan_register; } } @@ -6181,59 +6120,42 @@ static int __init mlxplat_init(void) err = mlxplat_mlxcpld_check_wd_capability(priv->regmap); if (err) goto fail_platform_wd_register; - for (j = 0; j < MLXPLAT_CPLD_WD_MAX_DEVS; j++) { - if (mlxplat_wd_data[j]) { - mlxplat_wd_data[j]->regmap = priv->regmap; - priv->pdev_wd[j] = - platform_device_register_resndata(&mlxplat_dev->dev, "mlx-wdt", j, - NULL, 0, mlxplat_wd_data[j], - sizeof(*mlxplat_wd_data[j])); - if (IS_ERR(priv->pdev_wd[j])) { - err = PTR_ERR(priv->pdev_wd[j]); + for (i = 0; i < MLXPLAT_CPLD_WD_MAX_DEVS; i++) { + if (mlxplat_wd_data[i]) { + mlxplat_wd_data[i]->regmap = priv->regmap; + priv->pdev_wd[i] = + platform_device_register_resndata(&mlxplat_dev->dev, "mlx-wdt", i, + NULL, 0, mlxplat_wd_data[i], + sizeof(*mlxplat_wd_data[i])); + if (IS_ERR(priv->pdev_wd[i])) { + err = PTR_ERR(priv->pdev_wd[i]); goto fail_platform_wd_register; } } } - /* Sync registers with hardware. */ - regcache_mark_dirty(priv->regmap); - err = regcache_sync(priv->regmap); - if (err) - goto fail_platform_wd_register; - return 0; fail_platform_wd_register: - while (--j >= 0) - platform_device_unregister(priv->pdev_wd[j]); - if (mlxplat_fan) - platform_device_unregister(priv->pdev_fan); -fail_platform_io_regs_register: + while (--i >= 0) + platform_device_unregister(priv->pdev_wd[i]); +fail_platform_fan_register: if (mlxplat_regs_io) platform_device_unregister(priv->pdev_io_regs); -fail_platform_led_register: +fail_platform_io_register: if (mlxplat_led) platform_device_unregister(priv->pdev_led); -fail_platform_hotplug_register: +fail_platform_leds_register: if (mlxplat_hotplug) platform_device_unregister(priv->pdev_hotplug); -fail_platform_mux_register: - while (--i >= 0) - platform_device_unregister(priv->pdev_mux[i]); - platform_device_unregister(priv->pdev_i2c); -fail_alloc: - +fail_platform_hotplug_register: return err; } -module_init(mlxplat_init); -static void __exit mlxplat_exit(void) +static void mlxplat_pre_exit(struct mlxplat_priv *priv) { - struct mlxplat_priv *priv = platform_get_drvdata(mlxplat_dev); int i; - if (pm_power_off) - pm_power_off = NULL; for (i = MLXPLAT_CPLD_WD_MAX_DEVS - 1; i >= 0 ; i--) platform_device_unregister(priv->pdev_wd[i]); if (priv->pdev_fan) @@ -6244,13 +6166,186 @@ static void __exit mlxplat_exit(void) platform_device_unregister(priv->pdev_led); if (priv->pdev_hotplug) platform_device_unregister(priv->pdev_hotplug); +} + +static int +mlxplat_i2c_mux_complition_notify(void *handle, struct i2c_adapter *parent, + struct i2c_adapter *adapters[]) +{ + struct mlxplat_priv *priv = handle; + + return mlxplat_post_init(priv); +} - for (i = mlxplat_mux_num - 1; i >= 0 ; i--) +static int mlxplat_i2c_mux_topolgy_init(struct mlxplat_priv *priv) +{ + int i, err; + + if (!priv->pdev_i2c) { + priv->i2c_main_init_status = MLXPLAT_I2C_MAIN_BUS_NOTIFIED; + return 0; + } + + priv->i2c_main_init_status = MLXPLAT_I2C_MAIN_BUS_HANDLE_CREATED; + for (i = 0; i < mlxplat_mux_num; i++) { + priv->pdev_mux[i] = platform_device_register_resndata(&priv->pdev_i2c->dev, + "i2c-mux-reg", i, NULL, 0, + &mlxplat_mux_data[i], + sizeof(mlxplat_mux_data[i])); + if (IS_ERR(priv->pdev_mux[i])) { + err = PTR_ERR(priv->pdev_mux[i]); + goto fail_platform_mux_register; + } + } + + return mlxplat_i2c_mux_complition_notify(priv, NULL, NULL); + +fail_platform_mux_register: + while (--i >= 0) platform_device_unregister(priv->pdev_mux[i]); + return err; +} + +static void mlxplat_i2c_mux_topolgy_exit(struct mlxplat_priv *priv) +{ + int i; + + for (i = mlxplat_mux_num - 1; i >= 0 ; i--) { + if (priv->pdev_mux[i]) + platform_device_unregister(priv->pdev_mux[i]); + } - platform_device_unregister(priv->pdev_i2c); mlxplat_post_exit(); } + +static int mlxplat_i2c_main_complition_notify(void *handle, int id) +{ + struct mlxplat_priv *priv = handle; + + return mlxplat_i2c_mux_topolgy_init(priv); +} + +static int mlxplat_i2c_main_init(struct mlxplat_priv *priv) +{ + int nr, err; + + if (!mlxplat_i2c) + return 0; + + err = mlxplat_mlxcpld_verify_bus_topology(&nr); + if (nr < 0) + goto fail_mlxplat_mlxcpld_verify_bus_topology; + + nr = (nr == mlxplat_max_adap_num) ? -1 : nr; + mlxplat_i2c->regmap = priv->regmap; + mlxplat_i2c->handle = priv; + + priv->pdev_i2c = platform_device_register_resndata(&mlxplat_dev->dev, "i2c_mlxcpld", + nr, priv->hotplug_resources, + priv->hotplug_resources_size, + mlxplat_i2c, sizeof(*mlxplat_i2c)); + if (IS_ERR(priv->pdev_i2c)) { + err = PTR_ERR(priv->pdev_i2c); + goto fail_platform_i2c_register; + } + + if (priv->i2c_main_init_status == MLXPLAT_I2C_MAIN_BUS_NOTIFIED) { + err = mlxplat_i2c_mux_topolgy_init(priv); + if (err) + goto fail_mlxplat_i2c_mux_topolgy_init; + } + + return 0; + +fail_mlxplat_i2c_mux_topolgy_init: +fail_platform_i2c_register: +fail_mlxplat_mlxcpld_verify_bus_topology: + return err; +} + +static void mlxplat_i2c_main_exit(struct mlxplat_priv *priv) +{ + mlxplat_i2c_mux_topolgy_exit(priv); + if (priv->pdev_i2c) + platform_device_unregister(priv->pdev_i2c); +} + +static int __init mlxplat_init(void) +{ + unsigned int hotplug_resources_size; + struct resource *hotplug_resources; + struct mlxplat_priv *priv; + int i, err; + + if (!dmi_check_system(mlxplat_dmi_table)) + return -ENODEV; + + err = mlxplat_pre_init(&hotplug_resources, &hotplug_resources_size); + if (err) + return err; + + priv = devm_kzalloc(&mlxplat_dev->dev, sizeof(struct mlxplat_priv), + GFP_KERNEL); + if (!priv) { + err = -ENOMEM; + goto fail_alloc; + } + platform_set_drvdata(mlxplat_dev, priv); + priv->hotplug_resources = hotplug_resources; + priv->hotplug_resources_size = hotplug_resources_size; + + if (!mlxplat_regmap_config) + mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config; + + priv->regmap = devm_regmap_init(&mlxplat_dev->dev, NULL, + &mlxplat_mlxcpld_regmap_ctx, + mlxplat_regmap_config); + if (IS_ERR(priv->regmap)) { + err = PTR_ERR(priv->regmap); + goto fail_alloc; + } + + /* Set default registers. */ + for (i = 0; i < mlxplat_regmap_config->num_reg_defaults; i++) { + err = regmap_write(priv->regmap, + mlxplat_regmap_config->reg_defaults[i].reg, + mlxplat_regmap_config->reg_defaults[i].def); + if (err) + goto fail_regmap_write; + } + + err = mlxplat_i2c_main_init(priv); + if (err) + goto fail_mlxplat_i2c_main_init; + + /* Sync registers with hardware. */ + regcache_mark_dirty(priv->regmap); + err = regcache_sync(priv->regmap); + if (err) + goto fail_regcache_sync; + + return 0; + +fail_regcache_sync: + mlxplat_pre_exit(priv); +fail_mlxplat_i2c_main_init: +fail_regmap_write: +fail_alloc: + mlxplat_post_exit(); + + return err; +} +module_init(mlxplat_init); + +static void __exit mlxplat_exit(void) +{ + struct mlxplat_priv *priv = platform_get_drvdata(mlxplat_dev); + + if (pm_power_off) + pm_power_off = NULL; + mlxplat_pre_exit(priv); + mlxplat_i2c_main_exit(priv); +} module_exit(mlxplat_exit); MODULE_AUTHOR("Vadim Pasternak (vadimp@mellanox.com)"); From patchwork Wed Feb 8 06:33:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 13132487 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F850C05027 for ; Wed, 8 Feb 2023 06:35:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229739AbjBHGfy (ORCPT ); Wed, 8 Feb 2023 01:35:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229630AbjBHGfx (ORCPT ); Wed, 8 Feb 2023 01:35:53 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2051.outbound.protection.outlook.com [40.107.92.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7E944390D for ; Tue, 7 Feb 2023 22:35:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ByCe19J7uXn1n+hKD7I0hSXP1TtZw50xS9zZkpXDLuZwPwzSlzZv7s5Rf7mRESk5TX3aRL/77JYHD5scAwFEtdY124kyxseI/3euVLRv6w3vBGWev8bOOOpBmdNHI7y4M+C3kc2DiPb8YurqBBZcdTwnkLsKyR7sDX5VWNYSMWJKEHRhYewjVs5kxX26sPOd8m5kdV3oQJKxpWVIuHvrvBbrn5K9VC3KTQvXNVIV+BP7LBkbcRVvtFr4zoMf1N9qpV3TWJi4/3SBT98SYgTz1+eNqwxquPQ+Ws296rOIuMWHL06rFbXeN07iYdjn5x25EYwH4uy/p9f38UecpvrZLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OKqpsiQeJKRS/eGw+QclsLe7QM1M3O6CiOt6QKxbd+w=; b=Cl/oRyWbuU84FL+ck/bwKaavpxdTynJZWswJqspkGZvW0SbMehM+6vK17KBvrKx56R6WnfeaH70SWzY+lxov5iwLRgUUNZ3B2J9wlnxy/O3cxZH4AaF38bfXBEkGld0fDNg7UVvx0Y6W+Z2f5/MblrSP8Pg+Xvn3f0gmjmnMaTp9O1PKzVcJFRiQ4Aw+Kk/HvrAtoc9BA3q/+MZO9uk/wGBggdwp4OtzdTMg64vC1JjB5nILyFLZ97jFHEbhAKCdIwaWIwLL+A5iXqC5BEqA168fgJ55/CnSzAlOzC/DUHCQRcgjbFJChU2O+oT5wu8CZnka68ePWESFd+qqeN56jw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OKqpsiQeJKRS/eGw+QclsLe7QM1M3O6CiOt6QKxbd+w=; b=cOC1CkIZ3v+l/2bv/olbH3msoUIDlwfyIre/2XnUTS+Iqrtvc3wcfxB0KckHvDqc4VUwKcSaCv8L47/icU8tN0YEWQvDaCKNXDaQpMlvHoml15f+K21XxtTMElsnlcGAavJD+a6fDWy7NoNFHmlrVVtIz3o9V3OYZcwohY91JvgyZ1YVSgMajqfDb443HFVRnKxzJ++Pp5o1qHQr4gjD1bFwqMvbLlq4Bi2302TdTnSkpNJZS0O3gkO9duQeZoRCsPC6XiSPrVOt21GDIg9OuQI1vaTLACGpKlhQZa+blDOuksKemi2Asy42GwZq+jtNFkLTZPFCRFQZzdrrfmVfAQ== Received: from DS7PR03CA0137.namprd03.prod.outlook.com (2603:10b6:5:3b4::22) by DM6PR12MB4863.namprd12.prod.outlook.com (2603:10b6:5:1b9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17; Wed, 8 Feb 2023 06:35:51 +0000 Received: from DM6NAM11FT084.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b4:cafe::78) by DS7PR03CA0137.outlook.office365.com (2603:10b6:5:3b4::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:35:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT084.mail.protection.outlook.com (10.13.172.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:35:50 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:35:42 -0800 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:35:40 -0800 From: Vadim Pasternak To: CC: , Vadim Pasternak Subject: [PATCH platform-next 08/13] platform: mellanox: Extend all systems with I2C notification callback Date: Wed, 8 Feb 2023 08:33:25 +0200 Message-ID: <20230208063331.15560-9-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230208063331.15560-1-vadimp@nvidia.com> References: <20230208063331.15560-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT084:EE_|DM6PR12MB4863:EE_ X-MS-Office365-Filtering-Correlation-Id: 1834782e-1697-49f4-06b9-08db099eb87b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aYflr2gSmpWEb7LsHsOatAo5vdd5tHVrVeRDuWYoYKneulwZBbs0X94YMGeMUKIuW3k08lLb4AiAyCXc6umvdfN2RsnjrvjXioLeCo3dsAx9YHMwK+kuuXQgDqmw+4PuLyTkOrkIuzKGthzvrZ7fgantRPmGSL2LViaV4TOYmxGDnq3It6cVR78q2+k56pNDT6JrPgpQCsbqxE+VpaOyY9k4ZK57mjuy0yfc1Ho1iqZ/YCRmiyr6xtzMGayAtlDJHCJlAoMeFFDQnZplvH1SYQn9Inh9dtWsKDqxQYX/O/SS3YywJVFj6btRT7RqrAKuVnzxBGmfEoClPiJAwPbWFDXxFKpSHVirckX8YifntJ6ti5iu6uClZRQ1q8M0LV5VORnKAxDNFRNWFIS5XJHk+Q4PqWv+MNAMi2ZDhfUPAIGN0gHBmnRF6xUKuvg5dvXCYiwr1Z2MZ7w8uCSeaDb0dNDnHUb0FZvDZsB9cPwCh4oopNiri+YS3A2Ff1pFCUhtSDAKmUPdKW4iPx1QYRx5ndN5ISmE0FnkVwRDoL8JOSMvE979i1bDbcreHPDiSmGQXoNIJR23lojxTOkKoRrm/PTudV47dnM7ZIWdgaf/dDSeZtPScfVTl+ErhsKblLP1kAG8XjUdxAc4MNj2/i+vj/+lPlbObPGD5A72F/sVgd+yRTk/iuuu9dSHddMF1kiy0xU57cVvX+t8N2O3SQXbSw== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(396003)(346002)(136003)(39860400002)(376002)(451199018)(36840700001)(40470700004)(46966006)(82310400005)(54906003)(356005)(1076003)(8676002)(40480700001)(16526019)(186003)(316002)(86362001)(6666004)(107886003)(7636003)(82740400003)(26005)(478600001)(426003)(41300700001)(8936002)(336012)(83380400001)(40460700003)(47076005)(5660300002)(36756003)(4326008)(2616005)(70586007)(36860700001)(70206006)(6916009)(15650500001)(2906002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 06:35:50.6204 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1834782e-1697-49f4-06b9-08db099eb87b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT084.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4863 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Motivation is to provide synchronization between I2C main bus and other platform drivers using this notification callback. Signed-off-by: Vadim Pasternak Reviewed-by: Michael Shych --- drivers/platform/x86/mlx-platform.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c index 30998b0a8bc8..d00fe9f3f1dc 100644 --- a/drivers/platform/x86/mlx-platform.c +++ b/drivers/platform/x86/mlx-platform.c @@ -363,6 +363,11 @@ static const struct resource mlxplat_lpc_resources[] = { IORESOURCE_IO), }; +/* Platform systems default i2c data */ +static struct mlxreg_core_hotplug_platform_data mlxplat_mlxcpld_i2c_default_data = { + .completion_notify = mlxplat_i2c_main_complition_notify, +}; + /* Platform i2c next generation systems data */ static struct mlxreg_core_data mlxplat_mlxcpld_i2c_ng_items_data[] = { { @@ -5479,6 +5484,7 @@ static int __init mlxplat_dmi_default_matched(const struct dmi_system_id *dmi) mlxplat_led = &mlxplat_default_led_data; mlxplat_regs_io = &mlxplat_default_regs_io_data; mlxplat_wd_data[0] = &mlxplat_mlxcpld_wd_set_type1[0]; + mlxplat_i2c = &mlxplat_mlxcpld_i2c_default_data; return 1; } @@ -5501,6 +5507,7 @@ static int __init mlxplat_dmi_default_wc_matched(const struct dmi_system_id *dmi mlxplat_led = &mlxplat_default_led_wc_data; mlxplat_regs_io = &mlxplat_default_regs_io_data; mlxplat_wd_data[0] = &mlxplat_mlxcpld_wd_set_type1[0]; + mlxplat_i2c = &mlxplat_mlxcpld_i2c_default_data; return 1; } @@ -5548,6 +5555,7 @@ static int __init mlxplat_dmi_msn21xx_matched(const struct dmi_system_id *dmi) mlxplat_led = &mlxplat_msn21xx_led_data; mlxplat_regs_io = &mlxplat_msn21xx_regs_io_data; mlxplat_wd_data[0] = &mlxplat_mlxcpld_wd_set_type1[0]; + mlxplat_i2c = &mlxplat_mlxcpld_i2c_default_data; return 1; } @@ -5570,6 +5578,7 @@ static int __init mlxplat_dmi_msn274x_matched(const struct dmi_system_id *dmi) mlxplat_led = &mlxplat_default_led_data; mlxplat_regs_io = &mlxplat_msn21xx_regs_io_data; mlxplat_wd_data[0] = &mlxplat_mlxcpld_wd_set_type1[0]; + mlxplat_i2c = &mlxplat_mlxcpld_i2c_default_data; return 1; } @@ -5592,6 +5601,7 @@ static int __init mlxplat_dmi_msn201x_matched(const struct dmi_system_id *dmi) mlxplat_led = &mlxplat_msn21xx_led_data; mlxplat_regs_io = &mlxplat_msn21xx_regs_io_data; mlxplat_wd_data[0] = &mlxplat_mlxcpld_wd_set_type1[0]; + mlxplat_i2c = &mlxplat_mlxcpld_i2c_default_data; return 1; } @@ -5641,6 +5651,7 @@ static int __init mlxplat_dmi_comex_matched(const struct dmi_system_id *dmi) mlxplat_fan = &mlxplat_default_fan_data; for (i = 0; i < ARRAY_SIZE(mlxplat_mlxcpld_wd_set_type2); i++) mlxplat_wd_data[i] = &mlxplat_mlxcpld_wd_set_type2[i]; + mlxplat_i2c = &mlxplat_mlxcpld_i2c_default_data; mlxplat_regmap_config = &mlxplat_mlxcpld_regmap_config_comex; return 1; From patchwork Wed Feb 8 06:33:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 13132488 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC4C3C05027 for ; Wed, 8 Feb 2023 06:35:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229942AbjBHGf5 (ORCPT ); Wed, 8 Feb 2023 01:35:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229630AbjBHGf4 (ORCPT ); Wed, 8 Feb 2023 01:35:56 -0500 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2048.outbound.protection.outlook.com [40.107.95.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EEE44390D for ; Tue, 7 Feb 2023 22:35:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DPJdWnQ0YFkdb0zlQeGYan6ipcr8SROPlm+bVcWhB0Ij2NAXz53hLUtBhdg2NB+PHCpKdhns9kYkGXFT8RYGE4eWs5lrBc0QvgKbro6VdOWBXy4pK0L94iq953uV5nO7BocGnI6D/prL5ASrJJ7o4ct6w5Hn2a2pgTGLTgsimikZlZ+AyWEwRDZpH2OU7LLAFmlpggAm2mn/MMJe7uLbUMFqpxeKE1Ol8o+NLnUZ4HSFHWwnuEckvTqfs1SPcZEOkwWtQ55ys6DJ5XUg6OHJtNrKhQuXu9hi4QAVmDNJxoolynXbl9fC17j58vGEo5NSflgj2YIvoO+n451QxiJb+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IBaP+cRfqCX+ZNwXO4quHWO7/aX0L9GViux5Q51aj+o=; b=EhWP88sfRlq8soNN6MEB8pG0jAe14pAo05FRb+IO3JC/uoIX4D2WFzqYXJEnYJ8f/NnumyKiaUPuiJdY0vw6urGpMIGPSe6ieUfIbB0WlOfYqts2jh3txba6iOYtadk3RnARB4r76zzCPuKr3JNrLCqJNuNz/h9CZAEduhEhSzTLePyvOyWOWLVs8LJzDJHXoPDU3aWyhbwqoCPEZmKT/WS4dbQgnpeyJofKPSf+PgD0WGbJOhJ5zK1VDbHmZLoLw7FqQR29ps/+Ft6eFhNyjgVtqrwRLfjd4hqVYjVdie3Qebd0FiBwmMijRzkI1fHqSMTOnm0J4Cr097ZnGheX4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IBaP+cRfqCX+ZNwXO4quHWO7/aX0L9GViux5Q51aj+o=; b=cpOSodzEGgoIANLP3Awpnldaw7qMFHjbk5QarZ91ePCYC9wNOThFDiiP5U3nWvR0yk2f2PG5ZF3vEn7M1vIZLBQgYHy+OCfaJLuItNKdYcc19xQ+ypQ3h4KXpZmVf9TV2fu24hA7m73/M1ZuMN9ACPIzODeuDY7tKy4JPcSm8tpngjbFfrvzxfRZvIChj5Mqb5Voc08YqtoeD4kHN21axVqSR79OrvEQhCnTjw/TxlathvaNo6vHhvG7NNpF/N7zMdh47PCuKAoHuO3NjUYbbO7BcisETU3X1fTa3k5ve96bg/fqIxACX/ijOV1n2SacOtakeCZ50ljJtNnoZs1MCQ== Received: from DM5PR07CA0085.namprd07.prod.outlook.com (2603:10b6:4:ae::14) by DS0PR12MB7727.namprd12.prod.outlook.com (2603:10b6:8:135::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17; Wed, 8 Feb 2023 06:35:53 +0000 Received: from DS1PEPF0000E65D.namprd02.prod.outlook.com (2603:10b6:4:ae:cafe::df) by DM5PR07CA0085.outlook.office365.com (2603:10b6:4:ae::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36 via Frontend Transport; Wed, 8 Feb 2023 06:35:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS1PEPF0000E65D.mail.protection.outlook.com (10.167.18.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.16 via Frontend Transport; Wed, 8 Feb 2023 06:35:53 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:35:44 -0800 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:35:43 -0800 From: Vadim Pasternak To: CC: , Vadim Pasternak Subject: [PATCH platform-next 09/13] platform/mellanox: mlxreg-hotplug: Allow more flexible hotplug events configuration Date: Wed, 8 Feb 2023 08:33:26 +0200 Message-ID: <20230208063331.15560-10-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230208063331.15560-1-vadimp@nvidia.com> References: <20230208063331.15560-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E65D:EE_|DS0PR12MB7727:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f0ceb42-5a5a-4c59-0087-08db099eba4f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n1AhsPRNsBuOgAmlDmfK1FekR99HpNOaabZBDJmBMaktSNO2eJuRZY6tYq0r1+UkYuZ9uMY+Pbqzm4jg1u9qhASM5psfZRt5lJoQew9VpPRG/58FqTzQoXLOWXgVW7Pcty99voCpf9mKHAx41x9dSR2mnvycSg246LW4MerzbkQwXSfLHg+SrNqTomuoMjvVs+9JYk5216Ubu3FypAFoBKBc3lSyh7wUcc51bPRLidhYusS/ytnmc8M4sw+V2CVO16fInxBn54pTWFR0axzbZMAyPmnezvvFsE4QVQjrfRDYTrVQmSTVG5jKE6AEadTznhwhM05wdiNJPGp/pcalUmz2irxcb+tfk3FBqhhCuM/1ACnxya/fS8EPOtXMT5kP/bxObERxBzNWfbB5yIdxtPQiz7BKd963RybFyAibqKPlbyaewq6S5HrhXQNh96JI0TyTV3rF1J97JfG03Ean4lHyab7FiPv9O8h2yu+XbkqqhKJx1C0ZFk9/xVb4Kmgmbdq6P8d+3VJTZVmz9COuQ1nxur2YZ5iycia+Hq+1OBaPQJzbQ+W02Oieowp6uGQbm6pFhjihVgFAwfRbjJeWdlKRThYB/W2jTzDsAqiR42GeMxPr0gVWqojmG/wwcUhO2XFkMPPROmxHY1I3e8BYJPdhdO96NS+oZnFD+gXXVJ2zSZeVUbd2chup8aIentSmLEFfJfOpiyWtO901iLDu9A== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(39860400002)(136003)(396003)(376002)(346002)(451199018)(46966006)(40470700004)(36840700001)(40460700003)(82740400003)(7636003)(356005)(316002)(8676002)(8936002)(41300700001)(4326008)(186003)(70586007)(2906002)(36860700001)(5660300002)(1076003)(6916009)(107886003)(2616005)(6666004)(26005)(16526019)(70206006)(478600001)(82310400005)(86362001)(83380400001)(54906003)(426003)(47076005)(40480700001)(336012)(36756003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 06:35:53.6873 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7f0ceb42-5a5a-4c59-0087-08db099eba4f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000E65D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7727 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Currently hotplug configuration in logic device assumes that all items are provided with no holes. Thus, any group of hotplug events, associated with the specific status/event/mask registers is configured in those registers successively from bit zero to bit #n (#n < 8). This logic is changed int order to allow non-successive definition to support configuration with the skipped bits – for example bits 3, 5, 7 in status/event/mask registers can be associated with hotplug events, while others can be skipped. Signed-off-by: Vadim Pasternak Reviewed-by: Michael Shych --- drivers/platform/mellanox/mlxreg-hotplug.c | 28 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c b/drivers/platform/mellanox/mlxreg-hotplug.c index 117bc3f395fd..b7dcc64cd238 100644 --- a/drivers/platform/mellanox/mlxreg-hotplug.c +++ b/drivers/platform/mellanox/mlxreg-hotplug.c @@ -239,6 +239,17 @@ static ssize_t mlxreg_hotplug_attr_show(struct device *dev, #define PRIV_ATTR(i) priv->mlxreg_hotplug_attr[i] #define PRIV_DEV_ATTR(i) priv->mlxreg_hotplug_dev_attr[i] +static int mlxreg_hotplug_item_label_index_get(u32 mask, u32 bit) +{ + int i, j; + + for (i = 0, j = -1; i <= bit; i++) { + if (mask & BIT(i)) + j++; + } + return j; +} + static int mlxreg_hotplug_attr_init(struct mlxreg_hotplug_priv_data *priv) { struct mlxreg_core_hotplug_platform_data *pdata; @@ -246,7 +257,7 @@ static int mlxreg_hotplug_attr_init(struct mlxreg_hotplug_priv_data *priv) struct mlxreg_core_data *data; unsigned long mask; u32 regval; - int num_attrs = 0, id = 0, i, j, k, ret; + int num_attrs = 0, id = 0, i, j, k, count, ret; pdata = dev_get_platdata(&priv->pdev->dev); item = pdata->items; @@ -272,7 +283,8 @@ static int mlxreg_hotplug_attr_init(struct mlxreg_hotplug_priv_data *priv) /* Go over all unmasked units within item. */ mask = item->mask; k = 0; - for_each_set_bit(j, &mask, item->count) { + count = item->ind ? item->ind : item->count; + for_each_set_bit(j, &mask, count) { if (data->capability) { /* * Read capability register and skip non @@ -282,16 +294,17 @@ static int mlxreg_hotplug_attr_init(struct mlxreg_hotplug_priv_data *priv) data->capability, ®val); if (ret) return ret; + if (!(regval & data->bit)) { data++; continue; } } + PRIV_ATTR(id) = &PRIV_DEV_ATTR(id).dev_attr.attr; PRIV_ATTR(id)->name = devm_kasprintf(&priv->pdev->dev, GFP_KERNEL, data->label); - if (!PRIV_ATTR(id)->name) { dev_err(priv->dev, "Memory allocation failed for attr %d.\n", id); @@ -365,9 +378,14 @@ mlxreg_hotplug_work_helper(struct mlxreg_hotplug_priv_data *priv, regval &= item->mask; asserted = item->cache ^ regval; item->cache = regval; - for_each_set_bit(bit, &asserted, 8) { - data = item->data + bit; + int pos; + + pos = mlxreg_hotplug_item_label_index_get(item->mask, bit); + if (pos < 0) + goto out; + + data = item->data + pos; if (regval & BIT(bit)) { if (item->inversed) mlxreg_hotplug_device_destroy(priv, data, item->kind); From patchwork Wed Feb 8 06:33:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 13132489 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A3C2C636CC for ; Wed, 8 Feb 2023 06:37:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229994AbjBHGhb (ORCPT ); Wed, 8 Feb 2023 01:37:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229805AbjBHGh3 (ORCPT ); Wed, 8 Feb 2023 01:37:29 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2082.outbound.protection.outlook.com [40.107.237.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E000F30B22 for ; Tue, 7 Feb 2023 22:37:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kK24M+9woL/JhO+pIReYBSLMEJztfezqnNMed/7Ra9AiOmqa4+NGGj5xcQ6hZo6CV/RFt1WZsdEyIV2njzMkZfRYryY1SurbCvNjyRYU0gxyFql7Pg1NgDrmGXfB8Qg/sGdgeLSmgBW+PZzwSgm46i06G8M/6J5+sp+nMKO69WI0ttMiKziXFT+MVn6sfjpGcnu6HPF0hgnbxJfTrvxt39S2x1R01C9GbkW46DnXQ73nqTArq/ahRWjtZddAsyL/TWeu0cOmZ9LU0s7rJ9+BdlmdSKCIL6gQ1Eyr5JcukSaS2mPtXV8hRkEPF7nfgneKqdOs+iHJhExG6MbeW8hGaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DWbLZoLhynsG7csh7b9ltJx/CSHw0OU8tlaYF9dKozM=; b=lqjOk1G8vz6IVbZ4LzvcZYXJPtBrp48mtQo94CwYDHzM049PYBybfeLn4oVfYQn+rAFUp1ZzAFxsebhv7UO0hP3DQrEvR0An+NgVLSx5b3so2Wmf7bzpRBTAtcQWQCz+mLs8cMkJ4bm0W2UCr3CYhsHBz7QMJankKY1E80psj9AqffJdhjBG9B50c4kR/xNFS8EmSIEGkNdjScY/hF/JXlN5zTbJFe5OXfEoWChIeI9hzRqlPGDtWCUiz1CfX9kLkLk8O41Dp9EQG60Dn2TuuLEueC/DDZ648tQ7snJ/8QgvlypzQMHiOMq+Vy4M5ZnfD6VZ+Rc0nkmoRVaEX2uaYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DWbLZoLhynsG7csh7b9ltJx/CSHw0OU8tlaYF9dKozM=; b=YjjChgQVM2Y5LbtIxSO/qwCHNKVy80KbpIsu1dYVTEQremfz88rUssNNyPwkSMNc5ltl/ZJNMY1uoq6kvgxb5mdfMmU0egMpCqrl5c5q98odxFl7gI1kRBApQKYF+EwVcb+MedOt43yd2P0tVScYG/x83kNaGA92HGdkAXTg3aqb9fOY0b8sKAeIqI8C6fgHEYO/gUn7lyvFAV81xo1LcBvOy/ezvsq83Qb0jm4GGHAQEecihHe0rAXJhG3DbMDu70AhVlA94fGZh5kgolfZSRKZEBTNHejhk/6pOkMFXyyJSDx8z6RyYnoo9Ci+S0Kia540RSznUmA/KN505FDW7w== Received: from BN9PR03CA0063.namprd03.prod.outlook.com (2603:10b6:408:fc::8) by IA1PR12MB6579.namprd12.prod.outlook.com (2603:10b6:208:3a1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27; Wed, 8 Feb 2023 06:37:23 +0000 Received: from BN8NAM11FT067.eop-nam11.prod.protection.outlook.com (2603:10b6:408:fc:cafe::6f) by BN9PR03CA0063.outlook.office365.com (2603:10b6:408:fc::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:37:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT067.mail.protection.outlook.com (10.13.177.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:37:23 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:37:10 -0800 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:37:09 -0800 From: Vadim Pasternak To: CC: , Vadim Pasternak Subject: [PATCH platform-next 10/13] platform_data/mlxreg: Add field with mapped resource address Date: Wed, 8 Feb 2023 08:33:27 +0200 Message-ID: <20230208063331.15560-11-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230208063331.15560-1-vadimp@nvidia.com> References: <20230208063331.15560-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT067:EE_|IA1PR12MB6579:EE_ X-MS-Office365-Filtering-Correlation-Id: e0d2fa4e-2fcd-41f9-5055-08db099eeff6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cTIe1hUNZUj/3THeB6sLottpU4RcnCSw+sCg/e01irkRT+BUa6EjMmhCxGav7A+Eed4ezv0/b4KTrZfHqGiVEHiq8ZZ5LNyEQaeW/igQBmmiDkoUi+b10810pu6UR1s/6OFYZ76mNdB7nbJMGwqIY5YARjTbLWenxBbYclxwYOChFZQdKOYTCDMFIcHjtInFcBK+NCyv0zd/UrmBXYQY7+WAwoxmGIqFP8ztv5kbxf4Gw1hQ2TVEubL0kGxYCxlH3Nk4LtlP9ssSJ6eYIl5E0WbYJwrwSXfs6ym5E2bWQ9W+NStxK0eTK1hB4s04y5kcS26t1ih7zqYT9ICFt02XDuGABPmwpux+HmRFMxKbH6V1kRAhvbfMvT6DqLx4aSOb8h2lsJ17ZaYF9zmtnfD9ufJuusQU4c9lqqlAUrQmb28onZtrrXr5JLbxVefL/6GsMCz26qkNk4dvB4CQu0uWGiAWkt4MZ554b+C2u7CLHHfc/K3JOK53U0AHx45vw+AfOuc7xA0hPV9aSJxCz0ZzBXc/EqgS+e0ZOdIATmu8eq57GA8Ap5x/6v2Xa+5o6u9vqd0VVrpaeAgzhCgVWQP0QDZnBmmal+Itiprziq+XR/whOdGfcTJ7iF+Asi/xxeVsbDBB9v8SS9/nYhOHkoa4MDekurnZ/RVpXRSy3iyM4m+RnNonXWTH6MSqdshxoXXEXTovm1Vv9qRfn88ee62pQw== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(346002)(39860400002)(376002)(136003)(396003)(451199018)(46966006)(36840700001)(40470700004)(356005)(2906002)(36756003)(47076005)(40480700001)(107886003)(83380400001)(426003)(336012)(82310400005)(54906003)(6666004)(316002)(82740400003)(478600001)(2616005)(86362001)(26005)(8676002)(5660300002)(16526019)(8936002)(70206006)(40460700003)(6916009)(186003)(4326008)(41300700001)(7636003)(70586007)(36860700001)(1076003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 06:37:23.6405 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0d2fa4e-2fcd-41f9-5055-08db099eeff6 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT067.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6579 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Add field with PCIe remapped based address for passing it across relevant platform drivers sharing common system resources. Signed-off-by: Vadim Pasternak Reviewed-by: Michael Shych --- include/linux/platform_data/mlxreg.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/platform_data/mlxreg.h b/include/linux/platform_data/mlxreg.h index a6bd74e29b6b..0b9f81a6f753 100644 --- a/include/linux/platform_data/mlxreg.h +++ b/include/linux/platform_data/mlxreg.h @@ -216,6 +216,7 @@ struct mlxreg_core_platform_data { * @mask_low: low aggregation interrupt common mask; * @deferred_nr: I2C adapter number must be exist prior probing execution; * @shift_nr: I2C adapter numbers must be incremented by this value; + * @addr: mapped resource address; * @handle: handle to be passed by callback; * @completion_notify: callback to notify when platform driver probing is done; */ @@ -230,6 +231,7 @@ struct mlxreg_core_hotplug_platform_data { u32 mask_low; int deferred_nr; int shift_nr; + void __iomem *addr; void *handle; int (*completion_notify)(void *handle, int id); }; From patchwork Wed Feb 8 06:33:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 13132490 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A10DC05027 for ; Wed, 8 Feb 2023 06:37:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229805AbjBHGhc (ORCPT ); Wed, 8 Feb 2023 01:37:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229984AbjBHGha (ORCPT ); Wed, 8 Feb 2023 01:37:30 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2075.outbound.protection.outlook.com [40.107.93.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D98FA37F25 for ; Tue, 7 Feb 2023 22:37:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ikaWWdk+SqRp/r1fUmwGqrPtW/YH0Bqseq/MrRFYcpAdCy7SEa8gMN00j5/tW2sEa57p7A8kvCGw3N4xJYsNP2xGGHZ/z0XfLoVXtu84nS0a81nVgc+XwuS600UQ61raPEbnCJUhqSUc+Im04nXI7gAd6xIZzK9ZCSQnls2HmWFvbzxlILUwpR3dnIlaRj/Z18ADRsUIomFezggLGHsYxWkYO0f/Fm+5zoTGN1jeLVjrRVRMghMIqCPvSfqg1NGvwRYKnWtgMKiYUCueHYtHbRc+GmOiofHiPC9CuXQv4tU5+wViGqT0HQnkS59Nmz+PZpluur2QvW2B7gjy4k3RIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Qz1Dl5PLF7qodd4Z7D8Le5eym/rO8f502zKZhaVnhjs=; b=oZzeLrO1icIRl/qcVE3XpkOUYjx5rN578EyrUk7XzuYuTiImVp8vKTVC5aq1ajo4OWjjVOGgP0JRKbbpZz5bJ1tpNOCv+SvvKTd/C6Ec1MiXbzspuSVfpUehd/XXETs8v4iwmX6AzMuK+fHqSB8XI+cfOEaiNffYvWZlbXq+mJ85/tZyt7N+wVl5XRLeOsgLZE87jpBcUOJmsSjiP71g68BL45vP/It3U57EIl/Y97DTpKVy2xwJXEBRg+qmXfNugU709hJSdq0pKWkYMf/DHvf0dJTXMpnwjARS4QGw0JT2kMtm7cBt6fTDI4Cv0qfsAwUOzMYAK/EhGRM/Ck55ZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qz1Dl5PLF7qodd4Z7D8Le5eym/rO8f502zKZhaVnhjs=; b=ONXg/TZjjnNDvTqN+ixB/XhfUa75Qlh/Z19np+fY3W937YE4UqjHBJzDHU70/zk5FqzcUEuwDnrxnVvk6o8uYAoOCCEV4JnKgKLpCK87RANCkmKwHPUclHiBNeRQPCHI7+HVNx8tw0M4UMdwjklTKmQxV8guuLaTfPeIKq+Pq05m+TFaPIZVrpJVKnCYiyBSTIWvwcoJUJP+mSQJ2VS13AV4Ktk9G1buHnBXMH5RZGDEbjLCDF5ssEhiQc0xb+OvAiCFRxFlbzjATDh2WyHre31/F0xENN29sBN0NXTfY+iLa3W5+xw1K0Tw+mPr/6CwBUYNvBjE4sfsEOC4d8dQIw== Received: from DM6PR11CA0048.namprd11.prod.outlook.com (2603:10b6:5:14c::25) by DS0PR12MB7678.namprd12.prod.outlook.com (2603:10b6:8:135::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.34; Wed, 8 Feb 2023 06:37:25 +0000 Received: from DS1PEPF0000E656.namprd02.prod.outlook.com (2603:10b6:5:14c:cafe::67) by DM6PR11CA0048.outlook.office365.com (2603:10b6:5:14c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:37:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS1PEPF0000E656.mail.protection.outlook.com (10.167.18.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.16 via Frontend Transport; Wed, 8 Feb 2023 06:37:24 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:37:14 -0800 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:37:12 -0800 From: Vadim Pasternak To: CC: , Vadim Pasternak Subject: [PATCH platform-next 11/13] platform: mellanox: mlx-platform: Add mux selection register to regmap Date: Wed, 8 Feb 2023 08:33:28 +0200 Message-ID: <20230208063331.15560-12-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230208063331.15560-1-vadimp@nvidia.com> References: <20230208063331.15560-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E656:EE_|DS0PR12MB7678:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e7ebd93-05bd-42e6-f86f-08db099ef0a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qFngLQYpJdnkl8K0Yz5sZRxxMxNRaFiTmvZWQJYribypivuf9ZfcofiJOm1x7D4Iqv09aVnxGNEaN9WxH7QjAQD8pDOSAEmveYGCeU3jjS34Jz6aB40v88ncZkNxcTRgiq+DJaWg3aMvcXWTVG6vQDl/D/N+hAL1To16Wru4PUdaY7wHMQGMZigkoNGf2gG61wXXEN+355SZQnjhn2S5mIbEKjj2MCDLWqmhmRyVtlsqqx2S6m9KzWeECg27pTnxROJFPokYRF+wGN9aFL5Sz6xH0546z/vqaEYnnQKp0S5snatLki58MMJ4Bvhf30OAZxKKWCQI4OqyJ2lMaUY/2592UIjFY3T1DR1dV6JNwp7+0IYfk3w9cePOPlinglx5U7mirLaVpblgPpAVlDG7JdHCSPQ7WlQtv+QW0ZelRXj+jilgUqGcXgJNtl22G7dU4phWyIfpA2ts3iYneCZL5d4zH/TU9V4FjDZbhs5ARqMrFy3oRFV16Ao+2tRi+F47DwhiD3Wf1A53EqmJ7itop44Er0EJu7cHeRXSJLnQqDCtUo4x9ZCLriP7Bc5LQOQb880TO4eVt+gtj41iLGcgA4m/woQv1QMP9Uhww54gWn0ZLdSaD2EUGsPeihLPg6sV2ONP5idDDsV2x+P5f1VQt2eUNfweOyGoYN3CMBSIyfY00fRMoP09Wo4agzHJmi5cA+4v2oYsQ186FddYURwfDw== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(39860400002)(396003)(136003)(376002)(346002)(451199018)(36840700001)(40470700004)(46966006)(36756003)(5660300002)(2906002)(426003)(83380400001)(47076005)(2616005)(40480700001)(336012)(356005)(82740400003)(7636003)(8676002)(36860700001)(70206006)(70586007)(4326008)(54906003)(316002)(6916009)(8936002)(41300700001)(6666004)(107886003)(1076003)(186003)(16526019)(26005)(82310400005)(40460700003)(478600001)(86362001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 06:37:24.8804 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e7ebd93-05bd-42e6-f86f-08db099ef0a9 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000E656.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7678 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Extend writeable, readable, volatile registers of the 'regmap' object with for I2C mux selector registers. The motivation is to pass this object extended with selector registers to I2C mux driver working over ‘regmap’. Signed-off-by: Vadim Pasternak Reviewed-by: Michael Shych --- drivers/platform/x86/mlx-platform.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c index d00fe9f3f1dc..482c62988a6f 100644 --- a/drivers/platform/x86/mlx-platform.c +++ b/drivers/platform/x86/mlx-platform.c @@ -139,6 +139,10 @@ #define MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET 0xd2 #define MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET 0xd3 #define MLXPLAT_CPLD_LPC_REG_DBG_CTRL_OFFSET 0xd9 +#define MLXPLAT_CPLD_LPC_REG_I2C_CH1_OFFSET 0xdb +#define MLXPLAT_CPLD_LPC_REG_I2C_CH2_OFFSET 0xda +#define MLXPLAT_CPLD_LPC_REG_I2C_CH3_OFFSET 0xdc +#define MLXPLAT_CPLD_LPC_REG_I2C_CH4_OFFSET 0xdd #define MLXPLAT_CPLD_LPC_REG_CPLD1_MVER_OFFSET 0xde #define MLXPLAT_CPLD_LPC_REG_CPLD2_MVER_OFFSET 0xdf #define MLXPLAT_CPLD_LPC_REG_CPLD3_MVER_OFFSET 0xe0 @@ -172,23 +176,19 @@ #define MLXPLAT_CPLD_LPC_REG_CONFIG2_OFFSET 0xfc #define MLXPLAT_CPLD_LPC_REG_CONFIG3_OFFSET 0xfd #define MLXPLAT_CPLD_LPC_IO_RANGE 0x100 -#define MLXPLAT_CPLD_LPC_I2C_CH1_OFF 0xdb -#define MLXPLAT_CPLD_LPC_I2C_CH2_OFF 0xda -#define MLXPLAT_CPLD_LPC_I2C_CH3_OFF 0xdc -#define MLXPLAT_CPLD_LPC_I2C_CH4_OFF 0xdd #define MLXPLAT_CPLD_LPC_PIO_OFFSET 0x10000UL #define MLXPLAT_CPLD_LPC_REG1 ((MLXPLAT_CPLD_LPC_REG_BASE_ADRR + \ - MLXPLAT_CPLD_LPC_I2C_CH1_OFF) | \ + MLXPLAT_CPLD_LPC_REG_I2C_CH1_OFFSET) | \ MLXPLAT_CPLD_LPC_PIO_OFFSET) #define MLXPLAT_CPLD_LPC_REG2 ((MLXPLAT_CPLD_LPC_REG_BASE_ADRR + \ - MLXPLAT_CPLD_LPC_I2C_CH2_OFF) | \ + MLXPLAT_CPLD_LPC_REG_I2C_CH2_OFFSET) | \ MLXPLAT_CPLD_LPC_PIO_OFFSET) #define MLXPLAT_CPLD_LPC_REG3 ((MLXPLAT_CPLD_LPC_REG_BASE_ADRR + \ - MLXPLAT_CPLD_LPC_I2C_CH3_OFF) | \ + MLXPLAT_CPLD_LPC_REG_I2C_CH3_OFFSET) | \ MLXPLAT_CPLD_LPC_PIO_OFFSET) #define MLXPLAT_CPLD_LPC_REG4 ((MLXPLAT_CPLD_LPC_REG_BASE_ADRR + \ - MLXPLAT_CPLD_LPC_I2C_CH4_OFF) | \ + MLXPLAT_CPLD_LPC_REG_I2C_CH4_OFFSET) | \ MLXPLAT_CPLD_LPC_PIO_OFFSET) /* Masks for aggregation, psu, pwr and fan event in CPLD related registers. */ @@ -4980,6 +4980,10 @@ static bool mlxplat_mlxcpld_writeable_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET: case MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET: case MLXPLAT_CPLD_LPC_REG_DBG_CTRL_OFFSET: + case MLXPLAT_CPLD_LPC_REG_I2C_CH1_OFFSET: + case MLXPLAT_CPLD_LPC_REG_I2C_CH2_OFFSET: + case MLXPLAT_CPLD_LPC_REG_I2C_CH3_OFFSET: + case MLXPLAT_CPLD_LPC_REG_I2C_CH4_OFFSET: case MLXPLAT_CPLD_LPC_REG_PWM1_OFFSET: case MLXPLAT_CPLD_LPC_REG_PWM2_OFFSET: case MLXPLAT_CPLD_LPC_REG_PWM3_OFFSET: @@ -5107,6 +5111,10 @@ static bool mlxplat_mlxcpld_readable_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET: case MLXPLAT_CPLD_LPC_REG_WD3_ACT_OFFSET: case MLXPLAT_CPLD_LPC_REG_DBG_CTRL_OFFSET: + case MLXPLAT_CPLD_LPC_REG_I2C_CH1_OFFSET: + case MLXPLAT_CPLD_LPC_REG_I2C_CH2_OFFSET: + case MLXPLAT_CPLD_LPC_REG_I2C_CH3_OFFSET: + case MLXPLAT_CPLD_LPC_REG_I2C_CH4_OFFSET: case MLXPLAT_CPLD_LPC_REG_CPLD1_MVER_OFFSET: case MLXPLAT_CPLD_LPC_REG_CPLD2_MVER_OFFSET: case MLXPLAT_CPLD_LPC_REG_CPLD3_MVER_OFFSET: @@ -5254,6 +5262,10 @@ static bool mlxplat_mlxcpld_volatile_reg(struct device *dev, unsigned int reg) case MLXPLAT_CPLD_LPC_REG_WD3_TMR_OFFSET: case MLXPLAT_CPLD_LPC_REG_WD3_TLEFT_OFFSET: case MLXPLAT_CPLD_LPC_REG_DBG_CTRL_OFFSET: + case MLXPLAT_CPLD_LPC_REG_I2C_CH1_OFFSET: + case MLXPLAT_CPLD_LPC_REG_I2C_CH2_OFFSET: + case MLXPLAT_CPLD_LPC_REG_I2C_CH3_OFFSET: + case MLXPLAT_CPLD_LPC_REG_I2C_CH4_OFFSET: case MLXPLAT_CPLD_LPC_REG_CPLD1_MVER_OFFSET: case MLXPLAT_CPLD_LPC_REG_CPLD2_MVER_OFFSET: case MLXPLAT_CPLD_LPC_REG_CPLD3_MVER_OFFSET: From patchwork Wed Feb 8 06:33:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 13132491 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 916B1C05027 for ; Wed, 8 Feb 2023 06:37:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230064AbjBHGhf (ORCPT ); Wed, 8 Feb 2023 01:37:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229962AbjBHGhe (ORCPT ); Wed, 8 Feb 2023 01:37:34 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2081.outbound.protection.outlook.com [40.107.220.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D15F330B22 for ; Tue, 7 Feb 2023 22:37:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dn6OKAfZRmc54AWW/2013mfqNg7usP5mK9BSOqP3Mj8hQ/bwrEbZI4QCWgYVBTC493oPVPgl3jlJE26KRrLyorH5aaPjKLoW+v+j0Y+wDfZltdmIvh9en3XGpjpSPYUqRtdR10/cU9eL+egzG2aL0cRKYVuJ6Ug85mfp0YhQHzr7cI6NEHBYqSnQ+Fv1OhmwBOjdib4F/In9e5hFkaNOOypoN2TEXfeS5iTpj6QVcTys8K7rIic/Kc/OvTwcIdOg1Ocxskfbx5U8a+aEiaNjJApdQcfo8fArhJv+AT7BFZUiBHdWYPXPouvpzb4FurWeMDW1jTj/yi97N3FOcYoiDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hz0EZ0akay6idePB6w+P/MRk7qF45B9LJ+KuazC5vk4=; b=FQT68ovml2289JSkyNoSI5YhDW/H9EhzC6CrBs3p9Co5Tf8of+Eqy5PKkPsSea20ag5o63GaXu5bCwiOMPMeA6KZJjbFdGq8aoO+Nr3M9020JiCaf/0a6vtB74RQwGQU4SmCTixSRtZOxt4yQL9yznDcK02p0NXuBBMLz0mbYNKoOw62WVl0DciCbhYL9wSVaGv4gx7Th/Dagvvd/rhSNDHbpUr7e0eRJIn0zL+EROQ+gLNslK+XuahJYXKFlptEC25jsIQmRqC52amqp45bHF8HqeAJ8Wl43mEqBaWlHGXCvEPhyk5+V9cYI9UfMyLhdQz64OG0A/MRQWOBWezhYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hz0EZ0akay6idePB6w+P/MRk7qF45B9LJ+KuazC5vk4=; b=GarmA3HnKX7LuTBiUP9934PEYVMhvpduDImRIFE8pKUJrd3sK0Zd3qP6iSlGxwfClp5OHX9dGSCEwirAF3OMRHJESBPHSxiNGDeuIKVtnVIW1ccN3QGVySGoyroWh+ZXeM3XGoSC03zmm2d+9ITXiU0OI+k/l864xBBES0f/kn9hj3V9nmCMQvdIIqyj32cAMoanV+7N8hFNurFMjVLd88lIu+R4vA8eVdjKlBfXyYSVDXxfLD2c3Q3Soe7ARq1kr+pCYmop5QVSoKUkKItc+PMZ4tW3Pmdx3FeNqJobAne1BXqIdk/tLKFbCMQLYaDtu175w11REG1i5/Abe21hjA== Received: from BN0PR04CA0068.namprd04.prod.outlook.com (2603:10b6:408:ea::13) by BY5PR12MB4211.namprd12.prod.outlook.com (2603:10b6:a03:20f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36; Wed, 8 Feb 2023 06:37:30 +0000 Received: from BN8NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ea:cafe::30) by BN0PR04CA0068.outlook.office365.com (2603:10b6:408:ea::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.36 via Frontend Transport; Wed, 8 Feb 2023 06:37:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT034.mail.protection.outlook.com (10.13.176.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:37:30 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:37:17 -0800 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:37:15 -0800 From: Vadim Pasternak To: CC: , Vadim Pasternak Subject: [PATCH platform-next 12/13] platform: mellanox: mlx-platform: Move bus shift assignment out of the loop Date: Wed, 8 Feb 2023 08:33:29 +0200 Message-ID: <20230208063331.15560-13-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230208063331.15560-1-vadimp@nvidia.com> References: <20230208063331.15560-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT034:EE_|BY5PR12MB4211:EE_ X-MS-Office365-Filtering-Correlation-Id: 8013ef0d-ae76-4e64-8596-08db099ef3f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xqKFx8kPmwQeNbRO3rfVwcopIzj7heOtazlJnnaUu3Q/HNlWmWt7K77zj0l5QxD1bKrws1jd1IUmkCk4qCOUg1YF/yPvxLKU5Zy8BQsxIy1xhWUO20Ml/pk8Z5pDjlS7ofOQDLAdAjCEMS5AphCZHIEcbkIPH//HII/RQ+ImmjWg5RpZt0PRGYv4uNQqz6Y2lVFSLFdnVa6W87zp79bBWMaHW1CsLKKv26ELm2vHMAVJzekBo5wCwOudJIFC1MfAZhScmpNu2U6a11eVOGRJWH1mCWxB+QPnQNFNXng7tod5Va0BW7GI+VEus7PToL47HXtWq4F0tocICn91FLuqZjZ99ljfprwX2lXn3Ut6zJBIamWndcMELxwCNQNJA94DUTgMleSOdJu3Jv2Cgcwul/lo1+CV3UsLx8YQWQTKzijbBGwzarO2iS9xaYY8DAB/iYMJ3kkzYw5+SmxN/9AAPAJtvLx4LLHfE3oskzYTDBgMlO7ouzdCuTVRLDOtnWM4G4jfSXVB8bHoJvwwJ0Z7Bl4w3gY//Au9kUU9btEstjL2n7+erj4LA4ls3Dev0Df3reAWa4aARrxTH0MbPdaKPD/0jJUxcSJ4qx0HnmkRXlqV+J1tqj2/djxZ/8hqODkK8QADoHD5w7+lUZSEBTKpF7YaHfMrpB0QYxeySEOMRK43/LVKbpTtz40dTPGJknU+TRdyjck1UfH5mcU1jAqNmA== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(376002)(39860400002)(136003)(346002)(396003)(451199018)(46966006)(40470700004)(36840700001)(107886003)(40460700003)(1076003)(36756003)(16526019)(186003)(6666004)(82310400005)(26005)(8676002)(47076005)(7636003)(356005)(54906003)(82740400003)(36860700001)(316002)(5660300002)(40480700001)(2616005)(41300700001)(8936002)(2906002)(4744005)(83380400001)(426003)(4326008)(336012)(70586007)(86362001)(70206006)(6916009)(478600001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 06:37:30.3175 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8013ef0d-ae76-4e64-8596-08db099ef3f3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4211 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Move assignment of bus shift setting out of the loop to avoid redundant operation. Signed-off-by: Vadim Pasternak Reviewed-by: Michael Shych --- drivers/platform/x86/mlx-platform.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c index 482c62988a6f..1bf9ef6e8c97 100644 --- a/drivers/platform/x86/mlx-platform.c +++ b/drivers/platform/x86/mlx-platform.c @@ -6008,10 +6008,11 @@ static int mlxplat_mlxcpld_verify_bus_topology(int *nr) shift = *nr - mlxplat_mux_data[i].parent; mlxplat_mux_data[i].parent = *nr; mlxplat_mux_data[i].base_nr += shift; - if (shift > 0) - mlxplat_hotplug->shift_nr = shift; } + if (shift > 0) + mlxplat_hotplug->shift_nr = shift; + return 0; } From patchwork Wed Feb 8 06:33:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vadim Pasternak X-Patchwork-Id: 13132492 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DA55C05027 for ; Wed, 8 Feb 2023 06:37:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229962AbjBHGhk (ORCPT ); Wed, 8 Feb 2023 01:37:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229984AbjBHGhj (ORCPT ); Wed, 8 Feb 2023 01:37:39 -0500 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2069.outbound.protection.outlook.com [40.107.101.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96F8030B22 for ; Tue, 7 Feb 2023 22:37:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jOxhUvRftUIFVXecS5oMzbe70A2GI1fehJFiIs208NHbaWGLftF8Bw0MbwZrIwGN8ojy910GcEGj/061yiADmYl2GNOLkqZYapXNL1Gu3vqSFgHDpptjZlmyO4ceuFwOkQMgJOC9U71Ez6d2v9J814jUnZPRtWSQpYNCWRlpBs3/ThkLajueFnQ2kF9Ipa7Q6Za51qJfgquyE/9Pa2ZFtpBWYg3bPJEeTlS5ahIuJF5JJmN1vF55LqfsLBP3vUcO6nx3NQfKOu6AorkIW2DjhlazQ8qiHIAwtdQdzwZltHgfhMuZPFyLlRy7W4u1if/y9ztLN4u7EuiGKEWlkAeOxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BKejNIlnEkWk5bQSvcPL+eJR8UXvey9Tm1yzh41vjOQ=; b=jiA0bzvZsHvg7x51R9eZ9rBSFQ4K/6KIVdtheS2Jr789gz8jKjMLTZd7hAr2+T56D/MeOmlkoI5F5q0gg3qGuvql5V3Bhr0+nmm6gX/hY+Z6m5rW9jbKntk3zY9UDLpMYaMdS7uk3iCMJERUNHqLRupPc6YkmJGkh6YB7pDU0jqf5poQ7CsTJDmJoZYS6ie0bRkvz8wiNheZytp6yHoiSfdPRc5JOvY0MBsKneCcyqXou+fDhjqOwyokswU9tkPa0UKj1f4CNnhwtpV7wOYjrraMz6dTSbqB4W+aNk0UrCsfWT4Onggcb4k3UOUGKVEhEiqawPzVQhUWGzLXMtTMNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BKejNIlnEkWk5bQSvcPL+eJR8UXvey9Tm1yzh41vjOQ=; b=Wh2pwoDGuS34k4iNbkx6lBtlarBeEoESaLUe9L+MlAL8deacG5v727VPgW2w6+pFm82FJ90zeavThfBwKOaS24N3pm/mqFFVuajLUH73mc/kIVhNKPptIe7mOzD4pdyYp47x7NaufG5Hc7gIey+To7wGmeZu9Oe3iyUl1/3cCT1JHUbalfjQQWgN734ujD9Wy74tkT2pToGbZl6Py/X2NJBE5DnavJK14L2qPmFVTJ9+pr1wjZoLm8RyW0/BguYMtiqtGBKeaaU4DH7klb4MDT6Xkgb130s8ALo3cx7QfNWjgsn5vHNmYOcNkdiYMRy1O0NzqHEf9UXj7w72y+Tz+Q== Received: from BN0PR04CA0067.namprd04.prod.outlook.com (2603:10b6:408:ea::12) by MW3PR12MB4473.namprd12.prod.outlook.com (2603:10b6:303:56::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.35; Wed, 8 Feb 2023 06:37:33 +0000 Received: from BN8NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ea:cafe::84) by BN0PR04CA0067.outlook.office365.com (2603:10b6:408:ea::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:37:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT034.mail.protection.outlook.com (10.13.176.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17 via Frontend Transport; Wed, 8 Feb 2023 06:37:33 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:37:19 -0800 Received: from r-build-bsp-02.mtr.labs.mlnx (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Tue, 7 Feb 2023 22:37:18 -0800 From: Vadim Pasternak To: CC: , Vadim Pasternak Subject: [PATCH platform-next 13/13] Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces Date: Wed, 8 Feb 2023 08:33:30 +0200 Message-ID: <20230208063331.15560-14-vadimp@nvidia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230208063331.15560-1-vadimp@nvidia.com> References: <20230208063331.15560-1-vadimp@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT034:EE_|MW3PR12MB4473:EE_ X-MS-Office365-Filtering-Correlation-Id: db2b5a9e-92e4-423d-51ca-08db099ef5d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kKuuVXUO4t+XORB0os3yBeMXr5vGfwFVJxTbdqq7ZchOPjQV4svOyDGve2nzUgUVmiVNGNcdDAk6iPfVjX8P9BdUeDyo65MiZ1FBFJcrEk5ufp8LM4JzPAmzkpM7Ee5ohaPoorVtAhbksii/ZLPHHg0OgAvkbAVZTQ5ROhu1d68kQls/+kxrGKuJf4tAWByo1OKoMsgFbQzbX2NVVPLJ9h8VLZ0DNe4ElzJ+xWTFA18nfdM00sgNR3auvABSS7P2Y6UenXKF/ks+zIJMKalrbEGQBBDeNd8IAYn9PGESvRedimw0O8ExmK8mn1pVhBqGoAsjPtuzwhoVtCowP0dQrPxhsAUlpAbbFwu5IuTm6dh8+L4CMiqAIHxN7lput5Hmob1vcyCPxJCWEg8T3uauWLjJ6qKTA9P8MjdSCx/ZSXQ+my17DO4CHBdQf+3qBAOMn3NQjCdTca+9lOisJp8PKM4UGA49LFrArh1qOf4W46brp/cJCT4S4jo9Y/wgxQpg+IknN/219dkiizCxXY09/x7+c/nReBtp/lndb2WxjnpLbjcDR+AAgaSwlzuabh9qaujLHE2Ttc/lrxH+SDkMso+FXtf4Uv8LpAkbHoPjYcUxw0bu9SWiV0kPO585h3Cdcw2z/dasHXYmuRjIsdkQkhQOtXHmysNqaKsWnYoRsoUwDoi/xjhbGkjXuyJMAqczXIVF2617+TTifthflv+bTg== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(396003)(376002)(346002)(39860400002)(136003)(451199018)(36840700001)(40470700004)(46966006)(82310400005)(426003)(83380400001)(36756003)(86362001)(2906002)(8936002)(5660300002)(4326008)(6916009)(70206006)(8676002)(40480700001)(70586007)(41300700001)(356005)(7636003)(82740400003)(36860700001)(316002)(54906003)(47076005)(6666004)(107886003)(40460700003)(336012)(2616005)(16526019)(478600001)(1076003)(26005)(186003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2023 06:37:33.4422 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: db2b5a9e-92e4-423d-51ca-08db099ef5d0 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4473 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Add description for new attributes added for rack manager switch and NG800 family systems. Attributes related to power converter board: - reset_pwr_converter_fail; - pwr_converter_prog_en; Attributes related to External Root of Trust (EROT) devices recovery: - erot1_ap_reset; - erot2_ap_reset; - erot1_recovery; - erot2_recovery; - erot1_reset; - erot2_reset; - erot1_wp; - erot2_wp; - spi_chnl_select; Attributes related to clock board failures and recovery: - clk_brd1_boot_fail; - clk_brd2_boot_fail; - clk_brd_fail; - clk_brd_prog_en; Attributes related to power failures: - reset_ac_ok_fail; - asic_pg_fail; Signed-off-by: Vadim Pasternak Reviewed-by: Michael Shych --- .../ABI/stable/sysfs-driver-mlxreg-io | 122 +++++++++++++++++- 1 file changed, 121 insertions(+), 1 deletion(-) diff --git a/Documentation/ABI/stable/sysfs-driver-mlxreg-io b/Documentation/ABI/stable/sysfs-driver-mlxreg-io index af0cbf143c48..60953903d007 100644 --- a/Documentation/ABI/stable/sysfs-driver-mlxreg-io +++ b/Documentation/ABI/stable/sysfs-driver-mlxreg-io @@ -522,7 +522,6 @@ Description: These files allow to each of ASICs by writing 1. The files are write only. - What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/comm_chnl_ready Date: July 2022 KernelVersion: 5.20 @@ -542,3 +541,124 @@ Description: The file indicates COME module hardware configuration. The purpose is to expose some minor BOM changes for the same system SKU. The file is read only. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_pwr_converter_fail +Date: February 2023 +KernelVersion: 6.3 +Contact: Vadim Pasternak +Description: This file shows the system reset cause due to power converter + devices failure. + Value 1 in file means this is reset cause, 0 - otherwise. + + The file is read only. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/erot1_ap_reset +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/erot2_ap_reset +Date: February 2023 +KernelVersion: 6.3 +Contact: Vadim Pasternak +Description: These files aim to monitor the status of the External Root of Trust (EROT) + processor's RESET output to the Application Processor (AP). + By reading this file, could be determined if the EROT has invalidated or + revoked AP Firmware, at which point it will hold the AP in RESET until a + valid firmware is loaded. This protects the AP from running an + unauthorized firmware. In the normal flow, the AP reset should be released + after the EROT validates the integrity of the FW, and it should be done so + as quickly as possible so that the AP boots before the CPU starts to + communicate to each ASIC. + + The files are read only. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/erot1_recovery +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/erot2_recovery +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/erot1_reset +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/erot2_reset +Date: February 2023 +KernelVersion: 6.3 +Contact: Vadim Pasternak +Description: These files aim to perform External Root of Trust (EROT) recovery + sequence after EROT device failure. + These EROT devices protect ASICs from unauthorized access and in normal + flow their reset should be released with system power – earliest power + up stage, so that EROTs can begin boot and authentication process before + CPU starts to communicate to ASICs. + Issuing a reset to the EROT while asserting the recovery signal will cause + the EROT Application Processor to enter recovery mode so that the EROT FW + can be updated/recovered. + For reset/recovery the related file should be toggled by 1/0. + + The files are read/write. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/erot1_wp +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/erot2_wp +Date: February 2023 +KernelVersion: 6.3 +Contact: Vadim Pasternak +Description: These files allow access to External Root of Trust (EROT) for reset + and recovery sequence after EROT device failure. + Default is 0 (programming disabled). + If the system is in locked-down mode writing this file will not be allowed. + + The files are read/write. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/spi_chnl_select +Date: February 2023 +KernelVersion: 6.3 +Contact: Vadim Pasternak +Description: This file allows SPI chip selection for External Root of Trust (EROT) + device Out-of-Band recovery. + File can be written with 0 or with 1. It selects which EROT can be accessed + through SPI device. + + The file is read/write. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/asic_pg_fail +Date: February 2023 +KernelVersion: 6.3 +Contact: Vadim Pasternak vadimp@nvidia.com +Description: This file shows ASIC Power Good status. + Value 1 in file means ASIC Power Good failed, 0 - otherwise. + + The file is read only. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/clk_brd1_boot_fail +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/clk_brd2_boot_fail +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/clk_brd_fail +Date: February 2023 +KernelVersion: 6.3 +Contact: Vadim Pasternak vadimp@nvidia.com +Description: These files are related to clock boards status in system. + - clk_brd1_boot_fail: warning about 1-st clock board failed to boot from CI. + - clk_brd2_boot_fail: warning about 2-nd clock board failed to boot from CI. + - clk_brd_fail: error about common clock board boot failure. + + The files are read only. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/clk_brd_prog_en +Date: February 2023 +KernelVersion: 6.3 +Contact: Vadim Pasternak +Description: This file enables programming of clock boards. + Default is 0 (programming disabled). + If the system is in locked-down mode writing this file will not be allowed. + + The file is read/write. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/pwr_converter_prog_en +Date: February 2023 +KernelVersion: 6.3 +Contact: Vadim Pasternak +Description: This file enables programming of power converters. + Default is 0 (programming disabled). + If the system is in locked-down mode writing this file will not be allowed. + + The file is read/write. + +What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/reset_ac_ok_fail +Date: February 2023 +KernelVersion: 6.3 +Contact: Vadim Pasternak +Description: This file shows the system reset cause due to AC power failure. + Value 1 in file means this is reset cause, 0 - otherwise. + + The file is read only.