From patchwork Wed Nov 29 22:12:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 171615 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:296:b0:164:83eb:24d7 with SMTP id ek22csp11680rwb; Wed, 29 Nov 2023 14:13:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQH9lzrPmGVUke/cD89bzrVUK8cUt2uibFI27A5rTNkM9f9nEILJL7cXUB/umrmUq99UZV X-Received: by 2002:a05:6a21:2d87:b0:187:71f7:bb26 with SMTP id ty7-20020a056a212d8700b0018771f7bb26mr22184112pzb.54.1701295979785; Wed, 29 Nov 2023 14:12:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701295979; cv=pass; d=google.com; s=arc-20160816; b=z0SpPQPgfuzoGkwEmfb9mfdaH6YU1RhRfbltHGZ+Wbuyqcc9+Q2am5HuEvwJGJsBRB DshXe6RV6QiiEKu+IKKTuFelcGlxdi0J4HCGCKlpQBw/QZjCl6JGXmWAZ7rY/l+1AI8B 3FVamBevykin9sbQ24z8urQyWfZFCgrFl1OY1KZifp7moWXRlcpnD5BR5YfwnlEu4/Ni lsQBFzsidtCL+tCXXNyGRNkiJLhnY6Zk6GhGPVVR5zmh9w8Ul9xcjvxd91bQqVyO0Jp9 0zuyNZjMMqBBkOH+rimsuu9iAJhSPbdVv9zvG5HIRPp7x5SedeKc6aL53mTpxZL5pgs0 QqNw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sDlf4xSFouG1bOinSyyY0+9HL8i98T9MXvpDH0ZtEyI=; fh=PdbvvRYRJ8Q0x2Lw0CjA1nrMatMLWmexk8+z0DwTFq4=; b=de/E830ExuTu3opE5VvvgUHT2jctZWKPa8JdFvGaFg4UitXVVz9O50FM7PEFtnJg86 XzXHhnG1QFWA2Qfga0/Uj7rfEthmxlhmnf8neHaOZZmQzWzhLDT0NjOBHDYQA0TPBFI6 CjNT57EMWfhQCZcZW0Iza+c5K+gBixAicjrw93yS5rY6+jylUYwK0+kxpBx3gZ8v3djj yCZa6NfuyxWTR8OJqafLwRC13HAcoJKfIei4l55CBm5Yj3Lo3E8JimZNyh1IgTLL6Jg5 K/wqDfKgPsSIP3xYkCdAwzD3r5cBjPw4r5UqRBpAe+nQ5LoyNI/gAyFRhbCkssDFbxC4 DEFg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=pXgpmX5S; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id 198-20020a6301cf000000b005c5f5194e56si3414496pgb.372.2023.11.29.14.12.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 14:12:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=pXgpmX5S; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 51FF080BC515; Wed, 29 Nov 2023 14:12:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234737AbjK2WMq (ORCPT + 99 others); Wed, 29 Nov 2023 17:12:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230408AbjK2WMn (ORCPT ); Wed, 29 Nov 2023 17:12:43 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2045.outbound.protection.outlook.com [40.107.14.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 519D4A3 for ; Wed, 29 Nov 2023 14:12:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E6AuFl7HL60izem5MOw0aNv4ZIYzrepqbcoDusqE65B2rUxrJGOFFQlO8bU1Vw7qqEyan3RG+hxe0MShWjSDR97QsqRD3+UOuTZ9wwcMyvNKm6ipODs6iP5H4JUIua5xKFNXGgqxY7RTEkGXP4NVI0J6V/Imx3nmXrRkZWJJeNfCDRKHCPHgC/INmV82sNxlHBseZCRykrSUq2wuRkHhcYQJggIJt4rUq2REiCsggt21bz5GQtk8qSN1llEesGR8Y/jLPFnSpZGckxBUANh6yDIomGH1EwL2IbhnqrgFr/dj9t1QaX3wAUeDuZQx1kEsdXipZcokGiBsTO81qRdFqw== 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=sDlf4xSFouG1bOinSyyY0+9HL8i98T9MXvpDH0ZtEyI=; b=NhvNVmfRClD2Th/UrKVNq4aesI6+SRik/7BeduKRjE5Bc8l04FAbpTx7Nr2l2fE8DcsnBBBsevCapYTAJ0yiKxQ1mAmnUkOqSSvxA3teyPyq+F4IE976/5mbF9nxYEiQuD6XEWGb+8RV1m3KU5pYICisWiRqcOXQKbUWq2MNmUZX83rT71EwWm5YkhmRvQVZOfB9FxaIXUlMUnAcBEAWbX1g4/ybWM2ho1yXFVqKDS7T2WfJnNxHgwd4uPigiO2/wDE39cnBgR5fMAOU9Cb+31W6EsyO52+XcqhYqdSAlNxuQMKpOrAX1x9j6nT+jgEB82+w9C2IYOiNDLKRIQikfg== 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=sDlf4xSFouG1bOinSyyY0+9HL8i98T9MXvpDH0ZtEyI=; b=pXgpmX5Ss+DIwAcDeTt2lXV7dzR0kRBsBeBVza52enzdrESUD4pIzzfdvW0YUgL5XVDoQxPLj8dRqKnTPuFhXx4VrpPI2JT3iIvbycdigXf16vh8TK1ji4azu2fzn6YZciBnVmmTx+c+QM5D1grsHEJPF7V80Hr4WfQs0f6tJmI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB9PR04MB9578.eurprd04.prod.outlook.com (2603:10a6:10:305::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Wed, 29 Nov 2023 22:12:47 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%6]) with mapi id 15.20.7046.015; Wed, 29 Nov 2023 22:12:47 +0000 From: Frank Li To: alexandre.belloni@bootlin.com Cc: Frank.li@nxp.com, conor.culhane@silvaco.com, imx@lists.linux.dev, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, miquel.raynal@bootlin.com, zbigniew.lukwinski@linux.intel.com Subject: [PATCH v4 1/6] i3c: master: add enable(disable) hot join in sys entry Date: Wed, 29 Nov 2023 17:12:20 -0500 Message-Id: <20231129221225.387952-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231129221225.387952-1-Frank.Li@nxp.com> References: <20231129221225.387952-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR04CA0003.namprd04.prod.outlook.com (2603:10b6:a03:40::16) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB9PR04MB9578:EE_ X-MS-Office365-Filtering-Correlation-Id: c56aadeb-5476-4a4b-b5ec-08dbf1285164 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8T6UvqL72rIyTUg8dN18HgG6jDUJ66471hzNfWi4rBAHBtNeLEKaY8n5ysIqoWKvFyobVzmWIUrQda1xeS8ocov9vEInA7GRhL4+gpQQ3ESgMfSoRxP+N63iGKxtyArluV/7aDb9qQBPT02SmvBC7v3sDQhwdzFo6jeeXUiQR0uwmhNdGfveagwGTOYIeRIhfGpyU67YxF7Rt/uFbgwH2u2NZg+BkhrYr0nKJhaDn0062/IA8fjLZMYQoQx21OaMltLyxX7Z54e4XU+5ehLr9nE5tt5HXyVmlFZqNeKYPUPvl/03d6k1n6M+aF/Fv8rMnvWFdJiJOX6zZn6ZvLxfT7QRhUUPrpvxQuOvdp8/ivler5JknE5G8MuTNic2GjIWfns6H+3RRFBoNC6XYWhdN/QvqRzcWFyOutWPMXczMZ4QCDDKEopKdWbKe3PepGeP7npQPkh0RkLxssy6sGd0WvH4cu+1UzRUHMNVUhwq/8UZYVhuY8ec9Dl9nAgAAyMLC5KRjDetiKaKA51FmwTKZ6uCuDGlzz5fM0sLMgRTAbKJK0SJxAZEFPl2K7nRN0MSa5Qb4dIoSZu/aTsDdwofoNQox/HOHfByTUq80ywDDdfL6wt40q+PdUgiysL1SQL+yWnRaAkMeGeAt0aAUyukS8XTqzl3qHXXchMGKgFp4uVKezoYhERa8mPpDKBMzCFm X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(136003)(346002)(376002)(396003)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(202311291699003)(38350700005)(36756003)(2906002)(41300700001)(5660300002)(86362001)(6666004)(6512007)(52116002)(83380400001)(2616005)(1076003)(38100700002)(6506007)(26005)(316002)(66476007)(478600001)(6486002)(8936002)(66946007)(8676002)(66556008)(4326008)(6916009)(309714004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KFsGWnNOwltynlexzi5u2ESBFmm4iqjE1fDffTCeku7zK4UrrwfCnqGemHSdXw1rDaQk1lm+zk2LiAd8xro07rPGryobO051Tz6i71AO8/JuATTbvc9VPjwyx+1S+Aqfm2jmf7y3grf7yWOEr2HYHDoJMIn9CD2izXqENzae1bi+GdXEdGBPYgdT+OkqCUVQiR5xm7KY5C4cWr+ikVXfO9a+g7V9iYt6SrRnfSeCjluJaruffc+5lhbqkn88Lu67jNfjWNtvlJkjT+KaoABfnuV1/WLAr9oYPuZ4cIZnuoZoyUdOcxmxqXQZ7Q1cQ01lXe+Ct8MjrpJgXSrk7v8daSuzwxFj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6nh9Mx3As6XNYMuCFujtoBZdn4PHULldxFw6KNkl2x672Pzhu4UZWV/w1jcKup+TYsU97hQ/7xsDU+IvZDA4Ka+4wn3Aatf0KuoyZirCX/N+yWTe8NFpoclL9K1thtB7F7leTsrTdqa7BnIBLgV2WIrY2mbOGwNVX/WrLLLWExd1EOWGn X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c56aadeb-5476-4a4b-b5ec-08dbf1285164 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 22:12:47.1334 (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: /g/ITY229ayTGX/TLiZUaYMzBUSjufNblxgFEyJ/f8Qwh6gN2WQjjkTbOxy/eikPE7640u0sATSk7r7wOZEhyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9578 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 29 Nov 2023 14:12:56 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783938133189413512 X-GMAIL-MSGID: 1783938133189413512 Add hotjoin entry in sys file system allow user enable/disable hotjoin feature. Add (*enable(disable)_hotjoin)() to i3c_master_controller_ops. Add api i3c_master_enable(disable)_hotjoin(); Signed-off-by: Frank Li --- drivers/i3c/master.c | 84 ++++++++++++++++++++++++++++++++++++++ include/linux/i3c/master.h | 5 +++ 2 files changed, 89 insertions(+) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 08aeb69a78003..ed5e27cd20811 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -526,6 +526,89 @@ static ssize_t i2c_scl_frequency_show(struct device *dev, } static DEVICE_ATTR_RO(i2c_scl_frequency); +static int i3c_set_hotjoin(struct i3c_master_controller *master, bool enable) +{ + int ret; + + if (!master || + !master->ops || + !master->ops->enable_hotjoin || + !master->ops->disable_hotjoin + ) + return -EINVAL; + + i3c_bus_normaluse_lock(&master->bus); + + if (enable) + ret = master->ops->enable_hotjoin(master); + else + ret = master->ops->disable_hotjoin(master); + + master->hotjoin = enable; + + i3c_bus_normaluse_unlock(&master->bus); + + return ret; +} + +static ssize_t hotjoin_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct i3c_bus *i3cbus = dev_to_i3cbus(dev); + int ret; + long res; + + if (!i3cbus->cur_master) + return -EINVAL; + + if (kstrtol(buf, 10, &res)) + return -EINVAL; + + ret = i3c_set_hotjoin(i3cbus->cur_master->common.master, !!res); + if (ret) + return ret; + + return count; +} + +/* + * i3c_master_enable_hotjoin - Enable hotjoin + * @master: I3C master object + * + * Return: a 0 in case of success, an negative error code otherwise. + */ +int i3c_master_enable_hotjoin(struct i3c_master_controller *master) +{ + return i3c_set_hotjoin(master, true); +} +EXPORT_SYMBOL_GPL(i3c_master_enable_hotjoin); + +/* + * i3c_master_disable_hotjoin - Disable hotjoin + * @master: I3C master object + * + * Return: a 0 in case of success, an negative error code otherwise. + */ +int i3c_master_disable_hotjoin(struct i3c_master_controller *master) +{ + return i3c_set_hotjoin(master, false); +} +EXPORT_SYMBOL_GPL(i3c_master_disable_hotjoin); + +static ssize_t hotjoin_show(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i3c_bus *i3cbus = dev_to_i3cbus(dev); + ssize_t ret; + + i3c_bus_normaluse_lock(i3cbus); + ret = sysfs_emit(buf, "%d\n", i3cbus->cur_master->common.master->hotjoin); + i3c_bus_normaluse_unlock(i3cbus); + + return ret; +} + +static DEVICE_ATTR_RW(hotjoin); + static struct attribute *i3c_masterdev_attrs[] = { &dev_attr_mode.attr, &dev_attr_current_master.attr, @@ -536,6 +619,7 @@ static struct attribute *i3c_masterdev_attrs[] = { &dev_attr_pid.attr, &dev_attr_dynamic_address.attr, &dev_attr_hdrcap.attr, + &dev_attr_hotjoin.attr, NULL, }; ATTRIBUTE_GROUPS(i3c_masterdev); diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h index 0b52da4f23467..65b8965968af2 100644 --- a/include/linux/i3c/master.h +++ b/include/linux/i3c/master.h @@ -452,6 +452,8 @@ struct i3c_master_controller_ops { int (*disable_ibi)(struct i3c_dev_desc *dev); void (*recycle_ibi_slot)(struct i3c_dev_desc *dev, struct i3c_ibi_slot *slot); + int (*enable_hotjoin)(struct i3c_master_controller *master); + int (*disable_hotjoin)(struct i3c_master_controller *master); }; /** @@ -487,6 +489,7 @@ struct i3c_master_controller { const struct i3c_master_controller_ops *ops; unsigned int secondary : 1; unsigned int init_done : 1; + unsigned int hotjoin: 1; struct { struct list_head i3c; struct list_head i2c; @@ -543,6 +546,8 @@ int i3c_master_register(struct i3c_master_controller *master, const struct i3c_master_controller_ops *ops, bool secondary); void i3c_master_unregister(struct i3c_master_controller *master); +int i3c_master_enable_hotjoin(struct i3c_master_controller *master); +int i3c_master_disable_hotjoin(struct i3c_master_controller *master); /** * i3c_dev_get_master_data() - get master private data attached to an I3C From patchwork Wed Nov 29 22:12:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 171617 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:296:b0:164:83eb:24d7 with SMTP id ek22csp11749rwb; Wed, 29 Nov 2023 14:13:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6OQwHChRh5joqrCY54rNHAPfFBJbLbs73BN2L/+jjsAlVH8C82sdgYPFUNurtJFeCTb/v X-Received: by 2002:a05:6a00:1387:b0:6cb:68d7:b1bc with SMTP id t7-20020a056a00138700b006cb68d7b1bcmr19970207pfg.30.1701295988099; Wed, 29 Nov 2023 14:13:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701295988; cv=pass; d=google.com; s=arc-20160816; b=mbm8ofc87jA/9c7p1d5hgwnMiegIKw6yf6iNPlHqLXj0xD02vIJ6uhw5h0HqaB4k+E hJidmeOwh80UIoVH+8yGzeSwTedPRVZXv/RZcX/Bf6O3EWWC4z62nXR113Hqiq8dgebr LoUvgIsEtbqNden2NRsyaWb2oNH0nO99w/A6X2Xhe/AFveYhkFcjxbTwtvvHAhDvhKq6 E4xz1VM412Nz90YBigCJZjrf486qSE29lNDZ5YXOorU7SwfenFt5bFizVrkzG16XzSN5 X0vmOmsKlFczsrPgKypdWTE5Fdp/Ena+KyiJEs6eR5Zxq2ieoRARGPOkc/OwSISq4l4Z DHTg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ejs+fzDBAH2ZY/qjkH7dS4XB9G6YOzq3AX8ZgGT5dkU=; fh=PdbvvRYRJ8Q0x2Lw0CjA1nrMatMLWmexk8+z0DwTFq4=; b=UbJZ+JqSM5RhhZuCIdpIt2DnbxKqhHqWfyzHXaNekzbUz2vhUbSUZdVP/0Z+ivB3Lw kZhYBfOvtxhA8JRXO9eDuHS/zSVwO8E+1vK4C5FUV8CYaLl9ilPac2pGM2BOjcbfalF1 EMY6vGbyTJAXGuHD/23aOQwbbjOR1TunZRLFb+V2/nhfzH3/8u7Vd2MVYeXkgQP/59R4 wowQB7Q3Ztp+/cqcltn6oA4wRKnUTFHeBlbcz4BjWxObGTYcrz1ZsIvXLyIP00Fm87Yd sF66NDGOXPloaZFBrFD/jm+r5K1EHbPIlrOg5cVvd5wBV7swFBAa7nVc96S8ppj2czD4 P4AA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=SgkiI0iW; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id f11-20020a056a001acb00b006cb6e6a740fsi15403275pfv.74.2023.11.29.14.13.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 14:13:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=SgkiI0iW; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 48FFB80BD39F; Wed, 29 Nov 2023 14:13:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234756AbjK2WMt (ORCPT + 99 others); Wed, 29 Nov 2023 17:12:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234576AbjK2WMp (ORCPT ); Wed, 29 Nov 2023 17:12:45 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2045.outbound.protection.outlook.com [40.107.14.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEC1CD1 for ; Wed, 29 Nov 2023 14:12:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cT9WW8COAZbtUwwb07C9LYivJFV+bKJzyz1PRRC9JE5h2fKXZL5KZ941Z4pW2T/Exi9x5AYCBE70ZtSOVCFqmHBp2mf2t+AcMOWqNsXBUvJ5mVLjK2NkosG69x7IAIHfzmYsoJ293pWHh2xo8GADOlIxeiiatHrXYnWQyPJLspVREskGSStOXdajU9FXeCjZuZku8E0u63fyS6qWwWIipNuKmjCCMw2qs+/X4DdSwCVIhWz6abNT4335JcW8qnCh2BOTwSTc16735I/d0TcCcuufgiWlpdANItk/NLK49yBQwzwBBw5diN9mFM6OX9uSJPM+MNAeKXEschZS+bA5FQ== 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=Ejs+fzDBAH2ZY/qjkH7dS4XB9G6YOzq3AX8ZgGT5dkU=; b=LiWAo6+YjmnJfZLqcmHyTf4+RtRv/3+RlxQ/rq/xNQ5VRqkdUPVd3turgxLnqmkVFPFcmYF1q6whoiKNGsKPOyz+ce735QQuUBb5uR6p9zi7Mwuz/TwdD5sVgHv2cQNtU+KH8I5FvVF9wxjzpFVIbxFDN3ktbC+2yHNQtehAWKTgy/zWhdhlZr+FsHbgDfX6fHWJPWjNvrHQUCQ7xHHtnmjub4KEKwZwzJKI8eVxamu9Tj34/NT1WuYZrVeIpUwlWoBn8jY7yTc6AAsRFTrFyAAbWEqPWQa60Gns/oM3oNxTYfNoxyuEikYV/XSdWfs6cLrJqR3kL3nxIDFPb+L4hQ== 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=Ejs+fzDBAH2ZY/qjkH7dS4XB9G6YOzq3AX8ZgGT5dkU=; b=SgkiI0iWA1pte1bkBn4uJFk4uzqq8uEoWbi/4Y5GjqMFVkD38NE5uIW/s2nrHL9LE6lWirc5BMA3SWVczA7tVWel/eRm+M8czKV2GJn24e/F0GSi9mAtm39jURIxBZ4NcVfky/P2QNoz8aZeC897t2hiK6CXgpOdXCoWku/1adQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB9PR04MB9578.eurprd04.prod.outlook.com (2603:10a6:10:305::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Wed, 29 Nov 2023 22:12:49 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%6]) with mapi id 15.20.7046.015; Wed, 29 Nov 2023 22:12:49 +0000 From: Frank Li To: alexandre.belloni@bootlin.com Cc: Frank.li@nxp.com, conor.culhane@silvaco.com, imx@lists.linux.dev, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, miquel.raynal@bootlin.com, zbigniew.lukwinski@linux.intel.com Subject: [PATCH v4 2/6] i3c: master: svc: add hot join support Date: Wed, 29 Nov 2023 17:12:21 -0500 Message-Id: <20231129221225.387952-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231129221225.387952-1-Frank.Li@nxp.com> References: <20231129221225.387952-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR04CA0003.namprd04.prod.outlook.com (2603:10b6:a03:40::16) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB9PR04MB9578:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a3dec51-7000-4016-907f-08dbf12852e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NWUpI+ThdopmHyGa2HNuyyXLOxnXBFLVos/u0o0sM3fqmekFFBQgYnGJUkER1n15VHx4tKl2y22JdOfcgg75FT5LJvEpE03R5VzP7YEnnMox5IfSRIHkUnRC9wDHVn6igWqdzRYXWpMaYf0WX5u72+CuMoOlVX4GsDqgLo0+rtuMqkSXc/ATpSzxH4eQpZblrDt0CqaZBothkL0CFlYI94K0VR9FUeMDLa9o0xhHaypLXT1PSy26HzYFyfBNkPMz+xciRU0KHjKPrCQgWy/dGXFlGtP4cULj9odAMl2CSIFQjVN1Iys+T85Z8/dqbNLLGGgSGAHcL/dP+aSrzJ1H2UzGtO1EORjW8oxbuJIyktsA2rSRFgYapv9Wa6eQhCad6q0nHjXmXVB94mO+h7cY9+Dwadg6FCcSoxnHlmVtS+PM6RR5FK53yJkbhxvdySWvSJYY512x66PvWVo28XRgvILprxCHpaRRVfjJ12bpmADso+wVqorSc/cYc952DjrQ6Yn2vIOOtNzmvWqY/uAahRUYa4igKhKbmw6J4SBexC2fiofhR6Z4D6QWMu+56a1o69zvLfE3IkWZxH85qwz41ATKOaJrDbymPNHAqthPPyry9ywoKK5TX+UYBBYTcxdo3V4p0fyk/1s5zmwp5v3e1tD2UGBOIp/ak9/4yFHW3DY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(136003)(346002)(376002)(396003)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(202311291699003)(38350700005)(36756003)(2906002)(41300700001)(5660300002)(86362001)(6666004)(6512007)(52116002)(83380400001)(2616005)(1076003)(38100700002)(6506007)(26005)(316002)(66476007)(478600001)(6486002)(8936002)(66946007)(8676002)(66556008)(4326008)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wqWsEHyiJP44QbnKJBehDrqARFaHHggpi/PdiXUUjz850JFIUHFc89+yfHUvfre1rwvRxfr6Azhdn2c3rWBnG/ndHZO3XWtTGaRKLm+oj5efl0sv49ZqspUKxVOZFJexSvi0rvDtPqJefKJdVwZ7urWm6ZZlNRBp4+SvmWFgT9tiD3mOSYkHko8x/UmIHrOluOViDZJMbYqV4a6h3lz2M+ayHixStZvlZcMSSgwOrvcfErWZIOELR+bf2Mgcu/cxr4ljC2v41dzri2a4EoQToT1QG21N9cRjBkq1RVQUR0BZJVD/+OrOfVKLfctGdd1yH6Vfsg6wqByesaqi95LR/cq+zYul/QI3DS4ey/Hcgd/IbojQsEullJQV1mH/LMlDpYZj86YO5aBXToMXiAuQmjWa/0v7b/ExOmJ1Tn5juAa3FKhLkE3EvhHn7M5mZPpw3Cs/Zz4HE04oEp/7lex8e7b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MIHSrxpjsKwjwBximLAlSLuRphQh/8Tp/bp0CrJhRQH X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a3dec51-7000-4016-907f-08dbf12852e3 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 22:12:49.6112 (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: 5O6DsE43ddHBoZIj0/4hSXlcg8S+1HtXKNWa8Ny6IN+vCUBnwo3UPaFFJi/yEoNY8a2wWRbNeVd8xgSk0UpAVA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9578 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 29 Nov 2023 14:13:04 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783938141961128194 X-GMAIL-MSGID: 1783938141961128194 Add hot join support for svc master controller. Enable hot join defaultly. User can use sys entry to disable hot join. Signed-off-by: Frank Li --- drivers/i3c/master/svc-i3c-master.c | 58 +++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 6b6bdd163af4f..880c6ae76c013 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -128,6 +128,9 @@ /* This parameter depends on the implementation and may be tuned */ #define SVC_I3C_FIFO_SIZE 16 +#define SVC_I3C_EVENT_IBI BIT(0) +#define SVC_I3C_EVENT_HOTJOIN BIT(1) + struct svc_i3c_cmd { u8 addr; bool rnw; @@ -176,6 +179,7 @@ struct svc_i3c_regs_save { * @ibi.tbq_slot: To be queued IBI slot * @ibi.lock: IBI lock * @lock: Transfer lock, protect between IBI work thread and callbacks from master + * @enabled_events: Bit masks for enable events (IBI, HotJoin). */ struct svc_i3c_master { struct i3c_master_controller base; @@ -205,6 +209,7 @@ struct svc_i3c_master { spinlock_t lock; } ibi; struct mutex lock; + int enabled_events; }; /** @@ -428,13 +433,16 @@ static void svc_i3c_master_ibi_work(struct work_struct *work) switch (ibitype) { case SVC_I3C_MSTATUS_IBITYPE_IBI: dev = svc_i3c_master_dev_from_addr(master, ibiaddr); - if (!dev) + if (!dev || !(master->enabled_events & SVC_I3C_EVENT_IBI)) svc_i3c_master_nack_ibi(master); else svc_i3c_master_handle_ibi(master, dev); break; case SVC_I3C_MSTATUS_IBITYPE_HOT_JOIN: - svc_i3c_master_ack_ibi(master, false); + if (master->enabled_events & SVC_I3C_EVENT_HOTJOIN) + svc_i3c_master_ack_ibi(master, false); + else + svc_i3c_master_nack_ibi(master); break; case SVC_I3C_MSTATUS_IBITYPE_MASTER_REQUEST: svc_i3c_master_nack_ibi(master); @@ -471,7 +479,9 @@ static void svc_i3c_master_ibi_work(struct work_struct *work) svc_i3c_master_emit_stop(master); break; case SVC_I3C_MSTATUS_IBITYPE_HOT_JOIN: - queue_work(master->base.wq, &master->hj_work); + svc_i3c_master_emit_stop(master); + if (master->enabled_events & SVC_I3C_EVENT_HOTJOIN) + queue_work(master->base.wq, &master->hj_work); break; case SVC_I3C_MSTATUS_IBITYPE_MASTER_REQUEST: default: @@ -1471,6 +1481,7 @@ static int svc_i3c_master_enable_ibi(struct i3c_dev_desc *dev) return ret; } + master->enabled_events |= SVC_I3C_EVENT_IBI; svc_i3c_master_enable_interrupts(master, SVC_I3C_MINT_SLVSTART); return i3c_master_enec_locked(m, dev->info.dyn_addr, I3C_CCC_EVENT_SIR); @@ -1482,7 +1493,9 @@ 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); + master->enabled_events &= ~SVC_I3C_EVENT_IBI; + if (!master->enabled_events) + svc_i3c_master_disable_interrupts(master); ret = i3c_master_disec_locked(m, dev->info.dyn_addr, I3C_CCC_EVENT_SIR); @@ -1492,6 +1505,39 @@ static int svc_i3c_master_disable_ibi(struct i3c_dev_desc *dev) return ret; } +static int svc_i3c_master_enable_hotjoin(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 ret; + } + + master->enabled_events |= SVC_I3C_EVENT_HOTJOIN; + + svc_i3c_master_enable_interrupts(master, SVC_I3C_MINT_SLVSTART); + + return 0; +} + +static int svc_i3c_master_disable_hotjoin(struct i3c_master_controller *m) +{ + struct svc_i3c_master *master = to_svc_i3c_master(m); + + master->enabled_events &= ~SVC_I3C_EVENT_HOTJOIN; + + if (!master->enabled_events) + svc_i3c_master_disable_interrupts(master); + + pm_runtime_mark_last_busy(master->dev); + pm_runtime_put_autosuspend(master->dev); + + return 0; +} + static void svc_i3c_master_recycle_ibi_slot(struct i3c_dev_desc *dev, struct i3c_ibi_slot *slot) { @@ -1518,6 +1564,8 @@ static const struct i3c_master_controller_ops svc_i3c_master_ops = { .recycle_ibi_slot = svc_i3c_master_recycle_ibi_slot, .enable_ibi = svc_i3c_master_enable_ibi, .disable_ibi = svc_i3c_master_disable_ibi, + .enable_hotjoin = svc_i3c_master_enable_hotjoin, + .disable_hotjoin = svc_i3c_master_disable_hotjoin, }; static int svc_i3c_master_prepare_clks(struct svc_i3c_master *master) @@ -1630,6 +1678,8 @@ static int svc_i3c_master_probe(struct platform_device *pdev) pm_runtime_mark_last_busy(&pdev->dev); pm_runtime_put_autosuspend(&pdev->dev); + i3c_master_enable_hotjoin(&master->base); + return 0; rpm_disable: From patchwork Wed Nov 29 22:12:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 171616 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:296:b0:164:83eb:24d7 with SMTP id ek22csp11736rwb; Wed, 29 Nov 2023 14:13:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IG6NVm457tv6q9lINyjjsAwNsTiGn5iDzb2JX4/3tXNnd+ZZiH9TJucTt50YEdvaYIchrSN X-Received: by 2002:a05:6a00:2410:b0:6cb:903a:b064 with SMTP id z16-20020a056a00241000b006cb903ab064mr21887410pfh.22.1701295986488; Wed, 29 Nov 2023 14:13:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701295986; cv=pass; d=google.com; s=arc-20160816; b=fa6bl2wcgQeSu64b8QvMvpBKPitR9aHS1RFiZFKePyAHPi/KD5NYYv029ES/7DnTbI LMUuiGjXg2uoB7P0WbWabg2z6f7Oafv49lZVNJhBQ9Pb+DZZeBsD6B2hqRwQsRk9O1yk IL4qw7fSEgcC5Fh/YwaWgsXiQNfwKgNBApg/v1tUcavICF8lVoFUEjMKZcdYG2lpavFy dQ5W/TUDY9b70XLSHCmjUZKx3YiRSUu2IqB53tnU1xzRrHxosQLdfr9/m3kzSA++9Us4 YeX+QuE3OAoAc+JfGzpFji3DfqGjISaBR694Fd31S8eTyCR5vnrYu+gl//6Gzx5fyOBC XtXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=++WWKqxHPtPOuShZ9C+n6tM8dcE6BdIrF96tSwG9XqE=; fh=PdbvvRYRJ8Q0x2Lw0CjA1nrMatMLWmexk8+z0DwTFq4=; b=0idJpoUPS7fT6jxhQXlzKmeZOCVj6/OYuWd3Gbi5VOZec9ySakuA6nd6PEVem75eOs s2jMPGlV4Bns3IvJgcwFYcnrTd9lCxsnfWs36YHFGjoRzfHmvxELSlOA+FoxiYghKBaF G/LYhZgpet63ozcFVb8RWZi6ce5/O5K3GF/Apo7HTPrOqdaOlajI8Hewu2ICwieODb0/ dbES/KaPaAUBMm6evNORr9Snh9nZiWmLgfJsvn7CthGENkDqyk9y/xCNibuJWtGxN/QJ C45aqRxyUY6Vq/FssloA6Z2bVX3AIzBUdMfHPlkx05evDRuGHSK5RdJyWQbvL3wFuZ0e q9Hg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=OmtZJzw0; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id q3-20020a056a00088300b006c4a78a81a5si15328039pfj.88.2023.11.29.14.13.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 14:13:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=OmtZJzw0; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9589880BC511; Wed, 29 Nov 2023 14:13:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234837AbjK2WMw (ORCPT + 99 others); Wed, 29 Nov 2023 17:12:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234683AbjK2WMt (ORCPT ); Wed, 29 Nov 2023 17:12:49 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2081.outbound.protection.outlook.com [40.107.14.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0B05D1 for ; Wed, 29 Nov 2023 14:12:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EDsQ2KcAuz0d8mg2XG882N4R69w2/0MdK1pXwB0+3F5g/OdIYJD4WqNZSiIo9RUACqgsSOM0q6O5/Mg1mt+fxI8n8Jhc+xqzLF2G3ObsyW5jOVwncvRaZcYb7uqz05PSx9nQgu9xR7T9gqsGBCH8FfO61ZgNSIiSlUuKRKMmqWCx+Rqd1xFsWNvzgiDLwceDwXXDEly6e7GDBLe12ssRc8KRg0dI4y14znO7ou3PRwjVOZT2Hw3p2iStn9vyj5sdLhC+zSDYRFGqI3eB2HGaRt/1YeityntyD3N1OildUV8wz9WbNnldkMNZdrIyuSzww6yvdcprW3UwAlSkv75Kvg== 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=++WWKqxHPtPOuShZ9C+n6tM8dcE6BdIrF96tSwG9XqE=; b=nf7a5rgOv+UPOHZTadyLE+anwpzul7VX5pgl7FvBAksfwGOIgg4C2ONXcEvrm63sJGgeqzd3/fgwk+P7IISgPo2mPMBXqAjY8Qi8lDD1up2b0N1JPQtP35CQvg3RwiaM0tjsnE6lXhPLrAqZ2gkUr9ZgzX7g/4pgNtgiCW6TXuq8e9E3fMwwbMPYvCNNAuzhkv8v0o5silQz8DkQmEc+3yF3clzGe3G4Z3LwRMFoFOEX/ztYs4aRQ+13jB8HEs7DkLPpqTso3S7D/REFu8tGWT6Ux/g9pw1EHRUJwYpl9POJV9n7UV/Rty2IF9HgPYx8KdlusiZ7VW4U/88UcpRshA== 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=++WWKqxHPtPOuShZ9C+n6tM8dcE6BdIrF96tSwG9XqE=; b=OmtZJzw0E+IRJfBDs/uBI9vKMDzYcCMcwdOdyw9UA25l1FxYNAD1tcoiKngu8SVepfALNU6DIa3ALik8yHfhQE1zbK9iaR9Ejy5ez0zrRUL+ns8G+FfMRiHqe0AgpMYi416bFi/buVI52B51hwyfve70zWf4iSqfhgBCmgrUWv4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB9PR04MB9578.eurprd04.prod.outlook.com (2603:10a6:10:305::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Wed, 29 Nov 2023 22:12:52 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%6]) with mapi id 15.20.7046.015; Wed, 29 Nov 2023 22:12:52 +0000 From: Frank Li To: alexandre.belloni@bootlin.com Cc: Frank.li@nxp.com, conor.culhane@silvaco.com, imx@lists.linux.dev, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, miquel.raynal@bootlin.com, zbigniew.lukwinski@linux.intel.com Subject: [PATCH v4 3/6] i3c: add actual_len in i3c_priv_xfer Date: Wed, 29 Nov 2023 17:12:22 -0500 Message-Id: <20231129221225.387952-4-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231129221225.387952-1-Frank.Li@nxp.com> References: <20231129221225.387952-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR04CA0003.namprd04.prod.outlook.com (2603:10b6:a03:40::16) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB9PR04MB9578:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b0a95dc-92c5-4ba6-89fc-08dbf128545a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LU9ldm+8pEXiKI5yIpulC0Za5ZMpklP4GoQ0jnVdV4KmKgBco9ckwHKqCI843WF7e3Ptvn/aH5PvsfGQbQCrPmv0yz4hoT/5SUZgy7nvqH8bombV3map6TQ4JGR70w+QSAcdeY4gmq1RAqxcymJtMMSz4hFCnpH1TUGsJ9PdKYA/2O3K01qUOYyRg5UT8B22SJe6f/QpnHkOIQWZ3Gcect0/BLGn+vS4t+ZLIWbeUWwXDzxxqQLbXwyMCLPk77kqd972R4mMhd7Oe+E3a5cLhYfboHDSVnw8qJ5xEt+rZiBX9Aj2aQ1Owi8PhUrKXBX3kYBd25RpaJdOhjBOT/k+TOMbViWYKul40fh8jDiDUz/Jn0DsfEj59hMt/yKPuqyr4Fg9H9dmybq7yZpuMhilmeGr2s0gAJwIZN2IcWk5gj6jawg0lFG/P1mue6+RsyWzuIiLEpz3A0IubCx7zeckRsOH+Mb9gk3qeI6KJOT2t91nH8TzFYJZBUPnNLAZsXVMstf8UgqCwP/LxiqQp1jav1eDdUW83uMED38f5eVso/go17TuacEaG0MSGaFEIS8NcOfxGHZSyk2Zs/u3M0vbt+uDQL8jrh/UzzFcYSsI3Nwy0GQ/rWBZJO95CPQyXOHzWoQyApQini0gPpQuAMxyow2fzn/oiuHvTvOMky39eyg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(136003)(346002)(376002)(396003)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(202311291699003)(38350700005)(36756003)(2906002)(41300700001)(5660300002)(86362001)(6666004)(6512007)(52116002)(2616005)(1076003)(38100700002)(6506007)(26005)(316002)(66476007)(478600001)(6486002)(8936002)(66946007)(8676002)(66556008)(4326008)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?TMME2RyQfrhkR/ayBTqJFyfFBE9o?= =?utf-8?q?s8hGR2VnT6HqsFpQXOVeDS33vxrmsxfRc8CVHZGZ92nGpi9Rb7EvqeRwZrhK8kZnk?= =?utf-8?q?EnXGzc4aPDAanmx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LamwuPUTph6fMaeKo6WyAQa7WP02aHqsmVy5HquPML3Zta/htEzUEupaSja9wl?= =?utf-8?q?Pkp3STjuTc4eFX4dsw4YKRRp6a08r/NTneVLMo0rARm5QKtB/60MEe10uYdPC0UT+?= =?utf-8?q?GPbWKUcdVMYmXNhS/7U5A5qMeUd44lSnl/nP8rlgXfWk6ISW+1FPOTnZTquxuQ16o?= =?utf-8?q?NwEhAvUKf7KpgSCaeB3NTC5tu71J7k5Vq6dOLm/GAWC8LhctD+XS9MSvDa8e6BOAg?= =?utf-8?q?fq4oZBGM0ZxBeY3M94gdQ8bzhu9di63XgH9RALbgyPWxkQoht9VWJAgtrMzYn27e8?= =?utf-8?q?IQjtJqmp7WmLzH37mUlRWD0Pl4febdMtuq8r5yaB7nJsZx7gT5QG9KgCDQ35A5dCG?= =?utf-8?q?SXG7XPC6mBSp0OpfV/PUAR80sp3eaD1bZFJy7qidXNPuOE896mndN9EoSblLPd/4H?= =?utf-8?q?qID1SCc4rAHOqyc4ghOlA1Has6tV4l9JCDh9pyC1dr76wD8vmb2s+bL+Xg2A2n7TB?= =?utf-8?q?zO4QN2tvAn10XtM1TNvXXCD0Hdl9HXwayvbuTddcDYpaGzGoBFKDcyZ3QNSwZclYM?= =?utf-8?q?YdO5xRSq97gC?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b0a95dc-92c5-4ba6-89fc-08dbf128545a X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 22:12:52.0818 (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: GqW7yc0q+PBmiRvVU9wojR9eEHastHvAeMhzhrSM4YuvLvhV5ROZUhkpXIA1IZ6M2QCPNYoMhWY5IAi68aHvAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9578 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 29 Nov 2023 14:13:04 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783938140473996137 X-GMAIL-MSGID: 1783938140473996137 In MIPI I3C Specification: "Ninth Bit of SDR Target Returned (Read) Data as End-of-Data: In I2C, the ninth Data bit from Target to Controller is an ACK by the Controller. By contrast, in I3C this bit allows the Target to end a Read, and allows the Controller to Abort a Read. In SDR terms, the ninth bit of Read data is referred to as the T-Bit (for ‘Transition’)" I3C allow devices early terminate data transfer. So need "actual_len" field to indicate how much get by i3c_priv_xfer. Signed-off-by: Frank Li Reviewed-by: Miquel Raynal --- include/linux/i3c/device.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/i3c/device.h b/include/linux/i3c/device.h index 90fa83464f003..ef6217da8253b 100644 --- a/include/linux/i3c/device.h +++ b/include/linux/i3c/device.h @@ -54,6 +54,7 @@ enum i3c_hdr_mode { * struct i3c_priv_xfer - I3C SDR private transfer * @rnw: encodes the transfer direction. true for a read, false for a write * @len: transfer length in bytes of the transfer + * @actual_len: actual length in bytes are transferred by the controller * @data: input/output buffer * @data.in: input buffer. Must point to a DMA-able buffer * @data.out: output buffer. Must point to a DMA-able buffer @@ -62,6 +63,7 @@ enum i3c_hdr_mode { struct i3c_priv_xfer { u8 rnw; u16 len; + u16 actual_len; union { void *in; const void *out; From patchwork Wed Nov 29 22:12:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 171618 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:296:b0:164:83eb:24d7 with SMTP id ek22csp11797rwb; Wed, 29 Nov 2023 14:13:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGlhpRzaQ7Bc+SHVk2nlwpIOQv6Y3qTT4I2IzdB4eoUCHQGazWCAyTEY1b9x00zGUXI+F96 X-Received: by 2002:a17:90b:314c:b0:285:a18a:49c0 with SMTP id ip12-20020a17090b314c00b00285a18a49c0mr18778038pjb.28.1701295997082; Wed, 29 Nov 2023 14:13:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701295997; cv=pass; d=google.com; s=arc-20160816; b=P9irAAnlgERRA9DfYubdELdB/98Qce2RCfDRP3JahEFVCbAKM0gMFXDj9/bQu/PuHv uzCfK3+zA/zdaDyZNODllb3L3IHUpZlDWkCbvbJbc2W4/57tM7g3uI1LOItBM7xKAtlR nptDc0JvJ6skV5W3GUR5HEdmKu8hvw3QruIT45j+BztU84o69Xmc3tvPQup71AsNfilS 59nPAXV2VzAy71QB9WCayaVHGEK16OQ9dyB5k+m2x45xybJmujwJhA4qyvk+91+0Rfz8 qvmkcDeipssSgmEG8fNHQEre0MANNWzTA5OyCsK7T4YniNXOJmryuyMG0oVGTkLL/TB8 bmUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BYlOqxYRwrA/DY9Y5S2Maw7Zy0Q7zqC4/7Z+mE81oiY=; fh=PdbvvRYRJ8Q0x2Lw0CjA1nrMatMLWmexk8+z0DwTFq4=; b=qxZfuP/Fbhu2i8Xjq+b1kwRSnc5m7ZwNijQiMJM0oPZAgDeG6pjmBgja209OpVPe41 w8M8udALQ3Rc9yWquIRnDizrrO0qpbLJfwieJ0bD7TagnHEN9HcIgeBeotNuAAnWwB7T 5lx3cbK2PdRJ1DzZHMAaAED/a+UR8FolVEEderZSYxnm4Qqht7XuDzbQGS5wMWghH0xF 4V4PeveXOz9nFxJWslA/h/wUcQXjAC29cpfAS4QWhx0nFlBKi4LkfNd6ik+xO1Dh0UaV EMT1bINiQ8SCryV4w0I977aaTHjZ+Uq4DmCgkAv76mKFjOeCnCatazWNhspR3llzNzFD 0idA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Z+ccet5P; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id me4-20020a17090b17c400b002854774e56bsi2167720pjb.15.2023.11.29.14.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 14:13:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Z+ccet5P; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id BF2E580C9C99; Wed, 29 Nov 2023 14:13:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234674AbjK2WND (ORCPT + 99 others); Wed, 29 Nov 2023 17:13:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234576AbjK2WM6 (ORCPT ); Wed, 29 Nov 2023 17:12:58 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2081.outbound.protection.outlook.com [40.107.14.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 838AAD5E for ; Wed, 29 Nov 2023 14:12:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i6nRBm6HmlXSe0fgBJhrfl7GwD4Pu/A53VBh7XqKLBOOQwp5KFJhr2LVSeZ1xlumtjX+YKYcNEKcNXNlePGvp5fze1+IJA12lw0LLLU07w1kTbS+LPFKpzWzqs+XD9mYKzolgNajzp+K9rerRErd2AqO28YQB5H31x/euygJXg8LTbIarTOQLfoDXYev1PVYvb1DIh0iOA1KoJH573H6g+j4KC4hmX5/ILUERbyCkIbP74Jm5i5BDaPGYNhwjcr2zRQH5lAOVlMhhSluLwUVHvwxkbuxEgZ4Fp073cnQybFmuz0YeuPC/W0U9k8zPIN9s05/oJYpOjdClI5Aw8J53g== 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=BYlOqxYRwrA/DY9Y5S2Maw7Zy0Q7zqC4/7Z+mE81oiY=; b=G5KrcNF9k09by/6YAbtPqo+m4HIVNLyq4efZZj6jaNKeraUXNjrKuAVyuD4+6g+nq3CaHnQqWFoiSlMeGJUEbdGBUOJIR9QrG/z8L9NGskZCytehRDKmAtO3SLH5sC2A4x6r/+hmEv0H2BzslIO4ZOaeGcdrERZnPd4fVx4am0tur9mulsFGDyqzb9GEVuq+HFO52jAX7L1JnB7YtTJ64w8LyZzjxxunHNxGwpTySjL2O7kRTKkZtygUpsDe4JlH9nmZlhAbktA/XDqq1LAyJ0Tbs6V/SYgXzcclF2NTmoVx8XVMh9OUydCCUd8te3JyQK1PAEeWHTuqt93QCjsnkQ== 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=BYlOqxYRwrA/DY9Y5S2Maw7Zy0Q7zqC4/7Z+mE81oiY=; b=Z+ccet5PNfwC/ORYRkCQ17euIW71id/jczcPU+k7xZbTkfeQ4eUPAZTIs+r5b0P5MceADYlEhQBVjghRSIxRE6lOqe7ICwjmfFZzJuvBGjfqsY8NH92kPelsP+jN4xHDW+sa1anRQ14jtKhuI7AYW8DoMIbRLdp3HpU4wSSHW24= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB9PR04MB9578.eurprd04.prod.outlook.com (2603:10a6:10:305::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Wed, 29 Nov 2023 22:12:54 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%6]) with mapi id 15.20.7046.015; Wed, 29 Nov 2023 22:12:54 +0000 From: Frank Li To: alexandre.belloni@bootlin.com Cc: Frank.li@nxp.com, conor.culhane@silvaco.com, imx@lists.linux.dev, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, miquel.raynal@bootlin.com, zbigniew.lukwinski@linux.intel.com Subject: [PATCH v4 4/6] i3c: svc: rename read_len as actual_len Date: Wed, 29 Nov 2023 17:12:23 -0500 Message-Id: <20231129221225.387952-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231129221225.387952-1-Frank.Li@nxp.com> References: <20231129221225.387952-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR04CA0003.namprd04.prod.outlook.com (2603:10b6:a03:40::16) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB9PR04MB9578:EE_ X-MS-Office365-Filtering-Correlation-Id: 4bc5fb55-3f16-41f8-9f7c-08dbf12855ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yffM/LEHeaoxrU3rL35KGNd/otUostXP8CSy7cEL/nJ9ajmpeIktFO/BuL7wzUsF85qgqXW9xyK4n8ueI4YtSZE3GyP2ZKs1TrerwtR9XXYgDJb8MaxzsbzMtnGWnHBjtT7Gwkjm4BbdIutokfPieGRXeCry/huFsjS1Ypvdu1t85wUIrKtEqkJiKiUjsWO3Bvk+C/VEF6hKuCMvGgcvPvVf7M6J/vwrWknhsjTYVQlCxePZcUp+E34KVDwy4bEAh3h8TyglrVO+/9d10XouVCELSRFkBjO6KEpIyzYnw+j5sYyTzzS006zwNdNv9WPABxaNTalaF5neqwieBtT0BCTaipGf1lHoRLm5RUE8zJitTdIglxy2ZyXUGOdsMwj/UQseAfFKJnWo8hmbRk3wsVmsQ8n38wKaDO3rRkwyEK6iqQsQGvDbZsFAQsxT14kDqFA7Oxf2uI7Cin7M6c/QwTnTHp2mwNeNg7DS4VGZCk6vXX2UGJMgACVFaStSrelvo6VlOVA1ZGgZ6tIzTEgktt3zfSslNm3WuYxGSbHQd5JDWWB+pyoSU654kXtqi3AU83+Waoq/1Y4cJDDz9tV3koJIli9IUQORFpobQEWxOKbQAlVmrxhYyrmgooU3CSGIeHBYd70NrJit9bjkDNWSabhjPoslXWAIeX+OjQwZpMM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(136003)(346002)(376002)(396003)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(202311291699003)(38350700005)(36756003)(2906002)(41300700001)(5660300002)(86362001)(6666004)(6512007)(52116002)(83380400001)(2616005)(1076003)(38100700002)(6506007)(26005)(316002)(66476007)(478600001)(6486002)(8936002)(66946007)(8676002)(66556008)(4326008)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wQfaAaYDOE+n44EAMDweCBLfUc/K4O05VxbNaIxH3HbaBi53jI7HUTTM6tZ10lBVAPfTzVRKMuXcOkmRd7SI8BZc8nB2Wb+RXhruPCJqTUhK61wR9n68o+bk7nzKGrdI0l+Dm7aYI+AZHgVLa+WmbxZB8IUiWcY+0Tutq7uIKW7Xyos/uvZl9IIDn40UHKJx11mLp6+0C76JX8V/qxE8BpLnM1DrOyuWfrGZ917G2JgwVohpvbwjg5hhK9DRFuL9l0A/1U8CuixUYRlkHKAJ45ioc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zcHZL0zapIaG+PL4AHFlYGM5bVzBdNVCnK1QM3eFpHMmGO4kxzihyI4+JXGo0eqIkALesjjr2MZyCwt/Gr04CCCXC+gGSSAbwhpToosPSpC4G7vPixootnec0FsTgWPzae2DnXcZsjE9SmDABxkk12WIg5X3nQvR+AOPBmQL7onbd0Q8UMCufBtzJIH01ebeMAlevSeNuSFsHWCrm7qony15kslKxvMKeOmqCH83nowVSPJxQ0xln3 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4bc5fb55-3f16-41f8-9f7c-08dbf12855ce X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 22:12:54.5021 (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: 2wfL4SNdkS13YTO1bgQeQWhTV4WahUgkr2YMONHhlvnFnPxNTHyAFnquhr3VQwEoo9IxlETznEhffTJSvHBnJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9578 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 29 Nov 2023 14:13:15 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783938151496149903 X-GMAIL-MSGID: 1783938151496149903 I3C transfer (SDR), target can early terminate read transfer. I3C transfer (HDR), target can end write transfer. I2C transfer, target can NACK write transfer. 'actual_len' is better name than 'read_len'. Reviewed-by: Miquel Raynal Signed-off-by: Frank Li --- drivers/i3c/master/svc-i3c-master.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 880c6ae76c013..be742e6734e39 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -137,7 +137,7 @@ struct svc_i3c_cmd { u8 *in; const void *out; unsigned int len; - unsigned int read_len; + unsigned int actual_len; bool continued; }; @@ -1033,7 +1033,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 *actual_len, bool continued) { u32 reg; int ret; @@ -1046,7 +1046,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(*actual_len), master->regs + SVC_I3C_MCTRL); ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg, @@ -1084,7 +1084,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, goto emit_stop; if (rnw) - *read_len = ret; + *actual_len = ret; ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg, SVC_I3C_MSTATUS_COMPLETE(reg), 0, 1000); @@ -1166,7 +1166,7 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master) ret = svc_i3c_master_xfer(master, cmd->rnw, xfer->type, cmd->addr, cmd->in, cmd->out, - cmd->len, &cmd->read_len, + cmd->len, &cmd->actual_len, cmd->continued); if (ret) break; @@ -1252,7 +1252,7 @@ static int svc_i3c_master_send_bdcast_ccc_cmd(struct svc_i3c_master *master, cmd->in = NULL; cmd->out = buf; cmd->len = xfer_len; - cmd->read_len = 0; + cmd->actual_len = 0; cmd->continued = false; mutex_lock(&master->lock); @@ -1272,7 +1272,7 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master, struct i3c_ccc_cmd *ccc) { unsigned int xfer_len = ccc->dests[0].payload.len; - unsigned int read_len = ccc->rnw ? xfer_len : 0; + unsigned int actual_len = ccc->rnw ? xfer_len : 0; struct svc_i3c_xfer *xfer; struct svc_i3c_cmd *cmd; int ret; @@ -1290,7 +1290,7 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master, cmd->in = NULL; cmd->out = &ccc->id; cmd->len = 1; - cmd->read_len = 0; + cmd->actual_len = 0; cmd->continued = true; /* Directed message */ @@ -1300,7 +1300,7 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master, cmd->in = ccc->rnw ? ccc->dests[0].payload.data : NULL; cmd->out = ccc->rnw ? NULL : ccc->dests[0].payload.data, cmd->len = xfer_len; - cmd->read_len = read_len; + cmd->actual_len = actual_len; cmd->continued = false; mutex_lock(&master->lock); @@ -1309,8 +1309,8 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master, svc_i3c_master_dequeue_xfer(master, xfer); mutex_unlock(&master->lock); - if (cmd->read_len != xfer_len) - ccc->dests[0].payload.len = cmd->read_len; + if (cmd->actual_len != xfer_len) + ccc->dests[0].payload.len = cmd->actual_len; ret = xfer->ret; svc_i3c_master_free_xfer(xfer); @@ -1360,7 +1360,7 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev, cmd->in = xfers[i].rnw ? xfers[i].data.in : NULL; cmd->out = xfers[i].rnw ? NULL : xfers[i].data.out; cmd->len = xfers[i].len; - cmd->read_len = xfers[i].rnw ? xfers[i].len : 0; + cmd->actual_len = xfers[i].rnw ? xfers[i].len : 0; cmd->continued = (i + 1) < nxfers; } @@ -1400,7 +1400,7 @@ static int svc_i3c_master_i2c_xfers(struct i2c_dev_desc *dev, cmd->in = cmd->rnw ? xfers[i].buf : NULL; cmd->out = cmd->rnw ? NULL : xfers[i].buf; cmd->len = xfers[i].len; - cmd->read_len = cmd->rnw ? xfers[i].len : 0; + cmd->actual_len = cmd->rnw ? xfers[i].len : 0; cmd->continued = (i + 1 < nxfers); } From patchwork Wed Nov 29 22:12:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 171619 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:296:b0:164:83eb:24d7 with SMTP id ek22csp11847rwb; Wed, 29 Nov 2023 14:13:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IG+qR7byLpPWg4T6oTNNb7x/NFzGAmlqV+s2aapvWoRQEttABGDC6ytJIA4TkPy3eqvwaIz X-Received: by 2002:a17:903:234a:b0:1cf:e9b5:90ee with SMTP id c10-20020a170903234a00b001cfe9b590eemr12794702plh.24.1701296003984; Wed, 29 Nov 2023 14:13:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701296003; cv=pass; d=google.com; s=arc-20160816; b=MyIb8VU5AGINrGfi9oVYXY6PqKhdwhQR62LxzwqU7/y4WeJoqr6v9vZ0DwmnkRlHI/ 2UustZDu+A7Gtz0PK7D1CaAj8CqWwQmpzQY1BV04wfEAYWobxEMlM84cHiOmDCnWHuWE yXSAeZ5qon3kPsVowPgVwRL/tlE9Z6uR00EGuvRhmXuEDgTg7Dw1NwtjLGXlViGOFTdf ueZpbZ1Wlcr7lSxoRcOlQgfQVPzNiTskP88k3QDW6F5sxuP8t6WnQAuDbFy9ZG7iOpK3 MYb89f3i/0HLqyAke+UGyk5hWC5I/Tf3zwuJHBwxdL+lSRlca+D5kyT7wfoWmLJ3Nl8J jjpQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R2/YV3nkqc3UDSc0gYS53JKr0jm5PsR0IRqF30SYf6s=; fh=PdbvvRYRJ8Q0x2Lw0CjA1nrMatMLWmexk8+z0DwTFq4=; b=cYFp5ydoNF+1dOJCo5qj8zx00KmNL8mpjFPQPMhwwgeyJ3lm2FvhM/Zu1CSTEAUe9u iQD/OTU2X+zjV5Ig05ACzgDrxni6BhOYljxF5m9PYOaZv0u9OJFUXmtCYDy6Bg965cYO GHLjPcgPYpSa20bnJtavIfjS88GXua49EQV54AcNqaz98401K/CBMTXpZQEgrxGcAqoA M6TDy0tQBe03Jv+2yY+pt65H7GqCkD+UxWLeT2enV9mijrCs3r8+rEH8QL4sxXHW6ZGu lLPAN0N2sEGQt9xr+tpY7jwofmpfm8woejuFELkFS31fYv638HdGcP96iQsCjgTQVFuq 8ByQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=F7BbBMsU; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id 6-20020a170902c10600b001d0041b74b9si3533114pli.362.2023.11.29.14.13.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 14:13:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=F7BbBMsU; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1CE26802CFDB; Wed, 29 Nov 2023 14:13:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234803AbjK2WNJ (ORCPT + 99 others); Wed, 29 Nov 2023 17:13:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234918AbjK2WNE (ORCPT ); Wed, 29 Nov 2023 17:13:04 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2054.outbound.protection.outlook.com [40.107.14.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36A05170E for ; Wed, 29 Nov 2023 14:13:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e5QwvBRRs1kY7yJmGzFKM2vuRkpKLV5BCvsOO/R+uiZsT1vVhm5QCLkrNeQJI2hLl6NJkM/tH38AFieThU6ebg6uTZoz78vn1zmOFj17aCkS3c17jtDN6uH6yM0dMFFBcfc2KcRIcTw9hPIHMxHoNoz+MiPrZWR8AOtcjG1OvG1ThdJ6rBU1iAxALbj8eo0lvZMB9YA6pQGnimNPFkLxVZKOZ/CGhb1KSEdeSlnIfS6wjEHVsJ8xba38BM3pTMuqGR3AHcfdUN+mcAREwR/d/0rfNBiOp/pC4bjOoj12xukZHBz4TR0vzvV1e+blVHvxr91nuG0DjJPoYwrrqf7hOw== 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=R2/YV3nkqc3UDSc0gYS53JKr0jm5PsR0IRqF30SYf6s=; b=T6IfY/b6DTTfzLtlzWcN+ebztrQ8xNGnJ7kCnSPcE0z3u1mqvkRKwd+KFoFhOQXQe5hE8pEwkGNu5z2XZSxd8tJYbIXZzoTMG7CIvcHPE9e3ZbonhOAXl/HFiD498AugLCeBdPEIMQLEeEBYarVk9yisSzsY1hCcgGfQWvBMBpX7wc7j0thiN0kcW62jMkWIsjieB25M41AVGedPNX2l9fyYMTHuUGZ39jEwRrUrpDSyumxIJk0frsVdrZjBXUWKl5UOVtVcuuipcXkv7pewi9lScbxqCTIfAWVvobCMXndZ0jhuzUn8U2fpDqWKnbVLzEC2rJvi/VX8k2Fcvhf7Lw== 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=R2/YV3nkqc3UDSc0gYS53JKr0jm5PsR0IRqF30SYf6s=; b=F7BbBMsUhXUgcB1JZ0s4oTRQZY6bkVVsJSQZxI76xuLjdNjWMAU4HDshqu/3TkEfbl3VoLNcnkhUyt/q0CDybqwFmc6/uweBOT+iQvJLpjunbe/JKMkf3Qodba+GTjVmOGcJNVBpFvQ7E3D0l8+zIrW9Jy5cvxo+xgRaVNf51TY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB9PR04MB9578.eurprd04.prod.outlook.com (2603:10a6:10:305::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Wed, 29 Nov 2023 22:12:57 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%6]) with mapi id 15.20.7046.015; Wed, 29 Nov 2023 22:12:57 +0000 From: Frank Li To: alexandre.belloni@bootlin.com Cc: Frank.li@nxp.com, conor.culhane@silvaco.com, imx@lists.linux.dev, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, miquel.raynal@bootlin.com, zbigniew.lukwinski@linux.intel.com Subject: [PATCH v4 5/6] i3c: master: svc return actual transfer data len Date: Wed, 29 Nov 2023 17:12:24 -0500 Message-Id: <20231129221225.387952-6-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231129221225.387952-1-Frank.Li@nxp.com> References: <20231129221225.387952-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR04CA0003.namprd04.prod.outlook.com (2603:10b6:a03:40::16) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB9PR04MB9578:EE_ X-MS-Office365-Filtering-Correlation-Id: 58f96f7c-c90f-4b49-5c68-08dbf128574d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xfwVV0mxbvSnUIqN43btO6qB9nIC3/6W7sKDlnJyJbpgI+kS+H90MjJqKntiRClDDUewHrdKzuow2PQUXtCca4dw37Df7FliQv38K+9JYY3NQAqbV5R/c0Dtr8hacJJALLW9/Mx83FnAd3gL3EpbNh+S+fCL6enAaNH3x5CifSsjKKjci38DVkVPtjScNERqWFdCPaVeEarGqh/JVMuaJ3JyXjL0bA5EzQChCqUMURmsfmNvKxeQCwQR76TLE8CjaN/pM26iouLFHBKxWufnKSgEtfXKJ5sdelBwhW9q+Q/cw49l9YO3l//B+MA7LNQmtk76DrMQ9afD1Ezh0g0iPk0/OdKhDvuTRVASMjXXmjwUjhcL+yIHj8rZbDp4YRCKFO0jhPsuRDFxrtgKIKs+D4MhyruhJiHShO+WPGp+bQ8V8FHuXQEYaCf2fa1aHfBz69WC80FlfcHR/cEf1vBrcuyFca6AUXDViK9di9HKUBOqubob6xp763fPfsVxxHoQ21A+KLWg5++v7AYPwNFCr3Lh0JLTJejeoA5Y+JdildEQXEwjI/u2RUHrqFdlyiAEmF+lu3P+srPUj9Eg2K9U9FCvcwtYOvqsXSVs9UMoIMyP8lnt5W7qhaFpWNL4azKDhF0E+wPVl308cEkCFdTJYiBNOWlO+RGVf5PX9BM8i7E= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(136003)(346002)(376002)(396003)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(202311291699003)(38350700005)(36756003)(2906002)(41300700001)(5660300002)(86362001)(6666004)(6512007)(52116002)(83380400001)(2616005)(1076003)(38100700002)(6506007)(26005)(316002)(66476007)(478600001)(6486002)(8936002)(66946007)(8676002)(66556008)(4326008)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /okbGPYL3DNgegIHqv5WJ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+JKmCu6M3hlbjt8IeYIu82FBhc3eaV68/jY4Tre6GYNKwsfVaYLEyPROUTEQtBPcygOqbHrSpdbXrwg54CnSUNoTgcmU+fZBaP5hMnT0ZUIzMwGAe9fsACt77Uh+7dM1EqJcmoZ1Js84KoPa1jo2IQgvLs8hcbgzWu34vH/p82QqQN4sLKNysuC/GD7wxY3a9+xwoZ7F2vQi16JSLii1Mm8HH/Kg2d9VXpoWFjXaMNifyDrXfLV2HAwm+BBjJ1Y/jFTcd+Kc1WnI8mv08jGJcNpvFJxIwSLQWlpyBo21Obrds0p7t/YadSyuC39WY+Z/6GPV9QqwLPkqoHYWaWGRDKMBnfW36sJtDvz8gsRglgBDSUrjyWhhScWXuPjp79MpxBbcvOhWc9AN90dTkt3WkFxzPfsZd7hR2O9NeZadU49rYPvKguSXINzYW3FD9gLNYvRA8Kn0suFNzm8WtOC3iLSQuRTitYutId/2Ocpjzw X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 58f96f7c-c90f-4b49-5c68-08dbf128574d X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 22:12:57.0049 (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: 8VvR9+CqVtcyF9uTwbwidtWHxLlTZSl5xvWuEBim0Zr0Ak1KJnVmIXrS4YC+t9PGlKTi6fqteL4WPBbCEO/3Vw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9578 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 29 Nov 2023 14:13:22 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783938158381857201 X-GMAIL-MSGID: 1783938158381857201 I3C allow devices early terminate data transfer. So set "actual_len" to indicate how much data get by i3c_priv_xfer. Signed-off-by: Frank Li Reviewed-by: Miquel Raynal --- drivers/i3c/master/svc-i3c-master.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index be742e6734e39..9dc12f9936a27 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -138,6 +138,7 @@ struct svc_i3c_cmd { const void *out; unsigned int len; unsigned int actual_len; + struct i3c_priv_xfer *xfer; bool continued; }; @@ -1056,6 +1057,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, if (readl(master->regs + SVC_I3C_MERRWARN) & SVC_I3C_MERRWARN_NACK) { ret = -ENXIO; + *actual_len = 0; goto emit_stop; } @@ -1073,6 +1075,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master, */ if (SVC_I3C_MSTATUS_IBIWON(reg)) { ret = -ENXIO; + *actual_len = 0; goto emit_stop; } @@ -1168,6 +1171,10 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master) cmd->addr, cmd->in, cmd->out, cmd->len, &cmd->actual_len, cmd->continued); + /* cmd->xfer is NULL if I2C or CCC transfer */ + if (cmd->xfer) + cmd->xfer->actual_len = cmd->actual_len; + if (ret) break; } @@ -1355,6 +1362,7 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev, for (i = 0; i < nxfers; i++) { struct svc_i3c_cmd *cmd = &xfer->cmds[i]; + cmd->xfer = &xfers[i]; cmd->addr = master->addrs[data->index]; cmd->rnw = xfers[i].rnw; cmd->in = xfers[i].rnw ? xfers[i].data.in : NULL; From patchwork Wed Nov 29 22:12:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 171620 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:296:b0:164:83eb:24d7 with SMTP id ek22csp12008rwb; Wed, 29 Nov 2023 14:13:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgpxbpAzerITUNq44NS1nIMruygjIEv2bZMYSxwmhJ1a04w/oG9RL+ph40+z2cG0AElwLY X-Received: by 2002:a05:6a00:130f:b0:6cb:a60c:1d with SMTP id j15-20020a056a00130f00b006cba60c001dmr19907937pfu.17.1701296023069; Wed, 29 Nov 2023 14:13:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701296023; cv=pass; d=google.com; s=arc-20160816; b=KPyv+tE9PLIlB4PKANZeW5XixsEQ5QHA75HntkusuQcVyNiB+b6H8Xct3B1EIwGBrp /zlwA42oZMLnkEQT3PsN2QrsA+hQ7i56K/xoqiXD3riVs5aytJhslk1N+DU//1K0EkZ3 7JlekGMFuPRATBU7Q5KloqeF4qIc8In7IXItj6rN0GFtv26Z4lgMvWlOuihfh4u6P8Yv VuG5XY/+dOevtJqzhQ2etKqbv8shEXLeKtQI5EIXA/bs947gInD/0921aMro4x2jcYi0 u1KAJ8A04mRdcPA4YZaXeA2BppYHJQpqvLnZTEuz5TSEn5LR6r5jDuSG+ZAaqrG7bmPG pTFw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pPWQn2l7iuQDprEGwbhMq6laPM8yM/hxK/Z8Bbastmc=; fh=PdbvvRYRJ8Q0x2Lw0CjA1nrMatMLWmexk8+z0DwTFq4=; b=k9CovO+ugtJG8VnDd9ZCMI7Tl2qZfqD90U6i8topsAapL+Y6h1MaQmUhm1oQEOlaWe e9yGUtK/C3KsNiMt1E4mFSgNJrQGs7GncSGEHNecjef9Z3BKR/97dFHiqfbb/J0J3kzr zmJ3XNML4/uvsDIC6lhN1YVWvNzlm1ltdbfZRd9Kdi38yCdw+k0cuBbsx1CGbdWrjgvx FS+tqBQxvJNxk97k9yDxuSBKsaF03reT3556SlMe64X5zYWPtTJhvrlKS3cICTH6RB58 kWGng7TI0TDfkbYF1fweO7HxW0j5isy1fmO888M3YAsU65RJtqgjTcOFDJ5bU7m0swoY ZOug== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="oIUt/M1U"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id u11-20020a056a00124b00b006be3c302801si15213269pfi.397.2023.11.29.14.13.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 14:13:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="oIUt/M1U"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id DE1CC80B9F9E; Wed, 29 Nov 2023 14:13:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235010AbjK2WNX (ORCPT + 99 others); Wed, 29 Nov 2023 17:13:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234950AbjK2WNG (ORCPT ); Wed, 29 Nov 2023 17:13:06 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2054.outbound.protection.outlook.com [40.107.14.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D94A5172D for ; Wed, 29 Nov 2023 14:13:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hOcinrE5Q2bcnp1WngSndbSfwXsvOt0k35uVVAfQkVPm8lq4Y3SbmNkpY8s0OpfDl4Ldyz0aQaz6vrFn8vPEcUaX9O86GFuwO+Urvu2pSe/n6yz6WIcsoCh+mPKUJN+KeS5mrueIWGFHqz9ISJvLYhWU5nVqgIGVV5IzIU7sQMT2nC0ICn6I0Sw2n/TGp2WiRR523QiDF9KxpbDinPGobGyagHh5ESvBR4JGGcd4XivtZKWysGoNJhKqQiiOVcgekoeXQL1e5TgoNxB4sVPwSCZA70ZIE9FAU4/98vEH4LuHwMEKKsDJfLZg/UtBwyver/yyE3T/xEFymDNosHXGVA== 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=pPWQn2l7iuQDprEGwbhMq6laPM8yM/hxK/Z8Bbastmc=; b=McfJWlnwxlJWIHhz6TKUDUd8yiuZ/1JY5B7VK4mva0/XpMOF+XMhZlGcCIq0h/4XCG3a0nfZcQXavO6qTGvaBDyg54Zl6IjC2OKOCIiJDouGgNFKE6yRsRcAsWzzlJmg6XfF2JRA89mn3J7/g+NjKK1VKNOk0VZwcXlsa9MobqSkoyy+qZOjx5sVa/bitbcPZL76Kg4akSjJvmpSELxGDY2yiavnb5SwLINDQ5TMWh+Vu/TQb9CkUpuhKleaSIkqrEpO3d5EZAaoiK5nWE8HeeG57DgM+3zg1m+ToOqvv0aHDshfhjL6uF2s3x3jMeElnTMWe+UbJ48hjjW3HIaqZg== 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=pPWQn2l7iuQDprEGwbhMq6laPM8yM/hxK/Z8Bbastmc=; b=oIUt/M1U63K5xrZjQ9nJOrsJEz/2zh05RrJVADZfc4ANyTBHncU6phspWaIN8qOeAaQgchzS5iMM8A1O0r8kh1QqK5y6KpIinWFIZL+BOLa8dF8x6sXeOUPYDhSKuunIIYReCWSDwGyuMgTdtTBZgRDv9K7fL4/DiMhysZtZ5U4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by DB9PR04MB9578.eurprd04.prod.outlook.com (2603:10a6:10:305::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Wed, 29 Nov 2023 22:12:59 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::95f5:5118:258f:ee40%6]) with mapi id 15.20.7046.015; Wed, 29 Nov 2023 22:12:59 +0000 From: Frank Li To: alexandre.belloni@bootlin.com Cc: Frank.li@nxp.com, conor.culhane@silvaco.com, imx@lists.linux.dev, joe@perches.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, miquel.raynal@bootlin.com, zbigniew.lukwinski@linux.intel.com Subject: [PATCH v4 6/6] i3c: add API i3c_dev_gettstatus_format1() to get target device status Date: Wed, 29 Nov 2023 17:12:25 -0500 Message-Id: <20231129221225.387952-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231129221225.387952-1-Frank.Li@nxp.com> References: <20231129221225.387952-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR04CA0003.namprd04.prod.outlook.com (2603:10b6:a03:40::16) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DB9PR04MB9578:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ec119a3-88e5-43cf-9742-08dbf12858c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fRxqB7tA6jyw0QU+IMByfrrbJz2pUDseokMYLhf4DLjtJeQRDDYv56osvP+iRyr/udM8mXnrV6H8zUxyU8ZtV+rVOxT9ZqHiUOtVwmmEkRy40Aon+O4N5/z5VrZ8lE7MnGI/GB+Z3u24J/W/OnfM9X6jlgbOfxj9wVZry/bMHGuNk/Ibx7J9FBfuN5ZzBBfQKr+jSDNPIHLib8RAn/5DzhI9Grcki7up8Fl1h8bWmZx0rKDatkwDXEPpNQLJsKFvAMoqXtIEJvEwX4CK/O+EgokPZNIvwQBM4t6kB59pCpkVZI8eCLnbBRfpY/P3VpQiHBF10Z/VqweGsoY2nzuc2rS6glW5KShLwSCvhAU/IUAtbR4D/0OjVZFCW4cfNMpEuA5a9BaDbGnB7YRqkZNPnmYq4HJ709IrJiPl2MGAHZD6GqLyujalGlh+/pRCZZ1jqKA2zsaJDP54W+FZdKXe4ypKq9kxEK1iQIJXBJn5Uqbn6maLBW6JALXpuEMMji2MxSjoVtZ+ecKuHUuawFITJjwQSgLUEZ2eHMLBi5Fa/4ui2+F4xLmmdU2yOvjohOXCi9Tw2FcVys1pjlCXu0mA5pGKhJDVaq9TOteuwIWcsOWDbmDdU4W5qnTo6dk3kBuMQgSxPlUccmAGaMOde0k0QKQ9QzuWM5P2NBMUoITfqfs= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(136003)(346002)(376002)(396003)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(202311291699003)(38350700005)(36756003)(2906002)(41300700001)(5660300002)(86362001)(6666004)(6512007)(52116002)(83380400001)(2616005)(1076003)(38100700002)(6506007)(26005)(316002)(66476007)(478600001)(6486002)(8936002)(66946007)(8676002)(66556008)(4326008)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vAC3A2Bdrm5/uqw3WZVDX1nE87b6iXtQ4yoZ2jfMWsVRGhxQ18D+s9tefKn4j9XSp3cOwxbsFKIOJbr2HWte7pXZFHm+QhUkOQdF8r5ISYI0jFQdHyG56Mrio68FtEgOa9F1DYcGbyEnAXxOtP2klD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Pajmoy28WDBoQm39zKrMhoH2p62uTxOyeGZxwJrLtE7CuacKNKyrgdmW31g2qWqXtciqKqQUSenvJeTYDWsJYMaa9eH/53+KkuUbKIvaf5FUrdUNkYkmuPiOzr5JVY1wXIv2SRDlVzTbRZoN08w8Omn/nxCvcPnkFFF+Mh2aH51urh4EJOCM5pAlwyer8EP9f6PfjMGc33rH7IegsVUfeMyTGaOQMSBXUjoeqfzjQyRIPlKxI1lumibzJK3SS1+CAHpvjy6veq65ySHhKrvuQB+SnUKNbwseg1nZLvlESHkUXv936BemHCvgPOOYLK6oEaAB7wtBJOv0n3utgJ9Ne04jWh3F6XOmc4wAc/71fGXiALBhh7MEA X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ec119a3-88e5-43cf-9742-08dbf12858c1 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2023 22:12:59.4434 (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: ZAlhJh+/uo36cs6bdEyPr0f6EauS45hPjoVWfFZv6ZQdLGH1lR4e4MvG1626woOvut3efu7Gh0conSjqJOZtSg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9578 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 29 Nov 2023 14:13:40 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783938178668169872 X-GMAIL-MSGID: 1783938178668169872 I3C standard 5.1.9.3.15 Get Device Status (GETSTATUS): Get request for one I3C Target Device to return its current status. Add API to fetch it with format1. Signed-off-by: Frank Li --- drivers/i3c/device.c | 24 ++++++++++++++++++++++++ drivers/i3c/internals.h | 1 + drivers/i3c/master.c | 26 ++++++++++++++++++++++++++ include/linux/i3c/device.h | 1 + 4 files changed, 52 insertions(+) diff --git a/drivers/i3c/device.c b/drivers/i3c/device.c index 1a6a8703dbc3a..aa26cf50ab9c6 100644 --- a/drivers/i3c/device.c +++ b/drivers/i3c/device.c @@ -196,6 +196,30 @@ void i3c_device_free_ibi(struct i3c_device *dev) } EXPORT_SYMBOL_GPL(i3c_device_free_ibi); +/** + * i3c_device_getstatus_format1() - Get device status with format 1. + * @dev: device for which you want to get status. + * @status: I3C status format 1 + * + * Return: 0 in case of success, a negative error core otherwise. + */ +int i3c_device_getstatus_format1(struct i3c_device *dev, u16 *status) +{ + int ret = -EINVAL; + + if (!status) + return -EINVAL; + + i3c_bus_normaluse_lock(dev->bus); + if (dev->desc) + ret = i3c_dev_getstatus_format1_locked(dev->desc, status); + + i3c_bus_normaluse_unlock(dev->bus); + + return ret; +} +EXPORT_SYMBOL_GPL(i3c_device_getstatus_format1); + /** * i3cdev_to_dev() - Returns the device embedded in @i3cdev * @i3cdev: I3C device diff --git a/drivers/i3c/internals.h b/drivers/i3c/internals.h index 908a807badaf9..976ad26ca79c2 100644 --- a/drivers/i3c/internals.h +++ b/drivers/i3c/internals.h @@ -24,4 +24,5 @@ int i3c_dev_enable_ibi_locked(struct i3c_dev_desc *dev); int i3c_dev_request_ibi_locked(struct i3c_dev_desc *dev, const struct i3c_ibi_setup *req); void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev); +int i3c_dev_getstatus_format1_locked(struct i3c_dev_desc *dev, u16 *status); #endif /* I3C_INTERNAL_H */ diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index ed5e27cd20811..6a16ebdd180b5 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -2924,6 +2924,32 @@ void i3c_dev_free_ibi_locked(struct i3c_dev_desc *dev) dev->ibi = NULL; } +int i3c_dev_getstatus_format1_locked(struct i3c_dev_desc *dev, u16 *status) +{ + struct i3c_master_controller *master = i3c_dev_get_master(dev); + struct i3c_ccc_getstatus *format1; + struct i3c_ccc_cmd_dest dest; + struct i3c_ccc_cmd cmd; + int ret; + + format1 = i3c_ccc_cmd_dest_init(&dest, dev->info.dyn_addr, sizeof(*format1)); + if (!format1) + return -ENOMEM; + + i3c_ccc_cmd_init(&cmd, true, I3C_CCC_GETSTATUS, &dest, 1); + + ret = i3c_master_send_ccc_cmd_locked(master, &cmd); + if (ret) + goto out; + + *status = be16_to_cpu(format1->status); + +out: + i3c_ccc_cmd_dest_cleanup(&dest); + + return ret; +} + static int __init i3c_init(void) { int res; diff --git a/include/linux/i3c/device.h b/include/linux/i3c/device.h index ef6217da8253b..5f511bd400f11 100644 --- a/include/linux/i3c/device.h +++ b/include/linux/i3c/device.h @@ -345,4 +345,5 @@ void i3c_device_free_ibi(struct i3c_device *dev); int i3c_device_enable_ibi(struct i3c_device *dev); int i3c_device_disable_ibi(struct i3c_device *dev); +int i3c_device_getstatus_format1(struct i3c_device *dev, u16 *status); #endif /* I3C_DEV_H */