Skip to contentSkip to conversation

board: arm: Add support for Broadcom BCM7445D0

PATCH Superseded Thomas Fitzsimmons 6 participants 37 messages May 6, 2018 – Sep 27, 2019

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

cover board: arm: Add support for Broadcom BCM7445D0

Hi,

This patch adds support for loading U-Boot on the Broadcom 7445D0 SoC, as a third stage bootloader loaded by Broadcom's BOLT bootloader.

While this is only a partial port, it does enable some of U-Boot's flexibility on this SoC, functionality beyond what BOLT provides. Specifically, it brings:

- ext4 file system traversal

- support for loading FIT images

- advanced scripting

- support for FIT-provided DTBs instead of relying on the BOLT-provided DTB

My team at Cisco is using a customized version of this port in production. The same approach may work on other BCM7xxx boards, with some configuration adjustments and memory layout experimentation.

Stefan Roese reviewed (off-list) some early revisions of these changes. This patch is my attempt to rebase on the current U-Boot master branch. I'm submitting it in case there is interest in including this port in upstream U-Boot.

Thomas

Thomas Fitzsimmons (1):
board: arm: Add support for Broadcom BCM7445D0

 arch/arm/Kconfig                                |  12 +
 arch/arm/cpu/armv7/Makefile                     |   1 +
 arch/arm/cpu/armv7/bcm7445d0/Makefile           |  11 +
 arch/arm/cpu/armv7/bcm7445d0/lowlevel_init.S    |  24 ++
 arch/arm/lib/crt0.S                             |   2 +
 arch/arm/mach-bcm7445d0/include/mach/gpio.h     |  12 +
 arch/arm/mach-bcm7445d0/include/mach/hardware.h |  12 +
 arch/arm/mach-bcm7445d0/include/mach/sdhci.h    |  15 +
 board/broadcom/bcm7445d0/Kconfig                | 132 ++++++++
 board/broadcom/bcm7445d0/Makefile               |  11 +
 board/broadcom/bcm7445d0/bcm7445d0.c            | 147 ++++++++
 common/fdt_support.c                            |   9 +-
 common/image-fit.c                              |   2 +
 configs/bcm7445d0_defconfig                     |  21 ++
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  59 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 428 ++++++++++++++++++++++++
 dts/Kconfig                                     |   6 +
 include/configs/bcm7445d0.h                     | 227 +++++++++++++
 include/configs/bcmstb.h                        |  57 ++++
 lib/fdtdec.c                                    |   8 +
 23 files changed, 1204 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/cpu/armv7/bcm7445d0/Makefile
 create mode 100644 arch/arm/cpu/armv7/bcm7445d0/lowlevel_init.S
 create mode 100644 arch/arm/mach-bcm7445d0/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcm7445d0/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcm7445d0/include/mach/sdhci.h
 create mode 100644 board/broadcom/bcm7445d0/Kconfig
 create mode 100644 board/broadcom/bcm7445d0/Makefile
 create mode 100644 board/broadcom/bcm7445d0/bcm7445d0.c
 create mode 100644 configs/bcm7445d0_defconfig
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcm7445d0.h
 create mode 100644 include/configs/bcmstb.h
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 board: arm: Add support for Broadcom BCM7445D0

Add support for loading U-Boot on the Broadcom 7445D0 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

---
 arch/arm/Kconfig                                |  12 +
 arch/arm/cpu/armv7/Makefile                     |   1 +
 arch/arm/cpu/armv7/bcm7445d0/Makefile           |  11 +
 arch/arm/cpu/armv7/bcm7445d0/lowlevel_init.S    |  24 ++
 arch/arm/lib/crt0.S                             |   2 +
 arch/arm/mach-bcm7445d0/include/mach/gpio.h     |  12 +
 arch/arm/mach-bcm7445d0/include/mach/hardware.h |  12 +
 arch/arm/mach-bcm7445d0/include/mach/sdhci.h    |  15 +
 board/broadcom/bcm7445d0/Kconfig                | 132 ++++++++
 board/broadcom/bcm7445d0/Makefile               |  11 +
 board/broadcom/bcm7445d0/bcm7445d0.c            | 147 ++++++++
 common/fdt_support.c                            |   9 +-
 common/image-fit.c                              |   2 +
 configs/bcm7445d0_defconfig                     |  21 ++
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  59 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 428 ++++++++++++++++++++++++
 dts/Kconfig                                     |   6 +
 include/configs/bcm7445d0.h                     | 227 +++++++++++++
 include/configs/bcmstb.h                        |  57 ++++
 lib/fdtdec.c                                    |   8 +
 23 files changed, 1204 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/cpu/armv7/bcm7445d0/Makefile
 create mode 100644 arch/arm/cpu/armv7/bcm7445d0/lowlevel_init.S
 create mode 100644 arch/arm/mach-bcm7445d0/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcm7445d0/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcm7445d0/include/mach/sdhci.h
 create mode 100644 board/broadcom/bcm7445d0/Kconfig
 create mode 100644 board/broadcom/bcm7445d0/Makefile
 create mode 100644 board/broadcom/bcm7445d0/bcm7445d0.c
 create mode 100644 configs/bcm7445d0_defconfig
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcm7445d0.h
 create mode 100644 include/configs/bcmstb.h
arch/arm/Kconfig +12 -0
index 9bd70f4..b2df30a 100644
@@ -498,6 +498,17 @@ config TARGET_VEXPRESS_CA15_TC2
 	select CPU_V7_HAS_VIRT
 	select PL011_SERIAL
 
+config TARGET_BCM7445D0
+	bool "Broadcom 7445D0 TSBL"
+	select CPU_V7
+	select SUPPORT_SPL
+	help
+	  Support for the Broadcom 7445D0 SoC.  This port assumes Bolt
+	  is acting as the second stage bootloader, and U-Boot is
+	  acting as the third stage bootloader (TSBL), loaded by Bolt.
+	  This port may work on other BCM7xxx boards with
+	  configuration changes.
+
 config TARGET_VEXPRESS_CA5X2
 	bool "Support vexpress_ca5x2"
 	select CPU_V7
@@ -1320,6 +1331,7 @@ source "board/armltd/vexpress/Kconfig"
 source "board/armltd/vexpress64/Kconfig"
 source "board/broadcom/bcm23550_w1d/Kconfig"
 source "board/broadcom/bcm28155_ap/Kconfig"
+source "board/broadcom/bcm7445d0/Kconfig"
 source "board/broadcom/bcmcygnus/Kconfig"
 source "board/broadcom/bcmnsp/Kconfig"
 source "board/broadcom/bcmns2/Kconfig"
arch/arm/cpu/armv7/Makefile +1 -0
index b14ee54..7183d4d 100644
@@ -30,6 +30,7 @@ endif
 
 obj-$(if $(filter bcm235xx,$(SOC)),y) += bcm235xx/
 obj-$(if $(filter bcm281xx,$(SOC)),y) += bcm281xx/
+obj-$(if $(filter bcm7445d0,$(SOC)),y) += bcm7445d0/
 obj-$(if $(filter bcmcygnus,$(SOC)),y) += bcmcygnus/
 obj-$(if $(filter bcmnsp,$(SOC)),y) += bcmnsp/
 obj-$(if $(filter ls102xa,$(SOC)),y) += ls102xa/
arch/arm/cpu/armv7/bcm7445d0/Makefile new file +11 -0
new file mode 100644
index 0000000..796f482
@@ -0,0 +1,11 @@
+#
+# (C) Copyright 2018
+# Cisco Systems, Inc. <www.cisco.com>
+#
+# Author :
+#	Thomas Fitzsimmons <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= lowlevel_init.o
arch/arm/cpu/armv7/bcm7445d0/lowlevel_init.S new file +24 -0
new file mode 100644
index 0000000..1eb67a0
@@ -0,0 +1,24 @@
+/*
+ * (C) Copyright 2018
+ * Cisco Systems, Inc. <www.cisco.com>
+ *
+ * Author :
+ *	Thomas Fitzsimmons <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <linux/linkage.h>
+
+ENTRY(save_boot_params)
+	ldr	r6, =bcm7445d0_boot_parameters
+	str	r0, [r6, #0]
+	str	r1, [r6, #4]
+	str	r2, [r6, #8]
+	str	r3, [r6, #12]
+	str	sp, [r6, #16]
+	str	lr, [r6, #20]
+	ldr	r6, =prior_stage_fdt_address
+	str	r2, [r6]
+	b	save_boot_params_ret
+ENDPROC(save_boot_params)
arch/arm/lib/crt0.S +2 -0
index fa81317..f1a6f35 100644
@@ -94,6 +94,7 @@ ENTRY(_main)
  * 'here' but relocated.
  */
 
+#if !defined(CONFIG_OF_PRIOR_STAGE)
 	ldr	r0, [r9, #GD_START_ADDR_SP]	/* sp = gd->start_addr_sp */
 	bic	r0, r0, #7	/* 8-byte alignment for ABI compliance */
 	mov	sp, r0
@@ -108,6 +109,7 @@ ENTRY(_main)
 #endif
 	ldr	r0, [r9, #GD_RELOCADDR]		/* r0 = gd->relocaddr */
 	b	relocate_code
+#endif
 here:
 /*
  * now relocate vectors
arch/arm/mach-bcm7445d0/include/mach/gpio.h new file +12 -0
new file mode 100644
index 0000000..f7163e4
@@ -0,0 +1,12 @@
+/*
+ * (C) Copyright 2018
+ * Cisco Systems, Inc. <www.cisco.com>
+ *
+ * Author :
+ *	Thomas Fitzsimmons <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#ifndef _BCM7445D0_GPIO_H
+#define _BCM7445D0_GPIO_H
+#endif /* _BCM7445D0_GPIO_H */
arch/arm/mach-bcm7445d0/include/mach/hardware.h new file +12 -0
new file mode 100644
index 0000000..28418bf
@@ -0,0 +1,12 @@
+/*
+ * (C) Copyright 2018
+ * Cisco Systems, Inc. <www.cisco.com>
+ *
+ * Author :
+ *	Thomas Fitzsimmons <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#ifndef _BCM7445D0_HARDWARE_H
+#define _BCM7445D0_HARDWARE_H
+#endif /* _BCM7445D0_HARDWARE_H */
arch/arm/mach-bcm7445d0/include/mach/sdhci.h new file +15 -0
new file mode 100644
index 0000000..2c7fb09
@@ -0,0 +1,15 @@
+/*
+ * (C) Copyright 2018
+ * Cisco Systems, Inc. <www.cisco.com>
+ *
+ * Author :
+ *	Thomas Fitzsimmons <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#ifndef _BCM7445D0_SDHCI_H
+#define _BCM7445D0_SDHCI_H
+
+int bcmstb_sdhci_init(phys_addr_t regbase);
+
+#endif /* _BCM7445D0_SDHCI_H */
board/broadcom/bcm7445d0/Kconfig new file +132 -0

132 lines not on this page · raw message

board/broadcom/bcm7445d0/Makefile new file +11 -0
new file mode 100644
index 0000000..265bc74
@@ -0,0 +1,11 @@
+#
+# (C) Copyright 2018
+# Cisco Systems, Inc. <www.cisco.com>
+#
+# Author :
+#	Thomas Fitzsimmons <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= bcm7445d0.o
board/broadcom/bcm7445d0/bcm7445d0.c new file +147 -0

147 lines not on this page · raw message

common/fdt_support.c +8 -1
index 66a313e..f07dfe3 100644
@@ -242,11 +242,13 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end)
 		}
 	}
 
+#if !defined(CONFIG_BCMSTB_ACCOMMODATE_STBLINUX)
 	err = fdt_add_mem_rsv(fdt, initrd_start, initrd_end - initrd_start);
 	if (err < 0) {
 		printf("fdt_initrd: %s\n", fdt_strerror(err));
 		return err;
 	}
+#endif
 
 	is_u64 = (fdt_address_cells(fdt, 0) == 2);
 
@@ -602,7 +604,10 @@ int fdt_shrink_to_minimum(void *blob, uint extrasize)
 {
 	int i;
 	uint64_t addr, size;
-	int total, ret;
+	int total;
+#if !defined(CONFIG_BCMSTB_ACCOMMODATE_STBLINUX)
+	int ret;
+#endif
 	uint actualsize;
 
 	if (!blob)
@@ -635,9 +640,11 @@ int fdt_shrink_to_minimum(void *blob, uint extrasize)
 	fdt_set_totalsize(blob, actualsize);
 
 	/* Add the new reservation */
+#if !defined(CONFIG_BCMSTB_ACCOMMODATE_STBLINUX)
 	ret = fdt_add_mem_rsv(blob, (uintptr_t)blob, actualsize);
 	if (ret < 0)
 		return ret;
+#endif
 
 	return actualsize;
 }
common/image-fit.c +2 -0
index 030a3e5..a346f8c 100644
@@ -1905,6 +1905,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
 			return -EBADF;
 		}
 	} else if (load_op != FIT_LOAD_OPTIONAL_NON_ZERO || load) {
+#if !defined(CONFIG_BCMSTB_ACCOMMODATE_STBLINUX)
 		ulong image_start, image_end;
 		ulong load_end;
 		void *dst;
@@ -1929,6 +1930,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
 		dst = map_sysmem(load, len);
 		memmove(dst, buf, len);
 		data = load;
+#endif
 	}
 	bootstage_mark(bootstage_id + BOOTSTAGE_SUB_LOAD);
 
configs/bcm7445d0_defconfig new file +21 -0
new file mode 100644
index 0000000..1e1162e
@@ -0,0 +1,21 @@
+CONFIG_ARM=y
+CONFIG_SYS_TEXT_BASE=0x80100000
+CONFIG_TARGET_BCM7445D0=y
+CONFIG_USE_PRIVATE_LIBGCC=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_PRIOR_STAGE=y
+CONFIG_DM=y
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI=y
+CONFIG_SPI_FLASH=y
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_RSA=y
+CONFIG_BLK=n
+CONFIG_MMC_SDHCI=y
+CONFIG_CONS_INDEX=3
+CONFIG_BOOTDELAY=1
+CONFIG_SYS_PROMPT="U-Boot>"
+CONFIG_HUSH_PARSER=y
drivers/mmc/Makefile +1 -0
index cf46c33..959f410 100644
@@ -26,6 +26,7 @@ obj-$(CONFIG_MMC_DW_EXYNOS)		+= exynos_dw_mmc.o
 obj-$(CONFIG_MMC_DW_K3)			+= hi6220_dw_mmc.o
 obj-$(CONFIG_MMC_DW_ROCKCHIP)		+= rockchip_dw_mmc.o
 obj-$(CONFIG_MMC_DW_SOCFPGA)		+= socfpga_dw_mmc.o
+obj-$(CONFIG_BCMSTB_SDHCI) += bcmstb_sdhci.o
 obj-$(CONFIG_FSL_ESDHC) += fsl_esdhc.o
 obj-$(CONFIG_FTSDC010) += ftsdc010_mci.o
 obj-$(CONFIG_GENERIC_ATMEL_MCI) += gen_atmel_mci.o
drivers/mmc/bcmstb_sdhci.c new file +59 -0

59 lines not on this page · raw message

drivers/spi/Kconfig +7 -0
index 6667f73..c4a6c8d 100644
@@ -66,6 +66,13 @@ config BCM63XX_SPI
 	  access the SPI NOR flash on platforms embedding these Broadcom
 	  SPI cores.
 
+config BCMSTB_SPI
+	bool "Broadcom Set Top Box SPI driver"
+	help
+	  Enable the Broadcom Set Top Box SPI driver. This driver can
+	  be used to access the SPI flash on platforms embedding this
+	  Broadcom SPI core.
+
 config CADENCE_QSPI
 	bool "Cadence QSPI driver"
 	help
drivers/spi/Makefile +1 -0
index 176bfa0..0f864be 100644
@@ -20,6 +20,7 @@ obj-$(CONFIG_ATH79_SPI) += ath79_spi.o
 obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 obj-$(CONFIG_BCM63XX_HSSPI) += bcm63xx_hsspi.o
 obj-$(CONFIG_BCM63XX_SPI) += bcm63xx_spi.o
+obj-$(CONFIG_BCMSTB_SPI) += bcmstb_spi.o
 obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o
 obj-$(CONFIG_CF_SPI) += cf_spi.o
 obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
drivers/spi/bcmstb_spi.c new file +428 -0

428 lines not on this page · raw message

dts/Kconfig +6 -0
index 0cef225..074784b 100644
@@ -101,6 +101,12 @@ config OF_HOSTFILE
 	  This is only useful for Sandbox.  Use the -d flag to U-Boot to
 	  specify the file to read.
 
+config OF_PRIOR_STAGE
+	bool "Prior stage bootloader DTB for DT control"
+	help
+	  If this option is enabled, DTB will be read from a memory
+	  location passed to U-Boot by the prior stage bootloader.
+
 endchoice
 
 config DEFAULT_DEVICE_TREE
include/configs/bcm7445d0.h new file +227 -0

227 lines not on this page · raw message

include/configs/bcmstb.h new file +57 -0

57 lines not on this page · raw message

lib/fdtdec.c +8 -0
index 320ee1d..aec12f2 100644
@@ -1299,6 +1299,10 @@ __weak void *board_fdt_blob_setup(void)
 }
 #endif
 
