summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/amiga7xx.c
blob: 25d3b193a07e9be9c162e54d4fdd6f3a98e8bde8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*
 * Detection routine for the NCR53c710 based Amiga SCSI Controllers for Linux.
 *  		Amiga MacroSystemUS WarpEngine SCSI controller.
 *		Amiga Technologies A4000T SCSI controller.
 *		Amiga Technologies/DKB A4091 SCSI controller.
 *
 * Written 1997 by Alan Hourihane <alanh@fairlite.demon.co.uk>
 * plus modifications of the 53c7xx.c driver to support the Amiga.
 */
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/blk.h>
#include <linux/sched.h>
#include <linux/version.h>
#include <linux/config.h>
#include <linux/zorro.h>

#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/amigaints.h>
#include <asm/amigahw.h>
#include <asm/irq.h>

#include "scsi.h"
#include "hosts.h"
#include "53c7xx.h"
#include "amiga7xx.h"

#include<linux/stat.h>

struct proc_dir_entry proc_scsi_amiga7xx = {
    PROC_SCSI_AMIGA7XX, 8, "Amiga7xx",
    S_IFDIR | S_IRUGO | S_IXUGO, 2
};

extern ncr53c7xx_init (Scsi_Host_Template *tpnt, int board, int chip, 
		       u32 base, int io_port, int irq, int dma,
		       long long options, int clock);

int amiga7xx_detect(Scsi_Host_Template *tpnt)
{
    static unsigned char called = 0;
    unsigned int key;
    int num = 0, clock;
    long long options;
    const struct ConfigDev *cd;

    if (called || !MACH_IS_AMIGA)
	return 0;

    tpnt->proc_dir = &proc_scsi_amiga7xx;

#ifdef CONFIG_BLZ603EPLUS_SCSI
    if ((key = zorro_find(ZORRO_PROD_PHASE5_BLIZZARD_603E_PLUS, 0, 0)))
    {
	cd = zorro_get_board(key);
/*
	unsigned long address;
	address = (unsigned long)kernel_map((unsigned long)cd->cd_BoardAddr,
		cd->cd_BoardSize, KERNELMAP_NOCACHE_SER, NULL);
*/
	options = OPTION_MEMORY_MAPPED|OPTION_DEBUG_TEST1|OPTION_INTFLY|OPTION_SYNCHRONOUS|OPTION_ALWAYS_SYNCHRONOUS|OPTION_DISCONNECT;

	clock = 50000000;	/* 50MHz SCSI Clock */

	ncr53c7xx_init(tpnt, 0, 710, (u32)(unsigned char *)(0x80f40000),
			0, IRQ_AMIGA_PORTS, DMA_NONE, 
			options, clock);

	zorro_config_board(key, 0);
	num++;
    }
#endif

#ifdef CONFIG_WARPENGINE_SCSI
    if ((key = zorro_find(ZORRO_PROD_MACROSYSTEMS_WARP_ENGINE_40xx, 0, 0)))
    {
	unsigned long address;
	cd = zorro_get_board(key);
	address = (unsigned long)kernel_map((unsigned long)cd->cd_BoardAddr,
		cd->cd_BoardSize, KERNELMAP_NOCACHE_SER, NULL);

	options = OPTION_MEMORY_MAPPED|OPTION_DEBUG_TEST1|OPTION_INTFLY|OPTION_SYNCHRONOUS|OPTION_ALWAYS_SYNCHRONOUS|OPTION_DISCONNECT;

	clock = 50000000;	/* 50MHz SCSI Clock */

	ncr53c7xx_init(tpnt, 0, 710, (u32)(unsigned char *)(address + 0x40000),
			0, IRQ_AMIGA_PORTS, DMA_NONE, 
			options, clock);

	zorro_config_board(key, 0);
	num++;
    }
#endif

#ifdef CONFIG_A4000T_SCSI
    if (AMIGAHW_PRESENT(A4000_SCSI))
    { 
    	options = OPTION_MEMORY_MAPPED|OPTION_DEBUG_TEST1|OPTION_INTFLY|OPTION_SYNCHRONOUS|OPTION_ALWAYS_SYNCHRONOUS|OPTION_DISCONNECT;

	clock = 50000000;	/* 50MHz SCSI Clock */

    	ncr53c7xx_init(tpnt, 0, 710, (u32)(unsigned char *)ZTWO_VADDR(0xDD0040),
			0, IRQ_AMIGA_PORTS, DMA_NONE,
			options, clock);
    	num++;
    }
#endif

#ifdef CONFIG_A4091_SCSI
    while ( (key = zorro_find(ZORRO_PROD_CBM_A4091_1, 0, 0)) ||
	    (key = zorro_find(ZORRO_PROD_CBM_A4091_2, 0, 0)) )
    {
	unsigned long address;
	cd = zorro_get_board(key);
	address = (unsigned long)kernel_map((unsigned long)cd->cd_BoardAddr,
		cd->cd_BoardSize, KERNELMAP_NOCACHE_SER, NULL);

    	options = OPTION_MEMORY_MAPPED|OPTION_DEBUG_TEST1|OPTION_INTFLY|OPTION_SYNCHRONOUS|OPTION_ALWAYS_SYNCHRONOUS|OPTION_DISCONNECT;

	clock = 50000000;	/* 50MHz SCSI Clock */

    	ncr53c7xx_init(tpnt, 0, 710, (u32)(unsigned char *)(address+0x800000),
			0, IRQ_AMIGA_PORTS, DMA_NONE, options, clock);

	zorro_config_board(key, 0);
	num++;
    }
#endif

#ifdef CONFIG_GVP_TURBO_SCSI
    if((key = zorro_find(ZORRO_PROD_GVP_GFORCE_040_060, 0, 0)))
    {
	    cd = zorro_get_board(key);
	    address = ZTWO_VADDR((unsigned long)cd->cd_BoardAddr);

	    options = OPTION_MEMORY_MAPPED | OPTION_DEBUG_TEST1 |
		      OPTION_INTFLY | OPTION_SYNCHRONOUS |
		      OPTION_ALWAYS_SYNCHRONOUS | OPTION_DISCONNECT;

	    clock = 50000000;	/* 50MHz SCSI Clock */

	    ncr53c7xx_init(tpnt, 0, 710,
			   (u32)(unsigned char *)(address + 0x40000),
			   0, IRQ_AMIGA_PORTS, DMA_NONE, options, clock);

	    zorro_config_board(key, 0);
	    num++;
    }
#endif

    called = 1;
    return num;
}