dslinux/linux-2.6.x/drivers/ide ide-iops.c

amadeus dslinux_amadeus at user.in-berlin.de
Thu Sep 7 22:20:05 CEST 2006


Update of /cvsroot/dslinux/dslinux/linux-2.6.x/drivers/ide
In directory antilope:/tmp/cvs-serv15828/linux-2.6.x/drivers/ide

Modified Files:
	ide-iops.c 
Log Message:
Fix supercard CF without CONFIG_ROM_8BIT

Index: ide-iops.c
===================================================================
RCS file: /cvsroot/dslinux/dslinux/linux-2.6.x/drivers/ide/ide-iops.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ide-iops.c	3 Sep 2006 20:22:27 -0000	1.9
+++ ide-iops.c	7 Sep 2006 20:20:02 -0000	1.10
@@ -30,6 +30,40 @@
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
+#if defined(CONFIG_IDE_NDS_SUPERCARD) && !defined(CONFIG_NDS_ROM8BIT)
+
+#define NDS_IME     (*(volatile u32*)0x04000208)
+
+#define unlock() supercard_unlock()
+#define lock() supercard_lock()
+
+void supercard_unlock( void )
+{
+       NDS_IME = 0;
+       *(volatile u16 *)0x09fffffe = 0xa55a ;
+       *(volatile u16 *)0x09fffffe = 0xa55a ;
+       *(volatile u16 *)0x09fffffe = 0x7 ;
+       *(volatile u16 *)0x09fffffe = 0x7 ;
+}
+
+void supercard_lock( void )
+{
+       *(volatile u16 *)0x09fffffe = 0xa55a ;
+       *(volatile u16 *)0x09fffffe = 0xa55a ;
+       *(volatile u16 *)0x09fffffe = 0x5 ;
+       *(volatile u16 *)0x09fffffe = 0x5 ;
+       NDS_IME = 1;
+}
+
+#else
+
+#define unlock()  /* nothing */
+#define lock()    /* nothing */
+
+#endif
+
+
+
 /*
  *	Conventional PIO operations for ATA devices
  */
@@ -37,67 +71,89 @@
 static u8 ide_inb (unsigned long port)
 {
 	u8 val ;
+	unlock() ;
 	val = (u8) inb(port);
+	lock() ;
 	return val ;
 }
 
 static u16 ide_inw (unsigned long port)
 {
 	u16 val ;
+	unlock() ;
 	val = (u16) inw(port);
+	lock() ;
 	return val ;
 }
 
 static void ide_insw (unsigned long port, void *addr, u32 count)
 {
+	unlock();
 	insw(port, addr, count);
+	lock();
 }
 
 static u32 ide_inl (unsigned long port)
 {
 	u32 val ;
+	unlock() ;
 	val = (u32) inl(port);
+	lock() ;
 	return val ;
 
 }
 
 static void ide_insl (unsigned long port, void *addr, u32 count)
 {
+	unlock();
 	insl(port, addr, count);
+	lock();
 }
 
 static void ide_outb (u8 val, unsigned long port)
 {
 	/* We call outw here because the GameBoyAdvance slot of the 
 	 * Nintendo DS cannot write 8bits. It can only write 16bits. */
+	unlock() ;
 	outw(val, port);
+	lock() ;
 }
 
 static void ide_outbsync (ide_drive_t *drive, u8 addr, unsigned long port)
 {
 	/* We call outw here because the GameBoyAdvance slot of the 
 	 * Nintendo DS cannot write 8bits. It can only write 16bits. */
+	unlock() ;
 	outw(addr, port);
+	lock() ;
 }
 
 static void ide_outw (u16 val, unsigned long port)
 {
+	unlock();
 	outw(val, port);
+	lock();
 }
 
 static void ide_outsw (unsigned long port, void *addr, u32 count)
 {
+	unlock();
 	outsw(port, addr, count);
+	lock();
 }
 
 static void ide_outl (u32 val, unsigned long port)
 {
+	unlock();
 	outl(val, port);
+	lock();
 }
 
 static void ide_outsl (unsigned long port, void *addr, u32 count)
 {
+	unlock();
 	outsl(port, addr, count);
+	lock();
 }
 
 void default_hwif_iops (ide_hwif_t *hwif)




More information about the dslinux-commit mailing list