大家好,我在尝试给f1c100s外接一个st7789的屏幕,修改了设备树和驱动文件,但是感觉驱动并没有跑起来,请求大家帮忙看看。
linux源码修改了2个文件:
分别修改如下:
dmesg:
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.15.0-rc8-licheepi-nano+ (xsr@linux) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)) #4 Sat Apr 23 03:31:11 CST 2022
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] OF: fdt: Machine model: Lichee Pi Nano
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] On node 0 totalpages: 8192
[ 0.000000] Normal zone: 64 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 8192 pages, LIFO batch:0
[ 0.000000] random: fast init done
[ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[ 0.000000] pcpu-alloc: [0] 0
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 8128
[ 0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2
[ 0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Memory: 22676K/32768K available (6144K kernel code, 237K rwdata, 1412K rodata, 1024K init, 245K bss, 10092K reserved, 0K cma-reserved, 0K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xc2800000 - 0xff800000 ( 976 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc2000000 ( 32 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0x(ptrval) - 0x(ptrval) (7136 kB)
[ 0.000000] .init : 0x(ptrval) - 0x(ptrval) (1024 kB)
[ 0.000000] .data : 0x(ptrval) - 0x(ptrval) ( 238 kB)
[ 0.000000] .bss : 0x(ptrval) - 0x(ptrval) ( 246 kB)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000051] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000123] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000650] Console: colour dummy device 80x30
[ 0.000739] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[ 0.070255] pid_max: default: 32768 minimum: 301
[ 0.070581] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.070631] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.072201] CPU: Testing write buffer coherency: ok
[ 0.074097] Setting up static identity map for 0x80100000 - 0x80100058
[ 0.076647] devtmpfs: initialized
[ 0.083488] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.083559] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.083853] pinctrl core: initialized pinctrl subsystem
[ 0.086159] NET: Registered protocol family 16
[ 0.088138] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.089940] cpuidle: using governor menu
[ 0.117608] SCSI subsystem initialized
[ 0.118006] usbcore: registered new interface driver usbfs
[ 0.118174] usbcore: registered new interface driver hub
[ 0.118390] usbcore: registered new device driver usb
[ 0.118804] pps_core: LinuxPPS API ver. 1 registered
[ 0.118830] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.118892] PTP clock support registered
[ 0.119361] Advanced Linux Sound Architecture Driver Initialized.
[ 0.121098] clocksource: Switched to clocksource timer
[ 0.150333] NET: Registered protocol family 2
[ 0.152033] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.152112] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.152164] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.152521] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.152593] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.153113] NET: Registered protocol family 1
[ 0.154457] RPC: Registered named UNIX socket transport module.
[ 0.154502] RPC: Registered udp transport module.
[ 0.154519] RPC: Registered tcp transport module.
[ 0.154535] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.156880] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.158922] Initialise system trusted keyrings
[ 0.159538] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[ 0.177805] NFS: Registering the id_resolver key type
[ 0.177883] Key type id_resolver registered
[ 0.177904] Key type id_legacy registered
[ 0.178021] jffs2: version 2.2. (NAND) 2001-2006 Red Hat, Inc.
[ 0.193199] Key type asymmetric registered
[ 0.193244] Asymmetric key parser 'x509' registered
[ 0.193441] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.193470] io scheduler noop registered
[ 0.193489] io scheduler deadline registered
[ 0.194284] io scheduler cfq registered (default)
[ 0.194323] io scheduler mq-deadline registered
[ 0.194342] io scheduler kyber registered
[ 0.195528] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[ 0.205978] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.394855] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.402189] console [ttyS0] disabled
[ 0.422458] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 23, base_baud = 6250000) is a 16550A
[ 0.895799] console [ttyS0] enabled
[ 0.906569] panel-simple panel: panel supply power not found, using dummy regulator
[ 0.916099] SCSI Media Changer driver v0.25
[ 0.924232] m25p80 spi0.0: xt25f128b (16384 Kbytes)
[ 0.929193] 4 ofpart partitions found on MTD device spi0.0
[ 0.934797] Creating 4 MTD partitions on "spi0.0":
[ 0.939617] 0x000000000000-0x000000100000 : "u-boot"
[ 0.947379] 0x000000100000-0x000000110000 : "dtb"
[ 0.954983] 0x000000110000-0x000000510000 : "kernel"
[ 0.962648] 0x000000510000-0x000001000000 : "rootfs"
[ 0.970958] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.977630] ehci-platform: EHCI generic platform driver
[ 0.983235] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.989466] ohci-platform: OHCI generic platform driver
[ 0.995261] usbcore: registered new interface driver usb-storage
[ 1.002401] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[ 1.011503] i2c /dev entries driver
[ 1.071240] sunxi-mmc 1c0f000.mmc: base:0x4df2d6d8 irq:19
[ 1.078866] usbcore: registered new interface driver usbhid
[ 1.084576] usbhid: USB HID core driver
[ 1.107767] NET: Registered protocol family 17
[ 1.112650] Key type dns_resolver registered
[ 1.119444] Loading compiled-in X.509 certificates
[ 1.137139] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc0739fc4)
[ 1.146103] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc07392a8)
[ 1.153890] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 1.160488] [drm] No driver support for vblank timestamp query.
[ 1.299609] Console: switching to colour frame buffer device 100x30
[ 1.339288] sun4i-drm display-engine: fb0: frame buffer device
[ 1.346589] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[ 1.355854] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[ 1.367833] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[ 1.373778] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[ 1.384064] hub 1-0:1.0: USB hub found
[ 1.388009] hub 1-0:1.0: 1 port detected
[ 1.393712] using random self ethernet address
[ 1.398253] using random host ethernet address
[ 1.404724] usb0: HOST MAC e6:b0:3a:29:22:14
[ 1.409122] usb0: MAC 96:9c:4f:d2:59:ea
[ 1.413244] g_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008
[ 1.420727] g_cdc gadget: g_cdc ready
[ 1.425577] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 1.443786] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 1.450613] vcc3v3: disabling
[ 1.453704] ALSA device list:
[ 1.456683] #0: Loopback 1
[ 1.460520] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 1.469282] cfg80211: failed to load regulatory.db
[ 1.576920] random: crng init done
[ 2.994345] g_cdc gadget: high-speed config #1: CDC Composite (ECM + ACM)
[ 4.032053] VFS: Mounted root (jffs2 filesystem) on device 31:3.
[ 4.040065] devtmpfs: mounted
[ 4.049255] Freeing unused kernel memory: 1024K
查看设备树:
完整设备树:
// SPDX-License-Identifier: (GPL-2.0+ OR X11)
/*
* Copyright 2018 Icenowy Zheng <icenowy@aosc.io>
*/
/dts-v1/;
#include "suniv-f1c100s.dtsi"
#include <dt-bindings/gpio/gpio.h>
/ {
model = "Lichee Pi Nano";
compatible = "licheepi,licheepi-nano", "allwinner,suniv-f1c100s",
"allwinner,suniv";
aliases {
serial0 = &uart0;
spi0 = &spi0;
spi1 = &spi1;
};
chosen {
stdout-path = "serial0:115200n8";
};
panel: panel {
compatible = "lg,lb070wv8", "simple-panel";
#address-cells = <1>;
#size-cells = <0>;
enable-gpios = <&pio 4 6 GPIO_ACTIVE_HIGH>;
port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;
panel_input: endpoint@0 {
reg = <0>;
remote-endpoint = <&tcon0_out_lcd>;
};
};
};
reg_vcc3v3: vcc3v3 {
compatible = "regulator-fixed";
regulator-name = "vcc3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
};
&de {
status = "okay";
};
&mmc0 {
vmmc-supply = <®_vcc3v3>;
bus-width = <4>;
broken-cd;
status = "okay";
};
&otg_sram {
status = "okay";
};
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins_a>;
status = "okay";
spi-max-frequency = <50000000>;
flash: w25q128@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "winbond,xt25f128b", "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x000000 0x100000>;
read-only;
};
partition@100000 {
label = "dtb";
reg = <0x100000 0x10000>;
read-only;
};
partition@110000 {
label = "kernel";
reg = <0x110000 0x400000>;
read-only;
};
partition@510000 {
label = "rootfs";
reg = <0x510000 0xAF0000>;
};
};
};
};
&spi1 {
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins>;
status = "okay";
spi-max-frequency = <32000000>;
// bias-pull-up;
st7789v@0 {
status = "okay";
compatible = "sitronix,st7789v";
reg = <0>;
spi-max-frequency = <32000000>;
rotate = <0>;
spi-cpol;
spi-cpha;
rgb;
fps = <30>;
buswidth = <8>;
reset-gpios=<&pio 4 4 GPIO_ACTIVE_LOW>;
dc-gpios =<&pio 4 5 GPIO_ACTIVE_LOW>;
debug =<1>;
};
};
&pio {
spi1_pins: spi1-pins{
pins = "PA2","PA0","PA3","PA1";
function = "spi1";
};
};
&tcon0 {
pinctrl-names = "default";
pinctrl-0 = <&lcd_rgb666_pins>;
status = "okay";
};
&tcon0_out {
tcon0_out_lcd: endpoint@0 {
reg = <0>;
remote-endpoint = <&panel_input>;
};
};
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pins_a>;
status = "okay";
};
&usb_otg {
dr_mode = "otg";
status = "okay";
};
&usbphy {
usb0_id_det-gpio = <&pio 4 2 GPIO_ACTIVE_HIGH>; /* PE2 */
status = "okay";
};
请大家帮我看看这个问题,谢谢。
以及,我有几个疑问:
1.我看别的帖子里面日志是有很多详细信息的,我该如何打开更加详细的日志呢
2.我的驱动本身已经有荔枝派nano的RGB接口的屏幕的frame buffer驱动,这个驱动和st7789的驱动能否共存?
3.有没有可能是硬件接线的问题,硬件接线不对,会不会也会导致这里出问题,谢谢
离线
1. 要根据不同厂家的初始化代码,修改drivers/staging/fbtft/fb_st7789v.c中的static int init_display(struct fbtft_par *par)函数的初始化代码,尽管都是st7789,但是不同店家的初始化代码不一样,会出现颜色错误的问题。
2. 设备树我也是这么配的,但是不知道你的kerel中开启了spi没有,由于FC1000S的SPI中有一个BUG,因此我们在开启SPI驱动的时候必须选择A31(Device Drivers -> SPI support),并且kernel中7789的驱动也要编写进去。
3. 即使没有链接屏幕,但是启动的log中也是有fbtft的信息的,我这里显示如下:
[ 0.933460] fbtft_of_value: width = 240
[ 0.937440] fbtft_of_value: height = 320
[ 0.941393] fbtft_of_value: buswidth = 8
[ 0.945324] fbtft_of_value: debug = 0
[ 0.949058] fbtft_of_value: rotate = 0
[ 0.952829] fbtft_of_value: fps = 30
4. 硬件接线我是这么接的:
LCD -- F1C
SCL -- CLK
SDA -- MOSI
RES -- PE9
DC -- PE4
CS -- CS
BLK -- 空
5. 推荐参考大佬的设置:
https://www.cnblogs.com/twzy/p/15160836.html
6. 其他的我不懂了
离线
@romanljw
我也是参考了这个大佬的文章进行配置的, A31我也打开了,但是我现在完全没有fbtft的信息输出。
离线
@romanljw
我也是参考了这个大佬的文章进行配置的, A31我也打开了,但是我现在完全没有fbtft的信息输出。
linux kernel 如果是4.x的话我记得好像不用改gpio的获取方式这些,直接把初始化部分改掉就可以了,但是5.16的话需要按照大佬的方式把gpio申请这些都改掉。其他版本我没有试过
离线
我的还是4.x的版本,lychee pi nano官网上的那个版本
离线