All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/9] arm: mvebu: clearfog: support boot from SATA disk
@ 2019-05-16 10:03 Baruch Siach
  2019-05-16 10:03 ` [U-Boot] [PATCH 1/9] spl: sata: add default partition and image name Baruch Siach
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: Baruch Siach @ 2019-05-16 10:03 UTC (permalink / raw)
  To: u-boot

This series enables support for boot from SATA on the SolidRun Clearfog
platform.

Patches 1-3 are preparations for the addition of loading U-Boot main image from
raw SATA device. They make spl sata code independent of board macros and
specific kconfig symbols.

Patch 4 adds to SPL generic support for loading U-Boot from a raw SATA device.
This code is modeled after the similar support for MMC devices.

Patches 5-6 are mvebu specific. Patch 5 fixes SATA access from SPL. Patch 6
adds the SATA boot option at the SoC level.

Patches 7-9 are the board specific update that enable SATA boot in Clearfog,
and document the offset setting requirement.

Baruch Siach (9):
  spl: sata: add default partition and image name
  spl: sata: fix build with DM_SCSI
  spl: sata: don't force FS_FAT support
  spl: sata: support U-Boot load from raw sata disk
  arm: mvebu: fix ahci mbus config in SPL
  arm: mvebu: add support for boot from SATA
  arm: mvebu: clearfog: enable SATA in SPL
  arm: mvebu: clearfog: set U-Boot offset for SATA boot
  arm: mvebu: clearfog: document boot from SATA

 arch/arm/dts/armada-388-clearfog-u-boot.dtsi |  8 ++++
 arch/arm/mach-mvebu/Kconfig                  |  5 ++
 arch/arm/mach-mvebu/Makefile                 |  3 ++
 arch/arm/mach-mvebu/cpu.c                    |  4 ++
 arch/arm/mach-mvebu/include/mach/soc.h       |  2 +
 arch/arm/mach-mvebu/spl.c                    |  5 ++
 board/solidrun/clearfog/README               |  6 +++
 common/spl/Kconfig                           | 14 ++++++
 common/spl/spl_sata.c                        | 49 ++++++++++++++++++--
 include/configs/clearfog.h                   |  2 +-
 10 files changed, 94 insertions(+), 4 deletions(-)

-- 
2.20.1

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

* [U-Boot] [PATCH 1/9] spl: sata: add default partition and image name
  2019-05-16 10:03 [U-Boot] [PATCH 0/9] arm: mvebu: clearfog: support boot from SATA disk Baruch Siach
@ 2019-05-16 10:03 ` Baruch Siach
  2019-05-16 10:03 ` [U-Boot] [PATCH 2/9] spl: sata: fix build with DM_SCSI Baruch Siach
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Baruch Siach @ 2019-05-16 10:03 UTC (permalink / raw)
  To: u-boot

Add sensible defaults for the FAT partition selection and the main
U-Boot image file name. This allows spl_sata to build when the board
headers does not select them explicitly.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 common/spl/spl_sata.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
index adfce1d527f6..b08efc841903 100644
--- a/common/spl/spl_sata.c
+++ b/common/spl/spl_sata.c
@@ -17,6 +17,14 @@
 #include <fat.h>
 #include <image.h>
 
+#ifndef CONFIG_SYS_SATA_FAT_BOOT_PARTITION
+#define CONFIG_SYS_SATA_FAT_BOOT_PARTITION	1
+#endif
+
+#ifndef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
+#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME	"u-boot.img"
+#endif
+
 static int spl_sata_load_image(struct spl_image_info *spl_image,
 			       struct spl_boot_device *bootdev)
 {
-- 
2.20.1

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

* [U-Boot] [PATCH 2/9] spl: sata: fix build with DM_SCSI
  2019-05-16 10:03 [U-Boot] [PATCH 0/9] arm: mvebu: clearfog: support boot from SATA disk Baruch Siach
  2019-05-16 10:03 ` [U-Boot] [PATCH 1/9] spl: sata: add default partition and image name Baruch Siach
@ 2019-05-16 10:03 ` Baruch Siach
  2019-05-16 10:03 ` [U-Boot] [PATCH 3/9] spl: sata: don't force FS_FAT support Baruch Siach
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Baruch Siach @ 2019-05-16 10:03 UTC (permalink / raw)
  To: u-boot

