硬件原理圖如下:
CH9434的INT接SSD202D的TTL26,CS,CLK,MOSI,MISO,分別接SSD202D的GPIO8,GPIO9,GPIO10,GPIO11?。
參考SPI使用參考 - SigmaStarDocs (comake.online),修改DTS,
修改arch\arm\boot\dts\infinity2m-ssc011a-s01a-padmux.dtsi
,
,
,
,
把相關(guān)管腳復(fù)用成SPI,編譯kernel燒進(jìn)板子后,會(huì)有/dev/spidev0.0節(jié)點(diǎn)。
參考恒沁官網(wǎng)驅(qū)動(dòng),修改ch9434驅(qū)動(dòng),
1:屏蔽DTS,增加spi_info
2:增加spi_register_board_info
把驅(qū)動(dòng)編譯進(jìn)內(nèi)核后,跑起來后ch943x_scr_test一直不過。
[? ? 1.837296] [ss_gpi_intc_domain_alloc] hw:30 -> v:62
[? ? 1.839409] gpio_to_irq:62, spi->irq:60
[? ? 1.843310] change to SPI MODE 3!
[? ? 1.846561] [Padmux]reset Pad_45(reg 0x101e0d; mask0xf00) to GPIO(org: TTL_MODE_1)
[? ? 1.854279] ch943x_port_write - reg:0x81, val:0x 0
[? ? 1.858940] ch943x_port_write - reg:0x84, val:0x 0
[? ? 1.863760] ch943x_port_read - reg:0x 6, val:0xc7
[? ? 1.868389] ******Uart 0 SPR Test Start******
[? ? 1.872791] ch943x_port_write - reg:0x87, val:0x55
[? ? 1.877567] ch943x_port_read - reg:0x 7, val:0xc7
[? ? 1.882253] UART 0 SPR Test Failed.
[? ? 1.885725] ch943x_spi spi0.1: ch943x_probe error
[? ? 1.890431] ch943x_spi: probe of spi0.1 failed with error -1
spi_board_info中的irq以及其controller_data不知道如何取值。不清楚這樣修改是否正確?還請(qǐng)大神給與解答。