diff mbox series

[v1,07/11] rockchip: rk3568: add boot device detection

Message ID 20220222013131.3114990-8-pgwipeout@gmail.com
State Changes Requested
Delegated to: Kever Yang
Headers show
Series rockchip fixes and extend rk3568 support | expand

Commit Message

Peter Geis Feb. 22, 2022, 1:31 a.m. UTC
Enable rk3568 spl to detect which device it was booted from.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---
 arch/arm/mach-rockchip/rk3568/rk3568.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Simon Glass March 12, 2022, 2:24 a.m. UTC | #1
Hi Peter,

On Mon, 21 Feb 2022 at 18:31, Peter Geis <pgwipeout@gmail.com> wrote:
>
> Enable rk3568 spl to detect which device it was booted from.
>
> Signed-off-by: Peter Geis <pgwipeout@gmail.com>
> ---
>  arch/arm/mach-rockchip/rk3568/rk3568.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

I think a better way would be to put an option in the U-Boot config node, like:

boot-devices = <&sdhci_0 &spi_flash &sd>;

> diff --git a/arch/arm/mach-rockchip/rk3568/rk3568.c b/arch/arm/mach-rockchip/rk3568/rk3568.c
> index 4e23feb9417f..5f239d89a7a9 100644
> --- a/arch/arm/mach-rockchip/rk3568/rk3568.c
> +++ b/arch/arm/mach-rockchip/rk3568/rk3568.c
> @@ -7,6 +7,7 @@
>  #include <dm.h>
>  #include <asm/armv8/mmu.h>
>  #include <asm/io.h>
> +#include <asm/arch-rockchip/bootrom.h>
>  #include <asm/arch-rockchip/grf_rk3568.h>
>  #include <asm/arch-rockchip/hardware.h>
>  #include <dt-bindings/clock/rk3568-cru.h>
> @@ -23,6 +24,7 @@
>  #define SGRF_SOC_CON4                  0x10
>  #define EMMC_HPROT_SECURE_CTRL         0x03
>  #define SDMMC0_HPROT_SECURE_CTRL       0x01
> +
>  /* PMU_GRF_GPIO0D_IOMUX_L */
>  enum {
>         GPIO0D1_SHIFT           = 4,
> @@ -43,6 +45,12 @@ enum {
>         UART2_IO_SEL_M0         = 0,
>  };
>
> +const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
> +       [BROM_BOOTSOURCE_EMMC] = "/sdhci@fe310000",
> +       [BROM_BOOTSOURCE_SPINOR] = "/spi@fe300000/flash@0",
> +       [BROM_BOOTSOURCE_SD] = "/mmc@fe2b0000",
> +};
> +
>  static struct mm_region rk3568_mem_map[] = {
>         {
>                 .virt = 0x0UL,
> --
> 2.25.1
>

Regards,
Simon
Peter Geis March 12, 2022, 3:34 a.m. UTC | #2
On Fri, Mar 11, 2022 at 9:25 PM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Peter,
>
> On Mon, 21 Feb 2022 at 18:31, Peter Geis <pgwipeout@gmail.com> wrote:
> >
> > Enable rk3568 spl to detect which device it was booted from.
> >
> > Signed-off-by: Peter Geis <pgwipeout@gmail.com>
> > ---
> >  arch/arm/mach-rockchip/rk3568/rk3568.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> I think a better way would be to put an option in the U-Boot config node, like:
>
> boot-devices = <&sdhci_0 &spi_flash &sd>;

This would certainly solve the problem of needing to constantly update
the boot devices each time a dts sync occurs.
I'm still learning my way around u-boot's method of handling
device-trees vs linux's method.

>
> > diff --git a/arch/arm/mach-rockchip/rk3568/rk3568.c b/arch/arm/mach-rockchip/rk3568/rk3568.c
> > index 4e23feb9417f..5f239d89a7a9 100644
> > --- a/arch/arm/mach-rockchip/rk3568/rk3568.c
> > +++ b/arch/arm/mach-rockchip/rk3568/rk3568.c
> > @@ -7,6 +7,7 @@
> >  #include <dm.h>
> >  #include <asm/armv8/mmu.h>
> >  #include <asm/io.h>
> > +#include <asm/arch-rockchip/bootrom.h>
> >  #include <asm/arch-rockchip/grf_rk3568.h>
> >  #include <asm/arch-rockchip/hardware.h>
> >  #include <dt-bindings/clock/rk3568-cru.h>
> > @@ -23,6 +24,7 @@
> >  #define SGRF_SOC_CON4                  0x10
> >  #define EMMC_HPROT_SECURE_CTRL         0x03
> >  #define SDMMC0_HPROT_SECURE_CTRL       0x01
> > +
> >  /* PMU_GRF_GPIO0D_IOMUX_L */
> >  enum {
> >         GPIO0D1_SHIFT           = 4,
> > @@ -43,6 +45,12 @@ enum {
> >         UART2_IO_SEL_M0         = 0,
> >  };
> >
> > +const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
> > +       [BROM_BOOTSOURCE_EMMC] = "/sdhci@fe310000",
> > +       [BROM_BOOTSOURCE_SPINOR] = "/spi@fe300000/flash@0",
> > +       [BROM_BOOTSOURCE_SD] = "/mmc@fe2b0000",
> > +};
> > +
> >  static struct mm_region rk3568_mem_map[] = {
> >         {
> >                 .virt = 0x0UL,
> > --
> > 2.25.1
> >
>
> Regards,
> Simon
diff mbox series

Patch

diff --git a/arch/arm/mach-rockchip/rk3568/rk3568.c b/arch/arm/mach-rockchip/rk3568/rk3568.c
index 4e23feb9417f..5f239d89a7a9 100644
--- a/arch/arm/mach-rockchip/rk3568/rk3568.c
+++ b/arch/arm/mach-rockchip/rk3568/rk3568.c
@@ -7,6 +7,7 @@ 
 #include <dm.h>
 #include <asm/armv8/mmu.h>
 #include <asm/io.h>
+#include <asm/arch-rockchip/bootrom.h>
 #include <asm/arch-rockchip/grf_rk3568.h>
 #include <asm/arch-rockchip/hardware.h>
 #include <dt-bindings/clock/rk3568-cru.h>
@@ -23,6 +24,7 @@ 
 #define SGRF_SOC_CON4			0x10
 #define EMMC_HPROT_SECURE_CTRL		0x03
 #define SDMMC0_HPROT_SECURE_CTRL	0x01
+
 /* PMU_GRF_GPIO0D_IOMUX_L */
 enum {
 	GPIO0D1_SHIFT		= 4,
@@ -43,6 +45,12 @@  enum {
 	UART2_IO_SEL_M0		= 0,
 };
 
+const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
+	[BROM_BOOTSOURCE_EMMC] = "/sdhci@fe310000",
+	[BROM_BOOTSOURCE_SPINOR] = "/spi@fe300000/flash@0",
+	[BROM_BOOTSOURCE_SD] = "/mmc@fe2b0000",
+};
+
 static struct mm_region rk3568_mem_map[] = {
 	{
 		.virt = 0x0UL,