spi: Fixes for v5.11

A few more bug fixes for SPI, both driver specific ones.  The caching in
 the Cadence driver is to avoid a deadlock trying to retrieve the cached
 value later at runtime.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmAFyd4ACgkQJNaLcl1U
 h9DOnwf/SZWtc+EtLYPeHEBjMpvAW4n39BU24dkYQeEsy6rOEMDC3fNxV1PcCmTA
 jXtTaVXDYmzoYKy3u45QQaDY+vfmtdK1PAfU6LWaXW2tfSPIrB9RzZNQv0j7y4xZ
 xLOjrLIlfReDSgBBuFWHj139YX2LOheX5sSIUvVWgZLT8HPdicQ7CrW7Ju0cdNIm
 ZUbdg0mg72WUGnttnF87gL6Obbv8te+bv6+mpbKYuj+pYouSVNZgKPQ7+uGeH3rP
 RGcjtFwBs5CedgWe+Rv/5GSkMR68gNjjYWrKXN5GMc3ieXtaKxKkd5CfLafLWAEC
 m6YjNDKizP1bA1LU289/bDTs4mThNg==
 =V7f4
 -----END PGP SIGNATURE-----

Merge tag 'spi-fix-v5.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
 "A few more bug fixes for SPI, both driver specific ones. The caching
  in the Cadence driver is to avoid a deadlock trying to retrieve the
  cached value later at runtime"

* tag 'spi-fix-v5.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: cadence: cache reference clock rate during probe
  spi: fsl: Fix driver breakage when SPI_CS_HIGH is not set in spi->mode
This commit is contained in:
Linus Torvalds 2021-01-18 11:23:05 -08:00
commit 1e2a199f6c
2 changed files with 6 additions and 5 deletions

View File

@ -115,6 +115,7 @@ struct cdns_spi {
void __iomem *regs;
struct clk *ref_clk;
struct clk *pclk;
unsigned int clk_rate;
u32 speed_hz;
const u8 *txbuf;
u8 *rxbuf;
@ -250,7 +251,7 @@ static void cdns_spi_config_clock_freq(struct spi_device *spi,
u32 ctrl_reg, baud_rate_val;
unsigned long frequency;
frequency = clk_get_rate(xspi->ref_clk);
frequency = xspi->clk_rate;
ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR);
@ -558,8 +559,9 @@ static int cdns_spi_probe(struct platform_device *pdev)
master->auto_runtime_pm = true;
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
xspi->clk_rate = clk_get_rate(xspi->ref_clk);
/* Set to default valid value */
master->max_speed_hz = clk_get_rate(xspi->ref_clk) / 4;
master->max_speed_hz = xspi->clk_rate / 4;
xspi->speed_hz = master->max_speed_hz;
master->bits_per_word_mask = SPI_BPW_MASK(8);

View File

@ -115,14 +115,13 @@ static void fsl_spi_chipselect(struct spi_device *spi, int value)
{
struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master);
struct fsl_spi_platform_data *pdata;
bool pol = spi->mode & SPI_CS_HIGH;
struct spi_mpc8xxx_cs *cs = spi->controller_state;
pdata = spi->dev.parent->parent->platform_data;
if (value == BITBANG_CS_INACTIVE) {
if (pdata->cs_control)
pdata->cs_control(spi, !pol);
pdata->cs_control(spi, false);
}
if (value == BITBANG_CS_ACTIVE) {
@ -134,7 +133,7 @@ static void fsl_spi_chipselect(struct spi_device *spi, int value)
fsl_spi_change_mode(spi);
if (pdata->cs_control)
pdata->cs_control(spi, pol);
pdata->cs_control(spi, true);
}
}