NVIDIA: SAUCE: Revert "i2c: tegra: Allocate DMA memory for DMA engine"
BugLink: https://bugs.launchpad.net/bugs/2080908
Reason for revert: The commit violates the requirement of stream ID
isolation specified by Bug 200761027. Memory allocated by I2C for
dma transfer should be owned by I2C and not by GPCDMA.
http://nvbugs/4112053
http://nvbugs/4253415
http://nvbugs/4251463
http://nvbugs/4233150
This reverts commit cdbf26251d
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Signed-off-by: Bodla Rakesh Babu <rbodla@nvidia.com>
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off-by: Noah Wager <noah.wager@canonical.com>
This commit is contained in:
@@ -288,7 +288,6 @@ struct tegra_i2c_dev {
|
||||
struct completion dma_complete;
|
||||
struct dma_chan *dma_chan;
|
||||
unsigned int dma_buf_size;
|
||||
struct device *dma_dev;
|
||||
dma_addr_t dma_phys;
|
||||
void *dma_buf;
|
||||
|
||||
@@ -426,7 +425,7 @@ static int tegra_i2c_dma_submit(struct tegra_i2c_dev *i2c_dev, size_t len)
|
||||
static void tegra_i2c_release_dma(struct tegra_i2c_dev *i2c_dev)
|
||||
{
|
||||
if (i2c_dev->dma_buf) {
|
||||
dma_free_coherent(i2c_dev->dma_dev, i2c_dev->dma_buf_size,
|
||||
dma_free_coherent(i2c_dev->dev, i2c_dev->dma_buf_size,
|
||||
i2c_dev->dma_buf, i2c_dev->dma_phys);
|
||||
i2c_dev->dma_buf = NULL;
|
||||
}
|
||||
@@ -468,11 +467,10 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
i2c_dev->dma_dev = i2c_dev->dma_chan->device->dev;
|
||||
i2c_dev->dma_buf_size = i2c_dev->hw->quirks->max_write_len +
|
||||
I2C_PACKET_HEADER_SIZE;
|
||||
|
||||
dma_buf = dma_alloc_coherent(i2c_dev->dma_dev, i2c_dev->dma_buf_size,
|
||||
dma_buf = dma_alloc_coherent(i2c_dev->dev, i2c_dev->dma_buf_size,
|
||||
&dma_phys, GFP_KERNEL | __GFP_NOWARN);
|
||||
if (!dma_buf) {
|
||||
dev_err(i2c_dev->dev, "failed to allocate DMA buffer\n");
|
||||
@@ -1324,7 +1322,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
|
||||
|
||||
if (i2c_dev->dma_mode) {
|
||||
if (i2c_dev->msg_read) {
|
||||
dma_sync_single_for_device(i2c_dev->dma_dev,
|
||||
dma_sync_single_for_device(i2c_dev->dev,
|
||||
i2c_dev->dma_phys,
|
||||
xfer_size, DMA_FROM_DEVICE);
|
||||
|
||||
@@ -1332,7 +1330,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
|
||||
if (err)
|
||||
return err;
|
||||
} else {
|
||||
dma_sync_single_for_cpu(i2c_dev->dma_dev,
|
||||
dma_sync_single_for_cpu(i2c_dev->dev,
|
||||
i2c_dev->dma_phys,
|
||||
xfer_size, DMA_TO_DEVICE);
|
||||
}
|
||||
@@ -1345,7 +1343,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
|
||||
memcpy(i2c_dev->dma_buf + I2C_PACKET_HEADER_SIZE,
|
||||
msg->buf, i2c_dev->msg_len);
|
||||
|
||||
dma_sync_single_for_device(i2c_dev->dma_dev,
|
||||
dma_sync_single_for_device(i2c_dev->dev,
|
||||
i2c_dev->dma_phys,
|
||||
xfer_size, DMA_TO_DEVICE);
|
||||
|
||||
@@ -1391,7 +1389,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
|
||||
}
|
||||
|
||||
if (i2c_dev->msg_read && i2c_dev->msg_err == I2C_ERR_NONE) {
|
||||
dma_sync_single_for_cpu(i2c_dev->dma_dev,
|
||||
dma_sync_single_for_cpu(i2c_dev->dev,
|
||||
i2c_dev->dma_phys,
|
||||
xfer_size, DMA_FROM_DEVICE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user