cancel
Showing results for 
Search instead for 
Did you mean: 

SPI5 clock in STM32MP151

vsaakian
Associate III

Working on setting up SPI bus and get a connection to ESP32C6 WiFi/BT module. Trying to configure SPI5 clock in device tree for STM32MP151. Have used different sources (HSI, HSE, PLL4Q), but the enable count on the SPI5_k clock is always zero. I am suspecting now that problem must be elsewhere. Has anyone stumbled upon this? 

14 REPLIES 14
Erwan SZYMANSKI
ST Employee

Hello @vsaakian ,
A little bit difficult to help with no context, can you explain :

- On which OpenSTLinux are you ? 
- Is it a custom board ? 
- Can you share your platform device tree involving SPI5 node ? 

Kind regards,
Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi, it is Dunfell OpenSTLinux, HEAD:ed4cbda9145779f757d92d158ae612238d1c7078
Yes, It is a custom board

SPI5 part looks like this:

```&spi5 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&spi5_pins_mx>;
pinctrl-1 = <&spi5_sleep_pins_mx>;
cs-gpios = <&gpioj 1 1>;
clocks = <&rcc SPI5_K>;
status = "okay";
 
esp32c6mini: esp32c6@0 {
compatible = "esp,esp32c3";
spi-max-frequency = <50000000>;
reg = <0>;
status = "okay";
 
};
};```
 
And pins defined:
```spi5_pins_mx: spi5_mx-0 {
pins {
pinmux = <STM32_PINMUX('K', 0, AF5)>, /* SPI1_SCK */
<STM32_PINMUX('J', 10, AF5)>, /* SPI_MOSI */
<STM32_PINMUX('J', 11, AF5)>; /* SPI_MISO */
bias-disable;
drive-push-pull;
slew-rate = <1>;
};
};
 
spi5_sleep_pins_mx: spi5_sleep_mx-0 {
pins {
pinmux = <STM32_PINMUX('K', 0, ANALOG)>, /* SPI1_SCK */
<STM32_PINMUX('J', 10, ANALOG)>, /* SPI_MOSI */
<STM32_PINMUX('J', 11, ANALOG)>; /* SPI_MISO */
};
};```
vsaakian
Associate III

And this is what clk_summary says about SPI5_K clock:

vsaakian_0-1702048053699.png

 

Thank you for additional information,
Do you have any trace of the driver of esp32c6 in dmesg ? Are you sure it is probed ?

Kind regards,
Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
vsaakian
Associate III

I so far have only tried with spidev which did not work really. DT example above I have not tried yet. This is how spidev probing looks like:
vsaakian_1-1702049632370.png

 

 

 

@vsaakian ,
Can you show me your DT with spidev on SPI5 ? 

Kind regards,
Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
vsaakian
Associate III

As for esp32c6 - I don't see anything in dmesg. I doubt it is a valid driver

&spi5{
pinctrl-names = "default", "sleep";
pinctrl-0 = <&spi5_pins_mx>;
pinctrl-1 = <&spi5_sleep_pins_mx>;
    cs-gpios = <&gpioj 1 1>;
clocks = <&rcc SPI5_K>;
status = "okay";
 
esp32c6mini: esp32c6@0 {
compatible = "linux,spidev";
spi-max-frequency = <50000000>;
reg = <0>;
status = "okay";
};
};

@vsaakian ,
Different comments :

1) esp32c6 seems to not be a driver upstreamed on Linux and I do not see any compatible that matches with the one you put in the device tree. If this driver is not upstreamed, it must at least exist on your side if you declare it like that in the device tree, or Linux will never make any link between the driver you try to use through SPI5, and the real one (that does not exist ?).
When I see your device tree, it means that you have your own driver (or a driver you found somewhere) that has been added to your sources, with the corresponding compatible. If it is not the case, it is not a clock issue, this is just a driver issue.

2) Concerning spidev, the compatible "linux,spidev" does not exist anymore. You need to look at spidev.c file and you will see the list of compatible supported : 

#ifdef CONFIG_OF
static const struct of_device_id spidev_dt_ids[] = {
	{ .compatible = "rohm,dh2228fv" },
	{ .compatible = "lineartechnology,ltc2488" },
	{ .compatible = "ge,achc" },
	{ .compatible = "semtech,sx1301" },
	{ .compatible = "lwn,bk4" },
	{ .compatible = "dh,dhcom-board" },
	{ .compatible = "menlo,m53cpld" },
	{},
};

I hope these explanations will help you to go forward.

Kind regards,
Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.