From patchwork Thu Jul 15 08:24:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 12379331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83EA8C47E48 for ; Thu, 15 Jul 2021 08:23:18 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 4215161370 for ; Thu, 15 Jul 2021 08:23:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4215161370 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org 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=Yzd7P3e7g949VZnWisW39Ww6y+ppjdHFaNfwJArA01M=; b=Sk/a5J9EaOS8d/ AanaA2NxHo2kZYg0mqzPaCI3Xom+jPLOzrveFjAe5Myz3RCDfMm2e5wFF8II9wZavoBL7IgtiogmD 4NakEZipfkV8ALOoyFt/zZq1xOUjqyAnbWF2t/HJjH4kYstVS1x+ccKHQipDA/lqYrtPGmkMO+dyD vRjPTNzT6bQgoWRkGi6E4HzsccyZ4fSo1EpgvznbJ7UMHrDim3wlnKpHDezZBY8hf66s7ij6UqSgY VjWJaAU2ARIEETySgPRIyKEURBD3DEs4HyhNQGqOafGeHbJ0c8qMgqBF7xapPJm2ayxywkk4Doskj F5O1k/BifH2+Ylon7d3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3weL-00HUnR-P0; Thu, 15 Jul 2021 08:23:17 +0000 Received: from mail-eopbgr70053.outbound.protection.outlook.com ([40.107.7.53] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3weJ-00HUm5-GL for linux-i3c@lists.infradead.org; Thu, 15 Jul 2021 08:23:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kqwl75E6ucaLjC/q0ggaA5vvytPhV1Hx7pYSbJ4uJbcdikCgRAVL0WBcgPke8EiDKSjZQIBTicoxE6DZC42RQTiQp3h3N7jr9bypGr6hS5Qc0Zc15ucqzqlw8rwQ/5/JfwERYQHB5WIfW6HIAO/m3aa9IQAHTpQ9t+zJ3e0iSza0jIXRC3i8gm05SF8ahqtXbQdgVWwcos2xute6cInbHyxykEVXPjnY/8zLKBWJj+SYkks0rls1aY/fc0lSpsF1MnxipvCIW6G8by1MQPr2AwK29iXBUuO3Ed0MTCyp0TgYxll8y4eowVXgrLRn4TTrFUYxvG+8WTAQ1ntH9GcyBA== 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-SenderADCheck; bh=ls6fGOJNPBTG9DB1XIg7D71kmBM8VyA9hl9+bGbLZMk=; b=XlZbrOGiXGufVxzjIsATARK7VK6E1qPSc/WteiDZmsUOdAyF44xHBxrVcS+0NinMYv6RCKWTSFek0Z+Z3eMZnpqaONl8b8SmzYSrGYIe6cylDWJ7Mbj6c2p0KeOP7neOzkn/vII/MUKzAn1THLfQS5YXUPQy78xJb6lxl+e67Qvg2BHPJJhHm1+dvZ6dTNLZNuTOgnoye4xV09SrdPo9mg3N1/FOXnCF/gfEe8m3Kf5gys+aGSrCqoSHlAWhA4sJeNCtshJ+Um6v6yOM7cxRGu4TDVoIe4V0Cl7JvCTBxHrQjvyMa0mq0C+AJ2oTQ4z+dOOlkE7tpbzXcCgRqDcR1g== 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=ls6fGOJNPBTG9DB1XIg7D71kmBM8VyA9hl9+bGbLZMk=; b=T/bHgrySgQAw9IEStGYWJLfXgNlDVeElVAHXA+o84Q7BEZu9wDibNEkAn4DDeilSznW02tam/F46l6U+S4wwtBfv0uLGowZPVSrFlSFDbJ5Vto9t8LwbwwG9w/9r9315pKqbFK9us1dpV5vDVpIBAGQ9ropvBUwjHqRHX3N36JI= Authentication-Results: bootlin.com; dkim=none (message not signed) header.d=none;bootlin.com; dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) by AM6PR04MB4167.eurprd04.prod.outlook.com (2603:10a6:209:4e::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Thu, 15 Jul 2021 08:23:12 +0000 Received: from AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::74f8:10b:8efd:b265]) by AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::74f8:10b:8efd:b265%5]) with mapi id 15.20.4308.027; Thu, 15 Jul 2021 08:23:12 +0000 From: Clark Wang To: miquel.raynal@bootlin.com, conor.culhane@silvaco.com, alexandre.belloni@bootlin.com, vitor.soares@synopsys.com, boris.brezillon@bootlin.com Cc: linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, xiaoning.wang@nxp.com Subject: [PATCH 4/4] i3c: master: svc: set ODSTOP to let I2C device see the STOP signal Date: Thu, 15 Jul 2021 16:24:13 +0800 Message-Id: <20210715082413.3042149-5-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210715082413.3042149-1-xiaoning.wang@nxp.com> References: <20210715082413.3042149-1-xiaoning.wang@nxp.com> X-ClientProxiedBy: SG2PR03CA0142.apcprd03.prod.outlook.com (2603:1096:4:c8::15) To AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by SG2PR03CA0142.apcprd03.prod.outlook.com (2603:1096:4:c8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.9 via Frontend Transport; Thu, 15 Jul 2021 08:23:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3d2ccbbe-afbf-4bef-7263-08d94769c95c X-MS-TrafficTypeDiagnostic: AM6PR04MB4167: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1148; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Gz96Mr94W21Ygbgwf731HUpf/t8hqK3eFCNloEzxKlhvOywj9DkVWrCt6aJXAuUdX4jv0nOE6X/UxVm6nN30IKSphYgcYSSLES/BYJC7dh+b/NxocE6YjJFL8PDDorJvPyYcj85G4FKGBi2YDWSpBGVnDe+Ubwl/sumHTDjoXQnboLnVVItmxUszWmVLAsDjCGerdNVkMCGTraKLS16otLChuR9KZ7dDLA6sSWYeGBlFnQhRoOck32y01mB8jXmxbXflLsp3C5cbi+96fyIi53P/MiTA09zII7fyydXPmG10dm10P4zcWVrlQIbxRVnG5Fz2tqALmWBlFMS2DJMhmpjHJdXhjc4Kf085q+SbBIsE4ncwpJHQGogBMjOgkBQ5Ea8pxp8VKkjyXNvxlO7hNmed93L37Oa92sOY+i/UqkiN+/nts3xUWqQFNzveWi9r5bUIsQgUOg8vWtOW1sYYoVmticFo+ND385oTJASmxTF72+9qIpUnqKABYk9utudrGebEdU3lLowGUtb3C4maQdT97JDZmw8NtBBebG+T2QqoQ5P1I4HFCBdyJeS5UHFNqEHtawn1F5QzvUiDz0ulw3ir7wX3KPV/cgWOEAVZ+tLButBYmsHe1lmC2Vz6j6GWG4lNzc95q4gTUwYhfWv5Pkjxg5AhcKPXh++Eu6a/KVaPAMTTsPvY/FmgSN5jV/T8nFk2Snc6GcmGGc2TUU3eLA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB5623.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(396003)(136003)(366004)(39860400002)(6512007)(478600001)(4326008)(83380400001)(8676002)(8936002)(66946007)(86362001)(316002)(36756003)(2906002)(2616005)(52116002)(1076003)(956004)(5660300002)(38350700002)(6506007)(38100700002)(66476007)(186003)(26005)(6486002)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-Message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purIvgV03NET159tnqGWCRB6Dk+C8JT4PMBtBqqvwz83r/Zw+QsNaDTfWTGyzwGoLCZuywCfUKIvqDU5s1AzT+/Iru9ykrMMNGKuNB0coSNoT1F5yMfmyda97ugKZaga+2KpK2a2FH8TJkIa1MxLRdC4BA9Z82Y2C4BoKkrYmO7B1cNeeNkiJZgp810Fs6fRZ5V5xLD7PdnVfX0Pn54hiKf/WCT/F8UI8iopx/9/7pAbeP7WBLd8/WtwdENbIKVS79/YIDlBm+uHTQ9yTDo61kaWcBJL+yncm5C8hMnplImrDliyAzl X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d2ccbbe-afbf-4bef-7263-08d94769c95c X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5623.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2021 08:23:12.7741 (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: C5tiyw0Cgim/QSMYweEWDhK/I5YxoW9qISvrrYXGFtK/w38WdHYJ6LqrV6w9+Lq4/yu9aKg5G8oCpoqEqvu9kQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB4167 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210715_012315_591052_A2C17C5F X-CRM114-Status: GOOD ( 12.06 ) 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 --- 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 892e57fec4b0..b05cc7f521e6 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -449,7 +449,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 */ @@ -479,6 +479,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: @@ -487,6 +488,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: /* @@ -494,6 +496,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; @@ -502,7 +505,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) |