icside.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. /*
  2. * linux/drivers/ide/arm/icside.c
  3. *
  4. * Copyright (c) 1996-2004 Russell King.
  5. *
  6. * Please note that this platform does not support 32-bit IDE IO.
  7. */
  8. #include <linux/string.h>
  9. #include <linux/module.h>
  10. #include <linux/ioport.h>
  11. #include <linux/slab.h>
  12. #include <linux/blkdev.h>
  13. #include <linux/errno.h>
  14. #include <linux/hdreg.h>
  15. #include <linux/ide.h>
  16. #include <linux/dma-mapping.h>
  17. #include <linux/device.h>
  18. #include <linux/init.h>
  19. #include <linux/scatterlist.h>
  20. #include <linux/io.h>
  21. #include <asm/dma.h>
  22. #include <asm/ecard.h>
  23. #define ICS_IDENT_OFFSET 0x2280
  24. #define ICS_ARCIN_V5_INTRSTAT 0x0000
  25. #define ICS_ARCIN_V5_INTROFFSET 0x0004
  26. #define ICS_ARCIN_V5_IDEOFFSET 0x2800
  27. #define ICS_ARCIN_V5_IDEALTOFFSET 0x2b80
  28. #define ICS_ARCIN_V5_IDESTEPPING 6
  29. #define ICS_ARCIN_V6_IDEOFFSET_1 0x2000
  30. #define ICS_ARCIN_V6_INTROFFSET_1 0x2200
  31. #define ICS_ARCIN_V6_INTRSTAT_1 0x2290
  32. #define ICS_ARCIN_V6_IDEALTOFFSET_1 0x2380
  33. #define ICS_ARCIN_V6_IDEOFFSET_2 0x3000
  34. #define ICS_ARCIN_V6_INTROFFSET_2 0x3200
  35. #define ICS_ARCIN_V6_INTRSTAT_2 0x3290
  36. #define ICS_ARCIN_V6_IDEALTOFFSET_2 0x3380
  37. #define ICS_ARCIN_V6_IDESTEPPING 6
  38. struct cardinfo {
  39. unsigned int dataoffset;
  40. unsigned int ctrloffset;
  41. unsigned int stepping;
  42. };
  43. static struct cardinfo icside_cardinfo_v5 = {
  44. .dataoffset = ICS_ARCIN_V5_IDEOFFSET,
  45. .ctrloffset = ICS_ARCIN_V5_IDEALTOFFSET,
  46. .stepping = ICS_ARCIN_V5_IDESTEPPING,
  47. };
  48. static struct cardinfo icside_cardinfo_v6_1 = {
  49. .dataoffset = ICS_ARCIN_V6_IDEOFFSET_1,
  50. .ctrloffset = ICS_ARCIN_V6_IDEALTOFFSET_1,
  51. .stepping = ICS_ARCIN_V6_IDESTEPPING,
  52. };
  53. static struct cardinfo icside_cardinfo_v6_2 = {
  54. .dataoffset = ICS_ARCIN_V6_IDEOFFSET_2,
  55. .ctrloffset = ICS_ARCIN_V6_IDEALTOFFSET_2,
  56. .stepping = ICS_ARCIN_V6_IDESTEPPING,
  57. };
  58. struct icside_state {
  59. unsigned int channel;
  60. unsigned int enabled;
  61. void __iomem *irq_port;
  62. void __iomem *ioc_base;
  63. unsigned int type;
  64. ide_hwif_t *hwif[2];
  65. };
  66. #define ICS_TYPE_A3IN 0
  67. #define ICS_TYPE_A3USER 1
  68. #define ICS_TYPE_V6 3
  69. #define ICS_TYPE_V5 15
  70. #define ICS_TYPE_NOTYPE ((unsigned int)-1)
  71. /* ---------------- Version 5 PCB Support Functions --------------------- */
  72. /* Prototype: icside_irqenable_arcin_v5 (struct expansion_card *ec, int irqnr)
  73. * Purpose : enable interrupts from card
  74. */
  75. static void icside_irqenable_arcin_v5 (struct expansion_card *ec, int irqnr)
  76. {
  77. struct icside_state *state = ec->irq_data;
  78. writeb(0, state->irq_port + ICS_ARCIN_V5_INTROFFSET);
  79. }
  80. /* Prototype: icside_irqdisable_arcin_v5 (struct expansion_card *ec, int irqnr)
  81. * Purpose : disable interrupts from card
  82. */
  83. static void icside_irqdisable_arcin_v5 (struct expansion_card *ec, int irqnr)
  84. {
  85. struct icside_state *state = ec->irq_data;
  86. readb(state->irq_port + ICS_ARCIN_V5_INTROFFSET);
  87. }
  88. static const expansioncard_ops_t icside_ops_arcin_v5 = {
  89. .irqenable = icside_irqenable_arcin_v5,
  90. .irqdisable = icside_irqdisable_arcin_v5,
  91. };
  92. /* ---------------- Version 6 PCB Support Functions --------------------- */
  93. /* Prototype: icside_irqenable_arcin_v6 (struct expansion_card *ec, int irqnr)
  94. * Purpose : enable interrupts from card
  95. */
  96. static void icside_irqenable_arcin_v6 (struct expansion_card *ec, int irqnr)
  97. {
  98. struct icside_state *state = ec->irq_data;
  99. void __iomem *base = state->irq_port;
  100. state->enabled = 1;
  101. switch (state->channel) {
  102. case 0:
  103. writeb(0, base + ICS_ARCIN_V6_INTROFFSET_1);
  104. readb(base + ICS_ARCIN_V6_INTROFFSET_2);
  105. break;
  106. case 1:
  107. writeb(0, base + ICS_ARCIN_V6_INTROFFSET_2);
  108. readb(base + ICS_ARCIN_V6_INTROFFSET_1);
  109. break;
  110. }
  111. }
  112. /* Prototype: icside_irqdisable_arcin_v6 (struct expansion_card *ec, int irqnr)
  113. * Purpose : disable interrupts from card
  114. */
  115. static void icside_irqdisable_arcin_v6 (struct expansion_card *ec, int irqnr)
  116. {
  117. struct icside_state *state = ec->irq_data;
  118. state->enabled = 0;
  119. readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1);
  120. readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2);
  121. }
  122. /* Prototype: icside_irqprobe(struct expansion_card *ec)
  123. * Purpose : detect an active interrupt from card
  124. */
  125. static int icside_irqpending_arcin_v6(struct expansion_card *ec)
  126. {
  127. struct icside_state *state = ec->irq_data;
  128. return readb(state->irq_port + ICS_ARCIN_V6_INTRSTAT_1) & 1 ||
  129. readb(state->irq_port + ICS_ARCIN_V6_INTRSTAT_2) & 1;
  130. }
  131. static const expansioncard_ops_t icside_ops_arcin_v6 = {
  132. .irqenable = icside_irqenable_arcin_v6,
  133. .irqdisable = icside_irqdisable_arcin_v6,
  134. .irqpending = icside_irqpending_arcin_v6,
  135. };
  136. /*
  137. * Handle routing of interrupts. This is called before
  138. * we write the command to the drive.
  139. */
  140. static void icside_maskproc(ide_drive_t *drive, int mask)
  141. {
  142. ide_hwif_t *hwif = HWIF(drive);
  143. struct icside_state *state = hwif->hwif_data;
  144. unsigned long flags;
  145. local_irq_save(flags);
  146. state->channel = hwif->channel;
  147. if (state->enabled && !mask) {
  148. switch (hwif->channel) {
  149. case 0:
  150. writeb(0, state->irq_port + ICS_ARCIN_V6_INTROFFSET_1);
  151. readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2);
  152. break;
  153. case 1:
  154. writeb(0, state->irq_port + ICS_ARCIN_V6_INTROFFSET_2);
  155. readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1);
  156. break;
  157. }
  158. } else {
  159. readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_2);
  160. readb(state->irq_port + ICS_ARCIN_V6_INTROFFSET_1);
  161. }
  162. local_irq_restore(flags);
  163. }
  164. #ifdef CONFIG_BLK_DEV_IDEDMA_ICS
  165. /*
  166. * SG-DMA support.
  167. *
  168. * Similar to the BM-DMA, but we use the RiscPCs IOMD DMA controllers.
  169. * There is only one DMA controller per card, which means that only
  170. * one drive can be accessed at one time. NOTE! We do not enforce that
  171. * here, but we rely on the main IDE driver spotting that both
  172. * interfaces use the same IRQ, which should guarantee this.
  173. */
  174. /*
  175. * Configure the IOMD to give the appropriate timings for the transfer
  176. * mode being requested. We take the advice of the ATA standards, and
  177. * calculate the cycle time based on the transfer mode, and the EIDE
  178. * MW DMA specs that the drive provides in the IDENTIFY command.
  179. *
  180. * We have the following IOMD DMA modes to choose from:
  181. *
  182. * Type Active Recovery Cycle
  183. * A 250 (250) 312 (550) 562 (800)
  184. * B 187 250 437
  185. * C 125 (125) 125 (375) 250 (500)
  186. * D 62 125 187
  187. *
  188. * (figures in brackets are actual measured timings)
  189. *
  190. * However, we also need to take care of the read/write active and
  191. * recovery timings:
  192. *
  193. * Read Write
  194. * Mode Active -- Recovery -- Cycle IOMD type
  195. * MW0 215 50 215 480 A
  196. * MW1 80 50 50 150 C
  197. * MW2 70 25 25 120 C
  198. */
  199. static void icside_set_dma_mode(ide_drive_t *drive, const u8 xfer_mode)
  200. {
  201. int cycle_time, use_dma_info = 0;
  202. switch (xfer_mode) {
  203. case XFER_MW_DMA_2:
  204. cycle_time = 250;
  205. use_dma_info = 1;
  206. break;
  207. case XFER_MW_DMA_1:
  208. cycle_time = 250;
  209. use_dma_info = 1;
  210. break;
  211. case XFER_MW_DMA_0:
  212. cycle_time = 480;
  213. break;
  214. case XFER_SW_DMA_2:
  215. case XFER_SW_DMA_1:
  216. case XFER_SW_DMA_0:
  217. cycle_time = 480;
  218. break;
  219. }
  220. /*
  221. * If we're going to be doing MW_DMA_1 or MW_DMA_2, we should
  222. * take care to note the values in the ID...
  223. */
  224. if (use_dma_info && drive->id->eide_dma_time > cycle_time)
  225. cycle_time = drive->id->eide_dma_time;
  226. drive->drive_data = cycle_time;
  227. printk("%s: %s selected (peak %dMB/s)\n", drive->name,
  228. ide_xfer_verbose(xfer_mode), 2000 / drive->drive_data);
  229. }
  230. static void icside_dma_host_set(ide_drive_t *drive, int on)
  231. {
  232. }
  233. static int icside_dma_end(ide_drive_t *drive)
  234. {
  235. ide_hwif_t *hwif = HWIF(drive);
  236. struct expansion_card *ec = ECARD_DEV(hwif->dev);
  237. drive->waiting_for_dma = 0;
  238. disable_dma(ec->dma);
  239. /* Teardown mappings after DMA has completed. */
  240. ide_destroy_dmatable(drive);
  241. return get_dma_residue(ec->dma) != 0;
  242. }
  243. static void icside_dma_start(ide_drive_t *drive)
  244. {
  245. ide_hwif_t *hwif = HWIF(drive);
  246. struct expansion_card *ec = ECARD_DEV(hwif->dev);
  247. /* We can not enable DMA on both channels simultaneously. */
  248. BUG_ON(dma_channel_active(ec->dma));
  249. enable_dma(ec->dma);
  250. }
  251. static int icside_dma_setup(ide_drive_t *drive)
  252. {
  253. ide_hwif_t *hwif = HWIF(drive);
  254. struct expansion_card *ec = ECARD_DEV(hwif->dev);
  255. struct request *rq = hwif->hwgroup->rq;
  256. unsigned int dma_mode;
  257. if (rq_data_dir(rq))
  258. dma_mode = DMA_MODE_WRITE;
  259. else
  260. dma_mode = DMA_MODE_READ;
  261. /*
  262. * We can not enable DMA on both channels.
  263. */
  264. BUG_ON(dma_channel_active(ec->dma));
  265. hwif->sg_nents = ide_build_sglist(drive, rq);
  266. /*
  267. * Ensure that we have the right interrupt routed.
  268. */
  269. icside_maskproc(drive, 0);
  270. /*
  271. * Route the DMA signals to the correct interface.
  272. */
  273. writeb(hwif->select_data, hwif->config_data);
  274. /*
  275. * Select the correct timing for this drive.
  276. */
  277. set_dma_speed(ec->dma, drive->drive_data);
  278. /*
  279. * Tell the DMA engine about the SG table and
  280. * data direction.
  281. */
  282. set_dma_sg(ec->dma, hwif->sg_table, hwif->sg_nents);
  283. set_dma_mode(ec->dma, dma_mode);
  284. drive->waiting_for_dma = 1;
  285. return 0;
  286. }
  287. static void icside_dma_exec_cmd(ide_drive_t *drive, u8 cmd)
  288. {
  289. /* issue cmd to drive */
  290. ide_execute_command(drive, cmd, ide_dma_intr, 2 * WAIT_CMD, NULL);
  291. }
  292. static int icside_dma_test_irq(ide_drive_t *drive)
  293. {
  294. ide_hwif_t *hwif = HWIF(drive);
  295. struct icside_state *state = hwif->hwif_data;
  296. return readb(state->irq_port +
  297. (hwif->channel ?
  298. ICS_ARCIN_V6_INTRSTAT_2 :
  299. ICS_ARCIN_V6_INTRSTAT_1)) & 1;
  300. }
  301. static void icside_dma_timeout(ide_drive_t *drive)
  302. {
  303. printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name);
  304. if (icside_dma_test_irq(drive))
  305. return;
  306. ide_dump_status(drive, "DMA timeout", HWIF(drive)->INB(IDE_STATUS_REG));
  307. icside_dma_end(drive);
  308. }
  309. static void icside_dma_lost_irq(ide_drive_t *drive)
  310. {
  311. printk(KERN_ERR "%s: IRQ lost\n", drive->name);
  312. }
  313. static void icside_dma_init(ide_hwif_t *hwif)
  314. {
  315. hwif->mwdma_mask = 7; /* MW0..2 */
  316. hwif->swdma_mask = 7; /* SW0..2 */
  317. hwif->dmatable_cpu = NULL;
  318. hwif->dmatable_dma = 0;
  319. hwif->set_dma_mode = icside_set_dma_mode;
  320. hwif->dma_host_set = icside_dma_host_set;
  321. hwif->dma_setup = icside_dma_setup;
  322. hwif->dma_exec_cmd = icside_dma_exec_cmd;
  323. hwif->dma_start = icside_dma_start;
  324. hwif->ide_dma_end = icside_dma_end;
  325. hwif->ide_dma_test_irq = icside_dma_test_irq;
  326. hwif->dma_timeout = icside_dma_timeout;
  327. hwif->dma_lost_irq = icside_dma_lost_irq;
  328. }
  329. #else
  330. #define icside_dma_init(hwif) (0)
  331. #endif
  332. static ide_hwif_t *
  333. icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *ec)
  334. {
  335. unsigned long port = (unsigned long)base + info->dataoffset;
  336. ide_hwif_t *hwif;
  337. hwif = ide_find_port(port);
  338. if (hwif) {
  339. int i;
  340. /*
  341. * Ensure we're using MMIO
  342. */
  343. default_hwif_mmiops(hwif);
  344. hwif->mmio = 1;
  345. for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
  346. hwif->io_ports[i] = port;
  347. port += 1 << info->stepping;
  348. }
  349. hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset;
  350. hwif->irq = ec->irq;
  351. hwif->noprobe = 0;
  352. hwif->chipset = ide_acorn;
  353. hwif->gendev.parent = &ec->dev;
  354. hwif->dev = &ec->dev;
  355. }
  356. return hwif;
  357. }
  358. static int __init
  359. icside_register_v5(struct icside_state *state, struct expansion_card *ec)
  360. {
  361. ide_hwif_t *hwif;
  362. void __iomem *base;
  363. u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
  364. base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
  365. if (!base)
  366. return -ENOMEM;
  367. state->irq_port = base;
  368. ec->irqaddr = base + ICS_ARCIN_V5_INTRSTAT;
  369. ec->irqmask = 1;
  370. ecard_setirq(ec, &icside_ops_arcin_v5, state);
  371. /*
  372. * Be on the safe side - disable interrupts
  373. */
  374. icside_irqdisable_arcin_v5(ec, 0);
  375. hwif = icside_setup(base, &icside_cardinfo_v5, ec);
  376. if (!hwif)
  377. return -ENODEV;
  378. state->hwif[0] = hwif;
  379. idx[0] = hwif->index;
  380. ide_device_add(idx);
  381. return 0;
  382. }
  383. static int __init
  384. icside_register_v6(struct icside_state *state, struct expansion_card *ec)
  385. {
  386. ide_hwif_t *hwif, *mate;
  387. void __iomem *ioc_base, *easi_base;
  388. unsigned int sel = 0;
  389. int ret;
  390. u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
  391. ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
  392. if (!ioc_base) {
  393. ret = -ENOMEM;
  394. goto out;
  395. }
  396. easi_base = ioc_base;
  397. if (ecard_resource_flags(ec, ECARD_RES_EASI)) {
  398. easi_base = ecardm_iomap(ec, ECARD_RES_EASI, 0, 0);
  399. if (!easi_base) {
  400. ret = -ENOMEM;
  401. goto out;
  402. }
  403. /*
  404. * Enable access to the EASI region.
  405. */
  406. sel = 1 << 5;
  407. }
  408. writeb(sel, ioc_base);
  409. ecard_setirq(ec, &icside_ops_arcin_v6, state);
  410. state->irq_port = easi_base;
  411. state->ioc_base = ioc_base;
  412. /*
  413. * Be on the safe side - disable interrupts
  414. */
  415. icside_irqdisable_arcin_v6(ec, 0);
  416. /*
  417. * Find and register the interfaces.
  418. */
  419. hwif = icside_setup(easi_base, &icside_cardinfo_v6_1, ec);
  420. mate = icside_setup(easi_base, &icside_cardinfo_v6_2, ec);
  421. if (!hwif || !mate) {
  422. ret = -ENODEV;
  423. goto out;
  424. }
  425. state->hwif[0] = hwif;
  426. state->hwif[1] = mate;
  427. hwif->maskproc = icside_maskproc;
  428. hwif->channel = 0;
  429. hwif->hwif_data = state;
  430. hwif->mate = mate;
  431. hwif->serialized = 1;
  432. hwif->config_data = (unsigned long)ioc_base;
  433. hwif->select_data = sel;
  434. mate->maskproc = icside_maskproc;
  435. mate->channel = 1;
  436. mate->hwif_data = state;
  437. mate->mate = hwif;
  438. mate->serialized = 1;
  439. mate->config_data = (unsigned long)ioc_base;
  440. mate->select_data = sel | 1;
  441. if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) {
  442. icside_dma_init(hwif);
  443. icside_dma_init(mate);
  444. }
  445. idx[0] = hwif->index;
  446. idx[1] = mate->index;
  447. ide_device_add(idx);
  448. return 0;
  449. out:
  450. return ret;
  451. }
  452. static int __devinit
  453. icside_probe(struct expansion_card *ec, const struct ecard_id *id)
  454. {
  455. struct icside_state *state;
  456. void __iomem *idmem;
  457. int ret;
  458. ret = ecard_request_resources(ec);
  459. if (ret)
  460. goto out;
  461. state = kzalloc(sizeof(struct icside_state), GFP_KERNEL);
  462. if (!state) {
  463. ret = -ENOMEM;
  464. goto release;
  465. }
  466. state->type = ICS_TYPE_NOTYPE;
  467. idmem = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
  468. if (idmem) {
  469. unsigned int type;
  470. type = readb(idmem + ICS_IDENT_OFFSET) & 1;
  471. type |= (readb(idmem + ICS_IDENT_OFFSET + 4) & 1) << 1;
  472. type |= (readb(idmem + ICS_IDENT_OFFSET + 8) & 1) << 2;
  473. type |= (readb(idmem + ICS_IDENT_OFFSET + 12) & 1) << 3;
  474. ecardm_iounmap(ec, idmem);
  475. state->type = type;
  476. }
  477. switch (state->type) {
  478. case ICS_TYPE_A3IN:
  479. dev_warn(&ec->dev, "A3IN unsupported\n");
  480. ret = -ENODEV;
  481. break;
  482. case ICS_TYPE_A3USER:
  483. dev_warn(&ec->dev, "A3USER unsupported\n");
  484. ret = -ENODEV;
  485. break;
  486. case ICS_TYPE_V5:
  487. ret = icside_register_v5(state, ec);
  488. break;
  489. case ICS_TYPE_V6:
  490. ret = icside_register_v6(state, ec);
  491. break;
  492. default:
  493. dev_warn(&ec->dev, "unknown interface type\n");
  494. ret = -ENODEV;
  495. break;
  496. }
  497. if (ret == 0) {
  498. ecard_set_drvdata(ec, state);
  499. goto out;
  500. }
  501. kfree(state);
  502. release:
  503. ecard_release_resources(ec);
  504. out:
  505. return ret;
  506. }
  507. static void __devexit icside_remove(struct expansion_card *ec)
  508. {
  509. struct icside_state *state = ecard_get_drvdata(ec);
  510. switch (state->type) {
  511. case ICS_TYPE_V5:
  512. /* FIXME: tell IDE to stop using the interface */
  513. /* Disable interrupts */
  514. icside_irqdisable_arcin_v5(ec, 0);
  515. break;
  516. case ICS_TYPE_V6:
  517. /* FIXME: tell IDE to stop using the interface */
  518. if (ec->dma != NO_DMA)
  519. free_dma(ec->dma);
  520. /* Disable interrupts */
  521. icside_irqdisable_arcin_v6(ec, 0);
  522. /* Reset the ROM pointer/EASI selection */
  523. writeb(0, state->ioc_base);
  524. break;
  525. }
  526. ecard_set_drvdata(ec, NULL);
  527. kfree(state);
  528. ecard_release_resources(ec);
  529. }
  530. static void icside_shutdown(struct expansion_card *ec)
  531. {
  532. struct icside_state *state = ecard_get_drvdata(ec);
  533. unsigned long flags;
  534. /*
  535. * Disable interrupts from this card. We need to do
  536. * this before disabling EASI since we may be accessing
  537. * this register via that region.
  538. */
  539. local_irq_save(flags);
  540. ec->ops->irqdisable(ec, 0);
  541. local_irq_restore(flags);
  542. /*
  543. * Reset the ROM pointer so that we can read the ROM
  544. * after a soft reboot. This also disables access to
  545. * the IDE taskfile via the EASI region.
  546. */
  547. if (state->ioc_base)
  548. writeb(0, state->ioc_base);
  549. }
  550. static const struct ecard_id icside_ids[] = {
  551. { MANU_ICS, PROD_ICS_IDE },
  552. { MANU_ICS2, PROD_ICS2_IDE },
  553. { 0xffff, 0xffff }
  554. };
  555. static struct ecard_driver icside_driver = {
  556. .probe = icside_probe,
  557. .remove = __devexit_p(icside_remove),
  558. .shutdown = icside_shutdown,
  559. .id_table = icside_ids,
  560. .drv = {
  561. .name = "icside",
  562. },
  563. };
  564. static int __init icside_init(void)
  565. {
  566. return ecard_register_driver(&icside_driver);
  567. }
  568. MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>");
  569. MODULE_LICENSE("GPL");
  570. MODULE_DESCRIPTION("ICS IDE driver");
  571. module_init(icside_init);