2023-03-14 11:38 PM
I'm using the STM32MP157F-DK2-ND evaluation board and getting an error when I try to enable SPI5.
I have researched previous posts with this error
https://community.st.com/s/question/0D53W00000GZlRVSA1/enabling-devspidevxx-on-openstlinux
https://community.st.com/s/question/0D53W00000RS3ynSAD/how-can-i-enable-spi5-on-stm32mp157dk1
And reviewed relevant documentation
https://wiki.st.com/stm32mpu/wiki/How_to_use_SPI_from_Linux_userland_with_spidev
https://wiki.st.com/stm32mpu/wiki/SPI_overview
https://wiki.st.com/stm32mpu/wiki/SPI_device_tree_configuration
I've also ensured these options are checked in make linux-menuconfig
https://wiki.st.com/stm32mpu/wiki/SPI_overview#Kernel_configuration
Still, I cannot figure out why the clock isn't running.
[ 1.533147] spi_stm32 44009000.spi: clk rate = 0
[ 1.536942] spi_stm32: probe of 44009000.spi failed with error -22
I 'm using the buildroot config: st_stm32mp157f_dk2_demo_defconfig provided by github buildroot-external-st repository (new member so can't add link)
After generating from CubeMX I added the following user code in my linux-dts and uboot-dts files:
&spi5{
pinctrl-names = "default", "sleep";
pinctrl-0 = <&spi5_pins_mx>;
pinctrl-1 = <&spi5_sleep_pins_mx>;
cs-gpios= <&gpiof 6 0>;
status = "okay";
/* USER CODE BEGIN spi5 */
spidev@0{
compatible = "linux,spidev";
reg = <0>;
spi-max-frequency = <4000000>;
};
/* USER CODE END spi5 */
};
I also ensured:
CLK_SPI2S23_PLL3Q
CLK_SPI45_PCLK2
are set in my tfa-dts file
I ensured these settings are getting built correctly by downloading the output from:
output/build/linux-custom/
I would appreciate help to troubleshoot this and any debug tools I can use to figure out this issue. Thanks!
Solved! Go to Solution.
2023-03-29 06:40 AM
Hello @AMill.9 ,
I can see that you are using:
+ compatible = "linux,spidev";
In the spidev.c it is indicated:
/*
* spidev should never be referenced in DT without a specific
* compatible string, it is a Linux implementation thing
* rather than a description of the hardware.
*/
WARN(spi->dev.of_node &&
of_device_is_compatible(spi->dev.of_node, "spidev"),
"%pOF: buggy DT: spidev listed directly in DT\n", spi->dev.of_node);
And below you have the list of compatible field possible in a DT:
static const struct of_device_id spidev_dt_ids[] = {
{ .compatible = "rohm,dh2228fv" },
{ .compatible = "lineartechnology,ltc2488" },
{ .compatible = "semtech,sx1301" },
{ .compatible = "lwn,bk4" },
{ .compatible = "dh,dhcom-board" },
{ .compatible = "menlo,m53cpld" },
{ .compatible = "cisco,spi-petra" },
{ .compatible = "micron,spi-authenta" },
{},
You must use one of these compatible fields in your DTS to have spidev functional.
And be sure to have enabled these linux configurations described in the wiki: https://wiki.st.com/stm32mpu/wiki/SPI_overview#Kernel_configuration
Hope it helps,
Best regards,
Kevin
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'
2023-03-15 01:11 PM
Should I try to do a minimal build with only SPI5 enabled instead of all this other crap?
2023-03-16 03:35 PM
PLEASE can I get some help? I will even pay. I need to get this working asap as it's holding up the project.
2023-03-29 06:40 AM
Hello @AMill.9 ,
I can see that you are using:
+ compatible = "linux,spidev";
In the spidev.c it is indicated:
/*
* spidev should never be referenced in DT without a specific
* compatible string, it is a Linux implementation thing
* rather than a description of the hardware.
*/
WARN(spi->dev.of_node &&
of_device_is_compatible(spi->dev.of_node, "spidev"),
"%pOF: buggy DT: spidev listed directly in DT\n", spi->dev.of_node);
And below you have the list of compatible field possible in a DT:
static const struct of_device_id spidev_dt_ids[] = {
{ .compatible = "rohm,dh2228fv" },
{ .compatible = "lineartechnology,ltc2488" },
{ .compatible = "semtech,sx1301" },
{ .compatible = "lwn,bk4" },
{ .compatible = "dh,dhcom-board" },
{ .compatible = "menlo,m53cpld" },
{ .compatible = "cisco,spi-petra" },
{ .compatible = "micron,spi-authenta" },
{},
You must use one of these compatible fields in your DTS to have spidev functional.
And be sure to have enabled these linux configurations described in the wiki: https://wiki.st.com/stm32mpu/wiki/SPI_overview#Kernel_configuration
Hope it helps,
Best regards,
Kevin
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'