From: Ahmad Fatoum <a.fatoum@pengutronix.de> To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>, barebox@lists.infradead.org Cc: rcz@pengutronix.de Subject: Re: [PATCH v2 1/3] imx8mp-evk: Add support for booting via USB Date: Tue, 26 Oct 2021 18:30:59 +0200 [thread overview] Message-ID: <c9540fec-d9cb-66a6-db20-a6fc69151399@pengutronix.de> (raw) In-Reply-To: <20210813152245.15841-2-u.kleine-koenig@pengutronix.de> On 13.08.21 17:22, Uwe Kleine-König wrote: > --- I copied these changes to the nxp-imx8mn-evk, which has the same ROM API and I can bootstrap with uuu, therefore: Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> > arch/arm/boards/nxp-imx8mp-evk/lowlevel.c | 27 +++++++++++++++++++++++ > arch/arm/mach-imx/boot.c | 4 +++- > include/asm-generic/sections.h | 1 + > 3 files changed, 31 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/boards/nxp-imx8mp-evk/lowlevel.c b/arch/arm/boards/nxp-imx8mp-evk/lowlevel.c > index 3298ded5866d..1fb7899198d6 100644 > --- a/arch/arm/boards/nxp-imx8mp-evk/lowlevel.c > +++ b/arch/arm/boards/nxp-imx8mp-evk/lowlevel.c > @@ -99,6 +99,30 @@ static int power_init_board(void) > return 0; > } > > +/* read piggydata via a bootrom callback and place it behind our copy in SDRAM */ > +static int imx8m_bootrom_load_image(void) > +{ > + int (*download_image)(u8 *dest, u32 offset, u32 size, u32 xor) = *(void **)0x988; > + size_t count = __piggydata_end - __piggydata_start; > + char *p = (char *)MX8M_ATF_BL33_BASE_ADDR + (__piggydata_start - __image_start); > + > + while (count) { > + size_t chunksize = min(count, (size_t)1024); > + int ret; > + > + ret = download_image(p, 0, chunksize, (uintptr_t)p ^ chunksize); > + if (ret != 0xf0) { > + pr_err("Failed to load piggy data (ret = %x)\n", ret); > + return -EIO; > + } > + > + p += chunksize; > + count -= chunksize; > + } > + > + return 0; > +} > + > extern struct dram_timing_info imx8mp_evk_dram_timing; > > static void start_atf(void) > @@ -125,6 +149,9 @@ static void start_atf(void) > case BOOTSOURCE_MMC: > imx8mp_esdhc_load_image(instance, false); > break; > + case BOOTSOURCE_SERIAL: > + imx8m_bootrom_load_image(); > + break; > default: > printf("Unhandled bootsource BOOTSOURCE_%d\n", src); > hang(); > diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c > index 2b66bbf71eb1..7c1d49291045 100644 > --- a/arch/arm/mach-imx/boot.c > +++ b/arch/arm/mach-imx/boot.c > @@ -495,10 +495,12 @@ static void __imx7_get_boot_source(enum bootsource *src, int *instance, > case 5: > *src = BOOTSOURCE_NOR; > break; > - case 15: > + case 14: /* observed on i.MX8MP for USB "serial" booting */ > + case 15: /* observed on i.MX8MM for USB "serial" booting */ > *src = BOOTSOURCE_SERIAL; > break; > default: > + *src = BOOTSOURCE_UNKNOWN; > break; > } > } > diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h > index 870bff21f668..597c4951ea5e 100644 > --- a/include/asm-generic/sections.h > +++ b/include/asm-generic/sections.h > @@ -9,6 +9,7 @@ extern char _end[]; > extern char __image_start[]; > extern char __image_end[]; > extern char __piggydata_start[]; > +extern char __piggydata_end[]; > extern void *_barebox_image_size; > extern void *_barebox_bare_init_size; > extern void *_barebox_pbl_size; > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-10-26 16:33 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-13 15:22 [PATCH v2 0/3] Support usb booting on i.MX8MP Uwe Kleine-König 2021-08-13 15:22 ` [PATCH v2 1/3] imx8mp-evk: Add support for booting via USB Uwe Kleine-König 2021-08-13 19:26 ` Ahmad Fatoum 2021-08-13 20:20 ` Lucas Stach 2021-08-13 20:48 ` Ahmad Fatoum 2021-10-26 16:30 ` Ahmad Fatoum [this message] 2021-08-13 15:22 ` [PATCH v2 2/3] imx-usb-loader: Drop nearly unused struct usb_id Uwe Kleine-König 2021-10-27 6:05 ` Ahmad Fatoum 2021-08-13 15:22 ` [PATCH v2 3/3] imx-usb-loader: Add support for i.MX8MP Uwe Kleine-König 2021-10-27 6:06 ` Ahmad Fatoum 2021-08-13 20:32 ` [PATCH v2 0/3] Support usb booting on i.MX8MP Lucas Stach 2021-10-13 19:33 ` Ahmad Fatoum
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=c9540fec-d9cb-66a6-db20-a6fc69151399@pengutronix.de \ --to=a.fatoum@pengutronix.de \ --cc=barebox@lists.infradead.org \ --cc=rcz@pengutronix.de \ --cc=u.kleine-koenig@pengutronix.de \ --subject='Re: [PATCH v2 1/3] imx8mp-evk: Add support for booting via USB' \ /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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox