From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 581A2C02192 for ; Mon, 3 Feb 2025 17:12:36 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4YmtMX5VVNz3g2d for ; Tue, 4 Feb 2025 04:11:52 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=212.199.177.27 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1738602705; cv=none; b=YOMm2wRDwMUGkPyIvDCyJRxEYgCten/Yz1daecozEREeOMfLMj9jSIe2HyKjYQCtksltksE3fNwOThk9ImeSSvPw7caGB0C911//3MYDKorxBUSVTuOKQ28p0K298mmmv6bD2RaEaon2OcCNc56JlEq7Ag9QmRv5/eeoRlSP6H/G1bEin6pcIubSAKqyZa1LM3sSEvpqQiHrPv72WJ8Hf4O+be0Iz3ffnXrfoGxhiOQHD+uQlJMMvPtSALHBf2Olw9mdMjKr/aB4PALjBiijANCcYQm0Thnk11xgNki8ddPsCIfP1XdvR7KU+502L7uGC3cBGQVIy8ROwnJpiWd3UQ== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1738602705; c=relaxed/relaxed; bh=dGfJmuXEFtvuCrTwX0lJoF8HOnPmjNw85qhK1YQH+uI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hCiZ5N7k32EWEue7/6yTzPvHBLdGvXWMl/5fZYLQNO29jjfhSXPXQe3PB1IvMPIj4KXEoXcJIg3zFUKzFKwB1n3IiXwSotElU7jK49BDAHLL80HxkvB2ujdYvLjUsFzme8rFc+YolHI9tOPZVihHSLek9HKln7bFYWO0MpGsFK7XbS00YYoZxfTSiO3NnfgMA9v641JpYNbN6cPgb4w6Se7KL6JzfZIoPJULMPqZTcV/vYe0813zuRkRCXbETDo2VpPNj+Ko0tqs3uanYQJBSB2XpLq0CxU3QfxTDqAK/oNWCvgpKg0H/ur4v1niNA+2GKCjkzbQvxXO7CsevRHpAA== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=none (client-ip=212.199.177.27; helo=herzl.nuvoton.co.il; envelope-from=tmaimon@taln60.nuvoton.co.il; receiver=lists.ozlabs.org) smtp.mailfrom=taln60.nuvoton.co.il Authentication-Results: lists.ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=taln60.nuvoton.co.il (client-ip=212.199.177.27; helo=herzl.nuvoton.co.il; envelope-from=tmaimon@taln60.nuvoton.co.il; receiver=lists.ozlabs.org) Received: from herzl.nuvoton.co.il (unknown [212.199.177.27]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4YmtMN1bsFz3dJV for ; Tue, 4 Feb 2025 04:11:43 +1100 (AEDT) Received: from NTILML01.nuvoton.com (212.199.177.18.static.012.net.il [212.199.177.18]) by herzl.nuvoton.co.il (8.13.8/8.13.8) with ESMTP id 513GF0q7006488 for ; Mon, 3 Feb 2025 18:15:00 +0200 Received: from NTHCCAS01.nuvoton.com (10.1.8.28) by NTILML01.nuvoton.com (10.190.1.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.43; Mon, 3 Feb 2025 18:14:59 +0200 Received: from NTHCCAS01.nuvoton.com (10.1.8.28) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 4 Feb 2025 00:14:57 +0800 Received: from taln58.nuvoton.co.il (10.191.1.178) by NTHCCAS01.nuvoton.com (10.1.8.28) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Tue, 4 Feb 2025 00:14:57 +0800 Received: from taln60.nuvoton.co.il (taln60 [10.191.1.180]) by taln58.nuvoton.co.il (Postfix) with ESMTP id 8652A5F657; Mon, 3 Feb 2025 18:14:55 +0200 (IST) Received: by taln60.nuvoton.co.il (Postfix, from userid 10070) id 863CCDC3281; Mon, 3 Feb 2025 18:14:55 +0200 (IST) From: Tomer Maimon To: Subject: [PATCH linux dev-6.6 v1 8/8] i2c: npcm: Enable slave in eob interrupt Date: Mon, 3 Feb 2025 18:14:50 +0200 Message-ID: <20250203161450.265480-9-tmaimon77@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250203161450.265480-1-tmaimon77@gmail.com> References: <20250203161450.265480-1-tmaimon77@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NotSetDelaration: True X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andi Shyti , Charles Boyer , Tali Perry , Tyrone Ting , Vivekanand Veeracholan , Joel Stanley Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" From: Charles Boyer Nuvoton slave enable was in user space API call master_xfer, so it is subject to delays from the OS scheduler. If the BMC is not enabled for slave mode in time for master to send response, then it will NAK the address match. Then the PLDM request timeout occurs. If the slave enable is moved to the EOB interrupt service routine, then the BMC can be ready in slave mode by the time it needs to receive a response. Signed-off-by: Charles Boyer Signed-off-by: Vivekanand Veeracholan Signed-off-by: Tyrone Ting Reviewed-by: Tali Perry Link: https://lore.kernel.org/r/20241219090859.18722-5-kfting@nuvoton.com Signed-off-by: Andi Shyti --- drivers/i2c/busses/i2c-npcm7xx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c index 81f6dc95aced..706a9d64e481 100644 --- a/drivers/i2c/busses/i2c-npcm7xx.c +++ b/drivers/i2c/busses/i2c-npcm7xx.c @@ -1926,6 +1926,12 @@ static int npcm_i2c_int_master_handler(struct npcm_i2c *bus) (FIELD_GET(NPCM_I2CCST3_EO_BUSY, ioread8(bus->reg + NPCM_I2CCST3)))) { npcm_i2c_irq_handle_eob(bus); +#if IS_ENABLED(CONFIG_I2C_SLAVE) + /* reenable slave if it was enabled */ + if (bus->slave) + iowrite8(bus->slave->addr | NPCM_I2CADDR_SAEN, + bus->reg + NPCM_I2CADDR1); +#endif return 0; } -- 2.34.1