OpenCores
URL https://opencores.org/ocsvn/test_project/test_project/trunk

Subversion Repositories test_project

[/] [test_project/] [trunk/] [linux_sd_driver/] [drivers/] [mmc/] [core/] [sd.c] - Blame information for rev 81

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 62 marcus.erl
/*
2
 *  linux/drivers/mmc/core/sd.c
3
 *
4
 *  Copyright (C) 2003-2004 Russell King, All Rights Reserved.
5
 *  SD support Copyright (C) 2004 Ian Molton, All Rights Reserved.
6
 *  Copyright (C) 2005-2007 Pierre Ossman, All Rights Reserved.
7
 *
8
 * This program is free software; you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License version 2 as
10
 * published by the Free Software Foundation.
11
 */
12
 
13
#include <linux/err.h>
14
 
15
#include <linux/mmc/host.h>
16
#include <linux/mmc/card.h>
17
#include <linux/mmc/mmc.h>
18
#include <linux/mmc/sd.h>
19
 
20
#include "core.h"
21
#include "sysfs.h"
22
#include "bus.h"
23
#include "mmc_ops.h"
24
#include "sd_ops.h"
25
 
26
static const unsigned int tran_exp[] = {
27
        10000,          100000,         1000000,        10000000,
28
        0,               0,               0,               0
29
};
30
 
31
static const unsigned char tran_mant[] = {
32
        0,       10,     12,     13,     15,     20,     25,     30,
33
        35,     40,     45,     50,     55,     60,     70,     80,
34
};
35
 
36
static const unsigned int tacc_exp[] = {
37
        1,      10,     100,    1000,   10000,  100000, 1000000, 10000000,
38
};
39
 
40
static const unsigned int tacc_mant[] = {
41
        0,       10,     12,     13,     15,     20,     25,     30,
42
        35,     40,     45,     50,     55,     60,     70,     80,
43
};
44
 
45
#define UNSTUFF_BITS(resp,start,size)                                   \
46
        ({                                                              \
47
                const int __size = size;                                \
48
                const u32 __mask = (__size < 32 ? 1 << __size : 0) - 1;  \
49
                const int __off = 3 - ((start) / 32);                   \
50
                const int __shft = (start) & 31;                        \
51
                u32 __res;                                              \
52
                                                                        \
53
                __res = resp[__off] >> __shft;                          \
54
                if (__size + __shft > 32)                               \
55
                        __res |= resp[__off-1] << ((32 - __shft) % 32); \
56
                __res & __mask;                                         \
57
        })
58
 
59
/*
60
 * Given the decoded CSD structure, decode the raw CID to our CID structure.
61
 */
62
static void mmc_decode_cid(struct mmc_card *card)
63
{
64
        u32 *resp = card->raw_cid;
65
 
66
        memset(&card->cid, 0, sizeof(struct mmc_cid));
67
 
68
        /*
69
         * SD doesn't currently have a version field so we will
70
         * have to assume we can parse this.
71
         */
72
        card->cid.manfid                = UNSTUFF_BITS(resp, 120, 8);
73
        card->cid.oemid                 = UNSTUFF_BITS(resp, 104, 16);
74
        card->cid.prod_name[0]           = UNSTUFF_BITS(resp, 96, 8);
75
        card->cid.prod_name[1]          = UNSTUFF_BITS(resp, 88, 8);
76
        card->cid.prod_name[2]          = UNSTUFF_BITS(resp, 80, 8);
77
        card->cid.prod_name[3]          = UNSTUFF_BITS(resp, 72, 8);
78
        card->cid.prod_name[4]          = UNSTUFF_BITS(resp, 64, 8);
79
        card->cid.hwrev                 = UNSTUFF_BITS(resp, 60, 4);
80
        card->cid.fwrev                 = UNSTUFF_BITS(resp, 56, 4);
81
        card->cid.serial                = UNSTUFF_BITS(resp, 24, 32);
82
        card->cid.year                  = UNSTUFF_BITS(resp, 12, 8);
83
        card->cid.month                 = UNSTUFF_BITS(resp, 8, 4);
84
 
85
        card->cid.year += 2000; /* SD cards year offset */
86
}
87
 
88
/*
89
 * Given a 128-bit response, decode to our card CSD structure.
90
 */
