diff options
author | Nicolas Ferre <nicolas.ferre@atmel.com> | 2009-12-14 21:01:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-15 11:53:35 -0500 |
commit | 2635d1ba711560d521f6218c585a3e0401f566e1 (patch) | |
tree | 11c8f09f15cd2f19bfd6f2d2d9b2cac67544179f /arch/avr32/mach-at32ap/at32ap700x.c | |
parent | bd68e0838fe85794b06892054772fa013a8d1986 (diff) |
atmel-mci: change use of dma slave interface
Allow the use of another DMA controller driver in atmel-mci sd/mmc driver.
This adds a generic dma_slave pointer to the mci platform structure where
we can store DMA controller information. In atmel-mci we use information
provided by this structure to initialize the driver (with new helper
functions that are architecture dependant).
This also adds at32/avr32 chip modifications to cope with this new access
method.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/avr32/mach-at32ap/at32ap700x.c')
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap700x.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index eb9d4dc2e86d..b40ff39e0ac8 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/gpio.h> | 15 | #include <linux/gpio.h> |
16 | #include <linux/spi/spi.h> | 16 | #include <linux/spi/spi.h> |
17 | #include <linux/usb/atmel_usba_udc.h> | 17 | #include <linux/usb/atmel_usba_udc.h> |
18 | |||
19 | #include <mach/atmel-mci.h> | ||
18 | #include <linux/atmel-mci.h> | 20 | #include <linux/atmel-mci.h> |
19 | 21 | ||
20 | #include <asm/io.h> | 22 | #include <asm/io.h> |
@@ -1320,7 +1322,7 @@ struct platform_device *__init | |||
1320 | at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | 1322 | at32_add_device_mci(unsigned int id, struct mci_platform_data *data) |
1321 | { | 1323 | { |
1322 | struct platform_device *pdev; | 1324 | struct platform_device *pdev; |
1323 | struct dw_dma_slave *dws = &data->dma_slave; | 1325 | struct mci_dma_slave *slave; |
1324 | u32 pioa_mask; | 1326 | u32 pioa_mask; |
1325 | u32 piob_mask; | 1327 | u32 piob_mask; |
1326 | 1328 | ||
@@ -1339,13 +1341,17 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | |||
1339 | ARRAY_SIZE(atmel_mci0_resource))) | 1341 | ARRAY_SIZE(atmel_mci0_resource))) |
1340 | goto fail; | 1342 | goto fail; |
1341 | 1343 | ||
1342 | dws->dma_dev = &dw_dmac0_device.dev; | 1344 | slave = kzalloc(sizeof(struct mci_dma_slave), GFP_KERNEL); |
1343 | dws->reg_width = DW_DMA_SLAVE_WIDTH_32BIT; | 1345 | |
1344 | dws->cfg_hi = (DWC_CFGH_SRC_PER(0) | 1346 | slave->sdata.dma_dev = &dw_dmac0_device.dev; |
1347 | slave->sdata.reg_width = DW_DMA_SLAVE_WIDTH_32BIT; | ||
1348 | slave->sdata.cfg_hi = (DWC_CFGH_SRC_PER(0) | ||
1345 | | DWC_CFGH_DST_PER(1)); | 1349 | | DWC_CFGH_DST_PER(1)); |
1346 | dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL | 1350 | slave->sdata.cfg_lo &= ~(DWC_CFGL_HS_DST_POL |
1347 | | DWC_CFGL_HS_SRC_POL); | 1351 | | DWC_CFGL_HS_SRC_POL); |
1348 | 1352 | ||
1353 | data->dma_slave = slave; | ||
1354 | |||
1349 | if (platform_device_add_data(pdev, data, | 1355 | if (platform_device_add_data(pdev, data, |
1350 | sizeof(struct mci_platform_data))) | 1356 | sizeof(struct mci_platform_data))) |
1351 | goto fail; | 1357 | goto fail; |
@@ -1411,6 +1417,8 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data) | |||
1411 | return pdev; | 1417 | return pdev; |
1412 | 1418 | ||
1413 | fail: | 1419 | fail: |
1420 | data->dma_slave = NULL; | ||
1421 | kfree(slave); | ||
1414 | platform_device_put(pdev); | 1422 | platform_device_put(pdev); |
1415 | return NULL; | 1423 | return NULL; |
1416 | } | 1424 | } |