| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #include <linux/types.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | #include <linux/init.h> | 
 | 3 | #include <linux/interrupt.h> | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 4 | #include <linux/mm.h> | 
 | 5 | #include <linux/slab.h> | 
 | 6 | #include <linux/spinlock.h> | 
 | 7 | #include <linux/zorro.h> | 
| Paul Gortmaker | acf3368 | 2011-05-27 09:47:43 -0400 | [diff] [blame] | 8 | #include <linux/module.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #include <asm/page.h> | 
 | 11 | #include <asm/pgtable.h> | 
 | 12 | #include <asm/amigaints.h> | 
 | 13 | #include <asm/amigahw.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 |  | 
 | 15 | #include "scsi.h" | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include "wd33c93.h" | 
 | 17 | #include "a2091.h" | 
 | 18 |  | 
| Adrian Bunk | 5880f48 | 2009-03-04 12:06:07 -0800 | [diff] [blame] | 19 |  | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 20 | struct a2091_hostdata { | 
 | 21 | 	struct WD33C93_hostdata wh; | 
 | 22 | 	struct a2091_scsiregs *regs; | 
 | 23 | }; | 
 | 24 |  | 
| Geert Uytterhoeven | b1de6ab | 2010-04-04 11:00:40 +0200 | [diff] [blame] | 25 | static irqreturn_t a2091_intr(int irq, void *data) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | { | 
| Geert Uytterhoeven | b1de6ab | 2010-04-04 11:00:40 +0200 | [diff] [blame] | 27 | 	struct Scsi_Host *instance = data; | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 28 | 	struct a2091_hostdata *hdata = shost_priv(instance); | 
 | 29 | 	unsigned int status = hdata->regs->ISTR; | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 30 | 	unsigned long flags; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 |  | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 32 | 	if (!(status & (ISTR_INT_F | ISTR_INT_P)) || !(status & ISTR_INTS)) | 
 | 33 | 		return IRQ_NONE; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 |  | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 35 | 	spin_lock_irqsave(instance->host_lock, flags); | 
 | 36 | 	wd33c93_intr(instance); | 
 | 37 | 	spin_unlock_irqrestore(instance->host_lock, flags); | 
 | 38 | 	return IRQ_HANDLED; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | } | 
 | 40 |  | 
