From patchwork Fri Sep 13 12:11:03 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: 1985174 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=C/m0ApDj; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:40f1:3f00::1; helo=sy.mirrors.kernel.org; envelope-from=linux-i2c+bounces-6709-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [IPv6:2604:1380:40f1:3f00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X4tTg3gtRz1y1y for ; Fri, 13 Sep 2024 22:12:07 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 64B19B25535 for ; Fri, 13 Sep 2024 12:12:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D2091D9336; Fri, 13 Sep 2024 12:11:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="C/m0ApDj" X-Original-To: linux-i2c@vger.kernel.org Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2082.outbound.protection.outlook.com [40.107.220.82]) (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 AFC461C175F for ; Fri, 13 Sep 2024 12:11:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229514; cv=fail; b=nGkBQJrm7SK7idHAH6wdelU5QG7fWZSMzPG22ZBG5kbH7vkdnESO+N1L7y6iROU0REpsDHY1+BvBhz6cRNsEoKYuhirawkfhvVGkSr4NlYNX0/sRo3i8tdz7yQ5xyg/SdrfW5OaGVq8CIIm36mOLHhALDbPxRFgAzxP6Nh9ceoc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229514; c=relaxed/simple; bh=+j32HPHXm4u/A/zLh4xfOQyexC3b5t8F8Li1t8pWwbc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LtIx4Mek9lWoZ/ft7ICXYChNoF9ssluyFckaEpXvY8fz5lsMMFkL6q8lJzDVc7AyTZYaR1PKphHCn1oMqWxaotVhZXRUAAZaqdIorSRJd7yMq2Gs8vj4+cnnHuXiosYLqe9gupVAnTDoWbQp4V+81KiITOkwye7NKVdYooUytfA= 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=C/m0ApDj; arc=fail smtp.client-ip=40.107.220.82 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nHnFpmURAaMMdobxMGj0Moz7gj/hNT0x2oY/F0RbXtzPHB9obfioKnBcINGafcHin0rK6DtQwFKFpOMfDHuuYP7KlWSRvEZn77MPQjKTrwt10nSrjWrfYbh41SY6F9FR2yGvQScViPRrGLbrFYuxPYR4BTDJNZJXevGpKr+C3vCqbCGCoUxusNgUX7gaZ+6K3D4zKQDTdC+M9fJPrcA0xXSFJGKoFGBTWekG/0v/fPciOk2cH4R7pxPpXLl3IwYoGWZ++nfhSXl4ptSrjCMmN3Gc/8yffc4+8xuobqo5uwWP2xYlOi2IF/rlzq8xhQmM+45qd2UNFTdVQSs58BtG6Q== 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=itvN20R4OIRzIJrt50Bims62xjAbWdCQHMfg222Ablo=; b=Ur5Y0xNdWVf5DSY0CIP/cXx6nn7Y+Jgnvq1w19nuAOiAhQcwhEC+jJcepaF2gnU2NjhS7PKg/c9fHlOZQhVeSi5dqQaQ/ezaL+9wIlHtXEB1td0UX/toXyE2eOTcLV5jK+8ZMaDe7fE9QVkzEqJz4VahONOOP528z6IX1J9joZDSqeRh9LRL3CKuzoxN6i6NIJhL6tGaQoxNVI+h7NOTjEb0sFli3F2G/0QDLgfFTZ5BC0FlZUPLA9iVp6JSrC/oaGCUfl63RtrkubvFdehlmImlzrWVT8OlPFLNSBZAQKA535Gw80anz7ovesmYU7P/S6U5cHmMvdYPcAOIzkCj4w== 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=itvN20R4OIRzIJrt50Bims62xjAbWdCQHMfg222Ablo=; b=C/m0ApDj1ta0J9olewrDc3Ce01k+NtG7SFpFkU2jYnEODthNZPEX1XmOgksMlUQwnqNrZV6idrkb7fmGGlhInW31/E6vSelbNeWcTsQTs/Idr12RfkYT8pN2qKTXqm/LV4UDP990kEBOOaXp0NzZunVcSbu1hv2ipknsskV6yJc= Received: from CH0PR03CA0254.namprd03.prod.outlook.com (2603:10b6:610:e5::19) by SJ2PR12MB9006.namprd12.prod.outlook.com (2603:10b6:a03:540::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.20; Fri, 13 Sep 2024 12:11:49 +0000 Received: from CH1PEPF0000A34C.namprd04.prod.outlook.com (2603:10b6:610:e5:cafe::d8) by CH0PR03CA0254.outlook.office365.com (2603:10b6:610:e5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24 via Frontend Transport; Fri, 13 Sep 2024 12:11:49 +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 CH1PEPF0000A34C.mail.protection.outlook.com (10.167.244.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Fri, 13 Sep 2024 12:11:49 +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; Fri, 13 Sep 2024 07:11:46 -0500 From: Shyam Sundar S K To: Jean Delvare , Andi Shyti CC: , , Andy Shevchenko , , Shyam Sundar S K Subject: [PATCH v5 1/8] i2c: piix4: Change the parameter list of piix4_transaction function Date: Fri, 13 Sep 2024 17:41:03 +0530 Message-ID: <20240913121110.1611340-2-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240913121110.1611340-1-Shyam-sundar.S-k@amd.com> References: <20240913121110.1611340-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000A34C:EE_|SJ2PR12MB9006:EE_ X-MS-Office365-Filtering-Correlation-Id: d33c1448-ed5f-4dd1-9326-08dcd3ed3ec0 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: skApciLW4xRMh3KLBW/NYRdSg8uQexQg+zBRwRDB8mjSZzAf4AWYt4uNRjHmTapku3XKMeBvsTyAS/ESnzKeKJPl7hLx41DB4BbHrCZVyQH4ukK3H/8xFA0N9sgJfpfzDigFH/Q13s9P03APQi81brJaEr95ELl5nIFRwogJzeFqnFaMQzultM5kl0qq3VpPYty+/sB+vbZDhiwkrPKNS8ARb7lz8tJW2zUphUYeFTZszmFm7HjtLvrFIVZyRzX7RIV5oZYT49HPZi3xMQwdRkdja6QP8mmCQ3BiN4zePFbKxAY/kXEHQ4WMpFTjQFxLXaj+25tfwhnoSXGTKGklXMRrvU7Wy7/ZzQgGwrl7g2s2x3EtFG9+6hrHtzxjGvUuwIv+3L2deu55QuqJf3D8Y1XJcR21Ej06ROtuhYZFhJFWQjB+II+ROfI/TVMBqCKsq5+bgSdCKo+mXnkDL/KM8aoxjR47/VZBCs31kqwApTXsLXm8/veNpmDRxQenh/5EbWmGQeNS55aWLFEZyU2aECIDEXb9u5wNLqr7wg1E1ZR7UloFiCPDlWNpxN/1FBVy4FqAbXzJsQjhpKW/QNl1g4k4p7BgUb12QU51M+72izinbdKIimuBHNK2ZEsI1GJlDuPE00TlWHrBzEwlwvRg4LAHvsAhMFj7v/Ysay+sfYk7RHTVNhiSLKwyyVFQrS+dKV8FDrRVjLCPZbSQO4hUZyRkHPQAzVBGIKUsu8Wn9n9aXJGpyTOC3kyWJs0SneHsArsB3xwkSwivxm9AL5wGR105tdcPuZk9++MKHhv4Ww/f/aLj1uK4TnxVaXyK5LlGW53PD7ULXc81Toqat2cHTo0DSlRgm6oOp/QB2WM8yb4aB6erQJ3DyIDtPvXJDxzRfO2qFo6xdz7+vE0Vtyz8jHfsy+7FYJQJ1POLk4OACHXRyjmm9xMb/K3DPV3NkAAnalZrSwl1Q2InXBz/vekQUXnb9R/XtLNizwgKTwYRqZpxVS/qQp1gfJKdeIrh0CH8aAZc5TbniID0sYOp2xAJ1XWvnaWfjrGGrFr1Yj4NEFOE4YRNJUPsIoRAC9he0YCRbpZFwkqx2ok+Ef5+0csKUilX2qVl0tjzcAjCOfOrwpzL2h/kp7B4irb8loh7/9Ia4eYlpllYtPQxBxu4tRhMw5wH8UEFaYjxd6+wpSOuoCFUSLYcuKXFVB2aHr8cEbFIXuIw9R7KdQ1Myqs7XDJDWeJSkUNddNgoXCO+Ha+LzfAL0e4tvdaalxyQ9E8x9Bi2ZU1PJiBgfjpf8WYvy9+HSr8KfPhRO8SOuIweeG0pRT81D+COik9JIRTGoBAlzdKIHzQEp0UDoTkOzFxu6w9zsXovU/dv/jxZTkbYK+YVNX+KgT2LF1XZHV4ai+OCbBKE82uK1e3//Rpr0pxTYU+KsQe+049mo26J4c+v+qTkqiRuzy3QIILrG5Qhv3we0+NY 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: 13 Sep 2024 12:11:49.2348 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d33c1448-ed5f-4dd1-9326-08dcd3ed3ec0 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: CH1PEPF0000A34C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9006 Currently, `piix4_transaction()` accepts only one parameter, which is the `i2c_adapter` information. This approach works well as long as SB800 SMBus port accesses are confined to the piix4 driver. However, with the implementation of a separate ASF driver and the varying address spaces across drivers, it is necessary to change the function parameter list of `piix4_transaction()` to include the port address. This modification allows other drivers that use piix4 to pass the specific port details they need to operate on. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K Reviewed-by: Andy Shevchenko --- drivers/i2c/busses/i2c-piix4.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 4e32d57ae0bf..69b362db6d0c 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c @@ -536,10 +536,8 @@ static int piix4_setup_aux(struct pci_dev *PIIX4_dev, return piix4_smba; } -static int piix4_transaction(struct i2c_adapter *piix4_adapter) +static int piix4_transaction(struct i2c_adapter *piix4_adapter, unsigned short piix4_smba) { - struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(piix4_adapter); - unsigned short piix4_smba = adapdata->smba; int temp; int result = 0; int timeout = 0; @@ -675,7 +673,7 @@ static s32 piix4_access(struct i2c_adapter * adap, u16 addr, outb_p((size & 0x1C) + (ENABLE_INT9 & 1), SMBHSTCNT); - status = piix4_transaction(adap); + status = piix4_transaction(adap, piix4_smba); if (status) return status; From patchwork Fri Sep 13 12:11:04 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: 1985176 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=3KgtimCT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-i2c+bounces-6710-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X4tTj5GXzz1y2L for ; Fri, 13 Sep 2024 22:12:09 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 80476281689 for ; Fri, 13 Sep 2024 12:12:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A24811D9342; Fri, 13 Sep 2024 12:11:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="3KgtimCT" X-Original-To: linux-i2c@vger.kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2068.outbound.protection.outlook.com [40.107.244.68]) (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 C7EA91C175F for ; Fri, 13 Sep 2024 12:11:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229516; cv=fail; b=IIdcvSpk79k9LnTxwqKHa0z8OqOHwF5wZYPK3BYmCd9Hvd1QnlmGJQnSu5eDMNdz64W2RABtHwQYMxBZiuX+sOGNbbs6Q7AJ8wNofo6ZurB8kKamxYFmDMrl6z71VTI3tTSZTOtfTvKOSg0iSAvXBrb4W9UVopjPBNx7lBQKY9A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229516; c=relaxed/simple; bh=9x4utuipeUMGcGTlkwcNySSCC5wQ19DjSbVrOMWDCm8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bGoqxlvnMJnz1m1ZpYn+6U2uuf8/8EqXKNMVnO/kDemMwUupF9rpmeuU5O6M/2tPPF5izXKdP5caBcAuSrSY1lnn4FlypBE/H6YLq2kAJyVgMfdI6GTY83SqwEpPQyS7tkFPNlnvMOlIoDV6aBQYvQtpdskjAYWBC9/OyfZ+RaI= 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=3KgtimCT; arc=fail smtp.client-ip=40.107.244.68 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=B3exlR9PgEoXhZrz6pq5r5epNtq0vhazwrQQEof7/z8Rex60AoBFTAm3Axei0CyfLLy2IFPZpJvP51lMHdP0ysVUc9jnqpxZyWqk2e2xvo0ov8DDhwSjwUk5GYjbjLPaSZWc6k6YuBeqMv5CehUgZ+rdDjYH1sMhqwBt1HSFSxo/KUk+NrJ20CYhQrZ4eDGEwRFGI0odUHbAj6DaAoe6YpW/Z4pYKOIXtc2a72zSpEPoDmZ6C/4reWENqZZPaSZrqe+uE4cisjIl+Y8xoja5+R//A/A0zuYvR0w0zdBonB8dqccOXsErWINs1tlOOavF2xydFq5wN6CceRSoDK780w== 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=+ECkYedZWcbcZtu08q1GD2hXMgqmIYRhGYiQYFuxbkY=; b=eoGEy5OOP3+dZZGk3siO7Yfo3ZDXVBCUFE2yZyONckzAnY44W2KSn6KbqpsCaTeb6R8o0ft42zcvOojTJ0uwU5rwFpL51SEYg4UsG2VOoYalx1ZgcEWR/HsJsuPhN/RfdsCMAyWwFqoO+mw37yuTq65BDRacwWTHTttyAHld/MWnJT12Qzz2wJ/9IeqEpHk9wR01ZeFjiwen09ech0F5fLW+ZU/sORUSWKEYSE1wKNMbNiPGWYMXmAvpGItFtq9sLcy07Dq1CxjQII/mzRN5YPZGF+HAOzAohljVrA82mi3lnS2E4dch3jJPciHFY749GFVh4ve4FQJ7G43ho+dkdQ== 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=+ECkYedZWcbcZtu08q1GD2hXMgqmIYRhGYiQYFuxbkY=; b=3KgtimCT6Dj9PoxufYeM3lEd3QcKKaWq4OLyuzQb7bH0mh3qeRi2y8Dix1RZM0Fz3t7R9SJUg7ZduxcCKh0CJ6XuPwfiwdlCbb8Y89VYjdXItvZBC2SQle0c4FWBo7YhG3YJdvG27yl4Arnv6Z5TOGOK4o+kNEaciVziZzhvSlM= Received: from CH0PR03CA0243.namprd03.prod.outlook.com (2603:10b6:610:e5::8) by MW6PR12MB7086.namprd12.prod.outlook.com (2603:10b6:303:238::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.17; Fri, 13 Sep 2024 12:11:52 +0000 Received: from CH1PEPF0000A347.namprd04.prod.outlook.com (2603:10b6:610:e5:cafe::5c) by CH0PR03CA0243.outlook.office365.com (2603:10b6:610:e5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.26 via Frontend Transport; Fri, 13 Sep 2024 12:11:51 +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 CH1PEPF0000A347.mail.protection.outlook.com (10.167.244.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Fri, 13 Sep 2024 12:11:51 +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; Fri, 13 Sep 2024 07:11:49 -0500 From: Shyam Sundar S K To: Jean Delvare , Andi Shyti CC: , , Andy Shevchenko , , Shyam Sundar S K Subject: [PATCH v5 2/8] i2c: piix4: Move i2c_piix4 macros and structures to common header Date: Fri, 13 Sep 2024 17:41:04 +0530 Message-ID: <20240913121110.1611340-3-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240913121110.1611340-1-Shyam-sundar.S-k@amd.com> References: <20240913121110.1611340-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000A347:EE_|MW6PR12MB7086:EE_ X-MS-Office365-Filtering-Correlation-Id: 2649b059-5b97-47cf-ba5d-08dcd3ed403d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: ytXyNAKlxtx9hl3aAhtWexjhthlmew7EBZSLwvgZrK/HzE4zWzeoOhZEwRnk1/o4939tO0dqnNySZHZuS42cxCtgmyZOuzjvW+2OF4y5Z5eAYq33ySEVEGdW8wpkSdY7DEEoM8EYg3BOBoE1aZfiti4l7X/mv+AaYLbpqSadZys8clOGS7oSWSm31EahIYPoUnGEA8Qixebz2UlV9zZjKgmxs3S+R3u4Bp9QW+ClH/16dhSeo7Xy5oq8HZjdNepRccQ1U5apv2r7xX1YNTnw/bOm5mJjLcddh/uPvBNw666qskhiFzzul74F1P8vzLia5ksDx4jDqY87qgWJKwF3I1akp6nD3rFM60XualZYUob6f7iP4dQn95XOrvUM45N8VJ2jH0xnibFiT8+iofKAYiYLkZUps+sJFdC5h7GYHJroudDeif7eJVwCLXDWVMEkgzc8Fy+BNWKqMi7hlXTTBDEuIZJG8cx4qVSVC4yJsK0Y2APsE3rJN4av1wvdkEHK0HHXkZpvbitRrU/X9yQxvrNpSM/8MEcJIJKXRqkqzcGIe80fc06a2Xj4P82QvkKipCwIzXKG3IvKCcVBKi0cnjUU/uAr5bjekMQ3TBoKIxU7Uk4vd/Pj1SJztSBwFaTtvGnAwwAOgmiPqLJR4KRma9kWko/QzoNTPtnLJDtCVchoiteZJ/rUBloC5Myy/3t0KJjN43EYZVoKd5MP3H2dNmgFv6PA3ZwQSmt2dgrQ9V6gqOt0LEHGtpGJbBFAXVoaELtFsD+laeGmv0YrwQ1HSHhol13Oi+by5yb8kYvuKSclB4BTBHucKbfkOhCSr/krFbDJM9xWw/YGzq3dkXryH9GsYxw8lv6Pzk/evqNw2IAVs9pNYYWK0dBLfbHv09JJMkpKDuredjkNuYJaNLPunM/Ym0hu5r2+jCPN/O2mxW2Ntot/xzHi9VMSWaOj+PpVvzTlSKt8zWA+FWxDRXznEndNmo2nNLA7AqD8/D4LlF3QqiQW0t7N4jGjQDQC9Tefv1JoZhAP/Xs+E/BxM0HxgedKEW16P4T/af9bERxWN3xF9bQsIildilh5nFxaiM79ZklHgvUhDZgoE9kGuc8nmA6oe/JamujCBg6Zn6cmNN5CF13wd+Si5XCeSEhsNUlBZequ4ucglbxIZAhrb4U/Nw1Ivh0alQjxDSJhxCYEa4BMn3YyBLypBvq37PsdqqHPthZsjsz7GZddJVK46lJOzPN2tziMBT1ixRfP6bJ/6MujDGwC/TBloeYuwfHA3KrsyFUs95L1r1Vltoadotpr9Xc4bFMfuW3NOKP3E+TcZ0dRO2B0Ze1lram9rnh9jJBXz45bKmWemboSlk/tukmvpXOtGicos6n5mg4J7U/7+Rr/hoRVKt1hJMKcuSXIRDYqBk1dSW4UpRZUI8kC2TZWofxUZykmGjjkl2r9Z+xeaIVzVqHUnGD7gy2dxKCVoO5S 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)(36860700013)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2024 12:11:51.7483 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2649b059-5b97-47cf-ba5d-08dcd3ed403d 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: CH1PEPF0000A347.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB7086 Add a separate header file to relocate the common code from the i2c_piix4 driver, allowing the AMD ASF driver to utilize the same code. Update the MAINTAINERS file to include information about the new common header file. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K --- MAINTAINERS | 2 +- drivers/i2c/busses/i2c-piix4.c | 24 +------------------- drivers/i2c/busses/i2c-piix4.h | 40 ++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 24 deletions(-) create mode 100644 drivers/i2c/busses/i2c-piix4.h diff --git a/MAINTAINERS b/MAINTAINERS index 10430778c998..3f348b71b9c9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10611,7 +10611,7 @@ F: drivers/i2c/busses/i2c-i801.c F: drivers/i2c/busses/i2c-isch.c F: drivers/i2c/busses/i2c-nforce2-s4985.c F: drivers/i2c/busses/i2c-nforce2.c -F: drivers/i2c/busses/i2c-piix4.c +F: drivers/i2c/busses/i2c-piix4.* F: drivers/i2c/busses/i2c-sis5595.c F: drivers/i2c/busses/i2c-sis630.c F: drivers/i2c/busses/i2c-sis96x.c diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 69b362db6d0c..2c2a466e2f85 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c @@ -35,23 +35,7 @@ #include #include - -/* PIIX4 SMBus address offsets */ -#define SMBHSTSTS (0 + piix4_smba) -#define SMBHSLVSTS (1 + piix4_smba) -#define SMBHSTCNT (2 + piix4_smba) -#define SMBHSTCMD (3 + piix4_smba) -#define SMBHSTADD (4 + piix4_smba) -#define SMBHSTDAT0 (5 + piix4_smba) -#define SMBHSTDAT1 (6 + piix4_smba) -#define SMBBLKDAT (7 + piix4_smba) -#define SMBSLVCNT (8 + piix4_smba) -#define SMBSHDWCMD (9 + piix4_smba) -#define SMBSLVEVT (0xA + piix4_smba) -#define SMBSLVDAT (0xC + piix4_smba) - -/* count for request_region */ -#define SMBIOSIZE 9 +#include "i2c-piix4.h" /* PCI Address Constants */ #define SMBBA 0x090 @@ -70,7 +54,6 @@ #define PIIX4_BYTE 0x04 #define PIIX4_BYTE_DATA 0x08 #define PIIX4_WORD_DATA 0x0C -#define PIIX4_BLOCK_DATA 0x14 /* Multi-port constants */ #define PIIX4_MAX_ADAPTERS 4 @@ -160,11 +143,6 @@ static const char *piix4_main_port_names_sb800[PIIX4_MAX_ADAPTERS] = { }; static const char *piix4_aux_port_name_sb800 = " port 1"; -struct sb800_mmio_cfg { - void __iomem *addr; - bool use_mmio; -}; - struct i2c_piix4_adapdata { unsigned short smba; diff --git a/drivers/i2c/busses/i2c-piix4.h b/drivers/i2c/busses/i2c-piix4.h new file mode 100644 index 000000000000..c4c20edacb00 --- /dev/null +++ b/drivers/i2c/busses/i2c-piix4.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * PIIX4/SB800 SMBus Interfaces + * + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Authors: Shyam Sundar S K + * Sanket Goswami + */ + +#ifndef I2C_PIIX4_H +#define I2C_PIIX4_H + +/* PIIX4 SMBus address offsets */ +#define SMBHSTSTS (0 + piix4_smba) +#define SMBHSLVSTS (1 + piix4_smba) +#define SMBHSTCNT (2 + piix4_smba) +#define SMBHSTCMD (3 + piix4_smba) +#define SMBHSTADD (4 + piix4_smba) +#define SMBHSTDAT0 (5 + piix4_smba) +#define SMBHSTDAT1 (6 + piix4_smba) +#define SMBBLKDAT (7 + piix4_smba) +#define SMBSLVCNT (8 + piix4_smba) +#define SMBSHDWCMD (9 + piix4_smba) +#define SMBSLVEVT (0xA + piix4_smba) +#define SMBSLVDAT (0xC + piix4_smba) + +/* Count for request_region */ +#define SMBIOSIZE 9 + +/* PIIX4 constants */ +#define PIIX4_BLOCK_DATA 0x14 + +struct sb800_mmio_cfg { + void __iomem *addr; + bool use_mmio; +}; + +#endif /* I2C_PIIX4_H */ From patchwork Fri Sep 13 12:11:05 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: 1985177 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=ZQfc78g0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-i2c+bounces-6711-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X4tTs5JDhz1y1y for ; Fri, 13 Sep 2024 22:12:17 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7F10E1F22CD3 for ; Fri, 13 Sep 2024 12:12:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D71A1D935F; Fri, 13 Sep 2024 12:12:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ZQfc78g0" X-Original-To: linux-i2c@vger.kernel.org Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2041.outbound.protection.outlook.com [40.107.92.41]) (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 701C01C2329 for ; Fri, 13 Sep 2024 12:11:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229521; cv=fail; b=Qm69B3RnIVIYQncHUD52KUg4nrZsfFyJKjG5CDnLMlLBa+kuairsd8e+WXU0IgS8zxv9i8nLa+dtl2UmwxevW/ZfqKFjDCbMYAl/KcO+povvNoUefhUqAUtgXXmIQV3tKqWtBZ4YPQDoR/KgAC4YrEGQZ1B2SFBpj+G5S71rMV4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229521; c=relaxed/simple; bh=CPCR44+rG+0Ildkk0srAQL7vppVAwH5jDO6xZ7pYyUc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U0c3ZwfIVQdoRLqUDCVdvEx7C230OnR7X+vsp6vA5I3Lz/wxyrsmEw8a5+3q5lxOvbwRmzGzgu3mJGfWvQNW0yhZt980+Ee8XGosghnYlzz0+aJ8bDt9zceLuIhWGY+evEYBbf4+eFqN2Ikk71tdyyBQRbKs8DNmi8gxc8KSDb4= 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=ZQfc78g0; arc=fail smtp.client-ip=40.107.92.41 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QKC0O32Se/WpjmBybGzzAJgNeyCIWV8ZntsN3wScGRzfkUmALfbglPJjs46QE+otIMWZfCJbXZ/WUhVE368ksrZUGur8Tolb1JAyNjR2/ftT62GFCEgZtFVwZgSfo6gL+hVJE1SWGuwcieJEulvX3MZWiRTevYHlsEH0e7RUVUr9fvhYNYss7zs6Tn3QtopE/cgqwW6oORFPiM0oy5M3VeTAUU3G92/TVqLpJdLITHXFxjfxotv/aQALTb7fBI7VsE/pM7SbPCvdLjGGq4RaJdXwxJ1t7p8mgShsIwqldmVM3qZXea/rAiqYC52IZ6U8cjXXNZV8oT57NZklGlF7yg== 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=E8X92reLtvPO5QKuDUOJvFqig/cxf1Tj93LE9zwF00k=; b=MbyoANbvLiXn1W4fJm9LBybKtsTXokFMqJ+H0T6lBGkRj4HxxTQP7Oph4JbxFeyDX8QvXVv0czFsfFHNVij0LJeOvpuh/Kiz2WOeE0K3MWk15LPcQv560xxi5HemLS+gR+Tw//FDDd5oR5ha6BjRYTAY9Q8lNDfL32EZbom50PjFVRTepqbOlIy36wW9LxIadDl8VXLvHjPtRAT8PTkCYZRw2Qsgd26yGtQeC2KdCjXpLdW/u7hse7IpodsO0DMPu+kniSMzXJBZd1LYRNerQU/SfbCKd683X8nkcxe773Dx01a2SjYJeL/nMvnZVIZnVEensbUGhy/wHgJyrrJygA== 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=E8X92reLtvPO5QKuDUOJvFqig/cxf1Tj93LE9zwF00k=; b=ZQfc78g0abT84apR5t4dfPTKDWudoXKTYeqH0h3pWbwykKtgcX6S4ksDptftwR/+n3dfvUsx16DDWk0wV+Yl2v4VLfymv9bxYA4yqvdsFe3k1s9Qjr84ktBdZc0tXZDV3I5H05i9nuBhVOn2UWGZZ4dwI20/D9cCy1Mhjc2hfHk= Received: from CH0PR03CA0246.namprd03.prod.outlook.com (2603:10b6:610:e5::11) by CH3PR12MB7641.namprd12.prod.outlook.com (2603:10b6:610:150::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Fri, 13 Sep 2024 12:11:54 +0000 Received: from CH1PEPF0000A347.namprd04.prod.outlook.com (2603:10b6:610:e5:cafe::48) by CH0PR03CA0246.outlook.office365.com (2603:10b6:610:e5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.25 via Frontend Transport; Fri, 13 Sep 2024 12:11:54 +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 CH1PEPF0000A347.mail.protection.outlook.com (10.167.244.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Fri, 13 Sep 2024 12:11:54 +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; Fri, 13 Sep 2024 07:11:51 -0500 From: Shyam Sundar S K To: Jean Delvare , Andi Shyti CC: , , Andy Shevchenko , , Shyam Sundar S K Subject: [PATCH v5 3/8] i2c: piix4: Export i2c_piix4 driver functions as library Date: Fri, 13 Sep 2024 17:41:05 +0530 Message-ID: <20240913121110.1611340-4-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240913121110.1611340-1-Shyam-sundar.S-k@amd.com> References: <20240913121110.1611340-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000A347:EE_|CH3PR12MB7641:EE_ X-MS-Office365-Filtering-Correlation-Id: 1fc648b2-e333-4b9f-e148-08dcd3ed41ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: DsQYNSMwqB7bo4xCZakTvljmt3Yq5wqhaEEwsKQYoDkmMfd0ydbG7EIgpIhz84sTexLdZTFTIlwzwWL3mqi2YxYzQk3izYNjIhEabWm8J/jJW7W/F/oqhKePxKZhLtJmnN9sOJBZKyveWEfPbNyI4CBlx+BHa25kQeNsS50xK5euevetUwVilFRqgJiYbZIGdv2wv0G2Xt1RLNMsEQPtBEQUR2wJar2nm4tmnBPylepIAxoBT9jSU/SJspSJMthG9In911gDAXd4BxdtAG4wz9pP5mgIAqF9n73zic3UwSMqfo9t+qgjSPl9OGSq89SzkLgS7mM4zl0cC27tOYpR+ELOikhoWmBeLZRicEdqqB6bDAbpEWpKvOqv5vqtMu7JaU6ptQ2uCcqYlbp06b6xRS/B/WQvF0JKnEotogZW5uUAE/jsxrO1y6OtkBI4TqSSAkf7Z9fobmN5pL17pDL2UaYrmnaJzZjbodNKhrZi6ox6ALwxK90yjEp5cVzYZ+hrUTapua74ic5LNvu8ysygoi094IUPYkq9NxUWNtHl4VFi5cEmgFubV4cChTCgIucScs7kg6994kWiZqLygjMVfzmzLKa8+em8WUXC8O3IQUf9WId/9kaNyV9Chf0bqhw7PC6+trAQgd2WAsnqjII+8SSYliVTCzm3QewjohZAuOcIU808WGfT2fViBsOt7gXAbTtpUFMycmZdhQokHxHIp6YFtVqdyT9Jfj+lyi9e+NtFoXeyp7fG1EROxYm7q4S+iuMlS4Id4Kq0b6ZG1IZSoXUvwx/0TKR6/DTCK6uObKquF260NjTAZ6L2ODdF2VTCmUm84NdlG7HHG0+W9k5gvg74dcYMuCii4Vc5l6x5ZQbB/K/Ldf4cDShP9LnI0yxpy6mjbVIbkJtN/rbJk+ezZdYsH6vHT4E0ze7JUla+5mqMigLndJDQj3XWMv3xEJexu2JVqysKxzPPJHr62M+Oonn0H9pnNWngz37YpcvIwHn/zJ5weBcKvDRLYWs8CNxlkxMyx3eUavS+6167KPdDRbKcwfCzWo0923mBEZqpPP/lAnQ5BLFuNAnVYvxrwQOGMt6b4mZkG99aPWhSYr7llRZx5HW3Fpd/G3Kr85ol5r7l73vy6+bLkfLV/T3uIyX7t/ool1BPI6uh5MzIhqQ3J6kfqyfw53sd2Umy+PHL0KULR+hpmClFv7QjYPf5zqlwkC2ISp/2TKAMKKwVEgAfArWQ/PAy8/D7Tr0IZXKTBNBIDz5cbhEyNRjRXVR+ac81al0LHqYKdxECZRcbY/et/+ix5NI6M6kLA3i6P+WinPgN/xmdJsdnyrdgu2giEPIs0yavh1FBc09pzPUQ4tcWYbyBQXB2L+TrOzp8bVFn7KZYo4cC5V9hTyuEVxPvthEa1iW8P7BGClKgAIYrs/5TOv3SDZjMOVdnJAaEu0OuPLlLbmHc/b37r3K2QO34/giF 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)(376014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2024 12:11:54.5452 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1fc648b2-e333-4b9f-e148-08dcd3ed41ea 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: CH1PEPF0000A347.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7641 Export the following i2c_piix4 driver functions as a library so that the AMD ASF driver can utilize these core functionalities from the i2c_piix4 driver: - piix4_sb800_region_request(): Request access to a specific SMBus region on the SB800 chipset. - piix4_sb800_region_release(): Release the previously requested SMBus region on the SB800 chipset. - piix4_transaction(): Handle SMBus transactions between the SMBus controller and connected devices. - piix4_sb800_port_sel(): Select the appropriate SMBus port on the SB800 chipset. By making these functions available as a library, enable the AMD ASF driver to leverage the established mechanisms in the i2c_piix4 driver, promoting code reuse and consistency across different drivers. Note that the git diff view is presented in two separate lines in order to suppress the checkpatch.pl "CHECKS". Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K --- drivers/i2c/busses/i2c-piix4.c | 16 ++++++++++------ drivers/i2c/busses/i2c-piix4.h | 5 +++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 2c2a466e2f85..7e0fb51ce532 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c @@ -153,8 +153,8 @@ struct i2c_piix4_adapdata { struct sb800_mmio_cfg mmio_cfg; }; -static int piix4_sb800_region_request(struct device *dev, - struct sb800_mmio_cfg *mmio_cfg) +int piix4_sb800_region_request(struct device *dev, + struct sb800_mmio_cfg *mmio_cfg) { if (mmio_cfg->use_mmio) { void __iomem *addr; @@ -192,9 +192,10 @@ static int piix4_sb800_region_request(struct device *dev, return 0; } +EXPORT_SYMBOL_GPL(piix4_sb800_region_request); -static void piix4_sb800_region_release(struct device *dev, - struct sb800_mmio_cfg *mmio_cfg) +void piix4_sb800_region_release(struct device *dev, + struct sb800_mmio_cfg *mmio_cfg) { if (mmio_cfg->use_mmio) { iounmap(mmio_cfg->addr); @@ -205,6 +206,7 @@ static void piix4_sb800_region_release(struct device *dev, release_region(SB800_PIIX4_SMB_IDX, SB800_PIIX4_SMB_MAP_SIZE); } +EXPORT_SYMBOL_GPL(piix4_sb800_region_release); static bool piix4_sb800_use_mmio(struct pci_dev *PIIX4_dev) { @@ -514,7 +516,7 @@ static int piix4_setup_aux(struct pci_dev *PIIX4_dev, return piix4_smba; } -static int piix4_transaction(struct i2c_adapter *piix4_adapter, unsigned short piix4_smba) +int piix4_transaction(struct i2c_adapter *piix4_adapter, unsigned short piix4_smba) { int temp; int result = 0; @@ -587,6 +589,7 @@ static int piix4_transaction(struct i2c_adapter *piix4_adapter, unsigned short p inb_p(SMBHSTDAT1)); return result; } +EXPORT_SYMBOL_GPL(piix4_transaction); /* Return negative errno on error. */ static s32 piix4_access(struct i2c_adapter * adap, u16 addr, @@ -740,7 +743,7 @@ static void piix4_imc_wakeup(void) release_region(KERNCZ_IMC_IDX, 2); } -static int piix4_sb800_port_sel(u8 port, struct sb800_mmio_cfg *mmio_cfg) +int piix4_sb800_port_sel(u8 port, struct sb800_mmio_cfg *mmio_cfg) { u8 smba_en_lo, val; @@ -762,6 +765,7 @@ static int piix4_sb800_port_sel(u8 port, struct sb800_mmio_cfg *mmio_cfg) return (smba_en_lo & piix4_port_mask_sb800); } +EXPORT_SYMBOL_GPL(piix4_sb800_port_sel); /* * Handles access to multiple SMBus ports on the SB800. diff --git a/drivers/i2c/busses/i2c-piix4.h b/drivers/i2c/busses/i2c-piix4.h index c4c20edacb00..9a5faac3eedd 100644 --- a/drivers/i2c/busses/i2c-piix4.h +++ b/drivers/i2c/busses/i2c-piix4.h @@ -37,4 +37,9 @@ struct sb800_mmio_cfg { bool use_mmio; }; +int piix4_sb800_port_sel(u8 port, struct sb800_mmio_cfg *mmio_cfg); +int piix4_transaction(struct i2c_adapter *piix4_adapter, unsigned short piix4_smba); +int piix4_sb800_region_request(struct device *dev, struct sb800_mmio_cfg *mmio_cfg); +void piix4_sb800_region_release(struct device *dev, struct sb800_mmio_cfg *mmio_cfg); + #endif /* I2C_PIIX4_H */ From patchwork Fri Sep 13 12:11:06 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: 1985178 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=v2b5LT5H; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-i2c+bounces-6712-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X4tTv4W9Bz1y1y for ; Fri, 13 Sep 2024 22:12:19 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 237751F22D64 for ; Fri, 13 Sep 2024 12:12:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85CF21DA0E2; Fri, 13 Sep 2024 12:12:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="v2b5LT5H" X-Original-To: linux-i2c@vger.kernel.org Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2061.outbound.protection.outlook.com [40.107.212.61]) (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 77C971C2329 for ; Fri, 13 Sep 2024 12:12:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229523; cv=fail; b=m8gW5m43IAhUPFzS4OriJpf4kXO/Jw8ML5jEmr8FJxLj4bAyY687n2XN7oMF5O7zzNTxMvI6t6fqnlmeUEvFH0kpqEM5fZGfYThaa6OmXh6lCb/3u+WBA1XIEUzm1iHVZtm10nHKpj4nvO1LeA3WmarsBLmsyHvKO6MnoLevlJY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229523; c=relaxed/simple; bh=TFBJtns56b9foXQXWC3UJMens+lgzzgwxi16HznX0gE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KofcBL/HAVZpcPGLEOGva/1S5kH++t/vX3wufI9nAt3nHVJyWNbN08xcaV4fB71O9tuF0shckn9KQo0NTSDHKVqRBBWxOiZzCPZ2FWPfhdhsANK6D0/ku1wI7UC9eBD0YQDc/LT/SKcKWRxm0mNntcH2p3Jke66Ys+8JA48Iidw= 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=v2b5LT5H; arc=fail smtp.client-ip=40.107.212.61 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dKmmS35kB9ceipBnqRcDpSv+h4dUiTg3l9aREMJUJfzwMmPSNLUyIMs+2+fUUQ8WeY3ZMFlfTajS0Se/elbNiykdGrbArPDk3REX8JAWQprKBwFTuKAy8JOtTkQbk2oxDGwtttBc/kCiKssMsyvXljCxdQzulGFxS4RXOGodiSDZcCRD5zoxnL0bJEOqDXR6pGkS5KmUbt4ikQ2Pinuie7CQCX/G1JIw7bwOn266CgUyW/R583Qe+7hLBH2hTvTU7EdNvnJho7nhk6cwK66cuA7vuS8a9tvuqgOriawycRDBq3Yi4UavNwJUVBxmezC9MEkw4H7KCgtlFfSdVHyn6g== 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=YJrI6HmnMCvxaVQAbRYqJYwAOTXGR+M798Va5alQjJY=; b=IrXVWVjNBs5Y+3lmTjDKWrcGcljyX7rInrTaDpLSjDidCV1cn3qQ6pIk7SwJTOGbCRJw+o+eEynQ0kKZHK7kzX40IBDlJ9jUS1l57bRN/IE3gZhVDwbXvmwuwEoxkJS4fTeQ5trr8KiJuhvRpd00enP3rRNc4Itd1C76JBzuhRYKi40QlWYfmD0bUam6tl5x/zIJxADf9yMWD6O6y5ndzrV+gDGVp585N+Za2uFCTkGSxkNoPOpshbxHn2/U1JUHddj5lyRczn+eDFHmZL0TyHBjF17dhZZmRc0tkPvzkln/qv5cs+0YMmiN2jgCK2michtufS3rUy95N2jAo/ghfg== 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=YJrI6HmnMCvxaVQAbRYqJYwAOTXGR+M798Va5alQjJY=; b=v2b5LT5HMoisp5JlMe0uBZsWNmUa+3KO5k1SqI7rxFsz1x7Qk2KSbmB0Y5WQne4D1+b/4JvUDsAqe6Y8ZOqJ0Ek6jawFQ44zdb0piP8u5ta7FL63QNox17j9se6xBCPCnIQt6asCofb+4H5L0aCB12pTimQyyEoo+FhEKD0UKP4= Received: from CH5P222CA0003.NAMP222.PROD.OUTLOOK.COM (2603:10b6:610:1ee::24) by MW6PR12MB8913.namprd12.prod.outlook.com (2603:10b6:303:247::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.19; Fri, 13 Sep 2024 12:11:57 +0000 Received: from CH1PEPF0000A34A.namprd04.prod.outlook.com (2603:10b6:610:1ee:cafe::be) by CH5P222CA0003.outlook.office365.com (2603:10b6:610:1ee::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.27 via Frontend Transport; Fri, 13 Sep 2024 12:11:56 +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 CH1PEPF0000A34A.mail.protection.outlook.com (10.167.244.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Fri, 13 Sep 2024 12:11:56 +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; Fri, 13 Sep 2024 07:11:54 -0500 From: Shyam Sundar S K To: Jean Delvare , Andi Shyti CC: , , Andy Shevchenko , , Shyam Sundar S K Subject: [PATCH v5 4/8] i2c: amd-asf: Add ACPI support for AMD ASF Controller Date: Fri, 13 Sep 2024 17:41:06 +0530 Message-ID: <20240913121110.1611340-5-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240913121110.1611340-1-Shyam-sundar.S-k@amd.com> References: <20240913121110.1611340-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000A34A:EE_|MW6PR12MB8913:EE_ X-MS-Office365-Filtering-Correlation-Id: b9c6f139-e697-45c3-9342-08dcd3ed4320 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: lO/5L1Yk5wohNVy6FbxSELYBnS0/p4VOA31RLGTahvbBwu/kFgEuv6EF/Iku5YvEK05qeRrH2KblwPb9Lwc+kEsb8ve0QYfoFGeN4OvRiFcSFzZmLib83/mg6LwzX+JGsac0WqE2GuPI+c8+Fbv7nA560wsMsUcbpM52xZZ+FIZsyhCsZNL22EpQdiUnpqCVfLkG1IuhDTwlkS0X+wpuuYHwhOFyFBpqm4DXa4AAEaEG8n1PwpDOy1UxHjoKzRjqsTlv+xrGWfFJiQGtbworKNsqflfyzi2uALs/7UCUsNAx5Ln0JKORpCgrUSiwABdG0X4t8oQHEHbHNY12LnHS3mok6fnSOv0UEnWmVJne8OznzHr/T+SWGmsWXjhMDxyVEOzwFKvEcfy0NoXHPPDIvqPvjTbeFSiRkwg82O89xxR0D3OySrXWgCdryQHIsB5Y6vknyCF3KGYic4a+tim7L6q/RaywILSfCzm31nQu7g7Hcmt1u9covHQhfghVs+vUDkVOEVBAj2UZCakRMZ2SdRZmAF1seHvKgoNBvyLqqKqH5OeDjPPLG4pLNNHGoBqZarUeOgjx+htsIO3jOlMPTKFNf288us6q3exVySM+ht4tVdn6WmPHgePzgZfcBtwVczW4mGSZBF7797tkA59hWqFzf9gtDi5UwwR4xA09dDvzbPKCGOn0fJIuzq49wPn+MQcZjBKORg6ixW10+xJM8yRnv/xFAgB4Z7RT/Huob0cysG5Jf1glHF6VxmoZOBRC9Un3gaVulHTbY8dDJ6mM1b0ZXfS6XisAITCda7IcdIOlWy5dBpq5JngBEuuQ2JnzeYsK9PJ4TNA8l0QytFWjVoF+Qum/Sa/4pP0qucRZaAED7Wl/WjSXhtNVlxtDHHhdSWh6H3nQMVZBpSPZMZe4cubhTwdqhCOVomz97QokfIAgv3lm2W5GEc2IO5pKaImXqjcOebaUxKCtpZLRpdvjDRqg78bp6hua2x7bm55dRvkyMGa5qpTSlW4WkyWm+KbgtLABVxSBp4joHMfHy1wMgBFi0SAiWT36ztxrkvYvAUizTaawaiSwLeEnC31bQ1th29s2uoppHlL5EO6b8CfojsblFDgfdSB8SHG1tBXNffWZjBJCbRB5Fq9tVTDn17SPpoOPffO/JkKIa26SZPz5fGKuSXdl4biqAQsqC5HcD8k0tE3b620VwkmMA06qpUoJvo/WfotdvUrBhOioYQH1ApCo60N67Gt6zuipeckaUflw066LQ35Vy8Sq0CaRtylPlVMo3bYQOemZhG7qAt+X1PrVJ+Kz5s8RDw6OcIEpojnoHHGVwzRT7l0TFRh9NSJxsl26jTCF1TL55PW8sJYcpHH1Ivahcr/sTouA4GlTFy+bIHLivDNwVDY1ZMVuk88iUYvaLzOGl98FcbHebvX+ugDKCQdax8i7PxbumE4QlEEcXPxpyLsbl8O06Vzliv/S 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)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2024 12:11:56.5748 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b9c6f139-e697-45c3-9342-08dcd3ed4320 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: CH1PEPF0000A34A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8913 The AMD ASF controller is presented to the operating system as an ACPI device. The AMD ASF driver can use ACPI to obtain 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 should not be configured. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K --- drivers/i2c/busses/Kconfig | 16 ++++++ drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-amd-asf-plat.c | 73 +++++++++++++++++++++++++++ drivers/i2c/busses/i2c-piix4.c | 12 ++++- 4 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 drivers/i2c/busses/i2c-amd-asf-plat.c diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index a22f9125322a..03afcdbff209 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -95,6 +95,22 @@ config I2C_AMD_MP2 This driver can also be built as modules. If so, the modules will be called i2c-amd-mp2-pci and i2c-amd-mp2-plat. +config I2C_AMD_ASF + tristate "AMD ASF I2C Controller Support" + depends on I2C_PIIX4 + help + This option enables support for the AMD ASF (Alert Standard Format) + I2C controller. The AMD ASF controller is an SMBus controller with + built-in ASF functionality, allowing it to issue generic SMBus + packets and communicate with the DASH controller using MCTP over + ASF. + + If you have an AMD system with ASF support and want to enable this + functionality, say Y or M here. If unsure, say N. + + To compile this driver as a module, choose M here: the module will + be called i2c_amd_asf_plat. + config I2C_HIX5HD2 tristate "Hix5hd2 high-speed I2C driver" depends on ARCH_HISI || ARCH_HIX5HD2 || COMPILE_TEST diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 78d0561339e5..74920380a337 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile @@ -38,6 +38,7 @@ obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o # Embedded system I2C/SMBus host controller drivers obj-$(CONFIG_I2C_ALTERA) += i2c-altera.o obj-$(CONFIG_I2C_AMD_MP2) += i2c-amd-mp2-pci.o i2c-amd-mp2-plat.o +obj-$(CONFIG_I2C_AMD_ASF) += i2c-amd-asf-plat.o obj-$(CONFIG_I2C_ASPEED) += i2c-aspeed.o obj-$(CONFIG_I2C_AT91) += i2c-at91.o i2c-at91-objs := i2c-at91-core.o i2c-at91-master.o diff --git a/drivers/i2c/busses/i2c-amd-asf-plat.c b/drivers/i2c/busses/i2c-amd-asf-plat.c new file mode 100644 index 000000000000..3d80805a7a3e --- /dev/null +++ b/drivers/i2c/busses/i2c-amd-asf-plat.c @@ -0,0 +1,73 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * AMD Alert Standard Format Platform Driver + * + * Copyright (c) 2024, Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Authors: Shyam Sundar S K + * Sanket Goswami + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "i2c-piix4.h" + +static const char *amd_asf_port_name = " port 1"; + +struct amd_asf_dev { + struct i2c_adapter adap; + struct device *dev; + struct sb800_mmio_cfg mmio_cfg; + struct resource *port_addr; +}; + +static int amd_asf_probe(struct platform_device *pdev) +{ + struct amd_asf_dev *asf_dev; + + asf_dev = devm_kzalloc(&pdev->dev, sizeof(*asf_dev), GFP_KERNEL); + if (!asf_dev) + return dev_err_probe(&pdev->dev, -ENOMEM, "Failed to allocate memory\n"); + + asf_dev->dev = &pdev->dev; + asf_dev->mmio_cfg.use_mmio = true; + platform_set_drvdata(pdev, asf_dev); + + asf_dev->port_addr = platform_get_resource(pdev, IORESOURCE_IO, 0); + if (!asf_dev->port_addr) + return dev_err_probe(&pdev->dev, -EINVAL, "missing IO resources\n"); + + asf_dev->adap.owner = THIS_MODULE; + asf_dev->adap.dev.parent = &pdev->dev; + + i2c_set_adapdata(&asf_dev->adap, asf_dev); + snprintf(asf_dev->adap.name, sizeof(asf_dev->adap.name), + "SMBus ASF adapter%s at 0x%llx", amd_asf_port_name, asf_dev->port_addr->start); + + return devm_i2c_add_adapter(&pdev->dev, &asf_dev->adap); +} + +static const struct acpi_device_id amd_asf_acpi_ids[] = { + { "AMDI001A" }, + { } +}; +MODULE_DEVICE_TABLE(acpi, amd_asf_acpi_ids); + +static struct platform_driver amd_asf_driver = { + .driver = { + .name = "i2c-amd-asf", + .acpi_match_table = amd_asf_acpi_ids, + }, + .probe = amd_asf_probe, +}; +module_platform_driver(amd_asf_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("AMD Alert Standard Format Driver"); diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 7e0fb51ce532..f4a65344b481 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c @@ -84,6 +84,7 @@ #define SB800_PIIX4_FCH_PM_ADDR 0xFED80300 #define SB800_PIIX4_FCH_PM_SIZE 8 +#define SB800_ASF_ACPI_PATH "\\_SB.ASFC" /* insmod parameters */ @@ -1023,6 +1024,9 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id) { int retval; bool is_sb800 = false; + bool is_asf = false; + acpi_status status; + acpi_handle handle; if ((dev->vendor == PCI_VENDOR_ID_ATI && dev->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS && @@ -1085,10 +1089,16 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id) } } + status = acpi_get_handle(NULL, (acpi_string)SB800_ASF_ACPI_PATH, &handle); + if (ACPI_SUCCESS(status)) + is_asf = true; + 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) { From patchwork Fri Sep 13 12:11:07 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: 1985180 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=1pGXfGon; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-i2c+bounces-6713-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X4tTw0YwPz1y2K for ; Fri, 13 Sep 2024 22:12:20 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A47DA1C21728 for ; Fri, 13 Sep 2024 12:12:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B11371D9353; Fri, 13 Sep 2024 12:12:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="1pGXfGon" X-Original-To: linux-i2c@vger.kernel.org Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2077.outbound.protection.outlook.com [40.107.93.77]) (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 B0F2F1C2329 for ; Fri, 13 Sep 2024 12:12:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229525; cv=fail; b=D9PDPJt0iHmXsuy/4kF1CuCcjucocqEzR+DvBqZunZ9ZbFRVwi8sodAx+/3yjnnrd3/K856gKcCVWvk3XbY7KQHz+Juh83FqyKuHbVuSIvaV7IACKXP42+ZrTGqXfpsc2ZiwLFYECnFoZGCnJwwcqKz9aBchx9tU3XQ5pfZBkrg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229525; c=relaxed/simple; bh=MHxeU2vbcANVhV447r92ome6DsYWucQMpKqE/+Xm44I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AQDYsUOPrLS2hXUIGxPVJR58FPLQPPg7ulyPQCS9JccySkHpgmTwTzHP/0EhqF6ABhzoNwAIMcghvyMWd597O2enFUckHW/KpY/DGnJili098IXVqTU3YroJeubwnpJ17z5x8LVg8fnXC1TXqLWupnJuSojy5lf0cQv9TXm3d9U= 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=1pGXfGon; arc=fail smtp.client-ip=40.107.93.77 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iCyJYknEplcdvZ2I6cCulEt8npwS8Umcr/BCpEJGktK/a4N08q78fPs0/qY83syoxUBJdofdxs4FEcVQjXZndGOgHdX843vYVH48MT2/7B73Ty8toah1Qk7mfvvSPnHk0jIMHcTHpTi7Q8MUNxL3Tt+PgHb603aTTENlb+82NVWNfpbA08zOkVt7RtMuhXnlgaE9u20sB7UznN+3Idt2GFUqTuVEeh1E25hiCDTOgQ1UDcu1riQRN5Q2hk1QNgY+dgrhO9XZjEio9sC8N3cImLsaDqvnAoolienQmOXJ6tZAOwSK01ee4s069pV6FdPGVFS5fSep+kbMuSNydKRtOw== 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=b6/b7yT8gQtKxyyct14dob7/bmkS91Hm3H8CuyUEeus=; b=fA0Tn02uBJ0ucDEE1mhY8kqbVTYwJ7qReHlzPtx6dd5rQQP7kFYaFnvnYvozKt0Nw0ElLJSR4n850ZxFYxUv8KwyQWlSNsOPDGA7rUf4emd+5IPnkJKKI431i1wPOAvYIrRjAnV+ANiteMefRC4+IqdmicbbaWOURznFWzzs1y8VrTZorp93qQ7DZUAJNGVAKidHBUIIkMUFJtuIGwjduq7aZwC4aIaWeKUKjCO9ohNSptmWRLqNAMtr/hTqrXg0z4cSSiP/t9LU1eltqpruzt50IOmTs41PbSMf5qPdy1TDvmTwl1c2VlYhbUgRPdVFFq5FoXWK7ANhPS/HksuIlA== 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=b6/b7yT8gQtKxyyct14dob7/bmkS91Hm3H8CuyUEeus=; b=1pGXfGonlDkbU+YD/huA04CpU5hTA65//emvTSdyzIqLTaGvNEwtv4nSj5F08ZRcMuw6E2Z97/9qclhHG8dHANIXEm2UCMVWsZmACLQfi6S3BvdjO7vHPDVHOvJRBFCrvXpRarWZZIwQ+ZSxVCsIn5/HI1VWMvMXFh+rVqrkcHE= Received: from CH2PR18CA0016.namprd18.prod.outlook.com (2603:10b6:610:4f::26) by CH3PR12MB8512.namprd12.prod.outlook.com (2603:10b6:610:158::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.27; Fri, 13 Sep 2024 12:11:59 +0000 Received: from CH1PEPF0000A348.namprd04.prod.outlook.com (2603:10b6:610:4f:cafe::c5) by CH2PR18CA0016.outlook.office365.com (2603:10b6:610:4f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24 via Frontend Transport; Fri, 13 Sep 2024 12:11:59 +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 CH1PEPF0000A348.mail.protection.outlook.com (10.167.244.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Fri, 13 Sep 2024 12:11:59 +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; Fri, 13 Sep 2024 07:11:56 -0500 From: Shyam Sundar S K To: Jean Delvare , Andi Shyti CC: , , Andy Shevchenko , , Shyam Sundar S K Subject: [PATCH v5 5/8] i2c: amd-asf: Add i2c_algorithm operations to support AMD ASF with SMBus Date: Fri, 13 Sep 2024 17:41:07 +0530 Message-ID: <20240913121110.1611340-6-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240913121110.1611340-1-Shyam-sundar.S-k@amd.com> References: <20240913121110.1611340-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000A348:EE_|CH3PR12MB8512:EE_ X-MS-Office365-Filtering-Correlation-Id: 09c89ea6-38a7-40d0-d4a1-08dcd3ed449f 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: tx0g1Ig2+EI5qE6zJup4clGjF5em3w5qdwPPoxMGwQ+kJuvFVr5EN+YcdgixisOR4z5LAVcDlOY1FGdbVx4HMcTazxIF1qSK9zLPVKdaS5AVVYHOoyblCMCEyxAso9EuS61YA9Nfr714CkcI3N8FV/BS6Ay6IPpJMBz5eUB/mNqjb30M2SlR9pZKC8dBjzVHff7BfMunJUKJ6H/7ptmKD/P4jB8pNIWAzuWvL3vA5Egs3uxu4H+8EZ0RY/0MApwxSaF7HvQEQRye4T4gf1o5KokuHXQykJekF+pel0/+GS8PU2xhEK+YyAlIbp1sEyn+5WASM2UpaaBXL/CZtaKvjtiS68gLZvI+Z1RE/gCA6HtcjBSNY3cACMIlEmw0i8/hAPqbiaHBNOIndYh9QSlrZfzPPcS4WolcdsNfgmMnMHHbp0iW7gdHMoUOhV5hLzEANAOHSKzKOpTn+E7PMoCy8FyaHyLGzIGpZhVF+tk654GMmsV+fAPoXIIUXqd2kouur8SZB/8mPXidgduPn0kNocf07OKMPxANDwhWMqrzaXNgwgLBB6veambBovYIs4/ObRd8rPPVSZ1Q551UiSQG23ad7mFyG0+cMuI5ktbYTyerBYY2vtOQ4Q19VUetTs93729BNODAjapP1F+7LsMjA+fo6Y7c/wloLtuYPvuBs6EebRA/lw4wGDtcZFnby1guMjuy4zdA7ewn9iem09h92U9UeFGO09VANIgknZ4O/wQplvepy4JLPpLRCoKcB8U/I2eANR1HPeRKf1oPiSwhLe2boViGBfKljKVKXQMO6E/JtSLWxIQg2dQRW+bsBH3DajQUxiRfho9Zos40C0IKvkX4yqSZAsD2Sy6QSopa0MJTrThrxnuaYq9KqW35DeMkrSw8IC8xPy1mvj7hW85FbI0wYDzVcn6UC3CH8gzpiCu91Vv3yKNA9clexjK3CnWTcG+jfy0Udx9RAOPB9falWTgQzqsxA8BxYrHy/cx83tSSZl1AFz54oxO1LuE3R7CwsxVd4oSC/74dxsJt5+DOB4qZ6X7q2Tq6efW1SrqX3QE3/K6zONWGK6raI6sVFHAO93Z+XwLp7D+3KBOs6Za3ITwLGHzTTJR/G5DnRQT2LlplmsT39pqAYpu8xlOmNmNu7pkxeOIs1p3pyCcdsZAfd8CItHafEa22vkyDIDxQYt0gtI6ppMSLmxGDBropRyjnbZoYpDvzZcd4fgHhadkzJtbR03xVP0tEEn8cI8e2re1U1+g6J+Ww6Fnho58g8B3vBnCsauK/7/Hzn8mLuaNLIIXFTv8skHSVDajGlzeeKEFcS3rBfMQL/yR2wIyUdMJ7yagX5aDD9eLtt6Z/Zp4CX/rx78btlOVUriO1WW5nWn0ea5vIr/IMHirIV0+/PmIhYF05kOkUPKB/ncWZf3LiphwKJlysG6IMdRDM1WX2RCrrVF1To/T/mCnwf0HHdY98 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: 13 Sep 2024 12:11:59.1021 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 09c89ea6-38a7-40d0-d4a1-08dcd3ed449f 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: CH1PEPF0000A348.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8512 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. Additionally, include a 'select' Kconfig entry as the current patch utilizes reg_slave and unreg_slave callbacks, which are controlled by IS_ENABLED(CONFIG_I2C_SLAVE). Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K --- drivers/i2c/busses/Kconfig | 1 + drivers/i2c/busses/i2c-amd-asf-plat.c | 185 ++++++++++++++++++++++++++ 2 files changed, 186 insertions(+) diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 03afcdbff209..9353946882db 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -98,6 +98,7 @@ config I2C_AMD_MP2 config I2C_AMD_ASF tristate "AMD ASF I2C Controller Support" depends on I2C_PIIX4 + select I2C_SLAVE help This option enables support for the AMD ASF (Alert Standard Format) I2C controller. The AMD ASF controller is an SMBus controller with diff --git a/drivers/i2c/busses/i2c-amd-asf-plat.c b/drivers/i2c/busses/i2c-amd-asf-plat.c index 3d80805a7a3e..aa85e10a3927 100644 --- a/drivers/i2c/busses/i2c-amd-asf-plat.c +++ b/drivers/i2c/busses/i2c-amd-asf-plat.c @@ -19,15 +19,199 @@ #include #include "i2c-piix4.h" +/* ASF register bits */ +#define ASF_SLV_LISTN 0 +#define ASF_SLV_INTR 1 +#define ASF_SLV_RST 4 +#define ASF_PEC_SP 5 +#define ASF_DATA_EN 7 +#define ASF_MSTR_EN 16 +#define ASF_CLK_EN 17 + +/* ASF address offsets */ +#define ASFLISADDR (9 + piix4_smba) +#define ASFSTA (0xA + piix4_smba) +#define ASFSLVSTA (0xD + piix4_smba) +#define ASFDATABNKSEL (0x13 + piix4_smba) +#define ASFSLVEN (0x15 + piix4_smba) + +#define ASF_BLOCK_MAX_BYTES 72 + static const char *amd_asf_port_name = " port 1"; struct amd_asf_dev { struct i2c_adapter adap; struct device *dev; + struct i2c_client *target; struct sb800_mmio_cfg mmio_cfg; struct resource *port_addr; }; +static void amd_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 amd_asf_update_bytes(struct amd_asf_dev *dev, u8 bit, bool set) +{ + unsigned long reg; + + reg = ioread32(dev->mmio_cfg.addr); + if (set) + set_bit(bit, ®); + else + clear_bit(bit, ®); + iowrite32(reg, dev->mmio_cfg.addr); +} + +static void amd_asf_setup_target(struct amd_asf_dev *dev) +{ + unsigned short piix4_smba = dev->port_addr->start; + + /* Reset both host and target before setting up */ + outb_p(0, SMBHSTSTS); + outb_p(0, ASFSLVSTA); + outb_p(0, ASFSTA); + + /* Update target address */ + amd_asf_update_bits(piix4_smba, ASF_SLV_LISTN, ASFLISADDR, true); + /* Enable target and set the clock */ + amd_asf_update_bytes(dev, ASF_MSTR_EN, false); + amd_asf_update_bytes(dev, ASF_CLK_EN, true); + /* Enable target interrupt */ + amd_asf_update_bits(piix4_smba, ASF_SLV_INTR, ASFSLVEN, true); + amd_asf_update_bits(piix4_smba, ASF_SLV_RST, ASFSLVEN, false); + /* Enable PEC and PEC append */ + amd_asf_update_bits(piix4_smba, ASF_DATA_EN, SMBHSTCNT, true); + amd_asf_update_bits(piix4_smba, ASF_PEC_SP, SMBHSTCNT, true); +} + +static s32 amd_asf_access(struct i2c_adapter *adap, u16 addr, u8 command, u8 *data) +{ + struct amd_asf_dev *dev = i2c_get_adapdata(adap); + unsigned short piix4_smba = dev->port_addr->start; + u8 i, len; + + outb_p((addr << 1), SMBHSTADD); + outb_p(command, SMBHSTCMD); + len = data[0]; + if (len == 0 || len > ASF_BLOCK_MAX_BYTES) + return -EINVAL; + + outb_p(len, SMBHSTDAT0); + /* Reset SMBBLKDAT */ + inb_p(SMBHSTCNT); + for (i = 1; i <= len; i++) + outb_p(data[i], SMBBLKDAT); + + outb_p(PIIX4_BLOCK_DATA, SMBHSTCNT); + /* Enable PEC and PEC append */ + amd_asf_update_bits(piix4_smba, ASF_DATA_EN, SMBHSTCNT, true); + amd_asf_update_bits(piix4_smba, ASF_PEC_SP, SMBHSTCNT, true); + + return piix4_transaction(adap, piix4_smba); +} + +static int amd_asf_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) +{ + struct amd_asf_dev *dev = i2c_get_adapdata(adap); + unsigned short piix4_smba = dev->port_addr->start; + u8 asf_data[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, "ASF: Read not supported\n"); + return -EOPNOTSUPP; + } + + /* Exclude the receive header and PEC */ + if (msgs->len > 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, &dev->mmio_cfg); + if (ret) + return ret; + + amd_asf_update_bits(piix4_smba, ASF_SLV_RST, ASFSLVEN, true); + amd_asf_update_bits(piix4_smba, ASF_SLV_LISTN, ASFLISADDR, false); + /* Clear ASF target status */ + outb_p(0, ASFSLVSTA); + + /* Enable ASF SMBus controller function */ + amd_asf_update_bytes(dev, ASF_MSTR_EN, true); + prev_port = piix4_sb800_port_sel(0, &dev->mmio_cfg); + ret = amd_asf_access(adap, msgs->addr, msgs[0].buf[0], asf_data); + piix4_sb800_port_sel(prev_port, &dev->mmio_cfg); + amd_asf_setup_target(dev); + piix4_sb800_region_release(&adap->dev, &dev->mmio_cfg); + return ret; +} + +static int amd_asf_reg_target(struct i2c_client *target) +{ + struct amd_asf_dev *dev = i2c_get_adapdata(target->adapter); + unsigned short piix4_smba = dev->port_addr->start; + int ret; + u8 reg; + + if (dev->target) + return -EBUSY; + + ret = piix4_sb800_region_request(&target->dev, &dev->mmio_cfg); + if (ret) + return ret; + + reg = (target->addr << 1) | BIT(0); + outb_p(reg, ASFLISADDR); + + amd_asf_setup_target(dev); + dev->target = target; + amd_asf_update_bits(piix4_smba, ASF_DATA_EN, ASFDATABNKSEL, false); + piix4_sb800_region_release(&target->dev, &dev->mmio_cfg); + + return 0; +} + +static int amd_asf_unreg_target(struct i2c_client *target) +{ + struct amd_asf_dev *dev = i2c_get_adapdata(target->adapter); + unsigned short piix4_smba = dev->port_addr->start; + + amd_asf_update_bits(piix4_smba, ASF_SLV_INTR, ASFSLVEN, false); + amd_asf_update_bits(piix4_smba, ASF_SLV_RST, ASFSLVEN, true); + dev->target = NULL; + + return 0; +} + +static u32 amd_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 amd_asf_smbus_algorithm = { + .master_xfer = amd_asf_xfer, + .reg_target = amd_asf_reg_target, + .unreg_target = amd_asf_unreg_target, + .functionality = amd_asf_func, +}; + static int amd_asf_probe(struct platform_device *pdev) { struct amd_asf_dev *asf_dev; @@ -45,6 +229,7 @@ static int amd_asf_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, -EINVAL, "missing IO resources\n"); asf_dev->adap.owner = THIS_MODULE; + asf_dev->adap.algo = &amd_asf_smbus_algorithm; asf_dev->adap.dev.parent = &pdev->dev; i2c_set_adapdata(&asf_dev->adap, asf_dev); From patchwork Fri Sep 13 12:11:08 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: 1985179 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=it+NZ7Jq; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:40f1:3f00::1; helo=sy.mirrors.kernel.org; envelope-from=linux-i2c+bounces-6714-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [IPv6:2604:1380:40f1:3f00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X4tTw2CD1z1y2L for ; Fri, 13 Sep 2024 22:12:20 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D879CB258AB for ; Fri, 13 Sep 2024 12:12:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 30B281D9340; Fri, 13 Sep 2024 12:12:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="it+NZ7Jq" X-Original-To: linux-i2c@vger.kernel.org Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2071.outbound.protection.outlook.com [40.107.101.71]) (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 35AF51D932F for ; Fri, 13 Sep 2024 12:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229528; cv=fail; b=SiV6dHNxRGnVZbhtQUfTDLJCIgS1jJWsKPGppLbgQ2QJuBbAif6JFKaC5pUp9QNeegGcgsy3yWDjydlEVaEipd8XsHsW6dT/buA1ZBZluFLOkgkwIinhGY5feZ5Vw4dQG94U8oDDTffHQEIi9QNpyqCWpB7Xy6MzQ8PpLPJ3AbY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229528; c=relaxed/simple; bh=4MB3QhWwseFIEG0aHskRBdMxe6Qr0aEuibazMqpsS6M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MsHMYnCmiOPU8M/dzt5yxbVw6ZMPL4w0aE7wwazkmRDf++MUXL0vLuRXUJFKODYvzr8brUFzowvScxW6HPIAbItc79k0TTEC9cTeW2y0HFVqYjHEoJFDsc0dytaTQb6OVT6ZAB3mgYGgWzftRqU3QuY3VvJ7wmOP0rpPNwbGUJg= 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=it+NZ7Jq; arc=fail smtp.client-ip=40.107.101.71 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bgq53i7zUtbb6aUeIidrLn5VTtrgwK4Kr2/vkDIBbe2sDow78bb7Q+R0Zq/jvgoAO6mnLVmjO1bcbqQWSYCGa/mMnG+E1gsq4JMC6hX1nHCaomBVGKmEHN8HFAEpvGh1X3HImOqWIylOSWlS0vDEk7T6kO7JhkzyBTCHkFQuAIbPabj3Y9+Yja5GrYKPOLqNQbiyD8f10OQPqIQ5uV6DK/maQ4JIZFdMu0tDcHiy2Ei9KyjKLj7MhN66Nihc64bPBP6jsKrWzuYQUMlCGqi2c5KVyzlhbMJWrxY4/By6K4zcFErdIAsz2JVs13KkI6D2UebOCclqRNo9RyxX0U4z9Q== 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=TFuMgtay9sTuMPD9zpjHF2whmryHFlELJznzRDfOEiM=; b=jpDMc3sOqFyyiPnVb4ARMNR8KqLwytRLWY1wUNp9zL3tfgxyLciTgz/NMZYggeXZXaVCvey7Cvq/Z5BGxgZyUtGyzlcViCReflxzeZa/AbbVPLbjFdlopqroSXvwOPuevJvyutEtPBvip7a+by0pdbGvhZLd2nMV835TIwfYaIaBIgR34AHriFrxekA1kSoRY4Gy7qNlhOe2Resx7RiiiJMI2oEMUqFj+qbjNTCB5enIhQAlBCBDV8tMTBD+itgD0i9oRaKNlcMSI/YtchISOisehyWho60lv0Eu6FEj4PGCg9bUZCjUuQGAsBKD9DwgUPIKyHZ3Jx+mi1Oa68E8JQ== 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=TFuMgtay9sTuMPD9zpjHF2whmryHFlELJznzRDfOEiM=; b=it+NZ7Jqy63Vvu4Hm/MiMdpCQ+xCrC3iChc1jYj7TG35gUCQ7TagQqAf9QzBhIXhQCwekdk6cutZ20p3sjYnBgi5LLWko9KzVLnEXaC8l+lxvPS2VoyqAls77FsNKbVCvDMCaT3Dtwd8zdibEFvrwxFpzxre6cr1a9BMZGufJlo= Received: from CH0PR03CA0259.namprd03.prod.outlook.com (2603:10b6:610:e5::24) by DS7PR12MB8322.namprd12.prod.outlook.com (2603:10b6:8:ed::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.25; Fri, 13 Sep 2024 12:12:01 +0000 Received: from CH1PEPF0000A34C.namprd04.prod.outlook.com (2603:10b6:610:e5:cafe::f0) by CH0PR03CA0259.outlook.office365.com (2603:10b6:610:e5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.27 via Frontend Transport; Fri, 13 Sep 2024 12:12:01 +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 CH1PEPF0000A34C.mail.protection.outlook.com (10.167.244.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Fri, 13 Sep 2024 12:12:01 +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; Fri, 13 Sep 2024 07:11:59 -0500 From: Shyam Sundar S K To: Jean Delvare , Andi Shyti CC: , , Andy Shevchenko , , Shyam Sundar S K Subject: [PATCH v5 6/8] i2c: amd-asf: Add routine to handle the ASF slave process Date: Fri, 13 Sep 2024 17:41:08 +0530 Message-ID: <20240913121110.1611340-7-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240913121110.1611340-1-Shyam-sundar.S-k@amd.com> References: <20240913121110.1611340-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000A34C:EE_|DS7PR12MB8322:EE_ X-MS-Office365-Filtering-Correlation-Id: 43aac748-ee4f-4754-1291-08dcd3ed461c 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: 1LinGCS9a0Ptvc2sq5VO5u4ZpCZDss0+PMS4xaFMXSzmG5OPiZAjXwJDj1Uf6L3tKo1hO/tc7AvzCXGe6jE7YlyZ1Vx1R108z+wI8dzF4iEXQM4Kwa6Uh/tM/p9OUnVGzykvilM5Nm9dpGTdp/DYvOA7OLZFebhj6Bi/mUZ9duWRMukWkABBVhNhrXkMyDTfTkW74SbX0Gc3L5gcZnivI7UXyLs9uN8oJFWhspxkcaFrmNv/s2CfJvYwcXThb97F/xlZmVuZGWrSiHFQmGtEtFgEqYP6Zsg1v/Gw0T74unlTN3Jani3+KJqIxQAbqsFwpG8NXyKQKB2h2XUqWnOFzSRiZuFzni/Y6Te9aM/ePDRZJ7u336mtpOcQ+AJGtcJZ2L2nBFFJOyS/xDyiaupkbSdVc1SmhHd2LXSxvPPhqOOqeXYPP7fzbnMZ7PIC0EMB8i3GQs6pAXjTVv68BHzkMrf8sCAkwOdjiEwG1dPWCmKbBIwG7C/Fginyepw5dnEkoAE76x9Tx5kl5iA46X7RxuoxcVYGl43EJml1JuGkL8WhAh0qRhvVWp+MnBIft1IhFF67DIh5VCyWLo0IyNbkKZ3YJ/VRELoBv0OQ4jM6apBi662BYSuyP7mExYb7irSqUBZ2uvBZbugPboEAspH0bBBkb3GfJmKvhyc0XfRZZuCK1681MhZWHXdz99/GkdJyyPoW29VruMWsNRVvH1vF4ytB3bm2x0MbxwSGTv/FQUNvMTYJqQofqyAndd/8D5ul6ukC7Vx1ULies0+ijudSBpsXt9149/OGFnKkOBo1deKBrFad7QOqJler0R4BNboLAN/ufppz6a98G3PQxr83BB0IsPtxRH4ms1djQRQmOplZ8PBho4LbuUk4P+irr7qyG2eLTU0v3f9SMqxdm4VeSnrL43iEg4jE72cDcGQK9D2qCZ92/usp3+zj4KBPyCtR7seIW7mf1e1pqqbHYCixpMtvY+a59sBFN1r28CEoAIxi52tOKytbKHuKAwfOfqXB3f4zirjS426+MKswz9OIOs+Q221o+it69azfwfMRMcEFWTYltP9EiN1XfnyXIipfXruEaitVjJRbJRwz6h4axI1r+GzGfNUDCGXCrcdiKjcmvHyHc/FMRNzTYT9Op3T4zTRMnqydlXTSv5u8xmJHtitfsDsxG9Oo13+Niz2thlkCXqubddJlKK/AIjYNzqnZmmgI44SITy2ueHj5axm+c77ea7ulTTnkznDdfAESB1sOimfs5QXaL0QSJ4vPAFA7w5qylPR1WlevBodKMjfASL3CzY5cp0rVax45hoGoj6sSY94ZJeHnSy1ZuJkYu8WoKRNXI8C9HmFRgqR6qaeKeFh2FddNm3ChK/3x7bwWszYRKWLygboehlZCj62dA7MQhtaiHV8WOQHtrWXj3920U/dnwm+0CFnQu1RqIeECFKvwUMPByhz+ClbnTuEAL7+a 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: 13 Sep 2024 12:12:01.5941 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43aac748-ee4f-4754-1291-08dcd3ed461c 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: CH1PEPF0000A34C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8322 Add support for handling ASF slave process events as described in the AMD ASF databook. This involves implementing the correct programming sequence to manage each ASF packet appropriately. Co-developed-by: Sanket Goswami Signed-off-by: Sanket Goswami Signed-off-by: Shyam Sundar S K --- drivers/i2c/busses/i2c-amd-asf-plat.c | 103 ++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/drivers/i2c/busses/i2c-amd-asf-plat.c b/drivers/i2c/busses/i2c-amd-asf-plat.c index aa85e10a3927..1beef717ef40 100644 --- a/drivers/i2c/busses/i2c-amd-asf-plat.c +++ b/drivers/i2c/busses/i2c-amd-asf-plat.c @@ -29,13 +29,17 @@ #define ASF_CLK_EN 17 /* 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) #define ASF_BLOCK_MAX_BYTES 72 +#define ASF_ERROR_STATUS 0xE static const char *amd_asf_port_name = " port 1"; @@ -43,10 +47,71 @@ struct amd_asf_dev { struct i2c_adapter adap; struct device *dev; struct i2c_client *target; + struct delayed_work work_buf; struct sb800_mmio_cfg mmio_cfg; struct resource *port_addr; }; +static void amd_asf_process_target(struct work_struct *work) +{ + struct amd_asf_dev *dev = container_of(work, struct amd_asf_dev, work_buf.work); + unsigned short piix4_smba = dev->port_addr->start; + u8 data[ASF_BLOCK_MAX_BYTES]; + u8 len, idx, val = 0; + u8 bank, reg, cmd; + + /* Read target status register */ + reg = inb_p(ASFSLVSTA); + + /* Check if no error bits are set in target status register */ + if (reg & ASF_ERROR_STATUS) { + /* Set bank as full */ + cmd = 0; + reg = reg | GENMASK(3, 2); + outb_p(reg, ASFDATABNKSEL); + } else { + /* Read data bank */ + reg = inb_p(ASFDATABNKSEL); + bank = (reg & BIT(3)) ? 1 : 0; + + /* 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 (idx = 0; idx < len; idx++) + data[idx] = 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); + } + } + + outb_p(0, ASFSETDATARDPTR); + if (cmd & BIT(0)) + return; + + i2c_slave_event(dev->target, I2C_SLAVE_WRITE_REQUESTED, &val); + for (idx = 0; idx < len; idx++) { + val = data[idx]; + i2c_slave_event(dev->target, I2C_SLAVE_WRITE_RECEIVED, &val); + } + i2c_slave_event(dev->target, I2C_SLAVE_STOP, &val); +} + static void amd_asf_update_bits(unsigned short piix4_smba, u8 bit, unsigned long offset, bool set) { @@ -212,9 +277,28 @@ static const struct i2c_algorithm amd_asf_smbus_algorithm = { .functionality = amd_asf_func, }; +static irqreturn_t amd_asf_irq_handler(int irq, void *ptr) +{ + struct amd_asf_dev *dev = ptr; + unsigned short piix4_smba = dev->port_addr->start; + u8 target_int = inb_p(ASFSTA); + + if (target_int & BIT(6)) { + /* Target Interrupt */ + outb_p(target_int | BIT(6), ASFSTA); + schedule_delayed_work(&dev->work_buf, HZ); + } else { + /* Controller Interrupt */ + amd_asf_update_bits(piix4_smba, ASF_SLV_INTR, SMBHSTSTS, true); + } + + return IRQ_HANDLED; +} + static int amd_asf_probe(struct platform_device *pdev) { struct amd_asf_dev *asf_dev; + int ret, irq; asf_dev = devm_kzalloc(&pdev->dev, sizeof(*asf_dev), GFP_KERNEL); if (!asf_dev) @@ -228,6 +312,17 @@ static int amd_asf_probe(struct platform_device *pdev) if (!asf_dev->port_addr) return dev_err_probe(&pdev->dev, -EINVAL, "missing IO resources\n"); + INIT_DELAYED_WORK(&asf_dev->work_buf, amd_asf_process_target); + + irq = platform_get_irq(pdev, 0); + if (!irq) + return dev_err_probe(&pdev->dev, -EINVAL, "missing IRQ resources\n"); + + ret = devm_request_irq(&pdev->dev, irq, amd_asf_irq_handler, IRQF_SHARED, + "amd_smbus_asf", asf_dev); + if (ret) + return dev_err_probe(&pdev->dev, ret, "Unable to request irq: %d for use\n", irq); + asf_dev->adap.owner = THIS_MODULE; asf_dev->adap.algo = &amd_asf_smbus_algorithm; asf_dev->adap.dev.parent = &pdev->dev; @@ -239,6 +334,13 @@ static int amd_asf_probe(struct platform_device *pdev) return devm_i2c_add_adapter(&pdev->dev, &asf_dev->adap); } +static void amd_asf_remove(struct platform_device *pdev) +{ + struct amd_asf_dev *dev = platform_get_drvdata(pdev); + + cancel_delayed_work_sync(&dev->work_buf); +} + static const struct acpi_device_id amd_asf_acpi_ids[] = { { "AMDI001A" }, { } @@ -251,6 +353,7 @@ static struct platform_driver amd_asf_driver = { .acpi_match_table = amd_asf_acpi_ids, }, .probe = amd_asf_probe, + .remove_new = amd_asf_remove, }; module_platform_driver(amd_asf_driver); From patchwork Fri Sep 13 12:11:09 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: 1985181 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=YJo4inhG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-i2c+bounces-6715-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X4tTx2RDhz1y1y for ; Fri, 13 Sep 2024 22:12:21 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0C59C281A9F for ; Fri, 13 Sep 2024 12:12:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 692921D9336; Fri, 13 Sep 2024 12:12:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="YJo4inhG" X-Original-To: linux-i2c@vger.kernel.org Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2080.outbound.protection.outlook.com [40.107.236.80]) (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 8C8001D9332 for ; Fri, 13 Sep 2024 12:12:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229530; cv=fail; b=ckCeTnVAWxKn0XV/gKLq7Wdq8oJSH25St8iS5wEswR7mdJBO32GNmfdLRos+W2geULd1DPb8RVwB6gNx85PP+SAFt1A6rhtMTxIzDSA05I5070n4CyRc/qa1+Fr07OvRhyaFjCZupA7xAxJlo+OliLr8iO/zlemVaaz5g8CwXGA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229530; c=relaxed/simple; bh=OP1BD53Je0i/jgmxahVD166WfibhSRfDCrlJVp42giA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fpKNtEp6nwd2odxzFi2Z6Kf+BBdPtg7zvsNuId9D7wTJgL+G2uSfWIyDBHm6CzBoVzJF/KC0j+fYDc7iy28Cr2d0wCfnHKgoeMZvrI4MoR1fhI0BLVsJNw/L02xn0ezGnHCL+nF9knCltawGDqeN1rIppBnd7UCp/XTJKnWCnBo= 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=YJo4inhG; arc=fail smtp.client-ip=40.107.236.80 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kLaDipz8U/ery8WBZOK/XHDMn/aRQHCnOxWJ/9lJR5WqCuLW7yTiEuBG1fdbW9uvUMMxP0/5yW3654spLdLctmrPbEZojgipm7aFGR5kR+lBZPm6CYobtSNTqOtpuCNwyn8WKJDFvXUnfJNtj8aVq8DmHuX5TiiXbDsjcxJ+g7NFVT3x+zQjtxt0cP27VrZKwKua0Q5vkTq6HVRyifANeB+KO2WsOxN4xNsaWb9RJ3EJzSCGjvlHw7X2ja4TR5LglMcxzHAEdF+YTuL/OCZXCAFva8URYpUfqId/5bAmhTKDgWu7knOql6+N93wRIDgvvux6u6GsrLwEYSI9Dboktg== 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=Sz473k80CoIcqFyKW0CCBwlqXr/sEuEO8OIifcx1CCY=; b=kvfDj/ow1vSvjsgsk5hQD4lDkvjuqYozmjzeLZsvqP6ZAAAg0mlxP6my2+4c7+2ulhqt4m8X7vCynBnvqKE9xDyKYQEF4uCxMZWYQs758Zar5O3NF7Ktjs7UwIcHVot5EnXZIgpSWD5YM5k+Loe6RLrglHIHcMSvo7oVnxmIUjeEcjakDyBiA8CR7La3TenximtiwCIRqP4JUfnKKr8fKncY5TTNDrxYLPvkE2/qWTr+4uoqHrw4U9c4X6EAeRCOe3IMFHwQYtj9z5XMY4M0LQwna2JqE5H0iT23I8FzcsxgtYBmSPpKsoMVIzWVwTmuW7qaMJ88AzIS5iwiz/za5w== 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=Sz473k80CoIcqFyKW0CCBwlqXr/sEuEO8OIifcx1CCY=; b=YJo4inhGULgfpyqPEmQRtQExSlyBYX41fLiKLufgunXNIXcbhcbFULTQUA6dEjjya8isc8kbeLgSdIp4fwSBlfL9/H6IBL87HvK6hFmwXOcV1XUOUQvCIL875RMaQ8cN1vvDuMaFJBibH33qS2Jyl41iuivEIA+lw09uZrTvm08= Received: from CH0PR03CA0248.namprd03.prod.outlook.com (2603:10b6:610:e5::13) by IA1PR12MB6211.namprd12.prod.outlook.com (2603:10b6:208:3e5::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.27; Fri, 13 Sep 2024 12:12:04 +0000 Received: from CH1PEPF0000A34C.namprd04.prod.outlook.com (2603:10b6:610:e5:cafe::ed) by CH0PR03CA0248.outlook.office365.com (2603:10b6:610:e5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.25 via Frontend Transport; Fri, 13 Sep 2024 12:12:04 +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 CH1PEPF0000A34C.mail.protection.outlook.com (10.167.244.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Fri, 13 Sep 2024 12:12:03 +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; Fri, 13 Sep 2024 07:12:01 -0500 From: Shyam Sundar S K To: Jean Delvare , Andi Shyti CC: , , Andy Shevchenko , , Shyam Sundar S K Subject: [PATCH v5 7/8] i2c: amd-asf: Clear remote IRR bit to get successive interrupt Date: Fri, 13 Sep 2024 17:41:09 +0530 Message-ID: <20240913121110.1611340-8-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240913121110.1611340-1-Shyam-sundar.S-k@amd.com> References: <20240913121110.1611340-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000A34C:EE_|IA1PR12MB6211:EE_ X-MS-Office365-Filtering-Correlation-Id: 551c03f4-ae79-445c-d9f4-08dcd3ed4788 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: mbBcJwD+ctaJUWtkYwPRYjI/nvla0O/njYschcOp9w00v5WG68l+Gf9vMUyACs1/pijk7w+ySoTDog4kcKxz/WWivBCP6Th0og8tVpz8e24R3V//AJO/3agk1lyV3f4Kjj8fhf4FVfpy726L+ds7gay9EDAVDvZUtw6pu5lgLUbdsQfAQqKo+nOq57F/QQOIr2WfydZv54HmMaOuqkKH+FuYQZQNABiEnlAO9wnI2QumDU6Bguseuw9JeGJcN+7+vIx4X9Qv6CITYvfOiFcNOkFoAGqOQPtLPC1BuAwkrOnXrDKpOk1PTPN6hny+pdJnNa9So0zWpk45yX2mWB4XkQnzXVMWLcimiQDIJBL6e5xEkxucHg2Qp1mveEwfmviPClGNDcM9Tl8QP5+EwfSdnXx7LZ5a9SfFFfx0WqAbwLALXOewaGSPnuDf0w4d4gT6fNVzuGeEhlugQmnr27pyaBA+PwAdk3tbAthxTWke8PGKNMi1/RkBLAqlld6RNgFWZoL+Vd95UuKJAxndxRueeHxTqD1bHz3uxIL2n5ymAHhWyV0PRjh+toubXvkPSRMWbgLLBlsfDlvfdMIu8FYSk/MuyvjF3fXg2wMbPBteEDXy8tUO467KXQDZntfnxtOly4eSxOGgmPtdVD4EHUpk8zVnlNKVxXilUoUWOfUBG2bDDeEo5nxOqzMfBuOTzwmiDmjkNi2S+M8n7xsCQ18aG5vG8l8occvgyMb9+tZ/vS3naXLUT40o80X5ij+U5TwC1cMWQoA0vBqqZ0bH/NlBG+QhhbubkLRlhtHgagPH+L9AP/+Z/USbUD4+VBm45q2ARIyI6Y8hLRKyylHH+RvO/R+EdsmCnZZ7JY6VwM6nra7I34Dc1ZWtVURZFDftKeIBgDZWYNT2oL4w0uuBMiC0PxrXRvZekfzbnscbIARF7+tr+hR+n76ug1BE1oGmmdzicBEXc2/0tqST7fliXd+tmOVA/6aAKa4H3+z6qIUyiUTf9gyFE3n8JTah8TWnGTEoRu8rwnJB7dvNqTF8IhsyQC+SjRuaTwBb6v4OnPWMU7cahRdP8hN9ig7j7AMMUR/cBvPhBTG+lGgKrMebKVivc7sPPotlnxsLb4VTw2g/FVBnvrXMBj4Cbw0BPEzcZXLBOlQiDxbybL4eDN1fd/TFNzsjlyU1s/LapU7XVyAeWwz9J4QeJNLlACpMMxbJQlB76Gt8LeMbPJRQtP6r2J8+Y8vn0GFY0znPLHHQUyPzdSQYowVw8uR31+I9+544e1mGn9F1zQICPspWBfjdTRpzi5aPGpDdchgKVIeu0GTdG5SZ5IvKs9wcO3gjtAZkE7FKQek7NMu7XiRYLWow/6Sb7t98t75deYlERtrbDyr6Zjn2sQc97K7s2+wc+c4+HhLuVxrb7EgMS02lc6TyeNIRwJpOFRxlHjNaNDyiIhSvp1POUVlYF65ZJFDLBl1S/FlX 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)(376014)(82310400026)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2024 12:12:03.9691 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 551c03f4-ae79-445c-d9f4-08dcd3ed4788 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: CH1PEPF0000A34C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6211 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-amd-asf-plat.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/i2c/busses/i2c-amd-asf-plat.c b/drivers/i2c/busses/i2c-amd-asf-plat.c index 1beef717ef40..77555416597f 100644 --- a/drivers/i2c/busses/i2c-amd-asf-plat.c +++ b/drivers/i2c/busses/i2c-amd-asf-plat.c @@ -45,6 +45,7 @@ static const char *amd_asf_port_name = " port 1"; struct amd_asf_dev { struct i2c_adapter adap; + void __iomem *eoi_base; struct device *dev; struct i2c_client *target; struct delayed_work work_buf; @@ -292,12 +293,14 @@ static irqreturn_t amd_asf_irq_handler(int irq, void *ptr) amd_asf_update_bits(piix4_smba, ASF_SLV_INTR, SMBHSTSTS, true); } + iowrite32(irq, dev->eoi_base); return IRQ_HANDLED; } static int amd_asf_probe(struct platform_device *pdev) { struct amd_asf_dev *asf_dev; + struct resource *eoi_addr; int ret, irq; asf_dev = devm_kzalloc(&pdev->dev, sizeof(*asf_dev), GFP_KERNEL); @@ -312,6 +315,14 @@ static int amd_asf_probe(struct platform_device *pdev) if (!asf_dev->port_addr) return dev_err_probe(&pdev->dev, -EINVAL, "missing IO resources\n"); + eoi_addr = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!eoi_addr) + return dev_err_probe(&pdev->dev, -EINVAL, "missing MEM resources\n"); + + asf_dev->eoi_base = devm_ioremap(&pdev->dev, eoi_addr->start, resource_size(eoi_addr)); + if (!asf_dev->eoi_base) + return dev_err_probe(&pdev->dev, -EBUSY, "failed mapping IO region\n"); + INIT_DELAYED_WORK(&asf_dev->work_buf, amd_asf_process_target); irq = platform_get_irq(pdev, 0); From patchwork Fri Sep 13 12:11:10 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: 1985182 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=YraOblDh; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=139.178.88.99; helo=sv.mirrors.kernel.org; envelope-from=linux-i2c+bounces-6716-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4X4tTy5wpNz1y1y for ; Fri, 13 Sep 2024 22:12:22 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7B545281988 for ; Fri, 13 Sep 2024 12:12:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 12FAD1D88B9; Fri, 13 Sep 2024 12:12:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="YraOblDh" X-Original-To: linux-i2c@vger.kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2073.outbound.protection.outlook.com [40.107.94.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 5A1561D932F for ; Fri, 13 Sep 2024 12:12:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229534; cv=fail; b=Pg4Nc3DXCd2g8NI1tOtVoF/oI56Z0JL7k1dnPajUDD7BXwPRWOW6zkKME0xPM+RJoFZTqOQgV220LSqAujS99PPv7xNjDJxH+o+1Hq2pTS6Kc4PmdpAhcAQ4u6zt085RvlYz1iHCTQ7OMym3Bj9657ngrd0yYQve1WUVDo4wJJU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229534; c=relaxed/simple; bh=0jASz4pDDI+7tLG85wbL6aIEUOlrpaUqP8MHVRtVURo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MqrVPYjSpKvmW+S7nHUI7Div1srjBWivC9kummTKOY/56lL40YTWAUMoOc2AXLlMK12YEfV7pAK+rmsTmk57ZsX9Cqw2R6kfvY2IlfL1+IHTy811BVbOu2+Toa668Oxpq9QcK8ekJnk0PWhPB2CBX5K1YZ+s4pE88TjjDld/eoE= 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=YraOblDh; arc=fail smtp.client-ip=40.107.94.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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=B39XbB+++mCFyrTjDQepzhbuZMaJ05W6HrUhajHWt4txiVurrlrsoVKeHxI1Jy0HPPBR1gho54fvbvgifvmh85yundGtrCIY8CMq7KtMriGpXu2NAxMsk5LbfKYuI79tA3M00M8+WEerVys6CeieN3J6oMfC7hJ2E8HJKM64ys6qcd2m2YNwZSwKwYTSklz7HrRC4JAKiMb3NPZPhj214faRYrxcGbymmGsW0CIyQXjsJYuYnHDIIXF3pP8wRsJMjg2osCjx8RPcLKHi1zwCeSkEr/E7eK6jTc14/0YIAYXrR22S/yHsGMyxMEmDDtLIKSQ4SXjzNEd4WdMxxNV+ew== 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=70uaL74fdj4TD6eP1KHBoDkBUeLL0nXwecX6kkmx1ac=; b=Uhc/bpI/t1vp0zDVl07q5VzusvajTKkmexsqL1cTxDwh0GxuKlwSLvuXtSm003A/Ss473CX16hBlP8DKLu9BEqpUbbTUQUfZCT8p5Ntw9ah94fZy0sa8YaL9nYWeJkwy/N46mBvCo16E9qm/BrdpItRmsYeyqu9+v63981c7aCBGxOgXGeyn/eao5tbm2qDavN30xN9S3WIod3aW6wB0VVNrlWrOyFTIbC9P/lEI1KXy4kIDRBVeNYUepd3jn+7SMzahspBCNWypLeozk7o6nlgx/1UDYLfNavi0PCc6fXH4A4wYdM6hllUbrSgiOONeFx0KQJRWhUJSMQDmmJ3i7Q== 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=70uaL74fdj4TD6eP1KHBoDkBUeLL0nXwecX6kkmx1ac=; b=YraOblDhns/JnVczj7mPiXdAK3KE5gndyJ8grLMA52qjuxcNCbz/gIC0/OsZewm1BpEbgmcFTittMdysJbTtb9rIjzVHykZHevldaABuLei/NXsLFDnWEJ5BimFs2sAh/hNFem02Q3rN5ft2VAcBn2z8zqwqvthIxVW51jMzhUw= Received: from CH2PR17CA0026.namprd17.prod.outlook.com (2603:10b6:610:53::36) by BL1PR12MB5873.namprd12.prod.outlook.com (2603:10b6:208:395::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.26; Fri, 13 Sep 2024 12:12:06 +0000 Received: from CH1PEPF0000A34B.namprd04.prod.outlook.com (2603:10b6:610:53:cafe::bc) by CH2PR17CA0026.outlook.office365.com (2603:10b6:610:53::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.27 via Frontend Transport; Fri, 13 Sep 2024 12:12:06 +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 CH1PEPF0000A34B.mail.protection.outlook.com (10.167.244.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Fri, 13 Sep 2024 12:12:06 +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; Fri, 13 Sep 2024 07:12:03 -0500 From: Shyam Sundar S K To: Jean Delvare , Andi Shyti CC: , , Andy Shevchenko , , Shyam Sundar S K Subject: [PATCH v5 8/8] MAINTAINERS: Add AMD ASF driver entry Date: Fri, 13 Sep 2024 17:41:10 +0530 Message-ID: <20240913121110.1611340-9-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240913121110.1611340-1-Shyam-sundar.S-k@amd.com> References: <20240913121110.1611340-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: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000A34B:EE_|BL1PR12MB5873:EE_ X-MS-Office365-Filtering-Correlation-Id: 818c3663-6dbe-4fc5-20a3-08dcd3ed4901 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: 4a/+6h2xZ7tCGfZmTm5s4HVzR/jOTM3gorcPiUgS8JFzFmdwgVj/PExvmuih4vaFF5eEgF/qaFTfobL2rjdZum4HCGjHsPSgsF3FMGL8dd4B2d6Xa0HwZ53iFIMjIGuHLucmYq8Rmrw0DgUCT+w31UjaXWA5+xaIbI+zxIw3nr/GDENChbbV5pKMIrMRT8n5RHmRmZq8E+jI3Btwb5IYustFS+s8xA2xXTd2dJ/N7JIEtvlp9MMFVVFJ7e2PAPjLTzErdmr2IN4onqZ8BsoiJj7PBtuYCnfwpLQzWO/90bOrqywu25hsdhYpVbXhlISrPCsqdQmj6zhyIqSJcHBJUyserczZ5voeB0lSmEQ79yFCs8FlnwxovqZvxko+sOGp1uCAaBYUrSVZfPoWzVwpKh/niEV1+DhZAeBfQ8yVoL95eDqd5PnvHFfAUC/i6YFJpGx2xFdC2n0Ji8piZ4EC4qGsHIUCqxavVu6jJwDhUkmh/CIk0JdXGb5dJmm0KGPIsFsSKYp8vDQj/ShCEx5TamIq31UrtfKHf38tK2TyTtSi0PCzZPamtDw9Gw7cT9+YfSbcAI1UzgWVXbmFNknw5KT74jP7I/jst1dCqQ07dT+HfK+k6xaZUH+RHoaEZv6UbW+7IIMAS3kcRaEa2yOYrgCyC3Wki2ckzXVe0qabx+x/S2qwNB71kQOkrZGUKBDD0M5KW7pkeeaI803nDf19Sh5Pal+J27QzUhKrCNxvAl4s/rHtZ4/RkZK0V6jEqGIBooz5PSb7W8CYCUe3ZKpuKSarG8UwmGUdlSNS6o8ciu0S1PqwF/BI11xzjjPoWinBtjfCm3yNruV4TKaD72yzYbCUzcblgbu2LQHfrIuWvXdu6iuE2WC0RmLNjsrWeAZk0fHtWFRFcMGD66uj/w98CDJWsi4iYdl3g+QG0OCZLsQFx4Lfd+JBkf9DJP9/c+QkMn8/+/G7XwlzkkwTtCZCDvTGJZ6B/8T/SCZvVgWFZ0u1mCVQg3t9Do03ZA39j0GB/wf8CW7TlpqGC2sqduIwjOx5fmepVeqQzk9i1U2vuboLG4FinlmgZH5bIS0qp9RG97WpP/MMrYKzoWZ7i8+/i/2nFkpZj/WInHIIE9CsKHBUy8E03E27GO3uYMvZtdnMO5Ese0HA35jVBwNigcSFQOUmyKi7bQDRQOwNF1djSFji191BWgKTUQaWgHAqCeA5UycVIyrNFiqe07i8guRgSBt0XNBSfMbWM10oF3cmTxvnY7ZxznnV/yc1+k3qjmb3NRgfqm3iZ9u2jkLRE4w1i5Z1xeGa5n5JHydMYjIztmbvfHOWs0Gegz33TV11dkTpcxdY0Kh9F2fqUf8t9VAePxn7zkVSLSxtS0C+2yBTeB/1zneJuoLYEiEa6EJS1HpfA+Upk6lasw0X6uBkEwhAhLo3QqXl/elFkaZ9vZ6KgCGg7797bjaeJ8ntd1PohoFf 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: 13 Sep 2024 12:12:06.4507 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 818c3663-6dbe-4fc5-20a3-08dcd3ed4901 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: CH1PEPF0000A34B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5873 Update the MAINTAINERS file with AMD ASF driver details. Signed-off-by: Shyam Sundar S K --- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3f348b71b9c9..18b8975dd058 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1082,6 +1082,12 @@ L: linux-i2c@vger.kernel.org S: Maintained F: drivers/i2c/busses/i2c-amd-mp2* +AMD ASF I2C DRIVER +M: Shyam Sundar S K +L: linux-i2c@vger.kernel.org +S: Maintained +F: drivers/i2c/busses/i2c-amd-asf-plat.c + AMD PDS CORE DRIVER M: Shannon Nelson M: Brett Creeley