Skip to content

Commit 495e54e

Browse files
committed
Merge pull request #652 from weiszg/rpi-3.12.y
add alternative MMC driver and support scatter/gather transfers in dmaengine
2 parents f03cd5e + ded75ff commit 495e54e

File tree

9 files changed

+2285
-188
lines changed

9 files changed

+2285
-188
lines changed

arch/arm/configs/bcmrpi_defconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,9 @@ CONFIG_USB_ISIGHTFW=m
897897
CONFIG_USB_YUREX=m
898898
CONFIG_MMC=y
899899
CONFIG_MMC_BLOCK_MINORS=32
900+
CONFIG_MMC_BCM2835=y
901+
CONFIG_MMC_BCM2835_DMA=y
902+
CONFIG_MMC_BCM2835_PIO_DMA_BARRIER=2
900903
CONFIG_MMC_SDHCI=y
901904
CONFIG_MMC_SDHCI_PLTFM=y
902905
CONFIG_MMC_SDHCI_BCM2708=y
@@ -946,7 +949,7 @@ CONFIG_RTC_DRV_DS3234=m
946949
CONFIG_RTC_DRV_PCF2123=m
947950
CONFIG_RTC_DRV_RX4581=m
948951
CONFIG_DMADEVICES=y
949-
CONFIG_DMA_BCM2708=m
952+
CONFIG_DMA_BCM2708=y
950953
CONFIG_UIO=m
951954
CONFIG_UIO_PDRV_GENIRQ=m
952955
CONFIG_STAGING=y

arch/arm/mach-bcm2708/bcm2708.c

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ static unsigned disk_led_active_low = 1;
9090
static unsigned reboot_part = 0;
9191
static unsigned w1_gpio_pin = W1_GPIO;
9292
static unsigned w1_gpio_pullup = W1_PULLUP;
93+
static unsigned bcm2835_mmc = 0;
9394

9495
static void __init bcm2708_init_led(void);
9596

@@ -452,6 +453,34 @@ struct platform_device bcm2708_emmc_device = {
452453
};
453454
#endif /* CONFIG_MMC_SDHCI_BCM2708 */
454455

456+
#ifdef CONFIG_MMC_BCM2835 /* Arasan emmc SD (new) */
457+
static struct resource bcm2835_emmc_resources[] = {
458+
[0] = {
459+
.start = EMMC_BASE,
460+
.end = EMMC_BASE + SZ_256 - 1, /* we only need this area */
461+
/* the memory map actually makes SZ_4K available */
462+
.flags = IORESOURCE_MEM,
463+
},
464+
[1] = {
465+
.start = IRQ_ARASANSDIO,
466+
.end = IRQ_ARASANSDIO,
467+
.flags = IORESOURCE_IRQ,
468+
},
469+
};
470+
471+
static u64 bcm2835_emmc_dmamask = 0xffffffffUL;
472+
473+
struct platform_device bcm2835_emmc_device = {
474+
.name = "mmc-bcm2835",
475+
.id = 0,
476+
.num_resources = ARRAY_SIZE(bcm2835_emmc_resources),
477+
.resource = bcm2835_emmc_resources,
478+
.dev = {
479+
.dma_mask = &bcm2835_emmc_dmamask,
480+
.coherent_dma_mask = 0xffffffffUL},
481+
};
482+
#endif /* CONFIG_MMC_BCM2835 */
483+
455484
static struct resource bcm2708_powerman_resources[] = {
456485
[0] = {
457486
.start = PM_BASE,
@@ -820,7 +849,12 @@ void __init bcm2708_init(void)
820849
bcm_register_device(&bcm2708_powerman_device);
821850

822851
#ifdef CONFIG_MMC_SDHCI_BCM2708
823-
bcm_register_device(&bcm2708_emmc_device);
852+
if (!bcm2835_mmc)
853+
bcm_register_device(&bcm2708_emmc_device);
854+
#endif
855+
#ifdef CONFIG_MMC_BCM2835
856+
if (bcm2835_mmc)
857+
bcm_register_device(&bcm2835_emmc_device);
824858
#endif
825859
bcm2708_init_led();
826860
for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++)
@@ -1049,3 +1083,4 @@ module_param(disk_led_active_low, uint, 0644);
10491083
module_param(reboot_part, uint, 0644);
10501084
module_param(w1_gpio_pin, uint, 0644);
10511085
module_param(w1_gpio_pullup, uint, 0644);
1086+
module_param(bcm2835_mmc, uint, 0644);

arch/arm/mach-bcm2708/dma.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ static void vc_dmaman_init(struct vc_dmaman *dmaman, void __iomem *dma_base,
156156
dmaman->chan_available = chans_available;
157157
dmaman->has_feature[BCM_DMA_FEATURE_FAST_ORD] = 0x0c; /* chans 2 & 3 */
158158
dmaman->has_feature[BCM_DMA_FEATURE_BULK_ORD] = 0x01; /* chan 0 */
159+
dmaman->has_feature[BCM_DMA_FEATURE_NORMAL_ORD] = 0xfe; /* chans 1 to 7 */
160+
dmaman->has_feature[BCM_DMA_FEATURE_LITE_ORD] = 0x7f00; /* chans 8 to 14 */
159161
}
160162

161163
static int vc_dmaman_chan_alloc(struct vc_dmaman *dmaman,

arch/arm/mach-bcm2708/include/mach/dma.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@ extern int /*rc*/ bcm_dma_abort(void __iomem *dma_chan_base);
7777
those with higher priority smaller ordinal numbers */
7878
#define BCM_DMA_FEATURE_FAST_ORD 0
7979
#define BCM_DMA_FEATURE_BULK_ORD 1
80+
#define BCM_DMA_FEATURE_NORMAL_ORD 2
81+
#define BCM_DMA_FEATURE_LITE_ORD 3
8082
#define BCM_DMA_FEATURE_FAST (1<<BCM_DMA_FEATURE_FAST_ORD)
8183
#define BCM_DMA_FEATURE_BULK (1<<BCM_DMA_FEATURE_BULK_ORD)
82-
#define BCM_DMA_FEATURE_COUNT 2
84+
#define BCM_DMA_FEATURE_NORMAL (1<<BCM_DMA_FEATURE_NORMAL_ORD)
85+
#define BCM_DMA_FEATURE_LITE (1<<BCM_DMA_FEATURE_LITE_ORD)
86+
#define BCM_DMA_FEATURE_COUNT 4
8387

8488
/* return channel no or -ve error */
8589
extern int bcm_dma_chan_alloc(unsigned preferred_feature_set,

0 commit comments

Comments
 (0)