From patchwork Wed May 19 07:49:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Nguyen X-Patchwork-Id: 12266583 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65149C433ED for ; Wed, 19 May 2021 07:53:38 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E58B860FE4 for ; Wed, 19 May 2021 07:53:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E58B860FE4 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=os.amperecomputing.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=R4rRH83Q4C6xAHjt3uL7x9NtzM+DVUWXy5xrRPMSqMw=; b=EHLWe7PFECQTMyZrcCngl7UO5 Lw7yjFDxjG7sVZEfN/1yfwgodhVWg1CCAf/hbByaLLROYZFzd57HNX7dfIfQqRdNx5czGWfFotJoz jBmeK3R6fuANlubC9n5lzQNyor7LkXd11NZH/1Y69/XZpwreGipDGgFP5vzeM8RPZuscGF5psEbJ/ XicsmuVgh9jnqiK/686ynYF60Y6o1rp9pryFohuOCvl52RkpDTvSoauu3f1gN+RR7FtbOa8u/CXhs J4ggOAqLPVLy4l6/dWIxcre+xNhXc2ibBQvfLe69fQg6uhj7NudQM0cs2bsMeD4tIGGvo7ruoM/8P jaEI5LJdQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljGzm-003EiX-4E; Wed, 19 May 2021 07:51:59 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyY-003EJa-JH for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 07:50:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=PqBAtez2bYEYPVr1UA+6yYTcfsTkQ8Jef38beg1HuNw=; b=4zDGeUGHUIUa9mCPpKm5oymVeU bHqUEoR3xOVnyGtHFoY9nrDIJQ0aKpd2+cuwfb0pnAsOKPy4xVpKKDycwtzH1jQoJskJqIJxprjtc W52IvEVp3Ye78uhQ4j/DawEc7klXtNHuPEfNdiTCsbJiqqCT+X626gDfF+iUXZsWQabZSfL4y1AyU TSNxWJz4EZ/xC9tEzEdGNQT3oeGazBCyKvjFh3LcWZ7fql8aQ5+i0Qvs45loy0VWr1m9UYdzK5TN4 Ef4ExF/sdtNJ5Ddeh3NDtGt/s1NIukTlM44y59nXFBgdeuorRnuRzwqowYh/GG0iE5pp9Z1ymBovS kbF3MYTg==; Received: from mail-bn8nam08on2131.outbound.protection.outlook.com ([40.107.100.131] helo=NAM04-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljGyV-00FEep-GP for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 07:50:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FPhr7e3zmtVVcw6QJXZiMftQUWOCry1TuCeqXL4QkheTlqpB4nehIAiSdxsE/3wNvUSco4W7T5I67ZPMpIq8N5C4KfkzdkVuyFvnlp9TPGiBvvc2xjEKk6Z0gtk6wuwnNJ7C6qCJzgX0C4PGBVBM8SMgTAzfMEymExMJ2gGGJT/TXL5olGE88bMHvWRN4RWzJvNGcSUkVSENwEvvA35o/YsnzpnrV15/D9hsJ2AublELT7BGhC/aIrSra8XOYWx8o5vu4YBNWmQBzk7LJy6cXnTBtvtSYQlgXF2AjuxDN+XhStzdbyheDRtW9RaPBY3KhOVkFZUwCvhDchtM7uRuyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PqBAtez2bYEYPVr1UA+6yYTcfsTkQ8Jef38beg1HuNw=; b=OszkteslzvFbttq7oXJLoKUFrAWBbB9IQtT4aRuLplZ2NUE9y1OnoMtac6rgRytMp4Kx7MGSHng+TCEzRUHaN0nfFguGm9M6Y60Xvq1uRwi9q+St1ZxodOPsSw1Kkd48ic9VhquP4RmrTRVcek1IZYpnvct+TGp4x4sHvqh7DKr0MWL6NWgtthl1sD5GseOspIBIBTP5QUOf+f+ok8Am8fRZIDs6QwjDWX0AD1aghq7Y5YoRkaTH9gfFVmNZ5nP/liaqqsnJbfkf6cL7F/XedxRZNg6k6fZSZeUTyZ0uOSYBSPRohxJqQLkaUq7/qJlib/yLKYw7sVtXPWzoC4+6bA== 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=PqBAtez2bYEYPVr1UA+6yYTcfsTkQ8Jef38beg1HuNw=; b=AXy/CmkEHESFFrRqk7UHuNZydzz+6M90JEu6uNHLauF/+fboFqePZoyK//rA2pkmJ8gBblqVXy7bSpB0xcaYoVHQHoEOAEqvwMcynuZT8QHgS5MVaaC6J9dzaToz9j79sCZRXGjh+Z4tUSg/aaKIuejhKa8BKXPRO2B5zPV4/8c= Authentication-Results: acm.org; dkim=none (message not signed) header.d=none;acm.org; dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) by CO1PR01MB6743.prod.exchangelabs.com (2603:10b6:303:d5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.26; Wed, 19 May 2021 07:50:37 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::d840:7aa7:58d4:b503%5]) with mapi id 15.20.4129.032; Wed, 19 May 2021 07:50:37 +0000 From: Quan Nguyen To: Corey Minyard , Rob Herring , Joel Stanley , Andrew Jeffery , Brendan Higgins , Benjamin Herrenschmidt , Wolfram Sang , Philipp Zabel , openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org Cc: Open Source Submission , Phong Vo , "Thang Q . Nguyen" , openbmc@lists.ozlabs.org Subject: [PATCH v3 5/7] i2c: aspeed: Add aspeed_set_slave_busy() Date: Wed, 19 May 2021 14:49:32 +0700 Message-Id: <20210519074934.20712-6-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210519074934.20712-1-quan@os.amperecomputing.com> References: <20210519074934.20712-1-quan@os.amperecomputing.com> X-Originating-IP: [118.69.219.201] X-ClientProxiedBy: HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) To MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hcm-sw-17.amperecomputing.com (118.69.219.201) by HK2PR04CA0081.apcprd04.prod.outlook.com (2603:1096:202:15::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25 via Frontend Transport; Wed, 19 May 2021 07:50:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3f34fae3-c945-4d1c-e4f8-08d91a9aca06 X-MS-TrafficTypeDiagnostic: CO1PR01MB6743: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 95jn109+m3nocENwElxyrjFodaRMaJicDBnx+WxHCrXfLGUeiSgxZxcNPgHlYRI2Zmw2NlSzhEzS20Ke+0gwF+PM50Dvru8fMVKl2diI+Eb41Pknhf10OVSFlJ3c+4S/K8wlxtnNbOv+80hh34ALoGJXU4ef/hS2w3EOO67Kb+PyWwCNxMSxhJoilNpk872cBIwI+RmEsKzGj9aqNu44nwpWvMJ3IiFmyEAQlPLRnwvL9DsBG+Z4G701Gt2HS3U678QpGMpNqo9FClYKAhubBUdIFXHpr2e8hAinEDJE+wfDAXFiSnh2OMpe/eWApeySGU6AqUSYns4E+UNDOIIg5PpOFAkH/mvcTc8yY/q54aSOFteNzj1L9hkION52U31iT5XhJmX8mgNjQvf1LCY0QaaKxDHDwO7RFEyf7B0051tkItdQUwPcfl+enRtuGhvQkpKDgFQc/pkHJtNf7gS6eM36KZ6LrRG+rwjHWq3n8nFbXvHel237JrX8yq3ueQgmjTizQ3/tcJb+Ls5fwhN9x3lDPK0xybhvv5Xh2xCJ97f+RkL4vRMC0wYlm8zx3GF0hazXYeqoAJaUkKbfh+0s5gm1vggFWKpNmHtYbcZ1AsUteQQze0jh64rtEr8CG90P7vqlMmbIHLkhScf/jIx0pxx4D/gJQcWpI++ItUINymo= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW2PR0102MB3482.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39850400004)(376002)(136003)(346002)(396003)(478600001)(66946007)(66476007)(8676002)(8936002)(956004)(921005)(66556008)(52116002)(6506007)(2616005)(6512007)(5660300002)(86362001)(4326008)(38100700002)(1076003)(38350700002)(7416002)(316002)(83380400001)(186003)(2906002)(110136005)(54906003)(6486002)(16526019)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: wf/tLFUZ8IECaMNchEzq6ikeZPCoXVSce7cpTgRoTH1XX0sEjfmm68uXdXZ+wQbQAn3lyefXZM0JNPZf92bcaG+xWUd8/J3LJf22GCy2HlmlkhQ0UD/nJ7Sh7RsJBjud9cU+E+q87MHqu/uz4ihxBo16HNp00mafJYUf1bFG7sz947s/5D75Mtqy5We5HY0UMV0KHSGKMR6zZgXkqcLgDdOsqPBNKQ9UEqzt3IThyW9gn6jvhHfHF3vG1MLpIgWOKN5wcOKD6vVW6Mhxr7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.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f34fae3-c945-4d1c-e4f8-08d91a9aca06 X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2021 07:50:36.9439 (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: ls50jwrku7MN6VDAh2fBVqEr5u3Z0GVgx/IOzpQiv0IUP5IwjI6mmYyWv3//P7bjrnD/RpAknDDkCPOngNHJEtMkhX5oLsVV8k7wOliULsE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR01MB6743 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_005039_569076_08DDD009 X-CRM114-Status: GOOD ( 11.62 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Slave i2c device on AST2500 received a lot of slave irq while it is busy processing the response. To handle this case, adds and exports aspeed_set_slave_busy() for controller to temporary stop slave irq while slave is handling the response, and re-enable them again when the response is ready. Signed-off-by: Quan Nguyen --- v3: + First introduce in v3 [Quan] drivers/i2c/busses/i2c-aspeed.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c index b2e9c8f0ddf7..9926d04831a2 100644 --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -944,6 +944,26 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus, return 0; } +#if IS_ENABLED(CONFIG_I2C_SLAVE) +void aspeed_set_slave_busy(struct i2c_adapter *adap, bool busy) +{ + struct aspeed_i2c_bus *bus = i2c_get_adapdata(adap); + unsigned long current_mask, flags; + + spin_lock_irqsave(&bus->lock, flags); + + current_mask = readl(bus->base + ASPEED_I2C_INTR_CTRL_REG); + if (busy) + current_mask &= ~(ASPEED_I2CD_INTR_RX_DONE | ASPEED_I2CD_INTR_SLAVE_MATCH); + else + current_mask |= ASPEED_I2CD_INTR_RX_DONE | ASPEED_I2CD_INTR_SLAVE_MATCH; + writel(current_mask, bus->base + ASPEED_I2C_INTR_CTRL_REG); + + spin_unlock_irqrestore(&bus->lock, flags); +} +EXPORT_SYMBOL_GPL(aspeed_set_slave_busy); +#endif + static int aspeed_i2c_reset(struct aspeed_i2c_bus *bus) { struct platform_device *pdev = to_platform_device(bus->dev);