Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2762726rwb; Fri, 20 Jan 2023 07:06:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXvsRBeCteBLlptY+qE00sxgvWo0p3ypzpcxQHUKsyw8PgUaBCg1rZr9HoTkUczB4OJZtxcZ X-Received: by 2002:a17:906:80d:b0:870:d15a:c2e0 with SMTP id e13-20020a170906080d00b00870d15ac2e0mr14743390ejd.51.1674227188814; Fri, 20 Jan 2023 07:06:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674227188; cv=none; d=google.com; s=arc-20160816; b=wblJTiW9eUr1dS/OHDfQjGluY3nDmN8AdsoIw1MMXbFOQRWnsSPYnZXSDzM36ajRXh IlTBpIm+MujPRrJSJYMgmWid7TsT2jUMj7iUIGh2mXfPebEs7Fex3+9ehr/RhFC/rdh9 DCBSdEoxIHHE4leR3tMhkTXWK7W82vVCcNgLv9uSwrGsYMEdtQNDOIERBHyujKWadA7k 2QOSA3E5iexyXIi+nissfSEByT5YnKvWm1wgwQrzROZyUbUp2wz9HBRitVlVm9NIpnNc hFvbbl9Quf1mGcfuryH3LkQiENDnPSldKrfcJupn2TBPGkWAUrio7/9X3DQqKFd+S9WZ wEIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HiZ8tLA6mvZUTnnktZhvMxjtOS4IT6sB9XR+vKuHf/Q=; b=yyie8U3G42I/DiF+t3w6P3Y6E/OsMvTpkXC4zbNY0jhwWc/dv0jznn5eKT39YPh43v e8W3+kqyafJQYbyfCjaAiaaXIAL1q7JgYYnQTjnV2GRTEZxY7ZNvq6ULpPwpNgBLAdyf IUYcgz9KucJ3JChS6OG71DuDH/89X/kk677kxVrqOFM1IW8GhCCsmmrVJrDzVnPrAW76 9jb+BvcOiMZsmQDwtWTTTO6+9QzARBrxFoptPBsWaDWPxhFU43DtxypQoGFh0xZHDlTN HUCljS69XeMTU8UpGDrq8m7w+d+VeBZFHADuysqJXzYA9qOYgq/XI6GgqKcJJ5JIZGmQ hFRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=N8KoVEws; 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=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd3-20020a1709069b8300b008775fc70972si8122136ejc.186.2023.01.20.07.06.14; Fri, 20 Jan 2023 07:06:28 -0800 (PST) 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=@microchip.com header.s=mchp header.b=N8KoVEws; 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=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230044AbjATOkU (ORCPT + 49 others); Fri, 20 Jan 2023 09:40:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230166AbjATOkN (ORCPT ); Fri, 20 Jan 2023 09:40:13 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCA26D05CF for ; Fri, 20 Jan 2023 06:39:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1674225582; x=1705761582; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1o9L/4gS6hFw7QhrPiNy1BOlai1A8GCWCQbQw2g35go=; b=N8KoVEws+IE8jm989gzVYiwvDTSE+7fVDlhRMvEbRgGPxRJBAZ0N988A 0Qj5vOtAQpC39UJjXcCdJcZJUMrOp2VuNHSNNmcxUNX98QLKH7gCNhCcT e92nA+p2d/l4TmTbYTfvaI5bDB7brPi2SCYauZZtFpD9W0ZNN5qqt6VmT +8VbyqMdYfjV6CcJs+OsckZ+m+7VBzt/M+uoGqIdzVm3cW4gmOCreQHcC jB4MFdQZsVwnSicEOM1oF/Lq362WH5clBzuV4+nOYZ7uZ+vObbc0f0ngM 2KKFfsi2tK2ouMMuh3aZmyGFfJKdTyNe+s4MEGiGMuW0XBI1ETRWTw+s8 g==; X-IronPort-AV: E=Sophos;i="5.97,232,1669100400"; d="scan'208";a="208646900" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 20 Jan 2023 07:38:13 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Fri, 20 Jan 2023 07:38:13 -0700 Received: from wendy.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Fri, 20 Jan 2023 07:38:12 -0700 From: Conor Dooley To: Jassi Brar CC: Conor Dooley , Daire McNamara , , Subject: [PATCH v2 2/7] mailbox: mpfs: switch to txdone_poll Date: Fri, 20 Jan 2023 14:37:30 +0000 Message-ID: <20230120143734.3438755-3-conor.dooley@microchip.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230120143734.3438755-1-conor.dooley@microchip.com> References: <20230120143734.3438755-1-conor.dooley@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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 The system controller on PolarFire SoC has no interrupt to signify that the TX has been completed. The interrupt instead signals that a service requested by the mailbox client has succeeded. If a service fails, there will be no interrupt delivered. Switch to polling the busy register to determine whether transmission has completed. Fixes: 83d7b1560810 ("mbox: add polarfire soc system controller mailbox") Signed-off-by: Conor Dooley --- drivers/mailbox/mailbox-mpfs.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/mailbox/mailbox-mpfs.c b/drivers/mailbox/mailbox-mpfs.c index d37560e91116..e0e825bdbad9 100644 --- a/drivers/mailbox/mailbox-mpfs.c +++ b/drivers/mailbox/mailbox-mpfs.c @@ -79,6 +79,13 @@ static bool mpfs_mbox_busy(struct mpfs_mbox *mbox) return status & SCB_STATUS_BUSY_MASK; } +static bool mpfs_mbox_last_tx_done(struct mbox_chan *chan) +{ + struct mpfs_mbox *mbox = (struct mpfs_mbox *)chan->con_priv; + + return !mpfs_mbox_busy(mbox); +} + static int mpfs_mbox_send_data(struct mbox_chan *chan, void *data) { struct mpfs_mbox *mbox = (struct mpfs_mbox *)chan->con_priv; @@ -183,7 +190,6 @@ static irqreturn_t mpfs_mbox_inbox_isr(int irq, void *data) mpfs_mbox_rx_data(chan); - mbox_chan_txdone(chan, 0); return IRQ_HANDLED; } @@ -213,6 +219,7 @@ static const struct mbox_chan_ops mpfs_mbox_ops = { .send_data = mpfs_mbox_send_data, .startup = mpfs_mbox_startup, .shutdown = mpfs_mbox_shutdown, + .last_tx_done = mpfs_mbox_last_tx_done, }; static int mpfs_mbox_probe(struct platform_device *pdev) @@ -248,7 +255,8 @@ static int mpfs_mbox_probe(struct platform_device *pdev) mbox->controller.num_chans = 1; mbox->controller.chans = mbox->chans; mbox->controller.ops = &mpfs_mbox_ops; - mbox->controller.txdone_irq = true; + mbox->controller.txdone_poll = true; + mbox->controller.txpoll_period = 10u; ret = devm_mbox_controller_register(&pdev->dev, &mbox->controller); if (ret) { -- 2.39.0