Skip to content

SpacemiT: Add SD card support, CPU freq scaling and other fixups#9518

Merged
pyavitz merged 9 commits into
armbian:mainfrom
pyavitz:SPACEMIT-005
Mar 13, 2026
Merged

SpacemiT: Add SD card support, CPU freq scaling and other fixups#9518
pyavitz merged 9 commits into
armbian:mainfrom
pyavitz:SPACEMIT-005

Conversation

@pyavitz
Copy link
Copy Markdown
Collaborator

@pyavitz pyavitz commented Mar 12, 2026

BPI-F3 / MusePi Pro

  • SD card support (WIP)
  • CPU freq scaling (WIP)

https://paste.armbian.com/vebelezife.yaml

SD card and CPU freq scaling is still being worked on upstream, but this at least gets us to a place that makes devel and testing easier.

root@musepipro:~# cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies
614400 819000 1000000 1228800 1600000 
root@musepipro:~# cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors
conservative ondemand userspace powersave performance schedutil 

pyavitz added 9 commits March 12, 2026 06:37
Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
Assign CPU power supply to fully enable CPU DVFS.

Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
CONFIG_CPUFREQ_DT=y
CONFIG_NVMEM_LAYOUT_ONIE_TLV=m

Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
@pyavitz pyavitz requested a review from sven-ola as a code owner March 12, 2026 14:31
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 12, 2026

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • Needs review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 05c06100-d5f7-4bec-80db-12114ec85a47

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... size/large PR with 250 lines or more labels Mar 12, 2026
@pyavitz pyavitz requested a review from igorpecovnik March 12, 2026 14:32
@github-actions github-actions Bot added the 05 Milestone: Second quarter release label Mar 12, 2026
@pyavitz pyavitz changed the title SpacemiT: Add SD card support (WIP), CPU freq scaling (WIP) and other fixups SpacemiT: Add SD card support, CPU freq scaling and other fixups Mar 12, 2026
@sven-ola
Copy link
Copy Markdown
Member

sven-ola commented Mar 13, 2026

