It will require changes to mainline DTS files to enable them as overlays aren’t on in mainline afaik, UART3 is off by default for sure… I2c - should work… but this is pretty easy to accomplish…
Is DTS files in fenix/build/linux-mainline-5.17/arch/arm64/boot/dts/amlogic
?
root@ubuntu:/home/dylan/Desktop/fenix/build/linux-mainline-5.17/arch/arm64/boot/dts/amlogic# ls
Makefile meson-gxl-mali.dtsi
meson-a1-ad401.dts meson-gxl-s805x.dtsi
meson-a1.dtsi meson-gxl-s805x-libretech-ac.dts
meson-axg.dtsi meson-gxl-s805x-p241.dts
meson-axg-jethome-jethub-j100.dts meson-gxl-s905d.dtsi
meson-axg-s400.dts meson-gxl-s905d-libretech-pc.dts
meson-g12a.dtsi meson-gxl-s905d-mecool-kii-pro.dts
meson-g12a-radxa-zero.dts meson-gxl-s905d-p230.dts
meson-g12a-sei510.dts meson-gxl-s905d-p231.dts
meson-g12a-u200.dts meson-gxl-s905d-phicomm-n1.dts
meson-g12a-x96-max.dts meson-gxl-s905d-sml5442tw.dts
meson-g12b-a311d.dtsi meson-gxl-s905w-jethome-jethub-j80.dts
meson-g12b-a311d-khadas-vim3.dtb meson-gxl-s905w-p281.dts
meson-g12b-a311d-khadas-vim3.dts meson-gxl-s905w-tx3-mini.dts
meson-g12b.dtsi meson-gxl-s905x.dtsi
meson-g12b-gsking-x.dts meson-gxl-s905x-hwacom-amazetv.dts
meson-g12b-gtking.dts meson-gxl-s905x-khadas-vim.dtb
meson-g12b-gtking-pro.dts meson-gxl-s905x-khadas-vim.dts
meson-g12b-khadas-vim3.dtsi meson-gxl-s905x-libretech-cc.dts
meson-g12b-odroid-n2.dts meson-gxl-s905x-libretech-cc-v2.dts
meson-g12b-odroid-n2.dtsi meson-gxl-s905x-nexbox-a95x.dts
meson-g12b-odroid-n2-plus.dts meson-gxl-s905x-p212.dts
meson-g12b-s922x.dtsi meson-gxl-s905x-p212.dtsi
meson-g12b-s922x-khadas-vim3.dtb meson-gx-mali450.dtsi
meson-g12b-s922x-khadas-vim3.dts meson-gxm.dtsi
meson-g12b-ugoos-am6.dts meson-gxm-khadas-vim2.dtb
meson-g12b-w400.dtsi meson-gxm-khadas-vim2.dts
meson-g12-common.dtsi meson-gxm-mecool-kiii-pro.dts
meson-g12.dtsi meson-gxm-minix-neo-u9h.dts
meson-gxbb.dtsi meson-gxm-nexbox-a1.dts
meson-gxbb-kii-pro.dts meson-gxm-q200.dts
meson-gxbb-nanopi-k2.dts meson-gxm-q201.dts
meson-gxbb-nexbox-a95x.dts meson-gxm-rbox-pro.dts
meson-gxbb-odroidc2.dts meson-gxm-s912-libretech-pc.dts
meson-gxbb-p200.dts meson-gxm-vega-s96.dts
meson-gxbb-p201.dts meson-gxm-wetek-core2.dts
meson-gxbb-p20x.dtsi meson-gx-p23x-q20x.dtsi
meson-gxbb-vega-s95.dtsi meson-khadas-vim3.dtsi
meson-gxbb-vega-s95-meta.dts meson-sm1-bananapi-m5.dts
meson-gxbb-vega-s95-pro.dts meson-sm1.dtsi
meson-gxbb-vega-s95-telos.dts meson-sm1-khadas-vim3l.dtb
meson-gxbb-wetek.dtsi meson-sm1-khadas-vim3l.dts
meson-gxbb-wetek-hub.dts meson-sm1-odroid-c4.dts
meson-gxbb-wetek-play2.dts meson-sm1-odroid.dtsi
meson-gx.dtsi meson-sm1-odroid-hc4.dts
meson-gxl.dtsi meson-sm1-sei610.dts
meson-gx-libretech-pc.dtsi
Forgive my poor knowledge about DTS, I don’t know what to do with that file and how to do it, especially now that using fenix finds that Linux has become 5.17.
I want to use the spi to receive data from two spi slave sensors, like mpu6000 etc.
In 5.17 Fenix build - Khadas team added kernel overlay config option - I assume usual overlays from uboot and 4.9 kernel should work now to enable usart3 and spi. @hyphop - Artem can you confirm this ?
I’ve created post to illustrate my situation
Briefly, the overlays failed, and then the dts were modified, but it still failed, so I suspect that I modified the configuration of the dts by mistake
yes fenix fresh build can use overlays easily
I use overlays to setup spi1,but it fails.
system info:
Linux Khadas 5.17.0-rt17 #1.0.11 SMP Wed May 4 03:34:07 PDT 2022 aarch64 aarch64 aarch64 GNU/Linux
more details in this post:
i think your dts configuration have some collisions
need more details dmesg | grep spi
maybe need inc kernel messages level and check /sys/class/spi*
example how to check spi
find /sys/class/spi*
/sys/class/spi_master
/sys/class/spi_master/spi0
/sys/class/spidev
run dmesg | grep spi
and find /sys/class/spi*
Is this result right?It seems spi0 is ok,is spi0 in the 40-Pin HEADER?
I add following code in meson-khadas-vim3.dtsi
,and set &PWM_EF status to disabled
&spicc1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spicc1_pins>;
cs-gpios = <&gpio GPIOH_6 0>;
spidev@0 {
status = "okay";
compatible = "linux,spidev";
/* spi default max clock 100Mhz */
spi-max-frequency = <100000000>;
reg = <0>;
};
};
Maybe need to modify other content in DTS flie for kernel 5.17?
check you kernel config 1st
# zgrep SPICC /proc/config.gz
CONFIG_SPI_MESON_SPICC=m
# lsmod | grep spicc
aml_spicc 24576 0
maybe need modprobe aml_spicc
no need its already build-in ! need more check
my example for spi flash
cat /sys/class/spi_master/spi0/uevent
OF_NAME=spi
OF_FULLNAME=/soc/apb4@fe000000/spi@56000
OF_COMPATIBLE_0=amlogic,meson-spifc
OF_COMPATIBLE_N=1
OF_ALIAS_0=spi0
cat /sys/class/spi_master/spi0/uevent
Is that mean i can use spi0?
for now,I am rebuilding images via fenix.
in your situation spi0 (just kernel device name and this name not related with dts alias node name ) works as spicc
How can I use it?
Forgive me for my ignorance of Linux devices,I could open devices in /dev/*
.But i don’t know how to use devices in /sys/class/spi_master/spi0
I download code from
and just edit this device path to “/sys/class/spi_master/spi0/spi0.0”
gcc and run.It comes out:can't open device: Is a directory
I also want to know why no spi dev node in /dev
?
/sys/class/spi_master/spi0 - its not device its just kernel information …
I could open devices in `/dev/*
not exist becouse its not properly configured
Now,I just want to check my board can work with spi, I download image from
choose VIM3_Ubuntu-server-focal_Linux-4.9_arm64_SD-USB_V1.0.10-220108.img.xz
burn it into SD card,And edit /boot/env.txt with overlays=spi1 os08a10 watchdog
reboot board, find it can’t load kernel,Stuck in Starting kernel …
full output:
G12B:BL:6e7c85:2a3b91;FEAT:E0F83180:402000;POC:F;RCY:0;EMMC:0;READ:0;0.�!,K��х��}���с0x01
bl2_stage_init 0x81
hw id: 0x0000 - pwm id 0x01
bl2_stage_init 0xc1
bl2_stage_init 0x02
L0:00000000
L1:20000703
L2:00008067
L3:14000000
B2:00402000
B1:e0f83180
TE: 179510
BL2 Built : 15:22:05, Aug 28 2019. g12b g1bf2b53 - luan.yuan@droid15-sz
Board ID = 8
Set A53 clk to 24M
Set A73 clk to 24M
Set clk81 to 24M
A53 clk: 1200 MHz
A73 clk: 1200 MHz
CLK81: 166.6M
smccc: 00030513
eMMC boot @ 0
sw8 s
DDR driver_vesion: LPDDR4_PHY_V_0_1_18 build time: Aug 28 2019 15:22:01
board id: 8
Load FIP HDR from eMMC, src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0
fw parse done
Load ddrfw from eMMC, src: 0x00060200, des: 0xfffd0000, size: 0x0000c000, part: 0
Load ddrfw from eMMC, src: 0x00038200, des: 0xfffd0000, size: 0x00004000, part: 0
PIEI prepare done
fastboot data load
00000000
emmc switch 1 ok
00000000
emmc switch 2 ok
fastboot data verify
verify result: 265
Cfg max: 4, cur: 1. Board id: 255. Force loop cfg
LPDDR4 probe
ddr clk to 1608MHz
Load ddrfw from eMMC, src: 0x0003c200, des: 0xfffd0000, size: 0x0000c000, part: 0
00000000
emmc switch 0 ok
dmc_version 0001
Check phy result
INFO : End of CA training
INFO : End of initialization
INFO : Training has run successfully!
Check phy result
INFO : End of initialization
INFO : End of read enable training
INFO : End of fine write leveling
INFO : End of Write leveling coarse delay
INFO : Training has run successfully!
Check phy result
INFO : End of initialization
INFO : End of read dq deskew training
INFO : End of MPR read delay center optimization
INFO : End of write delay center optimization
INFO : End of read delay center optimization
INFO : End of max read latency training
INFO : Training has run successfully!
1D training succeed
Load ddrfw from eMMC, src: 0x00048200, des: 0xfffd0000, size: 0x0000c000, part: 0
Check phy result
INFO : End of initialization
INFO : End of 2D read delay Voltage center optimization
INFO : End of 2D read delay Voltage center optimization
INFO : End of 2D write delay Voltage center optimization
INFO : End of 2D write delay Voltage center optimization
INFO : Training has run successfully!
channel==0
RxClkDly_Margin_A0==97 ps 10
TxDqDly_Margin_A0==106 ps 11
RxClkDly_Margin_A1==87 ps 9
TxDqDly_Margin_A1==97 ps 10
TrainedVREFDQ_A0==28
TrainedVREFDQ_A1==27
VrefDac_Margin_A0==30
DeviceVref_Margin_A0==27
VrefDac_Margin_A1==32
DeviceVref_Margin_A1==26
channel==1
RxClkDly_Margin_A0==106 ps 11
TxDqDly_Margin_A0==116 ps 12
RxClkDly_Margin_A1==97 ps 10
TxDqDly_Margin_A1==106 ps 11
TrainedVREFDQ_A0==26
TrainedVREFDQ_A1==26
VrefDac_Margin_A0==32
DeviceVref_Margin_A0==26
VrefDac_Margin_A1==30
DeviceVref_Margin_A1==26
dwc_ddrphy_apb_wr((0<<20)|(2<<16)|(0<<12)|(0xb0):0004
soc_vref_reg_value 0x 00000028 00000027 00000028 00000028 0000002a 00000025 00000029 00000028 00000027 00000026 00000029 00000027 00000029 00000028 00000026 00000027 00000027 00000028 00000028 00000026 00000028 00000028 00000028 00000027 00000028 0000002a 0000002a 00000029 00000029 00000027 00000028 0000002b dram_vref_reg_value 0x 00000013
2D training succeed
aml_ddr_fw_vesion: LPDDR4_PHY_V_0_1_18 build time: Aug 28 2019 13:54:19
auto size-- 65535DDR cs0 size: 2048MB
DDR cs1 size: 2048MB
DMC_DDR_CTRL: 00e00024DDR size: 3928MB
cs0 DataBus test pass
cs1 DataBus test pass
cs0 AddrBus test pass
cs1 AddrBus test pass
100bdlr_step_size ps== 403
result report
boot times 0Enable ddr reg access
00000000
emmc switch 3 ok
Authentication key not yet programmed
get rpmb counter error 0x00000007
00000000
emmc switch 0 ok
Load FIP HDR from eMMC, src: 0x00010200, des: 0x01700000, size: 0x00004000, part: 0
Load BL3X from eMMC, src: 0x00078200, des: 0x01768000, size: 0x000ac000, part: 0
0.0;M3 CHK:0;cm4_sp_mode 0
MVN_1=0x00000000
MVN_2=0x00000000
[Image: g12b_v1.1.3390-6ac5299 2019-09-26 14:10:05 luan.yuan@droid15-sz]
OPS=0x10
ring efuse init
chipver efuse init
29 0b 10 00 01 09 12 00 00 11 36 32 33 57 33 50
[0.018959 Inits done]
secure task start!
high task start!
low task start!
run into bl31
NOTICE: BL31: v1.3(release):4fc40b1
NOTICE: BL31: Built : 15:58:17, May 22 2019
NOTICE: BL31: G12A normal boot!
NOTICE: BL31: BL33 decompress pass
ERROR: Error initializing runtime service opteed_fast
U-Boot 2021.04 (May 02 2022 - 23:38:20 -0700) khadas-vim3
Model: Khadas VIM3
SoC: Amlogic Meson G12B (A311D) Revision 29:b (10:2)
DRAM: 3.8 GiB
MMC: sd@ffe03000: 0, sd@ffe05000: 1, mmc@ffe07000: 2
In: serial
Out: serial
Err: serial
fusb302_init: Device ID: 0x91
CC connected in 0 as UFP
fusb302 detect chip.port_num = 0
Net: eth0: ethernet@ff3f0000
Failed to load 'splash.bmp'
Failed to load 'splash.bmp'
1080138 bytes read in 70 ms (14.7 MiB/s)
DISPLAY: setup failsave FullHD mode
starting USB...
Bus usb@ff500000: Register 3000140 NbrPorts 3
Starting the controller
USB XHCI 1.10
scanning bus usb@ff500000 for devices... 2 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Setting bus to 0
Hit SPACE in 2 seconds to stop autoboot
Device 0: unknown device
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
Found U-Boot script /boot.ini
10134 bytes read in 5 ms (1.9 MiB/s)
## Script run a:08000000 l:10115 c:0
Starting boot.ini...
Setting bus to 0
saradc: 0x0, hw_ver: 0x32 (VIM3.V12)
uboot type: mainline
Scanning mmc 0:1...
Card did not respond to voltage select! : -110
Can't set block device
Scanning mmc 0:5...
Card did not respond to voltage select! : -110
Can't set block device
Scanning mmc 1:1...
10722939 bytes read in 530 ms (19.3 MiB/s)
29248000 bytes read in 1443 ms (19.3 MiB/s)
90207 bytes read in 9 ms (9.6 MiB/s)
Failed to load '/boot/env.txt'
4577 bytes read in 5 ms (893.6 KiB/s)
Import env.txt
Found custom ethmac: c8:63:14:71:00:24, overwrite eth_mac!
Booting legacy kernel...
Setting bus to 0
port mode is usb3.0
Apply dtbo spi1
** Reading file would overwrite reserved memory **
Failed to load '/dtb/overlays/kvim3/spi1.dtbo'
Apply dtbo os08a10
** Reading file would overwrite reserved memory **
Failed to load '/dtb/overlays/kvim3/os08a10.dtbo'
Apply dtbo watchdog
** Reading file would overwrite reserved memory **
Failed to load '/dtb/overlays/kvim3/watchdog.dtbo'
Moving Image from 0x11000000 to 0x11080000, end=12de5000
## Loading init Ramdisk from Legacy Image at 13000000 ...
Image Name: uInitrd
Image Type: AArch64 Linux RAMDisk Image (uncompressed)
Data Size: 10722875 Bytes = 10.2 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 01000000
Booting using the fdt blob at 0x1000000
Loading Ramdisk to 7f5c6000, end 7ffffe3b ... OK
Loading Device Tree to 000000007f547000, end 000000007f5c5fff ... OK
Cannot setup simplefb: node not found
Starting kernel ...
I notice the log
Apply dtbo spi1
** Reading file would overwrite reserved memory **
Failed to load '/dtb/overlays/kvim3/spi1.dtbo'
Apply dtbo os08a10
** Reading file would overwrite reserved memory **
Failed to load '/dtb/overlays/kvim3/os08a10.dtbo'
Apply dtbo watchdog
** Reading file would overwrite reserved memory **
Failed to load '/dtb/overlays/kvim3/watchdog.dtbo'
Maybe it is why the overlays does’t work.
For now,I am going to reburn image via emmc.I start to suspect the SD card.
My goal is to check spi is work under 4.9 kernel(boot from emmc and SD/USB) to exclude Hardware problem
I had test spi in 4.9 kernel.It only works in emmc not in SD/USB
So,I know my board is ok to enable SPI.
I try to boot from SD card.
It was also log like:
Apply dtbo spi1
** Reading file would overwrite reserved memory **
Failed to load '/dtb/overlays/kvim3/spi1.dtbo'
Apply dtbo os08a10
** Reading file would overwrite reserved memory **
Failed to load '/dtb/overlays/kvim3/os08a10.dtbo'
Apply dtbo watchdog
** Reading file would overwrite reserved memory **
Failed to load '/dtb/overlays/kvim3/watchdog.dtbo'
However,I boot from SD and run sudo emmc-install
to copy Image from SD card to EMMC.
Then reboot.SPI was loaded
Apply dtbo spi1
reading /dtb/overlays/kvim3/spi1.dtbo
447 bytes read in 4 ms (108.4 KiB/s)
Apply dtbo i2c3
reading /dtb/overlays/kvim3/i2c3.dtbo
223 bytes read in 5 ms (43 KiB/s)
Apply dtbo i2s
reading /dtb/overlays/kvim3/i2s.dtbo
3330 bytes read in 4 ms (812.5 KiB/s)
According to this situation.I think overlays only work on EMMC.I don’t know why boot via SD will fail to load //
Next,I will test the mainline liunx 5.17.
- plz clean vendor uboot from emmc
- write mainline uboot into emmc or spi
- check again
Do overlays support in manline kernel 5.17?
Some overlays do not work in mainline like ts050 and gpio I believe