From patchwork Mon Aug 28 19:25:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13370359 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 74E7CC83F17 for ; Wed, 30 Aug 2023 17:54:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Qq2bQxFATR5dql90aHYQWPQchwD93lDVIVcwZJMYXYg=; b=zDS9N4Mi8sN3CG 8+QUB6ZZ/J+YifONtgzEhyyNo5ZD9H/3tnHjT4NoLE5W0mdkWO2pEQA1GkmDCcFkBa3ym7idkz08R 6hGcVau2VtNoIxSMCXTW/nJkYOSR5Dz/M8hoybsTatCiJND16Fojx2+znB3XEaJMixQcqc1JhTaGI i0/6tglOvb0WEt3R2SS/icAI6roZX5mgkguusSiG8xxP22znsdSyZ60EiX+jCoEL+5pNcZdQ2+s2W Yia73px+PhnejcsLdUdkAo6riY3CVeL1YDdOtSrFHdMTY9PMGUwa02CU2StdtFjrkbbBB4tASP19q AiKfs8a3G5Nw9LLwp8/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qbPOG-00Dw0S-0R; Wed, 30 Aug 2023 17:54:04 +0000 Received: from mail-am6eur05on20615.outbound.protection.outlook.com ([2a01:111:f400:7e1b::615] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qahrl-00A8pQ-1P for linux-i3c@lists.infradead.org; Mon, 28 Aug 2023 19:25:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=clr5sepU+apYMmDoA7zIyFFiwunAc4drcMhzuT5m1KwNObI913hL8cKpb8DmMV6KAniNmNpMzGPHanHO8DnWJEXlwVdFZh3R8JPvldHtOb+yxMjIQnjsRsfTFxTzDfd/Omp6FKkEGnit+COIcoaeB8XeJQJERJDZUCQxeI6wD6w/2ZFfgIfALbXeH6mpzcLkgjblNaJmJSOsUPmz8A2U044G+KO3hTiaz3Ju9wGXG/iX7EqwLnKrvU9CudHyIcblKyXeBKA1YOgPa99pMLMwBumkS5793c5RjOjNfmUdwzSgQGh4terncmdGEy6DlFU6dvOAzRHGKq0R7nPm8Zh8Eg== 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=1JkCMzwP2pi5MtOkISXsvPDy7HgD65tBmAtTNEJuu1Q=; b=cdcjfudKhu6LwW8g7KdnjP3qhTjN0zy40NMsv55o8lm8K+sb7m8VuypFZcfs5LCgNMVWErRiBogPNFIdAXKtAkIIwYmUfm8wcXtGyENwg3nC1rQRXFIn4gEW6cAITLJGQnTzwrqDXWpY69pEKAdXoIO28Hb7/FbhjNIesmZ5rXxIMJnQM0lX11HwaQe4Rbn5UcB87Z1DfCV9AxYZ9mC97F9lQ2BDSpUKp9qa6znSeueJwY8AqMIHPaDK1zOTmhaXXl3BD9UM1c0wVAOTjSmudai6ec0Aui8cueKn9pOHgafr/eguDhMlG4lAVHsAtzAMx3PYGLp65lADB4samdpGYA== 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=1JkCMzwP2pi5MtOkISXsvPDy7HgD65tBmAtTNEJuu1Q=; b=JUTiYY1S0tZ0q7xT9j6miBWZOjuZd/UemAUfyAUDA7vqcp0K129sYHvapP6144Snhqg519R42ljAhUNPMKBbRUGzmwoAWJBzIsKfHTnDqgwo/WPaNmjHuOCTvvWw0gTObNm5D8zp+lnwbZ8G3er47QU+RJZfWkLzqPJDYpmrKgI= 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 DBAPR04MB7462.eurprd04.prod.outlook.com (2603:10a6:10:1a0::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.34; Mon, 28 Aug 2023 19:25:23 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::a680:2943:82d1:6aa8]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::a680:2943:82d1:6aa8%3]) with mapi id 15.20.6699.034; Mon, 28 Aug 2023 19:25:23 +0000 From: Frank Li To: Miquel Raynal , Conor Culhane , Alexandre Belloni , linux-i3c@lists.infradead.org (moderated list:SILVACO I3C DUAL-ROLE MASTER), linux-kernel@vger.kernel.org (open list) Cc: imx@lists.linux.dev Subject: [PATCH 2/2] i3c: master: svc: fix probe failure when no i3c device exist Date: Mon, 28 Aug 2023 15:25:02 -0400 Message-Id: <20230828192502.3525418-2-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230828192502.3525418-1-Frank.Li@nxp.com> References: <20230828192502.3525418-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR08CA0067.namprd08.prod.outlook.com (2603:10b6:a03:117::44) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|DBAPR04MB7462:EE_ X-MS-Office365-Filtering-Correlation-Id: e9dafe4b-b769-4f43-85df-08dba7fc8674 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OU1sqROa2fHGkdRwUMrjCrF5eZIe7vlDPJ35fop/LILj74ytS91p2dbEmdhZlXWdUjToTfvq4RhnRMJdHossLcIghfcJHYJYixsbE4PvysF4jgKI9j7if46AJGDpfDypPsetxbCbNbn58k1fdoZn0ERmz2M8BWV6D5NyIgJIxA9v4sJPVGG2cfjI9BIbyS34UymEFxxPrLBZwE09PlC7MzlfuJz6XZ1uTqapytwNr1ZwzC2kUmnU1PUsHQgwJrr/VLEZRQy16pAUE+6ZYpS+Qm6e37C0OwSJ9xf+SD1+wImymxqDx/qpot4bn3haZ486j1MBSde3mLARWrSiZM8oKAqPEt/oe9VuNoAdjZZWwR8oU6HD+zDYNEyfi9PcIpUGL12LAqb/pRG4XtlFLUjMuj8tNiO1XKGA2xPKhTgGwP7Rl1kBpbAC9XVLAfVG3iFj2jqbXMgJAF5/o6mZ6esf+YJSIj3NxL6HrB73gHqNPYL9Zhj0Kwlg66xX/ZWv0XHF+QBed7wBYIsui5rFomNKrmDv0l/5nvFfOJbbaTH1zwjrWoNVaLwbcSeV+BwwEylJKW8ZoVwSHnOqufsti80oHIOZwdTC4U+2/DokMRN8xSXc1k2rBA1Zuq7MldaEG56qJqVaK8qHSdPa1nSVtN4Y5g== 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)(396003)(346002)(376002)(39860400002)(136003)(186009)(1800799009)(451199024)(6666004)(6506007)(6486002)(86362001)(36756003)(26005)(1076003)(2616005)(52116002)(83380400001)(6512007)(316002)(5660300002)(110136005)(38350700002)(66556008)(66946007)(38100700002)(66476007)(41300700001)(2906002)(478600001)(8936002)(8676002)(4326008)(42413004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fNJjX6id68U8tsP2qWUFOaOIZnhY6nHQGOsTJclVEE3GG4DGiQ/3JReC9/Sa2xbyvxaWFi96YLJqJ4v7Q0rheywuYxki0k00m2WeDtvwAiA7ObaCdE6YKtaJOKaGPfiM4HeLq281acaz9BX/9ul2NMQV98M1DdxyEqGjvz3efwNHTk6d8G9ha7j88dCKSaTK9r4YRKsfvsrUhbicTQKhkIk+FsirSBGbmoJzilqu+vGHPwPZ+e+2vq+1jPKnWioSjVztxAm6AhGMo0GA0gYWE7uGIIe2pyDVnGQ6VNrgi/wMZahnS4kvCiVAIst67HpaBQ+LKixm3gfIu3yoAvexdMvntoft9M9LItJ0Z7jrrqn6GJxbtiV1QnSXGOnZPW8sTW7uGcATW3dwm3Cx7EdDrUQnHKljmxMmGAmIbbfShaYk5yTPElt0ekOAJ+mN912irENu5Gh/N6hvyROEAYuM3PogCX01IXREsxie3OTCeZTBrFxN/vdl7790JaXRzJZNruENj/i10kTRfhFEiH80ySdY9J/7Zhia4OnwHnXvEbhojrumcQJcQXMJCYTYtQwhf/y4djmPECLAOijh52YkV2mhIJqhs0FUlZBUPgZmtvK5D/aTkbHsiZ+o1On6nPVzxBV9JTjO4gIfAd/5TN7SQMJjB8/tAZYqjerXPF1dei7Bmjmo2YT3N1GkKkS3BgXBxdkzChUWaq5euAKf29yfGC8fW5Vq3ups0qfANCF/U+XcGfn1oaS5c2fmskFiT/cguPDONpoe40rRAoGSQgQZw+LZldM2l3ILlndOzK6Ia7NN6pOaCHKsEHK+AFQBsu/VT79PnrJ4RV1lXeDNxXg/9bHGWAmy46hr+tP8XfOBgpZBUZJ1byPEYUUliRvfi3sRF4NFMONYXKi5V/Tt9I430xLhN7YErzrMO2RMRZuURIIPb2G7Sg/xEb1EqtHIii3G7M6yjke1ADjhvZa4dXgGN4GCaxlh6JmqxnxBQGbN/vYN+X48frcPIObeuxhA6t6C29b1cdufNkCH27yUHOECr66b2dcYkBXEZ4OVV1MNz1d3ziodrzu/bkhSkUGcB2x6QofXYp+tu6NSKFwv8/ea6J9mYGNNZBDoz9W/ZXOXN8bx9HtN2Z9OERoFV8BJadM7l8jPcp0qNo9v02dnU8J+VLR7SZrDbHRdicu4Nw4wRP7Bbg2P5K3Q8tQUBih/I4qcRXX+zNVPl5NAzF7nVbKgmUMTT018nt7oAoGngS/ymS8YyxiuN5SSEBp2i/FnAD6tGckhdjlhJFrWpl/+IsMRAn79ZkpLcww5poHVgEpOoFn115fUU3Gp7RHAQkdUFh/CCblXfAjeTZdmTd9PccOvzL51SXuAHlZXTzCem9IaUnYcpUNVl613Qk/YoRqM0tHk18z2EBdGToaueS/rhM0R/Mt1A+0x629OiR4dcF8PEffT+lfITounFRlkHLbzgiV3T6Czpzq11XoWmaPzHJoJ1+0xgfMok5m9lhjyxwuoi6gHiv3g2vzfVY4UW3esfOdF9rhp8GTvWF5uUfl/qNzrASiIkch3XlTLtOulHACBi9Q= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9dafe4b-b769-4f43-85df-08dba7fc8674 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2023 19:25:23.4018 (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: EtROGoIo8ZNe6PRvIvWIZnoz4poUlRC7o7qqV6Q9FtiNUqbHYj4HRQU2/VaFcKje22Cw5pawNFi2adnzSuq23g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7462 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230828_122537_477309_8E89A00F X-CRM114-Status: GOOD ( 12.14 ) X-Mailman-Approved-At: Wed, 30 Aug 2023 10:54:02 -0700 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 there are not i3c device, all ccc command will get NACK. Set i3c_ccc_cmd::err as I3C_ERROR_M2. Return success when no i3c device found at svc_i3c_master_do_daa_locked(). Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver") Signed-off-by: Frank Li --- drivers/i3c/master/svc-i3c-master.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c index 770b40e28015e..a5620103acb73 100644 --- a/drivers/i3c/master/svc-i3c-master.c +++ b/drivers/i3c/master/svc-i3c-master.c @@ -789,6 +789,9 @@ static int svc_i3c_master_do_daa_locked(struct svc_i3c_master *master, */ break; } else if (SVC_I3C_MSTATUS_NACKED(reg)) { + /* No I3C devices attached */ + if (dev_nb == 0) + break; /* * A slave device nacked the address, this is * allowed only once, DAA will be stopped and @@ -1263,11 +1266,17 @@ static int svc_i3c_master_send_ccc_cmd(struct i3c_master_controller *m, { struct svc_i3c_master *master = to_svc_i3c_master(m); bool broadcast = cmd->id < 0x80; + int ret; if (broadcast) - return svc_i3c_master_send_bdcast_ccc_cmd(master, cmd); + ret = svc_i3c_master_send_bdcast_ccc_cmd(master, cmd); else - return svc_i3c_master_send_direct_ccc_cmd(master, cmd); + ret = svc_i3c_master_send_direct_ccc_cmd(master, cmd); + + if (ret) + cmd->err = I3C_ERROR_M2; + + return ret; } static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev,