All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] board/broadcom: add support for BCM4908 platform devices
@ 2021-08-12 10:52 Rafał Miłecki
  2021-08-19 21:41 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Rafał Miłecki @ 2021-08-12 10:52 UTC (permalink / raw)
  To: buildroot; +Cc: Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

BCM4908 is Broadcom's 64-bit platform with Broadcom's own Brahma-B53
CPU(s). It's mostly used for home routers.

Kernel config is a minimal setup required to support on-SoC blocks like
NAND controller, Ethernet, switch, USB.

To make kernels 5.12+ boot those boards require a hacky patch modifying
hyp-stub.S. That booting problem will hopefully get fixes on day in
upstream kernel code.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 board/broadcom/bcm4908/linux.config           | 42 +++++++++++++++++++
 .../0001-arm64-don-t-issue-HVC-on-boot.patch  | 32 ++++++++++++++
 configs/broadcom_bcm4908_defconfig            | 12 ++++++
 3 files changed, 86 insertions(+)
 create mode 100644 board/broadcom/bcm4908/linux.config
 create mode 100644 board/broadcom/bcm4908/patches/linux/0001-arm64-don-t-issue-HVC-on-boot.patch
 create mode 100644 configs/broadcom_bcm4908_defconfig

diff --git a/board/broadcom/bcm4908/linux.config b/board/broadcom/bcm4908/linux.config
new file mode 100644
index 0000000..28d7c39
--- /dev/null
+++ b/board/broadcom/bcm4908/linux.config
@@ -0,0 +1,42 @@
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE="${BR_BINARIES_DIR}/rootfs.cpio"
+CONFIG_ARCH_BCM4908=y
+CONFIG_NR_CPUS=4
+CONFIG_CMDLINE="earlycon=bcm63xx_uart,0xff800640 console=ttyS0,115200"
+CONFIG_CMDLINE_FORCE=y
+# CONFIG_GCC_PLUGINS is not set
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_BRIDGE=y
+CONFIG_BRIDGE_VLAN_FILTERING=y
+CONFIG_NET_DSA=y
+CONFIG_VLAN_8021Q=y
+CONFIG_PCI=y
+CONFIG_PCIEPORTBUS=y
+CONFIG_PCIE_BRCMSTB=y
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+CONFIG_MTD=y
+CONFIG_MTD_RAW_NAND=y
+CONFIG_MTD_NAND_BRCMNAND=y
+CONFIG_NETDEVICES=y
+CONFIG_NET_DSA_BCM_SF2=y
+CONFIG_SERIAL_BCM63XX=y
+CONFIG_SERIAL_BCM63XX_CONSOLE=y
+CONFIG_I2C=y
+CONFIG_I2C_CHARDEV=y
+CONFIG_I2C_SLAVE=y
+CONFIG_SPI=y
+CONFIG_PINCTRL=y
+CONFIG_POWER_RESET_SYSCON=y
+CONFIG_THERMAL=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_PLATFORM=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_HCD_PLATFORM=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_HCD_PLATFORM=y
+CONFIG_RESET_CONTROLLER=y
diff --git a/board/broadcom/bcm4908/patches/linux/0001-arm64-don-t-issue-HVC-on-boot.patch b/board/broadcom/bcm4908/patches/linux/0001-arm64-don-t-issue-HVC-on-boot.patch
new file mode 100644
index 0000000..32e2b63
--- /dev/null
+++ b/board/broadcom/bcm4908/patches/linux/0001-arm64-don-t-issue-HVC-on-boot.patch
@@ -0,0 +1,32 @@
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Thu, 12 Aug 2021 11:52:42 +0200
+Subject: [PATCH] arm64: don't issue HVC on boot
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Broadcom's CFE loader seems to miss setting SCR_EL3.HCE which results in
+generating an UNDEF and kernel panic on the first HVC.
+
+HVC gets issued by kernels 5.12+ while booting, by kexec and KVM. Until
+someone finds a workaround we have to avoid all above.
+
+Workarounds: 0c93df9622d4 ("arm64: Initialise as nVHE before switching to VHE")
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+---
+ arch/arm64/kernel/hyp-stub.S | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm64/kernel/hyp-stub.S b/arch/arm64/kernel/hyp-stub.S
+index 43d212618..fc95b103e 100644
+--- a/arch/arm64/kernel/hyp-stub.S
++++ b/arch/arm64/kernel/hyp-stub.S
+@@ -238,7 +238,7 @@ SYM_FUNC_START(switch_to_vhe)
+ 
+ 	// Turn the world upside down
+ 	mov	x0, #HVC_VHE_RESTART
+-	hvc	#0
++//	hvc	#0
+ 1:
+ 	ret
+ SYM_FUNC_END(switch_to_vhe)
diff --git a/configs/broadcom_bcm4908_defconfig b/configs/broadcom_bcm4908_defconfig
new file mode 100644
index 0000000..c6310de
--- /dev/null
+++ b/configs/broadcom_bcm4908_defconfig
@@ -0,0 +1,12 @@
+BR2_aarch64=y
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.13.9"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/broadcom/bcm4908/linux.config"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm4908/bcm4906-netgear-r8000p broadcom/bcm4908/bcm4906-tplink-archer-c2300-v1 broadcom/bcm4908/bcm4908-asus-gt-ac5300"
+BR2_PACKAGE_LINUX_FIRMWARE=y
+BR2_PACKAGE_BRIDGE_UTILS=y
+BR2_TARGET_ROOTFS_INITRAMFS=y
+# BR2_TARGET_ROOTFS_TAR is not set
-- 
2.26.2

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] board/broadcom: add support for BCM4908 platform devices
  2021-08-12 10:52 [Buildroot] [PATCH] board/broadcom: add support for BCM4908 platform devices Rafał Miłecki
@ 2021-08-19 21:41 ` Thomas Petazzoni
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2021-08-19 21:41 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: Rafał Miłecki, buildroot

Hello Rafał,

On Thu, 12 Aug 2021 12:52:58 +0200
Rafał Miłecki <zajec5@gmail.com> wrote:

> From: Rafał Miłecki <rafal@milecki.pl>
> 
> BCM4908 is Broadcom's 64-bit platform with Broadcom's own Brahma-B53
> CPU(s). It's mostly used for home routers.
> 
> Kernel config is a minimal setup required to support on-SoC blocks like
> NAND controller, Ethernet, switch, USB.
> 
> To make kernels 5.12+ boot those boards require a hacky patch modifying
> hyp-stub.S. That booting problem will hopefully get fixes on day in
> upstream kernel code.
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>

Here again this defconfig does not build any bootloader. Most Buildroot
defconfigs normally try to build the whole software stack, including
the bootloader/firmware. Any reason not to do so here? Also why is an
initramfs used?

> ---
>  board/broadcom/bcm4908/linux.config           | 42 +++++++++++++++++++
>  .../0001-arm64-don-t-issue-HVC-on-boot.patch  | 32 ++++++++++++++
>  configs/broadcom_bcm4908_defconfig            | 12 ++++++
>  3 files changed, 86 insertions(+)

board/broadcom/bcm4908/readme.txt needed, as well as an update to the
DEVELOPERS file.


> +++ b/board/broadcom/bcm4908/linux.config
> @@ -0,0 +1,42 @@
> +CONFIG_BLK_DEV_INITRD=y
> +CONFIG_INITRAMFS_SOURCE="${BR_BINARIES_DIR}/rootfs.cpio"

Not needed, will be added by Buildroot.


> diff --git a/configs/broadcom_bcm4908_defconfig b/configs/broadcom_bcm4908_defconfig
> new file mode 100644
> index 0000000..c6310de
> --- /dev/null
> +++ b/configs/broadcom_bcm4908_defconfig
> @@ -0,0 +1,12 @@
> +BR2_aarch64=y
> +BR2_LINUX_KERNEL=y
> +BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.13.9"
> +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
> +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/broadcom/bcm4908/linux.config"
> +BR2_LINUX_KERNEL_DTS_SUPPORT=y
> +BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm4908/bcm4906-netgear-r8000p broadcom/bcm4908/bcm4906-tplink-archer-c2300-v1 broadcom/bcm4908/bcm4908-asus-gt-ac5300"
> +BR2_PACKAGE_LINUX_FIRMWARE=y

Added, but no firmware enabled?

> +BR2_PACKAGE_BRIDGE_UTILS=y

Not needed.

> +BR2_TARGET_ROOTFS_INITRAMFS=y
> +# BR2_TARGET_ROOTFS_TAR is not set

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

end of thread, other threads:[~2021-08-19 21:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 10:52 [Buildroot] [PATCH] board/broadcom: add support for BCM4908 platform devices Rafał Miłecki
2021-08-19 21:41 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.