Skip to content

Commit 64d3954

Browse files
weiszgpopcornmix
authored andcommitted
MMC: added alternative MMC driver
mmc: Disable CMD23 transfers on all cards Pending wire-level investigation of these types of transfers and associated errors on bcm2835-mmc, disable for now. Fallback of CMD18/CMD25 transfers will be used automatically by the MMC layer. Reported/Tested-by: Gellert Weisz <[email protected]> mmc: bcm2835-mmc: enable DT support for all architectures Both ARCH_BCM2835 and ARCH_BCM270x are built with OF now. Enable Device Tree support for all architectures. Signed-off-by: Noralf Trønnes <[email protected]> mmc: bcm2835-mmc: fix probe error handling Probe error handling is broken in several places. Simplify error handling by using device managed functions. Replace pr_{err,info} with dev_{err,info}. Signed-off-by: Noralf Trønnes <[email protected]> bcm2835-mmc: Add locks when accessing sdhost registers bcm2835-mmc: Add range of debug options for slowing things down bcm2835-mmc: Add option to disable some delays bcm2835-mmc: Add option to disable MMC_QUIRK_BLK_NO_CMD23 bcm2835-mmc: Default to disabling MMC_QUIRK_BLK_NO_CMD23 bcm2835-mmc: Adding overclocking option Allow a different clock speed to be substitued for a requested 50MHz. This option is exposed using the "overclock_50" DT parameter. Note that the mmc interface is restricted to EVEN integer divisions of 250MHz, and the highest sensible option is 63 (250/4 = 62.5), the next being 125 (250/2) which is much too high. Use at your own risk. bcm2835-mmc: Round up the overclock, so 62 works for 62.5Mhz Also only warn once for each overclock setting. mmc: bcm2835-mmc: Make available on ARCH_BCM2835 Make the bcm2835-mmc driver available for use on ARCH_BCM2835. Signed-off-by: Noralf Trønnes <[email protected]> BCM270x_DT: add bcm2835-mmc entry Add Device Tree entry for bcm2835-mmc. In non-DT mode, don't add the device in the board file. Signed-off-by: Noralf Trønnes <[email protected]> bcm2835-mmc: Don't overwrite MMC capabilities from DT
1 parent 5826647 commit 64d3954

File tree

6 files changed

+1659
-2
lines changed

6 files changed

+1659
-2
lines changed

arch/arm/mach-bcm2708/bcm2708.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,34 @@ static struct platform_device bcm2708_gpio_device = {
390390
};
391391
#endif
392392

393+
#ifdef CONFIG_MMC_BCM2835 /* Arasan emmc SD (new) */
394+
static struct resource bcm2835_emmc_resources[] = {
395+
[0] = {
396+
.start = EMMC_BASE,
397+
.end = EMMC_BASE + SZ_256 - 1, /* we only need this area */
398+
/* the memory map actually makes SZ_4K available */
399+
.flags = IORESOURCE_MEM,
400+
},
401+
[1] = {
402+
.start = IRQ_ARASANSDIO,
403+
.end = IRQ_ARASANSDIO,
404+
.flags = IORESOURCE_IRQ,
405+
},
406+
};
407+
408+
static u64 bcm2835_emmc_dmamask = 0xffffffffUL;
409+
410+
struct platform_device bcm2835_emmc_device = {
411+
.name = "mmc-bcm2835",
412+
.id = 0,
413+
.num_resources = ARRAY_SIZE(bcm2835_emmc_resources),
414+
.resource = bcm2835_emmc_resources,
415+
.dev = {
416+
.dma_mask = &bcm2835_emmc_dmamask,
417+
.coherent_dma_mask = 0xffffffffUL},
418+
};
419+
#endif /* CONFIG_MMC_BCM2835 */
420+
393421
int __init bcm_register_device(struct platform_device *pdev)
394422
{
395423
int ret;
@@ -526,6 +554,9 @@ void __init bcm2708_init(void)
526554
bcm_register_device_dt(&bcm2708_fb_device);
527555
bcm_register_device_dt(&bcm2708_usb_device);
528556

557+
#ifdef CONFIG_MMC_BCM2835
558+
bcm_register_device_dt(&bcm2835_emmc_device);
559+
#endif
529560
bcm2708_init_led();
530561
bcm2708_init_uart1();
531562

arch/arm/mach-bcm2709/bcm2709.c

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,34 @@ static struct platform_device bcm2708_gpio_device = {
406406
};
407407
#endif
408408

409+
#ifdef CONFIG_MMC_BCM2835 /* Arasan emmc SD (new) */
410+
static struct resource bcm2835_emmc_resources[] = {
411+
[0] = {
412+
.start = EMMC_BASE,
413+
.end = EMMC_BASE + SZ_256 - 1, /* we only need this area */
414+
/* the memory map actually makes SZ_4K available */
415+
.flags = IORESOURCE_MEM,
416+
},
417+
[1] = {
418+
.start = IRQ_ARASANSDIO,
419+
.end = IRQ_ARASANSDIO,
420+
.flags = IORESOURCE_IRQ,
421+
},
422+
};
423+
424+
static u64 bcm2835_emmc_dmamask = 0xffffffffUL;
425+
426+
struct platform_device bcm2835_emmc_device = {
427+
.name = "mmc-bcm2835",
428+
.id = 0,
429+
.num_resources = ARRAY_SIZE(bcm2835_emmc_resources),
430+
.resource = bcm2835_emmc_resources,
431+
.dev = {
432+
.dma_mask = &bcm2835_emmc_dmamask,
433+
.coherent_dma_mask = 0xffffffffUL},
434+
};
435+
#endif /* CONFIG_MMC_BCM2835 */
436+
409437
int __init bcm_register_device(struct platform_device *pdev)
410438
{
411439
int ret;
@@ -543,8 +571,11 @@ void __init bcm2709_init(void)
543571
bcm_register_device_dt(&bcm2708_fb_device);
544572
bcm_register_device_dt(&bcm2708_usb_device);
545573

546-
bcm2708_init_led();
547-
bcm2708_init_uart1();
574+
#ifdef CONFIG_MMC_BCM2835
575+
bcm_register_device_dt(&bcm2835_emmc_device);
576+
#endif
577+
bcm2709_init_led();
578+
bcm2709_init_uart1();
548579

549580
if (!use_dt) {
550581
for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {

drivers/mmc/core/quirks.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ static const struct mmc_fixup mmc_fixup_methods[] = {
7171

7272
void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
7373
{
74+
extern unsigned mmc_debug;
7475
const struct mmc_fixup *f;
7576
u64 rev = cid_rev_card(card);
7677

@@ -95,5 +96,10 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table)
9596
f->vendor_fixup(card, f->data);
9697
}
9798
}
99+
/* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail.
100+
* Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers).
101+
*/
102+
if (mmc_debug & (1<<13))
103+
card->quirks |= MMC_QUIRK_BLK_NO_CMD23;
98104
}
99105
EXPORT_SYMBOL(mmc_fixup_device);

drivers/mmc/host/Kconfig

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,35 @@
44

55
comment "MMC/SD/SDIO Host Controller Drivers"
66

7+
config MMC_BCM2835
8+
tristate "MMC support on BCM2835"
9+
depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835
10+
help
11+
This selects the MMC Interface on BCM2835.
12+
13+
If you have a controller with this interface, say Y or M here.
14+
15+
If unsure, say N.
16+
17+
config MMC_BCM2835_DMA
18+
bool "DMA support on BCM2835 Arasan controller"
19+
depends on MMC_BCM2835
20+
help
21+
Enable DMA support on the Arasan SDHCI controller in Broadcom 2708
22+
based chips.
23+
24+
If unsure, say N.
25+
26+
config MMC_BCM2835_PIO_DMA_BARRIER
27+
int "Block count limit for PIO transfers"
28+
depends on MMC_BCM2835 && MMC_BCM2835_DMA
29+
range 0 256
30+
default 2
31+
help
32+
The inclusive limit in bytes under which PIO will be used instead of DMA
33+
34+
If unsure, say 2 here.
35+
736
config MMC_ARMMMCI
837
tristate "ARM AMBA Multimedia Card Interface support"
938
depends on ARM_AMBA

drivers/mmc/host/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o
1818
obj-$(CONFIG_MMC_SDHCI_SIRF) += sdhci-sirf.o
1919
obj-$(CONFIG_MMC_SDHCI_F_SDH30) += sdhci_f_sdh30.o
2020
obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o
21+
obj-$(CONFIG_MMC_BCM2835) += bcm2835-mmc.o
2122
obj-$(CONFIG_MMC_WBSD) += wbsd.o
2223
obj-$(CONFIG_MMC_AU1X) += au1xmmc.o
2324
obj-$(CONFIG_MMC_MTK) += mtk-sd.o

0 commit comments

Comments
 (0)