+#if defined(CONFIG_OF_PRIOR_STAGE)
+extern phys_addr_t prior_stage_fdt_address;
+#endif
+
 int fdtdec_setup(void)
 {
 #if CONFIG_IS_ENABLED(OF_CONTROL)
@@ -1323,8 +1327,12 @@ int fdtdec_setup(void)
 # endif
 # ifndef CONFIG_SPL_BUILD
 	/* Allow the early environment to override the fdt address */
+#  if defined(CONFIG_OF_PRIOR_STAGE)
+	gd->fdt_blob = (void *)prior_stage_fdt_address;
+#  else
 	gd->fdt_blob = (void *)env_get_ulong("fdtcontroladdr", 16,
 						(uintptr_t)gd->fdt_blob);
+#  endif
 # endif
 
 # if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 1/1 board: arm: Add support for Broadcom BCM7445D0

Quoted 7 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445D0 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

[snip]

Quoted 13 lines
arch/arm/lib/crt0.S +1 -0
index fa81317..f1a6f35 100644
@@ -94,6 +94,7 @@ ENTRY(_main)
  * 'here' but relocated.
  */
 
+#if !defined(CONFIG_OF_PRIOR_STAGE)
 	ldr	r0, [r9, #GD_START_ADDR_SP]	/* sp = gd->start_addr_sp */
 	bic	r0, r0, #7	/* 8-byte alignment for ABI compliance */
 	mov	sp, r0

arch/arm/lib/crt0.S ENTRY(_main) · line 115

Quoted 7 lines
arch/arm/lib/crt0.S +1 -0
@@ -108,6 +109,7 @@ ENTRY(_main)
 #endif
 	ldr	r0, [r9, #GD_RELOCADDR]		/* r0 = gd->relocaddr */
 	b	relocate_code
+#endif
 here:
 /*
  * now relocate vectors

Can you explain this bit a good bit more?

arch/arm/lib/crt0.S

Quoted 3 lines
arch/arm/lib/crt0.S +3 -0
+config BCHP_BSPI_MAST_N_BOOT_CTRL
+	hex ""
+	default 0x003e3208

Doing hex "" seems wrong. What are you doing here exactly?

Quoted 5 lines
common/fdt_support.c +0 -0
index 66a313e..f07dfe3 100644

common/fdt_support.c int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end) · line 251

Quoted 10 lines
common/fdt_support.c +2 -0
@@ -242,11 +242,13 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end)
 		}
 	}
 
+#if !defined(CONFIG_BCMSTB_ACCOMMODATE_STBLINUX)
 	err = fdt_add_mem_rsv(fdt, initrd_start, initrd_end - initrd_start);
 	if (err < 0) {
 		printf("fdt_initrd: %s\n", fdt_strerror(err));
 		return err;
 	}
+#endif

Why do we need this?

common/fdt_support.c int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end)

Quoted 6 lines
common/fdt_support.c +6 -0
+#ifdef DEBUG
+static int debug_tx_rx;
+#define D(fmt, args...) debug_cond(debug_tx_rx, fmt, ##args)
+#else
+#define D(fmt, args...)
+#endif

We have dbg() etc, please use. Thanks!

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

PATCH 1/1 board: arm: Add support for Broadcom BCM7445D0

Quoted 18 lines · Tom Rini
Quoted 7 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445D0 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

[snip]

Quoted 8 lines
arch/arm/lib/crt0.S +0 -0
index fa81317..f1a6f35 100644
@@ -94,6 +94,7 @@ ENTRY(_main)
  * 'here' but relocated.
  */
 
Quoted 14 lines

arch/arm/lib/crt0.S ENTRY(_main) · line 115

Quoted 12 lines
arch/arm/lib/crt0.S +2 -0
+#if !defined(CONFIG_OF_PRIOR_STAGE)
 	ldr	r0, [r9, #GD_START_ADDR_SP]	/* sp = gd->start_addr_sp */
 	bic	r0, r0, #7	/* 8-byte alignment for ABI compliance */
 	mov	sp, r0
@@ -108,6 +109,7 @@ ENTRY(_main)
 #endif
 	ldr	r0, [r9, #GD_RELOCADDR]		/* r0 = gd->relocaddr */
 	b	relocate_code
+#endif
 here:
 /*
  * now relocate vectors

Can you explain this bit a good bit more?

When BOLT loads U-Boot as an ELF program, this relocation code hangs -- I haven't found out why yet -- but if I skip the relocation, U-Boot runs successfully. I figured out a different approach to preventing the relocation, one that only requires logic in an SoC-specific file, so v2 of the patch will not have any crt0.S changes.

Quoted 5 lines

arch/arm/lib/crt0.S

Quoted 3 lines
arch/arm/lib/crt0.S +3 -0
+config BCHP_BSPI_MAST_N_BOOT_CTRL
+	hex ""
+	default 0x003e3208

Doing hex "" seems wrong. What are you doing here exactly?

I've reorganized all these into more appropriate locations, and documented all the remaining Kconfig items, which you'll see in the v2 patch I'll post shortly.

Quoted 8 lines
Quoted 8 lines
common/fdt_support.c +0 -0
index 66a313e..f07dfe3 100644
@@ -242,11 +242,13 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end)
 		}
 	}
 
Quoted 9 lines

common/fdt_support.c int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end) · line 251

Quoted 7 lines
common/fdt_support.c +2 -0
+#if !defined(CONFIG_BCMSTB_ACCOMMODATE_STBLINUX)
 	err = fdt_add_mem_rsv(fdt, initrd_start, initrd_end - initrd_start);
 	if (err < 0) {
 		printf("fdt_initrd: %s\n", fdt_strerror(err));
 		return err;
 	}
+#endif

Why do we need this?

The background is that stblinux is designed to use some physical memory for Linux itself, and leave the rest of physical memory for direct use by video decode blocks in the SoC.

Basically, without making accommodations for it in U-Boot, stblinux will allocate less memory for use by the video decode blocks than is actually available, even if it could safely allocate more.

In v2 of the patch, I've documented a different approach to loading FIT images (one that keeps the RFS and DTB in-place), which eliminates the need for this configuration macro.

Quoted 8 lines

common/fdt_support.c int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end)

Quoted 6 lines
common/fdt_support.c +6 -0
+#ifdef DEBUG
+static int debug_tx_rx;
+#define D(fmt, args...) debug_cond(debug_tx_rx, fmt, ##args)
+#else
+#define D(fmt, args...)
+#endif

We have dbg() etc, please use. Thanks!

OK, done in v2 of the patch.

Thanks for reviewing,
Thomas

#4 lore raw

PATCH 1/1 board: arm: Add support for Broadcom BCM7445D0

In reply to Thomas Fitzsimmons
Quoted 14 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445D0 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

arch/arm/Kconfig +0 -0
index 9bd70f4..b2df30a 100644

arch/arm/Kconfig config TARGET_VEXPRESS_CA15_TC2 · line 506

Quoted 9 lines
arch/arm/Kconfig +6 -0
@@ -498,6 +498,17 @@ config TARGET_VEXPRESS_CA15_TC2
 	select CPU_V7_HAS_VIRT
 	select PL011_SERIAL
 
+config TARGET_BCM7445D0
+	bool "Broadcom 7445D0 TSBL"
+	select CPU_V7
+	select SUPPORT_SPL
+	help
+	  Support for the Broadcom 7445D0 SoC.  This port assumes Bolt

BOLT

arch/arm/Kconfig config TARGET_VEXPRESS_CA15_TC2 · line 508

Quoted 2 lines
arch/arm/Kconfig +2 -0
+	  is acting as the second stage bootloader, and U-Boot is
+	  acting as the third stage bootloader (TSBL), loaded by Bolt.

again BOLT

arch/arm/Kconfig config TARGET_VEXPRESS_CA15_TC2 · line 510

Quoted 2 lines
arch/arm/Kconfig +2 -0
+	  This port may work on other BCM7xxx boards with
+	  configuration changes.

There are other revisions than D0, so I would just name this TARGET_BCM7445. You would likely want to create a TARGET_BRCMSTB general menu which would encompass all ARMv7-A based SoCs from the Broadcom STB/CM division, and then have per-chip Kconfig options (similar to what the older <= 3.14 STB Linux kernels did).

Quoted 7 lines
arch/arm/Kconfig +7 -0
+
+config BCMSTB_ACCOMMODATE_STBLINUX
+	bool ""
+	default y
+	help
+	  This prevents U-Boot from adding memory reservations for the
+          lengths of initramfs and DTB.  Without skipping these,

arch/arm/Kconfig config TARGET_VEXPRESS_CA15_TC2

Quoted 10 lines
arch/arm/Kconfig +10 -0
+          stblinux's "contiguous memory allocator" (CMA) Linux driver
+          (cma_driver) will allocate memory ranges smaller than what
+          are actually available, because it only checks reservation
+          sizes.  It doesn't check if the reserved range overlaps the
+          range it allocates.  stblinux also tries to move the DTB to
+          a lower memory location early in the Linux boot.  If the FIT
+          image specifies a load address for the initramfs then
+          sometimes the DTB is moved into the range where the
+          initramfs image is loaded.  Defining this will mean that
+          FIT-provided initramfs load addresses are ignored.

What STB Linux kernel did you observe this with? I am afraid this is still true about the ranges vs. allocation even in newer kernels, but that is kind of intented to keep the logic KISS (because it's already too complicated IMHO).

arch/arm/Kconfig

Quoted 12 lines
arch/arm/Kconfig +12 -0
+
+config BCMSTB_SDHCI
+	bool ""
+	default y
+
+config BCMSTB_SDHCI_BASE
+	hex ""
+	default 0xf03e0200
+
+config BCMSTB_SPI_BASE
+	hex ""
+	default 0xf03e3400

Why don't you get those from the Device Tree blob that BOLT passes?

Quoted 26 lines
arch/arm/Kconfig +26 -0
+
+config CMD_FDT_MAX_DUMP
+	int ""
+	default 256
+
+config GENERIC_MMC
+	bool ""
+	default y
+
+config MMC_SDMA
+	bool ""
+	default y
+
+config SDHCI
+	bool ""
+	default y
+
+config SYS_BCMSTB_SPI_WAIT
+	int ""
+	default 10
+
+config SYS_FDT_SAVE_ADDRESS
+	hex ""
+	default 0x1f00000
+
+config SYS_NO_FLASH

arch/arm/Kconfig

Quoted 10 lines
arch/arm/Kconfig +10 -0
+	bool ""
+	default y
+
+config TIMER_FREQUENCY_REGISTER_ADDRESS
+	hex ""
+	default 0xf0412020
+
+config TIMER_LOW_REGISTER_ADDRESS
+	hex ""
+	default 0xf0412008

All of these physical address ares not going to change given a 7445-based design, so why not hard code them in a header file unless you are keen on taking them from the passed Device Tree blob from BOLT?

arch/arm/Kconfig

Quoted 10 lines
arch/arm/Kconfig +10 -0
+int dram_init_banksize(void)
+{
+	bd_t *bd = gd->bd;
+
+	bd->bi_dram[0].start = 0x00000000;
+	bd->bi_dram[0].size  = 0x40000000;
+	bd->bi_dram[1].start = 0x40000000;
+	bd->bi_dram[1].size  = 0x40000000;
+	bd->bi_dram[2].start = 0x80000000;
+	bd->bi_dram[2].size  = 0x40000000;

This may be true for your system if you have 3x1GB populated, but 7445 supports additional extension regions, so this must be configurable if you want to make this flexible enough for other people to use it.

arch/arm/Kconfig

Quoted 9 lines
arch/arm/Kconfig +9 -0
+/* Copied from stblinux, include/linux/brcmstb/brcmstb.h. */
+#define DEV_RD(x) (readl((x)))
+#define DEV_WR(x, y) do { writel((y), (x)); } while (0)
+#define DEV_UNSET(x, y) do { DEV_WR((x), DEV_RD(x) & ~(y)); } while (0)
+#define DEV_SET(x, y) do { DEV_WR((x), DEV_RD(x) | (y)); } while (0)
+
+#define DEV_WR_RB(x, y) do { DEV_WR((x), (y)); DEV_RD(x); } while (0)
+#define DEV_SET_RB(x, y) do { DEV_SET((x), (y)); DEV_RD(x); } while (0)
+#define DEV_UNSET_RB(x, y) do { DEV_UNSET((x), (y)); DEV_RD(x); } while (0)

I would just flat out drop those macros and instead use standard accessors. Those happen to work just fine given Broadcom STB's GISB bus, but if you want portable drivers in u-boot, and you likely would want those, you should use more standard I/O accessors.

Signature · 1 line
Florian
#5 lore raw

PATCH 1/1 board: arm: Add support for Broadcom BCM7445D0

Quoted 27 lines · Florian Fainelli
Quoted 14 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445D0 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

arch/arm/Kconfig +0 -0
index 9bd70f4..b2df30a 100644

arch/arm/Kconfig config TARGET_VEXPRESS_CA15_TC2 · line 506

Quoted 9 lines
arch/arm/Kconfig +6 -0
@@ -498,6 +498,17 @@ config TARGET_VEXPRESS_CA15_TC2
 	select CPU_V7_HAS_VIRT
 	select PL011_SERIAL
 
+config TARGET_BCM7445D0
+	bool "Broadcom 7445D0 TSBL"
+	select CPU_V7
+	select SUPPORT_SPL
+	help
+	  Support for the Broadcom 7445D0 SoC.  This port assumes Bolt

BOLT

Quoted 4 lines

arch/arm/Kconfig config TARGET_VEXPRESS_CA15_TC2 · line 508

Quoted 2 lines
arch/arm/Kconfig +2 -0
+	  is acting as the second stage bootloader, and U-Boot is
+	  acting as the third stage bootloader (TSBL), loaded by Bolt.

again BOLT

Oops, will fix in a v2 patch.

Quoted 8 lines

arch/arm/Kconfig config TARGET_VEXPRESS_CA15_TC2 · line 510

Quoted 2 lines
arch/arm/Kconfig +2 -0
+	  This port may work on other BCM7xxx boards with
+	  configuration changes.

There are other revisions than D0, so I would just name this TARGET_BCM7445. You would likely want to create a TARGET_BRCMSTB general menu which would encompass all ARMv7-A based SoCs from the Broadcom STB/CM division, and then have per-chip Kconfig options (similar to what the older <= 3.14 STB Linux kernels did).

OK, will try this in v2.

Quoted 14 lines
Quoted 14 lines
arch/arm/Kconfig +14 -0
+
+config BCMSTB_ACCOMMODATE_STBLINUX
+	bool ""
+	default y
+	help
+	  This prevents U-Boot from adding memory reservations for the
+          lengths of initramfs and DTB.  Without skipping these,
+          stblinux's "contiguous memory allocator" (CMA) Linux driver
+          (cma_driver) will allocate memory ranges smaller than what
+          are actually available, because it only checks reservation
+          sizes.  It doesn't check if the reserved range overlaps the
+          range it allocates.  stblinux also tries to move the DTB to
+          a lower memory location early in the Linux boot.  If the FIT
+          image specifies a load address for the initramfs then
Quoted 8 lines

arch/arm/Kconfig

Quoted 3 lines
arch/arm/Kconfig +3 -0
+          sometimes the DTB is moved into the range where the
+          initramfs image is loaded.  Defining this will mean that
+          FIT-provided initramfs load addresses are ignored.

What STB Linux kernel did you observe this with? I am afraid this is still true about the ranges vs. allocation even in newer kernels, but that is kind of intented to keep the logic KISS (because it's already too complicated IMHO).

I investigated the allocation discrepancy and wrote the workaround while we were still using stblinux-3.14. Since then we've updated to stblinux-4.1 and I've left the workaround enabled, but I haven't investigated its interactions with the newer bmem mechanism. I should probably revisit this though, with stblinux-4.1 and stblinux-4.9, just to make sure this macro is still useful.

Quoted 6 lines
Quoted 6 lines
arch/arm/Kconfig +6 -0
+
+config BCMSTB_SDHCI
+	bool ""
+	default y
+
+config BCMSTB_SDHCI_BASE
Quoted 8 lines

arch/arm/Kconfig

Quoted 6 lines
arch/arm/Kconfig +6 -0
+	hex ""
+	default 0xf03e0200
+
+config BCMSTB_SPI_BASE
+	hex ""
+	default 0xf03e3400

Why don't you get those from the Device Tree blob that BOLT passes?

During development I did implement that for SDHCI_BASE, so it is possible. But I ended up #ifdef'ing it out and hard-coding the address in production, to keep the runtime logic simpler. Doing DTB traversal in code adds complexity but it may achieve portability to different BCM7xxx SoCs without further code changes, which would be nice.

Quoted 32 lines
Quoted 32 lines
arch/arm/Kconfig +32 -0
+
+config CMD_FDT_MAX_DUMP
+	int ""
+	default 256
+
+config GENERIC_MMC
+	bool ""
+	default y
+
+config MMC_SDMA
+	bool ""
+	default y
+
+config SDHCI
+	bool ""
+	default y
+
+config SYS_BCMSTB_SPI_WAIT
+	int ""
+	default 10
+
+config SYS_FDT_SAVE_ADDRESS
+	hex ""
+	default 0x1f00000
+
+config SYS_NO_FLASH
+	bool ""
+	default y
+
+config TIMER_FREQUENCY_REGISTER_ADDRESS
+	hex ""
+	default 0xf0412020
Quoted 8 lines

arch/arm/Kconfig

Quoted 4 lines
arch/arm/Kconfig +4 -0
+
+config TIMER_LOW_REGISTER_ADDRESS
+	hex ""
+	default 0xf0412008

All of these physical address ares not going to change given a 7445-based design, so why not hard code them in a header file unless you are keen on taking them from the passed Device Tree blob from BOLT?

Agreed, a header file or BOLT DTB lookup for these values would be better. I think for a v2 of the patch, I'll move these to a header file. If I get to adding another BCM7xxx board (I'm looking at BCM7260 right now) then I can revisit BOLT DTB lookups in the context of portability between the two SoCs.

Quoted 6 lines
Quoted 6 lines
arch/arm/Kconfig +6 -0
+int dram_init_banksize(void)
+{
+	bd_t *bd = gd->bd;
+
+	bd->bi_dram[0].start = 0x00000000;
+	bd->bi_dram[0].size  = 0x40000000;
Quoted 8 lines

arch/arm/Kconfig

Quoted 4 lines
arch/arm/Kconfig +4 -0
+	bd->bi_dram[1].start = 0x40000000;
+	bd->bi_dram[1].size  = 0x40000000;
+	bd->bi_dram[2].start = 0x80000000;
+	bd->bi_dram[2].size  = 0x40000000;

This may be true for your system if you have 3x1GB populated, but 7445 supports additional extension regions, so this must be configurable if you want to make this flexible enough for other people to use it.

OK, I'm not familiar with extension regions. Would it be enough to size and initialize bi_dram based on different CONFIG_NR_DRAM_BANKS values?

Quoted 6 lines
Quoted 6 lines
arch/arm/Kconfig +6 -0
+/* Copied from stblinux, include/linux/brcmstb/brcmstb.h. */
+#define DEV_RD(x) (readl((x)))
+#define DEV_WR(x, y) do { writel((y), (x)); } while (0)
+#define DEV_UNSET(x, y) do { DEV_WR((x), DEV_RD(x) & ~(y)); } while (0)
+#define DEV_SET(x, y) do { DEV_WR((x), DEV_RD(x) | (y)); } while (0)
+
Quoted 8 lines

arch/arm/Kconfig

Quoted 3 lines
arch/arm/Kconfig +3 -0
+#define DEV_WR_RB(x, y) do { DEV_WR((x), (y)); DEV_RD(x); } while (0)
+#define DEV_SET_RB(x, y) do { DEV_SET((x), (y)); DEV_RD(x); } while (0)
+#define DEV_UNSET_RB(x, y) do { DEV_UNSET((x), (y)); DEV_RD(x); } while (0)

I would just flat out drop those macros and instead use standard accessors. Those happen to work just fine given Broadcom STB's GISB bus, but if you want portable drivers in u-boot, and you likely would want those, you should use more standard I/O accessors.

OK, I'll look into this.

Thanks for reviewing,
Thomas

#6 lore raw

PATCH 1/1 board: arm: Add support for Broadcom BCM7445D0

Quoted 70 lines · Thomas Fitzsimmons
Quoted 27 lines · Florian Fainelli
Quoted 14 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445D0 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

arch/arm/Kconfig +0 -0
index 9bd70f4..b2df30a 100644

arch/arm/Kconfig config TARGET_VEXPRESS_CA15_TC2 · line 506

Quoted 9 lines
arch/arm/Kconfig +6 -0
@@ -498,6 +498,17 @@ config TARGET_VEXPRESS_CA15_TC2
 	select CPU_V7_HAS_VIRT
 	select PL011_SERIAL
 
+config TARGET_BCM7445D0
+	bool "Broadcom 7445D0 TSBL"
+	select CPU_V7
+	select SUPPORT_SPL
+	help
+	  Support for the Broadcom 7445D0 SoC.  This port assumes Bolt

BOLT

Quoted 4 lines

arch/arm/Kconfig config TARGET_VEXPRESS_CA15_TC2 · line 508

Quoted 2 lines
arch/arm/Kconfig +2 -0
+	  is acting as the second stage bootloader, and U-Boot is
+	  acting as the third stage bootloader (TSBL), loaded by Bolt.

again BOLT

Oops, will fix in a v2 patch.

Quoted 8 lines

arch/arm/Kconfig config TARGET_VEXPRESS_CA15_TC2 · line 510

Quoted 2 lines
arch/arm/Kconfig +2 -0
+	  This port may work on other BCM7xxx boards with
+	  configuration changes.

There are other revisions than D0, so I would just name this TARGET_BCM7445. You would likely want to create a TARGET_BRCMSTB general menu which would encompass all ARMv7-A based SoCs from the Broadcom STB/CM division, and then have per-chip Kconfig options (similar to what the older <= 3.14 STB Linux kernels did).

OK, will try this in v2.

Quoted 14 lines
Quoted 14 lines
arch/arm/Kconfig +14 -0
+
+config BCMSTB_ACCOMMODATE_STBLINUX
+	bool ""
+	default y
+	help
+	  This prevents U-Boot from adding memory reservations for the
+          lengths of initramfs and DTB.  Without skipping these,
+          stblinux's "contiguous memory allocator" (CMA) Linux driver
+          (cma_driver) will allocate memory ranges smaller than what
+          are actually available, because it only checks reservation
+          sizes.  It doesn't check if the reserved range overlaps the
+          range it allocates.  stblinux also tries to move the DTB to
+          a lower memory location early in the Linux boot.  If the FIT
+          image specifies a load address for the initramfs then
Quoted 8 lines

arch/arm/Kconfig

Quoted 3 lines
arch/arm/Kconfig +3 -0
+          sometimes the DTB is moved into the range where the
+          initramfs image is loaded.  Defining this will mean that
+          FIT-provided initramfs load addresses are ignored.

What STB Linux kernel did you observe this with? I am afraid this is still true about the ranges vs. allocation even in newer kernels, but that is kind of intented to keep the logic KISS (because it's already too complicated IMHO).

Quoted 6 lines

I investigated the allocation discrepancy and wrote the workaround while we were still using stblinux-3.14. Since then we've updated to stblinux-4.1 and I've left the workaround enabled, but I haven't investigated its interactions with the newer bmem mechanism. I should probably revisit this though, with stblinux-4.1 and stblinux-4.9, just to make sure this macro is still useful.

Sounds good, let me know if there is something that does not seem quite right, we could fix it.

Quoted 16 lines
Quoted 15 lines

arch/arm/Kconfig

Quoted 13 lines
arch/arm/Kconfig +12 -0
+
+config BCMSTB_SDHCI
+	bool ""
+	default y
+
+config BCMSTB_SDHCI_BASE
+	hex ""
+	default 0xf03e0200
+
+config BCMSTB_SPI_BASE
+	hex ""
+	default 0xf03e3400

Why don't you get those from the Device Tree blob that BOLT passes?

Quoted 5 lines

During development I did implement that for SDHCI_BASE, so it is possible. But I ended up #ifdef'ing it out and hard-coding the address in production, to keep the runtime logic simpler. Doing DTB traversal in code adds complexity but it may achieve portability to different BCM7xxx SoCs without further code changes, which would be nice.

Given what I see with Broadcom STB customers, I don't think there is a strong push for anything other than BOLT, or another proprietary TSBL, so with that, I am not sure about whether there would be an use case for e.g; a single u-boot binary that would run on more than a flavor of a given SoC. I would be inclined to put the different base register addresses into a header file and use those constants in the respective drivers (or even better, in the part of code that does register those).

Quoted 42 lines
Quoted 33 lines
Quoted 33 lines
arch/arm/Kconfig +32 -0
+
+config CMD_FDT_MAX_DUMP
+	int ""
+	default 256
+
+config GENERIC_MMC
+	bool ""
+	default y
+
+config MMC_SDMA
+	bool ""
+	default y
+
+config SDHCI
+	bool ""
+	default y
+
+config SYS_BCMSTB_SPI_WAIT
+	int ""
+	default 10
+
+config SYS_FDT_SAVE_ADDRESS
+	hex ""
+	default 0x1f00000
+
+config SYS_NO_FLASH
+	bool ""
+	default y
+
+config TIMER_FREQUENCY_REGISTER_ADDRESS
+	hex ""
+	default 0xf0412020
Quoted 8 lines

arch/arm/Kconfig

Quoted 4 lines
arch/arm/Kconfig +4 -0
+
+config TIMER_LOW_REGISTER_ADDRESS
+	hex ""
+	default 0xf0412008

All of these physical address ares not going to change given a 7445-based design, so why not hard code them in a header file unless you are keen on taking them from the passed Device Tree blob from BOLT?

Quoted 5 lines

Agreed, a header file or BOLT DTB lookup for these values would be better. I think for a v2 of the patch, I'll move these to a header file. If I get to adding another BCM7xxx board (I'm looking at BCM7260 right now) then I can revisit BOLT DTB lookups in the context of portability between the two SoCs.

Sounds good.

Quoted 16 lines
Quoted 15 lines

arch/arm/Kconfig

Quoted 11 lines
arch/arm/Kconfig +10 -0
+int dram_init_banksize(void)
+{
+	bd_t *bd = gd->bd;
+
+	bd->bi_dram[0].start = 0x00000000;
+	bd->bi_dram[0].size  = 0x40000000;
+	bd->bi_dram[1].start = 0x40000000;
+	bd->bi_dram[1].size  = 0x40000000;
+	bd->bi_dram[2].start = 0x80000000;
+	bd->bi_dram[2].size  = 0x40000000;

This may be true for your system if you have 3x1GB populated, but 7445 supports additional extension regions, so this must be configurable if you want to make this flexible enough for other people to use it.

Quoted 2 lines

OK, I'm not familiar with extension regions. Would it be enough to size and initialize bi_dram based on different CONFIG_NR_DRAM_BANKS values?

Humm, sure that would be a good step forward. This is something that might be best extracted from the Device Tree provided by BOLT because there is a standard memory node's "reg" property being provided.

A possible challenge with u-boot's bi_dram structure is that the extension regions are way above the 4GB PA boundary. As long as you don't need to access those in u-boot, you should be fine with a "standard setup" (short page table descriptors etc.).

Signature · 1 line
Florian
#7 lore raw

PATCH 1/1 board: arm: Add support for Broadcom BCM7445D0

Quoted 4 lines · Florian Fainelli
Quoted 3 lines · Thomas Fitzsimmons
Quoted 1 line · Florian Fainelli

On 05/06/2018 04:09 AM, Thomas Fitzsimmons wrote:

[...]

Quoted 30 lines
Quoted 23 lines
Quoted 14 lines
Quoted 14 lines
board/broadcom/bcm7445d0/Kconfig new file +14 -0
+
+config BCMSTB_ACCOMMODATE_STBLINUX
+	bool ""
+	default y
+	help
+	  This prevents U-Boot from adding memory reservations for the
+          lengths of initramfs and DTB.  Without skipping these,
+          stblinux's "contiguous memory allocator" (CMA) Linux driver
+          (cma_driver) will allocate memory ranges smaller than what
+          are actually available, because it only checks reservation
+          sizes.  It doesn't check if the reserved range overlaps the
+          range it allocates.  stblinux also tries to move the DTB to
+          a lower memory location early in the Linux boot.  If the FIT
+          image specifies a load address for the initramfs then
Quoted 8 lines

board/broadcom/bcm7445d0/Kconfig line 82

Quoted 3 lines
board/broadcom/bcm7445d0/Kconfig new file +3 -0
+          sometimes the DTB is moved into the range where the
+          initramfs image is loaded.  Defining this will mean that
+          FIT-provided initramfs load addresses are ignored.

What STB Linux kernel did you observe this with? I am afraid this is still true about the ranges vs. allocation even in newer kernels, but that is kind of intented to keep the logic KISS (because it's already too complicated IMHO).

Quoted 6 lines

I investigated the allocation discrepancy and wrote the workaround while we were still using stblinux-3.14. Since then we've updated to stblinux-4.1 and I've left the workaround enabled, but I haven't investigated its interactions with the newer bmem mechanism. I should probably revisit this though, with stblinux-4.1 and stblinux-4.9, just to make sure this macro is still useful.

Quoted 2 lines

Sounds good, let me know if there is something that does not seem quite right, we could fix it.

[...]

In the v3 patch, I keep the FIT's RFS and DTB in-place. This approach eliminates the bmem/cma allocation discrepancies. I compared bmem/cma dmesg output for stblinux 3.14, 4.1 and 4.9, zImage and ITB builds, on my eval board, and they're all the same for the same kernel version. The only thing I noticed is that in 3.14 and 4.1 (zImage and ITB), the first bmem region is:

768 MiB at 0x0000000010000000

whereas in 4.9 (zImage and ITB), it is:

760 MiB at 0x0000000010800000

This is booting with no kernel command line arguments, so I guess some default may have changed between stblinux 4.1 and 4.9?

Thomas

#8 lore raw

PATCH 1/1 board: arm: Add support for Broadcom BCM7445D0

Quoted 51 lines · Thomas Fitzsimmons
Quoted 4 lines · Florian Fainelli
Quoted 3 lines · Thomas Fitzsimmons
Quoted 1 line · Florian Fainelli

On 05/06/2018 04:09 AM, Thomas Fitzsimmons wrote:

[...]

Quoted 30 lines
Quoted 23 lines
Quoted 14 lines
Quoted 14 lines
board/broadcom/bcm7445d0/Kconfig new file +14 -0
+
+config BCMSTB_ACCOMMODATE_STBLINUX
+	bool ""
+	default y
+	help
+	  This prevents U-Boot from adding memory reservations for the
+          lengths of initramfs and DTB.  Without skipping these,
+          stblinux's "contiguous memory allocator" (CMA) Linux driver
+          (cma_driver) will allocate memory ranges smaller than what
+          are actually available, because it only checks reservation
+          sizes.  It doesn't check if the reserved range overlaps the
+          range it allocates.  stblinux also tries to move the DTB to
+          a lower memory location early in the Linux boot.  If the FIT
+          image specifies a load address for the initramfs then
Quoted 8 lines

board/broadcom/bcm7445d0/Kconfig line 82

Quoted 3 lines
board/broadcom/bcm7445d0/Kconfig new file +3 -0
+          sometimes the DTB is moved into the range where the
+          initramfs image is loaded.  Defining this will mean that
+          FIT-provided initramfs load addresses are ignored.

What STB Linux kernel did you observe this with? I am afraid this is still true about the ranges vs. allocation even in newer kernels, but that is kind of intented to keep the logic KISS (because it's already too complicated IMHO).

Quoted 6 lines

I investigated the allocation discrepancy and wrote the workaround while we were still using stblinux-3.14. Since then we've updated to stblinux-4.1 and I've left the workaround enabled, but I haven't investigated its interactions with the newer bmem mechanism. I should probably revisit this though, with stblinux-4.1 and stblinux-4.9, just to make sure this macro is still useful.

Quoted 2 lines

Sounds good, let me know if there is something that does not seem quite right, we could fix it.

[...]

In the v3 patch, I keep the FIT's RFS and DTB in-place. This approach eliminates the bmem/cma allocation discrepancies. I compared bmem/cma dmesg output for stblinux 3.14, 4.1 and 4.9, zImage and ITB builds, on my eval board, and they're all the same for the same kernel version. The only thing I noticed is that in 3.14 and 4.1 (zImage and ITB), the first bmem region is:

Quoted 8 lines
   768 MiB at 0x0000000010000000

whereas in 4.9 (zImage and ITB), it is:

   760 MiB at 0x0000000010800000

This is booting with no kernel command line arguments, so I guess some default may have changed between stblinux 4.1 and 4.9?

This upstream commit is responsible for what you see:
6ff0966052c46efb53980b8a1add2e7b49c9f560 ("ARM: 8432/1: move VMALLOC_END from 0xff000000 to 0xff800000") we've backported that change to our 3.14 and 4.1 kernels since then.

Signature · 1 line
Florian
#9 lore raw

v2 cover board: arm: Add support for Broadcom BCM7445

In reply to Thomas Fitzsimmons

Add support for Broadcom BCM7445

Changes for v2:
- Reorganize Kconfig to create ARCH_BCMSTB
- Use generic bcmstb SoC name wherever possible
- Eliminate crt0.S changes by moving relocation logic to bcmstb.c
- Use debug() macro where appropriate
- Read bcmstb_spi register base addresses from prior stage device tree, where possible
- Read bcmstb_sdhci register base address from prior stage DT
- Make timer register addresses configurable
- Fix BOLT typos
- Eliminate CONFIG_BCMSTB_ACCOMMODATE_STBLINUX by keeping FIT initramfs and device tree binary in-place
- Add README.bcm7xxx
- Read memory configuration from prior stage device tree
- Add CONFIG_OF_PRIOR_STAGE support in spi-uclass.c
- Fix issues reported by checkpatch.pl
- Fix issues reported by sparse
- Update some comments and formatting
- Add a MAINTAINERS file

Thomas Fitzsimmons (1):
board: arm: Add support for Broadcom BCM7445

 arch/arm/Kconfig                                |  12 +
 arch/arm/Makefile                               |   1 +
 arch/arm/mach-bcmstb/Kconfig                    |  64 ++++
 arch/arm/mach-bcmstb/Makefile                   |   9 +
 arch/arm/mach-bcmstb/include/mach/gpio.h        |  12 +
 arch/arm/mach-bcmstb/include/mach/hardware.h    |  12 +
 arch/arm/mach-bcmstb/include/mach/prior_stage.h |  31 ++
 arch/arm/mach-bcmstb/include/mach/sdhci.h       |  16 +
 arch/arm/mach-bcmstb/include/mach/timer.h       |  14 +
 arch/arm/mach-bcmstb/lowlevel_init.S            |  22 ++
 board/broadcom/bcmstb/MAINTAINERS               |   6 +
 board/broadcom/bcmstb/Makefile                  |   9 +
 board/broadcom/bcmstb/bcmstb.c                  | 192 +++++++++++
 configs/bcm7445_defconfig                       |  27 ++
 doc/README.bcm7xxx                              | 147 ++++++++
 drivers/mmc/Kconfig                             |  11 +
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  68 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 440 ++++++++++++++++++++++++
 drivers/spi/spi-uclass.c                        |   2 +-
 dts/Kconfig                                     |   7 +
 include/configs/bcmstb.h                        | 189 ++++++++++
 include/fdtdec.h                                |   4 +
 lib/fdtdec.c                                    |   4 +
 26 files changed, 1307 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-bcmstb/Kconfig
 create mode 100644 arch/arm/mach-bcmstb/Makefile
 create mode 100644 arch/arm/mach-bcmstb/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/prior_stage.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/sdhci.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/timer.h
 create mode 100644 arch/arm/mach-bcmstb/lowlevel_init.S
 create mode 100644 board/broadcom/bcmstb/MAINTAINERS
 create mode 100644 board/broadcom/bcmstb/Makefile
 create mode 100644 board/broadcom/bcmstb/bcmstb.c
 create mode 100644 configs/bcm7445_defconfig
 create mode 100644 doc/README.bcm7xxx
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcmstb.h
Signature · 1 line
1.8.3.1
#10 lore raw

PATCH v2 1/1 board: arm: Add support for Broadcom BCM7445

Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Florian Fainelli <[email protected]>

---
Changes for v2:
- Reorganize Kconfig to create ARCH_BCMSTB
- Use generic bcmstb SoC name wherever possible
- Eliminate crt0.S changes by moving relocation logic to bcmstb.c
- Use debug() macro where appropriate
- Read bcmstb_spi register base addresses from prior stage device tree, where possible
- Read bcmstb_sdhci register base address from prior stage DT
- Make timer register addresses configurable
- Fix BOLT typos
- Eliminate CONFIG_BCMSTB_ACCOMMODATE_STBLINUX by keeping FIT initramfs and device tree binary in-place
- Add README.bcm7xxx
- Read memory configuration from prior stage device tree
- Add CONFIG_OF_PRIOR_STAGE support in spi-uclass.c
- Fix issues reported by checkpatch.pl
- Fix issues reported by sparse
- Update some comments and formatting
- Add a MAINTAINERS file

 arch/arm/Kconfig                                |  12 +
 arch/arm/Makefile                               |   1 +
 arch/arm/mach-bcmstb/Kconfig                    |  64 ++++
 arch/arm/mach-bcmstb/Makefile                   |   9 +
 arch/arm/mach-bcmstb/include/mach/gpio.h        |  12 +
 arch/arm/mach-bcmstb/include/mach/hardware.h    |  12 +
 arch/arm/mach-bcmstb/include/mach/prior_stage.h |  31 ++
 arch/arm/mach-bcmstb/include/mach/sdhci.h       |  16 +
 arch/arm/mach-bcmstb/include/mach/timer.h       |  14 +
 arch/arm/mach-bcmstb/lowlevel_init.S            |  22 ++
 board/broadcom/bcmstb/MAINTAINERS               |   6 +
 board/broadcom/bcmstb/Makefile                  |   9 +
 board/broadcom/bcmstb/bcmstb.c                  | 192 +++++++++++
 configs/bcm7445_defconfig                       |  27 ++
 doc/README.bcm7xxx                              | 147 ++++++++
 drivers/mmc/Kconfig                             |  11 +
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  68 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 440 ++++++++++++++++++++++++
 drivers/spi/spi-uclass.c                        |   2 +-
 dts/Kconfig                                     |   7 +
 include/configs/bcmstb.h                        | 189 ++++++++++
 include/fdtdec.h                                |   4 +
 lib/fdtdec.c                                    |   4 +
 26 files changed, 1307 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-bcmstb/Kconfig
 create mode 100644 arch/arm/mach-bcmstb/Makefile
 create mode 100644 arch/arm/mach-bcmstb/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/prior_stage.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/sdhci.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/timer.h
 create mode 100644 arch/arm/mach-bcmstb/lowlevel_init.S
 create mode 100644 board/broadcom/bcmstb/MAINTAINERS
 create mode 100644 board/broadcom/bcmstb/Makefile
 create mode 100644 board/broadcom/bcmstb/bcmstb.c
 create mode 100644 configs/bcm7445_defconfig
 create mode 100644 doc/README.bcm7xxx
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcmstb.h
arch/arm/Kconfig +12 -0
index 9bd70f4..fa3089f 100644
@@ -498,6 +498,16 @@ config TARGET_VEXPRESS_CA15_TC2
 	select CPU_V7_HAS_VIRT
 	select PL011_SERIAL
 
+config ARCH_BCMSTB
+	bool "Broadcom BCM7XXX family"
+	select CPU_V7
+	select DM
+	select OF_CONTROL
+	select OF_PRIOR_STAGE
+	help
+	  This enables support for Broadcom ARM-based set-top box
+	  chipsets, including the 7445 family of chips.
+
 config TARGET_VEXPRESS_CA5X2
 	bool "Support vexpress_ca5x2"
 	select CPU_V7
@@ -1237,6 +1247,8 @@ source "arch/arm/mach-at91/Kconfig"
 
 source "arch/arm/mach-bcm283x/Kconfig"
 
+source "arch/arm/mach-bcmstb/Kconfig"
+
 source "arch/arm/mach-davinci/Kconfig"
 
 source "arch/arm/mach-exynos/Kconfig"
arch/arm/Makefile +1 -0
index 4fa8b38..b0cd152 100644
@@ -53,6 +53,7 @@ PLATFORM_CPPFLAGS += $(arch-y) $(tune-y)
 machine-$(CONFIG_ARCH_ASPEED)		+= aspeed
 machine-$(CONFIG_ARCH_AT91)		+= at91
 machine-$(CONFIG_ARCH_BCM283X)		+= bcm283x
+machine-$(CONFIG_ARCH_BCMSTB)		+= bcmstb
 machine-$(CONFIG_ARCH_DAVINCI)		+= davinci
 machine-$(CONFIG_ARCH_EXYNOS)		+= exynos
 machine-$(CONFIG_ARCH_HIGHBANK)		+= highbank
arch/arm/mach-bcmstb/Kconfig new file +64 -0

64 lines not on this page · raw message

arch/arm/mach-bcmstb/Makefile new file +9 -0
new file mode 100644
index 0000000..2c5da6b
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2018  Cisco Systems, Inc.
+#
+# Author: Thomas Fitzsimmons <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= lowlevel_init.o
arch/arm/mach-bcmstb/include/mach/gpio.h new file +12 -0
new file mode 100644
index 0000000..a1d0d3b
@@ -0,0 +1,12 @@
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _BCMSTB_GPIO_H
+#define _BCMSTB_GPIO_H
+
+#endif /* _BCMSTB_GPIO_H */
arch/arm/mach-bcmstb/include/mach/hardware.h new file +12 -0
new file mode 100644
index 0000000..6b0bbbd
@@ -0,0 +1,12 @@
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _BCMSTB_HARDWARE_H
+#define _BCMSTB_HARDWARE_H
+
+#endif /* _BCMSTB_HARDWARE_H */
arch/arm/mach-bcmstb/include/mach/prior_stage.h new file +31 -0
new file mode 100644
index 0000000..4fa10b0
@@ -0,0 +1,31 @@
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _BCMSTB_PRIOR_STAGE_H
+#define _BCMSTB_PRIOR_STAGE_H
+
+#ifndef __ASSEMBLY__
+
+#include <linux/types.h>
+
+struct bcmstb_boot_parameters {
+	u32 r0;
+	u32 r1;
+	u32 r2;
+	u32 r3;
+	u32 sp;
+	u32 lr;
+};
+
+extern struct bcmstb_boot_parameters bcmstb_boot_parameters;
+
+extern phys_addr_t prior_stage_fdt_address;
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _BCMSTB_PRIOR_STAGE_H */
arch/arm/mach-bcmstb/include/mach/sdhci.h new file +16 -0
new file mode 100644
index 0000000..f3af388
@@ -0,0 +1,16 @@
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _BCMSTB_SDHCI_H
+#define _BCMSTB_SDHCI_H
+
+#include <linux/types.h>
+
+int bcmstb_sdhci_init(phys_addr_t regbase);
+
+#endif /* _BCMSTB_SDHCI_H */
arch/arm/mach-bcmstb/include/mach/timer.h new file +14 -0
new file mode 100644
index 0000000..ca125a4
@@ -0,0 +1,14 @@
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _BCMSTB_TIMER_H
+#define _BCMSTB_TIMER_H
+
+unsigned long timer_read_counter(void);
+
+#endif /* _BCMSTB_TIMER_H */
arch/arm/mach-bcmstb/lowlevel_init.S new file +22 -0
new file mode 100644
index 0000000..1eaac87
@@ -0,0 +1,22 @@
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <linux/linkage.h>
+
+ENTRY(save_boot_params)
+	ldr	r6, =bcmstb_boot_parameters
+	str	r0, [r6, #0]
+	str	r1, [r6, #4]
+	str	r2, [r6, #8]
+	str	r3, [r6, #12]
+	str	sp, [r6, #16]
+	str	lr, [r6, #20]
+	ldr	r6, =prior_stage_fdt_address
+	str	r2, [r6]
+	b	save_boot_params_ret
+ENDPROC(save_boot_params)
board/broadcom/bcmstb/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000..5e23ecd
@@ -0,0 +1,6 @@
+BCM7445 BOARD
+M:	Thomas Fitzsimmons <[email protected]>
+S:	Maintained
+F:	board/broadcom/bcmstb/
+F:	include/configs/bcmstb.h
+F:	configs/bcm7445_defconfig
board/broadcom/bcmstb/Makefile new file +9 -0
new file mode 100644
index 0000000..4f03293
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2018  Cisco Systems, Inc.
+#
+# Author: Thomas Fitzsimmons <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= bcmstb.o
board/broadcom/bcmstb/bcmstb.c new file +192 -0

192 lines not on this page · raw message

configs/bcm7445_defconfig new file +27 -0
new file mode 100644
index 0000000..46dea17
@@ -0,0 +1,27 @@
+CONFIG_ARM=y
+CONFIG_ARCH_BCMSTB=y
+CONFIG_TARGET_BCM7445=y
+CONFIG_USE_PRIVATE_LIBGCC=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_PRIOR_STAGE=y
+CONFIG_DM=y
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI=y
+CONFIG_SPI_FLASH=y
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_BCMSTB_SPI=y
+CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_RSA=y
+CONFIG_BLK=n
+CONFIG_SDHCI=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_BCMSTB=y
+CONFIG_CONS_INDEX=3
+CONFIG_BOOTDELAY=1
+CONFIG_SYS_PROMPT="U-Boot>"
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_TEXT_BASE=0x80100000
+CONFIG_SYS_NS16550_COM3=0xf040ab00
+CONFIG_EFI_LOADER=n
doc/README.bcm7xxx new file +147 -0

147 lines not on this page · raw message

drivers/mmc/Kconfig +11 -0
index 4fa8dd8..c734d18 100644
@@ -364,6 +364,17 @@ config MMC_SDHCI_BCM2835
 
 	  If unsure, say N.
 
+config MMC_SDHCI_BCMSTB
+	tristate "SDHCI support for the BCMSTB SD/MMC Controller"
+	depends on MMC_SDHCI
+	help
+	  This selects the Broadcom set-top box SD/MMC controller.
+
+	  If you have a BCMSTB platform with SD or MMC devices,
+	  say Y here.
+
+	  If unsure, say N.
+
 config MMC_SDHCI_CADENCE
 	bool "SDHCI support for the Cadence SD/SDIO/eMMC controller"
 	depends on BLK && DM_MMC
drivers/mmc/Makefile +1 -0
index cf46c33..14d5ef4 100644
@@ -47,6 +47,7 @@ obj-$(CONFIG_STM32_SDMMC2) += stm32_sdmmc2.o
 obj-$(CONFIG_MMC_SDHCI)			+= sdhci.o
 obj-$(CONFIG_MMC_SDHCI_ATMEL)		+= atmel_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_BCM2835)		+= bcm2835_sdhci.o
+obj-$(CONFIG_MMC_SDHCI_BCMSTB)		+= bcmstb_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_CADENCE)		+= sdhci-cadence.o
 obj-$(CONFIG_MMC_SDHCI_KONA)		+= kona_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_MSM)		+= msm_sdhci.o
drivers/mmc/bcmstb_sdhci.c new file +68 -0

68 lines not on this page · raw message

drivers/spi/Kconfig +7 -0
index 6667f73..e5dccfc 100644
@@ -66,6 +66,13 @@ config BCM63XX_SPI
 	  access the SPI NOR flash on platforms embedding these Broadcom
 	  SPI cores.
 
+config BCMSTB_SPI
+	bool "BCMSTB SPI driver"
+	help
+	  Enable the Broadcom set-top box SPI driver. This driver can
+	  be used to access the SPI flash on platforms embedding this
+	  Broadcom SPI core.
+
 config CADENCE_QSPI
 	bool "Cadence QSPI driver"
 	help
drivers/spi/Makefile +1 -0
index 176bfa0..0f864be 100644
@@ -20,6 +20,7 @@ obj-$(CONFIG_ATH79_SPI) += ath79_spi.o
 obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 obj-$(CONFIG_BCM63XX_HSSPI) += bcm63xx_hsspi.o
 obj-$(CONFIG_BCM63XX_SPI) += bcm63xx_spi.o
+obj-$(CONFIG_BCMSTB_SPI) += bcmstb_spi.o
 obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o
 obj-$(CONFIG_CF_SPI) += cf_spi.o
 obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
drivers/spi/bcmstb_spi.c new file +440 -0

440 lines not on this page · raw message

drivers/spi/spi-uclass.c +1 -1
index 15d90a5..ebb50aa 100644
@@ -274,7 +274,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
 	bool created = false;
 	int ret;
 
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_PLATDATA) || CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
 	ret = uclass_first_device_err(UCLASS_SPI, &bus);
 #else
 	ret = uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus);
dts/Kconfig +7 -0
index 0cef225..a1a92f2 100644
@@ -101,6 +101,13 @@ config OF_HOSTFILE
 	  This is only useful for Sandbox.  Use the -d flag to U-Boot to
 	  specify the file to read.
 
+config OF_PRIOR_STAGE
+	bool "Prior stage bootloader DTB for DT control"
+	help
+	  If this option is enabled, the device tree used for DT
+	  control will be read from a device tree binary, at a memory
+	  location passed to U-Boot by the prior stage bootloader.
+
 endchoice
 
 config DEFAULT_DEVICE_TREE
include/configs/bcmstb.h new file +189 -0

189 lines not on this page · raw message

include/fdtdec.h +4 -0
index 2941a2e..84753e3 100644
@@ -47,6 +47,10 @@ struct fdt_memory {
 #define SPL_BUILD	0
 #endif
 
+#if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
+extern phys_addr_t prior_stage_fdt_address;
+#endif
+
 /*
  * Information about a resource. start is the first address of the resource
  * and end is the last address (inclusive). The length of the resource will
lib/fdtdec.c +4 -0
index 320ee1d..5473a2d 100644
@@ -1323,8 +1323,12 @@ int fdtdec_setup(void)
 # endif
 # ifndef CONFIG_SPL_BUILD
 	/* Allow the early environment to override the fdt address */
+#  if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
+	gd->fdt_blob = (void *)prior_stage_fdt_address;
+#  else
 	gd->fdt_blob = (void *)env_get_ulong("fdtcontroladdr", 16,
 						(uintptr_t)gd->fdt_blob);
+#  endif
 # endif
 
 # if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
Signature · 1 line
1.8.3.1
#11 lore raw

PATCH v2 1/1 board: arm: Add support for Broadcom BCM7445

Quoted 9 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Florian Fainelli <[email protected]>

Please rebase this to master. While I can fixup the SPDX tags (and some formatting issues from checkpatch.pl) I also run in to:
+(bcm7445) In file included from ../arch/arm/include/asm/system.h:6:0,

+(bcm7445)                  from ../arch/arm/include/asm/cache.h:11,
+(bcm7445)                  from ../include/net.h:15,
+(bcm7445)                  from ../include/common.h:519,
+(bcm7445)                  from ../lib/asm-offsets.c:14:

+(bcm7445) ../arch/arm/include/asm/barriers.h:32:24: error: operator '>=' has no left operand +(bcm7445) #if __LINUX_ARM_ARCH__ >= 7
+(bcm7445) ^~
+(bcm7445) ../arch/arm/include/asm/barriers.h:36:26: error: operator '==' has no left operand +(bcm7445) #elif __LINUX_ARM_ARCH__ == 6
+(bcm7445) ^~
+(bcm7445) make[2]: *** [.././Kbuild:44: lib/asm-offsets.s] Error 1
+(bcm7445) make[1]: *** [Makefile:1433: prepare0] Error 2

Please look into, thanks!

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

PATCH v2 1/1 board: arm: Add support for Broadcom BCM7445

Quoted 7 lines · Tom Rini
Quoted 5 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

Quoted 7 lines
Quoted 4 lines
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Florian Fainelli <[email protected]>

Please rebase this to master. While I can fixup the SPDX tags (and some formatting issues from checkpatch.pl)

I think I fixed all of these in v3 (just posted), by adding an entry to top-level MAINTAINERS and using the new SPDX formatting rules.

Quoted 13 lines

I also run in to: +(bcm7445) In file included from ../arch/arm/include/asm/system.h:6:0, +(bcm7445) from ../arch/arm/include/asm/cache.h:11, +(bcm7445) from ../include/net.h:15, +(bcm7445) from ../include/common.h:519, +(bcm7445) from ../lib/asm-offsets.c:14: +(bcm7445) ../arch/arm/include/asm/barriers.h:32:24: error: operator '>=' has no left operand +(bcm7445) #if __LINUX_ARM_ARCH__ >= 7 +(bcm7445) ^~ +(bcm7445) ../arch/arm/include/asm/barriers.h:36:26: error: operator '==' has no left operand +(bcm7445) #elif __LINUX_ARM_ARCH__ == 6 +(bcm7445) ^~ +(bcm7445) make[2]: *** [.././Kbuild:44:
lib/asm-offsets.s] Error 1 +(bcm7445) make[1]: *** [Makefile:1433:
prepare0] Error 2

Quoted 1 line

Please look into, thanks!

This was caused by a Kconfig option being renamed on master (CPU_V7 to CPU_V7A). Fixed in v3.

Thanks,
Thomas

#13 lore raw

v3 cover board: arm: Add support for Broadcom BCM7445

In reply to Thomas Fitzsimmons

Add support for Broadcom BCM7445

Changes for v3:
- Rebase to master
- Add "ARM BROADCOM BCMSTB" entry to top-level MAINTAINERS
- Fix SPDX formatting
- In Kconfig use CPU_V7A, not CPU_V7, per acf15001...

Thomas Fitzsimmons (1):
board: arm: Add support for Broadcom BCM7445

 MAINTAINERS                                     |  10 +
 arch/arm/Kconfig                                |  12 +
 arch/arm/Makefile                               |   1 +
 arch/arm/mach-bcmstb/Kconfig                    |  64 ++++
 arch/arm/mach-bcmstb/Makefile                   |   8 +
 arch/arm/mach-bcmstb/include/mach/gpio.h        |  11 +
 arch/arm/mach-bcmstb/include/mach/hardware.h    |  11 +
 arch/arm/mach-bcmstb/include/mach/prior_stage.h |  30 ++
 arch/arm/mach-bcmstb/include/mach/sdhci.h       |  15 +
 arch/arm/mach-bcmstb/include/mach/timer.h       |  13 +
 arch/arm/mach-bcmstb/lowlevel_init.S            |  21 ++
 board/broadcom/bcmstb/MAINTAINERS               |   6 +
 board/broadcom/bcmstb/Makefile                  |   8 +
 board/broadcom/bcmstb/bcmstb.c                  | 191 +++++++++++
 configs/bcm7445_defconfig                       |  27 ++
 doc/README.bcm7xxx                              | 147 ++++++++
 drivers/mmc/Kconfig                             |  11 +
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  67 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 439 ++++++++++++++++++++++++
 drivers/spi/spi-uclass.c                        |   2 +-
 dts/Kconfig                                     |   7 +
 include/configs/bcmstb.h                        | 188 ++++++++++
 include/fdtdec.h                                |   4 +
 lib/fdtdec.c                                    |   4 +
 27 files changed, 1305 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-bcmstb/Kconfig
 create mode 100644 arch/arm/mach-bcmstb/Makefile
 create mode 100644 arch/arm/mach-bcmstb/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/prior_stage.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/sdhci.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/timer.h
 create mode 100644 arch/arm/mach-bcmstb/lowlevel_init.S
 create mode 100644 board/broadcom/bcmstb/MAINTAINERS
 create mode 100644 board/broadcom/bcmstb/Makefile
 create mode 100644 board/broadcom/bcmstb/bcmstb.c
 create mode 100644 configs/bcm7445_defconfig
 create mode 100644 doc/README.bcm7xxx
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcmstb.h
Signature · 1 line
1.8.3.1
#14 lore raw

PATCH v3 1/1 board: arm: Add support for Broadcom BCM7445

Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Florian Fainelli <[email protected]>

---
Changes for v3:
- Rebase to master
- Add "ARM BROADCOM BCMSTB" entry to top-level MAINTAINERS
- Fix SPDX formatting
- In Kconfig use CPU_V7A, not CPU_V7, per acf15001...

 MAINTAINERS                                     |  10 +
 arch/arm/Kconfig                                |  12 +
 arch/arm/Makefile                               |   1 +
 arch/arm/mach-bcmstb/Kconfig                    |  64 ++++
 arch/arm/mach-bcmstb/Makefile                   |   8 +
 arch/arm/mach-bcmstb/include/mach/gpio.h        |  11 +
 arch/arm/mach-bcmstb/include/mach/hardware.h    |  11 +
 arch/arm/mach-bcmstb/include/mach/prior_stage.h |  30 ++
 arch/arm/mach-bcmstb/include/mach/sdhci.h       |  15 +
 arch/arm/mach-bcmstb/include/mach/timer.h       |  13 +
 arch/arm/mach-bcmstb/lowlevel_init.S            |  21 ++
 board/broadcom/bcmstb/MAINTAINERS               |   6 +
 board/broadcom/bcmstb/Makefile                  |   8 +
 board/broadcom/bcmstb/bcmstb.c                  | 191 +++++++++++
 configs/bcm7445_defconfig                       |  27 ++
 doc/README.bcm7xxx                              | 147 ++++++++
 drivers/mmc/Kconfig                             |  11 +
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  67 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 439 ++++++++++++++++++++++++
 drivers/spi/spi-uclass.c                        |   2 +-
 dts/Kconfig                                     |   7 +
 include/configs/bcmstb.h                        | 188 ++++++++++
 include/fdtdec.h                                |   4 +
 lib/fdtdec.c                                    |   4 +
 27 files changed, 1305 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-bcmstb/Kconfig
 create mode 100644 arch/arm/mach-bcmstb/Makefile
 create mode 100644 arch/arm/mach-bcmstb/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/prior_stage.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/sdhci.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/timer.h
 create mode 100644 arch/arm/mach-bcmstb/lowlevel_init.S
 create mode 100644 board/broadcom/bcmstb/MAINTAINERS
 create mode 100644 board/broadcom/bcmstb/Makefile
 create mode 100644 board/broadcom/bcmstb/bcmstb.c
 create mode 100644 configs/bcm7445_defconfig
 create mode 100644 doc/README.bcm7xxx
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcmstb.h
MAINTAINERS +10 -0
index 642c448..58634fc 100644
@@ -107,6 +107,16 @@ F:	drivers/video/bcm2835.c
 F:	include/dm/platform_data/serial_bcm283x_mu.h
 F:	drivers/pinctrl/broadcom/
 
+ARM BROADCOM BCMSTB
+M:	Thomas Fitzsimmons <[email protected]>
+S:	Maintained
+F:	arch/arm/mach-bcmstb/
+F:	board/broadcom/bcmstb/
+F:	configs/bcm7445_defconfig
+F:	doc/README.bcm7xxx
+F:	drivers/mmc/bcmstb_sdhci.c
+F:	drivers/spi/bcmstb_spi.c
+
 ARM FREESCALE IMX
 M:	Stefano Babic <[email protected]>
 M:	Fabio Estevam <[email protected]>
arch/arm/Kconfig +12 -0
index dde422b..fa2001b 100644
@@ -533,6 +533,16 @@ config TARGET_VEXPRESS_CA15_TC2
 	select CPU_V7_HAS_VIRT
 	select PL011_SERIAL
 
+config ARCH_BCMSTB
+	bool "Broadcom BCM7XXX family"
+	select CPU_V7A
+	select DM
+	select OF_CONTROL
+	select OF_PRIOR_STAGE
+	help
+	  This enables support for Broadcom ARM-based set-top box
+	  chipsets, including the 7445 family of chips.
+
 config TARGET_VEXPRESS_CA5X2
 	bool "Support vexpress_ca5x2"
 	select CPU_V7A
@@ -1297,6 +1307,8 @@ source "arch/arm/mach-at91/Kconfig"
 
 source "arch/arm/mach-bcm283x/Kconfig"
 
+source "arch/arm/mach-bcmstb/Kconfig"
+
 source "arch/arm/mach-davinci/Kconfig"
 
 source "arch/arm/mach-exynos/Kconfig"
arch/arm/Makefile +1 -0
index 680c6e8..03252fe 100644
@@ -54,6 +54,7 @@ PLATFORM_CPPFLAGS += $(arch-y) $(tune-y)
 machine-$(CONFIG_ARCH_ASPEED)		+= aspeed
 machine-$(CONFIG_ARCH_AT91)		+= at91
 machine-$(CONFIG_ARCH_BCM283X)		+= bcm283x
+machine-$(CONFIG_ARCH_BCMSTB)		+= bcmstb
 machine-$(CONFIG_ARCH_DAVINCI)		+= davinci
 machine-$(CONFIG_ARCH_EXYNOS)		+= exynos
 machine-$(CONFIG_ARCH_HIGHBANK)		+= highbank
arch/arm/mach-bcmstb/Kconfig new file +64 -0

64 lines not on this page · raw message

arch/arm/mach-bcmstb/Makefile new file +8 -0
new file mode 100644
index 0000000..71e5727
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2018  Cisco Systems, Inc.
+#
+# Author: Thomas Fitzsimmons <[email protected]>
+#
+
+obj-y	:= lowlevel_init.o
arch/arm/mach-bcmstb/include/mach/gpio.h new file +11 -0
new file mode 100644
index 0000000..bffecf9
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ */
+
+#ifndef _BCMSTB_GPIO_H
+#define _BCMSTB_GPIO_H
+
+#endif /* _BCMSTB_GPIO_H */
arch/arm/mach-bcmstb/include/mach/hardware.h new file +11 -0
new file mode 100644
index 0000000..76f799d
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ */
+
+#ifndef _BCMSTB_HARDWARE_H
+#define _BCMSTB_HARDWARE_H
+
+#endif /* _BCMSTB_HARDWARE_H */
arch/arm/mach-bcmstb/include/mach/prior_stage.h new file +30 -0
new file mode 100644
index 0000000..6c36c68
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ */
+
+#ifndef _BCMSTB_PRIOR_STAGE_H
+#define _BCMSTB_PRIOR_STAGE_H
+
+#ifndef __ASSEMBLY__
+
+#include <linux/types.h>
+
+struct bcmstb_boot_parameters {
+	u32 r0;
+	u32 r1;
+	u32 r2;
+	u32 r3;
+	u32 sp;
+	u32 lr;
+};
+
+extern struct bcmstb_boot_parameters bcmstb_boot_parameters;
+
+extern phys_addr_t prior_stage_fdt_address;
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _BCMSTB_PRIOR_STAGE_H */
arch/arm/mach-bcmstb/include/mach/sdhci.h new file +15 -0
new file mode 100644
index 0000000..243783d
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ */
+
+#ifndef _BCMSTB_SDHCI_H
+#define _BCMSTB_SDHCI_H
+
+#include <linux/types.h>
+
+int bcmstb_sdhci_init(phys_addr_t regbase);
+
+#endif /* _BCMSTB_SDHCI_H */
arch/arm/mach-bcmstb/include/mach/timer.h new file +13 -0
new file mode 100644
index 0000000..d05b4d6
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ */
+
+#ifndef _BCMSTB_TIMER_H
+#define _BCMSTB_TIMER_H
+
+unsigned long timer_read_counter(void);
+
+#endif /* _BCMSTB_TIMER_H */
arch/arm/mach-bcmstb/lowlevel_init.S new file +21 -0
new file mode 100644
index 0000000..aa81f70
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ */
+
+#include <linux/linkage.h>
+
+ENTRY(save_boot_params)
+	ldr	r6, =bcmstb_boot_parameters
+	str	r0, [r6, #0]
+	str	r1, [r6, #4]
+	str	r2, [r6, #8]
+	str	r3, [r6, #12]
+	str	sp, [r6, #16]
+	str	lr, [r6, #20]
+	ldr	r6, =prior_stage_fdt_address
+	str	r2, [r6]
+	b	save_boot_params_ret
+ENDPROC(save_boot_params)
board/broadcom/bcmstb/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000..5e23ecd
@@ -0,0 +1,6 @@
+BCM7445 BOARD
+M:	Thomas Fitzsimmons <[email protected]>
+S:	Maintained
+F:	board/broadcom/bcmstb/
+F:	include/configs/bcmstb.h
+F:	configs/bcm7445_defconfig
board/broadcom/bcmstb/Makefile new file +8 -0
new file mode 100644
index 0000000..9609887
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2018  Cisco Systems, Inc.
+#
+# Author: Thomas Fitzsimmons <[email protected]>
+#
+
+obj-y	:= bcmstb.o
board/broadcom/bcmstb/bcmstb.c new file +191 -0

191 lines not on this page · raw message

configs/bcm7445_defconfig new file +27 -0
new file mode 100644
index 0000000..46dea17
@@ -0,0 +1,27 @@
+CONFIG_ARM=y
+CONFIG_ARCH_BCMSTB=y
+CONFIG_TARGET_BCM7445=y
+CONFIG_USE_PRIVATE_LIBGCC=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_PRIOR_STAGE=y
+CONFIG_DM=y
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI=y
+CONFIG_SPI_FLASH=y
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_BCMSTB_SPI=y
+CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_RSA=y
+CONFIG_BLK=n
+CONFIG_SDHCI=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_BCMSTB=y
+CONFIG_CONS_INDEX=3
+CONFIG_BOOTDELAY=1
+CONFIG_SYS_PROMPT="U-Boot>"
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_TEXT_BASE=0x80100000
+CONFIG_SYS_NS16550_COM3=0xf040ab00
+CONFIG_EFI_LOADER=n
doc/README.bcm7xxx new file +147 -0

147 lines not on this page · raw message

drivers/mmc/Kconfig +11 -0
index 693b3ce..377b1c4 100644
@@ -379,6 +379,17 @@ config MMC_SDHCI_BCM2835
 
 	  If unsure, say N.
 
+config MMC_SDHCI_BCMSTB
+	tristate "SDHCI support for the BCMSTB SD/MMC Controller"
+	depends on MMC_SDHCI
+	help
+	  This selects the Broadcom set-top box SD/MMC controller.
+
+	  If you have a BCMSTB platform with SD or MMC devices,
+	  say Y here.
+
+	  If unsure, say N.
+
 config MMC_SDHCI_CADENCE
 	bool "SDHCI support for the Cadence SD/SDIO/eMMC controller"
 	depends on BLK && DM_MMC
drivers/mmc/Makefile +1 -0
index 3a9805d..f619186 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_STM32_SDMMC2) += stm32_sdmmc2.o
 obj-$(CONFIG_MMC_SDHCI)			+= sdhci.o
 obj-$(CONFIG_MMC_SDHCI_ATMEL)		+= atmel_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_BCM2835)		+= bcm2835_sdhci.o
+obj-$(CONFIG_MMC_SDHCI_BCMSTB)		+= bcmstb_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_CADENCE)		+= sdhci-cadence.o
 obj-$(CONFIG_MMC_SDHCI_KONA)		+= kona_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_MSM)		+= msm_sdhci.o
drivers/mmc/bcmstb_sdhci.c new file +67 -0

67 lines not on this page · raw message

drivers/spi/Kconfig +7 -0
index 3532c2a..f5960a7 100644
@@ -66,6 +66,13 @@ config BCM63XX_SPI
 	  access the SPI NOR flash on platforms embedding these Broadcom
 	  SPI cores.
 
+config BCMSTB_SPI
+	bool "BCMSTB SPI driver"
+	help
+	  Enable the Broadcom set-top box SPI driver. This driver can
+	  be used to access the SPI flash on platforms embedding this
+	  Broadcom SPI core.
+
 config CADENCE_QSPI
 	bool "Cadence QSPI driver"
 	help
drivers/spi/Makefile +1 -0
index 5a2c00e..e73b0cd 100644
@@ -18,6 +18,7 @@ obj-$(CONFIG_ATH79_SPI) += ath79_spi.o
 obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 obj-$(CONFIG_BCM63XX_HSSPI) += bcm63xx_hsspi.o
 obj-$(CONFIG_BCM63XX_SPI) += bcm63xx_spi.o
+obj-$(CONFIG_BCMSTB_SPI) += bcmstb_spi.o
 obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o
 obj-$(CONFIG_CF_SPI) += cf_spi.o
 obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
drivers/spi/bcmstb_spi.c new file +439 -0

439 lines not on this page · raw message

drivers/spi/spi-uclass.c +1 -1
index d2d091f..c517d06 100644
@@ -273,7 +273,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
 	bool created = false;
 	int ret;
 
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_PLATDATA) || CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
 	ret = uclass_first_device_err(UCLASS_SPI, &bus);
 #else
 	ret = uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus);
dts/Kconfig +7 -0
index 0cef225..a1a92f2 100644
@@ -101,6 +101,13 @@ config OF_HOSTFILE
 	  This is only useful for Sandbox.  Use the -d flag to U-Boot to
 	  specify the file to read.
 
+config OF_PRIOR_STAGE
+	bool "Prior stage bootloader DTB for DT control"
+	help
+	  If this option is enabled, the device tree used for DT
+	  control will be read from a device tree binary, at a memory
+	  location passed to U-Boot by the prior stage bootloader.
+
 endchoice
 
 config DEFAULT_DEVICE_TREE
include/configs/bcmstb.h new file +188 -0

188 lines not on this page · raw message

include/fdtdec.h +4 -0
index c15b2a0..ff1c5f5 100644
@@ -47,6 +47,10 @@ struct fdt_memory {
 #define SPL_BUILD	0
 #endif
 
+#if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
+extern phys_addr_t prior_stage_fdt_address;
+#endif
+
 /*
  * Information about a resource. start is the first address of the resource
  * and end is the last address (inclusive). The length of the resource will
lib/fdtdec.c +4 -0
index f4e8dbf..b29b283 100644
@@ -1323,8 +1323,12 @@ int fdtdec_setup(void)
 # endif
 # ifndef CONFIG_SPL_BUILD
 	/* Allow the early environment to override the fdt address */
+#  if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
+	gd->fdt_blob = (void *)prior_stage_fdt_address;
+#  else
 	gd->fdt_blob = (void *)env_get_ulong("fdtcontroladdr", 16,
 						(uintptr_t)gd->fdt_blob);
+#  endif
 # endif
 
 # if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
Signature · 1 line
1.8.3.1
#15 lore raw

PATCH v3 1/1 board: arm: Add support for Broadcom BCM7445

Quoted 10 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Florian Fainelli <[email protected]>

---

Looks good, still some minor comments about the choice of representation for physical addresses of peripherals, see below.

arch/arm/mach-bcmstb/Kconfig line 42

Quoted 3 lines
arch/arm/mach-bcmstb/Kconfig new file +3 -0
+config BCMSTB_TIMER_LOW
+	hex "Address of BCMSTB timer low register"
+	default 0xf0412008

This looks very simplistic here since the CPU system control timer is a 64-bit timer.

I am really not a big fan of all of those configurable addresses which are a) fixed given a specific SoC family (7445, 7439 etc.) and b) are error prone because we let an user change those without necessarily knowing what is the implication. I really think sticking those constants into a header file would be much more appropriate.

board/broadcom/bcmstb/bcmstb.c line 80

Quoted 7 lines
board/broadcom/bcmstb/bcmstb.c new file +7 -0
+void enable_caches(void)
+{
+	/*
+	 * Nothing required here, since the prior stage bootloader has
+	 * enabled I-cache and D-cache already.  Implementing this
+	 * function silences the warning in the default function.
+	 */

This heavily depends on how you load your binary from BOLT, so you must be careful about this statement here.

Signature · 1 line
Florian
#16 lore raw

PATCH v3 1/1 board: arm: Add support for Broadcom BCM7445

Quoted 15 lines · Florian Fainelli
Quoted 10 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Florian Fainelli <[email protected]>

---

Looks good, still some minor comments about the choice of representation for physical addresses of peripherals, see below.

Quoted 6 lines

arch/arm/mach-bcmstb/Kconfig line 42

Quoted 3 lines
arch/arm/mach-bcmstb/Kconfig new file +3 -0
+config BCMSTB_TIMER_LOW
+	hex "Address of BCMSTB timer low register"
+	default 0xf0412008

This looks very simplistic here since the CPU system control timer is a 64-bit timer.

This worked via the default get_ticks implementation in lib/time.c, which tracks rollovers and converts to a 64-bit value. But I agree it's better to use the high timer register, so that (among other reasons) get_ticks reflects total uptime including time spent in BOLT. I overrode get_ticks in v4 of the patch to use the high and low timer registers.

Quoted 5 lines

I am really not a big fan of all of those configurable addresses which are a) fixed given a specific SoC family (7445, 7439 etc.) and b) are error prone because we let an user change those without necessarily knowing what is the implication. I really think sticking those constants into a header file would be much more appropriate.

Makes sense, moved to a 7445-specific header in v4.

Quoted 10 lines

board/broadcom/bcmstb/bcmstb.c line 80

Quoted 7 lines
board/broadcom/bcmstb/bcmstb.c new file +7 -0
+void enable_caches(void)
+{
+	/*
+	 * Nothing required here, since the prior stage bootloader has
+	 * enabled I-cache and D-cache already.  Implementing this
+	 * function silences the warning in the default function.
+	 */

This heavily depends on how you load your binary from BOLT, so you must be careful about this statement here.

In v4 I adjusted the comment and added an entry to the README to document the expectation.

Thanks,
Thomas

#17 lore raw

v4 cover board: arm: Add support for Broadcom BCM7445

In reply to Thomas Fitzsimmons

Add support for Broadcom BCM7445

Changes for v4:
- Use high timer register for get_ticks
- Move hard-coded register addresses from Kconfig to header
- Document I-cache/D-cache expectation

Thomas Fitzsimmons (1):
board: arm: Add support for Broadcom BCM7445

 MAINTAINERS                                     |  10 +
 arch/arm/Kconfig                                |  12 +
 arch/arm/Makefile                               |   1 +
 arch/arm/mach-bcmstb/Kconfig                    |  36 ++
 arch/arm/mach-bcmstb/Makefile                   |   8 +
 arch/arm/mach-bcmstb/include/mach/gpio.h        |  11 +
 arch/arm/mach-bcmstb/include/mach/hardware.h    |  11 +
 arch/arm/mach-bcmstb/include/mach/prior_stage.h |  30 ++
 arch/arm/mach-bcmstb/include/mach/sdhci.h       |  15 +
 arch/arm/mach-bcmstb/include/mach/timer.h       |  13 +
 arch/arm/mach-bcmstb/lowlevel_init.S            |  21 ++
 board/broadcom/bcmstb/MAINTAINERS               |   7 +
 board/broadcom/bcmstb/Makefile                  |   8 +
 board/broadcom/bcmstb/bcmstb.c                  | 194 +++++++++++
 configs/bcm7445_defconfig                       |  27 ++
 doc/README.bcm7xxx                              | 150 ++++++++
 drivers/mmc/Kconfig                             |  11 +
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  67 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 439 ++++++++++++++++++++++++
 drivers/spi/spi-uclass.c                        |   2 +-
 dts/Kconfig                                     |   7 +
 include/configs/bcm7445.h                       |  26 ++
 include/configs/bcmstb.h                        | 183 ++++++++++
 include/fdtdec.h                                |   4 +
 lib/fdtdec.c                                    |   4 +
 28 files changed, 1305 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-bcmstb/Kconfig
 create mode 100644 arch/arm/mach-bcmstb/Makefile
 create mode 100644 arch/arm/mach-bcmstb/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/prior_stage.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/sdhci.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/timer.h
 create mode 100644 arch/arm/mach-bcmstb/lowlevel_init.S
 create mode 100644 board/broadcom/bcmstb/MAINTAINERS
 create mode 100644 board/broadcom/bcmstb/Makefile
 create mode 100644 board/broadcom/bcmstb/bcmstb.c
 create mode 100644 configs/bcm7445_defconfig
 create mode 100644 doc/README.bcm7xxx
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcm7445.h
 create mode 100644 include/configs/bcmstb.h
Signature · 1 line
1.8.3.1
#18 lore raw

PATCH v4 1/1 board: arm: Add support for Broadcom BCM7445

Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Florian Fainelli <[email protected]>

---
Changes for v4:
- Use high timer register for get_ticks
- Move hard-coded register addresses from Kconfig to header
- Document I-cache/D-cache expectation

 MAINTAINERS                                     |  10 +
 arch/arm/Kconfig                                |  12 +
 arch/arm/Makefile                               |   1 +
 arch/arm/mach-bcmstb/Kconfig                    |  36 ++
 arch/arm/mach-bcmstb/Makefile                   |   8 +
 arch/arm/mach-bcmstb/include/mach/gpio.h        |  11 +
 arch/arm/mach-bcmstb/include/mach/hardware.h    |  11 +
 arch/arm/mach-bcmstb/include/mach/prior_stage.h |  30 ++
 arch/arm/mach-bcmstb/include/mach/sdhci.h       |  15 +
 arch/arm/mach-bcmstb/include/mach/timer.h       |  13 +
 arch/arm/mach-bcmstb/lowlevel_init.S            |  21 ++
 board/broadcom/bcmstb/MAINTAINERS               |   7 +
 board/broadcom/bcmstb/Makefile                  |   8 +
 board/broadcom/bcmstb/bcmstb.c                  | 194 +++++++++++
 configs/bcm7445_defconfig                       |  27 ++
 doc/README.bcm7xxx                              | 150 ++++++++
 drivers/mmc/Kconfig                             |  11 +
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  67 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 439 ++++++++++++++++++++++++
 drivers/spi/spi-uclass.c                        |   2 +-
 dts/Kconfig                                     |   7 +
 include/configs/bcm7445.h                       |  26 ++
 include/configs/bcmstb.h                        | 183 ++++++++++
 include/fdtdec.h                                |   4 +
 lib/fdtdec.c                                    |   4 +
 28 files changed, 1305 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-bcmstb/Kconfig
 create mode 100644 arch/arm/mach-bcmstb/Makefile
 create mode 100644 arch/arm/mach-bcmstb/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/prior_stage.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/sdhci.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/timer.h
 create mode 100644 arch/arm/mach-bcmstb/lowlevel_init.S
 create mode 100644 board/broadcom/bcmstb/MAINTAINERS
 create mode 100644 board/broadcom/bcmstb/Makefile
 create mode 100644 board/broadcom/bcmstb/bcmstb.c
 create mode 100644 configs/bcm7445_defconfig
 create mode 100644 doc/README.bcm7xxx
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcm7445.h
 create mode 100644 include/configs/bcmstb.h
MAINTAINERS +10 -0
index 642c448..58634fc 100644
@@ -107,6 +107,16 @@ F:	drivers/video/bcm2835.c
 F:	include/dm/platform_data/serial_bcm283x_mu.h
 F:	drivers/pinctrl/broadcom/
 
+ARM BROADCOM BCMSTB
+M:	Thomas Fitzsimmons <[email protected]>
+S:	Maintained
+F:	arch/arm/mach-bcmstb/
+F:	board/broadcom/bcmstb/
+F:	configs/bcm7445_defconfig
+F:	doc/README.bcm7xxx
+F:	drivers/mmc/bcmstb_sdhci.c
+F:	drivers/spi/bcmstb_spi.c
+
 ARM FREESCALE IMX
 M:	Stefano Babic <[email protected]>
 M:	Fabio Estevam <[email protected]>
arch/arm/Kconfig +12 -0
index dde422b..fa2001b 100644
@@ -533,6 +533,16 @@ config TARGET_VEXPRESS_CA15_TC2
 	select CPU_V7_HAS_VIRT
 	select PL011_SERIAL
 
+config ARCH_BCMSTB
+	bool "Broadcom BCM7XXX family"
+	select CPU_V7A
+	select DM
+	select OF_CONTROL
+	select OF_PRIOR_STAGE
+	help
+	  This enables support for Broadcom ARM-based set-top box
+	  chipsets, including the 7445 family of chips.
+
 config TARGET_VEXPRESS_CA5X2
 	bool "Support vexpress_ca5x2"
 	select CPU_V7A
@@ -1297,6 +1307,8 @@ source "arch/arm/mach-at91/Kconfig"
 
 source "arch/arm/mach-bcm283x/Kconfig"
 
+source "arch/arm/mach-bcmstb/Kconfig"
+
 source "arch/arm/mach-davinci/Kconfig"
 
 source "arch/arm/mach-exynos/Kconfig"
arch/arm/Makefile +1 -0
index 680c6e8..03252fe 100644
@@ -54,6 +54,7 @@ PLATFORM_CPPFLAGS += $(arch-y) $(tune-y)
 machine-$(CONFIG_ARCH_ASPEED)		+= aspeed
 machine-$(CONFIG_ARCH_AT91)		+= at91
 machine-$(CONFIG_ARCH_BCM283X)		+= bcm283x
+machine-$(CONFIG_ARCH_BCMSTB)		+= bcmstb
 machine-$(CONFIG_ARCH_DAVINCI)		+= davinci
 machine-$(CONFIG_ARCH_EXYNOS)		+= exynos
 machine-$(CONFIG_ARCH_HIGHBANK)		+= highbank
arch/arm/mach-bcmstb/Kconfig new file +36 -0
new file mode 100644
index 0000000..6c7952f
@@ -0,0 +1,36 @@
+if ARCH_BCMSTB
+
+config TARGET_BCM7445
+	bool "Broadcom 7445 TSBL"
+	depends on ARCH_BCMSTB
+	help
+	  Support for the Broadcom 7445 SoC.  This port assumes BOLT
+	  is acting as the second stage bootloader, and U-Boot is
+	  acting as the third stage bootloader (TSBL), loaded by BOLT.
+	  This port may work on other BCM7xxx boards with
+	  configuration changes.
+
+config SYS_CPU
+	default "armv7"
+
+config SYS_BOARD
+	default "bcmstb"
+
+config SYS_VENDOR
+	default "broadcom"
+
+config SYS_SOC
+	default "bcmstb"
+
+config SYS_CONFIG_NAME
+	default "bcm7445"
+
+config SYS_FDT_SAVE_ADDRESS
+	hex "Address to which the prior stage provided DTB will be copied"
+	default 0x1f00000
+
+config BCMSTB_SDHCI_INDEX
+	int "Index of preferred BCMSTB SDHCI alias in DTB"
+	default 1
+
+endif
arch/arm/mach-bcmstb/Makefile new file +8 -0
new file mode 100644
index 0000000..71e5727
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2018  Cisco Systems, Inc.
+#
+# Author: Thomas Fitzsimmons <[email protected]>
+#
+
+obj-y	:= lowlevel_init.o
arch/arm/mach-bcmstb/include/mach/gpio.h new file +11 -0
new file mode 100644
index 0000000..bffecf9
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ */
+
+#ifndef _BCMSTB_GPIO_H
+#define _BCMSTB_GPIO_H
+
+#endif /* _BCMSTB_GPIO_H */
arch/arm/mach-bcmstb/include/mach/hardware.h new file +11 -0
new file mode 100644
index 0000000..76f799d
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ */
+
+#ifndef _BCMSTB_HARDWARE_H
+#define _BCMSTB_HARDWARE_H
+
+#endif /* _BCMSTB_HARDWARE_H */
arch/arm/mach-bcmstb/include/mach/prior_stage.h new file +30 -0
new file mode 100644
index 0000000..6c36c68
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ */
+
+#ifndef _BCMSTB_PRIOR_STAGE_H
+#define _BCMSTB_PRIOR_STAGE_H
+
+#ifndef __ASSEMBLY__
+
+#include <linux/types.h>
+
+struct bcmstb_boot_parameters {
+	u32 r0;
+	u32 r1;
+	u32 r2;
+	u32 r3;
+	u32 sp;
+	u32 lr;
+};
+
+extern struct bcmstb_boot_parameters bcmstb_boot_parameters;
+
+extern phys_addr_t prior_stage_fdt_address;
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _BCMSTB_PRIOR_STAGE_H */
arch/arm/mach-bcmstb/include/mach/sdhci.h new file +15 -0
new file mode 100644
index 0000000..243783d
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ */
+
+#ifndef _BCMSTB_SDHCI_H
+#define _BCMSTB_SDHCI_H
+
+#include <linux/types.h>
+
+int bcmstb_sdhci_init(phys_addr_t regbase);
+
+#endif /* _BCMSTB_SDHCI_H */
arch/arm/mach-bcmstb/include/mach/timer.h new file +13 -0
new file mode 100644
index 0000000..d05b4d6
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ */
+
+#ifndef _BCMSTB_TIMER_H
+#define _BCMSTB_TIMER_H
+
+unsigned long timer_read_counter(void);
+
+#endif /* _BCMSTB_TIMER_H */
arch/arm/mach-bcmstb/lowlevel_init.S new file +21 -0
new file mode 100644
index 0000000..aa81f70
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ */
+
+#include <linux/linkage.h>
+
+ENTRY(save_boot_params)
+	ldr	r6, =bcmstb_boot_parameters
+	str	r0, [r6, #0]
+	str	r1, [r6, #4]
+	str	r2, [r6, #8]
+	str	r3, [r6, #12]
+	str	sp, [r6, #16]
+	str	lr, [r6, #20]
+	ldr	r6, =prior_stage_fdt_address
+	str	r2, [r6]
+	b	save_boot_params_ret
+ENDPROC(save_boot_params)
board/broadcom/bcmstb/MAINTAINERS new file +7 -0
new file mode 100644
index 0000000..5851cb9
@@ -0,0 +1,7 @@
+BCM7445 BOARD
+M:	Thomas Fitzsimmons <[email protected]>
+S:	Maintained
+F:	board/broadcom/bcmstb/
+F:	include/configs/bcmstb.h
+F:	include/configs/bcm7445.h
+F:	configs/bcm7445_defconfig
board/broadcom/bcmstb/Makefile new file +8 -0
new file mode 100644
index 0000000..9609887
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2018  Cisco Systems, Inc.
+#
+# Author: Thomas Fitzsimmons <[email protected]>
+#
+
+obj-y	:= bcmstb.o
board/broadcom/bcmstb/bcmstb.c new file +194 -0

194 lines not on this page · raw message

configs/bcm7445_defconfig new file +27 -0
new file mode 100644
index 0000000..46dea17
@@ -0,0 +1,27 @@
+CONFIG_ARM=y
+CONFIG_ARCH_BCMSTB=y
+CONFIG_TARGET_BCM7445=y
+CONFIG_USE_PRIVATE_LIBGCC=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_PRIOR_STAGE=y
+CONFIG_DM=y
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI=y
+CONFIG_SPI_FLASH=y
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_BCMSTB_SPI=y
+CONFIG_FIT=y
+CONFIG_FIT_SIGNATURE=y
+CONFIG_RSA=y
+CONFIG_BLK=n
+CONFIG_SDHCI=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_BCMSTB=y
+CONFIG_CONS_INDEX=3
+CONFIG_BOOTDELAY=1
+CONFIG_SYS_PROMPT="U-Boot>"
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_TEXT_BASE=0x80100000
+CONFIG_SYS_NS16550_COM3=0xf040ab00
+CONFIG_EFI_LOADER=n
doc/README.bcm7xxx new file +150 -0

150 lines not on this page · raw message

drivers/mmc/Kconfig +11 -0
index 693b3ce..377b1c4 100644
@@ -379,6 +379,17 @@ config MMC_SDHCI_BCM2835
 
 	  If unsure, say N.
 
+config MMC_SDHCI_BCMSTB
+	tristate "SDHCI support for the BCMSTB SD/MMC Controller"
+	depends on MMC_SDHCI
+	help
+	  This selects the Broadcom set-top box SD/MMC controller.
+
+	  If you have a BCMSTB platform with SD or MMC devices,
+	  say Y here.
+
+	  If unsure, say N.
+
 config MMC_SDHCI_CADENCE
 	bool "SDHCI support for the Cadence SD/SDIO/eMMC controller"
 	depends on BLK && DM_MMC
drivers/mmc/Makefile +1 -0
index 3a9805d..f619186 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_STM32_SDMMC2) += stm32_sdmmc2.o
 obj-$(CONFIG_MMC_SDHCI)			+= sdhci.o
 obj-$(CONFIG_MMC_SDHCI_ATMEL)		+= atmel_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_BCM2835)		+= bcm2835_sdhci.o
+obj-$(CONFIG_MMC_SDHCI_BCMSTB)		+= bcmstb_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_CADENCE)		+= sdhci-cadence.o
 obj-$(CONFIG_MMC_SDHCI_KONA)		+= kona_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_MSM)		+= msm_sdhci.o
drivers/mmc/bcmstb_sdhci.c new file +67 -0

67 lines not on this page · raw message

drivers/spi/Kconfig +7 -0
index 3532c2a..f5960a7 100644
@@ -66,6 +66,13 @@ config BCM63XX_SPI
 	  access the SPI NOR flash on platforms embedding these Broadcom
 	  SPI cores.
 
+config BCMSTB_SPI
+	bool "BCMSTB SPI driver"
+	help
+	  Enable the Broadcom set-top box SPI driver. This driver can
+	  be used to access the SPI flash on platforms embedding this
+	  Broadcom SPI core.
+
 config CADENCE_QSPI
 	bool "Cadence QSPI driver"
 	help
drivers/spi/Makefile +1 -0
index 5a2c00e..e73b0cd 100644
@@ -18,6 +18,7 @@ obj-$(CONFIG_ATH79_SPI) += ath79_spi.o
 obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 obj-$(CONFIG_BCM63XX_HSSPI) += bcm63xx_hsspi.o
 obj-$(CONFIG_BCM63XX_SPI) += bcm63xx_spi.o
+obj-$(CONFIG_BCMSTB_SPI) += bcmstb_spi.o
 obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o
 obj-$(CONFIG_CF_SPI) += cf_spi.o
 obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
drivers/spi/bcmstb_spi.c new file +439 -0

439 lines not on this page · raw message

drivers/spi/spi-uclass.c +1 -1
index d2d091f..c517d06 100644
@@ -273,7 +273,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
 	bool created = false;
 	int ret;
 
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_PLATDATA) || CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
 	ret = uclass_first_device_err(UCLASS_SPI, &bus);
 #else
 	ret = uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus);
dts/Kconfig +7 -0
index 0cef225..a1a92f2 100644
@@ -101,6 +101,13 @@ config OF_HOSTFILE
 	  This is only useful for Sandbox.  Use the -d flag to U-Boot to
 	  specify the file to read.
 
+config OF_PRIOR_STAGE
+	bool "Prior stage bootloader DTB for DT control"
+	help
+	  If this option is enabled, the device tree used for DT
+	  control will be read from a device tree binary, at a memory
+	  location passed to U-Boot by the prior stage bootloader.
+
 endchoice
 
 config DEFAULT_DEVICE_TREE
include/configs/bcm7445.h new file +26 -0
new file mode 100644
index 0000000..f720035
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2018  Cisco Systems, Inc.
+ *
+ * Author: Thomas Fitzsimmons <[email protected]>
+ *
+ * Configuration settings for the Broadcom BCM7445 SoC family.
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include "bcmstb.h"
+
+#define CONFIG_SYS_NS16550_COM3	0xf040ab00
+
+#define BCMSTB_SDHCI_BASE	0xf03e0200
+#define BCMSTB_TIMER_LOW	0xf0412008
+#define BCMSTB_TIMER_HIGH	0xf041200c
+#define BCMSTB_TIMER_FREQUENCY	0xf0412020
+#define BCMSTB_HIF_MSPI_BASE	0xf03e3400
+#define BCMSTB_BSPI_BASE	0xf03e3200
+#define BCMSTB_HIF_SPI_INTR2	0xf03e1a00
+#define BCMSTB_CS_REG		0xf03e0920
+
+#endif	/* __CONFIG_H */
include/configs/bcmstb.h new file +183 -0

183 lines not on this page · raw message

include/fdtdec.h +4 -0
index c15b2a0..ff1c5f5 100644
@@ -47,6 +47,10 @@ struct fdt_memory {
 #define SPL_BUILD	0
 #endif
 
+#if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
+extern phys_addr_t prior_stage_fdt_address;
+#endif
+
 /*
  * Information about a resource. start is the first address of the resource
  * and end is the last address (inclusive). The length of the resource will
lib/fdtdec.c +4 -0
index f4e8dbf..b29b283 100644
@@ -1323,8 +1323,12 @@ int fdtdec_setup(void)
 # endif
 # ifndef CONFIG_SPL_BUILD
 	/* Allow the early environment to override the fdt address */
+#  if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
+	gd->fdt_blob = (void *)prior_stage_fdt_address;
+#  else
 	gd->fdt_blob = (void *)env_get_ulong("fdtcontroladdr", 16,
 						(uintptr_t)gd->fdt_blob);
+#  endif
 # endif
 
 # if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
Signature · 1 line
1.8.3.1
#19 lore raw

PATCH v4 1/1 board: arm: Add support for Broadcom BCM7445

Quoted 9 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Florian Fainelli <[email protected]>

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: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180711/768667e4/attachment.sig>
#20 lore raw

PATCH v4 1/1 board: arm: Add support for Broadcom BCM7445

In reply to Thomas Fitzsimmons

Hi Thomas,

Quoted 63 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Florian Fainelli <[email protected]>

---
Changes for v4:
- Use high timer register for get_ticks
- Move hard-coded register addresses from Kconfig to header
- Document I-cache/D-cache expectation

 MAINTAINERS                                     |  10 +
 arch/arm/Kconfig                                |  12 +
 arch/arm/Makefile                               |   1 +
 arch/arm/mach-bcmstb/Kconfig                    |  36 ++
 arch/arm/mach-bcmstb/Makefile                   |   8 +
 arch/arm/mach-bcmstb/include/mach/gpio.h        |  11 +
 arch/arm/mach-bcmstb/include/mach/hardware.h    |  11 +
 arch/arm/mach-bcmstb/include/mach/prior_stage.h |  30 ++
 arch/arm/mach-bcmstb/include/mach/sdhci.h       |  15 +
 arch/arm/mach-bcmstb/include/mach/timer.h       |  13 +
 arch/arm/mach-bcmstb/lowlevel_init.S            |  21 ++
 board/broadcom/bcmstb/MAINTAINERS               |   7 +
 board/broadcom/bcmstb/Makefile                  |   8 +
 board/broadcom/bcmstb/bcmstb.c                  | 194 +++++++++++
 configs/bcm7445_defconfig                       |  27 ++
 doc/README.bcm7xxx                              | 150 ++++++++
 drivers/mmc/Kconfig                             |  11 +
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  67 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 439 ++++++++++++++++++++++++
 drivers/spi/spi-uclass.c                        |   2 +-
 dts/Kconfig                                     |   7 +
 include/configs/bcm7445.h                       |  26 ++
 include/configs/bcmstb.h                        | 183 ++++++++++
 include/fdtdec.h                                |   4 +
 lib/fdtdec.c                                    |   4 +
 28 files changed, 1305 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-bcmstb/Kconfig
 create mode 100644 arch/arm/mach-bcmstb/Makefile
 create mode 100644 arch/arm/mach-bcmstb/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/prior_stage.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/sdhci.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/timer.h
 create mode 100644 arch/arm/mach-bcmstb/lowlevel_init.S
 create mode 100644 board/broadcom/bcmstb/MAINTAINERS
 create mode 100644 board/broadcom/bcmstb/Makefile
 create mode 100644 board/broadcom/bcmstb/bcmstb.c
 create mode 100644 configs/bcm7445_defconfig
 create mode 100644 doc/README.bcm7xxx
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcm7445.h
 create mode 100644 include/configs/bcmstb.h

[snip]

drivers/spi/spi-uclass.c int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode, · line 276

Quoted 10 lines
drivers/spi/spi-uclass.c +1 -1
index d2d091f..c517d06 100644
@@ -273,7 +273,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
        bool created = false;
        int ret;
 
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_PLATDATA) || CONFIG_IS_ENABLED(OF_PRIOR_STAGE)

Could you please explain this change a little bit? Why should we call uclass_first_device_err() for OF_PRIOR_STAGE?

Quoted 10 lines
drivers/spi/spi-uclass.c +0 -0
        ret = uclass_first_device_err(UCLASS_SPI, &bus);
 #else
        ret = uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus);
dts/Kconfig +0 -0
index 0cef225..a1a92f2 100644
@@ -101,6 +101,13 @@ config OF_HOSTFILE
          This is only useful for Sandbox.  Use the -d flag to U-Boot to
          specify the file to read.

dts/Kconfig config OF_HOSTFILE · line 112

Quoted 10 lines
dts/Kconfig +7 -0
 
+config OF_PRIOR_STAGE
+       bool "Prior stage bootloader DTB for DT control"
+       help
+         If this option is enabled, the device tree used for DT
+         control will be read from a device tree binary, at a memory
+         location passed to U-Boot by the prior stage bootloader.
+
 endchoice
 

[snip]

Regards,
Bin

#21 lore raw

PATCH v4 1/1 board: arm: Add support for Broadcom BCM7445

Hi Bin,

Quoted 77 lines · Bin Meng

Hi Thomas,

Quoted 63 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Florian Fainelli <[email protected]>

---
Changes for v4:
- Use high timer register for get_ticks
- Move hard-coded register addresses from Kconfig to header
- Document I-cache/D-cache expectation

 MAINTAINERS                                     |  10 +
 arch/arm/Kconfig                                |  12 +
 arch/arm/Makefile                               |   1 +
 arch/arm/mach-bcmstb/Kconfig                    |  36 ++
 arch/arm/mach-bcmstb/Makefile                   |   8 +
 arch/arm/mach-bcmstb/include/mach/gpio.h        |  11 +
 arch/arm/mach-bcmstb/include/mach/hardware.h    |  11 +
 arch/arm/mach-bcmstb/include/mach/prior_stage.h |  30 ++
 arch/arm/mach-bcmstb/include/mach/sdhci.h       |  15 +
 arch/arm/mach-bcmstb/include/mach/timer.h       |  13 +
 arch/arm/mach-bcmstb/lowlevel_init.S            |  21 ++
 board/broadcom/bcmstb/MAINTAINERS               |   7 +
 board/broadcom/bcmstb/Makefile                  |   8 +
 board/broadcom/bcmstb/bcmstb.c                  | 194 +++++++++++
 configs/bcm7445_defconfig                       |  27 ++
 doc/README.bcm7xxx                              | 150 ++++++++
 drivers/mmc/Kconfig                             |  11 +
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  67 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 439 ++++++++++++++++++++++++
 drivers/spi/spi-uclass.c                        |   2 +-
 dts/Kconfig                                     |   7 +
 include/configs/bcm7445.h                       |  26 ++
 include/configs/bcmstb.h                        | 183 ++++++++++
 include/fdtdec.h                                |   4 +
 lib/fdtdec.c                                    |   4 +
 28 files changed, 1305 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-bcmstb/Kconfig
 create mode 100644 arch/arm/mach-bcmstb/Makefile
 create mode 100644 arch/arm/mach-bcmstb/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/prior_stage.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/sdhci.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/timer.h
 create mode 100644 arch/arm/mach-bcmstb/lowlevel_init.S
 create mode 100644 board/broadcom/bcmstb/MAINTAINERS
 create mode 100644 board/broadcom/bcmstb/Makefile
 create mode 100644 board/broadcom/bcmstb/bcmstb.c
 create mode 100644 configs/bcm7445_defconfig
 create mode 100644 doc/README.bcm7xxx
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcm7445.h
 create mode 100644 include/configs/bcmstb.h

[snip]

Quoted 8 lines
drivers/spi/spi-uclass.c +0 -0
index d2d091f..c517d06 100644
@@ -273,7 +273,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
        bool created = false;
        int ret;
 
Quoted 9 lines

drivers/spi/spi-uclass.c int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode, · line 276

Quoted 2 lines
drivers/spi/spi-uclass.c +1 -1
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_PLATDATA) || CONFIG_IS_ENABLED(OF_PRIOR_STAGE)

Could you please explain this change a little bit? Why should we call uclass_first_device_err() for OF_PRIOR_STAGE?

Quoted 3 lines
drivers/spi/spi-uclass.c +0 -0
        ret = uclass_first_device_err(UCLASS_SPI, &bus);
 #else
        ret = uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus);

On the BCM7445 eval board, the prior-stage-provided device tree does not have an alias for spi0, though it has aliases for other device types; I don't know why this is the case, but I don't have control over what the prior stage bootloader (Broadcom's BOLT) provides. Without that alias, uclass_get_device_by_seq fails to find the SPI bus (and so U-Boot can't find the SPI flash device that stores its environment).

At the time, I checked other ARM device trees in the Linux kernel and not many set an alias for spi0, so I wrote the patch to choose the first SPI bus. Doing so was in line with what CONFIG_OF_PLATDATA did on boards that wanted to avoid device tree accesses.

I see that since I introduced CONFIG_OF_PRIOR_STAGE, several other ports have started using it, so there's probably a need to generalize this; if other prior stage bootloaders provide SPI aliases then there should be a way for this code to use them.

Quoted 8 lines
Quoted 8 lines
dts/Kconfig +0 -0
index 0cef225..a1a92f2 100644
@@ -101,6 +101,13 @@ config OF_HOSTFILE
          This is only useful for Sandbox.  Use the -d flag to U-Boot to
          specify the file to read.
 
Quoted 11 lines
Quoted 9 lines
dts/Kconfig +7 -0
+config OF_PRIOR_STAGE
+       bool "Prior stage bootloader DTB for DT control"
+       help
+         If this option is enabled, the device tree used for DT
+         control will be read from a device tree binary, at a memory
+         location passed to U-Boot by the prior stage bootloader.
+
 endchoice
 

[snip]

Thomas

#22 lore raw

PATCH v4 1/1 board: arm: Add support for Broadcom BCM7445

Hi Thomas,

Quoted 92 lines · Thomas Fitzsimmons

Hi Bin,

Quoted 77 lines · Bin Meng

Hi Thomas,

Quoted 63 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Florian Fainelli <[email protected]>

---
Changes for v4:
- Use high timer register for get_ticks
- Move hard-coded register addresses from Kconfig to header
- Document I-cache/D-cache expectation

 MAINTAINERS                                     |  10 +
 arch/arm/Kconfig                                |  12 +
 arch/arm/Makefile                               |   1 +
 arch/arm/mach-bcmstb/Kconfig                    |  36 ++
 arch/arm/mach-bcmstb/Makefile                   |   8 +
 arch/arm/mach-bcmstb/include/mach/gpio.h        |  11 +
 arch/arm/mach-bcmstb/include/mach/hardware.h    |  11 +
 arch/arm/mach-bcmstb/include/mach/prior_stage.h |  30 ++
 arch/arm/mach-bcmstb/include/mach/sdhci.h       |  15 +
 arch/arm/mach-bcmstb/include/mach/timer.h       |  13 +
 arch/arm/mach-bcmstb/lowlevel_init.S            |  21 ++
 board/broadcom/bcmstb/MAINTAINERS               |   7 +
 board/broadcom/bcmstb/Makefile                  |   8 +
 board/broadcom/bcmstb/bcmstb.c                  | 194 +++++++++++
 configs/bcm7445_defconfig                       |  27 ++
 doc/README.bcm7xxx                              | 150 ++++++++
 drivers/mmc/Kconfig                             |  11 +
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  67 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 439 ++++++++++++++++++++++++
 drivers/spi/spi-uclass.c                        |   2 +-
 dts/Kconfig                                     |   7 +
 include/configs/bcm7445.h                       |  26 ++
 include/configs/bcmstb.h                        | 183 ++++++++++
 include/fdtdec.h                                |   4 +
 lib/fdtdec.c                                    |   4 +
 28 files changed, 1305 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-bcmstb/Kconfig
 create mode 100644 arch/arm/mach-bcmstb/Makefile
 create mode 100644 arch/arm/mach-bcmstb/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/prior_stage.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/sdhci.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/timer.h
 create mode 100644 arch/arm/mach-bcmstb/lowlevel_init.S
 create mode 100644 board/broadcom/bcmstb/MAINTAINERS
 create mode 100644 board/broadcom/bcmstb/Makefile
 create mode 100644 board/broadcom/bcmstb/bcmstb.c
 create mode 100644 configs/bcm7445_defconfig
 create mode 100644 doc/README.bcm7xxx
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcm7445.h
 create mode 100644 include/configs/bcmstb.h

[snip]

Quoted 8 lines
drivers/spi/spi-uclass.c +0 -0
index d2d091f..c517d06 100644
@@ -273,7 +273,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
        bool created = false;
        int ret;
 
Quoted 9 lines

drivers/spi/spi-uclass.c int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode, · line 276

Quoted 2 lines
drivers/spi/spi-uclass.c +1 -1
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_PLATDATA) || CONFIG_IS_ENABLED(OF_PRIOR_STAGE)

Could you please explain this change a little bit? Why should we call uclass_first_device_err() for OF_PRIOR_STAGE?

Quoted 3 lines
drivers/spi/spi-uclass.c +0 -0
        ret = uclass_first_device_err(UCLASS_SPI, &bus);
 #else
        ret = uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus);
Quoted 7 lines

On the BCM7445 eval board, the prior-stage-provided device tree does not have an alias for spi0, though it has aliases for other device types; I don't know why this is the case, but I don't have control over what the prior stage bootloader (Broadcom's BOLT) provides. Without that alias, uclass_get_device_by_seq fails to find the SPI bus (and so U-Boot can't find the SPI flash device that stores its environment).

I checked uclass_get_device_by_seq() and did not find any codes that are trying to read aliases. Am I missing anything?

Quoted 5 lines

At the time, I checked other ARM device trees in the Linux kernel and not many set an alias for spi0, so I wrote the patch to choose the first SPI bus. Doing so was in line with what CONFIG_OF_PLATDATA did on boards that wanted to avoid device tree accesses.

Based on what you said, the adding of OF_PRIOR_STAGE here sounds like a hack.

Quoted 5 lines

I see that since I introduced CONFIG_OF_PRIOR_STAGE, several other ports have started using it, so there's probably a need to generalize this; if other prior stage bootloaders provide SPI aliases then there should be a way for this code to use them.

I think the correct way is to call uclass_get_device_by_seq(). CONFIG_OF_PRIOR_STAGE should not imply such behavior.

Regards,
Bin

#23 lore raw

PATCH v4 1/1 board: arm: Add support for Broadcom BCM7445

Hi Bin,

Quoted 103 lines · Bin Meng

Hi Thomas,

Quoted 92 lines · Thomas Fitzsimmons

Hi Bin,

Quoted 77 lines · Bin Meng

Hi Thomas,

Quoted 63 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Florian Fainelli <[email protected]>

---
Changes for v4:
- Use high timer register for get_ticks
- Move hard-coded register addresses from Kconfig to header
- Document I-cache/D-cache expectation

 MAINTAINERS                                     |  10 +
 arch/arm/Kconfig                                |  12 +
 arch/arm/Makefile                               |   1 +
 arch/arm/mach-bcmstb/Kconfig                    |  36 ++
 arch/arm/mach-bcmstb/Makefile                   |   8 +
 arch/arm/mach-bcmstb/include/mach/gpio.h        |  11 +
 arch/arm/mach-bcmstb/include/mach/hardware.h    |  11 +
 arch/arm/mach-bcmstb/include/mach/prior_stage.h |  30 ++
 arch/arm/mach-bcmstb/include/mach/sdhci.h       |  15 +
 arch/arm/mach-bcmstb/include/mach/timer.h       |  13 +
 arch/arm/mach-bcmstb/lowlevel_init.S            |  21 ++
 board/broadcom/bcmstb/MAINTAINERS               |   7 +
 board/broadcom/bcmstb/Makefile                  |   8 +
 board/broadcom/bcmstb/bcmstb.c                  | 194 +++++++++++
 configs/bcm7445_defconfig                       |  27 ++
 doc/README.bcm7xxx                              | 150 ++++++++
 drivers/mmc/Kconfig                             |  11 +
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  67 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 439 ++++++++++++++++++++++++
 drivers/spi/spi-uclass.c                        |   2 +-
 dts/Kconfig                                     |   7 +
 include/configs/bcm7445.h                       |  26 ++
 include/configs/bcmstb.h                        | 183 ++++++++++
 include/fdtdec.h                                |   4 +
 lib/fdtdec.c                                    |   4 +
 28 files changed, 1305 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-bcmstb/Kconfig
 create mode 100644 arch/arm/mach-bcmstb/Makefile
 create mode 100644 arch/arm/mach-bcmstb/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/prior_stage.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/sdhci.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/timer.h
 create mode 100644 arch/arm/mach-bcmstb/lowlevel_init.S
 create mode 100644 board/broadcom/bcmstb/MAINTAINERS
 create mode 100644 board/broadcom/bcmstb/Makefile
 create mode 100644 board/broadcom/bcmstb/bcmstb.c
 create mode 100644 configs/bcm7445_defconfig
 create mode 100644 doc/README.bcm7xxx
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcm7445.h
 create mode 100644 include/configs/bcmstb.h

[snip]

Quoted 8 lines
drivers/spi/spi-uclass.c +0 -0
index d2d091f..c517d06 100644
@@ -273,7 +273,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
        bool created = false;
        int ret;
 
Quoted 9 lines

drivers/spi/spi-uclass.c int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode, · line 276

Quoted 2 lines
drivers/spi/spi-uclass.c +1 -1
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_PLATDATA) || CONFIG_IS_ENABLED(OF_PRIOR_STAGE)

Could you please explain this change a little bit? Why should we call uclass_first_device_err() for OF_PRIOR_STAGE?

Quoted 3 lines
drivers/spi/spi-uclass.c +0 -0
        ret = uclass_first_device_err(UCLASS_SPI, &bus);
 #else
        ret = uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus);
Quoted 7 lines

On the BCM7445 eval board, the prior-stage-provided device tree does not have an alias for spi0, though it has aliases for other device types; I don't know why this is the case, but I don't have control over what the prior stage bootloader (Broadcom's BOLT) provides. Without that alias, uclass_get_device_by_seq fails to find the SPI bus (and so U-Boot can't find the SPI flash device that stores its environment).

Quoted 2 lines

I checked uclass_get_device_by_seq() and did not find any codes that are trying to read aliases. Am I missing anything?

Alias handling is not in the direct uclass_get_device_by_seq call chain, and it took some debugging to find this. The requested sequence number is handled earlier in the boot, in device_bind_common:

   dev->seq = -1;
   dev->req_seq = -1;
   if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) &&
       (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) {
           /*
            * Some devices, such as a SPI bus, I2C bus and serial ports
            * are numbered using aliases.
            *
            * This is just a 'requested' sequence, and will be
            * resolved (and ->seq updated) when the device is probed.
            */
           if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
                   if (uc->uc_drv->name && ofnode_valid(node))
                           dev_read_alias_seq(dev, &dev->req_seq);
           } else {
                   dev->req_seq = uclass_find_next_free_req_seq(drv->id);
           }
   }

