icside.c 16 KB

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