The init_sata() routine is only present when DM_SCSI is not enabled.
Don't call init_sata() when DM_SCSI is enabled. The code will fall back
to scsi_scan() in this case.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 common/spl/spl_sata.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
index b08efc841903..2fb46108a512 100644
--- a/common/spl/spl_sata.c
+++ b/common/spl/spl_sata.c
@@ -28,10 +28,12 @@
 static int spl_sata_load_image(struct spl_image_info *spl_image,
 			       struct spl_boot_device *bootdev)
 {
-	int err;
+	int err = 0;
 	struct blk_desc *stor_dev;
 
+#if !defined(CONFIG_DM_SCSI) && !defined(CONFIG_AHCI)
 	err = init_sata(CONFIG_SPL_SATA_BOOT_DEVICE);
+#endif
 	if (err) {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 		printf("spl: sata init failed: err - %d\n", err);
-- 
2.20.1

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

* [U-Boot] [PATCH 3/9] spl: sata: don't force FS_FAT support
  2019-05-16 10:03 [U-Boot] [PATCH 0/9] arm: mvebu: clearfog: support boot from SATA disk Baruch Siach
  2019-05-16 10:03 ` [U-Boot] [PATCH 1/9] spl: sata: add default partition and image name Baruch Siach
  2019-05-16 10:03 ` [U-Boot] [PATCH 2/9] spl: sata: fix build with DM_SCSI Baruch Siach
@ 2019-05-16 10:03 ` Baruch Siach
  2019-05-16 10:03 ` [U-Boot] [PATCH 4/9] spl: sata: support U-Boot load from raw sata disk Baruch Siach
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Baruch Siach @ 2019-05-16 10:03 UTC (permalink / raw)
  To: u-boot

Allow the code to build when FS_FAT is not enabled, and thus
spl_load_image_fat() is not provided.

A subsequent patch should add alternative raw access U-Boot main image
load method.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 common/spl/spl_sata.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
index 2fb46108a512..f0af9f38d19f 100644
--- a/common/spl/spl_sata.c
+++ b/common/spl/spl_sata.c
@@ -53,9 +53,13 @@ static int spl_sata_load_image(struct spl_image_info *spl_image,
 				  CONFIG_SYS_SATA_FAT_BOOT_PARTITION))
 #endif
 	{
-		err = spl_load_image_fat(spl_image, stor_dev,
+		err = -ENOSYS;
+
+		if (IS_ENABLED(CONFIG_SPL_FS_FAT)) {
+			err = spl_load_image_fat(spl_image, stor_dev,
 					CONFIG_SYS_SATA_FAT_BOOT_PARTITION,
-				CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
+					CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
+		}
 	}
 	if (err) {
 		puts("Error loading sata device\n");
-- 
2.20.1

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

* [U-Boot] [PATCH 4/9] spl: sata: support U-Boot load from raw sata disk
  2019-05-16 10:03 [U-Boot] [PATCH 0/9] arm: mvebu: clearfog: support boot from SATA disk Baruch Siach
                   ` (2 preceding siblings ...)
  2019-05-16 10:03 ` [U-Boot] [PATCH 3/9] spl: sata: don't force FS_FAT support Baruch Siach
@ 2019-05-16 10:03 ` Baruch Siach
  2019-07-11  8:57   ` Stefan Roese
  2019-05-16 10:03 ` [U-Boot] [PATCH 5/9] arm: mvebu: fix ahci mbus config in SPL Baruch Siach
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Baruch Siach @ 2019-05-16 10:03 UTC (permalink / raw)
  To: u-boot

Support load of the U-Boot image from raw SATA disk sector. This is
equivalent to load from MMC raw sector.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 common/spl/Kconfig    | 14 ++++++++++++++
 common/spl/spl_sata.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index c7cd34449a52..a90c6adbf68b 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -733,6 +733,20 @@ config SPL_SATA_SUPPORT
 	  expense and power consumption. This enables loading from SATA
 	  using a configured device.
 
+config SPL_SATA_RAW_U_BOOT_USE_SECTOR
+	bool "SATA raw mode: by sector"
+	depends on SPL_SATA_SUPPORT
+	help
+	  Use sector number for specifying U-Boot location on SATA disk in
+	  raw mode.
+
+config SPL_SATA_RAW_U_BOOT_SECTOR
+	hex "Sector on the SATA disk to load U-Boot from"
+	depends on SPL_SATA_RAW_U_BOOT_USE_SECTOR
+	help
+	  Sector on the SATA disk to load U-Boot from, when the SATA disk is being
+	  used in raw mode. Units: SATA disk sectors (1 sector = 512 bytes).
+
 config SPL_SERIAL_SUPPORT
 	bool "Support serial"
 	select SPL_PRINTF
diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
index f0af9f38d19f..3ad8a5a58035 100644
--- a/common/spl/spl_sata.c
+++ b/common/spl/spl_sata.c
@@ -25,6 +25,32 @@
 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME	"u-boot.img"
 #endif
 
+static int spl_sata_load_image_raw(struct spl_image_info *spl_image,
+		struct blk_desc *stor_dev, unsigned long sector)
+{
+	struct image_header *header;
+	unsigned long count;
+	u32 image_size_sectors;
+	int ret;
+
+	header = spl_get_load_buffer(-sizeof(*header), stor_dev->blksz);
+	count = blk_dread(stor_dev, sector, 1, header);
+	if (count == 0)
+		return -EIO;
+
+	ret = spl_parse_image_header(spl_image, header);
+	if (ret)
+		return ret;
+
+	image_size_sectors = DIV_ROUND_UP(spl_image->size, stor_dev->blksz);
+	count = blk_dread(stor_dev, sector, image_size_sectors,
+			(void *)spl_image->load_addr);
+	if (count != image_size_sectors)
+		return -EIO;
+
+	return 0;
+}
+
 static int spl_sata_load_image(struct spl_image_info *spl_image,
 			       struct spl_boot_device *bootdev)
 {
@@ -59,6 +85,9 @@ static int spl_sata_load_image(struct spl_image_info *spl_image,
 			err = spl_load_image_fat(spl_image, stor_dev,
 					CONFIG_SYS_SATA_FAT_BOOT_PARTITION,
 					CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
+		} else if (IS_ENABLED(CONFIG_SPL_SATA_RAW_U_BOOT_USE_SECTOR)) {
+			err = spl_sata_load_image_raw(spl_image, stor_dev,
+				CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR);
 		}
 	}
 	if (err) {
-- 
2.20.1

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

* [U-Boot] [PATCH 5/9] arm: mvebu: fix ahci mbus config in SPL
  2019-05-16 10:03 [U-Boot] [PATCH 0/9] arm: mvebu: clearfog: support boot from SATA disk Baruch Siach
                   ` (3 preceding siblings ...)
  2019-05-16 10:03 ` [U-Boot] [PATCH 4/9] spl: sata: support U-Boot load from raw sata disk Baruch Siach
@ 2019-05-16 10:03 ` Baruch Siach
  2019-05-17  7:49   ` Chris Packham
  2019-05-16 10:03 ` [U-Boot] [PATCH 6/9] arm: mvebu: add support for boot from SATA Baruch Siach
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Baruch Siach @ 2019-05-16 10:03 UTC (permalink / raw)
  To: u-boot

SPL does not initialize mbus_dram_info. Don't change the ahci mbus
settings of the ROM. This allows the ahci to work in SPL.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 arch/arm/mach-mvebu/cpu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c
index f09e7b10e935..f4b7a4fa8010 100644
--- a/arch/arm/mach-mvebu/cpu.c
+++ b/arch/arm/mach-mvebu/cpu.c
@@ -542,6 +542,10 @@ static void ahci_mvebu_mbus_config(void __iomem *base)
 	const struct mbus_dram_target_info *dram;
 	int i;
 
+	/* mbus is not initialized in SPL; keep the ROM settings */
+	if (IS_ENABLED(CONFIG_SPL_BUILD))
+		return;
+
 	dram = mvebu_mbus_dram_info();
 
 	for (i = 0; i < 4; i++) {
-- 
2.20.1

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

* [U-Boot] [PATCH 6/9] arm: mvebu: add support for boot from SATA
  2019-05-16 10:03 [U-Boot] [PATCH 0/9] arm: mvebu: clearfog: support boot from SATA disk Baruch Siach
                   ` (4 preceding siblings ...)
  2019-05-16 10:03 ` [U-Boot] [PATCH 5/9] arm: mvebu: fix ahci mbus config in SPL Baruch Siach
@ 2019-05-16 10:03 ` Baruch Siach
  2019-05-17  7:58   ` Chris Packham
  2019-05-16 10:04 ` [U-Boot] [PATCH 7/9] arm: mvebu: clearfog: enable SATA in SPL Baruch Siach
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 16+ messages in thread
From: Baruch Siach @ 2019-05-16 10:03 UTC (permalink / raw)
  To: u-boot

Add the required Kconfig and macro definitions to allow boot from SATA
on Armada 38x systems.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 arch/arm/mach-mvebu/Kconfig            | 5 +++++
 arch/arm/mach-mvebu/Makefile           | 3 +++
 arch/arm/mach-mvebu/include/mach/soc.h | 2 ++
 arch/arm/mach-mvebu/spl.c              | 5 +++++
 4 files changed, 15 insertions(+)

diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 495c48e6c749..fdd39685b75d 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -239,6 +239,11 @@ config MVEBU_SPL_BOOT_DEVICE_MMC
 	bool "SDIO/MMC card"
 	select SPL_LIBDISK_SUPPORT
 
+config MVEBU_SPL_BOOT_DEVICE_SATA
+	bool "SATA"
+	select SPL_SATA_SUPPORT
+	select SPL_LIBDISK_SUPPORT
+
 config MVEBU_SPL_BOOT_DEVICE_UART
 	bool "UART"
 
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 02d3ce27ee74..8228a17972f9 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -37,6 +37,9 @@ endif
 ifneq ($(CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC),)
 	KWB_CFG_BOOT_FROM=sdio
 endif
+ifneq ($(CONFIG_MVEBU_SPL_BOOT_DEVICE_SATA),)
+	KWB_CFG_BOOT_FROM=sata
+endif
 ifneq ($(CONFIG_MVEBU_SPL_BOOT_DEVICE_UART),)
 	KWB_CFG_BOOT_FROM=uart
 endif
diff --git a/arch/arm/mach-mvebu/include/mach/soc.h b/arch/arm/mach-mvebu/include/mach/soc.h
index f666ee24243b..acb9257c90fe 100644
--- a/arch/arm/mach-mvebu/include/mach/soc.h
+++ b/arch/arm/mach-mvebu/include/mach/soc.h
@@ -159,7 +159,9 @@
 #define BOOT_DEV_SEL_MASK	(0x3f << BOOT_DEV_SEL_OFFS)
 
 #define BOOT_FROM_NAND		0x0A
+#define BOOT_FROM_SATA		0x22
 #define BOOT_FROM_UART		0x28
+#define BOOT_FROM_SATA_ALT	0x2A
 #define BOOT_FROM_UART_ALT	0x3f
 #define BOOT_FROM_SPI		0x32
 #define BOOT_FROM_MMC		0x30
diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
index 530b98c1aa31..d54de5195624 100644
--- a/arch/arm/mach-mvebu/spl.c
+++ b/arch/arm/mach-mvebu/spl.c
@@ -59,6 +59,11 @@ static u32 get_boot_device(void)
 	case BOOT_FROM_UART_ALT:
 #endif
 		return BOOT_DEVICE_UART;
+#ifdef BOOT_FROM_SATA
+	case BOOT_FROM_SATA:
+	case BOOT_FROM_SATA_ALT:
+		return BOOT_DEVICE_SATA;
+#endif
 	case BOOT_FROM_SPI:
 	default:
 		return BOOT_DEVICE_SPI;
-- 
2.20.1

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

* [U-Boot] [PATCH 7/9] arm: mvebu: clearfog: enable SATA in SPL
  2019-05-16 10:03 [U-Boot] [PATCH 0/9] arm: mvebu: clearfog: support boot from SATA disk Baruch Siach
                   ` (5 preceding siblings ...)
  2019-05-16 10:03 ` [U-Boot] [PATCH 6/9] arm: mvebu: add support for boot from SATA Baruch Siach
@ 2019-05-16 10:04 ` Baruch Siach
  2019-05-17  7:59   ` Chris Packham
  2019-05-16 10:04 ` [U-Boot] [PATCH 8/9] arm: mvebu: clearfog: set U-Boot offset for SATA boot Baruch Siach
  2019-05-16 10:04 ` [U-Boot] [PATCH 9/9] arm: mvebu: clearfog: document boot from SATA Baruch Siach
  8 siblings, 1 reply; 16+ messages in thread
From: Baruch Siach @ 2019-05-16 10:04 UTC (permalink / raw)
  To: u-boot

Enable SATA peripherals in SPL to allow boot from SATA.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 arch/arm/dts/armada-388-clearfog-u-boot.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/dts/armada-388-clearfog-u-boot.dtsi b/arch/arm/dts/armada-388-clearfog-u-boot.dtsi
index a12694e17103..cf6c08881b18 100644
--- a/arch/arm/dts/armada-388-clearfog-u-boot.dtsi
+++ b/arch/arm/dts/armada-388-clearfog-u-boot.dtsi
@@ -11,3 +11,11 @@
 &sdhci {
 	u-boot,dm-spl;
 };
+
+&ahci0 {
+	u-boot,dm-spl;
+};
+
+&ahci1 {
+	u-boot,dm-spl;
+};
-- 
2.20.1

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

* [U-Boot] [PATCH 8/9] arm: mvebu: clearfog: set U-Boot offset for SATA boot
  2019-05-16 10:03 [U-Boot] [PATCH 0/9] arm: mvebu: clearfog: support boot from SATA disk Baruch Siach
                   ` (6 preceding siblings ...)
  2019-05-16 10:04 ` [U-Boot] [PATCH 7/9] arm: mvebu: clearfog: enable SATA in SPL Baruch Siach
@ 2019-05-16 10:04 ` Baruch Siach
  2019-05-17  8:01   ` Chris Packham
  2019-05-16 10:04 ` [U-Boot] [PATCH 9/9] arm: mvebu: clearfog: document boot from SATA Baruch Siach
  8 siblings, 1 reply; 16+ messages in thread
From: Baruch Siach @ 2019-05-16 10:04 UTC (permalink / raw)
  To: u-boot

See the offset of U-Boot in raw SATA disk to the same value as the MMC
offset. That is 0x140 sectors from the beginning of the SPL, which is
0x141 sectors from the beginning of the device (after the MBR sector).

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 include/configs/clearfog.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h
index 4198ff051177..15c402b542e9 100644
--- a/include/configs/clearfog.h
+++ b/include/configs/clearfog.h
@@ -85,7 +85,7 @@
 /* SPL related SPI defines */
 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x20000
 #define CONFIG_SYS_U_BOOT_OFFS		CONFIG_SYS_SPI_U_BOOT_OFFS
-#elif defined(CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC)
+#elif defined(CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC) || defined(CONFIG_MVEBU_SPL_BOOT_DEVICE_SATA)
 /* SPL related MMC defines */
 #define CONFIG_SYS_MMC_U_BOOT_OFFS		(160 << 10)
 #define CONFIG_SYS_U_BOOT_OFFS			CONFIG_SYS_MMC_U_BOOT_OFFS
-- 
2.20.1

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

* [U-Boot] [PATCH 9/9] arm: mvebu: clearfog: document boot from SATA
  2019-05-16 10:03 [U-Boot] [PATCH 0/9] arm: mvebu: clearfog: support boot from SATA disk Baruch Siach
                   ` (7 preceding siblings ...)
  2019-05-16 10:04 ` [U-Boot] [PATCH 8/9] arm: mvebu: clearfog: set U-Boot offset for SATA boot Baruch Siach
@ 2019-05-16 10:04 ` Baruch Siach
  2019-05-17  8:02   ` Chris Packham
  8 siblings, 1 reply; 16+ messages in thread
From: Baruch Siach @ 2019-05-16 10:04 UTC (permalink / raw)
  To: u-boot

Document the main U-Boot image offset when booting from SATA disk on the
Clearfog board.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 board/solidrun/clearfog/README | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/board/solidrun/clearfog/README b/board/solidrun/clearfog/README
index 0b0e98de90a0..6171ce66f4f8 100644
--- a/board/solidrun/clearfog/README
+++ b/board/solidrun/clearfog/README
@@ -40,6 +40,12 @@ Install U-Boot on eMMC boot partition from Linux running on Clearfog:
 Note that the SD card is not accessible when the Clearfog SOM has eMMC.
 Consider initial boot from UART (see below).
 
+Install U-Boot on SATA:
+-----------------------
+
+When loading the main U-Boot image from raw SATA sector, set
+CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR to 0x141.
+
 Boot selection:
 ---------------
 
-- 
2.20.1

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

* [U-Boot] [PATCH 5/9] arm: mvebu: fix ahci mbus config in SPL
  2019-05-16 10:03 ` [U-Boot] [PATCH 5/9] arm: mvebu: fix ahci mbus config in SPL Baruch Siach
@ 2019-05-17  7:49   ` Chris Packham
  0 siblings, 0 replies; 16+ messages in thread
From: Chris Packham @ 2019-05-17  7:49 UTC (permalink / raw)
  To: u-boot

On Thu, May 16, 2019 at 10:09 PM Baruch Siach <baruch@tkos.co.il> wrote:
>
> SPL does not initialize mbus_dram_info. Don't change the ahci mbus
> settings of the ROM. This allows the ahci to work in SPL.
>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>

Reviewed-by: Chris Packham <judge.packham@gmail.com>

> ---
>  arch/arm/mach-mvebu/cpu.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c
> index f09e7b10e935..f4b7a4fa8010 100644
> --- a/arch/arm/mach-mvebu/cpu.c
> +++ b/arch/arm/mach-mvebu/cpu.c
> @@ -542,6 +542,10 @@ static void ahci_mvebu_mbus_config(void __iomem *base)
>         const struct mbus_dram_target_info *dram;
>         int i;
>
> +       /* mbus is not initialized in SPL; keep the ROM settings */
> +       if (IS_ENABLED(CONFIG_SPL_BUILD))
> +               return;
> +
>         dram = mvebu_mbus_dram_info();
>
>         for (i = 0; i < 4; i++) {
> --
> 2.20.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

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

* [U-Boot] [PATCH 6/9] arm: mvebu: add support for boot from SATA
  2019-05-16 10:03 ` [U-Boot] [PATCH 6/9] arm: mvebu: add support for boot from SATA Baruch Siach
@ 2019-05-17  7:58   ` Chris Packham
  0 siblings, 0 replies; 16+ messages in thread
From: Chris Packham @ 2019-05-17  7:58 UTC (permalink / raw)
  To: u-boot

On Thu, May 16, 2019 at 10:09 PM Baruch Siach <baruch@tkos.co.il> wrote:
>
> Add the required Kconfig and macro definitions to allow boot from SATA
> on Armada 38x systems.
>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>

Reviewed-by: Chris Packham <judge.packham@gmail.com>

> ---
>  arch/arm/mach-mvebu/Kconfig            | 5 +++++
>  arch/arm/mach-mvebu/Makefile           | 3 +++
>  arch/arm/mach-mvebu/include/mach/soc.h | 2 ++
>  arch/arm/mach-mvebu/spl.c              | 5 +++++
>  4 files changed, 15 insertions(+)
>
> diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
> index 495c48e6c749..fdd39685b75d 100644
> --- a/arch/arm/mach-mvebu/Kconfig
> +++ b/arch/arm/mach-mvebu/Kconfig
> @@ -239,6 +239,11 @@ config MVEBU_SPL_BOOT_DEVICE_MMC
>         bool "SDIO/MMC card"
>         select SPL_LIBDISK_SUPPORT
>
> +config MVEBU_SPL_BOOT_DEVICE_SATA
> +       bool "SATA"
> +       select SPL_SATA_SUPPORT
> +       select SPL_LIBDISK_SUPPORT
> +
>  config MVEBU_SPL_BOOT_DEVICE_UART
>         bool "UART"
>
> diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
> index 02d3ce27ee74..8228a17972f9 100644
> --- a/arch/arm/mach-mvebu/Makefile
> +++ b/arch/arm/mach-mvebu/Makefile
> @@ -37,6 +37,9 @@ endif
>  ifneq ($(CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC),)
>         KWB_CFG_BOOT_FROM=sdio
>  endif
> +ifneq ($(CONFIG_MVEBU_SPL_BOOT_DEVICE_SATA),)
> +       KWB_CFG_BOOT_FROM=sata
> +endif
>  ifneq ($(CONFIG_MVEBU_SPL_BOOT_DEVICE_UART),)
>         KWB_CFG_BOOT_FROM=uart
>  endif
> diff --git a/arch/arm/mach-mvebu/include/mach/soc.h b/arch/arm/mach-mvebu/include/mach/soc.h
> index f666ee24243b..acb9257c90fe 100644
> --- a/arch/arm/mach-mvebu/include/mach/soc.h
> +++ b/arch/arm/mach-mvebu/include/mach/soc.h
> @@ -159,7 +159,9 @@
>  #define BOOT_DEV_SEL_MASK      (0x3f << BOOT_DEV_SEL_OFFS)
>
>  #define BOOT_FROM_NAND         0x0A
> +#define BOOT_FROM_SATA         0x22
>  #define BOOT_FROM_UART         0x28
> +#define BOOT_FROM_SATA_ALT     0x2A
>  #define BOOT_FROM_UART_ALT     0x3f
>  #define BOOT_FROM_SPI          0x32
>  #define BOOT_FROM_MMC          0x30
> diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
> index 530b98c1aa31..d54de5195624 100644
> --- a/arch/arm/mach-mvebu/spl.c
> +++ b/arch/arm/mach-mvebu/spl.c
> @@ -59,6 +59,11 @@ static u32 get_boot_device(void)
>         case BOOT_FROM_UART_ALT:
>  #endif
>                 return BOOT_DEVICE_UART;
> +#ifdef BOOT_FROM_SATA
> +       case BOOT_FROM_SATA:
> +       case BOOT_FROM_SATA_ALT:
> +               return BOOT_DEVICE_SATA;
> +#endif
>         case BOOT_FROM_SPI:
>         default:
>                 return BOOT_DEVICE_SPI;
> --
> 2.20.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

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

* [U-Boot] [PATCH 7/9] arm: mvebu: clearfog: enable SATA in SPL
  2019-05-16 10:04 ` [U-Boot] [PATCH 7/9] arm: mvebu: clearfog: enable SATA in SPL Baruch Siach
@ 2019-05-17  7:59   ` Chris Packham
  0 siblings, 0 replies; 16+ messages in thread
From: Chris Packham @ 2019-05-17  7:59 UTC (permalink / raw)
  To: u-boot

On Thu, May 16, 2019 at 10:12 PM Baruch Siach <baruch@tkos.co.il> wrote:
>
> Enable SATA peripherals in SPL to allow boot from SATA.
>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>

Reviewed-by: Chris Packham <judge.packham@gmail.com>

> ---
>  arch/arm/dts/armada-388-clearfog-u-boot.dtsi | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/arch/arm/dts/armada-388-clearfog-u-boot.dtsi b/arch/arm/dts/armada-388-clearfog-u-boot.dtsi
> index a12694e17103..cf6c08881b18 100644
> --- a/arch/arm/dts/armada-388-clearfog-u-boot.dtsi
> +++ b/arch/arm/dts/armada-388-clearfog-u-boot.dtsi
> @@ -11,3 +11,11 @@
>  &sdhci {
>         u-boot,dm-spl;
>  };
> +
> +&ahci0 {
> +       u-boot,dm-spl;
> +};
> +
> +&ahci1 {
> +       u-boot,dm-spl;
> +};
> --
> 2.20.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

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

* [U-Boot] [PATCH 8/9] arm: mvebu: clearfog: set U-Boot offset for SATA boot
  2019-05-16 10:04 ` [U-Boot] [PATCH 8/9] arm: mvebu: clearfog: set U-Boot offset for SATA boot Baruch Siach
@ 2019-05-17  8:01   ` Chris Packham
  0 siblings, 0 replies; 16+ messages in thread
From: Chris Packham @ 2019-05-17  8:01 UTC (permalink / raw)
  To: u-boot

On Thu, May 16, 2019 at 10:11 PM Baruch Siach <baruch@tkos.co.il> wrote:
>
> See the offset of U-Boot in raw SATA disk to the same value as the MMC

s/See/Set/

> offset. That is 0x140 sectors from the beginning of the SPL, which is
> 0x141 sectors from the beginning of the device (after the MBR sector).
>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>

With the typo fix above

Reviewed-by: Chris Packham <judge.packham@gmail.com>

> ---
>  include/configs/clearfog.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h
> index 4198ff051177..15c402b542e9 100644
> --- a/include/configs/clearfog.h
> +++ b/include/configs/clearfog.h
> @@ -85,7 +85,7 @@
>  /* SPL related SPI defines */
>  #define CONFIG_SYS_SPI_U_BOOT_OFFS     0x20000
>  #define CONFIG_SYS_U_BOOT_OFFS         CONFIG_SYS_SPI_U_BOOT_OFFS
> -#elif defined(CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC)
> +#elif defined(CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC) || defined(CONFIG_MVEBU_SPL_BOOT_DEVICE_SATA)
>  /* SPL related MMC defines */
>  #define CONFIG_SYS_MMC_U_BOOT_OFFS             (160 << 10)
>  #define CONFIG_SYS_U_BOOT_OFFS                 CONFIG_SYS_MMC_U_BOOT_OFFS
> --
> 2.20.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

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

* [U-Boot] [PATCH 9/9] arm: mvebu: clearfog: document boot from SATA
  2019-05-16 10:04 ` [U-Boot] [PATCH 9/9] arm: mvebu: clearfog: document boot from SATA Baruch Siach
@ 2019-05-17  8:02   ` Chris Packham
  0 siblings, 0 replies; 16+ messages in thread
From: Chris Packham @ 2019-05-17  8:02 UTC (permalink / raw)
  To: u-boot

On Thu, May 16, 2019 at 10:10 PM Baruch Siach <baruch@tkos.co.il> wrote:
>
> Document the main U-Boot image offset when booting from SATA disk on the
> Clearfog board.
>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>

Reviewed-by: Chris Packham <judge.packham@gmail.com>

> ---
>  board/solidrun/clearfog/README | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/board/solidrun/clearfog/README b/board/solidrun/clearfog/README
> index 0b0e98de90a0..6171ce66f4f8 100644
> --- a/board/solidrun/clearfog/README
> +++ b/board/solidrun/clearfog/README
> @@ -40,6 +40,12 @@ Install U-Boot on eMMC boot partition from Linux running on Clearfog:
>  Note that the SD card is not accessible when the Clearfog SOM has eMMC.
>  Consider initial boot from UART (see below).
>
> +Install U-Boot on SATA:
> +-----------------------
> +
> +When loading the main U-Boot image from raw SATA sector, set
> +CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR to 0x141.
> +
>  Boot selection:
>  ---------------
>
> --
> 2.20.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

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

* [U-Boot] [PATCH 4/9] spl: sata: support U-Boot load from raw sata disk
  2019-05-16 10:03 ` [U-Boot] [PATCH 4/9] spl: sata: support U-Boot load from raw sata disk Baruch Siach
@ 2019-07-11  8:57   ` Stefan Roese
  0 siblings, 0 replies; 16+ messages in thread
From: Stefan Roese @ 2019-07-11  8:57 UTC (permalink / raw)
  To: u-boot

Hi Baruch,

On 16.05.19 12:03, Baruch Siach wrote:
> Support load of the U-Boot image from raw SATA disk sector. This is
> equivalent to load from MMC raw sector.
> 
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>

This patch breaks cm_t54:

$ ./tools/buildman/buildman cm_t54
Building current source for 1 boards (1 thread, 16 jobs per thread)
        arm:  +   cm_t54
+common/spl/spl_sata.c: In function ?spl_sata_load_image?:
+common/spl/spl_sata.c:90:5: error: ?CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR? undeclared (first use in this function); did you mean ?CONFIG_SPL_SATA_BOOT_DEVICE??
+     CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR);
+     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+     CONFIG_SPL_SATA_BOOT_DEVICE
+common/spl/spl_sata.c:90:5: note: each undeclared identifier is reported only once for each function it appears in
+make[3]: *** [scripts/Makefile.build:278: spl/common/spl/spl_sata.o] Error 1
+make[2]: *** [scripts/Makefile.spl:410: spl/common/spl] Error 2
+make[1]: *** [Makefile:1727: spl/u-boot-spl] Error 2
+make: *** [Makefile:148: sub-make] Error 2
     0    0    1 /1      cm_t54

I'm dropping this one from the upcoming pull request. Please re-send
it, once you've fixed it. And please compile test it for all
targets (Travis).

Thanks,
Stefan

> ---
>   common/spl/Kconfig    | 14 ++++++++++++++
>   common/spl/spl_sata.c | 29 +++++++++++++++++++++++++++++
>   2 files changed, 43 insertions(+)
> 
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index c7cd34449a52..a90c6adbf68b 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -733,6 +733,20 @@ config SPL_SATA_SUPPORT
>   	  expense and power consumption. This enables loading from SATA
>   	  using a configured device.
>   
> +config SPL_SATA_RAW_U_BOOT_USE_SECTOR
> +	bool "SATA raw mode: by sector"
> +	depends on SPL_SATA_SUPPORT
> +	help
> +	  Use sector number for specifying U-Boot location on SATA disk in
> +	  raw mode.
> +
> +config SPL_SATA_RAW_U_BOOT_SECTOR
> +	hex "Sector on the SATA disk to load U-Boot from"
> +	depends on SPL_SATA_RAW_U_BOOT_USE_SECTOR
> +	help
> +	  Sector on the SATA disk to load U-Boot from, when the SATA disk is being
> +	  used in raw mode. Units: SATA disk sectors (1 sector = 512 bytes).
> +
>   config SPL_SERIAL_SUPPORT
>   	bool "Support serial"
>   	select SPL_PRINTF
> diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
> index f0af9f38d19f..3ad8a5a58035 100644
> --- a/common/spl/spl_sata.c
> +++ b/common/spl/spl_sata.c
> @@ -25,6 +25,32 @@
>   #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME	"u-boot.img"
>   #endif
>   
> +static int spl_sata_load_image_raw(struct spl_image_info *spl_image,
> +		struct blk_desc *stor_dev, unsigned long sector)
> +{
> +	struct image_header *header;
> +	unsigned long count;
> +	u32 image_size_sectors;
> +	int ret;
> +
> +	header = spl_get_load_buffer(-sizeof(*header), stor_dev->blksz);
> +	count = blk_dread(stor_dev, sector, 1, header);
> +	if (count == 0)
> +		return -EIO;
> +
> +	ret = spl_parse_image_header(spl_image, header);
> +	if (ret)
> +		return ret;
> +
> +	image_size_sectors = DIV_ROUND_UP(spl_image->size, stor_dev->blksz);
> +	count = blk_dread(stor_dev, sector, image_size_sectors,
> +			(void *)spl_image->load_addr);
> +	if (count != image_size_sectors)
> +		return -EIO;
> +
> +	return 0;
> +}
> +
>   static int spl_sata_load_image(struct spl_image_info *spl_image,
>   			       struct spl_boot_device *bootdev)
>   {
> @@ -59,6 +85,9 @@ static int spl_sata_load_image(struct spl_image_info *spl_image,
>   			err = spl_load_image_fat(spl_image, stor_dev,
>   					CONFIG_SYS_SATA_FAT_BOOT_PARTITION,
>   					CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
> +		} else if (IS_ENABLED(CONFIG_SPL_SATA_RAW_U_BOOT_USE_SECTOR)) {
> +			err = spl_sata_load_image_raw(spl_image, stor_dev,
> +				CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR);
>   		}
>   	}
>   	if (err) {
> 

Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de

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

end of thread, other threads:[~2019-07-11  8:57 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16 10:03 [U-Boot] [PATCH 0/9] arm: mvebu: clearfog: support boot from SATA disk Baruch Siach
2019-05-16 10:03 ` [U-Boot] [PATCH 1/9] spl: sata: add default partition and image name Baruch Siach
2019-05-16 10:03 ` [U-Boot] [PATCH 2/9] spl: sata: fix build with DM_SCSI Baruch Siach
2019-05-16 10:03 ` [U-Boot] [PATCH 3/9] spl: sata: don't force FS_FAT support Baruch Siach
2019-05-16 10:03 ` [U-Boot] [PATCH 4/9] spl: sata: support U-Boot load from raw sata disk Baruch Siach
2019-07-11  8:57   ` Stefan Roese
2019-05-16 10:03 ` [U-Boot] [PATCH 5/9] arm: mvebu: fix ahci mbus config in SPL Baruch Siach
2019-05-17  7:49   ` Chris Packham
2019-05-16 10:03 ` [U-Boot] [PATCH 6/9] arm: mvebu: add support for boot from SATA Baruch Siach
2019-05-17  7:58   ` Chris Packham
2019-05-16 10:04 ` [U-Boot] [PATCH 7/9] arm: mvebu: clearfog: enable SATA in SPL Baruch Siach
2019-05-17  7:59   ` Chris Packham
2019-05-16 10:04 ` [U-Boot] [PATCH 8/9] arm: mvebu: clearfog: set U-Boot offset for SATA boot Baruch Siach
2019-05-17  8:01   ` Chris Packham
2019-05-16 10:04 ` [U-Boot] [PATCH 9/9] arm: mvebu: clearfog: document boot from SATA Baruch Siach
2019-05-17  8:02   ` Chris Packham

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.