On Wed, Jan 21, 2026 at 06:24:01PM -0500, Raymond Mao wrote:
> Hi Yao Zi,
>
> On Mon, Jan 19, 2026 at 4:41 AM Yao Zi <[email protected]> wrote:
>
> > (My mail provider complains about the huge list of recipients, so I
> > reduced it a little.)
> >
> > On Sat, Jan 17, 2026 at 02:01:48PM -0500, Raymond Mao wrote:
> > > From: Raymond Mao <[email protected]>
> > >
> > > Include DDR initialization firmware in the SPL image. The firmware
> > > path can be specified via the DDR_FW_FILE environment variable. If
> > > the firmware is not found, an empty placeholder file is created to
> > > allow the build to proceed without DDR initialization support.
> > >
> > > Signed-off-by: Raymond Mao <[email protected]>
> > > ---
> > > arch/riscv/dts/k1-spl.dts | 34 ++++++++++++++++++++++++++++++++-
> > > board/spacemit/k1/Kconfig | 8 ++++++++
> > > board/spacemit/k1/Makefile | 19 ++++++++++++++++++
> > > board/spacemit/k1/spl.c | 30 +++++++++++++++++++++++++++++
> > > include/configs/k1.h | 3 +++
> > > lib/vendor/spacemit/ddr_fw.bin | Bin 0 -> 19416 bytes
> >
> > It's unusual to ship binary firmware in U-Boot repository. Please place
> > the firmware somewhere else, and give a clear instruction in the
> > board/architecture documentation explaining how to obtain/build it.
> >
> > > 6 files changed, 93 insertions(+), 1 deletion(-)
> > > create mode 100644 lib/vendor/spacemit/ddr_fw.bin
> >
> > ...
> >
> > > diff --git a/board/spacemit/k1/Kconfig b/board/spacemit/k1/Kconfig
> > > index 9f9c806d00d..a5fa788f660 100644
> > > --- a/board/spacemit/k1/Kconfig
> > > +++ b/board/spacemit/k1/Kconfig
> > > @@ -15,6 +15,14 @@ config SYS_CONFIG_NAME
> > > config TEXT_BASE
> > > default 0x00200000
> > >
> > > +config SPL_DDR_FIRMWARE_OFFSET
> > > + hex "DDR firmware offset in SPL image"
> > > + depends on SPL
> > > + default 0x20000
> > > + help
> > > + Offset where DDR firmware should be placed in the SPL
> > > + image.
> > > +
> > > config SPL_OPENSBI_LOAD_ADDR
> > > default 0x00000000
> > >
> > > diff --git a/board/spacemit/k1/Makefile b/board/spacemit/k1/Makefile
> > > index 7bce47bac8c..ebe6e55867c 100644
> > > --- a/board/spacemit/k1/Makefile
> > > +++ b/board/spacemit/k1/Makefile
> > > @@ -5,3 +5,22 @@
> > >
> > > obj-y := board.o
> > > obj-$(CONFIG_SPL_BUILD) += spl.o
> > > +
> > > +DDR_FW_SRC ?= $(DDR_FW_FILE)
> > > +FW_TARGET = $(srctree)/lib/vendor/spacemit/ddr_fw.bin
> > > +
> > > +DDR_FW_HEADER = $(objtree)/include/generated/ddr_fw_info.h
> > > +
> > > +$(obj)/spl.o: $(DDR_FW_HEADER)
> > > +
> > > +$(DDR_FW_HEADER): $(FW_TARGET)
> > > + @echo "/* DDR firmware info - $$(date) */" > $@
> > > + @if [ -f "$(FW_TARGET)" ]; then \
> > > + SIZE=$$(stat -c%s "$(FW_TARGET)" 2>/dev/null || echo 0); \
> > > + else \
> > > + SIZE=0; \
> > > + fi; \
> > > + echo "#define DDR_FW_FILE_SIZE $$SIZE" >> $@
> > > + @echo "/* Note: Update ADDR if binman layout changes */" >> $@
> > > +
> > > +clean-files += $(FW_TARGET) $(DDR_FW_HEADER)
> >
> > Please make use of existing binman[1] facibilities to avoid the extra
> > Kconfig and Makefile pieces. binman_sym() could be used for obtaining
> > both size and offset of a binman entry.
> >
> > It doesn't work at all in SPL. I checked the binman symbol table
> that was totally empty.
I've tried commit fd871fc6bb49 ("pinctrl: mediatek: mt8365: add PUPD
registers") with th1520_lpi4a_defconfig, and
drivers/ram/thead/th1520_ddr.c, which makes use of binman_sym(), does
work.
This suggests binman facilities do work on RISC-V, at least after the
last time when I fixed it[1]. Are you testing on a U-Boot version
earlier than v2025.07? Otherwise there's likely something (configuration
or code) wrong on your side.
btw, every first line of your replied paragraphs has the wrong level of
quotes, which is a little confusing.
Best regards,
Yao Zi
[1]: https://lore.kernel.org/u-boot/[email protected]/