From 2704cce243df4698c2e30e60730fa1957a5c2fdd Mon Sep 17 00:00:00 2001 From: kiyohara Date: Tue, 18 Oct 2016 14:39:52 +0000 Subject: [PATCH] Support tifb. --- sys/arch/evbarm/beagle/beagle_machdep.c | 52 +++++++++++++++++++---- sys/arch/evbarm/gumstix/gumstix_machdep.c | 12 +++++- sys/arch/evbarm/gumstix/gxio.c | 5 ++- 3 files changed, 58 insertions(+), 11 deletions(-) diff --git a/sys/arch/evbarm/beagle/beagle_machdep.c b/sys/arch/evbarm/beagle/beagle_machdep.c index b7cf25cef27e..679039b41d47 100644 --- a/sys/arch/evbarm/beagle/beagle_machdep.c +++ b/sys/arch/evbarm/beagle/beagle_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: beagle_machdep.c,v 1.64 2016/07/03 11:40:58 kiyohara Exp $ */ +/* $NetBSD: beagle_machdep.c,v 1.65 2016/10/18 14:39:52 kiyohara Exp $ */ /* * Machine dependent functions for kernel setup for TI OSK5912 board. @@ -125,7 +125,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.64 2016/07/03 11:40:58 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.65 2016/10/18 14:39:52 kiyohara Exp $"); #include "opt_machdep.h" #include "opt_ddb.h" @@ -190,6 +190,7 @@ __KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.64 2016/07/03 11:40:58 kiyohara # error no prcm device configured. # endif # include +# include # include # if NSDHC > 0 # include @@ -497,7 +498,13 @@ initarm(void *arg) /* The console is going to try to map things. Give pmap a devmap. */ pmap_devmap_register(devmap); + + if (get_bootconf_option(bootargs, "console", + BOOTOPT_TYPE_STRING, &ptr) && strncmp(ptr, "fb", 2) == 0) { + use_fb_console = true; + } consinit(); + #ifdef CPU_CORTEXA15 #ifdef MULTIPROCESSOR arm_cpu_max = 1 + __SHIFTOUT(armreg_l2ctrl_read(), L2CTRL_NUMCPU); @@ -618,11 +625,6 @@ initarm(void *arg) db_trap_callback = beagle_db_trap; - if (get_bootconf_option(boot_args, "console", - BOOTOPT_TYPE_STRING, &ptr) && strncmp(ptr, "fb", 2) == 0) { - use_fb_console = true; - } - return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, NULL, 0); } @@ -688,7 +690,8 @@ consinit(void) #endif #if NUKBD > 0 - ukbd_cnattach(); /* allow USB keyboard to become console */ + if (use_fb_console) + ukbd_cnattach(); /* allow USB keyboard to become console */ #endif beagle_putchar('f'); @@ -1107,6 +1110,39 @@ beagle_device_register(device_t self, void *aux) return; } if (device_is_a(self, "tifb")) { + static const struct tifb_panel_info default_panel_info = { + .panel_tft = 1, + .panel_mono = false, + .panel_bpp = 24, + + .panel_pxl_clk = 30000000, + .panel_width = 800, + .panel_height = 600, + .panel_hfp = 0, + .panel_hbp = 47, + .panel_hsw = 47, + .panel_vfp = 0, + .panel_vbp = 10, + .panel_vsw = 2, + .panel_invert_hsync = 1, + .panel_invert_vsync = 1, + + .panel_ac_bias = 255, + .panel_ac_bias_intrpt = 0, + .panel_dma_burst_sz = 16, + .panel_fdd = 0x80, + .panel_sync_edge = 0, + .panel_sync_ctrl = 1, + .panel_invert_pxl_clk = 0, + }; + prop_data_t panel_info; + + panel_info = prop_data_create_data_nocopy(&default_panel_info, + sizeof(struct tifb_panel_info)); + KASSERT(panel_info != NULL); + prop_dictionary_set(dict, "panel-info", panel_info); + prop_object_release(panel_info); + if (use_fb_console) prop_dictionary_set_bool(dict, "is_console", true); return; diff --git a/sys/arch/evbarm/gumstix/gumstix_machdep.c b/sys/arch/evbarm/gumstix/gumstix_machdep.c index f95c75d19dd3..10672975371f 100644 --- a/sys/arch/evbarm/gumstix/gumstix_machdep.c +++ b/sys/arch/evbarm/gumstix/gumstix_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: gumstix_machdep.c,v 1.54 2016/10/16 23:07:31 kiyohara Exp $ */ +/* $NetBSD: gumstix_machdep.c,v 1.55 2016/10/18 14:39:52 kiyohara Exp $ */ /* * Copyright (C) 2005, 2006, 2007 WIDE Project and SOUM Corporation. * All rights reserved. @@ -192,6 +192,7 @@ #include #include #include +#include #include #include #include @@ -262,6 +263,7 @@ int comcnmode = CONMODE; static char console[16]; #endif +const struct tifb_panel_info *tifb_panel_info = NULL; /* Use TPS65217 White LED Driver */ bool use_tps65217_wled = false; @@ -1164,6 +1166,14 @@ gumstix_device_register(device_t dev, void *aux) prop_dictionary_set_bool(dict, "dual-volt", dualvolt); } if (device_is_a(dev, "tifb")) { + prop_data_t panel_info; + + panel_info = prop_data_create_data_nocopy(tifb_panel_info, + sizeof(struct tifb_panel_info)); + KASSERT(panel_info != NULL); + prop_dictionary_set(dict, "panel-info", panel_info); + prop_object_release(panel_info); + #if defined(OMAP2) /* enable LCD */ omap2_gpio_ctl(59, GPIO_PIN_OUTPUT); diff --git a/sys/arch/evbarm/gumstix/gxio.c b/sys/arch/evbarm/gumstix/gxio.c index 42733435990b..ad9def9c7007 100644 --- a/sys/arch/evbarm/gumstix/gxio.c +++ b/sys/arch/evbarm/gumstix/gxio.c @@ -1,4 +1,4 @@ -/* $NetBSD: gxio.c,v 1.22 2016/10/16 13:54:28 kiyohara Exp $ */ +/* $NetBSD: gxio.c,v 1.23 2016/10/18 14:39:52 kiyohara Exp $ */ /* * Copyright (C) 2005, 2006, 2007 WIDE Project and SOUM Corporation. * All rights reserved. @@ -31,7 +31,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: gxio.c,v 1.22 2016/10/16 13:54:28 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gxio.c,v 1.23 2016/10/18 14:39:52 kiyohara Exp $"); #include "opt_cputypes.h" #include "opt_gumstix.h" @@ -58,6 +58,7 @@ __KERNEL_RCSID(0, "$NetBSD: gxio.c,v 1.22 2016/10/16 13:54:28 kiyohara Exp $"); #endif #include #include +#include #if defined(CPU_XSCALE) #include #endif