From patchwork Fri Aug 23 14:19:13 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: 13775299 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 15F56C5321E for ; Fri, 23 Aug 2024 14:21:10 +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=ts/ejWIIIYTBzds+0FSG8JZBtEYJyaK2OO9lRhVl9PY=; b=4QbqP1hMDbP+0D 3TxpE21hubYaRYfUZvjv2LRnczsaJEnCnJjl7+P2uNnV2tRj6L2SCcVZHxozh3tNgCtHFRav+7Ve7 +WZnYiWZmeGw+SdTyxJCOpE3+vDnj952Mqf67T2wVr8AZKhxkWdFbHJips3RDGapUYEhuO8XS+HT2 PQfmB3bV9k1B5gocWYpZCbBHYaX0w74SCjblP6DY5cNpR5Jwje7yaIGcEwoPJ2KwxkoZJl/1zNJ71 y0nA2Qe7B8z6u6rKMZeQLWhF7x9/IGvNE+AJqOzBiU4jrLMhMqLoJmDWbfaEF4s3U9Uupg+JwiRTG 6JpZ1H20RLqePfWG0MPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shVA5-0000000H4Ex-2kQx; Fri, 23 Aug 2024 14:21:09 +0000 Received: from mail-dm6nam11on2060d.outbound.protection.outlook.com ([2a01:111:f403:2415::60d] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shVA0-0000000H4Ay-2wCM for linux-i3c@lists.infradead.org; Fri, 23 Aug 2024 14:21:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZiN9DSESP+uOAmam+OEFJ9ZFce3XSB0tULdfOtRQ+mdSj2xJT8dNo6L7IOZxA2couKRcjgFPCUmZiEvcZMaO4A37/FO98sbtQC0oEs6m1aV6MYJjWj2A+feO+uzxfj1sd9d7khEHvzsdyTX2h3JsxXArPzQAy4cpUl+SJxjAFwJqmAbHGME19mFLQaDU7f0HlmYcEqEMgihSR1cDwHrXsm1eWMzwuCwwGMZc75VrC23MM8IC77htBhMCvmBocQ4H2rzvgpH3YHAA3hlL/6syKPzK80XQz28dpGUfTpGcQR+28uIh1Fzf4mKQwIzbnlWubN02789uuAnCHFJljJGVPA== 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=V2XNRZIHJv3vl0L1ghOR1iqJ+WQGba+DYJt1stgshww=; b=LWsWCNtvmwnva8XK8/AGushCcOge8MA5ClCBXtqaE4DRbSbYsjHLTlKvSSZtRxXgmjDtYX+udQhWOXUJl7a1FFbGZeeo6fAP5sOyDu+34Q0w9JMk6n/XVmWbSKTtpoRnXdrR/h4hWmjQeLIzxxQVRq9vAWSsD3Qj3rce+w4STevMjdxj1m7SdIp9gd0TI3dfVNeQOhoIgRDedq3FsMS25iJubWcI4IJXNqr4wpEOSWUma9BiPcX4FQWsX3b75TP4gXWLVSF0+pppCC+Dw3Z3x6SdS/18VunWyeRLmkxWowP7mNYjYMbONxGOc17E/PcJ4dbru48uKa94+1q3sHz0Dg== 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=V2XNRZIHJv3vl0L1ghOR1iqJ+WQGba+DYJt1stgshww=; b=fKI0xcf/1RDEIjgFYptOJrKMGJeSldg7YNBuyZUFfPFGKLtT8WUBgFzE1eL4pBo3PUHq8mm1AD/FvYaX09Aw5XXS0QTVl9MzZHKoyl4JZ60bXcuRVd7UdAlHl5IU+C7PWezTBnD5gUKlP6Od6Ly75vQ6rjVZEV8buny5uR6REIQ= Received: from DS7PR03CA0283.namprd03.prod.outlook.com (2603:10b6:5:3ad::18) by PH0PR12MB8798.namprd12.prod.outlook.com (2603:10b6:510:28d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.29; Fri, 23 Aug 2024 14:20:58 +0000 Received: from DS3PEPF0000C380.namprd04.prod.outlook.com (2603:10b6:5:3ad:cafe::6a) by DS7PR03CA0283.outlook.office365.com (2603:10b6:5:3ad::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21 via Frontend Transport; Fri, 23 Aug 2024 14:20:58 +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 DS3PEPF0000C380.mail.protection.outlook.com (10.167.23.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7897.11 via Frontend Transport; Fri, 23 Aug 2024 14:20:57 +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, 23 Aug 2024 09:20:55 -0500 From: Shyam Sundar S K To: Alexandre Belloni , Jarkko Nikula CC: Guruvendra Punugupati , Krishnamoorthi M , , , Shyam Sundar S K Subject: [PATCH v5 2/6] i3c: mipi-i3c-hci: Read HC_CONTROL_PIO_MODE only after i3c hci v1.1 Date: Fri, 23 Aug 2024 19:49:13 +0530 Message-ID: <20240823141917.692336-3-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823141917.692336-1-Shyam-sundar.S-k@amd.com> References: <20240823141917.692336-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: DS3PEPF0000C380:EE_|PH0PR12MB8798:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b55cd5e-cce7-48ff-3f55-08dcc37ecea9 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: sEcVVhWEvuZD0SUihixk6+yj2D/HRaZgtHRWd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nP0LsZbCIAT9wvvoqJHuf66DOgHq8Gy6Mf9R9r+VJhu6JpruZJilF+NlE5XF9DFel0AoV1K9ZX/TqA6wyBRQ4bG1dYM6o5rsdOnhyDRYvZ0L2FPB7vvVzRt83296u4jbePnCd/vdM8PQYvwFu4WRH2hfJjWTXoVom6DnDuMedQcO2U1vkmIfcpTkK9H+X8RplR48her2Ls6q/UhxYvBqHTL97IwRzhTaP28ydCRxkiZgokxE31YKkHXjuLMbFUhavwPebU0WxULLR8oBrbbHpsFCPA/KbpunuBIYq7LiSJd8hz4L1/bVU8ozvjv9lGj9K9TLY1C8qpmpm1okWdL0UEpvFAqzgYxdCJn1NeJgkTak 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: 23 Aug 2024 14:20:57.9324 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5b55cd5e-cce7-48ff-3f55-08dcc37ecea9 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: DS3PEPF0000C380.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8798 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_072105_261102_11F4CF0D X-CRM114-Status: GOOD ( 12.86 ) 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 HC_CONTROL_PIO_MODE bit was introduced in the HC_CONTROL register starting from version 1.1. Therefore, checking the HC_CONTROL_PIO_MODE bit on hardware that adheres to older specification revisions (i.e., versions earlier than 1.1) is incorrect. To address this, add an additional check to read the HCI version before attempting to read the HC_CONTROL_PIO_MODE status. Signed-off-by: Shyam Sundar S K --- drivers/i3c/master/mipi-i3c-hci/core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c index 07de1cecfa30..42d2362d072b 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -630,8 +630,8 @@ static irqreturn_t i3c_hci_irq_handler(int irq, void *dev_id) static int i3c_hci_init(struct i3c_hci *hci) { + bool size_in_dwords, pio_mode_support; u32 regval, offset; - bool size_in_dwords; int ret; /* Validate HCI hardware version */ @@ -753,10 +753,13 @@ static int i3c_hci_init(struct i3c_hci *hci) return -EINVAL; } + pio_mode_support = hci->version_major > 1 || + (hci->version_major == 1 && hci->version_minor > 0) ? true : false; + /* Try activating DMA operations first */ if (hci->RHS_regs) { reg_clear(HC_CONTROL, HC_CONTROL_PIO_MODE); - if (reg_read(HC_CONTROL) & HC_CONTROL_PIO_MODE) { + if (pio_mode_support && (reg_read(HC_CONTROL) & HC_CONTROL_PIO_MODE)) { dev_err(&hci->master.dev, "PIO mode is stuck\n"); ret = -EIO; } else { @@ -768,7 +771,7 @@ static int i3c_hci_init(struct i3c_hci *hci) /* If no DMA, try PIO */ if (!hci->io && hci->PIO_regs) { reg_set(HC_CONTROL, HC_CONTROL_PIO_MODE); - if (!(reg_read(HC_CONTROL) & HC_CONTROL_PIO_MODE)) { + if (pio_mode_support && !(reg_read(HC_CONTROL) & HC_CONTROL_PIO_MODE)) { dev_err(&hci->master.dev, "DMA mode is stuck\n"); ret = -EIO; } else {