[PATCH 7/9] ARM: rk3568: Detect USB boot
Sascha Hauer
s.hauer at pengutronix.de
Tue Oct 12 00:15:34 PDT 2021
On Mon, Oct 11, 2021 at 10:53:07AM -0700, Trent Piepho wrote:
> On Mon, Oct 11, 2021 at 1:04 AM Sascha Hauer <s.hauer at pengutronix.de> wrote:
> > @@ -151,6 +151,11 @@ static struct rk_bootsource bootdev_map[] = {
> > { .src = BOOTSOURCE_SPI_NOR, .instance = 0 },
> > { .src = BOOTSOURCE_SPI_NAND, .instance = 0 },
> > { .src = BOOTSOURCE_MMC, .instance = 1 },
> > + { .src = BOOTSOURCE_UNKNOWN, .instance = 0 },
> > + { .src = BOOTSOURCE_UNKNOWN, .instance = 0 },
> > + { .src = BOOTSOURCE_UNKNOWN, .instance = 0 },
> > + { .src = BOOTSOURCE_UNKNOWN, .instance = 0 },
> > + { .src = BOOTSOURCE_USB, .instance = 0 },
> > };
>
> Instead of blank entries, one could do designated array initialization
> (since BOOTSOURCE_UNKNOWN is 0):
>
> static struct rk_bootsource bootdev_map[] = {
> [0x01] = { .src = BOOTSOURCE_NAND, .instance = 0 },
> [0x02] = { .src = BOOTSOURCE_MMC, .instance = 0 },
> [0x03] = { .src = BOOTSOURCE_SPI_NOR, .instance = 0 },
> [0x04] = { .src = BOOTSOURCE_SPI_NAND, .instance = 0 },
> [0x05] = { .src = BOOTSOURCE_MMC, .instance = 1 },
> [0x0a] = { .src = BOOTSOURCE_USB, .instance = 0 },
> };
>
> I also like the way the register value shows up in the table.
Apart from the implicit assumption that BOOTSOURCE_UNKNOWN is 0 your
approach is all better. Changed it like that.
Sascha
--
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 |
More information about the barebox
mailing list