mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 21:21:37 +00:00
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>
This commit is contained in:
parent
53086befe8
commit
327b5c9f7c
1 changed files with 1 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue