ath6kl: Fix buffer alignment for scatter-gather I/O
For non-scatter buffers, there is already a bounce buffer which takes care of alignment. This patch is influenced by a rough patch of Kalle. Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
parent
13e34ea1f4
commit
1df94a8578
5 changed files with 22 additions and 12 deletions
|
@ -128,6 +128,17 @@ static int ath6kl_sdio_func0_cmd52_wr_byte(struct mmc_card *card,
|
|||
return mmc_wait_for_cmd(card->host, &io_cmd, 0);
|
||||
}
|
||||
|
||||
static void ath6kl_sdio_buf_align(u8 **buf, unsigned long len)
|
||||
{
|
||||
u8 *align_addr;
|
||||
|
||||
if (!IS_ALIGNED((unsigned long) *buf, 4)) {
|
||||
align_addr = PTR_ALIGN(*buf - 4, 4);
|
||||
memmove(align_addr, *buf, len);
|
||||
*buf = align_addr;
|
||||
}
|
||||
}
|
||||
|
||||
static int ath6kl_sdio_io(struct sdio_func *func, u32 request, u32 addr,
|
||||
u8 *buf, u32 len)
|
||||
{
|
||||
|
@ -213,16 +224,10 @@ static void ath6kl_sdio_setup_scat_data(struct hif_scatter_req *scat_req,
|
|||
|
||||
/* assemble SG list */
|
||||
for (i = 0; i < scat_req->scat_entries; i++, sg++) {
|
||||
if ((unsigned long)scat_req->scat_list[i].buf & 0x3)
|
||||
/*
|
||||
* Some scatter engines can handle unaligned
|
||||
* buffers, print this as informational only.
|
||||
*/
|
||||
ath6kl_dbg(ATH6KL_DBG_SCATTER,
|
||||
"(%s) scatter buffer is unaligned 0x%p\n",
|
||||
scat_req->req & HIF_WRITE ? "WR" : "RD",
|
||||
scat_req->scat_list[i].buf);
|
||||
|
||||
/* No header is added to rx buf, so it shoule be aligned */
|
||||
if (data->flags == MMC_DATA_WRITE)
|
||||
ath6kl_sdio_buf_align(&scat_req->scat_list[i].buf,
|
||||
scat_req->scat_list[i].len);
|
||||
ath6kl_dbg(ATH6KL_DBG_SCATTER, "%d: addr:0x%p, len:%d\n",
|
||||
i, scat_req->scat_list[i].buf,
|
||||
scat_req->scat_list[i].len);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue