From patchwork Mon Oct 2 23:13:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 9981329 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 73845602A0 for ; Mon, 2 Oct 2017 23:15:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 661A5288DB for ; Mon, 2 Oct 2017 23:15:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A82228942; Mon, 2 Oct 2017 23:15:32 +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 E2FC1288DB for ; Mon, 2 Oct 2017 23:15:31 +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=GHB18eWD4SE0l7XKC+0vjB3Xg4vnqrNgSFFczp+cB9k=; b=FPVq92u5DkAxhiSA7RyNvn4rs+ XnI/CCdmhzahxTxctVLvLLhwWDeM2Ynbvcm9Uo21zz5Q4wBuqEbUfrMyW3XkB86VjKU9zh1JZb2ZJ VjeWRxrYt9bKrQWSc6VZd0+41SjOI+cuEMaN/yg49OqjU6xyAfXcocCHEES059QYsJeFD4XLIUh+3 vnmGrs6I9D/w9IOldEnnsbcDgFxZY6gVgRAtrSTLtEPEPIxpyaVPFyoCocaCXf4/QUPfYXFxYnkll ZMPJuX1Wb3xhLR6RqgZl3rs6FrnUDDpjp3h4g6QFegmnkZLSvpCpU+WCWei/G2LUWazpsaQvc22hV 01dn6TbQ==; 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 1dz9vn-0001ic-9F; Mon, 02 Oct 2017 23:15:23 +0000 Received: from smtp-out-so.shaw.ca ([64.59.136.139]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dz9vL-0000BG-Sf for linux-arm-kernel@lists.infradead.org; Mon, 02 Oct 2017 23:15:01 +0000 Received: from triton.mmayer.net ([96.48.165.49]) by shaw.ca with SMTP id z9v3dFCeZ8LPZz9v4dsXgf; Mon, 02 Oct 2017 17:14:38 -0600 X-Authority-Analysis: v=2.2 cv=e552ceh/ c=1 sm=1 tr=0 a=k5HOQ6ZN7M0zyjl8M7O1NA==:117 a=k5HOQ6ZN7M0zyjl8M7O1NA==:17 a=02M-m0pO-4AA:10 a=Q-fNiiVtAAAA:8 a=jbmsSpij_iSxRTdqSoAA:9 a=Fp8MccfUoT0GBdDC_Lng:22 Received: by triton.mmayer.net (Postfix, from userid 501) id 65AAA200568399; Mon, 2 Oct 2017 16:14:37 -0700 (PDT) From: Markus Mayer To: Florian Fainelli , Gregory Fong , Brian Norris Subject: [PATCH 2/2] memory: brcmstb: dpfe: skip downloading firmware when possible Date: Mon, 2 Oct 2017 16:13:47 -0700 Message-Id: <20171002231347.8671-3-code@mmayer.net> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171002231347.8671-1-code@mmayer.net> References: <20171002231347.8671-1-code@mmayer.net> X-CMAE-Envelope: MS4wfK7KrPlKaf37zHLHBFD9ONHDLja35MPYDN64DN/O+mxqDz69uBgkE66uXsjV4MZcP8ziTDlQbI1fpqCc2l0KgUnop/M5u/AnDgNbm5pcWicfjQmD+37u yMyg5zqRJVplICG9TdLtE28plBd7zY+3bpq/upGBq/04kp2YS85ASOH7bw/Bh6bY2HpxXQPg0fWM3LTuL+Cms+Myxup/aNrMsfx6LbXG53CzOuH6HGrnyYyy 8lnv3KYdzTKFdxvgm4wq+DTkeB9zAqjR7vynTN37FVMZCwCIn3dPmv5DZTGyPqgdOIoiLMi7dk52+lzki2uiT46b5HVW4SPdRbBwHegsXB5seMdOiHeHLEQj UcfMN/KqPDabJtwO4wEq6q2NVMtKFQ20xREnanOLVfIRuoT5lqphDiKNpxQL48nZz6NUxdw0wf9UOECDrt3NvkeCb/RqJouLAyZM3xnRMxqUD4HJdSg= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171002_161456_849794_825BF49B X-CRM114-Status: GOOD ( 12.41 ) 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: Device Tree List , Broadcom Kernel List , ARM Kernel List , Markus Mayer , Linux Kernel Mailing List 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: Markus Mayer We want to skip downloading the DPFE firmware from Linux if it was already downloaded by the boot loader. The driver now checks if the DCPU is already running and, if so, whether it can process commands. If the DCPU processes commands successfully, the driver skips the firmware download step. Signed-off-by: Markus Mayer --- drivers/memory/brcmstb_dpfe.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/memory/brcmstb_dpfe.c b/drivers/memory/brcmstb_dpfe.c index 3516ee8..0a7bdbe 100644 --- a/drivers/memory/brcmstb_dpfe.c +++ b/drivers/memory/brcmstb_dpfe.c @@ -431,13 +431,25 @@ static int brcmstb_dpfe_download_firmware(struct platform_device *pdev, const void *fw_blob; int ret; + priv = platform_get_drvdata(pdev); + + /* + * Skip downloading the firmware if the DCPU is already running and + * responding to commands. + */ + if (is_dcpu_enabled(priv->regs)) { + u32 response[MSG_FIELD_MAX]; + + ret = __send_command(priv, DPFE_CMD_GET_INFO, response); + if (!ret) + return 0; + } + ret = request_firmware(&fw, FIRMWARE_NAME, dev); /* request_firmware() prints its own error messages. */ if (ret) return ret; - priv = platform_get_drvdata(pdev); - ret = __verify_firmware(init, fw); if (ret) return -EFAULT;