mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-20 09:58:04 +07:00
dmaengine: qcom_bam_dma: Make driver work for BE
This patch fixes the Qualcomm BAM dmaenging driver to work with big endian kernels. Signed-off-by: Andy Gross <andy.gross@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
This commit is contained in:
parent
92e963f50f
commit
458f5884a1
@ -53,9 +53,9 @@
|
|||||||
#include "virt-dma.h"
|
#include "virt-dma.h"
|
||||||
|
|
||||||
struct bam_desc_hw {
|
struct bam_desc_hw {
|
||||||
u32 addr; /* Buffer physical address */
|
__le32 addr; /* Buffer physical address */
|
||||||
u16 size; /* Buffer size in bytes */
|
__le16 size; /* Buffer size in bytes */
|
||||||
u16 flags;
|
__le16 flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DESC_FLAG_INT BIT(15)
|
#define DESC_FLAG_INT BIT(15)
|
||||||
@ -632,14 +632,15 @@ static struct dma_async_tx_descriptor *bam_prep_slave_sg(struct dma_chan *chan,
|
|||||||
unsigned int curr_offset = 0;
|
unsigned int curr_offset = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
desc->addr = sg_dma_address(sg) + curr_offset;
|
desc->addr = cpu_to_le32(sg_dma_address(sg) +
|
||||||
|
curr_offset);
|
||||||
|
|
||||||
if (remainder > BAM_MAX_DATA_SIZE) {
|
if (remainder > BAM_MAX_DATA_SIZE) {
|
||||||
desc->size = BAM_MAX_DATA_SIZE;
|
desc->size = cpu_to_le16(BAM_MAX_DATA_SIZE);
|
||||||
remainder -= BAM_MAX_DATA_SIZE;
|
remainder -= BAM_MAX_DATA_SIZE;
|
||||||
curr_offset += BAM_MAX_DATA_SIZE;
|
curr_offset += BAM_MAX_DATA_SIZE;
|
||||||
} else {
|
} else {
|
||||||
desc->size = remainder;
|
desc->size = cpu_to_le16(remainder);
|
||||||
remainder = 0;
|
remainder = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -915,9 +916,11 @@ static void bam_start_dma(struct bam_chan *bchan)
|
|||||||
|
|
||||||
/* set any special flags on the last descriptor */
|
/* set any special flags on the last descriptor */
|
||||||
if (async_desc->num_desc == async_desc->xfer_len)
|
if (async_desc->num_desc == async_desc->xfer_len)
|
||||||
desc[async_desc->xfer_len - 1].flags = async_desc->flags;
|
desc[async_desc->xfer_len - 1].flags =
|
||||||
|
cpu_to_le16(async_desc->flags);
|
||||||
else
|
else
|
||||||
desc[async_desc->xfer_len - 1].flags |= DESC_FLAG_INT;
|
desc[async_desc->xfer_len - 1].flags |=
|
||||||
|
cpu_to_le16(DESC_FLAG_INT);
|
||||||
|
|
||||||
if (bchan->tail + async_desc->xfer_len > MAX_DESCRIPTORS) {
|
if (bchan->tail + async_desc->xfer_len > MAX_DESCRIPTORS) {
|
||||||
u32 partial = MAX_DESCRIPTORS - bchan->tail;
|
u32 partial = MAX_DESCRIPTORS - bchan->tail;
|
||||||
|
Loading…
Reference in New Issue
Block a user