Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp316251iog; Wed, 15 Jun 2022 02:53:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vIZx+4yV5lavwYD9+YlRdVwoV+NN42GlMxH+PxMg8jyZue/qEWg3/B0TIeEhFDKrfqb+Y3 X-Received: by 2002:a17:90b:1b4c:b0:1e4:dac8:29e0 with SMTP id nv12-20020a17090b1b4c00b001e4dac829e0mr9446064pjb.36.1655286801342; Wed, 15 Jun 2022 02:53:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1655286801; cv=pass; d=google.com; s=arc-20160816; b=pPIB/IKuNgy/2FKjqquzk+zQoOW8Y2P+asC5Lip7zNXBUbLzsNhB5XDr7I6mqdlNCJ Z/eIVnqqG5egciMk4dB7egZJGLpP1HXyF2jceIDQm60g1ORPNv+qeZtL8oaio6I8/m0Y +y45YPiRy14PYVNMnW9ZLj/lxwVRGChi8RLAeXAyXwmXoh/3Vjc4BQsExUP7PQc4vI20 O1p37WxkFbOi3y/Wpmg6lvTls+1I6Au6eeUHCm5R9c1E9KSDD5aU3x1VKgUIpsrkViJV gySaL76tGCBJDIlR3nmDci5Wm+G/4e3mhDUBbcDfU65VnDiNkqQv+vTrTmQlYAiKb2H7 +uvA== 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=yY+JGXPT07FYHFt/DZ+nLA+W08wbKn7f4XO1Mu0iF0E=; b=ThjajnZWl3Cz/lpimJIbCf8a2uFdEo6h1MTGIobmzKrrfsARKLvHYuiov1ejuBqo7Q EIr3erCFD0F9rW5YCDudruse2+PyeRhu+DMLQjhuZvlVyEicCw/lmunnTLEUVn35COQd cUpyNJCWadIUU+TNVi3BIM7713GSTNkUhE+ZzBMXWSdIMllnp4crKt93aFTSoEMEGyKL koBbmYucbGrQVaGApVK2/yWNG6Ifh44F65nb5PBl0cFvJtQ274kqRNm19FbCtIOWCvgH 6cGMSAa4q11AT9xwUWNXKkMt8/3KKt3d/VAEVo/9LEyVZ/b5j/uk57b5DBcv7BBuPs8E qgJQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=rEZh3U14; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v62-20020a638941000000b00408a7a11803si5301174pgd.720.2022.06.15.02.53.09; Wed, 15 Jun 2022 02:53:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=rEZh3U14; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347104AbiFOJEA (ORCPT + 99 others); Wed, 15 Jun 2022 05:04:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347035AbiFOJDu (ORCPT ); Wed, 15 Jun 2022 05:03:50 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2122.outbound.protection.outlook.com [40.107.237.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D00DE38BC4; Wed, 15 Jun 2022 02:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MeaAFKx8KsTxyAtT/rlemxx0LuzSjrNpGj8VzPBSiX0rPVtE0L2LHcFrFxz+WhtRMk1MrOQiHQPRzOf5sGTRP2qQsQhVCgrYGnAFVl4Nsp+zQuuKBdUaFqVunceDzMFtTrNSMCnerjB+AEwBbRjwS3c5sX8i8fZ3KL1E/0zB540/y19fs2/DKb3YRFCFDdASOqvSz8TL/7lsvQ4uV2OoRe1jvCTzT/bwooBqPWaHKLgJ1rZISgqzJoIZRJWTP6vgqeLwWNXwfmohchuFtDMT94lP0pIPkaK6/bt0IYww+2AeHIl+Vuq2rzevXUk5rUU8DuEnyaKXqOWhVDxHy4quOw== 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=yY+JGXPT07FYHFt/DZ+nLA+W08wbKn7f4XO1Mu0iF0E=; b=N731RStz6bgBX0RdQY5MdQDDhUy0x01AtsCm3NDuIarkn5Tk9IqRZn2RD4OmHXC16Vqexu3mSiXJVLGcT+pp0t4jLrg6HD+5Y6KzcccG7I9ka3u/mTiMMcHQMT7UOF8KoRcyr0s9qrSb/rtXs1uMZRQ/SCoMBZhcxZfRsPARvYoYrONR/K0xZUH4UwybtwTcYOpj7N6tw73jZEbhNmKcwNoptVeCHrqOe6bwMvLXFIz8rrioPK6lG3oJg5NyKQBhpZ8dau5clCrKMuoyhXA1KZq0YUHNwv9rvcwpE4+VHALTeWNKBNy72Y1HjZH8YqPGE2uXVrdXdleqXWYRcYQC4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yY+JGXPT07FYHFt/DZ+nLA+W08wbKn7f4XO1Mu0iF0E=; b=rEZh3U14eaaorob5C55RA/ERxesr4ki4roZo6pnG1Cs/s4igKpkG1ASXmCaaKz4tlc1IAZosRGvseW9b5AbhhTBDpI7hxaicX3oKHdhJgOoGY2y//qgsV6p9txN+69KjEdvslXaRwjAbFdaXbRshZlQyvJ/lQGWgkKrP6YoMvNk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from SJ0PR01MB7282.prod.exchangelabs.com (2603:10b6:a03:3f2::24) by BY5PR01MB6049.prod.exchangelabs.com (2603:10b6:a03:1bd::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.12; Wed, 15 Jun 2022 09:03:42 +0000 Received: from SJ0PR01MB7282.prod.exchangelabs.com ([fe80::7535:773:f979:893e]) by SJ0PR01MB7282.prod.exchangelabs.com ([fe80::7535:773:f979:893e%7]) with mapi id 15.20.5332.020; Wed, 15 Jun 2022 09:03:42 +0000 From: Quan Nguyen To: Quan Nguyen , Corey Minyard , Rob Herring , Krzysztof Kozlowski , Brendan Higgins , Benjamin Herrenschmidt , Joel Stanley , Andrew Jeffery , Wolfram Sang , openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, openbmc@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org Cc: Open Source Submission , Phong Vo , "Thang Q . Nguyen" Subject: [PATCH v8 3/3] i2c: aspeed: Assert NAK when slave is busy Date: Wed, 15 Jun 2022 16:02:59 +0700 Message-Id: <20220615090259.1121405-4-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220615090259.1121405-1-quan@os.amperecomputing.com> References: <20220615090259.1121405-1-quan@os.amperecomputing.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR06CA0189.apcprd06.prod.outlook.com (2603:1096:4:1::21) To SJ0PR01MB7282.prod.exchangelabs.com (2603:10b6:a03:3f2::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ba968699-d8d6-4ff9-4d5c-08da4eadf120 X-MS-TrafficTypeDiagnostic: BY5PR01MB6049:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zGKtg09K2Ga+07FilLNmiWGZi5Fue4wQ277TV9JyI11B5ePC9gLhFMULVnKkrUlJSs0cnI5ScBeewqAylQuuq+jr+M4VrHjIjI3NocYRWKPVFqYTF4GHW6yvf1bVpPO4zk5iMG0h2enqgTxX780czV5Jgr5hSZHidlA31Y3aY6cTt3yTQlA2QNBj6oGCK747Lm1vF8b0v16EoT/I16yyp2gRE44PLP9pjynoeGxUn1UeDDgIoaqdP7n1qfglbeGIozBgpcilroh+lJVFGE5a1+IGr2J1QaSJhpJRAeTXnYRQmmj2ubzU/8jvZCg5uKjRQvEICyjyuu1A0JKaVQVfvn2FePNho46cWVBgX+9EtakC/CEiEZuggF4kG91zt5rBEmPR17cVQWQVM0fIOeJibsPmq1PMyEdZxLIjHY7vF7M8vqxOpyCocR+8BFwsCn6lIGGUWLh3MmBeBjx1hUiRU4LjDbWZJS1myoX/iAQ4qlEAhVOXYKLbY5yyvKGyAawTYruZ70HWOOlIktRyFjB6YDhbDWpPkdbatITIrAuh0osFxHIRoMMZzP/amDl0wZ68Lb5yjSzwY5dZCOE9Nf+xrg+JcQZe1J1XtGt5p8YJr1XxffNMfCNbwXikVgQpAV/zKlRuSjR0w8MDmp0nYFgEBLhpNpHKpblqVCPk3qOELEjtcJzT8IuBwIICBjOsD291GWTZZmIeVKNftLatthx3b0UkBM3RLi6306i9OSBEVRQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR01MB7282.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(366004)(66556008)(66476007)(6666004)(508600001)(4326008)(83380400001)(38350700002)(8676002)(1076003)(2616005)(6486002)(316002)(107886003)(52116002)(8936002)(186003)(66946007)(6506007)(5660300002)(2906002)(6512007)(110136005)(26005)(54906003)(38100700002)(86362001)(921005)(7416002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Zcci+qM+7J2sVgi3h54Oih7Oq+rN5lVdzvUOr/kyWCarCse62Di1djmOM1iC?= =?us-ascii?Q?ifaNrX9uPR6iMIF9/MAMEC57BOEK6towWofbJ5cBDRmnis9etiUxyyiVumET?= =?us-ascii?Q?LzbB6wbSY0mexH7fS9dMd9wHR8rXCXBE0z1TtzJdVulus7v/upEshzJrqTCO?= =?us-ascii?Q?4cy7NlcqZI6CUnLNJ8yn6I59Ul9NHr8Z/d6MOhNph/g6T4G4UZfRYTcwFYep?= =?us-ascii?Q?0QaXhU8oafmlE4V3EUx0b2chSEbDmZUSVyGHURyZCfE9Alne+tv6E+cx42z2?= =?us-ascii?Q?qImWqlopt1XNcvM1zPOzKkRQslf8+AQnMmX0RbjR6Y5MFxqY/cnbPaL9DpcC?= =?us-ascii?Q?L6QYWuzbr9BvDtlQvp13P//tZ6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ii?Q?3OGNbF1F1uEg72coxRuGl98yN6N+1t1VVAtEM7YG+W+d2TMgIOLzAoWnw5C6?= =?us-ascii?Q?NlcOrbU94khQSKnw7pUXdcZjGFZWvhb7ENbeex99C0YIurZmtf41IeREC4gA?= =?us-ascii?Q?eyIfLXpH1Eu7FV/UM3LJssWxa9a2yXKI4BtSVJsCiXJuf9WztcL/ZNGcm7PI?= =?us-ascii?Q?FhczAa6PnC50blJ6EgMfqqa0I20PxnnbgkY6zik6lLFqe+euwz+ZSySO3+oY?= =?us-ascii?Q?YnrwSGoKPoDwPGMg8vbKbXze5dBtdXCIRfwxz0/W2XM+aTjqfsGwLadFZHTu?= =?us-ascii?Q?osz7zCmn8Mja2nDii5RZap/1aiR/DndGAeJpn5StyI+n477BLiXJvCwS0LGN?= =?us-ascii?Q?GoN9hJbDF8wtqF3VetwObQUZJTEdBwbC2MRwDlslfQjWy21dgR+1eqTaQGY7?= =?us-ascii?Q?Ztky2l0HDe3JkNfPABaZqBNoXG7pQ6yd/mvgy0Mf0G0B8LUPwEi97J5ep4W0?= =?us-ascii?Q?OI7hGAqYKzoC+ceN5lDRrCfVmMLwrgJjJCSZcwvlsJleN7HW7ZEa?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba968699-d8d6-4ff9-4d5c-08da4eadf120 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR01MB7282.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2022 09:03:42.0110 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +4LE9NuCeXTGzIR8NWYgChCT08uhXibQpey3CXP7Rdo/+Ra1PGN8vhNraZZiRstATqkvM4WfrjRnbnvxERQfTuwpw692UfJdazTaetsv2MU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR01MB6049 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 When processing I2C_SLAVE_WRITE_REQUESTED event, if slave returns -EBUSY, i2c controller should issue RxCmdLast command to assert NAK on the bus. Signed-off-by: Quan Nguyen --- v7 -> v8: + None v6: + New introduced in v6 [Quan] drivers/i2c/busses/i2c-aspeed.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c index 771e53d3d197..ebc2b92656c8 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -244,6 +244,7 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) u32 command, irq_handled = 0; struct i2c_client *slave = bus->slave; u8 value; + int ret; if (!slave) return 0; @@ -311,7 +312,9 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status) break; case ASPEED_I2C_SLAVE_WRITE_REQUESTED: bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED; - i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value); + ret = i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value); + if (ret == -EBUSY) + writel(ASPEED_I2CD_M_S_RX_CMD_LAST, bus->base + ASPEED_I2C_CMD_REG); break; case ASPEED_I2C_SLAVE_WRITE_RECEIVED: i2c_slave_event(slave, I2C_SLAVE_WRITE_RECEIVED, &value); -- 2.35.1