]> git.hungrycats.org Git - linux/commitdiff
[PATCH] H8/300 new ide driver support
authorYoshinori Sato <ysato@users.sourceforge.jp>
Fri, 21 May 2004 07:09:31 +0000 (00:09 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 21 May 2004 07:09:31 +0000 (00:09 -0700)
- new config items
- interface setup
- io cleanup

arch/h8300/Kconfig.ide
arch/h8300/kernel/setup.c
include/asm-h8300/io.h

index 3b9d58c169a8134ef303754140b6d91ce2e93ce0..a38a63054ac26058375691ba57aecab9e8d18612 100644 (file)
@@ -1,23 +1,44 @@
 # uClinux H8/300 Target Board Selection Menu (IDE)
 
+if (H8300H_AKI3068NET)
 menu "IDE Extra configuration"
 
 config H8300_IDE_BASE
-       hex "IDE regitser base address"
+       hex "IDE register base address"
        depends on IDE
+       default 0
        help
          IDE registers base address
 
 config H8300_IDE_ALT
-       hex "IDE regitser alternate address"
+       hex "IDE register alternate address"
        depends on IDE
+       default 0
        help
          IDE alternate registers address
 
 config H8300_IDE_IRQ
        int "IDE IRQ no"
        depends on IDE
+       default 0
        help
-         IDE I/F using IRQ no
-
+         IDE use IRQ no
 endmenu
+endif
+
+if (H8300H_H8MAX)
+config H8300_IDE_BASE
+       hex
+       depends on IDE
+       default 0x200000
+
+config H8300_IDE_ALT
+       hex
+       depends on IDE
+       default 0x60000c
+
+config H8300_IDE_IRQ
+       int
+       depends on IDE
+       default 5
+endif
index 7bab2e30d711e704add8b6fd0879d9ac534f7075..bf5822c5659ee04c565f0957dc6412d9cf112ff7 100644 (file)
 
 #if defined(__H8300H__)
 #define CPU "H8/300H"
+#include <asm/regs306x.h>
 #endif
 
 #if defined(__H8300S__)
 #define CPU "H8S"
-#endif
-
-#if defined(CONFIG_INTELFLASH)
-#define BLKOFFSET 512
-#else
-#define BLKOFFSET 0
+#include <asm/regs267x.h>
 #endif
 
 #define STUBSIZE 0xc000;
@@ -58,8 +54,6 @@ unsigned long rom_length;
 unsigned long memory_start;
 unsigned long memory_end;
 
-struct task_struct *_current_task;
-
 char command_line[512];
 char saved_command_line[512];
 
@@ -107,12 +101,11 @@ void __init setup_arch(char **cmdline_p)
        memory_start = (unsigned long) &_ramstart;
 
        /* allow for ROMFS on the end of the kernel */
-       if (memcmp((void *)(memory_start + BLKOFFSET), "-rom1fs-", 8) == 0) {
+       if (memcmp((void *)memory_start, "-rom1fs-", 8) == 0) {
 #if defined(CONFIG_BLK_DEV_INITRD)
-               initrd_start = memory_start += BLKOFFSET;
+               initrd_start = memory_start;
                initrd_end = memory_start += be32_to_cpu(((unsigned long *) (memory_start))[2]);
 #else
-               memory_start += BLKOFFSET;
                memory_start += be32_to_cpu(((unsigned long *) memory_start)[2]);
 #endif
        }
@@ -190,6 +183,16 @@ void __init setup_arch(char **cmdline_p)
         */
        paging_init();
        h8300_gpio_init();
+#if defined(CONFIG_H8300_AKI3068NET) && defined(CONFIG_IDE)
+       {
+#define AREABIT(addr) (1 << (((addr) >> 21) & 7))
+               /* setup BSC */
+               volatile unsigned char *abwcr = (volatile unsigned char *)ABWCR;
+               volatile unsigned char *cscr = (volatile unsigned char *)CSCR;
+               *abwcr &= ~(AREABIT(CONFIG_H8300_IDE_BASE) | AREABIT(CONFIG_H8300_IDE_ALT));
+               *cscr  |= (AREABIT(CONFIG_H8300_IDE_BASE) | AREABIT(CONFIG_H8300_IDE_ALT)) | 0x0f;
+       }
+#endif
 #ifdef DEBUG
        printk(KERN_DEBUG "Done setup_arch\n");
 #endif
index 380b20876a50a142e71908a030c57a961eabebb7..ceef5200c85a42988b3067af824be61197e74f82 100644 (file)
  * swap functions are sometimes needed to interface little-endian hardware
  */
 
-/*
- * CHANGES
- * 
- * 020325   Added some #define's for the COBRA5272 board
- *          (hede)
- */
-
 static inline unsigned short _swapw(volatile unsigned short v)
 {
-    return ((v << 8) | (v >> 8));
+       unsigned short r,t;
+       __asm__("mov.b %w2,%x1\n\t"
+               "mov.b %x2,%w1\n\t"
+               "mov.w %1,%0"
+               :"=r"(r),"=r"(t)
+               :"r"(v));
+       return r;
 }
 
 static inline unsigned int _swapl(volatile unsigned long v)
 {
-    return ((v << 24) | ((v & 0xff00) << 8) | ((v & 0xff0000) >> 8) | (v >> 24));
+       unsigned int r,t;
+       __asm__("mov.b %w2,%x1\n\t"
+               "mov.b %x2,%w1\n\t"
+               "mov.w %f1,%e0\n\t"
+               "mov.w %e2,%f1\n\t"
+               "mov.b %w1,%x0\n\t"
+               "mov.b %x1,%w0"
+               :"=r"(r),"=r"(t)
+               :"r"(v));
+       return r;
 }
 
 #define readb(addr) \
@@ -96,7 +104,7 @@ static inline void io_outsw(unsigned int addr, const void *buf, int len)
        volatile unsigned short *ap = (volatile unsigned short *) addr;
        unsigned short *bp = (unsigned short *) buf;
        while (len--)
-               *ap = *bp++;
+               *ap = _swapw(*bp++);
 }
 
 static inline void io_outsl(unsigned int addr, const void *buf, int len)
@@ -104,7 +112,7 @@ static inline void io_outsl(unsigned int addr, const void *buf, int len)
        volatile unsigned int *ap = (volatile unsigned int *) addr;
        unsigned long *bp = (unsigned long *) buf;
        while (len--)
-               *ap = *bp++;
+               *ap = _swapl(*bp++);
 }
 
 static inline void io_insb(unsigned int addr, void *buf, int len)
@@ -129,7 +137,7 @@ static inline void io_insw(unsigned int addr, void *buf, int len)
        volatile unsigned short *ap = (volatile unsigned short *) addr;
        unsigned short *bp = (unsigned short *) buf;
        while (len--)
-               *bp++ = *ap;
+               *bp++ = _swapw(*ap);
 }
 
 static inline void io_insl(unsigned int addr, void *buf, int len)
@@ -137,7 +145,7 @@ static inline void io_insl(unsigned int addr, void *buf, int len)
        volatile unsigned int *ap = (volatile unsigned int *) addr;
        unsigned long *bp = (unsigned long *) buf;
        while (len--)
-               *bp++ = *ap;
+               *bp++ = _swapl(*ap);
 }
 
 /*