Commit 4969c32b authored by Boojin Kim's avatar Boojin Kim Committed by Kukjin Kim

spi/s3c64xx: Add the use of DMA config operation

Config operation is separated from request operation in
DMA common operation. Because spi driver can change the
DMA config for every transfer. So this patch is using the
separated DMA config operation.
Signed-off-by: default avatarBoojin Kim <boojin.kim@samsung.com>
Signed-off-by: default avatarKyoungil Kim <ki0351.kim@samsung.com>
Signed-off-by: default avatarKukjin Kim <kgene.kim@samsung.com>
parent fbb20e81
...@@ -262,14 +262,24 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma, ...@@ -262,14 +262,24 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma,
unsigned len, dma_addr_t buf) unsigned len, dma_addr_t buf)
{ {
struct s3c64xx_spi_driver_data *sdd; struct s3c64xx_spi_driver_data *sdd;
struct samsung_dma_prep_info info; struct samsung_dma_prep info;
struct samsung_dma_config config;
if (dma->direction == DMA_DEV_TO_MEM) if (dma->direction == DMA_DEV_TO_MEM) {
sdd = container_of((void *)dma, sdd = container_of((void *)dma,
struct s3c64xx_spi_driver_data, rx_dma); struct s3c64xx_spi_driver_data, rx_dma);
else config.direction = sdd->rx_dma.direction;
config.fifo = sdd->sfr_start + S3C64XX_SPI_RX_DATA;
config.width = sdd->cur_bpw / 8;
sdd->ops->config(sdd->rx_dma.ch, &config);
} else {
sdd = container_of((void *)dma, sdd = container_of((void *)dma,
struct s3c64xx_spi_driver_data, tx_dma); struct s3c64xx_spi_driver_data, tx_dma);
config.direction = sdd->tx_dma.direction;
config.fifo = sdd->sfr_start + S3C64XX_SPI_TX_DATA;
config.width = sdd->cur_bpw / 8;
sdd->ops->config(sdd->tx_dma.ch, &config);
}
info.cap = DMA_SLAVE; info.cap = DMA_SLAVE;
info.len = len; info.len = len;
...@@ -284,20 +294,15 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma, ...@@ -284,20 +294,15 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma,
static int acquire_dma(struct s3c64xx_spi_driver_data *sdd) static int acquire_dma(struct s3c64xx_spi_driver_data *sdd)
{ {
struct samsung_dma_info info; struct samsung_dma_req req;
sdd->ops = samsung_dma_get_ops(); sdd->ops = samsung_dma_get_ops();
info.cap = DMA_SLAVE; req.cap = DMA_SLAVE;
info.client = &s3c64xx_spi_dma_client; req.client = &s3c64xx_spi_dma_client;
info.width = sdd->cur_bpw / 8;
sdd->rx_dma.ch = sdd->ops->request(sdd->rx_dma.dmach, &req);
info.direction = sdd->rx_dma.direction; sdd->tx_dma.ch = sdd->ops->request(sdd->tx_dma.dmach, &req);
info.fifo = sdd->sfr_start + S3C64XX_SPI_RX_DATA;
sdd->rx_dma.ch = sdd->ops->request(sdd->rx_dma.dmach, &info);
info.direction = sdd->tx_dma.direction;
info.fifo = sdd->sfr_start + S3C64XX_SPI_TX_DATA;
sdd->tx_dma.ch = sdd->ops->request(sdd->tx_dma.dmach, &info);
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment