Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch A debe can't feed both tcon at the same time.



details:   https://anonhg.NetBSD.org/src/rev/909018e24579
branches:  trunk
changeset: 341385:909018e24579
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Nov 03 18:38:03 2015 +0000

description:
A debe can't feed both tcon at the same time.
AWIN_DEBE_MODCTL_OUT_SEL will select which tcon instance will get data
(0 for tcon0, 1 for tcon1).
In tcon, AWIN_TCON_CTL_SRC_SEL_DE0 selects the default debe for this
tcon instance: debe0 for tcon0, debe1 for tcon1.
So always connect tcon0 to debe0 and tcon1 to debe1.
now display modes 0, 1 and 2 works; display modes 3 and 4 needs more work.

diffstat:

 sys/arch/arm/allwinner/awin_debe.c  |  20 ++++++++++++---
 sys/arch/arm/allwinner/awin_reg.h   |   5 ++-
 sys/arch/arm/allwinner/awin_tcon.c  |  49 +++++++++---------------------------
 sys/arch/evbarm/awin/awin_machdep.c |  19 ++------------
 4 files changed, 35 insertions(+), 58 deletions(-)

diffs (267 lines):

diff -r 6182a854d644 -r 909018e24579 sys/arch/arm/allwinner/awin_debe.c
--- a/sys/arch/arm/allwinner/awin_debe.c        Tue Nov 03 14:15:08 2015 +0000
+++ b/sys/arch/arm/allwinner/awin_debe.c        Tue Nov 03 18:38:03 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_debe.c,v 1.17 2015/10/25 20:54:19 bouyer Exp $ */
+/* $NetBSD: awin_debe.c,v 1.18 2015/11/03 18:38:03 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -37,7 +37,7 @@
 #define AWIN_DEBE_CURMAX       64
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.17 2015/10/25 20:54:19 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.18 2015/11/03 18:38:03 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -451,10 +451,11 @@
 
        dev = device_find_by_driver_unit("awindebe", unit);
        if (dev == NULL) {
-               printf("DEBE: no driver found\n");
+               printf("DEBE%d: no driver found\n", unit);
                return;
        }
        sc = device_private(dev);
+       KASSERT(device_unit(sc->sc_dev) == unit);
 
        if (enable) {
                val = DEBE_READ(sc, AWIN_DEBE_REGBUFFCTL_REG);
@@ -469,6 +470,11 @@
                val &= ~AWIN_DEBE_MODCTL_START_CTL;
                DEBE_WRITE(sc, AWIN_DEBE_MODCTL_REG, val);
        }
+#if 0
+       for (int i = 0; i < 0x1000; i += 4) {
+               printf("DEBE 0x%04x: 0x%08x\n", i, DEBE_READ(sc, i));
+       }
+#endif
 }
 
 void
@@ -480,10 +486,11 @@
 
        dev = device_find_by_driver_unit("awindebe", unit);
        if (dev == NULL) {
-               printf("DEBE: no driver found\n");
+               printf("DEBE%d: no driver found\n", unit);
                return;
        }
        sc = device_private(dev);
+       KASSERT(device_unit(sc->sc_dev) == unit);
 
        if (mode) {
                const u_int interlace_p = !!(mode->flags & VID_INTERLACE);
@@ -545,6 +552,11 @@
                } else {
                        val &= ~AWIN_DEBE_MODCTL_ITLMOD_EN;
                }
+               val &= ~AWIN_DEBE_MODCTL_OUT_SEL;
+               if (device_unit(sc->sc_dev) == 1) {
+                       val |= __SHIFTIN(AWIN_DEBE_MODCTL_OUT_SEL_LCD1,
+                           AWIN_DEBE_MODCTL_OUT_SEL);
+               }
                DEBE_WRITE(sc, AWIN_DEBE_MODCTL_REG, val);
        } else {
                /* disable */
