sun3_scsi.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. /*
  2. * Sun3 SCSI stuff by Erik Verbruggen (erik@bigmama.xtdnet.nl)
  3. *
  4. * Sun3 DMA routines added by Sam Creasey (sammy@sammy.net)
  5. *
  6. * VME support added by Sam Creasey
  7. *
  8. * TODO: modify this driver to support multiple Sun3 SCSI VME boards
  9. *
  10. * Adapted from mac_scsinew.c:
  11. */
  12. /*
  13. * Generic Macintosh NCR5380 driver
  14. *
  15. * Copyright 1998, Michael Schmitz <mschmitz@lbl.gov>
  16. *
  17. * derived in part from:
  18. */
  19. /*
  20. * Generic Generic NCR5380 driver
  21. *
  22. * Copyright 1995, Russell King
  23. */
  24. #include <linux/types.h>
  25. #include <linux/delay.h>
  26. #include <linux/module.h>
  27. #include <linux/ioport.h>
  28. #include <linux/init.h>
  29. #include <linux/blkdev.h>
  30. #include <linux/platform_device.h>
  31. #include <asm/io.h>
  32. #include <asm/dvma.h>
  33. #include <scsi/scsi_host.h>
  34. #include "sun3_scsi.h"
  35. /* Definitions for the core NCR5380 driver. */
  36. #define REAL_DMA
  37. /* #define SUPPORT_TAGS */
  38. /* minimum number of bytes to do dma on */
  39. #define DMA_MIN_SIZE 129
  40. /* #define MAX_TAGS 32 */
  41. #define NCR5380_implementation_fields /* none */
  42. #define NCR5380_read(reg) sun3scsi_read(reg)
  43. #define NCR5380_write(reg, value) sun3scsi_write(reg, value)
  44. #define NCR5380_queue_command sun3scsi_queue_command
  45. #define NCR5380_bus_reset sun3scsi_bus_reset
  46. #define NCR5380_abort sun3scsi_abort
  47. #define NCR5380_show_info sun3scsi_show_info
  48. #define NCR5380_info sun3scsi_info
  49. #define NCR5380_dma_read_setup(instance, data, count) \
  50. sun3scsi_dma_setup(data, count, 0)
  51. #define NCR5380_dma_write_setup(instance, data, count) \
  52. sun3scsi_dma_setup(data, count, 1)
  53. #define NCR5380_dma_residual(instance) \
  54. sun3scsi_dma_residual(instance)
  55. #define NCR5380_dma_xfer_len(instance, cmd, phase) \
  56. sun3scsi_dma_xfer_len(cmd->SCp.this_residual, cmd, !((phase) & SR_IO))
  57. #define NCR5380_acquire_dma_irq(instance) (1)
  58. #define NCR5380_release_dma_irq(instance)
  59. #include "NCR5380.h"
  60. extern int sun3_map_test(unsigned long, char *);
  61. static int setup_can_queue = -1;
  62. module_param(setup_can_queue, int, 0);
  63. static int setup_cmd_per_lun = -1;
  64. module_param(setup_cmd_per_lun, int, 0);
  65. static int setup_sg_tablesize = -1;
  66. module_param(setup_sg_tablesize, int, 0);
  67. #ifdef SUPPORT_TAGS
  68. static int setup_use_tagged_queuing = -1;
  69. module_param(setup_use_tagged_queuing, int, 0);
  70. #endif
  71. static int setup_hostid = -1;
  72. module_param(setup_hostid, int, 0);
  73. /* #define RESET_BOOT */
  74. #define AFTER_RESET_DELAY (HZ/2)
  75. /* ms to wait after hitting dma regs */
  76. #define SUN3_DMA_DELAY 10
  77. /* dvma buffer to allocate -- 32k should hopefully be more than sufficient */
  78. #define SUN3_DVMA_BUFSIZE 0xe000
  79. static struct scsi_cmnd *sun3_dma_setup_done;
  80. static unsigned char *sun3_scsi_regp;
  81. static volatile struct sun3_dma_regs *dregs;
  82. static struct sun3_udc_regs *udc_regs;
  83. static unsigned char *sun3_dma_orig_addr = NULL;
  84. static unsigned long sun3_dma_orig_count = 0;
  85. static int sun3_dma_active = 0;
  86. static unsigned long last_residual = 0;
  87. static struct Scsi_Host *default_instance;
  88. /*
  89. * NCR 5380 register access functions
  90. */
  91. static inline unsigned char sun3scsi_read(int reg)
  92. {
  93. return in_8(sun3_scsi_regp + reg);
  94. }
  95. static inline void sun3scsi_write(int reg, int value)
  96. {
  97. out_8(sun3_scsi_regp + reg, value);
  98. }
  99. #ifndef SUN3_SCSI_VME
  100. /* dma controller register access functions */
  101. static inline unsigned short sun3_udc_read(unsigned char reg)
  102. {
  103. unsigned short ret;
  104. dregs->udc_addr = UDC_CSR;
  105. udelay(SUN3_DMA_DELAY);
  106. ret = dregs->udc_data;
  107. udelay(SUN3_DMA_DELAY);
  108. return ret;
  109. }
  110. static inline void sun3_udc_write(unsigned short val, unsigned char reg)
  111. {
  112. dregs->udc_addr = reg;
  113. udelay(SUN3_DMA_DELAY);
  114. dregs->udc_data = val;
  115. udelay(SUN3_DMA_DELAY);
  116. }
  117. #endif
  118. #ifdef RESET_BOOT
  119. static void sun3_scsi_reset_boot(struct Scsi_Host *instance)
  120. {
  121. unsigned long end;
  122. /*
  123. * Do a SCSI reset to clean up the bus during initialization. No
  124. * messing with the queues, interrupts, or locks necessary here.
  125. */
  126. printk( "Sun3 SCSI: resetting the SCSI bus..." );
  127. /* switch off SCSI IRQ - catch an interrupt without IRQ bit set else */
  128. // sun3_disable_irq( IRQ_SUN3_SCSI );
  129. /* get in phase */
  130. NCR5380_write( TARGET_COMMAND_REG,
  131. PHASE_SR_TO_TCR( NCR5380_read(STATUS_REG) ));
  132. /* assert RST */
  133. NCR5380_write( INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST );
  134. /* The min. reset hold time is 25us, so 40us should be enough */
  135. udelay( 50 );
  136. /* reset RST and interrupt */
  137. NCR5380_write( INITIATOR_COMMAND_REG, ICR_BASE );
  138. NCR5380_read( RESET_PARITY_INTERRUPT_REG );
  139. for( end = jiffies + AFTER_RESET_DELAY; time_before(jiffies, end); )
  140. barrier();
  141. /* switch on SCSI IRQ again */
  142. // sun3_enable_irq( IRQ_SUN3_SCSI );
  143. printk( " done\n" );
  144. }
  145. #endif
  146. // safe bits for the CSR
  147. #define CSR_GOOD 0x060f
  148. static irqreturn_t scsi_sun3_intr(int irq, void *dummy)
  149. {
  150. unsigned short csr = dregs->csr;
  151. int handled = 0;
  152. #ifdef SUN3_SCSI_VME
  153. dregs->csr &= ~CSR_DMA_ENABLE;
  154. #endif
  155. if(csr & ~CSR_GOOD) {
  156. if(csr & CSR_DMA_BUSERR) {
  157. printk("scsi%d: bus error in dma\n", default_instance->host_no);
  158. }
  159. if(csr & CSR_DMA_CONFLICT) {
  160. printk("scsi%d: dma conflict\n", default_instance->host_no);
  161. }
  162. handled = 1;
  163. }
  164. if(csr & (CSR_SDB_INT | CSR_DMA_INT)) {
  165. NCR5380_intr(irq, dummy);
  166. handled = 1;
  167. }
  168. return IRQ_RETVAL(handled);
  169. }
  170. /*
  171. * Debug stuff - to be called on NMI, or sysrq key. Use at your own risk;
  172. * reentering NCR5380_print_status seems to have ugly side effects
  173. */
  174. /* this doesn't seem to get used at all -- sam */
  175. #if 0
  176. void sun3_sun3_debug (void)
  177. {
  178. unsigned long flags;
  179. if (default_instance) {
  180. local_irq_save(flags);
  181. NCR5380_print_status(default_instance);
  182. local_irq_restore(flags);
  183. }
  184. }
  185. #endif
  186. /* sun3scsi_dma_setup() -- initialize the dma controller for a read/write */
  187. static unsigned long sun3scsi_dma_setup(void *data, unsigned long count, int write_flag)
  188. {
  189. void *addr;
  190. if(sun3_dma_orig_addr != NULL)
  191. dvma_unmap(sun3_dma_orig_addr);
  192. #ifdef SUN3_SCSI_VME
  193. addr = (void *)dvma_map_vme((unsigned long) data, count);
  194. #else
  195. addr = (void *)dvma_map((unsigned long) data, count);
  196. #endif
  197. sun3_dma_orig_addr = addr;
  198. sun3_dma_orig_count = count;
  199. #ifndef SUN3_SCSI_VME
  200. dregs->fifo_count = 0;
  201. sun3_udc_write(UDC_RESET, UDC_CSR);
  202. /* reset fifo */
  203. dregs->csr &= ~CSR_FIFO;
  204. dregs->csr |= CSR_FIFO;
  205. #endif
  206. /* set direction */
  207. if(write_flag)
  208. dregs->csr |= CSR_SEND;
  209. else
  210. dregs->csr &= ~CSR_SEND;
  211. #ifdef SUN3_SCSI_VME
  212. dregs->csr |= CSR_PACK_ENABLE;
  213. dregs->dma_addr_hi = ((unsigned long)addr >> 16);
  214. dregs->dma_addr_lo = ((unsigned long)addr & 0xffff);
  215. dregs->dma_count_hi = 0;
  216. dregs->dma_count_lo = 0;
  217. dregs->fifo_count_hi = 0;
  218. dregs->fifo_count = 0;
  219. #else
  220. /* byte count for fifo */
  221. dregs->fifo_count = count;
  222. sun3_udc_write(UDC_RESET, UDC_CSR);
  223. /* reset fifo */
  224. dregs->csr &= ~CSR_FIFO;
  225. dregs->csr |= CSR_FIFO;
  226. if(dregs->fifo_count != count) {
  227. printk("scsi%d: fifo_mismatch %04x not %04x\n",
  228. default_instance->host_no, dregs->fifo_count,
  229. (unsigned int) count);
  230. NCR5380_dprint(NDEBUG_DMA, default_instance);
  231. }
  232. /* setup udc */
  233. udc_regs->addr_hi = (((unsigned long)(addr) & 0xff0000) >> 8);
  234. udc_regs->addr_lo = ((unsigned long)(addr) & 0xffff);
  235. udc_regs->count = count/2; /* count in words */
  236. udc_regs->mode_hi = UDC_MODE_HIWORD;
  237. if(write_flag) {
  238. if(count & 1)
  239. udc_regs->count++;
  240. udc_regs->mode_lo = UDC_MODE_LSEND;
  241. udc_regs->rsel = UDC_RSEL_SEND;
  242. } else {
  243. udc_regs->mode_lo = UDC_MODE_LRECV;
  244. udc_regs->rsel = UDC_RSEL_RECV;
  245. }
  246. /* announce location of regs block */
  247. sun3_udc_write(((dvma_vtob(udc_regs) & 0xff0000) >> 8),
  248. UDC_CHN_HI);
  249. sun3_udc_write((dvma_vtob(udc_regs) & 0xffff), UDC_CHN_LO);
  250. /* set dma master on */
  251. sun3_udc_write(0xd, UDC_MODE);
  252. /* interrupt enable */
  253. sun3_udc_write(UDC_INT_ENABLE, UDC_CSR);
  254. #endif
  255. return count;
  256. }
  257. #ifndef SUN3_SCSI_VME
  258. static inline unsigned long sun3scsi_dma_count(struct Scsi_Host *instance)
  259. {
  260. unsigned short resid;
  261. dregs->udc_addr = 0x32;
  262. udelay(SUN3_DMA_DELAY);
  263. resid = dregs->udc_data;
  264. udelay(SUN3_DMA_DELAY);
  265. resid *= 2;
  266. return (unsigned long) resid;
  267. }
  268. #endif
  269. static inline unsigned long sun3scsi_dma_residual(struct Scsi_Host *instance)
  270. {
  271. return last_residual;
  272. }
  273. static inline unsigned long sun3scsi_dma_xfer_len(unsigned long wanted,
  274. struct scsi_cmnd *cmd,
  275. int write_flag)
  276. {
  277. if (cmd->request->cmd_type == REQ_TYPE_FS)
  278. return wanted;
  279. else
  280. return 0;
  281. }
  282. static inline int sun3scsi_dma_start(unsigned long count, unsigned char *data)
  283. {
  284. #ifdef SUN3_SCSI_VME
  285. unsigned short csr;
  286. csr = dregs->csr;
  287. dregs->dma_count_hi = (sun3_dma_orig_count >> 16);
  288. dregs->dma_count_lo = (sun3_dma_orig_count & 0xffff);
  289. dregs->fifo_count_hi = (sun3_dma_orig_count >> 16);
  290. dregs->fifo_count = (sun3_dma_orig_count & 0xffff);
  291. /* if(!(csr & CSR_DMA_ENABLE))
  292. * dregs->csr |= CSR_DMA_ENABLE;
  293. */
  294. #else
  295. sun3_udc_write(UDC_CHN_START, UDC_CSR);
  296. #endif
  297. return 0;
  298. }
  299. /* clean up after our dma is done */
  300. static int sun3scsi_dma_finish(int write_flag)
  301. {
  302. unsigned short __maybe_unused count;
  303. unsigned short fifo;
  304. int ret = 0;
  305. sun3_dma_active = 0;
  306. #ifdef SUN3_SCSI_VME
  307. dregs->csr &= ~CSR_DMA_ENABLE;
  308. fifo = dregs->fifo_count;
  309. if (write_flag) {
  310. if ((fifo > 0) && (fifo < sun3_dma_orig_count))
  311. fifo++;
  312. }
  313. last_residual = fifo;
  314. /* empty bytes from the fifo which didn't make it */
  315. if ((!write_flag) && (dregs->csr & CSR_LEFT)) {
  316. unsigned char *vaddr;
  317. vaddr = (unsigned char *)dvma_vmetov(sun3_dma_orig_addr);
  318. vaddr += (sun3_dma_orig_count - fifo);
  319. vaddr--;
  320. switch (dregs->csr & CSR_LEFT) {
  321. case CSR_LEFT_3:
  322. *vaddr = (dregs->bpack_lo & 0xff00) >> 8;
  323. vaddr--;
  324. case CSR_LEFT_2:
  325. *vaddr = (dregs->bpack_hi & 0x00ff);
  326. vaddr--;
  327. case CSR_LEFT_1:
  328. *vaddr = (dregs->bpack_hi & 0xff00) >> 8;
  329. break;
  330. }
  331. }
  332. #else
  333. // check to empty the fifo on a read
  334. if(!write_flag) {
  335. int tmo = 20000; /* .2 sec */
  336. while(1) {
  337. if(dregs->csr & CSR_FIFO_EMPTY)
  338. break;
  339. if(--tmo <= 0) {
  340. printk("sun3scsi: fifo failed to empty!\n");
  341. return 1;
  342. }
  343. udelay(10);
  344. }
  345. }
  346. count = sun3scsi_dma_count(default_instance);
  347. fifo = dregs->fifo_count;
  348. last_residual = fifo;
  349. /* empty bytes from the fifo which didn't make it */
  350. if((!write_flag) && (count - fifo) == 2) {
  351. unsigned short data;
  352. unsigned char *vaddr;
  353. data = dregs->fifo_data;
  354. vaddr = (unsigned char *)dvma_btov(sun3_dma_orig_addr);
  355. vaddr += (sun3_dma_orig_count - fifo);
  356. vaddr[-2] = (data & 0xff00) >> 8;
  357. vaddr[-1] = (data & 0xff);
  358. }
  359. #endif
  360. dvma_unmap(sun3_dma_orig_addr);
  361. sun3_dma_orig_addr = NULL;
  362. #ifdef SUN3_SCSI_VME
  363. dregs->dma_addr_hi = 0;
  364. dregs->dma_addr_lo = 0;
  365. dregs->dma_count_hi = 0;
  366. dregs->dma_count_lo = 0;
  367. dregs->fifo_count = 0;
  368. dregs->fifo_count_hi = 0;
  369. dregs->csr &= ~CSR_SEND;
  370. /* dregs->csr |= CSR_DMA_ENABLE; */
  371. #else
  372. sun3_udc_write(UDC_RESET, UDC_CSR);
  373. dregs->fifo_count = 0;
  374. dregs->csr &= ~CSR_SEND;
  375. /* reset fifo */
  376. dregs->csr &= ~CSR_FIFO;
  377. dregs->csr |= CSR_FIFO;
  378. #endif
  379. sun3_dma_setup_done = NULL;
  380. return ret;
  381. }
  382. #include "atari_NCR5380.c"
  383. #ifdef SUN3_SCSI_VME
  384. #define SUN3_SCSI_NAME "Sun3 NCR5380 VME SCSI"
  385. #define DRV_MODULE_NAME "sun3_scsi_vme"
  386. #else
  387. #define SUN3_SCSI_NAME "Sun3 NCR5380 SCSI"
  388. #define DRV_MODULE_NAME "sun3_scsi"
  389. #endif
  390. #define PFX DRV_MODULE_NAME ": "
  391. static struct scsi_host_template sun3_scsi_template = {
  392. .module = THIS_MODULE,
  393. .proc_name = DRV_MODULE_NAME,
  394. .show_info = sun3scsi_show_info,
  395. .name = SUN3_SCSI_NAME,
  396. .info = sun3scsi_info,
  397. .queuecommand = sun3scsi_queue_command,
  398. .eh_abort_handler = sun3scsi_abort,
  399. .eh_bus_reset_handler = sun3scsi_bus_reset,
  400. .can_queue = 16,
  401. .this_id = 7,
  402. .sg_tablesize = SG_NONE,
  403. .cmd_per_lun = 2,
  404. .use_clustering = DISABLE_CLUSTERING
  405. };
  406. static int __init sun3_scsi_probe(struct platform_device *pdev)
  407. {
  408. struct Scsi_Host *instance;
  409. int error;
  410. struct resource *irq, *mem;
  411. unsigned char *ioaddr;
  412. int host_flags = 0;
  413. #ifdef SUN3_SCSI_VME
  414. int i;
  415. #endif
  416. if (setup_can_queue > 0)
  417. sun3_scsi_template.can_queue = setup_can_queue;
  418. if (setup_cmd_per_lun > 0)
  419. sun3_scsi_template.cmd_per_lun = setup_cmd_per_lun;
  420. if (setup_sg_tablesize >= 0)
  421. sun3_scsi_template.sg_tablesize = setup_sg_tablesize;
  422. if (setup_hostid >= 0)
  423. sun3_scsi_template.this_id = setup_hostid & 7;
  424. #ifdef SUN3_SCSI_VME
  425. ioaddr = NULL;
  426. for (i = 0; i < 2; i++) {
  427. unsigned char x;
  428. irq = platform_get_resource(pdev, IORESOURCE_IRQ, i);
  429. mem = platform_get_resource(pdev, IORESOURCE_MEM, i);
  430. if (!irq || !mem)
  431. break;
  432. ioaddr = sun3_ioremap(mem->start, resource_size(mem),
  433. SUN3_PAGE_TYPE_VME16);
  434. dregs = (struct sun3_dma_regs *)(ioaddr + 8);
  435. if (sun3_map_test((unsigned long)dregs, &x)) {
  436. unsigned short oldcsr;
  437. oldcsr = dregs->csr;
  438. dregs->csr = 0;
  439. udelay(SUN3_DMA_DELAY);
  440. if (dregs->csr == 0x1400)
  441. break;
  442. dregs->csr = oldcsr;
  443. }
  444. iounmap(ioaddr);
  445. ioaddr = NULL;
  446. }
  447. if (!ioaddr)
  448. return -ENODEV;
  449. #else
  450. irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
  451. mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  452. if (!irq || !mem)
  453. return -ENODEV;
  454. ioaddr = ioremap(mem->start, resource_size(mem));
  455. dregs = (struct sun3_dma_regs *)(ioaddr + 8);
  456. udc_regs = dvma_malloc(sizeof(struct sun3_udc_regs));
  457. if (!udc_regs) {
  458. pr_err(PFX "couldn't allocate DVMA memory!\n");
  459. iounmap(ioaddr);
  460. return -ENOMEM;
  461. }
  462. #endif
  463. sun3_scsi_regp = ioaddr;
  464. instance = scsi_host_alloc(&sun3_scsi_template,
  465. sizeof(struct NCR5380_hostdata));
  466. if (!instance) {
  467. error = -ENOMEM;
  468. goto fail_alloc;
  469. }
  470. default_instance = instance;
  471. instance->io_port = (unsigned long)ioaddr;
  472. instance->irq = irq->start;
  473. #ifdef SUPPORT_TAGS
  474. host_flags |= setup_use_tagged_queuing > 0 ? FLAG_TAGGED_QUEUING : 0;
  475. #endif
  476. NCR5380_init(instance, host_flags);
  477. error = request_irq(instance->irq, scsi_sun3_intr, 0,
  478. "NCR5380", instance);
  479. if (error) {
  480. #ifdef REAL_DMA
  481. pr_err(PFX "scsi%d: IRQ %d not free, bailing out\n",
  482. instance->host_no, instance->irq);
  483. goto fail_irq;
  484. #else
  485. pr_warn(PFX "scsi%d: IRQ %d not free, interrupts disabled\n",
  486. instance->host_no, instance->irq);
  487. instance->irq = NO_IRQ;
  488. #endif
  489. }
  490. dregs->csr = 0;
  491. udelay(SUN3_DMA_DELAY);
  492. dregs->csr = CSR_SCSI | CSR_FIFO | CSR_INTR;
  493. udelay(SUN3_DMA_DELAY);
  494. dregs->fifo_count = 0;
  495. #ifdef SUN3_SCSI_VME
  496. dregs->fifo_count_hi = 0;
  497. dregs->dma_addr_hi = 0;
  498. dregs->dma_addr_lo = 0;
  499. dregs->dma_count_hi = 0;
  500. dregs->dma_count_lo = 0;
  501. dregs->ivect = VME_DATA24 | (instance->irq & 0xff);
  502. #endif
  503. #ifdef RESET_BOOT
  504. sun3_scsi_reset_boot(instance);
  505. #endif
  506. error = scsi_add_host(instance, NULL);
  507. if (error)
  508. goto fail_host;
  509. platform_set_drvdata(pdev, instance);
  510. scsi_scan_host(instance);
  511. return 0;
  512. fail_host:
  513. if (instance->irq != NO_IRQ)
  514. free_irq(instance->irq, instance);
  515. fail_irq:
  516. NCR5380_exit(instance);
  517. scsi_host_put(instance);
  518. fail_alloc:
  519. if (udc_regs)
  520. dvma_free(udc_regs);
  521. iounmap(sun3_scsi_regp);
  522. return error;
  523. }
  524. static int __exit sun3_scsi_remove(struct platform_device *pdev)
  525. {
  526. struct Scsi_Host *instance = platform_get_drvdata(pdev);
  527. scsi_remove_host(instance);
  528. if (instance->irq != NO_IRQ)
  529. free_irq(instance->irq, instance);
  530. NCR5380_exit(instance);
  531. scsi_host_put(instance);
  532. if (udc_regs)
  533. dvma_free(udc_regs);
  534. iounmap(sun3_scsi_regp);
  535. return 0;
  536. }
  537. static struct platform_driver sun3_scsi_driver = {
  538. .remove = __exit_p(sun3_scsi_remove),
  539. .driver = {
  540. .name = DRV_MODULE_NAME,
  541. },
  542. };
  543. module_platform_driver_probe(sun3_scsi_driver, sun3_scsi_probe);
  544. MODULE_ALIAS("platform:" DRV_MODULE_NAME);
  545. MODULE_LICENSE("GPL");