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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx> 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 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux