Patchwork [U-Boot,v2] mxc_ipuv3: fix memory alignment of framebuffer

login
register
mail settings
Submitter Eric Nelson
Date July 27, 2013, 12:53 a.m.
Message ID <1374886425-11512-1-git-send-email-eric.nelson@boundarydevices.com>
Download mbox | patch
Permalink /patch/262366/
State Awaiting Upstream
Delegated to: Stefano Babic
Headers show

Comments

Eric Nelson - July 27, 2013, 12:53 a.m.
The frame-buffer on i.MX boards needs to be aligned for DMA.

Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
---
Changes in v2: Also round smem_len up to ARCH_DMA_MINALIGN

 drivers/video/mxc_ipuv3_fb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Stefano Babic - July 29, 2013, 10:18 a.m.
On 27/07/2013 02:53, Eric Nelson wrote:
> The frame-buffer on i.MX boards needs to be aligned for DMA.
> 
> Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
> ---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic

Patch

diff --git a/drivers/video/mxc_ipuv3_fb.c b/drivers/video/mxc_ipuv3_fb.c
index ace226c..d922d5d 100644
--- a/drivers/video/mxc_ipuv3_fb.c
+++ b/drivers/video/mxc_ipuv3_fb.c
@@ -415,8 +415,9 @@  static int mxcfb_map_video_memory(struct fb_info *fbi)
 		fbi->fix.smem_len = fbi->var.yres_virtual *
 				    fbi->fix.line_length;
 	}
-
-	fbi->screen_base = (char *)malloc(fbi->fix.smem_len);
+	fbi->fix.smem_len = roundup(fbi->fix.smem_len, ARCH_DMA_MINALIGN);
+	fbi->screen_base = (char *)memalign(ARCH_DMA_MINALIGN,
+					    fbi->fix.smem_len);
 	fbi->fix.smem_start = (unsigned long)fbi->screen_base;
 	if (fbi->screen_base == 0) {
 		puts("Unable to allocate framebuffer memory\n");