If the prior stage bootloader provides no SPI bus alias, then dev_read_alias_seq fails, dev->req_seq stays unset (-1), and later when an attempt is made to access the SPI bus, the call to uclass_get_device_by_seq fails.

Quoted 7 lines
Quoted 5 lines

At the time, I checked other ARM device trees in the Linux kernel and not many set an alias for spi0, so I wrote the patch to choose the first SPI bus. Doing so was in line with what CONFIG_OF_PLATDATA did on boards that wanted to avoid device tree accesses.

Based on what you said, the adding of OF_PRIOR_STAGE here sounds like a hack.

Yeah, it makes an assumption about which SPI bus to use, that may or may not be valid on other boards.

Quoted 8 lines
Quoted 5 lines

I see that since I introduced CONFIG_OF_PRIOR_STAGE, several other ports have started using it, so there's probably a need to generalize this; if other prior stage bootloaders provide SPI aliases then there should be a way for this code to use them.

I think the correct way is to call uclass_get_device_by_seq(). CONFIG_OF_PRIOR_STAGE should not imply such behavior.

OK, but without other changes this would break boards that rely on the above assumption (for example BCM7445).

I'm experimenting with patches that work on BCM7445 and eliminate the SPI bus assumption but I don't know what effect they might have on other ports that use OF_PRIOR_STAGE.

