All of lore.kernel.org
 help / color / mirror / Atom feed
From: york sun <york.sun@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4] QE: add QE support on SD boot
Date: Wed, 24 May 2017 15:23:58 +0000	[thread overview]
Message-ID: <VI1PR0401MB268758687F3D34EEB66249CD9AFE0@VI1PR0401MB2687.eurprd04.prod.outlook.com> (raw)
In-Reply-To: 1494898066-11825-1-git-send-email-qiang.zhao@nxp.com

On 05/15/2017 06:43 PM, Zhao Qiang wrote:
> modify u_qe_init to upload QE firmware from SD card when it is SD
> boot
> 
> Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
> ---
> Changes for v2:
> 	- fix issue of memory leak
> Changes for v3:
> 	- add CONFIG_SYS_QE_FMAN_FW_IN_NOR to ls1021a
> Changes for v4:
> 	- rebase due to memory-mapping conflict
> 
>   drivers/qe/qe.c                  | 37 ++++++++++++++++++++++++++++++++++++-
>   include/configs/ls1021aqds.h     |  1 +
>   include/configs/ls1021atwr.h     |  1 +
>   include/configs/ls1043a_common.h |  2 ++
>   include/configs/ls1043ardb.h     |  4 +---
>   5 files changed, 41 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/qe/qe.c b/drivers/qe/qe.c
> index 4f0a278..52e4d7c 100644
> --- a/drivers/qe/qe.c
> +++ b/drivers/qe/qe.c
> @@ -8,6 +8,7 @@
>    */
>   
>   #include <common.h>
> +#include <malloc.h>
>   #include <command.h>
>   #include <linux/errno.h>
>   #include <asm/io.h>
> @@ -17,6 +18,10 @@
>   #include <asm/arch/immap_ls102xa.h>
>   #endif
>   
> +#ifdef CONFIG_SYS_QE_FMAN_FW_IN_MMC
> +#include <mmc.h>
> +#endif
> +
>   #define MPC85xx_DEVDISR_QE_DISABLE	0x1
>   
>   qe_map_t		*qe_immr = NULL;
> @@ -194,8 +199,38 @@ void u_qe_init(void)
>   {
>   	qe_immr = (qe_map_t *)(CONFIG_SYS_IMMR + QE_IMMR_OFFSET);
>   
> -	u_qe_upload_firmware((const void *)CONFIG_SYS_QE_FW_ADDR);
> +#if defined(CONFIG_SYS_QE_FMAN_FW_IN_NOR)
> +	void *addr = (void *)CONFIG_SYS_QE_FW_ADDR;
> +#elif defined(CONFIG_SYS_QE_FMAN_FW_IN_MMC)
> +	int dev = CONFIG_SYS_MMC_ENV_DEV;
> +	void *addr = malloc(CONFIG_SYS_QE_FMAN_FW_LENGTH);
> +	u32 cnt = CONFIG_SYS_QE_FMAN_FW_LENGTH / 512;
> +	u32 blk = CONFIG_SYS_QE_FW_ADDR / 512;
> +
> +	if (mmc_initialize(gd->bd)) {
> +		printf("%s: mmc_initialize() failed\n", __func__);
> +		return;
> +	}
> +	struct mmc *mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV);
> +
> +	if (!mmc) {
> +		free(addr);
> +		printf("\nMMC cannot find device for ucode\n");
> +	} else {
> +		printf("\nMMC read: dev # %u, block # %u, count %u ...\n",
> +		       dev, blk, cnt);
> +		mmc_init(mmc);
> +		(void)mmc->block_dev.block_read(&mmc->block_dev, blk, cnt,
> +						addr);
> +		/* flush cache after read */
> +		flush_cache((ulong)addr, cnt * 512);
> +	}
> +#endif
> +	u_qe_upload_firmware(addr);
>   	out_be32(&qe_immr->iram.iready, QE_IRAM_READY);

You are using addr outside of #if section. This causes compiling error 
for T1024, T1040, T1042, etc. Please test on both ARM and PowerPC 
platforms before sending a new version.

York

      reply	other threads:[~2017-05-24 15:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16  1:27 [U-Boot] [PATCH v4] QE: add QE support on SD boot Zhao Qiang
2017-05-24 15:23 ` york sun [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=VI1PR0401MB268758687F3D34EEB66249CD9AFE0@VI1PR0401MB2687.eurprd04.prod.outlook.com \
    --to=york.sun@nxp.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.