spi-topcliff-pch: Fix issue for transmitting over 4KByte
[zen-stable.git] / arch / arm / plat-mxc / devices / platform-mxc-mmc.c
blob540d3a7d92dfaacf8fd82cbd745327c7d2e094a9
1 /*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9 #include <linux/dma-mapping.h>
10 #include <mach/hardware.h>
11 #include <mach/devices-common.h>
13 #define imx_mxc_mmc_data_entry_single(soc, _id, _hwid, _size) \
14 { \
15 .id = _id, \
16 .iobase = soc ## _SDHC ## _hwid ## _BASE_ADDR, \
17 .iosize = _size, \
18 .irq = soc ## _INT_SDHC ## _hwid, \
19 .dmareq = soc ## _DMA_REQ_SDHC ## _hwid, \
21 #define imx_mxc_mmc_data_entry(soc, _id, _hwid, _size) \
22 [_id] = imx_mxc_mmc_data_entry_single(soc, _id, _hwid, _size)
24 #ifdef CONFIG_SOC_IMX21
25 const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst = {
26 #define imx21_mxc_mmc_data_entry(_id, _hwid) \
27 imx_mxc_mmc_data_entry(MX21, _id, _hwid, SZ_4K)
28 imx21_mxc_mmc_data_entry(0, 1),
29 imx21_mxc_mmc_data_entry(1, 2),
31 #endif /* ifdef CONFIG_SOC_IMX21 */
33 #ifdef CONFIG_SOC_IMX27
34 const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst = {
35 #define imx27_mxc_mmc_data_entry(_id, _hwid) \
36 imx_mxc_mmc_data_entry(MX27, _id, _hwid, SZ_4K)
37 imx27_mxc_mmc_data_entry(0, 1),
38 imx27_mxc_mmc_data_entry(1, 2),
40 #endif /* ifdef CONFIG_SOC_IMX27 */
42 #ifdef CONFIG_SOC_IMX31
43 const struct imx_mxc_mmc_data imx31_mxc_mmc_data[] __initconst = {
44 #define imx31_mxc_mmc_data_entry(_id, _hwid) \
45 imx_mxc_mmc_data_entry(MX31, _id, _hwid, SZ_16K)
46 imx31_mxc_mmc_data_entry(0, 1),
47 imx31_mxc_mmc_data_entry(1, 2),
49 #endif /* ifdef CONFIG_SOC_IMX31 */
51 struct platform_device *__init imx_add_mxc_mmc(
52 const struct imx_mxc_mmc_data *data,
53 const struct imxmmc_platform_data *pdata)
55 struct resource res[] = {
57 .start = data->iobase,
58 .end = data->iobase + SZ_4K - 1,
59 .flags = IORESOURCE_MEM,
60 }, {
61 .start = data->irq,
62 .end = data->irq,
63 .flags = IORESOURCE_IRQ,
64 }, {
65 .start = data->dmareq,
66 .end = data->dmareq,
67 .flags = IORESOURCE_DMA,
70 return imx_add_platform_device_dmamask("mxc-mmc", data->id,
71 res, ARRAY_SIZE(res),
72 pdata, sizeof(*pdata), DMA_BIT_MASK(32));