The driver ignores the “spi-max-frequency” parameter. I was forced to reduce the MAX_SPI_CLK_SPEED in the driver to 25 MHz because it needs to be half of my peripheral clock (50 MHz).
Here is a Logic Analyzer trace of the SPI bus and RST line on boot.
Haven’t had any experience with the iMX93 specifically, but we are currently working through a SPI attached iMX6.
A small quirk with the MM6108, in order to put it into SPI mode, the host needs to toggle the SPI clock line ~74 times while the CS pin is held high - ie, inverted compared to normal operation.
From your trace, it looks like yours is driving the CS line low during this period. I suspect this is causing your errors, as the MM6108 then will not respond to any other host commands.
This can happen if the hardware chip select is being used (check pinctrl_lpspi4), and isn’t respecting the driver request to invert the CS logic.
If this is still failing, there may be some kernel patches missing. Let me know!
I see what you are saying about the CS line being low during the initialization. I will look into morse_spi_initsequence (spi.c) to see why the CS behavior is not being inverted. Do you think it may be necessary to add a patch to the SPI driver to support this inversion?
It looks like the driver is not respecting the cs_high bit. I see the bit getting set in the debug logs, but I do not see it act as active high on the logic analyzer trace.
@ajudge I was using the 1.12.4 version of the driver. It is missing some kernel changes related to SPI_CONTROLLER_ENABLE_CS_GPIOD.
I upgraded to 1.14.1 and pulled in the new kernel patches. I am able to load the driver successfully now and I do see the CS line inverted for the initialization.
I still have to modify the driver to limit the SPI bus speed to 25 MHz. Is it possible add support to the driver to respect the spi-max-frequency property?
There is a module parameter spi_clock_speed which you can set on driver insertion to set the module parameter. However, I can appreciate that you would want to communicate this configuration with devicetree instead. We did have an internal patch which was never merged to respect the device tree property, I’ll follow that up.