| Henrik Kretzschmar | 6539641 | 2006-09-12 23:49:33 +0200 | [diff] [blame] | 41 | static int dma_setup(struct scsi_cmnd *cmd, int dir_in) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | { | 
| Geert Uytterhoeven | 6d1d5d4 | 2010-04-04 11:00:36 +0200 | [diff] [blame] | 43 | 	struct Scsi_Host *instance = cmd->device->host; | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 44 | 	struct a2091_hostdata *hdata = shost_priv(instance); | 
 | 45 | 	struct WD33C93_hostdata *wh = &hdata->wh; | 
 | 46 | 	struct a2091_scsiregs *regs = hdata->regs; | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 47 | 	unsigned short cntr = CNTR_PDMD | CNTR_INTEN; | 
 | 48 | 	unsigned long addr = virt_to_bus(cmd->SCp.ptr); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 |  | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 50 | 	/* don't allow DMA if the physical address is bad */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | 	if (addr & A2091_XFER_MASK) { | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 52 | 		wh->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; | 
 | 53 | 		wh->dma_bounce_buffer = kmalloc(wh->dma_bounce_len, | 
 | 54 | 						GFP_KERNEL); | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 55 |  | 
 | 56 | 		/* can't allocate memory; use PIO */ | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 57 | 		if (!wh->dma_bounce_buffer) { | 
 | 58 | 			wh->dma_bounce_len = 0; | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 59 | 			return 1; | 
 | 60 | 		} | 
 | 61 |  | 
 | 62 | 		/* get the physical address of the bounce buffer */ | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 63 | 		addr = virt_to_bus(wh->dma_bounce_buffer); | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 64 |  | 
 | 65 | 		/* the bounce buffer may not be in the first 16M of physmem */ | 
 | 66 | 		if (addr & A2091_XFER_MASK) { | 
 | 67 | 			/* we could use chipmem... maybe later */ | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 68 | 			kfree(wh->dma_bounce_buffer); | 
 | 69 | 			wh->dma_bounce_buffer = NULL; | 
 | 70 | 			wh->dma_bounce_len = 0; | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 71 | 			return 1; | 
 | 72 | 		} | 
 | 73 |  | 
 | 74 | 		if (!dir_in) { | 
 | 75 | 			/* copy to bounce buffer for a write */ | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 76 | 			memcpy(wh->dma_bounce_buffer, cmd->SCp.ptr, | 
| Geert Uytterhoeven | 6d1d5d4 | 2010-04-04 11:00:36 +0200 | [diff] [blame] | 77 | 			       cmd->SCp.this_residual); | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 78 | 		} | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | 	} | 
 | 80 |  | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 81 | 	/* setup dma direction */ | 
 | 82 | 	if (!dir_in) | 
 | 83 | 		cntr |= CNTR_DDIR; | 
 | 84 |  | 
 | 85 | 	/* remember direction */ | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 86 | 	wh->dma_dir = dir_in; | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 87 |  | 
| Geert Uytterhoeven | b1de6ab | 2010-04-04 11:00:40 +0200 | [diff] [blame] | 88 | 	regs->CNTR = cntr; | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 89 |  | 
 | 90 | 	/* setup DMA *physical* address */ | 
| Geert Uytterhoeven | b1de6ab | 2010-04-04 11:00:40 +0200 | [diff] [blame] | 91 | 	regs->ACR = addr; | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 92 |  | 
 | 93 | 	if (dir_in) { | 
 | 94 | 		/* invalidate any cache */ | 
 | 95 | 		cache_clear(addr, cmd->SCp.this_residual); | 
 | 96 | 	} else { | 
 | 97 | 		/* push any dirty cache */ | 
 | 98 | 		cache_push(addr, cmd->SCp.this_residual); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | 	} | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 100 | 	/* start DMA */ | 
| Geert Uytterhoeven | b1de6ab | 2010-04-04 11:00:40 +0200 | [diff] [blame] | 101 | 	regs->ST_DMA = 1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 |  | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 103 | 	/* return success */ | 
 | 104 | 	return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | } | 
 | 106 |  | 
| Henrik Kretzschmar | 6539641 | 2006-09-12 23:49:33 +0200 | [diff] [blame] | 107 | static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 108 | 		     int status) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | { | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 110 | 	struct a2091_hostdata *hdata = shost_priv(instance); | 
 | 111 | 	struct WD33C93_hostdata *wh = &hdata->wh; | 
 | 112 | 	struct a2091_scsiregs *regs = hdata->regs; | 
| Geert Uytterhoeven | 6d1d5d4 | 2010-04-04 11:00:36 +0200 | [diff] [blame] | 113 |  | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 114 | 	/* disable SCSI interrupts */ | 
 | 115 | 	unsigned short cntr = CNTR_PDMD; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 |  | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 117 | 	if (!wh->dma_dir) | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 118 | 		cntr |= CNTR_DDIR; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 |  | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 120 | 	/* disable SCSI interrupts */ | 
| Geert Uytterhoeven | b1de6ab | 2010-04-04 11:00:40 +0200 | [diff] [blame] | 121 | 	regs->CNTR = cntr; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 |  | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 123 | 	/* flush if we were reading */ | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 124 | 	if (wh->dma_dir) { | 
| Geert Uytterhoeven | b1de6ab | 2010-04-04 11:00:40 +0200 | [diff] [blame] | 125 | 		regs->FLUSH = 1; | 
 | 126 | 		while (!(regs->ISTR & ISTR_FE_FLG)) | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 127 | 			; | 
 | 128 | 	} | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 |  | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 130 | 	/* clear a possible interrupt */ | 
| Geert Uytterhoeven | b1de6ab | 2010-04-04 11:00:40 +0200 | [diff] [blame] | 131 | 	regs->CINT = 1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 |  | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 133 | 	/* stop DMA */ | 
| Geert Uytterhoeven | b1de6ab | 2010-04-04 11:00:40 +0200 | [diff] [blame] | 134 | 	regs->SP_DMA = 1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 |  | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 136 | 	/* restore the CONTROL bits (minus the direction flag) */ | 
| Geert Uytterhoeven | b1de6ab | 2010-04-04 11:00:40 +0200 | [diff] [blame] | 137 | 	regs->CNTR = CNTR_PDMD | CNTR_INTEN; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 |  | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 139 | 	/* copy from a bounce buffer, if necessary */ | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 140 | 	if (status && wh->dma_bounce_buffer) { | 
 | 141 | 		if (wh->dma_dir) | 
 | 142 | 			memcpy(SCpnt->SCp.ptr, wh->dma_bounce_buffer, | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 143 | 			       SCpnt->SCp.this_residual); | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 144 | 		kfree(wh->dma_bounce_buffer); | 
 | 145 | 		wh->dma_bounce_buffer = NULL; | 
 | 146 | 		wh->dma_bounce_len = 0; | 
| Geert Uytterhoeven | 09bc85b | 2010-04-04 11:00:32 +0200 | [diff] [blame] | 147 | 	} | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | } | 
 | 149 |  | 
| Henrik Kretzschmar | 6539641 | 2006-09-12 23:49:33 +0200 | [diff] [blame] | 150 | static int a2091_bus_reset(struct scsi_cmnd *cmd) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | { | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 152 | 	struct Scsi_Host *instance = cmd->device->host; | 
 | 153 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | 	/* FIXME perform bus-specific reset */ | 
| Jeff Garzik  | 68b3aa7 | 2005-05-28 07:56:31 -0400 | [diff] [blame] | 155 |  | 
| Jeff Garzik  | df0ae24 | 2005-05-28 07:57:14 -0400 | [diff] [blame] | 156 | 	/* FIXME 2: kill this function, and let midlayer fall back | 
 | 157 | 	   to the same action, calling wd33c93_host_reset() */ | 
 | 158 |  | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 159 | 	spin_lock_irq(instance->host_lock); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | 	wd33c93_host_reset(cmd); | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 161 | 	spin_unlock_irq(instance->host_lock); | 
| Jeff Garzik  | 68b3aa7 | 2005-05-28 07:56:31 -0400 | [diff] [blame] | 162 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | 	return SUCCESS; | 
 | 164 | } | 
 | 165 |  | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 166 | static struct scsi_host_template a2091_scsi_template = { | 
 | 167 | 	.module			= THIS_MODULE, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | 	.name			= "Commodore A2091/A590 SCSI", | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 169 | 	.proc_info		= wd33c93_proc_info, | 
 | 170 | 	.proc_name		= "A2901", | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | 	.queuecommand		= wd33c93_queuecommand, | 
 | 172 | 	.eh_abort_handler	= wd33c93_abort, | 
 | 173 | 	.eh_bus_reset_handler	= a2091_bus_reset, | 
 | 174 | 	.eh_host_reset_handler	= wd33c93_host_reset, | 
 | 175 | 	.can_queue		= CAN_QUEUE, | 
 | 176 | 	.this_id		= 7, | 
 | 177 | 	.sg_tablesize		= SG_ALL, | 
 | 178 | 	.cmd_per_lun		= CMD_PER_LUN, | 
 | 179 | 	.use_clustering		= DISABLE_CLUSTERING | 
 | 180 | }; | 
 | 181 |  | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 182 | static int __devinit a2091_probe(struct zorro_dev *z, | 
 | 183 | 				 const struct zorro_device_id *ent) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | { | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 185 | 	struct Scsi_Host *instance; | 
 | 186 | 	int error; | 
 | 187 | 	struct a2091_scsiregs *regs; | 
 | 188 | 	wd33c93_regs wdregs; | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 189 | 	struct a2091_hostdata *hdata; | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 190 |  | 
 | 191 | 	if (!request_mem_region(z->resource.start, 256, "wd33c93")) | 
 | 192 | 		return -EBUSY; | 
 | 193 |  | 
 | 194 | 	instance = scsi_host_alloc(&a2091_scsi_template, | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 195 | 				   sizeof(struct a2091_hostdata)); | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 196 | 	if (!instance) { | 
 | 197 | 		error = -ENOMEM; | 
 | 198 | 		goto fail_alloc; | 
 | 199 | 	} | 
 | 200 |  | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 201 | 	instance->irq = IRQ_AMIGA_PORTS; | 
 | 202 | 	instance->unique_id = z->slotaddr; | 
 | 203 |  | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 204 | 	regs = (struct a2091_scsiregs *)ZTWO_VADDR(z->resource.start); | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 205 | 	regs->DAWR = DAWR_A2091; | 
 | 206 |  | 
 | 207 | 	wdregs.SASR = ®s->SASR; | 
 | 208 | 	wdregs.SCMD = ®s->SCMD; | 
 | 209 |  | 
 | 210 | 	hdata = shost_priv(instance); | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 211 | 	hdata->wh.no_sync = 0xff; | 
 | 212 | 	hdata->wh.fast = 0; | 
 | 213 | 	hdata->wh.dma_mode = CTRL_DMA; | 
 | 214 | 	hdata->regs = regs; | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 215 |  | 
 | 216 | 	wd33c93_init(instance, wdregs, dma_setup, dma_stop, WD33C93_FS_8_10); | 
 | 217 | 	error = request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED, | 
 | 218 | 			    "A2091 SCSI", instance); | 
 | 219 | 	if (error) | 
 | 220 | 		goto fail_irq; | 
 | 221 |  | 
 | 222 | 	regs->CNTR = CNTR_PDMD | CNTR_INTEN; | 
 | 223 |  | 
 | 224 | 	error = scsi_add_host(instance, NULL); | 
 | 225 | 	if (error) | 
 | 226 | 		goto fail_host; | 
 | 227 |  | 
 | 228 | 	zorro_set_drvdata(z, instance); | 
 | 229 |  | 
 | 230 | 	scsi_scan_host(instance); | 
 | 231 | 	return 0; | 
 | 232 |  | 
 | 233 | fail_host: | 
 | 234 | 	free_irq(IRQ_AMIGA_PORTS, instance); | 
 | 235 | fail_irq: | 
 | 236 | 	scsi_host_put(instance); | 
 | 237 | fail_alloc: | 
 | 238 | 	release_mem_region(z->resource.start, 256); | 
 | 239 | 	return error; | 
 | 240 | } | 
 | 241 |  | 
 | 242 | static void __devexit a2091_remove(struct zorro_dev *z) | 
 | 243 | { | 
 | 244 | 	struct Scsi_Host *instance = zorro_get_drvdata(z); | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 245 | 	struct a2091_hostdata *hdata = shost_priv(instance); | 
| Geert Uytterhoeven | b1de6ab | 2010-04-04 11:00:40 +0200 | [diff] [blame] | 246 |  | 
| Geert Uytterhoeven | 65c2784 | 2010-04-12 21:55:03 +0200 | [diff] [blame] | 247 | 	hdata->regs->CNTR = 0; | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 248 | 	scsi_remove_host(instance); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | 	free_irq(IRQ_AMIGA_PORTS, instance); | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 250 | 	scsi_host_put(instance); | 
 | 251 | 	release_mem_region(z->resource.start, 256); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | } | 
 | 253 |  | 
| Geert Uytterhoeven | c737e22 | 2009-08-16 11:17:35 +0200 | [diff] [blame] | 254 | static struct zorro_device_id a2091_zorro_tbl[] __devinitdata = { | 
 | 255 | 	{ ZORRO_PROD_CBM_A590_A2091_1 }, | 
 | 256 | 	{ ZORRO_PROD_CBM_A590_A2091_2 }, | 
 | 257 | 	{ 0 } | 
 | 258 | }; | 
 | 259 | MODULE_DEVICE_TABLE(zorro, a2091_zorro_tbl); | 
 | 260 |  | 
 | 261 | static struct zorro_driver a2091_driver = { | 
 | 262 | 	.name		= "a2091", | 
 | 263 | 	.id_table	= a2091_zorro_tbl, | 
 | 264 | 	.probe		= a2091_probe, | 
 | 265 | 	.remove		= __devexit_p(a2091_remove), | 
 | 266 | }; | 
 | 267 |  | 
 | 268 | static int __init a2091_init(void) | 
 | 269 | { | 
 | 270 | 	return zorro_register_driver(&a2091_driver); | 
 | 271 | } | 
 | 272 | module_init(a2091_init); | 
 | 273 |  | 
 | 274 | static void __exit a2091_exit(void) | 
 | 275 | { | 
 | 276 | 	zorro_unregister_driver(&a2091_driver); | 
 | 277 | } | 
 | 278 | module_exit(a2091_exit); | 
 | 279 |  | 
 | 280 | MODULE_DESCRIPTION("Commodore A2091/A590 SCSI"); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | MODULE_LICENSE("GPL"); |