From patchwork Wed Jul 24 07:12:45 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: 13740635 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 36059C3DA61 for ; Wed, 24 Jul 2024 07:13:44 +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=t3reDbMGzYjpZ55rJKGcFPS4DSItfYl5g274NYps3jo=; b=i4d7v/oWwgTco6 dtBBxdhGW/+0AKXGFWRM9uqT9qjwYmG7JxF1JyWp8RDHOHNzvINAk95ArPwMOGYEx4fURixx+5JJ5 ikCAmj/8w30EbZCOQFtDPHbLrQDUnt6EX/WnqKUTmMtpPGPv3Mnfecb+zv+z6uFB6WWBQe3P3L89j 7/GYYLHEKHDBWh4stMe7lNuOsdLhTFkoPP1JuWpuIXUXeibJYMj2d7EZfpYBeus7bnoElsDr3jLLO 1S5fyQEwuK5sEaJTexKmHGjGKngIoKpgyIuMSc/ZRnOETSp5EccQgYlDxI8tv26bmXuiqwFCVFSNr 6JdT7Smtt5NShp1oy/NA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWWBz-0000000EazR-3mz5; Wed, 24 Jul 2024 07:13:43 +0000 Received: from mail-bn8nam11on2060d.outbound.protection.outlook.com ([2a01:111:f403:2414::60d] helo=NAM11-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWWBx-0000000EawV-18ai for linux-i3c@lists.infradead.org; Wed, 24 Jul 2024 07:13:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=P1vAd1T3JIBhIRt+Nn46p6UwXhId4HyFmcjjP+PXcLhomddjRStVzwgUUIkg0wd7yQd4QMCUROXkFaS+tJXXUqW38AglqsCGfsVMoFzQa5NhKU4F1afKmGbtcYk+xf6KCRPqPiF+0Nh0vXyDK/0nWXhnvCI+HadAYYz4R9aMLxgS2hbgXPlNkZu+7ZocU4sDFRqovVtCbxJ9iSccuUfd3Nk+37Wsk/8goT5H3xQP8CDh/As1E3+lXGkimB48C8H2Sf5WoMhuPs3EWTzktSD+XDp5sXMFOI91Ed5vxeyQ28HWMG1QZueLYy2mdyiXO2vRZ6+EyBwzJPscKjzhZl0eQA== 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=eNndY+4j2BOeK7DkDZeVG2tG+e3ohDOcTGYuJJuDwLY=; b=HYrWBnXBXzDxXsBnbnzAPG7L2ODSQ3mXiqcr6p7qHU8a+yJ0v8gZWvrDfnNG26wU/+wZ2+twIO4xOQ/kDk9SELanS0kSICpqNOLk8cpshTMlaKLkQ4hB9gitmUwB9CABeCIPDkxWbIGVlE73Z/6O+kwoCZVnKm3I0EB9L2yNEoiwyTRpK+zxmDQ2lxWJ+v1LDkbaWlauwjgPj8mbBzx74m7milkkAnrHKLmix2rIIjrNIWTe4vPbu86dx6NG+IXgycQTauV6EwaEvDhJguDrR/4WiFyjdzq5yKGd7iD0W0wN3V/mF9ub20YS3wqNdBETj1TerTFJmDcbCbtdaBeWzA== 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=eNndY+4j2BOeK7DkDZeVG2tG+e3ohDOcTGYuJJuDwLY=; b=XlTiWPerwNgehjl2tep/rFRq2t3b2vN3YvzQ03FhyF5AKQlkaFH2jtJLarEtL1f8SY+F7ASfNdZQ6vmGmpgOQpusbvS84Mk5na8Vc2SQ4AWMIeGELsyvSrKfl0hlq6zhqv+VngM8pZa/jT6w7n1ASM2FNWYjAu7QejOq5N9FrOM= Received: from BYAPR01CA0071.prod.exchangelabs.com (2603:10b6:a03:94::48) by IA0PR12MB8931.namprd12.prod.outlook.com (2603:10b6:208:48a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29; Wed, 24 Jul 2024 07:13:35 +0000 Received: from SJ5PEPF000001D1.namprd05.prod.outlook.com (2603:10b6:a03:94:cafe::15) by BYAPR01CA0071.outlook.office365.com (2603:10b6:a03:94::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.29 via Frontend Transport; Wed, 24 Jul 2024 07:13:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by 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:35 +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:31 -0500 From: Shyam Sundar S K To: Alexandre Belloni , Jarkko Nikula CC: Guruvendra Punugupati , Krishnamoorthi M , , , Shyam Sundar S K Subject: [PATCH v2 5/5] i3c: mipi-i3c-hci: Add a quirk to set Response buffer threshold Date: Wed, 24 Jul 2024 12:42:45 +0530 Message-ID: <20240724071245.3833404-6-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> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] 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_|IA0PR12MB8931:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d07a187-95d6-4136-1ea8-08dcabb021ef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: BRUQfKaJMZo3X85JtlNMqLUQ8Ha9ijoJi+2yZYFDZFsrlXK7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l3a0byJ9Sc4UnNIVkJ0Rd9ULLEtA1E4Iy9wGXdLzW/4KSac+2JYQ84W2ul3k3UivOEnTkv+dHcxHl+HaezXSmXSE9y2EVaySM+OYWRpo32vpjDUR3nUuWnWgiwWXG6Hahk+lQ+rjGI0Ic0K8x+4hl6KSOmnkEqXEWIDfvkxrAIYy2yL/sbw5eRptIvuK4Kp9crynp02Vz3AePLP5LZRyPiEAn0Z/CPIfmZt66RAs3cu07eNYm0Nn0Q9OVrCOqk+6ENELOuQQ4P2UW+j8OtY/M1qWd2EK1teOskoplUXIqQ91QepRux9UxjnA+Qm/nEtuHDX+JRJxvVcnmY9lfqgrnqhMdSuiyvYrS2RoOc 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)(82310400026)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2024 07:13:35.0274 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d07a187-95d6-4136-1ea8-08dcabb021ef 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: IA0PR12MB8931 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240724_001341_372803_77B593B8 X-CRM114-Status: GOOD ( 15.15 ) 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 3320e6331c86..eef5059177f1 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_AMD_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 06a4d54a5a02..58c3643c6390 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_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 */ +#define HCI_QUIRK_AMD_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 6ce08f9c92a8..954cba95e4a4 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_AMD_PIO_MODE; hci->quirks |= HCI_QUIRK_AMD_OD_PP_TIMING; + hci->quirks |= HCI_QUIRK_AMD_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); +}