CVSROOT: /home/cvs
Module name: linux
Changes by: ppopov@ftp.linux-mips.org 05/02/11 20:37:25
Modified files:
drivers/char : Tag: linux_2_4 au1550_psc_spi.c
Log message:
This patch fixes a basic problem with SPI transfers, and also allows
the driver to work on the Pb1200 platform.
diff -urN linux/drivers/char/au1550_psc_spi.c
linux/drivers/char/au1550_psc_spi.c
--- linux/drivers/char/Attic/au1550_psc_spi.c 2004/07/14 06:30:30 1.1.2.2
+++ linux/drivers/char/Attic/au1550_psc_spi.c 2005/02/11 20:37:24 1.1.2.3
@@ -45,6 +45,10 @@
#include <asm/db1x00.h>
#endif
+#ifdef CONFIG_MIPS_PB1200
+#include <asm/pb1200.h>
+#endif
+
/* This is just a simple programmed I/O SPI interface on the PSC of the 1550.
* We support open, close, write, and ioctl. The SPI is a full duplex
* interface, you can't read without writing. So, the write system call
@@ -73,6 +77,25 @@
static uint spi_datalen;
static int
+au1550spi_master_done( int ms )
+{
+ int timeout=ms;
+ volatile psc_spi_t *sp;
+
+ sp = (volatile psc_spi_t *)SPI_PSC_BASE;
+
+ /* Loop until MD is set or timeout has expired */
+ while(!(sp->psc_spievent & PSC_SPIEVNT_MD) && timeout--) udelay(1000);
+
+ if ( !timeout )
+ return 0;
+ else
+ sp->psc_spievent |= PSC_SPIEVNT_MD;
+
+ return 1;
+}
+
+static int
au1550spi_open(struct inode *inode, struct file *file)
{
if (inuse)
@@ -199,6 +222,9 @@
rcount -= bytelen;
}
}
+
+ /* Wait for MasterDone event. 30ms timeout */
+ if (!au1550spi_master_done(30) ) retval = -EFAULT;
return retval;
}
|