1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
From 32db8cc989d7dfdf0315d286b06234e008e56d7c Mon Sep 17 00:00:00 2001
From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Date: Sun, 15 May 2016 21:53:13 +0300
Subject: [PATCH] spi: sh-msiof: fixes
speed up polling of CTR register and allow scheduling instead of
busy loop
Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
---
drivers/spi/spi-sh-msiof.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index d096f5a..6817304 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -228,11 +228,11 @@ static int sh_msiof_modify_ctr_wait(struct sh_msiof_spi_priv *p,
data |= set;
sh_msiof_write(p, CTR, data);
- for (k = 100; k > 0; k--) {
+ for (k = 100000; k > 0; k--) {
if ((sh_msiof_read(p, CTR) & mask) == set)
break;
- udelay(10);
+ usleep_range(1, 2);
}
return k > 0 ? 0 : -ETIMEDOUT;
@@ -295,7 +295,7 @@ static void sh_msiof_spi_reset_regs(struct sh_msiof_spi_priv *p)
if (!(sh_msiof_read(p, CTR) & mask))
break;
- udelay(10);
+ usleep_range(10, 20);
}
}
--
1.9.1
|