* [PATCH 1/2] spl: socfpga: Getting SPL boot device from DT
@ 2022-09-16 14:23 Jit Loon Lim
2022-09-16 14:23 ` [PATCH 2/2] arm: spl: create a common spl for Stratix10 and Agilex Jit Loon Lim
2022-09-16 14:31 ` [PATCH 1/2] spl: socfpga: Getting SPL boot device from DT Quentin Schulz
0 siblings, 2 replies; 3+ messages in thread
From: Jit Loon Lim @ 2022-09-16 14:23 UTC (permalink / raw)
To: u-boot
Cc: Jagan Teki, Vignesh R, Marek, Simon, Tien Fong, Kok Kiang,
Siew Chin, Sin Hui, Raaj, Dinesh, Boon Khai, Alif, Teik Heng,
Hazim, Jit Loon Lim, Sieu Mun Tang
From: Tien Fong Chee <tien.fong.chee@intel.com>
Current SPL boot device is harcoded with MMC1, this implementation
would inhibit the support of other boot device. So, this patch is
created to get the boot device from DT, user should define the boot
device in property "u-boot,boot0". Default MMC1 would be boot device if
no boot device is defined in DT.
Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
Signed-off-by: Jit Loon Lim <jit.loon.lim@intel.com>
---
arch/arm/dts/socfpga_stratix10_socdk.dts | 1 +
arch/arm/mach-socfpga/spl_s10.c | 65 ++++++++++++++++++++++++
2 files changed, 66 insertions(+)
diff --git a/arch/arm/dts/socfpga_stratix10_socdk.dts b/arch/arm/dts/socfpga_stratix10_socdk.dts
index 8aa55a60ab..c8e9261f48 100755
--- a/arch/arm/dts/socfpga_stratix10_socdk.dts
+++ b/arch/arm/dts/socfpga_stratix10_socdk.dts
@@ -16,6 +16,7 @@
chosen {
stdout-path = "serial0:115200n8";
+ u-boot,boot0 = <&mmc>;
};
leds {
diff --git a/arch/arm/mach-socfpga/spl_s10.c b/arch/arm/mach-socfpga/spl_s10.c
index dad2ac5d0d..c4b82ebf14 100644
--- a/arch/arm/mach-socfpga/spl_s10.c
+++ b/arch/arm/mach-socfpga/spl_s10.c
@@ -13,6 +13,8 @@
#include <asm/utils.h>
#include <common.h>
#include <debug_uart.h>
+#include <dm.h>
+#include <dm/ofnode.h>
#include <image.h>
#include <spl.h>
#include <asm/arch/clock_manager.h>
@@ -27,6 +29,69 @@
DECLARE_GLOBAL_DATA_PTR;
+u32 spl_boot_device(void)
+{
+ int ret, size;
+ ofnode node;
+ const fdt32_t *phandle_p;
+ u32 phandle;
+ struct udevice *dev;
+
+ node = ofnode_path("/chosen");
+ if (!ofnode_valid(node)) {
+ debug("%s: /chosen node was not found.\n", __func__);
+ goto fallback;
+ }
+
+ phandle_p = ofnode_get_property(node, "u-boot,boot0", &size);
+ if (!phandle_p) {
+ debug("%s: u-boot,boot0 property was not found.\n",
+ __func__);
+ goto fallback;
+ }
+
+ phandle = fdt32_to_cpu(*phandle_p);
+
+ node = ofnode_get_by_phandle(phandle);
+
+ ret = device_get_global_by_ofnode(node, &dev);
+ if (ret) {
+ debug("%s: Boot device at not found, error: %d\n", __func__,
+ ret);
+ goto fallback;
+ }
+
+ debug("%s: Found boot device %s\n", __func__, dev->name);
+
+ switch (device_get_uclass_id(dev)) {
+ case UCLASS_SPI_FLASH:
+ return BOOT_DEVICE_SPI;
+ case UCLASS_MISC:
+ return BOOT_DEVICE_NAND;
+ case UCLASS_MMC:
+ return BOOT_DEVICE_MMC1;
+ default:
+ debug("%s: Booting from device uclass '%s' is not "
+ "supported\n", __func__,
+ dev_get_uclass_name(dev));
+ }
+
+fallback:
+ /* Return default boot device */
+ return BOOT_DEVICE_MMC1;
+}
+
+#ifdef CONFIG_SPL_MMC_SUPPORT
+u32 spl_mmc_boot_mode(const u32 boot_device)
+{
+#if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4)
+ return MMCSD_MODE_FS;
+#else
+ return MMCSD_MODE_RAW;
+#endif
+}
+#endif
+
void board_init_f(ulong dummy)
{
const struct cm_config *cm_default_cfg = cm_get_default_config();
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] arm: spl: create a common spl for Stratix10 and Agilex
2022-09-16 14:23 [PATCH 1/2] spl: socfpga: Getting SPL boot device from DT Jit Loon Lim
@ 2022-09-16 14:23 ` Jit Loon Lim
2022-09-16 14:31 ` [PATCH 1/2] spl: socfpga: Getting SPL boot device from DT Quentin Schulz
1 sibling, 0 replies; 3+ messages in thread
From: Jit Loon Lim @ 2022-09-16 14:23 UTC (permalink / raw)
To: u-boot
Cc: Jagan Teki, Vignesh R, Marek, Simon, Tien Fong, Kok Kiang,
Siew Chin, Sin Hui, Raaj, Dinesh, Boon Khai, Alif, Teik Heng,
Hazim, Jit Loon Lim, Sieu Mun Tang, Ooi, Joyce, Ooi
From: "Ooi, Joyce" <joyce.ooi@intel.com>
Since Stratix10 and Agilex are using ARM64, there are some common codes
in the SPL. Hence, spl_soc64.c is created to place the common codes.
Signed-off-by: Ooi, Joyce <joyce.ooi@intel.com>
Signed-off-by: Jit Loon Lim <jit.loon.lim@intel.com>
---
arch/arm/mach-socfpga/spl_s10.c | 63 ---------------------------
arch/arm/mach-socfpga/spl_soc64.c | 71 +++++++++++++++++++++++++++++--
2 files changed, 67 insertions(+), 67 deletions(-)
diff --git a/arch/arm/mach-socfpga/spl_s10.c b/arch/arm/mach-socfpga/spl_s10.c
index c4b82ebf14..fb807acf27 100644
--- a/arch/arm/mach-socfpga/spl_s10.c
+++ b/arch/arm/mach-socfpga/spl_s10.c
@@ -29,69 +29,6 @@
DECLARE_GLOBAL_DATA_PTR;
-u32 spl_boot_device(void)
-{
- int ret, size;
- ofnode node;
- const fdt32_t *phandle_p;
- u32 phandle;
- struct udevice *dev;
-
- node = ofnode_path("/chosen");
- if (!ofnode_valid(node)) {
- debug("%s: /chosen node was not found.\n", __func__);
- goto fallback;
- }
-
- phandle_p = ofnode_get_property(node, "u-boot,boot0", &size);
- if (!phandle_p) {
- debug("%s: u-boot,boot0 property was not found.\n",
- __func__);
- goto fallback;
- }
-
- phandle = fdt32_to_cpu(*phandle_p);
-
- node = ofnode_get_by_phandle(phandle);
-
- ret = device_get_global_by_ofnode(node, &dev);
- if (ret) {
- debug("%s: Boot device at not found, error: %d\n", __func__,
- ret);
- goto fallback;
- }
-
- debug("%s: Found boot device %s\n", __func__, dev->name);
-
- switch (device_get_uclass_id(dev)) {
- case UCLASS_SPI_FLASH:
- return BOOT_DEVICE_SPI;
- case UCLASS_MISC:
- return BOOT_DEVICE_NAND;
- case UCLASS_MMC:
- return BOOT_DEVICE_MMC1;
- default:
- debug("%s: Booting from device uclass '%s' is not "
- "supported\n", __func__,
- dev_get_uclass_name(dev));
- }
-
-fallback:
- /* Return default boot device */
- return BOOT_DEVICE_MMC1;
-}
-
-#ifdef CONFIG_SPL_MMC_SUPPORT
-u32 spl_mmc_boot_mode(const u32 boot_device)
-{
-#if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4)
- return MMCSD_MODE_FS;
-#else
- return MMCSD_MODE_RAW;
-#endif
-}
-#endif
-
void board_init_f(ulong dummy)
{
const struct cm_config *cm_default_cfg = cm_get_default_config();
diff --git a/arch/arm/mach-socfpga/spl_soc64.c b/arch/arm/mach-socfpga/spl_soc64.c
index ba6efc1d86..ea1acaf309 100644
--- a/arch/arm/mach-socfpga/spl_soc64.c
+++ b/arch/arm/mach-socfpga/spl_soc64.c
@@ -4,22 +4,85 @@
*
*/
+#include <asm/io.h>
+#include <asm/u-boot.h>
+#include <asm/utils.h>
#include <common.h>
+#include <debug_uart.h>
+#include <dm.h>
+#include <dm/ofnode.h>
+#include <image.h>
+#include <log.h>
#include <spl.h>
+#include <asm/arch/clock_manager.h>
+#include <asm/arch/firewall.h>
+#include <asm/arch/mailbox_s10.h>
+#include <asm/arch/reset_manager.h>
+#include <asm/arch/system_manager.h>
+#include <asm/arch/smmu_s10.h>
+#include <watchdog.h>
+#include <dm/uclass.h>
DECLARE_GLOBAL_DATA_PTR;
u32 spl_boot_device(void)
{
+ int ret, size;
+ ofnode node;
+ const fdt32_t *phandle_p;
+ u32 phandle;
+ struct udevice *dev;
+
+ node = ofnode_path("/chosen");
+ if (!ofnode_valid(node)) {
+ debug("%s: /chosen node was not found.\n", __func__);
+ goto fallback;
+ }
+
+ phandle_p = ofnode_get_property(node, "u-boot,boot0", &size);
+ if (!phandle_p) {
+ debug("%s: u-boot,boot0 property was not found.\n",
+ __func__);
+ goto fallback;
+ }
+
+ phandle = fdt32_to_cpu(*phandle_p);
+
+ node = ofnode_get_by_phandle(phandle);
+
+ ret = device_get_global_by_ofnode(node, &dev);
+ if (ret) {
+ debug("%s: Boot device at not found, error: %d\n", __func__,
+ ret);
+ goto fallback;
+ }
+
+ debug("%s: Found boot device %s\n", __func__, dev->name);
+
+ switch (device_get_uclass_id(dev)) {
+ case UCLASS_SPI_FLASH:
+ return BOOT_DEVICE_SPI;
+ case UCLASS_MISC:
+ return BOOT_DEVICE_NAND;
+ case UCLASS_MMC:
+ return BOOT_DEVICE_MMC1;
+ default:
+ debug("%s: Booting from device uclass '%s' is not supported\n",
+ __func__, dev_get_uclass_name(dev));
+ }
+
+fallback:
+ /* Return default boot device */
return BOOT_DEVICE_MMC1;
}
#if IS_ENABLED(CONFIG_SPL_MMC)
u32 spl_boot_mode(const u32 boot_device)
{
- if (IS_ENABLED(CONFIG_SPL_FS_FAT) || IS_ENABLED(CONFIG_SPL_FS_EXT4))
- return MMCSD_MODE_FS;
- else
- return MMCSD_MODE_RAW;
+#if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4)
+ return MMCSD_MODE_FS;
+#else
+ return MMCSD_MODE_RAW;
+#endif
}
#endif
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] spl: socfpga: Getting SPL boot device from DT
2022-09-16 14:23 [PATCH 1/2] spl: socfpga: Getting SPL boot device from DT Jit Loon Lim
2022-09-16 14:23 ` [PATCH 2/2] arm: spl: create a common spl for Stratix10 and Agilex Jit Loon Lim
@ 2022-09-16 14:31 ` Quentin Schulz
1 sibling, 0 replies; 3+ messages in thread
From: Quentin Schulz @ 2022-09-16 14:31 UTC (permalink / raw)
To: Jit Loon Lim, u-boot
Cc: Jagan Teki, Vignesh R, Marek, Simon, Tien Fong, Kok Kiang,
Siew Chin, Sin Hui, Raaj, Dinesh, Boon Khai, Alif, Teik Heng,
Hazim, Sieu Mun Tang
Hi Jit Loon Lim,
On 9/16/22 16:23, Jit Loon Lim wrote:
> From: Tien Fong Chee <tien.fong.chee@intel.com>
>
> Current SPL boot device is harcoded with MMC1, this implementation
> would inhibit the support of other boot device. So, this patch is
> created to get the boot device from DT, user should define the boot
> device in property "u-boot,boot0". Default MMC1 would be boot device if
Isn't u-boot,spl-boot-order DT property what you're after? We use this
property to specify the order in which the listed media will be tried
for loading U-Boot proper from the SPL. Is this what you're trying to do
with u-boot,boot0 ? (you'll still need to implement the same logic I'm
just arguing about the name that was picked for the property).
Cheers,
Quentin
> no boot device is defined in DT.
>
> Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
> Signed-off-by: Jit Loon Lim <jit.loon.lim@intel.com>
> ---
> arch/arm/dts/socfpga_stratix10_socdk.dts | 1 +
> arch/arm/mach-socfpga/spl_s10.c | 65 ++++++++++++++++++++++++
> 2 files changed, 66 insertions(+)
>
> diff --git a/arch/arm/dts/socfpga_stratix10_socdk.dts b/arch/arm/dts/socfpga_stratix10_socdk.dts
> index 8aa55a60ab..c8e9261f48 100755
> --- a/arch/arm/dts/socfpga_stratix10_socdk.dts
> +++ b/arch/arm/dts/socfpga_stratix10_socdk.dts
> @@ -16,6 +16,7 @@
>
> chosen {
> stdout-path = "serial0:115200n8";
> + u-boot,boot0 = <&mmc>;
> };
>
> leds {
> diff --git a/arch/arm/mach-socfpga/spl_s10.c b/arch/arm/mach-socfpga/spl_s10.c
> index dad2ac5d0d..c4b82ebf14 100644
> --- a/arch/arm/mach-socfpga/spl_s10.c
> +++ b/arch/arm/mach-socfpga/spl_s10.c
> @@ -13,6 +13,8 @@
> #include <asm/utils.h>
> #include <common.h>
> #include <debug_uart.h>
> +#include <dm.h>
> +#include <dm/ofnode.h>
> #include <image.h>
> #include <spl.h>
> #include <asm/arch/clock_manager.h>
> @@ -27,6 +29,69 @@
>
> DECLARE_GLOBAL_DATA_PTR;
>
> +u32 spl_boot_device(void)
> +{
> + int ret, size;
> + ofnode node;
> + const fdt32_t *phandle_p;
> + u32 phandle;
> + struct udevice *dev;
> +
> + node = ofnode_path("/chosen");
> + if (!ofnode_valid(node)) {
> + debug("%s: /chosen node was not found.\n", __func__);
> + goto fallback;
> + }
> +
> + phandle_p = ofnode_get_property(node, "u-boot,boot0", &size);
> + if (!phandle_p) {
> + debug("%s: u-boot,boot0 property was not found.\n",
> + __func__);
> + goto fallback;
> + }
> +
> + phandle = fdt32_to_cpu(*phandle_p);
> +
> + node = ofnode_get_by_phandle(phandle);
> +
> + ret = device_get_global_by_ofnode(node, &dev);
> + if (ret) {
> + debug("%s: Boot device at not found, error: %d\n", __func__,
> + ret);
> + goto fallback;
> + }
> +
> + debug("%s: Found boot device %s\n", __func__, dev->name);
> +
> + switch (device_get_uclass_id(dev)) {
> + case UCLASS_SPI_FLASH:
> + return BOOT_DEVICE_SPI;
> + case UCLASS_MISC:
> + return BOOT_DEVICE_NAND;
> + case UCLASS_MMC:
> + return BOOT_DEVICE_MMC1;
> + default:
> + debug("%s: Booting from device uclass '%s' is not "
> + "supported\n", __func__,
> + dev_get_uclass_name(dev));
> + }
> +
> +fallback:
> + /* Return default boot device */
> + return BOOT_DEVICE_MMC1;
> +}
> +
> +#ifdef CONFIG_SPL_MMC_SUPPORT
> +u32 spl_mmc_boot_mode(const u32 boot_device)
> +{
> +#if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4)
> + return MMCSD_MODE_FS;
> +#else
> + return MMCSD_MODE_RAW;
> +#endif
> +}
> +#endif
> +
> void board_init_f(ulong dummy)
> {
> const struct cm_config *cm_default_cfg = cm_get_default_config();
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-16 14:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-16 14:23 [PATCH 1/2] spl: socfpga: Getting SPL boot device from DT Jit Loon Lim
2022-09-16 14:23 ` [PATCH 2/2] arm: spl: create a common spl for Stratix10 and Agilex Jit Loon Lim
2022-09-16 14:31 ` [PATCH 1/2] spl: socfpga: Getting SPL boot device from DT Quentin Schulz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox