Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/fdt Allow plfb to be the console device



details:   https://anonhg.NetBSD.org/src/rev/e6cc3ff55e93
branches:  trunk
changeset: 354161:e6cc3ff55e93
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Jun 06 00:26:59 2017 +0000

description:
Allow plfb to be the console device

diffstat:

 sys/arch/arm/fdt/plfb_fdt.c |  29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diffs (61 lines):

diff -r c6d10fd853c9 -r e6cc3ff55e93 sys/arch/arm/fdt/plfb_fdt.c
--- a/sys/arch/arm/fdt/plfb_fdt.c       Tue Jun 06 00:26:16 2017 +0000
+++ b/sys/arch/arm/fdt/plfb_fdt.c       Tue Jun 06 00:26:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: plfb_fdt.c,v 1.1 2017/06/03 14:50:39 jmcneill Exp $ */
+/* $NetBSD: plfb_fdt.c,v 1.2 2017/06/06 00:26:59 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: plfb_fdt.c,v 1.1 2017/06/03 14:50:39 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plfb_fdt.c,v 1.2 2017/06/06 00:26:59 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -68,6 +68,8 @@
 
 #define        PLFB_BPP                32
 
+static int plfb_console_phandle = -1;
+
 struct plfb_softc {
        struct genfb_softc      sc_gen;
        bus_space_tag_t         sc_bst;
@@ -170,7 +172,8 @@
        plfb_init(sc);
 
        sc->sc_wstype = WSDISPLAY_TYPE_PLFB;
-       prop_dictionary_set_bool(dict, "is_console", false);
+       prop_dictionary_set_bool(dict, "is_console",
+           phandle == plfb_console_phandle);
 
        genfb_init(&sc->sc_gen);
 
@@ -294,3 +297,23 @@
            LCDCONTROL_PWR | LCDCONTROL_EN | LCDCONTROL_BPP_24 |
            LCDCONTROL_BGR);
 }
+
+static int
+plfb_console_match(int phandle)
+{
+       return of_match_compatible(phandle, compatible);
+}
+
+static void
+plfb_console_consinit(struct fdt_attach_args *faa, u_int uart_freq)
+{
+       plfb_console_phandle = faa->faa_phandle;
+       genfb_cnattach();
+}
+
+static const struct fdt_console plfb_fdt_console = {
+       .match = plfb_console_match,
+       .consinit = plfb_console_consinit
+};
+
+FDT_CONSOLE(plfb, &plfb_fdt_console);



Home | Main Index | Thread Index | Old Index