blob: 595177428d7628f492f37b04413d449884b83f7c [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#define __STRVAL(x) #x
18#define STRVAL(x) __STRVAL(x)
19
Ondrej Zary702a98c2010-08-10 18:01:16 -070020#ifndef SCSI_G_NCR5380_MEM
Finn Thainaa2e2cb2016-01-03 16:05:48 +110021#define DRV_MODULE_NAME "g_NCR5380"
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#define NCR5380_map_type int
24#define NCR5380_map_name port
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
Finn Thain54d8fe42016-01-03 16:05:06 +110026#define NCR5380_read(reg) \
27 inb(instance->io_port + (reg))
28#define NCR5380_write(reg, value) \
29 outb(value, instance->io_port + (reg))
Linus Torvalds1da177e2005-04-16 15:20:36 -070030
Ondrej Zary12150792016-01-03 16:06:15 +110031#define NCR5380_implementation_fields \
32 int c400_ctl_status; \
33 int c400_blk_cnt; \
Ondrej Zaryaeb51152016-01-03 16:06:17 +110034 int c400_host_buf; \
35 int io_width;
Al Viroc818cb62006-03-24 03:15:37 -080036
Linus Torvalds1da177e2005-04-16 15:20:36 -070037#else
Ondrej Zary702a98c2010-08-10 18:01:16 -070038/* therefore SCSI_G_NCR5380_MEM */
Finn Thainaa2e2cb2016-01-03 16:05:48 +110039#define DRV_MODULE_NAME "g_NCR5380_mmio"
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
Linus Torvalds1da177e2005-04-16 15:20:36 -070041#define NCR5380_map_type unsigned long
42#define NCR5380_map_name base
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#define NCR53C400_mem_base 0x3880
44#define NCR53C400_host_buffer 0x3900
Finn Thain9d376402016-03-23 21:10:10 +110045#define NCR53C400_region_size 0x3a00
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
Finn Thain54d8fe42016-01-03 16:05:06 +110047#define NCR5380_read(reg) \
48 readb(((struct NCR5380_hostdata *)shost_priv(instance))->iomem + \
49 NCR53C400_mem_base + (reg))
50#define NCR5380_write(reg, value) \
51 writeb(value, ((struct NCR5380_hostdata *)shost_priv(instance))->iomem + \
52 NCR53C400_mem_base + (reg))
Linus Torvalds1da177e2005-04-16 15:20:36 -070053
54#define NCR5380_implementation_fields \
Ondrej Zary12150792016-01-03 16:06:15 +110055 void __iomem *iomem; \
Finn Thain9d376402016-03-23 21:10:10 +110056 resource_size_t iomem_size; \
Ondrej Zary12150792016-01-03 16:06:15 +110057 int c400_ctl_status; \
58 int c400_blk_cnt; \
59 int c400_host_buf;
Linus Torvalds1da177e2005-04-16 15:20:36 -070060
Al Viroc818cb62006-03-24 03:15:37 -080061#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070062
Finn Thainff3d4572016-01-03 16:05:25 +110063#define NCR5380_dma_xfer_len(instance, cmd, phase) \
Finn Thain7e9ec8d2016-03-23 21:10:11 +110064 generic_NCR5380_dma_xfer_len(instance, cmd)
Finn Thain6c4b88c2016-03-23 21:10:17 +110065#define NCR5380_dma_recv_setup generic_NCR5380_pread
66#define NCR5380_dma_send_setup generic_NCR5380_pwrite
Finn Thain8053b0e2016-03-23 21:10:19 +110067#define NCR5380_dma_residual(instance) (0)
Finn Thainff3d4572016-01-03 16:05:25 +110068
Linus Torvalds1da177e2005-04-16 15:20:36 -070069#define NCR5380_intr generic_NCR5380_intr
70#define NCR5380_queue_command generic_NCR5380_queue_command
71#define NCR5380_abort generic_NCR5380_abort
72#define NCR5380_bus_reset generic_NCR5380_bus_reset
Finn Thain8c325132014-11-12 16:11:58 +110073#define NCR5380_info generic_NCR5380_info
Linus Torvalds1da177e2005-04-16 15:20:36 -070074
Finn Thaine5d55d12016-03-23 21:10:16 +110075#define NCR5380_io_delay(x) udelay(x)
76
Linus Torvalds1da177e2005-04-16 15:20:36 -070077#define BOARD_NCR5380 0
78#define BOARD_NCR53C400 1
79#define BOARD_NCR53C400A 2
80#define BOARD_DTC3181E 3
Ondrej Zaryc6084cb2016-01-03 16:06:19 +110081#define BOARD_HP_C2502 4
Linus Torvalds1da177e2005-04-16 15:20:36 -070082
Linus Torvalds1da177e2005-04-16 15:20:36 -070083#endif /* GENERIC_NCR5380_H */
84