From 6ed4524e7a0ba407f886ea314a216e63add966fe Mon Sep 17 00:00:00 2001 From: jmcneill Date: Sat, 22 Aug 2015 15:10:04 +0000 Subject: [PATCH] Add kernel config for Tegra K1 "Nyan Big" board, as found in the Acer Chromebook 13 (CB5-311). --- sys/arch/arm/nvidia/files.tegra | 6 +- sys/arch/evbarm/conf/NYAN-BIG | 149 ++++++++++++++++++++++++++ sys/arch/evbarm/tegra/tegra_machdep.c | 41 ++++++- sys/arch/evbarm/tegra/tegra_start.S | 6 +- 4 files changed, 196 insertions(+), 6 deletions(-) create mode 100644 sys/arch/evbarm/conf/NYAN-BIG diff --git a/sys/arch/arm/nvidia/files.tegra b/sys/arch/arm/nvidia/files.tegra index 7d207a020743..f232c830b915 100644 --- a/sys/arch/arm/nvidia/files.tegra +++ b/sys/arch/arm/nvidia/files.tegra @@ -1,4 +1,4 @@ -# $NetBSD: files.tegra,v 1.15 2015/08/01 21:20:11 jmcneill Exp $ +# $NetBSD: files.tegra,v 1.16 2015/08/22 15:10:04 jmcneill Exp $ # # Configuration info for NVIDIA Tegra ARM Peripherals # @@ -132,4 +132,6 @@ defflag opt_tegra.h SOC_TEGRAK1 defflag opt_tegra.h SOC_TEGRA124: SOC_TEGRAK1 # Board parameters -defflag opt_tegra.h BOARD_JETSONTK1 +defflag opt_tegra.h TEGRA_UBOOT +defflag opt_tegra.h BOARD_JETSONTK1: TEGRA_UBOOT +defflag opt_tegra.h BOARD_NYAN_BIG diff --git a/sys/arch/evbarm/conf/NYAN-BIG b/sys/arch/evbarm/conf/NYAN-BIG new file mode 100644 index 000000000000..b6aa338078e2 --- /dev/null +++ b/sys/arch/evbarm/conf/NYAN-BIG @@ -0,0 +1,149 @@ +# +# $NetBSD: NYAN-BIG,v 1.1 2015/08/22 15:10:04 jmcneill Exp $ +# +# Chrome OS nyan_big board - Tegra K1 +# - Acer Chromebook 13 (CB5-311) +# + +include "arch/evbarm/conf/std.tegra" +include "arch/evbarm/conf/GENERIC.common" + +options BOOT_ARGS="\"console=fb\"" + +options CPU_CORTEXA15 +options SOC_TEGRA124 +options BOARD_NYAN_BIG +#options CPUFREQ_BOOT=xxx +options MULTIPROCESSOR +#options MEMSIZE=2048 + +options DIAGNOSTIC # internal consistency checks +#options DEBUG +#options LOCKDEBUG +#options PMAP_DEBUG # Enable pmap_debug_level code +#options IPKDB # remote kernel debugging +#options VERBOSE_INIT_ARM # verbose bootstraping messages +makeoptions DEBUG="-g" # compile full symbol table +makeoptions COPY_SYMTAB=1 + +config netbsd root on ? type ? + +mainbus0 at root +cpu* at mainbus? + +# A15 core devices +armperiph0 at mainbus? +armgic0 at armperiph? # Interrupt Controller +armgtmr0 at armperiph? # ARM Generic Timer + +# On-board I/O +tegraio0 at mainbus? + +# Memory controller +tegramc0 at tegraio? # MC + +# Power management controller +tegrapmc0 at tegraio? # PMC + +# Clock and Reset controller +tegracar0 at tegraio? # CAR + +# GPIO controller +tegragpio0 at tegraio? # GPIO +gpio* at gpiobus? +#gpiobutton0 at gpio16 offset 0 mask 1 flag 0x01 # Power button +#gpiorfkill0 at gpio23 offset 7 mask 1 # WiFi enable + +# Timers +tegratimer0 at tegraio? # Timers + +# MPIO / Pinmux +tegrampio0 at tegraio? # MPIO + +# XUSB PADCTL +tegraxusbpad0 at tegraio? # XUSB PADCTL + +# PCIE +tegrapcie0 at tegraio? # PCIE +pci* at tegrapcie0 +ppb* at pci? dev ? function ? +pci* at ppb? + +# UART +com0 at tegraio? port 0 # UART-A +options CONSADDR=0x70006000, CONSPEED=115200 + +# I2C +tegrai2c0 at tegraio? port 0 # I2C1 +iic0 at tegrai2c0 +titemp0 at iic0 addr 0x4c # TI TMP451 +tegrai2c1 at tegraio? port 1 # I2C2 +iic1 at tegrai2c1 +tegrai2c2 at tegraio? port 2 # I2C3 +iic2 at tegrai2c2 +tegrai2c3 at tegraio? port 3 # I2C4 +iic3 at tegrai2c3 +ddc0 at iic3 addr 0x50 # HDMI DDC +tegrai2c4 at tegraio? port 4 # I2C5 +iic4 at tegrai2c4 + +# RTC +tegrartc0 at tegraio? # RTC + +# SDMMC +#sdhc0 at tegraio? port 0 # SDMMC1 (WiFi/BT) +#sdmmc0 at sdhc0 +sdhc2 at tegraio? port 2 # SDMMC3 (SD card) +sdmmc2 at sdhc2 +sdhc3 at tegraio? port 3 # SDMMC4 (eMMC) +sdmmc3 at sdhc3 + +ld0 at sdmmc3 # eMMC +ld1 at sdmmc2 # SD card + +# HDA +hdaudio* at tegraio? # HDA +hdafg* at hdaudiobus? +audio* at audiobus? +options HDAUDIOVERBOSE +options HDAUDIO_32BIT_ACCESS +options HDAUDIO_ENABLE_HDMI +options HDAUDIO_ENABLE_DISPLAYPORT + +# Host1x subsystem +tegrahost1x0 at tegraio? # HOST1X + +# Display controller +tegradc0 at tegraio? port 0 # DISPLAYA +tegradc1 at tegraio? port 1 # DISPLAYB +genfb* at tegradc? +wsdisplay* at genfb? +options VCONS_DRAW_INTR +options WSEMUL_VT100 +options WS_DEFAULT_FG=WSCOL_WHITE +options WS_DEFAULT_BG=WSCOL_BLACK +options WS_KERNEL_FG=WSCOL_GREEN +options WS_KERNEL_BG=WSCOL_BLACK +options WSDISPLAY_COMPAT_PCVT +options WSDISPLAY_COMPAT_SYSCONS +options WSDISPLAY_COMPAT_USL +options WSDISPLAY_COMPAT_RAWKBD +options WSDISPLAY_DEFAULTSCREENS=4 +pseudo-device wsmux +pseudo-device wsfont + +# HDMI +tegrahdmi0 at tegraio? # HDMI +tegracec0 at tegraio? # HDMI CEC +hdmicec* at hdmicecbus? + +# USB 2.0 +ehci0 at tegraio? port 0 # USB1 +ehci1 at tegraio? port 1 # USB2 +ehci2 at tegraio? port 2 # USB3 +usb* at ehci? + +include "dev/usb/usbdevices.config" +midi* at midibus? + +cinclude "arch/evbarm/conf/NYAN-BIG.local" diff --git a/sys/arch/evbarm/tegra/tegra_machdep.c b/sys/arch/evbarm/tegra/tegra_machdep.c index 3cffde3eea1f..786fe5a14a90 100644 --- a/sys/arch/evbarm/tegra/tegra_machdep.c +++ b/sys/arch/evbarm/tegra/tegra_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: tegra_machdep.c,v 1.18 2015/08/01 21:20:47 jmcneill Exp $ */ +/* $NetBSD: tegra_machdep.c,v 1.19 2015/08/22 15:10:04 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.18 2015/08/01 21:20:47 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.19 2015/08/22 15:10:04 jmcneill Exp $"); #include "opt_tegra.h" #include "opt_machdep.h" @@ -95,7 +95,9 @@ __KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.18 2015/08/01 21:20:47 jmcneill BootConfig bootconfig; char bootargs[TEGRA_MAX_BOOT_STRING] = ""; char *boot_args = NULL; +#ifdef TEGRA_UBOOT u_int uboot_args[4] = { 0 }; /* filled in by tegra_start.S (not in bss) */ +#endif extern char KERNEL_BASE_phys[]; #define KERNEL_BASE_PHYS ((paddr_t)KERNEL_BASE_phys) @@ -244,8 +246,10 @@ initarm(void *arg) DPRINTF(" ok\n"); +#ifdef TEGRA_UBOOT DPRINTF("uboot: args %#x, %#x, %#x, %#x\n", uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]); +#endif cpu_reset_address = tegra_pmc_reset; @@ -437,4 +441,37 @@ tegra_device_register(device_t self, void *aux) prop_dictionary_set_cstring(dict, "display-device", "tegradc1"); } #endif + +#ifdef BOARD_NYAN_BIG + if (device_is_a(self, "sdhc") + && device_is_a(device_parent(self), "tegraio")) { + struct tegraio_attach_args * const tio = aux; + const struct tegra_locators * const loc = &tio->tio_loc; + + if (loc->loc_port == 2) { + prop_dictionary_set_cstring(dict, "cd-gpio", "V2"); + prop_dictionary_set_cstring(dict, "power-gpio", "R0"); + } + } + + if (device_is_a(self, "ehci") + && device_is_a(device_parent(self), "tegraio")) { + struct tegraio_attach_args * const tio = aux; + const struct tegra_locators * const loc = &tio->tio_loc; + + if (loc->loc_port == 0) { + prop_dictionary_set_cstring(dict, "vbus-gpio", "N4"); + } else if (loc->loc_port == 2) { + prop_dictionary_set_cstring(dict, "vbus-gpio", "N5"); + } + } + + if (device_is_a(self, "tegrahdmi")) { + prop_dictionary_set_cstring(dict, "hpd-gpio", "N7"); + prop_dictionary_set_cstring(dict, "pll-gpio", "H7"); + prop_dictionary_set_cstring(dict, "power-gpio", "K6"); + prop_dictionary_set_cstring(dict, "ddc-device", "ddc0"); + prop_dictionary_set_cstring(dict, "display-device", "tegradc1"); + } +#endif } diff --git a/sys/arch/evbarm/tegra/tegra_start.S b/sys/arch/evbarm/tegra/tegra_start.S index 5bc07c254b28..fb86372f7b7b 100644 --- a/sys/arch/evbarm/tegra/tegra_start.S +++ b/sys/arch/evbarm/tegra/tegra_start.S @@ -1,4 +1,4 @@ -/* $NetBSD: tegra_start.S,v 1.6 2015/05/13 11:21:38 skrll Exp $ */ +/* $NetBSD: tegra_start.S,v 1.7 2015/08/22 15:10:04 jmcneill Exp $ */ /*- * Copyright (c) 2014, 2015 The NetBSD Foundation, Inc. @@ -43,7 +43,7 @@ #include #include -RCSID("$NetBSD: tegra_start.S,v 1.6 2015/05/13 11:21:38 skrll Exp $") +RCSID("$NetBSD: tegra_start.S,v 1.7 2015/08/22 15:10:04 jmcneill Exp $") #if defined(VERBOSE_INIT_ARM) #define XPUTC(n) mov r0, n; bl xputc @@ -92,6 +92,7 @@ _C_LABEL(tegra_start): /* Move into supervisor mode and disable IRQs/FIQs. */ cpsid if, #PSR_SVC32_MODE +#ifdef TEGRA_UBOOT /* * Save any arguments passed to us. */ @@ -116,6 +117,7 @@ _C_LABEL(tegra_start): teq r0, #0 bne 2b 1: +#endif /* * Turn on the SMP bit