Skip to contentSkip to conversation

spl: mmc: Fix indentation in spl_mmc.c file

PATCH New Lukasz Majewski 2 participants 4 messages Aug 19, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 spl: mmc: Fix indentation in spl_mmc.c file

From: Mans Rullgard <[email protected]>

This fixes a wrongly indented block of code.

[lukma: Make the commit message more verbose]

---

Changes in v2: None

 common/spl/spl_mmc.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
common/spl/spl_mmc.c +20 -20
index b3619889f7..2caceb5186 100644
@@ -334,28 +334,28 @@ int spl_mmc_load(struct spl_image_info *spl_image,
 	err = -EINVAL;
 	switch (boot_mode) {
 	case MMCSD_MODE_EMMCBOOT:
-			/*
-			 * We need to check what the partition is configured to.
-			 * 1 and 2 match up to boot0 / boot1 and 7 is user data
-			 * which is the first physical partition (0).
-			 */
-			part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
-
-			if (part == 7)
-				part = 0;
-
-			if (CONFIG_IS_ENABLED(MMC_TINY))
-				err = mmc_switch_part(mmc, part);
-			else
-				err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
-
-			if (err) {
+		/*
+		 * We need to check what the partition is configured to.
+		 * 1 and 2 match up to boot0 / boot1 and 7 is user data
+		 * which is the first physical partition (0).
+		 */
+		part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
+
+		if (part == 7)
+			part = 0;
+
+		if (CONFIG_IS_ENABLED(MMC_TINY))
+			err = mmc_switch_part(mmc, part);
+		else
+			err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
+
+		if (err) {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
-				puts("spl: mmc partition switch failed\n");
+			puts("spl: mmc partition switch failed\n");
 #endif
-				return err;
-			}
-			/* Fall through */
+			return err;
+		}
+		/* Fall through */
 	case MMCSD_MODE_RAW:
 		debug("spl: mmc boot mode: raw\n");
 
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 2/3 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).

[lukma: Edit the commit message]

---

Changes in v2: None

 common/spl/Kconfig   | 6 ++++++
 common/spl/spl_mmc.c | 4 ++++
 2 files changed, 10 insertions(+)
common/spl/Kconfig +6 -0
index 0a3877ec28..4fe4a1359c 100644
@@ -293,6 +293,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
#2 lore raw

PATCH v2 2/3 spl: mmc: Add option to set eMMC HW boot partition

Quoted 9 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).

[lukma: Edit the commit message]

Regards, Andreas

Quoted 50 lines

---

Changes in v2: None

 common/spl/Kconfig   | 6 ++++++
 common/spl/spl_mmc.c | 4 ++++
 2 files changed, 10 insertions(+)
common/spl/Kconfig +6 -0
index 0a3877ec28..4fe4a1359c 100644
@@ -293,6 +293,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
#3 lore raw

PATCH v2 3/3 imx: Add support for i.MX28 based XEA board

In reply to Lukasz Majewski

From: Mans Rullgard <[email protected]>

This patch introduces support for i.MX28 based XEA board.

This board supports DM/DTS in U-Boot proper as well as DM aware drivers in SPL (u-boot.sb).
More detailed information regarding usage of it can be found in ./board/liebherr/xea/README file.

U-Boot SPL 2019.10-rc1-00233-g6aa549f05c (Aug 12 2019 - 09:23:36 +0200) Trying to boot from MMC1
MMC0: Command 8 timeout (status 0xf0344020)
mmc_load_image_raw_sector: mmc block read error

U-Boot 2019.10-rc1-00233-g6aa549f05c (Aug 12 2019 - 09:23:36 +0200)

CPU:   Freescale i.MX28 rev1.2 at 454 MHz
BOOT:  SSP SPI #3, master, 3V3 NOR
Model: Liebherr (LWE) XEA i.MX28 Board
DRAM:  128 MiB
MMC:   MXS MMC: 0
Loading Environment from SPI Flash... SF: Detected n25q128a13 with page size 256 Bytes, erase size 64 KiB, total 16 MiB
OK
In:    serial
Out:   serial
Err:   serial

Net:
Warning: ethernet at 800f0000 (eth0) using random MAC address - ce:e1:9e:46:f3:a2
eth0: ethernet at 800f0000
Hit any key to stop autoboot: 0

---

Changes in v2:
- Adjust config to match dependent patches
- Increase malloc size to allow booting the board with GPIO DM/DTS support
- Add support for GPIO driver in SPL (with DM + OF_PLATDATA)
- Adjust spl_xea.c to support bootmode pins
- Add patches to set in Kconfig default boot HW partition for eMMC

Dependencies:
- The whole patch series (v2) (1-4) starting at:
https://patchwork.ozlabs.org/cover/1146494/

- Fixes/conversion for i.MX28 spi, emmc and gpio (the whole series 1-9):
https://patchwork.ozlabs.org/cover/1148900/

Applied on top of -master branch:
SHA1: feb5a02f869d5678190dfc915ef6c2781b4f7a6c

Travis-CI:
https://travis-ci.org/lmajewski/u-boot-dfu/builds/573538193

---
 arch/arm/dts/Makefile              |   3 +
 arch/arm/dts/imx28-xea-u-boot.dtsi |  46 ++++++
 arch/arm/dts/imx28-xea.dts         | 110 ++++++++++++++
 arch/arm/mach-imx/mxs/Kconfig      |   4 +
 board/liebherr/xea/Kconfig         |  24 +++
 board/liebherr/xea/MAINTAINERS     |   6 +
 board/liebherr/xea/Makefile        |  12 ++
 board/liebherr/xea/README          |  63 ++++++++
 board/liebherr/xea/spl_xea.c       | 303 +++++++++++++++++++++++++++++++++++++
 board/liebherr/xea/xea.c           | 152 +++++++++++++++++++
 configs/imx28_xea_defconfig        | 109 +++++++++++++
 include/configs/xea.h              | 196 ++++++++++++++++++++++++
 12 files changed, 1028 insertions(+)
 create mode 100644 arch/arm/dts/imx28-xea-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx28-xea.dts
 create mode 100644 board/liebherr/xea/Kconfig
 create mode 100644 board/liebherr/xea/MAINTAINERS
 create mode 100644 board/liebherr/xea/Makefile
 create mode 100644 board/liebherr/xea/README
 create mode 100644 board/liebherr/xea/spl_xea.c
 create mode 100644 board/liebherr/xea/xea.c
 create mode 100644 configs/imx28_xea_defconfig
 create mode 100644 include/configs/xea.h
arch/arm/dts/Makefile +3 -0
index 9e7d6d6490..555532b933 100644
@@ -544,6 +544,9 @@ dtb-$(CONFIG_VF610) += vf500-colibri.dtb \
 	vf610-pcm052.dtb \
 	vf610-bk4r1.dtb
 
+dtb-$(CONFIG_MX28) += \
+	imx28-xea.dtb
+
 dtb-$(CONFIG_MX53) += imx53-cx9020.dtb \
 	imx53-kp.dtb \
 	imx53-m53menlo.dtb
arch/arm/dts/imx28-xea-u-boot.dtsi new file +46 -0

46 lines not on this page · raw message

arch/arm/dts/imx28-xea.dts new file +110 -0

110 lines not on this page · raw message

arch/arm/mach-imx/mxs/Kconfig +4 -0
index 68072d5a1f..b90d7b6e41 100644
@@ -60,6 +60,9 @@ config TARGET_SC_SPS_1
 config TARGET_TS4600
 	bool "Support TS4600"
 
+config TARGET_XEA
+	bool "Support XEA"
+
 endchoice
 
 config SYS_SOC
@@ -67,6 +70,7 @@ config SYS_SOC
 
 source "board/bluegiga/apx4devkit/Kconfig"
 source "board/freescale/mx28evk/Kconfig"
+source "board/liebherr/xea/Kconfig"
 source "board/ppcag/bg0900/Kconfig"
 source "board/schulercontrol/sc_sps_1/Kconfig"
 source "board/technologic/ts4600/Kconfig"
board/liebherr/xea/Kconfig new file +24 -0
new file mode 100644
index 0000000000..5428de4646
@@ -0,0 +1,24 @@
+if TARGET_XEA
+
+config SYS_BOARD
+	default "xea"
+
+config SYS_VENDOR
+	default "liebherr"
+
+config SYS_SOC
+	default "mxs"
+
+config SYS_CONFIG_NAME
+	default "xea"
+
+config ENV_SIZE
+	default 0x2000
+
+config ENV_SECT_SIZE
+	default 0x10000 if ENV_IS_IN_SPI_FLASH
+
+config ENV_OFFSET
+	default 0x80000 if ENV_IS_IN_SPI_FLASH
+
+endif
board/liebherr/xea/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..623184d0f8
@@ -0,0 +1,6 @@
+XEA BOARD
+M:	Lukasz Majewski <[email protected]>
+S:	Maintained
+F:	board/liebherr/xea/
+F:	include/configs/xea.h
+F:	configs/imx28_xea_defconfig
board/liebherr/xea/Makefile new file +12 -0
new file mode 100644
index 0000000000..abf500857f
@@ -0,0 +1,12 @@
+#
+# (C) Copyright 2019
+# Lukasz Majewski, DENX Software Engineering, lukma at denx.de.
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= xea.o
+
+ifdef	CONFIG_SPL_BUILD
+obj-y	+= spl_xea.o
+endif
board/liebherr/xea/README new file +63 -0

63 lines not on this page · raw message

board/liebherr/xea/spl_xea.c new file +303 -0

303 lines not on this page · raw message

board/liebherr/xea/xea.c new file +152 -0

152 lines not on this page · raw message

configs/imx28_xea_defconfig new file +109 -0

109 lines not on this page · raw message

include/configs/xea.h new file +196 -0

196 lines not on this page · raw message

Signature · 1 line
2.11.0