您尚未登录。

楼主 # 2022-07-15 18:34:07

ronz
会员
注册时间: 2021-11-19
已发帖子: 31
积分: 31

V3S 主线linux5.2 SPI 增加CS遇到的问题

不废话
主线5.2.0 想挂个FRAM  CS选的PB2

单独的FRAM   或者 单独的SPI NAND都是可以的,但是同时就是不行

DTS

&pio {
	    spi0_cs_pins: spi0_cs_pins {
		pins = "PC2", "PB2";
		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 2 GPIO_ACTIVE_HIGH>, <&pio 1 2 GPIO_ACTIVE_HIGH>;
        
        spi_nand: spi_nand@0 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "spi-nand";
                reg = <0>;
                spi-max-frequency = <50000000>;

                partition@0 {
                    label = "uboot";
                    reg = <0x0 0x100000>;
                    read-only;
                };

                partition@100000 {
                    label = "dtb";
                    reg = <0x100000 0x20000>;
                    read-only;
                };

                partition@120000 {
                    label = "kernel";
                    reg = <0x120000 0x800000>;
                    read-only;
                };

                partition@920000 {
                    label = "rootfs";
                    reg = <0x920000 0x79E0000>;
                };
            };
        
                
        mb85rs256:mb85rs2mta@0 {
                compatible = "jedec,spi-nor";
                reg = <0x0>;
                spi-max-frequency = <25000000>;
                #address-cells = <1>;
                #size-cells = <1>;
        	};	
		
	};

LOG:

   0.791005] printk: console [ttyS0] enabled
[    0.816903] 1c28800.serial: ttyS1 at MMIO 0x1c28800 (irq = 34, base_baud = 1500000) is a U6_16550A
[    0.852444] sun8i-v3s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pc not found, using dummy regulator
[    0.864037] spi-nand spi0.0: GigaDevice SPI NAND was found.
[    0.869702] spi-nand spi0.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
[    0.878622] 4 fixed-partitions partitions found on MTD device spi0.0
[    0.885073] Creating 4 MTD partitions on "spi0.0":
[    0.889908] 0x000000000000-0x000000100000 : "uboot"
[    0.897741] 0x000000100000-0x000000120000 : "dtb"
[    0.903663] 0x000000120000-0x000000920000 : "kernel"
[    0.909452] random: fast init done
[    0.928650] 0x000000920000-0x000008300000 : "rootfs"
[    0.933722] mtd: partition "rootfs" extends beyond the end of device "spi0.0" -- size truncated to 0x76e0000
[    1.081055] random: crng init done
[    1.177988] sun6i-spi 1c68000.spi: chipselect 0 already in use
[    1.183898] spi_master spi0: spi_device register error /soc/spi@1c68000/mb85rs2mta@0
[    1.191667] spi_master spi0: Failed to create SPI device for /soc/spi@1c68000/mb85rs2mta@0

我已经参考了
H5的spi控制器驱动, 可以通过 gpio 控制 spi 片选 (转载)

最近编辑记录 ronz (2022-07-15 18:38:32)

离线

楼主 #2 2022-07-15 22:46:46

ronz
会员
注册时间: 2021-11-19
已发帖子: 31
积分: 31

Re: V3S 主线linux5.2 SPI 增加CS遇到的问题

image_2022_07_15T09_33_23_568Z.pngimage_2022_07_15T09_33_05_552Z.png

谢大佬指点,不在报cs占用了
m25p80 spi0.0: unrecognized JEDEC id bytes: 04 c8 51 c8 51 c8
这个 ID是 nand flash,不是FRAM的
难道FRAM的频率有点低?他datasheet最大是45
我设置的25.....

离线

楼主 #3 2022-07-16 20:11:40

ronz
会员
注册时间: 2021-11-19
已发帖子: 31
积分: 31

Re: V3S 主线linux5.2 SPI 增加CS遇到的问题

搞定了 谢谢大佬

&pio {
	    spi0_cs_pins: spi0_cs_pins {
		pins = "PC2", "PB2";
		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 2 GPIO_ACTIVE_HIGH>, <&pio 1 2 GPIO_ACTIVE_HIGH>;
        
        spi_nand: spi_nand@0 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "spi-nand";
                reg = <0x0>;
                spi-max-frequency = <50000000>;

                partition@0 {
                    label = "uboot";
                    reg = <0x0 0x100000>;
                    read-only;
                };

                partition@100000 {
                    label = "dtb";
                    reg = <0x100000 0x20000>;
                    read-only;
                };

                partition@120000 {
                    label = "kernel";
                    reg = <0x120000 0x800000>;
                    read-only;
                };

                partition@920000 {
                    label = "rootfs";
                    reg = <0x920000 0x79E0000>;
                };
            };
        
                
        mb85rs256:mb85rs2mta@1 {
                compatible = "jedec,spi-nor";
                reg = <0x1>;
                spi-max-frequency = <45000000>;
                #address-cells = <1>;
                #size-cells = <1>;
        	};	
		
	};

LOG

[    0.853517] sun8i-v3s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pc not found, using dummy regulator
[    0.865110] spi-nand spi0.0: GigaDevice SPI NAND was found.
[    0.870780] spi-nand spi0.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 128
[    0.879806] 4 fixed-partitions partitions found on MTD device spi0.0
[    0.886165] Creating 4 MTD partitions on "spi0.0":
[    0.891040] 0x000000000000-0x000000100000 : "uboot"
[    0.898358] 0x000000100000-0x000000120000 : "dtb"
[    0.904275] 0x000000120000-0x000000920000 : "kernel"
[    0.910170] random: fast init done
[    0.929055] 0x000000920000-0x000008300000 : "rootfs"
[    0.934131] mtd: partition "rootfs" extends beyond the end of device "spi0.0" -- size truncated to 0x76e0000
[    1.081048] random: crng init done
[    1.177381] m25p80 spi0.1: mb85rs2mta (256 Kbytes)
[    1.183734] usbcore: registered new interface driver rndis_wlan
[    1.190289] usbcore: registered new interface driver cdc_ether
[    1.196164] usbcore: registered new interface driver rndis_host
[    1.202158] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.208680] ehci-platform: EHCI generic platform driver
[    1.214235] ehci-platform 1c1a000.usb: EHCI Host Controller
[    1.219914] ehci-platform 1c1a000.usb: new USB bus registered, assigne

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn