CVS commit: src/sys/dev/fdt
Module Name:src Committed By: marty Date: Sun Jan 10 23:01:29 UTC 2016 Modified Files: src/sys/dev/fdt: fdt_intr.c Log Message: FDT Interrupt handling - change memory allocation This version does dynamic allocation of the specifier array. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/fdt_intr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/fdt_intr.c diff -u src/sys/dev/fdt/fdt_intr.c:1.6 src/sys/dev/fdt/fdt_intr.c:1.7 --- src/sys/dev/fdt/fdt_intr.c:1.6 Thu Jan 7 04:26:44 2016 +++ src/sys/dev/fdt/fdt_intr.c Sun Jan 10 23:01:29 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_intr.c,v 1.6 2016/01/07 04:26:44 marty Exp $ */ +/* $NetBSD: fdt_intr.c,v 1.7 2016/01/10 23:01:29 marty Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill@@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.6 2016/01/07 04:26:44 marty Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.7 2016/01/10 23:01:29 marty Exp $"); #include #include @@ -36,7 +36,6 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v #include #include -#define MAX_SPEC_LENGTH 6 struct fdtbus_interrupt_controller { device_t ic_dev; int ic_phandle; @@ -123,33 +122,41 @@ void * fdtbus_intr_establish(int phandle, u_int index, int ipl, int flags, int (*func)(void *), void *arg) { + void * result = NULL; u_int *specifier; - u_int maxspec[MAX_SPEC_LENGTH]; + u_int spec_length; int ihandle; struct fdtbus_interrupt_controller *ic; if (has_interrupt_map(phandle)) { - specifier = get_entry_from_map(phandle, index, maxspec); + specifier = get_entry_from_map(phandle, index, _length); ihandle = be32toh(specifier[1]); ihandle = fdtbus_get_phandle_from_native(ihandle); specifier += 2; } else { - specifier = get_specifier_by_index(phandle, index, maxspec); + specifier = get_specifier_by_index(phandle, index, + _length); ihandle = phandle; } if (specifier == NULL) { printf("%s: Unable to get specifier %d for phandle %d\n", __func__, index, phandle); - return NULL; + goto done; } ic = fdtbus_get_interrupt_controller(ihandle); if (ic == NULL) { printf("%s: Unable to get interrupt controller for %d\n", __func__, ihandle); - return NULL; + goto done; } - return ic->ic_funcs->establish(ic->ic_dev, specifier, + result = ic->ic_funcs->establish(ic->ic_dev, specifier, ipl, flags, func, arg); +done: + if (has_interrupt_map(phandle)) + specifier -= 2; + if (specifier && spec_length > 0) + kmem_free(specifier, spec_length); + return result; } void @@ -166,31 +173,40 @@ fdtbus_intr_disestablish(int phandle, vo bool fdtbus_intr_str(int phandle, u_int index, char *buf, size_t buflen) { + bool result = false; struct fdtbus_interrupt_controller *ic; int ihandle; u_int *specifier; - u_int maxspec[MAX_SPEC_LENGTH]; + u_int spec_length; if (has_interrupt_map(phandle)) { - specifier = get_entry_from_map(phandle, index, maxspec); + specifier = get_entry_from_map(phandle, index, + _length); ihandle = be32toh(specifier[1]); ihandle = fdtbus_get_phandle_from_native(ihandle); specifier += 2; } else { ihandle = phandle; - specifier = get_specifier_by_index(phandle, index, maxspec); + specifier = get_specifier_by_index(phandle, index, + _length); } if (specifier == NULL) { printf("%s: Unable to get specifier %d for phandle %d\n", __func__, index, phandle); - return false; + goto done; } ic = fdtbus_get_interrupt_controller(ihandle); if (ic == NULL) { printf("%s: Unable to get interrupt controller for %d\n", __func__, ihandle); - return false; + goto done; } - return ic->ic_funcs->intrstr(ic->ic_dev, specifier, buf, buflen); + result = ic->ic_funcs->intrstr(ic->ic_dev, specifier, buf, buflen); +done: + if (has_interrupt_map(phandle)) + specifier -= 2; + if (specifier && spec_length > 0) + kmem_free(specifier, spec_length); + return result; } /* @@ -232,7 +248,7 @@ has_interrupt_map(int phandle) * */ static u_int * -get_entry_from_map(int phandle, int pindex, u_int *specifier) +get_entry_from_map(int phandle, int pindex, u_int *spec_length) { int intr_cells; int intr_parent; @@ -262,9 +278,11 @@ get_entry_from_map(int phandle, int pind u_int pintr_cells; of_getprop_uint32(parent, "#interrupt-cells", _cells); if (index == pindex) { - for (int i = 0; i < pintr_cells; i++) -specifier[i] = p[i]; - result = specifier; + result = kmem_alloc((pintr_cells + 2) * sizeof(u_int), + KM_SLEEP); + *spec_length = (pintr_cells + 2) * sizeof (u_int); + for (int i = 0; i < pintr_cells + 2; i++) +result[i] = p[i]; goto done; } @@ -287,9 +305,11 @@ done: * and return a pointer to it. * */ -static u_int *get_specifier_by_index(int phandle, int
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Thu Jan 7 04:45:10 UTC 2016 Modified Files: src/sys/arch/arm/samsung: mct.c Log Message: exynos mct -- snapshot This code is still a mess, but at least it uses an interrupt-map so I can use it to test whether interrupt-map handling in fdt_intr_ is working properly. Need to get some real documentation and redo this so it works. :( To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/mct.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/mct.c diff -u src/sys/arch/arm/samsung/mct.c:1.9 src/sys/arch/arm/samsung/mct.c:1.10 --- src/sys/arch/arm/samsung/mct.c:1.9 Tue Jan 5 21:53:48 2016 +++ src/sys/arch/arm/samsung/mct.c Thu Jan 7 04:45:10 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: mct.c,v 1.9 2016/01/05 21:53:48 marty Exp $ */ +/* $NetBSD: mct.c,v 1.10 2016/01/07 04:45:10 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.9 2016/01/05 21:53:48 marty Exp $"); +__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.10 2016/01/07 04:45:10 marty Exp $"); #include #include @@ -54,9 +54,8 @@ __KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.9 static int mct_match(device_t, cfdata_t, void *); static void mct_attach(device_t, device_t, void *); -static int mct_intr(void *arg); -//static int clockhandler(void *); +static int clockhandler(void *); CFATTACH_DECL_NEW(exyo_mct, 0, mct_match, mct_attach, NULL, NULL); @@ -74,7 +73,6 @@ static struct timecounter mct_timecounte }; #endif - static inline uint32_t mct_read_global(struct mct_softc *sc, bus_size_t o) { @@ -174,12 +172,8 @@ mct_attach(device_t parent, device_t sel device_xname(self), "missing interrupts"); for (int i = 0; i < 12; i++) - fdtbus_intr_establish(faa->faa_phandle, i, 0, 0, mct_intr, 0); -} - -static int mct_intr(void *arg) -{ - return 0; + fdtbus_intr_establish(faa->faa_phandle, i, 0, 0, + clockhandler, 0); } static inline uint64_t @@ -194,7 +188,6 @@ mct_gettime(struct mct_softc *sc) } -#if 0 /* interrupt handler */ static int clockhandler(void *arg) @@ -221,7 +214,6 @@ clockhandler(void *arg) /* handled */ return 1; } -#endif void mct_init_cpu_clock(struct cpu_info *ci)
CVS commit: src/sys
Module Name:src Committed By: marty Date: Tue Jan 5 21:53:48 UTC 2016 Modified Files: src/sys/arch/arm/fdt: gic_fdt.c src/sys/arch/arm/nvidia: tegra_lic.c src/sys/arch/arm/samsung: exynos_combiner.c mct.c src/sys/arch/evbarm/conf: EXYNOS src/sys/dev/fdt: fdt_intr.c fdtvar.h Log Message: FDT: Interrupts -- add support for interrupt maps The mct on exynos uses an interrupt map so we add support now. Devices represent their interrupts either through a combination of interrupt-parent and interrupts properties, where the 'interrupts' property is an array of one or more interrupt specifiers; or through a combination of an interrupt-parent that points to an interrupt-map, where the interrupt-map contains 2 or more entries consisting of an index, a pointer to an interrupt-controller, and a specifier for that controller. This code adds the ability to walk the interrupt-map and return a specifier. Unfortunately, the addition requires changing the interface to the interrupt-controllers' _establish and _intstr functions, so this check in contains a rototill of the three existing fdt interrupt controllers to use the new interface. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/fdt/gic_fdt.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/nvidia/tegra_lic.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos_combiner.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/mct.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/conf/EXYNOS cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/fdt_intr.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/fdtvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/fdt/gic_fdt.c diff -u src/sys/arch/arm/fdt/gic_fdt.c:1.1 src/sys/arch/arm/fdt/gic_fdt.c:1.2 --- src/sys/arch/arm/fdt/gic_fdt.c:1.1 Sun Dec 13 17:45:37 2015 +++ src/sys/arch/arm/fdt/gic_fdt.c Tue Jan 5 21:53:48 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: gic_fdt.c,v 1.1 2015/12/13 17:45:37 jmcneill Exp $ */ +/* $NetBSD: gic_fdt.c,v 1.2 2016/01/05 21:53:48 marty Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill@@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.1 2015/12/13 17:45:37 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.2 2016/01/05 21:53:48 marty Exp $"); #include #include @@ -44,10 +44,10 @@ __KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v static int gic_fdt_match(device_t, cfdata_t, void *); static void gic_fdt_attach(device_t, device_t, void *); -static void * gic_fdt_establish(device_t, int, u_int, int, int, +static void * gic_fdt_establish(device_t, u_int *, int, int, int (*)(void *), void *); static void gic_fdt_disestablish(device_t, void *); -static bool gic_fdt_intrstr(device_t, int, u_int, char *, size_t); +static bool gic_fdt_intrstr(device_t, u_int *, char *, size_t); struct fdtbus_interrupt_controller_func gic_fdt_funcs = { .establish = gic_fdt_establish, @@ -100,49 +100,21 @@ gic_fdt_attach(device_t parent, device_t } static void * -gic_fdt_establish(device_t dev, int phandle, u_int index, int ipl, int flags, +gic_fdt_establish(device_t dev, u_int *specifier, int ipl, int flags, int (*func)(void *), void *arg) { - struct gic_fdt_softc * const sc = device_private(dev); int iflags = (flags & FDT_INTR_MPSAFE) ? IST_MPSAFE : 0; - u_int *interrupts; - int interrupt_cells, len; - - len = OF_getprop(sc->sc_phandle, "#interrupt-cells", _cells, - sizeof(interrupt_cells)); - if (len != sizeof(interrupt_cells) || interrupt_cells <= 0) - return NULL; - interrupt_cells = be32toh(interrupt_cells); - - len = OF_getproplen(phandle, "interrupts"); - if (len <= 0) - return NULL; - - const u_int clen = interrupt_cells * 4; - const u_int nintr = len / interrupt_cells; - - if (index >= nintr) - return NULL; - - interrupts = kmem_alloc(len, KM_SLEEP); - - if (OF_getprop(phandle, "interrupts", interrupts, len) != len) { - kmem_free(interrupts, len); - return NULL; - } /* 1st cell is the interrupt type; 0 is SPI, 1 is PPI */ /* 2nd cell is the interrupt number */ /* 3rd cell is flags */ - const u_int type = be32toh(interrupts[index * clen + 0]); - const u_int intr = be32toh(interrupts[index * clen + 1]); + const u_int type = be32toh(specifier[0]); + const u_int intr = be32toh(specifier[1]); const u_int irq = type == 0 ? IRQ_SPI(intr) : IRQ_PPI(intr); - const u_int trig = be32toh(interrupts[index * clen + 2]) & 0xf; + const u_int trig = be32toh(specifier[2]) & 0xf; const u_int level = (trig & 0x3) ? IST_EDGE : IST_LEVEL; - kmem_free(interrupts, len); - return intr_establish(irq, ipl, level | iflags, func, arg); } @@ -153,49 +125,18 @@ gic_fdt_disestablish(device_t dev, void } static bool -gic_fdt_intrstr(device_t dev, int phandle, u_int index, char *buf, -size_t buflen) +gic_fdt_intrstr(device_t dev, u_int *specifier, char
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: marty Date: Tue Jan 5 21:57:18 UTC 2016 Modified Files: src/sys/dev/fdt: fdt_intr.c Log Message: FDT interrupts -- clean up debug printfs Ooops. forgot to delete my debug printfs before my last checkin. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/fdt_intr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/fdt_intr.c diff -u src/sys/dev/fdt/fdt_intr.c:1.4 src/sys/dev/fdt/fdt_intr.c:1.5 --- src/sys/dev/fdt/fdt_intr.c:1.4 Tue Jan 5 21:53:48 2016 +++ src/sys/dev/fdt/fdt_intr.c Tue Jan 5 21:57:18 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_intr.c,v 1.4 2016/01/05 21:53:48 marty Exp $ */ +/* $NetBSD: fdt_intr.c,v 1.5 2016/01/05 21:57:18 marty Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill@@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.4 2016/01/05 21:53:48 marty Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.5 2016/01/05 21:57:18 marty Exp $"); #include #include @@ -271,14 +271,10 @@ static u_int *get_specifier_by_index(int u_int *specifiers; int interrupt_parent, interrupt_cells, len; - printf("%s: phandle = %d pindex = %d\n", __func__, phandle, pindex); - len = OF_getprop(phandle, "interrupt-parent", _parent, sizeof(interrupt_parent)); interrupt_parent = be32toh(interrupt_parent); interrupt_parent = fdtbus_get_phandle_from_native(interrupt_parent); - printf("%s: len = %d interrupt_parent = %d\n", __func__, len, - interrupt_parent); if (len != sizeof(interrupt_parent) || interrupt_parent <= 0) { printf("%s: interrupt_parent sanity check failed\n", __func__); return NULL; @@ -287,8 +283,6 @@ static u_int *get_specifier_by_index(int len = OF_getprop(interrupt_parent, "#interrupt-cells", _cells, sizeof(interrupt_cells)); interrupt_cells = be32toh(interrupt_cells); - printf("%s: len = %d interrupt_cells = %d\n", __func__, len, - interrupt_cells); if (len != sizeof(interrupt_cells) || interrupt_cells <= 0) { printf("%s: interrupt_celyls sanity check failed\n", __func__); return NULL;
CVS commit: src/sys/arch/arm/samsung
/12/27 02:54:12 marty Exp $ +# $NetBSD: files.exynos,v 1.21 2016/01/03 04:10:58 marty Exp $ # # Configuration info for Samsung Exynos SoC ARM Peripherals # @@ -58,6 +58,11 @@ device chipid : fdtbus attach chipid at fdt with exynos_chipid file arch/arm/samsung/exynos_chipid.c exynos_chipid +# SYSMMU +device sysmmu : fdtbus +attach sysmmu at fdt with exynos_sysmmu +file arch/arm/samsung/exynos_sysmmu.c exynos_sysmmu + # real time clock device exyortc : ftdbus attach exyortc at fdt with exynos_rtc Index: src/sys/arch/arm/samsung/mct.c diff -u src/sys/arch/arm/samsung/mct.c:1.7 src/sys/arch/arm/samsung/mct.c:1.8 --- src/sys/arch/arm/samsung/mct.c:1.7 Mon Dec 21 00:54:35 2015 +++ src/sys/arch/arm/samsung/mct.c Sun Jan 3 04:10:58 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: mct.c,v 1.7 2015/12/21 00:54:35 marty Exp $ */ +/* $NetBSD: mct.c,v 1.8 2016/01/03 04:10:58 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.7 2015/12/21 00:54:35 marty Exp $"); +__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.8 2016/01/03 04:10:58 marty Exp $"); #include #include @@ -54,7 +54,7 @@ __KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.7 static int mct_match(device_t, cfdata_t, void *); static void mct_attach(device_t, device_t, void *); -static int clockhandler(void *); +//static int clockhandler(void *); CFATTACH_DECL_NEW(exyo_mct, 0, mct_match, mct_attach, NULL, NULL); @@ -160,7 +160,7 @@ mct_attach(device_t parent, device_t sel self->dv_private = sc; sc->sc_dev = self; sc->sc_bst = faa->faa_bst; - /* MJF: Need to get irq from the dtd */ + /* MJF: Need to get irqs from the dtd */ // sc->sc_irq = exyo->exyo_loc.loc_intr; error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh); @@ -176,11 +176,11 @@ mct_attach(device_t parent, device_t sel evcnt_attach_dynamic(>sc_ev_missing_ticks, EVCNT_TYPE_MISC, NULL, device_xname(self), "missing interrupts"); - sc->sc_global_ih = intr_establish(sc->sc_irq, IPL_CLOCK, IST_EDGE, - clockhandler, NULL); - if (sc->sc_global_ih == NULL) - panic("%s: unable to register timer interrupt", __func__); - aprint_normal_dev(sc->sc_dev, "interrupting on irq %d\n", sc->sc_irq); +// sc->sc_global_ih = intr_establish(sc->sc_irq, IPL_CLOCK, IST_EDGE, +// clockhandler, NULL); +// if (sc->sc_global_ih == NULL) +// panic("%s: unable to register timer interrupt", __func__); +// aprint_normal_dev(sc->sc_dev, "interrupting on irq %d\n", sc->sc_irq); } @@ -196,6 +196,7 @@ mct_gettime(struct mct_softc *sc) } +#if 0 /* interrupt handler */ static int clockhandler(void *arg) @@ -222,7 +223,7 @@ clockhandler(void *arg) /* handled */ return 1; } - +#endif void mct_init_cpu_clock(struct cpu_info *ci) Added files: Index: src/sys/arch/arm/samsung/exynos_sysmmu.c diff -u /dev/null src/sys/arch/arm/samsung/exynos_sysmmu.c:1.1 --- /dev/null Sun Jan 3 04:10:58 2016 +++ src/sys/arch/arm/samsung/exynos_sysmmu.c Sun Jan 3 04:10:58 2016 @@ -0,0 +1,130 @@ +/* $NetBSD: exynos_sysmmu.c,v 1.1 2016/01/03 04:10:58 marty Exp $ */ + +/*- +* Copyright (c) 2015 The NetBSD Foundation, Inc. +* All rights reserved. +* +* This code is derived from software contributed to The NetBSD Foundation +* by Marty Fouts +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +*notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +*notice, this list of conditions and the following disclaimer in the +*documentation and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "opt_exynos.h" +#include "opt_arm_debug.h" +#include "gpio.h" + +#include +__KERNEL_RCSID(1, "$NetBSD: exynos_sysmmu.c,v 1.1 2016/01/03 04:10:58 marty Exp $"); + +#include +#include +#include +#include +#include +#include +#in
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: marty Date: Fri Jan 1 22:35:44 UTC 2016 Modified Files: src/sys/dev/fdt: fdt_pinctrl.c fdtvar.h Log Message: FDT pinctl - review from Jared These changes reflect a redesign based on a preliminary review by Jared. Instead of the acquire/release/set/get approach of the original, this uses a much simpler, and cleaner register/set approach. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_pinctrl.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/fdtvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/fdt_pinctrl.c diff -u src/sys/dev/fdt/fdt_pinctrl.c:1.1 src/sys/dev/fdt/fdt_pinctrl.c:1.2 --- src/sys/dev/fdt/fdt_pinctrl.c:1.1 Wed Dec 30 04:23:39 2015 +++ src/sys/dev/fdt/fdt_pinctrl.c Fri Jan 1 22:35:44 2016 @@ -1,7 +1,7 @@ -/* $NetBSD: fdt_pinctrl.c,v 1.1 2015/12/30 04:23:39 marty Exp $ */ +/* $NetBSD: fdt_pinctrl.c,v 1.2 2016/01/01 22:35:44 marty Exp $ */ /*- - * Copyright (c) 2015 Jared D. McNeill+ * Copyright (c) 2015 Martin Fouts * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.1 2015/12/30 04:23:39 marty Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.2 2016/01/01 22:35:44 marty Exp $"); #include #include @@ -37,8 +37,8 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl. #include struct fdtbus_pinctrl_controller { - device_t pc_dev; int pc_phandle; + void *pc_cookie; const struct fdtbus_pinctrl_controller_func *pc_funcs; struct fdtbus_pinctrl_controller *pc_next; @@ -47,13 +47,13 @@ struct fdtbus_pinctrl_controller { static struct fdtbus_pinctrl_controller *fdtbus_pc = NULL; int -fdtbus_register_pinctrl_controller(device_t dev, int phandle, +fdtbus_register_pinctrl_config(void *cookie, int phandle, const struct fdtbus_pinctrl_controller_func *funcs) { struct fdtbus_pinctrl_controller *pc; pc = kmem_alloc(sizeof(*pc), KM_SLEEP); - pc->pc_dev = dev; + pc->pc_cookie = cookie; pc->pc_phandle = phandle; pc->pc_funcs = funcs; @@ -63,49 +63,70 @@ fdtbus_register_pinctrl_controller(devic return 0; } -struct fdtbus_pinctrl_pin * -fdtbus_pinctrl_acquire(int phandle, const char *prop) +static struct fdtbus_pinctrl_controller * +fdtbus_pinctrl_lookup(int phandle) { struct fdtbus_pinctrl_controller *pc; - struct fdtbus_pinctrl_pin *gp; - gp = kmem_alloc(sizeof(*gp), KM_SLEEP); - for (pc = fdtbus_pc; pc; pc = pc->pc_next) { - gp->pp_pc = pc; - gp->pp_priv = pc->pc_funcs->acquire(pc->pc_dev, prop); - if (gp->pp_priv != NULL) - break; - } - - if (gp->pp_priv == NULL) { - kmem_free(gp, sizeof(*gp)); - return NULL; - } + for (pc = fdtbus_pc; pc; pc = pc->pc_next) + if (pc->pc_phandle == phandle) + return pc; - return gp; + return NULL; } -void -fdtbus_pinctrl_release(struct fdtbus_pinctrl_pin *gp) +int +fdtbus_pinctrl_set_config_index(int phandle, u_int index) { - struct fdtbus_pinctrl_controller *pc = gp->pp_pc; + char buf[80]; + int len, handle; + struct fdtbus_pinctrl_controller *pc; - pc->pc_funcs->release(pc->pc_dev, gp->pp_priv); - kmem_free(gp, sizeof(*gp)); -} + snprintf(buf, 80, "pinctrl-%d", index); -void -fdtbus_pinctrl_get_cfg(struct fdtbus_pinctrl_pin *gp, void *cookie) -{ - struct fdtbus_pinctrl_controller *pc = gp->pp_pc; + len = OF_getprop(phandle, buf, (char *), +sizeof(handle)); + if (len != sizeof(int)) { + printf("%s: couldn't get %s.\n", __func__, buf); + return -1; + } + + handle = fdtbus_get_phandle_from_native(be32toh(handle)); + + pc = fdtbus_pinctrl_lookup(handle); + if (!pc) { + printf("%s: Couldn't get handle %d for %s\n", __func__, handle, + buf); + return -1; + } - pc->pc_funcs->get(gp, cookie); + return pc->pc_funcs->set_config(pc->pc_cookie); } -void -fdtbus_pinctrl_set_cfg(struct fdtbus_pinctrl_pin *gp, void *cookie) +int +fdtbus_pinctrl_set_config(int phandle, const char *cfgname) { - struct fdtbus_pinctrl_controller *pc = gp->pp_pc; + int index = 0; + int len; + char *result; + char *next; + + len = OF_getproplen(phandle, "pinctrl-names"); + if (len <= 0) + return -1; + result = kmem_zalloc(len, KM_SLEEP); + OF_getprop(phandle, "pinctrl-names", result, len); + + next = result; + while (next - result < len) { + if (!strcmp(next, cfgname)) { + return fdtbus_pinctrl_set_config_index(phandle, index); + } + index++; + while (*next) + next++; + next++; + } - pc->pc_funcs->set(gp, cookie); + return -1; } Index: src/sys/dev/fdt/fdtvar.h diff -u src/sys/dev/fdt/fdtvar.h:1.5 src/sys/dev/fdt/fdtvar.h:1.6 --- src/sys/dev/fdt/fdtvar.h:1.5 Wed Dec 30 04:23:39 2015 +++ src/sys/dev/fdt/fdtvar.h Fri Jan 1 22:35:44 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtvar.h,v 1.5 2015/12/30 04:23:39 marty Exp $ */ +/* $NetBSD:
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Fri Jan 1 22:37:07 UTC 2016 Modified Files: src/sys/arch/arm/samsung: exynos_i2c.c exynos_pinctrl.c Log Message: XU4 FDT pinctrl Rewrite the use of pinctrl to reflect the new model from Jared. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/exynos_i2c.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/exynos_pinctrl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_i2c.c diff -u src/sys/arch/arm/samsung/exynos_i2c.c:1.9 src/sys/arch/arm/samsung/exynos_i2c.c:1.10 --- src/sys/arch/arm/samsung/exynos_i2c.c:1.9 Wed Dec 30 04:30:27 2015 +++ src/sys/arch/arm/samsung/exynos_i2c.c Fri Jan 1 22:37:07 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_i2c.c,v 1.9 2015/12/30 04:30:27 marty Exp $ */ +/* $NetBSD: exynos_i2c.c,v 1.10 2016/01/01 22:37:07 marty Exp $ */ /* * Copyright (c) 2015 Jared D. McNeill@@ -31,7 +31,7 @@ #include "opt_arm_debug.h" #include -__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.9 2015/12/30 04:30:27 marty Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.10 2016/01/01 22:37:07 marty Exp $"); #include #include @@ -144,18 +144,11 @@ exynos_i2c_attach(device_t parent, devic bus_size_t size; int error; - char result[64]; - int i2c_handle; - int len; - int handle; - int func, pud, drv; - if (fdtbus_get_reg(phandle, 0, , ) != 0) { aprint_error(": couldn't get registers\n"); return; } - sc->sc_dev = self; sc->sc_bst = faa->faa_bst; error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh); @@ -182,66 +175,8 @@ exynos_i2c_attach(device_t parent, devic return; } aprint_normal_dev(self, "interrupting on %s\n", intrstr); - - len = OF_getprop(phandle, "pinctrl-0", (char *), - sizeof(handle)); - if (len != sizeof(int)) { - aprint_error_dev(self, "couldn't get pinctrl-0.\n"); - return; - } - - i2c_handle = fdtbus_get_phandle_from_native(be32toh(handle)); - len = OF_getprop(i2c_handle, "samsung,pins", result, sizeof(result)); - if (len <= 0) { - aprint_error_dev(self, "couldn't get pins.\n"); - return; - } - len = OF_getprop(i2c_handle, "samsung,pin-function", - , sizeof(handle)); - if (len <= 0) { - aprint_error_dev(self, "couldn't get pin-function.\n"); - return; - } else - func = be32toh(handle); - - sc->sc_sda = fdtbus_pinctrl_acquire(phandle, [0]); - if (sc->sc_sda == NULL) { - printf("could not acquire sda gpio %s\n", [0]); - return; - } - - sc->sc_scl = fdtbus_pinctrl_acquire(phandle, [7]); - if (sc->sc_scl == NULL) { - printf("could not acquire scl gpio %s\n", [7]); - return; - } - - len = OF_getprop(i2c_handle, "samsung,pin-pud", , - sizeof()); - if (len <= 0) { - aprint_error_dev(self, "couldn't get pin-pud.\n"); - return; - } else - pud = be32toh(handle); - - len = OF_getprop(i2c_handle, "samsung,pin-drv", , - sizeof()); - if (len <= 0) { - aprint_error_dev(self, "couldn't get pin-drv.\n"); - return; - } else - drv = be32toh(handle); - - struct exynos_gpio_pin_cfg cfg; - cfg.cfg = func; - cfg.pud = pud; - cfg.drv = drv; - cfg.conpwd = 0; - cfg.pudpwd = 0; - - fdtbus_pinctrl_set_cfg(sc->sc_scl, ); - fdtbus_pinctrl_set_cfg(sc->sc_sda, ); + fdtbus_pinctrl_set_config_index(phandle, 0); sc->sc_ic.ic_cookie = sc; sc->sc_ic.ic_acquire_bus = exynos_i2c_acquire_bus; Index: src/sys/arch/arm/samsung/exynos_pinctrl.c diff -u src/sys/arch/arm/samsung/exynos_pinctrl.c:1.8 src/sys/arch/arm/samsung/exynos_pinctrl.c:1.9 --- src/sys/arch/arm/samsung/exynos_pinctrl.c:1.8 Wed Dec 30 04:30:27 2015 +++ src/sys/arch/arm/samsung/exynos_pinctrl.c Fri Jan 1 22:37:07 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_pinctrl.c,v 1.8 2015/12/30 04:30:27 marty Exp $ */ +/* $NetBSD: exynos_pinctrl.c,v 1.9 2016/01/01 22:37:07 marty Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.8 2015/12/30 04:30:27 marty Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.9 2016/01/01 22:37:07 marty Exp $"); #include #include @@ -53,19 +53,21 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_pinct #include +struct exynos_pinctrl_config { + int pc_phandle; + struct exynos_gpio_pin_cfg *pc_pincfg; + struct exynos_pinctrl_softc *pc_sc; +}; + static int exynos_pinctrl_match(device_t, cfdata_t, void *); static void exynos_pinctrl_attach(device_t, device_t, void *); -static void *exynos_pinctrl_acquire(device_t, const char *); -static void exynos_pinctrl_release(device_t, void *); -static void exynos_pinctrl_get_cfg(struct fdtbus_pinctrl_pin *, void *); -static void exynos_pinctrl_set_cfg(struct fdtbus_pinctrl_pin *, void *); +static int exynos_pinctrl_set_cfg(void *); +static struct exynos_gpio_pin_cfg * +exynos_parse_config(struct exynos_pinctrl_config *pc); static struct
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Thu Dec 31 03:50:34 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_gpio.c Log Message: XU4 gpio - get rid of annoying printf To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/samsung/exynos_gpio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_gpio.c diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.22 src/sys/arch/arm/samsung/exynos_gpio.c:1.23 --- src/sys/arch/arm/samsung/exynos_gpio.c:1.22 Wed Dec 30 04:30:27 2015 +++ src/sys/arch/arm/samsung/exynos_gpio.c Thu Dec 31 03:50:34 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_gpio.c,v 1.22 2015/12/30 04:30:27 marty Exp $ */ +/* $NetBSD: exynos_gpio.c,v 1.23 2015/12/31 03:50:34 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.22 2015/12/30 04:30:27 marty Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.23 2015/12/31 03:50:34 marty Exp $"); #include #include @@ -392,7 +392,6 @@ exynos_gpio_fdt_acquire(device_t dev, co if (bank == NULL) return NULL; - printf("gpio pin %s-%d being acquired\n", bank->bank_name, pin); gpin = kmem_alloc(sizeof(*gpin), KM_SLEEP); gpin->pin_sc = bank->bank_sc; gpin->pin_bank = bank;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: marty Date: Wed Dec 30 04:23:39 UTC 2015 Modified Files: src/sys/dev/fdt: fdtvar.h files.fdt Added Files: src/sys/dev/fdt: fdt_pinctrl.c Log Message: FDT pinctrl Add a pinctrl bus to FDT. This works against exynos, but someone(tm) needs to think about whether it is general enough or too specific to exynos. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/fdt_pinctrl.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/fdtvar.h cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/files.fdt Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/fdtvar.h diff -u src/sys/dev/fdt/fdtvar.h:1.4 src/sys/dev/fdt/fdtvar.h:1.5 --- src/sys/dev/fdt/fdtvar.h:1.4 Tue Dec 22 22:19:07 2015 +++ src/sys/dev/fdt/fdtvar.h Wed Dec 30 04:23:39 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtvar.h,v 1.4 2015/12/22 22:19:07 jmcneill Exp $ */ +/* $NetBSD: fdtvar.h,v 1.5 2015/12/30 04:23:39 marty Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill@@ -76,6 +76,20 @@ struct fdtbus_gpio_controller_func { void (*write)(device_t, void *, int, bool); }; +struct fdtbus_pinctrl_controller; + +struct fdtbus_pinctrl_pin { + struct fdtbus_pinctrl_controller *pp_pc; + void *pp_priv; +}; + +struct fdtbus_pinctrl_controller_func { + void * (*acquire)(device_t, const char *); + void (*release)(device_t, void *); + void (*get)(struct fdtbus_pinctrl_pin *, void *); + void (*set)(struct fdtbus_pinctrl_pin *, void *); +}; + struct fdtbus_regulator_controller; struct fdtbus_regulator { @@ -112,6 +126,8 @@ int fdtbus_register_i2c_controller(devi const struct fdtbus_i2c_controller_func *); int fdtbus_register_gpio_controller(device_t, int, const struct fdtbus_gpio_controller_func *); +int fdtbus_register_pinctrl_controller(device_t, int, + const struct fdtbus_pinctrl_controller_func *); int fdtbus_register_regulator_controller(device_t, int, const struct fdtbus_regulator_controller_func *); int fdtbus_register_clock_controller(device_t, int, @@ -133,6 +149,10 @@ int fdtbus_gpio_read(struct fdtbus_gpio void fdtbus_gpio_write(struct fdtbus_gpio_pin *, int); int fdtbus_gpio_read_raw(struct fdtbus_gpio_pin *); void fdtbus_gpio_write_raw(struct fdtbus_gpio_pin *, int); +struct fdtbus_pinctrl_pin *fdtbus_pinctrl_acquire(int, const char *); +void fdtbus_pinctrl_release(struct fdtbus_pinctrl_pin *); +void fdtbus_pinctrl_set_cfg(struct fdtbus_pinctrl_pin *, void *); +void fdtbus_pinctrl_get_cfg(struct fdtbus_pinctrl_pin *, void *); struct fdtbus_regulator *fdtbus_regulator_acquire(int, const char *); void fdtbus_regulator_release(struct fdtbus_regulator *); int fdtbus_regulator_enable(struct fdtbus_regulator *); Index: src/sys/dev/fdt/files.fdt diff -u src/sys/dev/fdt/files.fdt:1.6 src/sys/dev/fdt/files.fdt:1.7 --- src/sys/dev/fdt/files.fdt:1.6 Wed Dec 23 11:31:45 2015 +++ src/sys/dev/fdt/files.fdt Wed Dec 30 04:23:39 2015 @@ -1,4 +1,4 @@ -# $NetBSD: files.fdt,v 1.6 2015/12/23 11:31:45 jmcneill Exp $ +# $NetBSD: files.fdt,v 1.7 2015/12/30 04:23:39 marty Exp $ include "external/bsd/libfdt/conf/files.libfdt" @@ -30,3 +30,4 @@ file dev/fdt/fdt_i2c.c fdtbus file dev/fdt/fdt_intr.c fdtbus file dev/fdt/fdt_regulator.c fdtbus file dev/fdt/fdt_reset.c fdtbus +file dev/fdt/fdt_pinctrl.c fdtbus Added files: Index: src/sys/dev/fdt/fdt_pinctrl.c diff -u /dev/null src/sys/dev/fdt/fdt_pinctrl.c:1.1 --- /dev/null Wed Dec 30 04:23:39 2015 +++ src/sys/dev/fdt/fdt_pinctrl.c Wed Dec 30 04:23:39 2015 @@ -0,0 +1,111 @@ +/* $NetBSD: fdt_pinctrl.c,v 1.1 2015/12/30 04:23:39 marty Exp $ */ + +/*- + * Copyright (c) 2015 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Wed Dec 30 04:30:27 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_combiner.c exynos_gpio.c exynos_i2c.c exynos_pinctrl.c exynos_var.h Log Message: XU4 i2c, gpio & pinctrl changes modify exynos_gpio.c to support the new pinctrl model. set up the new pinctrl model in exynos_pinctrl.c Flesh out exynos_i2c.c and set it up to use the new pinctrl model. NOTE: exynos_i2c.c is still incomplete. I need to figure out what to set the prescaler and scaler to. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/samsung/exynos_combiner.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/samsung/exynos_gpio.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/exynos_i2c.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos_pinctrl.c cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/samsung/exynos_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_combiner.c diff -u src/sys/arch/arm/samsung/exynos_combiner.c:1.3 src/sys/arch/arm/samsung/exynos_combiner.c:1.4 --- src/sys/arch/arm/samsung/exynos_combiner.c:1.3 Thu Dec 24 21:20:17 2015 +++ src/sys/arch/arm/samsung/exynos_combiner.c Wed Dec 30 04:30:27 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_combiner.c,v 1.3 2015/12/24 21:20:17 marty Exp $ */ +/* $NetBSD: exynos_combiner.c,v 1.4 2015/12/30 04:30:27 marty Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.3 2015/12/24 21:20:17 marty Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.4 2015/12/30 04:30:27 marty Exp $"); #include #include @@ -197,7 +197,7 @@ exynos_combiner_intrstr(device_t dev, in kmem_free(interrupts, len); - snprintf(buf, buflen, "LIC irq %d", irq); + snprintf(buf, buflen, "combiner irq %d", irq); return true; } Index: src/sys/arch/arm/samsung/exynos_gpio.c diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.21 src/sys/arch/arm/samsung/exynos_gpio.c:1.22 --- src/sys/arch/arm/samsung/exynos_gpio.c:1.21 Sun Dec 27 12:42:14 2015 +++ src/sys/arch/arm/samsung/exynos_gpio.c Wed Dec 30 04:30:27 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_gpio.c,v 1.21 2015/12/27 12:42:14 jmcneill Exp $ */ +/* $NetBSD: exynos_gpio.c,v 1.22 2015/12/30 04:30:27 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.21 2015/12/27 12:42:14 jmcneill Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.22 2015/12/30 04:30:27 marty Exp $"); #include #include @@ -53,16 +53,6 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_gpio. #include -struct exynos_gpio_pin_cfg { - uint32_t cfg; - uint32_t pud; - uint32_t drv; - uint32_t conpwd; - uint32_t pudpwd; -}; - -struct exynos_gpio_softc; - struct exynos_gpio_bank { const char bank_name[6]; device_t bank_dev; @@ -80,12 +70,6 @@ struct exynos_gpio_bank { struct exynos_gpio_bank * bank_next; }; -struct exynos_gpio_softc { - device_t sc_dev; - bus_space_tag_t sc_bst; - bus_space_handle_t sc_bsh; -}; - struct exynos_gpio_pin { struct exynos_gpio_softc *pin_sc; int pin_no; @@ -144,7 +128,7 @@ static struct exynos_gpio_bank exynos5_b GPIO_GRP(5, MUXD, 0x00E0, gpb4, 2), GPIO_GRP(5, MUXD, 0x0100, gph0, 4), - GPIO_GRP(5, MUXE, 0x, gpz0, 7), + GPIO_GRP(5, MUXE, 0x, gpz, 7), }; @@ -159,7 +143,6 @@ static void exynos_gpio_fdt_release(devi static int exynos_gpio_fdt_read(device_t, void *, bool); static void exynos_gpio_fdt_write(device_t, void *, int, bool); -static struct exynos_gpio_bank *exynos_gpio_bank_lookup(const char *); static int exynos_gpio_cfprint(void *, const char *); struct fdtbus_gpio_controller_func exynos_gpio_funcs = { @@ -279,7 +262,27 @@ exynos_gpio_pin_ctl(void *cookie, int pi exynos_gpio_update_cfg_regs(bank, ); } -void +void exynos_gpio_pin_ctl_read(const struct exynos_gpio_bank *bank, + struct exynos_gpio_pin_cfg *cfg) +{ + cfg->cfg = GPIO_READ(bank, EXYNOS_GPIO_CON); + cfg->pud = GPIO_READ(bank, EXYNOS_GPIO_PUD); + cfg->drv = GPIO_READ(bank, EXYNOS_GPIO_DRV); + cfg->conpwd = GPIO_READ(bank, EXYNOS_GPIO_CONPWD); + cfg->pudpwd = GPIO_READ(bank, EXYNOS_GPIO_PUDPWD); +} + +void exynos_gpio_pin_ctl_write(const struct exynos_gpio_bank *bank, + const struct exynos_gpio_pin_cfg *cfg) +{ + GPIO_WRITE(bank, EXYNOS_GPIO_CON, cfg->cfg); + GPIO_WRITE(bank, EXYNOS_GPIO_PUD, cfg->pud); + GPIO_WRITE(bank, EXYNOS_GPIO_DRV, cfg->drv); + GPIO_WRITE(bank, EXYNOS_GPIO_CONPWD, cfg->conpwd); + GPIO_WRITE(bank, EXYNOS_GPIO_PUDPWD, cfg->pudpwd); +} + +struct exynos_gpio_softc * exynos_gpio_bank_config(struct exynos_pinctrl_softc * parent, const struct fdt_attach_args *faa, int node) { @@ -294,13 +297,14 @@ exynos_gpio_bank_config(struct
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Sun Dec 27 02:43:42 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_gpio.c Log Message: XU4 gpio clean up acquire code properly locate the bank in the acquire code. This may even work. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/samsung/exynos_gpio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_gpio.c diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.18 src/sys/arch/arm/samsung/exynos_gpio.c:1.19 --- src/sys/arch/arm/samsung/exynos_gpio.c:1.18 Thu Dec 24 01:10:51 2015 +++ src/sys/arch/arm/samsung/exynos_gpio.c Sun Dec 27 02:43:42 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_gpio.c,v 1.18 2015/12/24 01:10:51 marty Exp $ */ +/* $NetBSD: exynos_gpio.c,v 1.19 2015/12/27 02:43:42 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.18 2015/12/24 01:10:51 marty Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.19 2015/12/27 02:43:42 marty Exp $"); #include #include @@ -365,17 +365,22 @@ exynos_gpio_pin_lookup(const char *pinna static void * exynos_gpio_fdt_acquire(device_t dev, const void *data, size_t len, int flags) { - /* MJF: This is wrong. data is a u_int but I need a name */ -// const u_int *gpio = data; - const char *pinname = data; - const struct exynos_gpio_bank *bank; + const u_int *cells = data; + const struct exynos_gpio_bank *bank = NULL; struct exynos_gpio_pin *gpin; - int pin; + int pin = be32toh(cells[0]) & 0x0f; + int n; - bank = exynos_gpio_pin_lookup(pinname, ); + for (n = 0; n < __arraycount(exynos5_banks); n++) { + if (exynos_gpio_banks[n].bank_sc->sc_dev == dev) { + bank = _gpio_banks[n]; + break; + } + } if (bank == NULL) return NULL; + printf("gpio pin %s-%d being acquired\n", bank->bank_name, pin); gpin = kmem_alloc(sizeof(*gpin), KM_SLEEP); gpin->pin_sc = bank->bank_sc; gpin->pin_bank = bank;
CVS commit: src/sys/arch
Module Name:src Committed By: marty Date: Sun Dec 27 02:54:13 UTC 2015 Modified Files: src/sys/arch/arm/samsung: files.exynos src/sys/arch/evbarm/conf: EXYNOS Added Files: src/sys/arch/arm/samsung: exynos_ehci.c exynos_ohci.c exynos_usb3.c exynos_usbphy.c Removed Files: src/sys/arch/arm/samsung: exynos_usb.c Log Message: XU4 USB snapshot: Reorganize source files This is just a skeleton, not a set of drivers, but the pieces are now more or less in the right places. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/samsung/exynos_ehci.c \ src/sys/arch/arm/samsung/exynos_ohci.c \ src/sys/arch/arm/samsung/exynos_usb3.c \ src/sys/arch/arm/samsung/exynos_usbphy.c cvs rdiff -u -r1.15 -r0 src/sys/arch/arm/samsung/exynos_usb.c cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/samsung/files.exynos cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/conf/EXYNOS Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/files.exynos diff -u src/sys/arch/arm/samsung/files.exynos:1.19 src/sys/arch/arm/samsung/files.exynos:1.20 --- src/sys/arch/arm/samsung/files.exynos:1.19 Sat Dec 26 23:13:50 2015 +++ src/sys/arch/arm/samsung/files.exynos Sun Dec 27 02:54:12 2015 @@ -1,4 +1,4 @@ -# $NetBSD: files.exynos,v 1.19 2015/12/26 23:13:50 jmcneill Exp $ +# $NetBSD: files.exynos,v 1.20 2015/12/27 02:54:12 marty Exp $ # # Configuration info for Samsung Exynos SoC ARM Peripherals # @@ -87,12 +87,24 @@ attach exyopctl at fdt with exynos_pinc file arch/arm/samsung/exynos_pinctrl.c exynos_pinctrl needs-flag file arch/arm/samsung/exynos_gpio.c exynos_pinctrl needs-flag -# USB2 Host Controller (EHCI/OHCI) -device exyousb { } : fdtbus -attach exyousb at fdt with exyo_usb -attach ohci at exyousb with ohci_exyousb -attach ehci at exyousb with ehci_exyousb -file arch/arm/samsung/exynos_usb.c exyo_usb +# USB2 phy +device exyousbphy +attach exyousbphy at fdt with exynos_usbphy +filearch/arm/samsung/exynos_usbphy.c exynos_usbphy + +# USB2 Host Controller (OHCI) +attach ohci at fdt with exynos_ohci +file arch/arm/samsung/exynos_ohci.c exynos_ohci + +#USB 2 Host Controller (EHCI) +attach ehci at fdt with exynos_ehci +file arch/arm/samsung/exynos_ehci.c exynos_ehci + +# USB3 Host Controller (xHCI) +device exyousb : fdtbus +attach exyousb at fdt with exynos_usb +attach xhci at fdt +file arch/arm/samsung/exynos_usb3.c exynos_usb # SD/MMC Host Controller attach dwcmmc at fdt with exynos_dwcmmc Index: src/sys/arch/evbarm/conf/EXYNOS diff -u src/sys/arch/evbarm/conf/EXYNOS:1.7 src/sys/arch/evbarm/conf/EXYNOS:1.8 --- src/sys/arch/evbarm/conf/EXYNOS:1.7 Sat Dec 26 23:14:08 2015 +++ src/sys/arch/evbarm/conf/EXYNOS Sun Dec 27 02:54:13 2015 @@ -1,5 +1,5 @@ # -# $NetBSD: EXYNOS,v 1.7 2015/12/26 23:14:08 jmcneill Exp $ +# $NetBSD: EXYNOS,v 1.8 2015/12/27 02:54:13 marty Exp $ # # ODROID-XU -- ODROID-XU4 Exynos5422 based kernel # @@ -238,15 +238,20 @@ exyopctl1 at fdt? exyopctl2 at fdt? exyopctl3 at fdt? exyopctl4 at fdt? -#gpio* at exyogpio? +gpio* at gpiobus? -# On-board USB -exyousb* at fdt? -ohci* at exyousb? -ehci* at exyousb? +# On-board USB 2.0 +exyousbphy* at fdt? +ohci* at fdt? +ehci* at fdt? usb* at ohci? usb* at ehci? +# On-board USB 3.0 +exyousb* at fdt? +#xhci* at fdt? +#usb* at xhci? + # I2C devices exyoi2c0 at fdt? exyoi2c1 at fdt? Added files: Index: src/sys/arch/arm/samsung/exynos_ehci.c diff -u /dev/null src/sys/arch/arm/samsung/exynos_ehci.c:1.1 --- /dev/null Sun Dec 27 02:54:13 2015 +++ src/sys/arch/arm/samsung/exynos_ehci.c Sun Dec 27 02:54:12 2015 @@ -0,0 +1,124 @@ +/* $NetBSD: exynos_ehci.c,v 1.1 2015/12/27 02:54:12 marty Exp $ */ + +/*- + * Copyright (c) 2014 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Reinoud Zandijk. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Thu Dec 24 21:30:05 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_i2c.c Log Message: XU4 I2C snapshot This is a complete, but untested, driver; except that it needs to be able to configure gpios and, afaict, we don't yet have an fdtbus_gpio_* function that will do that. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos_i2c.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_i2c.c diff -u src/sys/arch/arm/samsung/exynos_i2c.c:1.7 src/sys/arch/arm/samsung/exynos_i2c.c:1.8 --- src/sys/arch/arm/samsung/exynos_i2c.c:1.7 Tue Dec 22 22:32:54 2015 +++ src/sys/arch/arm/samsung/exynos_i2c.c Thu Dec 24 21:30:05 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_i2c.c,v 1.7 2015/12/22 22:32:54 jmcneill Exp $ */ +/* $NetBSD: exynos_i2c.c,v 1.8 2015/12/24 21:30:05 marty Exp $ */ /* * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "opt_arm_debug.h" #include -__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.7 2015/12/22 22:32:54 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.8 2015/12/24 21:30:05 marty Exp $"); #include #include @@ -61,8 +61,8 @@ struct exynos_i2c_softc { void * sc_ih; u_int sc_port; - struct fdtbus_gpio_pin sc_sda; - struct fdtbus_gpio_pin sc_slc; + struct fdtbus_gpio_pin *sc_sda; + struct fdtbus_gpio_pin *sc_scl; bool sc_sda_is_output; struct i2c_controller sc_ic; kmutex_t sc_lock; @@ -92,6 +92,14 @@ static void exynos_i2c_attach(device_t, CFATTACH_DECL_NEW(exynos_i2c, sizeof(struct exynos_i2c_softc), exynos_i2c_match, exynos_i2c_attach, NULL, NULL); +#define I2C_WRITE(sc, reg, val) \ +bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val)) +#define I2C_READ(sc, reg) \ +bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg)) + +#define IICON 0 +#define IRQPEND (1<<4) + static int exynos_i2c_match(device_t self, cfdata_t cf, void *aux) { @@ -114,6 +122,12 @@ exynos_i2c_attach(device_t parent, devic bus_size_t size; int error; + char result[64]; + int i2c_handle; + int len; + int handle; + int func /*, pud, drv */; + if (fdtbus_get_reg(phandle, 0, , ) != 0) { aprint_error(": couldn't get registers\n"); return; @@ -132,7 +146,7 @@ exynos_i2c_attach(device_t parent, devic sc->sc_port = i2c_port++; mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_VM); cv_init(>sc_cv, device_xname(self)); - aprint_normal(" @ 0x%08x", (uint)addr); + aprint_normal(" @ 0x%08x\n", (uint)addr); if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) { aprint_error_dev(self, "failed to decode interrupt\n"); @@ -148,6 +162,50 @@ exynos_i2c_attach(device_t parent, devic } aprint_normal_dev(self, "interrupting on %s\n", intrstr); + len = OF_getprop(phandle, "pinctrl-0", (char *), + sizeof(handle)); + if (len != sizeof(int)) { + aprint_error_dev(self, "couldn't get pinctrl-0.\n"); + return; + } + + i2c_handle = fdtbus_get_phandle_from_native(be32toh(handle)); + len = OF_getprop(i2c_handle, "samsung,pins", result, sizeof(result)); + if (len <= 0) { + aprint_error_dev(self, "couldn't get pins.\n"); + return; + } + + len = OF_getprop(i2c_handle, "samsung,pin-function", + , sizeof(handle)); + if (len <= 0) { + aprint_error_dev(self, "couldn't get pin-function.\n"); + return; + } else + func = be32toh(handle); + + sc->sc_sda = fdtbus_gpio_acquire(phandle, [0], func); + sc->sc_scl = fdtbus_gpio_acquire(phandle, [7], func); + + /* MJF: Need fdtbus_gpio_configure */ +#if 0 + len = OF_getprop(i2c_handle, "samsung,pin-pud", , + sizeof()); + if (len <= 0) { + aprint_error_dev(self, "couldn't get pin-pud.\n"); + return; + } else + pud = be32toh(handle); + + len = OF_getprop(i2c_handle, "samsung,pin-drv", , + sizeof()); + if (len <= 0) { + aprint_error_dev(self, "couldn't get pin-drv.\n"); + return; + } else + drv = be32toh(handle); + +#endif if (!exynos_i2c_attach_i2cbus(sc, >sc_ic)) return; @@ -168,8 +226,6 @@ exynos_i2c_attach_i2cbus(struct exynos_i i2c_cntr->ic_read_byte = exynos_i2c_read_byte; i2c_cntr->ic_write_byte = exynos_i2c_write_byte; - /*MJF: FIX ME needs gpio pins */ -// exynos_gpio_pinset_acquire(pinset); return 1; } @@ -182,28 +238,28 @@ static void exynos_i2c_bb_set_bits(void *cookie, uint32_t bits) { struct exynos_i2c_softc *i2c_sc = cookie; - int sda, slc; + int sda, scl; sda = (bits & EXYNOS_I2C_BB_SDA) ? true : false; - slc = (bits & EXYNOS_I2C_BB_SCL) ? true : false; + scl = (bits & EXYNOS_I2C_BB_SCL) ? true : false; if (i2c_sc->sc_sda_is_output) - fdtbus_gpio_write(_sc->sc_sda, sda); - fdtbus_gpio_write(_sc->sc_slc, slc); + fdtbus_gpio_write(i2c_sc->sc_sda, sda); + fdtbus_gpio_write(i2c_sc->sc_scl, scl); } static uint32_t exynos_i2c_bb_read_bits(void *cookie) { struct exynos_i2c_softc *i2c_sc = cookie;
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Thu Dec 24 21:20:17 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_combiner.c Log Message: XU4 interrupt combiner Written but untested. I'm still confused about how to handle two things: 1) at interrupt disestablishment, where do I get an interrupt number so that I can disable the interrupt on the combiner? 2) How is interrupt multiplexing handled? I don't seem to have any sort of interrupt dispatch routine that takes the 1 interrupt that reaches the gic and turn it into one of eight combined interrupts to call the established interrupt for the original uncombined interrupt source. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_combiner.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_combiner.c diff -u src/sys/arch/arm/samsung/exynos_combiner.c:1.2 src/sys/arch/arm/samsung/exynos_combiner.c:1.3 --- src/sys/arch/arm/samsung/exynos_combiner.c:1.2 Mon Dec 21 04:58:50 2015 +++ src/sys/arch/arm/samsung/exynos_combiner.c Thu Dec 24 21:20:17 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_combiner.c,v 1.2 2015/12/21 04:58:50 marty Exp $ */ +/* $NetBSD: exynos_combiner.c,v 1.3 2015/12/24 21:20:17 marty Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.2 2015/12/21 04:58:50 marty Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.3 2015/12/24 21:20:17 marty Exp $"); #include #include @@ -50,8 +50,16 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_combi #include +#define COMBINER_IESR_OFFSET 0x00 +#define COMBINER_IECR_OFFSET 0x04 +#define COMBINER_ISTR_OFFSET 0x08 +#define COMBINER_IMSR_OFFSET 0x0C +#define COMBINER_BLOCK_SIZE 0x10 + struct exynos_combiner_softc { device_t sc_dev; + bus_space_tag_t sc_bst; + bus_space_handle_t sc_bsh; int sc_phandle; }; @@ -99,6 +107,15 @@ exynos_combiner_attach(device_t parent, sc->sc_dev = self; sc->sc_phandle = faa->faa_phandle; + sc->sc_bst = faa->faa_bst; + + error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh); + if (error) { + aprint_error(": couldn't map %#llx: %d", + (uint64_t)addr, error); + return; + } + error = fdtbus_register_interrupt_controller(self, faa->faa_phandle, _combiner_funcs); if (error) { @@ -106,15 +123,12 @@ exynos_combiner_attach(device_t parent, return; } - - aprint_normal(" @ 0x%08x: interrupt combiner, NOT IMPLEMENTED", - (uint)addr); + aprint_normal(" @ 0x%08x: interrupt combiner", (uint)addr); aprint_naive("\n"); aprint_normal("\n"); } - static void * exynos_combiner_establish(device_t dev, int phandle, u_int index, int ipl, int flags, @@ -122,44 +136,17 @@ exynos_combiner_establish(device_t dev, { struct exynos_combiner_softc * const sc = device_private(dev); int iflags = (flags & FDT_INTR_MPSAFE) ? IST_MPSAFE : 0; - u_int *interrupts; - int interrupt_cells, len; - - if (of_getprop_uint32(sc->sc_phandle, "#interrupt-cells", - _cells)) { - return NULL; - } - - len = OF_getproplen(phandle, "interrupts"); - if (len <= 0) - return NULL; - - const u_int clen = interrupt_cells * 4; - const u_int nintr = len / interrupt_cells; - - if (index >= nintr) - return NULL; - - interrupts = kmem_alloc(len, KM_SLEEP); - - if (OF_getprop(phandle, "interrupts", interrupts, len) != len) { - kmem_free(interrupts, len); - return NULL; - } - - /* 1st cell is the interrupt type; */ - /* 2nd cell is the interrupt number */ - /* 3rd cell is flags */ - - const u_int type = be32toh(interrupts[index * clen + 0]); - const u_int intr = be32toh(interrupts[index * clen + 1]); - const u_int irq = type == 0 ? IRQ_SPI(intr) : IRQ_PPI(intr); - const u_int trig = be32toh(interrupts[index * clen + 2]) & 0xf; - const u_int level = (trig & 0x3) ? IST_EDGE : IST_LEVEL; - - kmem_free(interrupts, len); - - return intr_establish(irq, ipl, level | iflags, func, arg); + int iblock = index >> 3; + int ioffset = index & 0x07; + int block_offset = + iblock * COMBINER_BLOCK_SIZE + COMBINER_IESR_OFFSET; + int istatus = + bus_space_read_4(sc->sc_bst, sc->sc_bsh, block_offset); + printf("Establishing irq %d (0x%x) @ iblock = %d, ioffset = %d\n", + index, index, iblock, ioffset); + istatus |= 1 << ioffset; + bus_space_write_4(sc->sc_bst, sc->sc_bsh, block_offset, istatus); + return intr_establish(index, ipl, iflags, func, arg); } static void
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Thu Dec 24 01:10:51 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_gpio.c exynos_pinctrl.c exynos_var.h files.exynos Log Message: XU4 GPIO Review Changes Implement suggestions from Jared. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/samsung/exynos_gpio.c \ src/sys/arch/arm/samsung/files.exynos cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos_pinctrl.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/samsung/exynos_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_gpio.c diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.17 src/sys/arch/arm/samsung/exynos_gpio.c:1.18 --- src/sys/arch/arm/samsung/exynos_gpio.c:1.17 Tue Dec 22 22:19:07 2015 +++ src/sys/arch/arm/samsung/exynos_gpio.c Thu Dec 24 01:10:51 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_gpio.c,v 1.17 2015/12/22 22:19:07 jmcneill Exp $ */ +/* $NetBSD: exynos_gpio.c,v 1.18 2015/12/24 01:10:51 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.17 2015/12/22 22:19:07 jmcneill Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.18 2015/12/24 01:10:51 marty Exp $"); #include #include @@ -281,7 +281,8 @@ exynos_gpio_pin_ctl(void *cookie, int pi } void -exynos_gpio_bank_config(struct exynos_pinctrl_softc * parent, int node) +exynos_gpio_bank_config(struct exynos_pinctrl_softc * parent, + const struct fdt_attach_args *faa, int node) { struct exynos_gpio_bank *bank = kmem_zalloc(sizeof(*bank), KM_SLEEP); struct exynos_gpio_softc *sc = kmem_zalloc(sizeof(*sc), KM_SLEEP); @@ -320,32 +321,35 @@ exynos_gpio_bank_config(struct exynos_pi bank->bank_cfg.drv = GPIO_READ(bank, EXYNOS_GPIO_DRV); bank->bank_cfg.conpwd = GPIO_READ(bank, EXYNOS_GPIO_CONPWD); bank->bank_cfg.pudpwd = GPIO_READ(bank, EXYNOS_GPIO_PUDPWD); + + fdtbus_register_gpio_controller(bank->bank_dev, faa->faa_phandle, + _gpio_funcs); } /* - * pinmame = gpLD-N + * pinmame = gpLD[-N] * L = 'a' - 'z' -+ - * D = '0' - '8' -+ = bank name - * N = '0' - '8'= pin number + * D = '0' - '9' -+ = bank name + * N = '0' - '7'= pin number */ static struct exynos_gpio_bank * exynos_gpio_pin_lookup(const char *pinname, int *ppin) { char bankname[5]; - int pin; + int pin = 0; int n; struct exynos_gpio_bank *bank; memset(bankname, 0, sizeof(bankname)); - bankname[0] = pinname[0]; /* 'g' */ - bankname[1] = pinname[1]; /* 'p' */ - bankname[2] = pinname[2]; /* L */ - bankname[3] = pinname[3]; /* D */ - bankname[4] = 0; - if (ppin) + for (n = 0; n < 4; n++) + bankname[n] = pinname[n]; + bankname[n] = 0; + if (ppin && pinname[4] == '-') { pin = pinname[5] - '0'; /* skip the '-' */ - + if (pin < 0 || pin > 8) + return NULL; + } for (n = 0; n < __arraycount(exynos5_banks); n++) { bank = _gpio_banks[n]; if (strcmp(bank->bank_name, bankname) == 0) { Index: src/sys/arch/arm/samsung/files.exynos diff -u src/sys/arch/arm/samsung/files.exynos:1.17 src/sys/arch/arm/samsung/files.exynos:1.18 --- src/sys/arch/arm/samsung/files.exynos:1.17 Mon Dec 21 04:58:50 2015 +++ src/sys/arch/arm/samsung/files.exynos Thu Dec 24 01:10:51 2015 @@ -1,4 +1,4 @@ -# $NetBSD: files.exynos,v 1.17 2015/12/21 04:58:50 marty Exp $ +# $NetBSD: files.exynos,v 1.18 2015/12/24 01:10:51 marty Exp $ # # Configuration info for Samsung Exynos SoC ARM Peripherals # @@ -87,11 +87,6 @@ attach exyopctl at fdt with exynos_pinc file arch/arm/samsung/exynos_pinctrl.c exynos_pinctrl needs-flag file arch/arm/samsung/exynos_gpio.c exynos_pinctrl needs-flag -# GPIO -#device exyogpio : gpiobus -#attach exyogpio at fdt with exynos_gpio -#file arch/arm/samsung/exynos_gpio.c exynos_gpio needs-flag - # USB2 Host Controller (EHCI/OHCI) device exyousb { } : fdtbus attach exyousb at fdt with exyo_usb @@ -99,7 +94,7 @@ attach ohci at exyousb with ohci_exyousb attach ehci at exyousb with ehci_exyousb file arch/arm/samsung/exynos_usb.c exyo_usb -# I2C support, bitbanging trough GPIO +# I2C support, bitbanging through GPIO device exyoi2c: i2cbus, i2c_bitbang attach exyoi2c at fdt with exynos_i2c file arch/arm/samsung/exynos_i2c.c exynos_i2c needs-flag Index: src/sys/arch/arm/samsung/exynos_pinctrl.c diff -u src/sys/arch/arm/samsung/exynos_pinctrl.c:1.5 src/sys/arch/arm/samsung/exynos_pinctrl.c:1.6 --- src/sys/arch/arm/samsung/exynos_pinctrl.c:1.5 Tue Dec 22 22:34:42 2015 +++ src/sys/arch/arm/samsung/exynos_pinctrl.c Thu Dec 24 01:10:51 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_pinctrl.c,v 1.5 2015/12/22 22:34:42 jmcneill Exp $ */ +/* $NetBSD: exynos_pinctrl.c,v 1.6 2015/12/24 01:10:51 marty Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Tue Dec 22 03:36:01 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_gpio.c exynos_pinctrl.c exynos_pinctrl.h Log Message: XU4 GPIO Driver This is a moderately tested working gpio driver for the Exynos based ODROID XU4. To use this you have to edit the dtd file exynos54422-pinctrl.dtsi and change the two occurances of 'gpz' to 'gpz0'. Otherewise it will crash on a lookup failure. It certainly could use a code review. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/samsung/exynos_gpio.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/samsung/exynos_pinctrl.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_pinctrl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_gpio.c diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.15 src/sys/arch/arm/samsung/exynos_gpio.c:1.16 --- src/sys/arch/arm/samsung/exynos_gpio.c:1.15 Mon Dec 21 04:58:50 2015 +++ src/sys/arch/arm/samsung/exynos_gpio.c Tue Dec 22 03:36:01 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_gpio.c,v 1.15 2015/12/21 04:58:50 marty Exp $ */ +/* $NetBSD: exynos_gpio.c,v 1.16 2015/12/22 03:36:01 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.15 2015/12/21 04:58:50 marty Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.16 2015/12/22 03:36:01 marty Exp $"); #include #include @@ -67,7 +67,7 @@ struct exynos_gpio_bank { const char bank_name[6]; device_t bank_dev; struct gpio_chipset_tag bank_gc; - struct exynos_gpio_softc *bank_softc; + struct exynos_gpio_softc *bank_sc; gpio_pin_t bank_pins[8]; const bus_addr_t bank_core_offset; @@ -94,16 +94,74 @@ struct exynos_gpio_pin { const struct exynos_gpio_bank *pin_bank; }; -struct exynos_gpio_bank *exynos_gpio_banks; -static void exynos_gpio_pin_ctl(void *cookie, int pin, int flags); +//#define GPIO_REG(v,s,o) (EXYNOS##v##_GPIO_##s##_OFFSET + (o)) +#define GPIO_REG(v,s,o) ((o)) +#define GPIO_GRP(v, s, o, n, b) \ + { \ + .bank_name = #n, \ + .bank_core_offset = GPIO_REG(v,s,o), \ + .bank_bits = b, \ + } + +static struct exynos_gpio_bank exynos5_banks[] = { + GPIO_GRP(5, MUXA, 0x, gpy7, 8), + GPIO_GRP(5, MUXA, 0x0C00, gpx0, 8), + GPIO_GRP(5, MUXA, 0x0C20, gpx1, 8), + GPIO_GRP(5, MUXA, 0x0C40, gpx2, 8), + GPIO_GRP(5, MUXA, 0x0C60, gpx3, 8), + + GPIO_GRP(5, MUXB, 0x, gpc0, 8), + GPIO_GRP(5, MUXB, 0x0020, gpc1, 8), + GPIO_GRP(5, MUXB, 0x0040, gpc2, 7), + GPIO_GRP(5, MUXB, 0x0060, gpc3, 4), + GPIO_GRP(5, MUXB, 0x0080, gpc4, 2), + GPIO_GRP(5, MUXB, 0x00A0, gpd1, 8), + GPIO_GRP(5, MUXB, 0x00C0, gpy0, 6), + GPIO_GRP(5, MUXB, 0x00E0, gpy1, 4), + GPIO_GRP(5, MUXB, 0x0100, gpy2, 6), + GPIO_GRP(5, MUXB, 0x0120, gpy3, 8), + GPIO_GRP(5, MUXB, 0x0140, gpy4, 8), + GPIO_GRP(5, MUXB, 0x0160, gpy5, 8), + GPIO_GRP(5, MUXB, 0x0180, gpy6, 8), + + GPIO_GRP(5, MUXC, 0x, gpe0, 8), + GPIO_GRP(5, MUXC, 0x0020, gpe1, 2), + GPIO_GRP(5, MUXC, 0x0040, gpf0, 6), + GPIO_GRP(5, MUXC, 0x0060, gpf1, 8), + GPIO_GRP(5, MUXC, 0x0080, gpg0, 8), + GPIO_GRP(5, MUXC, 0x00A0, gpg1, 8), + GPIO_GRP(5, MUXC, 0x00C0, gpg2, 2), + GPIO_GRP(5, MUXC, 0x00E0, gpj4, 4), + + GPIO_GRP(5, MUXD, 0x, gpa0, 8), + GPIO_GRP(5, MUXD, 0x0020, gpa1, 6), + GPIO_GRP(5, MUXD, 0x0040, gpa2, 8), + GPIO_GRP(5, MUXD, 0x0060, gpb0, 5), + GPIO_GRP(5, MUXD, 0x0080, gpb1, 5), + GPIO_GRP(5, MUXD, 0x00A0, gpb2, 4), + GPIO_GRP(5, MUXD, 0x00C0, gpb3, 8), + GPIO_GRP(5, MUXD, 0x00E0, gpb4, 2), + GPIO_GRP(5, MUXD, 0x0100, gph0, 4), + + GPIO_GRP(5, MUXE, 0x, gpz0, 7), + +}; + +struct exynos_gpio_bank *exynos_gpio_banks = exynos5_banks; + +static int exynos_gpio_pin_read(void *, int); +static void exynos_gpio_pin_write(void *, int, int); +static void exynos_gpio_pin_ctl(void *, int, int); static void *exynos_gpio_fdt_acquire(device_t, const void *, size_t, int); static void exynos_gpio_fdt_release(device_t, void *); static int exynos_gpio_fdt_read(device_t, void *); static void exynos_gpio_fdt_write(device_t, void *, int); -//static int exynos_gpio_cfprint(void *, const char *); +static struct exynos_gpio_bank * +exynos_gpio_pin_lookup(const char *pinname, int *ppin); +static int exynos_gpio_cfprint(void *, const char *); struct fdtbus_gpio_controller_func exynos_gpio_funcs = { .acquire = exynos_gpio_fdt_acquire, @@ -111,8 +169,15 @@ struct fdtbus_gpio_controller_func exyno .read = exynos_gpio_fdt_read, .write = exynos_gpio_fdt_write }; +#define GPIO_WRITE(bank, reg, val) \ + bus_space_write_4((bank)->bank_sc->sc_bst, \ + (bank)->bank_sc->sc_bsh, \ + (bank)->bank_core_offset + (reg), (val)) +#define GPIO_READ(bank, reg) \ + bus_space_read_4((bank)->bank_sc->sc_bst, \ + (bank)->bank_sc->sc_bsh, \ + (bank)->bank_core_offset + (reg)) -#if 0
CVS commit: src/sys/arch
Module Name:src Committed By: marty Date: Mon Dec 21 04:58:50 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_chipid.c exynos_combiner.c exynos_gpio.c exynos_i2c.c exynos_pinctrl.c exynos_rtc.c exynos_soc.c exynos_usb.c exynos_wdt.c files.exynos src/sys/arch/evbarm/conf: EXYNOS src/sys/arch/evbarm/exynos: exynos_machdep.c Removed Files: src/sys/arch/arm/samsung: exynos4_loc.c exynos4_reg.h exynos5_loc.c exynos_dma.c exynos_io.c exynos_io.h exynos_space.c Log Message: XU4 FDT final checkpoint step N of N: get rid of baggage by removing whole files. What's left is in approximately the same shape as when the FDT update started, that is mostly broken. What's missing is most of the 76 devices recognized in the dtd. In other words, This is barely the start of a port. Next up, gpio then i2c, followed either by straightening out usb or getting the sdhc driver to work -- both probably require getting the interrupt combiner to work first. A large chunk of work is left to do on the clocks. I barely got them attaching to fdt and didn't do anything to take advantage of the information in the dtd. None of the other existing drivers, such as they are, properly request gpios, i2c or clocks, and, of course power domains are off the table. To generate a diff of this commit: cvs rdiff -u -r1.11 -r0 src/sys/arch/arm/samsung/exynos4_loc.c cvs rdiff -u -r1.13 -r0 src/sys/arch/arm/samsung/exynos4_reg.h \ src/sys/arch/arm/samsung/exynos5_loc.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_chipid.c \ src/sys/arch/arm/samsung/exynos_combiner.c \ src/sys/arch/arm/samsung/exynos_rtc.c cvs rdiff -u -r1.1 -r0 src/sys/arch/arm/samsung/exynos_dma.c cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/samsung/exynos_gpio.c \ src/sys/arch/arm/samsung/exynos_usb.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos_i2c.c cvs rdiff -u -r1.8 -r0 src/sys/arch/arm/samsung/exynos_io.c cvs rdiff -u -r1.6 -r0 src/sys/arch/arm/samsung/exynos_io.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_pinctrl.c cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/samsung/exynos_soc.c cvs rdiff -u -r1.2 -r0 src/sys/arch/arm/samsung/exynos_space.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/exynos_wdt.c cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/samsung/files.exynos cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/EXYNOS cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/exynos/exynos_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_chipid.c diff -u src/sys/arch/arm/samsung/exynos_chipid.c:1.1 src/sys/arch/arm/samsung/exynos_chipid.c:1.2 --- src/sys/arch/arm/samsung/exynos_chipid.c:1.1 Mon Dec 21 00:52:50 2015 +++ src/sys/arch/arm/samsung/exynos_chipid.c Mon Dec 21 04:58:50 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_chipid.c,v 1.1 2015/12/21 00:52:50 marty Exp $ */ +/* $NetBSD: exynos_chipid.c,v 1.2 2015/12/21 04:58:50 marty Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_chipid.c,v 1.1 2015/12/21 00:52:50 marty Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_chipid.c,v 1.2 2015/12/21 04:58:50 marty Exp $"); #include #include @@ -47,7 +47,6 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_chipi #include #include -#include #include #include Index: src/sys/arch/arm/samsung/exynos_combiner.c diff -u src/sys/arch/arm/samsung/exynos_combiner.c:1.1 src/sys/arch/arm/samsung/exynos_combiner.c:1.2 --- src/sys/arch/arm/samsung/exynos_combiner.c:1.1 Mon Dec 21 00:52:50 2015 +++ src/sys/arch/arm/samsung/exynos_combiner.c Mon Dec 21 04:58:50 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_combiner.c,v 1.1 2015/12/21 00:52:50 marty Exp $ */ +/* $NetBSD: exynos_combiner.c,v 1.2 2015/12/21 04:58:50 marty Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.1 2015/12/21 00:52:50 marty Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.2 2015/12/21 04:58:50 marty Exp $"); #include #include @@ -46,7 +46,6 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_combi #include #include -#include #include #include Index: src/sys/arch/arm/samsung/exynos_rtc.c diff -u src/sys/arch/arm/samsung/exynos_rtc.c:1.1 src/sys/arch/arm/samsung/exynos_rtc.c:1.2 --- src/sys/arch/arm/samsung/exynos_rtc.c:1.1 Mon Dec 21 00:52:50 2015 +++ src/sys/arch/arm/samsung/exynos_rtc.c Mon Dec 21 04:58:50 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_rtc.c,v 1.1 2015/12/21 00:52:50 marty Exp $ */ +/* $NetBSD: exynos_rtc.c,v 1.2 2015/12/21 04:58:50 marty Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_rtc.c,v 1.1 2015/12/21 00:52:50
CVS commit: src/sys/arch
_start(cookie, flags, _iic_bbops); - panic("%s: not implemented for non gpio case\n", __func__); - return EINVAL; + return i2c_bitbang_send_start(cookie, flags, _i2c_bbops); } static int -exynos_iic_send_stop(void *cookie, int flags) +exynos_i2c_send_stop(void *cookie, int flags) { - struct exynos_iic_dev_softc *i2c_sc = cookie; - - if (i2c_sc->isc_isgpio) - return i2c_bitbang_send_stop(cookie, flags, _iic_bbops); - panic("%s: not implemented for non gpio case\n", __func__); - return EINVAL; + return i2c_bitbang_send_stop(cookie, flags, _i2c_bbops); } static int -exynos_iic_initiate_xfer(void *cookie, i2c_addr_t addr, int flags) +exynos_i2c_initiate_xfer(void *cookie, i2c_addr_t addr, int flags) { - struct exynos_iic_dev_softc *i2c_sc = cookie; - - if (i2c_sc->isc_isgpio) - return i2c_bitbang_initiate_xfer(cookie, addr, flags, - _iic_bbops); - panic("%s: not implemented for non gpio case\n", __func__); - return EINVAL; + return i2c_bitbang_initiate_xfer(cookie, addr, flags, + _i2c_bbops); } static int -exynos_iic_read_byte(void *cookie, uint8_t *bytep, int flags) +exynos_i2c_read_byte(void *cookie, uint8_t *bytep, int flags) { - struct exynos_iic_dev_softc *i2c_sc = cookie; - - if (i2c_sc->isc_isgpio) - return i2c_bitbang_read_byte(cookie, bytep, flags, - _iic_bbops); - panic("%s: not implemented for non gpio case\n", __func__); - return EINVAL; + return i2c_bitbang_read_byte(cookie, bytep, flags, + _i2c_bbops); } static int -exynos_iic_write_byte(void *cookie, uint8_t byte, int flags) +exynos_i2c_write_byte(void *cookie, uint8_t byte, int flags) { - struct exynos_iic_dev_softc *i2c_sc = cookie; - - if (i2c_sc->isc_isgpio) - return i2c_bitbang_write_byte(cookie, byte, flags, - _iic_bbops); - panic("%s: not implemented for non gpio case\n", __func__); - return EINVAL; + return i2c_bitbang_write_byte(cookie, byte, flags, + _i2c_bbops); } - -#endif /* NEXYNOS_IIC > 0 */ - Index: src/sys/arch/arm/samsung/files.exynos diff -u src/sys/arch/arm/samsung/files.exynos:1.14 src/sys/arch/arm/samsung/files.exynos:1.15 --- src/sys/arch/arm/samsung/files.exynos:1.14 Sat Dec 19 21:42:31 2015 +++ src/sys/arch/arm/samsung/files.exynos Mon Dec 21 00:52:50 2015 @@ -1,4 +1,4 @@ -# $NetBSD: files.exynos,v 1.14 2015/12/19 21:42:31 marty Exp $ +# $NetBSD: files.exynos,v 1.15 2015/12/21 00:52:50 marty Exp $ # # Configuration info for Samsung Exynos SoC ARM Peripherals # @@ -56,9 +56,24 @@ file arch/arm/samsung/exynos_io.c exyo_i file arch/arm/samsung/exynos4_loc.c exyo_io & exynos4 file arch/arm/samsung/exynos5_loc.c exyo_io & exynos5 +# Interrupt combiner +device exyointr +attach exyointr at fdt with exynos_intr +file arch/arm/samsung/exynos_combiner.c exynos_intr + +# CHIP ID register +device chipid : fdtbus +attach chipid at fdt with exynos_chipid +file arch/arm/samsung/exynos_chipid.c exynos_chipid + +# real time clock +device exyortc : ftdbus +attach exyortc at fdt with exynos_rtc +filearch/arm/samsung/exynos_rtc.c exynos_rtc + # Multi Core timer -device mct { } : bus_space_generic -attach mct at exyo with exyo_mct +device mct : ftdbus +attach mct at fdt with exyo_mct file arch/arm/samsung/mct.c exyo_mct # Watchdog @@ -93,8 +108,8 @@ attach ehci at exyousb with ehci_exyousb file arch/arm/samsung/exynos_usb.c exyo_usb # I2C support, bitbanging trough GPIO -device exyoiic: i2cbus, i2c_bitbang -attach exyoiic at exyo with exynos_iic +device exyoi2c: i2cbus, i2c_bitbang +attach exyoi2c at fdt with exynos_i2c file arch/arm/samsung/exynos_i2c.c exynos_iic | exyo_io needs-flag file arch/arm/samsung/exynos5422_dma.c Index: src/sys/arch/evbarm/conf/EXYNOS diff -u src/sys/arch/evbarm/conf/EXYNOS:1.3 src/sys/arch/evbarm/conf/EXYNOS:1.4 --- src/sys/arch/evbarm/conf/EXYNOS:1.3 Sat Dec 19 21:42:31 2015 +++ src/sys/arch/evbarm/conf/EXYNOS Mon Dec 21 00:52:51 2015 @@ -1,5 +1,5 @@ # -# $NetBSD: EXYNOS,v 1.3 2015/12/19 21:42:31 marty Exp $ +# $NetBSD: EXYNOS,v 1.4 2015/12/21 00:52:51 marty Exp $ # # ODROID-XU -- ODROID-XU4 Exynos5422 based kernel # @@ -210,6 +210,7 @@ fdt* at simplebus? fregulator* at fdt? #interrupt controller +exyointr0 at fdt? gic* at fdt? # Exynos SoC @@ -225,6 +226,15 @@ sscom* at fdt?# UART ? # Exynos Watchdog Timer exyowdt0 at fdt?# watchdog +# Exynos chip id +chipid0 at fdt? + +# Exynos RTC +exyortc0 at fdt? + +# Exynos Multi Core timer (MCT) +mct0 at fdt? + # GPIO exyopctl0 at fdt? exyopctl1 at fdt? @@ -241,8 +251,11 @@ usb* at ohci? usb* at ehci? # I2C devices -exyoiic0 at exyo0 -iic* at exyoiic? +exyoi2c0 at fdt? +exyoi2c1 at fdt? +exyoi2c2 at fdt? +exyoi2c3 at fdt? +#i2c* at exyoi2c? # MISSING SUPPORT # eMMC Added files: Index: src/sys/arch/arm/samsung/exynos_chipid.c diff -u /dev/null src/sys/arch/arm/samsung/exynos_chipid.c:1.1 --- /dev/null Mon Dec 21 00:52:51 2015 +++ src/sys/arch/a
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Mon Dec 21 00:54:35 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_pinctrl.c exynos_sscom.c mct.c mct_var.h Log Message: XU4 FDT missed files To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_pinctrl.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/samsung/exynos_sscom.c \ src/sys/arch/arm/samsung/mct.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/samsung/mct_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_pinctrl.c diff -u src/sys/arch/arm/samsung/exynos_pinctrl.c:1.1 src/sys/arch/arm/samsung/exynos_pinctrl.c:1.2 --- src/sys/arch/arm/samsung/exynos_pinctrl.c:1.1 Sat Dec 19 21:42:31 2015 +++ src/sys/arch/arm/samsung/exynos_pinctrl.c Mon Dec 21 00:54:35 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_pinctrl.c,v 1.1 2015/12/19 21:42:31 marty Exp $ */ +/* $NetBSD: exynos_pinctrl.c,v 1.2 2015/12/21 00:54:35 marty Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.1 2015/12/19 21:42:31 marty Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.2 2015/12/21 00:54:35 marty Exp $"); #include #include @@ -84,7 +84,7 @@ exynos_pinctrl_attach(device_t parent, d return; } - printf(" pinctl @ 0x%08x\n", (uint)addr); + aprint_normal(" pinctl @ 0x%08x", (uint)addr); sc->sc_dev = self; sc->sc_bst = faa->faa_bst; error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh); Index: src/sys/arch/arm/samsung/exynos_sscom.c diff -u src/sys/arch/arm/samsung/exynos_sscom.c:1.6 src/sys/arch/arm/samsung/exynos_sscom.c:1.7 --- src/sys/arch/arm/samsung/exynos_sscom.c:1.6 Thu Dec 17 22:39:37 2015 +++ src/sys/arch/arm/samsung/exynos_sscom.c Mon Dec 21 00:54:35 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_sscom.c,v 1.6 2015/12/17 22:39:37 marty Exp $ */ +/* $NetBSD: exynos_sscom.c,v 1.7 2015/12/21 00:54:35 marty Exp $ */ /* * Copyright (c) 2014 Reinoud Zandijk @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.6 2015/12/17 22:39:37 marty Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.7 2015/12/21 00:54:35 marty Exp $"); #include "opt_sscom.h" #include "opt_ddb.h" @@ -190,10 +190,10 @@ sscom_attach(device_t parent, device_t s } sc->sc_ioh = bsh; } else { - printf(" (console) "); + aprint_normal(" (console) "); } - printf("\n"); + aprint_normal("\n"); #if 0 void *ih = fdtbus_intr_establish(faa->faa_phandle, 0, IPL_SERIAL, Index: src/sys/arch/arm/samsung/mct.c diff -u src/sys/arch/arm/samsung/mct.c:1.6 src/sys/arch/arm/samsung/mct.c:1.7 --- src/sys/arch/arm/samsung/mct.c:1.6 Fri Dec 11 04:03:44 2015 +++ src/sys/arch/arm/samsung/mct.c Mon Dec 21 00:54:35 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: mct.c,v 1.6 2015/12/11 04:03:44 marty Exp $ */ +/* $NetBSD: mct.c,v 1.7 2015/12/21 00:54:35 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.6 2015/12/11 04:03:44 marty Exp $"); +__KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.7 2015/12/21 00:54:35 marty Exp $"); #include #include @@ -49,6 +49,7 @@ __KERNEL_RCSID(1, "$NetBSD: mct.c,v 1.6 #include #include +#include static int mct_match(device_t, cfdata_t, void *); static void mct_attach(device_t, device_t, void *); @@ -132,52 +133,45 @@ mct_write_global(struct mct_softc *sc, b static int mct_match(device_t parent, cfdata_t cf, void *aux) { - /* not used if Generic Timer is Available */ - if (armreg_pfr1_read() & ARM_PFR1_GTIMER_MASK) - return 0; - - /* sanity check, something is mixed up! */ - if (!device_is_a(parent, "exyo")) - return 1; - - /* there can only be one */ - if (mct_sc.sc_dev != NULL) - return 0; + const char * const compatible[] = { "samsung,exynos4210-mct", + NULL }; - return 1; + struct fdt_attach_args * const faa = aux; + return of_match_compatible(faa->faa_phandle, compatible); } static void mct_attach(device_t parent, device_t self, void *aux) { - struct exyo_attach_args *exyo = (struct exyo_attach_args *) aux; struct mct_softc * const sc = _sc; - prop_dictionary_t dict = device_properties(self); - char freqbuf[sizeof("XXX SHz")]; - const char *pin_name; +// prop_dictionary_t dict = device_properties(self); +// char freqbuf[sizeof("XXX SHz")]; + struct fdt_attach_args * const faa = aux; + bus_addr_t addr; + bus_size_t size; + int error; + + if (fdtbus_get_reg(faa->faa_phandle, 0, , ) != 0) { + aprint_error(": couldn't get registers\n"); + return; + } self->dv_private = sc; sc->sc_dev = self; - sc->sc_bst = exyo->exyo_core_bst; - sc->sc_irq = exyo->exyo_loc.loc_intr; - - bus_space_subregion(sc->sc_bst, exyo->exyo_core_bsh, - exyo->exyo_loc.loc_offset, exyo->exyo_loc.loc_size, >sc_bsh); - -
CVS commit: src/sys/arch
Module Name:src Committed By: marty Date: Mon Dec 21 03:34:34 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos5422_clock.c exynos_usb.c files.exynos src/sys/arch/evbarm/conf: EXYNOS Log Message: XU4 FDT Last drivers converted There is a minimum conversion on the clock driver. The USB driver needs reordering and is broken, but it was broken before. Next up: tactical nuclear weapons To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos5422_clock.c cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/samsung/exynos_usb.c cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/samsung/files.exynos cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/EXYNOS Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos5422_clock.c diff -u src/sys/arch/arm/samsung/exynos5422_clock.c:1.2 src/sys/arch/arm/samsung/exynos5422_clock.c:1.3 --- src/sys/arch/arm/samsung/exynos5422_clock.c:1.2 Sat Dec 5 18:29:22 2015 +++ src/sys/arch/arm/samsung/exynos5422_clock.c Mon Dec 21 03:34:34 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos5422_clock.c,v 1.2 2015/12/05 18:29:22 jmcneill Exp $ */ +/* $NetBSD: exynos5422_clock.c,v 1.3 2015/12/21 03:34:34 marty Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill@@ -29,7 +29,7 @@ #include "locators.h" #include -__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.2 2015/12/05 18:29:22 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.3 2015/12/21 03:34:34 marty Exp $"); #include #include @@ -45,6 +45,8 @@ __KERNEL_RCSID(0, "$NetBSD: exynos5422_c #include #include +#include + static struct clk *exynos5422_clock_get(void *, const char *); static void exynos5422_clock_put(void *, struct clk *); static u_int exynos5422_clock_get_rate(void *, struct clk *); @@ -243,20 +245,35 @@ CFATTACH_DECL_NEW(exynos5422_clock, size static int exynos5422_clock_match(device_t parent, cfdata_t cf, void *aux) { - return IS_EXYNOS5422_P(); + const char * const compatible[] = { "samsung,exynos5422-clock", + NULL }; + struct fdt_attach_args * const faa = aux; + return of_match_compatible(faa->faa_phandle, compatible); } static void exynos5422_clock_attach(device_t parent, device_t self, void *aux) { struct exynos5422_clock_softc * const sc = device_private(self); - struct exyo_attach_args * const exyo = aux; - const struct exyo_locators *loc = >exyo_loc; + struct fdt_attach_args * const faa = aux; + bus_addr_t addr; + bus_size_t size; + int error; + + if (fdtbus_get_reg(faa->faa_phandle, 0, , ) != 0) { + aprint_error(": couldn't get registers\n"); + return; + } sc->sc_dev = self; - sc->sc_bst = exyo->exyo_core_bst; - bus_space_subregion(exyo->exyo_core_bst, exyo->exyo_core_bsh, - loc->loc_offset, loc->loc_size, >sc_bsh); + sc->sc_bst = faa->faa_bst; + + error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh); + if (error) { + aprint_error(": couldn't map %#llx: %d", + (uint64_t)addr, error); + return; + } aprint_naive("\n"); aprint_normal(": Exynos5422 Clock Controller\n"); Index: src/sys/arch/arm/samsung/exynos_usb.c diff -u src/sys/arch/arm/samsung/exynos_usb.c:1.13 src/sys/arch/arm/samsung/exynos_usb.c:1.14 --- src/sys/arch/arm/samsung/exynos_usb.c:1.13 Tue Sep 30 14:23:41 2014 +++ src/sys/arch/arm/samsung/exynos_usb.c Mon Dec 21 03:34:34 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_usb.c,v 1.13 2014/09/30 14:23:41 reinoud Exp $ */ +/* $NetBSD: exynos_usb.c,v 1.14 2015/12/21 03:34:34 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: exynos_usb.c,v 1.13 2014/09/30 14:23:41 reinoud Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_usb.c,v 1.14 2015/12/21 03:34:34 marty Exp $"); #include #include @@ -67,6 +67,8 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_usb.c #include #include +#include + struct exynos_usb_softc { device_t sc_self; @@ -74,6 +76,7 @@ struct exynos_usb_softc { bus_dma_tag_t sc_dmat; bus_space_tag_t sc_bst; + bus_space_handle_t sc_bsh; bus_space_handle_t sc_ehci_bsh; bus_space_handle_t sc_ohci_bsh; bus_space_handle_t sc_usb2phy_bsh; @@ -92,7 +95,7 @@ struct exynos_usb_attach_args { /* forwards */ -static int exynos_usb_intr(void *arg); +//static int exynos_usb_intr(void *arg); static int exynos_usb_match(device_t, cfdata_t, void *); @@ -105,11 +108,10 @@ CFATTACH_DECL_NEW(exyo_usb, 0, static int exynos_usb_match(device_t parent, cfdata_t cf, void *aux) { - /* there can only be one */ - if (exynos_usb_sc.sc_self) - return 0; - - return 1; + const char * const compatible[] = { "samsung,exynos5-dwusb3", + NULL }; + struct fdt_attach_args * const faa = aux; + return of_match_compatible(faa->faa_phandle, compatible); } @@ -117,76 +119,44 @@ static void exynos_usb_attach(device_t parent, device_t
CVS commit: src/sys/arch
(struct exynos_pinctrl_softc *, int); extern void exynos_wdt_reset(void); extern void exynos_init_clkout_for_usb(void); // board specific Index: src/sys/arch/evbarm/conf/EXYNOS diff -u src/sys/arch/evbarm/conf/EXYNOS:1.2 src/sys/arch/evbarm/conf/EXYNOS:1.3 --- src/sys/arch/evbarm/conf/EXYNOS:1.2 Thu Dec 17 22:40:49 2015 +++ src/sys/arch/evbarm/conf/EXYNOS Sat Dec 19 21:42:31 2015 @@ -1,5 +1,5 @@ # -# $NetBSD: EXYNOS,v 1.2 2015/12/17 22:40:49 marty Exp $ +# $NetBSD: EXYNOS,v 1.3 2015/12/19 21:42:31 marty Exp $ # # ODROID-XU -- ODROID-XU4 Exynos5422 based kernel # @@ -209,6 +209,9 @@ fdt* at simplebus? fregulator* at fdt? +#interrupt controller +gic* at fdt? + # Exynos SoC exyo0 at mainbus? @@ -223,8 +226,12 @@ sscom* at fdt?# UART ? exyowdt0 at fdt?# watchdog # GPIO -exyogpio0 at exyo0 -gpio* at exyogpio? +exyopctl0 at fdt? +exyopctl1 at fdt? +exyopctl2 at fdt? +exyopctl3 at fdt? +exyopctl4 at fdt? +#gpio* at exyogpio? # On-board USB exyousb* at exyo0 Added files: Index: src/sys/arch/arm/samsung/exynos_pinctrl.c diff -u /dev/null src/sys/arch/arm/samsung/exynos_pinctrl.c:1.1 --- /dev/null Sat Dec 19 21:42:31 2015 +++ src/sys/arch/arm/samsung/exynos_pinctrl.c Sat Dec 19 21:42:31 2015 @@ -0,0 +1,110 @@ +/* $NetBSD: exynos_pinctrl.c,v 1.1 2015/12/19 21:42:31 marty Exp $ */ + +/*- +* Copyright (c) 2015 The NetBSD Foundation, Inc. +* All rights reserved. +* +* This code is derived from software contributed to The NetBSD Foundation +* by Marty Fouts +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +*notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +*notice, this list of conditions and the following disclaimer in the +*documentation and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*/ + +#include "opt_exynos.h" +#include "opt_arm_debug.h" +#include "gpio.h" + +#include +__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.1 2015/12/19 21:42:31 marty Exp $"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include + +static int exynos_pinctrl_match(device_t, cfdata_t, void *); +static void exynos_pinctrl_attach(device_t, device_t, void *); + +CFATTACH_DECL_NEW(exynos_pinctrl, sizeof(struct exynos_pinctrl_softc), + exynos_pinctrl_match, exynos_pinctrl_attach, NULL, NULL); + +static int +exynos_pinctrl_match(device_t parent, cfdata_t cf, void *aux) +{ + const char * const compatible[] = { "samsung,exynos5422-pinctrl", + NULL }; + struct fdt_attach_args * const faa = aux; + return of_match_compatible(faa->faa_phandle, compatible); +} + +static void +exynos_pinctrl_attach(device_t parent, device_t self, void *aux) +{ + struct exynos_pinctrl_softc * const sc + = kmem_zalloc(sizeof(*sc), KM_SLEEP); + struct fdt_attach_args * const faa = aux; + bus_addr_t addr; + bus_size_t size; + int error; + int child; + + if (fdtbus_get_reg(faa->faa_phandle, 0, , ) != 0) { + aprint_error(": couldn't get registers\n"); + return; + } + + printf(" pinctl @ 0x%08x\n", (uint)addr); + sc->sc_dev = self; + sc->sc_bst = faa->faa_bst; + error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh); + if (error) { + aprint_error(": couldn't map %#llx: %d", + (uint64_t)addr, error); + return; + } + + for (child = OF_child(faa->faa_phandle); child; + child = OF_peer(child)) { + char result[64]; + error = OF_getprop(child, "gpio-controller", result, + sizeof(result)); + if (error == -1) + continue; + exynos_gpio_bank_config(sc,child); + } + + aprint_naive("\n"); + aprint_normal("\n"); + +}
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Sat Dec 19 21:43:36 UTC 2015 Added Files: src/sys/arch/arm/samsung: exynos_pinctrl.h Log Message: XU4 GPIO FDT missing file. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/samsung/exynos_pinctrl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/arm/samsung/exynos_pinctrl.h diff -u /dev/null src/sys/arch/arm/samsung/exynos_pinctrl.h:1.1 --- /dev/null Sat Dec 19 21:43:36 2015 +++ src/sys/arch/arm/samsung/exynos_pinctrl.h Sat Dec 19 21:43:36 2015 @@ -0,0 +1,6 @@ +struct exynos_pinctrl_softc { + device_t sc_dev; + bus_space_tag_t sc_bst; + bus_space_handle_t sc_bsh; + +};
CVS commit: src/sys/arch/evbarm/exynos
Module Name:src Committed By: marty Date: Sun Dec 20 05:25:01 UTC 2015 Modified Files: src/sys/arch/evbarm/exynos: exynos_machdep.c Log Message: XU4 debug cleanup get rid of some unneeded debug chatter in machdep To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/exynos/exynos_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/exynos/exynos_machdep.c diff -u src/sys/arch/evbarm/exynos/exynos_machdep.c:1.5 src/sys/arch/evbarm/exynos/exynos_machdep.c:1.6 --- src/sys/arch/evbarm/exynos/exynos_machdep.c:1.5 Wed Dec 16 12:18:34 2015 +++ src/sys/arch/evbarm/exynos/exynos_machdep.c Sun Dec 20 05:25:01 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_machdep.c,v 1.5 2015/12/16 12:18:34 jmcneill Exp $ */ +/* $NetBSD: exynos_machdep.c,v 1.6 2015/12/20 05:25:01 marty Exp $ */ /* * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exynos_machdep.c,v 1.5 2015/12/16 12:18:34 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_machdep.c,v 1.6 2015/12/20 05:25:01 marty Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_exynos.h" @@ -330,21 +330,17 @@ initarm(void *arg) panic("Unknown product family %llx", EXYNOS_PRODUCT_FAMILY(exynos_soc_id)); } - DPRINT(" devmap"); pmap_devmap_register(devmap); /* bootstrap soc. uart_address is determined in exynos_start */ paddr_t uart_address = armreg_tpidruro_read(); - DPRINT(" bootstrap"); exynos_bootstrap(EXYNOS_CORE_VBASE, EXYNOS_IOPHYSTOVIRT(uart_address)); /* set up CPU / MMU / TLB functions */ - DPRINT(" cpufunc"); if (set_cpufuncs()) panic("cpu not recognized!"); /* get normal console working */ - DPRINT(" consinit"); consinit(); #ifdef KGDB
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Thu Dec 17 22:39:38 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_sscom.c files.exynos Log Message: EXYNOS FDT sscom To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos_sscom.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/files.exynos Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_sscom.c diff -u src/sys/arch/arm/samsung/exynos_sscom.c:1.5 src/sys/arch/arm/samsung/exynos_sscom.c:1.6 --- src/sys/arch/arm/samsung/exynos_sscom.c:1.5 Sun Apr 27 20:22:46 2014 +++ src/sys/arch/arm/samsung/exynos_sscom.c Thu Dec 17 22:39:37 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_sscom.c,v 1.5 2014/04/27 20:22:46 reinoud Exp $ */ +/* $NetBSD: exynos_sscom.c,v 1.6 2015/12/17 22:39:37 marty Exp $ */ /* * Copyright (c) 2014 Reinoud Zandijk @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.5 2014/04/27 20:22:46 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.6 2015/12/17 22:39:37 marty Exp $"); #include "opt_sscom.h" #include "opt_ddb.h" @@ -66,6 +66,13 @@ __KERNEL_RCSID(0, "$NetBSD: exynos_sscom #include #include +#include + +#include + +extern int num_exynos_uarts_entries; +extern int exynos_uarts[]; + static int sscom_match(device_t, cfdata_t, void *); static void sscom_attach(device_t, device_t, void *); @@ -75,10 +82,10 @@ CFATTACH_DECL_NEW(exynos_sscom, sizeof(s static int sscom_match(device_t parent, cfdata_t cf, void *aux) { - struct exyo_attach_args *exyoaa = aux; - int port = exyoaa->exyo_loc.loc_port; + const char * const compatible[] = { "samsung,exynos4210-uart", NULL }; + struct fdt_attach_args * const faa = aux; - return port >= 0 && port <= 4; + return of_match_compatible(faa->faa_phandle, compatible); } static void @@ -139,15 +146,31 @@ static void sscom_attach(device_t parent, device_t self, void *aux) { struct sscom_softc *sc = device_private(self); - struct exyo_attach_args *exyo = aux; - int unit = exyo->exyo_loc.loc_port; + struct fdt_attach_args *faa = aux; + int unit = -1; + bus_space_handle_t bsh; + bus_space_tag_t bst; + bus_addr_t addr; + bus_size_t size; + int error; + int i; - /* debug */ -// bus_addr_t iobase = exyo->exyo_loc.loc_offset; -// aprint_normal( ": UART%d addr=%lx", unit, iobase ); + if (fdtbus_get_reg(faa->faa_phandle, 0, , ) != 0) { + aprint_error(": couldn't get registers\n"); + return; + } + /* unit is required for the sscom driver, which desperately + * needs to be rewritten. For now, this hack gets the answer. + * MJF: FIX ME + */ + for (i = 1; i < num_exynos_uarts_entries; i += 2) + if (EXYNOS_CORE_PBASE + exynos_uarts[i] == addr) + break; + unit = exynos_uarts[i-1]; sc->sc_dev = self; - sc->sc_iot = exyo->exyo_core_bst; + sc->sc_iot = bst = faa->faa_bst; + sc->sc_ioh = exynos_uarts[i] + EXYNOS_CORE_VBASE; sc->sc_unit = unit; sc->sc_frequency = EXYNOS_UART_FREQ; @@ -158,22 +181,29 @@ sscom_attach(device_t parent, device_t s sc->sc_rx_irqno = 0; sc->sc_tx_irqno = 0; - if (!sscom_is_console(sc->sc_iot, unit, >sc_ioh) - && bus_space_subregion(sc->sc_iot, exyo->exyo_core_bsh, - exyo->exyo_loc.loc_offset, SSCOM_SIZE, >sc_ioh)) { - printf( ": failed to map registers\n" ); - return; + if (!sscom_is_console(sc->sc_iot, unit, >sc_ioh)) { + error = bus_space_map(bst, addr, size, 0, ); + if (error) { + aprint_error(": couldn't map %#llx: %d\n", + (uint64_t)addr, error); + return; + } + sc->sc_ioh = bsh; + } else { + printf(" (console) "); } printf("\n"); - void *ih = intr_establish(exyo->exyo_loc.loc_intr, IPL_SCHED, - IST_LEVEL, sscomintr, sc); - if (ih != NULL) { - aprint_normal_dev(self, "interrupting at irq %d\n", - exyo->exyo_loc.loc_intr); - } +#if 0 + void *ih = fdtbus_intr_establish(faa->faa_phandle, 0, IPL_SERIAL, + FDT_INTR_MPSAFE, sscomintr, sc); + if (ih == NULL) + aprint_error_dev(self, "failed to establish interrupt\n"); +#endif + sscom_attach_subr(sc); + } Index: src/sys/arch/arm/samsung/files.exynos diff -u src/sys/arch/arm/samsung/files.exynos:1.12 src/sys/arch/arm/samsung/files.exynos:1.13 --- src/sys/arch/arm/samsung/files.exynos:1.12 Tue Dec 15 23:15:53 2015 +++ src/sys/arch/arm/samsung/files.exynos Thu Dec 17 22:39:37 2015 @@ -1,4 +1,4 @@ -# $NetBSD: files.exynos,v 1.12 2015/12/15 23:15:53 marty Exp $ +# $NetBSD: files.exynos,v 1.13 2015/12/17 22:39:37 marty Exp $ # # Configuration info for Samsung Exynos SoC ARM Peripherals # @@ -68,7 +68,7 @@ file arch/arm/samsung/exynos_wdt.c exyno # UARTs device sscom { } : bus_space_generic -attach sscom at exyo with exynos_sscom +attach sscom at fdt with exynos_sscom file arch/arm/samsung/sscom.c sscom needs-flag file arch/arm/samsung/exynos_sscom.c exynos_sscom defflag opt_sscom.h SSCOM0CONSOLE
CVS commit: src/sys/arch/evbarm/conf
Module Name:src Committed By: marty Date: Thu Dec 17 22:40:49 UTC 2015 Modified Files: src/sys/arch/evbarm/conf: EXYNOS Log Message: XU4 FDT sscon This is a mess and I don't understand why part of it works, but it passes the basic test. There has to be some better way to get the info that I'm grabbing from the exynos_uarts[] array. I'm not sure how to deal with VA != PA when the DTB contains physical rather than virtual addresses. This is going to be an issue for all of the drivers. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/EXYNOS Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/conf/EXYNOS diff -u src/sys/arch/evbarm/conf/EXYNOS:1.1 src/sys/arch/evbarm/conf/EXYNOS:1.2 --- src/sys/arch/evbarm/conf/EXYNOS:1.1 Tue Dec 15 04:38:30 2015 +++ src/sys/arch/evbarm/conf/EXYNOS Thu Dec 17 22:40:49 2015 @@ -1,5 +1,5 @@ # -# $NetBSD: EXYNOS,v 1.1 2015/12/15 04:38:30 marty Exp $ +# $NetBSD: EXYNOS,v 1.2 2015/12/17 22:40:49 marty Exp $ # # ODROID-XU -- ODROID-XU4 Exynos5422 based kernel # @@ -216,8 +216,8 @@ exyo0 at mainbus? exy5422clk0 at exyo0 # Exynos5422 clock controller # Integrated Samsung UARTs -#sscom* at exyo0 port ? # UART ? -sscom2 at exyo0 port 2 # UART2 +sscom* at fdt?# UART ? +#sscom2 at fdt?# console # Exynos Watchdog Timer exyowdt0 at fdt?# watchdog
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Tue Dec 15 23:15:53 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_wdt.c files.exynos Log Message: XU4 FDT WDT - convert driver to FDT The watchdog timer is the most trivial driver in exynos, from the POV of converting to FDT, so go ahead and do it first. NOTE: There's a hack in the driver that needs to eventually be fixed -- the clock frequency is hardwired when it should be gotten from the clock in the device tree. I'll come back and fix this when I'm more comfortable with the api. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/samsung/exynos_wdt.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/samsung/files.exynos Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_wdt.c diff -u src/sys/arch/arm/samsung/exynos_wdt.c:1.7 src/sys/arch/arm/samsung/exynos_wdt.c:1.8 --- src/sys/arch/arm/samsung/exynos_wdt.c:1.7 Sun Dec 13 22:28:09 2015 +++ src/sys/arch/arm/samsung/exynos_wdt.c Tue Dec 15 23:15:53 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_wdt.c,v 1.7 2015/12/13 22:28:09 marty Exp $ */ +/* $NetBSD: exynos_wdt.c,v 1.8 2015/12/15 23:15:53 marty Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "exynos_wdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: exynos_wdt.c,v 1.7 2015/12/13 22:28:09 marty Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_wdt.c,v 1.8 2015/12/15 23:15:53 marty Exp $"); #include #include @@ -48,6 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: exynos_wdt.c #include #include +#include #if NEXYNOS_WDT > 0 static int exynos_wdt_match(device_t, cfdata_t, void *); @@ -90,7 +91,10 @@ exynos_wdt_wdog_write(struct exynos_wdt_ static int exynos_wdt_match(device_t parent, cfdata_t cf, void *aux) { - return 1; + const char * const compatible[] = { "samsung,s3c2410-wdt", NULL }; + struct fdt_attach_args * const faa = aux; + + return of_match_compatible(faa->faa_phandle, compatible); } static int @@ -173,22 +177,32 @@ static void exynos_wdt_attach(device_t parent, device_t self, void *aux) { struct exynos_wdt_softc * const sc = device_private(self); - struct exyo_attach_args * const exyo = aux; - prop_dictionary_t dict = device_properties(self); +// prop_dictionary_t dict = device_properties(self); + struct fdt_attach_args * const faa = aux; + bus_addr_t addr; + bus_size_t size; + int error; + + if (fdtbus_get_reg(faa->faa_phandle, 0, , ) != 0) { + aprint_error(": couldn't get registers\n"); + return; + } sc->sc_dev = self; - sc->sc_bst = exyo->exyo_core_bst; + sc->sc_bst = faa->faa_bst; - if (bus_space_subregion(sc->sc_bst, exyo->exyo_core_bsh, - exyo->exyo_loc.loc_offset, exyo->exyo_loc.loc_size, >sc_wdog_bsh)) { - aprint_error(": failed to map registers\n"); + error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_wdog_bsh); + if (error) { + aprint_error(": couldn't map %#llx: %d", (uint64_t)addr, error); return; } /* * This runs at the Exynos Pclk. */ - prop_dictionary_get_uint32(dict, "frequency", >sc_freq); +// prop_dictionary_get_uint32(dict, "frequency", >sc_freq); + sc->sc_freq = 1200; /* MJF: HACK hardwire for now */ + /* Need to figure out how to get freq from dtb */ sc->sc_wdog_wtcon = exynos_wdt_wdog_read(sc, EXYNOS_WDT_WTCON); sc->sc_wdog_armed = (sc->sc_wdog_wtcon & WTCON_ENABLE) && (sc->sc_wdog_wtcon & WTCON_RESET_ENABLE); @@ -255,7 +269,7 @@ exynos_wdt_attach(device_t parent, devic sc->sc_smw.smw_period = sc->sc_wdog_period; if (sc->sc_wdog_armed) { - int error = sysmon_wdog_setmode(>sc_smw, WDOG_MODE_KTICKLE, + error = sysmon_wdog_setmode(>sc_smw, WDOG_MODE_KTICKLE, sc->sc_wdog_period); if (error) aprint_error_dev(self, Index: src/sys/arch/arm/samsung/files.exynos diff -u src/sys/arch/arm/samsung/files.exynos:1.11 src/sys/arch/arm/samsung/files.exynos:1.12 --- src/sys/arch/arm/samsung/files.exynos:1.11 Mon Dec 14 22:06:57 2015 +++ src/sys/arch/arm/samsung/files.exynos Tue Dec 15 23:15:53 2015 @@ -1,4 +1,4 @@ -# $NetBSD: files.exynos,v 1.11 2015/12/14 22:06:57 marty Exp $ +# $NetBSD: files.exynos,v 1.12 2015/12/15 23:15:53 marty Exp $ # # Configuration info for Samsung Exynos SoC ARM Peripherals # @@ -12,14 +12,14 @@ file arch/arm/arm32/arm32_boot.c file arch/arm/arm32/arm32_kvminit.c file arch/arm/arm32/arm32_reboot.c file arch/arm/arm32/irq_dispatch.S +file arch/arm/arm32/armv7_generic_space.c +file arch/arm/arm/bus_space_a4x.S file arch/arm/samsung/exynos_soc.c file arch/arm/samsung/exynos_space.c #file arch/arm/samsung/exynos_dma.c file arch/arm/samsung/exynos_smc.S arm_trustzone_firmware -file arch/arm/arm/bus_space_a4x.S exyo - # Console parameters defparam opt_exynos.hCONADDR defparam opt_exynos.hCONSPEED @@ -63,7 +63,7 @@ file arch/arm/samsung/mct.c exyo_mct # Watchdog device exyowdt : sysmon_wdog
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Tue Dec 15 23:13:51 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_fdt.c exynos_var.h Log Message: XU4 FDT -- fix bus tags I got away with not having the generic bus tags for getting minimum fdt to work; but for real drivers have to actually have them. Make necessary corrections. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_fdt.c cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/samsung/exynos_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_fdt.c diff -u src/sys/arch/arm/samsung/exynos_fdt.c:1.1 src/sys/arch/arm/samsung/exynos_fdt.c:1.2 --- src/sys/arch/arm/samsung/exynos_fdt.c:1.1 Mon Dec 14 22:51:42 2015 +++ src/sys/arch/arm/samsung/exynos_fdt.c Tue Dec 15 23:13:51 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_fdt.c,v 1.1 2015/12/14 22:51:42 marty Exp $ */ +/* $NetBSD: exynos_fdt.c,v 1.2 2015/12/15 23:13:51 marty Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill@@ -29,7 +29,7 @@ #include "opt_exynos.h" #include -__KERNEL_RCSID(0, "$NetBSD: exynos_fdt.c,v 1.1 2015/12/14 22:51:42 marty Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_fdt.c,v 1.2 2015/12/15 23:13:51 marty Exp $"); #include #include @@ -84,9 +84,9 @@ exynosfdt_attach(device_t parent, device struct fdt_attach_args faa = { .faa_name = "", - // .faa_bst = _generic_bs_tag, - //.faa_a4x_bst = _generic_a4x_bs_tag, - //.faa_dmat = _dma_tag, + .faa_bst = _generic_bs_tag, + .faa_a4x_bst = _generic_a4x_bs_tag, + .faa_dmat = _bus_dma_tag, .faa_phandle = OF_peer(0), .faa_init = exynosfdt_init, .faa_ninit = __arraycount(exynosfdt_init) Index: src/sys/arch/arm/samsung/exynos_var.h diff -u src/sys/arch/arm/samsung/exynos_var.h:1.19 src/sys/arch/arm/samsung/exynos_var.h:1.20 --- src/sys/arch/arm/samsung/exynos_var.h:1.19 Fri Dec 11 04:03:44 2015 +++ src/sys/arch/arm/samsung/exynos_var.h Tue Dec 15 23:13:51 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_var.h,v 1.19 2015/12/11 04:03:44 marty Exp $ */ +/* $NetBSD: exynos_var.h,v 1.20 2015/12/15 23:13:51 marty Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -115,6 +115,8 @@ extern struct bus_space exynos_a4x_bs_ta extern struct arm32_bus_dma_tag exynos_bus_dma_tag; extern struct arm32_bus_dma_tag exynos_coherent_bus_dma_tag; +extern struct bus_space armv7_generic_bs_tag; +extern struct bus_space armv7_generic_a4x_bs_tag; extern bus_space_handle_t exynos_core_bsh; extern bus_space_handle_t exynos_wdt_bsh; extern bus_space_handle_t exynos_pmu_bsh;
CVS commit: src/sys/arch/evbarm/exynos
Module Name:src Committed By: marty Date: Tue Dec 15 04:53:56 UTC 2015 Added Files: src/sys/arch/evbarm/exynos: genassym.cf Log Message: XU$ genassym.cf adding previously missed file. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/exynos/genassym.cf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/evbarm/exynos/genassym.cf diff -u /dev/null src/sys/arch/evbarm/exynos/genassym.cf:1.1 --- /dev/null Tue Dec 15 04:53:56 2015 +++ src/sys/arch/evbarm/exynos/genassym.cf Tue Dec 15 04:53:55 2015 @@ -0,0 +1,39 @@ +# $NetBSD: genassym.cf,v 1.1 2015/12/15 04:53:55 marty Exp $ + +#- +# Copyright (c) 2013 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Matt Thomas of 3am Software Foundry. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +#notice, this list of conditions and the following disclaimer in the +#documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +include +include + +define UTRSTAT_TXEMPTY UTRSTAT_TXEMPTY +define UTRSTAT_TXSHIFTER_EMPTY UTRSTAT_TXSHIFTER_EMPTY +define SSCOM_UTXH SSCOM_UTXH +define SSCOM_UTRSTAT SSCOM_UTRSTAT +define MAX_BOOT_STRING MAX_BOOT_STRING
CVS commit: src/sys/arch/evbarm/conf
Module Name:src Committed By: marty Date: Tue Dec 15 04:38:30 UTC 2015 Added Files: src/sys/arch/evbarm/conf: EXYNOS EXYNOS_INSTALL Removed Files: src/sys/arch/evbarm/conf: ODROID-XU4 ODROID-XU4_INSTALL files.odroid mk.odroid std.odroid Log Message: EXYNOS - change ODROID-XU4 to EXYNOS EXYNOS will be a generic fdt kernel, so signify that with the name change, as requested by Nick. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/EXYNOS \ src/sys/arch/evbarm/conf/EXYNOS_INSTALL cvs rdiff -u -r1.5 -r0 src/sys/arch/evbarm/conf/ODROID-XU4 \ src/sys/arch/evbarm/conf/std.odroid cvs rdiff -u -r1.1 -r0 src/sys/arch/evbarm/conf/ODROID-XU4_INSTALL \ src/sys/arch/evbarm/conf/files.odroid cvs rdiff -u -r1.3 -r0 src/sys/arch/evbarm/conf/mk.odroid Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/evbarm/conf/EXYNOS diff -u /dev/null src/sys/arch/evbarm/conf/EXYNOS:1.1 --- /dev/null Tue Dec 15 04:38:30 2015 +++ src/sys/arch/evbarm/conf/EXYNOS Tue Dec 15 04:38:30 2015 @@ -0,0 +1,278 @@ +# +# $NetBSD: EXYNOS,v 1.1 2015/12/15 04:38:30 marty Exp $ +# +# ODROID-XU -- ODROID-XU4 Exynos5422 based kernel +# + +include "arch/evbarm/conf/std.exynos" + +no makeoptions CPUFLAGS +makeoptions CPUFLAGS="-mcpu=cortex-a7 -mfpu=neon" +no makeoptions BOARDTYPE +makeoptions BOARDTYPE="hardkernel_odroid_xu4" +no makeoptions KERNEL_BASE_PHYS +no makeoptions KERNEL_BASE_VIRT +makeoptions KERNEL_BASE_PHYS="0x8000" +makeoptions KERNEL_BASE_VIRT="0x8000" +options PMAP_NEED_ALLOC_POOLPAGE +options MEMSIZE=2048 + +# estimated number of users + +maxusers 8 + +# Standard system options + +options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT +#options NTP # NTP phase/frequency locked loop + +# CPU options +options CPU_CORTEX +options CPU_CORTEXA7 +options CPU_CORTEXA15 +options EXYNOS5422 +#options MULTIPROCESSOR + +options FDT # not really but soon +pseudo-device openfirm # jmcneill: oops, fdtbus should depend on +# openfirm. don't let me forget. + + +options PMAPCOUNTERS +options BUSDMA_COUNTERS +options EXYNOS_CONSOLE_EARLY +#options UVMHIST +options USBHIST +options USBHIST_SIZE=10 +#options UVMHIST_PRINT,KERNHIST_DELAY=0 +options __HAVE_MM_MD_DIRECT_MAPPED_PHYS +#options PMAP_NEED_ALLOC_POOLPAGE + +# Specify the memory size in megabytes (optional). +#options MEMSIZE=2048 + +# File systems +file-system FFS # UFS +#file-system LFS # log-structured file system +file-system MFS # memory file system +file-system NFS # Network file system +#file-system ADOSFS # AmigaDOS-compatible file system +#file-system EXT2FS # second extended file system (linux) +#file-system CD9660 # ISO 9660 + Rock Ridge file system +file-system MSDOSFS # MS-DOS file system +#file-system FDESC # /dev/fd +file-system KERNFS # /kern +#file-system NULLFS # loopback file system +file-system PROCFS # /proc +#file-system PUFFS # Userspace file systems (e.g. ntfs-3g & sshfs) +#file-system UMAPFS # NULLFS + uid and gid remapping +#file-system UNION # union file system +file-system TMPFS # memory file system +file-system PTYFS # /dev/pts/N support + +# File system options +#options QUOTA # legacy UFS quotas +#options QUOTA2 # new, in-filesystem UFS quotas +#options FFS_EI # FFS Endian Independent support +options NFSSERVER +options WAPBL # File system journaling support +#options FFS_NO_SNAPSHOT # No FFS snapshot support + +# Networking options + +#options GATEWAY # packet forwarding +options INET # IP + ICMP + TCP + UDP +options INET6 # IPV6 +#options IPSEC # IP security +#options IPSEC_DEBUG # debug for IP security +#options MROUTING # IP multicast routing +#options PIM # Protocol Independent Multicast +#options NETATALK # AppleTalk networking +#options PPP_BSDCOMP # BSD-Compress compression support for PPP +#options PPP_DEFLATE # Deflate compression support for PPP +#options PPP_FILTER # Active filter support for PPP (requires bpf) +#options TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG + +#options NFS_BOOT_BOOTP +#options NFS_BOOT_DHCP +#options NFS_BOOT_BOOTSTATIC +#options NFS_BOOTSTATIC_MYIP="\"192.168.0.22\"" +#options NFS_BOOTSTATIC_GWIP="\"192.168.0.1\"" +#options NFS_BOOTSTATIC_MASK="\"255.255.255.0\"" +#options NFS_BOOTSTATIC_SERVADDR="\"192.168.0.5\"" +#options NFS_BOOTSTATIC_SERVER="\"192.168.0.5:/stuff/nfs/odroid\"" + +#options NFS_BOOT_RWSIZE=1024 + +# Compatibility options + +options COMPAT_NETBSD32 # allow running arm (e.g. non-earm) binaries +#options COMPAT_43 # 4.3BSD compatibility. +#options COMPAT_09 # NetBSD 0.9, +#options COMPAT_10 # NetBSD 1.0, +#options COMPAT_11 # NetBSD 1.1, +#options COMPAT_12 # NetBSD 1.2, +#options COMPAT_13 # NetBSD 1.3, +#options COMPAT_14 # NetBSD 1.4, +#options COMPAT_15 # NetBSD 1.5, +#options COMPAT_16 # NetBSD
CVS commit: src/sys/arch
Module Name:src Committed By: marty Date: Mon Dec 14 22:06:57 UTC 2015 Modified Files: src/sys/arch/arm/samsung: files.exynos src/sys/arch/evbarm/conf: ODROID-XU4 files.exynos src/sys/arch/evbarm/exynos: exynos_machdep.c Log Message: XU4 FDT Enable the minimum device tree This enables the use of FDT on the XU4 but doesn't add any drivers. However, with this check in, XU4 becomes useless without a device tree blob from the Linux tree, which isn't checked in anywhere. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/samsung/files.exynos cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/ODROID-XU4 cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/files.exynos cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/exynos/exynos_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/files.exynos diff -u src/sys/arch/arm/samsung/files.exynos:1.10 src/sys/arch/arm/samsung/files.exynos:1.11 --- src/sys/arch/arm/samsung/files.exynos:1.10 Sat Dec 12 21:56:54 2015 +++ src/sys/arch/arm/samsung/files.exynos Mon Dec 14 22:06:57 2015 @@ -1,4 +1,4 @@ -# $NetBSD: files.exynos,v 1.10 2015/12/12 21:56:54 marty Exp $ +# $NetBSD: files.exynos,v 1.11 2015/12/14 22:06:57 marty Exp $ # # Configuration info for Samsung Exynos SoC ARM Peripherals # @@ -44,6 +44,11 @@ defflag opt_exynos.hEXYNOS5420: EXYN defflag opt_exynos.hEXYNOS5440: EXYNOS5 defflag opt_exynos.hEXYNOS5422: EXYNOS5 +# On-board I/O +device exynosfdt : bus_space_generic, fdtbus +attach exynosfdt at mainbus with exynos_fdt +file arch/arm/samsung/exynos_fdt.c exynos_fdt + # SoC I/O attach point device exyo { [port=-1], [intr=-1] } : bus_space_generic attach exyo at mainbus with exyo_io Index: src/sys/arch/evbarm/conf/ODROID-XU4 diff -u src/sys/arch/evbarm/conf/ODROID-XU4:1.4 src/sys/arch/evbarm/conf/ODROID-XU4:1.5 --- src/sys/arch/evbarm/conf/ODROID-XU4:1.4 Mon Dec 14 00:00:22 2015 +++ src/sys/arch/evbarm/conf/ODROID-XU4 Mon Dec 14 22:06:57 2015 @@ -1,5 +1,5 @@ # -# $NetBSD: ODROID-XU4,v 1.4 2015/12/14 00:00:22 marty Exp $ +# $NetBSD: ODROID-XU4,v 1.5 2015/12/14 22:06:57 marty Exp $ # # ODROID-XU -- ODROID-XU4 Exynos5422 based kernel # @@ -33,6 +33,11 @@ options CPU_CORTEXA15 options EXYNOS5422 #options MULTIPROCESSOR +options FDT # not really but soon +pseudo-device openfirm # jmcneill: oops, fdtbus should depend on +# openfirm. don't let me forget. + + options PMAPCOUNTERS options BUSDMA_COUNTERS options EXYNOS_CONSOLE_EARLY @@ -196,6 +201,14 @@ armperiph0 at mainbus? armgic0 at armperiph? # Interrupt Controller armgtmr0 at armperiph? # Generic Timer +# On-board I/O +exynosfdt0 at mainbus? +fdt0 at exynosfdt0 +simplebus* at fdt? +fdt* at simplebus? + +fregulator* at fdt? + # Exynos SoC exyo0 at mainbus? Index: src/sys/arch/evbarm/conf/files.exynos diff -u src/sys/arch/evbarm/conf/files.exynos:1.1 src/sys/arch/evbarm/conf/files.exynos:1.2 --- src/sys/arch/evbarm/conf/files.exynos:1.1 Sun Dec 6 00:31:24 2015 +++ src/sys/arch/evbarm/conf/files.exynos Mon Dec 14 22:06:57 2015 @@ -1,4 +1,4 @@ -# $NetBSD: files.exynos,v 1.1 2015/12/06 00:31:24 marty Exp $ +# $NetBSD: files.exynos,v 1.2 2015/12/14 22:06:57 marty Exp $ # # EXYNOS 5422 board configuration info # @@ -8,5 +8,11 @@ file arch/evbarm/exynos/exynos_machdep.c # Kernel boot arguments defparam opt_machdep.hBOOT_ARGS +# FDT + +include "dev/ofw/files.ofw" +include "dev/fdt/files.fdt" +include "arch/arm/fdt/files.fdt" + # Pull in Exynos SoC default include "arch/arm/samsung/files.exynos" Index: src/sys/arch/evbarm/exynos/exynos_machdep.c diff -u src/sys/arch/evbarm/exynos/exynos_machdep.c:1.3 src/sys/arch/evbarm/exynos/exynos_machdep.c:1.4 --- src/sys/arch/evbarm/exynos/exynos_machdep.c:1.3 Sun Dec 13 22:28:09 2015 +++ src/sys/arch/evbarm/exynos/exynos_machdep.c Mon Dec 14 22:06:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_machdep.c,v 1.3 2015/12/13 22:28:09 marty Exp $ */ +/* $NetBSD: exynos_machdep.c,v 1.4 2015/12/14 22:06:57 marty Exp $ */ /* * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exynos_machdep.c,v 1.3 2015/12/13 22:28:09 marty Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_machdep.c,v 1.4 2015/12/14 22:06:57 marty Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_exynos.h" @@ -101,6 +101,16 @@ __KERNEL_RCSID(0, "$NetBSD: exynos_machd #include #include +/* so we can load the device tree. NOTE: This requires the kernel to be + * made into a linux (not netbsd) uboot image. + */ +#include +#include +#include +#include +#define FDT_BUF_SIZE (128*1024) +static uint8_t fdt_data[FDT_BUF_SIZE]; + extern const int num_exynos_uarts_entries; extern const struct sscom_uart_info exynos_uarts[]; @@ -368,6 +378,7 @@ initarm(void *arg) char mi_bootargs[] = BOOT_ARGS;
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Mon Dec 14 22:51:42 UTC 2015 Added Files: src/sys/arch/arm/samsung: exynos_fdt.c Log Message: XU4 FDT Missing file maybe it'll compile now. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/samsung/exynos_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/arm/samsung/exynos_fdt.c diff -u /dev/null src/sys/arch/arm/samsung/exynos_fdt.c:1.1 --- /dev/null Mon Dec 14 22:51:42 2015 +++ src/sys/arch/arm/samsung/exynos_fdt.c Mon Dec 14 22:51:42 2015 @@ -0,0 +1,95 @@ +/* $NetBSD: exynos_fdt.c,v 1.1 2015/12/14 22:51:42 marty Exp $ */ + +/*- + * Copyright (c) 2015 Jared D. McNeill+ * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "opt_exynos.h" + +#include +__KERNEL_RCSID(0, "$NetBSD: exynos_fdt.c,v 1.1 2015/12/14 22:51:42 marty Exp $"); + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +static int exynosfdt_match(device_t, cfdata_t, void *); +static void exynosfdt_attach(device_t, device_t, void *); + +CFATTACH_DECL_NEW(exynos_fdt, 0, +exynosfdt_match, exynosfdt_attach, NULL, NULL); + +static bool exynosfdt_found = false; + +int +exynosfdt_match(device_t parent, cfdata_t cf, void *aux) +{ + if (exynosfdt_found) + return 0; + return 1; +} + +void +exynosfdt_attach(device_t parent, device_t self, void *aux) +{ + const char *exynosfdt_init[] = { + "interrupt-controller", + "clock", + "pinmux", + "gpio", + "regulators", + "dma", + "pmc", + "memory-controller", + "i2c", + "usb-phy" + }; + + exynosfdt_found = true; + + aprint_naive("\n"); + aprint_normal("\n"); + + struct fdt_attach_args faa = { + .faa_name = "", + // .faa_bst = _generic_bs_tag, + //.faa_a4x_bst = _generic_a4x_bs_tag, + //.faa_dmat = _dma_tag, + .faa_phandle = OF_peer(0), + .faa_init = exynosfdt_init, + .faa_ninit = __arraycount(exynosfdt_init) + }; + config_found(self, , NULL); +}
CVS commit: src/sys/arch
Module Name:src Committed By: marty Date: Sun Dec 13 22:28:10 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_wdt.c src/sys/arch/evbarm/exynos: exynos_machdep.c Log Message: undo 'typo' fix and restore 'frequency' to dictionary Oops. The 'typo' was elsewhere and I accidently removed setting the frequency. Fix that. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/samsung/exynos_wdt.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/exynos/exynos_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_wdt.c diff -u src/sys/arch/arm/samsung/exynos_wdt.c:1.6 src/sys/arch/arm/samsung/exynos_wdt.c:1.7 --- src/sys/arch/arm/samsung/exynos_wdt.c:1.6 Thu Dec 10 21:56:04 2015 +++ src/sys/arch/arm/samsung/exynos_wdt.c Sun Dec 13 22:28:09 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_wdt.c,v 1.6 2015/12/10 21:56:04 marty Exp $ */ +/* $NetBSD: exynos_wdt.c,v 1.7 2015/12/13 22:28:09 marty Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "exynos_wdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: exynos_wdt.c,v 1.6 2015/12/10 21:56:04 marty Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_wdt.c,v 1.7 2015/12/13 22:28:09 marty Exp $"); #include #include @@ -54,10 +54,10 @@ static int exynos_wdt_match(device_t, cf static void exynos_wdt_attach(device_t, device_t, void *); struct exynos_wdt_softc { - struct sysmon_wdog sc_smw; device_t sc_dev; bus_space_tag_t sc_bst; bus_space_handle_t sc_wdog_bsh; + struct sysmon_wdog sc_smw; u_int sc_wdog_period; u_int sc_wdog_clock_select; u_int sc_wdog_prescaler; @@ -68,7 +68,7 @@ struct exynos_wdt_softc { }; #ifndef EXYNOS_WDT_PERIOD_DEFAULT -#define EXYNOS_WDT_PERIOD_DEFAULT 12 +#define EXYNOS_WDT_PERIOD_DEFAULT 60 #endif CFATTACH_DECL_NEW(exynos_wdt, sizeof(struct exynos_wdt_softc), @@ -189,13 +189,12 @@ exynos_wdt_attach(device_t parent, devic * This runs at the Exynos Pclk. */ prop_dictionary_get_uint32(dict, "frequency", >sc_freq); - sc->sc_wdog_wtcon = exynos_wdt_wdog_read(sc, EXYNOS_WDT_WTCON); sc->sc_wdog_armed = (sc->sc_wdog_wtcon & WTCON_ENABLE) && (sc->sc_wdog_wtcon & WTCON_RESET_ENABLE); if (sc->sc_wdog_armed) { sc->sc_wdog_prescaler = - __SHIFTOUT(sc->sc_wdog_wtcon, WTCON_PRESCALER) + 1; + __SHIFTOUT(sc->sc_wdog_wtcon, WTCON_PRESCALER); sc->sc_wdog_clock_select = __SHIFTOUT(sc->sc_wdog_wtcon, WTCON_CLOCK_SELECT); sc->sc_freq /= sc->sc_wdog_prescaler; @@ -203,7 +202,7 @@ exynos_wdt_attach(device_t parent, devic sc->sc_wdog_wtdat = exynos_wdt_wdog_read(sc, EXYNOS_WDT_WTDAT); sc->sc_wdog_period = (sc->sc_wdog_wtdat + 1) / sc->sc_freq; } else { - sc->sc_wdog_period = EXYNOS_WDT_DEFAULT_PERIOD; + sc->sc_wdog_period = EXYNOS_WDT_PERIOD_DEFAULT; sc->sc_wdog_prescaler = 1; /* * Let's see what clock select we should use. Index: src/sys/arch/evbarm/exynos/exynos_machdep.c diff -u src/sys/arch/evbarm/exynos/exynos_machdep.c:1.2 src/sys/arch/evbarm/exynos/exynos_machdep.c:1.3 --- src/sys/arch/evbarm/exynos/exynos_machdep.c:1.2 Fri Dec 11 04:12:21 2015 +++ src/sys/arch/evbarm/exynos/exynos_machdep.c Sun Dec 13 22:28:09 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_machdep.c,v 1.2 2015/12/11 04:12:21 marty Exp $ */ +/* $NetBSD: exynos_machdep.c,v 1.3 2015/12/13 22:28:09 marty Exp $ */ /* * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exynos_machdep.c,v 1.2 2015/12/11 04:12:21 marty Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_machdep.c,v 1.3 2015/12/13 22:28:09 marty Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_exynos.h" @@ -515,6 +515,9 @@ odroid_device_register(device_t self, vo exynos_device_register(self, aux); if (device_is_a(self, "exyogpio")) { init_gpio_dictionary(gpio_pin_entries, dict); + } else if (device_is_a(self, "exyowdt")) { + prop_dictionary_set_uint32(dict, "frequency", + EXYNOS_F_IN_FREQ); } }
CVS commit: src/sys/arch/evbarm/conf
Module Name:src Committed By: marty Date: Mon Dec 14 00:00:22 UTC 2015 Modified Files: src/sys/arch/evbarm/conf: ODROID-XU4 Log Message: enable the watch dog This will work only if the patch to sysmon_wdog.c to convert it to MODULE_CLASS_DRIVER is installed. Symptom of failure is a crash in lockdebug because of an uninitialized mutex. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/ODROID-XU4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/conf/ODROID-XU4 diff -u src/sys/arch/evbarm/conf/ODROID-XU4:1.3 src/sys/arch/evbarm/conf/ODROID-XU4:1.4 --- src/sys/arch/evbarm/conf/ODROID-XU4:1.3 Sun Dec 6 00:31:24 2015 +++ src/sys/arch/evbarm/conf/ODROID-XU4 Mon Dec 14 00:00:22 2015 @@ -1,5 +1,5 @@ # -# $NetBSD: ODROID-XU4,v 1.3 2015/12/06 00:31:24 marty Exp $ +# $NetBSD: ODROID-XU4,v 1.4 2015/12/14 00:00:22 marty Exp $ # # ODROID-XU -- ODROID-XU4 Exynos5422 based kernel # @@ -207,7 +207,7 @@ exy5422clk0 at exyo0 # Exynos5422 cloc sscom2 at exyo0 port 2 # UART2 # Exynos Watchdog Timer -#exyowdt0 at exyo0 # watchdog +exyowdt0 at exyo0 # watchdog # GPIO exyogpio0 at exyo0
CVS commit: src/sys/arch/evbarm/exynos
Module Name:src Committed By: marty Date: Mon Dec 14 05:13:01 UTC 2015 Modified Files: src/sys/arch/evbarm/exynos: exynos_start.S Log Message: FDT XU4 fix uboot support remove some code I thought I'd previously removed which causes data aborts if uboot is invoked with 'bootm ADDR - ADDR'. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/exynos/exynos_start.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/exynos/exynos_start.S diff -u src/sys/arch/evbarm/exynos/exynos_start.S:1.1 src/sys/arch/evbarm/exynos/exynos_start.S:1.2 --- src/sys/arch/evbarm/exynos/exynos_start.S:1.1 Sun Dec 6 00:33:44 2015 +++ src/sys/arch/evbarm/exynos/exynos_start.S Mon Dec 14 05:13:01 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_start.S,v 1.1 2015/12/06 00:33:44 marty Exp $ */ +/* $NetBSD: exynos_start.S,v 1.2 2015/12/14 05:13:01 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ #include -RCSID("$NetBSD: exynos_start.S,v 1.1 2015/12/06 00:33:44 marty Exp $") +RCSID("$NetBSD: exynos_start.S,v 1.2 2015/12/14 05:13:01 marty Exp $") #if defined(VERBOSE_INIT_ARM) @@ -118,22 +118,6 @@ _C_LABEL(exynos_start): #endif stmia r4, {r0-r3} // Save the arguments - movw r4, #:lower16:bootargs - movt r4, #:upper16:bootargs -#if KERNEL_BASE_VOFFSET != 0 - sub r4, r4, #KERNEL_BASE_VOFFSET -#endif - - cmp r3, #0 - beq 1f -2: - ldrb r0, [r3], #1 - strb r0, [r4], #1 - teq r0, #0 - bne 2b - -1: - /* * For easy and early SoC / PoP dependency, retrieve the IDs */
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Sat Dec 12 21:57:40 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_soc.c Log Message: XU4: Fix build missed a dependency on evbarm/odroid that should have been evbarm/exynos. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/samsung/exynos_soc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_soc.c diff -u src/sys/arch/arm/samsung/exynos_soc.c:1.29 src/sys/arch/arm/samsung/exynos_soc.c:1.30 --- src/sys/arch/arm/samsung/exynos_soc.c:1.29 Fri Dec 11 04:03:44 2015 +++ src/sys/arch/arm/samsung/exynos_soc.c Sat Dec 12 21:57:40 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_soc.c,v 1.29 2015/12/11 04:03:44 marty Exp $ */ +/* $NetBSD: exynos_soc.c,v 1.30 2015/12/12 21:57:40 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #define _ARM32_BUS_DMA_PRIVATE #include -__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.29 2015/12/11 04:03:44 marty Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.30 2015/12/12 21:57:40 marty Exp $"); #include #include @@ -60,7 +60,7 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_soc.c #include /* XXXNH */ -#include +#include /* these variables are retrieved in start.S and stored in .data */
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Sat Dec 12 21:56:54 UTC 2015 Modified Files: src/sys/arch/arm/samsung: files.exynos Log Message: XU4: re-enable gpio c'n'p error left gpio disabled. fixed. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/files.exynos Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/files.exynos diff -u src/sys/arch/arm/samsung/files.exynos:1.9 src/sys/arch/arm/samsung/files.exynos:1.10 --- src/sys/arch/arm/samsung/files.exynos:1.9 Fri Dec 11 03:55:18 2015 +++ src/sys/arch/arm/samsung/files.exynos Sat Dec 12 21:56:54 2015 @@ -1,4 +1,4 @@ -# $NetBSD: files.exynos,v 1.9 2015/12/11 03:55:18 marty Exp $ +# $NetBSD: files.exynos,v 1.10 2015/12/12 21:56:54 marty Exp $ # # Configuration info for Samsung Exynos SoC ARM Peripherals # @@ -70,8 +70,8 @@ defflag opt_sscom.h SSCOM0CONSOLE SS defparam opt_sscom.hSSCOM_FREQ # GPIO -#device exyogpio : gpiobus -#attach exyogpio at exyo with exynos_gpio +device exyogpio : gpiobus +attach exyogpio at exyo with exynos_gpio file arch/arm/samsung/exynos_gpio.c exynos_gpio | exyo_io needs-flag # USB2 Host Controller (EHCI/OHCI)
CVS commit: src/sys/arch/evbarm/odroid
Module Name:src Committed By: marty Date: Sat Dec 12 00:42:42 UTC 2015 Removed Files: src/sys/arch/evbarm/odroid: genassym.cf odroid_machdep.c odroid_start.S platform.h Log Message: Remove ev that's no longer valid development of the odroid boards has moved to evbarm/exynos and this directory is now out of date with respect to new development. To generate a diff of this commit: cvs rdiff -u -r1.2 -r0 src/sys/arch/evbarm/odroid/genassym.cf cvs rdiff -u -r1.42 -r0 src/sys/arch/evbarm/odroid/odroid_machdep.c cvs rdiff -u -r1.21 -r0 src/sys/arch/evbarm/odroid/odroid_start.S cvs rdiff -u -r1.5 -r0 src/sys/arch/evbarm/odroid/platform.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Thu Dec 10 21:56:04 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_wdt.c Log Message: Fix a typo To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos_wdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_wdt.c diff -u src/sys/arch/arm/samsung/exynos_wdt.c:1.5 src/sys/arch/arm/samsung/exynos_wdt.c:1.6 --- src/sys/arch/arm/samsung/exynos_wdt.c:1.5 Mon Sep 29 14:47:52 2014 +++ src/sys/arch/arm/samsung/exynos_wdt.c Thu Dec 10 21:56:04 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_wdt.c,v 1.5 2014/09/29 14:47:52 reinoud Exp $ */ +/* $NetBSD: exynos_wdt.c,v 1.6 2015/12/10 21:56:04 marty Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "exynos_wdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: exynos_wdt.c,v 1.5 2014/09/29 14:47:52 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_wdt.c,v 1.6 2015/12/10 21:56:04 marty Exp $"); #include #include @@ -203,7 +203,7 @@ exynos_wdt_attach(device_t parent, devic sc->sc_wdog_wtdat = exynos_wdt_wdog_read(sc, EXYNOS_WDT_WTDAT); sc->sc_wdog_period = (sc->sc_wdog_wtdat + 1) / sc->sc_freq; } else { - sc->sc_wdog_period = EXYNOS_WDT_PERIOD_DEFAULT; + sc->sc_wdog_period = EXYNOS_WDT_DEFAULT_PERIOD; sc->sc_wdog_prescaler = 1; /* * Let's see what clock select we should use.
CVS commit: src/sys/arch/evbarm/exynos
Module Name:src Committed By: marty Date: Fri Dec 11 04:12:21 UTC 2015 Modified Files: src/sys/arch/evbarm/exynos: exynos_machdep.c Log Message: EXYNOS rewrite step 3 of N: Add aliases for gpio pins This adds the GPIO aliases that will be used for board-independent driver lookup until we have FDT. The idea here is that each pin used by any driver is given a name that the driver knows that is independent of the gpio bank name. The mapping from the alias to the actual gpio bank + pin number is done in this file and a lookup function is added to exynos_gpio.c that allows a driver to ask for a gpio pin by the alias name, blisssfully unaware that there is an underlying GPIO bank name. Once set up with all the drivers, it should then be possible to move to a different vendor's board simply by modifying exynos_machdep.c To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/exynos/exynos_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/exynos/exynos_machdep.c diff -u src/sys/arch/evbarm/exynos/exynos_machdep.c:1.1 src/sys/arch/evbarm/exynos/exynos_machdep.c:1.2 --- src/sys/arch/evbarm/exynos/exynos_machdep.c:1.1 Sun Dec 6 00:33:44 2015 +++ src/sys/arch/evbarm/exynos/exynos_machdep.c Fri Dec 11 04:12:21 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_machdep.c,v 1.1 2015/12/06 00:33:44 marty Exp $ */ +/* $NetBSD: exynos_machdep.c,v 1.2 2015/12/11 04:12:21 marty Exp $ */ /* * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exynos_machdep.c,v 1.1 2015/12/06 00:33:44 marty Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_machdep.c,v 1.2 2015/12/11 04:12:21 marty Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_exynos.h" @@ -135,6 +135,9 @@ char *boot_file = NULL;/* MI bootfil uint8_t uboot_enaddr[ETHER_ADDR_LEN] = {}; +void +odroid_device_register(device_t self, void *aux); + /* * kernel start and end from the linker */ @@ -201,6 +204,40 @@ static struct boot_physmem bp_highgig = }; #endif +static struct gpio_pin_entry { + const char *pin_name; + const char *pin_user; +} gpio_pin_entries[] = { + /* mux@1340 (muxa) */ + { "gpx3-7", "hdmi-hpd-irq"}, + { "gpx3-6", "hdmi_cec" }, + { "gpx0-7", "dp_hpd_gpio" }, + { "gpx0-4", "pmic-irq" }, + { "gpx3-2", "audio-irq" }, + { "gpx3-4", "b-sess1-irq" }, + { "gpx3-5", "b-sess0-irq" }, + { "gpx1-1", "id2-irq" }, + /* mux@13410 (muxb) */ + { "gpc0-0", "sd0-clk" }, + { "gpc0-1", "sd0-cmd" }, + { "gpc0-7", "sd0-rdqs" }, + { "gpd1-3", "sd0-qrdy" }, + { "gpc0-3", "sd0-bus-width1" }, + { "gpc0-3", "sd0-bus-width4-bit1" }, + { "gpc0-4", "sd0-bus-width4-bit2" }, + { "gpc0-5", "sd0-bus-width4-bit3" }, + { "gpc0-6", "sd0-bus-width4-bit4" }, + { "gpc1-0", "sd1-clk" }, + { "gpc1-1", "sd1-cmd" }, + { "gpc1-3", "sd1-bus-width1" }, + { "gpc1-3", "sd1-bus-width4-bit1" }, + { "gpc1-4", "sd1-bus-width4-bit2" }, + { "gpc1-5", "sd1-bus-width4-bit3" }, + { "gpc1-6", "sd1-bus-width4-bit4" }, + /* TODO: muxc and muxd as needed */ + { 0, 0} +}; + #ifdef VERBOSE_INIT_ARM extern void exynos_putchar(int); @@ -238,6 +275,20 @@ exynos_printn(u_int n, int base) extern void cortex_mpstart(void); /* + * void init_gpio_dictionary(...) + * + * Setup the dictionary of gpio pin names for the drivers to use + */ +static void init_gpio_dictionary(struct gpio_pin_entry *pins, + prop_dictionary_t dict) +{ + while (pins->pin_name) { + prop_dictionary_set_cstring(dict, pins->pin_user, + pins->pin_name); + pins++; + } +} +/* * u_int initarm(...) * * Our entry point from the assembly before main() is called. @@ -351,9 +402,8 @@ initarm(void *arg) mapallmem_p); /* we've a specific device_register routine */ - evbarm_device_register = exynos_device_register; - evbarm_device_register_post_config = exynos_device_register_post_config; - + evbarm_device_register = odroid_device_register; +// evbarm_device_register_post_config = exynos_device_register_post_config; /* * If we couldn't map all of memory via TTBR1, limit the memory the * kernel can allocate from to be from the highest available 1GB. @@ -458,6 +508,16 @@ exynos_extract_mac_adress(void) #undef EXPECT_COLON } +void +odroid_device_register(device_t self, void *aux) +{ + prop_dictionary_t dict = device_properties(self); + exynos_device_register(self, aux); + if (device_is_a(self, "exyogpio")) { + init_gpio_dictionary(gpio_pin_entries, dict); + } +} + /* * Exynos specific tweaks */
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Fri Dec 11 03:55:18 UTC 2015 Modified Files: src/sys/arch/arm/samsung: files.exynos Removed Files: src/sys/arch/arm/samsung: files.exynos5422 Log Message: Move everything back into files.exynos To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/files.exynos cvs rdiff -u -r1.1 -r0 src/sys/arch/arm/samsung/files.exynos5422 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/files.exynos diff -u src/sys/arch/arm/samsung/files.exynos:1.8 src/sys/arch/arm/samsung/files.exynos:1.9 --- src/sys/arch/arm/samsung/files.exynos:1.8 Sat Dec 5 13:32:27 2015 +++ src/sys/arch/arm/samsung/files.exynos Fri Dec 11 03:55:18 2015 @@ -1,4 +1,4 @@ -# $NetBSD: files.exynos,v 1.8 2015/12/05 13:32:27 jmcneill Exp $ +# $NetBSD: files.exynos,v 1.9 2015/12/11 03:55:18 marty Exp $ # # Configuration info for Samsung Exynos SoC ARM Peripherals # @@ -15,7 +15,7 @@ file arch/arm/arm32/irq_dispatch.S file arch/arm/samsung/exynos_soc.c file arch/arm/samsung/exynos_space.c -file arch/arm/samsung/exynos_dma.c +#file arch/arm/samsung/exynos_dma.c file arch/arm/samsung/exynos_smc.S arm_trustzone_firmware file arch/arm/arm/bus_space_a4x.S exyo @@ -70,8 +70,8 @@ defflag opt_sscom.h SSCOM0CONSOLE SS defparam opt_sscom.hSSCOM_FREQ # GPIO -device exyogpio : gpiobus -attach exyogpio at exyo with exynos_gpio +#device exyogpio : gpiobus +#attach exyogpio at exyo with exynos_gpio file arch/arm/samsung/exynos_gpio.c exynos_gpio | exyo_io needs-flag # USB2 Host Controller (EHCI/OHCI) @@ -86,4 +86,8 @@ device exyoiic: i2cbus, i2c_bitbang attach exyoiic at exyo with exynos_iic file arch/arm/samsung/exynos_i2c.c exynos_iic | exyo_io needs-flag -include "arch/arm/samsung/files.exynos5422" +file arch/arm/samsung/exynos5422_dma.c + +device exy5422clk: clk +attach exy5422clk at exyo with exynos5422_clock +file arch/arm/samsung/exynos5422_clock.c exynos5422_clock
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Fri Dec 11 04:05:54 UTC 2015 Added Files: src/sys/arch/arm/samsung: exynos5422_dma.c Log Message: add a dma file to the EXYNOS rewrite To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/samsung/exynos5422_dma.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/arm/samsung/exynos5422_dma.c diff -u /dev/null src/sys/arch/arm/samsung/exynos5422_dma.c:1.1 --- /dev/null Fri Dec 11 04:05:54 2015 +++ src/sys/arch/arm/samsung/exynos5422_dma.c Fri Dec 11 04:05:54 2015 @@ -0,0 +1,77 @@ +/* $NetBSD: exynos5422_dma.c,v 1.1 2015/12/11 04:05:54 marty Exp $ */ + +/*- + * Copyright (c) 2012 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Nick Hudson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "opt_exynos.h" + +#include +__KERNEL_RCSID(0, "$NetBSD: exynos5422_dma.c,v 1.1 2015/12/11 04:05:54 marty Exp $"); + +#define _ARM32_BUS_DMA_PRIVATE + +#include +#include + +#include +#include + +struct arm32_bus_dma_tag exynos_bus_dma_tag = { + _BUS_DMAMAP_FUNCS, + _BUS_DMAMEM_FUNCS, + _BUS_DMATAG_FUNCS, +}; + +struct arm32_dma_range exynos_coherent_dma_ranges[1] = { + [0] = { + .dr_sysbase = 0, /* filled in */ + .dr_busbase = 0, /* filled in */ + .dr_flags = _BUS_DMAMAP_COHERENT, + }, +}; + +struct arm32_bus_dma_tag exynos_coherent_bus_dma_tag = { + ._ranges = exynos_coherent_dma_ranges, + ._nranges = __arraycount(exynos_coherent_dma_ranges), + _BUS_DMAMAP_FUNCS, + _BUS_DMAMEM_FUNCS, + _BUS_DMATAG_FUNCS, +}; + +void +exynos_dma_bootstrap(psize_t memsize) +{ + bus_addr_t dram_base = EXYNOS5_SDRAM_PBASE; + + KASSERT(dram_base); + exynos_coherent_dma_ranges[0].dr_sysbase = dram_base; + exynos_coherent_dma_ranges[0].dr_busbase = dram_base; + exynos_coherent_dma_ranges[0].dr_len = memsize; +} +
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Fri Dec 11 04:03:44 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos5_reg.h exynos_gpio.c exynos_i2c.c exynos_soc.c exynos_var.h mct.c Log Message: EXYNOS Rewrite step 2 of N: New exynos_gpio.c I can't bring myself to fully nuke from orbit, so there are really two things in this checkin: 1) A major rewrite of exynos_gpio.c, based mostly on the Nvidia tegra_gpio.c file. This is missing a major function that will be added the first time a customer for it is integrated, which is meant to select pins based on aliases, rather than pin bank names. 2) A small number of changes to other files that keep the tree compiling and progressing as far as ever; except it is now 5422 specific and will not boot on the other exynos socs, which I don't have hardware to test. The choice to remove functionality is always controversial, but since we are doing a significant rewrite and I don't have either documentation or hardware *and* none of the code really works now anyway, I'm taking the stance that only tested functionality should be added, and that we'll layer the other exynos socs on this once it fully boots. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/samsung/exynos5_reg.h cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/exynos_gpio.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/samsung/exynos_i2c.c cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/samsung/exynos_soc.c cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/samsung/exynos_var.h cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/mct.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos5_reg.h diff -u src/sys/arch/arm/samsung/exynos5_reg.h:1.20 src/sys/arch/arm/samsung/exynos5_reg.h:1.21 --- src/sys/arch/arm/samsung/exynos5_reg.h:1.20 Mon Dec 29 22:58:59 2014 +++ src/sys/arch/arm/samsung/exynos5_reg.h Fri Dec 11 04:03:44 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos5_reg.h,v 1.20 2014/12/29 22:58:59 skrll Exp $ */ +/* $NetBSD: exynos5_reg.h,v 1.21 2015/12/11 04:03:44 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -51,6 +51,13 @@ * 0x4000 0x DRAM */ +/* MJF: The GPIO offset names made no sense and the values wer wrong. */ +#define EXYNOS5_GPIO_MUXA_OFFSET 0x0340 +#define EXYNOS5_GPIO_MUXB_OFFSET 0x0341 +#define EXYNOS5_GPIO_MUXC_OFFSET 0x0400 +#define EXYNOS5_GPIO_MUXD_OFFSET 0x0401 +#define EXYNOS5_GPIO_MUXE_OFFSET 0x0386 + /* CORE */ #define EXYNOS5_CORE_SIZE 0x0f00 #define EXYNOS5_SDRAM_PBASE 0x4000 @@ -103,7 +110,7 @@ #define EXYNOS5_AS_A_LEFT_BUS_OFFSET 0x00CE #define EXYNOS5_AS_A_RIGHT0_BUS_OFFSET 0x00CF #define EXYNOS5_AS_A_DISP1_BUS_OFFSET 0x00D0 -#define EXYNOS5_GPIO_C2C_OFFSET 0x00D1 +/*#define EXYNOS5_GPIO_C2C_OFFSET 0x00D1*/ #define EXYNOS5_DREXII_OFFSET 0x00DD #define EXYNOS5_AS_A_EFCON_OFFSET 0x00DE #define EXYNOS5_AP_C2C_OFFSET 0x00E0 @@ -117,7 +124,7 @@ #define EXYNOS5_MFC_OFFSET 0x0100 #define EXYNOS5_SYSMMU_MFC0_R 0x0120 #define EXYNOS5_SYSMMU_MFC1_L 0x0121 -#define EXYNOS5_GPIO_LEFT_OFFSET 0x0140 +/*#define EXYNOS5_GPIO_LEFT_OFFSET 0x0401*/ #define EXYNOS5_AS_A_MFC_OFFSET 0x0168 #define EXYNOS5_AS_A_GENX_OFFSET 0x016A #define EXYNOS5_3D ENGINE_OFFSET 0x0180 @@ -236,7 +243,7 @@ #define EXYNOS5_SYSMMU_FIMC_DIS0 0x032D #define EXYNOS5_SYSMMU_FIMC_DIS1 0x032E #define EXYNOS5_SYSMMU_FIMC_3DNR_OFFSET 0x032F -#define EXYNOS5_GPIO_RIGHT_OFFSET 0x0340 +/*#define EXYNOS5_GPIO_RIGHT_OFFSET 0x0400*/ #define EXYNOS5_AS_A_MFC0_OFFSET 0x0362 #define EXYNOS5_AS_A_ISP0_OFFSET 0x0364 #define EXYNOS5_AS_A_ISP1_OFFSET 0x0365 Index: src/sys/arch/arm/samsung/exynos_gpio.c diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.12 src/sys/arch/arm/samsung/exynos_gpio.c:1.13 --- src/sys/arch/arm/samsung/exynos_gpio.c:1.12 Mon Dec 29 22:34:08 2014 +++ src/sys/arch/arm/samsung/exynos_gpio.c Fri Dec 11 04:03:44 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_gpio.c,v 1.12 2014/12/29 22:34:08 skrll Exp $ */ +/* $NetBSD: exynos_gpio.c,v 1.13 2015/12/11 04:03:44 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.12 2014/12/29 22:34:08 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.13 2015/12/11 04:03:44 marty Exp $"); #include #include @@ -42,21 +42,14 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_gpio. #include #include #include +#include + +#include #include #include #include -#include -#include - -static int exynos_gpio_match(device_t, cfdata_t, void *); -static void exynos_gpio_attach(device_t, device_t, void *); - -static int exynos_gpio_pin_read(void *, int);
CVS commit: src/sys/arch/evbarm/exynos
Module Name:src Committed By: marty Date: Sun Dec 6 00:33:44 UTC 2015 Added Files: src/sys/arch/evbarm/exynos: exynos_machdep.c exynos_start.S platform.h Log Message: try 2 To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/exynos/exynos_machdep.c \ src/sys/arch/evbarm/exynos/exynos_start.S \ src/sys/arch/evbarm/exynos/platform.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/evbarm/exynos/exynos_machdep.c diff -u /dev/null src/sys/arch/evbarm/exynos/exynos_machdep.c:1.1 --- /dev/null Sun Dec 6 00:33:44 2015 +++ src/sys/arch/evbarm/exynos/exynos_machdep.c Sun Dec 6 00:33:44 2015 @@ -0,0 +1,484 @@ +/* $NetBSD: exynos_machdep.c,v 1.1 2015/12/06 00:33:44 marty Exp $ */ + +/* + * Copyright (c) 2014 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Reinoud Zandijk. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: exynos_machdep.c,v 1.1 2015/12/06 00:33:44 marty Exp $"); + +#include "opt_evbarm_boardtype.h" +#include "opt_exynos.h" +#include "opt_machdep.h" +#include "opt_ddb.h" +#include "opt_kgdb.h" +#include "opt_ipkdb.h" +#include "opt_md.h" +#include "opt_sscom.h" +#include "opt_arm_debug.h" + +#include "ukbd.h" +#include "arml2cc.h" // RPZ why is it not called opt_l2cc.h? + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include +#ifdef KGDB +#include +#endif + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +/* serial console stuff */ +#include "sscom.h" +#include "opt_sscom.h" + +#include +#include + +extern const int num_exynos_uarts_entries; +extern const struct sscom_uart_info exynos_uarts[]; + +#ifndef CONSPEED +#define CONSPEED 115200 +#endif /* CONSPEED */ +#ifndef CONMODE +#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB | HUPCL)) | CS8) /* 8N1 */ +#endif /* CONMODE */ + +static const int conspeed = CONSPEED; +static const int conmode = CONMODE; + +/* + * uboot passes 4 arguments to us. + * + * arg0 arg1 arg2 arg3 : the `bootargs' environment variable from the uboot + * context (in PA!) + * + * Note that the storage has to be in .data and not in .bss. On kernel start + * the .bss is cleared and this information would get lost. + */ +uintptr_t uboot_args[4] = { 0 }; + +/* + * argument and boot configure storage + */ +BootConfig bootconfig;/* for pmap's sake */ +char bootargs[MAX_BOOT_STRING] = ""; /* copied string from uboot */ +char *boot_args = NULL;/* MI bootargs */ +char *boot_file = NULL;/* MI bootfile */ +uint8_t uboot_enaddr[ETHER_ADDR_LEN] = {}; + + +/* + * kernel start and end from the linker + */ +extern char KERNEL_BASE_phys[]; /* physical start of kernel */ +extern char _end[]; /* physical end of kernel */ +#define KERNEL_BASE_PHYS ((paddr_t)KERNEL_BASE_phys) + +#define EXYNOS_IOPHYSTOVIRT(a) \ +((vaddr_t)(((a) - EXYNOS_CORE_PBASE) + EXYNOS_CORE_VBASE)) + +static void exynos_reset(void); +static void exynos_powerdown(void); +/* XXX we have no framebuffer implementation yet so com is console XXX */ +int use_fb_console = false; + + +/* prototypes */ +void consinit(void); +#ifdef KGDB +static void kgdb_port_init(void); +#endif +static void exynos_extract_mac_adress(void); +void exynos_device_register(device_t
CVS commit: src/sys/arch/evbarm
Module Name:src Committed By: marty Date: Sat Nov 28 20:51:36 UTC 2015 Modified Files: src/sys/arch/evbarm/conf: mk.odroid src/sys/arch/evbarm/odroid: odroid_start.S Log Message: Exit hypervisor mode before entering supervisor The Odroid XU4 is booted in hypervisor mode, probably because it is trust zone enabled. Before we can put it in supervisor we must explicitly remove it from hypervisor. This change is from Nick, who figured it out and adapted code from FreeBSD to make the necessary change. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/mk.odroid cvs rdiff -u -r1.17 -r1.18 src/sys/arch/evbarm/odroid/odroid_start.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/conf/mk.odroid diff -u src/sys/arch/evbarm/conf/mk.odroid:1.1 src/sys/arch/evbarm/conf/mk.odroid:1.2 --- src/sys/arch/evbarm/conf/mk.odroid:1.1 Sun Apr 13 02:26:26 2014 +++ src/sys/arch/evbarm/conf/mk.odroid Sat Nov 28 20:51:36 2015 @@ -1,4 +1,4 @@ -# $NetBSD: mk.odroid,v 1.1 2014/04/13 02:26:26 matt Exp $ +# $NetBSD: mk.odroid,v 1.2 2015/11/28 20:51:36 marty Exp $ .if !empty(MACHINE_ARCH:M*eb) EXTRA_LINKFLAGS+= --be8 @@ -6,6 +6,7 @@ EXTRA_LINKFLAGS+= --be8 SYSTEM_FIRST_OBJ= odroid_start.o SYSTEM_FIRST_SFILE= ${THISARM}/odroid/odroid_start.S +AFLAGS.odroid_start.S+=-Wa,-march=armv7-a+virt GENASSYM_EXTRAS+= ${THISARM}/odroid/genassym.cf Index: src/sys/arch/evbarm/odroid/odroid_start.S diff -u src/sys/arch/evbarm/odroid/odroid_start.S:1.17 src/sys/arch/evbarm/odroid/odroid_start.S:1.18 --- src/sys/arch/evbarm/odroid/odroid_start.S:1.17 Fri Nov 27 09:45:03 2015 +++ src/sys/arch/evbarm/odroid/odroid_start.S Sat Nov 28 20:51:36 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: odroid_start.S,v 1.17 2015/11/27 09:45:03 skrll Exp $ */ +/* $NetBSD: odroid_start.S,v 1.18 2015/11/28 20:51:36 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -46,7 +46,7 @@ #include -RCSID("$NetBSD: odroid_start.S,v 1.17 2015/11/27 09:45:03 skrll Exp $") +RCSID("$NetBSD: odroid_start.S,v 1.18 2015/11/28 20:51:36 marty Exp $") #if defined(VERBOSE_INIT_ARM) @@ -88,9 +88,26 @@ _C_LABEL(odroid_start): setend be /* force big endian */ #endif - /* Move into supervisor mode and disable IRQs/FIQs. */ - cpsid if, #PSR_SVC32_MODE +//.arch_extension virt +/* Leave HYP mode */ +mrsr0, cpsr +andr0, r0, #(PSR_MODE) /* Mode is in the low 5 bits of CPSR */ +teqr0, #(PSR_HYP32_MODE) /* Hyp Mode? */ +bne1f +/* Ensure that IRQ, FIQ and Aborts will be disabled after eret */ +mrsr0, cpsr +bicr0, r0, #(PSR_MODE) +orrr0, r0, #(PSR_SVC32_MODE) +orrr0, r0, #(I32_bit | F32_bit) +msrspsr_cxsf, r0 +/* Exit hypervisor mode */ +adrlr, 1f +msrelr_hyp, lr +eret +1: +///* Move into supervisor mode and disable IRQs/FIQs. */ +//cpsidif, #PSR_SVC32_MODE /* * Save any arguments passed to us. If .start is not at * 0x8000 but .text is, we can't directly use the address that
CVS commit: src/sys/arch/evbarm/odroid
Module Name:src Committed By: marty Date: Thu Nov 26 21:27:31 UTC 2015 Modified Files: src/sys/arch/evbarm/odroid: odroid_machdep.c odroid_start.S platform.h Log Message: Revert my previous change -- it breaks other odroid devices To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/arch/evbarm/odroid/odroid_machdep.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/odroid/odroid_start.S cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/odroid/platform.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/odroid/odroid_machdep.c diff -u src/sys/arch/evbarm/odroid/odroid_machdep.c:1.40 src/sys/arch/evbarm/odroid/odroid_machdep.c:1.41 --- src/sys/arch/evbarm/odroid/odroid_machdep.c:1.40 Wed Nov 25 04:04:13 2015 +++ src/sys/arch/evbarm/odroid/odroid_machdep.c Thu Nov 26 21:27:31 2015 @@ -1,4 +1,8 @@ -/* $NetBSD: odroid_machdep.c,v 1.40 2015/11/25 04:04:13 marty Exp $ */ +<<< odroid_machdep.c +/* $NetBSD: odroid_machdep.c,v 1.41 2015/11/26 21:27:31 marty Exp $ */ +=== +/* $NetBSD: odroid_machdep.c,v 1.41 2015/11/26 21:27:31 marty Exp $ */ +>>> 1.7 /* * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -31,7 +35,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.40 2015/11/25 04:04:13 marty Exp $"); +<<< odroid_machdep.c +__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.41 2015/11/26 21:27:31 marty Exp $"); +=== +__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.41 2015/11/26 21:27:31 marty Exp $"); +>>> 1.7 #include "opt_evbarm_boardtype.h" #include "opt_exynos.h" @@ -128,6 +136,10 @@ extern const struct sscom_uart_info exyn #define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB | HUPCL)) | CS8) /* 8N1 */ #endif /* CONMODE */ +// __CTASSERT(EXYNOS_CORE_PBASE + EXYNOS_UART0_OFFSET <= CONADDR); +// __CTASSERT(CONADDR <= EXYNOS_CORE_PBASE + EXYNOS_UART4_OFFSET); +// __CTASSERT(CONADDR % EXYNOS_BLOCK_SIZE == 0); +//static const bus_addr_t conaddr = CONADDR; static const int conspeed = CONSPEED; static const int conmode = CONMODE; #endif /*defined(KGDB) || defined(SSCOM*CONSOLE) */ @@ -148,7 +160,7 @@ uintptr_t uboot_args[4] = { 0 }; * argument and boot configure storage */ BootConfig bootconfig;/* for pmap's sake */ -char bootargs[MAX_BOOT_STRING]; /* copied string from uboot */ +char bootargs[MAX_BOOT_STRING] = ""; /* copied string from uboot */ char *boot_args = NULL;/* MI bootargs */ char *boot_file = NULL;/* MI bootfile */ uint8_t uboot_enaddr[ETHER_ADDR_LEN] = {}; @@ -177,9 +189,6 @@ static void exynos_usb_powercycle_lan973 static void exynos_extract_mac_adress(void); void odroid_device_register(device_t self, void *aux); void odroid_device_register_post_config(device_t self, void *aux); -#ifdef MULTIPROCESSOR -extern void exynos_cpu_hatch(struct cpu_info *ci); -#endif /* @@ -237,21 +246,12 @@ static const struct pmap_devmap e5_devma #ifdef PMAP_NEED_ALLOC_POOLPAGE static struct boot_physmem bp_highgig = { - .bp_start = EXYNOS5_SDRAM_PBASE / NBPG, .bp_pages = (KERNEL_VM_BASE - KERNEL_BASE) / NBPG, - .bp_freelist = VM_FREELIST_DEFAULT, + .bp_freelist = VM_FREELIST_ISADMA, .bp_flags = 0, }; #endif -#ifdef MULTIPROCESSOR -void -exynos_cpu_hatch(struct cpu_info *ci) -{ - /* MJF: WRITE ME */ -} -#endif - /* * u_int initarm(...) * @@ -260,7 +260,6 @@ exynos_cpu_hatch(struct cpu_info *ci) * - init the physical console * - setting up page tables for the kernel */ -extern void xputc(int); u_int initarm(void *arg) @@ -270,7 +269,6 @@ initarm(void *arg) const psize_t ram_reserve = 0x20; psize_t ram_size; -#if 0 /* allocate/map our basic memory mapping */ switch (EXYNOS_PRODUCT_FAMILY(exynos_soc_id)) { #if defined(EXYNOS4) @@ -290,24 +288,12 @@ initarm(void *arg) panic("Unknown product family %llx", EXYNOS_PRODUCT_FAMILY(exynos_soc_id)); } -#else - devmap = e5_devmap; - rambase = EXYNOS5_SDRAM_PBASE; -#endif - xputc('<'); pmap_devmap_register(devmap); - xputc('>'); -#if 0 /* bootstrap soc. uart_address is determined in odroid_start */ paddr_t uart_address = armreg_tpidruro_read(); exynos_bootstrap(EXYNOS_CORE_VBASE, EXYNOS_IOPHYSTOVIRT(uart_address)); -#else - xputc('['); - exynos_bootstrap(EXYNOS_CORE_VBASE, - EXYNOS_CORE_VBASE + EXYNOS5_UART2_OFFSET); - xputc(']'); -#endif + /* set up CPU / MMU / TLB functions */ if (set_cpufuncs()) panic("cpu not recognized!"); @@ -323,6 +309,7 @@ initarm(void *arg) printf("\nuboot arg = %#"PRIxPTR", %#"PRIxPTR", %#"PRIxPTR", %#"PRIxPTR"\n", uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]); printf("Exynos SoC ID %08x\n", exynos_soc_id); + printf("initarm: cbar=%#x\n", armreg_cbar_read()); #endif @@ -437,19 +424,21 @@ consinit(void) consinit_called = true; #if NSSCOM > 0 - bus_space_tag_t bst = _bs_tag; bus_addr_t iobase =
CVS commit: src/sys/arch/evbarm/odroid
Module Name:src Committed By: marty Date: Thu Nov 26 22:22:44 UTC 2015 Modified Files: src/sys/arch/evbarm/odroid: odroid_start.S Log Message: remove *all* of my changes to odroid_start.S To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/odroid/odroid_start.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/odroid/odroid_start.S diff -u src/sys/arch/evbarm/odroid/odroid_start.S:1.9 src/sys/arch/evbarm/odroid/odroid_start.S:1.10 --- src/sys/arch/evbarm/odroid/odroid_start.S:1.9 Thu Nov 26 21:27:31 2015 +++ src/sys/arch/evbarm/odroid/odroid_start.S Thu Nov 26 22:22:44 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: odroid_start.S,v 1.9 2015/11/26 21:27:31 marty Exp $ */ +/* $NetBSD: odroid_start.S,v 1.10 2015/11/26 22:22:44 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -46,16 +46,13 @@ #include -RCSID("$NetBSD: odroid_start.S,v 1.9 2015/11/26 21:27:31 marty Exp $") +RCSID("$NetBSD: odroid_start.S,v 1.10 2015/11/26 22:22:44 marty Exp $") #if defined(VERBOSE_INIT_ARM) + #define XPUTC(n) mov r0, n; bl xputc -#if KERNEL_BASE_VOFFSET == 0 -#define XPUTC2(n) mov r0, n; bl xputc -#else #define XPUTC2(n) mov r0, n; blx r11 -#endif #ifdef __ARMEB__ #define COM_BSWAP #endif @@ -65,7 +62,8 @@ RCSID("$NetBSD: odroid_start.S,v 1.9 201 #endif #define INIT_MEMSIZE 128 -#define TEMP_L1_TABLE (KERNEL_BASE - KERNEL_BASE_VOFFSET + INIT_MEMSIZE * L1_S_SIZE - L1_TABLE_SIZE) + +#define TEMP_L1_TABLE (KERNEL_BASE - KERNEL_BASE_VOFFSET + INIT_MEMSIZE * 0x10 - L1_TABLE_SIZE) #define MD_CPU_HATCH _C_LABEL(exynos_cpu_hatch) @@ -74,12 +72,8 @@ RCSID("$NetBSD: odroid_start.S,v 1.9 201 * At this point, this code has been loaded into SDRAM * and the MMU is off */ -#ifdef KERNEL_BASES_EQUAL - .text -#else .section .start,"ax",%progbits -#endif - + .global _C_LABEL(odroid_start) _C_LABEL(odroid_start): #ifdef __ARMEB__ @@ -97,16 +91,75 @@ _C_LABEL(odroid_start): */ movw r4, #:lower16:uboot_args movt r4, #:upper16:uboot_args -#if KERNEL_BASE_VOFFSET != 0 sub r4, r4, #KERNEL_BASE_VOFFSET -#endif stmia r4, {r0-r3} // Save the arguments /* + * Rescue passed "bootargs" env variable. This is not trivial + * since we can be booted using either `go' or trough `bootm'. + * + * 'go' passes R0 = argc, R1 = argv + * 'bootm' passes R0 = uboot_bootinfo, R3 = bootargs + */ + + movw r4, #:lower16:bootargs + movt r4, #:upper16:bootargs + sub r4, r4, #KERNEL_BASE_VOFFSET + + cmp r0, #0 + beq 1f + cmp r0, #MAX_BOOT_STRING + bge 1f + + /* `go' method */ + cmp r0, #1 // extra argument? + beq 3f + ldr r5, [r1, #4]// load argv[1] +2: + ldrb r0, [r5], #1 + strb r0, [r4], #1 + teq r0, #0 + bne 2b + + b 3f +1: + /* `bootm' method */ + mov r6, r0 // save binfo pointer + + cmp r3, #0 + beq 1f +2: + ldrb r0, [r3], #1 + strb r0, [r4], #1 + teq r0, #0 + bne 2b + +1: + cmp r6, #0 // binfo passed? + beq 3f + + add r6, r6, #0x250// to eth addr + + movw r4, #:lower16:uboot_enaddr + movt r4, #:upper16:uboot_enaddr + mov r2, #6 +2: + ldrb r0, [r6], #1 + strb r0, [r4], #1 + subs r2, r2, #1 + bne 2b + +3: + + /* * For easy and early SoC / PoP dependency, retrieve the IDs */ +#if 1 + mov r6, #EXYNOS_CORE_PBASE +#else movw r6, #:lower16:EXYNOS_CORE_PBASE movt r6, #:upper16:EXYNOS_CORE_PBASE +#endif ldr r0, [r6, #EXYNOS_PROD_ID_OFFSET] // load soc_id @@ -152,53 +205,49 @@ _C_LABEL(odroid_start): */ bl cortex_init - XPUTC(#'C') + XPUTC(#67) /* * Set up a preliminary mapping in the MMU to allow us to run * at KERNEL_BASE with caches on. */ + adr r1, .Lmmu_init_table movw r0, #:lower16:TEMP_L1_TABLE movt r0, #:upper16:TEMP_L1_TABLE - movw r1, #:lower16:.Lmmu_init_table - movt r1, #:upper16:.Lmmu_init_table bl arm_boot_l1pt_init - XPUTC(#'D') + XPUTC(#68) /* * Turn on the MMU, Caches, etc. */ - movw r0, #:lower16:TEMP_L1_TABLE - movt r0, #:upper16:TEMP_L1_TABLE -#if KERNEL_BASE_VOFFSET == 0 - bl arm_cpuinit -#else -#if defined(VERBOSE_INIT_ARM) - adr r11, xputc @ for XPUTC2 +#ifdef VERBOSE_INIT_ARM + adr r11, xputc #endif movw lr, #:lower16:1f movt lr, #:upper16:1f + movw r0, #:lower16:TEMP_L1_TABLE + movt r0, #:upper16:TEMP_L1_TABLE b arm_cpuinit - .pushsection .text,"ax",%progbits + + .pushsection .text, "ax", %progbits + .align 0 1: -#endif - XPUTC2(#'Z') + XPUTC2(#90) #if defined(MULTIPROCESSOR) #endif /* MULTIPROCESSOR */ - XPUTC2(#13) /* CR */ - XPUTC2(#10) /* LF */ + XPUTC2(#13) + XPUTC2(#10) /* * Jump to start in locore.S, which in turn will call initarm and main. */ b start -#ifndef KERNEL_BASES_EQUAL .popsection// back to .start -#endif + /* NOTREACHED */ .align 0 @@ -231,11 +280,9 @@ _C_LABEL(exynos_uarts): #if defined(VERBOSE_INIT_ARM) .align 0 .global xputc - .global _xputc // for C .type xputc,%function
CVS commit: src/sys/arch/evbarm/odroid
Module Name:src Committed By: marty Date: Thu Nov 26 21:42:19 UTC 2015 Modified Files: src/sys/arch/evbarm/odroid: odroid_machdep.c Log Message: repair conflicts from previous commit stupid marty checked in version with conflicts. bad marty no donut. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/arch/evbarm/odroid/odroid_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/odroid/odroid_machdep.c diff -u src/sys/arch/evbarm/odroid/odroid_machdep.c:1.41 src/sys/arch/evbarm/odroid/odroid_machdep.c:1.42 --- src/sys/arch/evbarm/odroid/odroid_machdep.c:1.41 Thu Nov 26 21:27:31 2015 +++ src/sys/arch/evbarm/odroid/odroid_machdep.c Thu Nov 26 21:42:18 2015 @@ -1,8 +1,4 @@ -<<< odroid_machdep.c -/* $NetBSD: odroid_machdep.c,v 1.41 2015/11/26 21:27:31 marty Exp $ */ -=== -/* $NetBSD: odroid_machdep.c,v 1.41 2015/11/26 21:27:31 marty Exp $ */ ->>> 1.7 +/* $NetBSD: odroid_machdep.c,v 1.42 2015/11/26 21:42:18 marty Exp $ */ /* * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -35,11 +31,7 @@ */ #include -<<< odroid_machdep.c -__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.41 2015/11/26 21:27:31 marty Exp $"); -=== -__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.41 2015/11/26 21:27:31 marty Exp $"); ->>> 1.7 +__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.42 2015/11/26 21:42:18 marty Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_exynos.h" @@ -424,8 +416,8 @@ consinit(void) consinit_called = true; #if NSSCOM > 0 + bus_space_tag_t bst = _bs_tag; bus_addr_t iobase = armreg_tpidruro_read(); -<<< odroid_machdep.c bus_space_handle_t bsh = EXYNOS_IOPHYSTOVIRT(iobase); u_int i; /* @@ -436,9 +428,6 @@ consinit(void) + bus_space_read_4(bst, bsh, SSCOM_UFRACVAL)); freq = (freq + conspeed / 2) / 1000; freq *= 1000; -=== - size_t i; ->>> 1.7 /* go trough all entries */ for (i = 0; i < num_exynos_uarts_entries; i++) { @@ -446,20 +435,15 @@ consinit(void) if (exynos_uarts[i].iobase + EXYNOS_CORE_PBASE == iobase) break; } -<<< odroid_machdep.c KASSERT(i < num_exynos_uarts_entries); printf("%s: attaching console @ %#"PRIxPTR" (%u HZ, %u bps)\n", __func__, iobase, freq, conspeed); if (sscom_cnattach(bst, exynos_core_bsh, _uarts[i], conspeed, freq, conmode)) -=== - KASSERT(i < __arraycount(exynos_uarts)); - - if (sscom_cnattach(_bs_tag, exynos_core_bsh, - _uarts[i], conspeed, EXYNOS_UART_FREQ, - conmode)) ->>> 1.7 panic("Serial console can not be initialized"); +#ifdef VERBOSE_INIT_ARM + printf("Console initialized\n"); +#endif #else #error only serial console is supported #if NUKBD > 0
CVS commit: src/sys/arch/arm/cortex
Module Name:src Committed By: marty Date: Wed Nov 25 04:03:34 UTC 2015 Added Files: src/sys/arch/arm/cortex: cortex_init.S Log Message: something temporary that will go away once odroid xu4 works To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/cortex/cortex_init.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/arm/cortex/cortex_init.S diff -u /dev/null src/sys/arch/arm/cortex/cortex_init.S:1.1 --- /dev/null Wed Nov 25 04:03:34 2015 +++ src/sys/arch/arm/cortex/cortex_init.S Wed Nov 25 04:03:34 2015 @@ -0,0 +1,780 @@ +/* $NetBSD: cortex_init.S,v 1.1 2015/11/25 04:03:34 marty Exp $ */ +/*- + * Copyright (c) 2012 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Matt Thomas of 3am Software Foundry. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "opt_cpuoptions.h" +#include "opt_cputypes.h" +#include "opt_multiprocessor.h" + +#include +#include +#include +#include "assym.h" + +#define A15 0xf +//#define MPDEBUG + +// Marco to call routines in .text +#if defined(KERNEL_BASES_EQUAL) +#define CALL(f) bl _C_LABEL(f) +#else +#define CALL(f) \ + movw ip, #:lower16:_C_LABEL(f); \ + movt ip, #:upper16:_C_LABEL(f); \ + sub ip, ip, #KERNEL_BASE_VOFFSET; \ + blx ip +#endif + + +// We'll modify va and pa at run time so we can use relocatable addresses. +#define MMU_INIT(va,pa,n_sec,attr) \ + .word ((va) & 0x)|(n_sec) ; \ + .word ((pa) & 0x)|(attr) ; \ + +// Set up a preliminary mapping in the MMU to allow us to run at KERNEL_BASE +// with caches on. If we are MULTIPROCESSOR, save the TTB address. +// +arm_boot_l1pt_init: +#if defined(MULTIPROCESSOR) + movw r3, #:lower16:cortex_mmuinfo + movt r3, #:upper16:cortex_mmuinfo +#if !defined(KERNEL_BASES_EQUAL) + sub r3, r3, #KERNEL_BASE_VOFFSET +#endif + str r0, [r3] + + // Make sure the info makes into memory + mcr p15, 0, r3, c7, c10, 1 // writeback the cache line + dsb +#endif + + mov ip, r1 // save mmu table addr + // Build page table from scratch + mov r1, r0 // Start address to clear memory. + // Zero the entire table so all virtual addresses are invalid. + add r2, r1, #L1_TABLE_SIZE // Ending address + mov r4, #0 + mov r5, #0 + mov r6, #0 + mov r7, #0 +1: stmia r1!, {r4-r7} // 16 bytes at a time + cmp r1, r2 + blt 1b + + // Now create our entries per the mmu_init_table. + l1table .req r0 + va .req r1 + pa .req r2 + n_sec .req r3 + attr .req r4 + itable .req r5 + + mov attr, #0 + mrc p15, 0, r3, c0, c0, 5 // MPIDR read + cmp r3, #0 // not zero? + movne attr, #L1_S_V6_S //yes, shareable attribute + mov itable, ip // reclaim table address + b 3f + +2: str pa, [l1table, va, lsl #2] + add va, va, #1 + add pa, pa, #(L1_S_SIZE) + subs n_sec, n_sec, #1 + bhi 2b + +3: ldmia itable!, {va, pa} + // Convert va to l1 offset: va = 4 * (va >> L1_S_SHIFT) + ubfx n_sec, va, #0, #L1_S_SHIFT + lsr va, va, #L1_S_SHIFT + + // Do we need add sharing for this? + tst pa, #(L1_S_C|L1_S_B) // is this entry cacheable? + orrne pa, pa, attr // add sharing + +4: cmp n_sec, #0 + bne 2b + bx lr // return + + .unreq va + .unreq pa + .unreq n_sec + .unreq attr + .unreq itable + .unreq l1table + +// +// Coprocessor register initialization values +// +#if defined(CPU_CORTEXA8) +#undef CPU_CONTROL_SWP_ENABLE // not present on A8 +#define CPU_CONTROL_SWP_ENABLE 0 +#endif +#ifdef __ARMEL__ +#define CPU_CONTROL_EX_BEND_SET 0 +#else +#define CPU_CONTROL_EX_BEND_SET CPU_CONTROL_EX_BEND +#endif +#ifdef ARM32_DISABLE_ALIGNMENT_FAULTS +#define
CVS commit: src/sys/arch/evbarm/odroid
Module Name:src Committed By: marty Date: Wed Nov 25 04:04:13 UTC 2015 Modified Files: src/sys/arch/evbarm/odroid: odroid_machdep.c odroid_start.S platform.h Log Message: snapshot: Does NOT boot To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/arch/evbarm/odroid/odroid_machdep.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/odroid/odroid_start.S cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/odroid/platform.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/odroid/odroid_machdep.c diff -u src/sys/arch/evbarm/odroid/odroid_machdep.c:1.39 src/sys/arch/evbarm/odroid/odroid_machdep.c:1.40 --- src/sys/arch/evbarm/odroid/odroid_machdep.c:1.39 Tue Sep 30 14:24:26 2014 +++ src/sys/arch/evbarm/odroid/odroid_machdep.c Wed Nov 25 04:04:13 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: odroid_machdep.c,v 1.39 2014/09/30 14:24:26 reinoud Exp $ */ +/* $NetBSD: odroid_machdep.c,v 1.40 2015/11/25 04:04:13 marty Exp $ */ /* * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.39 2014/09/30 14:24:26 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.40 2015/11/25 04:04:13 marty Exp $"); #include "opt_evbarm_boardtype.h" #include "opt_exynos.h" @@ -128,10 +128,6 @@ extern const struct sscom_uart_info exyn #define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB | HUPCL)) | CS8) /* 8N1 */ #endif /* CONMODE */ -// __CTASSERT(EXYNOS_CORE_PBASE + EXYNOS_UART0_OFFSET <= CONADDR); -// __CTASSERT(CONADDR <= EXYNOS_CORE_PBASE + EXYNOS_UART4_OFFSET); -// __CTASSERT(CONADDR % EXYNOS_BLOCK_SIZE == 0); -//static const bus_addr_t conaddr = CONADDR; static const int conspeed = CONSPEED; static const int conmode = CONMODE; #endif /*defined(KGDB) || defined(SSCOM*CONSOLE) */ @@ -152,7 +148,7 @@ uintptr_t uboot_args[4] = { 0 }; * argument and boot configure storage */ BootConfig bootconfig;/* for pmap's sake */ -char bootargs[MAX_BOOT_STRING] = ""; /* copied string from uboot */ +char bootargs[MAX_BOOT_STRING]; /* copied string from uboot */ char *boot_args = NULL;/* MI bootargs */ char *boot_file = NULL;/* MI bootfile */ uint8_t uboot_enaddr[ETHER_ADDR_LEN] = {}; @@ -181,6 +177,9 @@ static void exynos_usb_powercycle_lan973 static void exynos_extract_mac_adress(void); void odroid_device_register(device_t self, void *aux); void odroid_device_register_post_config(device_t self, void *aux); +#ifdef MULTIPROCESSOR +extern void exynos_cpu_hatch(struct cpu_info *ci); +#endif /* @@ -238,12 +237,21 @@ static const struct pmap_devmap e5_devma #ifdef PMAP_NEED_ALLOC_POOLPAGE static struct boot_physmem bp_highgig = { + .bp_start = EXYNOS5_SDRAM_PBASE / NBPG, .bp_pages = (KERNEL_VM_BASE - KERNEL_BASE) / NBPG, - .bp_freelist = VM_FREELIST_ISADMA, + .bp_freelist = VM_FREELIST_DEFAULT, .bp_flags = 0, }; #endif +#ifdef MULTIPROCESSOR +void +exynos_cpu_hatch(struct cpu_info *ci) +{ + /* MJF: WRITE ME */ +} +#endif + /* * u_int initarm(...) * @@ -252,6 +260,7 @@ static struct boot_physmem bp_highgig = * - init the physical console * - setting up page tables for the kernel */ +extern void xputc(int); u_int initarm(void *arg) @@ -261,6 +270,7 @@ initarm(void *arg) const psize_t ram_reserve = 0x20; psize_t ram_size; +#if 0 /* allocate/map our basic memory mapping */ switch (EXYNOS_PRODUCT_FAMILY(exynos_soc_id)) { #if defined(EXYNOS4) @@ -280,12 +290,24 @@ initarm(void *arg) panic("Unknown product family %llx", EXYNOS_PRODUCT_FAMILY(exynos_soc_id)); } +#else + devmap = e5_devmap; + rambase = EXYNOS5_SDRAM_PBASE; +#endif + xputc('<'); pmap_devmap_register(devmap); + xputc('>'); +#if 0 /* bootstrap soc. uart_address is determined in odroid_start */ paddr_t uart_address = armreg_tpidruro_read(); exynos_bootstrap(EXYNOS_CORE_VBASE, EXYNOS_IOPHYSTOVIRT(uart_address)); - +#else + xputc('['); + exynos_bootstrap(EXYNOS_CORE_VBASE, + EXYNOS_CORE_VBASE + EXYNOS5_UART2_OFFSET); + xputc(']'); +#endif /* set up CPU / MMU / TLB functions */ if (set_cpufuncs()) panic("cpu not recognized!"); @@ -301,7 +323,6 @@ initarm(void *arg) printf("\nuboot arg = %#"PRIxPTR", %#"PRIxPTR", %#"PRIxPTR", %#"PRIxPTR"\n", uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]); printf("Exynos SoC ID %08x\n", exynos_soc_id); - printf("initarm: cbar=%#x\n", armreg_cbar_read()); #endif @@ -418,14 +439,15 @@ consinit(void) #if NSSCOM > 0 bus_space_tag_t bst = _bs_tag; bus_addr_t iobase = armreg_tpidruro_read(); - bus_space_handle_t bsh = EXYNOS_IOPHYSTOVIRT(iobase); u_int i; + /* * No need to guess at the UART frequency since we can calculate it. */ - uint32_t freq = conspeed - * (16 * (bus_space_read_4(bst, bsh, SSCOM_UBRDIV) + 1) - + bus_space_read_4(bst, bsh, SSCOM_UFRACVAL)); + bus_space_handle_t
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Thu Nov 19 05:44:41 UTC 2015 Modified Files: src/sys/arch/arm/samsung: exynos_soc.c Log Message: add 5422 gic handling to attach code To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/samsung/exynos_soc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/samsung/exynos_soc.c diff -u src/sys/arch/arm/samsung/exynos_soc.c:1.27 src/sys/arch/arm/samsung/exynos_soc.c:1.28 --- src/sys/arch/arm/samsung/exynos_soc.c:1.27 Mon Dec 29 22:58:59 2014 +++ src/sys/arch/arm/samsung/exynos_soc.c Thu Nov 19 05:44:41 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_soc.c,v 1.27 2014/12/29 22:58:59 skrll Exp $ */ +/* $NetBSD: exynos_soc.c,v 1.28 2015/11/19 05:44:41 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #define _ARM32_BUS_DMA_PRIVATE #include -__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.27 2014/12/29 22:58:59 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_soc.c,v 1.28 2015/11/19 05:44:41 marty Exp $"); #include #include @@ -634,6 +634,14 @@ exynos_device_register(device_t self, vo mpcaa->mpcaa_off2 = EXYNOS5_GIC_IOP_CONTROLLER_OFFSET; #endif break; + case 0xe5422: { + struct mpcore_attach_args * const mpcaa = aux; + + mpcaa->mpcaa_memh = EXYNOS_CORE_VBASE; + mpcaa->mpcaa_off1 = EXYNOS5_GIC_IOP_DISTRIBUTOR_OFFSET; + mpcaa->mpcaa_off2 = EXYNOS5_GIC_IOP_CONTROLLER_OFFSET; + break; + } #endif #ifdef EXYNOS4 case 0xe4410:
CVS commit: src/sys/arch/evbarm/conf
Module Name:src Committed By: marty Date: Sat Nov 14 07:15:58 UTC 2015 Added Files: src/sys/arch/evbarm/conf: ODROID-XU4 ODROID-XU4_INSTALL Log Message: SNAPSHOT: DOES NOT BOOT First crack at configuration files for the Hardkernel ODROID XU4. This kernel hangs attempting to write to the console early in boot. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/ODROID-XU4 \ src/sys/arch/evbarm/conf/ODROID-XU4_INSTALL Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/evbarm/conf/ODROID-XU4 diff -u /dev/null src/sys/arch/evbarm/conf/ODROID-XU4:1.1 --- /dev/null Sat Nov 14 07:15:58 2015 +++ src/sys/arch/evbarm/conf/ODROID-XU4 Sat Nov 14 07:15:58 2015 @@ -0,0 +1,261 @@ +# +# $NetBSD: ODROID-XU4,v 1.1 2015/11/14 07:15:58 marty Exp $ +# +# ODROID-XU -- ODROID-XU4 Exynos5422 based kernel +# + +include "arch/evbarm/conf/std.odroid" + +no makeoptions CPUFLAGS +makeoptions CPUFLAGS="-mcpu=cortex-a7 -mfpu=neon" +no makeoptions BOARDTYPE +makeoptions BOARDTYPE="hardkernel_odroid_xu4" +no makeoptions KERNEL_BASE_PHYS +no makeoptions KERNEL_BASE_VIRT +makeoptions KERNEL_BASE_PHYS="0x8000" +makeoptions KERNEL_BASE_VIRT="0x8000" +options PMAP_NEED_ALLOC_POOLPAGE +options MEMSIZE=2048 + +# estimated number of users + +maxusers 8 + +# Standard system options + +options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT +#options NTP # NTP phase/frequency locked loop + +# CPU options +options CPU_CORTEX +options CPU_CORTEXA7 +options CPU_CORTEXA15 +options EXYNOS5422 +#options MULTIPROCESSOR + +options PMAPCOUNTERS +options BUSDMA_COUNTERS +options EXYNOS_CONSOLE_EARLY +#options UVMHIST +options USBHIST +options USBHIST_SIZE=10 +#options UVMHIST_PRINT,KERNHIST_DELAY=0 +options __HAVE_MM_MD_DIRECT_MAPPED_PHYS +#options PMAP_NEED_ALLOC_POOLPAGE + +# Specify the memory size in megabytes (optional). +#options MEMSIZE=2048 + +# File systems +file-system FFS # UFS +#file-system LFS # log-structured file system +file-system MFS # memory file system +file-system NFS # Network file system +#file-system ADOSFS # AmigaDOS-compatible file system +#file-system EXT2FS # second extended file system (linux) +#file-system CD9660 # ISO 9660 + Rock Ridge file system +file-system MSDOSFS # MS-DOS file system +#file-system FDESC # /dev/fd +file-system KERNFS # /kern +#file-system NULLFS # loopback file system +file-system PROCFS # /proc +#file-system PUFFS # Userspace file systems (e.g. ntfs-3g & sshfs) +#file-system UMAPFS # NULLFS + uid and gid remapping +#file-system UNION # union file system +file-system TMPFS # memory file system +file-system PTYFS # /dev/pts/N support + +# File system options +#options QUOTA # legacy UFS quotas +#options QUOTA2 # new, in-filesystem UFS quotas +#options FFS_EI # FFS Endian Independent support +#options NFSSERVER +options WAPBL # File system journaling support +#options FFS_NO_SNAPSHOT # No FFS snapshot support + +# Networking options + +#options GATEWAY # packet forwarding +options INET # IP + ICMP + TCP + UDP +options INET6 # IPV6 +#options IPSEC # IP security +#options IPSEC_DEBUG # debug for IP security +#options MROUTING # IP multicast routing +#options PIM # Protocol Independent Multicast +#options NETATALK # AppleTalk networking +#options PPP_BSDCOMP # BSD-Compress compression support for PPP +#options PPP_DEFLATE # Deflate compression support for PPP +#options PPP_FILTER # Active filter support for PPP (requires bpf) +#options TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG + +options NFS_BOOT_BOOTP +options NFS_BOOT_DHCP +#options NFS_BOOT_BOOTSTATIC +#options NFS_BOOTSTATIC_MYIP="\"192.168.1.4\"" +#options NFS_BOOTSTATIC_GWIP="\"192.168.1.1\"" +#options NFS_BOOTSTATIC_MASK="\"255.255.255.0\"" +#options NFS_BOOTSTATIC_SERVADDR="\"192.168.1.1\"" +#options NFS_BOOTSTATIC_SERVER="\"192.168.1.1:/nfs/sdp2430\"" + +options NFS_BOOT_RWSIZE=1024 + +# Compatibility options + +options COMPAT_NETBSD32 # allow running arm (e.g. non-earm) binaries +#options COMPAT_43 # 4.3BSD compatibility. +#options COMPAT_09 # NetBSD 0.9, +#options COMPAT_10 # NetBSD 1.0, +#options COMPAT_11 # NetBSD 1.1, +#options COMPAT_12 # NetBSD 1.2, +#options COMPAT_13 # NetBSD 1.3, +#options COMPAT_14 # NetBSD 1.4, +#options COMPAT_15 # NetBSD 1.5, +#options COMPAT_16 # NetBSD 1.6, +#options COMPAT_20 # NetBSD 2.0, +#options COMPAT_30 # NetBSD 3.0, +#options COMPAT_40 # NetBSD 4.0, +#options COMPAT_50 # NetBSD 5.0, +options COMPAT_60 # NetBSD 6.0, and +options COMPAT_70 # NetBSD 7.0 binary compatibility. +#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended. +#options COMPAT_BSDPTY # /dev/[pt]ty?? ptys. + +# Shared memory options + +options SYSVMSG # System V-like message queues +options SYSVSEM # System V-like semaphores +options
CVS commit: src/sys/arch/evbarm/odroid
Module Name:src Committed By: marty Date: Tue Nov 10 23:47:08 UTC 2015 Modified Files: src/sys/arch/evbarm/odroid: odroid_start.S Log Message: small cleanup of odroid_start.S removed attempt to 'rescue bootargs' that was causing a hang and isn't needed anyway. changed calls to XPUTC to use text constants rather than ascii decimal equivalents. adopted some of the techniques used in awin_start.s for reducing code and improving performance. polluted the namespace with _XPUTC so that xputc can be used from C code before early console is enabled. (Due to tracking a bug in early console initialization.) replaced a hardwired constant with the proper mannifest in the definition of TEMP_L1_TABLE This still needs MP support added but it should continue to work for XU3 while starting to work for XU4 To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/odroid/odroid_start.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/odroid/odroid_start.S diff -u src/sys/arch/evbarm/odroid/odroid_start.S:1.6 src/sys/arch/evbarm/odroid/odroid_start.S:1.7 --- src/sys/arch/evbarm/odroid/odroid_start.S:1.6 Thu Oct 2 12:12:55 2014 +++ src/sys/arch/evbarm/odroid/odroid_start.S Tue Nov 10 23:47:08 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: odroid_start.S,v 1.6 2014/10/02 12:12:55 skrll Exp $ */ +/* $NetBSD: odroid_start.S,v 1.7 2015/11/10 23:47:08 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -46,13 +46,16 @@ #include -RCSID("$NetBSD: odroid_start.S,v 1.6 2014/10/02 12:12:55 skrll Exp $") +RCSID("$NetBSD: odroid_start.S,v 1.7 2015/11/10 23:47:08 marty Exp $") #if defined(VERBOSE_INIT_ARM) - #define XPUTC(n) mov r0, n; bl xputc +#if KERNEL_BASE_VOFFSET == 0 +#define XPUTC2(n) mov r0, n; bl xputc +#else #define XPUTC2(n) mov r0, n; blx r11 +#endif #ifdef __ARMEB__ #define COM_BSWAP #endif @@ -62,8 +65,7 @@ RCSID("$NetBSD: odroid_start.S,v 1.6 201 #endif #define INIT_MEMSIZE 128 - -#define TEMP_L1_TABLE (KERNEL_BASE - KERNEL_BASE_VOFFSET + INIT_MEMSIZE * 0x10 - L1_TABLE_SIZE) +#define TEMP_L1_TABLE (KERNEL_BASE - KERNEL_BASE_VOFFSET + INIT_MEMSIZE * L1_S_SIZE - L1_TABLE_SIZE) #define MD_CPU_HATCH _C_LABEL(exynos_cpu_hatch) @@ -72,8 +74,12 @@ RCSID("$NetBSD: odroid_start.S,v 1.6 201 * At this point, this code has been loaded into SDRAM * and the MMU is off */ +#ifdef KERNEL_BASES_EQUAL + .text +#else .section .start,"ax",%progbits - +#endif + .global _C_LABEL(odroid_start) _C_LABEL(odroid_start): #ifdef __ARMEB__ @@ -91,75 +97,16 @@ _C_LABEL(odroid_start): */ movw r4, #:lower16:uboot_args movt r4, #:upper16:uboot_args +#if KERNEL_BASE_VOFFSET != 0 sub r4, r4, #KERNEL_BASE_VOFFSET +#endif stmia r4, {r0-r3} // Save the arguments /* - * Rescue passed "bootargs" env variable. This is not trivial - * since we can be booted using either `go' or trough `bootm'. - * - * 'go' passes R0 = argc, R1 = argv - * 'bootm' passes R0 = uboot_bootinfo, R3 = bootargs - */ - - movw r4, #:lower16:bootargs - movt r4, #:upper16:bootargs - sub r4, r4, #KERNEL_BASE_VOFFSET - - cmp r0, #0 - beq 1f - cmp r0, #MAX_BOOT_STRING - bge 1f - - /* `go' method */ - cmp r0, #1 // extra argument? - beq 3f - ldr r5, [r1, #4]// load argv[1] -2: - ldrb r0, [r5], #1 - strb r0, [r4], #1 - teq r0, #0 - bne 2b - - b 3f -1: - /* `bootm' method */ - mov r6, r0 // save binfo pointer - - cmp r3, #0 - beq 1f -2: - ldrb r0, [r3], #1 - strb r0, [r4], #1 - teq r0, #0 - bne 2b - -1: - cmp r6, #0 // binfo passed? - beq 3f - - add r6, r6, #0x250// to eth addr - - movw r4, #:lower16:uboot_enaddr - movt r4, #:upper16:uboot_enaddr - mov r2, #6 -2: - ldrb r0, [r6], #1 - strb r0, [r4], #1 - subs r2, r2, #1 - bne 2b - -3: - - /* * For easy and early SoC / PoP dependency, retrieve the IDs */ -#if 1 - mov r6, #EXYNOS_CORE_PBASE -#else movw r6, #:lower16:EXYNOS_CORE_PBASE movt r6, #:upper16:EXYNOS_CORE_PBASE -#endif ldr r0, [r6, #EXYNOS_PROD_ID_OFFSET] // load soc_id @@ -205,49 +152,53 @@ _C_LABEL(odroid_start): */ bl cortex_init - XPUTC(#67) + XPUTC(#'C') /* * Set up a preliminary mapping in the MMU to allow us to run * at KERNEL_BASE with caches on. */ - adr r1, .Lmmu_init_table movw r0, #:lower16:TEMP_L1_TABLE movt r0, #:upper16:TEMP_L1_TABLE + movw r1, #:lower16:.Lmmu_init_table + movt r1, #:upper16:.Lmmu_init_table bl arm_boot_l1pt_init - XPUTC(#68) + XPUTC(#'D') /* * Turn on the MMU, Caches, etc. */ -#ifdef VERBOSE_INIT_ARM - adr r11, xputc + movw r0, #:lower16:TEMP_L1_TABLE + movt r0, #:upper16:TEMP_L1_TABLE +#if KERNEL_BASE_VOFFSET == 0 + bl arm_cpuinit +#else +#if defined(VERBOSE_INIT_ARM) + adr r11, xputc @ for XPUTC2 #endif movw lr, #:lower16:1f movt lr, #:upper16:1f - movw r0, #:lower16:TEMP_L1_TABLE - movt r0, #:upper16:TEMP_L1_TABLE b arm_cpuinit - -
CVS commit: src/sys/arch/evbarm/odroid
Module Name:src Committed By: marty Date: Wed Nov 11 00:58:21 UTC 2015 Modified Files: src/sys/arch/evbarm/odroid: platform.h Log Message: Fix typo that prevented CONADDR from being defined for XU4 To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/odroid/platform.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/odroid/platform.h diff -u src/sys/arch/evbarm/odroid/platform.h:1.2 src/sys/arch/evbarm/odroid/platform.h:1.3 --- src/sys/arch/evbarm/odroid/platform.h:1.2 Sun Jun 15 20:14:41 2014 +++ src/sys/arch/evbarm/odroid/platform.h Wed Nov 11 00:58:21 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: platform.h,v 1.2 2014/06/15 20:14:41 matt Exp $ */ +/* $NetBSD: platform.h,v 1.3 2015/11/11 00:58:21 marty Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -51,7 +51,7 @@ */ #define CONADDR_VA ((CONADDR - EXYNOS_CORE_PBASE) + EXYNOS_CORE_VBASE) -#ifdef SSCOM0CONSOLE +#ifdef SSCOM2CONSOLE #define SSCON_CHANNEL 0 #define CONADDR (EXYNOS_CORE_PBASE + EXYNOS5_UART2_OFFSET) #endif
CVS commit: src/sys/arch/arm/omap
Module Name:src Committed By: marty Date: Tue Apr 14 06:33:23 UTC 2009 Modified Files: src/sys/arch/arm/omap: omap_intr.h Log Message: Work around the circular dependency between sys/device.h and omap_intr.h introduced when sys/device.h included sys/mutex.h This workaround should be removed once the circular dependency is fixed. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/omap/omap_intr.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/omap/omap_intr.h diff -u src/sys/arch/arm/omap/omap_intr.h:1.5 src/sys/arch/arm/omap/omap_intr.h:1.6 --- src/sys/arch/arm/omap/omap_intr.h:1.5 Fri Nov 21 17:13:07 2008 +++ src/sys/arch/arm/omap/omap_intr.h Tue Apr 14 06:33:23 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: omap_intr.h,v 1.5 2008/11/21 17:13:07 matt Exp $ */ +/* $NetBSD: omap_intr.h,v 1.6 2009/04/14 06:33:23 marty Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -184,7 +184,12 @@ void omap_irq_handler(void *); void *omap_intr_establish(int, int, const char *, int (*)(void *), void *); void omap_intr_disestablish(void *); -int omapintc_match(device_t, cfdata_t, void *); +/* XXX MARTY -- This is a hack to work around the circular dependency + * between sys/device.h and omap_intr.h It should be removed when + * the circular dependency is fixed and the declaration repaired. + */ +struct cfdata; +int omapintc_match(device_t, struct cfdata *, void *); void omapintc_attach(device_t, device_t, void *); #endif /* ! _LOCORE */