In general it seems like a good idea to use the prior-stage-provided aliases, but the question is what to do when an alias is missing; maybe always fall back to calling uclass_find_next_free_req_seq?

Have you found a board for which uclass_get_device_by_seq works for SPI and uclass_first_device_err does the wrong thing? Is it a publicly available port that I can have a look at?

Thanks,
Thomas

#24 lore raw

PATCH v4 1/1 board: arm: Add support for Broadcom BCM7445

+Simon

Quoted 134 lines · Thomas Fitzsimmons

Hi Bin,

Quoted 103 lines · Bin Meng

Hi Thomas,

Quoted 92 lines · Thomas Fitzsimmons

Hi Bin,

Quoted 77 lines · Bin Meng

Hi Thomas,

Quoted 63 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Florian Fainelli <[email protected]>

---
Changes for v4:
- Use high timer register for get_ticks
- Move hard-coded register addresses from Kconfig to header
- Document I-cache/D-cache expectation

 MAINTAINERS                                     |  10 +
 arch/arm/Kconfig                                |  12 +
 arch/arm/Makefile                               |   1 +
 arch/arm/mach-bcmstb/Kconfig                    |  36 ++
 arch/arm/mach-bcmstb/Makefile                   |   8 +
 arch/arm/mach-bcmstb/include/mach/gpio.h        |  11 +
 arch/arm/mach-bcmstb/include/mach/hardware.h    |  11 +
 arch/arm/mach-bcmstb/include/mach/prior_stage.h |  30 ++
 arch/arm/mach-bcmstb/include/mach/sdhci.h       |  15 +
 arch/arm/mach-bcmstb/include/mach/timer.h       |  13 +
 arch/arm/mach-bcmstb/lowlevel_init.S            |  21 ++
 board/broadcom/bcmstb/MAINTAINERS               |   7 +
 board/broadcom/bcmstb/Makefile                  |   8 +
 board/broadcom/bcmstb/bcmstb.c                  | 194 +++++++++++
 configs/bcm7445_defconfig                       |  27 ++
 doc/README.bcm7xxx                              | 150 ++++++++
 drivers/mmc/Kconfig                             |  11 +
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  67 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 439 ++++++++++++++++++++++++
 drivers/spi/spi-uclass.c                        |   2 +-
 dts/Kconfig                                     |   7 +
 include/configs/bcm7445.h                       |  26 ++
 include/configs/bcmstb.h                        | 183 ++++++++++
 include/fdtdec.h                                |   4 +
 lib/fdtdec.c                                    |   4 +
 28 files changed, 1305 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-bcmstb/Kconfig
 create mode 100644 arch/arm/mach-bcmstb/Makefile
 create mode 100644 arch/arm/mach-bcmstb/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/prior_stage.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/sdhci.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/timer.h
 create mode 100644 arch/arm/mach-bcmstb/lowlevel_init.S
 create mode 100644 board/broadcom/bcmstb/MAINTAINERS
 create mode 100644 board/broadcom/bcmstb/Makefile
 create mode 100644 board/broadcom/bcmstb/bcmstb.c
 create mode 100644 configs/bcm7445_defconfig
 create mode 100644 doc/README.bcm7xxx
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcm7445.h
 create mode 100644 include/configs/bcmstb.h

[snip]

Quoted 8 lines
drivers/spi/spi-uclass.c +0 -0
index d2d091f..c517d06 100644
@@ -273,7 +273,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
        bool created = false;
        int ret;
 
Quoted 9 lines

drivers/spi/spi-uclass.c int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode, · line 276

Quoted 2 lines
drivers/spi/spi-uclass.c +1 -1
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_PLATDATA) || CONFIG_IS_ENABLED(OF_PRIOR_STAGE)

Could you please explain this change a little bit? Why should we call uclass_first_device_err() for OF_PRIOR_STAGE?

Quoted 3 lines
drivers/spi/spi-uclass.c +0 -0
        ret = uclass_first_device_err(UCLASS_SPI, &bus);
 #else
        ret = uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus);
Quoted 7 lines

On the BCM7445 eval board, the prior-stage-provided device tree does not have an alias for spi0, though it has aliases for other device types; I don't know why this is the case, but I don't have control over what the prior stage bootloader (Broadcom's BOLT) provides. Without that alias, uclass_get_device_by_seq fails to find the SPI bus (and so U-Boot can't find the SPI flash device that stores its environment).

Quoted 2 lines

I checked uclass_get_device_by_seq() and did not find any codes that are trying to read aliases. Am I missing anything?

Alias handling is not in the direct uclass_get_device_by_seq call chain, and it took some debugging to find this. The requested sequence number is handled earlier in the boot, in device_bind_common:

   dev->seq = -1;
   dev->req_seq = -1;
   if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) &&
       (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) {
           /*
            * Some devices, such as a SPI bus, I2C bus and serial ports
            * are numbered using aliases.
            *
            * This is just a 'requested' sequence, and will be
            * resolved (and ->seq updated) when the device is probed.
            */
           if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
                   if (uc->uc_drv->name && ofnode_valid(node))
                           dev_read_alias_seq(dev, &dev->req_seq);
           } else {
                   dev->req_seq = uclass_find_next_free_req_seq(drv->id);
           }
   }
Quoted 4 lines

If the prior stage bootloader provides no SPI bus alias, then dev_read_alias_seq fails, dev->req_seq stays unset (-1), and later when an attempt is made to access the SPI bus, the call to uclass_get_device_by_seq fails.

Ah, I see. Thanks!

Quoted 24 lines
Quoted 8 lines
Quoted 6 lines

At the time, I checked other ARM device trees in the Linux kernel and not many set an alias for spi0, so I wrote the patch to choose the first SPI bus. Doing so was in line with what CONFIG_OF_PLATDATA did on boards that wanted to avoid device tree accesses.

Based on what you said, the adding of OF_PRIOR_STAGE here sounds like a hack.

Yeah, it makes an assumption about which SPI bus to use, that may or may not be valid on other boards.

Quoted 8 lines
Quoted 5 lines

I see that since I introduced CONFIG_OF_PRIOR_STAGE, several other ports have started using it, so there's probably a need to generalize this; if other prior stage bootloaders provide SPI aliases then there should be a way for this code to use them.

I think the correct way is to call uclass_get_device_by_seq(). CONFIG_OF_PRIOR_STAGE should not imply such behavior.

OK, but without other changes this would break boards that rely on the above assumption (for example BCM7445).

Quoted 7 lines

I'm experimenting with patches that work on BCM7445 and eliminate the SPI bus assumption but I don't know what effect they might have on other ports that use OF_PRIOR_STAGE.

In general it seems like a good idea to use the prior-stage-provided aliases, but the question is what to do when an alias is missing; maybe always fall back to calling uclass_find_next_free_req_seq?

I tend to agree. As I see lots of places in U-Boot sources, like below:

drivers/i2c/intel_i2c.c::intel_i2c_bind()

if (device_is_on_pci_bus(dev)) {
/*
* ToDo:
* Setting req_seq in the driver is probably not recommended.
* But without a DT alias the number is not configured. And
* using this driver is impossible for PCIe I2C devices.
* This can be removed, once a better (correct) way for this
* is found and implemented.
*/
dev->req_seq = num_cards;

And another example:
drivers/usb/host/ehci-vf.c::vf_usb_bind()

/*
* Without this hack, if we return ENODEV for USB Controller 0, on
* probe for the next controller, USB Controller 1 will be given a
* sequence number of 0. This conflicts with our requirement of
* sequence numbers while initialising the peripherals. */
dev->req_seq = num_controllers;

Simon, do you think we should change the behavior of dev->req_seq in the device bind for uclass drivers with DM_UC_FLAG_SEQ_ALIAS flag?

Quoted 4 lines

Have you found a board for which uclass_get_device_by_seq works for SPI and uclass_first_device_err does the wrong thing? Is it a publicly available port that I can have a look at?

No, I was not indicating an error like uclass_get_device_by_seq works for SPI and uclass_first_device_err does the wrong thing. The issue with your implementation is that it forces probing the first SPI controller and ignore the "busnum" completely. This makes a board with multiple SPI controllers unable to probe other controllers than the very first one.

Regards,
Bin

#25 lore raw

PATCH v4 1/1 board: arm: Add support for Broadcom BCM7445

Hi Simon,

Quoted 203 lines · Bin Meng

+Simon

Quoted 134 lines · Thomas Fitzsimmons

Hi Bin,

Quoted 103 lines · Bin Meng

Hi Thomas,

Quoted 92 lines · Thomas Fitzsimmons

Hi Bin,

Quoted 77 lines · Bin Meng

Hi Thomas,

Quoted 63 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Florian Fainelli <[email protected]>

---
Changes for v4:
- Use high timer register for get_ticks
- Move hard-coded register addresses from Kconfig to header
- Document I-cache/D-cache expectation

 MAINTAINERS                                     |  10 +
 arch/arm/Kconfig                                |  12 +
 arch/arm/Makefile                               |   1 +
 arch/arm/mach-bcmstb/Kconfig                    |  36 ++
 arch/arm/mach-bcmstb/Makefile                   |   8 +
 arch/arm/mach-bcmstb/include/mach/gpio.h        |  11 +
 arch/arm/mach-bcmstb/include/mach/hardware.h    |  11 +
 arch/arm/mach-bcmstb/include/mach/prior_stage.h |  30 ++
 arch/arm/mach-bcmstb/include/mach/sdhci.h       |  15 +
 arch/arm/mach-bcmstb/include/mach/timer.h       |  13 +
 arch/arm/mach-bcmstb/lowlevel_init.S            |  21 ++
 board/broadcom/bcmstb/MAINTAINERS               |   7 +
 board/broadcom/bcmstb/Makefile                  |   8 +
 board/broadcom/bcmstb/bcmstb.c                  | 194 +++++++++++
 configs/bcm7445_defconfig                       |  27 ++
 doc/README.bcm7xxx                              | 150 ++++++++
 drivers/mmc/Kconfig                             |  11 +
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  67 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 439 ++++++++++++++++++++++++
 drivers/spi/spi-uclass.c                        |   2 +-
 dts/Kconfig                                     |   7 +
 include/configs/bcm7445.h                       |  26 ++
 include/configs/bcmstb.h                        | 183 ++++++++++
 include/fdtdec.h                                |   4 +
 lib/fdtdec.c                                    |   4 +
 28 files changed, 1305 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-bcmstb/Kconfig
 create mode 100644 arch/arm/mach-bcmstb/Makefile
 create mode 100644 arch/arm/mach-bcmstb/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/prior_stage.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/sdhci.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/timer.h
 create mode 100644 arch/arm/mach-bcmstb/lowlevel_init.S
 create mode 100644 board/broadcom/bcmstb/MAINTAINERS
 create mode 100644 board/broadcom/bcmstb/Makefile
 create mode 100644 board/broadcom/bcmstb/bcmstb.c
 create mode 100644 configs/bcm7445_defconfig
 create mode 100644 doc/README.bcm7xxx
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcm7445.h
 create mode 100644 include/configs/bcmstb.h

[snip]

Quoted 8 lines
drivers/spi/spi-uclass.c +0 -0
index d2d091f..c517d06 100644
@@ -273,7 +273,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
        bool created = false;
        int ret;
 
Quoted 9 lines

drivers/spi/spi-uclass.c int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode, · line 276

Quoted 2 lines
drivers/spi/spi-uclass.c +1 -1
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_PLATDATA) || CONFIG_IS_ENABLED(OF_PRIOR_STAGE)

Could you please explain this change a little bit? Why should we call uclass_first_device_err() for OF_PRIOR_STAGE?

Quoted 3 lines
drivers/spi/spi-uclass.c +0 -0
        ret = uclass_first_device_err(UCLASS_SPI, &bus);
 #else
        ret = uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus);
Quoted 7 lines

On the BCM7445 eval board, the prior-stage-provided device tree does not have an alias for spi0, though it has aliases for other device types; I don't know why this is the case, but I don't have control over what the prior stage bootloader (Broadcom's BOLT) provides. Without that alias, uclass_get_device_by_seq fails to find the SPI bus (and so U-Boot can't find the SPI flash device that stores its environment).

Quoted 2 lines

I checked uclass_get_device_by_seq() and did not find any codes that are trying to read aliases. Am I missing anything?

Alias handling is not in the direct uclass_get_device_by_seq call chain, and it took some debugging to find this. The requested sequence number is handled earlier in the boot, in device_bind_common:

   dev->seq = -1;
   dev->req_seq = -1;
   if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) &&
       (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) {
           /*
            * Some devices, such as a SPI bus, I2C bus and serial ports
            * are numbered using aliases.
            *
            * This is just a 'requested' sequence, and will be
            * resolved (and ->seq updated) when the device is probed.
            */
           if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
                   if (uc->uc_drv->name && ofnode_valid(node))
                           dev_read_alias_seq(dev, &dev->req_seq);
           } else {
                   dev->req_seq = uclass_find_next_free_req_seq(drv->id);
           }
   }
Quoted 4 lines

If the prior stage bootloader provides no SPI bus alias, then dev_read_alias_seq fails, dev->req_seq stays unset (-1), and later when an attempt is made to access the SPI bus, the call to uclass_get_device_by_seq fails.

Ah, I see. Thanks!

Quoted 24 lines
Quoted 8 lines
Quoted 6 lines

At the time, I checked other ARM device trees in the Linux kernel and not many set an alias for spi0, so I wrote the patch to choose the first SPI bus. Doing so was in line with what CONFIG_OF_PLATDATA did on boards that wanted to avoid device tree accesses.

Based on what you said, the adding of OF_PRIOR_STAGE here sounds like a hack.

Yeah, it makes an assumption about which SPI bus to use, that may or may not be valid on other boards.

Quoted 8 lines
Quoted 5 lines

I see that since I introduced CONFIG_OF_PRIOR_STAGE, several other ports have started using it, so there's probably a need to generalize this; if other prior stage bootloaders provide SPI aliases then there should be a way for this code to use them.

I think the correct way is to call uclass_get_device_by_seq(). CONFIG_OF_PRIOR_STAGE should not imply such behavior.

OK, but without other changes this would break boards that rely on the above assumption (for example BCM7445).

Quoted 7 lines

I'm experimenting with patches that work on BCM7445 and eliminate the SPI bus assumption but I don't know what effect they might have on other ports that use OF_PRIOR_STAGE.

In general it seems like a good idea to use the prior-stage-provided aliases, but the question is what to do when an alias is missing; maybe always fall back to calling uclass_find_next_free_req_seq?

I tend to agree. As I see lots of places in U-Boot sources, like below:

drivers/i2c/intel_i2c.c::intel_i2c_bind()

