Commit 653ee35c authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

can: hi311x: remove custom DMA mapped buffer

There is no need to duplicate what SPI core already does, i.e. mapping buffers
for DMA capable transfers. This patch removes all related pices of code.
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 1f0dee39
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/freezer.h> #include <linux/freezer.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -126,10 +125,6 @@ ...@@ -126,10 +125,6 @@
#define DEVICE_NAME "hi3110" #define DEVICE_NAME "hi3110"
static int hi3110_enable_dma = 1; /* Enable SPI DMA. Default: 1 (On) */
module_param(hi3110_enable_dma, int, 0444);
MODULE_PARM_DESC(hi3110_enable_dma, "Enable SPI DMA. Default: 1 (On)");
static const struct can_bittiming_const hi3110_bittiming_const = { static const struct can_bittiming_const hi3110_bittiming_const = {
.name = DEVICE_NAME, .name = DEVICE_NAME,
.tseg1_min = 2, .tseg1_min = 2,
...@@ -156,8 +151,6 @@ struct hi3110_priv { ...@@ -156,8 +151,6 @@ struct hi3110_priv {
u8 *spi_tx_buf; u8 *spi_tx_buf;
u8 *spi_rx_buf; u8 *spi_rx_buf;
dma_addr_t spi_tx_dma;
dma_addr_t spi_rx_dma;
struct sk_buff *tx_skb; struct sk_buff *tx_skb;
int tx_len; int tx_len;
...@@ -217,13 +210,6 @@ static int hi3110_spi_trans(struct spi_device *spi, int len) ...@@ -217,13 +210,6 @@ static int hi3110_spi_trans(struct spi_device *spi, int len)
int ret; int ret;
spi_message_init(&m); spi_message_init(&m);
if (hi3110_enable_dma) {
t.tx_dma = priv->spi_tx_dma;
t.rx_dma = priv->spi_rx_dma;
m.is_dma_mapped = 1;
}
spi_message_add_tail(&t, &m); spi_message_add_tail(&t, &m);
ret = spi_sync(spi, &m); ret = spi_sync(spi, &m);
...@@ -915,30 +901,6 @@ static int hi3110_can_probe(struct spi_device *spi) ...@@ -915,30 +901,6 @@ static int hi3110_can_probe(struct spi_device *spi)
priv->spi = spi; priv->spi = spi;
mutex_init(&priv->hi3110_lock); mutex_init(&priv->hi3110_lock);
/* If requested, allocate DMA buffers */
if (hi3110_enable_dma) {
spi->dev.coherent_dma_mask = ~0;
/* Minimum coherent DMA allocation is PAGE_SIZE, so allocate
* that much and share it between Tx and Rx DMA buffers.
*/
priv->spi_tx_buf = dmam_alloc_coherent(&spi->dev,
PAGE_SIZE,
&priv->spi_tx_dma,
GFP_DMA);
if (priv->spi_tx_buf) {
priv->spi_rx_buf = (priv->spi_tx_buf + (PAGE_SIZE / 2));
priv->spi_rx_dma = (dma_addr_t)(priv->spi_tx_dma +
(PAGE_SIZE / 2));
} else {
/* Fall back to non-DMA */
hi3110_enable_dma = 0;
}
}
/* Allocate non-DMA buffers */
if (!hi3110_enable_dma) {
priv->spi_tx_buf = devm_kzalloc(&spi->dev, HI3110_RX_BUF_LEN, priv->spi_tx_buf = devm_kzalloc(&spi->dev, HI3110_RX_BUF_LEN,
GFP_KERNEL); GFP_KERNEL);
if (!priv->spi_tx_buf) { if (!priv->spi_tx_buf) {
...@@ -952,7 +914,6 @@ static int hi3110_can_probe(struct spi_device *spi) ...@@ -952,7 +914,6 @@ static int hi3110_can_probe(struct spi_device *spi)
ret = -ENOMEM; ret = -ENOMEM;
goto error_probe; goto error_probe;
} }
}
SET_NETDEV_DEV(net, &spi->dev); SET_NETDEV_DEV(net, &spi->dev);
......
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