Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c4b88ca authored by Finn Thain's avatar Finn Thain Committed by Martin K. Petersen
Browse files

ncr5380: Use DMA hooks for PDMA



Those wrapper drivers which use DMA define the REAL_DMA macro and
those which use pseudo DMA define PSEUDO_DMA. These macros need to be
removed for a number of reasons, not least of which is to have drivers
share more code.

Redefine the PDMA send and receive hooks as DMA setup hooks, so that the
DMA code can be shared by all 5380 wrapper drivers. This will help to
reunify the forked core driver.

Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Tested-by: default avatarMichael Schmitz <schmitzmic@gmail.com>
Tested-by: default avatarOndrej Zary <linux@rainbow-software.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent e5d55d1a
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -127,17 +127,11 @@
 * specific implementation of the NCR5380
 *
 * Either real DMA *or* pseudo DMA may be implemented
 * Note that the DMA setup functions should return the number of bytes
 * that they were able to program the controller for.
 *
 * NCR5380_dma_write_setup(instance, src, count) - initialize
 * NCR5380_dma_read_setup(instance, dst, count) - initialize
 * NCR5380_dma_residual(instance); - residual count
 *
 * PSEUDO functions :
 * NCR5380_pwrite(instance, src, count)
 * NCR5380_pread(instance, dst, count);
 *
 * The generic driver is initialized by calling NCR5380_init(instance),
 * after setting the appropriate host specific fields and ID.  If the
 * driver wishes to autoprobe for an IRQ line, the NCR5380_probe_irq(instance,
@@ -1511,7 +1505,7 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
 */

	if (p & SR_IO) {
		foo = NCR5380_pread(instance, d,
		foo = NCR5380_dma_recv_setup(instance, d,
			hostdata->flags & FLAG_DMA_FIXUP ? c - 1 : c);
		if (!foo && (hostdata->flags & FLAG_DMA_FIXUP)) {
			/*
@@ -1542,7 +1536,7 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,
			d[c - 1] = NCR5380_read(INPUT_DATA_REG);
		}
	} else {
		foo = NCR5380_pwrite(instance, d, c);
		foo = NCR5380_dma_send_setup(instance, d, c);
		if (!foo && (hostdata->flags & FLAG_DMA_FIXUP)) {
			/*
			 * Wait for the last byte to be sent.  If REQ is being asserted for
+6 −4
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@
#define NCR5380_write(reg, value)	cumanascsi_write(instance, reg, value)

#define NCR5380_dma_xfer_len(instance, cmd, phase)	(cmd->transfersize)
#define NCR5380_dma_recv_setup		cumanascsi_pread
#define NCR5380_dma_send_setup		cumanascsi_pwrite

#define NCR5380_intr			cumanascsi_intr
#define NCR5380_queue_command		cumanascsi_queue_command
@@ -39,8 +41,8 @@ void cumanascsi_setup(char *str, int *ints)
#define L(v)	(((v)<<16)|((v) & 0x0000ffff))
#define H(v)	(((v)>>16)|((v) & 0xffff0000))

static inline int
NCR5380_pwrite(struct Scsi_Host *host, unsigned char *addr, int len)
static inline int cumanascsi_pwrite(struct Scsi_Host *host,
                                    unsigned char *addr, int len)
{
  unsigned long *laddr;
  void __iomem *dma = priv(host)->dma + 0x2000;
@@ -102,8 +104,8 @@ NCR5380_pwrite(struct Scsi_Host *host, unsigned char *addr, int len)
  return len;
}

static inline int
NCR5380_pread(struct Scsi_Host *host, unsigned char *addr, int len)
static inline int cumanascsi_pread(struct Scsi_Host *host,
                                   unsigned char *addr, int len)
{
  unsigned long *laddr;
  void __iomem *dma = priv(host)->dma + 0x2000;
+6 −4
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@
	writeb(value, priv(instance)->base + ((reg) << 2))

#define NCR5380_dma_xfer_len(instance, cmd, phase)	(0)
#define NCR5380_dma_recv_setup		oakscsi_pread
#define NCR5380_dma_send_setup		oakscsi_pwrite

#define NCR5380_queue_command		oakscsi_queue_command
#define NCR5380_info			oakscsi_info
@@ -39,8 +41,8 @@
#define STAT	((128 + 16) << 2)
#define DATA	((128 + 8) << 2)

static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *addr,
              int len)
static inline int oakscsi_pwrite(struct Scsi_Host *instance,
                                 unsigned char *addr, int len)
{
  void __iomem *base = priv(instance)->base;

@@ -54,8 +56,8 @@ printk("writing %p len %d\n",addr, len);
  }
}

static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *addr,
              int len)
static inline int oakscsi_pread(struct Scsi_Host *instance,
                                unsigned char *addr, int len)
{
  void __iomem *base = priv(instance)->base;
printk("reading %p len %d\n", addr, len);
+2 −2
Original line number Diff line number Diff line
@@ -40,8 +40,8 @@
#define NCR5380_write(reg, value)	outb(value, instance->io_port + reg)

#define NCR5380_dma_xfer_len(instance, cmd, phase)	(0)
#define NCR5380_pread(instance, dst, len)		(0)
#define NCR5380_pwrite(instance, src, len)		(0)
#define NCR5380_dma_recv_setup(instance, dst, len)	(0)
#define NCR5380_dma_send_setup(instance, src, len)	(0)

#define NCR5380_implementation_fields	/* none */

+4 −2
Original line number Diff line number Diff line
@@ -322,7 +322,8 @@ static int dtc_biosparam(struct scsi_device *sdev, struct block_device *dev,
 * 	timeout.
*/

static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len)
static inline int dtc_pread(struct Scsi_Host *instance,
                            unsigned char *dst, int len)
{
	unsigned char *d = dst;
	int i;			/* For counting time spent in the poll-loop */
@@ -367,7 +368,8 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst,
 * 	timeout.
*/

static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len)
static inline int dtc_pwrite(struct Scsi_Host *instance,
                             unsigned char *src, int len)
{
	int i;
	struct NCR5380_hostdata *hostdata = shost_priv(instance);
Loading