离线
在设备树的文件 arch/arm64/boot/dts/allwinner/sunxi-h3-h5.dtsi里,厂家已写好两个spi控制器相关的设备节点:
spi0_pins: spi0 {
pins = "PC0", "PC1", "PC2", "PC3";
function = "spi0";
};
spi1_pins: spi1 {
pins = "PA15", "PA16", "PA14", "PA13";
function = "spi1";
};
spi0: spi@01c68000 {
compatible = "allwinner,sun8i-h3-spi";
reg = <0x01c68000 0x1000>;
interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>;
clock-names = "ahb", "mod";
dmas = <&dma 23>, <&dma 23>;
dma-names = "rx", "tx";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins>;
resets = <&ccu RST_BUS_SPI0>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
spi1: spi@01c69000 {
compatible = "allwinner,sun8i-h3-spi";
reg = <0x01c69000 0x1000>;
interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_SPI1>, <&ccu CLK_SPI1>;
clock-names = "ahb", "mod";
dmas = <&dma 24>, <&dma 24>;
dma-names = "rx", "tx";
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins>;
resets = <&ccu RST_BUS_SPI1>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
在板级主要的设备树文件 arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts:
&pio {
...
spi0_cs_pins: spi0_cs_pins {
pins = "PC3", "PA6";
function = "gpio_out";
};
};
&spi0 {
/* needed to avoid dtc warning */
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
cs-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>, <&pio 0 6 GPIO_ACTIVE_HIGH>;
...
离线
我看了韦东山的SPI驱动视频,不知道是否视频使用的版本太老了,没有用到设备树,我在内核代码里也没有找到(不会找)V3s的SPI驱动代码。不知道现在的内核版本,想使用SPI来驱动一个外设芯片,该怎么做。
期待大神能指点一二。
离线
是什么芯片?如果linux已有驱动配置驱动和dts就可以了。
离线
也就是说,我现在用SPI FLASH作为S3/V3s的存储器, 还能挂一个ST7789这种SPI LCD吗?
离线
也就是说,我现在用SPI FLASH作为S3/V3s的存储器, 还能挂一个ST7789这种SPI LCD吗?
可以, 亲测可用。
https://whycan.cn/t_4774.html#p48764
&pio {
spi0_cs_pins: spi0_cs_pins {
pins = "PC3", "PH6";
function = "gpio_out";
};
};
&spi0 {
status ="okay";
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
cs-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>, <&pio 7 6 GPIO_ACTIVE_HIGH>;
mx25l25635e:mx25l25635e@0 {
compatible = "jedec,spi-nor";
reg = <0x0>;
spi-max-frequency = <50000000>;
#address-cells = <1>;
#size-cells = <1>;
};
panel@0 {
compatible = "sitronix,st7789v";
reg = <1>;
reset-gpios = <&pio 2 4 GPIO_ACTIVE_HIGH>;//PC4
dc-gpios = <&pio 2 7 GPIO_ACTIVE_LOW>;//PC7
/*backlight = <&pwm_bl>;*/
led-gpios = <&pio 7 0 GPIO_ACTIVE_LOW>;//PH0
spi-max-frequency = <50000000>;
spi-cpol;
spi-cpha;
buswidth = <8>;
rotate = <270>;
rgb;
fps = <30>;
debug = <1>;
};
离线
离线
晕哥,H5是不是和H3硬件兼容呀,还有就是带设备树的LINUX是从哪一版本开始的呀?全志V3S,带设备树LINUX主流版本版本是哪一个呀?
离线