U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: E Shattow <e@freeshell.de>
To: u-boot@lists.u-boot-project.org
Subject: Re: [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP (continued)
Date: Wed, 25 Nov 2026 15:52:40 -0800	[thread overview]
Message-ID: <0bdd7822-46ea-4e1c-8ce5-a0975ee8cd96@freeshell.de> (raw)
In-Reply-To: <20261029003327.1890979-1-e@freeshell.de>

Update as of November 2026,

On 10/28/26 17:33, E Shattow wrote:
> Do Not Merge
> 
> Informational purpose only, to aid mainline development of SpacemiT K3
> support.
> 
> ...continued from https://lore.kernel.org/u-boot/20261029001555.1890775-1-e@freeshell.de/
> 
> What is known to be working from mainline?
> - mkimage to post-process SPL into spl/u-boot-spl-mkimage.bin
> - FIT U-Boot main app u-boot.itb
> - dependency on OpenSBI
> 
> What do we need from the vendor BSP?
> - SPL
> 

> (Optional) Additional hardware used?
> - K3 Pico-ITX BootROM UART SPL loader mode selected by pull-up via
>   FPC-36P reverse cable and adapter to header pins (2.54mm pitch
>   DuPont connector).

Also an JST GH1.25 4P cable and breakout board accommodates a power
indicator LED and momentary switch. Long-press (~3 seconds) of the
switch begins a flashing power indicator LED sequence and after some
delay (~4 seconds) the power turns off. Short-press of the switch turns
on power when it was off previously. This can be useful to instrument
the power on/off sequence and set boot modes for automated board
testing, without soldering to the reset and boot mode button connections
directly.

OpenCD debug access for K3 Pico-ITX to K3 SoC is connected via five
solder points on the opposite face of PCB and near the same position
where the FPC-36P connector is populated. This is documented at:

https://github.com/spacemit-com/docs-chip/blob/main/en/key_stone/k3/k3_hw/static/pico-jtag-debug.png

Signal layout ordering:
- TRST_N (near "do not dispose in trash" silkscreen iconography)
- TDO
- TMS
- TDI
- TCK (near FPC-36P pin 18 on opposite face of PCB)

OpenCD debug access for K3 CoM260 to K3 SoC is connected via an adapter
for the micro SD card slot.

> 
> The assumption in this guide is root user in a fresh Debian 13
> Trixie build environment on amd64 architecture build host.
> 
> dpkg --add-architecture riscv64
> apt install -y bison ca-certificates flex gcc-riscv64-linux-gnu git \
>   libgnutls28-dev libpython3-dev libssl-dev python3-setuptools swig \
>   curl
> export CROSS_COMPILE=riscv64-linux-gnu-
> 
> git clone https://github.com/riscv-software-src/opensbi.git \
>   opensbi.git

> git -C opensbi.git checkout d28bc6f89837 # origin/master
> # v6 "platform: generic: spacemit: add K3 platform support"
> # https://patchwork.ozlabs.org/project/opensbi/list/?series=530305
> curl https://patchwork.ozlabs.org/series/530305/mbox/ \
>   | git -C opensbi.git am
> make -C opensbi.git O=../opensbi clean
> make -C opensbi.git O=../opensbi PLATFORM=generic

This was since merged in mainline OpenSBI for the next
tag after v1.9 release.

> 
> git clone https://git.u-boot-project.org/u-boot/u-boot.git u-boot.git
> git -C u-boot.git remote add -f spacemit-com \
>   https://github.com/spacemit-com/uboot-2022.10.git
> 

> git -C u-boot.git checkout 03e45557e1f3 # origin/main
> # v1 "Spacemit K3 enable Linux boot"
> # https://patchwork.ozlabs.org/project/uboot/list/?series=530384
> curl https://patchwork.ozlabs.org/series/530384/mbox/ \
>   | git -C u-boot.git am
> make -C u-boot.git O=../u-boot spacemit_k3_defconfig
> fw_dynbin=$(realpath opensbi/platform/generic/firmware/fw_dynamic.bin)
> make -C u-boot.git O=../u-boot OPENSBI=$fw_dynbin

This was since merged in mainline U-Boot for v2026.10-rc6 release candidate.

> 
> git -C u-boot.git checkout k3-br-v1.0.10 # spacemit-com/k3-br-v1.0.y
> # v1 "Guide to build reduced SpacemiT K3 vendor BSP"
> # https://patchwork.ozlabs.org/project/uboot/list/?series=530447
> curl https://patchwork.ozlabs.org/series/530447/mbox/ \
>   | git -C u-boot.git am
> mki=$(realpath u-boot/tools/mkimage)
> make -C u-boot.git O=../bsp-spi \
>   spacemit_k3_uart_spi_defconfig
> make -C u-boot.git O=../bsp-spi MKIMAGE=$mki \
>   spl/u-boot-spl-mkimage.bin
> make -C u-boot.git O=../bsp-nospi \
>   spacemit_k3_uart_nospi_defconfig
> make -C u-boot.git O=../bsp-nospi MKIMAGE=$mki \
>   spl/u-boot-spl-mkimage.bin
> 
> tar -czf reduced-spacemit-k3-vendor-bsp.tar.gz \
>   --transform 's~^~reduced-spacemit-k3-vendor-bsp/~' \
>   bsp-nospi/spl/u-boot-spl-mkimage.bin \
>   bsp-spi/spl/u-boot-spl-mkimage.bin \
>   u-boot/u-boot.itb
> 
> ### K3 Pico-ITX BootROM UART SPL loader
> Connect USB selection bias-pulldown pin 10 high to VCC1V8 pin 1 or
> pin 2 for UART selection and pin 11 high to VCC1V8 selects BootROM
> USB/UART download mode; pin 11 low is normal operation from selected
> NOR/UFS/MMC/NAND secondary boot after SD card. If you do not have a
> flat flex cable then it is possible with a sharp probe and steady
> hands to do so, the easiest method apparently being to connect the
> physically large VCC1V8 leg of the EEPROM part to probe FPC-36P pin 10
> and depress the Firmware DownLoad button held for a moment while
> pressing the reset or powering up the board. The reason for wanting to
> activate BootROM UART mode is to avoid the use of Fastboot USB, and to
> isolate any peripheral configuration that may have been acted upon by
> BootROM which may be different between the available BootROM SPL
> loader modes.

This is confirmed in use that BootROM SPL loader fastboot-compatible
mode does setup of clocks that are not touched by the BootROM SPL loader
UART mode, see the detail about "bsp-spi" following...

> 
> Visual reference:
> https://web.archive.org/web/20261025124009/https://freeshell.de/e/riscv64/K3PicoITX-explainer_boot_resistors-20261017draft.webp
> 
> Connect for fastboot transfers the K3 Pico-ITX USB-C OTG port (not the
> corner USB-C power input/display port) using USB-C to USB-A cable and
> then to any USB-A port on the fastboot and serial terminal host.
> 
> Connect a serial UART cable, note the board TXD is adjacent to the PCB
> board edge and opposite of that is GND with board RXD in the middle;
> swap adapter TXD and adapter RXD as appropriate.
> 
> The vanilla vendor BSP assumes use of fastboot USB in FSBL.bin SPL for
> main.itb loading. If the vanilla vendor BSP main.itb runs with pin 10
> low (the board default) then it again attempts to load an SPL and this
> can be escaped to a hush prompt by fastboot host 'fastboot continue'.
> 
> The UART variants of vendor BSP are patched to assume that u-boot.itb
> is loaded over serial UART in YMODEM protocol. If activated the
> BootROM UART loader assumes loading an SPL over serial UART in XMODEM
> protocol. Using the 'tio' serial terminal software the keybind
> sequences are (Control-t,x,0) for XMODEM and (Control-t,y) for YMODEM.
> If you initiate a transfer and question-mark characters '?' appear
> then the transfer has not synchronized correctly, so abort sending and
> then re-try sending the transfer until you will see '.' progress marks
> appear. The reduction in build config options for "bsp-spi" deletes
> support for USB from SPL. The "bsp-nospi" has nearly all options
> removed leaving only YMODEM loading, DRAM initialization, and
> dependency of EEPROM TLV access for DRAM id.

With mainline U-Boot v2027.01-rc3 the FSL QSPI driver now does clock
enablement (commit 7030b5d8bdf1 "spi: fsl_qspi: Add optional clock
support"). As this was previously, "bsp-spi" was working for 'sf probe'
and SPI NOR data operations in mainline U-Boot main app u-boot.itb *if*
BootROM SPL loader fastboot-compatible mode does its clock setup prior
to loading "bsp-spi". The 'sf probe' detection and SPI NOR data
operations failed if this was instead preceded by BootROM SPL loader
UART mode, which, apparently does not touch the necessary clocks. The
FSL SPI NOR driver in mainline U-Boot main app now works for 'sf probe'
after both SPL of "bsp-spi" or "bsp-nospi". Neither of these has an
effect on SPI NOR detection or access from subsequent Linux kernel use.

OzLabs Patchwork service is severely impacted by "A.I." data scraper bot
traffic and so 'curl' requests to it may timeout or fail to produce
valid output for input to 'git am'. Substituting for "curl ... | git am
..." with the use of 'b4' is recommended.

The revised "Guide to build reduced SpacemiT K3 vendor BSP (continued)"
build steps are now:

dpkg --add-architecture riscv64
apt install -y bison ca-certificates flex gcc-riscv64-linux-gnu git \
  libgnutls28-dev libpython3-dev libssl-dev python3-setuptools swig \
  b4
export CROSS_COMPILE=riscv64-linux-gnu-

git clone https://github.com/riscv-software-src/opensbi.git \
  opensbi.git
git -C opensbi.git checkout origin/master # or any tag after v1.9
make -C opensbi.git O=../opensbi clean
make -C opensbi.git O=../opensbi PLATFORM=generic

git clone https://git.u-boot-project.org/u-boot/u-boot.git u-boot.git
git -C u-boot.git remote add -f spacemit-com \
  https://github.com/spacemit-com/uboot-2022.10.git

git -C u-boot.git checkout origin/main # v2027.01-rc3 or later
make -C u-boot.git O=../u-boot spacemit_k3_defconfig
fw_dynbin=$(realpath opensbi/platform/generic/firmware/fw_dynamic.bin)
make -C u-boot.git O=../u-boot OPENSBI=$fw_dynbin

git -C u-boot.git checkout spacemit-com/k3-br-v1.0.y
# v1 "Guide to build reduced SpacemiT K3 vendor BSP"
pushd u-boot.git
b4 shazam -v1 \
  https://lore.kernel.org/u-boot/20261029001555.1890775-1-e@freeshell.de
popd
mki=$(realpath u-boot/tools/mkimage)
make -C u-boot.git O=../bsp-spi \
  spacemit_k3_uart_spi_defconfig
make -C u-boot.git O=../bsp-spi MKIMAGE=$mki \
  spl/u-boot-spl-mkimage.bin
make -C u-boot.git O=../bsp-nospi \
  spacemit_k3_uart_nospi_defconfig
make -C u-boot.git O=../bsp-nospi MKIMAGE=$mki \
  spl/u-boot-spl-mkimage.bin

tar -czf reduced-spacemit-k3-vendor-bsp.tar.gz \
  --transform 's~^~reduced-spacemit-k3-vendor-bsp/~' \
  bsp-nospi/spl/u-boot-spl-mkimage.bin \
  bsp-spi/spl/u-boot-spl-mkimage.bin \
  u-boot/u-boot.itb

[...]

-E

      reply	other threads:[~2026-11-25 23:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29  0:15 [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP E Shattow
2026-10-29  0:15 ` [DNM PATCH v1 1/7] reduced SpacemiT K3 vendor BSP: use MKIMAGE build env E Shattow
2026-10-29  0:15 ` [DNM PATCH v1 2/7] reduced SpacemiT K3 vendor BSP: add guards around config optioned k3.c code E Shattow
2026-10-29  0:15 ` [DNM PATCH v1 3/7] reduced SpacemiT K3 vendor BSP: add fallback fastboot buf addr and size def E Shattow
2026-10-29  0:15 ` [DNM PATCH v1 4/7] reduced SpacemiT K3 vendor BSP: force UART boot when YMODEM_SUPPORT enabled E Shattow
2026-10-29  0:15 ` [DNM PATCH v1 5/7] reduced SpacemiT K3 vendor BSP: add UART SPI defconfig E Shattow
2026-10-29  0:15 ` [DNM PATCH v1 6/7] reduced SpacemiT K3 vendor BSP: add UART (no SPI) defconfig E Shattow
2026-10-29  0:15 ` [DNM PATCH v1 7/7] reduced SpacemiT K3 vendor BSP: set uart compatible for mainline OpenSBI E Shattow
2026-10-29  0:33 ` [DNM v1 0/7] Guide to build reduced SpacemiT K3 vendor BSP (continued) E Shattow
2026-11-25 23:52   ` E Shattow [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0bdd7822-46ea-4e1c-8ce5-a0975ee8cd96@freeshell.de \
    --to=e@freeshell.de \
    --cc=u-boot@lists.u-boot-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox