msm_sdcc.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287
  1. /*
  2. * linux/drivers/mmc/host/msm_sdcc.c - Qualcomm MSM 7X00A SDCC Driver
  3. *
  4. * Copyright (C) 2007 Google Inc,
  5. * Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. * Based on mmci.c
  12. *
  13. * Author: San Mehat (san@android.com)
  14. *
  15. */
  16. #include <linux/module.h>
  17. #include <linux/moduleparam.h>
  18. #include <linux/init.h>
  19. #include <linux/ioport.h>
  20. #include <linux/device.h>
  21. #include <linux/interrupt.h>
  22. #include <linux/delay.h>
  23. #include <linux/err.h>
  24. #include <linux/highmem.h>
  25. #include <linux/log2.h>
  26. #include <linux/mmc/host.h>
  27. #include <linux/mmc/card.h>
  28. #include <linux/clk.h>
  29. #include <linux/scatterlist.h>
  30. #include <linux/platform_device.h>
  31. #include <linux/dma-mapping.h>
  32. #include <linux/debugfs.h>
  33. #include <linux/io.h>
  34. #include <linux/memory.h>
  35. #include <asm/cacheflush.h>
  36. #include <asm/div64.h>
  37. #include <asm/sizes.h>
  38. #include <asm/mach/mmc.h>
  39. #include <mach/msm_iomap.h>
  40. #include <mach/dma.h>
  41. #include <mach/htc_pwrsink.h>
  42. #include "msm_sdcc.h"
  43. #define DRIVER_NAME "msm-sdcc"
  44. static unsigned int msmsdcc_fmin = 144000;
  45. static unsigned int msmsdcc_fmax = 50000000;
  46. static unsigned int msmsdcc_4bit = 1;
  47. static unsigned int msmsdcc_pwrsave = 1;
  48. static unsigned int msmsdcc_piopoll = 1;
  49. static unsigned int msmsdcc_sdioirq;
  50. #define PIO_SPINMAX 30
  51. #define CMD_SPINMAX 20
  52. static void
  53. msmsdcc_start_command(struct msmsdcc_host *host, struct mmc_command *cmd,
  54. u32 c);
  55. static void
  56. msmsdcc_request_end(struct msmsdcc_host *host, struct mmc_request *mrq)
  57. {
  58. writel(0, host->base + MMCICOMMAND);
  59. BUG_ON(host->curr.data);
  60. host->curr.mrq = NULL;
  61. host->curr.cmd = NULL;
  62. if (mrq->data)
  63. mrq->data->bytes_xfered = host->curr.data_xfered;
  64. if (mrq->cmd->error == -ETIMEDOUT)
  65. mdelay(5);
  66. /*
  67. * Need to drop the host lock here; mmc_request_done may call
  68. * back into the driver...
  69. */
  70. spin_unlock(&host->lock);
  71. mmc_request_done(host->mmc, mrq);
  72. spin_lock(&host->lock);
  73. }
  74. static void
  75. msmsdcc_stop_data(struct msmsdcc_host *host)
  76. {
  77. writel(0, host->base + MMCIDATACTRL);
  78. host->curr.data = NULL;
  79. host->curr.got_dataend = host->curr.got_datablkend = 0;
  80. }
  81. uint32_t msmsdcc_fifo_addr(struct msmsdcc_host *host)
  82. {
  83. switch (host->pdev_id) {
  84. case 1:
  85. return MSM_SDC1_PHYS + MMCIFIFO;
  86. case 2:
  87. return MSM_SDC2_PHYS + MMCIFIFO;
  88. case 3:
  89. return MSM_SDC3_PHYS + MMCIFIFO;
  90. case 4:
  91. return MSM_SDC4_PHYS + MMCIFIFO;
  92. }
  93. BUG();
  94. return 0;
  95. }
  96. static void
  97. msmsdcc_dma_complete_func(struct msm_dmov_cmd *cmd,
  98. unsigned int result,
  99. struct msm_dmov_errdata *err)
  100. {
  101. struct msmsdcc_dma_data *dma_data =
  102. container_of(cmd, struct msmsdcc_dma_data, hdr);
  103. struct msmsdcc_host *host = dma_data->host;
  104. unsigned long flags;
  105. struct mmc_request *mrq;
  106. spin_lock_irqsave(&host->lock, flags);
  107. mrq = host->curr.mrq;
  108. BUG_ON(!mrq);
  109. if (!(result & DMOV_RSLT_VALID)) {
  110. pr_err("msmsdcc: Invalid DataMover result\n");
  111. goto out;
  112. }
  113. if (result & DMOV_RSLT_DONE) {
  114. host->curr.data_xfered = host->curr.xfer_size;
  115. } else {
  116. /* Error or flush */
  117. if (result & DMOV_RSLT_ERROR)
  118. pr_err("%s: DMA error (0x%.8x)\n",
  119. mmc_hostname(host->mmc), result);
  120. if (result & DMOV_RSLT_FLUSH)
  121. pr_err("%s: DMA channel flushed (0x%.8x)\n",
  122. mmc_hostname(host->mmc), result);
  123. if (err)
  124. pr_err("Flush data: %.8x %.8x %.8x %.8x %.8x %.8x\n",
  125. err->flush[0], err->flush[1], err->flush[2],
  126. err->flush[3], err->flush[4], err->flush[5]);
  127. if (!mrq->data->error)
  128. mrq->data->error = -EIO;
  129. }
  130. host->dma.busy = 0;
  131. dma_unmap_sg(mmc_dev(host->mmc), host->dma.sg, host->dma.num_ents,
  132. host->dma.dir);
  133. if (host->curr.user_pages) {
  134. struct scatterlist *sg = host->dma.sg;
  135. int i;
  136. for (i = 0; i < host->dma.num_ents; i++)
  137. flush_dcache_page(sg_page(sg++));
  138. }
  139. host->dma.sg = NULL;
  140. if ((host->curr.got_dataend && host->curr.got_datablkend)
  141. || mrq->data->error) {
  142. /*
  143. * If we've already gotten our DATAEND / DATABLKEND
  144. * for this request, then complete it through here.
  145. */
  146. msmsdcc_stop_data(host);
  147. if (!mrq->data->error)
  148. host->curr.data_xfered = host->curr.xfer_size;
  149. if (!mrq->data->stop || mrq->cmd->error) {
  150. writel(0, host->base + MMCICOMMAND);
  151. host->curr.mrq = NULL;
  152. host->curr.cmd = NULL;
  153. mrq->data->bytes_xfered = host->curr.data_xfered;
  154. spin_unlock_irqrestore(&host->lock, flags);
  155. mmc_request_done(host->mmc, mrq);
  156. return;
  157. } else
  158. msmsdcc_start_command(host, mrq->data->stop, 0);
  159. }
  160. out:
  161. spin_unlock_irqrestore(&host->lock, flags);
  162. return;
  163. }
  164. static int validate_dma(struct msmsdcc_host *host, struct mmc_data *data)
  165. {
  166. if (host->dma.channel == -1)
  167. return -ENOENT;
  168. if ((data->blksz * data->blocks) < MCI_FIFOSIZE)
  169. return -EINVAL;
  170. if ((data->blksz * data->blocks) % MCI_FIFOSIZE)
  171. return -EINVAL;
  172. return 0;
  173. }
  174. static int msmsdcc_config_dma(struct msmsdcc_host *host, struct mmc_data *data)
  175. {
  176. struct msmsdcc_nc_dmadata *nc;
  177. dmov_box *box;
  178. uint32_t rows;
  179. uint32_t crci;
  180. unsigned int n;
  181. int i, rc;
  182. struct scatterlist *sg = data->sg;
  183. rc = validate_dma(host, data);
  184. if (rc)
  185. return rc;
  186. host->dma.sg = data->sg;
  187. host->dma.num_ents = data->sg_len;
  188. nc = host->dma.nc;
  189. switch (host->pdev_id) {
  190. case 1:
  191. crci = MSMSDCC_CRCI_SDC1;
  192. break;
  193. case 2:
  194. crci = MSMSDCC_CRCI_SDC2;
  195. break;
  196. case 3:
  197. crci = MSMSDCC_CRCI_SDC3;
  198. break;
  199. case 4:
  200. crci = MSMSDCC_CRCI_SDC4;
  201. break;
  202. default:
  203. host->dma.sg = NULL;
  204. host->dma.num_ents = 0;
  205. return -ENOENT;
  206. }
  207. if (data->flags & MMC_DATA_READ)
  208. host->dma.dir = DMA_FROM_DEVICE;
  209. else
  210. host->dma.dir = DMA_TO_DEVICE;
  211. host->curr.user_pages = 0;
  212. n = dma_map_sg(mmc_dev(host->mmc), host->dma.sg,
  213. host->dma.num_ents, host->dma.dir);
  214. if (n != host->dma.num_ents) {
  215. pr_err("%s: Unable to map in all sg elements\n",
  216. mmc_hostname(host->mmc));
  217. host->dma.sg = NULL;
  218. host->dma.num_ents = 0;
  219. return -ENOMEM;
  220. }
  221. box = &nc->cmd[0];
  222. for (i = 0; i < host->dma.num_ents; i++) {
  223. box->cmd = CMD_MODE_BOX;
  224. if (i == (host->dma.num_ents - 1))
  225. box->cmd |= CMD_LC;
  226. rows = (sg_dma_len(sg) % MCI_FIFOSIZE) ?
  227. (sg_dma_len(sg) / MCI_FIFOSIZE) + 1 :
  228. (sg_dma_len(sg) / MCI_FIFOSIZE) ;
  229. if (data->flags & MMC_DATA_READ) {
  230. box->src_row_addr = msmsdcc_fifo_addr(host);
  231. box->dst_row_addr = sg_dma_address(sg);
  232. box->src_dst_len = (MCI_FIFOSIZE << 16) |
  233. (MCI_FIFOSIZE);
  234. box->row_offset = MCI_FIFOSIZE;
  235. box->num_rows = rows * ((1 << 16) + 1);
  236. box->cmd |= CMD_SRC_CRCI(crci);
  237. } else {
  238. box->src_row_addr = sg_dma_address(sg);
  239. box->dst_row_addr = msmsdcc_fifo_addr(host);
  240. box->src_dst_len = (MCI_FIFOSIZE << 16) |
  241. (MCI_FIFOSIZE);
  242. box->row_offset = (MCI_FIFOSIZE << 16);
  243. box->num_rows = rows * ((1 << 16) + 1);
  244. box->cmd |= CMD_DST_CRCI(crci);
  245. }
  246. box++;
  247. sg++;
  248. }
  249. /* location of command block must be 64 bit aligned */
  250. BUG_ON(host->dma.cmd_busaddr & 0x07);
  251. nc->cmdptr = (host->dma.cmd_busaddr >> 3) | CMD_PTR_LP;
  252. host->dma.hdr.cmdptr = DMOV_CMD_PTR_LIST |
  253. DMOV_CMD_ADDR(host->dma.cmdptr_busaddr);
  254. host->dma.hdr.complete_func = msmsdcc_dma_complete_func;
  255. return 0;
  256. }
  257. static void
  258. msmsdcc_start_data(struct msmsdcc_host *host, struct mmc_data *data)
  259. {
  260. unsigned int datactrl, timeout;
  261. unsigned long long clks;
  262. void __iomem *base = host->base;
  263. unsigned int pio_irqmask = 0;
  264. host->curr.data = data;
  265. host->curr.xfer_size = data->blksz * data->blocks;
  266. host->curr.xfer_remain = host->curr.xfer_size;
  267. host->curr.data_xfered = 0;
  268. host->curr.got_dataend = 0;
  269. host->curr.got_datablkend = 0;
  270. memset(&host->pio, 0, sizeof(host->pio));
  271. clks = (unsigned long long)data->timeout_ns * host->clk_rate;
  272. do_div(clks, NSEC_PER_SEC);
  273. timeout = data->timeout_clks + (unsigned int)clks;
  274. writel(timeout, base + MMCIDATATIMER);
  275. writel(host->curr.xfer_size, base + MMCIDATALENGTH);
  276. datactrl = MCI_DPSM_ENABLE | (data->blksz << 4);
  277. if (!msmsdcc_config_dma(host, data))
  278. datactrl |= MCI_DPSM_DMAENABLE;
  279. else {
  280. host->pio.sg = data->sg;
  281. host->pio.sg_len = data->sg_len;
  282. host->pio.sg_off = 0;
  283. if (data->flags & MMC_DATA_READ) {
  284. pio_irqmask = MCI_RXFIFOHALFFULLMASK;
  285. if (host->curr.xfer_remain < MCI_FIFOSIZE)
  286. pio_irqmask |= MCI_RXDATAAVLBLMASK;
  287. } else
  288. pio_irqmask = MCI_TXFIFOHALFEMPTYMASK;
  289. }
  290. if (data->flags & MMC_DATA_READ)
  291. datactrl |= MCI_DPSM_DIRECTION;
  292. writel(pio_irqmask, base + MMCIMASK1);
  293. writel(datactrl, base + MMCIDATACTRL);
  294. if (datactrl & MCI_DPSM_DMAENABLE) {
  295. host->dma.busy = 1;
  296. msm_dmov_enqueue_cmd(host->dma.channel, &host->dma.hdr);
  297. }
  298. }
  299. static void
  300. msmsdcc_start_command(struct msmsdcc_host *host, struct mmc_command *cmd, u32 c)
  301. {
  302. void __iomem *base = host->base;
  303. if (readl(base + MMCICOMMAND) & MCI_CPSM_ENABLE) {
  304. writel(0, base + MMCICOMMAND);
  305. udelay(2 + ((5 * 1000000) / host->clk_rate));
  306. }
  307. c |= cmd->opcode | MCI_CPSM_ENABLE;
  308. if (cmd->flags & MMC_RSP_PRESENT) {
  309. if (cmd->flags & MMC_RSP_136)
  310. c |= MCI_CPSM_LONGRSP;
  311. c |= MCI_CPSM_RESPONSE;
  312. }
  313. if (cmd->opcode == 17 || cmd->opcode == 18 ||
  314. cmd->opcode == 24 || cmd->opcode == 25 ||
  315. cmd->opcode == 53)
  316. c |= MCI_CSPM_DATCMD;
  317. if (cmd == cmd->mrq->stop)
  318. c |= MCI_CSPM_MCIABORT;
  319. host->curr.cmd = cmd;
  320. host->stats.cmds++;
  321. writel(cmd->arg, base + MMCIARGUMENT);
  322. writel(c, base + MMCICOMMAND);
  323. }
  324. static void
  325. msmsdcc_data_err(struct msmsdcc_host *host, struct mmc_data *data,
  326. unsigned int status)
  327. {
  328. if (status & MCI_DATACRCFAIL) {
  329. pr_err("%s: Data CRC error\n", mmc_hostname(host->mmc));
  330. pr_err("%s: opcode 0x%.8x\n", __func__,
  331. data->mrq->cmd->opcode);
  332. pr_err("%s: blksz %d, blocks %d\n", __func__,
  333. data->blksz, data->blocks);
  334. data->error = -EILSEQ;
  335. } else if (status & MCI_DATATIMEOUT) {
  336. pr_err("%s: Data timeout\n", mmc_hostname(host->mmc));
  337. data->error = -ETIMEDOUT;
  338. } else if (status & MCI_RXOVERRUN) {
  339. pr_err("%s: RX overrun\n", mmc_hostname(host->mmc));
  340. data->error = -EIO;
  341. } else if (status & MCI_TXUNDERRUN) {
  342. pr_err("%s: TX underrun\n", mmc_hostname(host->mmc));
  343. data->error = -EIO;
  344. } else {
  345. pr_err("%s: Unknown error (0x%.8x)\n",
  346. mmc_hostname(host->mmc), status);
  347. data->error = -EIO;
  348. }
  349. }
  350. static int
  351. msmsdcc_pio_read(struct msmsdcc_host *host, char *buffer, unsigned int remain)
  352. {
  353. void __iomem *base = host->base;
  354. uint32_t *ptr = (uint32_t *) buffer;
  355. int count = 0;
  356. while (readl(base + MMCISTATUS) & MCI_RXDATAAVLBL) {
  357. *ptr = readl(base + MMCIFIFO + (count % MCI_FIFOSIZE));
  358. ptr++;
  359. count += sizeof(uint32_t);
  360. remain -= sizeof(uint32_t);
  361. if (remain == 0)
  362. break;
  363. }
  364. return count;
  365. }
  366. static int
  367. msmsdcc_pio_write(struct msmsdcc_host *host, char *buffer,
  368. unsigned int remain, u32 status)
  369. {
  370. void __iomem *base = host->base;
  371. char *ptr = buffer;
  372. do {
  373. unsigned int count, maxcnt;
  374. maxcnt = status & MCI_TXFIFOEMPTY ? MCI_FIFOSIZE :
  375. MCI_FIFOHALFSIZE;
  376. count = min(remain, maxcnt);
  377. writesl(base + MMCIFIFO, ptr, count >> 2);
  378. ptr += count;
  379. remain -= count;
  380. if (remain == 0)
  381. break;
  382. status = readl(base + MMCISTATUS);
  383. } while (status & MCI_TXFIFOHALFEMPTY);
  384. return ptr - buffer;
  385. }
  386. static int
  387. msmsdcc_spin_on_status(struct msmsdcc_host *host, uint32_t mask, int maxspin)
  388. {
  389. while (maxspin) {
  390. if ((readl(host->base + MMCISTATUS) & mask))
  391. return 0;
  392. udelay(1);
  393. --maxspin;
  394. }
  395. return -ETIMEDOUT;
  396. }
  397. static int
  398. msmsdcc_pio_irq(int irq, void *dev_id)
  399. {
  400. struct msmsdcc_host *host = dev_id;
  401. void __iomem *base = host->base;
  402. uint32_t status;
  403. status = readl(base + MMCISTATUS);
  404. do {
  405. unsigned long flags;
  406. unsigned int remain, len;
  407. char *buffer;
  408. if (!(status & (MCI_TXFIFOHALFEMPTY | MCI_RXDATAAVLBL))) {
  409. if (host->curr.xfer_remain == 0 || !msmsdcc_piopoll)
  410. break;
  411. if (msmsdcc_spin_on_status(host,
  412. (MCI_TXFIFOHALFEMPTY |
  413. MCI_RXDATAAVLBL),
  414. PIO_SPINMAX)) {
  415. break;
  416. }
  417. }
  418. /* Map the current scatter buffer */
  419. local_irq_save(flags);
  420. buffer = kmap_atomic(sg_page(host->pio.sg),
  421. KM_BIO_SRC_IRQ) + host->pio.sg->offset;
  422. buffer += host->pio.sg_off;
  423. remain = host->pio.sg->length - host->pio.sg_off;
  424. len = 0;
  425. if (status & MCI_RXACTIVE)
  426. len = msmsdcc_pio_read(host, buffer, remain);
  427. if (status & MCI_TXACTIVE)
  428. len = msmsdcc_pio_write(host, buffer, remain, status);
  429. /* Unmap the buffer */
  430. kunmap_atomic(buffer, KM_BIO_SRC_IRQ);
  431. local_irq_restore(flags);
  432. host->pio.sg_off += len;
  433. host->curr.xfer_remain -= len;
  434. host->curr.data_xfered += len;
  435. remain -= len;
  436. if (remain == 0) {
  437. /* This sg page is full - do some housekeeping */
  438. if (status & MCI_RXACTIVE && host->curr.user_pages)
  439. flush_dcache_page(sg_page(host->pio.sg));
  440. if (!--host->pio.sg_len) {
  441. memset(&host->pio, 0, sizeof(host->pio));
  442. break;
  443. }
  444. /* Advance to next sg */
  445. host->pio.sg++;
  446. host->pio.sg_off = 0;
  447. }
  448. status = readl(base + MMCISTATUS);
  449. } while (1);
  450. if (status & MCI_RXACTIVE && host->curr.xfer_remain < MCI_FIFOSIZE)
  451. writel(MCI_RXDATAAVLBLMASK, base + MMCIMASK1);
  452. if (!host->curr.xfer_remain)
  453. writel(0, base + MMCIMASK1);
  454. return IRQ_HANDLED;
  455. }
  456. static void msmsdcc_do_cmdirq(struct msmsdcc_host *host, uint32_t status)
  457. {
  458. struct mmc_command *cmd = host->curr.cmd;
  459. void __iomem *base = host->base;
  460. host->curr.cmd = NULL;
  461. cmd->resp[0] = readl(base + MMCIRESPONSE0);
  462. cmd->resp[1] = readl(base + MMCIRESPONSE1);
  463. cmd->resp[2] = readl(base + MMCIRESPONSE2);
  464. cmd->resp[3] = readl(base + MMCIRESPONSE3);
  465. del_timer(&host->command_timer);
  466. if (status & MCI_CMDTIMEOUT) {
  467. cmd->error = -ETIMEDOUT;
  468. } else if (status & MCI_CMDCRCFAIL &&
  469. cmd->flags & MMC_RSP_CRC) {
  470. pr_err("%s: Command CRC error\n", mmc_hostname(host->mmc));
  471. cmd->error = -EILSEQ;
  472. }
  473. if (!cmd->data || cmd->error) {
  474. if (host->curr.data && host->dma.sg)
  475. msm_dmov_stop_cmd(host->dma.channel,
  476. &host->dma.hdr, 0);
  477. else if (host->curr.data) { /* Non DMA */
  478. msmsdcc_stop_data(host);
  479. msmsdcc_request_end(host, cmd->mrq);
  480. } else /* host->data == NULL */
  481. msmsdcc_request_end(host, cmd->mrq);
  482. } else if (!(cmd->data->flags & MMC_DATA_READ))
  483. msmsdcc_start_data(host, cmd->data);
  484. }
  485. static void
  486. msmsdcc_handle_irq_data(struct msmsdcc_host *host, u32 status,
  487. void __iomem *base)
  488. {
  489. struct mmc_data *data = host->curr.data;
  490. if (!data)
  491. return;
  492. /* Check for data errors */
  493. if (status & (MCI_DATACRCFAIL | MCI_DATATIMEOUT |
  494. MCI_TXUNDERRUN | MCI_RXOVERRUN)) {
  495. msmsdcc_data_err(host, data, status);
  496. host->curr.data_xfered = 0;
  497. if (host->dma.sg)
  498. msm_dmov_stop_cmd(host->dma.channel,
  499. &host->dma.hdr, 0);
  500. else {
  501. msmsdcc_stop_data(host);
  502. if (!data->stop)
  503. msmsdcc_request_end(host, data->mrq);
  504. else
  505. msmsdcc_start_command(host, data->stop, 0);
  506. }
  507. }
  508. /* Check for data done */
  509. if (!host->curr.got_dataend && (status & MCI_DATAEND))
  510. host->curr.got_dataend = 1;
  511. if (!host->curr.got_datablkend && (status & MCI_DATABLOCKEND))
  512. host->curr.got_datablkend = 1;
  513. /*
  514. * If DMA is still in progress, we complete via the completion handler
  515. */
  516. if (host->curr.got_dataend && host->curr.got_datablkend &&
  517. !host->dma.busy) {
  518. /*
  519. * There appears to be an issue in the controller where
  520. * if you request a small block transfer (< fifo size),
  521. * you may get your DATAEND/DATABLKEND irq without the
  522. * PIO data irq.
  523. *
  524. * Check to see if there is still data to be read,
  525. * and simulate a PIO irq.
  526. */
  527. if (readl(base + MMCISTATUS) & MCI_RXDATAAVLBL)
  528. msmsdcc_pio_irq(1, host);
  529. msmsdcc_stop_data(host);
  530. if (!data->error)
  531. host->curr.data_xfered = host->curr.xfer_size;
  532. if (!data->stop)
  533. msmsdcc_request_end(host, data->mrq);
  534. else
  535. msmsdcc_start_command(host, data->stop, 0);
  536. }
  537. }
  538. static irqreturn_t
  539. msmsdcc_irq(int irq, void *dev_id)
  540. {
  541. struct msmsdcc_host *host = dev_id;
  542. void __iomem *base = host->base;
  543. u32 status;
  544. int ret = 0;
  545. int cardint = 0;
  546. spin_lock(&host->lock);
  547. do {
  548. status = readl(base + MMCISTATUS);
  549. status &= (readl(base + MMCIMASK0) | MCI_DATABLOCKENDMASK);
  550. writel(status, base + MMCICLEAR);
  551. msmsdcc_handle_irq_data(host, status, base);
  552. if (status & (MCI_CMDSENT | MCI_CMDRESPEND | MCI_CMDCRCFAIL |
  553. MCI_CMDTIMEOUT) && host->curr.cmd) {
  554. msmsdcc_do_cmdirq(host, status);
  555. }
  556. if (status & MCI_SDIOINTOPER) {
  557. cardint = 1;
  558. status &= ~MCI_SDIOINTOPER;
  559. }
  560. ret = 1;
  561. } while (status);
  562. spin_unlock(&host->lock);
  563. /*
  564. * We have to delay handling the card interrupt as it calls
  565. * back into the driver.
  566. */
  567. if (cardint)
  568. mmc_signal_sdio_irq(host->mmc);
  569. return IRQ_RETVAL(ret);
  570. }
  571. static void
  572. msmsdcc_request(struct mmc_host *mmc, struct mmc_request *mrq)
  573. {
  574. struct msmsdcc_host *host = mmc_priv(mmc);
  575. unsigned long flags;
  576. WARN_ON(host->curr.mrq != NULL);
  577. WARN_ON(host->pwr == 0);
  578. spin_lock_irqsave(&host->lock, flags);
  579. host->stats.reqs++;
  580. if (host->eject) {
  581. if (mrq->data && !(mrq->data->flags & MMC_DATA_READ)) {
  582. mrq->cmd->error = 0;
  583. mrq->data->bytes_xfered = mrq->data->blksz *
  584. mrq->data->blocks;
  585. } else
  586. mrq->cmd->error = -ENOMEDIUM;
  587. spin_unlock_irqrestore(&host->lock, flags);
  588. mmc_request_done(mmc, mrq);
  589. return;
  590. }
  591. host->curr.mrq = mrq;
  592. if (mrq->data && mrq->data->flags & MMC_DATA_READ)
  593. msmsdcc_start_data(host, mrq->data);
  594. msmsdcc_start_command(host, mrq->cmd, 0);
  595. if (host->cmdpoll && !msmsdcc_spin_on_status(host,
  596. MCI_CMDRESPEND|MCI_CMDCRCFAIL|MCI_CMDTIMEOUT,
  597. CMD_SPINMAX)) {
  598. uint32_t status = readl(host->base + MMCISTATUS);
  599. msmsdcc_do_cmdirq(host, status);
  600. writel(MCI_CMDRESPEND | MCI_CMDCRCFAIL | MCI_CMDTIMEOUT,
  601. host->base + MMCICLEAR);
  602. host->stats.cmdpoll_hits++;
  603. } else {
  604. host->stats.cmdpoll_misses++;
  605. mod_timer(&host->command_timer, jiffies + HZ);
  606. }
  607. spin_unlock_irqrestore(&host->lock, flags);
  608. }
  609. static void
  610. msmsdcc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
  611. {
  612. struct msmsdcc_host *host = mmc_priv(mmc);
  613. u32 clk = 0, pwr = 0;
  614. int rc;
  615. if (ios->clock) {
  616. if (!host->clks_on) {
  617. clk_enable(host->pclk);
  618. clk_enable(host->clk);
  619. host->clks_on = 1;
  620. }
  621. if (ios->clock != host->clk_rate) {
  622. rc = clk_set_rate(host->clk, ios->clock);
  623. if (rc < 0)
  624. pr_err("%s: Error setting clock rate (%d)\n",
  625. mmc_hostname(host->mmc), rc);
  626. else
  627. host->clk_rate = ios->clock;
  628. }
  629. clk |= MCI_CLK_ENABLE;
  630. }
  631. if (ios->bus_width == MMC_BUS_WIDTH_4)
  632. clk |= (2 << 10); /* Set WIDEBUS */
  633. if (ios->clock > 400000 && msmsdcc_pwrsave)
  634. clk |= (1 << 9); /* PWRSAVE */
  635. clk |= (1 << 12); /* FLOW_ENA */
  636. clk |= (1 << 15); /* feedback clock */
  637. if (host->plat->translate_vdd)
  638. pwr |= host->plat->translate_vdd(mmc_dev(mmc), ios->vdd);
  639. switch (ios->power_mode) {
  640. case MMC_POWER_OFF:
  641. htc_pwrsink_set(PWRSINK_SDCARD, 0);
  642. break;
  643. case MMC_POWER_UP:
  644. pwr |= MCI_PWR_UP;
  645. break;
  646. case MMC_POWER_ON:
  647. htc_pwrsink_set(PWRSINK_SDCARD, 100);
  648. pwr |= MCI_PWR_ON;
  649. break;
  650. }
  651. if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN)
  652. pwr |= MCI_OD;
  653. writel(clk, host->base + MMCICLOCK);
  654. if (host->pwr != pwr) {
  655. host->pwr = pwr;
  656. writel(pwr, host->base + MMCIPOWER);
  657. }
  658. if (!(clk & MCI_CLK_ENABLE) && host->clks_on) {
  659. clk_disable(host->clk);
  660. clk_disable(host->pclk);
  661. host->clks_on = 0;
  662. }
  663. }
  664. static void msmsdcc_enable_sdio_irq(struct mmc_host *mmc, int enable)
  665. {
  666. struct msmsdcc_host *host = mmc_priv(mmc);
  667. unsigned long flags;
  668. u32 status;
  669. spin_lock_irqsave(&host->lock, flags);
  670. if (msmsdcc_sdioirq == 1) {
  671. status = readl(host->base + MMCIMASK0);
  672. if (enable)
  673. status |= MCI_SDIOINTOPERMASK;
  674. else
  675. status &= ~MCI_SDIOINTOPERMASK;
  676. host->saved_irq0mask = status;
  677. writel(status, host->base + MMCIMASK0);
  678. }
  679. spin_unlock_irqrestore(&host->lock, flags);
  680. }
  681. static const struct mmc_host_ops msmsdcc_ops = {
  682. .request = msmsdcc_request,
  683. .set_ios = msmsdcc_set_ios,
  684. .enable_sdio_irq = msmsdcc_enable_sdio_irq,
  685. };
  686. static void
  687. msmsdcc_check_status(unsigned long data)
  688. {
  689. struct msmsdcc_host *host = (struct msmsdcc_host *)data;
  690. unsigned int status;
  691. if (!host->plat->status) {
  692. mmc_detect_change(host->mmc, 0);
  693. goto out;
  694. }
  695. status = host->plat->status(mmc_dev(host->mmc));
  696. host->eject = !status;
  697. if (status ^ host->oldstat) {
  698. pr_info("%s: Slot status change detected (%d -> %d)\n",
  699. mmc_hostname(host->mmc), host->oldstat, status);
  700. if (status)
  701. mmc_detect_change(host->mmc, (5 * HZ) / 2);
  702. else
  703. mmc_detect_change(host->mmc, 0);
  704. }
  705. host->oldstat = status;
  706. out:
  707. if (host->timer.function)
  708. mod_timer(&host->timer, jiffies + HZ);
  709. }
  710. static irqreturn_t
  711. msmsdcc_platform_status_irq(int irq, void *dev_id)
  712. {
  713. struct msmsdcc_host *host = dev_id;
  714. printk(KERN_DEBUG "%s: %d\n", __func__, irq);
  715. msmsdcc_check_status((unsigned long) host);
  716. return IRQ_HANDLED;
  717. }
  718. static void
  719. msmsdcc_status_notify_cb(int card_present, void *dev_id)
  720. {
  721. struct msmsdcc_host *host = dev_id;
  722. printk(KERN_DEBUG "%s: card_present %d\n", mmc_hostname(host->mmc),
  723. card_present);
  724. msmsdcc_check_status((unsigned long) host);
  725. }
  726. /*
  727. * called when a command expires.
  728. * Dump some debugging, and then error
  729. * out the transaction.
  730. */
  731. static void
  732. msmsdcc_command_expired(unsigned long _data)
  733. {
  734. struct msmsdcc_host *host = (struct msmsdcc_host *) _data;
  735. struct mmc_request *mrq;
  736. unsigned long flags;
  737. spin_lock_irqsave(&host->lock, flags);
  738. mrq = host->curr.mrq;
  739. if (!mrq) {
  740. pr_info("%s: Command expiry misfire\n",
  741. mmc_hostname(host->mmc));
  742. spin_unlock_irqrestore(&host->lock, flags);
  743. return;
  744. }
  745. pr_err("%s: Command timeout (%p %p %p %p)\n",
  746. mmc_hostname(host->mmc), mrq, mrq->cmd,
  747. mrq->data, host->dma.sg);
  748. mrq->cmd->error = -ETIMEDOUT;
  749. msmsdcc_stop_data(host);
  750. writel(0, host->base + MMCICOMMAND);
  751. host->curr.mrq = NULL;
  752. host->curr.cmd = NULL;
  753. spin_unlock_irqrestore(&host->lock, flags);
  754. mmc_request_done(host->mmc, mrq);
  755. }
  756. static int
  757. msmsdcc_init_dma(struct msmsdcc_host *host)
  758. {
  759. memset(&host->dma, 0, sizeof(struct msmsdcc_dma_data));
  760. host->dma.host = host;
  761. host->dma.channel = -1;
  762. if (!host->dmares)
  763. return -ENODEV;
  764. host->dma.nc = dma_alloc_coherent(NULL,
  765. sizeof(struct msmsdcc_nc_dmadata),
  766. &host->dma.nc_busaddr,
  767. GFP_KERNEL);
  768. if (host->dma.nc == NULL) {
  769. pr_err("Unable to allocate DMA buffer\n");
  770. return -ENOMEM;
  771. }
  772. memset(host->dma.nc, 0x00, sizeof(struct msmsdcc_nc_dmadata));
  773. host->dma.cmd_busaddr = host->dma.nc_busaddr;
  774. host->dma.cmdptr_busaddr = host->dma.nc_busaddr +
  775. offsetof(struct msmsdcc_nc_dmadata, cmdptr);
  776. host->dma.channel = host->dmares->start;
  777. return 0;
  778. }
  779. #ifdef CONFIG_MMC_MSM7X00A_RESUME_IN_WQ
  780. static void
  781. do_resume_work(struct work_struct *work)
  782. {
  783. struct msmsdcc_host *host =
  784. container_of(work, struct msmsdcc_host, resume_task);
  785. struct mmc_host *mmc = host->mmc;
  786. if (mmc) {
  787. mmc_resume_host(mmc);
  788. if (host->stat_irq)
  789. enable_irq(host->stat_irq);
  790. }
  791. }
  792. #endif
  793. static int
  794. msmsdcc_probe(struct platform_device *pdev)
  795. {
  796. struct mmc_platform_data *plat = pdev->dev.platform_data;
  797. struct msmsdcc_host *host;
  798. struct mmc_host *mmc;
  799. struct resource *cmd_irqres = NULL;
  800. struct resource *pio_irqres = NULL;
  801. struct resource *stat_irqres = NULL;
  802. struct resource *memres = NULL;
  803. struct resource *dmares = NULL;
  804. int ret;
  805. /* must have platform data */
  806. if (!plat) {
  807. pr_err("%s: Platform data not available\n", __func__);
  808. ret = -EINVAL;
  809. goto out;
  810. }
  811. if (pdev->id < 1 || pdev->id > 4)
  812. return -EINVAL;
  813. if (pdev->resource == NULL || pdev->num_resources < 2) {
  814. pr_err("%s: Invalid resource\n", __func__);
  815. return -ENXIO;
  816. }
  817. memres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  818. dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
  819. cmd_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
  820. "cmd_irq");
  821. pio_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
  822. "pio_irq");
  823. stat_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
  824. "status_irq");
  825. if (!cmd_irqres || !pio_irqres || !memres) {
  826. pr_err("%s: Invalid resource\n", __func__);
  827. return -ENXIO;
  828. }
  829. /*
  830. * Setup our host structure
  831. */
  832. mmc = mmc_alloc_host(sizeof(struct msmsdcc_host), &pdev->dev);
  833. if (!mmc) {
  834. ret = -ENOMEM;
  835. goto out;
  836. }
  837. host = mmc_priv(mmc);
  838. host->pdev_id = pdev->id;
  839. host->plat = plat;
  840. host->mmc = mmc;
  841. host->cmdpoll = 1;
  842. host->base = ioremap(memres->start, PAGE_SIZE);
  843. if (!host->base) {
  844. ret = -ENOMEM;
  845. goto out;
  846. }
  847. host->cmd_irqres = cmd_irqres;
  848. host->pio_irqres = pio_irqres;
  849. host->memres = memres;
  850. host->dmares = dmares;
  851. spin_lock_init(&host->lock);
  852. /*
  853. * Setup DMA
  854. */
  855. msmsdcc_init_dma(host);
  856. /*
  857. * Setup main peripheral bus clock
  858. */
  859. host->pclk = clk_get(&pdev->dev, "sdc_pclk");
  860. if (IS_ERR(host->pclk)) {
  861. ret = PTR_ERR(host->pclk);
  862. goto host_free;
  863. }
  864. ret = clk_enable(host->pclk);
  865. if (ret)
  866. goto pclk_put;
  867. host->pclk_rate = clk_get_rate(host->pclk);
  868. /*
  869. * Setup SDC MMC clock
  870. */
  871. host->clk = clk_get(&pdev->dev, "sdc_clk");
  872. if (IS_ERR(host->clk)) {
  873. ret = PTR_ERR(host->clk);
  874. goto pclk_disable;
  875. }
  876. ret = clk_enable(host->clk);
  877. if (ret)
  878. goto clk_put;
  879. ret = clk_set_rate(host->clk, msmsdcc_fmin);
  880. if (ret) {
  881. pr_err("%s: Clock rate set failed (%d)\n", __func__, ret);
  882. goto clk_disable;
  883. }
  884. host->clk_rate = clk_get_rate(host->clk);
  885. host->clks_on = 1;
  886. /*
  887. * Setup MMC host structure
  888. */
  889. mmc->ops = &msmsdcc_ops;
  890. mmc->f_min = msmsdcc_fmin;
  891. mmc->f_max = msmsdcc_fmax;
  892. mmc->ocr_avail = plat->ocr_mask;
  893. if (msmsdcc_4bit)
  894. mmc->caps |= MMC_CAP_4_BIT_DATA;
  895. if (msmsdcc_sdioirq)
  896. mmc->caps |= MMC_CAP_SDIO_IRQ;
  897. mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED;
  898. mmc->max_phys_segs = NR_SG;
  899. mmc->max_hw_segs = NR_SG;
  900. mmc->max_blk_size = 4096; /* MCI_DATA_CTL BLOCKSIZE up to 4096 */
  901. mmc->max_blk_count = 65536;
  902. mmc->max_req_size = 33554432; /* MCI_DATA_LENGTH is 25 bits */
  903. mmc->max_seg_size = mmc->max_req_size;
  904. writel(0, host->base + MMCIMASK0);
  905. writel(0x5e007ff, host->base + MMCICLEAR); /* Add: 1 << 25 */
  906. writel(MCI_IRQENABLE, host->base + MMCIMASK0);
  907. host->saved_irq0mask = MCI_IRQENABLE;
  908. /*
  909. * Setup card detect change
  910. */
  911. memset(&host->timer, 0, sizeof(host->timer));
  912. if (stat_irqres && !(stat_irqres->flags & IORESOURCE_DISABLED)) {
  913. unsigned long irqflags = IRQF_SHARED |
  914. (stat_irqres->flags & IRQF_TRIGGER_MASK);
  915. host->stat_irq = stat_irqres->start;
  916. ret = request_irq(host->stat_irq,
  917. msmsdcc_platform_status_irq,
  918. irqflags,
  919. DRIVER_NAME " (slot)",
  920. host);
  921. if (ret) {
  922. pr_err("%s: Unable to get slot IRQ %d (%d)\n",
  923. mmc_hostname(mmc), host->stat_irq, ret);
  924. goto clk_disable;
  925. }
  926. } else if (plat->register_status_notify) {
  927. plat->register_status_notify(msmsdcc_status_notify_cb, host);
  928. } else if (!plat->status)
  929. pr_err("%s: No card detect facilities available\n",
  930. mmc_hostname(mmc));
  931. else {
  932. init_timer(&host->timer);
  933. host->timer.data = (unsigned long)host;
  934. host->timer.function = msmsdcc_check_status;
  935. host->timer.expires = jiffies + HZ;
  936. add_timer(&host->timer);
  937. }
  938. if (plat->status) {
  939. host->oldstat = host->plat->status(mmc_dev(host->mmc));
  940. host->eject = !host->oldstat;
  941. }
  942. /*
  943. * Setup a command timer. We currently need this due to
  944. * some 'strange' timeout / error handling situations.
  945. */
  946. init_timer(&host->command_timer);
  947. host->command_timer.data = (unsigned long) host;
  948. host->command_timer.function = msmsdcc_command_expired;
  949. ret = request_irq(cmd_irqres->start, msmsdcc_irq, IRQF_SHARED,
  950. DRIVER_NAME " (cmd)", host);
  951. if (ret)
  952. goto stat_irq_free;
  953. ret = request_irq(pio_irqres->start, msmsdcc_pio_irq, IRQF_SHARED,
  954. DRIVER_NAME " (pio)", host);
  955. if (ret)
  956. goto cmd_irq_free;
  957. mmc_set_drvdata(pdev, mmc);
  958. mmc_add_host(mmc);
  959. pr_info("%s: Qualcomm MSM SDCC at 0x%016llx irq %d,%d dma %d\n",
  960. mmc_hostname(mmc), (unsigned long long)memres->start,
  961. (unsigned int) cmd_irqres->start,
  962. (unsigned int) host->stat_irq, host->dma.channel);
  963. pr_info("%s: 4 bit data mode %s\n", mmc_hostname(mmc),
  964. (mmc->caps & MMC_CAP_4_BIT_DATA ? "enabled" : "disabled"));
  965. pr_info("%s: MMC clock %u -> %u Hz, PCLK %u Hz\n",
  966. mmc_hostname(mmc), msmsdcc_fmin, msmsdcc_fmax, host->pclk_rate);
  967. pr_info("%s: Slot eject status = %d\n", mmc_hostname(mmc), host->eject);
  968. pr_info("%s: Power save feature enable = %d\n",
  969. mmc_hostname(mmc), msmsdcc_pwrsave);
  970. if (host->dma.channel != -1) {
  971. pr_info("%s: DM non-cached buffer at %p, dma_addr 0x%.8x\n",
  972. mmc_hostname(mmc), host->dma.nc, host->dma.nc_busaddr);
  973. pr_info("%s: DM cmd busaddr 0x%.8x, cmdptr busaddr 0x%.8x\n",
  974. mmc_hostname(mmc), host->dma.cmd_busaddr,
  975. host->dma.cmdptr_busaddr);
  976. } else
  977. pr_info("%s: PIO transfer enabled\n", mmc_hostname(mmc));
  978. if (host->timer.function)
  979. pr_info("%s: Polling status mode enabled\n", mmc_hostname(mmc));
  980. return 0;
  981. cmd_irq_free:
  982. free_irq(cmd_irqres->start, host);
  983. stat_irq_free:
  984. if (host->stat_irq)
  985. free_irq(host->stat_irq, host);
  986. clk_disable:
  987. clk_disable(host->clk);
  988. clk_put:
  989. clk_put(host->clk);
  990. pclk_disable:
  991. clk_disable(host->pclk);
  992. pclk_put:
  993. clk_put(host->pclk);
  994. host_free:
  995. mmc_free_host(mmc);
  996. out:
  997. return ret;
  998. }
  999. static int
  1000. msmsdcc_suspend(struct platform_device *dev, pm_message_t state)
  1001. {
  1002. struct mmc_host *mmc = mmc_get_drvdata(dev);
  1003. int rc = 0;
  1004. if (mmc) {
  1005. struct msmsdcc_host *host = mmc_priv(mmc);
  1006. if (host->stat_irq)
  1007. disable_irq(host->stat_irq);
  1008. if (mmc->card && mmc->card->type != MMC_TYPE_SDIO)
  1009. rc = mmc_suspend_host(mmc, state);
  1010. if (!rc) {
  1011. writel(0, host->base + MMCIMASK0);
  1012. if (host->clks_on) {
  1013. clk_disable(host->clk);
  1014. clk_disable(host->pclk);
  1015. host->clks_on = 0;
  1016. }
  1017. }
  1018. }
  1019. return rc;
  1020. }
  1021. static int
  1022. msmsdcc_resume(struct platform_device *dev)
  1023. {
  1024. struct mmc_host *mmc = mmc_get_drvdata(dev);
  1025. unsigned long flags;
  1026. if (mmc) {
  1027. struct msmsdcc_host *host = mmc_priv(mmc);
  1028. spin_lock_irqsave(&host->lock, flags);
  1029. if (!host->clks_on) {
  1030. clk_enable(host->pclk);
  1031. clk_enable(host->clk);
  1032. host->clks_on = 1;
  1033. }
  1034. writel(host->saved_irq0mask, host->base + MMCIMASK0);
  1035. spin_unlock_irqrestore(&host->lock, flags);
  1036. if (mmc->card && mmc->card->type != MMC_TYPE_SDIO)
  1037. mmc_resume_host(mmc);
  1038. if (host->stat_irq)
  1039. enable_irq(host->stat_irq);
  1040. else if (host->stat_irq)
  1041. enable_irq(host->stat_irq);
  1042. }
  1043. return 0;
  1044. }
  1045. static struct platform_driver msmsdcc_driver = {
  1046. .probe = msmsdcc_probe,
  1047. .suspend = msmsdcc_suspend,
  1048. .resume = msmsdcc_resume,
  1049. .driver = {
  1050. .name = "msm_sdcc",
  1051. },
  1052. };
  1053. static int __init msmsdcc_init(void)
  1054. {
  1055. return platform_driver_register(&msmsdcc_driver);
  1056. }
  1057. static void __exit msmsdcc_exit(void)
  1058. {
  1059. platform_driver_unregister(&msmsdcc_driver);
  1060. }
  1061. module_init(msmsdcc_init);
  1062. module_exit(msmsdcc_exit);
  1063. MODULE_DESCRIPTION("Qualcomm MSM 7X00A Multimedia Card Interface driver");
  1064. MODULE_LICENSE("GPL");