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/JepIZZxrfPJ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c90d68ce 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) |