Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1722955pxj; Wed, 19 May 2021 12:20:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMOPjcXU6CrpeDSpKWz3YIEyVL5WxUnwmpSGr3UowZHIKk4PQs3Mh2DuUxnpLHZTFjUrj4 X-Received: by 2002:a05:6602:121a:: with SMTP id y26mr1057814iot.168.1621452052980; Wed, 19 May 2021 12:20:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1621452052; cv=pass; d=google.com; s=arc-20160816; b=LbAhNilPBA1OaTVRMabhQwvzyIvPIzg0Bk3XkiGvEUY0lfqSycU52O+nUpITpaOcBC zitKf8BmHdZ5Nb5jGJzc0IEjjokidBirRrMiRO/O08DVtSN53tqEFlgFtxsY+uQt55K1 pb21ovz6Yy4SWOcnIqMHfs7livXRIdkVhpPM9CeXUQhDSRB8c8fYT6ryXPxywI4uF4g7 H68EPI6JUgFvmlZ7QxpsDRsmiGQhgIKov94Iuo0rOcC0gYtoanfP21+TX4dchFs3HnKR hJkLGRXooralshWrCRuwglOi9J7avcpSRGORDMkH4uC6l9B4aQcb5ehzqceXkmDh1f7q Jojg== 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=PqBAtez2bYEYPVr1UA+6yYTcfsTkQ8Jef38beg1HuNw=; b=ZSYiv7qL3Po2Dste5YXhn3zUeF4gxT8+DCQhc4YA9SCoM8SEKbMrof1VxDdqTA65x4 V/z+jhenwECKtTiaH5qy/jRaqs26FcxBbp+mGMwjw5rhNn1KH7RKSfoABTkXfdWPvVNl Tg7Upye9lZaqBkzipqr6R9R33bpxKEhpJ4MY+rWWpKT0ZYEz27AM3fOWo9WtgNR3bvA7 fm+tDx4pEp09Lf7s5Z9nGQgl7oyEaYFK+LNLdUt0b1OS30L3m/D/4yTrac12DmaWDQeF rfXupwTPVr3sdHVuE0oPKL8sfT3d7tv81Qyui8B+HnvYTiBoXVAYMJPyqKb3NJOblHTd AU8w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b="AXy/CmkE"; 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 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n10si669432ilk.92.2021.05.19.12.20.37; Wed, 19 May 2021 12:20:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b="AXy/CmkE"; 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 23.128.96.18 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 S243829AbhESHwL (ORCPT + 99 others); Wed, 19 May 2021 03:52:11 -0400 Received: from mail-bn8nam08on2090.outbound.protection.outlook.com ([40.107.100.90]:27072 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S242799AbhESHwH (ORCPT ); Wed, 19 May 2021 03:52:07 -0400 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> Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: =?us-ascii?Q?wf/tLFUZ8IECaMNchEzq6ikeZPCoXVSce7cpTgRoTH1XX0sEjfmm68uXdXZ+?= =?us-ascii?Q?wQbQAn3lyefXZM0JNPZf92bcaG+xWUd8/J3LJf22GCy2HlmlkhQ0UD/nJ7Sh?= =?us-ascii?Q?7RsJBjud9cU+E+q87MHqu/uz4ihxBo16HNp00mafJYUf1bFG7sz947s/5D75?= =?us-ascii?Q?Mtqy5We5HY0UMV0KHSGKMR6zZgXkqcLgDdOsqPBNKQ9UEqzt3IThyW9gn6jv?= =?us-ascii?Q?hHfHF3vG1MLpIgWOKN5wcOKD6vVW6Mhxr7bSgQw6pGIENMQSjJIenN6/NNC3?= =?us-ascii?Q?MRk8X2t5quoH6i5zsggSrMPjNZWn8eCOaiKi1af/ftyBJnDC8eRQzNN1Vbca?= =?us-ascii?Q?bipICm8ordWPW9UTgD9Wac1h8PjyFOz4VRwGMdl/Xz1pdziK23Gh5opDAuDC?= =?us-ascii?Q?NFUdbg5/oOhcO1TLU+/iq9L0aITjAgLN+5mPTRzgbLBGigtgqxU6yOoYeHP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orOrg: os.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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); -- 2.28.0