Hi.. community
Hope all are doing well
I'm dealing with the i.MX6 SOM from variscite
For the instance, I'm using Yocto BSP hardknott
My intend is to get the ecspi1 working, and that's how i have configure the kernel as follows
1. Activated all necessary drivers from the menuconfig
For ex
CONFIG_SPI=y
CONFIG_SPI_MASTER=y
CONFIG_SPI_IMX=y
CONFIG_SPI_IMX_DMA=y
2. configured the device tree source file on the dedicated PADS as follows
&ecspi1 {
fsl,spi-num-chipselects = <1>;
cs-gpios = <&gpio4 26 0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi1_1>;
status = "okay";
chip1: spidev@0 {
compatible = "var,spidev";
spi-max-frequency = <12000000>;
reg = <0>;
};
};
pinctrl_ecspi1_1: ecspi1grp {
fsl,pins = <
MX6UL_PAD_CSI_DATA07__ECSPI1_MISO 0x100b1
MX6UL_PAD_CSI_DATA06__ECSPI1_MOSI 0x100b1
MX6UL_PAD_CSI_DATA04__ECSPI1_SCLK 0x100b1
MX6UL_PAD_CSI_DATA05__GPIO4_IO26 0x100b1
>;
};
3. Installed the imx-sdma firmware with the custom image
which is appearing in /lib/firmware/imx/sdma directory in my custom image
CORE_IMAGE_EXTRA_INSTALL += " firmware-imx-sdma"
Problem statement
ecspi not getting activate, as /dev/spi* directory is not populating!
In kernel boot logs, i found some error logs for the SPI, which is mentioned here
[ 2.216962] spi_imx 2008000.spi: can't get the TX DMA channel, error -517!
[ 3.538836] spi_imx 2008000.spi: can't get the TX DMA channel, error -517!
[ 3.558381] spi_imx 2008000.spi: can't get the TX DMA channel, error -517!
[ 3.564509] spi_imx 2008000.spi: can't get the TX DMA channel, error -517!
From where, i got to know that the TX DMA channel is not allocated to SPI
For your reference , i have attached the full kernel boot logs, defconfig file and .dts file
I need some support from the community
All suggestions and comments welcome
Thanks
Mahendra Sondagar
Hi.. @kef2 & @Sanket_Parekh
here is the update from my side
1. verified the menuconfigs settings from my side as follows
CONFIG_SPI=y
CONFIG_SPI_MASTER=y
CONFIG_SPI_IMX=y
CONFIG_SPI_IMX_DMA=y
CONFIG_SPI_FSL_LPSPI=y
CONFIG_SPI_FSL_QUADSPI=y
CONFIG_SPI_NXP_FLEXSPI=y
CONFIG_SPI_SPIDEV=y
CONFIG_EXTRA_FIRMWARE="imx/sdma/sdma-imx6q.bin"
CONFIG_EXTRA_FIRMWARE_DIR="/lib/firmware/"
2. updated DT by applying the patch to enable the SPI & sdma as follows
&ecspi1 {
fsl,spi-num-chipselects = <1>;
cs-gpios = <&gpio4 26 0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi1_1>;
status = "okay";
spidev@0 {
compatible = "var,spidev";
spi-max-frequency = <12000000>;
reg = <0>;
status = "okay";
};
pinctrl_ecspi1_1: ecspi1grp {
fsl,pins = <
MX6UL_PAD_CSI_DATA07__ECSPI1_MISO 0x100b1
MX6UL_PAD_CSI_DATA06__ECSPI1_MOSI 0x100b1
MX6UL_PAD_CSI_DATA04__ECSPI1_SCLK 0x100b1
MX6UL_PAD_CSI_DATA05__GPIO4_IO26 0x100b1
>;
};
&sdma {
status = "okay";
};
3. After building the images with the above changes and loading with the target, here are the observations
(i) The DMA error gone from the dmesg logs
spi_imx 2008000.spi: can't get the TX DMA channel, error -517!
(ii) still /dev/spi* unable to populate!
(iii) device tree configuration & observations at target board are as follows
root@imx6ul-var-dart:~# find /sys/firmware | grep sdma
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/#dma-cells
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/compatible
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/clocks
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/fsl,sdma-ram-script-name
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/clock-names
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/interrupts
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/phandle
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/reg
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/name
root@imx6ul-var-dart:~# find /sys/firmware | grep spi@2008000/dma
/sys/firmware/devicetree/base/soc/bus@2000000/spba-bus@2000000/spi@2008000/dma-names
/sys/firmware/devicetree/base/soc/bus@2000000/spba-bus@2000000/spi@2008000/dmas
Hello @mahendrasondaga ,
I hope you are doing well.
->It should confirm via the command you shared & if the status is okay then it should be enabled.
->It looks like the initial loading of the SDMA firmware fails. This usually happens when the imx-sdma driver is built into the kernel. Please try building it as a kernel module.
->It may happen because SDMA firmware is outdated, Please make sure to use the latest Linux BSP as it has the latest updated drivers as well as firmware.
I hope it helps!
Thanks & Regards,
Sanket Parekh
Hi.. @Sanket_Parekh
after activating from the kernel module, it has been loaded
root@imx6ul-var-dart:~# dmesg | grep sdma
[ 1.339421] imx-sdma 20ec000.sdma: no event needs to be remapped
[ 1.339461] imx-sdma 20ec000.sdma: WARN: Device release is not defined so it is not safe to unbind this driver while in use
[ 1.345584] imx-sdma 20ec000.sdma: firmware found.
[ 1.346064] imx-sdma 20ec000.sdma: loaded firmware 3.5
[ 2.245635] imx-sdma 20ec000.sdma: private_candidate: dma0chan0 busy
[ 3.281665] imx-sdma 20ec000.sdma: private_candidate: dma0chan0 busy
[ 3.281699] imx-sdma 20ec000.sdma: private_candidate: dma0chan1 busy
[ 3.282203] imx-sdma 20ec000.sdma: private_candidate: dma0chan0 busy
[ 3.282228] imx-sdma 20ec000.sdma: private_candidate: dma0chan1 busy
[ 3.282248] imx-sdma 20ec000.sdma: private_candidate: dma0chan2 busy
root@imx6ul-var-dart:~# dmesg | grep spi
[ 2.245820] spidev@0 enforce active low on chipselect handle
[ 2.252011] spi_imx 2008000.spi: registered master spi0
[ 2.252436] spi spi0.0: spi_imx_setup: mode 0, 8 bpw, 12000000 hz
[ 2.252479] spi spi0.0: setup mode 0, 8 bits/w, 12000000 Hz max --> 0
[ 2.253746] spi_imx 2008000.spi: registered child spi0.0
root@imx6ul-var-dart:/dev# spidev_test -D /dev/spidev0.0
spi mode: 0x4
bits per word: 8
max speed: 500000 Hz (500 kHz)
Many Thanks @Sanket_Parekh & @kef2
Appreciate both of you
Hello @mahendrasondaga ,
I hope you are doing well.
I'm glad that issue is solved.
Hence can I close this thread?
Thanks & Regards,
Sanket Parekh
Hi.. @Sanket_Parekh
Thanks, let me try this
If you have this
&sdma { status = "okay"; };
then this
find /sys/firmware | grep sdma
should confirm it! I guess you failed to deploy new dtb to target. SDMA driver has to trigger in dmesg message about firmware loading.
Hi.. @kef2
Yes, you're right
By mistake, i have loaded the older DTB file
here is the update after enabling the sdma
root@imx6ul-var-dart:~# find /sys/firmware | grep sdma
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/#dma-cells
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/compatible
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/clocks
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/fsl,sdma-ram-script-name
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/clock-names
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/status
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/interrupts
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/phandle
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/reg
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/name
root@imx6ul-var-dart:~#
status contents seems to be "okay^@"
Yes, its activated now
root@imx6ul-var-dart:~# find /sys/firmware | grep spi@2008000/dma
/sys/firmware/devicetree/base/soc/bus@2000000/spba-bus@2000000/spi@2008000/dma-names
/sys/firmware/devicetree/base/soc/bus@2000000/spba-bus@2000000/spi@2008000/dmas
root@imx6ul-var-dart:~# dmesg | grep sdma
root@imx6ul-var-dart:~#
Still result remains the same!
root@imx6ul-var-dart:~# dmesg | grep spi
[ 2.222540] spi_imx 2008000.spi: can't get the TX DMA channel, error -517!
[ 3.553153] spi_imx 2008000.spi: can't get the TX DMA channel, error -517!
[ 3.572671] spi_imx 2008000.spi: can't get the TX DMA channel, error -517!
[ 3.578818] spi_imx 2008000.spi: can't get the TX DMA channel, error -517!
The complete dmesg logs is attached here
Any suggestions pl. ?
Then perhaps SDMA is not enabled in DT. Try adding
&sdma {
status = "okay";
};
Or verify what you have after Linux boots:
# find /sys/firmware | grep sdma
/sys/firmware/devicetree/base/soc/bus@2000000/dma-controller@20ec000/fsl,sdma-ram-script-name
# ls -l /sys/firmware/devicetree/base/soc/bus@2000000/dma-controller@20ec000/
-r--r--r-- 1 root root 4 May 23 07:03 #dma-cells
-r--r--r-- 1 root root 8 May 23 07:03 clock-names
-r--r--r-- 1 root root 16 May 23 07:03 clocks
-r--r--r-- 1 root root 46 May 23 07:03 compatible
-r--r--r-- 1 root root 24 May 23 07:03 fsl,sdma-ram-script-name
-r--r--r-- 1 root root 12 May 23 07:03 interrupts
-r--r--r-- 1 root root 15 May 23 07:03 name
-r--r--r-- 1 root root 4 May 23 07:03 phandle
-r--r--r-- 1 root root 8 May 23 07:03 reg
-r--r--r-- 1 root root 5 May 23 07:03 status
# cat /sys/firmware/devicetree/base/soc/bus@2000000/dma-controller@20ec000/status
okay#
As well check if ecspi1 doesn't miss dmas and dma-names
# find /sys/firmware | grep spi@2008000/dma
/sys/firmware/devicetree/base/soc/bus@2000000/spba-bus@2000000/spi@2008000/dma-names
/sys/firmware/devicetree/base/soc/bus@2000000/spba-bus@2000000/spi@2008000/dmas
# hexdump /sys/firmware/devicetree/base/soc/bus@2000000/spba-bus@2000000/spi@2008000/dmas
0000000 0000 0a00 0000 0300 0000 0700 0000 0100
0000010 0000 0a00 0000 0400 0000 0700 0000 0200
0000020
# cat /sys/firmware/devicetree/base/soc/bus@2000000/spba-bus@2000000/spi@2008000/dma-names
rxtx#
On success you should get this on your iMX6ULL
# dmesg | grep sdma
[ 0.344638] imx-sdma 20ec000.dma-controller: firmware found.
[ 0.344972] imx-sdma 20ec000.dma-controller: loaded firmware 3.5
Hi.. @kef2
here is the test results
find /sys/firmware | grep sdma
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/#dma-cells
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/compatible
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/clocks
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/fsl,sdma-ram-script-name
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/clock-names
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/interrupts
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/phandle
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/reg
/sys/firmware/devicetree/base/soc/bus@2000000/sdma@20ec000/name
-r--r--r-- 1 root root 4 Mar 25 08:24 #dma-cells
-r--r--r-- 1 root root 8 Mar 25 08:24 clock-names
-r--r--r-- 1 root root 16 Mar 25 08:24 clocks
-r--r--r-- 1 root root 46 Mar 25 08:24 compatible
-r--r--r-- 1 root root 24 Mar 25 08:24 fsl,sdma-ram-script-name
-r--r--r-- 1 root root 12 Mar 25 08:24 interrupts
-r--r--r-- 1 root root 5 Mar 25 08:24 name
-r--r--r-- 1 root root 4 Mar 25 08:24 phandle
-r--r--r-- 1 root root 8 Mar 25 08:24 reg
find /sys/firmware | grep spi@2008000/dma
/sys/firmware/devicetree/base/soc/bus@2000000/spba-bus@2000000/spi@2008000/dma-names
/sys/firmware/devicetree/base/soc/bus@2000000/spba-bus@2000000/spi@2008000/dmas
root@imx6ul-var-dart:~# dmesg | grep sdma
root@imx6ul-var-dart:~#
Yes, you're right
sdma seems not to be activated in DT
however, my host PC is in trouble
Once, It will get recover, I'll also verify the DT and update here
Many Thanks
Hello @mahendrasondaga ,
I hope you are doing well.
->Please make sure to check the sdma-related DT configuration, I have shared an example for reference.
sdma3: dma-controller@30e00000 {
compatible = "fsl,imx8mp-sdma", "fsl,imx7d-sdma";
reg = <0x30e00000 0x10000>;
interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_
<&audio_blk_ctrl IMX8MP_CLK_AUDIO_BLK_CTRL_
clock-names = "ipg", "ahb";
#dma-cells = <3>;
fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
fsl,ratio-1-1;
power-domains = <&audiomix_pd>;
status = "okay";
};
->One should always set the status to "okay" to enable it.
Please share the observation.
Thanks & Regards,
Sanket Parekh
Hi.. @Sanket_Parekh
here is the sdma node in my case
You can see, the status property is not written, but i guess it's seems to be activated
sdma: sdma@20ec000 {
compatible = "fsl,imx6ul-sdma", "fsl,imx6q-sdma",
"fsl,imx35-sdma";
reg = <0x020ec000 0x4000>;
interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6UL_CLK_IPG>,
<&clks IMX6UL_CLK_SDMA>;
clock-names = "ipg", "ahb";
#dma-cells = <3>;
fsl,sdma-ram-script-name = "imx/sdma/sdma-imx6q.bin";
};
Hi.. @kef2
I have configured the kernel configuration options into the menuconfig as follows
CONFIG_EXTRA_FIRMWARE="imx/sdma/sdma-imx6q.bin"
CONFIG_EXTRA_FIRMWARE_DIR="/lib/firmware/"
After compiling and installing the target board, I also verified for the same via below command
zcat /proc/config.gz | grep CONFIG_EXTRA_FIRMWARE
CONFIG_EXTRA_FIRMWARE="imx/sdma/sdma-imx6q.bin"
CONFIG_EXTRA_FIRMWARE_DIR="/lib/firmware/"
However, still, the issue remains the same!
As I believe the sdma-imx6q.bin lies in my /lib/firmware directory of the rootfs and that's how I have configured CONFIG_EXTRA_FIRMWARE_DIR accordingly
during the CONFIG_EXTRA_FIRMWARE_DIR="firmware" configuration, and compiling the Makefile unable to finds it!
Any suggestions pl. ?
Since you have 'y' for
CONFIG_SPI_IMX=y
SDMA as well should be compiled as 'y'. No matter 'y' or 'm', you should see message about loading SDMA FW. Perhaps you have SDMA disabled in kernel.
So 'y' for SPI_IMX means 'y' for SDMA. 'y' for SDMA means SDMA FW has to be included in kernel as blob. Unless it's done, no matter is there FW in /lib/firmare or not, SDMA will fail.
CORE_IMAGE_EXTRA_INSTALL += " firmware-imx-sdma"
This seems only instructing Yocto to populate FW in rootfs. It doesn't let FW blob to be attached in zImage. To include FW in zImage, kernel has to be compiled with
CONFIG_EXTRA_FIRMWARE="imx/sdma/sdma-imx6q.bin"
CONFIG_EXTRA_FIRMWARE_DIR="firmware"
Where FIRMWARE_DIR is path visible to kernel Makefile. It could be either relative or absolute. Above "firmware" is folder in the same path as kernel Makefile. And there's a FW file in firmware/imx/sdma/sdma-imx6q.bin.
CONFIG_EXTRA_FIRMWARE_DIR="firmware"
should be set to /lib/firmware. sdma-*.bin files come populated with host OS, as well with Yocto?
Hi.. @kef2
Thanks for the feedback
Yes, i agreed!
That i can also check from the kernel logs as well that kernel is not linking with the sdma drivers as, the directory is missing
Let me try this remedy
Many Thanks
Hello @mahendrasondaga
I hope you are doing well.
->One can also check by enabling the below-given macros in the def config.
CONFIG_SPI_FSL_LPSPI=y
CONFIG_SPI_FSL_QUADSPI=y
CONFIG_SPI_NXP_FLEXSPI=y
CONFIG_SPI_SPIDEV=y
->Please also enable the below option also in the kernel configuration.
CONFIG_IMX_SCU=y
Please share the observation.
Thanks & Regards,
Sanket Parekh
Hi.. @Sanket_Parekh
Thanks , Surely will add it and update it here after testing
Hello @mahendrasondaga ,
I hope you are doing well.
OK, Sure Please share the observation and the updates if any.
Thanks & Regards,
Sanket Parekh