atmel-mci: change use of dma slave interface
Subsystems (6)
Arm (32-bit) Arm sub-architectures MMC, SD and SDIO Arm/Microchip (AT91) SoC support +2 more subsystems
PATCH 178/196 atmel-mci: change use of dma slave interface
From: Nicolas Ferre <[email protected]>
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 <[email protected]>
Cc Haavard Skinnemoen <[email protected]>
Cc <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
arch/arm/mach-at91/include/mach/atmel-mci.h | 24 ++++++ arch/avr32/mach-at32ap/at32ap700x.c | 18 +++- arch/avr32/mach-at32ap/include/mach/atmel-mci.h | 24 ++++++ drivers/mmc/host/atmel-mci.c | 56 +++++++++----- include/linux/atmel-mci.h | 4 - 5 files changed, 98 insertions(+), 28 deletions(-)
arch/arm/mach-at91/include/mach/atmel-mci.h new file +24 -0
@@ -0,0 +1,24 @@ +#ifndef __MACH_ATMEL_MCI_H +#define __MACH_ATMEL_MCI_H + +#include <mach/at_hdmac.h> + +/** +* struct mci_dma_data - DMA data for MCI interface +*/ +struct mci_dma_data { +struct at_dma_slave sdata; +}; + +/* accessor macros */ +#define slave_data_ptr (s) (&(s)->sdata) +#define find_slave_dev (s) ((s)->sdata.dma_dev) + +#define setup_dma_addr (s, t, r) do { \ + if (s) { \ + (s)->sdata.tx_reg = (t); \ + (s)->sdata.rx_reg = (r); \ + } \ +} while (0) + +#endif /* __MACH_ATMEL_MCI_H */
arch/avr32/mach-at32ap/at32ap700x.c renamed from arch/avr32/mach-at32ap/at32ap700x.c~atmel-mci-change-use-of-dma-slave-interface +13 -5
@@ -15,6 +15,8 @@#include <linux/gpio.h> #include <linux/spi/spi.h> #include <linux/usb/atmel_usba_udc.h> + +#include <mach/atmel-mci.h> #include <linux/atmel-mci.h> #include <asm/io.h>
@@ -1320,7 +1322,7 @@ struct platform_device *__init at32_add_device_mci(unsigned int id, struct mci_platform_data *data) { struct platform_device *pdev; -struct dw_dma_slave *dws = &data->dma_slave; +struct mci_dma_slave *slave;u32 pioa_mask;u32 piob_mask;
@@ -1339,13 +1341,17 @@ at32_add_device_mci(unsigned int id, str ARRAY_SIZE(atmel_mci0_resource))) goto fail; - dws->dma_dev = &dw_dmac0_device.dev; - dws->reg_width =DW_DMA_SLAVE_WIDTH_32BIT ; - dws->cfg_hi = (DWC_CFGH_SRC_PER (0 ) + slave =kzalloc (sizeof (struct mci_dma_slave ),GFP_KERNEL ); + + slave->sdata.dma_dev = &dw_dmac0_device.dev; + slave->sdata.reg_width =DW_DMA_SLAVE_WIDTH_32BIT ; + slave->sdata.cfg_hi = (DWC_CFGH_SRC_PER (0 ) |DWC_CFGH_DST_PER (1 )); - dws->cfg_lo &= ~(DWC_CFGL_HS_DST_POL + slave->sdata.cfg_lo &= ~(DWC_CFGL_HS_DST_POL |DWC_CFGL_HS_SRC_POL ); + data->dma_slave = slave; +if (platform_device_add_data (pdev, data,sizeof (struct mci_platform_data ))) goto fail;
@@ -1411,6 +1417,8 @@ at32_add_device_mci(unsigned int id, strreturn pdev; fail: + data->dma_slave =NULL ; +kfree (slave);platform_device_put (pdev);return NULL ; }
arch/avr32/mach-at32ap/include/mach/atmel-mci.h new file +24 -0
@@ -0,0 +1,24 @@ +#ifndef __MACH_ATMEL_MCI_H +#define __MACH_ATMEL_MCI_H + +#include <linux/dw_dmac.h> + +/** +* struct mci_dma_data - DMA data for MCI interface +*/ +struct mci_dma_data { +struct dw_dma_slave sdata; +}; + +/* accessor macros */ +#define slave_data_ptr (s) (&(s)->sdata) +#define find_slave_dev (s) ((s)->sdata.dma_dev) + +#define setup_dma_addr (s, t, r) do { \ + if (s) { \ + (s)->sdata.tx_reg = (t); \ + (s)->sdata.rx_reg = (r); \ + } \ +} while (0) + +#endif /* __MACH_ATMEL_MCI_H */
drivers/mmc/host/atmel-mci.c renamed from drivers/mmc/host/atmel-mci.c~atmel-mci-change-use-of-dma-slave-interface +36 -20
78 lines not on this page · raw message
include/linux/atmel-mci.h renamed from include/linux/atmel-mci.h~atmel-mci-change-use-of-dma-slave-interface +1 -3
@@ -3,8 +3,6 @@#define ATMEL_MCI_MAX_NR_SLOTS 2 -#include <linux/dw_dmac.h> -/** * struct mci_slot_pdata - board-specific per-slot configuration * @bus_width: Number of data lines wired up the slot
@@ -34,7 +32,7 @@ struct mci_slot_pdata {* @slot: Per-slot configuration data. */ struct mci_platform_data { -struct dw_dma_slave dma_slave; +struct mci_dma_data *dma_slave;struct mci_slot_pdata slot[ATMEL_MCI_MAX_NR_SLOTS ]; };
_