diff -r 6182a854d644 -r 909018e24579 sys/arch/arm/allwinner/awin_reg.h
--- a/sys/arch/arm/allwinner/awin_reg.h Tue Nov 03 14:15:08 2015 +0000
+++ b/sys/arch/arm/allwinner/awin_reg.h Tue Nov 03 18:38:03 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_reg.h,v 1.81 2015/10/25 20:54:19 bouyer Exp $ */
+/* $NetBSD: awin_reg.h,v 1.82 2015/11/03 18:38:03 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -1701,7 +1701,8 @@
 #define AWIN_DEBE_MODCTL_LINE_SEL      __BIT(29)
 #define AWIN_DEBE_MODCTL_ITLMOD_EN     __BIT(28)
 #define AWIN_DEBE_MODCTL_OUT_SEL       __BITS(22,20)
-#define AWIN_DEBE_MODCTL_OUT_SEL_LCD   0
+#define AWIN_DEBE_MODCTL_OUT_SEL_LCD0  0
+#define AWIN_DEBE_MODCTL_OUT_SEL_LCD1  0
 #define AWIN_DEBE_MODCTL_OUT_SEL_FE0   6
 #define AWIN_DEBE_MODCTL_OUT_SEL_FE1   7
 #define AWIN_DEBE_MODCTL_OSCA_EN       __BIT(17)
diff -r 6182a854d644 -r 909018e24579 sys/arch/arm/allwinner/awin_tcon.c
--- a/sys/arch/arm/allwinner/awin_tcon.c        Tue Nov 03 14:15:08 2015 +0000
+++ b/sys/arch/arm/allwinner/awin_tcon.c        Tue Nov 03 18:38:03 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_tcon.c,v 1.6 2015/10/25 20:54:19 bouyer Exp $ */
+/* $NetBSD: awin_tcon.c,v 1.7 2015/11/03 18:38:03 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_allwinner.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_tcon.c,v 1.6 2015/10/25 20:54:19 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_tcon.c,v 1.7 2015/11/03 18:38:03 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -56,7 +56,6 @@
        unsigned int sc_clk_pll;
        unsigned int sc_clk_div;
        bool sc_clk_dbl;
-       unsigned int sc_debe_unit;
 };
 
 static bus_space_handle_t tcon_mux_bsh;
@@ -114,7 +113,6 @@
        struct awinio_attach_args * const aio = aux;
        const struct awin_locators * const loc = &aio->aio_loc;
        prop_dictionary_t cfg = device_properties(self);
-       int8_t debe_unit = -1;
 
        sc->sc_dev = self;
        sc->sc_bst = aio->aio_core_bst;
@@ -132,14 +130,6 @@
                awin_tcon_clear_reset(aio, 0);
        }
 
-       if (prop_dictionary_get_int8(cfg, "debe_unit", &debe_unit)) {
-               sc->sc_debe_unit = debe_unit;
-       } else {
-               sc->sc_debe_unit = 0; /* default value */
-       }
-
-               
-
        aprint_naive("\n");
        aprint_normal(": LCD/TV timing controller (TCON%d)\n", loc->loc_port);
        switch (sc->sc_port) {
@@ -154,10 +144,9 @@
        default:
                panic("awin_tcon port\n");
        }
-       if (debe_unit >= 0) {
-               aprint_verbose_dev(self, ": using DEBE%d, pll%d\n",
-                   sc->sc_debe_unit, sc->sc_clk_pll);
-       }
+
+       aprint_verbose_dev(self, ": using DEBE%d, pll%d\n",
+                   device_unit(self), sc->sc_clk_pll);
 
        awin_tcon_clear_reset(aio, sc->sc_port);
        
@@ -266,7 +255,7 @@
        }
        sc = device_private(dev);
 
-       awin_debe_enable(sc->sc_debe_unit, enable);
+       awin_debe_enable(device_unit(sc->sc_dev), enable);
        delay(20000);
        val = TCON_READ(sc, AWIN_TCON_GCTL_REG);
        if (enable) {
@@ -322,7 +311,7 @@
        }
        sc = device_private(dev);
 
-       awin_debe_set_videomode(sc->sc_debe_unit, mode);
+       awin_debe_set_videomode(device_unit(sc->sc_dev), mode);
        if (mode) {
                const u_int interlace_p = !!(mode->flags & VID_INTERLACE);
                const u_int phsync_p = !!(mode->flags & VID_PHSYNC);
@@ -340,17 +329,6 @@
                val |= AWIN_TCON_GCTL_IO_MAP_SEL;
                TCON_WRITE(sc, AWIN_TCON_GCTL_REG, val);
 
-               val = TCON_READ(sc, AWIN_TCON0_CTL_REG);
-               val &= ~0x00400003;
-               if (sc->sc_debe_unit == 0) {
-                       val |= __SHIFTIN(AWIN_TCON_CTL_SRC_SEL_DE0,
-                                        AWIN_TCON_CTL_SRC_SEL);
-               } else {
-                       val |= __SHIFTIN(AWIN_TCON_CTL_SRC_SEL_DE1,
-                                        AWIN_TCON_CTL_SRC_SEL);
-               }
-               TCON_WRITE(sc, AWIN_TCON0_CTL_REG, val);
-
                /* enable */
                val = AWIN_TCON_CTL_EN;
                if (interlace_p)
@@ -360,13 +338,12 @@
                val |= __SHIFTIN(AWIN_TCON_CTL_SRC_SEL_BLUEDATA,
                                 AWIN_TCON_CTL_SRC_SEL);
 #else
-               if (sc->sc_debe_unit == 0) {
-                       val |= __SHIFTIN(AWIN_TCON_CTL_SRC_SEL_DE0,
-                                        AWIN_TCON_CTL_SRC_SEL);
-               } else {
-                       val |= __SHIFTIN(AWIN_TCON_CTL_SRC_SEL_DE1,
-                                        AWIN_TCON_CTL_SRC_SEL);
-               }
+               /*
+                * the DE selector selects the primary DEBE for this tcon:
+                * 0 selects debe0 for tcon0 and debe1 for tcon1
+                */
+               val |= __SHIFTIN(AWIN_TCON_CTL_SRC_SEL_DE0,
+                                AWIN_TCON_CTL_SRC_SEL);
 #endif
                TCON_WRITE(sc, AWIN_TCON1_CTL_REG, val);
 
diff -r 6182a854d644 -r 909018e24579 sys/arch/evbarm/awin/awin_machdep.c
--- a/sys/arch/evbarm/awin/awin_machdep.c       Tue Nov 03 14:15:08 2015 +0000
+++ b/sys/arch/evbarm/awin/awin_machdep.c       Tue Nov 03 18:38:03 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: awin_machdep.c,v 1.45 2015/10/25 21:21:52 bouyer Exp $ */
+/*     $NetBSD: awin_machdep.c,v 1.46 2015/11/03 18:38:03 bouyer Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_machdep.c,v 1.45 2015/10/25 21:21:52 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_machdep.c,v 1.46 2015/11/03 18:38:03 bouyer Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -989,7 +989,7 @@
                break;
        case 1:
                /* screen1, fb0 */
-               prop_dictionary_set_bool(dict, "no-awindebe-1", true);
+               prop_dictionary_set_bool(dict, "no-awindebe-0", true);
                prop_dictionary_set_bool(dict, "no-awintcon-0", true);
                hdmi_used = (screen1_type == 3);
                break;
@@ -1001,7 +1001,6 @@
                /* xinerama */
        case 4:
                /* clone */
-               prop_dictionary_set_bool(dict, "no-awindebe-1", true);
                hdmi_used = (screen0_type == 3 || screen1_type == 3);
                break;
        default:
@@ -1054,7 +1053,6 @@
                if (mode < 0)
                        return;
 
-               prop_dictionary_set_int8(dict, "debe_unit", 0);
                type = awin_sysconfig_get_int("disp_init", "screen0_output_type");
                if (type == 1) {
                        /* LCD/LVDS output */
@@ -1069,17 +1067,6 @@
                return;
        }
        if (device_unit(self) == 1) {
-               switch (mode) {
-               case 0:
-                       /* only mode where tcon1 is not used */
-                       return;
-               case 2:
-                       prop_dictionary_set_int8(dict, "debe_unit", 1);
-                       break;
-               default:
-                       prop_dictionary_set_int8(dict, "debe_unit", 0);
-                       break;
-               }
                type = awin_sysconfig_get_int("disp_init", "screen1_output_type");
                if (type == 1) {
                        /* LCD/LVDS output */



Home | Main Index | Thread Index | Old Index