This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
您好!
请参阅应用手册 :https://www.ti.com/lit/pdf/sprad26?keyMatch=DRA821
此致、
基尔西
DMA =<&MAIN_udmap 0xc610>、<&MAIN_udmap 0x4610>;
如何设置有关 spi0和 SPI1的 DMA、这意味着0f '0xc610'
我添加了以下代码:
索引:ti/k3-j721e-common-proc-board.dts
===================================================================================================================================
-- ti/k3-j721e-common-proc-board.dts (修订版3142)
++ ti/k3-j721e-common-proc-board.dts (工作副本)
@@-240、6 +240、26 @@
>;
};
+ MAIN_spi0_PINS_DEFAULT:MAIN_spi0_PINS_DEFAULT{
+ pinctrl-single、pins =<
+ J721E_IOPAD (0x1c8、PIN_INPUT、0)/*(AA1) SPI0_CLK *
+ J721E_IOPAD (0x1c0、PIN_INPUT、0)/*(Aa2) SPI0_CS0 *
+ J721E_IOPAD (0x1cc、PIN_INPUT、0)/*(AB5) SPI0_D0 */
+ J721E_IOPAD (0x1d0、PIN_INPUT、0)/*(Aa3) SPI0_D1 *
+ J721E_IOPAD (0x264、PIN_INPUT、7)//(T29) MMC2_DAT2.GPIO1_24 */
+ >;
+} ;
+
+ MAIN_SPI1_PINS_DEFAULT:MAIN_SPI1_PINS_DEFAULT{
+ pinctrl-single、pins =<
+ J721E_IOPAD (0x1dc、PIN_INPUT、0)/*(Y1) SPI1_CLK */
+ J721E_IOPAD (0x1d4、PIN_INPUT、0)/*(Y3) SPI1_CS0 *
+ J721E_IOPAD (0x1e0、PIN_INPUT、0)/*(Y5) SPI1_D0 *
+ J721E_IOPAD (0x1e4、PIN_INPUT、0)/*(Y2) SPI1_D1 */
+ J721E_IOPAD (b0、PIN_INPUT、7)//(AF28) PRG0_PRU0_GPO0.GPIO0_43 */
+ >;
+} ;
+
@@-1202,6+1223,33 @@
STATUS ="禁用";
};
+&main_spi0{
+ status="oke";
+ pinctrl-names ="default";
+ pinctrl-0 =<&MAIN_spi0_PINS_DEFAULT>;
+ SPI 从器件;
+ 从器件@0{
+ SPI-max-frequency =<10000000>;
+ reg =<0>;
+ compatible ="linux、spidev";
+} ;
+};
+
SerDes_wiz4{(&S)
STATUS ="禁用";
};
索引:ti/k3-j721e-main.dtsi
===================================================================================================================================
-- ti/k3-j721e-main.dtsi (修订版3142)
++ ti/k3-j721e-main.dtsi (工作副本)
@@-1339、7 +1339、43 @@
时钟=<&K3_CLKS 193 0>;
电源域=<&K3_PDS 193 TI_SCI_PD_Excluse>;
};
-
+
+ MAIN_spi0:SPI@2100000{
+ 兼容="ti、am654-mcspi"、"ti、omAP4-mcspi";
+ reg =<0x0 0x2100000 0x0 0x400>;
+ 中断= ;
+ #address-cells =<1>;
+ #size-cells =<0>;
+ 时钟=<&K3_CLKS 266 0>;
+ 电源域=<&K3_PDS 266 TI_SCI_PD_Excluse>;
+ DMA =<&MAIN_udmap 0xc600>、<&MAIN_udmap 0xc600>;
+ dma-names ="tx0"、"rx0";
+} ;
d5520:视频解码器@4300000{
/* IMG D5520驱动程序配置*/
兼容="img、D5500-vxd";
@@-1348、6 +1384、8 @@
中断= ;
};
有两个警告:
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi:1343.25 - 1353.4:警告(SPI_BUS_BRIDGE):/bus@100000/SPI@2100000:SPI 总线的#address-cells 不正确
arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dtb:警告(SPI_BUS_reg):失败的前提条件'SPI_BUS_BRID'
赵好、
缺少 SPI0/1的某些 PSIL 线程编号:
因此、请添加以下更改:
diff --git a/drivers/dma/ti/k3-psil-j721e.c b/drivers/dma/ti/k3-psil-j721e.c index 34e3fc565..169d29f63 100644 --- a/drivers/dma/ti/k3-psil-j721e.c +++ b/drivers/dma/ti/k3-psil-j721e.c @@ -266,6 +266,15 @@ static struct psil_ep j721e_dst_ep_map[] = { PSIL_ETHERNET(0xc205), PSIL_ETHERNET(0xc206), PSIL_ETHERNET(0xc207), + /* PDMA8 (PDMA_MISC_G0) - SPI0-1 */ + PSIL_PDMA_XY_PKT(0xc600), + PSIL_PDMA_XY_PKT(0xc601), + PSIL_PDMA_XY_PKT(0xc602), + PSIL_PDMA_XY_PKT(0xc603), + PSIL_PDMA_XY_PKT(0xc604), + PSIL_PDMA_XY_PKT(0xc605), + PSIL_PDMA_XY_PKT(0xc606), + PSIL_PDMA_XY_PKT(0xc607), /* CPSW9 */ PSIL_ETHERNET(0xca00), PSIL_ETHERNET(0xca01),
MAIN_spi0节点也应如下所示:
+ MAIN_spi0:SPI@2100000{
+ 兼容="ti、am654-mcspi"、"ti、omAP4-mcspi";
+ reg =<0x0 0x2100000 0x0 0x400>;
+ 中断= ;
+ #address-cells =<1>;
+ #size-cells =<0>;
+ 时钟=<&K3_CLKS 266 0>;
+ 电源域=<&K3_PDS 266 TI_SCI_PD_Excluse>;
+ DMA =<&MAIN_udmap 0xc600>、<&MAIN_udmap 0x4600>;
+ dma-names ="tx0"、"rx0";
+} ;
main_SPI1的 DMA 属性为
+ DMA =<&MAIN_udmap 0xc604>、<&MAIN_udmap 0x4604>;
+ dma-names ="tx0"、"rx0";
此致、
基尔西
我的修改与您的修改相同、但在 TX 和 Rx 中传输失败。
我还测试了 zhe SPI4和 MCU SPI2、但传输失败。
root@j7-evm:~# ls -l /sys/class/spi*
/sys/class/spi_master:
总计0
lrwxrwxrwx 1 root root root 用户0 4月10 00:05 SPI2 ->../../devices/platform/bus@100000 /bus@100000:bus@28380000/40320000.MCU-SPI2/SPI_MASTER/SPI2
lrwxrwxrwx 1 root root root 用户0 4月10 00:05 spi3 ->../../devices/platform/bus@100000 /bus@100000:bus@28380000/470000.fss/47040000.SPI/SPI_master/spi3
/sys/class/spi_slave:
总计0
lrwxrwxrwx 1 root root root 用户0 4月10 00:05 spi0 ->../../devices/platform/bus@100000/2100000.SPI/SPI_slave/spi0
lrwxrwxrwx 1 root root 用户0四月10:00:05 SPI1 ->../../devices/platform/bus@100000/22110000.SPI/SPI_slave/SPI1
lrwxrwxrwx 1 root root root 用户0四月10:00:05 SPI4 ->../../devices/platform/bus@100000/2140000.SPI/SPI_slave/SPI4
/sys/class/spidev:
总计0
lrwxrwxrwx 1 root root 用户0 4月10 00:05 spidev0.0 ->../../devices/platform/bus@100000/2100000.SPI/SPI_slave/spi0/spi0.0/spidev/spidev0.0
lrwxrwxrwx 1 root root 用户0 4月10 00:05 spidev1.0 ->../../devices/platform/bus@100000/22110000.SPI/SPI_slave/SPI1/spi1.0/spidev/spidev1.0
lrwxrwxrwx 1 root root root 用户0 4月10 00:05 spidev2.0 ->../../devices/platform/bus@100000 /bus@100000:bus@28380000/40320000.MCU-SPI2/SPI_master/SPI2/spi2.0/spidev/spidev2.0
lrwxrwxrwx 1 root root 用户0 4月10 00:05 spidev4.0 ->../../devices/platform/bus@100000/2140000.SPI/SPI_slave/SPI4/spi4.0/spidev/spidev4.0
root@J7-EVM:/home# echo spidev >/sys/class/spi_slave/SPI4/ slave
root@j7-evm:/home#./spidev_test -v -D /dev/spidev4.0 -p slave-hello-to master &
[1] 1323
SPI 模式:0x0
每字位数:8.
最大速度:500000Hz (500KHz)
根目录@J7-EVM:/home#
root@j7-evm:/home#./spidev_test -v -D /dev/spidev2.0 -p master-hello-to -slave
SPI 模式:0x0
每字位数:8.
最大速度:500000Hz (500KHz)
TX | 6D 61 73 74 65 72 2D 68 65 6C 6F 2D 74 6F 2D 73 6C 61 76 65 ___________ ________ __ |master-hello-to -slave|
RX | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 __________ ________ __ |.................. |
索引:board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
===================================================================================================================================
--board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts (修订版3150)
++ board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts (工作副本)
@@-240、6 +240、26 @@
>;
};
+ MAIN_spi0_PINS_DEFAULT:MAIN_spi0_PINS_DEFAULT{
+ pinctrl-single、pins =<
+ J721E_IOPAD (0x1c8、PIN_INPUT、0)/*(AA1) SPI0_CLK *
+ J721E_IOPAD (0x1c0、PIN_INPUT、0)/*(Aa2) SPI0_CS0 *
+ J721E_IOPAD (0x1cc、PIN_INPUT、0)/*(AB5) SPI0_D0 */
+ J721E_IOPAD (0x1d0、PIN_INPUT、0)/*(Aa3) SPI0_D1 *
+ J721E_IOPAD (0x264、PIN_INPUT、7)//(T29) MMC2_DAT2.GPIO1_24 */
+ >;
+} ;
+
+ MAIN_SPI1_PINS_DEFAULT:MAIN_SPI1_PINS_DEFAULT{
+ pinctrl-single、pins =<
+ J721E_IOPAD (0x1dc、PIN_INPUT、0)/*(Y1) SPI1_CLK */
+ J721E_IOPAD (0x1d4、PIN_INPUT、0)/*(Y3) SPI1_CS0 *
+ J721E_IOPAD (0x1e0、PIN_INPUT、0)/*(Y5) SPI1_D0 *
+ J721E_IOPAD (0x1e4、PIN_INPUT、0)/*(Y2) SPI1_D1 */
+ J721E_IOPAD (b0、PIN_INPUT、7)//(AF28) PRG0_PRU0_GPO0.GPIO0_43 */
+ >;
+} ;
+
mcasp10_pins_default:mcasp10_pins_default{
pinctrl-single、pins =<
J721E_IOPAD (0x158、PIN_OUTPUT 下拉、12)/*(U23) RGMII5_TX_CTL.MCASP10_ACLKX *
@@-271,6+291,7 @@
J721E_IOPAD (0x240、PIN_INPUT、0)/*(R26) MMC1_DAT3 */
J721E_IOPAD (0x258、PIN_INPUT、0)/*(P23) MMC1_SDCD *
J721E_IOPAD (0x25c、PIN_INPUT、0)/*(R28) MMC1_SDWP *
>;
};
@@-1202,6+1223,60 @@
STATUS ="禁用";
};
+&main_spi0{
+ status="oke";
+ pinctrl-names ="default";
+ pinctrl-0 =<&MAIN_spi0_PINS_DEFAULT>;
+ SPI 从器件;
+ 从器件@0{
+ SPI-max-frequency =<10000000>;
+ reg =<0>;
+ compatible ="linux、spidev";
+
+ REQUEST_Pin{
+ REQUESTI-GPIO =<&MAIN_GPIO1 24 GPIO_ACTIVE_LOW_>;
+ ACTIVE_TIME =<1>; /* ms */
+} ;
+} ;
+};
+
+&MAIN_SPI1{
+ pinctrl-names ="default";
+ pinctrl-0 =<&MAIN_SPI1_PINS_DEFAULT>;
+ status="oke";
+
+ SPI 从器件;
+
+ 从器件@0{
+ SPI-max-frequency =<10000000>;
+ reg =<0>;
+ compatible ="linux、spidev";
+ REQUEST_Pin{
+ REQUESTI-GPIO =<&MAIN_GPIO0 43 GPIO_ACTIVE_LOW_>;
+ ACTIVE_TIME =<1>; /* ms */
+} ;
+} ;
+};
+
+&MCU_SPI2{
+ status="oke";
+ spidev@0{
+ SPI-max-frequency =<10000000>;
+ reg =<0>;
+ compatible ="linux、spidev";
+};
+};
+
+&MAIN_SPI4{
+ status="oke";
+ SPI 从器件;
+从器件@0{
+ SPI-max-frequency =<10000000>;
+ reg =<0>;
+ compatible ="linux、spidev";
+};
+};
+
SerDes_wiz4{(&S)
STATUS ="禁用";
};
索引:board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi
===================================================================================================================================
--board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi (修订版3150)
++ board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-main.dtsi (工作副本)
@@-1339、7 +1339、43 @@
时钟=<&K3_CLKS 193 0>;
电源域=<&K3_PDS 193 TI_SCI_PD_Excluse>;
};
+
+ MAIN_spi0:SPI@2100000{
+ 兼容="ti、am654-mcspi"、"ti、omAP4-mcspi";
+ reg =<0x0 0x2100000 0x0 0x400>;
+ 中断= ;
+ #address-cells =<1>;
+ #size-cells =<0>;
+ 时钟=<&K3_CLKS 266 0>;
+ 电源域=<&K3_PDS 266 TI_SCI_PD_Excluse>;
+ DMA =<&MAIN_udmap 0xc600>、<&MAIN_udmap 0x4600>;
+ dma-names ="tx0"、"rx0";
+} ;
+
+ MAIN_SPI1:SPI@2110000{
+ 兼容="ti、am654-mcspi"、"ti、omAP4-mcspi";
+ reg =<0x0 0x2110000 0x0 0x400>;
+ 中断= ;
+ #address-cells =<1>;
+ #size-cells =<0>;
+ 时钟=<&K3_CLKS 267 0>;
+ 电源域=<&K3_PDS 267 TI_SCI_PD_Excluse>;
+ DMA =<&MAIN_udmap 0xc604>、<&MAIN_udmap 0x4604>;
+ dma-names ="tx0"、"rx0";
+} ;
+ MAIN_SPI4:SPI@2140000{
+ 兼容="ti、am654-mcspi"、"ti、omAP4-mcspi";
+ reg =<0x0 0x2140000 0x0 0x400>;
+ 中断= ;
+ 时钟=<&K3_CLKS 270 1>;
+ 电源域=<&K3_PDS 270 TI_SCI_PD_Excluse>;
+ #address-cells =<1>;
+ #size-cells =<0>;
+ DMA =<&MAIN_udmap 0xc618>、<&MAIN_udmap 0x4618>;
+ dma-names ="tx0"、"rx0";
+} ;
+
d5520:视频解码器@4300000{
/* IMG D5520驱动程序配置*/
兼容="img、D5500-vxd";
索引:board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-mcus-wake.dtsi
===================================================================================================================================
--- board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-mcus-wake.dtsi (修订版3150)
++ board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e-mcus-wake.dtsi (工作副本)
@@-69、7 +69、15 @@
#address-cells =<1>;
大小单元格=<1>;
};
-
+ MCU_SPI2:MCU-SPI2@40320000{
+ 兼容="ti、am654-mcspi"、"ti、omAP4-mcspi";
+ reg =<0x0 0x40320000 0x0 0x400>;
+ 中断= ;
+ 时钟=<&K3_CLKS 276 1>;
+ 电源域=<&K3_PDS 276 TI_SCI_PD_Excluse>;
+ #address-cells =<1>;
+ #size-cells =<0>;
+} ;
wkup_uart0:串行@42300000{
兼容="ti、j721e-uart"、"ti、am654-uart";
REG =<0x00 0x42300000 0x00 0x100>;
索引:board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e.dtsi
===================================================================================================================================
--- board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e.dtsi (修订版3150)
++ board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/boot/dts/ti/k3-j721e.dtsi (工作副本)
@@-40、6 + 40、8 @@
rproP6 =&C66_0;
rproc 7 =&C66_1;
rproc8 =&C71_0;
+ spi0 =&main_spi0;
+ SPI1 =&MAIN_SPI1;
};
选择的{};
@@-179,6+181,7 @@
0x00 0x41c00000 0x00 0x41c00000 0x00 0x00100000>、/* MCU SRAM *
0x00 0x42040000 0x00 0x42040000 0x00 0x00 0x03ac2400>、/* WKUP 外设窗口*
0x00 0x45100000 0x00 0x45100000 0x00 0x00c24000>、// MMR、剩余的 NAVSS *
+ 0x00 0x40320000 0x00 0x40320000 0x00 0x00000400>、// MCU SPI2 *
0x00 0x46000000 0x00 0x46000000 0x00 0x00200000>、/* CPSW */
0x00 0x47000000 0x00 0x47000000 0x00 0x00068400>、/* OSPI 寄存器空间*/
0x00 0x50000000 0x00 0x50000000 0x00 0x10000000>、/* FSS OSPI0/1数据区域0 *
索引:board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/configs/tisdk_j7-evm_defconfig
===================================================================================================================================
--- board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/configs/tisdk_j7-evm_defconfig (版本3150)
++ board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/arch/arm64/configs/tisdk_j7-evm_defconfig (工作副本)
@@-2854、10 +2854、10 @@
编号
# SPI 协议主器件
编号
-# CONFIG_SPI_SPIDEV 未设置
+CONFIG_SPI_SPIDEV=y
未设置# CONFIG_SPI_LOOP_TEST
# CONFIG_SPI_TLE62X0未设置
-# CONFIG_SPI_SLAVE 未设置
+CONFIG_SPI_SLAVE = y
CONFIG_SPI_DYNAM=y
CONFIG_SPMI=y
未设置# CONFIG_HSI
索引:Board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/drivers/dma/ti/k3-psil-j721e.c
===================================================================================================================================
--- board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/drivers/dma/ti/k3-psil-j721e.c (修订版3150)
++ board-support/linux-5.4.106+gitAUTOINC+023faefa70-g023faefa70/drivers/dma/ti/k3-psil-j721e.c (工作副本)
@@-131、8 +131、8 @@
PSIL_PDMA_XY_PKT (0x4627)、
PSIL_PDMA_XY_PKT (0x4628)、
PSIL_PDMA_XY_PKT (0x4629)、
/* PDMA13 (PDMA_USART_G0)- UART0-1 */
PSIL_PDMA_XY_PKT (0x4700)、
PSIL_PDMA_XY_PKT (0x4701)、
@@-224、6 +224、45 @@
/* SA2UL */
PSIL_SA2UL (0xf500、1)、
PSIL_SA2UL (0xf501、1)、
+
+ /* PDMA_SPI_G0 - SPI1 */
+ PSIL_PDMA_XY_PKT (0xc600)、
+ PSIL_PDMA_XY_PKT (0xc601)、
+ PSIL_PDMA_XY_PKT (0xc602)、
+ PSIL_PDMA_XY_PKT (0xc603)、
+ PSIL_PDMA_XY_PKT (0xc604)、
+ PSIL_PDMA_XY_PKT (0xc605)、
+ PSIL_PDMA_XY_PKT (0xc606)、
+ PSIL_PDMA_XY_PKT (0xc607)、
+ /* PDMA_SPI_G2 - SPI3 */
+ PSIL_PDMA_XY_PKT (0xc60c)、
+ PSIL_PDMA_XY_PKT (0xc60d)、
+ PSIL_PDMA_XY_PKT (0xc60e)、
+ PSIL_PDMA_XY_PKT (0xc60f)、
+ PSIL_PDMA_XY_PKT (0xc610)、
+ PSIL_PDMA_XY_PKT (0xc611)、
+ PSIL_PDMA_XY_PKT (0xc612)、
+ PSIL_PDMA_XY_PKT (0xc613)、
+
+ /* PDMA_SPI_G4 - SPI5 */
+ PSIL_PDMA_XY_PKT (0xc618)、
+ PSIL_PDMA_XY_PKT (0xc619)、
+ PSIL_PDMA_XY_PKT (0xc61a)、
+ PSIL_PDMA_XY_PKT (0xc61b)、
+ PSIL_PDMA_XY_PKT (0xc61c)、
+ PSIL_PDMA_XY_PKT (0xc61d)、
+ PSIL_PDMA_XY_PKT (0xc61e)、
+ PSIL_PDMA_XY_PKT (0xc61f)、
+
+ /* PDMA_SPI_G6 - SPI7 */
+ PSIL_PDMA_XY_PKT (0xc624)、
+ PSIL_PDMA_XY_PKT (0xc625)、
+ PSIL_PDMA_XY_PKT (0xc626)、
+ PSIL_PDMA_XY_PKT (0xc627)、
+ PSIL_PDMA_XY_PKT (0xc628)、
+ PSIL_PDMA_XY_PKT (0xc629)、
+ PSIL_PDMA_XY_PKT (0xc62a)、
+ PSIL_PDMA_XY_PKT (0xc62b)、
};
struct psil_ep_map j721e_ep_map ={
您好!
我看不到 MAIN_SPI4和 MCU_SPI2的引脚复用。 请从共享的应用手册中复制它们。
-凯尔西