91
static int mmc_decode_csd(struct mmc_card *card)
92
{
93
        struct mmc_csd *csd = &card->csd;
94
        unsigned int e, m, csd_struct;
95
        u32 *resp = card->raw_csd;
96
 
97
        csd_struct = UNSTUFF_BITS(resp, 126, 2);
98
 
99
        switch (csd_struct) {
100
        case 0:
101
                m = UNSTUFF_BITS(resp, 115, 4);
102
                e = UNSTUFF_BITS(resp, 112, 3);
103
                csd->tacc_ns     = (tacc_exp[e] * tacc_mant[m] + 9) / 10;
104
                csd->tacc_clks   = UNSTUFF_BITS(resp, 104, 8) * 100;
105
 
106
                m = UNSTUFF_BITS(resp, 99, 4);
107
                e = UNSTUFF_BITS(resp, 96, 3);
108
                csd->max_dtr      = tran_exp[e] * tran_mant[m];
109
                csd->cmdclass     = UNSTUFF_BITS(resp, 84, 12);
110
 
111
                e = UNSTUFF_BITS(resp, 47, 3);
112
                m = UNSTUFF_BITS(resp, 62, 12);
113
                csd->capacity     = (1 + m) << (e + 2);
114 81 tac2
 
115 62 marcus.erl
                csd->read_blkbits = UNSTUFF_BITS(resp, 80, 4);
116
                csd->read_partial = UNSTUFF_BITS(resp, 79, 1);
117
                csd->write_misalign = UNSTUFF_BITS(resp, 78, 1);
118
                csd->read_misalign = UNSTUFF_BITS(resp, 77, 1);
119
                csd->r2w_factor = UNSTUFF_BITS(resp, 26, 3);
120
                csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4);
121
                csd->write_partial = UNSTUFF_BITS(resp, 21, 1);
122
                break;
123
        case 1:
124
                /*
125
                 * This is a block-addressed SDHC card. Most
126
                 * interesting fields are unused and have fixed
127
                 * values. To avoid getting tripped by buggy cards,
128
                 * we assume those fixed values ourselves.
129
                 */
130
                mmc_card_set_blockaddr(card);
131
 
132
                csd->tacc_ns     = 0; /* Unused */
133
                csd->tacc_clks   = 0; /* Unused */
134
 
135
                m = UNSTUFF_BITS(resp, 99, 4);
136
                e = UNSTUFF_BITS(resp, 96, 3);
137
                csd->max_dtr      = tran_exp[e] * tran_mant[m];
138
                csd->cmdclass     = UNSTUFF_BITS(resp, 84, 12);
139
 
140
                m = UNSTUFF_BITS(resp, 48, 22);
141
                csd->capacity     = (1 + m) << 10;
142
 
143
                csd->read_blkbits = 9;
144
                csd->read_partial = 0;
145
                csd->write_misalign = 0;
146
                csd->read_misalign = 0;
147
                csd->r2w_factor = 4; /* Unused */
148
                csd->write_blkbits = 9;
149
                csd->write_partial = 0;
150
                break;
151
        default:
152
                printk(KERN_ERR "%s: unrecognised CSD structure version %d\n",
153
                        mmc_hostname(card->host), csd_struct);
154
                return -EINVAL;
155
        }
156
 
157
        return 0;
158
}
159
 
160
/*
161
 * Given a 64-bit response, decode to our card SCR structure.
162
 */
163
static int mmc_decode_scr(struct mmc_card *card)
164
{
165
        struct sd_scr *scr = &card->scr;
166
        unsigned int scr_struct;
167
        u32 resp[4];
168
 
169
        resp[3] = card->raw_scr[1];
170
        resp[2] = card->raw_scr[0];
171 81 tac2
 
172
        //#ifdef CORES_SD_V1    
173
                scr_struct = UNSTUFF_BITS(resp, 60, 4);
174 62 marcus.erl
                printk(KERN_ERR "%s: unrecognised SCR structure version %d\n",
175 81 tac2
                                mmc_hostname(card->host), scr_struct);
176
 
177
                scr->sda_vsn = 0 ;//XXX: UNSTUFF_BITS(resp, 48, 4);UNSTUFF_BITS(resp, 56, 4);
178
                scr->bus_widths =1<<2 ;//XXX: UNSTUFF_BITS(resp, 48, 4);
179
 
180
        /*#else
181
                scr_struct = UNSTUFF_BITS(resp, 60, 4);
182
                if (scr_struct != 0) {
183
                        printk(KERN_ERR "%s: unrecognised SCR structure version %d\n",
184
                                mmc_hostname(card->host), scr_struct);
185
                        return -EINVAL;
186
                }
187
 
188
        #endif */
189
 
190 62 marcus.erl
 
191
        return 0;
192
}
193
 
194
/*
195
 * Fetches and decodes switch information
196
 */
197
static int mmc_read_switch(struct mmc_card *card)
198
{
199
        int err;
200
        u8 *status;
201
 
202
        if (card->scr.sda_vsn < SCR_SPEC_VER_1)
203
                return 0;
204
 
205
        if (!(card->csd.cmdclass & CCC_SWITCH)) {
206
                printk(KERN_WARNING "%s: card lacks mandatory switch "
207
                        "function, performance might suffer.\n",
208
                        mmc_hostname(card->host));
209
                return 0;
210
        }
211
 
212
        err = -EIO;
213
 
214
        status = kmalloc(64, GFP_KERNEL);
215
        if (!status) {
216
                printk(KERN_ERR "%s: could not allocate a buffer for "
217
                        "switch capabilities.\n", mmc_hostname(card->host));
218
                return -ENOMEM;
219
        }
220
 
221
        err = mmc_sd_switch(card, 0, 0, 1, status);
222
        if (err) {
223
                /*
224
                 * We all hosts that cannot perform the command
225
                 * to fail more gracefully
226
                 */
227
                if (err != -EINVAL)
228
                        goto out;
229
 
230
                printk(KERN_WARNING "%s: problem reading switch "
231
                        "capabilities, performance might suffer.\n",
232
                        mmc_hostname(card->host));
233
                err = 0;
234
 
235
                goto out;
236
        }
237
 
238
        if (status[13] & 0x02)
239
                card->sw_caps.hs_max_dtr = 50000000;
240
 
241
out:
242
        kfree(status);
243
 
244
        return err;
245
}
246
 
247
/*
248
 * Test if the card supports high-speed mode and, if so, switch to it.
249
 */
250
static int mmc_switch_hs(struct mmc_card *card)
251
{
252
        int err;
253
        u8 *status;
254
 
255
        if (card->scr.sda_vsn < SCR_SPEC_VER_1)
256
                return 0;
257
 
258
        if (!(card->csd.cmdclass & CCC_SWITCH))
259
                return 0;
260
 
261
        if (!(card->host->caps & MMC_CAP_SD_HIGHSPEED))
262
                return 0;
263
 
264
        if (card->sw_caps.hs_max_dtr == 0)
265
                return 0;
266
 
267
        err = -EIO;
268
 
269
        status = kmalloc(64, GFP_KERNEL);
270
        if (!status) {
271
                printk(KERN_ERR "%s: could not allocate a buffer for "
272
                        "switch capabilities.\n", mmc_hostname(card->host));
273
                return -ENOMEM;
274
        }
275
 
276
        err = mmc_sd_switch(card, 1, 0, 1, status);
277
        if (err)
278
                goto out;
279
 
280
        if ((status[16] & 0xF) != 1) {
281
                printk(KERN_WARNING "%s: Problem switching card "
282
                        "into high-speed mode!\n",
283
                        mmc_hostname(card->host));
284
        } else {
285
                mmc_card_set_highspeed(card);
286
                mmc_set_timing(card->host, MMC_TIMING_SD_HS);
287
        }
288
 
289
out:
290
        kfree(status);
291
 
292
        return err;
293
}
294
 
295
/*
296
 * Handle the detection and initialisation of a card.
297
 *
298
 * In the case of a resume, "curcard" will contain the card
299
 * we're trying to reinitialise.
300
 */
301
static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
302
        struct mmc_card *oldcard)
303
{
304
        struct mmc_card *card;
305
        int err;
306
        u32 cid[4];
307
        unsigned int max_dtr;
308
 
309
        BUG_ON(!host);
310
        WARN_ON(!host->claimed);
311
 
312
        /*
313
         * Since we're changing the OCR value, we seem to
314
         * need to tell some cards to go back to the idle
315
         * state.  We wait 1ms to give cards time to
316
         * respond.
317
         */
318
        mmc_go_idle(host);
319
 
320
        /*
321
         * If SD_SEND_IF_COND indicates an SD 2.0
322
         * compliant card and we should set bit 30
323
         * of the ocr to indicate that we can handle
324
         * block-addressed SDHC cards.
325
         */
326
        err = mmc_send_if_cond(host, ocr);
327
        if (!err)
328
                ocr |= 1 << 30;
329
 
330
        err = mmc_send_app_op_cond(host, ocr, NULL);
331
        if (err)
332
                goto err;
333
 
334
        /*
335
         * For SPI, enable CRC as appropriate.
336
         */
337
        if (mmc_host_is_spi(host)) {
338
                err = mmc_spi_set_crc(host, use_spi_crc);
339
                if (err)
340
                        goto err;
341
        }
342
 
343
        /*
344
         * Fetch CID from card.
345
         */
346
        if (mmc_host_is_spi(host))
347
                err = mmc_send_cid(host, cid);
348
        else
349
                err = mmc_all_send_cid(host, cid);
350
        if (err)
351
                goto err;
352
 
353
        if (oldcard) {
354
                if (memcmp(cid, oldcard->raw_cid, sizeof(cid)) != 0) {
355
                        err = -ENOENT;
356
                        goto err;
357
                }
358
 
359
                card = oldcard;
360
        } else {
361
                /*
362
                 * Allocate card structure.
363
                 */
364
                card = mmc_alloc_card(host);
365
                if (IS_ERR(card)) {
366
                        err = PTR_ERR(card);
367
                        goto err;
368
                }
369
 
370
                card->type = MMC_TYPE_SD;
371
                memcpy(card->raw_cid, cid, sizeof(card->raw_cid));
372
        }
373
 
374
        /*
375
         * For native busses:  get card RCA and quit open drain mode.
376
         */
377
        if (!mmc_host_is_spi(host)) {
378
                err = mmc_send_relative_addr(host, &card->rca);
379
                if (err)
380
                        goto free_card;
381
 
382
                mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
383
        }
384
 
385
        if (!oldcard) {
386
                /*
387
                 * Fetch CSD from card.
388
                 */
389
                err = mmc_send_csd(card, card->raw_csd);
390
                if (err)
391
                        goto free_card;
392
 
393
                err = mmc_decode_csd(card);
394
                if (err)
395
                        goto free_card;
396
 
397
                mmc_decode_cid(card);
398
        }
399
 
400
        /*
401
         * Select card, as all following commands rely on that.
402
         */
403
        if (!mmc_host_is_spi(host)) {
404
                err = mmc_select_card(card);
405
                if (err)
406
                        goto free_card;
407
        }
408
 
409
        if (!oldcard) {
410
                /*
411
                 * Fetch SCR from card.
412
                 */
413
                err = mmc_app_send_scr(card, card->raw_scr);
414
                if (err)
415
                        goto free_card;
416
 
417
                err = mmc_decode_scr(card);
418
                if (err < 0)
419
                        goto free_card;
420
 
421
                /*
422
                 * Fetch switch information from card.
423
                 */
424
                err = mmc_read_switch(card);
425
                if (err)
426
                        goto free_card;
427
        }
428
 
429
        /*
430
         * Attempt to change to high-speed (if supported)
431
         */
432
        err = mmc_switch_hs(card);
433
        if (err)
434
                goto free_card;
435
 
436
        /*
437
         * Compute bus speed.
438
         */
439
        max_dtr = (unsigned int)-1;
440
 
441
        if (mmc_card_highspeed(card)) {
442
                if (max_dtr > card->sw_caps.hs_max_dtr)
443
                        max_dtr = card->sw_caps.hs_max_dtr;
444
        } else if (max_dtr > card->csd.max_dtr) {
445
                max_dtr = card->csd.max_dtr;
446
        }
447
 
448
        mmc_set_clock(host, max_dtr);
449
 
450
        /*
451
         * Switch to wider bus (if supported).
452
         */
453
        if ((host->caps & MMC_CAP_4_BIT_DATA) &&
454
                (card->scr.bus_widths & SD_SCR_BUS_WIDTH_4)) {
455 81 tac2
                printk("Wide Bus\n");
456 62 marcus.erl
                err = mmc_app_set_bus_width(card, MMC_BUS_WIDTH_4);
457
                if (err)
458
                        goto free_card;
459
 
460
                mmc_set_bus_width(host, MMC_BUS_WIDTH_4);
461
        }
462
 
463
        /*
464
         * Check if read-only switch is active.
465
         */
466
        if (!oldcard) {
467
                if (!host->ops->get_ro) {
468
                        printk(KERN_WARNING "%s: host does not "
469
                                "support reading read-only "
470
                                "switch. assuming write-enable.\n",
471
                                mmc_hostname(host));
472
                } else {
473
                        if (host->ops->get_ro(host))
474
                                mmc_card_set_readonly(card);
475
                }
476
        }
477
 
478
        if (!oldcard)
479
                host->card = card;
480
 
481
        return 0;
482
 
483
free_card:
484
        if (!oldcard)
485
                mmc_remove_card(card);
486
err:
487
 
488
        return err;
489
}
490
 
