All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: zynqmp: Handle MMC seq number based on boot device
@ 2021-05-31  7:51 Michal Simek
  2021-06-10  7:24 ` Michal Simek
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Simek @ 2021-05-31  7:51 UTC (permalink / raw)
  To: u-boot, git

K26 has EMMC and SD and default 0 is not working when system is booting out
of SD which is controller 1. Add controller autodetection via
mmc_get_env_dev(). The same code is used for distro_boot selection done in
board_late_init(). bootseq variable can't be reused because this is called
so late.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 board/xilinx/zynqmp/zynqmp.c         | 35 ++++++++++++++++++++++++++++
 configs/xilinx_zynqmp_virt_defconfig |  1 +
 2 files changed, 36 insertions(+)

diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 6e353e3b0a57..46dee80470fa 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -709,6 +709,41 @@ int checkboard(void)
 	return 0;
 }
 
+int mmc_get_env_dev(void)
+{
+	struct udevice *dev;
+	int bootseq = 0;
+
+	switch (zynqmp_get_bootmode()) {
+	case EMMC_MODE:
+	case SD_MODE:
+		if (uclass_get_device_by_name(UCLASS_MMC,
+					      "mmc@ff160000", &dev) &&
+		    uclass_get_device_by_name(UCLASS_MMC,
+					      "sdhci@ff160000", &dev)) {
+			return -1;
+		}
+		bootseq = dev_seq(dev);
+		break;
+	case SD1_LSHFT_MODE:
+	case SD_MODE1:
+		if (uclass_get_device_by_name(UCLASS_MMC,
+					      "mmc@ff170000", &dev) &&
+		    uclass_get_device_by_name(UCLASS_MMC,
+					      "sdhci@ff170000", &dev)) {
+			return -1;
+		}
+		bootseq = dev_seq(dev);
+		break;
+	default:
+		break;
+	}
+
+	debug("bootseq %d\n", bootseq);
+
+	return bootseq;
+}
+
 enum env_location env_get_location(enum env_operation op, int prio)
 {
 	u32 bootmode = zynqmp_get_bootmode();
diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig
index ece527e07468..1df0ef66c22c 100644
--- a/configs/xilinx_zynqmp_virt_defconfig
+++ b/configs/xilinx_zynqmp_virt_defconfig
@@ -76,6 +76,7 @@ CONFIG_ENV_IS_IN_FAT=y
 CONFIG_ENV_IS_IN_NAND=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
+CONFIG_ENV_FAT_DEVICE_AND_PART=":auto"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_NETCONSOLE=y
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm64: zynqmp: Handle MMC seq number based on boot device
  2021-05-31  7:51 [PATCH] arm64: zynqmp: Handle MMC seq number based on boot device Michal Simek
@ 2021-06-10  7:24 ` Michal Simek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2021-06-10  7:24 UTC (permalink / raw)
  To: U-Boot, git

po 31. 5. 2021 v 9:52 odesílatel Michal Simek <michal.simek@xilinx.com> napsal:
>
> K26 has EMMC and SD and default 0 is not working when system is booting out
> of SD which is controller 1. Add controller autodetection via
> mmc_get_env_dev(). The same code is used for distro_boot selection done in
> board_late_init(). bootseq variable can't be reused because this is called
> so late.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  board/xilinx/zynqmp/zynqmp.c         | 35 ++++++++++++++++++++++++++++
>  configs/xilinx_zynqmp_virt_defconfig |  1 +
>  2 files changed, 36 insertions(+)
>
> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
> index 6e353e3b0a57..46dee80470fa 100644
> --- a/board/xilinx/zynqmp/zynqmp.c
> +++ b/board/xilinx/zynqmp/zynqmp.c
> @@ -709,6 +709,41 @@ int checkboard(void)
>         return 0;
>  }
>
> +int mmc_get_env_dev(void)
> +{
> +       struct udevice *dev;
> +       int bootseq = 0;
> +
> +       switch (zynqmp_get_bootmode()) {
> +       case EMMC_MODE:
> +       case SD_MODE:
> +               if (uclass_get_device_by_name(UCLASS_MMC,
> +                                             "mmc@ff160000", &dev) &&
> +                   uclass_get_device_by_name(UCLASS_MMC,
> +                                             "sdhci@ff160000", &dev)) {
> +                       return -1;
> +               }
> +               bootseq = dev_seq(dev);
> +               break;
> +       case SD1_LSHFT_MODE:
> +       case SD_MODE1:
> +               if (uclass_get_device_by_name(UCLASS_MMC,
> +                                             "mmc@ff170000", &dev) &&
> +                   uclass_get_device_by_name(UCLASS_MMC,
> +                                             "sdhci@ff170000", &dev)) {
> +                       return -1;
> +               }
> +               bootseq = dev_seq(dev);
> +               break;
> +       default:
> +               break;
> +       }
> +
> +       debug("bootseq %d\n", bootseq);
> +
> +       return bootseq;
> +}
> +
>  enum env_location env_get_location(enum env_operation op, int prio)
>  {
>         u32 bootmode = zynqmp_get_bootmode();
> diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig
> index ece527e07468..1df0ef66c22c 100644
> --- a/configs/xilinx_zynqmp_virt_defconfig
> +++ b/configs/xilinx_zynqmp_virt_defconfig
> @@ -76,6 +76,7 @@ CONFIG_ENV_IS_IN_FAT=y
>  CONFIG_ENV_IS_IN_NAND=y
>  CONFIG_ENV_IS_IN_SPI_FLASH=y
>  CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
> +CONFIG_ENV_FAT_DEVICE_AND_PART=":auto"
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>  CONFIG_NET_RANDOM_ETHADDR=y
>  CONFIG_NETCONSOLE=y
> --
> 2.31.1
>

Applied.
M

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-10  7:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31  7:51 [PATCH] arm64: zynqmp: Handle MMC seq number based on boot device Michal Simek
2021-06-10  7:24 ` Michal Simek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.