Skip to contentSkip to conversation

spl: mmc: Add option to set eMMC HW boot partition

PATCH New Lukasz Majewski 5 participants 10 messages Sep 3, 2019 – Oct 12, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spl: mmc: Add option to set eMMC HW boot partition

From: Mans Rullgard <[email protected]>

This change allows setting pre-defined eMMC boot partition for SPL eMMC booting. It is necessary in the case when one wants to boot (through falcon boot) from eMMC after loading SPL from other memory (like SPI-NOR).

---

 common/spl/Kconfig   | 6 ++++++
 common/spl/spl_mmc.c | 4 ++++
 2 files changed, 10 insertions(+)
common/spl/Kconfig +6 -0
index f467eca2be..5b7667ea16 100644
@@ -314,6 +314,12 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
 	  Address on the MMC to load U-Boot from, when the MMC is being used
 	  in raw mode. Units: MMC sectors (1 sector = 512 bytes).
 
+config SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
+	int "Number of the eMMC boot partition to use"
+	default 1
+	help
+	  eMMC boot partition number to use when the eMMC in raw mode.
+
 config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
 	bool "MMC Raw mode: by partition"
 	help
common/spl/spl_mmc.c +4 -0
index 2caceb5186..a4d2e63b82 100644
@@ -334,6 +334,9 @@ int spl_mmc_load(struct spl_image_info *spl_image,
 	err = -EINVAL;
 	switch (boot_mode) {
 	case MMCSD_MODE_EMMCBOOT:
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
+		part = CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION;
+#else
 		/*
 		 * We need to check what the partition is configured to.
 		 * 1 and 2 match up to boot0 / boot1 and 7 is user data
@@ -343,6 +346,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
 
 		if (part == 7)
 			part = 0;
+#endif
 
 		if (CONFIG_IS_ENABLED(MMC_TINY))
 			err = mmc_switch_part(mmc, part);
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 spl: mmc: Add option to set eMMC HW boot partition

Quoted 10 lines · Lukasz Majewski

From: Mans Rullgard <[email protected]>

This change allows setting pre-defined eMMC boot partition for SPL eMMC booting. It is necessary in the case when one wants to boot (through falcon boot) from eMMC after loading SPL from other memory (like SPI-NOR).

Would it be better if this came from /chosen node in DT ?

#2 lore raw

PATCH 1/1 spl: mmc: Add option to set eMMC HW boot partition

Quoted 7 lines · Marek Vasut
Quoted 6 lines · Lukasz Majewski

From: Mans Rullgard <[email protected]>

This change allows setting pre-defined eMMC boot partition for SPL eMMC booting. It is necessary in the case when one wants to boot (through falcon boot) from eMMC after loading SPL from other memory (like SPI-NOR).

Quoted 6 lines
Quoted 4 lines

Would it be better if this came from /chosen node in DT ?

This patch was made for an imx28 based board. Fitting DT support into SPL on that chip won't be easy.

Signature · 1 line
Måns Rullgård
#3 lore raw

PATCH 1/1 spl: mmc: Add option to set eMMC HW boot partition

Hi MÃ¥ns, Marek,

Quoted 15 lines
Quoted 13 lines · Marek Vasut
Quoted 11 lines · Lukasz Majewski

From: Mans Rullgard <[email protected]>

This change allows setting pre-defined eMMC boot partition for SPL eMMC booting. It is necessary in the case when one wants to boot (through falcon boot) from eMMC after loading SPL from other memory (like SPI-NOR).

Quoted 4 lines
Quoted 1 line

Would it be better if this came from /chosen node in DT ?

This patch was made for an imx28 based board. Fitting DT support into SPL on that chip won't be easy.

Unfortunately, on purpose the DT support for SPL on this board is disabled.

This is the case where the only eligible option is to use OF_PLATDATA, to benefit from DM drivers, but also to keep the size as small as possible.

(Please refer to xea board support patches for more details).

Quoted 1 line

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190903/1a21d908/attachment.sig>

#4 lore raw

PATCH 1/1 spl: mmc: Add option to set eMMC HW boot partition

Quoted 22 lines · Lukasz Majewski

Hi MÃ¥ns, Marek,

Quoted 15 lines
Quoted 13 lines · Marek Vasut
Quoted 11 lines · Lukasz Majewski

From: Mans Rullgard <[email protected]>

This change allows setting pre-defined eMMC boot partition for SPL eMMC booting. It is necessary in the case when one wants to boot (through falcon boot) from eMMC after loading SPL from other memory (like SPI-NOR).

Quoted 4 lines
Quoted 1 line

Would it be better if this came from /chosen node in DT ?

This patch was made for an imx28 based board. Fitting DT support into SPL on that chip won't be easy.

Quoted 8 lines

Unfortunately, on purpose the DT support for SPL on this board is disabled.

This is the case where the only eligible option is to use OF_PLATDATA, to benefit from DM drivers, but also to keep the size as small as possible.

(Please refer to xea board support patches for more details).

Hm, then shall we use platdata ? I don't think that fits common code like this either.

#5 lore raw

PATCH 1/1 spl: mmc: Add option to set eMMC HW boot partition

Hi Marek,

Quoted 26 lines · Lukasz Majewski
Quoted 25 lines

Hi MÃ¥ns, Marek,

Quoted 15 lines
Quoted 13 lines · Marek Vasut
Quoted 11 lines · Lukasz Majewski

From: Mans Rullgard <[email protected]>

This change allows setting pre-defined eMMC boot partition for SPL eMMC booting. It is necessary in the case when one wants to boot (through falcon boot) from eMMC after loading SPL from other memory (like SPI-NOR).

Quoted 4 lines
Quoted 1 line

Would it be better if this came from /chosen node in DT ?

This patch was made for an imx28 based board. Fitting DT support into SPL on that chip won't be easy.

Unfortunately, on purpose the DT support for SPL on this board is disabled.

Quoted 7 lines
Quoted 5 lines

This is the case where the only eligible option is to use OF_PLATDATA, to benefit from DM drivers, but also to keep the size as small as possible.

(Please refer to xea board support patches for more details).

Hm, then shall we use platdata ?

Yes, correct. The OF_PLATDATA allows you to use DM/DTS converted driver with platform data encoded in the C structures.

For example such patch adds support for OF_PLATDATA to DM/DTS driver:
https://patchwork.ozlabs.org/patch/1148906/

Quoted 2 lines

I don't think that fits common code
like this either.

Please see above link.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190903/fa9297a0/attachment.sig>

#6 lore raw

PATCH 1/1 spl: mmc: Add option to set eMMC HW boot partition

In reply to Lukasz Majewski

Dear Tom,

Quoted 7 lines

From: Mans Rullgard <[email protected]>

This change allows setting pre-defined eMMC boot partition for SPL eMMC booting. It is necessary in the case when one wants to boot (through falcon boot) from eMMC after loading SPL from other memory (like SPI-NOR).

Quoted 5 lines

Tom, are there any issues preventing this patch from being applied to -master?

Quoted 40 lines

---

 common/spl/Kconfig   | 6 ++++++
 common/spl/spl_mmc.c | 4 ++++
 2 files changed, 10 insertions(+)
common/spl/Kconfig +0 -0
index f467eca2be..5b7667ea16 100644
@@ -314,6 +314,12 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
 	  Address on the MMC to load U-Boot from, when the MMC is

being used in raw mode. Units: MMC sectors (1 sector = 512 bytes).

common/spl/Kconfig +5 -0
+config SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
+	int "Number of the eMMC boot partition to use"
+	default 1
+	help
+	  eMMC boot partition number to use when the eMMC in raw

mode. +
config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION

common/spl/Kconfig +0 -0
 	bool "MMC Raw mode: by partition"
 	help
common/spl/spl_mmc.c +3 -0
index 2caceb5186..a4d2e63b82 100644
@@ -334,6 +334,9 @@ int spl_mmc_load(struct spl_image_info *spl_image,
 	err = -EINVAL;
 	switch (boot_mode) {
 	case MMCSD_MODE_EMMCBOOT:
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
+		part = CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION;
+#else
 		/*
 		 * We need to check what the partition is configured

to.
* 1 and 2 match up to boot0 / boot1 and 7 is user
data @@ -343,6 +346,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,

common/spl/spl_mmc.c int spl_mmc_load(struct spl_image_info *spl_image, · line 352

Quoted 6 lines
common/spl/spl_mmc.c +1 -0
 		if (part == 7)
 			part = 0;
+#endif
 
 		if (CONFIG_IS_ENABLED(MMC_TINY))
 			err = mmc_switch_part(mmc, part);

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191009/4813b409/attachment.sig>

#7 lore raw

PATCH 1/1 spl: mmc: Add option to set eMMC HW boot partition

Quoted 9 lines · Lukasz Majewski

Dear Tom,

Quoted 7 lines

From: Mans Rullgard <[email protected]>

This change allows setting pre-defined eMMC boot partition for SPL eMMC booting. It is necessary in the case when one wants to boot (through falcon boot) from eMMC after loading SPL from other memory (like SPI-NOR).

Quoted 8 lines
Quoted 5 lines

Tom, are there any issues preventing this patch from being applied to -master?

Keeping in mind that we do need to allow for SPL to do reasonable things to retain a smaller footprint, this is fine. If Peng doesn't pick it up as an MMC change I'll get it soon.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191010/be60964d/attachment.sig>
#8 lore raw

PATCH 1/1 spl: mmc: Add option to set eMMC HW boot partition

Hi Tom,

Quoted 18 lines

Subject: Re: [PATCH] spl: mmc: Add option to set eMMC HW boot partition

Quoted 15 lines · Lukasz Majewski

Dear Tom,

Quoted 12 lines

From: Mans Rullgard <[email protected]>

This change allows setting pre-defined eMMC boot partition for SPL eMMC booting. It is necessary in the case when one wants to boot (through falcon boot) from eMMC after loading SPL from other memory (like SPI-NOR).

Quoted 6 lines
Quoted 2 lines

Tom, are there any issues preventing this patch from being applied to -master?

Keeping in mind that we do need to allow for SPL to do reasonable things to retain a smaller footprint, this is fine. If Peng doesn't pick it up as an MMC change I'll get it soon.

It not in my patchwork list, so I not pick it. Please directly pick it up since it is ok to you.

Thanks,
Peng.

Quoted 3 lines

--
Tom

#9 lore raw

PATCH 1/1 spl: mmc: Add option to set eMMC HW boot partition

In reply to Lukasz Majewski
Quoted 10 lines · Lukasz Majewski

From: Mans Rullgard <[email protected]>

This change allows setting pre-defined eMMC boot partition for SPL eMMC booting. It is necessary in the case when one wants to boot (through falcon boot) from eMMC after loading SPL from other memory (like SPI-NOR).

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/c627b42d/attachment.sig>