491
/*
492
 * Host is being removed. Free up the current card.
493
 */
494
static void mmc_sd_remove(struct mmc_host *host)
495
{
496
        BUG_ON(!host);
497
        BUG_ON(!host->card);
498
 
499
        mmc_remove_card(host->card);
500
        host->card = NULL;
501
}
502
 
503
/*
504
 * Card detection callback from host.
505
 */
506
static void mmc_sd_detect(struct mmc_host *host)
507
{
508
        int err;
509
 
510
        BUG_ON(!host);
511
        BUG_ON(!host->card);
512
 
513
        mmc_claim_host(host);
514
 
515
        /*
516
         * Just check if our card has been removed.
517
         */
518
        err = mmc_send_status(host->card, NULL);
519
 
520
        mmc_release_host(host);
521
 
522
        if (err) {
523
                mmc_sd_remove(host);
524
 
525
                mmc_claim_host(host);
526
                mmc_detach_bus(host);
527
                mmc_release_host(host);
528
        }
529
}
530
 
531
MMC_ATTR_FN(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1],
532
        card->raw_cid[2], card->raw_cid[3]);
533
MMC_ATTR_FN(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1],
534
        card->raw_csd[2], card->raw_csd[3]);
535
MMC_ATTR_FN(scr, "%08x%08x\n", card->raw_scr[0], card->raw_scr[1]);
536
MMC_ATTR_FN(date, "%02d/%04d\n", card->cid.month, card->cid.year);
537
MMC_ATTR_FN(fwrev, "0x%x\n", card->cid.fwrev);
538
MMC_ATTR_FN(hwrev, "0x%x\n", card->cid.hwrev);
539
MMC_ATTR_FN(manfid, "0x%06x\n", card->cid.manfid);
540
MMC_ATTR_FN(name, "%s\n", card->cid.prod_name);
541
MMC_ATTR_FN(oemid, "0x%04x\n", card->cid.oemid);
542
MMC_ATTR_FN(serial, "0x%08x\n", card->cid.serial);
543
 
544
static struct device_attribute mmc_sd_dev_attrs[] = {
545
        MMC_ATTR_RO(cid),
546
        MMC_ATTR_RO(csd),
547
        MMC_ATTR_RO(scr),
548
        MMC_ATTR_RO(date),
549
        MMC_ATTR_RO(fwrev),
550
        MMC_ATTR_RO(hwrev),
551
        MMC_ATTR_RO(manfid),
552
        MMC_ATTR_RO(name),
553
        MMC_ATTR_RO(oemid),
554
        MMC_ATTR_RO(serial),
555
        __ATTR_NULL,
556
};
557
 
558
/*
559
 * Adds sysfs entries as relevant.
560
 */
561
static int mmc_sd_sysfs_add(struct mmc_host *host, struct mmc_card *card)
562
{
563
        int ret;
564
 
565
        ret = mmc_add_attrs(card, mmc_sd_dev_attrs);
566
        if (ret < 0)
567
                return ret;
568
 
569
        return 0;
570
}
571
 
572
/*
573
 * Removes the sysfs entries added by mmc_sysfs_add().
574
 */
575
static void mmc_sd_sysfs_remove(struct mmc_host *host, struct mmc_card *card)
576
{
577
        mmc_remove_attrs(card, mmc_sd_dev_attrs);
578
}
579
 
