c5dc922ec91c564bc3863a57ae1e9d94c4adfb4b
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 319-v4.12-0030-brcmfmac-properly-align-buffers-on-certain-platforms.patch
1 From 6e84ab604bdedaa16239bd1c6e5fcb5660309f02 Mon Sep 17 00:00:00 2001
2 From: Heiner Kallweit <hkallweit1@gmail.com>
3 Date: Wed, 5 Apr 2017 20:33:26 +0200
4 Subject: [PATCH] brcmfmac: properly align buffers on certain platforms with 64
5 bit DMA
6
7 Systems with 64 bit DMA at least partially require buffers to be used
8 for DMA to be 8-byte-aligned. One example is Amlogic Meson GX.
9 Switching the MMC/SDIO driver for this platform to SG DMA mode
10 resulted in problems due to unaligned buffers.
11
12 Fortunately the brcmfmac driver has a global define for the alignment.
13 Changing it to 8 fixed the issues with Meson GX.
14
15 Suggested-by: Helmut Klein <hgkr.klein@gmail.com>
16 Tested-by: Helmut Klein <hgkr.klein@gmail.com>
17 Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
18 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
19 ---
20 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 ++++
21 1 file changed, 4 insertions(+)
22
23 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
24 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
25 @@ -539,7 +539,11 @@ static int qcount[NUMPRIO];
26 /* Limit on rounding up frames */
27 static const uint max_roundup = 512;
28
29 +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
30 +#define ALIGNMENT 8
31 +#else
32 #define ALIGNMENT 4
33 +#endif
34
35 enum brcmf_sdio_frmtype {
36 BRCMF_SDIO_FT_NORMAL,