Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9440437rwl; Wed, 11 Jan 2023 05:52:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXvIxHa2gSrLL/3gSPPXDWn3+mIT+SUQWmO6lLOuu4bMrg9louyUnCteA9rSYW7CBz//XGF3 X-Received: by 2002:a17:903:40c4:b0:193:197e:494f with SMTP id t4-20020a17090340c400b00193197e494fmr17250857pld.27.1673445126348; Wed, 11 Jan 2023 05:52:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673445126; cv=none; d=google.com; s=arc-20160816; b=M4d7FiGMVunhrYXWL4cdlYi541Uzt2VEVHuuCeCX+h+RlCpa5/1qwk1dhowYB20Htd +sMWDk7+ifoJUCAFazJTGAWYRcANiDECiYBVAONSPe8Rwqij7EEBfk6rz5uc9w4IrdM+ eMUi7wX3r3u5rXXcoGYyIyIr0fgfIN8593ky5X6BDSc/DhePBUqxbnn3fbiDBJCNsKAT G52K4goaeO7KKqT+3ZY4bnjcpSFG6SMg8RAOx+g1DmpmSzWZ6VlN5Rb/NzmBrOgAwvj2 LdgXalJSz/MlCQjzJzFuyurCA0Cf8UeKCi/DzfeNKYJb3u2n63Apg5Pb/ZmsJYQk8S8V GAqw== 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=ufhEyPYpRxOFn5ASj2hNmwwMTzoCiarinIByZ7vkJ2i9xKmSVMvuUdGx1V8REWrcoU iWxO7s3ZUobFssI3H3YS6rJsk4pWaJegaAcllZi3sGBuvuHkyiVWbMGO/ha2zJAFZ8Au S/CtmkTFLGJNksVeTAIav30/TUVIaWT2n405LYGT8WjV7i+VaX+g+NLayjEHFtt13sea I/4/Q4d4Bpamd0whI27SUZKFaG8DQUNO1oC51qWEahvzixG+i19huiNWVtDO1TY0T656 mZVbjqM0G7OVM7715PgYAvh6V11ZN6AoccpHtCMXjfB/DfYn2tho/S6oomXCkzfj21Gd 6dWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=FBi6yMeF; 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 y4-20020a1709029b8400b00186a076362csi13672754plp.315.2023.01.11.05.51.59; Wed, 11 Jan 2023 05:52:06 -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=FBi6yMeF; 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 S233760AbjAKNqZ (ORCPT + 53 others); Wed, 11 Jan 2023 08:46:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233532AbjAKNqV (ORCPT ); Wed, 11 Jan 2023 08:46:21 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6EBD5F5E for ; Wed, 11 Jan 2023 05:45:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673444755; x=1704980755; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1o9L/4gS6hFw7QhrPiNy1BOlai1A8GCWCQbQw2g35go=; b=FBi6yMeFn6kY4CuF0OtYFitOBkKBRbUtRGzPmSK+hIG+Z1l6/3ZbQGJN zpua8RYpDEPpkEJEh/oGiPycJLz54sEQ7y3/AZkK1A6McCxnfeNvLhOnl B3XTBgR2KPstelKZVKw+UOrn/j1+J+A+VCDNXo5yGv50t+RcXKo9eINnl 0mc4j/HJ8Jsga4AE8B7GcA9LNQ5zR1+jkuoFa0z5o8GKMayWu+qcqRc0S MQMsMAY1KPzzRIS+JcJ/Lf9/o1/+VNlDhFh7pQByH+5It7r2v+RG6/6/f BCqBUBKnx/9UORQyOvkrAUnmwXQrnQqCm67Ke34rWsR7k8/9V98nZYzBh A==; X-IronPort-AV: E=Sophos;i="5.96,317,1665471600"; d="scan'208";a="131834648" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 11 Jan 2023 06:45:54 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) 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; Wed, 11 Jan 2023 06:45:50 -0700 Received: from wendy.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Wed, 11 Jan 2023 06:45:49 -0700 From: Conor Dooley To: Jassi Brar CC: Conor Dooley , Daire McNamara , , Subject: [PATCH v1 2/7] mailbox: mpfs: switch to txdone_poll Date: Wed, 11 Jan 2023 13:45:08 +0000 Message-ID: <20230111134513.2495510-3-conor.dooley@microchip.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111134513.2495510-1-conor.dooley@microchip.com> References: <20230111134513.2495510-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