From nobody Thu Sep 19 01:19:36 2024 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2064.outbound.protection.outlook.com [40.107.93.64]) (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 5923E131E38 for ; Wed, 24 Jul 2024 07:13:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721805219; cv=fail; b=QZHo4J6gjApTS2x8GgUx30VnthxOU/5FhisHtMwbNYQlj/xCkCA1KkSdgTJ9M0JO0MXRwkUqVI3Z5gB0DVQm0L5xuhNk0TjQ6zj/WYwN8U23m296JXhaPic6xhjnFtDIBjLuB5QQpFvGimiHzyWtXYe9z3H19bPPVEtZDtlrcHw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721805219; c=relaxed/simple; bh=vpyad5LRMtEExHKtwLndVOY0s5do8BsSCBGVbCX5NWA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EWOXzRggU2ORuVNVK8+4YsDIEMpAOLi3YclXGZhlVXdJR0PcC9cDzrbZv8FXZItp6c0uygBh+7magrJr7nA3OnRmVGNC9G0hJb4YWe6tO9z9gs68a4PlGb/6IL29MF014TVy8dfucg6Tsyt4e2fwxADTgDD2zvVzMkiwvNJorwg= 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=G5CaaouT; arc=fail smtp.client-ip=40.107.93.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="G5CaaouT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iOzdIGzGYRXVj7zHGqtVF57ly/l8Qz/BnKU+zhnbmMRugfdIfVowUfEetw+XKTgcbU+Rc2iH6sV1j39Z0trH0dt56g0maWca4ZP6NCZeNkqiy9TASrRzMdIyzjHeduYc59eRxOvsmdLwGAw3MHk03dJs0MH7FkK8pGh3QeZDDgVvV5o/Lr7jLzuEdtCeBhqlYAdC38wC6ojJ1DGDD1ukcbfI9k9BSkuPEZrofLzesVj7aCTOiKuYQVpbAqRgpEMUUy3lnVQsqOoUFMtSm0CfTAFm0flf/9eEqwLICmClmJ5KyROe2XQZrxc/49GPanPg5cVQSZAkS6QGIfiXijbbvA== 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=ABM0PjwrBwECIs/E3JgSaaELkvIIKN7lkUEAryoaQlk=; b=o523q9HRqKNthE3AFZM9xUx035CYT3eyXX9YEfhzO1QOkvnytYK60JflG892jY1FxLxIRFYe9JW6BRB3SbiwO0IXTGqw0BT9+euFla+gAy//D49HBJGAsddK7SPrvRWK8I0Qd9t451TX9rGaZ4X/dIRCA2M48WcrpGzs6pjDa2VufNySYqEk+m5DP0OFYMqUBZ4er3G7HhsKLS72yh3K8AMv1Ir6V3B/NPhzspWtExSh2IrfdqOxblGDfjax3gvlIKhyaXDu1F6nn3rWqcCOGsWR3neF1gE5kydss3q887nihcTX9AVEQ3pUMO+a6wpbZW71aLDXvWSR4Yuyq/BLjA== 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=ABM0PjwrBwECIs/E3JgSaaELkvIIKN7lkUEAryoaQlk=; b=G5CaaouTPHG3G5BEnfpPyKa9pcVlKKybJg6GPyRgzqHrcF0GuiZX13BTUavgNoGPxUoW8JJrRxeZ8UEDKKMS4ygZBK+4FxX95OWNDskB+UM3wRZfiQreRraW4oZyiT6RLyiHWMg6G/2xxTIwp6JxD2kmkwgoaAldiHJ1PGLN5B4= Received: from BYAPR01CA0060.prod.exchangelabs.com (2603:10b6:a03:94::37) by PH7PR12MB7114.namprd12.prod.outlook.com (2603:10b6:510:1ed::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.28; Wed, 24 Jul 2024 07:13:32 +0000 Received: from SJ5PEPF000001D1.namprd05.prod.outlook.com (2603:10b6:a03:94:cafe::50) by BYAPR01CA0060.outlook.office365.com (2603:10b6:a03:94::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.28 via Frontend Transport; Wed, 24 Jul 2024 07:13:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF000001D1.mail.protection.outlook.com (10.167.242.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7784.11 via Frontend Transport; Wed, 24 Jul 2024 07:13:32 +0000 Received: from jatayu.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 24 Jul 2024 02:13:28 -0500 From: Shyam Sundar S K To: Alexandre Belloni , Jarkko Nikula CC: Guruvendra Punugupati , Krishnamoorthi M , , , Shyam Sundar S K Subject: [PATCH v2 4/5] i3c: mipi-i3c-hci: Add a quirk to set timing parameters Date: Wed, 24 Jul 2024 12:42:44 +0530 Message-ID: <20240724071245.3833404-5-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240724071245.3833404-1-Shyam-sundar.S-k@amd.com> References: <20240724071245.3833404-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: SJ5PEPF000001D1:EE_|PH7PR12MB7114:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b9eb17d-80ec-4f67-300f-08dcabb0205c 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: =?us-ascii?Q?Blv86NzydJXd0VjFUyces4mmMWbkMGCh3nwCTzqi6n/eDd99tMsexJ5pjn3r?= =?us-ascii?Q?bVF54awchIwClKb8nKkUXiiXdDWc7HuSl/DCNIVHqgM5t9Nmvq1V8NjAqmVs?= =?us-ascii?Q?D+hNZY7zsRppaLVvgNf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= =?us-ascii?Q?zKtvyvBlHuihhWtlikkCFgkTDLt9nLe4xrcfqV6/QjUlyEom2ixYQajXd9L7?= =?us-ascii?Q?Q6NYYUPTMHqV2J76A8gyvmdF8OZQS3fje7jCk4cqC1NIbFPu9KtyVc/1Bs8d?= =?us-ascii?Q?Bi+MrqZpmlEe3+k26QTKUWAb2pdvqGXuFbylchpD0uAeNRGJQI/T+f4n+HVF?= =?us-ascii?Q?Tqydkuy2Dv1gxD8HfFpHr4LwYm0rXqSjNOk+RbI3XWgHz6mSgrtU61gzFlhW?= =?us-ascii?Q?UCfUwPsqd772uWYFPVGNdB6FnUVuYgsdBp8NKsFdhc95ApYuG7VjC+Jjq4oc?= =?us-ascii?Q?qO2uQILt3en0QBmjhBL5bcooJGtYE5sfOQVTQW2LYtlp13piXj+l78Jlw7oo?= =?us-ascii?Q?gi+6M9U+PlPHhTKGfKEYIToXgtLS6L4Wpnp9+QdPFEtELGz6Dr/JsUMBei1O?= =?us-ascii?Q?uM1dpPv/GzkATn57ZX7ixhv02Fa3upIp?= 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: 24 Jul 2024 07:13:32.2930 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b9eb17d-80ec-4f67-300f-08dcabb0205c 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: SJ5PEPF000001D1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7114 Content-Type: text/plain; charset="utf-8" The AMD HCI controller is currently unstable at 12.5 MHz. To address this, a quirk is added to configure the clock rate to 9 MHz as a workaround, with proportional adjustments to the Open-Drain (OD) and Push-Pull (PP) values. Co-developed-by: Guruvendra Punugupati Signed-off-by: Guruvendra Punugupati Signed-off-by: Shyam Sundar S K --- drivers/i3c/master/mipi-i3c-hci/core.c | 4 ++ drivers/i3c/master/mipi-i3c-hci/hci.h | 2 + drivers/i3c/master/mipi-i3c-hci/hci_quirks.c | 43 ++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 drivers/i3c/master/mipi-i3c-hci/hci_quirks.c diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mi= pi-i3c-hci/core.c index ca9d4e2c80e6..3320e6331c86 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -783,6 +783,10 @@ static int i3c_hci_init(struct i3c_hci *hci) return ret; } =20 + /* Configure OD and PP timings for AMD platforms */ + if (hci->quirks & HCI_QUIRK_AMD_OD_PP_TIMING) + amd_set_od_pp_timing(hci); + return 0; } =20 diff --git a/drivers/i3c/master/mipi-i3c-hci/hci.h b/drivers/i3c/master/mip= i-i3c-hci/hci.h index 8e5af4e55de1..06a4d54a5a02 100644 --- a/drivers/i3c/master/mipi-i3c-hci/hci.h +++ b/drivers/i3c/master/mipi-i3c-hci/hci.h @@ -141,6 +141,7 @@ struct i3c_hci_dev_data { /* list of quirks */ #define HCI_QUIRK_RAW_CCC BIT(1) /* CCC framing must be explicit */ #define HCI_QUIRK_AMD_PIO_MODE BIT(2) /* Set PIO mode for AMD platforms = */ +#define HCI_QUIRK_AMD_OD_PP_TIMING BIT(3) /* Set OD and PP timings for AMD= platforms */ =20 =20 /* global functions */ @@ -149,5 +150,6 @@ void mipi_i3c_hci_pio_reset(struct i3c_hci *hci); void mipi_i3c_hci_dct_index_reset(struct i3c_hci *hci); =20 void amd_i3c_hci_quirks_init(struct i3c_hci *hci); +void amd_set_od_pp_timing(struct i3c_hci *hci); =20 #endif diff --git a/drivers/i3c/master/mipi-i3c-hci/hci_quirks.c b/drivers/i3c/mas= ter/mipi-i3c-hci/hci_quirks.c new file mode 100644 index 000000000000..6ce08f9c92a8 --- /dev/null +++ b/drivers/i3c/master/mipi-i3c-hci/hci_quirks.c @@ -0,0 +1,43 @@ +// 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" + +/* Timing registers */ +#define HCI_SCL_I3C_OD_TIMING 0x214 +#define HCI_SCL_I3C_PP_TIMING 0x218 +#define HCI_SDA_HOLD_SWITCH_DLY_TIMING 0x230 + +/* Timing values to configure 9MHz frequency */ +#define AMD_SCL_I3C_OD_TIMING 0x00cf00cf +#define AMD_SCL_I3C_PP_TIMING 0x00160016 + +void amd_i3c_hci_quirks_init(struct i3c_hci *hci) +{ +#if defined(CONFIG_X86) + if (boot_cpu_data.x86_vendor =3D=3D X86_VENDOR_AMD) { + hci->quirks |=3D HCI_QUIRK_AMD_PIO_MODE; + hci->quirks |=3D HCI_QUIRK_AMD_OD_PP_TIMING; + } +#endif +} + +void amd_set_od_pp_timing(struct i3c_hci *hci) +{ + u32 data; + + reg_write(HCI_SCL_I3C_OD_TIMING, AMD_SCL_I3C_OD_TIMING); + reg_write(HCI_SCL_I3C_PP_TIMING, AMD_SCL_I3C_PP_TIMING); + data =3D reg_read(HCI_SDA_HOLD_SWITCH_DLY_TIMING); + /* Configure maximum TX hold time */ + data |=3D W0_MASK(18, 16); + reg_write(HCI_SDA_HOLD_SWITCH_DLY_TIMING, data); +} --=20 2.25.1