From patchwork Tue Oct 3 05:21:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9981723 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3CC5660365 for ; Tue, 3 Oct 2017 05:39:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F7441FFB2 for ; Tue, 3 Oct 2017 05:39:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2238A2873F; Tue, 3 Oct 2017 05:39:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 88C971FFB2 for ; Tue, 3 Oct 2017 05:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=mlcS2k5t7KhLUT303h4fjdze1Jj/f5axUk8+DIl6KJs=; b=kVy5Hdt1fue6m6Agn9i/2FcDuM 9aqZ5eU/ZVZnxHCuttGz2IEbV4mdBTy1sc7M5UxaI0FWh776ALwnCt3/mAupuk42m3QDl1BHRV2Ic cstiuguMqEZsR4tvDm8mfTtCPkMrFql2fp6pfMA8NuDEPRmTb7N9ucqJiHaTNgiPtuTxJNTRGyVtq Vr2wvmHqr4p3JAupaSUksmeMD/BiDTn3pgpcZuP1HyYPk/LrBBx/J94RWfN9J9l/G5Lf0ykszlJNo GBTo3SbA5kQPh1SEvERl+UHJis7FcJdiKz4KUxNli2F77D7aQ/blYufppX+Ov3oeE2qCZwxlYEfad RXoa9sbQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dzFv6-0002OW-5o; Tue, 03 Oct 2017 05:39:04 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dzFuZ-0001Uq-JD for linux-arm-kernel@bombadil.infradead.org; Tue, 03 Oct 2017 05:38:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=dmTsPgJFgw5U3WnbGSY8x0hL3qu+9TlVeZRCOTiI/bE=; b=RFgbnTHo0I7xxtFBgOWt8kjil MMViDyDCwWcIcYLgHAwQtV4dvYCRKl42JtZUYh9Sti5y/SzM/2l6p4TMcddsgijCC3XPp0rBm4K39 QfxGsrrX+/iyzvEdRWtOsh1Wp9m372CvHbeunNvp+hja42UTgY9a4jtWcemlsIMpLhUjOHKkeOYb3 dyjDWtsUrNhI5IWN0tRbcQWfcCwPOg6PLoJo8ITqp6jQUmdhYB9FBt0ca13PFl+B3W4ldN+skuAHJ do2VwJ4/R5+NpPn+EarvzD2bSV/q8zQTJO1+DUrSACOIe58BjWpWakDEVZ017eFJUf7XFu4NGXpEA kqETcsuLQ==; Received: from mail-qt0-x22a.google.com ([2607:f8b0:400d:c0d::22a]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dzFfH-000501-Sy for linux-arm-kernel@lists.infradead.org; Tue, 03 Oct 2017 05:22:46 +0000 Received: by mail-qt0-x22a.google.com with SMTP id o52so10980579qtc.9 for ; Mon, 02 Oct 2017 22:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dmTsPgJFgw5U3WnbGSY8x0hL3qu+9TlVeZRCOTiI/bE=; b=UYx2VHci99UOBzCyFbwg8QAoqN9eFnfw8Eo68isKbDB7nbcJDffnURa3zswZvFZNXl O2jkHFgWNuEjV91kspuZSkqBchRa7Nkck2ixq/rzK1bUoG3fgivqo+QIyjTU+EiERLi4 LvoUh98vBV1pM7rGQEY69WkNKqhdw1IAK8MQQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dmTsPgJFgw5U3WnbGSY8x0hL3qu+9TlVeZRCOTiI/bE=; b=ECPdueJLaXndIKWE5xcYxOCV/VIUTGWBxcKLQheADJiNI1CjOjkSV4GQZmMwYitfsq fZOJRtrBkXbBCnq5y2+w2fCTTyNRtwSIS82UYLaZT1RugCqLq76lGCEx/eR3JhWCFiTU AAEmLPs7nV0FDyRrUsuXr38lHRnNPkMpLGeA+mnKL1Y0BfoRJRzPPQCdmVeLM7jS0wtT m+MsDlNxzc0dRwBDx31IF/+TyNBH64LE5jmSFldFNryJLyUE89FirXk1Easc5uUusQ4x rzxyKYJgWSrSpWywRAz+xoHeGnmqnvhpKGzXHb8fllxY8BMOO92C4zHz3MbFmt9/rq4J ijGA== X-Gm-Message-State: AMCzsaUHPYnfvG+Z/bspOAKEmqTeEQ5LtmNf52PY/frv+16PWR6lS1RB qq5jaxLYAzUC+SkTi3ds7+/jNA== X-Google-Smtp-Source: AOwi7QCWsP74dSObDgih4OTnGisLQsU2aC50sAPItw7b6P5HHGhXqCmkX5wy+z5vDsxjgUhtEU+J7g== X-Received: by 10.200.43.42 with SMTP id 39mr3318110qtu.51.1507008140801; Mon, 02 Oct 2017 22:22:20 -0700 (PDT) Received: from anup-HP-Compaq-8100-Elite-CMT-PC.dhcp.avagotech.net ([192.19.237.250]) by smtp.gmail.com with ESMTPSA id l51sm8226731qtl.41.2017.10.02.22.22.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Oct 2017 22:22:19 -0700 (PDT) From: Anup Patel To: Jassi Brar Subject: [PATCH 1/5] mailbox: bcm-flexrm-mailbox: Fix FlexRM ring flush sequence Date: Tue, 3 Oct 2017 10:51:48 +0530 Message-Id: <1507008112-27117-2-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507008112-27117-1-git-send-email-anup.patel@broadcom.com> References: <1507008112-27117-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171003_062244_030508_309C10FC X-CRM114-Status: GOOD ( 13.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Fainelli , Anup Patel , Scott Branden , Ray Jui , linux-kernel@vger.kernel.org, stable@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP As-per suggestion from FlexRM HW folks, we have to first set FlexRM ring flush state and then clear it for FlexRM ring flush to work properly. Currently, the FlexRM driver has incomplete FlexRM ring flush sequence which causes repeated insmod+rmmod of mailbox client drivers to fail. This patch fixes FlexRM ring flush sequence in flexrm_shutdown() as described above. Fixes: dbc049eee730 ("mailbox: Add driver for Broadcom FlexRM ring manager") Signed-off-by: Anup Patel Reviewed-by: Scott Branden Cc: stable@vger.kernel.org --- drivers/mailbox/bcm-flexrm-mailbox.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/mailbox/bcm-flexrm-mailbox.c b/drivers/mailbox/bcm-flexrm-mailbox.c index ae61463..f052a3e 100644 --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++ b/drivers/mailbox/bcm-flexrm-mailbox.c @@ -1365,8 +1365,8 @@ static void flexrm_shutdown(struct mbox_chan *chan) /* Disable/inactivate ring */ writel_relaxed(0x0, ring->regs + RING_CONTROL); - /* Flush ring with timeout of 1s */ - timeout = 1000; + /* Set ring flush state */ + timeout = 1000; /* timeout of 1s */ writel_relaxed(BIT(CONTROL_FLUSH_SHIFT), ring->regs + RING_CONTROL); do { @@ -1374,7 +1374,23 @@ static void flexrm_shutdown(struct mbox_chan *chan) FLUSH_DONE_MASK) break; mdelay(1); - } while (timeout--); + } while (--timeout); + if (!timeout) + dev_err(ring->mbox->dev, + "setting ring%d flush state timedout\n", ring->num); + + /* Clear ring flush state */ + timeout = 1000; /* timeout of 1s */ + writel_relaxed(0x0, ring + RING_CONTROL); + do { + if (!(readl_relaxed(ring + RING_FLUSH_DONE) & + FLUSH_DONE_MASK)) + break; + mdelay(1); + } while (--timeout); + if (!timeout) + dev_err(ring->mbox->dev, + "clearing ring%d flush state timedout\n", ring->num); /* Abort all in-flight requests */ for (reqid = 0; reqid < RING_MAX_REQ_COUNT; reqid++) {