linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] spi: sh-hspi: Improve performance
@ 2012-11-22 14:37 Phil Edworthy
       [not found] ` <1353595047-14558-1-git-send-email-phil.edworthy-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Phil Edworthy @ 2012-11-22 14:37 UTC (permalink / raw)
  To: Grant Likely, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: Phil Edworthy, Kuninori Morimoto

The driver attempts to read the recieved data immediately after
writing to the transmit buffer. If no data is available, the driver
currently waits 20ms until trying again. Since the hardware needs
to shift out the transmitted data, the first poll always fails,
leading to 20ms delay between bytes.

This patch reduces the polling interval to 1us, and also reduces
the timeout to 10ms.

Signed-off-by: Phil Edworthy <phil.edworthy-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
 drivers/spi/spi-sh-hspi.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c
index 934138c..0ca18c8 100644
--- a/drivers/spi/spi-sh-hspi.c
+++ b/drivers/spi/spi-sh-hspi.c
@@ -73,13 +73,13 @@ static u32 hspi_read(struct hspi_priv *hspi, int reg)
  */
 static int hspi_status_check_timeout(struct hspi_priv *hspi, u32 mask, u32 val)
 {
-	int t = 256;
+	int t = 10000; /* 10ms max timeout */
 
 	while (t--) {
 		if ((mask & hspi_read(hspi, SPSR)) == val)
 			return 0;
 
-		msleep(20);
+		udelay(1);
 	}
 
 	dev_err(hspi->dev, "timeout\n");
-- 
1.7.5.4


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-12-10  9:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-22 14:37 [PATCH 1/2] spi: sh-hspi: Improve performance Phil Edworthy
     [not found] ` <1353595047-14558-1-git-send-email-phil.edworthy-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2012-11-22 14:37   ` [PATCH 2/2] spi: sh-hspi: add CS manual control support Phil Edworthy
     [not found]     ` <1353595047-14558-2-git-send-email-phil.edworthy-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2012-11-23  9:53       ` Grant Likely
2012-11-23  9:51   ` [PATCH 1/2] spi: sh-hspi: Improve performance Grant Likely
2012-11-23 10:02     ` phil.edworthy-zM6kxYcvzFBBDgjK7y7TUQ
2012-11-23 14:46     ` [PATCH v2] " Phil Edworthy
     [not found]       ` <1353681984-15850-1-git-send-email-phil.edworthy-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2012-12-06 14:34         ` Grant Likely
2012-12-10  9:35           ` phil.edworthy-zM6kxYcvzFBBDgjK7y7TUQ

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).