sdio.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  1. /*
  2. * linux/drivers/mmc/sdio.c
  3. *
  4. * Copyright 2006-2007 Pierre Ossman
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or (at
  9. * your option) any later version.
  10. */
  11. #include <linux/err.h>
  12. #include <linux/mmc/host.h>
  13. #include <linux/mmc/card.h>
  14. #include <linux/mmc/sdio.h>
  15. #include <linux/mmc/sdio_func.h>
  16. #include "core.h"
  17. #include "bus.h"
  18. #include "sd.h"
  19. #include "sdio_bus.h"
  20. #include "mmc_ops.h"
  21. #include "sd_ops.h"
  22. #include "sdio_ops.h"
  23. #include "sdio_cis.h"
  24. static int sdio_read_fbr(struct sdio_func *func)
  25. {
  26. int ret;
  27. unsigned char data;
  28. ret = mmc_io_rw_direct(func->card, 0, 0,
  29. SDIO_FBR_BASE(func->num) + SDIO_FBR_STD_IF, 0, &data);
  30. if (ret)
  31. goto out;
  32. data &= 0x0f;
  33. if (data == 0x0f) {
  34. ret = mmc_io_rw_direct(func->card, 0, 0,
  35. SDIO_FBR_BASE(func->num) + SDIO_FBR_STD_IF_EXT, 0, &data);
  36. if (ret)
  37. goto out;
  38. }
  39. func->class = data;
  40. out:
  41. return ret;
  42. }
  43. static int sdio_init_func(struct mmc_card *card, unsigned int fn)
  44. {
  45. int ret;
  46. struct sdio_func *func;
  47. BUG_ON(fn > SDIO_MAX_FUNCS);
  48. func = sdio_alloc_func(card);
  49. if (IS_ERR(func))
  50. return PTR_ERR(func);
  51. func->num = fn;
  52. if (!(card->quirks & MMC_QUIRK_NONSTD_SDIO)) {
  53. ret = sdio_read_fbr(func);
  54. if (ret)
  55. goto fail;
  56. ret = sdio_read_func_cis(func);
  57. if (ret)
  58. goto fail;
  59. } else {
  60. func->vendor = func->card->cis.vendor;
  61. func->device = func->card->cis.device;
  62. func->max_blksize = func->card->cis.blksize;
  63. }
  64. card->sdio_func[fn - 1] = func;
  65. return 0;
  66. fail:
  67. /*
  68. * It is okay to remove the function here even though we hold
  69. * the host lock as we haven't registered the device yet.
  70. */
  71. sdio_remove_func(func);
  72. return ret;
  73. }
  74. static int sdio_read_cccr(struct mmc_card *card)
  75. {
  76. int ret;
  77. int cccr_vsn;
  78. unsigned char data;
  79. memset(&card->cccr, 0, sizeof(struct sdio_cccr));
  80. ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_CCCR, 0, &data);
  81. if (ret)
  82. goto out;
  83. cccr_vsn = data & 0x0f;
  84. if (cccr_vsn > SDIO_CCCR_REV_1_20) {
  85. printk(KERN_ERR "%s: unrecognised CCCR structure version %d\n",
  86. mmc_hostname(card->host), cccr_vsn);
  87. return -EINVAL;
  88. }
  89. card->cccr.sdio_vsn = (data & 0xf0) >> 4;
  90. ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_CAPS, 0, &data);
  91. if (ret)
  92. goto out;
  93. if (data & SDIO_CCCR_CAP_SMB)
  94. card->cccr.multi_block = 1;
  95. if (data & SDIO_CCCR_CAP_LSC)
  96. card->cccr.low_speed = 1;
  97. if (data & SDIO_CCCR_CAP_4BLS)
  98. card->cccr.wide_bus = 1;
  99. if (cccr_vsn >= SDIO_CCCR_REV_1_10) {
  100. ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_POWER, 0, &data);
  101. if (ret)
  102. goto out;
  103. if (data & SDIO_POWER_SMPC)
  104. card->cccr.high_power = 1;
  105. }
  106. if (cccr_vsn >= SDIO_CCCR_REV_1_20) {
  107. ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_SPEED, 0, &data);
  108. if (ret)
  109. goto out;
  110. if (data & SDIO_SPEED_SHS)
  111. card->cccr.high_speed = 1;
  112. }
  113. out:
  114. return ret;
  115. }
  116. static int sdio_enable_wide(struct mmc_card *card)
  117. {
  118. int ret;
  119. u8 ctrl;
  120. if (!(card->host->caps & MMC_CAP_4_BIT_DATA))
  121. return 0;
  122. if (card->cccr.low_speed && !card->cccr.wide_bus)
  123. return 0;
  124. ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_IF, 0, &ctrl);
  125. if (ret)
  126. return ret;
  127. ctrl |= SDIO_BUS_WIDTH_4BIT;
  128. ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL);
  129. if (ret)
  130. return ret;
  131. return 1;
  132. }
  133. /*
  134. * If desired, disconnect the pull-up resistor on CD/DAT[3] (pin 1)
  135. * of the card. This may be required on certain setups of boards,
  136. * controllers and embedded sdio device which do not need the card's
  137. * pull-up. As a result, card detection is disabled and power is saved.
  138. */
  139. static int sdio_disable_cd(struct mmc_card *card)
  140. {
  141. int ret;
  142. u8 ctrl;
  143. if (!card->cccr.disable_cd)
  144. return 0;
  145. ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_IF, 0, &ctrl);
  146. if (ret)
  147. return ret;
  148. ctrl |= SDIO_BUS_CD_DISABLE;
  149. return mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL);
  150. }
  151. /*
  152. * Devices that remain active during a system suspend are
  153. * put back into 1-bit mode.
  154. */
  155. static int sdio_disable_wide(struct mmc_card *card)
  156. {
  157. int ret;
  158. u8 ctrl;
  159. if (!(card->host->caps & MMC_CAP_4_BIT_DATA))
  160. return 0;
  161. if (card->cccr.low_speed && !card->cccr.wide_bus)
  162. return 0;
  163. ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_IF, 0, &ctrl);
  164. if (ret)
  165. return ret;
  166. if (!(ctrl & SDIO_BUS_WIDTH_4BIT))
  167. return 0;
  168. ctrl &= ~SDIO_BUS_WIDTH_4BIT;
  169. ctrl |= SDIO_BUS_ASYNC_INT;
  170. ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL);
  171. if (ret)
  172. return ret;
  173. mmc_set_bus_width(card->host, MMC_BUS_WIDTH_1);
  174. return 0;
  175. }
  176. static int sdio_enable_4bit_bus(struct mmc_card *card)
  177. {
  178. int err;
  179. if (card->type == MMC_TYPE_SDIO)
  180. return sdio_enable_wide(card);
  181. if ((card->host->caps & MMC_CAP_4_BIT_DATA) &&
  182. (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
  183. err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
  184. if (err)
  185. return err;
  186. } else
  187. return 0;
  188. err = sdio_enable_wide(card);
  189. if (err <= 0)
  190. mmc_app_set_bus_width(card, MMC_BUS_WIDTH_1);
  191. return err;
  192. }
  193. /*
  194. * Test if the card supports high-speed mode and, if so, switch to it.
  195. */
  196. static int mmc_sdio_switch_hs(struct mmc_card *card, int enable)
  197. {
  198. int ret;
  199. u8 speed;
  200. if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED))
  201. return 0;
  202. if (!card->cccr.high_speed)
  203. return 0;
  204. ret = mmc_io_rw_direct(card, 0, 0, SDIO_CCCR_SPEED, 0, &speed);
  205. if (ret)
  206. return ret;
  207. if (enable)
  208. speed |= SDIO_SPEED_EHS;
  209. else
  210. speed &= ~SDIO_SPEED_EHS;
  211. ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_SPEED, speed, NULL);
  212. if (ret)
  213. return ret;
  214. return 1;
  215. }
  216. /*
  217. * Enable SDIO/combo card's high-speed mode. Return 0/1 if [not]supported.
  218. */
  219. static int sdio_enable_hs(struct mmc_card *card)
  220. {
  221. int ret;
  222. ret = mmc_sdio_switch_hs(card, true);
  223. if (ret <= 0 || card->type == MMC_TYPE_SDIO)
  224. return ret;
  225. ret = mmc_sd_switch_hs(card);
  226. if (ret <= 0)
  227. mmc_sdio_switch_hs(card, false);
  228. return ret;
  229. }
  230. static unsigned mmc_sdio_get_max_clock(struct mmc_card *card)
  231. {
  232. unsigned max_dtr;
  233. if (mmc_card_highspeed(card)) {
  234. /*
  235. * The SDIO specification doesn't mention how
  236. * the CIS transfer speed register relates to
  237. * high-speed, but it seems that 50 MHz is
  238. * mandatory.
  239. */
  240. max_dtr = 50000000;
  241. } else {
  242. max_dtr = card->cis.max_dtr;
  243. }
  244. if (card->type == MMC_TYPE_SD_COMBO)
  245. max_dtr = min(max_dtr, mmc_sd_get_max_clock(card));
  246. return max_dtr;
  247. }
  248. /*
  249. * Handle the detection and initialisation of a card.
  250. *
  251. * In the case of a resume, "oldcard" will contain the card
  252. * we're trying to reinitialise.
  253. */
  254. static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
  255. struct mmc_card *oldcard, int powered_resume)
  256. {
  257. struct mmc_card *card;
  258. int err;
  259. BUG_ON(!host);
  260. WARN_ON(!host->claimed);
  261. /*
  262. * Inform the card of the voltage
  263. */
  264. if (!powered_resume) {
  265. err = mmc_send_io_op_cond(host, host->ocr, &ocr);
  266. if (err)
  267. goto err;
  268. }
  269. /*
  270. * For SPI, enable CRC as appropriate.
  271. */
  272. if (mmc_host_is_spi(host)) {
  273. err = mmc_spi_set_crc(host, use_spi_crc);
  274. if (err)
  275. goto err;
  276. }
  277. /*
  278. * Allocate card structure.
  279. */
  280. card = mmc_alloc_card(host, NULL);
  281. if (IS_ERR(card)) {
  282. err = PTR_ERR(card);
  283. goto err;
  284. }
  285. if (ocr & R4_MEMORY_PRESENT
  286. && mmc_sd_get_cid(host, host->ocr & ocr, card->raw_cid) == 0) {
  287. card->type = MMC_TYPE_SD_COMBO;
  288. if (oldcard && (oldcard->type != MMC_TYPE_SD_COMBO ||
  289. memcmp(card->raw_cid, oldcard->raw_cid, sizeof(card->raw_cid)) != 0)) {
  290. mmc_remove_card(card);
  291. return -ENOENT;
  292. }
  293. } else {
  294. card->type = MMC_TYPE_SDIO;
  295. if (oldcard && oldcard->type != MMC_TYPE_SDIO) {
  296. mmc_remove_card(card);
  297. return -ENOENT;
  298. }
  299. }
  300. /*
  301. * Call the optional HC's init_card function to handle quirks.
  302. */
  303. if (host->ops->init_card)
  304. host->ops->init_card(host, card);
  305. /*
  306. * For native busses: set card RCA and quit open drain mode.
  307. */
  308. if (!powered_resume && !mmc_host_is_spi(host)) {
  309. err = mmc_send_relative_addr(host, &card->rca);
  310. if (err)
  311. goto remove;
  312. mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
  313. }
  314. /*
  315. * Read CSD, before selecting the card
  316. */
  317. if (!oldcard && card->type == MMC_TYPE_SD_COMBO) {
  318. err = mmc_sd_get_csd(host, card);
  319. if (err)
  320. return err;
  321. mmc_decode_cid(card);
  322. }
  323. /*
  324. * Select card, as all following commands rely on that.
  325. */
  326. if (!powered_resume && !mmc_host_is_spi(host)) {
  327. err = mmc_select_card(card);
  328. if (err)
  329. goto remove;
  330. }
  331. if (card->quirks & MMC_QUIRK_NONSTD_SDIO) {
  332. /*
  333. * This is non-standard SDIO device, meaning it doesn't
  334. * have any CIA (Common I/O area) registers present.
  335. * It's host's responsibility to fill cccr and cis
  336. * structures in init_card().
  337. */
  338. mmc_set_clock(host, card->cis.max_dtr);
  339. if (card->cccr.high_speed) {
  340. mmc_card_set_highspeed(card);
  341. mmc_set_timing(card->host, MMC_TIMING_SD_HS);
  342. }
  343. goto finish;
  344. }
  345. /*
  346. * Read the common registers.
  347. */
  348. err = sdio_read_cccr(card);
  349. if (err)
  350. goto remove;
  351. /*
  352. * Read the common CIS tuples.
  353. */
  354. err = sdio_read_common_cis(card);
  355. if (err)
  356. goto remove;
  357. if (oldcard) {
  358. int same = (card->cis.vendor == oldcard->cis.vendor &&
  359. card->cis.device == oldcard->cis.device);
  360. mmc_remove_card(card);
  361. if (!same)
  362. return -ENOENT;
  363. card = oldcard;
  364. }
  365. if (card->type == MMC_TYPE_SD_COMBO) {
  366. err = mmc_sd_setup_card(host, card, oldcard != NULL);
  367. /* handle as SDIO-only card if memory init failed */
  368. if (err) {
  369. mmc_go_idle(host);
  370. if (mmc_host_is_spi(host))
  371. /* should not fail, as it worked previously */
  372. mmc_spi_set_crc(host, use_spi_crc);
  373. card->type = MMC_TYPE_SDIO;
  374. } else
  375. card->dev.type = &sd_type;
  376. }
  377. /*
  378. * If needed, disconnect card detection pull-up resistor.
  379. */
  380. err = sdio_disable_cd(card);
  381. if (err)
  382. goto remove;
  383. /*
  384. * Switch to high-speed (if supported).
  385. */
  386. err = sdio_enable_hs(card);
  387. if (err > 0)
  388. mmc_sd_go_highspeed(card);
  389. else if (err)
  390. goto remove;
  391. /*
  392. * Change to the card's maximum speed.
  393. */
  394. mmc_set_clock(host, mmc_sdio_get_max_clock(card));
  395. /*
  396. * Switch to wider bus (if supported).
  397. */
  398. err = sdio_enable_4bit_bus(card);
  399. if (err > 0)
  400. mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
  401. else if (err)
  402. goto remove;
  403. finish:
  404. if (!oldcard)
  405. host->card = card;
  406. return 0;
  407. remove:
  408. if (!oldcard)
  409. mmc_remove_card(card);
  410. err:
  411. return err;
  412. }
  413. /*
  414. * Host is being removed. Free up the current card.
  415. */
  416. static void mmc_sdio_remove(struct mmc_host *host)
  417. {
  418. int i;
  419. BUG_ON(!host);
  420. BUG_ON(!host->card);
  421. for (i = 0;i < host->card->sdio_funcs;i++) {
  422. if (host->card->sdio_func[i]) {
  423. sdio_remove_func(host->card->sdio_func[i]);
  424. host->card->sdio_func[i] = NULL;
  425. }
  426. }
  427. mmc_remove_card(host->card);
  428. host->card = NULL;
  429. }
  430. /*
  431. * Card detection callback from host.
  432. */
  433. static void mmc_sdio_detect(struct mmc_host *host)
  434. {
  435. int err;
  436. BUG_ON(!host);
  437. BUG_ON(!host->card);
  438. mmc_claim_host(host);
  439. /*
  440. * Just check if our card has been removed.
  441. */
  442. err = mmc_select_card(host->card);
  443. mmc_release_host(host);
  444. if (err) {
  445. mmc_sdio_remove(host);
  446. mmc_claim_host(host);
  447. mmc_detach_bus(host);
  448. mmc_release_host(host);
  449. }
  450. }
  451. /*
  452. * SDIO suspend. We need to suspend all functions separately.
  453. * Therefore all registered functions must have drivers with suspend
  454. * and resume methods. Failing that we simply remove the whole card.
  455. */
  456. static int mmc_sdio_suspend(struct mmc_host *host)
  457. {
  458. int i, err = 0;
  459. for (i = 0; i < host->card->sdio_funcs; i++) {
  460. struct sdio_func *func = host->card->sdio_func[i];
  461. if (func && sdio_func_present(func) && func->dev.driver) {
  462. const struct dev_pm_ops *pmops = func->dev.driver->pm;
  463. if (!pmops || !pmops->suspend || !pmops->resume) {
  464. /* force removal of entire card in that case */
  465. err = -ENOSYS;
  466. } else
  467. err = pmops->suspend(&func->dev);
  468. if (err)
  469. break;
  470. }
  471. }
  472. while (err && --i >= 0) {
  473. struct sdio_func *func = host->card->sdio_func[i];
  474. if (func && sdio_func_present(func) && func->dev.driver) {
  475. const struct dev_pm_ops *pmops = func->dev.driver->pm;
  476. pmops->resume(&func->dev);
  477. }
  478. }
  479. if (!err && host->pm_flags & MMC_PM_KEEP_POWER) {
  480. mmc_claim_host(host);
  481. sdio_disable_wide(host->card);
  482. mmc_release_host(host);
  483. }
  484. return err;
  485. }
  486. static int mmc_sdio_resume(struct mmc_host *host)
  487. {
  488. int i, err;
  489. BUG_ON(!host);
  490. BUG_ON(!host->card);
  491. /* Basic card reinitialization. */
  492. mmc_claim_host(host);
  493. err = mmc_sdio_init_card(host, host->ocr, host->card,
  494. (host->pm_flags & MMC_PM_KEEP_POWER));
  495. if (!err && host->sdio_irqs)
  496. mmc_signal_sdio_irq(host);
  497. mmc_release_host(host);
  498. /*
  499. * If the card looked to be the same as before suspending, then
  500. * we proceed to resume all card functions. If one of them returns
  501. * an error then we simply return that error to the core and the
  502. * card will be redetected as new. It is the responsibility of
  503. * the function driver to perform further tests with the extra
  504. * knowledge it has of the card to confirm the card is indeed the
  505. * same as before suspending (same MAC address for network cards,
  506. * etc.) and return an error otherwise.
  507. */
  508. for (i = 0; !err && i < host->card->sdio_funcs; i++) {
  509. struct sdio_func *func = host->card->sdio_func[i];
  510. if (func && sdio_func_present(func) && func->dev.driver) {
  511. const struct dev_pm_ops *pmops = func->dev.driver->pm;
  512. err = pmops->resume(&func->dev);
  513. }
  514. }
  515. return err;
  516. }
  517. static int mmc_sdio_power_restore(struct mmc_host *host)
  518. {
  519. int ret;
  520. BUG_ON(!host);
  521. BUG_ON(!host->card);
  522. mmc_claim_host(host);
  523. ret = mmc_sdio_init_card(host, host->ocr, host->card,
  524. (host->pm_flags & MMC_PM_KEEP_POWER));
  525. if (!ret && host->sdio_irqs)
  526. mmc_signal_sdio_irq(host);
  527. mmc_release_host(host);
  528. return ret;
  529. }
  530. static const struct mmc_bus_ops mmc_sdio_ops = {
  531. .remove = mmc_sdio_remove,
  532. .detect = mmc_sdio_detect,
  533. .suspend = mmc_sdio_suspend,
  534. .resume = mmc_sdio_resume,
  535. .power_restore = mmc_sdio_power_restore,
  536. };
  537. /*
  538. * Starting point for SDIO card init.
  539. */
  540. int mmc_attach_sdio(struct mmc_host *host, u32 ocr)
  541. {
  542. int err;
  543. int i, funcs;
  544. struct mmc_card *card;
  545. BUG_ON(!host);
  546. WARN_ON(!host->claimed);
  547. mmc_attach_bus(host, &mmc_sdio_ops);
  548. /*
  549. * Sanity check the voltages that the card claims to
  550. * support.
  551. */
  552. if (ocr & 0x7F) {
  553. printk(KERN_WARNING "%s: card claims to support voltages "
  554. "below the defined range. These will be ignored.\n",
  555. mmc_hostname(host));
  556. ocr &= ~0x7F;
  557. }
  558. host->ocr = mmc_select_voltage(host, ocr);
  559. /*
  560. * Can we support the voltage(s) of the card(s)?
  561. */
  562. if (!host->ocr) {
  563. err = -EINVAL;
  564. goto err;
  565. }
  566. /*
  567. * Detect and init the card.
  568. */
  569. err = mmc_sdio_init_card(host, host->ocr, NULL, 0);
  570. if (err)
  571. goto err;
  572. card = host->card;
  573. /*
  574. * The number of functions on the card is encoded inside
  575. * the ocr.
  576. */
  577. funcs = (ocr & 0x70000000) >> 28;
  578. card->sdio_funcs = 0;
  579. /*
  580. * Initialize (but don't add) all present functions.
  581. */
  582. for (i = 0; i < funcs; i++, card->sdio_funcs++) {
  583. err = sdio_init_func(host->card, i + 1);
  584. if (err)
  585. goto remove;
  586. }
  587. mmc_release_host(host);
  588. /*
  589. * First add the card to the driver model...
  590. */
  591. err = mmc_add_card(host->card);
  592. if (err)
  593. goto remove_added;
  594. /*
  595. * ...then the SDIO functions.
  596. */
  597. for (i = 0;i < funcs;i++) {
  598. err = sdio_add_func(host->card->sdio_func[i]);
  599. if (err)
  600. goto remove_added;
  601. }
  602. return 0;
  603. remove_added:
  604. /* Remove without lock if the device has been added. */
  605. mmc_sdio_remove(host);
  606. mmc_claim_host(host);
  607. remove:
  608. /* And with lock if it hasn't been added. */
  609. if (host->card)
  610. mmc_sdio_remove(host);
  611. err:
  612. mmc_detach_bus(host);
  613. mmc_release_host(host);
  614. printk(KERN_ERR "%s: error %d whilst initialising SDIO card\n",
  615. mmc_hostname(host), err);
  616. return err;
  617. }