嵌入式爱好者

查看: 3921|回复: 3

[Linux] SPI片选设置

[复制链接]

8

主题

28

帖子

63

积分

i.MX6Q通行证i.MX6UL通行证RK3568通行证RK3399通行证

扫一扫,手机访问本帖
发表于 2022-7-28 16:31:20 | 显示全部楼层 |阅读模式
您好,我想在SPI2上接4片芯片,需要4个片选脚。但设备树上我只找到一路CS0,我可以像GPIO口一样增加片选吗?还请帮忙看看这样行吗?还需要改哪些地方?

复制代码
           spi2_clk: spi2-clk {
                rockchip,pins =
                    <2 11 RK_FUNC_1 &pcfg_pull_up>;
            };
            spi2_cs0: spi2-cs0 {
                rockchip,pins =
                    <2 12 RK_FUNC_1 &pcfg_pull_up>;
            };
            spi2_cs1: spi1-cs1 {
                rockchip,pins =
                    <2 2 RK_FUNC_1 &pcfg_pull_up>;
            };
            spi2_cs2: spi1-cs2 {
                rockchip,pins =
                    <2 5 RK_FUNC_1 &pcfg_pull_up>;
            };
            spi2_cs3: spi1-cs3 {
                rockchip,pins =
                    <2 3 RK_FUNC_1 &pcfg_pull_up>;
            };
            spi2_rx: spi2-rx {
                rockchip,pins =
                    <2 9 RK_FUNC_1 &pcfg_pull_up>;
            };
            spi2_tx: spi2-tx {
                rockchip,pins =
                    <2 10 RK_FUNC_1 &pcfg_pull_up>;
            };
        };


&spi2 {
    status = "okay";
    pinctrl-0 = <&spi1_clk &spi1_tx &spi1_rx &spi1_cs0 &spi1_cs1 &spi1_cs2 &spi1_cs3>;
    #if 0
        spidev@0 {
                compatible = "spidev", "rohm,dh2228fv";
                reg = <0>;
                spi-max-frequency = <25000000>;
        };
    #endif
        spi_tmc@0 {
                compatible = "vistel,spi_tmc_CS0";
                reg = <0>;   //chip select  0:cs0  1:cs1
                id = <0>;
                spi-max-frequency = <2000000>;   //spi output clock
            };
        spi_tmc@1 {
                compatible = "vistel,spi_tmc_CS1";
                reg = <1>;   //chip select  0:cs0  1:cs1
                id = <1>;
                spi-max-frequency = <2000000>;   //spi output clock
            };
        spi_tmc@2 {
                compatible = "vistel,spi_tmc_CS2";
                reg = <2>;   //chip select  0:cs0  1:cs1
                id = <2>;
                spi-max-frequency = <2000000>;   //spi output clock
            };
        spi_tmc@3 {
                compatible = "vistel,spi_tmc_CS3";
                reg = <3>;   //chip select  0:cs0  1:cs1
                id = <3>;
                spi-max-frequency = <2000000>;   //spi output clock
            };              
};



回复

使用道具 举报

8

主题

28

帖子

63

积分

i.MX6Q通行证i.MX6UL通行证RK3568通行证RK3399通行证

 楼主| 发表于 2022-8-2 09:57:49 | 显示全部楼层
无人回答呀???
点评回复 支持 反对

使用道具 举报

0

主题

89

帖子

282

积分

A40i/T3/T507/T527通行证i.MX6Q通行证i.MX6UL通行证i.MX8MM通行证i.MX8MP通行证RK3568通行证RK3399通行证LS1028A通行证LS1012A通行证LS1043A\46A通行证TCU通行证FDU产品通行证FCU1401通行证FCU1301通行证FCU11xx通行证FCU1201通行证FCU2201通行证FCU2301/FCU2302通行证FCU2401通行证5G转接卡通行证FCU3001通行证AM5718通行证Hi3519A通信证AM335x通行证i.MX RT通行证XX18通行证

发表于 2022-8-2 11:40:00 | 显示全部楼层
您可以看一下源码目录下\docs\Common\SPI\Rockchip_Developer_Guide_Linux_SPI_CN目录下的文档查看,您目前的需求应该是不可以的,Rockchip SPI 功能特点中描述每个 SPI 控制器支持一个到两个片选。您现在想在一个SPI控制器下接入四个片选引脚不可行。
点评回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )

GMT+8, 2024-4-19 20:55

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表