From patchwork Wed Mar 4 14:26:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Shubin X-Patchwork-Id: 11420223 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F668139A for ; Wed, 4 Mar 2020 14:25:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0030E20866 for ; Wed, 4 Mar 2020 14:25:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=maquefel.me header.i=@maquefel.me header.b="HVFWZPWP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726748AbgCDOZW (ORCPT ); Wed, 4 Mar 2020 09:25:22 -0500 Received: from forward103p.mail.yandex.net ([77.88.28.106]:44763 "EHLO forward103p.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726440AbgCDOZW (ORCPT ); Wed, 4 Mar 2020 09:25:22 -0500 Received: from forward102q.mail.yandex.net (forward102q.mail.yandex.net [IPv6:2a02:6b8:c0e:1ba:0:640:516:4e7d]) by forward103p.mail.yandex.net (Yandex) with ESMTP id 25E9718C3845; Wed, 4 Mar 2020 17:25:19 +0300 (MSK) Received: from mxback8q.mail.yandex.net (mxback8q.mail.yandex.net [IPv6:2a02:6b8:c0e:42:0:640:b38f:32ec]) by forward102q.mail.yandex.net (Yandex) with ESMTP id 205C27F20018; Wed, 4 Mar 2020 17:25:19 +0300 (MSK) Received: from vla5-47b3f4751bc4.qloud-c.yandex.net (vla5-47b3f4751bc4.qloud-c.yandex.net [2a02:6b8:c18:3508:0:640:47b3:f475]) by mxback8q.mail.yandex.net (mxback/Yandex) with ESMTP id I0SvveKpM4-PINeEPFT; Wed, 04 Mar 2020 17:25:19 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maquefel.me; s=mail; t=1583331919; bh=r83eXkzCEdXbDAwniYRybWaeq5RaZBLGnoqVnnIBAUg=; h=Subject:To:From:Cc:Date:Message-Id; b=HVFWZPWPclF02CLbSzuHlL9bRIjJ8R4BhCaVEQFXbvAlKKCKFaDzEijV7uji3BY8t TZ2jGlQSgYvUPxMJoBPjCJExH/T7WYF8IhcGGtjjmAdtx4N1D3p/FWFB+BOzB1nI87 zkYBOwqgqqVqCi9UK/y3MB7bKa8IcqSqvbWmvvvo= Authentication-Results: mxback8q.mail.yandex.net; dkim=pass header.i=@maquefel.me Received: by vla5-47b3f4751bc4.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id OSNMAAdVGo-PH3OtHoN; Wed, 04 Mar 2020 17:25:17 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Nikita Shubin Cc: Nikita Shubin , Ohad Ben-Cohen , Bjorn Andersson , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] remoteproc: imx_rproc: dummy kick method Date: Wed, 4 Mar 2020 17:26:27 +0300 Message-Id: <20200304142628.8471-1-NShubin@topcon.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org add kick method that does nothing, to avoid errors in rproc_virtio_notify. Signed-off-by: Nikita Shubin --- drivers/remoteproc/imx_rproc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 3e72b6f38d4b..796b6b86550a 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -240,9 +240,15 @@ static void *imx_rproc_da_to_va(struct rproc *rproc, u64 da, int len) return va; } +static void imx_rproc_kick(struct rproc *rproc, int vqid) +{ + +} + static const struct rproc_ops imx_rproc_ops = { .start = imx_rproc_start, .stop = imx_rproc_stop, + .kick = imx_rproc_kick, .da_to_va = imx_rproc_da_to_va, }; From patchwork Wed Mar 4 14:26:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Shubin X-Patchwork-Id: 11420227 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 89C1F17E0 for ; Wed, 4 Mar 2020 14:25:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6B4AD20866 for ; Wed, 4 Mar 2020 14:25:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=maquefel.me header.i=@maquefel.me header.b="Y0dDF7rK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729642AbgCDOZg (ORCPT ); Wed, 4 Mar 2020 09:25:36 -0500 Received: from forward103j.mail.yandex.net ([5.45.198.246]:60300 "EHLO forward103j.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729608AbgCDOZg (ORCPT ); Wed, 4 Mar 2020 09:25:36 -0500 Received: from forward101q.mail.yandex.net (forward101q.mail.yandex.net [IPv6:2a02:6b8:c0e:4b:0:640:4012:bb98]) by forward103j.mail.yandex.net (Yandex) with ESMTP id 8C8F06740CBB; Wed, 4 Mar 2020 17:25:32 +0300 (MSK) Received: from mxback11q.mail.yandex.net (mxback11q.mail.yandex.net [IPv6:2a02:6b8:c0e:1b4:0:640:1f0c:10f2]) by forward101q.mail.yandex.net (Yandex) with ESMTP id 87464CF40016; Wed, 4 Mar 2020 17:25:32 +0300 (MSK) Received: from vla5-47b3f4751bc4.qloud-c.yandex.net (vla5-47b3f4751bc4.qloud-c.yandex.net [2a02:6b8:c18:3508:0:640:47b3:f475]) by mxback11q.mail.yandex.net (mxback/Yandex) with ESMTP id UCXxzZegUE-PVous9Uk; Wed, 04 Mar 2020 17:25:32 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maquefel.me; s=mail; t=1583331932; bh=Jng1nEj1zbxMUGN9K/Xjwz4cFmbLujsZJxv+9sN+qAg=; h=In-Reply-To:Subject:To:From:Cc:References:Date:Message-Id; b=Y0dDF7rKpb4+QNQNIAI98jMiP86mMDuVOZfHeceea3AJcf2ji3FFCHzWbNZEgI/w0 RgLFBNe68h8LFeo1xcZGJMEdGCCH3OETtgRxicMb3csdQWnFyrzAE9j5AzwUWcykdi uVuoaB/FkBz45olpZs4yKqu3SD4fF3BtljG0IN1U= Authentication-Results: mxback11q.mail.yandex.net; dkim=pass header.i=@maquefel.me Received: by vla5-47b3f4751bc4.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id OSNMAAdVGo-PU3OCmWJ; Wed, 04 Mar 2020 17:25:30 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Nikita Shubin Cc: Nikita Shubin , Ohad Ben-Cohen , Bjorn Andersson , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] remoteproc: imx_rproc: set pc on start Date: Wed, 4 Mar 2020 17:26:28 +0300 Message-Id: <20200304142628.8471-2-NShubin@topcon.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200304142628.8471-1-NShubin@topcon.com> References: <20200304142628.8471-1-NShubin@topcon.com> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org In case elf file interrupt vector is not supposed to be at OCRAM_S, it is needed to write elf entry point to OCRAM_S + 0x4, to boot M4 firmware. Otherwise firmware located anywhere besides OCRAM_S won't boot. The firmware must set stack poiner as first instruction: Reset_Handler: ldr sp, = __stack /* set stack pointer */ Signed-off-by: Nikita Shubin --- drivers/remoteproc/imx_rproc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 796b6b86550a..d02007f05ebd 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -45,6 +45,8 @@ #define IMX7D_RPROC_MEM_MAX 8 +#define IMX_BOOT_PC 0x4 + /** * struct imx_rproc_mem - slim internal memory structure * @cpu_addr: MPU virtual address of the memory region @@ -85,6 +87,7 @@ struct imx_rproc { const struct imx_rproc_dcfg *dcfg; struct imx_rproc_mem mem[IMX7D_RPROC_MEM_MAX]; struct clk *clk; + void __iomem *bootreg; }; static const struct imx_rproc_att imx_rproc_att_imx7d[] = { @@ -162,11 +165,16 @@ static int imx_rproc_start(struct rproc *rproc) struct device *dev = priv->dev; int ret; + /* write entry point to program counter */ + writel(rproc->bootaddr, priv->bootreg); + ret = regmap_update_bits(priv->regmap, dcfg->src_reg, dcfg->src_mask, dcfg->src_start); if (ret) dev_err(dev, "Failed to enable M4!\n"); + dev_info(&rproc->dev, "Started from 0x%x\n", rproc->bootaddr); + return ret; } @@ -182,6 +190,9 @@ static int imx_rproc_stop(struct rproc *rproc) if (ret) dev_err(dev, "Failed to stop M4!\n"); + /* clear entry points */ + writel(0, priv->bootreg); + return ret; } @@ -366,6 +377,8 @@ static int imx_rproc_probe(struct platform_device *pdev) goto err_put_rproc; } + priv->bootreg = imx_rproc_da_to_va(rproc, IMX_BOOT_PC, sizeof(u32)); + /* * clk for M4 block including memory. Should be * enabled before .start for FW transfer.