From patchwork Thu Aug 22 14:21:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 821458 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2072.outbound.protection.outlook.com [40.107.236.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 144981CB336 for ; Thu, 22 Aug 2024 14:22:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724336563; cv=fail; b=Fd0Niw5phLVdIUwG7E7ULdzxA9PPVxnZa+F1Zwc5ZWHHan3tXYi9Ispp8mjqWOnporUF7MzsyQwqqDHNzW1QGgZI1GI861Wmvqo4xRyaajS+lzYah37nKGIJlyqmNgH4iLQv+kXHDpJr/8FL/FDIqkhN26NDgS+fCXasjveS19k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724336563; c=relaxed/simple; bh=uLv9i/aqJ6QS8wBELy89zT4OW859UkgSE/LQpMC6vxA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=u2jTbgWxk1orhYJcWJAW7MRVYE9KHrLpYTxBb6QN2XdSpTW4OLh1+OBB9JB5BoCU9fT+FlsAAyBgBYSbuWWEvlXVKdn3j0YpokzyzPYlifkeKtufNVacEJXw6wRl97p06l51VnELG0RItWpFD8ZNFmsInsVwxHkua4Bcs8XLpxg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=FArL2cJo; arc=fail smtp.client-ip=40.107.236.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="FArL2cJo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JszSQcH+QK84h8Iw2IPjnnBhZIJeljIeCgjYyZkfwxDA/iqrdTLaK1EYwT8jcVHcAvtRLWKN56bkO8ydmD0/JiKsDhy/Q2LGuazemOPRDaeMPIISOQye1xS0fc9D5ReRqWQQbTMuWYo2b+ygVHJ4mvxTYt3ZjM5ZUpwW5dud41/qu4P+i4HY3/G9/WvK7xiH2o3xIwiPCxTN2rvICErshdli7rL2DpmLViwI6JxVZ8rrehylEZDFWgmnCt4DZx6fPsRLXcw/pokOmhd8yctHA8RacQkPSAfOa7SXRA/ugiuQgyatEgWUx+8066xX73lhI2DTBPLgctCCM+zkKmJZXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=4Dtr8v8y3YwVOl7LwpOMjkyNDBXg8iglxL6YODslKqA=; b=dlqeU+wqJ8Ydxh0yP6neM+49/PZf5IVLurkco2P1ff4RiSmrzF2J0qlVJCcyQBtyJ0yI5CVMvg0PUuRqNKr46w20tXFjot5AqkePLHcS7CNrFrcmVlgRARLwjqBf+2GSqHgRi/LRRdovbm+9bymKkvePegMRuYupyCuWg8RckFFQVnE20NuOvIhGkE5PSExhpyruosl/DPWVgDcpX0Xhz5H0xyGCh1iPe0LBbgRcWi/NVwvaJrAQPzDga9BSoMKSobTKhG1nNAhjAj70ecpFwp0GSlqnakeANpRbwOwiISNGcwTAY3bJMTWr24Ug252/eDmKMMH5EXiY4l3yXG3C0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4Dtr8v8y3YwVOl7LwpOMjkyNDBXg8iglxL6YODslKqA=; b=FArL2cJo7e/zmmjfwY6kdz3SWDpV5eaQ1iMX34ZS1U2wGHVTa1oKn6be2GD8gthEl4RvZ4eW/zc3Z6LrQ5ebT9UxITvT/G3PjgtgWco0jXtk4ImCG6WG5Xd5ORIGyymkrecPiYlhwS9UiMR1Q5ue8VWvU8lLJwiuiVLMM79DoOc= Received: from CH2PR07CA0005.namprd07.prod.outlook.com (2603:10b6:610:20::18) by PH8PR12MB6914.namprd12.prod.outlook.com (2603:10b6:510:1cb::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.18; Thu, 22 Aug 2024 14:22:32 +0000 Received: from CH3PEPF0000000F.namprd04.prod.outlook.com (2603:10b6:610:20:cafe::5f) by CH2PR07CA0005.outlook.office365.com (2603:10b6:610:20::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.25 via Frontend Transport; Thu, 22 Aug 2024 14:22:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH3PEPF0000000F.mail.protection.outlook.com (10.167.244.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7897.11 via Frontend Transport; Thu, 22 Aug 2024 14:22:32 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 22 Aug 2024 09:22:30 -0500 From: Shyam Sundar S K To: Jean Delvare , Andi Shyti CC: , , Shyam Sundar S K Subject: [PATCH 1/5] i2c: piix4: Allow more than two algo selection for SMBus Date: Thu, 22 Aug 2024 19:51:56 +0530 Message-ID: <20240822142200.686842-2-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822142200.686842-1-Shyam-sundar.S-k@amd.com> References: <20240822142200.686842-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF0000000F:EE_|PH8PR12MB6914:EE_ X-MS-Office365-Filtering-Correlation-Id: 523a9df9-d9bf-4e87-c593-08dcc2b5dc8b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: kMDYjxhwKn6IVPSsTWHHECqXZ6FxbY9JQo58CyDUtSv4xIErooUjWB9EC4lUNEyntZ/FeVD7j6AKCLiNjpNAFuppLJjZMB91bdiREoShlKF/N2kw4HibBJzHs8Ay5yeSdzTCTZFpFnTi4VnujrgNoxrmGfYxq42uoN3t4r1D4pcmq8fyKGrJnxrYdw+BKSjWnBeUs2SnAoEPiytfY9ZKr2BQqI2VwOpZYrftyCZ1dIBrIqcVBwLsudT1zgERux+BcgX+8lZNJDJHXuvJLL20V+kda9T1Z5/j48gXRshkaA0STnnzHGdsb2+uSglrLG6oJekVGeHYGKmKBXT5jE0AcT6CQbo4mcDV25UZBLCS07w/ntU8u/xaxdW9u5VLgCdXXYhW3Fx2G4fc2Vl3q5P4HnpxAcVJw+eG6lln2yB1lMfRh3Q3ZnyWTMdcz4v0f2HTdBD7LI+21Mycegp0TNn6391abaQXwGO+6e6wcl2Cs2bwVQreaKU0/5WZRWf8xGe6LpJtsurgT1zo3r+WkgcpFEnm7p8dI49/rGxSe0b2shYRBbr1DjUd5oKvtN8XWyr8lcnXaPiYrvb7SytYnoGrIKilfujxZIkuQgUaVoRXXn0WQog8VGEUiN0dOb5D1SJ7xnnL/anvDOVg9w0jmb/JByuEVO89XAw07ZZ246BnVawPbSgLCUXm/9hZC8BIFePcvWDdiJIA+7hzSYrfsMRce1WB3O8tFueJM0J14pMbyd+R265+ijiHPP4zVbRgk8jn7mxfgKPMHaWJTQLbpddMc5QuwVw7Kn7tIe7yYD/NB59rqNitcUulHfYiDgyA9tO7ubS8QwaFvCu5T1g2b5pMSJPsTGNqhqV+nDRzGaixjZruilorFFvnVZMv3YQSvDE1xa96sdacexqRpQ1VaYm6QWJ5Joij44zkPk/lMWfKAYiQCpoCuAy6Xd1vVSanKm/+uAYkghmeKE3f9pfu3TC3ejo6Q/If4+FAouja73N2IlNa61Z5Ynv8ZZerHyJ/7FRqKgRXYSa5YG4kVmlsXoUcyImvX8E9rNdKECbab3QwKMwTTXO9sEtxjVmNUxKLgwpUco3xSndJ4sluJNKVTaXTPDhVzy+wOoQB1V6DyZvOVWpD8Vmy4ZIwrGdZHYjOPTLKSfmjlHjoc7IENJZy30dCSVNu5MQQ514RQJ+J3mrTswunQi+MvnY9i1sGmDnPTDJemyEj+qI/dURbOrtxwl7U7AD9EgvrYje+1tZUp/S7msDSHR8gFxS4OKV/jk2S84uFwJNsKyZOXpf9iRzb6cm+bQHYNQ2Qn5wQl7UQkhBvGdsPz5uSn4bgyh7PO9Hg+VXxzBjGHbFoUEl/M/bXo8HEU3a9vwrzboIrVWqMmwQRoYr4IcfhzZXLVDAW/VA3k4/ImF62TvspGLs3GXybKUaw6wh0woFhaquUg/6oKAeLd+jTneKvLvzVxjTqEa0JGUnn X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(36860700013)(82310400026)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 14:22:32.3847 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 523a9df9-d9bf-4e87-c593-08dcc2b5dc8b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF0000000F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6914 The current implementation of the piix4 driver has a limitation in that it only supports two algorithms for the I2C adapter: - SB800 Algorithm: This is used for newer AMD chipsets. - Legacy PIIX4 Algorithm: This is used for older systems. The selection between these two algorithms is controlled by a boolean parameter in the piix4_add_adapter() function. This means that the driver can only toggle between these two options, which limits its flexibility. AMD's SMBus (System Management Bus) implementation supports additional functionalities, such as ASF (Alert Standard Format). ASF is a protocol used for system management and monitoring, which can be part of the SoC (System on Chip). To support ASF or any other future algorithms, the driver needs to be more flexible in its algorithm selection. The proposed change involves modifying the piix4_add_adapter() function to accommodate more than just two algorithm selections. Instead of using a boolean parameter to select between two algorithms, the function signature will be updated to allow for multiple algorithm options. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K --- drivers/i2c/busses/i2c-piix4.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 4e32d57ae0bf..2babe9a2291c 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c @@ -165,6 +165,11 @@ struct sb800_mmio_cfg { bool use_mmio; }; +enum piix4_algo { + SMBUS_SB800, + SMBUS_LEGACY, +}; + struct i2c_piix4_adapdata { unsigned short smba; @@ -173,6 +178,7 @@ struct i2c_piix4_adapdata { bool notify_imc; u8 port; /* Port number, shifted */ struct sb800_mmio_cfg mmio_cfg; + u8 algo_select; }; static int piix4_sb800_region_request(struct device *dev, @@ -929,7 +935,7 @@ static struct i2c_adapter *piix4_aux_adapter; static int piix4_adapter_count; static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba, - bool sb800_main, u8 port, bool notify_imc, + u8 piix4_algo, u8 port, bool notify_imc, u8 hw_port_nr, const char *name, struct i2c_adapter **padap) { @@ -945,8 +951,15 @@ static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba, adap->owner = THIS_MODULE; adap->class = I2C_CLASS_HWMON; - adap->algo = sb800_main ? &piix4_smbus_algorithm_sb800 - : &smbus_algorithm; + + switch (piix4_algo) { + case SMBUS_LEGACY: + adap->algo = &smbus_algorithm; + break; + case SMBUS_SB800: + adap->algo = &piix4_smbus_algorithm_sb800; + break; + } adapdata = kzalloc(sizeof(*adapdata), GFP_KERNEL); if (adapdata == NULL) { @@ -957,7 +970,7 @@ static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba, adapdata->mmio_cfg.use_mmio = piix4_sb800_use_mmio(dev); adapdata->smba = smba; - adapdata->sb800_main = sb800_main; + adapdata->algo_select = piix4_algo; adapdata->port = port << piix4_port_shift_sb800; adapdata->notify_imc = notify_imc; @@ -1013,7 +1026,7 @@ static int piix4_add_adapters_sb800(struct pci_dev *dev, unsigned short smba, for (port = 0; port < piix4_adapter_count; port++) { u8 hw_port_nr = port == 0 ? 0 : port + 1; - retval = piix4_add_adapter(dev, smba, true, port, notify_imc, + retval = piix4_add_adapter(dev, smba, SMBUS_SB800, port, notify_imc, hw_port_nr, piix4_main_port_names_sb800[port], &piix4_main_adapters[port]); @@ -1085,7 +1098,7 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id) return retval; /* Try to register main SMBus adapter, give up if we can't */ - retval = piix4_add_adapter(dev, retval, false, 0, false, 0, + retval = piix4_add_adapter(dev, retval, SMBUS_LEGACY, 0, false, 0, "", &piix4_main_adapters[0]); if (retval < 0) return retval; @@ -1114,7 +1127,7 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id) if (retval > 0) { /* Try to add the aux adapter if it exists, * piix4_add_adapter will clean up if this fails */ - piix4_add_adapter(dev, retval, false, 0, false, 1, + piix4_add_adapter(dev, retval, SMBUS_LEGACY, 0, false, 1, is_sb800 ? piix4_aux_port_name_sb800 : "", &piix4_aux_adapter); } From patchwork Thu Aug 22 14:21:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 821459 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2076.outbound.protection.outlook.com [40.107.96.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02F7A1EB5B for ; Thu, 22 Aug 2024 14:22:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724336561; cv=fail; b=VOQKaHPBYM85FctbYT0eV1etakf8rU0FxJL/aPCmh5YbTrCSjLBpi68Txjak6DNFWy/9WcZuXuE2dNEx/Vu6yfeyrSioPo6d459fdnhg2Z42cXZj+NHNKAJfEopBjzfDUW6zAF0zn7+Y0AvEYz2Wq3e8dE0hVs4cIWsLkexhtEM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724336561; c=relaxed/simple; bh=1/YliLRoCRTNNunsAauU7Fl9Ub8lt+lUzgR3F/my7PM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CeBwtcblEpAsrzOUS7BRdIX/A33YwKNYZqGwMl0WHlFJ6ObG1VYPj2h/7qYl4iNc4vhfn0fSVJSSPJBX9sDmJ596GgS57ODFznQMA6ODih/Ny7C+EMegumUWjl14JoM3uMYe1htDDIAf3/92cRFLO6dMTz/o7Gp029sfaktdcNo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=bhwrFWXz; arc=fail smtp.client-ip=40.107.96.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="bhwrFWXz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nlkV45NJf9ptnVBdpG8lyMztBWlBtAWwtiL6NajXVUROzL8T6eJMHEFKdrVOCmOwUptnD1nN/Fxkn4+jjBKDjoXqekr0Ya4Mut+f/FWR1KA4yL5vONFh4SzMXDSLEIKW6hQXseodjlnGskRTilwqy9DTOAhUoV5IoClju56I3LV1AYzejq+82x8nwfvZgsfes/jpEclWTLrheijPB9Prpbp0+l6PpUrS37/TWWacUHidO76YaOvCqu/WM52ODgniJoohGdAIGfocTyjzT8QxhMwE4GfNclW3fD5RM+5bk+vEQLW9ZZ9Ge8zl2lvNeongJfgXLTJbb82Xvg59YgprMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=NaEWQLs+Tu55xTO4xSketbSHUIvLZnPyJs9bg25uD+8=; b=m+n0s/Xl9/syXomt6o+xTjpEWAkyxSD+LuJfE93IIBthVHXnFHB/0H9C+KJZMMJ1X0rP3VmBexqzIsehh+zRxWpdG3QmZoFsKCaxmeG6KT2b4+0D/P4WZv5SzhDJhj//S+mSyu+zWcMKVg3hXSBYBjlFos8DHiz2VIGCKzRoymiCWgo8eQr0fU6PtEkdrI5+Fj0b7MCO45YS9QulDLnhaY1mf0F3wiWm77mypAd7B2ah11FRbaiGZiuztJRW4NqgOJlX/KFDL1jreMLs/T7wUcG3IKhdHHg6wQyWl3X8FLxZ+Z9v4mxCbN0MIWiC+SdFxmGLJQUzdGVjk6VGq6bzgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NaEWQLs+Tu55xTO4xSketbSHUIvLZnPyJs9bg25uD+8=; b=bhwrFWXz55xy4/2bSglDs2K7O9bbDlok0eyGSyS3/63eOBIANX1Vw4zSA6Z6J3Z2v95iBwvVfkTIzkvIU6YVkRnccu9pMRu7jyvfsRfyhjEBCLoQpekB7kfdqtXBggccdbcEXXAoqkSAcSGZjJ0slNcb//88mWZAQ5wetihAuzM= Received: from DM6PR06CA0056.namprd06.prod.outlook.com (2603:10b6:5:54::33) by MN2PR12MB4078.namprd12.prod.outlook.com (2603:10b6:208:1de::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.18; Thu, 22 Aug 2024 14:22:35 +0000 Received: from CH3PEPF00000010.namprd04.prod.outlook.com (2603:10b6:5:54:cafe::e3) by DM6PR06CA0056.outlook.office365.com (2603:10b6:5:54::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21 via Frontend Transport; Thu, 22 Aug 2024 14:22:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH3PEPF00000010.mail.protection.outlook.com (10.167.244.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7897.11 via Frontend Transport; Thu, 22 Aug 2024 14:22:34 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 22 Aug 2024 09:22:32 -0500 From: Shyam Sundar S K To: Jean Delvare , Andi Shyti CC: , , Shyam Sundar S K Subject: [PATCH 2/5] i2c: piix4: Add i2c_algorithm operations to support AMD ASF with SMBus Date: Thu, 22 Aug 2024 19:51:57 +0530 Message-ID: <20240822142200.686842-3-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822142200.686842-1-Shyam-sundar.S-k@amd.com> References: <20240822142200.686842-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000010:EE_|MN2PR12MB4078:EE_ X-MS-Office365-Filtering-Correlation-Id: 97324e6a-5311-4232-3cac-08dcc2b5ddce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: DiQOTAI8svQWLIK0V97mtcjNRQJ8jKiAwDSUNvz89UxI1rDdmX2oxyG4znYBtf470K63xbQMyshatWa/4Q3ojPYHeTymy/tOv5QESXU6zWm3x9SMOa33FKlVCuKS2qZvV6ioUKMrUo1x2/CQQd6vvwOgL+aIEglSdfPFvD/iYgJkmZTvGkigHvvbl24W97rnSayAcc6p1mywnG3BAn61vpedMCUKPHfD1Ep7hAO5B7b3XP6CqBlnzCKe8ufuRQcROuVDx/ZKh6EV1ht/7Iqa9bO0wI1gZTrdcyGckH+n31UWb3hKJhGRN5Pl1cC7VQXlUwgVKT6bREY30bbjJolX/7N2m5HkeAxaRfkpK8tMW26G+Jm/dirbxdi7tXssr+IIj5arhF81VoQPQcb+wUnX4YUxCrfpm/J+cIk+JA6bFIdTMxLCeq5Ie3HfKdcNYKvDfvN/VkfDx9PZwh4TxwF2h5P1i+9cfCjQBT4AlYNMru6AFFoexZnveJIoqB8thYO6kPFdFyxV2Ew+lJ+sl5GGRO/eQcxH4d6hWpwFb21YwGaCdXWLCyzK8JefjiSUVh0GUtuDxtk7gnxT9iKSgBrCD/45KHU/ZsbW/xnuhZBkLjfdqOwCojyHf0fUNPvjE1hAuX54mPn3IL5bN610QzMwqHfNXZbrSUMSVCcuZztnK++2OYcpu9v4f4Za68NF8PMJ/bslk+iJgUawCQt8G+aoYIYlw3rv758GvES8yv+GLAaB9lDXoIqS6VbofUQDlF26dE/xIoaTHrb8cxb1pMth2Gz1NGCoDWIat+ep402KYp9Qwf5Z9Vt2FlPP6dxfbos88RIWWovyNyELU7j1de/RZkSxWq91f7x8gmC9GMseAD1EDhH4GbAB/EcUnZehkysf4e9v4YKQXfKKo1FWsArqyFSFs4aOv3mdghOnIqWQNtrIfjVz40MYu3bTaqDUrt3eTCSxBqjdhwzAadEQuoklDTfNycAypp1aktTT/MVqOuIHpggYM5Bvz0CKESK5BNfZQRt+VrYZ1xx5FX22apu9mSiL220uq2DnUJMdfm9KWMJONBPn4PxP7dUbuOI0t/JcMOGn7nUjABeJFhVOcCkX46j4A8gPnmfH18Wfeuh3jm1YjbcqtNkIBBCroMWH5krcF1V5Q23d7ZZ70Vgm9ABMQ2N5z8uBJlyEb3fwfziH4gdwuCUxn1fAUOM+lGLh8DoMEajpK9Xy3VT9exa/iVu0DYRkFH0fwFc9s9hs2e/9umO7F5TaE+MsxXRokVIae5H05tn8hRqO5Pz1rM1ErBS06QsIzHPv86ZL41W9KF1U5GS+Um/EJDDmmx+57NztYdM20ieXX8RSkItpsTQMkJ75ozlv8N663RqpVgV0cbgxD7FnZ+4ofb9m8ikTLsJweSXiuWZuWhm6JkLMk7ElmROnpoptM+zNc7/L65WvWZJNo7Plr/bOdThR/F3WrBwlbyqy X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 14:22:34.5136 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97324e6a-5311-4232-3cac-08dcc2b5ddce X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF00000010.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4078 Implement the i2c_algorithm operations to enable support for AMD ASF (Alert Standard Format) with SMBus. This enhancement includes: - Adding functionality to identify and select the supported ASF functions. - Implementing mechanisms for registering and deregistering I2C slave devices. - Providing support for data transfer operations over ASF. These changes will extend the piix4 driver to accommodate the additional capabilities provided by AMD's ASF Controller. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K --- drivers/i2c/busses/i2c-piix4.c | 187 +++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 2babe9a2291c..a44b53dd4dd7 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c @@ -50,6 +50,25 @@ #define SMBSLVEVT (0xA + piix4_smba) #define SMBSLVDAT (0xC + piix4_smba) +/* SB800 ASF register bits */ +#define SB800_ASF_SLV_LISTN 0 +#define SB800_ASF_SLV_INTR 1 +#define SB800_ASF_SLV_RST 4 +#define SB800_ASF_PEC_SP 5 +#define SB800_ASF_DATA_EN 7 +#define SB800_ASF_MSTR_EN 16 +#define SB800_ASF_CLK_EN 17 + +/* SB800 ASF address offsets */ +#define ASFINDEX (7 + piix4_smba) +#define ASFLISADDR (9 + piix4_smba) +#define ASFSTA (0xA + piix4_smba) +#define ASFSLVSTA (0xD + piix4_smba) +#define ASFDATARWPTR (0x11 + piix4_smba) +#define ASFSETDATARDPTR (0x12 + piix4_smba) +#define ASFDATABNKSEL (0x13 + piix4_smba) +#define ASFSLVEN (0x15 + piix4_smba) + /* count for request_region */ #define SMBIOSIZE 9 @@ -101,6 +120,7 @@ #define SB800_PIIX4_FCH_PM_ADDR 0xFED80300 #define SB800_PIIX4_FCH_PM_SIZE 8 +#define SB800_ASF_BLOCK_MAX_BYTES 72 /* insmod parameters */ @@ -168,6 +188,7 @@ struct sb800_mmio_cfg { enum piix4_algo { SMBUS_SB800, SMBUS_LEGACY, + SMBUS_ASF, }; struct i2c_piix4_adapdata { @@ -179,6 +200,7 @@ struct i2c_piix4_adapdata { u8 port; /* Port number, shifted */ struct sb800_mmio_cfg mmio_cfg; u8 algo_select; + struct i2c_client *slave; }; static int piix4_sb800_region_request(struct device *dev, @@ -887,6 +909,168 @@ static s32 piix4_access_sb800(struct i2c_adapter *adap, u16 addr, return retval; } +static void sb800_asf_update_bits(unsigned short piix4_smba, u8 bit, unsigned long offset, bool set) +{ + unsigned long reg; + + reg = inb_p(offset); + if (set) + set_bit(bit, ®); + else + clear_bit(bit, ®); + outb_p(reg, offset); +} + +static void sb800_asf_update_bytes(struct i2c_piix4_adapdata *adap, u8 bit, bool set) +{ + unsigned long reg; + + reg = ioread32(adap->mmio_cfg.addr); + if (set) + set_bit(bit, ®); + else + clear_bit(bit, ®); + iowrite32(reg, adap->mmio_cfg.addr); +} + +static void sb800_asf_setup_slave(struct i2c_piix4_adapdata *adap) +{ + unsigned short piix4_smba = adap->smba; + + /* Reset both host and slave before setting up */ + outb_p(0, SMBHSTSTS); + outb_p(0, ASFSLVSTA); + outb_p(0, ASFSTA); + + /* Update slave address */ + sb800_asf_update_bits(piix4_smba, SB800_ASF_SLV_LISTN, ASFLISADDR, true); + /* Enable slave and set the clock */ + sb800_asf_update_bytes(adap, SB800_ASF_MSTR_EN, false); + sb800_asf_update_bytes(adap, SB800_ASF_CLK_EN, true); + /* Enable slave interrupt */ + sb800_asf_update_bits(piix4_smba, SB800_ASF_SLV_INTR, ASFSLVEN, true); + sb800_asf_update_bits(piix4_smba, SB800_ASF_SLV_RST, ASFSLVEN, false); + /* Enable PEC and PEC append */ + sb800_asf_update_bits(piix4_smba, SB800_ASF_DATA_EN, SMBHSTCNT, true); + sb800_asf_update_bits(piix4_smba, SB800_ASF_PEC_SP, SMBHSTCNT, true); +} + +static s32 sb800_asf_access(struct i2c_adapter *adap, u16 addr, u8 command, u8 *data) +{ + struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(adap); + unsigned short piix4_smba = adapdata->smba; + u8 len; + int i; + + outb_p((addr << 1), SMBHSTADD); + outb_p(command, SMBHSTCMD); + len = data[0]; + if (len == 0 || len > SB800_ASF_BLOCK_MAX_BYTES) + return -EINVAL; + + outb_p(len, SMBHSTDAT0); + inb_p(SMBHSTCNT); /* Reset SMBBLKDAT */ + for (i = 1; i <= len; i++) + outb_p(data[i], SMBBLKDAT); + + outb_p(PIIX4_BLOCK_DATA, SMBHSTCNT); + /* Enable PEC and PEC append */ + sb800_asf_update_bits(piix4_smba, SB800_ASF_DATA_EN, SMBHSTCNT, true); + sb800_asf_update_bits(piix4_smba, SB800_ASF_PEC_SP, SMBHSTCNT, true); + + return piix4_transaction(adap); +} + +static int sb800_asf_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) +{ + struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(adap); + unsigned short piix4_smba = adapdata->smba; + u8 asf_data[SB800_ASF_BLOCK_MAX_BYTES]; + struct i2c_msg *dev_msgs = msgs; + u8 prev_port; + int ret; + + if (msgs->flags & I2C_M_RD) { + dev_err(&adap->dev, "Read not supported\n"); + return -EOPNOTSUPP; + } + + /* Exclude the receive header and PEC */ + if (msgs->len > SB800_ASF_BLOCK_MAX_BYTES - 3) { + dev_err(&adap->dev, "ASF max message length exceeded\n"); + return -EOPNOTSUPP; + } + + asf_data[0] = dev_msgs->len; + memcpy(asf_data + 1, dev_msgs[0].buf, dev_msgs->len); + + ret = piix4_sb800_region_request(&adap->dev, &adapdata->mmio_cfg); + if (ret) + return ret; + + sb800_asf_update_bits(piix4_smba, SB800_ASF_SLV_RST, ASFSLVEN, true); + sb800_asf_update_bits(piix4_smba, SB800_ASF_SLV_LISTN, ASFLISADDR, false); + /* Clear ASF slave status */ + outb_p(0, ASFSLVSTA); + + /* Enable ASF SMBus master function */ + sb800_asf_update_bytes(adapdata, SB800_ASF_MSTR_EN, true); + prev_port = piix4_sb800_port_sel(adapdata->port, &adapdata->mmio_cfg); + ret = sb800_asf_access(adap, msgs->addr, msgs[0].buf[0], asf_data); + piix4_sb800_port_sel(prev_port, &adapdata->mmio_cfg); + sb800_asf_setup_slave(adapdata); + piix4_sb800_region_release(&adap->dev, &adapdata->mmio_cfg); + return ret; +} + +static int sb800_asf_reg_slave(struct i2c_client *slave) +{ + struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(slave->adapter); + unsigned short piix4_smba = adapdata->smba; + int ret; + u8 reg; + + if (adapdata->slave) + return -EBUSY; + + ret = piix4_sb800_region_request(&slave->dev, &adapdata->mmio_cfg); + if (ret) + return ret; + + reg = (slave->addr << 1) | BIT(0); + outb_p(reg, ASFLISADDR); + + sb800_asf_setup_slave(adapdata); + adapdata->slave = slave; + sb800_asf_update_bits(piix4_smba, SB800_ASF_DATA_EN, ASFDATABNKSEL, false); + piix4_sb800_region_release(&slave->dev, &adapdata->mmio_cfg); + return 0; +} + +static int sb800_asf_unreg_slave(struct i2c_client *slave) +{ + struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(slave->adapter); + unsigned short piix4_smba = adapdata->smba; + + sb800_asf_update_bits(piix4_smba, SB800_ASF_SLV_INTR, ASFSLVEN, false); + sb800_asf_update_bits(piix4_smba, SB800_ASF_SLV_RST, ASFSLVEN, true); + adapdata->slave = NULL; + return 0; +} + +static u32 sb800_asf_func(struct i2c_adapter *adapter) +{ + return I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_BYTE | + I2C_FUNC_SLAVE | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | I2C_FUNC_SMBUS_PEC; +} + +static const struct i2c_algorithm sb800_asf_smbus_algorithm = { + .master_xfer = sb800_asf_xfer, + .reg_slave = sb800_asf_reg_slave, + .unreg_slave = sb800_asf_unreg_slave, + .functionality = sb800_asf_func, +}; + static u32 piix4_func(struct i2c_adapter *adapter) { return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | @@ -959,6 +1143,9 @@ static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba, case SMBUS_SB800: adap->algo = &piix4_smbus_algorithm_sb800; break; + case SMBUS_ASF: + adap->algo = &sb800_asf_smbus_algorithm; + break; } adapdata = kzalloc(sizeof(*adapdata), GFP_KERNEL); From patchwork Thu Aug 22 14:21:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 821873 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2073.outbound.protection.outlook.com [40.107.237.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BFEB1CB333 for ; Thu, 22 Aug 2024 14:22:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724336562; cv=fail; b=KMntUkOId6eRdmuq0F5MtgMOpAdk46BRN+SgjNMTFh3c5Isdkz5V4gENcFfPqp4fpFn1ZuDVla0VUaDbL8OPQW/LRfNgXVZuS1QsOfx+1ioaR0K7fcuq95vP127Kn2/ohOdQZ6gBNM3A1Y+f1+5RFxzgPslKAbYPr+AMCKOJaCE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724336562; c=relaxed/simple; bh=01ZRAwt0Nwhhm5vHamMIVN+kxe3yx//XQI0MfxPiUt8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cimZ2f0zLFqtAtgoBsXiNTm21r20NHAKB0oEHUzj6XkAjh8TQU3120nX0PP98uMw2bVXq0hsLcQpQVZ2pCr8pvP1Fo2doOV9gRmcVWF2k2vx13jRSfWnXARzyUIbl+VS4ul/5L7Ro7qrboodtcCpMuRC7HbrrceJgg9CME4U45s= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=HOLqukRG; arc=fail smtp.client-ip=40.107.237.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="HOLqukRG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A1+AXUNp5ivTWqg1ecyRgO07Xaa8z6Rda8dPBHUC7iIjlROqRNwJxV+VAvMK+Hwy7eaRnjWXhKON1w8R7RIbt4pPOA3eGWLg0qBw/1Z+Qh38p+yPca19ii0dETBSuyKtHz5StfMV68Y1OFHnn7B0Si69aG3fepF/C5XWOzdIXK+GmILdF15mduTxNRE+2J8GX1c92kv/xI3T9GNS5w3TXebna+g88L3qzDsdSVGFmqHBLAXRiuMcUFjqYmuHuxWVBSQediA4beZaok65LtNJBZyjRikhTwzZIS6pK1pFRWaE3osQFiPRbIi49D4DKetmf/VNtjoxFd476lk4jacInw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=voiPuEUEc/hrocvnnUG1DyrvxTqCRJLFXZsFE526SAc=; b=NAoshez+bIUryaFY2Tt8Y6XH9M1/oDR6asmgpw+R384FHUADRQM95OKPMLlOQg8RO/aqfm0ElMHmOC41skVe8ruY+bncCOIFv7tzoXZFHL4MnrwFkFOM57fpnVgDabIpNyf/t5v1+nU1UEmf3XtW3NQ/HoN44aJLtHWt28qyC2rIKKn1oUiX0hEfYxv23tDsdT0lbdhCO6reNQk0IC8qSWOLnk+2ZQ2JtBwP9SWqomjh+cKkE93bfwNOl6xo8sW3X5pdRXcxgf1lH3qDubhsCqWhEj7AULNwKWI2fhVvYUjJOyzSjuiGjQR+SUOfi4ZgKjD645i6fSfsVZFLGS/Udw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=voiPuEUEc/hrocvnnUG1DyrvxTqCRJLFXZsFE526SAc=; b=HOLqukRGGu8COWnsB6eL6cwON92mmP2ER3USQA8z0GWvhwqhDwpiMDwhrcGfRmdy8FaEqRI2h15wc3VnySpdwQcZ/W7Kv7d4mtEgnxSIsJu+rTHICR6DEU07gmXLirbjYDtGPVRn8mDL/u4MSdOjJwiZR1unAL+reS1BkW58WAc= Received: from CH0PR04CA0112.namprd04.prod.outlook.com (2603:10b6:610:75::27) by PH7PR12MB6467.namprd12.prod.outlook.com (2603:10b6:510:1f5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Thu, 22 Aug 2024 14:22:36 +0000 Received: from CH3PEPF0000000B.namprd04.prod.outlook.com (2603:10b6:610:75:cafe::a8) by CH0PR04CA0112.outlook.office365.com (2603:10b6:610:75::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19 via Frontend Transport; Thu, 22 Aug 2024 14:22:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH3PEPF0000000B.mail.protection.outlook.com (10.167.244.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7897.11 via Frontend Transport; Thu, 22 Aug 2024 14:22:36 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 22 Aug 2024 09:22:34 -0500 From: Shyam Sundar S K To: Jean Delvare , Andi Shyti CC: , , Shyam Sundar S K Subject: [PATCH 3/5] i2c: piix4: Add ACPI support for ASF SMBus device Date: Thu, 22 Aug 2024 19:51:58 +0530 Message-ID: <20240822142200.686842-4-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822142200.686842-1-Shyam-sundar.S-k@amd.com> References: <20240822142200.686842-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF0000000B:EE_|PH7PR12MB6467:EE_ X-MS-Office365-Filtering-Correlation-Id: ec34f3a2-01ea-4b62-47bf-08dcc2b5df03 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: Kdaz2caY263U+fzMN/PIkiwiXDgUvZ6pjYQXiJm+vATd4lTxgY4FLMDcfj8OTuTNds0iSTqX5DoTavGSrjEX5lu3dwMP4YEF9DoddEiklQHCfwwwc+KS5kTa9/dPmPEDd7CNUTV1FiU5fDLhFd+9AHLHrX3JbYmUzNG1KoFn2ZWO/QnNqF3FaLomjuJaj+ZRZmOqQ05+iNbjvU73xuB6yj7/W8AjeniH1blVo0xfqS71U+jzi1IWJOcvSGIq7YJDFC5Cp8fT5dWbAgGW11Cjn2S11XbCN4QmdFBWCeoL95MdNrn3ChtG0oksS61Ng6z1UvLH39C+4+j5j5qUk6Gtj7YY+8Qdq/Eazl6UY34d9Vqv+3U5mmkpti5zCETA+lUvUUpNBBJN3AvMxd7sM07W2/9+MphhDo0o7ECZ5G8MsctIMOBzT4gzLPk28KfaIIzLDGhe3Y/4NaOrSHpY2PZL0zH33DPW8GBjYDYuAdNWZjCQHEZP84qp9DMaYhaYRQhPC5AE5exsbvrGX30wFCWB7RudfMe2zpzPJzTfHaCE6iwXx0YU8zGaa2uekWN95pXnMFxiaE6URANWSEgLB4lXo5TvwSpA+XOvkF5iYX7KL/A1c2Jugw77xwDCXc4FVEraAYpH9vgvzfmzY6ZVHNMCRb9iBz22AO7WNUcVPPCKwGeB/2ZpNOc5cBBDVap58RNANkKlhZlMuZyBC90myuLVxZr2Ua1472tztosr3MKhBqb92Yttecocei1AIqLrIcYnwxDv0LSMKYvMZGBvPhJb04ZGFtMhK9xF7921Vmqq/0w9ApYg5vgdg1ZVgqIkFsBUBO1wQBvP5EYaho/5smLYBwxuDmxgwet8oPPYUf/FFb2O1UWEnCfPsuL/4Wwzg43sWm0jR4AYkpOqUCuOjezk8ByopP+nKTgBrFvL28152Dp1vBwCC8MVcCtazHflhH00wl0mSWZtW2M+v8lRyjsUTCwuBT8MQVoTLY8/z6gxEEiyNYkg6Pccc6cBvT/PqyRDPjj9I6LlfOrGKcIfAAqsTWjHeiFZMeNBB874mIqp9EV7NcAGduiqb9mIvZkQ4ovEMfMFoMCGBgtHcFdp6Woct1WvAM57NRMS3Nb+hfBTQOh69Ub8ZaHWdgxgz0FKe6OSjsWnHi222DzJ42miaU0V2nvbaLkpwJulZWdBZA5MysOYM/Higkf0JOilQ4J1BirZ58M00EbIxm7kTnZJ7hIQJSsLVkFTezqWaqQTyH6FLstTsaoCFkzU0tECwCr7Z48EskajvcTRf/Zeg5v6PfBPqRz9doGGd8/63kn3QvN2iY571wc1pucc/BryivgZrupQGWAHk0cFJk8ukvx7IzDEZH/acTSRaFkj/q8xcD0RE+VS4C8pC6Z7BN/WCGUdNOpipyZf8ynMkQ2M7rGfHt/M7kFGitsIDxuOKei6bgAGwxHslWwl3sspXHnR3e5/aZMu X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(1800799024)(376014)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 14:22:36.5233 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ec34f3a2-01ea-4b62-47bf-08dcc2b5df03 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF0000000B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6467 The AMD ASF controller is presented to the operating system as an ACPI device. The piix4 driver can obtain the ASF handle through ACPI to retrieve information about the ASF controller's attributes, such as the ASF address space and interrupt number, and to handle ASF interrupts. Currently, the piix4 driver assumes that a specific port address is designated for AUX operations. However, with the introduction of ASF, the same port address may also be used by the ASF controller. Therefore, a check needs to be added to ensure that if ASF is advertised and enabled in ACPI, the AUX port is not set up. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K --- drivers/i2c/busses/i2c-piix4.c | 161 ++++++++++++++++++++++++++++++++- 1 file changed, 160 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index a44b53dd4dd7..00fc641e6277 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c @@ -121,6 +121,8 @@ #define SB800_PIIX4_FCH_PM_ADDR 0xFED80300 #define SB800_PIIX4_FCH_PM_SIZE 8 #define SB800_ASF_BLOCK_MAX_BYTES 72 +#define SB800_ASF_ERROR_STATUS 0xE +#define SB800_ASF_ACPI_PATH "\\_SB.ASFC" /* insmod parameters */ @@ -185,6 +187,11 @@ struct sb800_mmio_cfg { bool use_mmio; }; +struct sb800_asf_data { + unsigned short addr; + int irq; +}; + enum piix4_algo { SMBUS_SB800, SMBUS_LEGACY, @@ -201,6 +208,8 @@ struct i2c_piix4_adapdata { struct sb800_mmio_cfg mmio_cfg; u8 algo_select; struct i2c_client *slave; + bool is_asf; + struct delayed_work work_buf; }; static int piix4_sb800_region_request(struct device *dev, @@ -909,6 +918,66 @@ static s32 piix4_access_sb800(struct i2c_adapter *adap, u16 addr, return retval; } +static void sb800_asf_process_slave(struct work_struct *work) +{ + struct i2c_piix4_adapdata *adapdata = container_of(work, struct i2c_piix4_adapdata, + work_buf.work); + unsigned short piix4_smba = adapdata->smba; + u8 data[SB800_ASF_BLOCK_MAX_BYTES]; + u8 bank, reg, cmd; + u8 len, val = 0; + int i; + + /* Read slave status register */ + reg = inb_p(ASFSLVSTA); + + /* Check if no error bits are set in slave status register */ + if (!(reg & SB800_ASF_ERROR_STATUS)) { + /* Read data bank */ + reg = inb_p(ASFDATABNKSEL); + bank = (reg & BIT(3)) >> 3; + + /* Set read data bank */ + if (bank) { + reg = reg | BIT(4); + reg = reg & (~BIT(3)); + } else { + reg = reg & (~BIT(4)); + reg = reg & (~BIT(2)); + } + + /* Read command register */ + outb_p(reg, ASFDATABNKSEL); + cmd = inb_p(ASFINDEX); + len = inb_p(ASFDATARWPTR); + for (i = 0; i < len; i++) + data[i] = inb_p(ASFINDEX); + + /* Clear data bank status */ + if (bank) { + reg = reg | BIT(3); + outb_p(reg, ASFDATABNKSEL); + } else { + reg = reg | BIT(2); + outb_p(reg, ASFDATABNKSEL); + } + } else { + /* Set bank as full */ + reg = reg | (BIT(3) | BIT(2)); + outb_p(reg, ASFDATABNKSEL); + } + + outb_p(0, ASFSETDATARDPTR); + if (!(cmd & BIT(0))) { + i2c_slave_event(adapdata->slave, I2C_SLAVE_WRITE_REQUESTED, &val); + for (i = 0; i < len; i++) { + val = data[i]; + i2c_slave_event(adapdata->slave, I2C_SLAVE_WRITE_RECEIVED, &val); + } + i2c_slave_event(adapdata->slave, I2C_SLAVE_STOP, &val); + } +} + static void sb800_asf_update_bits(unsigned short piix4_smba, u8 bit, unsigned long offset, bool set) { unsigned long reg; @@ -1195,6 +1264,86 @@ static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba, return 0; } +static irqreturn_t sb800_asf_irq_handler(int irq, void *ptr) +{ + struct i2c_piix4_adapdata *adapdata = (struct i2c_piix4_adapdata *)ptr; + unsigned short piix4_smba = adapdata->smba; + u8 slave_int = inb_p(ASFSTA); + + if ((slave_int & BIT(6))) { + /* Slave Interrupt */ + outb_p(slave_int | BIT(6), ASFSTA); + schedule_delayed_work(&adapdata->work_buf, HZ); + } else { + /* Master Interrupt */ + sb800_asf_update_bits(piix4_smba, SB800_ASF_SLV_INTR, SMBHSTSTS, true); + } + + return IRQ_HANDLED; +} + +static acpi_status sb800_asf_acpi_resource_cb(struct acpi_resource *resource, void *context) +{ + struct sb800_asf_data *data = context; + + switch (resource->type) { + case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: + data->irq = resource->data.extended_irq.interrupts[0]; + break; + case ACPI_RESOURCE_TYPE_IO: + data->addr = resource->data.io.minimum; + break; + } + + return AE_OK; +} + +static int sb800_asf_add_adap(struct pci_dev *dev) +{ + struct i2c_piix4_adapdata *adapdata; + struct sb800_asf_data *data; + acpi_status status; + acpi_handle handle; + int ret; + + status = acpi_get_handle(NULL, SB800_ASF_ACPI_PATH, &handle); + if (ACPI_FAILURE(status)) + return -ENODEV; + + data = devm_kzalloc(&dev->dev, sizeof(struct sb800_asf_data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + status = acpi_walk_resources(handle, METHOD_NAME__CRS, sb800_asf_acpi_resource_cb, data); + if (ACPI_FAILURE(status)) + return -EINVAL; + + if (!data->addr) + return -EINVAL; + + ret = piix4_add_adapter(dev, data->addr, SMBUS_ASF, piix4_adapter_count, false, 0, + piix4_main_port_names_sb800[piix4_adapter_count], + &piix4_main_adapters[piix4_adapter_count]); + if (ret) { + dev_err(&dev->dev, "Failed to add ASF adapter: %d\n", ret); + return -ENODEV; + } + + adapdata = i2c_get_adapdata(piix4_main_adapters[piix4_adapter_count]); + ret = devm_request_irq(&dev->dev, data->irq, sb800_asf_irq_handler, IRQF_SHARED, + "sb800_smbus_asf", adapdata); + if (ret) { + dev_err(&dev->dev, "Unable to request irq: %d for use\n", data->irq); + return ret; + } + + INIT_DELAYED_WORK(&adapdata->work_buf, sb800_asf_process_slave); + adapdata->is_asf = true; + /* Increment the adapter count by 1 as ASF is added to the list */ + piix4_adapter_count += 1; + return 1; +} + static int piix4_add_adapters_sb800(struct pci_dev *dev, unsigned short smba, bool notify_imc) { @@ -1243,6 +1392,7 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id) { int retval; bool is_sb800 = false; + bool is_asf = false; if ((dev->vendor == PCI_VENDOR_ID_ATI && dev->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS && @@ -1279,6 +1429,10 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id) retval = piix4_add_adapters_sb800(dev, retval, notify_imc); if (retval < 0) return retval; + + /* Check if ASF is enabled in SB800 */ + if (sb800_asf_add_adap(dev)) + is_asf = true; } else { retval = piix4_setup(dev, id); if (retval < 0) @@ -1308,7 +1462,9 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id) if (dev->vendor == PCI_VENDOR_ID_AMD && (dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS || dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS)) { - retval = piix4_setup_sb800(dev, id, 1); + /* Do not setup AUX port if ASF is enabled */ + if (!is_asf) + retval = piix4_setup_sb800(dev, id, 1); } if (retval > 0) { @@ -1326,6 +1482,9 @@ static void piix4_adap_remove(struct i2c_adapter *adap) { struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(adap); + if (adapdata->is_asf) + cancel_delayed_work_sync(&adapdata->work_buf); + if (adapdata->smba) { i2c_del_adapter(adap); if (adapdata->port == (0 << piix4_port_shift_sb800)) From patchwork Thu Aug 22 14:21:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 821872 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2069.outbound.protection.outlook.com [40.107.237.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF7F81CBE89 for ; Thu, 22 Aug 2024 14:22:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724336565; cv=fail; b=FpQaq/w8J7LVNcCE2/HRWdTjd1X4XgTNlrqLYDW6HnWvjCY/UglvC80g8ADKHnh7wQXw4hS2bouJEiuXT8JbuGt4xMakJOqtzBOp8yquTqRoh2FsRtPDfNtbvVVqHX5rM6OlmutPMTO5rHiUcbVPm7IqpcN6Wgwfw0u8ObPxARs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724336565; c=relaxed/simple; bh=HfOSyF/GbrssYSa6+x4Gpb8Y4OKwxyARgj8Yc1uFhAI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UHRMFY57D2aWjpHWe1qHK4euUz+P1AMUJuYud2x9xfjOpboP4SDTdsZulMOqNmcl1XOKsYTKj0NDLLL+bc76eVa0daRLSljA8mbmIiIygZ8kzZ0eSdXseOXGRhj1fx0W061bHebbUT0IjEM0tJgRr4kNwZPUPJHwL1E0Bf3yHzU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=OmSEllsS; arc=fail smtp.client-ip=40.107.237.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="OmSEllsS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PGiv4XNUvbDCYCdo/e9tWrpf8HCRtNJUpXP5u6EoBhiu6l1iMRf6jxb2PNSAfvii8qttUuy9Vf+f8AvkYlXBH3ppkVO7ffiuJOSBSNRijFznIT/xTYYJtsu7tNqMJ8FZfK0kl5FgVnq611m3jUdTmAo6w5z7uX4IcuNXunVPPIZYR53hysndS+3HXyHdmaKehWI7QGjGcpQ+9EsTzAf4Ruc2oRiBEpOPfYCCvCr2BB1AGQymhjJL6RsrshYPleKr+BxNrxF5mBUYy3LDFY2fRGuT9AiRJJF5W/3b8bf7ycSl7PdHq8m3tqV4kWfrntF1iDyVwxOnDh2K8yfi87zDDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=AY2XjaGb1r3S4fNB8tull9MnpxrC052jUv/jK0Euf7A=; b=mz8wzMokX9lYT/mxwAILHJdAzM6jDTWQbmZ3pWHxxHCDlOJK+Hx74SQBaYl3LwLwg8A2e4dKtLOu4HjoqOuP12Ot5zk2sfm1vCv10lbSh2Yn0H1iFZ+BU1LtS/AYc1sH+GA+axXtxghqGkEOVfeU7BhOr3MUUQ4GjeU3n8Z0NulIBxwdwINapRxvQ1pg5C8J4PVpCl7FxxrmAUiKl7xIhMPW/WwElQYFI7fn9fppTEEJbZXZpbdGU/PSDIhSEH2a8ZOlhtt3uxcfgw9+dY+l8o996djj299Rq2+h+26OS96LNnrGdh4DisxP/KogW7Oa3vK+NufVzr3dmsUPz8AN1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AY2XjaGb1r3S4fNB8tull9MnpxrC052jUv/jK0Euf7A=; b=OmSEllsSxQtIltiPoud2/n3Uvr6rJbsMz01XSbFOO/ex4eeW/aj0gbMy3ITvYLEX3wpMj6mdmvRx309A6maYjTxn8xLYSDRySIyon0SI8qxVu6mfacSHW8dVbjAgCDGORWmfeoIhhCK8vVIqn45uZXWCgE/X0WyUsizRImZw9sA= Received: from CH2PR04CA0003.namprd04.prod.outlook.com (2603:10b6:610:52::13) by LV2PR12MB5894.namprd12.prod.outlook.com (2603:10b6:408:174::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Thu, 22 Aug 2024 14:22:38 +0000 Received: from CH3PEPF0000000D.namprd04.prod.outlook.com (2603:10b6:610:52:cafe::c) by CH2PR04CA0003.outlook.office365.com (2603:10b6:610:52::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19 via Frontend Transport; Thu, 22 Aug 2024 14:22:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH3PEPF0000000D.mail.protection.outlook.com (10.167.244.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7897.11 via Frontend Transport; Thu, 22 Aug 2024 14:22:38 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 22 Aug 2024 09:22:36 -0500 From: Shyam Sundar S K To: Jean Delvare , Andi Shyti CC: , , Shyam Sundar S K Subject: [PATCH 4/5] i2c: piix4: Adjust the SMBus debug message Date: Thu, 22 Aug 2024 19:51:59 +0530 Message-ID: <20240822142200.686842-5-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822142200.686842-1-Shyam-sundar.S-k@amd.com> References: <20240822142200.686842-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF0000000D:EE_|LV2PR12MB5894:EE_ X-MS-Office365-Filtering-Correlation-Id: 766bf9d8-86d3-4ec8-597d-08dcc2b5e02f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: xm/tApPH+nfNg5l/h0nzVoN1wqKel/sNF+XihR63kLOfeYtbCmCftz/CMroE4WLtMsqplFZ2N5DyGoqecn16lD0BG8xLFA2LsaJ6O6KeDc3GmMbgt3oc+Q3sgknn2Vuig9nCWBl6Bbtr9fwVg9Ln4+Z3TYiVjc4i+IpYNubEOoo5zCXwY+s+bgkAXLV1dJ3nqk54nHgWTxwWaz4bDMmGQ4WHK3ONN9nESEmTiam6Zd0wfvrI5r73Wohgv7zFKVdmj4QPm/LxqTzAhLaaSkjsLN3o4bjUQAYeLBYNBT+FXKik/UoTI8enbmV8kdvn9RANh8WoWTZYOCQJX3FsMdFbl8H6Tg+sW91QqtKfa46VHWkK/hKuQ2OIBsQCKGPK5r/vB5RlPUgMshtESXIIYaGZKTcjhTs+PXJDnrJ/WAW24zw24JS9OstHWyeZZrR+EqiioIQemtAu2cL40Q4nFouMZBldjDyXCUwV3yz4PMZhqShoxP2sQdPP2wMdPOTRfzr4suHlDAERqxImTfX0UngK5uWffMDj4yVLecFzvqTGYpxblFDhGVBqlJ5h6qjOJNX+u8fOZ3DL0ZmBHdz3csmoJrJ8FkBIkeLHJ4p1F+glwOWnOlbrTeFPT27g4p6Kr2HPuCnbgkUM4KWbk8BT6pgxRa4aElS6jgz7JcejVtOZwTwRhRW1MGkaEPaYdEBhp9DrvfrO/xezw6RJtwV3OkpIJvQ0FYQApNzd0UkKPXq77QJxGZG7+zu8PhmEmBLGBvo3/9FMfOEUn4FQXH/W6qVK65r2SX1NlouXu7M7yYHtTvXurGqdZh8VzsM8ZGI7zdYfvg9LLTiFlvDBE0/TFSSGbsRMXoySOy2WgJDvHLcG/NV16QywadnNTOVvlJmu/YT4XVZkp9CGKfChbp/rIsNB8TUEiv0Q68ow4D77gPQ0WQu86Hy2ry4iu4YH0bbbBin7gQPwQxBUcDZTkRmlNEUmpJeVyVK79C9oRtKweBH8OOd11tF7JcRK5oUARGNZVYx2ImNM/2pSxfBHyIlAc1qq7wNJz8q4H2h67ODh+x/3GtW9EZEXfW6DTVHt29/3mnIHj+HuXhh9YWRBWxfxHU7aWgQeaP/eRgLlXgQ05YnfnNYrWqXRq07s40vPgyR1Da27XC21YmPQytVz7YvEoqRO38EOdELAXw2/OQZ93czza2DU93CxIGtEGQrFJBxBnZAuyAsC4iDQlFaxiJRmf9Khd9mo/26QxQzxOBxkCcJ6HRrQ0Y+Uf37riQdYQu8lVGKC54RKTyvFIv4WJDo0zUdvl7x4UMnRvqzfDVQrIqO5kXltn2m2LEmq72LKoUHCJh5LhFk0cqOLKvtPg4xoiGld5suFumK5FScnNWRC1NPyped+yLMifnv7FRsn62pmo9p4VBD/sHeRE7R9WbHiwLoGhQxZiV0Elp9aSRgDcw08xRyeDsEBJNF502J6suNCHJDC X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 14:22:38.5055 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 766bf9d8-86d3-4ec8-597d-08dcc2b5e02f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF0000000D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5894 With the addition of ASF, the current adapter information must now correctly print the SMBus node details, whether it pertains to PIIX4 or ASF. Update the driver to reflect this change accordingly. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K --- drivers/i2c/busses/i2c-piix4.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 00fc641e6277..446e9235f900 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c @@ -1194,6 +1194,7 @@ static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba, { struct i2c_adapter *adap; struct i2c_piix4_adapdata *adapdata; + char *node = "PIIX4"; int retval; adap = kzalloc(sizeof(*adap), GFP_KERNEL); @@ -1213,6 +1214,7 @@ static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba, adap->algo = &piix4_smbus_algorithm_sb800; break; case SMBUS_ASF: + node = "ASF"; adap->algo = &sb800_asf_smbus_algorithm; break; } @@ -1240,7 +1242,7 @@ static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba, } snprintf(adap->name, sizeof(adap->name), - "SMBus PIIX4 adapter%s at %04x", name, smba); + "SMBus %s adapter%s at %04x", node, name, smba); i2c_set_adapdata(adap, adapdata); From patchwork Thu Aug 22 14:22:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 821457 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2070.outbound.protection.outlook.com [40.107.92.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E39A1C9EC6 for ; Thu, 22 Aug 2024 14:22:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724336568; cv=fail; b=ub+8HlTo7tWdXRjomQrkuppC/HvN5Rjo/YmjHBDvcuTm+oZ+JU9nd32JMiQAfqKaKid4lPBRdkYZ5+/5QpQR0zmznWM6+yzjfptLRfRkXBJ3BE32Pr/ByPAut8zJPRNle16xyG/RCX7vBfcHUU1qotuxMP9NVo04fWgLjLRrY24= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724336568; c=relaxed/simple; bh=LB6ZTWnMoBRqjNCzWqczA7hgGGKuoS4EalCtC4k5vUo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=l3MWHk4IPRr7Z+HwAkW6dSIVwCQ3KUUWHa4UZdevp1hamKIxS9w+YsgSxkywiZtL9J1tFM3wFB5OF61QmFnGqnRpSGBzv7Qj6yMZxxCiiHG39rkQugcdxZAAc40CbYIZArAxtTPaKaktVgNxcIysEz0S01AzATIRBIaasDyGTkQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=3Rqoe2fC; arc=fail smtp.client-ip=40.107.92.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="3Rqoe2fC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VsnuTt7UUDJYX/69w2haqvheXu+rjxsKfhYSYKcvhWMmrt7P/7VkPDpdFnUoOEOmlrxlFIc27vR/tW8m+mSd78WBsBoqCKR1KrqY2O1NHCUC7oW2jr5JPQkvCdvJkj0ORg7h4TtO9jxdBiq/G5N3Z6IuRmjMpi638GBepuLaFc7s3guFMdRtt1PY0Y6yxakDVwyrkZpS9+yGDz4leaLiGLaZMZGmKP5Jt7dQM9pFKsyzCeCLxWaSGb7gxVT6aI5BnWL7cOXIXE83jiF1l3nG+vueix/dVFMDKjo/5n7SAT4aJAOVzN3/m/suck2X2ltq/lZmSZk5bTDvq7THsnqKvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=uP55U3mWHViC9CzWxWkpj3ZPj+VTl22MLS3g5vIfmuI=; b=Z3PFgLeka4atxJVLmwpPCpl+QFLXaShcAeKvRWwVi0Y0jJLF/+45MsEgWYKXPkRc7v7gyKhZxgXeVG35fBj3zFAYlZt0wLRiWQm3beAWxebU1FeS3G12pRDHpdl1RZTMUYsHHP78uvnE64XVMoya0Wu51zA80O4PlKjTN1ipy8xfC3MhKpOBNl4H0xizWNDNgwH6GxPqJmi4yW/oC1rlYQaPAnkpxO2zCDW9GCDOAzAgbKHfzlCOZhk145SDdB7JjddhXppGnB5NR/35RJTgYFwDZNLgNSsHHhRDVH/83ON9NADQXPdaM/mkG0PHx3D6NLc9NYFhDYl/dWg9ejiMbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uP55U3mWHViC9CzWxWkpj3ZPj+VTl22MLS3g5vIfmuI=; b=3Rqoe2fChtpse+igumRtrlfZQBt9s88BymzL/nRsFYOGnrQCnbiqpkpO1g0xEdPt5xinqzIICDhqSclrlCiKoDG4KZFd0C+sQPE7KNZyO9OEFIPU6bpSk424+tsMep9lfVtWeAYw6tIQwjFEdba/QJ5RafULCGWlic2M4d6kjgg= Received: from DM6PR06CA0059.namprd06.prod.outlook.com (2603:10b6:5:54::36) by MW3PR12MB4443.namprd12.prod.outlook.com (2603:10b6:303:2d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.17; Thu, 22 Aug 2024 14:22:40 +0000 Received: from CH3PEPF00000010.namprd04.prod.outlook.com (2603:10b6:5:54:cafe::5e) by DM6PR06CA0059.outlook.office365.com (2603:10b6:5:54::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.22 via Frontend Transport; Thu, 22 Aug 2024 14:22:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH3PEPF00000010.mail.protection.outlook.com (10.167.244.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7897.11 via Frontend Transport; Thu, 22 Aug 2024 14:22:40 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 22 Aug 2024 09:22:38 -0500 From: Shyam Sundar S K To: Jean Delvare , Andi Shyti CC: , , Shyam Sundar S K Subject: [PATCH 5/5] i2c: piix4: Clear remote IRR bit to get successive interrupt Date: Thu, 22 Aug 2024 19:52:00 +0530 Message-ID: <20240822142200.686842-6-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822142200.686842-1-Shyam-sundar.S-k@amd.com> References: <20240822142200.686842-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000010:EE_|MW3PR12MB4443:EE_ X-MS-Office365-Filtering-Correlation-Id: c36add2c-f934-4162-e85f-08dcc2b5e168 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: ycke6DBpj3adjMALiCGJAQgsE8/sF+zY55/nIt1EhZrZnleEM4uaiY/BcfF7CKYmkc6todIzRlmEhlaqja/N71Hh2W5t6k3t72woqCrEPPweBvHI6Y1Tnma67noLdBqcgNkjlP4aKsfUxidnkYnt8WpT75S+UoktytSPXvSDdT9qBHpRWLZ+2lgaYQyh7p7LKLhDC1xa97OJMLCVk2aidTPynu0rtc9X3IE6LiYogcIFMVp9Z8/VsZhFv7DGg5Md49akotf3EwF/iR8UaQlltqucRz484uPh9eG+exyLis4H8iTa9EtN+NL/JKOwz0fjTGtLesZ8NPvPUA8FAvQgg8FQfN8spf5BEh9EKr/yzLGLMwCynMAFESnFf3CkDa2Ey+9+u8RehQ7An57WV8MO2z2lTYY93Xqm/K6T/KySehxRP1vNkdamLHPkTpo1Pb7LlPyu6hnUwnoULGD/nfof5v9BtYEKX2ZMaShx9sKd8ZmNgqRc9zZMDgvNy/JEuFToFhJNClGSoHTwkR5w4d1bMHejugXWg6rhyYabt2txdOzX22cZqk/sU85/+vrwU3akKwn1eDwuTLL6TFH/gc+hu3BUsxFNOa+MMG4aBr+kZ2ubCjg5jk7ZjSaKNXYDWPt7Hy1bZVWXaq9l4FCb0uhhJRcMhkY52v4jJdvmvJdS8UuoXku4uBsBsMKqPIbOsUwkRFx1p4vpOHBV2aTRg0HeY9tnSVPQ8U4JlgtiafMqLq6NWuxTJoULtfJohDucfFl+9BlhFsyQqySE2UPTgl3t4S6ZB6azoZ9pZhqH9rA3xphAcgKcaAiMfWiFYDodN8aiuhfaPrhsP6m5qYon4dsKZA+8KpOIullYXyUXGI1DySOoZQ3i1kZ3vCN6AJWOO1lMV39i84ez275GubusmBW0/oGCEROOAulumTZ+GpctPEkmo9GlzKlaiH7D2T2jwejhCkmaEVZ9jAOt6yxpysoM6rXpnM43soIau7fYpkhe087iAp1qatjD4Tba/DUSLGVbZu8ZBA1DddvKJ1c7Jt26pL9/ZlK3SKtVnGYl7vYfQyTeZSG1K+1s1Pg/1D3I+sbp53XxjPXSUfVNik8OSn85vFMqIp80mTaa6UMUyIfKFFnB6A801p3kmAgXrOWDUXR/3iyJ/yAslIrhn0Cd0be++t72IHakZMVdlaawgR4ifulzgoWleYiR4OdT2K2V7vhWwcsIW1vbuW3gjxdhaCtAD/Xp5Z7no8cxFt57QMCFUE8zyS1kEFfZ7HMl2C5FqjPx5zv7JN/WfOzzwvxgkfxuyALvLfmrYX4PvPTyHL4rgR0bQBNkB+iMtRAeCK7AB3Bg0ycE/9SMI4NFA8DWvai3ycfTgmytN2PTTycFULxwhaPiCuC+Xgq3Erp8JTW8D2MgRQr57gt6jFTZJpEzFL+ZXqKb5dHeS9onk9PrQN48B8kIQ6XoAYTP6Db2s4jF4GJL X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(36860700013)(82310400026)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 14:22:40.5448 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c36add2c-f934-4162-e85f-08dcc2b5e168 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF00000010.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4443 To ensure successive interrupts upon packet reception, it is necessary to clear the remote IRR bit by writing the interrupt number to the EOI register. The base address for this operation is provided by the BIOS and retrieved by the driver by traversing the ASF object's namespace. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K --- drivers/i2c/busses/i2c-piix4.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 446e9235f900..146c0f31e26b 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c @@ -188,6 +188,8 @@ struct sb800_mmio_cfg { }; struct sb800_asf_data { + resource_size_t eoi_addr; + resource_size_t eoi_sz; unsigned short addr; int irq; }; @@ -199,6 +201,7 @@ enum piix4_algo { }; struct i2c_piix4_adapdata { + void __iomem *eoi_base; unsigned short smba; /* SB800 */ @@ -1281,6 +1284,7 @@ static irqreturn_t sb800_asf_irq_handler(int irq, void *ptr) sb800_asf_update_bits(piix4_smba, SB800_ASF_SLV_INTR, SMBHSTSTS, true); } + iowrite32(irq, adapdata->eoi_base); return IRQ_HANDLED; } @@ -1295,6 +1299,10 @@ static acpi_status sb800_asf_acpi_resource_cb(struct acpi_resource *resource, vo case ACPI_RESOURCE_TYPE_IO: data->addr = resource->data.io.minimum; break; + case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: + data->eoi_addr = resource->data.fixed_memory32.address; + data->eoi_sz = resource->data.fixed_memory32.address_length; + break; } return AE_OK; @@ -1340,6 +1348,9 @@ static int sb800_asf_add_adap(struct pci_dev *dev) } INIT_DELAYED_WORK(&adapdata->work_buf, sb800_asf_process_slave); + adapdata->eoi_base = devm_ioremap(&dev->dev, data->eoi_addr, data->eoi_sz); + if (!adapdata->eoi_base) + return -ENOMEM; adapdata->is_asf = true; /* Increment the adapter count by 1 as ASF is added to the list */ piix4_adapter_count += 1;