aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-fsl-espi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi-fsl-espi.c')
-rw-r--r--drivers/spi/spi-fsl-espi.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index 43350f999314..7523a2429d09 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -182,16 +182,18 @@ static int fsl_espi_setup_transfer(struct spi_device *spi,
182 cs->hw_mode |= CSMODE_DIV16; 182 cs->hw_mode |= CSMODE_DIV16;
183 pm = DIV_ROUND_UP(mpc8xxx_spi->spibrg, hz * 16 * 4); 183 pm = DIV_ROUND_UP(mpc8xxx_spi->spibrg, hz * 16 * 4);
184 184
185 WARN_ONCE(pm > 16, "%s: Requested speed is too low: %d Hz. " 185 WARN_ONCE(pm > 33, "%s: Requested speed is too low: %d Hz. "
186 "Will use %d Hz instead.\n", dev_name(&spi->dev), 186 "Will use %d Hz instead.\n", dev_name(&spi->dev),
187 hz, mpc8xxx_spi->spibrg / 1024); 187 hz, mpc8xxx_spi->spibrg / (4 * 16 * (32 + 1)));
188 if (pm > 16) 188 if (pm > 33)
189 pm = 16; 189 pm = 33;
190 } else { 190 } else {
191 pm = DIV_ROUND_UP(mpc8xxx_spi->spibrg, hz * 4); 191 pm = DIV_ROUND_UP(mpc8xxx_spi->spibrg, hz * 4);
192 } 192 }
193 if (pm) 193 if (pm)
194 pm--; 194 pm--;
195 if (pm < 2)
196 pm = 2;
195 197
196 cs->hw_mode |= CSMODE_PM(pm); 198 cs->hw_mode |= CSMODE_PM(pm);
197 199