summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorChin Liang See <clsee@altera.com>2015-10-17 08:32:38 -0500
committerMarek Vasut <marex@denx.de>2015-11-05 02:34:15 +0100
commit4e609b6cb1e6e8cb14c55fd50c73c5affcba26b5 (patch)
treeffd2305483ba308f194d2fa2fcb02b9ee14b6a7d /drivers/spi
parent040f4ba742700529d950a92da5ddbe99d9ae335e (diff)
downloadu-boot-4e609b6cb1e6e8cb14c55fd50c73c5affcba26b5.tar.gz
u-boot-4e609b6cb1e6e8cb14c55fd50c73c5affcba26b5.tar.bz2
u-boot-4e609b6cb1e6e8cb14c55fd50c73c5affcba26b5.zip
spi: cadence_qspi: Ensure check for max frequency in place
Ensure the intended SCLK frequency not exceeding the maximum frequency. If that happen, SCLK will set to maximum frequency. Signed-off-by: Chin Liang See <clsee@altera.com> Cc: Dinh Nguyen <dinguyen@opensource.altera.com> Cc: Dinh Nguyen <dinh.linux@gmail.com> Cc: Marek Vasut <marex@denx.de> Cc: Stefan Roese <sr@denx.de> Cc: Vikas Manocha <vikas.manocha@st.com> Cc: Jagannadh Teki <jteki@openedev.com> Cc: Pavel Machek <pavel@denx.de> Acked-by: Pavel Machek <pavel@denx.de>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/cadence_qspi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index 5756178761..4f7fd52532 100644
--- a/drivers/spi/cadence_qspi.c
+++ b/drivers/spi/cadence_qspi.c
@@ -122,6 +122,9 @@ static int cadence_spi_set_speed(struct udevice *bus, uint hz)
struct cadence_spi_priv *priv = dev_get_priv(bus);
int err;
+ if (hz > plat->max_hz)
+ hz = plat->max_hz;
+
/* Disable QSPI */
cadence_qspi_apb_controller_disable(priv->regbase);