msm_sdcc.c 30 KB

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