From patchwork Tue May 16 18:02:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dwivedi, Avaneesh Kumar (avani)" X-Patchwork-Id: 9729471 X-Patchwork-Delegate: agross@codeaurora.org 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 CD97760386 for ; Tue, 16 May 2017 18:04:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6AEB286DE for ; Tue, 16 May 2017 18:04:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9D8F28758; Tue, 16 May 2017 18:04:11 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1DDC628736 for ; Tue, 16 May 2017 18:04:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752248AbdEPSDx (ORCPT ); Tue, 16 May 2017 14:03:53 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37564 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753033AbdEPSCR (ORCPT ); Tue, 16 May 2017 14:02:17 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id CEA0460D93; Tue, 16 May 2017 18:02:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1494957736; bh=Mz1Y58wAe99Z1YsrINVRit69rDzJ5OofcSJvM/dgdRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W7d6w798vnQbbNlS43FWxLr7EWmVb8tpazpeLjmaL5UP6uVrNGwRxgNChoxOoBK70 aN0DmcuqOVHvOjFDvM4DUXNF4LcMWI9hOJfCOA//OVYjwtLvu0BS6oZxI2FjobMNcZ gPnrxlDvuaxX1lxQ2NRFxvA1xyBwEqKO50j/tK00= Received: from akdwived-linux.qualcomm.com (unknown [202.46.23.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: akdwived@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 77CE060DA7; Tue, 16 May 2017 18:02:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1494957736; bh=Mz1Y58wAe99Z1YsrINVRit69rDzJ5OofcSJvM/dgdRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W7d6w798vnQbbNlS43FWxLr7EWmVb8tpazpeLjmaL5UP6uVrNGwRxgNChoxOoBK70 aN0DmcuqOVHvOjFDvM4DUXNF4LcMWI9hOJfCOA//OVYjwtLvu0BS6oZxI2FjobMNcZ gPnrxlDvuaxX1lxQ2NRFxvA1xyBwEqKO50j/tK00= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 77CE060DA7 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=akdwived@codeaurora.org From: Avaneesh Kumar Dwivedi To: bjorn.andersson@linaro.org Cc: sboyd@codeaurora.org, agross@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Avaneesh Kumar Dwivedi Subject: [RESEND: PATCH v4 2/4] remoteproc: qcom: refactor mss fw image loading sequence Date: Tue, 16 May 2017 23:32:00 +0530 Message-Id: <1494957722-13264-3-git-send-email-akdwived@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1494957722-13264-1-git-send-email-akdwived@codeaurora.org> References: <1494957722-13264-1-git-send-email-akdwived@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch refactor code to first load all firmware blobs and then update modem proc to authenticate and boot fw. Also make a trivial change in a error log. Signed-off-by: Avaneesh Kumar Dwivedi --- drivers/remoteproc/qcom_q6v5_pil.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c index 8fd697a..2626954 100644 --- a/drivers/remoteproc/qcom_q6v5_pil.c +++ b/drivers/remoteproc/qcom_q6v5_pil.c @@ -466,9 +466,10 @@ static int q6v5_mpss_init_image(struct q6v5 *qproc, const struct firmware *fw) ret = q6v5_rmb_mba_wait(qproc, RMB_MBA_META_DATA_AUTH_SUCCESS, 1000); if (ret == -ETIMEDOUT) - dev_err(qproc->dev, "MPSS header authentication timed out\n"); + dev_err(qproc->dev, "metadata authentication timed out\n"); else if (ret < 0) - dev_err(qproc->dev, "MPSS header authentication failed: %d\n", ret); + dev_err(qproc->dev, + "metadata authentication failed: %d\n", ret); dma_free_attrs(qproc->dev, fw->size, ptr, phys, dma_attrs); @@ -503,7 +504,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) bool relocate = false; char seg_name[10]; ssize_t offset; - size_t size; + size_t size = 0; void *ptr; int ret; int i; @@ -541,7 +542,9 @@ static int q6v5_mpss_load(struct q6v5 *qproc) } mpss_reloc = relocate ? min_addr : qproc->mpss_phys; - + /* Load firmware completely before letting mss to start + * authentication and then boot firmware + */ for (i = 0; i < ehdr->e_phnum; i++) { phdr = &phdrs[i]; @@ -574,17 +577,13 @@ static int q6v5_mpss_load(struct q6v5 *qproc) memset(ptr + phdr->p_filesz, 0, phdr->p_memsz - phdr->p_filesz); } - - size = readl(qproc->rmb_base + RMB_PMI_CODE_LENGTH_REG); - if (!size) { - boot_addr = relocate ? qproc->mpss_phys : min_addr; - writel(boot_addr, qproc->rmb_base + RMB_PMI_CODE_START_REG); - writel(RMB_CMD_LOAD_READY, qproc->rmb_base + RMB_MBA_COMMAND_REG); - } - size += phdr->p_memsz; - writel(size, qproc->rmb_base + RMB_PMI_CODE_LENGTH_REG); } + /* Transfer ownership of modem region with modem fw */ + boot_addr = relocate ? qproc->mpss_phys : min_addr; + writel(boot_addr, qproc->rmb_base + RMB_PMI_CODE_START_REG); + writel(RMB_CMD_LOAD_READY, qproc->rmb_base + RMB_MBA_COMMAND_REG); + writel(size, qproc->rmb_base + RMB_PMI_CODE_LENGTH_REG); ret = q6v5_rmb_mba_wait(qproc, RMB_MBA_AUTH_COMPLETE, 10000); if (ret == -ETIMEDOUT)