ARM: dts: dra7xx: Update spi-max-frequency for qspi slave node
Subsystems (2)
PATCH v3 1/2 ARM: dts: dra7xx: Update spi-max-frequency for qspi slave node
Update the spi-max-frequency property of m25p80 flash slave to match that of TI QSPI controller node, so that QSPI operations happen at maximum supported frequency of 76.8MHz.
---
v3: No changes.
arch/arm/dts/dra7-evm.dts | 2 +- arch/arm/dts/dra72-evm-common.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/dts/dra7-evm.dts +1 -1
@@ -505,7 +505,7 @@ spi-max-frequency = <76800000>; m25p80 at 0 { compatible = "s25fl256s1","spi-flash"; - spi-max-frequency = <64000000>; + spi-max-frequency = <76800000>; reg = <0>; spi-tx-bus-width = <1>; spi-rx-bus-width = <4>;
arch/arm/dts/dra72-evm-common.dtsi +1 -1
@@ -441,7 +441,7 @@ spi-max-frequency = <76800000>; m25p80 at 0 { compatible = "s25fl256s1", "spi-flash"; - spi-max-frequency = <64000000>; + spi-max-frequency = <76800000>; reg = <0>; spi-tx-bus-width = <1>; spi-rx-bus-width = <4>;
Signature · 1 line
2.10.2
PATCH v3 2/2 spi: ti_qspi: Fix baudrate divider calculation
Fix the divider calculation logic to choose a value so that the resulting baudrate is either equal to or closest possible baudrate less than the requested value. While at that, cleanup ti_spi_set_speed().
---
v3: Move SCLK disable and enable blocks together.
v2: cleanup ti_spi_set_speed() a bit.
drivers/spi/ti_qspi.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/spi/ti_qspi.c +7 -9
@@ -16,6 +16,7 @@#include <asm/omap_gpio.h> #include <asm/omap_common.h> #include <asm/ti-common/ti-edma3.h> +#include <linux/kernel.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -118,21 +119,18 @@ static void ti_spi_set_speed(struct ti_qspi_priv *priv, uint hz)if (!hz) clk_div =0 ;else - clk_div = (priv->fclk / hz) -1 ; + clk_div =DIV_ROUND_UP (priv->fclk, hz) -1 ; + +/* truncate clk_div value to QSPI_CLK_DIV_MAX */ +if (clk_div >QSPI_CLK_DIV_MAX ) + clk_div =QSPI_CLK_DIV_MAX ;debug ("ti_spi_set_speed: hz: %d, clock divider %d\n" , hz, clk_div);/* disable SCLK */ writel (readl (&priv->base->clk_ctrl) & ~QSPI_CLK_EN , &priv->base->clk_ctrl); - -/* assign clk_div values */ -if (clk_div <0 ) - clk_div =0 ; -else if (clk_div >QSPI_CLK_DIV_MAX ) - clk_div =QSPI_CLK_DIV_MAX ; - -/* enable SCLK */ +/* enable SCLK and program the clk divider */ writel (QSPI_CLK_EN | clk_div, &priv->base->clk_ctrl); }
Signature · 1 line
2.10.2
PATCH v3 2/2 spi: ti_qspi: Fix baudrate divider calculation
Quoted 5 lines · Vignesh R
Fix the divider calculation logic to choose a value so that the resulting baudrate is either equal to or closest possible baudrate less than the requested value. While at that, cleanup
ti_spi_set_speed().Signed-off-by Vignesh R <[email protected]>
Applied to u-boot-spi/master
thanks!
Signature · 4 lines
Jagan Teki Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India.
PATCH v3 1/2 ARM: dts: dra7xx: Update spi-max-frequency for qspi slave node
In reply to Vignesh RQuoted 6 lines · Vignesh R
Update the spi-max-frequency property of m25p80 flash slave to match that of TI QSPI controller node, so that QSPI operations happen at maximum supported frequency of 76.8MHz.
Signed-off-by Vignesh R <[email protected]>Reviewed-by Jagan Teki <[email protected]>
Applied to u-boot-spi/master
thanks!
Signature · 4 lines
Jagan Teki Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India.