This time the kernel 7.0 boots and I have an initramfs prompt (stopped b/c not finding it's root file sys). Tested on SD card and NVME. I have to rename the *.dtb or change extlinux.conf in order to match DTB names:

sed -i 's,x1_orangepi-rv2,k1-orangepi-rv2,' /mnt/boot/extlinux/extlinux.conf

The legacy and current Armbian images matches a DTB name to the Spacemit-K1 chip that is visible in u-boot via TLV_CODE_PRODUCT_NAME in the product_name env var. This is how the Bianbu u-boot is able to boot on different boards while Armbian uses the extlinux.conf file. Please either change the BOOT_FDT_FILE (for edge) in board config or rename *.dts in kernel tree.

I attach a dmesg for futher analysis (SD-Card not inserted, u-boot started via MTD and NVME).
dmesg-opirv2-7.0.txt

Copy link
Copy Markdown
Member

@sven-ola sven-ola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyhow, this is a step forward for kernel 7.0. For that: please merge.

@github-actions github-actions Bot added the Ready to merge Reviewed, tested and ready for merge label Mar 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions Bot removed the Needs review Seeking for review label Mar 13, 2026
@pyavitz
Copy link
Copy Markdown
Collaborator Author

pyavitz commented Mar 13, 2026

This time the kernel 7.0 boots and I have an initramfs prompt (stopped b/c not finding it's root file sys). Tested on SD card and NVME. I have to rename the *.dtb or change extlinux.conf in order to match DTB names:

sed -i 's,x1_orangepi-rv2,k1-orangepi-rv2,' /mnt/boot/extlinux/extlinux.conf

The legacy and current Armbian images matches a DTB name to the Spacemit-K1 chip that is visible in u-boot via TLV_CODE_PRODUCT_NAME in the product_name env var. This is how the Bianbu u-boot is able to boot on different boards while Armbian uses the extlinux.conf file. Please either change the BOOT_FDT_FILE (for edge) in board config or rename *.dts in kernel tree.

I attach a dmesg for futher analysis (SD-Card not inserted, u-boot started via MTD and NVME). dmesg-opirv2-7.0.txt

Do a PR and create a symlink in both legacy and current and update your $board.conf to point to the mainline tree k1-orangepi-rv2.dtb instead of the vendor one. Or rename them completely? Should work either way I gather.

marvin: dt git:( SPACEMIT-005 ✓ ) $ ln -s x1_orangepi-r2s.dts k1-orangepi-rv2.dts
marvin: dt git:( SPACEMIT-005 ?:1 ✗ ) $ ls -l
total 116
-rw-rw-r-- 1 patrick patrick  1003 Mar 12 06:32 Makefile
-rw-rw-r-- 1 patrick patrick 26585 Mar 12 06:32 k1-bananapi-f3.dts
-rw-rw-r-- 1 patrick patrick 26766 Mar 12 06:32 k1-musepi-pro.dts
lrwxrwxrwx 1 patrick patrick    19 Mar 13 15:40 k1-orangepi-rv2.dts -> x1_orangepi-r2s.dts
-rw-rw-r-- 1 patrick patrick  1174 Mar 12 06:32 lcd_tc358762xbg_dpi_800x480.dtsi
-rw-rw-r-- 1 patrick patrick 20815 Mar 12 06:32 x1_orangepi-r2s.dts
-rw-rw-r-- 1 patrick patrick 28283 Mar 12 06:32 x1_orangepi-rv2.dts

If I would have stuck with the bianbu source names it would be k1-x_deb1.dts and k1-x_MUSE-Pi.dts.

@pyavitz pyavitz merged commit 58907a3 into armbian:main Mar 13, 2026
2 checks passed
@sven-ola
Copy link
Copy Markdown
Member

The k1-orangepirv2 name is from upstream (Linux7)? The x1-orangepi name is stored in the chip and thus it is from the chip vendor, e.g. where you probably find MUSE in your board (stop u-boot, then printenv product_name should show "MUSE"). The kernel folks are rather stubborn, so if thats from there namespace I would adapt legacy and current...

@pyavitz
Copy link
Copy Markdown
Collaborator Author

pyavitz commented Mar 13, 2026

The k1-orangepirv2 name is from upstream (Linux7)? The x1-orangepi name is stored in the chip and thus it is from the chip vendor, e.g. where you probably find MUSE in your board (stop u-boot, then printenv product_name should show "MUSE"). The kernel folks are rather stubborn, so if thats from there namespace I would adapt legacy and current...

This makes sense as we are currently using vendor u-boot, but once we move to mainline u-boot this will no longer be the case. I would think staying ahead of the curb would be a better choice?

Are you afraid that by renaming the DTS files in the kernel, this is some how going to break something?

@sven-ola
Copy link
Copy Markdown
Member

Are you afraid that by renaming the DTS files in the kernel, this is some how going to break something?

No, it's only a file name. Using the name stored in the chip has the (future) option to have a single "firmware for all". using the name from upstream promises less fiddling. Thus it's the latter...

@pyavitz
Copy link
Copy Markdown
Collaborator Author

pyavitz commented Mar 14, 2026

Are you afraid that by renaming the DTS files in the kernel, this is some how going to break something?

No, it's only a file name. Using the name stored in the chip has the (future) option to have a single "firmware for all". using the name from upstream promises less fiddling. Thus it's the latter...

I suspect we could do this now by editing u-boot. Going that route would open up the door for UEFI one image fits them all type deal. Would lose easy overlay support though? Other option would be start using a boot.scr that takes this into account.

I'm fine with either, its just not on my list of things to mess around with at the moment. You are more than welcome to have at it though :)

@pyavitz
Copy link
Copy Markdown
Collaborator Author

pyavitz commented Mar 14, 2026

Are you afraid that by renaming the DTS files in the kernel, this is some how going to break something?

No, it's only a file name. Using the name stored in the chip has the (future) option to have a single "firmware for all". using the name from upstream promises less fiddling. Thus it's the latter...

This was tested on the BPI-F3 using the last musepipro test img I made.

Loading K1-X Environment ...
[   2.718] 
[   2.719] Running NVMe Scan ...
[   2.730] pcie_dw_k1x pcie@ca400000: has no power on gpio.
[   2.732] pcie_dw_k1x pcie@ca400000: has no power-on-status flag, use default.
[   2.740] Now init Rterm...
[   2.742] pcie prot id = 1, porta_init_done = 0
[   2.746] Now waiting portA resister tuning done...
[   2.751] porta redonly_reg2: 00005d47
[   2.754] pcie_rcal = 0x00005d47
[   2.758] pcie port id = 1, lane num = 2
[   2.761] Now int init_puphy...
[   2.764] waiting pll lock...
[   2.767] Now finish init_puphy....
[   2.770] pcie_dw_k1x pcie@ca400000: Unable to get phy0
[   2.775] pcie_dw_k1x pcie@ca400000: Unable to get phy1
[   2.911] PCIE-0: Link up (Gen2-x2, Bus0)
[   3.112] 1792 bytes read in 14 ms (125 KiB/s)
[   3.114] ## Executing script at 02000000
[   3.417] 22821024 bytes read in 249 ms (87.4 MiB/s)
[   3.641] 18872215 bytes read in 212 ms (84.9 MiB/s)
[   3.643] Loading boot/dtb/spacemit/k1-bananapi-f3.dtb ...
[   3.683] 33722 bytes read in 25 ms (1.3 MiB/s)
[   3.685] Booting BananaPi BPI-F3 from mmc 0:1 ...
[   3.689]    Uncompressing Kernel Image
[   4.169] Moving Image from 0x10000000 to 0x200000, end=362e000
[   4.197] ## Loading init Ramdisk from Legacy Image at 21000000 ...
[   4.200]    Image Name:   uInitrd
[   4.203]    Image Type:   RISC-V Linux RAMDisk Image (gzip compressed)
[   4.210]    Data Size:    22820960 Bytes = 21.8 MiB
[   4.215]    Load Address: 00000000
[   4.218]    Entry Point:  00000000
   Verifying Checksum ... OK
[   4.325] ## Flattened Device Tree blob at 31000000
[   4.327]    Booting using the fdt blob at 0x31000000
[   4.332]    Loading Ramdisk to 7c7a3000, end 7dd66860 ... OK
[   4.347]    Loading Device Tree to 000000007c797000, end 000000007c7a23b9 ... OK

Starting kernel ...

root@musepipro:~# dmesg | grep "command"
[    0.000000] Kernel command line: earlycon=sbi console=tty1 console=ttyS0,115200 rw root=PARTUUID=0e676e08-01 rootfstype=ext4 loglevel=1 fsck.repair=yes net.ifnames=0 rootwait init=/sbin/init
root@musepipro:~# ls /boot
boot.bmp                        Image
boot.cmd                        initrd.img-7.0.0-rc3-edge-spacemit
boot.scr                        System.map-7.0.0-rc3-edge-spacemit
config-7.0.0-rc3-edge-spacemit  uInitrd
dtb                             uInitrd-7.0.0-rc3-edge-spacemit
dtb-7.0.0-rc3-edge-spacemit     vmlinuz-7.0.0-rc3-edge-spacemit

If we setup a boot script, we could "I suppose" get rid of individual board.conf(s) and just use one spacemit.conf. Allowing us to have one img to rule them all.

If you are interested in working on it?
boot.cmd.txt

@sven-ola
Copy link
Copy Markdown
Member

If you are interested in working on it?
boot.cmd.txt

Not sure if I want to do that now. Lets postpone and focus on unfinished tasks instead: I'll send a PR x1opirv.dtb->k1opirv2 first, then overthink / integrate that GPU package grab from Bianbu (see forum post on RV2), then massage Linux7, then maybe play a bit with the NPU/Ollama thingy, then unified images. LG // Sven-Ola

sven-ola added a commit to sven-ola/armbian-build that referenced this pull request Mar 14, 2026
Rename DTS/DTB files for OrangePi RV2/R2S to match the
filename expected from Linux-7.x upstream. See discussion
on armbian#9518

Signed-off-by: Sven-Ola Tuecke <sven-ola@gmx.de>
sven-ola added a commit that referenced this pull request Mar 15, 2026
Rename DTS/DTB files for OrangePi RV2/R2S to match the
filename expected from Linux-7.x upstream. See discussion
on #9518

Signed-off-by: Sven-Ola Tuecke <sven-ola@gmx.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 Milestone: Second quarter release Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... Ready to merge Reviewed, tested and ready for merge size/large PR with 250 lines or more

Development

Successfully merging this pull request may close these issues.

2 participants