From patchwork Wed Aug 7 05:23:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13755649 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3BE0CC52D71 for ; Wed, 7 Aug 2024 05:25:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=u691ApaMExGhTQ2FnUDPMYCWU7PBXz5jrUdwLeTWTKU=; b=kxh5zp+K2Uu5lQ +eOt9HBO7A8xq5J+x+9udssrOU4gu0shu0Zi0z3qJlnInRu/+Wnka66LzKvQJI/kVJMams5gcvHeZ J/h5xn+GpCr+AF5CLvCnE8D2ZeUfDcyeQwmJqQv3FJAFRnoxtrbUpmMnIHoPTh1bnKappIIxcMSUN 1xA5z00w5EjYWtuwBQrfpu4q2MFKehGgPTYgEfq2pzcIAW6nW5kHhmFm/yXPKPhdJ/XNVUde9y/at GogyRSCo2XZpfksEVZIiXGvvLF78bFKjypieJCKUhKpEycdobDv+sWoOdzDhl8hR+Zmrx8LXkM9nz Ul4Ve78EjwBkDiQcnVUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbZAi-00000003rM7-3zcY; Wed, 07 Aug 2024 05:25:16 +0000 Received: from mail-bn8nam12on2061e.outbound.protection.outlook.com ([2a01:111:f403:2418::61e] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbZAf-00000003rIb-1rux for linux-i3c@lists.infradead.org; Wed, 07 Aug 2024 05:25:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aYbp8UGUowJckJnfi5yuDU1NkqZwX+YMhO4mmMijLkQaYBlLMQ1q4SutL++C9mbekrnC4i6beqrgfqtDQj8a3Ik4TYdnKxzSvLhnpbLZDJD+yPLOPPzqVW9ONHuRCcZJLq5vXcapSNQAQJAdEmEZgy+5j91nA3C58330TuJV0HNQw9FTqR9gvc2f5T5A4EY3Ay2naqMGRNgEiq6T0hP8ydizwmSA4TfX2aEejbtoVFq6+/JPh96aZq9xUyTAUj8erB9yo4DxmMddoh9Rz+i+MMKq7USYfGrGxiXrcz+bF8Hbmxn2c2lfbGjGNrcTPkXrrZAfAL6sQQjOcRnVYGIrmg== 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=zvzbnoS4IqnMS3jMOr8EVpyDh2YGtwmr5hmnktC+l20=; b=pAbnxg0LqzjANp9dymc65arXI8PLEWdq7U24KLaz0QVgVYKdaJPC0ECLg2SF+AR4BDelFJZeYVVSy0fr9RF6Uof+EBMbZpHEsB7Ifpu4w4e6yz8DFBTm8po8B6EDF3bAIkihNE4jN9z6GIQZ4siaqToqZh1cckhrQpNyQ9GorlOruW6kihRatrH1eMn0ae2V9ZTUvFf8UYwD6OKYlgGoLsKDk1us1dlX2a/PDWVqVTshwbaihAw/lqlpA+s6YifdO7WeVMvMT2jnHoi5PBYWexzdH9f50yapUTFCyU8GuyBi+xm7gYCo1nDRDwriAk4zk9OgPz7a0bOOjTG4qAayvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=bootlin.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=zvzbnoS4IqnMS3jMOr8EVpyDh2YGtwmr5hmnktC+l20=; b=oGzarOldrsqOwIxFBOw/SvPyJ4cIhhauFdtYyBB9xlQ1B2wEOppAx28Er8dEAOE63dO74j8aSCi0h1P+d/mXw5p5g5hZ6iT0Kunmoh8sxGZQX+LR5YQCsMs5aU+de37R9yS5dF1iZKxeuuJonLFW3K6f0uMxeB7WqjYWnp21fyE= Received: from SA0PR12CA0022.namprd12.prod.outlook.com (2603:10b6:806:6f::27) by PH8PR12MB7446.namprd12.prod.outlook.com (2603:10b6:510:216::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Wed, 7 Aug 2024 05:25:05 +0000 Received: from SN1PEPF000397B0.namprd05.prod.outlook.com (2603:10b6:806:6f:cafe::2b) by SA0PR12CA0022.outlook.office365.com (2603:10b6:806:6f::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.24 via Frontend Transport; Wed, 7 Aug 2024 05:25:05 +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 SN1PEPF000397B0.mail.protection.outlook.com (10.167.248.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7828.19 via Frontend Transport; Wed, 7 Aug 2024 05:25:05 +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; Wed, 7 Aug 2024 00:24:58 -0500 From: Shyam Sundar S K To: Alexandre Belloni , Jarkko Nikula CC: Guruvendra Punugupati , Krishnamoorthi M , , , Shyam Sundar S K Subject: [PATCH RESEND v3 3/6] i3c: mipi-i3c-hci: Add a quirk to set PIO mode Date: Wed, 7 Aug 2024 10:53:56 +0530 Message-ID: <20240807052359.290046-4-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240807052359.290046-1-Shyam-sundar.S-k@amd.com> References: <20240807052359.290046-1-Shyam-sundar.S-k@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000397B0:EE_|PH8PR12MB7446:EE_ X-MS-Office365-Filtering-Correlation-Id: e619b7c5-e09a-43f3-6492-08dcb6a14b8e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: 5B2wb2bdWvBU3hT3lVLHGuKxQDcwSFU6phXvkVBUenrWPkFo3ZE8foC04jySyD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FNIE+a35lPi6z9cJ3MR9FY7vJvlhy7Tk4ueyS9z8GA/Fv94vEQCaFrHtQcx0gl6TLUFSbrSmZMiMrhHHYZWBXyQdHAPJ/C3fbJaUGAjkL+zSAQ9TOQCeGoY16cCsqbKCBvCKd/jDJiORAzm60K9YzkEMWdLqfKk27+aPgJcam6blaHTyzL3HxwjkFfDeawZCeG5IsmcaSb+1BreyyLL3Z8n/+heET67PrzRdR3RYoGdMjx8za2FYfMjzxpnLv0oq1CGXpTlzm7h3HKBODIYznSEYshcFcPVncX/K8Z+VECNbEHkLf0n4AiSumtrh3p0hSpRjXT/XSdqfsr 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)(376014)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2024 05:25:05.2599 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e619b7c5-e09a-43f3-6492-08dcb6a14b8e 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: SN1PEPF000397B0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7446 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240806_222513_605241_64EFDA79 X-CRM114-Status: GOOD ( 17.85 ) X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org The AMD HCI controller currently only supports PIO mode but exposes DMA rings to the OS, which leads to the controller being configured in DMA mode. To address this, add a quirk to avoid configuring the controller in DMA mode and default to PIO mode. Additionally, introduce a generic quirk infrastructure to the mipi-i3c-hci driver to facilitate seamless future quirk additions. Co-developed-by: Krishnamoorthi M Signed-off-by: Krishnamoorthi M Co-developed-by: Guruvendra Punugupati Signed-off-by: Guruvendra Punugupati Signed-off-by: Shyam Sundar S K --- drivers/i3c/master/mipi-i3c-hci/Makefile | 3 ++- drivers/i3c/master/mipi-i3c-hci/core.c | 7 +++++++ drivers/i3c/master/mipi-i3c-hci/hci.h | 2 ++ drivers/i3c/master/mipi-i3c-hci/hci_quirks.c | 20 ++++++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 drivers/i3c/master/mipi-i3c-hci/hci_quirks.c diff --git a/drivers/i3c/master/mipi-i3c-hci/Makefile b/drivers/i3c/master/mipi-i3c-hci/Makefile index a658e7b8262c..1f8cd5c48fde 100644 --- a/drivers/i3c/master/mipi-i3c-hci/Makefile +++ b/drivers/i3c/master/mipi-i3c-hci/Makefile @@ -3,4 +3,5 @@ obj-$(CONFIG_MIPI_I3C_HCI) += mipi-i3c-hci.o mipi-i3c-hci-y := core.o ext_caps.o pio.o dma.o \ cmd_v1.o cmd_v2.o \ - dat_v1.o dct_v1.o + dat_v1.o dct_v1.o \ + hci_quirks.o diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c index a16da70bdfe1..4926fde6087d 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -754,6 +754,13 @@ static int i3c_hci_init(struct i3c_hci *hci) return -EINVAL; } + /* Initialize quirks for AMD platforms */ + amd_i3c_hci_quirks_init(hci); + + regval = reg_read(HCI_VERSION); + if (hci->quirks & HCI_QUIRK_PIO_MODE) + hci->RHS_regs = NULL; + /* Try activating DMA operations first */ if (hci->RHS_regs) { reg_clear(HC_CONTROL, HC_CONTROL_PIO_MODE); diff --git a/drivers/i3c/master/mipi-i3c-hci/hci.h b/drivers/i3c/master/mipi-i3c-hci/hci.h index f94d95e024be..a7ea37f8f8e0 100644 --- a/drivers/i3c/master/mipi-i3c-hci/hci.h +++ b/drivers/i3c/master/mipi-i3c-hci/hci.h @@ -135,11 +135,13 @@ struct i3c_hci_dev_data { /* list of quirks */ #define HCI_QUIRK_RAW_CCC BIT(1) /* CCC framing must be explicit */ +#define HCI_QUIRK_PIO_MODE BIT(2) /* Set PIO mode for AMD platforms */ /* global functions */ void mipi_i3c_hci_resume(struct i3c_hci *hci); void mipi_i3c_hci_pio_reset(struct i3c_hci *hci); void mipi_i3c_hci_dct_index_reset(struct i3c_hci *hci); +void amd_i3c_hci_quirks_init(struct i3c_hci *hci); #endif diff --git a/drivers/i3c/master/mipi-i3c-hci/hci_quirks.c b/drivers/i3c/master/mipi-i3c-hci/hci_quirks.c new file mode 100644 index 000000000000..897c0231f585 --- /dev/null +++ b/drivers/i3c/master/mipi-i3c-hci/hci_quirks.c @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * I3C HCI Quirks + * + * Copyright 2024 Advanced Micro Devices, Inc. + * + * Authors: Shyam Sundar S K + * Guruvendra Punugupati + */ + +#include +#include "hci.h" + +void amd_i3c_hci_quirks_init(struct i3c_hci *hci) +{ +#if defined(CONFIG_X86) + if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) + hci->quirks |= HCI_QUIRK_PIO_MODE; +#endif +}