@yuzukitsuru
1.大佬是用什么sdk的呀?我用的是韦东山提供的buildroot工程neza-d1-buildroot,
2.然后感觉那个uboot有点问题,不会遍历dts中第二层级的device,我在源码上参照那个clocks的来遍历第二层,第三层的device,在uboot 输入dm tree可以正常显示device对应的层级关系。只是第三层级的spinor没有绑定成功
修改后的串口dm tree打印
=> dm tree Class Probed Driver Name ---------------------------------------- root [ + ] root_drive root_driver hello_cj_c [ + ] hello_drv |-- hello_dts_name@1234 hello_cj_c [ ] hello_drv_ | `-- hello_dts_child@5678 spi_flash [ ] spi_flash_ `-- spi@04026000 =>uboot的spi1 dts配置
//uboot-origin_master/arch/riscv/dts/sun20iw1p1-soc-system.dts 6 /dts-v1/; 11 / { 12 model = "sun20iw1"; 13 compatible = "allwinner,riscv", "arm,sun20iw1p1"; 14 #address-cells = <2>; 15 #size-cells = <2>; + 18 hellohqh: hello_dts_name@1234 { + 19 + 20 #address-cells = <1>; + 21 #size-cells = <0>; + 22 compatible = "hello_dts"; + 23 reg = <0x02000000>; + 24 pinctrl-names = "default", "sleep"; + 25 pinctrl-0 = <&gpiotest_pins>; + 26 + 27 hellohqh1: hello_dts_child@5678 { + 28 compatible = "hello_child_dts"; + 29 reg = <0x31>; + 30 hellohqh2: hello_dts_child_child@99991 { + 31 compatible = "hello_child_child_dts"; + 32 + 33 }; + 34 }; + 35 }; 37 soc: soc@29000000 { 38 #address-cells = <2>; 39 #size-cells = <2>; + 427 spi1: spi@04026000 { + 428 //#address-cells = <1>; + 429 //#size-cells = <0>; + 430 compatible = "allwinner,sun20i-spi"; + 431 device_type = "spi1"; + 432 reg = <0x0 0x04026000 0x0 0x1000>; + 433 //interrupts-extended = <&plic0 31 IRQ_TYPE_LEVEL_HIGH>; + 434 //clocks = <&ccu CLK_PLL_PERIPH0>, <&ccu CLK_SPI0>, <&ccu CLK_BUS_SPI0>; + 435 //clock-names = "pll", "mod", "bus"; + 436 //resets = <&ccu RST_BUS_SPI0>; + 437 clock-frequency = <100000000>; + 438 pinctrl-names = "default", "sleep"; + 439 spi1_cs_number = <1>; + 440 spi1_cs_bitmap = <1>; + 441 spi_slave_mode = <0>; + 442 //dmas = <&dma 22>, <&dma 22>; + 443 //dma-names = "tx", "rx"; + 444 pinctrl-0 = <&spi1_pins_a &spi1_pins_b>; + 445 pinctrl-1 = <&spi1_pins_c>; + 446 status = "okay"; + 447 spi-nor { + 448 compatible = "jedec,spi-nor"; + 449 spi-max-frequency=<0x5F5E100>; + 450 reg = <0x0>; + 451 spi-rx-bus-width=<0x01>; + 452 spi-tx-bus-width=<0x01>; + 453 status="okay"; + 454 }; + 455 }; + 273 spi1_pins_a: spi1@0 { + 274 allwinner,pins = "PD11", "PD12", "PD13","PD14", "PD15"; + 275 allwinner,pname = "spi1_sclk", "spi1_mosi","spi1_miso", "spi1_hold", "spi1_wp"; + 276 allwinner,function = "spi1"; + 277 allwinner,muxsel = <4>; + 278 allwinner,drive = <1>; + 279 allwinner,pull = <0>; + 280 }; + 281 + 282 spi1_pins_b: spi1@1 { + 283 allwinner,pins = "PD10"; + 284 allwinner,pname = "spi1_cs0"; + 285 allwinner,function = "spi1"; + 286 allwinner,muxsel = <4>; + 287 allwinner,drive = <1>; + 288 allwinner,pull = <1>; // only CS should be pulled up + 289 }; + 290 + 291 spi1_pins_c: spi1@2 { + 292 allwinner,pins = "PD10", "PD11", "PD12", "PD13","PD14", "PD15"; + 293 allwinner,function = "gpio_in"; + 294 allwinner,muxsel = <0>; + 295 allwinner,drive = <1>; + 296 allwinner,pull = <0>; + 297 }; 307 };3.我看了一下drivers/sunxi_flash/sunxi_flash.c,貌似不是基于DM模型的驱动,这个是怎么调用的呀?大佬是否可以指导指导,还在学习阶段好多东西都不懂