离线
;----------------------------------------------------------------------------------
;SPI controller configuration
;----------------------------------------------------------------------------------
[spi0]
spi_used = 0
spi_cs_bitmap = 1
spi_cs0 = port:PC19<3><1><default><default>
spi_sclk = port:PC02<3><default><default><default>
spi_mosi = port:PC00<3><default><default><default>
spi_miso = port:PC01<3><default><default><default>
[spi1]
spi_used = 0
spi_cs_bitmap = 1
spi_cs0 =
spi_sclk =
spi_mosi =
spi_miso =
[spi2]
spi_used = 0
spi_cs_bitmap = 1
spi_cs0 = port:PE04<3><1><default><default>
spi_sclk = port:PE05<3><default><default><default>
spi_mosi = port:PE06<3><default><default><default>
spi_miso = port:PE07<3><default><default><default>
[spi3]
spi_used = 0
spi_cs_bitmap = 1
spi_cs0 = port:PH17<2><1><default><default>
spi_cs1 = port:PH18<2><1><default><default>
spi_cs2 = port:PH12<3><1><default><default>
spi_cs3 = port:PH13<3><default><default><default>
spi_sclk = port:PH14<2><default><default><default>
spi_mosi = port:PH15<2><default><default><default>
spi_miso = port:PH16<2><default><default><default>
;----------------------------------------------------------------------------------
;SPI device configuration
;----------------------------------------------------------------------------------
[spi_devices]
spi_dev_num = 1
[spi_board0]
modalias = "m25p32"
max_speed_hz = 33000000
bus_num = 0
chip_select = 0
mode = 0
https://github.com/linux-sunxi/sunxi-boards/blob/master/sys_config/a80/cubieboard4.fex
离线
https://whycan.com/files/members/3907/A33-user-manual-release-1_1.pdf
https://whycan.com/files/members/3/Allwinner_S3_Datasheet_V0_2.pdf
https://whycan.com/files/members/3907/D1_Datasheet_V0.1_Draft_Version.pdf
https://whycan.com/files/members/3907/D1_User_Manual_V0.1_Draft_Version.pdf
https://dl.linux-sunxi.org/H3/Allwinner_H3_Datasheet_V1.0.pdf
https://linux-sunxi.org/images/a/a3/Allwinner_H5_Manual_v1.0.pdf
翻遍了这些都没找到多片选。
离线
A80啥价格啊?为了片选spi,值得吗?
离线
A80啥价格啊?为了片选spi,值得吗?
不是用A80, 是看到手册和驱动都可以给每个SPI设置四个SPI_CS[0..3], 但是我能看到的芯片都只有一条片选腿, 所以非常奇怪,找到了早上的发现。
离线
这和普通io进行片选有什么区别
离线
这和普通io进行片选有什么区别
没有本质区别,上面这个片选方式用 SPI_TCR 寄存器的 SS_SEL 位控制片选引脚,可能效率更高?
离线
离线
看来就是说,全志soc在设计时候,每组SPI留了4个cs#引脚,但是一般实际只引出来一个cs0了。
离线
/* sunxi_spi_set_cs : spi control set cs to connect device
* enable : 1, working mode : set ss to connect device
* enable : 0, default mode : set ss to do not connect device
*
* spi controller cs mode use this funtion to set cs
* software cs mode use kernel code to set cs
* */
static void sunxi_spi_set_cs(struct spi_device *spi, bool enable)
{
u32 reg_val;
struct sunxi_spi *sspi = spi_master_get_devdata(spi->master);
sunxi_spi_ss_select(spi->chip_select, sspi->base_addr);
reg_val = readl(sspi->base_addr + SPI_TC_REG);
enable &= 0x01;
if (enable) //set cs to connect device
reg_val |= SPI_TC_SS_LEVEL;
else //set cs to default mode
reg_val &= ~SPI_TC_SS_LEVEL;
writel(reg_val, sspi->base_addr + SPI_TC_REG);
}
果然是啊, 从D1 SDK 翻到的 lichee/linux-5.4/drivers/spi/spi-sunxi.c
离线