Commit e8f064c2 authored by Linus Torvalds's avatar Linus Torvalds

Update the 32-bit Ninja SCSI driver from YOKOTA Hiroshi.

parent ad6ab150
...@@ -1348,7 +1348,7 @@ M: Andreas Mohr <100.30936@germany.net> ...@@ -1348,7 +1348,7 @@ M: Andreas Mohr <100.30936@germany.net>
L: linux-net@vger.kernel.org L: linux-net@vger.kernel.org
S: Maintained S: Maintained
NINJA SCSI-3 / NINJA SCSI-32Bi PCMCIA SCSI HOST ADAPTER DRIVER NINJA SCSI-3 / NINJA SCSI-32Bi (16bit/CardBus) PCMCIA SCSI HOST ADAPTER DRIVER
P: YOKOTA Hiroshi P: YOKOTA Hiroshi
M: yokota@netlab.is.tsukuba.ac.jp M: yokota@netlab.is.tsukuba.ac.jp
W: http://www.netlab.is.tsukuba.ac.jp/~yokota/izumi/ninja/ W: http://www.netlab.is.tsukuba.ac.jp/~yokota/izumi/ninja/
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
/* /*
* Workbit NinjaSCSI-32Bi/UDE PCI/Cardbus SCSI Host Bus Adapter driver * Workbit NinjaSCSI-32Bi/UDE PCI/CardBus SCSI Host Bus Adapter driver
* Debug routine * Debug routine
* *
* This software may be used and distributed according to the terms of * This software may be used and distributed according to the terms of
...@@ -88,7 +88,7 @@ static void print_commandk (unsigned char *command) ...@@ -88,7 +88,7 @@ static void print_commandk (unsigned char *command)
int i,s; int i,s;
// printk(KERN_DEBUG); // printk(KERN_DEBUG);
print_opcodek(command[0]); print_opcodek(command[0]);
/*printk(KERN_DEBUG __func__ " ");*/ /*printk(KERN_DEBUG "%s ", __FUNCTION__);*/
if ((command[0] >> 5) == 6 || if ((command[0] >> 5) == 6 ||
(command[0] >> 5) == 7 ) { (command[0] >> 5) == 7 ) {
s = 12; /* vender specific */ s = 12; /* vender specific */
...@@ -137,9 +137,9 @@ static void print_commandk (unsigned char *command) ...@@ -137,9 +137,9 @@ static void print_commandk (unsigned char *command)
printk("\n"); printk("\n");
} }
static void show_command(Scsi_Cmnd *ptr) static void show_command(Scsi_Cmnd *SCpnt)
{ {
print_commandk(ptr->cmnd); print_commandk(SCpnt->cmnd);
} }
static void show_busphase(unsigned char stat) static void show_busphase(unsigned char stat)
...@@ -260,3 +260,4 @@ static void nsp32_print_register(int base) ...@@ -260,3 +260,4 @@ static void nsp32_print_register(int base)
} }
} }
/* end */
/* /*
* Workbit NinjaSCSI-32Bi/UDE PCI/Cardbus SCSI Host Bus Adapter driver * Workbit NinjaSCSI-32Bi/UDE PCI/CardBus SCSI Host Bus Adapter driver
* I/O routine * I/O routine
* *
* This software may be used and distributed according to the terms of * This software may be used and distributed according to the terms of
...@@ -26,26 +26,26 @@ static inline void nsp32_write2(unsigned int base, ...@@ -26,26 +26,26 @@ static inline void nsp32_write2(unsigned int base,
unsigned int index, unsigned int index,
unsigned short val) unsigned short val)
{ {
outw(cpu_to_le16(val), (base + index)); outw(val, (base + index));
} }
static inline unsigned short nsp32_read2(unsigned int base, static inline unsigned short nsp32_read2(unsigned int base,
unsigned int index) unsigned int index)
{ {
return le16_to_cpu(inw(base + index)); return inw(base + index);
} }
static inline void nsp32_write4(unsigned int base, static inline void nsp32_write4(unsigned int base,
unsigned int index, unsigned int index,
unsigned long val) unsigned long val)
{ {
outl(cpu_to_le32(val), (base + index)); outl(val, (base + index));
} }
static inline unsigned long nsp32_read4(unsigned int base, static inline unsigned long nsp32_read4(unsigned int base,
unsigned int index) unsigned int index)
{ {
return le32_to_cpu(inl(base + index)); return inl(base + index);
} }
/*==============================================*/ /*==============================================*/
...@@ -58,7 +58,7 @@ static inline void nsp32_mmio_write1(unsigned long base, ...@@ -58,7 +58,7 @@ static inline void nsp32_mmio_write1(unsigned long base,
ptr = (unsigned char *)(base + NSP32_MMIO_OFFSET + index); ptr = (unsigned char *)(base + NSP32_MMIO_OFFSET + index);
*ptr = val; writeb(val, ptr);
} }
static inline unsigned char nsp32_mmio_read1(unsigned long base, static inline unsigned char nsp32_mmio_read1(unsigned long base,
...@@ -68,7 +68,7 @@ static inline unsigned char nsp32_mmio_read1(unsigned long base, ...@@ -68,7 +68,7 @@ static inline unsigned char nsp32_mmio_read1(unsigned long base,
ptr = (unsigned char *)(base + NSP32_MMIO_OFFSET + index); ptr = (unsigned char *)(base + NSP32_MMIO_OFFSET + index);
return *ptr; return readb(ptr);
} }
static inline void nsp32_mmio_write2(unsigned long base, static inline void nsp32_mmio_write2(unsigned long base,
...@@ -79,7 +79,7 @@ static inline void nsp32_mmio_write2(unsigned long base, ...@@ -79,7 +79,7 @@ static inline void nsp32_mmio_write2(unsigned long base,
ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + index); ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + index);
*ptr = cpu_to_le16(val); writew(cpu_to_le16(val), ptr);
} }
static inline unsigned short nsp32_mmio_read2(unsigned long base, static inline unsigned short nsp32_mmio_read2(unsigned long base,
...@@ -87,11 +87,9 @@ static inline unsigned short nsp32_mmio_read2(unsigned long base, ...@@ -87,11 +87,9 @@ static inline unsigned short nsp32_mmio_read2(unsigned long base,
{ {
volatile unsigned short *ptr; volatile unsigned short *ptr;
//printk(__FUNCTION__ "\n");
ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + index); ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + index);
return le16_to_cpu(*ptr); return le16_to_cpu(readw(ptr));
} }
static inline void nsp32_mmio_write4(unsigned long base, static inline void nsp32_mmio_write4(unsigned long base,
...@@ -102,7 +100,7 @@ static inline void nsp32_mmio_write4(unsigned long base, ...@@ -102,7 +100,7 @@ static inline void nsp32_mmio_write4(unsigned long base,
ptr = (unsigned long *)(base + NSP32_MMIO_OFFSET + index); ptr = (unsigned long *)(base + NSP32_MMIO_OFFSET + index);
*ptr = cpu_to_le32(val); writel(cpu_to_le32(val), ptr);
} }
static inline unsigned long nsp32_mmio_read4(unsigned long base, static inline unsigned long nsp32_mmio_read4(unsigned long base,
...@@ -110,16 +108,12 @@ static inline unsigned long nsp32_mmio_read4(unsigned long base, ...@@ -110,16 +108,12 @@ static inline unsigned long nsp32_mmio_read4(unsigned long base,
{ {
volatile unsigned long *ptr; volatile unsigned long *ptr;
//printk(__FUNCTION__ "\n");
ptr = (unsigned long *)(base + NSP32_MMIO_OFFSET + index); ptr = (unsigned long *)(base + NSP32_MMIO_OFFSET + index);
return le32_to_cpu(*ptr); return le32_to_cpu(readl(ptr));
} }
/*==============================================*/
/*=============================================*/
static inline unsigned char nsp32_index_read1(unsigned int base, static inline unsigned char nsp32_index_read1(unsigned int base,
unsigned int reg) unsigned int reg)
...@@ -132,7 +126,7 @@ static inline void nsp32_index_write1(unsigned int base, ...@@ -132,7 +126,7 @@ static inline void nsp32_index_write1(unsigned int base,
unsigned int reg, unsigned int reg,
unsigned char val) unsigned char val)
{ {
outb(reg, base + INDEX_REG); outb(reg, base + INDEX_REG );
outb(val, base + DATA_REG_LOW); outb(val, base + DATA_REG_LOW);
} }
...@@ -140,15 +134,15 @@ static inline unsigned short nsp32_index_read2(unsigned int base, ...@@ -140,15 +134,15 @@ static inline unsigned short nsp32_index_read2(unsigned int base,
unsigned int reg) unsigned int reg)
{ {
outb(reg, base + INDEX_REG); outb(reg, base + INDEX_REG);
return le16_to_cpu(inw(base + DATA_REG_LOW)); return inw(base + DATA_REG_LOW);
} }
static inline void nsp32_index_write2(unsigned int base, static inline void nsp32_index_write2(unsigned int base,
unsigned int reg, unsigned int reg,
unsigned short val) unsigned short val)
{ {
outb(reg, base + INDEX_REG); outb(reg, base + INDEX_REG );
outw(cpu_to_le16(val), base + DATA_REG_LOW); outw(val, base + DATA_REG_LOW);
} }
static inline unsigned long nsp32_index_read4(unsigned int base, static inline unsigned long nsp32_index_read4(unsigned int base,
...@@ -157,8 +151,8 @@ static inline unsigned long nsp32_index_read4(unsigned int base, ...@@ -157,8 +151,8 @@ static inline unsigned long nsp32_index_read4(unsigned int base,
unsigned long h,l; unsigned long h,l;
outb(reg, base + INDEX_REG); outb(reg, base + INDEX_REG);
l = le16_to_cpu(inw(base + DATA_REG_LOW)); l = inw(base + DATA_REG_LOW);
h = le16_to_cpu(inw(base + DATA_REG_HI )); h = inw(base + DATA_REG_HI );
return ((h << 16) | l); return ((h << 16) | l);
} }
...@@ -172,13 +166,12 @@ static inline void nsp32_index_write4(unsigned int base, ...@@ -172,13 +166,12 @@ static inline void nsp32_index_write4(unsigned int base,
h = (val & 0xffff0000) >> 16; h = (val & 0xffff0000) >> 16;
l = (val & 0x0000ffff) >> 0; l = (val & 0x0000ffff) >> 0;
outb(reg, base + INDEX_REG); outb(reg, base + INDEX_REG );
outw(cpu_to_le16(l), base + DATA_REG_LOW); outw(l, base + DATA_REG_LOW);
outw(cpu_to_le16(h), base + DATA_REG_HI); outw(h, base + DATA_REG_HI );
} }
/*==============================================*/
/* ===================================*/
static inline unsigned char nsp32_mmio_index_read1(unsigned int base, static inline unsigned char nsp32_mmio_index_read1(unsigned int base,
unsigned int reg) unsigned int reg)
...@@ -188,9 +181,8 @@ static inline unsigned char nsp32_mmio_index_read1(unsigned int base, ...@@ -188,9 +181,8 @@ static inline unsigned char nsp32_mmio_index_read1(unsigned int base,
index_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + INDEX_REG); index_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + INDEX_REG);
data_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + DATA_REG_LOW); data_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + DATA_REG_LOW);
*index_ptr = reg; writeb(reg, index_ptr);
return readb(data_ptr);
return ((*data_ptr) & 0xff);
} }
static inline void nsp32_mmio_index_write1(unsigned int base, static inline void nsp32_mmio_index_write1(unsigned int base,
...@@ -202,8 +194,8 @@ static inline void nsp32_mmio_index_write1(unsigned int base, ...@@ -202,8 +194,8 @@ static inline void nsp32_mmio_index_write1(unsigned int base,
index_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + INDEX_REG); index_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + INDEX_REG);
data_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + DATA_REG_LOW); data_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + DATA_REG_LOW);
*index_ptr = reg; writeb(reg, index_ptr);
*data_ptr = (unsigned short)val; writeb(val, data_ptr );
} }
static inline unsigned short nsp32_mmio_index_read2(unsigned int base, static inline unsigned short nsp32_mmio_index_read2(unsigned int base,
...@@ -214,9 +206,8 @@ static inline unsigned short nsp32_mmio_index_read2(unsigned int base, ...@@ -214,9 +206,8 @@ static inline unsigned short nsp32_mmio_index_read2(unsigned int base,
index_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + INDEX_REG); index_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + INDEX_REG);
data_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + DATA_REG_LOW); data_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + DATA_REG_LOW);
*index_ptr = reg; writeb(reg, index_ptr);
return le16_to_cpu(readw(data_ptr));
return le16_to_cpu(*data_ptr);
} }
static inline void nsp32_mmio_index_write2(unsigned int base, static inline void nsp32_mmio_index_write2(unsigned int base,
...@@ -228,34 +219,33 @@ static inline void nsp32_mmio_index_write2(unsigned int base, ...@@ -228,34 +219,33 @@ static inline void nsp32_mmio_index_write2(unsigned int base,
index_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + INDEX_REG); index_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + INDEX_REG);
data_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + DATA_REG_LOW); data_ptr = (unsigned short *)(base + NSP32_MMIO_OFFSET + DATA_REG_LOW);
*index_ptr = reg; writeb(reg, index_ptr);
*data_ptr = val; writew(cpu_to_le16(val), data_ptr );
} }
/*-------------------------------------------------------------------*/ /*==============================================*/
static inline void nsp32_multi_read4(unsigned int BaseAddr, static inline void nsp32_multi_read4(unsigned int base,
unsigned int Register, unsigned int reg,
void *buf, void *buf,
unsigned long count) unsigned long count)
{ {
insl(BaseAddr + Register, buf, count); insl(base + reg, buf, count);
} }
static inline void nsp32_fifo_read(unsigned int base, static inline void nsp32_fifo_read(unsigned int base,
void *buf, void *buf,
unsigned long count) unsigned long count)
{ {
//DEBUG(0, __FUNCTION__ "() buf=0x%p, count=0x%lx*4\n", buf, count);
nsp32_multi_read4(base, FIFO_DATA_LOW, buf, count); nsp32_multi_read4(base, FIFO_DATA_LOW, buf, count);
} }
static inline void nsp32_multi_write4(unsigned int BaseAddr, static inline void nsp32_multi_write4(unsigned int base,
unsigned int Register, unsigned int reg,
void *buf, void *buf,
unsigned long count) unsigned long count)
{ {
outsl(BaseAddr + Register, buf, count); outsl(base + reg, buf, count);
} }
static inline void nsp32_fifo_write(unsigned int base, static inline void nsp32_fifo_write(unsigned int base,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment