From patchwork Fri Sep 28 08:43:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Madalin Bucur X-Patchwork-Id: 10619213 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E262F6CB for ; Fri, 28 Sep 2018 09:08:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D62782AD70 for ; Fri, 28 Sep 2018 09:08:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8F4F2ADC0; Fri, 28 Sep 2018 09:08:44 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 7AE5B2AD70 for ; Fri, 28 Sep 2018 09:08:44 +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:Reply-To: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: References:In-Reply-To:Message-Id:Date:Subject:To:From:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=8nxKJ2wx77heH5Eh/9g96WgEfB3O/8GQZcBEBaS3vGA=; b=HPTkNERG1YCs83AiQ7reXOKyoZ Rn2d1rQmC3QWXuSYRUUc61i6AgNH3WO2+a+eUy5YbfH1HsssmRaaCY9fSw0buSnOGmv4vX0xW9xGq +NM9Wq7iMvLxsjP5qQajrqJk2JijImM4IB7tRYWKs26cV2TbhhNiwVK0ek0KWoNgn+pvZjvxoQvVL f1ReGgHv+r0QyK1A/drqBJiqefGm5tyteziugI+Jqzmxepk1bwmZmb6jbZU1kDueUsDvBNsBJ2ZDO J2bN54ibjMiSg6UqPpY4f2WCDS5BNqr9D5sq0lOozw8vdNzDpZfa5dZAe0uO8+BYEL+NytQoqTJFn Qj+NV7ng==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5olN-0005jk-BN; Fri, 28 Sep 2018 09:08:41 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5oXe-0007CX-Se for linux-arm-kernel@bombadil.infradead.org; Fri, 28 Sep 2018 08:54:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Reply-to:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender: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=2/+ZNLd1GQzOZJ0V59LJ0lNOfzSmbZuey268zuA9LFo=; b=Oga467Lie1uycBAK0zWf4phl3 bED6BgN8HHe9FLYAKDxxIx3ncO4xQzU6vKOmPkDRGa0Q7HG7449WLAFhY1PF/b5j9bcXMqPAg7ENQ VD/QTTwO3aNEVWMtJAy1nveJr0Orvy3ZmkQjE9XMs7nBu/1T9w6LXyUsiZKZezZzM1Xo8gWmROBf5 1B2D7tarvGj6Leq2zDMAGl4/gCMJyTDZQdTowTgW3aet59rFzQKlvbb5/XLd9xvrSxhc8W3OVjc+R DVXs3UyXqt/0P2Zyk85z7g1qYOSt9mr2YfM15vDF/LhdJ9HfXbM59udyyjMd7MS/6NtlRK3iIQ3Qn B1y+31j1w==; Received: from inva020.nxp.com ([92.121.34.13]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g5oNM-0002A9-PG for linux-arm-kernel@lists.infradead.org; Fri, 28 Sep 2018 08:43:54 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 7A2341A0070; Fri, 28 Sep 2018 10:43:41 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 6DC691A006D; Fri, 28 Sep 2018 10:43:41 +0200 (CEST) Received: from fsr-fed2164-101.ea.freescale.net (fsr-fed2164-101.ea.freescale.net [10.171.82.91]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 09A852039E; Fri, 28 Sep 2018 10:43:41 +0200 (CEST) From: Madalin Bucur To: leoyang.li@nxp.com Subject: [PATCH v2 4/5] soc/fsl/qbman: Use last response to determine valid bit Date: Fri, 28 Sep 2018 11:43:23 +0300 Message-Id: <1538124204-31406-5-git-send-email-madalin.bucur@nxp.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1538124204-31406-1-git-send-email-madalin.bucur@nxp.com> References: <1538124204-31406-1-git-send-email-madalin.bucur@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180928_094352_833667_98A56924 X-CRM114-Status: GOOD ( 15.66 ) 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: , Reply-To: madalin.bucur@nxp.com Cc: Madalin Bucur , catalin.marinas@arm.com, roy.pledge@nxp.com, linux-kernel@vger.kernel.org, oss@buserror.net, claudiu.manoil@nxp.com, linuxppc-dev@lists.ozlabs.org, 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 From: Roy Pledge Use the last valid response when determining what valid bit to use next for management commands. This is needed in the case that the portal was previously used by other software like a bootloader or if the kernel is restarted without a hardware reset. Signed-off-by: Roy Pledge Signed-off-by: Madalin Bucur --- drivers/soc/fsl/qbman/qman.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c index 0ffe7a1d0eae..99d0f87889b8 100644 --- a/drivers/soc/fsl/qbman/qman.c +++ b/drivers/soc/fsl/qbman/qman.c @@ -850,12 +850,24 @@ static inline void qm_mr_set_ithresh(struct qm_portal *portal, u8 ithresh) static inline int qm_mc_init(struct qm_portal *portal) { + u8 rr0, rr1; struct qm_mc *mc = &portal->mc; mc->cr = portal->addr.ce + QM_CL_CR; mc->rr = portal->addr.ce + QM_CL_RR0; - mc->rridx = (mc->cr->_ncw_verb & QM_MCC_VERB_VBIT) - ? 0 : 1; + /* + * The expected valid bit polarity for the next CR command is 0 + * if RR1 contains a valid response, and is 1 if RR0 contains a + * valid response. If both RR contain all 0, this indicates either + * that no command has been executed since reset (in which case the + * expected valid bit polarity is 1) + */ + rr0 = mc->rr->verb; + rr1 = (mc->rr+1)->verb; + if ((rr0 == 0 && rr1 == 0) || rr0 != 0) + mc->rridx = 1; + else + mc->rridx = 0; mc->vbit = mc->rridx ? QM_MCC_VERB_VBIT : 0; #ifdef CONFIG_FSL_DPAA_CHECKING mc->state = qman_mc_idle;