From patchwork Mon Dec 27 07:45:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 12699581 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 7CE9CC433FE for ; Mon, 27 Dec 2021 07:49:27 +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=mLBGklZ+187nL7wt5R8TzhWfVr8f+41dWcxIdJoAW84=; b=TM383zxXcNhIPa aju9lG/vWhvFYRmuGPKWfS7785lnKZmKp41v0TMphGrcDLtQdwzkvfI+nq+hAhzzB2LL/19EEcnP1 cjKXO+cE2IOwFhSHmzcNxwQUl/sDF+rIqk6Zux/r5/5uzg0gbzQPlENc+xeG1dHRfTaaBVjnzPY4T afw7YoTPv8Ij+5YarQodp7kJB7rnIroWTtLz09FDnLc9a7v6HI4EwGgCopldv16ge1jrw6YrHnMrK S9sc+7lJdpufAFtX+KXmDwy4EMpDZ6ksyalb3mpSsl9ohYPzRLmiMrH3qoBX0NEykCXiW4xqNGeW0 TsgaubkCfI/68CBdLinA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1kl4-00GJoU-RD; Mon, 27 Dec 2021 07:49:26 +0000 Received: from mail-vi1eur05on2081.outbound.protection.outlook.com ([40.107.21.81] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1kl2-00GJmw-NG for linux-i3c@lists.infradead.org; Mon, 27 Dec 2021 07:49:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vt0fOPFW42nUTM7MvIWlZBu/WColTbIKpFdSEl87KBW6gywKG4ft5WpiW35ZP3ivymM3H44dgsvfutGcykT2qzDI5gCj+9+4PCqf+MyPftZTK9qF+CnyHUDimRUwR0cQXd3sR5WjtB76n8Yb1lU3kJUv2oYyUq16e6U+TGDX6YvFAVpO2L3UxuAiHyA6QSoe5XPM30Yhay7V+59F3y8NI5lzH4JHDrpMopaoJvvu5QXMLBAiVbaXPIS0DSxMbGMpkZk/9E7P74QmIm6T65lpUdAU2rrsFLsr7/6y6/oBGrniswEWeUulQ2f6icSrEfsBUWxVHpXv/BxWIz5Zrb7hFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=J85mFZmjgJNx2kYN80ps6fCJtFjo40Mi9coCpNaNvLo=; b=PUfClvaZLw+oOVkK/+YTzTP+wOwFXm8reZCrqE/+WXDVLfwH6oOr5SH5q9f8f+q3hSN3m5FOmZMVQiwFB5+Ky0lhw7VYpBxoYSSLEvVY/4qFIpfQ9uN71GhNjh3U/N3aF+26Qo8f80+NRPP98bYcFxPHgnZVGdOGY5fhN9jHszfgLtM5xB/AzCRNF3YZbgb1cxeDz4E241CyeZv7UY+px4pRZAAr+cZvtGT2oz2FzzxBe7MUc/Gvr+5I+avZL5/IIe6jJhUakOL0yltz8uCJZjwRAoy9V8/7AxeicDySqYpZatncwuJX26JfWCgZ54epeGCGnPf1edih86iNOk37WA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J85mFZmjgJNx2kYN80ps6fCJtFjo40Mi9coCpNaNvLo=; b=srUVKOu32PmSgrRqlgUIzKY/3WYeGnGALExZISLJTiMYLZ9rKAceK9tB6IETOI21pF4yWlonTklpJwFSWMSaH0b4Uk/+sYHYSAS9rwjM9aBf9MXX8xvJBCAG4sRB/gDgoDgb2S/3Aby5fWiuGvsVelA8+4CCSMU5VPIzoxRkacg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) by VI1PR04MB5629.eurprd04.prod.outlook.com (2603:10a6:803:de::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.18; Mon, 27 Dec 2021 07:49:19 +0000 Received: from VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748]) by VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748%5]) with mapi id 15.20.4823.022; Mon, 27 Dec 2021 07:49:19 +0000 From: Clark Wang To: miquel.raynal@bootlin.com Cc: conor.culhane@silvaco.com, alexandre.belloni@bootlin.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 1/8] i3c: master: svc: move module reset behind clk enable Date: Mon, 27 Dec 2021 15:45:22 +0800 Message-Id: <20211227074529.1660398-2-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211227074529.1660398-1-xiaoning.wang@nxp.com> References: <20211227074529.1660398-1-xiaoning.wang@nxp.com> X-ClientProxiedBy: SG2PR01CA0132.apcprd01.prod.exchangelabs.com (2603:1096:4:40::36) To VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fa863be0-a184-47e4-bc24-08d9c90d6384 X-MS-TrafficTypeDiagnostic: VI1PR04MB5629:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:813; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LijEE+OOirQRD2GGp01r+zMF3SQAwRaQEu7i6XN0p1uPhKlGD1QfZ0gHA41QFVMo0VAkym1KmuwVPUMiBrTEXwh5QWg4rT7egY1HpdMIcEOYAcmgDijKDN6fyHq7baGBmC8NuNpUGPVzgRJNN+vCbdLV1ujFQPlJxraEnIgaOhuiXRz2Y2RxHLIUphNkV1LRNrglqk8mCbcpTFh7XW7E6Oj7zmGVoSvjURV65wFOKwxwCx0wI9jglND0ME2asFVEdWybThCuztj1JesyNntGawceLlyFbQeRA78ik+CxDBljVzfq3cP9QnmqVlAGgkR/86Qe1ZA3Lm76XXYaaHBGB+OBtAJh5Y74VS2ncswconenb+AYJMT6jtsJW1DQITEBl93BPKUp/y37J5LksRufBzlZmdBeYTxzH/KqOVFTSfaRMzWYoWvFUyVb1okpplz/i6+5iYuVWtoZmu/7AdgItzGg1OuYMeshlLesGhcNjgTDnWMIUNGB9zxboxuMa5d/UUWD1QjR6re5zbFynEd0RPuvxBaPcOeucwRyH/5k/g+JfUVCRYqPHs7+8iNxRGLKVSSwcRQGCYMkRFR8co7CdlZNRrd9tKjjAccc9i1whD0xueSG/0Aait82bJUH9gi0ggFRKRkK0gk8OR+hfHzwwVJr/W1fhbJKAz3DYNuzdG/9KeOL8kwCrMnvNs6VsJOT+qrb6iAMY5ZIX0Cj6y3Flw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5631.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6506007)(26005)(2906002)(6916009)(83380400001)(86362001)(36756003)(66556008)(6486002)(66476007)(66946007)(8936002)(52116002)(4326008)(38350700002)(38100700002)(2616005)(186003)(508600001)(6666004)(8676002)(6512007)(1076003)(5660300002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: auG6ID/Fqy1rfcyGK3X4WSkQocpANdrF2ayyb9dFi22le1p1R2NYQTczJu34ZI39F50gPYKTgcpJR+L2T8pgEKKfHLPjweI+uZoOK1u4WTlVfODtr3K//irUDGy66ukCEr3C211s0eZ6lfep7HV4JTUkXfoyvB06/Iaz3vMK07pGp3LrtxNs1qs8616kj5qy60rRe/viStA6DVH0qkM76q6SyZ30N3vfUkY+1W21uLpnk/Kgf252enDRhbq119zQRR/rA5XR/5GaR6L7fPVrq4sF2Nvx/yAYtLH5k+QTUfMolLNy3eznKiGvNT/SM2qqxaOviKKzaeHc72r+4mJ4vaxvWCIHgf2JRldZUY3BrSOERXIyvfvYTSWgVuqe6umPG9wJyPcXiEM2r4X9Im2QEn01g8SGpdfYUfx80qRyth68yfjepSPbddoS6gJYMTSXf1Kefz+CV3k8b/eLbxIE47BOO+JIGClzkEt1aXhsnFfGeQN2zAeeKdCyUS1LuKeRzQRWbLW7ARjP7P1R5uKc1np8BksmxYQxUS2lZaBrnPXb5y1c7J1jB/5fQBz6gu9o7vvRQlSXfWZ6YbsCLpwHE48xJ82DNIanhXA22zKwn2+o0GKr4CVwZG0WVrahZJ3QhlVf2Pg/w5EueCg5bdzSLlZ9PstB5YTPCNxhTKeALPN97gQ00j3p//G1bWMuLhoeB8dKGcAhGESgSGHpwoZL15w9l2ehyiok9EEDHGQ4ls+zHRsVFUfq2Na6+FzyE1Dg0f2LumFNiytwEAp+KlqLDWP5v//j8R14U034TdScn6YyYZAGrMSWYAmJDfUYEkRdNnym0cNKgCWSRvxl1fCJFcMZ05vRHMszBFwuBzufZvnJyy7drqlPM92cV8x0BvjyopUu6Xx1Gc7dfH9U2k/MPxDj0lqAnJ4OQg2saVQDcqMg/lUly62vKufK3SIUB5NeJbye8O7VCVFiTXupUhu4+NmR0cZm6XzLh2vI3S8xMh9fobawZPVLMto1qCbGT67b+nk4zDEVvcuG6adYjzFheYzP9R8RfFcnTZABES3Hbv31UCxDoPy8eN7vr8oCu44INTl0ubTG5cpENdgiF0XoQf3/6PttCWrpK/l+iDohBnDiJgBOGpU7PyQmhUGPFUptrHFK5GSONWGXF9J0dk5S3hMFVMNlCg0byoLKYBgkPGgiWeA0jgPj9vvL7VkHfe3JtpJ11AbZ0nCl/QYVHXRutKvKnhlL8n6Wje7AdcGtEkMumvcjwrQ9uWxsz1TcYsscrzRV1xrSaDEi1uIRGiwEurBwYvdOIRCZSDX5UCiZfgHhvwp/pN92Nl6OZ+X969GfF1yqVz2H1qlo4q8D1xW4GlHUoiAevYpAJxO9D74hzSrnbb21n75erM750rs3lncPI+zGaJOAGLOtj8OHe5zMQCNQCCn3m/orvq1z8IfSxEgaIasniyRqMUTArdVtm2SCBv7j4suphcFSclPRVH6Z1nYL98tEGO7y9APqZ3aaogbLDkobwOeEWwQMDru8dZ5hqHfw031Xta8eNXz8aWcd2Yvkd1uZIyoGvXMnZCdRNQ7u9Vpqo3q1lDJhzD33rB6EQUm3hP03l+pae8eNQZE1VNpe2tgYB6idAQRtSNX9TaI= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa863be0-a184-47e4-bc24-08d9c90d6384 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5631.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2021 07:49:19.3855 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GLSZyK0ni5uax0u9SfS8DWB0lPMvKo3CA1p5SUAzsiD+TT8reCJS7rhGqwmwRT2ao9lfRe/M8RQxhXQjLICvIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5629 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211226_234924_792021_46098B67 X-CRM114-Status: UNSURE ( 9.37 ) X-CRM114-Notice: Please train this message. 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 Reset I3C module will R/W its regs, so enable its clocks first. Signed-off-by: Clark Wang Reviewed-by: Miquel Raynal Reviewed-by: Jun Li --- V5: No change. --- drivers/i3c/master/svc-i3c-master.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 879e5a64acaf..c25a372f6820 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -1381,8 +1381,6 @@ static int svc_i3c_master_probe(struct platform_device *pdev) master->dev = dev; - svc_i3c_master_reset(master); - ret = clk_prepare_enable(master->pclk); if (ret) return ret; @@ -1419,6 +1417,8 @@ static int svc_i3c_master_probe(struct platform_device *pdev) platform_set_drvdata(pdev, master); + svc_i3c_master_reset(master); + /* Register the master */ ret = i3c_master_register(&master->base, &pdev->dev, &svc_i3c_master_ops, false); From patchwork Mon Dec 27 07:45:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 12699582 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 A4376C433F5 for ; Mon, 27 Dec 2021 07:49:29 +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=+1GAlT0uTLLcp2aHTHEHUoaJXQJFE8q50gx4fop71fQ=; b=N2hMkT2ta5TMX/ OLA3YfmSfMNqSxBmM06xYYXryI2iOU8cqrGq3bt6ETGH2RwjVjV1zXhLXvCSzocsLaQMH3HN908yP 7po5o6Wrd1K/SNOYWT9Lh6cbW1V4+ea6aGsq4ozj6OBCeHclaX/sj6JlgUWjSTd1QR3b2z4frtS3G bnp/2t6sBTxXN+w3WRHPrlw0+xRPW7EDWk+Dcy6hPxT5XB2BzoKZQCHL3sR6bWGhd0DAp1gjQuroY Lf4SyUgUlyp09ul6HwubzajTlxp94QpEYYdbRNzqzWjSLxx9PREC9+zkLI3JKgBepYjEyctzs8CsX NXO/YzE/tea3EttZerPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1kl6-00GJpd-VS; Mon, 27 Dec 2021 07:49:28 +0000 Received: from mail-vi1eur05on2081.outbound.protection.outlook.com ([40.107.21.81] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1kl4-00GJmw-AI for linux-i3c@lists.infradead.org; Mon, 27 Dec 2021 07:49:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XC5WgogYSLAwBHn52bpLPF+l4os3YFO+H5ZXWCp+wtUImqfzuWXnrNAVvJaCK1LH14bNwq7cSCprLq9szXZ4lpRsvEj7rSTwOk5k8PrIe3K5VN/ov2P0w7aRD+siwMHORm63hA1JLX7hNz+EUqn+S65MjAASuHGaEklBY5+VPGoarboxup+0n1/XJMbvTK6LkFK6Zo1VDVXsOiCLjnsqB119qHecMR3N33JpLKtevYyHwkiiNyYs5a3/DDCAXpPt5p8a2Zf0P8oXmSe260i+h+Za/dFloMiYKPZRzImvZaiNhCc/RHJArnnTkmZw7WPaEoUPyadVBKSvVYPa8KjtgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=xamtvSS69zF6+fXUNR9DB2PrXOBmOr10jWFtmiAmeHA=; b=VvorUfSnVQiynKBvAlEfA66vkCglIvjymviSLhMeBDUM71ppvHy6vg2hhPXH3nLWul0f4sRtXAWIP4j3jBMJJvu5idou/xapRIWqsgO5mhHbJINdE2FD/yHs0Cf/9OQ8spobhoi5Clk2gKATAreKnfxjVQMYL5aSrsZqh5D4lr5N6fx6xqiBuOCHNr3mqLb5At8SaaDCkhknQU20UyzKTJmRs/NZgub68qoc+H8ezPyhjl2Zz+GxoWkbXQs0IsLHmCeGlikVouWFDC9VRGR4o8Rwxzu3jqHgL2PAhmm/TasPJch382sm0I6vITccFxIOZt0oLxyYBUxi+A987h1mCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xamtvSS69zF6+fXUNR9DB2PrXOBmOr10jWFtmiAmeHA=; b=PeIGqA6Bs9Iu9tQHR5bulnndEdy08VzsE73WrIEXCfqho1++7DaPrbWtQSHW2Pz4iL4+B1E5oeCIJle8AFqknvtX5wcppbXxxImmWFJZgL8DU7aMCc8PV3QGkml/Ttt7ZXUDbJMsAxeg2yBf41iSPVRw7D1gVbE6vbSLWQ1WWnw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) by VI1PR04MB5629.eurprd04.prod.outlook.com (2603:10a6:803:de::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.18; Mon, 27 Dec 2021 07:49:21 +0000 Received: from VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748]) by VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748%5]) with mapi id 15.20.4823.022; Mon, 27 Dec 2021 07:49:21 +0000 From: Clark Wang To: miquel.raynal@bootlin.com Cc: conor.culhane@silvaco.com, alexandre.belloni@bootlin.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 2/8] i3c: master: svc: fix atomic issue Date: Mon, 27 Dec 2021 15:45:23 +0800 Message-Id: <20211227074529.1660398-3-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211227074529.1660398-1-xiaoning.wang@nxp.com> References: <20211227074529.1660398-1-xiaoning.wang@nxp.com> X-ClientProxiedBy: SG2PR01CA0132.apcprd01.prod.exchangelabs.com (2603:1096:4:40::36) To VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 06c1b2ca-85ac-4346-db96-08d9c90d64e4 X-MS-TrafficTypeDiagnostic: VI1PR04MB5629:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OvCcJ2s2kXen0EkvNV5qAalkNmxzSLzbVkScJNCa/LyC775QAAEm3U/r3OSLP0zVp4T9I7e+bLs5vukQqMCVF/EcmVhxi1xKLdbhK/IGuP4iCkBspyV7/sOun7/TTQOoo95FTN7q2V9K9YMWcQJ0EyfEHT+4EOas0g7MYdRPzMvQ2GS7Bj5kErPrU+liZ6LtRj2I0ohrjXRjRLjPghUWSByREBM7xEubSdwnimS9M/vF5cuEuZgXzJnKXG7ET1qCEjYxhqS9QCclq6US0stTFX+RsvuzqBEHHCovJCae57eD2Qex7oBrySFk1+0Fft9ptxAu9rVx5hnQIPxnCQqF4p0gXAUCjZgcYok8PDXGEnlrpwu2ybkzOFtfYQ+iesXGf0cTZd1DSesfjC2ay6YffassjBm627hMH1pJCBYqk0aGBREJv9IOm1Zw2pyj2Go3/g1nqAgmkY0XouT/0OFBbA3iSRfvM8UZ5FFmGoHAd2Bek+gKYD+PDNuv+7HT+kpxlt3hRvwCfB8en/WYbNf5NyPyP1FH+b3R22VU1gtd4ZlnDqL2np/c53gKtBWIcAQyrj0hCG9y/S58mtVf7QaO91V7v3702iVPu5NIrFcvybUF/w4OmW5iIGk4qhk2lEF5xnjBJqJLndjVYJTzuBnOU2J/J5lV2Hhi8oExfwdN61EwmGe7yAs5YX1bRa+Fqj22WhZ67RKdSeVo9jtFC9L70Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5631.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6506007)(26005)(2906002)(6916009)(83380400001)(86362001)(36756003)(66556008)(6486002)(66476007)(66946007)(8936002)(52116002)(4326008)(38350700002)(38100700002)(2616005)(186003)(508600001)(8676002)(6512007)(1076003)(5660300002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: N80L6sboLEZwnPZcZYuy+UzEFwL7tdK7PAY/BlY1RddWfE4OE49oyByKGOPvOS3iNQrZ4ghtkhEFmgX5ytry6AmtRe74qDAhfyod85smiEjYWi3MFN9vIOCVDlwVc6/cLpQnseeRZcbEaFAyu4aFmkaswO3Ajsyjaw/cPM8Ti2wXH7BGd1uslbq+YsAkMuiq54kHuMcwild/DrhM91Zyu/D/QyNBMWvqEhohohY2iS+5ZI2diwkz3zQEc6hPK6VcPF5DfwQ9nWVS2RnhcpVpAfsKfEdXnp4n7pRp7NCntXYN0bKfRogxeUz4B5JV0VEpkVfGHA+4bsJxiGl48WKiro/X1L7tnqp1w5msDLUTF5b74BxkFdPEKkkgWutPxIcaZAuzTFgdK5qRiJWkgGY8Teh5NhzvxEZ+no6saardz5CL258U03a0TJoQhMlxBCCXzCM/L/U9If0FBPZwAXpvXA/uymascOiaXhR9++hsnSc6Bl5/TvhBSMzJcrIuPwRrp9ptz2VVMrMjB+0pIb1A3Jq65b5elJHKsLC2w8MaXL04Zpn1ZmirZmiZMjPFZ+EEvxxIts5ni5K0PRYXkFmpTd9d7byPLPOjjzBggMAZl9WohKc7sRjJZwpm+WBVdW39uQtj7ogBEw7YTktk8YVIfv9EnMHcGCu89vz0XWUGNqxVyl0Qu2NAoXGbiUy0wNpInaF3icg9aOrNgjENSGhlk5tYkhXK0gT74rN//rvItCfu6LIAPlMwkGUjMPRGE9Aczx2wmfREKiJRkZ6cfVhe+BC5UaNbpqbssX6+pQvWYsZm5b/6EWLL6XpiZ/9bDgGiA8kUrjeja3w2dTAwpCxS2DJ/o60hSEZm2Ubzbp+w4FFKIgydq3SvoV9QaMBRd0YTiJfYIlEDJPYas+t+XFjO5yxxESop3CjbNCeHqqy2xlpTlebi1Ajd7MJwtCAEqNzcC4RU0KSeW4jo42SNfGWMLi1t3emR3zCrkGFC6TQFNfWcuATh5EDQU9zDKkThnFEweWRhqk4kYag8wJzx+XDSsUc1ZTepnkXhAvV4DvwtgKGkRaU2ArdNn/PydeRSND8su3sxpCqrCsR1xuwlJCn9tzPfGd5npTPlkmQn7ycTkrH/1pQeNPvj3/527LGPyqsO0poUlshkqWXN81hJuQTX2BoXzE6BWdymunLpiSaRBGhFJHYueqp0Q78YDYCL6uxz+N4GrGmUVeBkXKyNzDdJbWxu0lx8NdpcICJexKK0rdBPTmZnCUV2ZbVNAJ6WIxbI7DpZpQJy1YsEua9YjXm+f4P+o/iFt0KyxjASQouW/iImSsfqTvd8DDluc6e/wIp1INi0CE+Mi3mv4kpmKwTxhX6HWuVZ3lDnAy6Rbg1JMwD8pEVjGyq1AM95zxzcj2UrTqe/1X+o79lptxZqamGEt6oJnNSxC/OMHdTOp2x+ox7NegTWhgQnGDAVsrPW+NJFwlpkH90ogy7VA0ZTYtPqV1ZpkCJ/52rhx09k/KwogqUfXJ5bpBtgEqIOXmlp06JuCiGl7CAC1MewD4rnKR24rYSrdZJ9YKc9CHTQ+P51Hm47PNumpQUfHVZbeW6U9Ym9TRstlrjpL/42j59DzrXPR2BTfWaq7QumIFb+GumuEmc= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06c1b2ca-85ac-4346-db96-08d9c90d64e4 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5631.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2021 07:49:21.5852 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nLC/meowtXmj4R1Zt2bNPKD5imdHFP9mrKSa13e3satWfoaz9ghfnLSI/9f5ct8dSlzBX8KA2qXcF8ofzhnnKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5629 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211226_234926_383389_CC415E86 X-CRM114-Status: GOOD ( 10.23 ) 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 do_daa_locked() function is in a spin lock environment, use readl_poll_timeout_atomic() to replace the origin readl_poll_timeout(). Signed-off-by: Clark Wang Reviewed-by: Miquel Raynal Reviewed-by: Jun Li --- V5: No change. --- drivers/i3c/master/svc-i3c-master.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index c25a372f6820..47c02a60cf62 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -656,8 +656,10 @@ static int svc_i3c_master_readb(struct svc_i3c_master *master, u8 *dst, u32 reg; for (i = 0; i < len; i++) { - ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg, - SVC_I3C_MSTATUS_RXPEND(reg), 0, 1000); + ret = readl_poll_timeout_atomic(master->regs + SVC_I3C_MSTATUS, + reg, + SVC_I3C_MSTATUS_RXPEND(reg), + 0, 1000); if (ret) return ret; @@ -687,10 +689,11 @@ static int svc_i3c_master_do_daa_locked(struct svc_i3c_master *master, * Either one slave will send its ID, or the assignment process * is done. */ - ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg, - SVC_I3C_MSTATUS_RXPEND(reg) | - SVC_I3C_MSTATUS_MCTRLDONE(reg), - 1, 1000); + ret = readl_poll_timeout_atomic(master->regs + SVC_I3C_MSTATUS, + reg, + SVC_I3C_MSTATUS_RXPEND(reg) | + SVC_I3C_MSTATUS_MCTRLDONE(reg), + 1, 1000); if (ret) return ret; @@ -744,11 +747,12 @@ static int svc_i3c_master_do_daa_locked(struct svc_i3c_master *master, } /* Wait for the slave to be ready to receive its address */ - ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg, - SVC_I3C_MSTATUS_MCTRLDONE(reg) && - SVC_I3C_MSTATUS_STATE_DAA(reg) && - SVC_I3C_MSTATUS_BETWEEN(reg), - 0, 1000); + ret = readl_poll_timeout_atomic(master->regs + SVC_I3C_MSTATUS, + reg, + SVC_I3C_MSTATUS_MCTRLDONE(reg) && + SVC_I3C_MSTATUS_STATE_DAA(reg) && + SVC_I3C_MSTATUS_BETWEEN(reg), + 0, 1000); if (ret) return ret; From patchwork Mon Dec 27 07:45:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 12699583 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 AA7F7C4332F for ; Mon, 27 Dec 2021 07:49: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=BCyN5IiZY97uEmaejCo59VO3uq7AFd+h7DFVQx3fz7o=; b=nIBJ3gCTCqVENm DVfMtjmUeobJ4HWFKk2Ak4mDaNyuhWqBMridOS/PwWDbW6e4Sw4pVxDt3tUsX+mjp2OGYdZdWS9sT Aw427BOQ8YOgX2drDG9qTvTUSTnh+q7teSjlDxEn0tQnMlEAMKF+Zh5x9N2NmNtw9rMKsADSMbZoP MbFKdwxXEcDL8+4HC2EPV7qU79tQoWxk1pwpojX7nKGO86X2YTwXrQJi+6RDErj7jEvagjVKe401j xnESBjbQUOl8GXQyPYeEiuox7RQkpgE3x40t6us+qRj3zl3daXr0BGTnKIHISLDaGVf+gvlbezVw9 CG2ySrTFp9LyNnasP0Fg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1kl8-00GJqD-4J; Mon, 27 Dec 2021 07:49:30 +0000 Received: from mail-vi1eur05on2081.outbound.protection.outlook.com ([40.107.21.81] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1kl5-00GJmw-VQ for linux-i3c@lists.infradead.org; Mon, 27 Dec 2021 07:49:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uq0zS6cLwpi4/xMGu3LDEZOSjSLsl0N+QVLvbmVtKnKrd1tJYO+6NVMyX+M9T6aeZqiwBevVaM8LjexK9gbaNOT6c1gBjwgjMkHeQC+BmBspIyQZmMg7lpqqnYRUpr9cKOXbMhq428tDBavrDf/TBHMLOMeB1HhWemtkrDB5QeKHtl9klph9DwOngRDQRPk0zj1YRL+OB0DtAe6/RXbmq+AjPZ2HyXP28vCdrzqwnt6x+grpRIlIH3pw5LX99IH51NCLJ4FfjVwPTDScvAYdgMZXX/S4DRtPmyB3eCw66Sqgez1CGkxf6wwP5+0wR5wdUGJteqCuQQXCt+mgjz69lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=QUfVU8ZlO1kArJwBMnFVhJEZ/Nog01cUdi63xgM03LM=; b=cJLIumQPiMZKWyoH6wmywf+VsynxiQ6VAI1vdO6wka/y3OTygsVE9dM7cghwZ8GtRvihWi0nQYwZyTbjgN++NJjp5CK2UOotpoGQdgKvFVKrNzVPYkF5dSy1oMwH4++hwRic1P5bfCpUUF4JcYpE3Q85Ku+bwavWq1b624FOrnvGLGzBWA+by/hziQHweXHQplU/vTHIf+J5WBsYoKGFbbRpAO2NB1r81n2GuRDwze4XKR8rpGadNdr/r7qN1VfsxEFIaYiNCT1EyuGqszBCjuk7iw9UwcNJVjTssayryRQEAIB5cRbVNBfBgqzGLGfpwER8TsJND68fIafna/JyyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QUfVU8ZlO1kArJwBMnFVhJEZ/Nog01cUdi63xgM03LM=; b=dOioepdAZYOyKXixHaUjPrpEgjC0dFnCTLdqi7cYuyVIUSun1iLHp0Sz86sVstv27dqA9JYW9IhgDOwevcoZ9BCStRFwf11jAXHoMdcG3MYdyoyNF3OIsoFj2Yve4kWR/Z9fOStQ6Dejp2SdYkygeJsWZfWJd6psBRZHaUUadwA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) by VI1PR04MB5629.eurprd04.prod.outlook.com (2603:10a6:803:de::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.18; Mon, 27 Dec 2021 07:49:23 +0000 Received: from VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748]) by VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748%5]) with mapi id 15.20.4823.022; Mon, 27 Dec 2021 07:49:23 +0000 From: Clark Wang To: miquel.raynal@bootlin.com Cc: conor.culhane@silvaco.com, alexandre.belloni@bootlin.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 3/8] i3c: master: svc: separate err, fifo and disable interrupt of reset function Date: Mon, 27 Dec 2021 15:45:24 +0800 Message-Id: <20211227074529.1660398-4-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211227074529.1660398-1-xiaoning.wang@nxp.com> References: <20211227074529.1660398-1-xiaoning.wang@nxp.com> X-ClientProxiedBy: SG2PR01CA0132.apcprd01.prod.exchangelabs.com (2603:1096:4:40::36) To VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f0fad1f3-5cac-4420-fc1f-08d9c90d6632 X-MS-TrafficTypeDiagnostic: VI1PR04MB5629:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1265; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bWhFOpj7Ho0j/VkGoXxJf18/P9F1WERRFY3qY3ShXvLV3DVFptNkOitzdXc2MkvAb9YTIPYQxeCgRchdUw/NMQAtYM3cvRiGxn8bhgHQS0qUZ1LjzYqB2mxV2Qq8/6bNfoy9HcL7hEu/MtPTCxdmZVsh19hK7vY3pXHJ2YmabXtYqyhaURNCJrhG0f5JCkMmzQhhFNPrL7NeA/5n7PfRoNvSWhaNxo9Q74nCQleOkfDxsvwPGsepNaQXdsgm6nNpMOXdi+5aUyFDVwU8eEH7VHXk9dEYFkO91AxWD8RYy7R4UF+8tACgULIymmKcuTCD0gfp2dkXep8KnBnzFxIf9rycBADM65Z8VruQ+WDYh1UzYcR9F8Pi2HhzL8dKs4TAE6r1xKAER6egnChWJbnpDQb6nOOKlQnURPEt+8oYY4Ijp5RPZCUWw2SdgGMBdxRAvgAbakd00HjD6FNKDR3ylJZdtmhUBXdX+ZxpYf7oaOPz68re4G+dmQJ+DmW2Qy8ICzOb/SDG7Wm6DrnrU6QHXJ0uPbe25YqchYPVfQ5otccvG2hWFKafUtZpONH8vR828QNyRy6OQF+wN0Vekj/4odHteCrwA0o4YsEBIp1q2RYPwkj9hK+FQicYQ6tSge+WmyHYRTVAzZOSwwbSXAXSOQlVWAALjBVcTeVKA0s8nBXRFJZAf1Xo2dR+KLDlD+ZxCyJWte0/uFIdlyhHRjT1Pg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5631.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6506007)(26005)(2906002)(6916009)(83380400001)(86362001)(36756003)(66556008)(6486002)(66476007)(66946007)(8936002)(52116002)(4326008)(38350700002)(38100700002)(2616005)(186003)(508600001)(8676002)(6512007)(1076003)(5660300002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BHqXBnXz9cEHZLDpohxSedwFWHP7cwZFm+6ETDeEnQPSFxjT94nhAc31b4eUGFcju7919M8RS63+u2bHthXR9IZVkQQm58JbzpE8ZbDFilaTN43As3/Jo2Wkn+XlyhkVR3odATOhTDoDHCMpspwUd2lIsmyFqiNnienRKhBSmcVj0Cyz4T3NXv/F5+y7EOLpVoP+0MEA8g/nhj+Jhou9XweXT6GmnOp3dRJqvKCsZCgIb5hL6KBmkdyNuyZxrnNk2HImlmt/gyEUZp9wXdMANAUkvuEWhVUg+U9IvaACnZSZ4Nn+EyniRoF7bpDGeXy8TZSaD1wsH16Z1NqebpEQFv5vQLiMGfdDdxWUgWKZXlpg9CsUW+jaIl3gQ1BlPdOq+LI0xR/rWrk1zuPlB8yAYVPtakvo0l39aJo+NDXdJYq4jrv51RIoqIr0Vhi2L6U+Sdo357oI8sJE4IlsVrd5PSA6HbcAdR28LeQbHtg965APPMuTL4dDVZ95s49YTrsbKzhMainMwHMj77yCSxBpwKFdfNclVTj+QQ1DFf6T9z8uuzFjM8n/kjxeCQN+UAmt2aeIoOV/Cg24YFhnP1B8uQyXPW346x3bGQKMv30B/70UR4iwmIiZ/YFDAqVOSSK9/f04n/4RgI7nZU2SF7jFuzb6ph6MxnLlbthFACHd2JZUQ5fks4oQ90qrPJd7U1tpUaKmQJlR1SA6yhF7yQhiPy8t7i5NeHcpcwhs2d9LxVzANaWsc8jYebLvaxGuD4JoZ4dMK68xFKS55mkwQtQnbaHtbPwTKx8ZysKsFxDRLYOrN98yIkKvq1Z63oEoOVGylOTzMpJBOPgBlbzis7om/pJYMsMSnZPD+LiCRwDAUoxiyBWRy7y4rh2AdnjWURReioA5qg1QiN/fAOfYxqHD+FWMi5Ime03zn4pm3ylNCHqqHt3uAdU0TgooPjQhj512xP4V/vRzDJwaKSjKQBq8RtfQA8dIPmFaLJ0imFl8fLGlildgfBpomc1oA9Hii+GGemDzz9P/w6RPn8SewXhnMzKR1RCCH9Ez82iRbjoGMmagg4PP+R5ANIj8NP7Ggz1J/K9vY3fVVnfz+GgqOU2xfWOm385UKkeRmDckBKBwGk/vtSbDcTWIECljoz9zKCHiU11YZ/E8hsp64iZr30qM2wRMyLff6BVT2crzHHv+DoHZZBCHYbKLi2oIudeUmPZBICdoR1Dt+M7wxQnlBNB4IF0y0gkDwaX/LALH2eQXHrsyDiFytxQrUqsjdzPdCwtmg1D3Pv3HwJtDfJgSBWsSAKBTrQNH7Dn2p6mXw223h95WUp2+ctjf32c7fKrmqVj7HQFtPHm5Qs0fIi+yGlbMJUdFGmfgU+sPHoTH4nnPQdVJ/9u5aXJnCsm9WRz4ji5Z4+zTQii3VXseJOmHQY17m9axoVL3JBHyO9p9k8e2mJxe27Z4BGayOfDN5oCahTY7Ph4l3nohrP+dEs7k/Xvzd4WgZnEMtLgEalXa0Tl1QLyyt1q6Ih5XTvQn5SzAf79KiTTozmGc3kezPAe7s+b4paZ4GEO88cQExIz66DzHsgdSCn3TlHNOtt9GMpJYv7Iw2IgIRcgJsHu0yCEFuOE69R33DxxlOoSaH8FKgxSBDUs= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0fad1f3-5cac-4420-fc1f-08d9c90d6632 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5631.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2021 07:49:23.7630 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: X5s0oqZXuM1DJA9NOCowG5JyHBz7Z4/j6QjdFjW2GsW+lMNz+yPEuhveHSBtL+ex4g2j6ARXus/VqFlig/XMQA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5629 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211226_234928_038419_C00F4B6C X-CRM114-Status: GOOD ( 11.93 ) 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 Sometimes only need to reset err and fifo regs, so split the origin reset function to three functions. Put them at the top of the file, to let more functions can call them. Signed-off-by: Clark Wang Reviewed-by: Miquel Raynal Reviewed-by: Jun Li --- V5: - add Miquel's reviewed tag --- drivers/i3c/master/svc-i3c-master.c | 59 +++++++++++++++++------------ 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 47c02a60cf62..4e69c691253d 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -236,6 +236,40 @@ static void svc_i3c_master_disable_interrupts(struct svc_i3c_master *master) writel(mask, master->regs + SVC_I3C_MINTCLR); } +static void svc_i3c_master_clear_merrwarn(struct svc_i3c_master *master) +{ + /* Clear pending warnings */ + writel(readl(master->regs + SVC_I3C_MERRWARN), + master->regs + SVC_I3C_MERRWARN); +} + +static void svc_i3c_master_flush_fifo(struct svc_i3c_master *master) +{ + /* Flush FIFOs */ + writel(SVC_I3C_MDATACTRL_FLUSHTB | SVC_I3C_MDATACTRL_FLUSHRB, + master->regs + SVC_I3C_MDATACTRL); +} + +static void svc_i3c_master_reset_fifo_trigger(struct svc_i3c_master *master) +{ + u32 reg; + + /* Set RX and TX tigger levels, flush FIFOs */ + reg = SVC_I3C_MDATACTRL_FLUSHTB | + SVC_I3C_MDATACTRL_FLUSHRB | + SVC_I3C_MDATACTRL_UNLOCK_TRIG | + SVC_I3C_MDATACTRL_TXTRIG_FIFO_NOT_FULL | + SVC_I3C_MDATACTRL_RXTRIG_FIFO_NOT_EMPTY; + writel(reg, master->regs + SVC_I3C_MDATACTRL); +} + +static void svc_i3c_master_reset(struct svc_i3c_master *master) +{ + svc_i3c_master_clear_merrwarn(master); + svc_i3c_master_reset_fifo_trigger(master); + svc_i3c_master_disable_interrupts(master); +} + static inline struct svc_i3c_master * to_svc_i3c_master(struct i3c_master_controller *master) { @@ -279,12 +313,6 @@ static void svc_i3c_master_emit_stop(struct svc_i3c_master *master) udelay(1); } -static void svc_i3c_master_clear_merrwarn(struct svc_i3c_master *master) -{ - writel(readl(master->regs + SVC_I3C_MERRWARN), - master->regs + SVC_I3C_MERRWARN); -} - static int svc_i3c_master_handle_ibi(struct svc_i3c_master *master, struct i3c_dev_desc *dev) { @@ -1334,25 +1362,6 @@ static const struct i3c_master_controller_ops svc_i3c_master_ops = { .disable_ibi = svc_i3c_master_disable_ibi, }; -static void svc_i3c_master_reset(struct svc_i3c_master *master) -{ - u32 reg; - - /* Clear pending warnings */ - writel(readl(master->regs + SVC_I3C_MERRWARN), - master->regs + SVC_I3C_MERRWARN); - - /* Set RX and TX tigger levels, flush FIFOs */ - reg = SVC_I3C_MDATACTRL_FLUSHTB | - SVC_I3C_MDATACTRL_FLUSHRB | - SVC_I3C_MDATACTRL_UNLOCK_TRIG | - SVC_I3C_MDATACTRL_TXTRIG_FIFO_NOT_FULL | - SVC_I3C_MDATACTRL_RXTRIG_FIFO_NOT_EMPTY; - writel(reg, master->regs + SVC_I3C_MDATACTRL); - - svc_i3c_master_disable_interrupts(master); -} - static int svc_i3c_master_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; From patchwork Mon Dec 27 07:45:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 12699584 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 DE5A3C433EF for ; Mon, 27 Dec 2021 07:49:32 +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=stFznLn4FpFal/e+xIjd9K2asN11zEtddx7ROw1z71M=; b=ccHvQ7TGxhIo5Q Hv3V4vbjCFTH90Q+zxQfGtC+XWfvaVYcZMSm9GW920LM9ivECj96aQTfFYnvii93DadB8cQ/BruT0 q/TyYc1uHW8pLhlh1SpNmfGRTClqy0e8vlNiV7VYpPtfGP5f90B0/GFN7nUigJkiOPuI/kD3mp5SX gYo9e70xVOWLGg7n8ltEEMbdRENjkHnDfty6tskIHkYoAJK5NhGsD2M28+9OrzoFqPgenhA7AoGe2 FNte/3txXssAKx6eSqppx5A+PXbjH5LM8k3iBeJ0dDi5lzffz4mfk8S8YGhjzIvpwcOM+Tavrdcel Mbk+zw+up3gtGVGZeyTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1klA-00GJrX-8f; Mon, 27 Dec 2021 07:49:32 +0000 Received: from mail-vi1eur05on2081.outbound.protection.outlook.com ([40.107.21.81] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1kl7-00GJmw-NQ for linux-i3c@lists.infradead.org; Mon, 27 Dec 2021 07:49:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RRxt7GiKSRtB1Eysvd7fH4OMQb+SArS1208OTqgbKCTa6CHlWPD4O7Cn83Ka5Tkw6OIXE0mTv3mzE9t6XQyAVn3rAMxmFXds7dRQk2uu56IzrXvWlz7F6zsq3EMTEEXipXnSeI3Yh9oA3FpXebrF8AezGTlWznMF5KmSYSBQNb8375oR2TN8Bjvq98OQBpvpbCTT4UF3cV3Shr0fxgLFDsLfzkr5LvEspfYWVg/o/6R0FBNbngweiAJzneWWrWuvsZGBhtJEAQbJk4QMUKmjcoilpflt2UPsLjIYiCf6KtpqPnu94qFxWXim+riLDjbN31KvsDdVYephxOurrOpf2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=xpZnMG1+kfLkBaskDPFF6YKFFgEPWAI0+c/nVqSd9EE=; b=Zgz69NjXPDU3Z8sjpSzCHldutm17r2yNUY0bCMlkUIUG32ztP8MgQ3Sn16Ig6cr97A1GN44zsPp0EdUZEW4EIvLAcQY7BF2nRR1uOGQL/+l5vCBOkHkWsfjvfpvvmpDZFctRkDT6gzXZ0eQr+KnhD7sAhJED5C3VlMQgCQ6ZgiexvRmZE9/lbbms+N882G5GOf+Rmsbal0Fyio7HxBTHdfkvUI93UAx6Q01FW9GpjbGgHxAy86MrrcgNMpFJ6iJGHg2eDkLL7qSp/fdJjz35Zlu3JHX0IT1Z6xo+ah03aouB6cf5JJOKEapMgAF0yLHzwDsHksLgC2rcLByb1u2X3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xpZnMG1+kfLkBaskDPFF6YKFFgEPWAI0+c/nVqSd9EE=; b=R3atoN8nbymawLqIbJXHcYKLO9jNjZ+tEJbT3dcKs32LKKzWuLZZKWzrc/Zlfm1QNKRlFaQtG1ZZQ68Glf5KXC7T4jPq2Aw5Go+31bfHIjNLrWIFketjkjtPdXFlZItetH5FCO+DkfmFG4JeWopgwlT382S5os2PF783e6u1Ko8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) by VI1PR04MB5629.eurprd04.prod.outlook.com (2603:10a6:803:de::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.18; Mon, 27 Dec 2021 07:49:26 +0000 Received: from VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748]) by VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748%5]) with mapi id 15.20.4823.022; Mon, 27 Dec 2021 07:49:26 +0000 From: Clark Wang To: miquel.raynal@bootlin.com Cc: conor.culhane@silvaco.com, alexandre.belloni@bootlin.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 4/8] i3c: master: svc: add support for slave to stop returning data Date: Mon, 27 Dec 2021 15:45:25 +0800 Message-Id: <20211227074529.1660398-5-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211227074529.1660398-1-xiaoning.wang@nxp.com> References: <20211227074529.1660398-1-xiaoning.wang@nxp.com> X-ClientProxiedBy: SG2PR01CA0132.apcprd01.prod.exchangelabs.com (2603:1096:4:40::36) To VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4e0fb193-c588-4ef2-4843-08d9c90d677f X-MS-TrafficTypeDiagnostic: VI1PR04MB5629:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i1XB1mArbp+hXugD3ix8zPuBzhm8/NZ6sPFbNdTr0tKKeSsFOwUIj0OQNFRiosYZMkFtvcUOdnmmeBUzIp+QJPRgyEifqW9uqhW81OLriW3XdmReVC/GGKy3Y8R98OczWMKqZCJTxAUfZWVFdnsHaK6h9FPGlsECQuedsM2muZS4Yg087ZbEYDRCBOw/c3Dgfk6szDfBD181vbA5vuxxOSsjQ1yix6UP4LWZbw8YjCXnMzuOGMrRjii+8Xk+z5e0mZ/MfRgzbB5FNa9JyiMzEQFGzQZQwuSkeXGF79jE0XPeBF7/MqaZFJwHNlmHIym1jUGaGKVh4z6JQQPGsUrvKhk/AhmMdJx9+FXShs24KGgjPv0jsSpwdjIzeM1DtpJqFEVM3LjTohPt+sOXVbAghO0e80HIVjpzYzQx3qu1gLXT/1j1pML6TQvd7+38BPGf6FjZ2jcZc+GffOHVzI3LUQC1cNAgPElenzD6ABH8vc/5bAPtKLiHOtfW1vJLPUKP0xmia1ijtGxwnPxHyvQPQ1fi/0JoFgS5Eqd5y/7lHZSFDwqNpj80NpGjX76TD+n7qC+TLce2qosb08r5AlXmN6eUHmvPeox2AfmVp4SRpyHqJMCNeKmSSyVq5jpQOPYTjr3kvAS6bHZZOnCoKlJvseOcX5W6Rg0+AiYUZeDJgcU073QVebn1soP3k112Z9DPXc3YP/ZU9QRI4hsGZ21YDQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5631.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6506007)(26005)(2906002)(6916009)(83380400001)(86362001)(36756003)(66556008)(6486002)(66476007)(66946007)(8936002)(52116002)(4326008)(38350700002)(38100700002)(2616005)(186003)(508600001)(8676002)(6512007)(1076003)(5660300002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: asDUq18vKbWQHDHg1UEZkdEXuSsa0dyF1B7QyL28Bpg2gzdp8tpeOS+18YU6PahZJ3nrxePPn9lrREFYxdHeI0bR2zQrFl8rR3gyjkMGdw7dxlUjb9RVpxE3Ekk8tyaPkw6OIDixnyGSNzDRpokBLRJJmb3sDU8CR1bcUTbKk9J3t63Z2hVlZO8NcozvJ+cWTyD8UcrCfYw28tKTOF+2v+gl17aW6ukmmiaTL8vtck7pUwZoJUkDXWrKok3r6Ogi58hs9fovrRhGcj3B4w2bHbh3NycKGbP8NlezWyPwTFvG+2MvZRSM7cQgaFcLOMVrnfL2Hbi/NLBYXhxxILnXOlf8Gqqmsr5ENvYuL5chgfNKd1gU4XQc9vgSgiUxd9kSn0ijvt8XIQKJSAF0McrogA/HM0cb2UdsvEDPKjiVCb7ZUQP5MMMaF3WAYKwr/KfUUn4PtaO+oTNHQmuxeWXsnoFvIVxt0QJgTfm69/e6M9CUBh918KbWQbdq491nVIOoatvFB7sVtF26hkt/Mr3SiNn9tKtqCYtfjW1pvylgnhMRdeXiDHyndu68QKDhVdpH1Vx3RyUMPR3ChyLQ8nfsUs0sbwDR1LpZtJShLZFh/93tI7YU9sojgi1LrrsutsbU77O8GwL4Hfzid7RSxQaGJ5I9QARkUvUFnVpG1LjWXO71KS0m3bPQySRGIpffytKGsCT//Lyt2mD/vNxXfewuDPLfni1TEhWXgGPgdPjH4Vi3UkMTI/iCBhnsgTfY2CYmOh0rqfSsEMugXKc8w5mCgvNE/DL9Oujs+8xBa9ADiTb7uOIq1W4YnhRJGsA0e2LIiSciZ1Vx+Dnd1mf4aNkPyw+yN8MbXhBd+Q8/BaeqjUlmyRGdFtbvEAFsONpoUP1YY0oQYw77uWd7u9rU0qJt20niDA3fodfy53zWZKtx+JmRsYdpRn7EhvS6lOadhtRVVtokrJXTxi6XEbW85eWKvpJGWA7sHKnAUmS8IdNtTEvq54QnibTaWiwVEXPi8iv5lpt8hDJH/KTQWPwzjGCQDyOxW7u6ZiCSPTITb7tdZot8z5Vx0cHLsy/Ljag1RLGHNwBFt2uVQrruP2aXYk08SQNHGDKOFPyAnBuapZZ3FGwvili5eca7egb8GPOvt2Z+qS89MhfK6QVRBT/PDzg5MORx9ivUmB6DDCZBLhtvNmXcctxoOO+QOnFKc5zOkJ18F9UASd2dpZ3+CEKybVMr4Rr3tW1wxcVPHp3TXeZ2D1jw0+mNqF36JMyqJQ5oRPqlnkCQAb0nzXpYvRl5VyAYU05j9XKhKvk6UpWS+u2D+0jmbvA9m1dWQHGI+f/hndwDh4oe8XPJpSigcJXAHXaFFjNHD5tWQneNMmkDyybqdBjruHY0pT1b3FDCeU1jA1oebC3eQNKbpKD9Hq+lsEGVPx+sB3Ey6pvGmLD3TNQb5gr5I6AU/O1guKppgoIAFFEujLHQcKpBoAn0TCOcJmXBWz704eYoEfZfmo5Tmgzu14SkbMHkuUlq4+8CUDqgR8thdWOksETy3wY+lFazRKFjRRsRgtHBLs/aPoQxDH3oOvEh7LMX3vl3nHgAHVIJUsj6psPoUv1qbghni7AnfTgmG6+6HH3YemJ1sfg/yAsim3c= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e0fb193-c588-4ef2-4843-08d9c90d677f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5631.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2021 07:49:25.9567 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UlO+nxzhefd2iqU+/1U1xQWg2WmO7gCQtPAnfwfgcQBNOXY63sbCL3DtkIpK0+I1uV2V7TCHPdb9nco27Pl2gg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5629 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211226_234929_795066_A38A2910 X-CRM114-Status: GOOD ( 17.38 ) 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 When i3c controller reads data from slave device, slave device can stop returning data with an ACK after any byte. Add this support for svc i3c controller. Otherwise, it will timeout when the slave device ends the read operation early. Signed-off-by: Clark Wang Reviewed-by: Jun Li Reviewed-by: Miquel Raynal --- V5: - remove <%s> in logs - add some spaces - !SVC_I3C_MSTATUS_STATE(reg) -> SVC_I3C_MSTATUS_STATE_IDLE(reg) --- drivers/i3c/master/svc-i3c-master.c | 56 ++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 4e69c691253d..74b38772d692 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -896,27 +896,35 @@ static int svc_i3c_master_do_daa(struct i3c_master_controller *m) static int svc_i3c_master_read(struct svc_i3c_master *master, u8 *in, unsigned int len) { - int offset = 0, i, ret; - u32 mdctrl; + int offset = 0, i; + u32 mdctrl, mstatus; + bool completed = false; + unsigned int count; + unsigned long start = jiffies; - while (offset < len) { - unsigned int count; + while (!completed) { + mstatus = readl(master->regs + SVC_I3C_MSTATUS); + if (SVC_I3C_MSTATUS_COMPLETE(mstatus) != 0) + completed = true; - ret = readl_poll_timeout(master->regs + SVC_I3C_MDATACTRL, - mdctrl, - !(mdctrl & SVC_I3C_MDATACTRL_RXEMPTY), - 0, 1000); - if (ret) - return ret; + if (time_after(jiffies, start + msecs_to_jiffies(1000))) { + dev_dbg(master->dev, "I3C read timeout\n"); + return -ETIMEDOUT; + } + mdctrl = readl(master->regs + SVC_I3C_MDATACTRL); count = SVC_I3C_MDATACTRL_RXCOUNT(mdctrl); + if (offset + count > len) { + dev_err(master->dev, "I3C receive length too long!\n"); + return -EINVAL; + } for (i = 0; i < count; i++) in[offset + i] = readl(master->regs + SVC_I3C_MRDATAB); offset += count; } - return 0; + return offset; } static int svc_i3c_master_write(struct svc_i3c_master *master, @@ -949,7 +957,7 @@ static int svc_i3c_master_write(struct svc_i3c_master *master, static int svc_i3c_master_xfer(struct svc_i3c_master *master, bool rnw, unsigned int xfer_type, u8 addr, u8 *in, const u8 *out, unsigned int xfer_len, - unsigned int read_len, bool continued) + unsigned int *read_len, bool continued) { u32 reg; int ret; @@ -959,7 +967,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, SVC_I3C_MCTRL_IBIRESP_NACK | SVC_I3C_MCTRL_DIR(rnw) | SVC_I3C_MCTRL_ADDR(addr) | - SVC_I3C_MCTRL_RDTERM(read_len), + SVC_I3C_MCTRL_RDTERM(*read_len), master->regs + SVC_I3C_MCTRL); ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg, @@ -971,17 +979,27 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, ret = svc_i3c_master_read(master, in, xfer_len); else ret = svc_i3c_master_write(master, out, xfer_len); - if (ret) + if (ret < 0) goto emit_stop; + if (rnw) + *read_len = ret; + ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg, SVC_I3C_MSTATUS_COMPLETE(reg), 0, 1000); if (ret) goto emit_stop; - if (!continued) + writel(SVC_I3C_MINT_COMPLETE, master->regs + SVC_I3C_MSTATUS); + + if (!continued) { svc_i3c_master_emit_stop(master); + /* Wait idle if stop is sent. */ + readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg, + SVC_I3C_MSTATUS_STATE_IDLE(reg), 0, 1000); + } + return 0; emit_stop: @@ -1039,12 +1057,15 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master) if (!xfer) return; + svc_i3c_master_clear_merrwarn(master); + svc_i3c_master_flush_fifo(master); + for (i = 0; i < xfer->ncmds; i++) { struct svc_i3c_cmd *cmd = &xfer->cmds[i]; ret = svc_i3c_master_xfer(master, cmd->rnw, xfer->type, cmd->addr, cmd->in, cmd->out, - cmd->len, cmd->read_len, + cmd->len, &cmd->read_len, cmd->continued); if (ret) break; @@ -1173,6 +1194,9 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master, if (!wait_for_completion_timeout(&xfer->comp, msecs_to_jiffies(1000))) svc_i3c_master_dequeue_xfer(master, xfer); + if (cmd->read_len != xfer_len) + ccc->dests[0].payload.len = cmd->read_len; + ret = xfer->ret; svc_i3c_master_free_xfer(xfer); From patchwork Mon Dec 27 07:45:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 12699585 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 EEC2CC433F5 for ; Mon, 27 Dec 2021 07:49:34 +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=O3D7spt94ypRMKh8aUbaoVx7RBiDQVAXzCcjRNfcjHY=; b=ZXEQfMj9TjpThe v/lLT7hiliczvnlluq0NjvNrvOECAJibwbvGPGNZm3Ujic5HkicfHxuuCeQBpAXEzH5YB/+Yp1Lau rt6NlJts2JdN18kyxjUfTncVRi9ylWAwLQHA3Po/2XtY/21Yl6VgXYDD4s79c3dOYK5tqFFgoY2qj ejfGvg5T3+Bl3onmnjzhYYFk3cp8he5HOTtHHM0l3zKlrWa4m+KmdSgiDEUaIPrgzBGdReCvmM0Ty WKVEkyY4NufRB9/qcAUUMHKL/pxIpoheoRvosuRwKBSV63EgL2/XlgoSG+GxnTBgHAZqiFZCR+/rH OCS1MZJtbEmaNHZfhW/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1klC-00GJsl-Ct; Mon, 27 Dec 2021 07:49:34 +0000 Received: from mail-vi1eur05on2081.outbound.protection.outlook.com ([40.107.21.81] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1kl9-00GJmw-Hx for linux-i3c@lists.infradead.org; Mon, 27 Dec 2021 07:49:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N1AcN4SBHgQ1yHO3gfrImedY3/UJLP8wDGC5hI5n1QoMHyjXZMjTA2PzvUCLnpr4MtsOsw7Qo55+rtNfhi5XU7nSA0ONsbrWfwiw9gHlVL9igNKQEobqqeCQlEnBzghnOMlgX0uY1Pa0h/IVkonfvx0xXWe0Sdjbzrf6DU0L+mxM8x3tfz3WzAujqmIAO6zvvQr9P0jaSm/M/INq4hHWK8swtNTkVIZjRGzdq5klncrb1g31/u8yZHafygVSOt2XoX5agyyzjH5KMgX4T838Kb6kQR6lkBUNEYjOCj8Yb5UOsXxEI2yx/OtIhzoaUIl39MX4tP9AdfGKLYtOADUdkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=xrla7n5i7KUZGtYAELn/2sYg1nmTTmWaoDIY8GDqCE8=; b=EjRk1qAsOpFSzDTvv3x58gfkRc4UXetvjxSG7chLVOxj98uC1/+t92lD6hvuJbm/fZ7mS6sOaYbyedzdoRf7vbp6qpwCFt+UMNXE3sXg3lYjdWTMqnbm6ZBzCIqtM26z+qrYpEr6R07+LRSAOKPMsDRqWop725IMgzlwM8C/+a7htY0DDYn3/nymbdX9qzE2JIfkz9RuiIQtB1HNF4zSu/Bo3D3QxpdTobbDvLUUVQ3cMR4Q/tmfNr9bCbeqT4qV4UCwKFcfmInfqAd0rsZ76VTgZdBC99wjGYPfNQLCMVChvBDfhAksuOheXFNoVuKUjxp1trn06utIuTfuNhJP2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xrla7n5i7KUZGtYAELn/2sYg1nmTTmWaoDIY8GDqCE8=; b=iv4jIGqKMrNPhmtnmaFf8LMEGSAgdtcgZStmLF9OGzOVBf3zmAMo/9uU2kUjjaXCFpy0AjOTs07/zkWWHgQZ0c5UWfxovFx63GJqOe8QCqDaranvyxtswaZAHsoOjpj2yi1w31/pDp8COR1fjGovMpqCrWvUbqOBhpgBeu2oU7M= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) by VI1PR04MB5629.eurprd04.prod.outlook.com (2603:10a6:803:de::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.18; Mon, 27 Dec 2021 07:49:28 +0000 Received: from VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748]) by VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748%5]) with mapi id 15.20.4823.022; Mon, 27 Dec 2021 07:49:28 +0000 From: Clark Wang To: miquel.raynal@bootlin.com Cc: conor.culhane@silvaco.com, alexandre.belloni@bootlin.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 5/8] i3c: master: svc: set ODSTOP to let I2C device see the STOP signal Date: Mon, 27 Dec 2021 15:45:26 +0800 Message-Id: <20211227074529.1660398-6-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211227074529.1660398-1-xiaoning.wang@nxp.com> References: <20211227074529.1660398-1-xiaoning.wang@nxp.com> X-ClientProxiedBy: SG2PR01CA0132.apcprd01.prod.exchangelabs.com (2603:1096:4:40::36) To VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5dc0b8b0-7324-41e9-7a2f-08d9c90d68ce X-MS-TrafficTypeDiagnostic: VI1PR04MB5629:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1148; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gs3gq53PwEeziYfkPTHDySK8cESJ51iqg82/N5FFJhDnbdzfDPUiRDjsostjrjvKrWsY553sIr19KAQ8u8QkfclvGnspmGLGCWg/hf7vMrjNNXcD4YZA/b7onzIVVRmPA6QQaW4BjxVX/EQYyD4oJYAIlimU2F40sGOKQu8/d2ZuhoNiWeVIQ/puBgcvoY/UbhtH/a5GJeMnexLSLu3tdpp2cyOlZS3Clq3hiSSWe1+Olo5a7Wt2vvSoV7R8IjUlkgNi2W9/tYn3dwahiaAmpSjoMfIcGbjFXp2GnWHlBORsoCxSsujPd2GGNtwzU5Dsi4xUfqWoU0algCu/KfCZKzf6kzqYun9MHxO6gNQozj7W+wc+m28PoznM4FQ8Ts+xftTmp+zdla7/N48X5Nu/euHikyuzhRarYOpMH5bh4Kl7DPYtapEyN+AFnMzySY5/x8ri4qxINPxGK4O+Q8uOBOZpv57LhtbsV4pdHG/6eDGMrFRpDawiAPdiVZjET9g3VC6eThoVi8vVGHQ2q2swdsTVg6j1K/73LP59bH5kGPsxxhgpl+Hy3KHZc4Z75SWD8XAUN7EraWfKl6R4EY/eu6+uapFahopQb0Or3in8ZuUmnW6xHQLd8ga9S4pa9wrRq5JnCxdtiqwhSiRCa2+klzxtKG/YRCLOFywXiOAUtnLwfeZTN3bTpTKpohZGWj1FBYmu8RffZs7ptDI2yZoI6w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5631.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6506007)(26005)(2906002)(6916009)(83380400001)(86362001)(36756003)(66556008)(6486002)(66476007)(66946007)(8936002)(52116002)(4326008)(38350700002)(38100700002)(2616005)(186003)(508600001)(8676002)(6512007)(1076003)(5660300002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TWZjbsSdNoNNh3ZMEJCLv7bHfoFOyqZPuLRBPtU0LUb1iyqUqy5bfoKR3ChzJCiFbDfNk1EhF+G99ujwm3PYIZgI52Gx4gwvRqK+IhQwozgS9KBTChL2MtEvbTCOV+zSicGw92+C0SBXI6L5MW98e/Dc9rIEs2X7IgTbSpxKzXAwG1ur/HdVZLo7TaWUyxA1ISqrLG0aTTWkztIha1/GEO/k0jpc/gLtU6F4mya62366W+gsj/F6hJnngAMw7SpVFaFyahlsmfYIo+eHCGzCD9p6tYjFlDi0JA0SwHvgy12KcoIqzhDe5ZLEuNpmfgcC5kTcUljixpX+2KXUhC7AOtWXnxkufvt9c3EVpG8PdwWdegtbLFFHWbqu0xl5av/DP4Q1EQO91QCxkp0bhLUvYPkCJiLG3nuT0agV/L7gl/1BCEwRtDLJx9/iVhHiIBN3jHAxdDdqJxWY11ipnl57x8Ny7VjN6TGM9z+lD0wjO36BpdpubNd3ELy2zhJ26vjMnO4bufzf54tn53NOogCwpvTG9VMl9kz2jwY2BGRSNS7uNyhXuFk0yURb55cyeOmdQsGf4LlJ9A/vz2eRPwhg9FsH68l4u9eNEVTeyfVXzeQ/JepIZZxrfPJU1NpJH7t00e4/8rM5wjED0UtwH6Uqrm1/6iUFqboRgL2ykRivHJGZ/cg67CAI0eOS7QxPqThoNv/b6qI6lPmK0fNG/+C7jcK4SBOSKD6YdW2tZiVF2BlRl2wHbYzkqNqygn0DPcdaxIDHFs8beSEr24AumaNFH0rRvveL6QLtjA3BG18aGfJY1PyjTsGSSQqG1ME01ZJQ1QCnmZmp3EpqcMg4BJY4iWfZqesPlf5WeZI4fEsrN5nh0wSEhabI4HITsH+0nlrcciVzQNlkZKKGo+faRnVue9tGJ4M60IDQcfmhnuk1uW4MuyuyR8l/N5Oax5XMLs4dbcnpNmbxUqo1y+OYBLwuXt3wj86yJNEI5Z4DUzJaGSVeg5hk82bTEED3iTpa7CS9DnaTRNlWr5nf+zI9pt3JVzuU5bxX/Us8YWJGsl3fI9QKhrSauLt206qZ1On28qNz5B3G7nB4yadm83axmiEJw7Nbt5ICSl4klFfQnmP+pg4ZHAwYlYB6ADoVoFk2Qmj+gPsn8oeR1Vhcxk4gbBgX9Rapdybt/J2XYsDHl7838mgqTXUmUVq0ccQkEJlI2ec94v/yAgop2uJBITNxdVpL59vyWij2KG81v/5jWT/e2rL5jDieP1o3XICtU6p5n1F44xG9AJxeWJCTpBKMGEBLTqYCRE3ReO4tLNIEmJt56t4aiDZxxd9EOw6JC2hvw3b/rOVbK8m/IGTSnyx8KFSfEtG50Meavq/m7rPiho5EKRXhlToXnWBmZFpMD3fANXjAS8/GS0fwBq78soMknYWRv8uHmeZcST8Tu2vw8WwuN/y21bgaaLApXZEWZCsfOwftajl1dCn2jCDMlvpwZhFnr7qvl9WZuAzxsaeIQavyTkf2geMoRveRaU0GRIHOr4Bva7InHPBpnAJL33jRotwwrDtSatnrtONQ140PS0QiAZktYPQv+1A/vTdH0g8wTs6BQVrV1CCpCs/nFKX+MQaxtqMQXxPp5TqfrsHvijGe9tQ= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5dc0b8b0-7324-41e9-7a2f-08d9c90d68ce X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5631.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2021 07:49:28.1954 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eKPIsNZ2WwD06w5veGyDr7LQoqqOv787vjAC4EoOIH9MBzdDtVrl/bVqEe6PBYBzJ9ck3M/78nbISXy/juJrsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5629 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211226_234931_620121_9913C528 X-CRM114-Status: GOOD ( 10.64 ) 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 If using I2C/I3C mixed mode, need to set ODSTOP. Otherwise, the I2C devices cannot see the stop signal. It may cause message sending errors. Signed-off-by: Clark Wang Reviewed-by: Miquel Raynal Reviewed-by: Jun Li --- V5: No change. --- drivers/i3c/master/svc-i3c-master.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 74b38772d692..bc9c7fd69cbe 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -477,7 +477,7 @@ static int svc_i3c_master_bus_init(struct i3c_master_controller *m) struct i3c_device_info info = {}; unsigned long fclk_rate, fclk_period_ns; unsigned int high_period_ns, od_low_period_ns; - u32 ppbaud, pplow, odhpp, odbaud, i2cbaud, reg; + u32 ppbaud, pplow, odhpp, odbaud, odstop, i2cbaud, reg; int ret; /* Timings derivation */ @@ -507,6 +507,7 @@ static int svc_i3c_master_bus_init(struct i3c_master_controller *m) switch (bus->mode) { case I3C_BUS_MODE_PURE: i2cbaud = 0; + odstop = 0; break; case I3C_BUS_MODE_MIXED_FAST: case I3C_BUS_MODE_MIXED_LIMITED: @@ -515,6 +516,7 @@ static int svc_i3c_master_bus_init(struct i3c_master_controller *m) * between the high and low period does not really matter. */ i2cbaud = DIV_ROUND_UP(1000, od_low_period_ns) - 2; + odstop = 1; break; case I3C_BUS_MODE_MIXED_SLOW: /* @@ -522,6 +524,7 @@ static int svc_i3c_master_bus_init(struct i3c_master_controller *m) * constraints as the FM+ mode. */ i2cbaud = DIV_ROUND_UP(2500, od_low_period_ns) - 2; + odstop = 1; break; default: return -EINVAL; @@ -530,7 +533,7 @@ static int svc_i3c_master_bus_init(struct i3c_master_controller *m) reg = SVC_I3C_MCONFIG_MASTER_EN | SVC_I3C_MCONFIG_DISTO(0) | SVC_I3C_MCONFIG_HKEEP(0) | - SVC_I3C_MCONFIG_ODSTOP(0) | + SVC_I3C_MCONFIG_ODSTOP(odstop) | SVC_I3C_MCONFIG_PPBAUD(ppbaud) | SVC_I3C_MCONFIG_PPLOW(pplow) | SVC_I3C_MCONFIG_ODBAUD(odbaud) | From patchwork Mon Dec 27 07:45:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 12699586 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 310F2C433FE for ; Mon, 27 Dec 2021 07:49:37 +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=gKaukmbZGm12/lcIsxGKorANycy9JlDb31hBpkNtCuA=; b=VGNzgHKNDZTZH4 NhOecTbC5VOCO7QEoAe4wa2B2joYZWlbPoCk61igaVmqr9SnUZH2FryVzE8wQDa7HK+37LJXxDTsQ sH07KjfpSjlMR8S59PyWcvDN++dPQqqRSlyDOtxkS3PZ+kvYRP+5Volu+Z5v38h3K6r/EPrcNZrzY pzGZh955WvF/u+a13U0cAbtPXrCksJEEjChr2IIGtagp1iUktoZoG5/1oxYZjCzNAAZ2GMrsaVZDF GnxqzUerLu7HGYgMhZeUQDIuvYGtZmx3gk31i4HLrKYDkjNRzFZ2nhPpljPiEITzdpQD18RkOjfdQ Riqmszpi+p8ZMUDS3Y4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1klE-00GJuD-I0; Mon, 27 Dec 2021 07:49:36 +0000 Received: from mail-vi1eur05on2081.outbound.protection.outlook.com ([40.107.21.81] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1klB-00GJmw-6O for linux-i3c@lists.infradead.org; Mon, 27 Dec 2021 07:49:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IkiZOyKhoDhtfgNpSZraw1HMzo7yrWMf5Wi2AdTEX1dDeM2I5io8pF2ZcZP9rM+0aJAXtOja+1HB7Tf8GR8Azv6bgZRYGaLOvC83egTSsNbw6noT/mykjKXk39UPg8fm6rFCPabsUwWaX4PJx+Q+RGljBWgmyFZGzWKySNQXm4Zj7M0Jx5xq5FPkaLuKUX2+gZEHV56E7wRHVTzVu0YCmWx92Tz707SfHPO9B5mE1YoZMsfPKv+UIFB3odDQHLkwwxEoEhQ0qxopWyogw20+hwHVih1SaWG+IjKM/2u9kLfcyTK3QWhbtDwJdN7bQOrf41Pnis1K/YCZKb5y3uK7Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=A7aOp7JfdPBLB0PjrEzdvSJ9jjA8JHcjYlRhhf1GKyM=; b=YA9R3Gj0yjLtpDeud6X+BU1rGursQaVqiNr44mV2XOdhHM9GKzhpcpQHK59/AVOZw2q6gChq1t1tfC6qKSjeGQEoFNtyDamE4pB47H9NyFf5rTRJJBJtg4yqqRQtCYMvinic6MCD+ZmWtriRzZ656UsnXxAyw985O7kDoLfocffZVJFMrHLwtdhBCzXhkBbW5GrUrh43ApFX511nv01hBqhdSjOKZgVNsTI+J+grBBm3KgvvdYwDy9T3FOjrea7r47vrSWWzqsmkHH30ffWhLQpjKtl0tSzI8kH+6hQgCYDBQkjghpLUe64g3No5+33r/lN8XJUFtVfv022Pstmzxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A7aOp7JfdPBLB0PjrEzdvSJ9jjA8JHcjYlRhhf1GKyM=; b=rly9VN4dEbtEraumLWITrNdu0Y/0omdAUX5g3d71IffZPIM9QqX2y012rJwEY4caJx40IM38zJTL3SHVuhuz1Pqv2LGcX1OV17RgvKICrEwQYfhi0GgZQA8yGq7l4gwAJC2UZSoTxUI5O2wBsMoOLxIf7Vy7dzcvFUHk8fx4JXM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) by VI1PR04MB5629.eurprd04.prod.outlook.com (2603:10a6:803:de::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.18; Mon, 27 Dec 2021 07:49:30 +0000 Received: from VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748]) by VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748%5]) with mapi id 15.20.4823.022; Mon, 27 Dec 2021 07:49:30 +0000 From: Clark Wang To: miquel.raynal@bootlin.com Cc: conor.culhane@silvaco.com, alexandre.belloni@bootlin.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 6/8] i3c: master: svc: add runtime pm support Date: Mon, 27 Dec 2021 15:45:27 +0800 Message-Id: <20211227074529.1660398-7-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211227074529.1660398-1-xiaoning.wang@nxp.com> References: <20211227074529.1660398-1-xiaoning.wang@nxp.com> X-ClientProxiedBy: SG2PR01CA0132.apcprd01.prod.exchangelabs.com (2603:1096:4:40::36) To VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 10795e74-4cea-4728-9466-08d9c90d6a39 X-MS-TrafficTypeDiagnostic: VI1PR04MB5629:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:324; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fxvpLZPi6H4mkqjG3oI2BNu3SOMUh9BXS9HDTS1vkhUC5Kes0Q4Ztgk6Jhbph0+PzLH7YcARRNqdNiAvXlpd0NUbxqXzzdgwcW9MIsabb1eIkwDNUQUzItRV3gIS7xWrObagRjZaYDLXn2SLurRZyaFYwH7lCdmaWuJvr++G1lR9btY/DmIaq7YHlZ4wk6Ko4jgWBY2fJrxLu4jY1dBTgiHY4hq+HZtu1Qws5TK6ZCWK16HeJ8Ov7IdCFUnyzNJiXUOyIfzpwQ/HWzNtB3yPm2vacrsWo4Q776Q8tRczqbW6JJSIQxg1U9VWdXwolKMbpfSy0LN4vKvkTZffq3deLnVPHHBRkPL8rd4pHXjbCo/CVuvKX+SiMAs9ZIVJzt3bJwUZLL5rVV+kPuQpbAwWvMMUlxZU+G+w2zCcI1o2yvIYRf9d8irl99/D1BvTwn/ihasZUbqNQGDLFNHmPuXCl6gNMFu+Qx4tV9w2HVGOrP21MaPm0Ec1sCuLcxQfrzniJPPeqBON8X6PMEVQjC/SIdKy7CupENSHCmnTfUVbRZJxqzxqcU3/nR73oJuLdFFu2SWtWxM1HAu+XJLW7/xZmfmNeHZ9Hoz5phI2p7vxWrLWWMHqqtZkdJ+ftE2Nvji1XarM06cxftmNoY83BfcTeuzuoNRAEyhhqMgzXyUOL3SnJl9Dx9lPlL44cS2IUQw1k/Uk8t3j/nIx9x4dZlYTQg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5631.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6506007)(26005)(2906002)(6916009)(83380400001)(86362001)(36756003)(66556008)(6486002)(66476007)(66946007)(8936002)(52116002)(4326008)(38350700002)(38100700002)(2616005)(186003)(508600001)(6666004)(8676002)(6512007)(1076003)(5660300002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XjE0p+nRp0EGzzRSThYll5pYqVZZBv9omd/i7ocvXudptKiJQDCvEDlK93TbA4F90FowVl5WcBAWx2GxDLC60RG+vhSOwR6tiRDd311W57PpVfSzTKkhhvYGDFBMnQYKRmtSjUeG+bx11N0q2agQI8WXUwiMLFgXLAvJWXzyVm6UCdo5r1R/Qllen53vQ887X7uYW4ukFxeC+Jrw/tmmuwwg7EMKoVBUQMrWKqaBpEkeVU+NcLn9kkDuD7FS+5UjvqU/I72d9acfUy/d1NhHL80OuoTe06dE8rM7Us9KWN7YqXuC7QIhqmXSc3FiRG10GiuksjwgZzNUi8ss0g0MD4Gy4wHT2I4MYhVXAaRqm+AvMNMVj/y/ZWxuLP/snbkllx/HrgtKhk/tOE1/jxqTfTWZCUibNPRBKUgMhic/CI+AlUPSI4HnRLjPK+p9fXFyHgPCqVAq5spgWDTCV7NwrBL1OgbAVNTHTCc4khmNXiKZA+Ms+A+yDm4J9xaXl7GFcB6GUpROV3AgmDLRXfQYvbNlzD77kmcuhPqtEsa0I11/X1j8U9JZp6tXmDIJXHmiqYpPy/7F8m7ifVpP+vhrgiwhH/b70kDRRP/AXchx98WIuDcMc6JtekMWwl+nTJQ1LvndGRMN233mD+zEIY8KYJjWRGqDtdcaxBGSZ0iPn/VzVaHt/pgDQj2PcBeea4Rl5ghKyHP2qEQBJK5arNsUS1nZoEceKqqc1hSN7TLlWzR0xIXOMHUXh3BxhGRYXLQJZ1WG0dgaKP+jBoovh923PleqbTihdSi9zsgpBSmOaY1Nr8dSd9I6HRQeeKp6HVT32eRfClyQXPX9/0D4huxTFjI6+5+5tIhJHhXqCjR1yPtVZDKDs0mG1FzTXf38U1u+549Q78zC6MLQh5YhY9ms39PxL72U/iQRbp2jEDD8JLP5+JTZC0e2pA79VTxhhwTT+uE00deet1sgq8gTjYnWQgfTww0TuuzEDTv8f679XV+43FAiEhUCUzpO/wRojC6PMTr9RK9g8Qgww2mu4cuQlrU9p7PLNrN/Q8qBDDvVXheUpQMtCAAtWgipo4cfvyOyrIJDniA61+0Qb0NmaO8MV0JDyyQXSU3U/G2u17rTRRprDvxd1tM+K93L/aDslYL6VLwz6wxmpG9wZVLOE5lsjM6EbT4HifRIyJKb+4WDUV9tL+YS92UVFjjF5/XrC+rrKrwFsyonPX+/5I3rq2gHbznxNAXfgalm6d6EkkBzbaHdAocwwdCAyu2zXyAHHe9qSfMYIc3f/Fxyg+0AEAdVNB/Lpj+oqoxpnNHxiRM6hKGTDka1Npi1L9P521ZRscp/u0BwsxjUkd1R88TaFEy2mzrWO8wpGXLm4dVj29tWtZUyTdFcoCrY2M2XI9xvHD9VjlueW7jYjHp2JWbj1s9VTadN+Cd2W4p/w6faGkD5QNwVjioXgudEtX25IFd/5L79vV4xRRA1UEZKfyHExmLUwC1oDlO1F4rQoKamhh/5tUeTVOs3T1dwnZrcH1Ovyag7Y4CmojcPH26ivmTk2nLGYBLf0PNtt37x4VplY4sW06zwHAwRzYqUUt64oauqFcA7FuHiUf9ze8F1K4YF/DaSMewUn6LOi7xNhaIv6Ztl+nY= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10795e74-4cea-4728-9466-08d9c90d6a39 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5631.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2021 07:49:30.6880 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /Y99YYUsP/fDiwAJnSBZaUKyeITelRTAdg5bTZwO6bRi57ZcnrCJBZYWiIf7MG6kVgkF1HYA432Zy6MbCtOYyw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5629 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211226_234933_271567_C869AF5E X-CRM114-Status: GOOD ( 18.98 ) 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 Add runtime pm support to dynamically manage the clock. Signed-off-by: Clark Wang Reviewed-by: Miquel Raynal Reviewed-by: Jun Li --- V5: - create svc_i3c_master_prepare_clks() and svc_i3c_master_unprepare_clks() - add Miquel's reviewed tag --- drivers/i3c/master/svc-i3c-master.c | 196 ++++++++++++++++++++++------ 1 file changed, 156 insertions(+), 40 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index bc9c7fd69cbe..884f5349fb76 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -17,7 +17,9 @@ #include #include #include +#include #include +#include /* Master Mode Registers */ #define SVC_I3C_MCONFIG 0x000 @@ -119,6 +121,7 @@ #define SVC_MDYNADDR_ADDR(x) FIELD_PREP(GENMASK(7, 1), (x)) #define SVC_I3C_MAX_DEVS 32 +#define SVC_I3C_PM_TIMEOUT_MS 1000 /* This parameter depends on the implementation and may be tuned */ #define SVC_I3C_FIFO_SIZE 16 @@ -480,10 +483,20 @@ static int svc_i3c_master_bus_init(struct i3c_master_controller *m) u32 ppbaud, pplow, odhpp, odbaud, odstop, i2cbaud, reg; int ret; + ret = pm_runtime_resume_and_get(master->dev); + if (ret < 0) { + dev_err(master->dev, + "<%s> cannot resume i3c bus master, err: %d\n", + __func__, ret); + return ret; + } + /* Timings derivation */ fclk_rate = clk_get_rate(master->fclk); - if (!fclk_rate) - return -EINVAL; + if (!fclk_rate) { + ret = -EINVAL; + goto rpm_out; + } fclk_period_ns = DIV_ROUND_UP(1000000000, fclk_rate); @@ -527,7 +540,7 @@ static int svc_i3c_master_bus_init(struct i3c_master_controller *m) odstop = 1; break; default: - return -EINVAL; + goto rpm_out; } reg = SVC_I3C_MCONFIG_MASTER_EN | @@ -545,7 +558,7 @@ static int svc_i3c_master_bus_init(struct i3c_master_controller *m) /* Master core's registration */ ret = i3c_master_get_free_addr(m, 0); if (ret < 0) - return ret; + goto rpm_out; info.dyn_addr = ret; @@ -554,21 +567,35 @@ static int svc_i3c_master_bus_init(struct i3c_master_controller *m) ret = i3c_master_set_info(&master->base, &info); if (ret) - return ret; + goto rpm_out; svc_i3c_master_enable_interrupts(master, SVC_I3C_MINT_SLVSTART); - return 0; +rpm_out: + pm_runtime_mark_last_busy(master->dev); + pm_runtime_put_autosuspend(master->dev); + + return ret; } static void svc_i3c_master_bus_cleanup(struct i3c_master_controller *m) { struct svc_i3c_master *master = to_svc_i3c_master(m); + int ret; + + ret = pm_runtime_resume_and_get(master->dev); + if (ret < 0) { + dev_err(master->dev, "<%s> Cannot get runtime PM.\n", __func__); + return; + } svc_i3c_master_disable_interrupts(master); /* Disable master */ writel(0, master->regs + SVC_I3C_MCONFIG); + + pm_runtime_mark_last_busy(master->dev); + pm_runtime_put_autosuspend(master->dev); } static int svc_i3c_master_reserve_slot(struct svc_i3c_master *master) @@ -867,31 +894,36 @@ static int svc_i3c_master_do_daa(struct i3c_master_controller *m) unsigned int dev_nb; int ret, i; + ret = pm_runtime_resume_and_get(master->dev); + if (ret < 0) { + dev_err(master->dev, "<%s> Cannot get runtime PM.\n", __func__); + return ret; + } + spin_lock_irqsave(&master->xferqueue.lock, flags); ret = svc_i3c_master_do_daa_locked(master, addrs, &dev_nb); spin_unlock_irqrestore(&master->xferqueue.lock, flags); - if (ret) - goto emit_stop; + if (ret) { + svc_i3c_master_emit_stop(master); + svc_i3c_master_clear_merrwarn(master); + goto rpm_out; + } /* Register all devices who participated to the core */ for (i = 0; i < dev_nb; i++) { ret = i3c_master_add_i3c_dev_locked(m, addrs[i]); if (ret) - return ret; + goto rpm_out; } /* Configure IBI auto-rules */ ret = svc_i3c_update_ibirules(master); - if (ret) { + if (ret) dev_err(master->dev, "Cannot handle such a list of devices"); - return ret; - } - - return 0; -emit_stop: - svc_i3c_master_emit_stop(master); - svc_i3c_master_clear_merrwarn(master); +rpm_out: + pm_runtime_mark_last_busy(master->dev); + pm_runtime_put_autosuspend(master->dev); return ret; } @@ -1060,6 +1092,12 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master) if (!xfer) return; + ret = pm_runtime_resume_and_get(master->dev); + if (ret < 0) { + dev_err(master->dev, "<%s> Cannot get runtime PM.\n", __func__); + return; + } + svc_i3c_master_clear_merrwarn(master); svc_i3c_master_flush_fifo(master); @@ -1074,6 +1112,9 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master) break; } + pm_runtime_mark_last_busy(master->dev); + pm_runtime_put_autosuspend(master->dev); + xfer->ret = ret; complete(&xfer->comp); @@ -1350,6 +1391,14 @@ static void svc_i3c_master_free_ibi(struct i3c_dev_desc *dev) static int svc_i3c_master_enable_ibi(struct i3c_dev_desc *dev) { struct i3c_master_controller *m = i3c_dev_get_master(dev); + struct svc_i3c_master *master = to_svc_i3c_master(m); + int ret; + + ret = pm_runtime_resume_and_get(master->dev); + if (ret < 0) { + dev_err(master->dev, "<%s> Cannot get runtime PM.\n", __func__); + return ret; + } return i3c_master_enec_locked(m, dev->info.dyn_addr, I3C_CCC_EVENT_SIR); } @@ -1357,8 +1406,15 @@ static int svc_i3c_master_enable_ibi(struct i3c_dev_desc *dev) static int svc_i3c_master_disable_ibi(struct i3c_dev_desc *dev) { struct i3c_master_controller *m = i3c_dev_get_master(dev); + struct svc_i3c_master *master = to_svc_i3c_master(m); + int ret; + + ret = i3c_master_disec_locked(m, dev->info.dyn_addr, I3C_CCC_EVENT_SIR); - return i3c_master_disec_locked(m, dev->info.dyn_addr, I3C_CCC_EVENT_SIR); + pm_runtime_mark_last_busy(master->dev); + pm_runtime_put_autosuspend(master->dev); + + return ret; } static void svc_i3c_master_recycle_ibi_slot(struct i3c_dev_desc *dev, @@ -1389,6 +1445,37 @@ static const struct i3c_master_controller_ops svc_i3c_master_ops = { .disable_ibi = svc_i3c_master_disable_ibi, }; +static int svc_i3c_master_prepare_clks(struct svc_i3c_master *master) +{ + int ret = 0; + + ret = clk_prepare_enable(master->pclk); + if (ret) + return ret; + + ret = clk_prepare_enable(master->fclk); + if (ret) { + clk_disable_unprepare(master->pclk); + return ret; + } + + ret = clk_prepare_enable(master->sclk); + if (ret) { + clk_disable_unprepare(master->pclk); + clk_disable_unprepare(master->fclk); + return ret; + } + + return 0; +} + +static void svc_i3c_master_unprepare_clks(struct svc_i3c_master *master) +{ + clk_disable_unprepare(master->pclk); + clk_disable_unprepare(master->fclk); + clk_disable_unprepare(master->sclk); +} + static int svc_i3c_master_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1421,24 +1508,16 @@ static int svc_i3c_master_probe(struct platform_device *pdev) master->dev = dev; - ret = clk_prepare_enable(master->pclk); + ret = svc_i3c_master_prepare_clks(master); if (ret) return ret; - ret = clk_prepare_enable(master->fclk); - if (ret) - goto err_disable_pclk; - - ret = clk_prepare_enable(master->sclk); - if (ret) - goto err_disable_fclk; - INIT_WORK(&master->hj_work, svc_i3c_master_hj_work); INIT_WORK(&master->ibi_work, svc_i3c_master_ibi_work); ret = devm_request_irq(dev, master->irq, svc_i3c_master_irq_handler, IRQF_NO_SUSPEND, "svc-i3c-irq", master); if (ret) - goto err_disable_sclk; + goto err_disable_clks; master->free_slots = GENMASK(SVC_I3C_MAX_DEVS - 1, 0); @@ -1452,29 +1531,38 @@ static int svc_i3c_master_probe(struct platform_device *pdev) GFP_KERNEL); if (!master->ibi.slots) { ret = -ENOMEM; - goto err_disable_sclk; + goto err_disable_clks; } platform_set_drvdata(pdev, master); + pm_runtime_set_autosuspend_delay(&pdev->dev, SVC_I3C_PM_TIMEOUT_MS); + pm_runtime_use_autosuspend(&pdev->dev); + pm_runtime_get_noresume(&pdev->dev); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); + svc_i3c_master_reset(master); /* Register the master */ ret = i3c_master_register(&master->base, &pdev->dev, &svc_i3c_master_ops, false); if (ret) - goto err_disable_sclk; + goto rpm_disable; + + pm_runtime_mark_last_busy(&pdev->dev); + pm_runtime_put_autosuspend(&pdev->dev); return 0; -err_disable_sclk: - clk_disable_unprepare(master->sclk); +rpm_disable: + pm_runtime_dont_use_autosuspend(&pdev->dev); + pm_runtime_put_noidle(&pdev->dev); + pm_runtime_set_suspended(&pdev->dev); + pm_runtime_disable(&pdev->dev); -err_disable_fclk: - clk_disable_unprepare(master->fclk); - -err_disable_pclk: - clk_disable_unprepare(master->pclk); +err_disable_clks: + svc_i3c_master_unprepare_clks(master); return ret; } @@ -1488,13 +1576,40 @@ static int svc_i3c_master_remove(struct platform_device *pdev) if (ret) return ret; - clk_disable_unprepare(master->pclk); - clk_disable_unprepare(master->fclk); - clk_disable_unprepare(master->sclk); + pm_runtime_dont_use_autosuspend(&pdev->dev); + pm_runtime_disable(&pdev->dev); return 0; } +static int __maybe_unused svc_i3c_runtime_suspend(struct device *dev) +{ + struct svc_i3c_master *master = dev_get_drvdata(dev); + + svc_i3c_master_unprepare_clks(master); + pinctrl_pm_select_sleep_state(dev); + + return 0; +} + +static int __maybe_unused svc_i3c_runtime_resume(struct device *dev) +{ + struct svc_i3c_master *master = dev_get_drvdata(dev); + int ret = 0; + + pinctrl_pm_select_default_state(dev); + svc_i3c_master_prepare_clks(master); + + return ret; +} + +static const struct dev_pm_ops svc_i3c_pm_ops = { + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) + SET_RUNTIME_PM_OPS(svc_i3c_runtime_suspend, + svc_i3c_runtime_resume, NULL) +}; + static const struct of_device_id svc_i3c_master_of_match_tbl[] = { { .compatible = "silvaco,i3c-master" }, { /* sentinel */ }, @@ -1506,6 +1621,7 @@ static struct platform_driver svc_i3c_master = { .driver = { .name = "silvaco-i3c-master", .of_match_table = svc_i3c_master_of_match_tbl, + .pm = &svc_i3c_pm_ops, }, }; module_platform_driver(svc_i3c_master); From patchwork Mon Dec 27 07:45:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 12699587 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 6010DC433FE for ; Mon, 27 Dec 2021 07:49:39 +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=cdx45DtnYRzEpPDwUQ5pYg5JSdlZJQ0W4hwXWkaRWxw=; b=pMlROSjQi6R/gN GCfeRtlDBsjGtYPvHYDke+pFULPO4u4B93OcJgqcMeflu8VE+DdyqtKAnmMOq+WIMpvPDAX8FVSA4 mcRA+/flWrSpHVd85dV04TfgI2Aw6+3NbhKWbzcfGVTf0cGbnKDJFS90hbYTh1yMtlcpR4APHMPzX PR9bSvNLQF/dO5zKEI10BSj2D51CRuWFckEWMpDWkjSgewlZfNuxwE79UeIbJ1TKC15xIN6g6R2J8 4kQt3VsU2+YdaTtGoNW+7Hrv304fcnpcqC2OYbheXaR6gLpk6OkIbPlsNfu6OD1rQmHcdaZw7UbJ9 9OfnS093orSivimMG+aA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1klG-00GJwD-Nz; Mon, 27 Dec 2021 07:49:38 +0000 Received: from mail-vi1eur05on2081.outbound.protection.outlook.com ([40.107.21.81] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1klD-00GJmw-EN for linux-i3c@lists.infradead.org; Mon, 27 Dec 2021 07:49:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QebsHTzFWP8hv5oOQcJ/AmTxW5skCvsVVMOho6BKKtiP5u5y/OTePg6JjmBYW+x1DU+P4qxORMlV8vw28Uz/VCCVf/Fnq63eoJV6KFnO3/OE2DEEMCT9RmYFjnLsYkkIUc0raEdqS+Vth+4CKJ5xfdjTkcAP8Gfp94DDVh7e5E2aHMA4YvYXQEiTfO+ma8cx9hMEoMlAXVbtrsCPJAlwo3D2ChMLEClU/qkPcjam+4ZVBT3OflCwRGhLaP0CEjK7EZ528jOQYQy0cKmSueMpe+awJEl5rWVnzIPoG2h5E0N1lNJrrBpd+QgWQyDNDCXXFWluMVPvvMUX2OPbz6dJww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Q1jezXools/y/l/bcphAuJgmvbXwOynT63sfojpuGy0=; b=gPK/RZBimXxElzPAtVbobBMhBw63OtHsYU5pXxtdwpnlUcuxa6NE2C/pQvKbHfpLLZkDLZ/aV+t+xrg57Z8K03x8hSiq6ea0sJzjt+yEpxnGK5rUCn3wpkIP5wrCRxkh3LJkrMAQ0Bx1gk8pQ1EwdJfxvMI5/6obsXSTqX242K+8n33yAAUxGjr8z//FVhn8xXznJrYSzrfbVtLRvrittj1xKueROf6d4WiwyrWUl3UTe7QrNczmQl9wPm+qzm3kTMWBF163NZgTjNw2ed8noMtdJZoQKZu2lKnlQ4wq+ncx1/VG9+of6ds954g56hQ3D5DL6OdI3rXFbuJ0iKW3/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q1jezXools/y/l/bcphAuJgmvbXwOynT63sfojpuGy0=; b=dUui1vQT25hNDPeC4xnzu+O20wUIt6tsnggz/WwsqRhV1jxoyfzN85mSg1kPvfPGar2EfRXSeYnvWIs7ou3uzUewaRzEd+A4uOJfGYHvMF9d5os1hSAmZtCzFoJEpj6eZtXif/bJ36cpDScX31Oyst2i/4lUQ50A24Ix3d2kcSw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) by VI1PR04MB5629.eurprd04.prod.outlook.com (2603:10a6:803:de::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.18; Mon, 27 Dec 2021 07:49:33 +0000 Received: from VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748]) by VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748%5]) with mapi id 15.20.4823.022; Mon, 27 Dec 2021 07:49:33 +0000 From: Clark Wang To: miquel.raynal@bootlin.com Cc: conor.culhane@silvaco.com, alexandre.belloni@bootlin.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 7/8] i3c: master: svc: add the missing module device table Date: Mon, 27 Dec 2021 15:45:28 +0800 Message-Id: <20211227074529.1660398-8-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211227074529.1660398-1-xiaoning.wang@nxp.com> References: <20211227074529.1660398-1-xiaoning.wang@nxp.com> X-ClientProxiedBy: SG2PR01CA0132.apcprd01.prod.exchangelabs.com (2603:1096:4:40::36) To VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2562f110-d166-438c-350b-08d9c90d6ba6 X-MS-TrafficTypeDiagnostic: VI1PR04MB5629:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Efr5EoxNqmdOOudZLsb7NMbbzYi6QmkTh7Fv5XefSBVCvtmJgvVO8xE0ta+udqoXyBwRXeWJkRj/c69WFUlG7gjPtDw5JPY3juQs/eik6aFPSiJ8ImP9VZd9KJ4k31XUTiySoQMHypEFLrKA/S8JMXuOcd6wwBxkSZc3HRZQDXglTfv4JVEU9AZSIlOs8VpqlcxH8qhdh/4Bzfd6vxXKEAcCPQchCQIIQfJ8snGfnXjGuAlNS7K/Z9E0CDF7c4wy8b+lzUexYVigR1K/cahMJlp1rNVxpBeXitPDkwKLl9ugj43WzPw1WENUPeyp86PFihAfed1Q7+bQ8sbJCBmHWHwTomCqrrEJpoFLiD/SXyQqaXPhNydIXYiPzh6zb63XpveJ02B3U0MVHGBArsyto6Ko6p9zNO25h/JAo1FgvVIjWEW+Pg0TTd0zvl8qeNI2TqU4TYcHYfXltrUyLBvFGkl3a3PFp8OJH6zEq9WKOf0gVEG1rAfbezH41N7MniONWbm6N7GoRNrhSncPFAKTjByJTjv6u+JVftzFfcDIPGTbqxCxMTGfs5PcZiQNehEhWBpB7Ll8kCll/Wq51nFa0JIZe+943l70ZXFDS85pKqBdGkddLUTI2YU8R/3sd/tQgz4SQwsfXUiHcZf8YiVjcMWJAvZ0A9RdhfZ04yz30JvOrG/b1Evtl4W5uUmtt79BIHIunVKY4kGWYzxr5JNiog== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5631.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6506007)(26005)(2906002)(6916009)(86362001)(36756003)(66556008)(6486002)(66476007)(66946007)(8936002)(52116002)(4326008)(38350700002)(38100700002)(2616005)(186003)(508600001)(4744005)(6666004)(8676002)(6512007)(1076003)(5660300002)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aUPvWIYZBKerfbNNCVQrTjxvW5tFW/lHnDWqbrHfrZBPP/yOK46tXLhhyUm/3RY7auzpbPDYbXNelRiyyQ1NhaCbuC6fu1NEoar5O4I0JeLaEF0PRWV7qoUUZtT8+OWGmyMKdSe5Y8F8izdpTT4w6fDDth/pOZwGKEKCL8U0ABtVN6C1NerME3gcpl04m1zFs9o2NBgd7UBQtmrGd8hGJ8nPa5owZWrdkFC8ahZAV2dAUgJva4EmcG3Z+mWMx2IOgKV975yDy7BSASZuG1A6sKYIcIWCrzKQT6023ZuVllB0aynQzgDi+dJKEqPZ5m9oEk1+JwU25Kxuo1LkAYxmbf8p7e2M0mTCcL6E7rx9s8Q3PmptD+Wl7+t45BOOCHiTVmy+XvdUkRhQE7ntig3FpVxIPbzSG+Wc8b4Hjzh/N+/k9KVvn5GGRt14eDw4KWqCz6Abjsz9uE93Y3qpBZc67X+SJ22VrsJx/F0DVzPE9KjqujudBNEXsCCHSEqAXrvRB8FlUZxAdghuPD0tFhGl+4nWE3sgp2K8OemQa3kusj4zS1PsJG5KdvTWl6pjrRWXMij3zY9Lm6gsc/eZT3PjGvs84yRucd4AVwtJLa15O9bc79gMVJgGZnSzaums3cspHK548ohaNUjkVH4IATq5cvccUzWY0jap53uYPuqhpUTIDAJSez5wXYiNkjsfACh46PXoajEEuf8E5+mwUbstdbuqFYZLM0ztZH/GOOMdMF1BLQU4azrYf/lUW34GU+ezhMpbi1CTDn6a1uWVZpJrJHPpWbwCm6cLL9YF5m66gllhD6p1F6+iHpJkSzl2JZfXxbtqQTIwBwn9LDr0B0IPaGS8Jgy5BX6Rv3JIo7XQj9ib95cHK/QJvjvrkcw4eurllXSe1PH8t7Ky2QcnK+tvvm//fXbfqjf63ZPTLGAyr2l/c/8hQZpNsiK1wuGRLEYuctbj+XRhkBX/BY5km3UvzSrvdTGeYDeEjY3utACK17qW6yNEdz8qD08hNqCvkKIEL42JPtrtwe05WCuZU/z9qgHhwxXg5/jHBWkVBDbuqFq5lTSaQrXah7Kw2kNwfMkm62eO2X8QCk36p4auJ6vmkXxK3eMZbMqeXhV9SsSXFF2KvC5cQnapVlXeAQyRhGo7jz6qP+FH+E0f5nCo2clnsTW8EmQ9l04Rk6Qs11NMHkjury5P0aOHpwXXIBW1NF1+O8ry+gbiJQfx/BP7rRdrLd9YIdRd+kL8zfKkNytSdWXpBiuxoRZ0J1wPA9MbzfADSWoJ+7C7T6Ei4N2f+CSXjs7ysJxlZHWlZTrR5xuwtI1eZ6ieXOeneVC8ir+AJbqkfqal/Y/u9ZsSQ4vswV58ElpWIKum/Y46Gxhd9ujHExpW8cXTX6art49HzdJ2lgXvzsiAknl2eyC0H7vJ6mZDsOO7a2YCEYb8qbNS89Hx8B3hrsVL5XBd0tuwf2XDfo0bTgFbGbhjD4WsC/dhYADqNg7z+JEtkSbskKV2MyyiajK55AuilFc7zJJquXmUUfHXTdytQA+RKFtZKybJV5z7iNn83kS7B5wyZEJKfHKlTfA3bpBi3B1nAMIewAXWO4mIA87mlNk/+eKA9Tf0owhtoYko/wx+M+1aCP6IsfIdnS4= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2562f110-d166-438c-350b-08d9c90d6ba6 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5631.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2021 07:49:33.0886 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RRnJzSOWuCbmgDMLTiZUE+Y5VIuXSn3TO3InwvMRiwfydynzH/VCJQKQkn2CTHu3kvaHXfVSHR/BIL5ZOyuBRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5629 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211226_234935_506008_4C2754B4 X-CRM114-Status: UNSURE ( 9.30 ) X-CRM114-Notice: Please train this message. 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 missing MODULE_DEVICE_TABLE() will cause the svc-i3c-master cannot be auto probed when it is built in moudle. So add it. Signed-off-by: Clark Wang Reviewed-by: Miquel Raynal Reviewed-by: Jun Li --- V5: - add Miquel's reviewed tag --- drivers/i3c/master/svc-i3c-master.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 884f5349fb76..3bc81ef95334 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -1614,6 +1614,7 @@ static const struct of_device_id svc_i3c_master_of_match_tbl[] = { { .compatible = "silvaco,i3c-master" }, { /* sentinel */ }, }; +MODULE_DEVICE_TABLE(of, svc_i3c_master_of_match_tbl); static struct platform_driver svc_i3c_master = { .probe = svc_i3c_master_probe, From patchwork Mon Dec 27 07:45:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 12699588 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 6C0E3C433EF for ; Mon, 27 Dec 2021 07:49:42 +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=OzIX2a3JPnCoG8e2j77auOB82vVxUn3SSgTcXcnjk5s=; b=oxU9FaIsrt7I5E raJ74dW3ysTdxDSzdpAu/vR8PT85uoySyp7YimDiuq6JnYlPqhbi24EnUufjokrf10Jbhc+0Kj9Sw Gz8slZ/BiDxJF0i0HSZrShzGd7F6Bn6d38sTz1nbCzLmqZjtma+Lw/UVDi1Uf2VQcT3yZLoiEjbJS 7n2ghUTSyjhkVWI8VJv0KMqaHYlxh9yloH6InWCmq2vy5pCiMV4Dvj8mXlu6gOtcJdBQgsE/Hzp6l 3yhGFNVJhxqQFaGHyESGXZAg1ieC5w5Yweq1gAoXeslQib22iaAiFl8h/4Ya9iwyeba/VKyCgR0MN fzpM3xPtwu3+LmJ76dXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1klJ-00GJz6-Sn; Mon, 27 Dec 2021 07:49:41 +0000 Received: from mail-eopbgr140055.outbound.protection.outlook.com ([40.107.14.55] helo=EUR01-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1klH-00GJv7-9J for linux-i3c@lists.infradead.org; Mon, 27 Dec 2021 07:49:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QY3m+rlxlH0bM6yS7nqZk2eq350uFdpvoz5tHpH+iQjcTNvSgnqvY/nRY/OolnBuGmWzHdWA9ST+t3LJev9RZf3eF3kDJcjQ4E/wDIEwg2n/BWABRsdER1JczEquduY9AlsfJA01FCd4Kgi8bQgRqOMOSXSAB4jiJAELm70jf8zesu+HhKa+oKjUrwSwEN3x+nes68yEzFtfS6lNsi+bi6Px0lgQoKm6JNBTBLh0+kdBnoDMKn5kIWMfXGwbvz0JyN0khwOy+5M51BErmIH4aXUVq9uhsQ5J/oKXPEKej9nt71QfF49WMF4pfTXWOYmLoxS7za3BjRxlgG9xYbZI2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=jifJsGARhkDNJRV0D8tgFfXyWzKoCMF4H61IelB15LE=; b=KR9K5B84u6EMuc/UOceXec0gnk4yaSoFoZ8k765wnUFQVzH7URv44Nj2nYNPaeDTCeaKwmd/14TejPG6DyLjaLfuto5pBT1NBW81XHbz8ZpnSwk2qfs/aS6I5zuiqlHYJVWPSvA7U7X/xuvfPYgKwKreU0r9V1XB9420AYA0vSYTytEE9IVo2bTlhNVaXQsfgw+sYa1JnCYPIirAOIECiSlntMPIZAybUpXhx/p1tfHbI8dDtzagSf/IYpc4kFXfJuErAQMwjAqjSUVuTIXJtMsol1+IHHQJFhigNiCMKA+835pyL7CjbvIZOJXPaAxLp4F+h9xKfqOdxOlB/gXF3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jifJsGARhkDNJRV0D8tgFfXyWzKoCMF4H61IelB15LE=; b=afhGDkK9wuZc5jIOLmcwgvsdN1WTzUm28MwZ6idWEaMheNvSEc+iV1AhjyhBx2Ci89iS181wHHOCf1l7uuOQZWYkqk80xrhko8KtOtjBKESYMAkr3oDvd2uaQmiAx3h0SfDaMXGs+9v6TuEhXuoa+MlcIEyrtpCEIbrmLjFWJpI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) by VI1PR0402MB3904.eurprd04.prod.outlook.com (2603:10a6:803:17::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.21; Mon, 27 Dec 2021 07:49:35 +0000 Received: from VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748]) by VI1PR04MB5631.eurprd04.prod.outlook.com ([fe80::90fe:b60a:94b5:c748%5]) with mapi id 15.20.4823.022; Mon, 27 Dec 2021 07:49:35 +0000 From: Clark Wang To: miquel.raynal@bootlin.com Cc: conor.culhane@silvaco.com, alexandre.belloni@bootlin.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 8/8] i3c: master: svc: enable the interrupt in the enable ibi function Date: Mon, 27 Dec 2021 15:45:29 +0800 Message-Id: <20211227074529.1660398-9-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211227074529.1660398-1-xiaoning.wang@nxp.com> References: <20211227074529.1660398-1-xiaoning.wang@nxp.com> X-ClientProxiedBy: SG2PR01CA0132.apcprd01.prod.exchangelabs.com (2603:1096:4:40::36) To VI1PR04MB5631.eurprd04.prod.outlook.com (2603:10a6:803:dd::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 71f0d48c-a3df-4d44-2cb7-08d9c90d6d0f X-MS-TrafficTypeDiagnostic: VI1PR0402MB3904:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HjZMmqsHR74a2K+IEsKGoaKKhyS5crjoBfwH3KcFEW9rk9QPuMxODBHEWbBxAJhzleKAk623hdvgmmA7qekZ+bjw1VMIGK1EgrEOdMyLzC+Ek0h7ehy1UQCSOOSG3eSLlw+L+8JowrxNWcYrEtRFUhyjNZZ7AmhYtDPuvZ4I7RcVBwkjO85BxhuJR+xkxiiqLYPQfwuGrxq7J5vPM/A8kTJfjkY9qZdNO3GGIUcBifMeWRC5rMawOitOHjbUmbVylFQ/etTDONbGE3ivPGzpoJOLc2Jt1PM7vRmRXz9XWbPSc0dYiFMd2V3i90/+/0D2+c43BAX1fV2ps1dvSCRF3htFijxSfZcW4+IjTDpwNHCZfaebaCiF+gTAUEgB3VUFEDvqO5tdZdYlmPkzyH+YU5Z40QzBdBoPzr/HzCnz6saQyzKrbRvehDee03o2XKVnmu8uQI8cqO+6eo5rb4AhYURVz4sAR3PuJZSd/tF6zXWSuzItBBJYLgz7ZrPuzEIZpc5POgspzulEeaPUKgeUImhbMA3ROZ+HWM8hxpUfpgeOw+aF5xiMxzd2zvZrJVDWyaup3EB2Vj6B8Ce7mh5Fs8//DfYHO8sKjVWPaQe+E/jrvlL5CWC+gFOrKiijas+EeY1BNYxbV0gYI2VxKZrIc3AXTNZeGk0kvoA1yyNPsd7bjZODaS2/NlCQUAAZhMNzrIbPJpFeo2bX6S9oI/ULBQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5631.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(5660300002)(1076003)(186003)(86362001)(6486002)(83380400001)(38350700002)(316002)(508600001)(6916009)(2616005)(6512007)(66556008)(6666004)(66946007)(66476007)(26005)(36756003)(6506007)(2906002)(38100700002)(8936002)(8676002)(4326008)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3u95jlQHeQH9dZI/BoUE+fmI0HZW4Zb/nBCU5yraT0SlflqaF/FgZeKkFPpjNtYpcShRk4UM16F+kJhYJCgRQ1jW8tD5tH+kiLOJB0TYd0C5P8MT8Bz59k5r8C8qbKORYh29mOIlvVzEKhodBrvSrtRqU1NcU227O2d2s3efuKoTqvtORJcOb8wNlgw3Ic6tyJS5BJT6REvZYGbX/t2n33vfKprTh3WR9D2zM+icdtsv1WsYbXZ7AoXv8gGYMNhuVBo7IB4bg8IFy07+0QJFme/CtMMqMxslcu+j2IqZ8R3LP7njO5DGptVxbSvMtArA57dlvUyzNKQYRjajb9934C51MtEW/U0m5k8mc9Wt8QOwmNHaQyu3S5qPj9jROkOUtR0fOwGV8p5hsBigVUX0ntjD4AtHwdHfN5dyiPyepbSMT1k9b3CqQPv3LhGQDvLNsSVA6Sc2MA2ge/2OzenDJSsh+iirKeOf/hfOaYcMBaCPqsSQGEdNDB9ewi16p7OGZ8eXu7nkBP6pGtkXPNfKNUJH+1aqSDoxkPFWlDlalbNLnOg196zMGtzfAkE1l0bbQ3NQOT9hR6PtMkvIWyK/aaVM+1EDveX0DjJ053c7AlYm9+DvLlv+4kLSrL31R8vDFnJRm5sDEsf9WIJw/qTMd0dnuxqINu6bCxM7IbngC+UPKMdGEsYZgMVCQX9AfGTl1KkH1sFN4r5j+jP/UAh9G5Jq4FqOh5sZ8Mz0r+kJeTlkPoaCxUN1+Lw7LEmx3uyLjBWFB91ve3hIHlbFCKGyTLl9vKjmZvc0R59C7Ej4pzxAICFPHDtGOpERL4NGiEviMB5wsLf6LsiA0J9C1LX/DGkDQ9nzk9bsYVOJ6l9a/pMJXrTCxDBqrdIkuZYRV73sVUHkSA9hC/fiHGs8lUoZHJ1MUrURnlTLwQxyYhwK0CKFzX81MWtBrv/LewkxrJaCCPS4C7FZqW+Uqbn5joMEI0Djdi9bj5UjmQnekz4nMQfKG7G+rowv1ZQNHd++gxGFZrPtb1L9dYWd+aXrbkdjb0/jpCGV8nM9N+j1of9+Z+GDpCVu1+hdTg6/yW6mTGAhtVF3L5Y/0aUxdkoQQ0EeOAmGuVsu7d4XwCx6B+R3VW5PCyGl+xENdKcCvdvEFOX1G0tSANxlZKUwpNJ2t844LbeH4g8TyAR94cFxHjuLqgZwU3scRiGLL5ApUMDn38ByqT4aA+xAeClwzAD4EAeKAg4hRRlFo7RXHmNqsaZVSNwDRX9GaTcEQRgZN8LzlsjAZlFwOiRj0wyYglV5mUfl0hPu9ZwTaZj2dpDf6kpPInEqtSSFY1orbKHX/WCCWLDTJ756389KzmjiRJsqCp6LEa7HvEEvgtj0qZIPbl8Ltsdu3JPgM+EvJtz+vdOqMY391i7NmYGP3zZD/TchLGPi3f8YCmwX+zz4jRkbcxemeBmpupYvUNw5ZYMIgWZ3Rn0ZwF35ZKForuAM4ncJiwLiXcrZvm9jRrzkTExPfYOGghSnTqLPF0qd6Y+qttQo/0KldxHDxVxOO7zqUiaKFUiQVjpmHf4u+htPW3joc1aD0YIRKTFALKgRloQ7DBCcqqzxhWkeHqrjdhWRbMEpu/pO0Ce8At2IdcKkk66FkGNS6S4= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71f0d48c-a3df-4d44-2cb7-08d9c90d6d0f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5631.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2021 07:49:35.2823 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ynttRGRXNr05UAbtHdL13Sgg9RcEAqtRk0qrVGluLU4O7dH09F0GWSKBUxNHL1p0lE8Wd2YYWBAdqbJffkZiEw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3904 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211226_234939_349649_5ED5FCAE X-CRM114-Status: GOOD ( 11.46 ) 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 If enable interrupt in the svc_i3c_master_bus_init() but do not call enable ibi in the device driver, it will cause a kernel dump in the svc_i3c_master_handle_ibi() when a slave start occurs on the i3c bus, because the data->ibi_pool is not initialized. So only enable the interrupt in svc_i3c_master_enable_ibi() function. Signed-off-by: Clark Wang Reviewed-by: Miquel Raynal --- V5: - Yes, it actually happened when I try the lsmdo6d sensor's ibi function. - add Miquel's reviewed tag --- drivers/i3c/master/svc-i3c-master.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 3bc81ef95334..7550dad64ecf 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -569,8 +569,6 @@ static int svc_i3c_master_bus_init(struct i3c_master_controller *m) if (ret) goto rpm_out; - svc_i3c_master_enable_interrupts(master, SVC_I3C_MINT_SLVSTART); - rpm_out: pm_runtime_mark_last_busy(master->dev); pm_runtime_put_autosuspend(master->dev); @@ -1400,6 +1398,8 @@ static int svc_i3c_master_enable_ibi(struct i3c_dev_desc *dev) return ret; } + svc_i3c_master_enable_interrupts(master, SVC_I3C_MINT_SLVSTART); + return i3c_master_enec_locked(m, dev->info.dyn_addr, I3C_CCC_EVENT_SIR); } @@ -1409,6 +1409,8 @@ static int svc_i3c_master_disable_ibi(struct i3c_dev_desc *dev) struct svc_i3c_master *master = to_svc_i3c_master(m); int ret; + svc_i3c_master_disable_interrupts(master); + ret = i3c_master_disec_locked(m, dev->info.dyn_addr, I3C_CCC_EVENT_SIR); pm_runtime_mark_last_busy(master->dev);