spi: mxc_spi: use proper clock for SPI bus
authorTim Harvey <tharvey@gateworks.com>
Wed, 18 Dec 2024 19:42:24 +0000 (11:42 -0800)
committerFabio Estevam <festevam@gmail.com>
Mon, 23 Dec 2024 11:08:34 +0000 (08:08 -0300)
commitf331967b3da2511facff76a75f9b27f21df78527
treeca3af3487b472bcd0f563c3b94f1b6fd5bd176e0
parent5947cd76acdd65f48f0748af01241cb6c0756fba
spi: mxc_spi: use proper clock for SPI bus

The mxc_get_clock function is around for compatibility with older
drivers that are not clock aware. In this case asking for the clk for
MXC_CSPI_CLK does not take into account there are multiple SPI busses on
modern IMX SoC's and it will return the clock for the first bus which
may not be used or configured.

In the case you are not using the first bus you will not get the proper
clock. Fix this by obtaining the clock rate from the bus clock.

This resolves an invalid SPI clock frequency configuration for SPI2 on a
board where SPI1 is not used.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
drivers/spi/mxc_spi.c