if (device_is_on_pci_bus(dev)) {
/*
* ToDo:
* Setting req_seq in the driver is probably not recommended.
* But without a DT alias the number is not configured. And
* using this driver is impossible for PCIe I2C devices.
* This can be removed, once a better (correct) way for this
* is found and implemented.
*/
dev->req_seq = num_cards;

And another example:
drivers/usb/host/ehci-vf.c::vf_usb_bind()

/*
* Without this hack, if we return ENODEV for USB Controller 0, on
* probe for the next controller, USB Controller 1 will be given a
* sequence number of 0. This conflicts with our requirement of
* sequence numbers while initialising the peripherals. */
dev->req_seq = num_controllers;

Quoted 3 lines

Simon, do you think we should change the behavior of dev->req_seq in the device bind for uclass drivers with DM_UC_FLAG_SEQ_ALIAS flag?

Would you please give some comments regarding this?

Quoted 11 lines
Quoted 4 lines

Have you found a board for which uclass_get_device_by_seq works for SPI and uclass_first_device_err does the wrong thing? Is it a publicly available port that I can have a look at?

No, I was not indicating an error like uclass_get_device_by_seq works for SPI and uclass_first_device_err does the wrong thing. The issue with your implementation is that it forces probing the first SPI controller and ignore the "busnum" completely. This makes a board with multiple SPI controllers unable to probe other controllers than the very first one.

Regards,
Bin

#26 lore raw

PATCH v4 1/1 board: arm: Add support for Broadcom BCM7445

Hi Bin,

Quoted 207 lines · Bin Meng

Hi Simon,

Quoted 203 lines · Bin Meng

+Simon

Quoted 134 lines · Thomas Fitzsimmons

Hi Bin,

Quoted 103 lines · Bin Meng

Hi Thomas,

Quoted 92 lines · Thomas Fitzsimmons

Hi Bin,

Quoted 77 lines · Bin Meng

Hi Thomas,

Quoted 63 lines · Thomas Fitzsimmons

Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT.

Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
Cc Florian Fainelli <[email protected]>

---
Changes for v4:
- Use high timer register for get_ticks
- Move hard-coded register addresses from Kconfig to header
- Document I-cache/D-cache expectation

 MAINTAINERS                                     |  10 +
 arch/arm/Kconfig                                |  12 +
 arch/arm/Makefile                               |   1 +
 arch/arm/mach-bcmstb/Kconfig                    |  36 ++
 arch/arm/mach-bcmstb/Makefile                   |   8 +
 arch/arm/mach-bcmstb/include/mach/gpio.h        |  11 +
 arch/arm/mach-bcmstb/include/mach/hardware.h    |  11 +
 arch/arm/mach-bcmstb/include/mach/prior_stage.h |  30 ++
 arch/arm/mach-bcmstb/include/mach/sdhci.h       |  15 +
 arch/arm/mach-bcmstb/include/mach/timer.h       |  13 +
 arch/arm/mach-bcmstb/lowlevel_init.S            |  21 ++
 board/broadcom/bcmstb/MAINTAINERS               |   7 +
 board/broadcom/bcmstb/Makefile                  |   8 +
 board/broadcom/bcmstb/bcmstb.c                  | 194 +++++++++++
 configs/bcm7445_defconfig                       |  27 ++
 doc/README.bcm7xxx                              | 150 ++++++++
 drivers/mmc/Kconfig                             |  11 +
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  67 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 439 ++++++++++++++++++++++++
 drivers/spi/spi-uclass.c                        |   2 +-
 dts/Kconfig                                     |   7 +
 include/configs/bcm7445.h                       |  26 ++
 include/configs/bcmstb.h                        | 183 ++++++++++
 include/fdtdec.h                                |   4 +
 lib/fdtdec.c                                    |   4 +
 28 files changed, 1305 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-bcmstb/Kconfig
 create mode 100644 arch/arm/mach-bcmstb/Makefile
 create mode 100644 arch/arm/mach-bcmstb/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/prior_stage.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/sdhci.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/timer.h
 create mode 100644 arch/arm/mach-bcmstb/lowlevel_init.S
 create mode 100644 board/broadcom/bcmstb/MAINTAINERS
 create mode 100644 board/broadcom/bcmstb/Makefile
 create mode 100644 board/broadcom/bcmstb/bcmstb.c
 create mode 100644 configs/bcm7445_defconfig
 create mode 100644 doc/README.bcm7xxx
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcm7445.h
 create mode 100644 include/configs/bcmstb.h

[snip]

Quoted 8 lines
drivers/spi/spi-uclass.c +0 -0
index d2d091f..c517d06 100644
@@ -273,7 +273,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
        bool created = false;
        int ret;
 
Quoted 9 lines

drivers/spi/spi-uclass.c int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode, · line 276

Quoted 2 lines
drivers/spi/spi-uclass.c +1 -1
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_PLATDATA) || CONFIG_IS_ENABLED(OF_PRIOR_STAGE)

Could you please explain this change a little bit? Why should we call uclass_first_device_err() for OF_PRIOR_STAGE?

Quoted 3 lines
drivers/spi/spi-uclass.c +0 -0
        ret = uclass_first_device_err(UCLASS_SPI, &bus);
 #else
        ret = uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus);
Quoted 7 lines

On the BCM7445 eval board, the prior-stage-provided device tree does not have an alias for spi0, though it has aliases for other device types; I don't know why this is the case, but I don't have control over what the prior stage bootloader (Broadcom's BOLT) provides. Without that alias, uclass_get_device_by_seq fails to find the SPI bus (and so U-Boot can't find the SPI flash device that stores its environment).

Quoted 2 lines

I checked uclass_get_device_by_seq() and did not find any codes that are trying to read aliases. Am I missing anything?

Alias handling is not in the direct uclass_get_device_by_seq call chain, and it took some debugging to find this. The requested sequence number is handled earlier in the boot, in device_bind_common:

   dev->seq = -1;
   dev->req_seq = -1;
   if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) &&
       (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) {
           /*
            * Some devices, such as a SPI bus, I2C bus and serial ports
            * are numbered using aliases.
            *
            * This is just a 'requested' sequence, and will be
            * resolved (and ->seq updated) when the device is probed.
            */
           if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
                   if (uc->uc_drv->name && ofnode_valid(node))
                           dev_read_alias_seq(dev, &dev->req_seq);
           } else {
                   dev->req_seq = uclass_find_next_free_req_seq(drv->id);
           }
   }
Quoted 4 lines

If the prior stage bootloader provides no SPI bus alias, then dev_read_alias_seq fails, dev->req_seq stays unset (-1), and later when an attempt is made to access the SPI bus, the call to uclass_get_device_by_seq fails.

Ah, I see. Thanks!

Quoted 24 lines
Quoted 8 lines
Quoted 6 lines

At the time, I checked other ARM device trees in the Linux kernel and not many set an alias for spi0, so I wrote the patch to choose the first SPI bus. Doing so was in line with what CONFIG_OF_PLATDATA did on boards that wanted to avoid device tree accesses.

Based on what you said, the adding of OF_PRIOR_STAGE here sounds like a hack.

Yeah, it makes an assumption about which SPI bus to use, that may or may not be valid on other boards.

Quoted 8 lines
Quoted 5 lines

I see that since I introduced CONFIG_OF_PRIOR_STAGE, several other ports have started using it, so there's probably a need to generalize this; if other prior stage bootloaders provide SPI aliases then there should be a way for this code to use them.

I think the correct way is to call uclass_get_device_by_seq(). CONFIG_OF_PRIOR_STAGE should not imply such behavior.

OK, but without other changes this would break boards that rely on the above assumption (for example BCM7445).

Quoted 7 lines

I'm experimenting with patches that work on BCM7445 and eliminate the SPI bus assumption but I don't know what effect they might have on other ports that use OF_PRIOR_STAGE.

In general it seems like a good idea to use the prior-stage-provided aliases, but the question is what to do when an alias is missing; maybe always fall back to calling uclass_find_next_free_req_seq?

I tend to agree. As I see lots of places in U-Boot sources, like below:

drivers/i2c/intel_i2c.c::intel_i2c_bind()

if (device_is_on_pci_bus(dev)) {
/*
* ToDo:
* Setting req_seq in the driver is probably not recommended.
* But without a DT alias the number is not configured. And
* using this driver is impossible for PCIe I2C devices.
* This can be removed, once a better (correct) way for this
* is found and implemented.
*/
dev->req_seq = num_cards;

And another example:
drivers/usb/host/ehci-vf.c::vf_usb_bind()

/*
* Without this hack, if we return ENODEV for USB Controller 0, on
* probe for the next controller, USB Controller 1 will be given a
* sequence number of 0. This conflicts with our requirement of
* sequence numbers while initialising the peripherals. */
dev->req_seq = num_controllers;

Quoted 5 lines
Quoted 3 lines

Simon, do you think we should change the behavior of dev->req_seq in the device bind for uclass drivers with DM_UC_FLAG_SEQ_ALIAS flag?

Would you please give some comments regarding this?

Yes I think we should do something here.

I am not quite clear on the best action though.

At present ->seq is set when the device is proved and dropped when it is removed. This is good in the sense that different devices can 'take over' a sequence number. But in practice I don't think we have found that to be very useful.

An alternative would be to do this processing when the device is bound. We might then remove the two separate values and just have one. However it would mean processing aliases which could potentially be slow.

In general I had hoped that sequence numbers would become less important in U-Boot, as they have in Linux. But for now we need to deal with it.

Quoted 13 lines
Quoted 6 lines
Quoted 5 lines

Have you found a board for which uclass_get_device_by_seq works for SPI and uclass_first_device_err does the wrong thing? Is it a publicly available port that I can have a look at?

Quoted 6 lines

No, I was not indicating an error like uclass_get_device_by_seq works for SPI and uclass_first_device_err does the wrong thing. The issue with your implementation is that it forces probing the first SPI controller and ignore the "busnum" completely. This makes a board with multiple SPI controllers unable to probe other controllers than the very first one.

Quoted 2 lines

Regards,
Bin

Regards,
Simon

#27 lore raw

cover dm: CONFIG_OF_PRIOR_STAGE request number fixes

In reply to Bin Meng

These patches remove a workaround that was needed for ports that use CONFIG_OF_PRIOR_STAGE, that need to probe a SPI bus, and whose prior stage device tree does not provide SPI bus aliases.

Thomas Fitzsimmons (2):
dm: device: Request next sequence number
dm: spi: Do not assume first SPI bus

 drivers/core/device.c    | 5 +++++
 drivers/core/uclass.c    | 4 +++-
 drivers/spi/spi-uclass.c | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)
Signature · 1 line
2.23.0
#28 lore raw

PATCH 1/2 dm: device: Request next sequence number

For CONFIG_OF_PRIOR_STAGE, in the absence of a device tree alias for a given device, use the next request number for that type of device. This allows aliases to be used when they're available, while still allowing unaliased devices to be probed.

---
 drivers/core/device.c | 5 +++++
 drivers/core/uclass.c | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/core/device.c +5 -0
index 474c1642ee..ca8be208a9 100644
@@ -82,6 +82,11 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
 		if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
 			if (uc->uc_drv->name && ofnode_valid(node))
 				dev_read_alias_seq(dev, &dev->req_seq);
+#if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
+			if (dev->req_seq == -1)
+				dev->req_seq =
+					uclass_find_next_free_req_seq(drv->id);
+#endif
 		} else {
 			dev->req_seq = uclass_find_next_free_req_seq(drv->id);
 		}
drivers/core/uclass.c +3 -1
index b33296542f..d7aedac351 100644
@@ -269,7 +269,9 @@ int uclass_find_device_by_name(enum uclass_id id, const char *name,
 	return -ENODEV;
 }
 
-#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_PLATDATA)
+#if !CONFIG_IS_ENABLED(OF_CONTROL) || \
+    CONFIG_IS_ENABLED(OF_PLATDATA) || \
+    CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
 int uclass_find_next_free_req_seq(enum uclass_id id)
 {
 	struct uclass *uc;
Signature · 1 line
2.23.0
#29 lore raw

PATCH 1/2 dm: device: Request next sequence number

Hi Thomas,

Quoted 19 lines · Thomas Fitzsimmons

For CONFIG_OF_PRIOR_STAGE, in the absence of a device tree alias for a given device, use the next request number for that type of device. This allows aliases to be used when they're available, while still allowing unaliased devices to be probed.

---
 drivers/core/device.c | 5 +++++
 drivers/core/uclass.c | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/core/device.c +0 -0
index 474c1642ee..ca8be208a9 100644

drivers/core/device.c static int device_bind_common(struct udevice *parent, const struct driver *drv, · line 85

Quoted 4 lines
drivers/core/device.c +1 -0
@@ -82,6 +82,11 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
                if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
                        if (uc->uc_drv->name && ofnode_valid(node))
                                dev_read_alias_seq(dev, &dev->req_seq);
+#if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)

I was wondering whether we should limit such only for OF_PRIOR_STATE, instead change the behaviors for all DM devices.

Because as I pointed out in
https://lists.denx.de/pipermail/u-boot/2019-August/382368.html, it seems there are quite some codes in the existing code base that tried to workaround such limitation in their own way.

Quoted 13 lines
drivers/core/device.c +4 -0
+                       if (dev->req_seq == -1)
+                               dev->req_seq =
+                                       uclass_find_next_free_req_seq(drv->id);
+#endif
                } else {
                        dev->req_seq = uclass_find_next_free_req_seq(drv->id);
                }
drivers/core/uclass.c +0 -0
index b33296542f..d7aedac351 100644
@@ -269,7 +269,9 @@ int uclass_find_device_by_name(enum uclass_id id, const char *name,
        return -ENODEV;

drivers/core/uclass.c int uclass_find_device_by_name(enum uclass_id id, const char *name,

Quoted 10 lines
drivers/core/uclass.c +3 -2
 }
 
-#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_PLATDATA)
+#if !CONFIG_IS_ENABLED(OF_CONTROL) || \
+    CONFIG_IS_ENABLED(OF_PLATDATA) || \
+    CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
 int uclass_find_next_free_req_seq(enum uclass_id id)
 {
        struct uclass *uc;
--

Regards,
Bin

#30 lore raw

PATCH 1/2 dm: device: Request next sequence number

Hi Bin,

Bin Meng <[email protected]> writes:

[...]

Quoted 15 lines · Thomas Fitzsimmons
Quoted 14 lines

For CONFIG_OF_PRIOR_STAGE, in the absence of a device tree alias for a given device, use the next request number for that type of device. This allows aliases to be used when they're available, while still allowing unaliased devices to be probed.

---
 drivers/core/device.c | 5 +++++
 drivers/core/uclass.c | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)
Quoted 12 lines

drivers/core/device.c static int device_bind_common(struct udevice *parent, const struct driver *drv, · line 85

Quoted 9 lines
drivers/core/device.c +1 -0
index 474c1642ee..ca8be208a9 100644
@@ -82,6 +82,11 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
                if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
                        if (uc->uc_drv->name && ofnode_valid(node))
                                dev_read_alias_seq(dev, &dev->req_seq);
+#if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)

I was wondering whether we should limit such only for OF_PRIOR_STATE, instead change the behaviors for all DM devices.

Maybe, though I wouldn't want to break assumptions made in this area by non-OF_PRIOR_STAGE boards.

Quoted 4 lines

Because as I pointed out in
https://lists.denx.de/pipermail/u-boot/2019-August/382368.html, it seems there are quite some codes in the existing code base that tried to workaround such limitation in their own way.

I could create a separate config option to control this behavior, and document what it does in Kconfig. Then other ports could adopt it gradually, and eventually we could make it unconditional. I think OF_PRIOR_STAGE should select the new option, since I can confirm this is an improvement for my OF_PRIOR_STAGE-using board.

Thomas

#31 lore raw

PATCH 1/2 dm: device: Request next sequence number

Quoted 43 lines · Thomas Fitzsimmons

Hi Bin,

Bin Meng <[email protected]> writes:

[...]

Quoted 15 lines · Thomas Fitzsimmons
Quoted 14 lines

For CONFIG_OF_PRIOR_STAGE, in the absence of a device tree alias for a given device, use the next request number for that type of device. This allows aliases to be used when they're available, while still allowing unaliased devices to be probed.

---
 drivers/core/device.c | 5 +++++
 drivers/core/uclass.c | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)
Quoted 12 lines

drivers/core/device.c static int device_bind_common(struct udevice *parent, const struct driver *drv, · line 85

Quoted 9 lines
drivers/core/device.c +1 -0
index 474c1642ee..ca8be208a9 100644
@@ -82,6 +82,11 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
                if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
                        if (uc->uc_drv->name && ofnode_valid(node))
                                dev_read_alias_seq(dev, &dev->req_seq);
+#if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)

I was wondering whether we should limit such only for OF_PRIOR_STATE, instead change the behaviors for all DM devices.

Maybe, though I wouldn't want to break assumptions made in this area by non-OF_PRIOR_STAGE boards.

Quoted 4 lines

Because as I pointed out in
https://lists.denx.de/pipermail/u-boot/2019-August/382368.html, it seems there are quite some codes in the existing code base that tried to workaround such limitation in their own way.

Quoted 7 lines

I could create a separate config option to control this behavior, and document what it does in Kconfig. Then other ports could adopt it gradually, and eventually we could make it unconditional. I think OF_PRIOR_STAGE should select the new option, since I can confirm this is an improvement for my OF_PRIOR_STAGE-using board.

Thomas

It is best to use if() instead of #if if possible.

#32 lore raw

PATCH 1/2 dm: device: Request next sequence number

Quoted 22 lines · Thomas Fitzsimmons

Hi Bin,

Bin Meng <[email protected]> writes:

[...]

Quoted 15 lines · Thomas Fitzsimmons
Quoted 14 lines

For CONFIG_OF_PRIOR_STAGE, in the absence of a device tree alias for a given device, use the next request number for that type of device. This allows aliases to be used when they're available, while still allowing unaliased devices to be probed.

---
 drivers/core/device.c | 5 +++++
 drivers/core/uclass.c | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

Applied to u-boot-dm/next, thanks!

#33 lore raw

PATCH 2/2 dm: spi: Do not assume first SPI bus

In reply to Thomas Fitzsimmons

When CONFIG_OF_PRIOR_STAGE is enabled, this workaround was needed before device_bind_common assigned request numbers sequentially in the absence of aliases.

---
 drivers/spi/spi-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-uclass.c +1 -1
index 88cb2a1262..5e1f2232e5 100644
@@ -275,7 +275,7 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
 	bool created = false;
 	int ret;
 
-#if CONFIG_IS_ENABLED(OF_PLATDATA) || CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
+#if CONFIG_IS_ENABLED(OF_PLATDATA)
 	ret = uclass_first_device_err(UCLASS_SPI, &bus);
 #else
 	ret = uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus);
Signature · 1 line
2.23.0
#34 lore raw

PATCH 2/2 dm: spi: Do not assume first SPI bus

Quoted 11 lines · Thomas Fitzsimmons

When CONFIG_OF_PRIOR_STAGE is enabled, this workaround was needed before device_bind_common assigned request numbers sequentially in the absence of aliases.

---
 drivers/spi/spi-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#35 lore raw

PATCH 2/2 dm: spi: Do not assume first SPI bus

Quoted 11 lines · Thomas Fitzsimmons

When CONFIG_OF_PRIOR_STAGE is enabled, this workaround was needed before device_bind_common assigned request numbers sequentially in the absence of aliases.

---
 drivers/spi/spi-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-dm/next, thanks!

#36 lore raw

v2 cover board: arm: Add support for Broadcom BCM7445

In reply to Thomas Fitzsimmons
Quoted 61 lines · Thomas Fitzsimmons

Add support for Broadcom BCM7445

Changes for v2:
- Reorganize Kconfig to create ARCH_BCMSTB
- Use generic bcmstb SoC name wherever possible
- Eliminate crt0.S changes by moving relocation logic to bcmstb.c
- Use debug() macro where appropriate
- Read bcmstb_spi register base addresses from prior stage device tree, where possible
- Read bcmstb_sdhci register base address from prior stage DT
- Make timer register addresses configurable
- Fix BOLT typos
- Eliminate CONFIG_BCMSTB_ACCOMMODATE_STBLINUX by keeping FIT initramfs and device tree binary in-place
- Add README.bcm7xxx
- Read memory configuration from prior stage device tree
- Add CONFIG_OF_PRIOR_STAGE support in spi-uclass.c
- Fix issues reported by checkpatch.pl
- Fix issues reported by sparse
- Update some comments and formatting
- Add a MAINTAINERS file

Thomas Fitzsimmons (1):
board: arm: Add support for Broadcom BCM7445

 arch/arm/Kconfig                                |  12 +
 arch/arm/Makefile                               |   1 +
 arch/arm/mach-bcmstb/Kconfig                    |  64 ++++
 arch/arm/mach-bcmstb/Makefile                   |   9 +
 arch/arm/mach-bcmstb/include/mach/gpio.h        |  12 +
 arch/arm/mach-bcmstb/include/mach/hardware.h    |  12 +
 arch/arm/mach-bcmstb/include/mach/prior_stage.h |  31 ++
 arch/arm/mach-bcmstb/include/mach/sdhci.h       |  16 +
 arch/arm/mach-bcmstb/include/mach/timer.h       |  14 +
 arch/arm/mach-bcmstb/lowlevel_init.S            |  22 ++
 board/broadcom/bcmstb/MAINTAINERS               |   6 +
 board/broadcom/bcmstb/Makefile                  |   9 +
 board/broadcom/bcmstb/bcmstb.c                  | 192 +++++++++++
 configs/bcm7445_defconfig                       |  27 ++
 doc/README.bcm7xxx                              | 147 ++++++++
 drivers/mmc/Kconfig                             |  11 +
 drivers/mmc/Makefile                            |   1 +
 drivers/mmc/bcmstb_sdhci.c                      |  68 ++++
 drivers/spi/Kconfig                             |   7 +
 drivers/spi/Makefile                            |   1 +
 drivers/spi/bcmstb_spi.c                        | 440 ++++++++++++++++++++++++
 drivers/spi/spi-uclass.c                        |   2 +-
 dts/Kconfig                                     |   7 +
 include/configs/bcmstb.h                        | 189 ++++++++++
 include/fdtdec.h                                |   4 +
 lib/fdtdec.c                                    |   4 +
 26 files changed, 1307 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-bcmstb/Kconfig
 create mode 100644 arch/arm/mach-bcmstb/Makefile
 create mode 100644 arch/arm/mach-bcmstb/include/mach/gpio.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/hardware.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/prior_stage.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/sdhci.h
 create mode 100644 arch/arm/mach-bcmstb/include/mach/timer.h
 create mode 100644 arch/arm/mach-bcmstb/lowlevel_init.S
Quoted 9 lines
 create mode 100644 board/broadcom/bcmstb/MAINTAINERS
 create mode 100644 board/broadcom/bcmstb/Makefile
 create mode 100644 board/broadcom/bcmstb/bcmstb.c
 create mode 100644 configs/bcm7445_defconfig
 create mode 100644 doc/README.bcm7xxx
 create mode 100644 drivers/mmc/bcmstb_sdhci.c
 create mode 100644 drivers/spi/bcmstb_spi.c
 create mode 100644 include/configs/bcmstb.h

I am tracing an issue that lead me to this commit, a huge single commit that changes everywhere. We should not have such a commit merged, sigh.

Regards,
Bin