* [U-Boot] [PATCH v3] QE: add QE support on SD boot
@ 2017-05-09 6:17 Zhao Qiang
2017-05-15 17:25 ` york sun
0 siblings, 1 reply; 3+ messages in thread
From: Zhao Qiang @ 2017-05-09 6:17 UTC (permalink / raw)
To: u-boot
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
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);
+#ifdef CONFIG_SYS_QE_FMAN_FW_IN_MMC
+ free(addr);
+#endif
}
#endif
diff --git a/include/configs/ls1021aqds.h b/include/configs/ls1021aqds.h
index c3224c8..34e469e 100644
--- a/include/configs/ls1021aqds.h
+++ b/include/configs/ls1021aqds.h
@@ -125,6 +125,7 @@ unsigned long get_board_ddr_clk(void);
#if !defined(CONFIG_SD_BOOT) && !defined(CONFIG_NAND_BOOT) && \
!defined(CONFIG_QSPI_BOOT)
#define CONFIG_U_QE
+#define CONFIG_SYS_QE_FMAN_FW_IN_NOR
#endif
/*
diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h
index 1d0b469..a652248 100644
--- a/include/configs/ls1021atwr.h
+++ b/include/configs/ls1021atwr.h
@@ -150,6 +150,7 @@
#if !defined(CONFIG_SD_BOOT) && !defined(CONFIG_NAND_BOOT) && \
!defined(CONFIG_QSPI_BOOT)
#define CONFIG_U_QE
+#define CONFIG_SYS_QE_FMAN_FW_IN_NOR
#endif
/*
diff --git a/include/configs/ls1043a_common.h b/include/configs/ls1043a_common.h
index e269248..80c508e 100644
--- a/include/configs/ls1043a_common.h
+++ b/include/configs/ls1043a_common.h
@@ -219,6 +219,7 @@
*/
#define CONFIG_SYS_QE_FMAN_FW_IN_MMC
#define CONFIG_SYS_FMAN_FW_ADDR (512 * 0x820)
+#define CONFIG_SYS_QE_FW_ADDR (512 * 0x4a08)
#elif defined(CONFIG_QSPI_BOOT)
#define CONFIG_SYS_QE_FW_IN_SPIFLASH
#define CONFIG_SYS_FMAN_FW_ADDR 0x400d0000
@@ -230,6 +231,7 @@
#define CONFIG_SYS_QE_FMAN_FW_IN_NOR
/* FMan fireware Pre-load address */
#define CONFIG_SYS_FMAN_FW_ADDR 0x60300000
+#define CONFIG_SYS_QE_FW_ADDR 0x60600000
#endif
#define CONFIG_SYS_QE_FMAN_FW_LENGTH 0x10000
#define CONFIG_SYS_FDT_PAD (0x3000 + CONFIG_SYS_QE_FMAN_FW_LENGTH)
diff --git a/include/configs/ls1043ardb.h b/include/configs/ls1043ardb.h
index 5e570cd..ffa0dba 100644
--- a/include/configs/ls1043ardb.h
+++ b/include/configs/ls1043ardb.h
@@ -277,11 +277,9 @@
/* QE */
#ifndef SPL_NO_QE
-#if !defined(CONFIG_SD_BOOT) && !defined(CONFIG_NAND_BOOT) && \
- !defined(CONFIG_QSPI_BOOT)
+#if !defined(CONFIG_NAND_BOOT) && !defined(CONFIG_QSPI_BOOT)
#define CONFIG_U_QE
#endif
-#define CONFIG_SYS_QE_FW_ADDR 0x60600000
#endif
/* USB */
--
2.1.0.27.g96db324
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v3] QE: add QE support on SD boot
2017-05-09 6:17 [U-Boot] [PATCH v3] QE: add QE support on SD boot Zhao Qiang
@ 2017-05-15 17:25 ` york sun
2017-05-16 1:07 ` Qiang Zhao
0 siblings, 1 reply; 3+ messages in thread
From: york sun @ 2017-05-15 17:25 UTC (permalink / raw)
To: u-boot
On 05/08/2017 11:32 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
<snip>
> /*
> diff --git a/include/configs/ls1043a_common.h b/include/configs/ls1043a_common.h
> index e269248..80c508e 100644
> --- a/include/configs/ls1043a_common.h
> +++ b/include/configs/ls1043a_common.h
> @@ -219,6 +219,7 @@
> */
> #define CONFIG_SYS_QE_FMAN_FW_IN_MMC
> #define CONFIG_SYS_FMAN_FW_ADDR (512 * 0x820)
> +#define CONFIG_SYS_QE_FW_ADDR (512 * 0x4a08)
> #elif defined(CONFIG_QSPI_BOOT)
> #define CONFIG_SYS_QE_FW_IN_SPIFLASH
> #define CONFIG_SYS_FMAN_FW_ADDR 0x400d0000
> @@ -230,6 +231,7 @@
> #define CONFIG_SYS_QE_FMAN_FW_IN_NOR
> /* FMan fireware Pre-load address */
> #define CONFIG_SYS_FMAN_FW_ADDR 0x60300000
> +#define CONFIG_SYS_QE_FW_ADDR 0x60600000
Qiang,
Your patch and Alison's patch
(http://patchwork.ozlabs.org/patch/755865/) both modify the mapping.
Please confirm the addresses are still OK with both patches.
York
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v3] QE: add QE support on SD boot
2017-05-15 17:25 ` york sun
@ 2017-05-16 1:07 ` Qiang Zhao
0 siblings, 0 replies; 3+ messages in thread
From: Qiang Zhao @ 2017-05-16 1:07 UTC (permalink / raw)
To: u-boot
On 05/16/2017 1:26 AM, York Sun <york.sun@nxp.com> wrote:
> -----Original Message-----
> From: york sun
> Sent: Tuesday, May 16, 2017 1:26 AM
> To: Qiang Zhao <qiang.zhao@nxp.com>; Alison Wang <alison.wang@nxp.com>
> Cc: Mingkai Hu <mingkai.hu@nxp.com>; Xiaobo Xie <xiaobo.xie@nxp.com>; u-
> boot at lists.denx.de
> Subject: Re: [PATCH v3] QE: add QE support on SD boot
>
> On 05/08/2017 11:32 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
>
> <snip>
>
> > /*
> > diff --git a/include/configs/ls1043a_common.h
> > b/include/configs/ls1043a_common.h
> > index e269248..80c508e 100644
> > --- a/include/configs/ls1043a_common.h
> > +++ b/include/configs/ls1043a_common.h
> > @@ -219,6 +219,7 @@
> > */
> > #define CONFIG_SYS_QE_FMAN_FW_IN_MMC
> > #define CONFIG_SYS_FMAN_FW_ADDR (512 * 0x820)
> > +#define CONFIG_SYS_QE_FW_ADDR (512 * 0x4a08)
> > #elif defined(CONFIG_QSPI_BOOT)
> > #define CONFIG_SYS_QE_FW_IN_SPIFLASH
> > #define CONFIG_SYS_FMAN_FW_ADDR 0x400d0000
> > @@ -230,6 +231,7 @@
> > #define CONFIG_SYS_QE_FMAN_FW_IN_NOR
> > /* FMan fireware Pre-load address */
> > #define CONFIG_SYS_FMAN_FW_ADDR 0x60300000
> > +#define CONFIG_SYS_QE_FW_ADDR 0x60600000
>
> Qiang,
>
> Your patch and Alison's patch
> (http://patchwork.ozlabs.org/patch/755865/) both modify the mapping.
> Please confirm the addresses are still OK with both patches.
Thank you for your reminders.
I will rebase my patch on her patch.
BR
Qiang Zhao
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-16 1:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-09 6:17 [U-Boot] [PATCH v3] QE: add QE support on SD boot Zhao Qiang
2017-05-15 17:25 ` york sun
2017-05-16 1:07 ` Qiang Zhao
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.