580
#ifdef CONFIG_MMC_UNSAFE_RESUME
581
 
582
/*
583
 * Suspend callback from host.
584
 */
585
static void mmc_sd_suspend(struct mmc_host *host)
586
{
587
        BUG_ON(!host);
588
        BUG_ON(!host->card);
589
 
590
        mmc_claim_host(host);
591
        if (!mmc_host_is_spi(host))
592
                mmc_deselect_cards(host);
593
        host->card->state &= ~MMC_STATE_HIGHSPEED;
594
        mmc_release_host(host);
595
}
596
 
597
/*
598
 * Resume callback from host.
599
 *
600
 * This function tries to determine if the same card is still present
601
 * and, if so, restore all state to it.
602
 */
603
static void mmc_sd_resume(struct mmc_host *host)
604
{
605
        int err;
606
 
607
        BUG_ON(!host);
608
        BUG_ON(!host->card);
609
 
610
        mmc_claim_host(host);
611
        err = mmc_sd_init_card(host, host->ocr, host->card);
612
        mmc_release_host(host);
613
 
614
        if (err) {
615
                mmc_sd_remove(host);
616
 
617
                mmc_claim_host(host);
618
                mmc_detach_bus(host);
619
                mmc_release_host(host);
620
        }
621
 
622
}
623
 
624
#else
625
 
626
#define mmc_sd_suspend NULL
627
#define mmc_sd_resume NULL
628
 
629
#endif
630
 
631
static const struct mmc_bus_ops mmc_sd_ops = {
632
        .remove = mmc_sd_remove,
633
        .detect = mmc_sd_detect,
634
        .sysfs_add = mmc_sd_sysfs_add,
635
        .sysfs_remove = mmc_sd_sysfs_remove,
636
        .suspend = mmc_sd_suspend,
637
        .resume = mmc_sd_resume,
638
};
639
 
640
/*
641
 * Starting point for SD card init.
642
 */
643
int mmc_attach_sd(struct mmc_host *host, u32 ocr)
644
{
645
        int err;
646
 
647
        BUG_ON(!host);
648
        WARN_ON(!host->claimed);
649
 
650
        mmc_attach_bus(host, &mmc_sd_ops);
651
 
652
        /*
653
         * We need to get OCR a different way for SPI.
654
         */
655
        if (mmc_host_is_spi(host)) {
656
                mmc_go_idle(host);
657
 
658
                err = mmc_spi_read_ocr(host, 0, &ocr);
659
                if (err)
660
                        goto err;
661
        }
662
 
663
        /*
664
         * Sanity check the voltages that the card claims to
665
         * support.
666
         */
667
        if (ocr & 0x7F) {
668
                printk(KERN_WARNING "%s: card claims to support voltages "
669
                       "below the defined range. These will be ignored.\n",
670
                       mmc_hostname(host));
671
                ocr &= ~0x7F;
672
        }
673
 
674
        if (ocr & MMC_VDD_165_195) {
675
                printk(KERN_WARNING "%s: SD card claims to support the "
676
                       "incompletely defined 'low voltage range'. This "
677
                       "will be ignored.\n", mmc_hostname(host));
678
                ocr &= ~MMC_VDD_165_195;
679
        }
680
 
681
        host->ocr = mmc_select_voltage(host, ocr);
682
 
683
        /*
684
         * Can we support the voltage(s) of the card(s)?
685
         */
686
        if (!host->ocr) {
687
                err = -EINVAL;
688
                goto err;
689
        }
690
 
691
        /*
692
         * Detect and init the card.
693
         */
694
        err = mmc_sd_init_card(host, host->ocr, NULL);
695
        if (err)
696
                goto err;
697
 
698
        mmc_release_host(host);
699
 
700
        err = mmc_add_card(host->card);
701
        if (err)
702
                goto remove_card;
703
 
704
        return 0;
705
 
706
remove_card:
707
        mmc_remove_card(host->card);
708
        host->card = NULL;
709
        mmc_claim_host(host);
710
err:
711
        mmc_detach_bus(host);
712
        mmc_release_host(host);
713
 
714
        printk(KERN_ERR "%s: error %d whilst initialising SD card\n",
715
                mmc_hostname(host), err);
716
 
717
        return err;
718
}
719
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.