build/patch/u-boot/v2023.01/board_odroidhc4/board.odroidhc4.hc4_sd_defconfig.for.writing.to.mtd.patch

146 lines
5.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ricardo Pardini <ricardo@pardini.net>
Date: Mon, 14 Nov 2022 14:59:45 +0100
Subject: odroidhc4: add a marker boot-from-SD-write-to-SPI defconfig for the
HC4 based the C4 DT
For reasons I don't understand, using the HC4 DT + SPI + PCI stuff in odroid-hc4_defconfig
causes the HC4 to be unable to talk to the SPI MTD. Since it's quite common that an user
booting an Armbian SD card on the HC4 will want to write to the SPI MTD (with intent to
de-infest their machine from Petitboot), Armbian has for a long time shipped the
odroid-c4_defconfig for the HC4 image (usually written to SD card), while shipping the
proper odroid-hc4_defconfig for the SPI version (deployed to MTD by armbian-install).
This patch is thus, not required; we could simply use the c4_defconfig for the SD image.
See below, but it seems to boil down to the DT, not any other defconfig changes.
Below are a few different tries I've made:
## SPI Crazy vs C4/HC4 defconfig
- all below tests done on the following conditions:
- wiped/zeroed SPI flash (`cat /dev/zero > /dev/mtdblock0; sync`)
- u-boot.bin.sd.bin flashed SD card
- SD card inserted
- "button" not pressed at all
- initial cold boot, then some warm reboots.
- on `odroid-hc4_defconfig`:
- `SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:B;RCY:0;SPINOR:0;CHK:1F;EMMC:800;NAND:81;SD?:0;SD:0;READ:0;0.0;CHK:0;`
- u-boot `sf probe`: `jedec_spi_nor spi-flash@0: unrecognized JEDEC id bytes: 00, 00, 00`
- kernel: `spi-nor spi0.0: unrecognized JEDEC id bytes: 00 00 00 00 00 00`
- new `odroid-hc4_sd_defconfig`: (a copy of C4 version, but without the SPI stuff)
- `SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:B;RCY:0;SPINOR:0;CHK:1F;EMMC:800;NAND:81;SD?:0;SD:0;READ:0;0.0;CHK:0;`
- no u-boot `sf probe` since I left it out
- kernel: `spi-nor spi0.0: unrecognized JEDEC id bytes: 00 00 00 00 00 00`
- bootloop! (unrelated? kernel meson-gx-mmc stuff? BLxx says `sdio read data fail` and resets to `SM1:BL...`)
- new `odroid-hc4_sd_defconfig` (a copy of C4 version, sans-SPI, sans-PCI, sans GPIO-reg, only DT change):
- no bootloop, on try 1 -- why?
- no bootloop, on try 2 -- disabling pci, keeping dtb, avoids bootloop? some other change?
- no u-boot `sf probe` since I left it out
- kernel: `spi-nor spi0.0: unrecognized JEDEC id bytes: 00 00 00 00 00 00`
- new `odroid-hc4_sd_defconfig` (a copy of C4 version, sans-SPI, sans-PCI, sans GPIO-reg, using C4 DT)
- `SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:B;RCY:0;SPINOR:0;CHK:1F;EMMC:800;NAND:81;SD?:0;SD:0;READ:0;0.0;CHK:0;`
- SPI MTD works in kernel: `spi-nor spi0.0: xt25f128b (16384 Kbytes)`
- bootloop! (unrelated? kernel meson-gx-mmc stuff? BLxx says `sdio read data fail` and resets to `SM1:BL...`)
- this is the version that's actually included in this patch; essentially just c4_defconfig.
- now flashed SPI, booting from SPI, with HC4 defconfig +preboot for USB
- `SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:B;RCY:0;SPINOR:0;0.0;CHK:0;`
- kernel: `spi-nor spi0.0: xt25f128b (16384 Kbytes)`
- u-boot `sf probe`: `SF: Detected xt25f128b with page size 256 Bytes, erase size 4 KiB, total 16 MiB`
- everything works once SoC boots from SPI and uses the HC4 defconfig; no bootloops since SD is not involved at all
---
configs/odroid-hc4_sd_defconfig | 77 ++++++++++
1 file changed, 77 insertions(+)
diff --git a/configs/odroid-hc4_sd_defconfig b/configs/odroid-hc4_sd_defconfig
new file mode 100644
index 0000000000..7d2736b2bb
--- /dev/null
+++ b/configs/odroid-hc4_sd_defconfig
@@ -0,0 +1,77 @@
+CONFIG_ARM=y
+CONFIG_SYS_BOARD="odroid-n2"
+CONFIG_ARCH_MESON=y
+CONFIG_TEXT_BASE=0x01000000
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-sm1-odroid-c4"
+CONFIG_MESON_G12A=y
+CONFIG_DEBUG_UART_BASE=0xff803000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_IDENT_STRING=" odroid-hc4"
+CONFIG_SYS_LOAD_ADDR=0x1000000
+CONFIG_DEBUG_UART=y
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
+CONFIG_REMAKE_ELF=y
+CONFIG_OF_BOARD_SETUP=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+CONFIG_SYS_MAXARGS=32
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_ADC=y
+CONFIG_SARADC_MESON=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DM_MDIO=y
+CONFIG_DM_MDIO_MUX=y
+CONFIG_ETH_DESIGNWARE_MESON8B=y
+CONFIG_MDIO_MUX_MESON_G12A=y
+CONFIG_MESON_G12A_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_G12A=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_MESON_EE_POWER_DOMAIN=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_MESON_G12A=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
+CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_USB_GADGET_DWC2_OTG_PHY_BUS_WIDTH_8=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_VIDEO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP16 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_MESON=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_VIDEO_BMP_RLE8=y
+CONFIG_BMP_16BPP=y
+CONFIG_BMP_24BPP=y
+CONFIG_BMP_32BPP=y
+CONFIG_OF_LIBFDT_OVERLAY=y
--
Armbian