diff --git a/sys/arch/arm/fdt/plfb_fdt.c b/sys/arch/arm/fdt/plfb_fdt.c index c343a796b6ab..d946e7a5ead4 100644 --- a/sys/arch/arm/fdt/plfb_fdt.c +++ b/sys/arch/arm/fdt/plfb_fdt.c @@ -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 @@ -31,7 +31,7 @@ */ #include -__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 #include @@ -68,6 +68,8 @@ __KERNEL_RCSID(0, "$NetBSD: plfb_fdt.c,v 1.1 2017/06/03 14:50:39 jmcneill Exp $" #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_attach(device_t parent, device_t self, void *aux) 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 @@ plfb_init(struct plfb_softc *sc) 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);