|
由于内核源码没有ili9488的驱动,我就github上download下来了一个。我将详细描述我的操作过程,请大佬为我指出问题。
1.设备树在linux-4.19-0614/linux-4.19/arch/loongarch/boot/dts/loongson目录下,在loongson_2k0300_pai_99.dts的文件中,添加spi1节点:
spi1: spi1@16018000 {
status = "disabled";
compatible = "loongson,ls-spi";
reg = <0 0x16018000 0 0x10>;
#address-cells = <1>;
#size-cells = <0>;
};
2.在loongson_2k0300_pai_99_wifi.dts中添加:
&spi1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi1_4bit>;
ili9488@1{
compatible = "ilitek,ili9488";
reg = <0>;
status = "okay";
spi-max-frequency = <50000000>;
spi-cpol;
spi-cpha;
rotate = <90>;
fps = <60>;
buswidth = <8>;
dc-gpios = <&gpa3 2 GPIO_ACTIVE_HIGH>; //DC
reset-gpios = <&gpa3 3 GPIO_ACTIVE_HIGH>; //RST
debug = <0x0>;
};
};
3.linux-4.19/drivers/staging/fbtft中修改Kconfig和Makefile(根据已有的ili9466驱动改的)
Makefile中增加:
obj-$(CONFIG_FB_TFT_ILI9488) += fb_ili9488.o
Kconfig中增加:
config FB_TFT_ILI9488
tristate "FB driver for the ILI9488 LCD Controller"
depends on FB_TFT
help
Generic Framebuffer support for ILI9488
4.编译内核,生成vmlinuxz,U盘拷贝复制到久久派的/boot下,
但是出现这种情况:
[ 7.382260] drivers/pinctrl/pinctrl-ls2k300.c:gpio functions has redefinition
[ 7.845766] Unhandled kernel unaligned access[#1]:
[ 7.853907] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.190 #24
[ 7.863808] pc 9000000000763054 ra 9000000000763f9c tp 900000009c17c000 sp 900000009c17fae0
[ 7.876430] a0 0000000000000032 a1 9000000000e36ae8 a2 000000000004b000 a3 9000000000d8865c
[ 7.889083] a4 900000009c1c3e20 a5 0000000000000000 a6 000000000000003f a7 000000000000000d
[ 7.901726] t0 fffffffffffff000 t1 900000009ca27000 t2 90000000012071ec t3 900000009c180000
[ 7.914342] t4 0000000000000001 t5 90000000011e3930 t6 0000000000000000 t7 fffffffffefef000
[ 7.927058] t8 900000009c996501 u0 900000009c17fa38 s9 9000000001420008 s0 0000000000000032
[ 7.939820] s1 0000000000000001 s2 ffffff810219c000 s3 900000009c6c8040 s4 900000009c500800
[ 7.952636] s5 0000000000025800 s6 900000009ca27410 s7 0000000000000040 s8 900000000131c1b8
[ 7.965516] ra: 9000000000763f9c gpiod_set_value+0x2c/0x90
[ 7.975258] ERA: 9000000000763054 validate_desc+0x24/0xa0
[ 7.984771] CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
[ 7.995077] PRMD: 00000004 (PPLV0 +PIE -PWE)
[ 8.003177] EUEN: 00000000 (-FPE -SXE -ASXE -BTE)
[ 8.011748] ECFG: 00071fff (LIE=0-12 VS=7)
[ 8.019594] ESTAT: 00090010 [ALE] (IS=4 ECode=9 EsubCode=0)
[ 8.029154] BADV: 0000000000000032
[ 8.036180] PRID: 0014a030 (Loongson-64bit, )
[ 8.044362] Modules linked in:
[ 8.050873] Process swapper/0 (pid: 1, threadinfo=(____ptrval____), task=(____ptrval____))
[ 8.063767] Stack : 0000000000000032 9000000000763f9c 000000000000013f 0000000000000000
[ 8.076429] 900000009ca27410 9000000000aea7fc 000000000000013f 0000000000000040
[ 8.089094] 0000000000000000 000000000004b000 900000009c500800 0000000000000000
[ 8.101781] 000000000000013f 0000000000000000 900000009ca27410 9000000000ae6aa8
[ 8.114444] 0000000000000036 900000009ca27000 900000009c500800 900000009c500800
[ 8.127089] 900000009ca27000 0000000000000000 900000009ca27410 9000000000ae7744
[ 8.139710] 900000009ca27410 9000000000ae742c 0000000000000000 0000000000000000
[ 8.152307] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[ 8.164926] 900000009c990000 0000000000000000 0000000000000000 0000000000000000
[ 8.177503] 0000000000000000 0000000000000000 0000000000000000 900000009c500000
[ 8.190016] ...
[ 8.195764] Call Trace:
[ 8.201506] [<9000000000763054>] validate_desc+0x24/0xa0
[ 8.210663] [<9000000000763f9c>] gpiod_set_value+0x2c/0x90
[ 8.220001] [<9000000000aea7fc>] write_vmem16_bus8+0x5c/0x130
[ 8.229659] [<9000000000ae6aa8>] fbtft_update_display+0xe8/0x240
[ 8.239569] [<9000000000ae7744>] fbtft_register_framebuffer+0xf4/0x270
[ 8.250051] [<9000000000ae854c>] fbtft_probe_common+0x17c/0x4d0
[ 8.259749] [<900000000097cfe4>] spi_drv_probe+0x74/0xd0
[ 8.268712] [<90000000008e5680>] really_probe+0x200/0x2c0
[ 8.277753] [<90000000008e590c>] driver_probe_device+0x6c/0x110
[ 8.287375] [<90000000008e5acc>] __driver_attach+0x11c/0x120
[ 8.296677] [<90000000008e30ac>] bus_for_each_dev+0x6c/0xb0
[ 8.305856] [<90000000008e4808>] bus_add_driver+0x1d8/0x210
[ 8.315004] [<90000000008e67ac>] driver_register+0x6c/0x140
[ 8.324160] [<900000000136fa78>] fbtft_driver_module_init+0x20/0x48
[ 8.334170] [<9000000000200be4>] do_one_initcall+0x44/0x1c0
[ 8.343336] [<900000000131ce9c>] kernel_init_freeable+0x244/0x30c
[ 8.353128] [<9000000000d870cc>] kernel_init+0x18/0xfc
[ 8.361715] [<9000000000202fcc>] ret_from_kernel_thread+0xc/0x10
[ 8.371304] Code: 15ffffec 00150097 68004d84 <28c0008c> 40005980 28cde18d 02800404 40001da0 28c02061
[ 8.385470]
[ 8.389925] ---[ end trace ef1caaedf5017901 ]---
[ 8.398317] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[ 8.398317]
[ 8.414283] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[ 8.414283] ]---
[ 55.154703] random: crng init done
内核好像崩溃了。
|
|