frank-w / BPI-Router-Linux

Linux kernel 4.14+ for BPI-R2, 5.4+ for R64, 6.1+ for R2Pro and R3
Other
136 stars 47 forks source link

[bpi-r2pro/linux 6.1] how to populate spi devices in /dev #112

Open jssyan opened 1 year ago

jssyan commented 1 year ago

Would you please show some samples about how to populate spi devices under /dev for a bpi-r2-pro board?

Here is what I have done (but failed)

changed status from "disabled" to "okay" in rk3568-bpi-r2-pro.dts spi3

&spi3 {
   /* pin 19 (MO) + 21 (MI) + 23 (CK) of header con2 */
   /* shared with pwm12/14/15 and uart9 */
   pinctrl-0 = <&spi3m1_pins>;
   status = "okay";
};

compile & install & reboot

# lsmod
Module                  Size  Used by    Not tainted
spidev                 24576  0
nf_nat_ftp             20480  0
nf_conntrack_ftp       28672  1 nf_nat_ftp
ipt_REJECT             16384  1
nf_reject_ipv4         16384  1 ipt_REJECT
nf_log_syslog          24576  7
xt_LOG                 20480  7
xt_mark                16384  1
xt_conntrack           16384  3
iptable_filter         16384  1
iptable_mangle         16384  1
iptable_nat            16384  1
nf_nat                 65536  2 nf_nat_ftp,iptable_nat
nf_conntrack          155648  4 nf_nat_ftp,nf_conntrack_ftp,xt_conntrack,nf_nat
nf_defrag_ipv4         16384  1 nf_conntrack
nf_defrag_ipv6         24576  1 nf_conntrack
ip_tables              32768  3 iptable_filter,iptable_mangle,iptable_nat
x_tables               40960  8 ipt_REJECT,xt_LOG,xt_mark,xt_conntrack,iptable_filter,iptable_mangle,iptable_nat,ip_tables
polyval_ce             16384  0
polyval_generic        16384  1 polyval_ce
rockchip_rng           20480  0
rtc_hym8563            20480  1
spi_rockchip           20480  0
uio_pdrv_genirq        20480  0
uio                    20480  1 uio_pdrv_genirq
ath10k_pci             45056  0
ath10k_core           438272  1 ath10k_pci
mac80211              794624  1 ath10k_core
ath                    32768  1 ath10k_core
cfg80211              712704  3 ath10k_core,mac80211,ath

# ls -R /dev | grep spi
(nothing)

# find /sys/ -name spi3
/sys/class/spi_master/spi3
/sys/devices/platform/fe640000.spi/spi_master/spi3
/sys/firmware/devicetree/base/pinctrl/spi3
/sys/firmware/devicetree/base/aliases/spi3
/sys/firmware/devicetree/base/__symbols__/spi3

no spidevB.C device found under /dev

# cat /etc/mdev.conf
$MODALIAS=.* 0:0 660 @/sbin/modprobe -b "$MODALIAS"

null            0:0 666
zero            0:0 666
urandom         0:0 444

kmem            0:9 000
mem             0:9 640
port            0:9 640

console         0:5 600
ptmx            0:5 660
tty[0-9]*       0:5 660
ttyS[0-9]*      0:20 640

fd[0-9]*        0:11 660
sd[a-z]*        0:6 660
hd[a-z]*        0:6 660

rtc0            0:0 600 @/bin/ln -sf $MDEV rtc

usbdev.*          0:0 0660  */etc/mdev/usbdev.sh
SUBSYSTEM=usb;.*  0:0 0660  */etc/mdev/usbdev.sh

SUBSYSTEM=drivers;.* 0:0 0660  */etc/mdev/drivers.sh
frank-w commented 10 months ago

Hi sorry,missed this issue somehow. Have not done much with spi,but afaik you have to add your device (with the right compatible) to devicetree. Afair the spidev needs a special compatible as the spidev default compatible was dropped from mainline some time ago...you have to look into spidev driver which compatibles it supports