]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spi: cadence_qspi: Ensure check for max frequency in place
authorChin Liang See <clsee@altera.com>
Sat, 17 Oct 2015 13:32:38 +0000 (08:32 -0500)
committerMarek Vasut <marex@denx.de>
Thu, 5 Nov 2015 01:34:15 +0000 (02:34 +0100)
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>
drivers/spi/cadence_qspi.c

index 575617876103f9d318c5c0212e673b73ab2f02d7..4f7fd5253220882c7074ac62bdcb5e4461a48b07 100644 (file)
@@ -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);