SPI frequency on Apalis i.MX8

Hello, I am trying to work with iMX8 SPI but I cannot achieve clock frequencies more than 12MHz.
According to documentation the maximum SPI frequency for master configuration is 60MHZ.
But, trying to set the device to clock higher than 12MHz I got the following error:

[  417.655450] fsl_lpspi 5a000000.lpspi: per-clk should be at least two times of transfer speed
[  417.663939] myspidev spi0.0: SPI transfer failed: -22
[  417.668514] spi_master spi0: failed to transfer one message from queue

Also, in the device tree (fsl-imx8qm-device.dtsi) I can that the clock source for the SPI module is set to 24MHz:

            lpspi0: lpspi@5a000000 {
                    compatible = "fsl,imx7ulp-spi";
                    reg = <0x0 0x5a000000 0x0 0x10000>;
                    interrupts = <GIC_SPI 216 IRQ_TYPE_LEVEL_HIGH>;
                    interrupt-parent = <&gic>;
                    clocks = <&clk IMX8QM_SPI0_CLK>,
                             <&clk IMX8QM_SPI0_IPG_CLK>;
                    clock-names = "per", "ipg";
                    assigned-clocks = <&clk IMX8QM_SPI0_CLK>;
                    assigned-clock-rates = <24000000>;
                    power-domains = <&pd_dma0_chan1>;
                    dma-names = "tx","rx";
                    dmas = <&edma0 1 0 0>, <&edma0 0 0 1>;
                    status = "disabled";

Changing the “assigned-clock-rates” value did not solve the problem.
Has anyone succeed in configuring higher clock frequency for SPI master device on i.MX8 module?


Hi @ikok and Welcome to the Toradex Community!

Please have a look here.

Best regards,

Thank you @jaski.tx! After setting the assigned-clock-rates to 60MHz I can now configure the spi master clock to 30MHz.

Thanks for the feedback.