blob: bea1a3b9b862dfd4b944072af3fbab22344bd66c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Generic Generic NCR5380 driver defines
3 *
4 * Copyright 1993, Drew Eckhardt
5 * Visionary Computing
6 * (Unix and Linux consulting and custom programming)
7 * drew@colorado.edu
8 * +1 (303) 440-4894
9 *
10 * NCR53C400 extensions (c) 1994,1995,1996, Kevin Lentin
11 * K.Lentin@cs.monash.edu.au
Linus Torvalds1da177e2005-04-16 15:20:36 -070012 */
13
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#ifndef GENERIC_NCR5380_H
15#define GENERIC_NCR5380_H
16
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#ifdef NCR53C400
18#define BIOSPARAM
19#define NCR5380_BIOSPARAM generic_NCR5380_biosparam
20#else
21#define NCR5380_BIOSPARAM NULL
22#endif
23
24#ifndef ASM
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
26#ifndef CMD_PER_LUN
27#define CMD_PER_LUN 2
28#endif
29
30#ifndef CAN_QUEUE
31#define CAN_QUEUE 16
32#endif
33
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#define __STRVAL(x) #x
35#define STRVAL(x) __STRVAL(x)
36
Ondrej Zary702a98c2010-08-10 18:01:16 -070037#ifndef SCSI_G_NCR5380_MEM
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
39#define NCR5380_map_config port
40#define NCR5380_map_type int
41#define NCR5380_map_name port
42#define NCR5380_instance_name io_port
43#define NCR53C400_register_offset 0
44#define NCR53C400_address_adjust 8
45
46#ifdef NCR53C400
47#define NCR5380_region_size 16
48#else
49#define NCR5380_region_size 8
50#endif
51
52#define NCR5380_read(reg) (inb(NCR5380_map_name + (reg)))
53#define NCR5380_write(reg, value) (outb((value), (NCR5380_map_name + (reg))))
54
Al Viroc818cb62006-03-24 03:15:37 -080055#define NCR5380_implementation_fields \
56 NCR5380_map_type NCR5380_map_name
57
58#define NCR5380_local_declare() \
59 register NCR5380_implementation_fields
60
61#define NCR5380_setup(instance) \
62 NCR5380_map_name = (NCR5380_map_type)((instance)->NCR5380_instance_name)
63
Linus Torvalds1da177e2005-04-16 15:20:36 -070064#else
Ondrej Zary702a98c2010-08-10 18:01:16 -070065/* therefore SCSI_G_NCR5380_MEM */
Linus Torvalds1da177e2005-04-16 15:20:36 -070066
67#define NCR5380_map_config memory
68#define NCR5380_map_type unsigned long
69#define NCR5380_map_name base
70#define NCR5380_instance_name base
71#define NCR53C400_register_offset 0x108
72#define NCR53C400_address_adjust 0
73#define NCR53C400_mem_base 0x3880
74#define NCR53C400_host_buffer 0x3900
75#define NCR5380_region_size 0x3a00
76
Al Viroc818cb62006-03-24 03:15:37 -080077#define NCR5380_read(reg) readb(iomem + NCR53C400_mem_base + (reg))
78#define NCR5380_write(reg, value) writeb(value, iomem + NCR53C400_mem_base + (reg))
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
80#define NCR5380_implementation_fields \
Al Viroc818cb62006-03-24 03:15:37 -080081 NCR5380_map_type NCR5380_map_name; \
82 void __iomem *iomem;
Linus Torvalds1da177e2005-04-16 15:20:36 -070083
84#define NCR5380_local_declare() \
Al Viroc818cb62006-03-24 03:15:37 -080085 register void __iomem *iomem
Linus Torvalds1da177e2005-04-16 15:20:36 -070086
87#define NCR5380_setup(instance) \
Ondrej Zary702a98c2010-08-10 18:01:16 -070088 iomem = (((struct NCR5380_hostdata *)(instance)->hostdata)->iomem)
Al Viroc818cb62006-03-24 03:15:37 -080089
90#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070091
92#define NCR5380_intr generic_NCR5380_intr
93#define NCR5380_queue_command generic_NCR5380_queue_command
94#define NCR5380_abort generic_NCR5380_abort
95#define NCR5380_bus_reset generic_NCR5380_bus_reset
Linus Torvalds1da177e2005-04-16 15:20:36 -070096#define NCR5380_pread generic_NCR5380_pread
97#define NCR5380_pwrite generic_NCR5380_pwrite
Finn Thain8c325132014-11-12 16:11:58 +110098#define NCR5380_info generic_NCR5380_info
99#define NCR5380_show_info generic_NCR5380_show_info
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100
101#define BOARD_NCR5380 0
102#define BOARD_NCR53C400 1
103#define BOARD_NCR53C400A 2
104#define BOARD_DTC3181E 3
105
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106#endif /* ndef ASM */
107#endif /* GENERIC_NCR5380_H */
108