Commit e10a6bb5 authored by Kamal Dasu's avatar Kamal Dasu Committed by Mark Brown

spi: bcm-qspi: set transfer parameter only if they change

Check if the transfer parameters have changed from previous settings
before applying new parameters.
Signed-off-by: default avatarKamal Dasu <kdasu.kdev@gmail.com>
Link: https://lore.kernel.org/r/20211124193353.32311-3-kdasu.kdev@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent c74526f9
...@@ -598,12 +598,24 @@ static void bcm_qspi_chip_select(struct bcm_qspi *qspi, int cs) ...@@ -598,12 +598,24 @@ static void bcm_qspi_chip_select(struct bcm_qspi *qspi, int cs)
qspi->curr_cs = cs; qspi->curr_cs = cs;
} }
static bool bcmspi_parms_did_change(const struct bcm_qspi_parms * const cur,
const struct bcm_qspi_parms * const prev)
{
return (cur->speed_hz != prev->speed_hz) ||
(cur->mode != prev->mode) ||
(cur->bits_per_word != prev->bits_per_word);
}
/* MSPI helpers */ /* MSPI helpers */
static void bcm_qspi_hw_set_parms(struct bcm_qspi *qspi, static void bcm_qspi_hw_set_parms(struct bcm_qspi *qspi,
const struct bcm_qspi_parms *xp) const struct bcm_qspi_parms *xp)
{ {
u32 spcr, spbr = 0; u32 spcr, spbr = 0;
if (!bcmspi_parms_did_change(xp, &qspi->last_parms))
return;
if (!qspi->mspi_maj_rev) if (!qspi->mspi_maj_rev)
/* legacy controller */ /* legacy controller */
spcr = MSPI_MASTER_BIT; spcr = MSPI_MASTER_BIT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment