Module Name:    src
Committed By:   jmcneill
Date:           Wed Nov 12 23:12:27 UTC 2014

Modified Files:
        src/sys/arch/arm/allwinner: awin_debe.c

Log Message:
On 2GB systems, we have to subtract AWIN_SDRAM_PBASE from the physical address.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/allwinner/awin_debe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/allwinner/awin_debe.c
diff -u src/sys/arch/arm/allwinner/awin_debe.c:1.4 src/sys/arch/arm/allwinner/awin_debe.c:1.5
--- src/sys/arch/arm/allwinner/awin_debe.c:1.4	Tue Nov 11 19:22:32 2014
+++ src/sys/arch/arm/allwinner/awin_debe.c	Wed Nov 12 23:12:27 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_debe.c,v 1.4 2014/11/11 19:22:32 jmcneill Exp $ */
+/* $NetBSD: awin_debe.c,v 1.5 2014/11/12 23:12:27 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill <[email protected]>
@@ -34,7 +34,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.4 2014/11/11 19:22:32 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.5 2014/11/12 23:12:27 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -293,6 +293,14 @@ awin_debe_set_videomode(const struct vid
 			return;
 		}
 
+		paddr_t pa = sc->sc_dmamap->dm_segs[0].ds_addr;
+		/*
+		 * On 2GB systems, we need to subtract AWIN_SDRAM_PBASE from
+		 * the phys addr.
+		 */
+		if (pa >= AWIN_SDRAM_PBASE)
+			pa -= AWIN_SDRAM_PBASE;
+
 		/* notify fb */
 		awin_debe_setup_fbdev(sc, mode);
 
@@ -301,10 +309,8 @@ awin_debe_set_videomode(const struct vid
 		DEBE_WRITE(sc, AWIN_DEBE_LAYSIZE_REG,
 		    ((mode->vdisplay - 1) << 16) | (mode->hdisplay - 1));
 		DEBE_WRITE(sc, AWIN_DEBE_LAYLINEWIDTH_REG, mode->hdisplay << 5);
-		DEBE_WRITE(sc, AWIN_DEBE_LAYFB_L32ADD_REG,
-		    sc->sc_dmamap->dm_segs[0].ds_addr << 3);
-		DEBE_WRITE(sc, AWIN_DEBE_LAYFB_H4ADD_REG,
-		    sc->sc_dmamap->dm_segs[0].ds_addr >> 29);
+		DEBE_WRITE(sc, AWIN_DEBE_LAYFB_L32ADD_REG, pa << 3);
+		DEBE_WRITE(sc, AWIN_DEBE_LAYFB_H4ADD_REG, pa >> 29);
 
 		val = DEBE_READ(sc, AWIN_DEBE_ATTCTL1_REG);
 		val &= ~AWIN_DEBE_ATTCTL1_LAY_FBFMT;

Reply via email to