From 658be7a0514ec7984734c0fffd3dfbc84f06a737 Mon Sep 17 00:00:00 2001 From: Philip Molloy Date: Wed, 25 Mar 2026 13:05:47 +0100 Subject: [PATCH 1/4] board/adi/ev-sc598-som: support SPI NAND The long-term availability of eMMC is in question. Support a modified EV-SC598-SOM where the SPI flash has been replaced with a NAND part that is pin compatible to evaluate performance on the EV-SC598-SOM. Define two devicetree overlays, for Linux and U-Boot, because the register values are off by one. This will eventually get cleaned up as part of a bigger effort to clean-up Linux and remove the U-Boot devicetrees. Signed-off-by: Philip Molloy --- board/adi/ev-sc598-som/nand.cfg | 40 +++++++++++++ .../patches/linux/dts/adi/sc598-som-nand.dts | 58 +++++++++++++++++++ .../ev-sc598-som/patches/linux/nand.fragment | 2 + .../patches/uboot/dts/sc598-som-nand.dts | 58 +++++++++++++++++++ .../ev-sc598-som/patches/uboot/nand.fragment | 3 + configs/adi_sc598_nand.fragment | 7 +++ 6 files changed, 168 insertions(+) create mode 100644 board/adi/ev-sc598-som/nand.cfg create mode 100644 board/adi/ev-sc598-som/patches/linux/dts/adi/sc598-som-nand.dts create mode 100644 board/adi/ev-sc598-som/patches/linux/nand.fragment create mode 100644 board/adi/ev-sc598-som/patches/uboot/dts/sc598-som-nand.dts create mode 100644 board/adi/ev-sc598-som/patches/uboot/nand.fragment create mode 100644 configs/adi_sc598_nand.fragment diff --git a/board/adi/ev-sc598-som/nand.cfg b/board/adi/ev-sc598-som/nand.cfg new file mode 100644 index 0000000..ad5f65a --- /dev/null +++ b/board/adi/ev-sc598-som/nand.cfg @@ -0,0 +1,40 @@ +# Micron 8Gb (1GB) SPI NAND flash +# Model: MT29F8G01ADAFD12-AAT:F +# Datasheet: https://www.micron.com/content/dam/micron/global/secure/products/data-sheet/nand-flash/70-series/m70a-4-8gb-nand-spi-auto.pdf +# Label: U4 +flash nand-1G { + pebsize = 256K + numpebs = 4096 + minimum-io-unit-size = 4096 + sub-page-size = 4096 + vid-header-offset = 4096 +} + +image nand.img { + flash {} + flashtype = "nand-1G" + + partition u-boot-spl { + image = "u-boot-spl.ldr" + size = 256K + } + + partition u-boot { + image = "u-boot.ldr" + size = 768K + } + + partition dtb { + image = "sc598-som-nand.dtb" + size = 256K + } + + partition kernel { + image = "Image" + size = 32M + } + + partition rootfs { + image = "rootfs.ubi" + } +} diff --git a/board/adi/ev-sc598-som/patches/linux/dts/adi/sc598-som-nand.dts b/board/adi/ev-sc598-som/patches/linux/dts/adi/sc598-som-nand.dts new file mode 100644 index 0000000..5d783ac --- /dev/null +++ b/board/adi/ev-sc598-som/patches/linux/dts/adi/sc598-som-nand.dts @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2026 Analog Devices Incorporated + */ + +/dts-v1/; + +#include "sc598-som-revE.dtsi" + +/ { + model = "ADI SC598-SOM with NAND"; + compatible = "adi,sc598-som-nand", "adi,sc59x-64"; +}; + +&spi2 { + /delete-node/ is25lp01g@0; + + som_flash: spi-nand@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <25000000>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot-spl"; + reg = <0x0 0x40000>; + }; + + partition@40000 { + label = "u-boot"; + reg = <0x40000 0xC0000>; + }; + + partition@100000 { + label = "dtb"; + reg = <0x100000 0x40000>; + }; + + partition@140000 { + label = "kernel"; + reg = <0x140000 0x2000000>; + }; + + partition@2140000 { + label = "rootfs"; + reg = <0x2140000 0x3DEC0000>; + }; + }; + }; +}; diff --git a/board/adi/ev-sc598-som/patches/linux/nand.fragment b/board/adi/ev-sc598-som/patches/linux/nand.fragment new file mode 100644 index 0000000..613e448 --- /dev/null +++ b/board/adi/ev-sc598-som/patches/linux/nand.fragment @@ -0,0 +1,2 @@ +CONFIG_MTD_SPI_NAND=y +CONFIG_MTD_UBI=y diff --git a/board/adi/ev-sc598-som/patches/uboot/dts/sc598-som-nand.dts b/board/adi/ev-sc598-som/patches/uboot/dts/sc598-som-nand.dts new file mode 100644 index 0000000..3d85b99 --- /dev/null +++ b/board/adi/ev-sc598-som/patches/uboot/dts/sc598-som-nand.dts @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2026 Analog Devices Incorporated + */ + +/dts-v1/; + +#include "sc598-som-revE.dtsi" + +/ { + model = "ADI SC598-SOM with NAND"; + compatible = "adi,sc598-som-nand", "adi,sc59x-64"; +}; + +&spi2 { + /delete-node/ is25lp01g@1; + + som_flash: spi-nand@1 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <25000000>; + spi-rx-bus-width = <4>; + spi-tx-bus-width = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot-spl"; + reg = <0x0 0x40000>; + }; + + partition@40000 { + label = "u-boot"; + reg = <0x40000 0xC0000>; + }; + + partition@100000 { + label = "dtb"; + reg = <0x100000 0x40000>; + }; + + partition@140000 { + label = "kernel"; + reg = <0x140000 0x2000000>; + }; + + partition@2140000 { + label = "rootfs"; + reg = <0x2140000 0x3DEC0000>; + }; + }; + }; +}; diff --git a/board/adi/ev-sc598-som/patches/uboot/nand.fragment b/board/adi/ev-sc598-som/patches/uboot/nand.fragment new file mode 100644 index 0000000..53e3f1b --- /dev/null +++ b/board/adi/ev-sc598-som/patches/uboot/nand.fragment @@ -0,0 +1,3 @@ +CONFIG_DEFAULT_DEVICE_TREE="sc598-som-nand" +CONFIG_DM_MTD=y +CONFIG_MTD_SPI_NAND=y diff --git a/configs/adi_sc598_nand.fragment b/configs/adi_sc598_nand.fragment new file mode 100644 index 0000000..837fdc3 --- /dev/null +++ b/configs/adi_sc598_nand.fragment @@ -0,0 +1,7 @@ +BR2_LINUX_KERNEL_INTREE_DTS_NAME="adi/sc598-som-nand" +BR2_LINUX_KERNEL_CUSTOM_DTS_DIR="$(BR2_EXTERNAL)/board/adi/ev-sc598-som/patches/linux/dts/" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL)/board/adi/ev-sc598-som/patches/linux/nand.fragment" +BR2_TARGET_UBOOT_CUSTOM_DTS_PATH="$(BR2_EXTERNAL)/board/adi/ev-sc598-som/patches/uboot/dts/sc598-som-nand.dts" +BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL)/board/adi/ev-sc598-som/patches/uboot/nand.fragment" +BR2_ROOTFS_POST_IMAGE_SCRIPT_ARGS="-c $(BR2_EXTERNAL)/board/adi/ev-sc598-som/nand.cfg" +# BR2_TARGET_ROOTFS_EXT2 is not set From 69cb3f10ec7a3a266a41903ea77cc673d3a9e9ae Mon Sep 17 00:00:00 2001 From: Philip Molloy Date: Fri, 10 Apr 2026 10:05:04 -0400 Subject: [PATCH 2/4] board/adi/ev-sc598-som: increase SPI NAND clock speed Reconfigure the clock tree to improve SPI NAND performance by 25% (4.4 MB/s to 5.5 MB/s). Increase CGU0_ODIV output (oclk_0) from 62.5 MHz to 250 MHz, configure the SPI controller to use oclk_0 as parent, and set spi-max-frequency to 83 MHz (actual: 83.3 MHz). This avoids modifying sclk0_0 which is shared by UARTs, I2C, timers, watchdog, and Ethernet. Since eMMC defaults to oclk_0 and cannot handle 250 MHz, reconfigure it to use dclk_0_half (167 MHz). Also disable eMMC as it is not used in this NAND-only configuration. Tested with: time nanddump /dev/mtd4 -l 1048576 -f /dev/null Signed-off-by: Philip Molloy --- .../patches/linux/dts/adi/sc598-som-nand.dts | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/board/adi/ev-sc598-som/patches/linux/dts/adi/sc598-som-nand.dts b/board/adi/ev-sc598-som/patches/linux/dts/adi/sc598-som-nand.dts index 5d783ac..bf35079 100644 --- a/board/adi/ev-sc598-som/patches/linux/dts/adi/sc598-som-nand.dts +++ b/board/adi/ev-sc598-som/patches/linux/dts/adi/sc598-som-nand.dts @@ -12,6 +12,34 @@ compatible = "adi,sc598-som-nand", "adi,sc59x-64"; }; +/* + * Clock configuration for faster SPI NAND performance. + * + * Default SPI clock sources (sclk0_0, oclk_0) are both 62.5 MHz, limiting + * SPI speed. Reconfigure oclk_0 to 250 MHz instead of using sclk0_0 + * because sclk0_0 is shared by UARTs, I2C, timers, watchdog, and Ethernet. + * + * CGU0_ODIV: 1000 MHz / 4 = 250 MHz (was / 16 = 62.5 MHz) + * SPI_SEL: Use oclk_0 as SPI parent + * EMMC_SEL: Switch eMMC to dclk_0_half (eMMC defaults to oclk_0, which + * would break it at 250 MHz - "Internal clock never stabilised") + * + * time nanddump /dev/mtd4 -l 1048576 -f /dev/null + * ~21 MHz (original): 0.24s (~4.4 MB/s) + * 62.5 MHz: 0.20s (~5.2 MB/s) + * 83.3 MHz: 0.19s (~5.5 MB/s) + * 125 MHz: probe failed (ID reads 0xffffffff) + */ +&clk { + assigned-clocks = <&clk ADSP_SC598_CLK_CGU0_ODIV>, <&clk ADSP_SC598_CLK_SPI_SEL>, <&clk ADSP_SC598_CLK_EMMC_SEL>; + assigned-clock-rates = <250000000>, <0>, <0>; + assigned-clock-parents = <0>, <&clk ADSP_SC598_CLK_CGU0_OCLK>, <&clk ADSP_SC598_CLK_DCLK0_HALF>; +}; + +&mmc0 { + status = "disabled"; +}; + &spi2 { /delete-node/ is25lp01g@0; @@ -20,7 +48,7 @@ #size-cells = <1>; compatible = "spi-nand"; reg = <0>; - spi-max-frequency = <25000000>; + spi-max-frequency = <83000000>; spi-rx-bus-width = <4>; spi-tx-bus-width = <4>; From 16c7fd92ba9367d34cc75bec220fd82d1308af46 Mon Sep 17 00:00:00 2001 From: Philip Molloy Date: Fri, 10 Apr 2026 10:06:07 -0400 Subject: [PATCH 3/4] board/adi/ev-sc598-som: Support loading initramfs using booti Signed-off-by: Philip Molloy --- board/adi/ev-sc598-som/patches/uboot/nand.fragment | 1 + configs/adi_sc598_nand.fragment | 2 ++ 2 files changed, 3 insertions(+) diff --git a/board/adi/ev-sc598-som/patches/uboot/nand.fragment b/board/adi/ev-sc598-som/patches/uboot/nand.fragment index 53e3f1b..552a5e3 100644 --- a/board/adi/ev-sc598-som/patches/uboot/nand.fragment +++ b/board/adi/ev-sc598-som/patches/uboot/nand.fragment @@ -1,3 +1,4 @@ CONFIG_DEFAULT_DEVICE_TREE="sc598-som-nand" CONFIG_DM_MTD=y CONFIG_MTD_SPI_NAND=y +CONFIG_SUPPORT_RAW_INITRD=y diff --git a/configs/adi_sc598_nand.fragment b/configs/adi_sc598_nand.fragment index 837fdc3..4ad778f 100644 --- a/configs/adi_sc598_nand.fragment +++ b/configs/adi_sc598_nand.fragment @@ -5,3 +5,5 @@ BR2_TARGET_UBOOT_CUSTOM_DTS_PATH="$(BR2_EXTERNAL)/board/adi/ev-sc598-som/patches BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL)/board/adi/ev-sc598-som/patches/uboot/nand.fragment" BR2_ROOTFS_POST_IMAGE_SCRIPT_ARGS="-c $(BR2_EXTERNAL)/board/adi/ev-sc598-som/nand.cfg" # BR2_TARGET_ROOTFS_EXT2 is not set +BR2_TARGET_ROOTFS_CPIO=y +BR2_TARGET_ROOTFS_CPIO_GZIP=y From b9b9247824afd1c81e32ecc1aeed73f4be417e34 Mon Sep 17 00:00:00 2001 From: Philip Molloy Date: Wed, 15 Apr 2026 08:26:38 -0400 Subject: [PATCH 4/4] board/adi/ev-sc598-som: specify NAND model and explicit ECC config Signed-off-by: Philip Molloy --- .../ev-sc598-som/patches/linux/dts/adi/sc598-som-nand.dts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/board/adi/ev-sc598-som/patches/linux/dts/adi/sc598-som-nand.dts b/board/adi/ev-sc598-som/patches/linux/dts/adi/sc598-som-nand.dts index bf35079..117b9dd 100644 --- a/board/adi/ev-sc598-som/patches/linux/dts/adi/sc598-som-nand.dts +++ b/board/adi/ev-sc598-som/patches/linux/dts/adi/sc598-som-nand.dts @@ -46,11 +46,14 @@ som_flash: spi-nand@0 { #address-cells = <1>; #size-cells = <1>; - compatible = "spi-nand"; + compatible = "micron,mt29f1g01abafd", "spi-nand"; reg = <0>; spi-max-frequency = <83000000>; spi-rx-bus-width = <4>; spi-tx-bus-width = <4>; + nand-ecc-mode = "on-die"; + nand-ecc-strength = <1>; + nand-ecc-step-size = <512>; partitions { compatible = "fixed-partitions";