summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorSonic Zhang <sonic.zhang@analog.com>2014-01-28 13:53:34 +0800
committerHeiko Schocher <hs@denx.de>2014-02-20 06:46:56 +0100
commitd6a320d5bb3050eeb9a586481145d3a75ef24db8 (patch)
tree89c94515625e3e071bf2be44fb32db285cd289a6 /drivers/spi
parentbb0fad0ea095944c76dc94fcd13b91699413f79f (diff)
downloadu-boot-imx-d6a320d5bb3050eeb9a586481145d3a75ef24db8.zip
u-boot-imx-d6a320d5bb3050eeb9a586481145d3a75ef24db8.tar.gz
u-boot-imx-d6a320d5bb3050eeb9a586481145d3a75ef24db8.tar.bz2
blackfin: add spi and i2c specific get clock functions
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/bfin_spi.c7
-rw-r--r--drivers/spi/bfin_spi6xx.c7
2 files changed, 8 insertions, 6 deletions
diff --git a/drivers/spi/bfin_spi.c b/drivers/spi/bfin_spi.c
index aa89d89..71a31d0 100644
--- a/drivers/spi/bfin_spi.c
+++ b/drivers/spi/bfin_spi.c
@@ -13,6 +13,7 @@
#include <spi.h>
#include <asm/blackfin.h>
+#include <asm/clock.h>
#include <asm/gpio.h>
#include <asm/portmux.h>
#include <asm/mach-common/bits/spi.h>
@@ -140,12 +141,12 @@ static const unsigned short cs_pins[][7] = {
void spi_set_speed(struct spi_slave *slave, uint hz)
{
struct bfin_spi_slave *bss = to_bfin_spi_slave(slave);
- ulong sclk;
+ ulong clk;
u32 baud;
- sclk = get_sclk();
+ clk = get_spi_clk();
/* baud should be rounded up */
- baud = DIV_ROUND_UP(sclk, 2 * hz);
+ baud = DIV_ROUND_UP(clk, 2 * hz);
if (baud < 2)
baud = 2;
else if (baud > (u16)-1)
diff --git a/drivers/spi/bfin_spi6xx.c b/drivers/spi/bfin_spi6xx.c
index 07b833d..eba01d1 100644
--- a/drivers/spi/bfin_spi6xx.c
+++ b/drivers/spi/bfin_spi6xx.c
@@ -22,6 +22,7 @@
#include <spi.h>
#include <asm/blackfin.h>
+#include <asm/clock.h>
#include <asm/gpio.h>
#include <asm/portmux.h>
#include <asm/mach-common/bits/spi6xx.h>
@@ -135,11 +136,11 @@ static const unsigned short cs_pins[][7] = {
void spi_set_speed(struct spi_slave *slave, uint hz)
{
struct bfin_spi_slave *bss = to_bfin_spi_slave(slave);
- ulong sclk;
+ ulong clk;
u32 clock;
- sclk = get_sclk1();
- clock = sclk / hz;
+ clk = get_spi_clk();
+ clock = clk / hz;
if (clock)
clock--;
bss->clock = clock;