summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-07-12 17:39:41 +0800
committerSonic Zhang <sonic.zhang@analog.com>2013-07-31 16:56:04 +0800
commit327b5c9f7cde4e621c2f49fbd2e9890d32f2bef8 (patch)
tree1e0d982652459387892e546cef0db6508d31f8c9 /drivers/spi
parent53086befe88cc345ecb802b8dee79337f3ece2c7 (diff)
downloadu-boot-imx-327b5c9f7cde4e621c2f49fbd2e9890d32f2bef8.zip
u-boot-imx-327b5c9f7cde4e621c2f49fbd2e9890d32f2bef8.tar.gz
u-boot-imx-327b5c9f7cde4e621c2f49fbd2e9890d32f2bef8.tar.bz2
spi: bfin_spi: Use DIV_ROUND_UP instead of open-coded
Use DIV_ROUND_UP to simplify the code. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/bfin_spi.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/spi/bfin_spi.c b/drivers/spi/bfin_spi.c
index a9a4d92..f7192c2 100644
--- a/drivers/spi/bfin_spi.c
+++ b/drivers/spi/bfin_spi.c
@@ -144,10 +144,8 @@ void spi_set_speed(struct spi_slave *slave, uint hz)
u32 baud;
sclk = get_sclk();
- baud = sclk / (2 * hz);
/* baud should be rounded up */
- if (sclk % (2 * hz))
- baud += 1;
+ baud = DIV_ROUND_UP(sclk, 2 * hz);
if (baud < 2)
baud = 2;
else if (baud > (u16)-1)