[PATCH 7/9] ARM: rk3568: Detect USB boot

Trent Piepho trent.piepho at igorinstitute.com
Mon Oct 11 10:53:07 PDT 2021


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.



More information about the barebox mailing list