From patchwork Tue Aug 6 07:58:43 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: 13754544 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 95165C52D6D for ; Tue, 6 Aug 2024 07:59:30 +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=qhfZhxQpAb77yqEcOb3AMprWKbVMCYTQXuUbi7dwcHk=; b=lR275z0DD4dlri /IugAxPy/N/NtrDGWumjchWf49hYpvPo2fHmoRkf6PkN+aO/rDXwR905xfWYk7ztAwAIrunZMkG99 hXph3BI8KBb0r8pZgZkRUuTOrMaMhvkMAOrSFfGe1o64aYhSPyBDNYIpBX0ZWEVp+d6Z3l3tqJLlP ypSO6WUdqbZ+pzhO/iqfuWaNwmjchEASR8vG+1Bz8WqgWGHZV/qE5yZAqx3nDP7nwOsMf8JQ5Bn52 CzdBRv9aI6uqFemCVk14XzH63pNjWkjBfTnTFxXIgkiEr94xMLeIQTdORkSX8Ns7vmqS2BbMb0NUS icDo0y1nU+IwCUuCSm5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbF6Q-00000000rWk-1Klz; Tue, 06 Aug 2024 07:59:30 +0000 Received: from mail-co1nam11on20601.outbound.protection.outlook.com ([2a01:111:f403:2416::601] helo=NAM11-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbF6N-00000000rU9-0Sg1 for linux-i3c@lists.infradead.org; Tue, 06 Aug 2024 07:59:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yDRDjECauwaVln+sMuYrtyy+w3Cqro5Mp2VvAhADFGPbZcmgxCtgl+EQugxSxCmwpevZldBQcpONYsRU+22ZdyGWf3MTeu+O8ZSx6WQhkiGP2ps3HLVuVmb7sUGZkb9QHyYw0anEjPiKEV9okj5mkSM0Z+oibt9qUOSjIr7BtW2bvQIwDHXORTw7Ld0Y8JznZdW56lfJA4LjQC+K7hvSXSbhgs2mW3vrs4b02Qh9TVS77jCCJ1ILEKEs15nz9zDah0zVucXJWQ3xO3ippSP5eU6xvIy946Zzli9yCyaDneF6AxqXLFfQrN7pl3lw4ii6kzRhrzpT2Yw8dxxNalC8gw== 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=B+MpG3FQ6f6K1sK65Q3xCvKHWgQD8wi90mDlKI+icwk=; b=QqGe201aqsan39XNJMxNIbNaRvFnwPVf/O0qsK3KCIQDGj9InsvRxZa9Q4GNghCsqo7EhVMXZeggpVzbZ73bW9ri0YXnNhSwvQdKvYG6i+nVFsLBv1T9OwZ2i3qVNR+wbuTwXQaaxGJruL+uAECFh3chQvBf6UZSXFt8PXJADSS1QEdomS48qHNntZdFNO0ibh36AXfv/y4Xk78YpVIZSc7h38UzDXkpOSrGqxTZpkL6n2BWM9/yKZgXWVImrt3AgTCoGKo6FDqsXXpQuyfbSVhqM78vbwC5T9CGTxdGNrHV+m2wm6FiFKjGIQM9Rxtrgz/4RRvV7xwh0iPqOWTpew== 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=B+MpG3FQ6f6K1sK65Q3xCvKHWgQD8wi90mDlKI+icwk=; b=BNZTqeVsMNRrYqsumjenkxQ7q64aobJwTTGgC7B/eHS0m7TZt9dibyXVIEcY3g/jiCDYtxtucYp3th+un0n0gT2TaTELa6GAouXJ3vP3VtuS6u7C9HibG5zm7nCRvTKIIGfJrqJxUrWkx4AHBIS/x6D/6u1tOSsNkto9dagipqI= Received: from PH7PR03CA0001.namprd03.prod.outlook.com (2603:10b6:510:339::26) by CH2PR12MB4053.namprd12.prod.outlook.com (2603:10b6:610:7c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.27; Tue, 6 Aug 2024 07:59:20 +0000 Received: from SN1PEPF0002BA4C.namprd03.prod.outlook.com (2603:10b6:510:339::4) by PH7PR03CA0001.outlook.office365.com (2603:10b6:510:339::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.27 via Frontend Transport; Tue, 6 Aug 2024 07:59:20 +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 SN1PEPF0002BA4C.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7828.19 via Frontend Transport; Tue, 6 Aug 2024 07:59:20 +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; Tue, 6 Aug 2024 02:59:15 -0500 From: Shyam Sundar S K To: Alexandre Belloni , Jarkko Nikula CC: Guruvendra Punugupati , Krishnamoorthi M , , , Shyam Sundar S K Subject: [PATCH v3 5/5] i3c: mipi-i3c-hci: Add a quirk to set Response buffer threshold Date: Tue, 6 Aug 2024 13:28:43 +0530 Message-ID: <20240806075843.277969-6-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240806075843.277969-1-Shyam-sundar.S-k@amd.com> References: <20240806075843.277969-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: SN1PEPF0002BA4C:EE_|CH2PR12MB4053:EE_ X-MS-Office365-Filtering-Correlation-Id: 48b494f7-04d8-46ce-cc11-08dcb5edad8b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: kiaUt6MqE7x6OHy2j8tEYASPE5SjMzbVFxI9XmFD1TzX/XiLMCOMA3VsuPf4ZkfN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XZTbf98jBy0BFqNP03w0yDSlID/zKpceoNZTUEwszsYtIbsjwx/Kc1VT4hzPijyK8NtFJ+R0BqlUmCljxMzmROWuy8q2dn9jfuZJ7ZBozRegzKprIy/iD69yCXSd5TpKTyYb1sExsGiEXjoP7N8Ad/IuV0OXfm/cOxYVKK8tbjbckuYa8wZbkQr2P3TcaahpLSY/MYFTOLf+VKYNOMm2G/fUM5lxjBA8bK23wzWSMPQJ9tBh7NvLHeTX5TqnpzchnsvTfN6NprPJIKtwcMkd5ebfQB2g0tjyzx1O6Egs8lv6KUaoRKohtHjpPGBczDi9Jo3z5FmVqWNAQk00KH26jGRkv2uOwq8AojIJF 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)(1800799024)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Aug 2024 07:59:20.2483 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 48b494f7-04d8-46ce-cc11-08dcb5edad8b 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: SN1PEPF0002BA4C.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4053 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240806_005927_188308_BD8DEE51 X-CRM114-Status: GOOD ( 13.67 ) 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 current driver sets the response buffer threshold value to 1 (N+1, 2 DWORDS) in the QUEUE THRESHOLD register. However, the AMD I3C controller only generates interrupts when the response buffer threshold value is set to 0 (1 DWORD). Therefore, a quirk is added to set the response buffer threshold value to 0. 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/core.c | 4 ++++ drivers/i3c/master/mipi-i3c-hci/hci.h | 2 ++ drivers/i3c/master/mipi-i3c-hci/hci_quirks.c | 12 ++++++++++++ 3 files changed, 18 insertions(+) diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c index baec2c42e0e0..248f07f41c16 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -147,6 +147,10 @@ static int i3c_hci_bus_init(struct i3c_master_controller *m) if (ret) return ret; + /* Set RESP_BUF_THLD to 0(n) to get 1(n+1) response */ + if (hci->quirks & HCI_QUIRK_RESP_BUF_THLD) + amd_set_resp_buf_thld(hci); + reg_set(HC_CONTROL, HC_CONTROL_BUS_ENABLE); DBG("HC_CONTROL = %#x", reg_read(HC_CONTROL)); diff --git a/drivers/i3c/master/mipi-i3c-hci/hci.h b/drivers/i3c/master/mipi-i3c-hci/hci.h index e1a65cfb43c8..b6f1b97f9e04 100644 --- a/drivers/i3c/master/mipi-i3c-hci/hci.h +++ b/drivers/i3c/master/mipi-i3c-hci/hci.h @@ -142,6 +142,7 @@ struct i3c_hci_dev_data { #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 */ #define HCI_QUIRK_OD_PP_TIMING BIT(3) /* Set OD and PP timings for AMD platforms */ +#define HCI_QUIRK_RESP_BUF_THLD BIT(4) /* Set resp buf thld to 0 for AMD platforms */ /* global functions */ @@ -151,5 +152,6 @@ void mipi_i3c_hci_dct_index_reset(struct i3c_hci *hci); void amd_i3c_hci_quirks_init(struct i3c_hci *hci); void amd_set_od_pp_timing(struct i3c_hci *hci); +void amd_set_resp_buf_thld(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 index a222bfab0676..43210882ec4d 100644 --- a/drivers/i3c/master/mipi-i3c-hci/hci_quirks.c +++ b/drivers/i3c/master/mipi-i3c-hci/hci_quirks.c @@ -20,12 +20,15 @@ #define AMD_SCL_I3C_OD_TIMING 0x00cf00cf #define AMD_SCL_I3C_PP_TIMING 0x00160016 +#define QUEUE_THLD_CTRL 0xD0 + 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; hci->quirks |= HCI_QUIRK_OD_PP_TIMING; + hci->quirks |= HCI_QUIRK_RESP_BUF_THLD; } #endif } @@ -41,3 +44,12 @@ void amd_set_od_pp_timing(struct i3c_hci *hci) data |= W0_MASK(18, 16); reg_write(HCI_SDA_HOLD_SWITCH_DLY_TIMING, data); } + +void amd_set_resp_buf_thld(struct i3c_hci *hci) +{ + u32 data; + + data = reg_read(QUEUE_THLD_CTRL); + data = data & ~W0_MASK(15, 8); + reg_write(QUEUE_THLD_CTRL, data); +}