CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Fri Feb 9 08:50:52 UTC 2024 Modified Files: src/sys/dev/fdt: dwcmmc_fdt.c Log Message: Limit DMA to below 4GB - the supported controllers are limited this way. Thanks to jmcneill for a version of this patch. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/fdt/dwcmmc_fdt.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/dwcmmc_fdt.c diff -u src/sys/dev/fdt/dwcmmc_fdt.c:1.21 src/sys/dev/fdt/dwcmmc_fdt.c:1.22 --- src/sys/dev/fdt/dwcmmc_fdt.c:1.21 Fri Feb 9 06:28:50 2024 +++ src/sys/dev/fdt/dwcmmc_fdt.c Fri Feb 9 08:50:52 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwcmmc_fdt.c,v 1.21 2024/02/09 06:28:50 skrll Exp $ */ +/* $NetBSD: dwcmmc_fdt.c,v 1.22 2024/02/09 08:50:52 skrll Exp $ */ /*- * Copyright (c) 2015-2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.21 2024/02/09 06:28:50 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.22 2024/02/09 08:50:52 skrll Exp $"); #include #include @@ -149,7 +149,16 @@ dwcmmc_fdt_attach(device_t parent, devic sc->sc_dev = self; sc->sc_bst = faa->faa_bst; - sc->sc_dmat = faa->faa_dmat; + if (sizeof(bus_addr_t) > 4) { + error = bus_dmatag_subregion(faa->faa_dmat, 0, __MASK(32), + >sc_dmat, BUS_DMA_WAITOK); + if (error != 0) { + aprint_error(": couldn't create DMA tag: %d\n", error); + return; + } + } else { + sc->sc_dmat = faa->faa_dmat; + } error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh); if (error) { aprint_error(": couldn't map %#" PRIx64 ": %d\n",
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Fri Feb 9 08:50:52 UTC 2024 Modified Files: src/sys/dev/fdt: dwcmmc_fdt.c Log Message: Limit DMA to below 4GB - the supported controllers are limited this way. Thanks to jmcneill for a version of this patch. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/fdt/dwcmmc_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Fri Feb 9 06:28:50 UTC 2024 Modified Files: src/sys/dev/fdt: dwcmmc_fdt.c Log Message: spaces to tabs To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/fdt/dwcmmc_fdt.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/dwcmmc_fdt.c diff -u src/sys/dev/fdt/dwcmmc_fdt.c:1.20 src/sys/dev/fdt/dwcmmc_fdt.c:1.21 --- src/sys/dev/fdt/dwcmmc_fdt.c:1.20 Fri Dec 29 08:02:47 2023 +++ src/sys/dev/fdt/dwcmmc_fdt.c Fri Feb 9 06:28:50 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dwcmmc_fdt.c,v 1.20 2023/12/29 08:02:47 skrll Exp $ */ +/* $NetBSD: dwcmmc_fdt.c,v 1.21 2024/02/09 06:28:50 skrll Exp $ */ /*- * Copyright (c) 2015-2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.20 2023/12/29 08:02:47 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.21 2024/02/09 06:28:50 skrll Exp $"); #include #include @@ -236,7 +236,7 @@ static int dwcmmc_fdt_bus_clock(struct dwc_mmc_softc *sc, int rate) { struct dwcmmc_fdt_softc *esc = device_private(sc->sc_dev); -const u_int ciu_div = sc->sc_ciu_div > 0 ? sc->sc_ciu_div : 1; + const u_int ciu_div = sc->sc_ciu_div > 0 ? sc->sc_ciu_div : 1; int error; error = clk_set_rate(esc->sc_clk_ciu, 1000 * rate * ciu_div);
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Fri Feb 9 06:28:50 UTC 2024 Modified Files: src/sys/dev/fdt: dwcmmc_fdt.c Log Message: spaces to tabs To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/fdt/dwcmmc_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: kre Date: Sun Jan 21 15:10:08 UTC 2024 Modified Files: src/sys/dev/fdt: fdt_boot.c Log Message: Include for struct mbr_sector To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/fdt_boot.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_boot.c diff -u src/sys/dev/fdt/fdt_boot.c:1.5 src/sys/dev/fdt/fdt_boot.c:1.6 --- src/sys/dev/fdt/fdt_boot.c:1.5 Fri Jan 19 09:09:04 2024 +++ src/sys/dev/fdt/fdt_boot.c Sun Jan 21 15:10:07 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_boot.c,v 1.5 2024/01/19 09:09:04 skrll Exp $ */ +/* $NetBSD: fdt_boot.c,v 1.6 2024/01/21 15:10:07 kre Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -56,13 +56,14 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_boot.c,v 1.5 2024/01/19 09:09:04 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_boot.c,v 1.6 2024/01/21 15:10:07 kre Exp $"); #include "opt_efi.h" #include "opt_md.h" #include +#include #include #include #include
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: kre Date: Sun Jan 21 15:10:08 UTC 2024 Modified Files: src/sys/dev/fdt: fdt_boot.c Log Message: Include for struct mbr_sector To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/fdt_boot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: mlelstv Date: Sun Jan 14 07:53:38 UTC 2024 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: Handle multiple memory nodes by type, but still allow an untyped (non-standard) node named /memory. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/fdt/fdt_memory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: mlelstv Date: Sun Jan 14 07:53:38 UTC 2024 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: Handle multiple memory nodes by type, but still allow an untyped (non-standard) node named /memory. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/fdt/fdt_memory.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_memory.c diff -u src/sys/dev/fdt/fdt_memory.c:1.9 src/sys/dev/fdt/fdt_memory.c:1.10 --- src/sys/dev/fdt/fdt_memory.c:1.9 Fri Jan 12 18:06:18 2024 +++ src/sys/dev/fdt/fdt_memory.c Sun Jan 14 07:53:38 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_memory.c,v 1.9 2024/01/12 18:06:18 skrll Exp $ */ +/* $NetBSD: fdt_memory.c,v 1.10 2024/01/14 07:53:38 mlelstv Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "opt_fdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.9 2024/01/12 18:06:18 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.10 2024/01/14 07:53:38 mlelstv Exp $"); #include #include @@ -77,26 +77,43 @@ fdt_memory_range_free(struct fdt_memory_ void fdt_memory_get(uint64_t *pstart, uint64_t *pend) { - const int memory = OF_finddevice("/memory"); + const void *fdt_data = fdtbus_get_data(); uint64_t cur_addr, cur_size; - int index, nadd; + int index, nadd = 0, off, memory; - for (index = 0, nadd = 0; - fdtbus_get_reg64(memory, index, _addr, _size) == 0; - index++) { - if (cur_size == 0) - continue; - fdt_memory_add_range(cur_addr, cur_size); + off = fdt_node_offset_by_prop_value(fdt_data, -1, + "device_type", "memory", sizeof("memory")); - if (nadd++ == 0) { - *pstart = cur_addr; - *pend = cur_addr + cur_size; - continue; + /* + * Device Tree Specification 3.2 says that memory + * nodes are named "memory" and have device_type + * "memory", but if the device_type is missing, try + * to find the (then single) node by name. + */ + if (off == -FDT_ERR_NOTFOUND) + off = fdt_path_offset(fdt_data, "/memory"); + + while (off != -FDT_ERR_NOTFOUND) { + memory = fdtbus_offset2phandle(off); + for (index = 0; + fdtbus_get_reg64(memory, index, _addr, _size) == 0; + index++) { + if (cur_size == 0) +continue; + fdt_memory_add_range(cur_addr, cur_size); + + if (nadd++ == 0) { +*pstart = cur_addr; +*pend = cur_addr + cur_size; +continue; + } + if (cur_addr < *pstart) +*pstart = cur_addr; + if (cur_addr + cur_size > *pend) +*pend = cur_addr + cur_size; } - if (cur_addr < *pstart) - *pstart = cur_addr; - if (cur_addr + cur_size > *pend) - *pend = cur_addr + cur_size; + off = fdt_node_offset_by_prop_value(fdt_data, off, + "device_type", "memory", sizeof("memory")); } if (nadd == 0) panic("Cannot determine memory size");
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Fri Jan 12 18:06:18 UTC 2024 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: Cache the result from fdtbus_get_data() in fdt_memory_remove_reserved NFCI. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/fdt/fdt_memory.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_memory.c diff -u src/sys/dev/fdt/fdt_memory.c:1.8 src/sys/dev/fdt/fdt_memory.c:1.9 --- src/sys/dev/fdt/fdt_memory.c:1.8 Fri Nov 4 10:51:16 2022 +++ src/sys/dev/fdt/fdt_memory.c Fri Jan 12 18:06:18 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_memory.c,v 1.8 2022/11/04 10:51:16 jmcneill Exp $ */ +/* $NetBSD: fdt_memory.c,v 1.9 2024/01/12 18:06:18 skrll Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "opt_fdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.8 2022/11/04 10:51:16 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.9 2024/01/12 18:06:18 skrll Exp $"); #include #include @@ -110,15 +110,16 @@ fdt_memory_remove_reserved(uint64_t min_ { uint64_t lstart = 0, lend = 0; int index, error, phandle, child; + const void *fdt_data = fdtbus_get_data(); + const int num = fdt_num_mem_rsv(fdt_data); - const int num = fdt_num_mem_rsv(fdtbus_get_data()); for (index = 0; index <= num; index++) { uint64_t addr, size; - error = fdt_get_mem_rsv(fdtbus_get_data(), index, - , ); + error = fdt_get_mem_rsv(fdt_data, index, , ); if (error != 0) continue; + if (lstart <= addr && addr <= lend) { size -= (lend - addr); addr = lend;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Fri Jan 12 18:06:18 UTC 2024 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: Cache the result from fdtbus_get_data() in fdt_memory_remove_reserved NFCI. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/fdt/fdt_memory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: thorpej Date: Tue Jan 2 07:34:27 UTC 2024 Modified Files: src/sys/dev/fdt: gfrtc_fdt.c Log Message: Adapt to changes in the generic gfrtc code. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/gfrtc_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: thorpej Date: Tue Jan 2 07:34:27 UTC 2024 Modified Files: src/sys/dev/fdt: gfrtc_fdt.c Log Message: Adapt to changes in the generic gfrtc code. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/gfrtc_fdt.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/gfrtc_fdt.c diff -u src/sys/dev/fdt/gfrtc_fdt.c:1.2 src/sys/dev/fdt/gfrtc_fdt.c:1.3 --- src/sys/dev/fdt/gfrtc_fdt.c:1.2 Fri Dec 29 23:31:44 2023 +++ src/sys/dev/fdt/gfrtc_fdt.c Tue Jan 2 07:34:27 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: gfrtc_fdt.c,v 1.2 2023/12/29 23:31:44 thorpej Exp $ */ +/* $NetBSD: gfrtc_fdt.c,v 1.3 2024/01/02 07:34:27 thorpej Exp $ */ /*- * Copyright (c) 2023 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gfrtc_fdt.c,v 1.2 2023/12/29 23:31:44 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gfrtc_fdt.c,v 1.3 2024/01/02 07:34:27 thorpej Exp $"); #include @@ -79,10 +79,7 @@ gfrtc_fdt_attach(device_t parent, device return; } - aprint_naive("\n"); - aprint_normal(": Google Goldfish RTC\n"); - - gfrtc_attach(sc); + gfrtc_attach(sc, true); } CFATTACH_DECL_NEW(gfrtc_fdt, sizeof(struct gfrtc_softc),
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Fri Dec 29 08:02:47 UTC 2023 Modified Files: src/sys/dev/fdt: dwcmmc_fdt.c Log Message: dwcmmc_fdt_bus_clock: fix an aprint_debug_dev frequency units botch. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/fdt/dwcmmc_fdt.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/dwcmmc_fdt.c diff -u src/sys/dev/fdt/dwcmmc_fdt.c:1.19 src/sys/dev/fdt/dwcmmc_fdt.c:1.20 --- src/sys/dev/fdt/dwcmmc_fdt.c:1.19 Sun Feb 6 15:47:06 2022 +++ src/sys/dev/fdt/dwcmmc_fdt.c Fri Dec 29 08:02:47 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwcmmc_fdt.c,v 1.19 2022/02/06 15:47:06 jmcneill Exp $ */ +/* $NetBSD: dwcmmc_fdt.c,v 1.20 2023/12/29 08:02:47 skrll Exp $ */ /*- * Copyright (c) 2015-2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.19 2022/02/06 15:47:06 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.20 2023/12/29 08:02:47 skrll Exp $"); #include #include @@ -249,7 +249,7 @@ dwcmmc_fdt_bus_clock(struct dwc_mmc_soft sc->sc_clock_freq = clk_get_rate(esc->sc_clk_ciu); aprint_debug_dev(sc->sc_dev, "set clock rate to %u kHz (target %u kHz)\n", - sc->sc_clock_freq, rate); + sc->sc_clock_freq / 1000, rate); return 0; }
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Fri Dec 29 08:02:47 UTC 2023 Modified Files: src/sys/dev/fdt: dwcmmc_fdt.c Log Message: dwcmmc_fdt_bus_clock: fix an aprint_debug_dev frequency units botch. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/fdt/dwcmmc_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: rin Date: Mon Jul 31 04:59:47 UTC 2023 Modified Files: src/sys/dev/fdt: dwc2_fdt.c Log Message: dw2c_fdt: Terminate statements by ; instead of , (from Mori Hiroki) No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/fdt/dwc2_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: rin Date: Mon Jul 31 04:59:47 UTC 2023 Modified Files: src/sys/dev/fdt: dwc2_fdt.c Log Message: dw2c_fdt: Terminate statements by ; instead of , (from Mori Hiroki) No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/fdt/dwc2_fdt.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/dwc2_fdt.c diff -u src/sys/dev/fdt/dwc2_fdt.c:1.12 src/sys/dev/fdt/dwc2_fdt.c:1.13 --- src/sys/dev/fdt/dwc2_fdt.c:1.12 Sat Aug 7 16:19:10 2021 +++ src/sys/dev/fdt/dwc2_fdt.c Mon Jul 31 04:59:47 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc2_fdt.c,v 1.12 2021/08/07 16:19:10 thorpej Exp $ */ +/* $NetBSD: dwc2_fdt.c,v 1.13 2023/07/31 04:59:47 rin Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwc2_fdt.c,v 1.12 2021/08/07 16:19:10 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc2_fdt.c,v 1.13 2023/07/31 04:59:47 rin Exp $"); #include #include @@ -215,13 +215,13 @@ dwc2_fdt_amlogic_params(struct dwc2_fdt_ params->otg_cap = DWC2_CAP_PARAM_NO_HNP_SRP_CAPABLE; params->speed = DWC2_SPEED_PARAM_HIGH; params->dma_enable = 1; - params->enable_dynamic_fifo = 1, + params->enable_dynamic_fifo = 1; params->host_rx_fifo_size = 512; params->host_nperio_tx_fifo_size = 500; params->host_perio_tx_fifo_size = 500; params->host_channels = 16; params->phy_type = DWC2_PHY_TYPE_PARAM_UTMI; - params->reload_ctl = 1, + params->reload_ctl = 1; params->ahbcfg = GAHBCFG_HBSTLEN_INCR8 << GAHBCFG_HBSTLEN_SHIFT; #ifdef DWC2_POWER_DOWN_PARAM_NONE params->power_down = DWC2_POWER_DOWN_PARAM_NONE;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Tue Jul 11 05:57:44 UTC 2023 Modified Files: src/sys/dev/fdt: fdt_boot.c Log Message: G/C some #if 0 / #endif code To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/fdt_boot.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_boot.c diff -u src/sys/dev/fdt/fdt_boot.c:1.3 src/sys/dev/fdt/fdt_boot.c:1.4 --- src/sys/dev/fdt/fdt_boot.c:1.3 Mon Jul 10 07:01:48 2023 +++ src/sys/dev/fdt/fdt_boot.c Tue Jul 11 05:57:44 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_boot.c,v 1.3 2023/07/10 07:01:48 rin Exp $ */ +/* $NetBSD: fdt_boot.c,v 1.4 2023/07/11 05:57:44 skrll Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -56,7 +56,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_boot.c,v 1.3 2023/07/10 07:01:48 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_boot.c,v 1.4 2023/07/11 05:57:44 skrll Exp $"); #include "opt_efi.h" #include "opt_md.h" @@ -82,9 +82,6 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_boot.c,v #include #include -#if 0 -#include -#endif #include #ifndef FDT_MAX_BOOT_STRING
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Tue Jul 11 05:57:44 UTC 2023 Modified Files: src/sys/dev/fdt: fdt_boot.c Log Message: G/C some #if 0 / #endif code To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/fdt_boot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Mon May 8 10:18:03 UTC 2023 Modified Files: src/sys/dev/fdt: files.fdt Log Message: Google goldfish config goop To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 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.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Mon May 8 10:18:03 UTC 2023 Modified Files: src/sys/dev/fdt: files.fdt Log Message: Google goldfish config goop To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 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/files.fdt diff -u src/sys/dev/fdt/files.fdt:1.69 src/sys/dev/fdt/files.fdt:1.70 --- src/sys/dev/fdt/files.fdt:1.69 Sat Apr 22 09:53:45 2023 +++ src/sys/dev/fdt/files.fdt Mon May 8 10:18:03 2023 @@ -1,4 +1,4 @@ -# $NetBSD: files.fdt,v 1.69 2023/04/22 09:53:45 skrll Exp $ +# $NetBSD: files.fdt,v 1.70 2023/05/08 10:18:03 skrll Exp $ include "external/bsd/libfdt/conf/files.libfdt" @@ -215,3 +215,8 @@ file dev/fdt/genet_fdt.c genet_fdt # VMware Tools driver attach vmt at fdt with vmt_fdt file dev/fdt/vmt_fdt.c vmt_fdt + +# Google Goldfish RTC +device gfrtc +attach gfrtc at fdt with gfrtc_fdt +file dev/fdt/gfrtc_fdt.c gfrtc_fdt
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Mon May 8 07:51:44 UTC 2023 Added Files: src/sys/dev/fdt: gfrtc_fdt.c Log Message: Add a Google Goldfish RTC driver To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/gfrtc_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Mon May 8 07:51:44 UTC 2023 Added Files: src/sys/dev/fdt: gfrtc_fdt.c Log Message: Add a Google Goldfish RTC driver To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/gfrtc_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/dev/fdt/gfrtc_fdt.c diff -u /dev/null src/sys/dev/fdt/gfrtc_fdt.c:1.1 --- /dev/null Mon May 8 07:51:44 2023 +++ src/sys/dev/fdt/gfrtc_fdt.c Mon May 8 07:51:44 2023 @@ -0,0 +1,141 @@ +/* $NetBSD: gfrtc_fdt.c,v 1.1 2023/05/08 07:51:44 skrll Exp $ */ + +/*- + * Copyright (c) 2023 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 +__KERNEL_RCSID(0, "$NetBSD: gfrtc_fdt.c,v 1.1 2023/05/08 07:51:44 skrll Exp $"); + +#include + +#include +#include + +#include + +/* + * https://android.googlesource.com/platform/external/qemu/+/master/docs/GOLDFISH-VIRTUAL-HARDWARE.TXT + */ + +static const struct device_compatible_entry compat_data[] = { + { .compat = "google,goldfish-rtc" }, + DEVICE_COMPAT_EOL +}; + +struct gfrtc_fdt_softc { + device_t sc_dev; + bus_space_tag_t sc_bst; + bus_space_handle_t sc_bsh; + + struct todr_chip_handle sc_todr; +}; + +#define GOLDFISH_RTC_READ(sc, reg) \ + bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg)) +#define GOLDFISH_RTC_WRITE(sc, reg, val) \ + bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val)) + + +#define GOLDFISH_RTC_TIME_LOW 0x00 +#define GOLDFISH_RTC_TIME_HIGH 0x04 + + +static int +gfrtc_gettime(struct todr_chip_handle *ch, struct timeval *tv) +{ + struct gfrtc_fdt_softc *sc = ch->cookie; + const uint64_t lo = GOLDFISH_RTC_READ(sc, GOLDFISH_RTC_TIME_LOW); + const uint64_t hi = GOLDFISH_RTC_READ(sc, GOLDFISH_RTC_TIME_HIGH); + + uint64_t nsec = (hi << 32) | lo; + + tv->tv_sec = nsec / 10; + tv->tv_usec = (nsec - tv->tv_sec) / 1000; // Always 0? + + return 0; +} + +static int +gfrtc_settime(struct todr_chip_handle *ch, struct timeval *tv) +{ + struct gfrtc_fdt_softc *sc = ch->cookie; + + uint64_t nsec = (tv->tv_sec * 100 + tv->tv_usec) * 1000; + uint32_t hi = nsec >> 32; + uint32_t lo = nsec; + + GOLDFISH_RTC_WRITE(sc, GOLDFISH_RTC_TIME_HIGH, hi); + GOLDFISH_RTC_WRITE(sc, GOLDFISH_RTC_TIME_HIGH, lo); + + return 0; +} + + +static int +gfrtc_fdt_match(device_t parent, cfdata_t cf, void *aux) +{ + struct fdt_attach_args * const faa = aux; + + return of_compatible_match(faa->faa_phandle, compat_data); +} + +static void +gfrtc_fdt_attach(device_t parent, device_t self, void *aux) +{ + struct gfrtc_fdt_softc * const sc = device_private(self); + struct fdt_attach_args * const faa = aux; + const int phandle = faa->faa_phandle; + bus_addr_t addr; + bus_size_t size; + + 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; + if (bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh) != 0) { + aprint_error(": couldn't map registers\n"); + return; + } + + aprint_naive("\n"); + aprint_normal(": Google Goldfish RTC\n"); + + sc->sc_todr.cookie = sc; + sc->sc_todr.todr_gettime = gfrtc_gettime; + sc->sc_todr.todr_settime = gfrtc_settime; + sc->sc_todr.todr_setwen = NULL; + + todr_attach(>sc_todr); +} + +CFATTACH_DECL_NEW(gfrtc_fdt, sizeof(struct gfrtc_fdt_softc), + gfrtc_fdt_match, gfrtc_fdt_attach, NULL, NULL);
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Sat Nov 5 10:04:35 UTC 2022 Modified Files: src/sys/dev/fdt: cpus.c Log Message: Fix inverted result when status is "okay" To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/cpus.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/cpus.c diff -u src/sys/dev/fdt/cpus.c:1.5 src/sys/dev/fdt/cpus.c:1.6 --- src/sys/dev/fdt/cpus.c:1.5 Wed Jan 2 14:54:54 2019 +++ src/sys/dev/fdt/cpus.c Sat Nov 5 10:04:35 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: cpus.c,v 1.5 2019/01/02 14:54:54 jmcneill Exp $ */ +/* $NetBSD: cpus.c,v 1.6 2022/11/05 10:04:35 skrll Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpus.c,v 1.5 2019/01/02 14:54:54 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpus.c,v 1.6 2022/11/05 10:04:35 skrll Exp $"); #include #include @@ -85,7 +85,7 @@ cpus_cpu_enabled(int child) s = fdtbus_get_string(child, "status"); if (s) { if (strcmp(s, "okay") == 0) - return false; + return true; if (strcmp(s, "disabled") == 0) return of_hasprop(child, "enable-method"); return false;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Sat Nov 5 10:04:35 UTC 2022 Modified Files: src/sys/dev/fdt: cpus.c Log Message: Fix inverted result when status is "okay" To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/cpus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Wed Nov 2 11:04:02 UTC 2022 Modified Files: src/sys/dev/fdt: arasan_sdhc_fdt.c Log Message: Re-enable ADMA2 support for arasan,sdhci-8.9a To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/fdt/arasan_sdhc_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Wed Nov 2 11:04:02 UTC 2022 Modified Files: src/sys/dev/fdt: arasan_sdhc_fdt.c Log Message: Re-enable ADMA2 support for arasan,sdhci-8.9a To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/fdt/arasan_sdhc_fdt.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/arasan_sdhc_fdt.c diff -u src/sys/dev/fdt/arasan_sdhc_fdt.c:1.12 src/sys/dev/fdt/arasan_sdhc_fdt.c:1.13 --- src/sys/dev/fdt/arasan_sdhc_fdt.c:1.12 Tue Nov 1 00:57:39 2022 +++ src/sys/dev/fdt/arasan_sdhc_fdt.c Wed Nov 2 11:04:02 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: arasan_sdhc_fdt.c,v 1.12 2022/11/01 00:57:39 jmcneill Exp $ */ +/* $NetBSD: arasan_sdhc_fdt.c,v 1.13 2022/11/02 11:04:02 jmcneill Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_fdt.c,v 1.12 2022/11/01 00:57:39 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_fdt.c,v 1.13 2022/11/02 11:04:02 jmcneill Exp $"); #include #include @@ -53,8 +53,8 @@ __KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_ #define RK3399_CORECFG_CLOCKMULTIPLIER __BITS(7,0) enum arasan_sdhc_type { - AS_TYPE_RK3399 = 1, - AS_TYPE_SDHCI_8_9A, + AS_TYPE_GENERIC, + AS_TYPE_RK3399, }; struct arasan_sdhc_softc { @@ -78,7 +78,7 @@ static const struct device_compatible_en .value = AS_TYPE_RK3399 }, { .compat = "arasan,sdhci-8.9a", - .value = AS_TYPE_SDHCI_8_9A }, + .value = AS_TYPE_GENERIC }, DEVICE_COMPAT_EOL }; @@ -296,13 +296,6 @@ arasan_sdhc_attach(device_t parent, devi SDHC_FLAG_32BIT_ACCESS | SDHC_FLAG_USE_DMA | SDHC_FLAG_STOP_WITH_TC; - if (sc->sc_type == AS_TYPE_SDHCI_8_9A) { - /* - * Workaround for sporadic transfer errors on the Arasan SDHCI - * found in the Xilinx Zynq-7000 SoC. - */ - sc->sc_base.sc_flags |= SDHC_FLAG_BROKEN_ADMA; - } if (bus_width == 8) { sc->sc_base.sc_flags |= SDHC_FLAG_8BIT_MODE; }
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Tue Nov 1 00:57:39 UTC 2022 Modified Files: src/sys/dev/fdt: arasan_sdhc_fdt.c Log Message: Disable ADMA2 on the Arasan SDHCI 8.9A found in the Xilinx Zinq-7000 due to sporadic transfer errors until the root cause for the errors is found. In the meantime, SDMA works fine on this platform. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/fdt/arasan_sdhc_fdt.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/arasan_sdhc_fdt.c diff -u src/sys/dev/fdt/arasan_sdhc_fdt.c:1.11 src/sys/dev/fdt/arasan_sdhc_fdt.c:1.12 --- src/sys/dev/fdt/arasan_sdhc_fdt.c:1.11 Wed Oct 26 20:54:52 2022 +++ src/sys/dev/fdt/arasan_sdhc_fdt.c Tue Nov 1 00:57:39 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: arasan_sdhc_fdt.c,v 1.11 2022/10/26 20:54:52 jmcneill Exp $ */ +/* $NetBSD: arasan_sdhc_fdt.c,v 1.12 2022/11/01 00:57:39 jmcneill Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_fdt.c,v 1.11 2022/10/26 20:54:52 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_fdt.c,v 1.12 2022/11/01 00:57:39 jmcneill Exp $"); #include #include @@ -53,8 +53,8 @@ __KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_ #define RK3399_CORECFG_CLOCKMULTIPLIER __BITS(7,0) enum arasan_sdhc_type { - AS_TYPE_GENERIC = 0, AS_TYPE_RK3399 = 1, + AS_TYPE_SDHCI_8_9A, }; struct arasan_sdhc_softc { @@ -78,7 +78,7 @@ static const struct device_compatible_en .value = AS_TYPE_RK3399 }, { .compat = "arasan,sdhci-8.9a", - .value = AS_TYPE_GENERIC }, + .value = AS_TYPE_SDHCI_8_9A }, DEVICE_COMPAT_EOL }; @@ -296,8 +296,16 @@ arasan_sdhc_attach(device_t parent, devi SDHC_FLAG_32BIT_ACCESS | SDHC_FLAG_USE_DMA | SDHC_FLAG_STOP_WITH_TC; - if (bus_width == 8) + if (sc->sc_type == AS_TYPE_SDHCI_8_9A) { + /* + * Workaround for sporadic transfer errors on the Arasan SDHCI + * found in the Xilinx Zynq-7000 SoC. + */ + sc->sc_base.sc_flags |= SDHC_FLAG_BROKEN_ADMA; + } + if (bus_width == 8) { sc->sc_base.sc_flags |= SDHC_FLAG_8BIT_MODE; + } sc->sc_base.sc_clkbase = clk_get_rate(sc->sc_clk_xin) / 1000; sc->sc_base.sc_vendor_bus_clock = arasan_sdhc_bus_clock_pre; sc->sc_base.sc_vendor_bus_clock_post = arasan_sdhc_bus_clock_post;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Tue Nov 1 00:57:39 UTC 2022 Modified Files: src/sys/dev/fdt: arasan_sdhc_fdt.c Log Message: Disable ADMA2 on the Arasan SDHCI 8.9A found in the Xilinx Zinq-7000 due to sporadic transfer errors until the root cause for the errors is found. In the meantime, SDMA works fine on this platform. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/fdt/arasan_sdhc_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Wed Oct 26 20:54:53 UTC 2022 Modified Files: src/sys/dev/fdt: arasan_sdhc_fdt.c Log Message: No need to constrain DMA tag to 32-bits on 32-bit platforms. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/fdt/arasan_sdhc_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Wed Oct 26 20:54:53 UTC 2022 Modified Files: src/sys/dev/fdt: arasan_sdhc_fdt.c Log Message: No need to constrain DMA tag to 32-bits on 32-bit platforms. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/fdt/arasan_sdhc_fdt.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/arasan_sdhc_fdt.c diff -u src/sys/dev/fdt/arasan_sdhc_fdt.c:1.10 src/sys/dev/fdt/arasan_sdhc_fdt.c:1.11 --- src/sys/dev/fdt/arasan_sdhc_fdt.c:1.10 Wed Oct 26 10:55:23 2022 +++ src/sys/dev/fdt/arasan_sdhc_fdt.c Wed Oct 26 20:54:52 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: arasan_sdhc_fdt.c,v 1.10 2022/10/26 10:55:23 jmcneill Exp $ */ +/* $NetBSD: arasan_sdhc_fdt.c,v 1.11 2022/10/26 20:54:52 jmcneill Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_fdt.c,v 1.10 2022/10/26 10:55:23 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_fdt.c,v 1.11 2022/10/26 20:54:52 jmcneill Exp $"); #include #include @@ -234,7 +234,6 @@ arasan_sdhc_attach(device_t parent, devi bus_addr_t addr; bus_size_t size; u_int bus_width; - int error; void *ih; fdtbus_clock_assign(phandle); @@ -274,9 +273,10 @@ arasan_sdhc_attach(device_t parent, devi sc->sc_bsz = size; sc->sc_type = of_compatible_lookup(phandle, compat_data)->value; +#ifdef _LP64 const uint32_t caps = bus_space_read_4(sc->sc_bst, sc->sc_bsh, SDHC_CAPABILITIES); if ((caps & (SDHC_ADMA2_SUPP|SDHC_64BIT_SYS_BUS)) == SDHC_ADMA2_SUPP) { - error = bus_dmatag_subregion(faa->faa_dmat, 0, __MASK(32), + int error = bus_dmatag_subregion(faa->faa_dmat, 0, __MASK(32), >sc_base.sc_dmat, BUS_DMA_WAITOK); if (error != 0) { aprint_error(": couldn't create DMA tag: %d\n", error); @@ -285,6 +285,9 @@ arasan_sdhc_attach(device_t parent, devi } else { sc->sc_base.sc_dmat = faa->faa_dmat; } +#else + sc->sc_base.sc_dmat = faa->faa_dmat; +#endif sc->sc_base.sc_dev = self; sc->sc_base.sc_host = sc->sc_host;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Thu Oct 20 11:38:21 UTC 2022 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: Do what the comment says and reserve ranges that do and do not have the "no-map" property. Required for qemu/riscv To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/fdt_memory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Thu Oct 20 11:38:21 UTC 2022 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: Do what the comment says and reserve ranges that do and do not have the "no-map" property. Required for qemu/riscv To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/fdt_memory.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_memory.c diff -u src/sys/dev/fdt/fdt_memory.c:1.6 src/sys/dev/fdt/fdt_memory.c:1.7 --- src/sys/dev/fdt/fdt_memory.c:1.6 Sat Aug 6 20:16:42 2022 +++ src/sys/dev/fdt/fdt_memory.c Thu Oct 20 11:38:21 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_memory.c,v 1.6 2022/08/06 20:16:42 ryo Exp $ */ +/* $NetBSD: fdt_memory.c,v 1.7 2022/10/20 11:38:21 skrll Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "opt_fdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.6 2022/08/06 20:16:42 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.7 2022/10/20 11:38:21 skrll Exp $"); #include #include @@ -154,9 +154,6 @@ fdt_memory_remove_reserved(uint64_t min_ bus_addr_t addr; bus_size_t size; - if (!of_hasprop(child, "no-map")) -continue; - if (fdtbus_get_reg(child, 0, , ) != 0) continue; if (size == 0)
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Sat Aug 6 20:16:43 UTC 2022 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: In my previous change, it was necessary to consider the case where the first block size is zero. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/fdt_memory.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_memory.c diff -u src/sys/dev/fdt/fdt_memory.c:1.5 src/sys/dev/fdt/fdt_memory.c:1.6 --- src/sys/dev/fdt/fdt_memory.c:1.5 Thu Aug 4 11:58:55 2022 +++ src/sys/dev/fdt/fdt_memory.c Sat Aug 6 20:16:42 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_memory.c,v 1.5 2022/08/04 11:58:55 ryo Exp $ */ +/* $NetBSD: fdt_memory.c,v 1.6 2022/08/06 20:16:42 ryo Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "opt_fdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.5 2022/08/04 11:58:55 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.6 2022/08/06 20:16:42 ryo Exp $"); #include #include @@ -83,16 +83,16 @@ fdt_memory_get(uint64_t *pstart, uint64_ { const int memory = OF_finddevice("/memory"); uint64_t cur_addr, cur_size; - int index; + int index, nadd; - for (index = 0; + for (index = 0, nadd = 0; fdtbus_get_reg64(memory, index, _addr, _size) == 0; index++) { if (cur_size == 0) continue; fdt_memory_add_range(cur_addr, cur_size); - if (index == 0) { + if (nadd++ == 0) { *pstart = cur_addr; *pend = cur_addr + cur_size; continue; @@ -102,7 +102,7 @@ fdt_memory_get(uint64_t *pstart, uint64_ if (cur_addr + cur_size > *pend) *pend = cur_addr + cur_size; } - if (index == 0) + if (nadd == 0) panic("Cannot determine memory size"); }
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Sat Aug 6 20:16:43 UTC 2022 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: In my previous change, it was necessary to consider the case where the first block size is zero. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/fdt_memory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Thu Aug 4 11:58:55 UTC 2022 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: Don't pass a block of size 0 to fdt_memory_add_range(). There are some environments where size 0 blocks are passed from the loader. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/fdt_memory.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_memory.c diff -u src/sys/dev/fdt/fdt_memory.c:1.4 src/sys/dev/fdt/fdt_memory.c:1.5 --- src/sys/dev/fdt/fdt_memory.c:1.4 Fri Jan 7 07:25:37 2022 +++ src/sys/dev/fdt/fdt_memory.c Thu Aug 4 11:58:55 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_memory.c,v 1.4 2022/01/07 07:25:37 mlelstv Exp $ */ +/* $NetBSD: fdt_memory.c,v 1.5 2022/08/04 11:58:55 ryo Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "opt_fdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.4 2022/01/07 07:25:37 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.5 2022/08/04 11:58:55 ryo Exp $"); #include #include @@ -88,6 +88,8 @@ fdt_memory_get(uint64_t *pstart, uint64_ for (index = 0; fdtbus_get_reg64(memory, index, _addr, _size) == 0; index++) { + if (cur_size == 0) + continue; fdt_memory_add_range(cur_addr, cur_size); if (index == 0) {
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Thu Aug 4 11:58:55 UTC 2022 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: Don't pass a block of size 0 to fdt_memory_add_range(). There are some environments where size 0 blocks are passed from the loader. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/fdt_memory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Sun Jun 12 08:04:07 UTC 2022 Modified Files: src/sys/dev/fdt: dwc3_fdt.c Log Message: Attach when dr_mode is "otg" and the controller has the "usb-role-switch" and "role-switch-default-mode" as seen in the Apple M1 dts. This assumes the controller is properly setup for host mode already. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/fdt/dwc3_fdt.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/dwc3_fdt.c diff -u src/sys/dev/fdt/dwc3_fdt.c:1.19 src/sys/dev/fdt/dwc3_fdt.c:1.20 --- src/sys/dev/fdt/dwc3_fdt.c:1.19 Sun Nov 7 17:14:20 2021 +++ src/sys/dev/fdt/dwc3_fdt.c Sun Jun 12 08:04:07 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc3_fdt.c,v 1.19 2021/11/07 17:14:20 jmcneill Exp $ */ +/* $NetBSD: dwc3_fdt.c,v 1.20 2022/06/12 08:04:07 skrll Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.19 2021/11/07 17:14:20 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.20 2022/06/12 08:04:07 skrll Exp $"); #include #include @@ -256,9 +256,30 @@ dwc3_fdt_attach(device_t parent, device_ return; } - /* Only host mode is supported */ + /* + * Only host mode is supported, but this includes otg devices + * that have 'usb-role-switch' and 'role-switch-default-mode' of + * 'host' + */ const char *dr_mode = fdtbus_get_string(dwc3_phandle, "dr_mode"); - if (dr_mode == NULL || strcmp(dr_mode, "host") != 0) { + if (dr_mode == NULL || strcmp(dr_mode, "otg") == 0) { + bool ok = false; + if (of_hasprop(dwc3_phandle, "usb-role-switch")) { + const char *rsdm = fdtbus_get_string(dwc3_phandle, + "role-switch-default-mode"); + if (rsdm != NULL && strcmp(rsdm, "host") == 0) +ok = true; + + if (!ok) { +aprint_error(": host is not default mode\n"); +return; + } + } + if (!ok) { + aprint_error(": cannot switch 'otg' mode to host\n"); + return; + } + } else if (strcmp(dr_mode, "host") != 0) { aprint_error(": '%s' not supported\n", dr_mode); return; }
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Sun Jun 12 08:04:07 UTC 2022 Modified Files: src/sys/dev/fdt: dwc3_fdt.c Log Message: Attach when dr_mode is "otg" and the controller has the "usb-role-switch" and "role-switch-default-mode" as seen in the Apple M1 dts. This assumes the controller is properly setup for host mode already. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/fdt/dwc3_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Fri Mar 25 21:23:51 UTC 2022 Modified Files: src/sys/dev/fdt: files.fdt Added Files: src/sys/dev/fdt: fdt_userconf.c Log Message: fdt: add support for USERCONF option To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/fdt_userconf.c cvs rdiff -u -r1.63 -r1.64 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/files.fdt diff -u src/sys/dev/fdt/files.fdt:1.63 src/sys/dev/fdt/files.fdt:1.64 --- src/sys/dev/fdt/files.fdt:1.63 Fri Mar 4 08:19:06 2022 +++ src/sys/dev/fdt/files.fdt Fri Mar 25 21:23:51 2022 @@ -1,4 +1,4 @@ -# $NetBSD: files.fdt,v 1.63 2022/03/04 08:19:06 skrll Exp $ +# $NetBSD: files.fdt,v 1.64 2022/03/25 21:23:51 jmcneill Exp $ include "external/bsd/libfdt/conf/files.libfdt" @@ -13,6 +13,8 @@ device simplebus: fdt attach simplebus at fdt file dev/fdt/fdtbus.c fdt +file dev/fdt/fdt_userconf.c fdt & userconf + device fregulator attach fregulator at fdt file dev/fdt/fixedregulator.c fregulator Added files: Index: src/sys/dev/fdt/fdt_userconf.c diff -u /dev/null src/sys/dev/fdt/fdt_userconf.c:1.1 --- /dev/null Fri Mar 25 21:23:51 2022 +++ src/sys/dev/fdt/fdt_userconf.c Fri Mar 25 21:23:51 2022 @@ -0,0 +1,67 @@ +/* $NetBSD: fdt_userconf.c,v 1.1 2022/03/25 21:23:51 jmcneill Exp $ */ + +/*- + * Copyright (c) 2022 Jared 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 +__KERNEL_RCSID(0, "$NetBSD: fdt_userconf.c,v 1.1 2022/03/25 21:23:51 jmcneill Exp $"); + +#include +#include +#include + +#include +#include + +#define FDT_CHOSEN_PATH "/chosen" +#define FDT_CHOSEN_USERCONF_PROP "netbsd,userconf" + +void +userconf_bootinfo(void) +{ + const void *fdt = fdtbus_get_data(); + const char *cmd; + int chosen, index; + + if (fdt == NULL) { + return; + } + + chosen = fdt_path_offset(fdt, FDT_CHOSEN_PATH); + if (chosen < 0) { + return; + } + + index = 0; + do { + cmd = fdt_stringlist_get(fdt, chosen, FDT_CHOSEN_USERCONF_PROP, + index++, NULL); + if (cmd != NULL) { + aprint_debug("Processing userconf command: %s\n", cmd); + userconf_parse(__UNCONST(cmd)); + } + } while (cmd != NULL); +}
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Fri Mar 25 21:23:51 UTC 2022 Modified Files: src/sys/dev/fdt: files.fdt Added Files: src/sys/dev/fdt: fdt_userconf.c Log Message: fdt: add support for USERCONF option To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/fdt_userconf.c cvs rdiff -u -r1.63 -r1.64 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.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Fri Mar 4 08:19:07 UTC 2022 Modified Files: src/sys/dev/fdt: fdtbus.c fdtvar.h files.fdt Added Files: src/sys/dev/fdt: fdt_mbox.c fdt_powerdomain.c Log Message: Add mailbox and power-domain support. power-domain support is very rudimentary. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/fdt_mbox.c \ src/sys/dev/fdt/fdt_powerdomain.c cvs rdiff -u -r1.45 -r1.46 src/sys/dev/fdt/fdtbus.c cvs rdiff -u -r1.76 -r1.77 src/sys/dev/fdt/fdtvar.h cvs rdiff -u -r1.62 -r1.63 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.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Fri Mar 4 08:19:07 UTC 2022 Modified Files: src/sys/dev/fdt: fdtbus.c fdtvar.h files.fdt Added Files: src/sys/dev/fdt: fdt_mbox.c fdt_powerdomain.c Log Message: Add mailbox and power-domain support. power-domain support is very rudimentary. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/fdt_mbox.c \ src/sys/dev/fdt/fdt_powerdomain.c cvs rdiff -u -r1.45 -r1.46 src/sys/dev/fdt/fdtbus.c cvs rdiff -u -r1.76 -r1.77 src/sys/dev/fdt/fdtvar.h cvs rdiff -u -r1.62 -r1.63 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/fdtbus.c diff -u src/sys/dev/fdt/fdtbus.c:1.45 src/sys/dev/fdt/fdtbus.c:1.46 --- src/sys/dev/fdt/fdtbus.c:1.45 Sat Jan 22 11:49:17 2022 +++ src/sys/dev/fdt/fdtbus.c Fri Mar 4 08:19:06 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtbus.c,v 1.45 2022/01/22 11:49:17 thorpej Exp $ */ +/* $NetBSD: fdtbus.c,v 1.46 2022/03/04 08:19:06 skrll Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.45 2022/01/22 11:49:17 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.46 2022/03/04 08:19:06 skrll Exp $"); #include #include @@ -468,6 +468,8 @@ fdt_pre_attach(struct fdt_node *node) aprint_debug_dev(node->n_bus, "failed to set %s config on %s: %d\n", cfgname, node->n_name, error); + + fdtbus_powerdomain_enable(node->n_phandle); } static void Index: src/sys/dev/fdt/fdtvar.h diff -u src/sys/dev/fdt/fdtvar.h:1.76 src/sys/dev/fdt/fdtvar.h:1.77 --- src/sys/dev/fdt/fdtvar.h:1.76 Wed Feb 23 08:56:11 2022 +++ src/sys/dev/fdt/fdtvar.h Fri Mar 4 08:19:06 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtvar.h,v 1.76 2022/02/23 08:56:11 skrll Exp $ */ +/* $NetBSD: fdtvar.h,v 1.77 2022/03/04 08:19:06 skrll Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -157,6 +157,20 @@ struct fdtbus_iommu_func { }; +struct fdtbus_mbox_channel { + struct fdtbus_mbox_controller *mb_ctlr; + void *mb_priv; +}; + +struct fdtbus_mbox_controller_func { + void * (*mc_acquire)(device_t, const void *, size_t, void (*)(void *), + void *); + void (*mc_release)(device_t, void *); + int (*mc_recv)(device_t, void *, void *, size_t); + int (*mc_send)(device_t, void *, const void *, size_t); +}; + + struct fdtbus_mmc_pwrseq; struct fdtbus_mmc_pwrseq_func { @@ -201,6 +215,13 @@ struct fdtbus_power_controller_func { }; +struct fdtbus_powerdomain_controller; + +struct fdtbus_powerdomain_controller_func { + void (*pdc_enable)(device_t, const uint32_t *, bool); +}; + + struct fdtbus_pwm_controller_func { pwm_tag_t (*get_tag)(device_t, const void *, size_t); }; @@ -306,12 +327,16 @@ int fdtbus_register_interrupt_controlle const struct fdtbus_interrupt_controller_func *); int fdtbus_register_iommu(device_t, int, const struct fdtbus_iommu_func *); +int fdtbus_register_mbox_controller(device_t, int, + const struct fdtbus_mbox_controller_func *); int fdtbus_register_mmc_pwrseq(device_t, int, const struct fdtbus_mmc_pwrseq_func *); int fdtbus_register_pinctrl_config(device_t, int, const struct fdtbus_pinctrl_controller_func *); int fdtbus_register_power_controller(device_t, int, const struct fdtbus_power_controller_func *); +int fdtbus_register_powerdomain_controller(device_t, int, + const struct fdtbus_powerdomain_controller_func *); int fdtbus_register_phy_controller(device_t, int, const struct fdtbus_phy_controller_func *); int fdtbus_register_pwm_controller(device_t, int, @@ -392,6 +417,15 @@ int fdtbus_intr_parent(int); bus_dma_tag_t fdtbus_iommu_map(int, u_int, bus_dma_tag_t); bus_dma_tag_t fdtbus_iommu_map_pci(int, uint32_t, bus_dma_tag_t); +struct fdtbus_mbox_channel * + fdtbus_mbox_get(int, const char *, void (*)(void *), void *); +struct fdtbus_mbox_channel * + fdtbus_mbox_get_index(int, u_int, void (*)(void *), + void *); +int fdtbus_mbox_send(struct fdtbus_mbox_channel *, const void *, size_t); +int fdtbus_mbox_recv(struct fdtbus_mbox_channel *, void *, size_t); +void fdtbus_mbox_put(struct fdtbus_mbox_channel *); + struct fdtbus_mmc_pwrseq * fdtbus_mmc_pwrseq_get(int); void fdtbus_mmc_pwrseq_pre_power_on(struct fdtbus_mmc_pwrseq *); @@ -447,6 +481,11 @@ int fdtbus_todr_attach(device_t, int, t void fdtbus_power_reset(void); void fdtbus_power_poweroff(void); +int fdtbus_powerdomain_enable(int); +int fdtbus_powerdomain_enable_index(int, int); +int fdtbus_powerdomain_disable(int); +int fdtbus_powerdomain_disable_index(int, int); + struct syscon * fdtbus_syscon_acquire(int, const char *); struct syscon * fdtbus_syscon_lookup(int); Index: src/sys/dev/fdt/files.fdt diff -u src/sys/dev/fdt/files.fdt:1.62 src/sys/dev/fdt/files.fdt:1.63 --- src/sys/dev/fdt/files.fdt:1.62 Sat Sep 4 12:34:39
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Wed Feb 23 08:56:11 UTC 2022 Modified Files: src/sys/dev/fdt: fdtvar.h Log Message: Sort a bit. NFC To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 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.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Wed Feb 23 08:56:11 UTC 2022 Modified Files: src/sys/dev/fdt: fdtvar.h Log Message: Sort a bit. NFC To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 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/fdtvar.h diff -u src/sys/dev/fdt/fdtvar.h:1.75 src/sys/dev/fdt/fdtvar.h:1.76 --- src/sys/dev/fdt/fdtvar.h:1.75 Wed Feb 23 07:55:55 2022 +++ src/sys/dev/fdt/fdtvar.h Wed Feb 23 08:56:11 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtvar.h,v 1.75 2022/02/23 07:55:55 skrll Exp $ */ +/* $NetBSD: fdtvar.h,v 1.76 2022/02/23 08:56:11 skrll Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -59,95 +59,17 @@ struct fdt_attach_args { int faa_quiet; }; -/* flags for fdtbus_intr_establish */ -#define FDT_INTR_MPSAFE __BIT(0) - -/* Interrupt trigger types defined by the FDT "interrupts" bindings. */ -#define FDT_INTR_TYPE_POS_EDGE __BIT(0) -#define FDT_INTR_TYPE_NEG_EDGE __BIT(1) -#define FDT_INTR_TYPE_DOUBLE_EDGE (FDT_INTR_TYPE_POS_EDGE | \ - FDT_INTR_TYPE_NEG_EDGE) -#define FDT_INTR_TYPE_HIGH_LEVEL __BIT(2) -#define FDT_INTR_TYPE_LOW_LEVEL __BIT(3) - -struct fdtbus_interrupt_controller_func { - void * (*establish)(device_t, u_int *, int, int, - int (*)(void *), void *, const char *); - void (*disestablish)(device_t, void *); - bool (*intrstr)(device_t, u_int *, char *, size_t); - void (*mask)(device_t, void *); - void (*unmask)(device_t, void *); -}; - -struct fdtbus_spi_controller_func { - struct spi_controller * (*get_controller)(device_t); -}; - -struct fdtbus_gpio_controller; - -struct fdtbus_gpio_pin { - struct fdtbus_gpio_controller *gp_gc; - void *gp_priv; -}; - -struct fdtbus_gpio_controller_func { - void * (*acquire)(device_t, const void *, size_t, int); - void (*release)(device_t, void *); - int (*read)(device_t, void *, bool); - 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 { - int (*set_config)(device_t, const void *, size_t); -}; - -struct fdtbus_iommu_func { - bus_dma_tag_t (*map)(device_t, const u_int *, bus_dma_tag_t); -}; - -struct fdtbus_regulator_controller; - -struct fdtbus_regulator { - struct fdtbus_regulator_controller *reg_rc; -}; - -struct fdtbus_regulator_controller_func { - int (*acquire)(device_t); - void (*release)(device_t); - int (*enable)(device_t, bool); - int (*set_voltage)(device_t, u_int, u_int); - int (*get_voltage)(device_t, u_int *); -}; struct fdtbus_clock_controller_func { struct clk * (*decode)(device_t, int, const void *, size_t); }; -struct fdtbus_reset_controller; - -struct fdtbus_reset { - struct fdtbus_reset_controller *rst_rc; - void *rst_priv; -}; - -struct fdtbus_reset_controller_func { - void * (*acquire)(device_t, const void *, size_t); - void (*release)(device_t, void *); - int (*reset_assert)(device_t, void *); - int (*reset_deassert)(device_t, void *); -}; struct fdtbus_dai_controller_func { audio_dai_tag_t (*get_tag)(device_t, const void *, size_t); }; + struct fdtbus_dma_controller; struct fdtbus_dma { @@ -193,13 +115,58 @@ struct fdtbus_dma_controller_func { void (*halt)(device_t, void *); }; -struct fdtbus_power_controller; -struct fdtbus_power_controller_func { - void (*reset)(device_t); - void (*poweroff)(device_t); +struct fdtbus_gpio_controller; + +struct fdtbus_gpio_pin { + struct fdtbus_gpio_controller *gp_gc; + void *gp_priv; +}; + +struct fdtbus_gpio_controller_func { + void * (*acquire)(device_t, const void *, size_t, int); + void (*release)(device_t, void *); + int (*read)(device_t, void *, bool); + void (*write)(device_t, void *, int, bool); +}; + + +/* flags for fdtbus_intr_establish */ +#define FDT_INTR_MPSAFE __BIT(0) + +/* Interrupt trigger types defined by the FDT "interrupts" bindings. */ +#define FDT_INTR_TYPE_POS_EDGE __BIT(0) +#define FDT_INTR_TYPE_NEG_EDGE __BIT(1) +#define FDT_INTR_TYPE_DOUBLE_EDGE (FDT_INTR_TYPE_POS_EDGE | \ + FDT_INTR_TYPE_NEG_EDGE) +#define FDT_INTR_TYPE_HIGH_LEVEL __BIT(2) +#define FDT_INTR_TYPE_LOW_LEVEL __BIT(3) + +struct fdtbus_interrupt_controller_func { + void * (*establish)(device_t, u_int *, int, int, + int (*)(void *), void *, const char *); + void (*disestablish)(device_t, void *); + bool (*intrstr)(device_t, u_int *, char *, size_t); + void (*mask)(device_t, void *); + void (*unmask)(device_t, void *); +}; + + +struct fdtbus_iommu_func { + bus_dma_tag_t (*map)(device_t, const u_int *, bus_dma_tag_t); +}; + + +struct fdtbus_mmc_pwrseq; + +struct fdtbus_mmc_pwrseq_func { + void (*pre_power_on)(device_t); + void (*post_power_on)(device_t); + void (*power_off)(device_t); + void (*reset)(device_t); }; + struct fdtbus_phy_controller; struct fdtbus_phy { @@ -213,21
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Feb 6 15:47:06 UTC 2022 Modified Files: src/sys/dev/fdt: dwcmmc_fdt.c Log Message: fdt: dwcmmc: Honour broken-cd and non-removable DT properties To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/fdt/dwcmmc_fdt.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/dwcmmc_fdt.c diff -u src/sys/dev/fdt/dwcmmc_fdt.c:1.18 src/sys/dev/fdt/dwcmmc_fdt.c:1.19 --- src/sys/dev/fdt/dwcmmc_fdt.c:1.18 Wed Mar 24 18:19:31 2021 +++ src/sys/dev/fdt/dwcmmc_fdt.c Sun Feb 6 15:47:06 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: dwcmmc_fdt.c,v 1.18 2021/03/24 18:19:31 skrll Exp $ */ +/* $NetBSD: dwcmmc_fdt.c,v 1.19 2022/02/06 15:47:06 jmcneill Exp $ */ /*- * Copyright (c) 2015-2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.18 2021/03/24 18:19:31 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.19 2022/02/06 15:47:06 jmcneill Exp $"); #include #include @@ -167,6 +167,12 @@ dwcmmc_fdt_attach(device_t parent, devic sc->sc_intr_cardmask = esc->sc_conf->intr_cardmask; sc->sc_ciu_div = esc->sc_conf->ciu_div; sc->sc_flags = esc->sc_conf->flags; + if (of_getprop_bool(phandle, "non-removable")) { + sc->sc_flags |= DWC_MMC_F_NON_REMOVABLE; + } + if (of_getprop_bool(phandle, "broken-cd")) { + sc->sc_flags |= DWC_MMC_F_BROKEN_CD; + } sc->sc_pre_power_on = dwcmmc_fdt_pre_power_on; sc->sc_post_power_on = dwcmmc_fdt_post_power_on; sc->sc_bus_clock = dwcmmc_fdt_bus_clock;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Feb 6 15:47:06 UTC 2022 Modified Files: src/sys/dev/fdt: dwcmmc_fdt.c Log Message: fdt: dwcmmc: Honour broken-cd and non-removable DT properties To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/fdt/dwcmmc_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Sun Jan 23 08:01:33 UTC 2022 Modified Files: src/sys/dev/fdt: arasan_sdhc_fdt.c Log Message: Use __MASK(4) in bus_dmatag_subregion. NFCI. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/fdt/arasan_sdhc_fdt.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/arasan_sdhc_fdt.c diff -u src/sys/dev/fdt/arasan_sdhc_fdt.c:1.7 src/sys/dev/fdt/arasan_sdhc_fdt.c:1.8 --- src/sys/dev/fdt/arasan_sdhc_fdt.c:1.7 Mon Jan 17 14:00:47 2022 +++ src/sys/dev/fdt/arasan_sdhc_fdt.c Sun Jan 23 08:01:33 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: arasan_sdhc_fdt.c,v 1.7 2022/01/17 14:00:47 skrll Exp $ */ +/* $NetBSD: arasan_sdhc_fdt.c,v 1.8 2022/01/23 08:01:33 skrll Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_fdt.c,v 1.7 2022/01/17 14:00:47 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_fdt.c,v 1.8 2022/01/23 08:01:33 skrll Exp $"); #include #include @@ -272,7 +272,7 @@ arasan_sdhc_attach(device_t parent, devi const uint32_t caps = bus_space_read_4(sc->sc_bst, sc->sc_bsh, SDHC_CAPABILITIES); if ((caps & (SDHC_ADMA2_SUPP|SDHC_64BIT_SYS_BUS)) == SDHC_ADMA2_SUPP) { - error = bus_dmatag_subregion(faa->faa_dmat, 0, UINT32_MAX, + error = bus_dmatag_subregion(faa->faa_dmat, 0, __MASK(32), >sc_base.sc_dmat, BUS_DMA_WAITOK); if (error != 0) { aprint_error(": couldn't create DMA tag: %d\n", error);
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Sun Jan 23 08:01:33 UTC 2022 Modified Files: src/sys/dev/fdt: arasan_sdhc_fdt.c Log Message: Use __MASK(4) in bus_dmatag_subregion. NFCI. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/fdt/arasan_sdhc_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/dev/fdt
Should fix PR 56650 > Module Name: src > Committed By: macallan > Date: Fri Jan 21 21:00:26 UTC 2022 > > Modified Files: > src/sys/dev/fdt: fdt_port.c > > Log Message: > when enumerating ports and endpoints treat missing 'reg' properties as zero > ok jmcneill: > Looking at Linux. If port or endpoint are missing a 'reg' property it > defaults to 0. > Please make our code do the same. > > see > https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/graph.yaml > > with this my pinebook has a usable console again > > > To generate a diff of this commit: > cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/fdt_port.c > > Please note that diffs are not public domain; they are subject to the > copyright notices on the relevant files. >
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: macallan Date: Fri Jan 21 21:00:26 UTC 2022 Modified Files: src/sys/dev/fdt: fdt_port.c Log Message: when enumerating ports and endpoints treat missing 'reg' properties as zero ok jmcneill: Looking at Linux. If port or endpoint are missing a 'reg' property it defaults to 0. Please make our code do the same. see https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/graph.yaml with this my pinebook has a usable console again To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/fdt_port.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_port.c diff -u src/sys/dev/fdt/fdt_port.c:1.6 src/sys/dev/fdt/fdt_port.c:1.7 --- src/sys/dev/fdt/fdt_port.c:1.6 Wed Jan 1 12:46:44 2020 +++ src/sys/dev/fdt/fdt_port.c Fri Jan 21 21:00:26 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_port.c,v 1.6 2020/01/01 12:46:44 jmcneill Exp $ */ +/* $NetBSD: fdt_port.c,v 1.7 2022/01/21 21:00:26 macallan Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: fdt_port.c,v 1.6 2020/01/01 12:46:44 jmcneill Exp $"); +__KERNEL_RCSID(1, "$NetBSD: fdt_port.c,v 1.7 2022/01/21 21:00:26 macallan Exp $"); #include #include @@ -298,10 +298,10 @@ again: continue; if (fdtbus_get_reg(child, 0, , NULL) != 0) { if (ports->dp_nports > 1) -aprint_error_dev(self, +aprint_debug_dev(self, "%s: missing reg property", fdtbus_get_string(child, "name")); - id = i; + id = 0; } ports->dp_port[i].port_id = id; ports->dp_port[i].port_phandle = child; @@ -349,10 +349,10 @@ fdt_endpoints_register(int phandle, stru continue; if (fdtbus_get_reg64(child, 0, , NULL) != 0) { if (port->port_nep > 1) -aprint_error_dev(port->port_dp->dp_dev, +aprint_debug_dev(port->port_dp->dp_dev, "%s: missing reg property", fdtbus_get_string(child, "name")); - id = i; + id = 0; } ep = >port_ep[i]; ep->ep_id = id;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: macallan Date: Fri Jan 21 21:00:26 UTC 2022 Modified Files: src/sys/dev/fdt: fdt_port.c Log Message: when enumerating ports and endpoints treat missing 'reg' properties as zero ok jmcneill: Looking at Linux. If port or endpoint are missing a 'reg' property it defaults to 0. Please make our code do the same. see https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/graph.yaml with this my pinebook has a usable console again To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/fdt_port.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Mon Jan 17 14:00:47 UTC 2022 Modified Files: src/sys/dev/fdt: arasan_sdhc_fdt.c Log Message: s/0x/UINT32_MAX/ in bus_dmatag_subregion call To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/arasan_sdhc_fdt.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/arasan_sdhc_fdt.c diff -u src/sys/dev/fdt/arasan_sdhc_fdt.c:1.6 src/sys/dev/fdt/arasan_sdhc_fdt.c:1.7 --- src/sys/dev/fdt/arasan_sdhc_fdt.c:1.6 Wed Jan 27 03:10:21 2021 +++ src/sys/dev/fdt/arasan_sdhc_fdt.c Mon Jan 17 14:00:47 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: arasan_sdhc_fdt.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: arasan_sdhc_fdt.c,v 1.7 2022/01/17 14:00:47 skrll Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_fdt.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_fdt.c,v 1.7 2022/01/17 14:00:47 skrll Exp $"); #include #include @@ -272,7 +272,7 @@ arasan_sdhc_attach(device_t parent, devi const uint32_t caps = bus_space_read_4(sc->sc_bst, sc->sc_bsh, SDHC_CAPABILITIES); if ((caps & (SDHC_ADMA2_SUPP|SDHC_64BIT_SYS_BUS)) == SDHC_ADMA2_SUPP) { - error = bus_dmatag_subregion(faa->faa_dmat, 0, 0x, + error = bus_dmatag_subregion(faa->faa_dmat, 0, UINT32_MAX, >sc_base.sc_dmat, BUS_DMA_WAITOK); if (error != 0) { aprint_error(": couldn't create DMA tag: %d\n", error);
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Mon Jan 17 14:00:47 UTC 2022 Modified Files: src/sys/dev/fdt: arasan_sdhc_fdt.c Log Message: s/0x/UINT32_MAX/ in bus_dmatag_subregion call To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/arasan_sdhc_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Fri Jan 14 07:40:52 UTC 2022 Modified Files: src/sys/dev/fdt: fdtvar.h Log Message: Formatting. NFCI. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 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/fdtvar.h diff -u src/sys/dev/fdt/fdtvar.h:1.73 src/sys/dev/fdt/fdtvar.h:1.74 --- src/sys/dev/fdt/fdtvar.h:1.73 Sun Nov 7 17:13:53 2021 +++ src/sys/dev/fdt/fdtvar.h Fri Jan 14 07:40:52 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtvar.h,v 1.73 2021/11/07 17:13:53 jmcneill Exp $ */ +/* $NetBSD: fdtvar.h,v 1.74 2022/01/14 07:40:52 skrll Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -60,7 +60,7 @@ struct fdt_attach_args { }; /* flags for fdtbus_intr_establish */ -#define FDT_INTR_MPSAFE __BIT(0) +#define FDT_INTR_MPSAFE __BIT(0) /* Interrupt trigger types defined by the FDT "interrupts" bindings. */ #define FDT_INTR_TYPE_POS_EDGE __BIT(0) @@ -321,8 +321,10 @@ int fdtbus_get_phandle(int, const char int fdtbus_get_phandle_with_data(int, const char *, const char *, int, struct fdt_phandle_data *); int fdtbus_get_phandle_from_native(int); + i2c_tag_t fdtbus_get_i2c_tag(int); i2c_tag_t fdtbus_i2c_acquire(int, const char *); + void * fdtbus_intr_establish(int, u_int, int, int, int (*func)(void *), void *arg); void * fdtbus_intr_establish_xname(int, u_int, int, int, @@ -337,18 +339,24 @@ void fdtbus_intr_disestablish(int, void bool fdtbus_intr_str(int, u_int, char *, size_t); bool fdtbus_intr_str_raw(int, const u_int *, char *, size_t); int fdtbus_intr_parent(int); + int fdtbus_gpio_count(int, const char *); -struct fdtbus_gpio_pin *fdtbus_gpio_acquire(int, const char *, int); -struct fdtbus_gpio_pin *fdtbus_gpio_acquire_index(int, const char *, int, int); +struct fdtbus_gpio_pin * + fdtbus_gpio_acquire(int, const char *, int); +struct fdtbus_gpio_pin * + fdtbus_gpio_acquire_index(int, const char *, int, int); void fdtbus_gpio_release(struct fdtbus_gpio_pin *); int fdtbus_gpio_read(struct fdtbus_gpio_pin *); 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); + audio_dai_tag_t fdtbus_dai_acquire(int, const char *); audio_dai_tag_t fdtbus_dai_acquire_index(int, const char *, int); + pwm_tag_t fdtbus_pwm_acquire(int, const char *); pwm_tag_t fdtbus_pwm_acquire_index(int, const char *, int); + int fdtbus_pinctrl_set_config_index(int, u_int); int fdtbus_pinctrl_set_config(int, const char *); bool fdtbus_pinctrl_has_config(int, const char *); @@ -360,7 +368,9 @@ int fdtbus_pinctrl_parse_bias(int, int int fdtbus_pinctrl_parse_drive(int); int fdtbus_pinctrl_parse_drive_strength(int); int fdtbus_pinctrl_parse_input_output(int, int *); -struct fdtbus_regulator *fdtbus_regulator_acquire(int, const char *); + +struct fdtbus_regulator * + fdtbus_regulator_acquire(int, const char *); void fdtbus_regulator_release(struct fdtbus_regulator *); int fdtbus_regulator_enable(struct fdtbus_regulator *); int fdtbus_regulator_disable(struct fdtbus_regulator *); @@ -370,13 +380,17 @@ int fdtbus_regulator_get_voltage(struct u_int *); int fdtbus_regulator_supports_voltage(struct fdtbus_regulator *, u_int, u_int); + struct syscon * fdtbus_syscon_acquire(int, const char *); struct syscon * fdtbus_syscon_lookup(int); + bus_dma_tag_t fdtbus_iommu_map(int, u_int, bus_dma_tag_t); bus_dma_tag_t fdtbus_iommu_map_pci(int, uint32_t, bus_dma_tag_t); -struct fdtbus_dma *fdtbus_dma_get(int, const char *, void (*)(void *), void *); -struct fdtbus_dma *fdtbus_dma_get_index(int, u_int, void (*)(void *), +struct fdtbus_dma * + fdtbus_dma_get(int, const char *, void (*)(void *), void *); +struct fdtbus_dma * + fdtbus_dma_get_index(int, u_int, void (*)(void *), void *); void fdtbus_dma_put(struct fdtbus_dma *); int fdtbus_dma_transfer(struct fdtbus_dma *, @@ -391,19 +405,24 @@ u_int fdtbus_clock_count(int, const cha int fdtbus_clock_enable(int, const char *, bool); int fdtbus_clock_enable_index(int, u_int, bool); -struct fdtbus_reset *fdtbus_reset_get(int, const char *); -struct fdtbus_reset *fdtbus_reset_get_index(int, u_int); +struct fdtbus_reset * + fdtbus_reset_get(int, const char *); +struct fdtbus_reset * + fdtbus_reset_get_index(int, u_int); void fdtbus_reset_put(struct fdtbus_reset *); int fdtbus_reset_assert(struct fdtbus_reset *); int fdtbus_reset_deassert(struct fdtbus_reset *); -struct fdtbus_phy *fdtbus_phy_get(int, const char *); -struct fdtbus_phy *fdtbus_phy_get_index(int, u_int); +struct fdtbus_phy * + fdtbus_phy_get(int, const char *); +struct fdtbus_phy * + fdtbus_phy_get_index(int, u_int); void fdtbus_phy_put(struct fdtbus_phy *); device_t fdtbus_phy_device(struct fdtbus_phy *);
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Fri Jan 14 07:40:52 UTC 2022 Modified Files: src/sys/dev/fdt: fdtvar.h Log Message: Formatting. NFCI. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 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.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: mlelstv Date: Fri Jan 7 07:25:37 UTC 2022 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: Calculate the minimum address, don't assume the first entry is the start. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/fdt_memory.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_memory.c diff -u src/sys/dev/fdt/fdt_memory.c:1.3 src/sys/dev/fdt/fdt_memory.c:1.4 --- src/sys/dev/fdt/fdt_memory.c:1.3 Sat Jun 26 10:43:52 2021 +++ src/sys/dev/fdt/fdt_memory.c Fri Jan 7 07:25:37 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_memory.c,v 1.3 2021/06/26 10:43:52 jmcneill Exp $ */ +/* $NetBSD: fdt_memory.c,v 1.4 2022/01/07 07:25:37 mlelstv Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "opt_fdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.3 2021/06/26 10:43:52 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.4 2022/01/07 07:25:37 mlelstv Exp $"); #include #include @@ -90,12 +90,13 @@ fdt_memory_get(uint64_t *pstart, uint64_ index++) { fdt_memory_add_range(cur_addr, cur_size); - /* Assume the first entry is the start of memory */ if (index == 0) { *pstart = cur_addr; *pend = cur_addr + cur_size; continue; } + if (cur_addr < *pstart) + *pstart = cur_addr; if (cur_addr + cur_size > *pend) *pend = cur_addr + cur_size; }
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: mlelstv Date: Fri Jan 7 07:25:37 UTC 2022 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: Calculate the minimum address, don't assume the first entry is the start. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/fdt_memory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Fri Nov 12 21:57:44 UTC 2021 Modified Files: src/sys/dev/fdt: dw_apb_uart.c Log Message: dw_apb_uart: Honour reg-io-width property To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/fdt/dw_apb_uart.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/dw_apb_uart.c diff -u src/sys/dev/fdt/dw_apb_uart.c:1.10 src/sys/dev/fdt/dw_apb_uart.c:1.11 --- src/sys/dev/fdt/dw_apb_uart.c:1.10 Wed Jan 27 03:10:21 2021 +++ src/sys/dev/fdt/dw_apb_uart.c Fri Nov 12 21:57:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dw_apb_uart.c,v 1.10 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: dw_apb_uart.c,v 1.11 2021/11/12 21:57:44 jmcneill Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: dw_apb_uart.c,v 1.10 2021/01/27 03:10:21 thorpej Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dw_apb_uart.c,v 1.11 2021/11/12 21:57:44 jmcneill Exp $"); #include #include @@ -76,27 +76,32 @@ dw_apb_uart_attach(device_t parent, devi struct dw_apb_uart_softc * const ssc = device_private(self); struct com_softc * const sc = >ssc_sc; struct fdt_attach_args * const faa = aux; + const int phandle = faa->faa_phandle; bus_space_tag_t bst = faa->faa_bst; bus_space_handle_t bsh; char intrstr[128]; bus_addr_t addr; bus_size_t size; - u_int reg_shift; + u_int reg_shift, reg_iowidth; int error; - if (fdtbus_get_reg(faa->faa_phandle, 0, , ) != 0) { + if (fdtbus_get_reg(phandle, 0, , ) != 0) { aprint_error(": couldn't get registers\n"); return; } - if (of_getprop_uint32(faa->faa_phandle, "reg-shift", _shift)) { + if (of_getprop_uint32(phandle, "reg-shift", _shift)) { /* missing or bad reg-shift property, assume 2 */ reg_shift = 2; } + if (of_getprop_uint32(phandle, "reg-io-width", _iowidth)) { + /* missing or bad reg-io-width propery, assume 1 */ + reg_iowidth = 1; + } sc->sc_dev = self; - ssc->ssc_clk = fdtbus_clock_get_index(faa->faa_phandle, 0); + ssc->ssc_clk = fdtbus_clock_get_index(phandle, 0); if (ssc->ssc_clk == NULL) { aprint_error(": couldn't get clock\n"); return; @@ -106,13 +111,13 @@ dw_apb_uart_attach(device_t parent, devi return; } - ssc->ssc_pclk = fdtbus_clock_get(faa->faa_phandle, "apb_pclk"); + ssc->ssc_pclk = fdtbus_clock_get(phandle, "apb_pclk"); if (ssc->ssc_pclk != NULL && clk_enable(ssc->ssc_pclk) != 0) { aprint_error(": couldn't enable peripheral clock\n"); return; } - ssc->ssc_rst = fdtbus_reset_get_index(faa->faa_phandle, 0); + ssc->ssc_rst = fdtbus_reset_get_index(phandle, 0); if (ssc->ssc_rst && fdtbus_reset_deassert(ssc->ssc_rst) != 0) { aprint_error(": couldn't de-assert reset\n"); return; @@ -127,16 +132,16 @@ dw_apb_uart_attach(device_t parent, devi return; } - com_init_regs_stride(>sc_regs, bst, bsh, addr, reg_shift); + com_init_regs_stride_width(>sc_regs, bst, bsh, addr, reg_shift, reg_iowidth); com_attach_subr(sc); - if (!fdtbus_intr_str(faa->faa_phandle, 0, intrstr, sizeof(intrstr))) { + if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) { aprint_error_dev(self, "failed to decode interrupt\n"); return; } - ssc->ssc_ih = fdtbus_intr_establish_xname(faa->faa_phandle, 0, + ssc->ssc_ih = fdtbus_intr_establish_xname(phandle, 0, IPL_SERIAL, FDT_INTR_MPSAFE, comintr, sc, device_xname(self)); if (ssc->ssc_ih == NULL) { aprint_error_dev(self, "failed to establish interrupt on %s\n", @@ -164,7 +169,7 @@ dw_apb_uart_console_consinit(struct fdt_ struct com_regs regs; bus_addr_t addr; tcflag_t flags; - u_int reg_shift; + u_int reg_shift, reg_iowidth; int speed; fdtbus_get_reg(phandle, 0, , NULL); @@ -177,9 +182,13 @@ dw_apb_uart_console_consinit(struct fdt_ /* missing or bad reg-shift property, assume 2 */ reg_shift = 2; } + if (of_getprop_uint32(phandle, "reg-io-width", _iowidth)) { + /* missing or bad reg-io-width propery, assume 1 */ + reg_iowidth = 1; + } memset(_bsh, 0, sizeof(dummy_bsh)); - com_init_regs_stride(, bst, dummy_bsh, addr, reg_shift); + com_init_regs_stride_width(, bst, dummy_bsh, addr, reg_shift, reg_iowidth); if (comcnattach1(, speed, uart_freq, COM_TYPE_DW_APB, flags)) panic("Cannot initialize dw-apb-uart console");
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Fri Nov 12 21:57:44 UTC 2021 Modified Files: src/sys/dev/fdt: dw_apb_uart.c Log Message: dw_apb_uart: Honour reg-io-width property To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/fdt/dw_apb_uart.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:14:20 UTC 2021 Modified Files: src/sys/dev/fdt: dwc3_fdt.c Log Message: Look for child node by compat string snps,dwc3 instead of by name. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/fdt/dwc3_fdt.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/dwc3_fdt.c diff -u src/sys/dev/fdt/dwc3_fdt.c:1.18 src/sys/dev/fdt/dwc3_fdt.c:1.19 --- src/sys/dev/fdt/dwc3_fdt.c:1.18 Tue Sep 14 22:00:11 2021 +++ src/sys/dev/fdt/dwc3_fdt.c Sun Nov 7 17:14:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc3_fdt.c,v 1.18 2021/09/14 22:00:11 jmcneill Exp $ */ +/* $NetBSD: dwc3_fdt.c,v 1.19 2021/11/07 17:14:20 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.18 2021/09/14 22:00:11 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.19 2021/11/07 17:14:20 jmcneill Exp $"); #include #include @@ -244,7 +244,10 @@ dwc3_fdt_attach(device_t parent, device_ /* Find dwc3 sub-node */ if (of_compatible_lookup(phandle, compat_data_dwc3) == NULL) { - dwc3_phandle = of_find_firstchild_byname(phandle, "dwc3"); + dwc3_phandle = of_find_bycompat(phandle, "snps,dwc3"); + if (dwc3_phandle <= 0) { + dwc3_phandle = of_find_firstchild_byname(phandle, "dwc3"); + } } else { dwc3_phandle = phandle; }
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:14:20 UTC 2021 Modified Files: src/sys/dev/fdt: dwc3_fdt.c Log Message: Look for child node by compat string snps,dwc3 instead of by name. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/fdt/dwc3_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:14:09 UTC 2021 Modified Files: src/sys/dev/fdt: pwm_backlight.c Log Message: pwm_backlight: pick defaults if none are provided To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/fdt/pwm_backlight.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/pwm_backlight.c diff -u src/sys/dev/fdt/pwm_backlight.c:1.9 src/sys/dev/fdt/pwm_backlight.c:1.10 --- src/sys/dev/fdt/pwm_backlight.c:1.9 Wed Jan 27 03:10:21 2021 +++ src/sys/dev/fdt/pwm_backlight.c Sun Nov 7 17:14:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pwm_backlight.c,v 1.9 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: pwm_backlight.c,v 1.10 2021/11/07 17:14:09 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pwm_backlight.c,v 1.9 2021/01/27 03:10:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pwm_backlight.c,v 1.10 2021/11/07 17:14:09 jmcneill Exp $"); #include #include @@ -86,7 +86,7 @@ pwm_backlight_attach(device_t parent, de struct fdt_attach_args * const faa = aux; const int phandle = faa->faa_phandle; const u_int *levels; - u_int default_level; + u_int default_level = 0; u_int n; int len; @@ -107,14 +107,18 @@ pwm_backlight_attach(device_t parent, de } levels = fdtbus_get_prop(phandle, "brightness-levels", ); - if (len < 4) { - aprint_error(": couldn't get 'brightness-levels' property\n"); - return; + if (levels != NULL) { + sc->sc_nlevels = len / 4; + sc->sc_levels = kmem_alloc(len, KM_SLEEP); + for (n = 0; n < sc->sc_nlevels; n++) + sc->sc_levels[n] = be32toh(levels[n]); + } else { + sc->sc_nlevels = 256; + sc->sc_levels = kmem_alloc(sc->sc_nlevels * 4, KM_SLEEP); + for (n = 0; n < sc->sc_nlevels; n++) + sc->sc_levels[n] = n; + default_level = 200; } - sc->sc_levels = kmem_alloc(len, KM_SLEEP); - sc->sc_nlevels = len / 4; - for (n = 0; n < sc->sc_nlevels; n++) - sc->sc_levels[n] = be32toh(levels[n]); aprint_naive("\n"); aprint_normal(": PWM Backlight"); @@ -127,7 +131,8 @@ pwm_backlight_attach(device_t parent, de sc->sc_lid_state = true; - if (of_getprop_uint32(phandle, "default-brightness-level", _level) == 0) { + of_getprop_uint32(phandle, "default-brightness-level", _level); + if (default_level != 0) { /* set the default level now */ pwm_backlight_set(sc, default_level, true); }
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:14:09 UTC 2021 Modified Files: src/sys/dev/fdt: pwm_backlight.c Log Message: pwm_backlight: pick defaults if none are provided To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/fdt/pwm_backlight.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:13:53 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_intr.c fdtvar.h Log Message: fdt: add helper for finding intr parent phandle To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/fdt/fdt_intr.c cvs rdiff -u -r1.72 -r1.73 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_intr.c diff -u src/sys/dev/fdt/fdt_intr.c:1.29 src/sys/dev/fdt/fdt_intr.c:1.30 --- src/sys/dev/fdt/fdt_intr.c:1.29 Fri Jan 15 22:59:49 2021 +++ src/sys/dev/fdt/fdt_intr.c Sun Nov 7 17:13:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_intr.c,v 1.29 2021/01/15 22:59:49 jmcneill Exp $ */ +/* $NetBSD: fdt_intr.c,v 1.30 2021/11/07 17:13:53 jmcneill Exp $ */ /*- * Copyright (c) 2015-2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.29 2021/01/15 22:59:49 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.30 2021/11/07 17:13:53 jmcneill Exp $"); #include #include @@ -177,6 +177,12 @@ fdtbus_put_interrupt_cookie(struct fdtbu mutex_exit(_interrupt_cookie_mutex); } +int +fdtbus_intr_parent(int phandle) +{ + return fdtbus_get_interrupt_parent(phandle); +} + void * fdtbus_intr_establish(int phandle, u_int index, int ipl, int flags, int (*func)(void *), void *arg) Index: src/sys/dev/fdt/fdtvar.h diff -u src/sys/dev/fdt/fdtvar.h:1.72 src/sys/dev/fdt/fdtvar.h:1.73 --- src/sys/dev/fdt/fdtvar.h:1.72 Mon Sep 6 14:03:18 2021 +++ src/sys/dev/fdt/fdtvar.h Sun Nov 7 17:13:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtvar.h,v 1.72 2021/09/06 14:03:18 jmcneill Exp $ */ +/* $NetBSD: fdtvar.h,v 1.73 2021/11/07 17:13:53 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -336,6 +336,7 @@ void fdtbus_intr_unmask(int, void *); void fdtbus_intr_disestablish(int, void *); bool fdtbus_intr_str(int, u_int, char *, size_t); bool fdtbus_intr_str_raw(int, const u_int *, char *, size_t); +int fdtbus_intr_parent(int); int fdtbus_gpio_count(int, const char *); struct fdtbus_gpio_pin *fdtbus_gpio_acquire(int, const char *, int); struct fdtbus_gpio_pin *fdtbus_gpio_acquire_index(int, const char *, int, int);
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:13:53 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_intr.c fdtvar.h Log Message: fdt: add helper for finding intr parent phandle To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/fdt/fdt_intr.c cvs rdiff -u -r1.72 -r1.73 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.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:12:26 UTC 2021 Modified Files: src/sys/dev/fdt: pinctrl_single.c Log Message: pinctrl-single: support #pinctrl-cells 2 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/pinctrl_single.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/pinctrl_single.c diff -u src/sys/dev/fdt/pinctrl_single.c:1.5 src/sys/dev/fdt/pinctrl_single.c:1.6 --- src/sys/dev/fdt/pinctrl_single.c:1.5 Wed Jan 27 03:10:21 2021 +++ src/sys/dev/fdt/pinctrl_single.c Sun Nov 7 17:12:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pinctrl_single.c,v 1.5 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: pinctrl_single.c,v 1.6 2021/11/07 17:12:25 jmcneill Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pinctrl_single.c,v 1.5 2021/01/27 03:10:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pinctrl_single.c,v 1.6 2021/11/07 17:12:25 jmcneill Exp $"); #include #include @@ -110,7 +110,7 @@ pinctrl_single_pins_set_config(device_t const u_int *pins; int pinslen; - if (len != 4) + if (len != 4 && len != 8) return -1; const int phandle = fdtbus_get_phandle_from_native(be32dec(data)); @@ -119,13 +119,14 @@ pinctrl_single_pins_set_config(device_t if (pins == NULL) return -1; - while (pinslen >= 8) { + while (pinslen >= 4 + len) { const int off = be32toh(pins[0]); const int val = be32toh(pins[1]); + const int mux = len == 4 ? 0 : be32toh(pins[2]); - pinctrl_single_pins_write(sc, off, val); - pins += 2; - pinslen -= 8; + pinctrl_single_pins_write(sc, off, val | mux); + pins += 1 + (len / 4); + pinslen -= (4 + len); } return 0;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:12:26 UTC 2021 Modified Files: src/sys/dev/fdt: pinctrl_single.c Log Message: pinctrl-single: support #pinctrl-cells 2 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/pinctrl_single.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:12:16 UTC 2021 Modified Files: src/sys/dev/fdt: fdtbus.c Log Message: fdtbus: match simple-pm-bus To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/fdt/fdtbus.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/fdtbus.c diff -u src/sys/dev/fdt/fdtbus.c:1.43 src/sys/dev/fdt/fdtbus.c:1.44 --- src/sys/dev/fdt/fdtbus.c:1.43 Mon Sep 6 14:03:18 2021 +++ src/sys/dev/fdt/fdtbus.c Sun Nov 7 17:12:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtbus.c,v 1.43 2021/09/06 14:03:18 jmcneill Exp $ */ +/* $NetBSD: fdtbus.c,v 1.44 2021/11/07 17:12:15 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.43 2021/09/06 14:03:18 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.44 2021/11/07 17:12:15 jmcneill Exp $"); #include #include @@ -89,6 +89,7 @@ static void fdt_post_attach(struct fdt_n static const struct device_compatible_entry compat_data[] = { { .compat = "simple-bus" }, + { .compat = "simple-pm-bus" }, DEVICE_COMPAT_EOL };
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Nov 7 17:12:16 UTC 2021 Modified Files: src/sys/dev/fdt: fdtbus.c Log Message: fdtbus: match simple-pm-bus To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/fdt/fdtbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Tue Sep 14 22:00:11 UTC 2021 Modified Files: src/sys/dev/fdt: dwc3_fdt.c Log Message: Remove "no IOMMU" hack. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/fdt/dwc3_fdt.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/dwc3_fdt.c diff -u src/sys/dev/fdt/dwc3_fdt.c:1.17 src/sys/dev/fdt/dwc3_fdt.c:1.18 --- src/sys/dev/fdt/dwc3_fdt.c:1.17 Mon Aug 30 22:49:42 2021 +++ src/sys/dev/fdt/dwc3_fdt.c Tue Sep 14 22:00:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc3_fdt.c,v 1.17 2021/08/30 22:49:42 jmcneill Exp $ */ +/* $NetBSD: dwc3_fdt.c,v 1.18 2021/09/14 22:00:11 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.17 2021/08/30 22:49:42 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.18 2021/09/14 22:00:11 jmcneill Exp $"); #include #include @@ -242,12 +242,6 @@ dwc3_fdt_attach(device_t parent, device_ void *ih; u_int n; - /* XXX IOMMUs not supported yet */ - if (of_hasprop(phandle, "iommus")) { - aprint_error(": devices behind IOMMUs not supported\n"); - return; - } - /* Find dwc3 sub-node */ if (of_compatible_lookup(phandle, compat_data_dwc3) == NULL) { dwc3_phandle = of_find_firstchild_byname(phandle, "dwc3");
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Tue Sep 14 22:00:11 UTC 2021 Modified Files: src/sys/dev/fdt: dwc3_fdt.c Log Message: Remove "no IOMMU" hack. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/fdt/dwc3_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sat Sep 4 12:34:39 UTC 2021 Modified Files: src/sys/dev/fdt: fdtvar.h files.fdt Added Files: src/sys/dev/fdt: fdt_iommu.c Log Message: Add facility for registering iommus. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/fdt_iommu.c cvs rdiff -u -r1.70 -r1.71 src/sys/dev/fdt/fdtvar.h cvs rdiff -u -r1.61 -r1.62 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.70 src/sys/dev/fdt/fdtvar.h:1.71 --- src/sys/dev/fdt/fdtvar.h:1.70 Sat Apr 24 23:36:53 2021 +++ src/sys/dev/fdt/fdtvar.h Sat Sep 4 12:34:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtvar.h,v 1.70 2021/04/24 23:36:53 thorpej Exp $ */ +/* $NetBSD: fdtvar.h,v 1.71 2021/09/04 12:34:39 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -108,6 +108,10 @@ struct fdtbus_pinctrl_controller_func { int (*set_config)(device_t, const void *, size_t); }; +struct fdtbus_iommu_func { + bus_dma_tag_t (*map)(device_t, const u_int *, bus_dma_tag_t); +}; + struct fdtbus_regulator_controller; struct fdtbus_regulator { @@ -299,6 +303,8 @@ int fdtbus_register_pwm_controller(devi int fdtbus_register_mmc_pwrseq(device_t, int, const struct fdtbus_mmc_pwrseq_func *); int fdtbus_register_syscon(device_t, int, struct syscon *); +int fdtbus_register_iommu(device_t, int, + const struct fdtbus_iommu_func *); void fdtbus_set_decoderegprop(bool); @@ -363,6 +369,8 @@ int fdtbus_regulator_supports_voltage(s u_int, u_int); struct syscon * fdtbus_syscon_acquire(int, const char *); struct syscon * fdtbus_syscon_lookup(int); +bus_dma_tag_t fdtbus_iommu_map(int, u_int, bus_dma_tag_t); +bus_dma_tag_t fdtbus_iommu_map_pci(int, uint32_t, bus_dma_tag_t); struct fdtbus_dma *fdtbus_dma_get(int, const char *, void (*)(void *), void *); struct fdtbus_dma *fdtbus_dma_get_index(int, u_int, void (*)(void *), Index: src/sys/dev/fdt/files.fdt diff -u src/sys/dev/fdt/files.fdt:1.61 src/sys/dev/fdt/files.fdt:1.62 --- src/sys/dev/fdt/files.fdt:1.61 Mon Apr 26 15:02:29 2021 +++ src/sys/dev/fdt/files.fdt Sat Sep 4 12:34:39 2021 @@ -1,4 +1,4 @@ -# $NetBSD: files.fdt,v 1.61 2021/04/26 15:02:29 thorpej Exp $ +# $NetBSD: files.fdt,v 1.62 2021/09/04 12:34:39 jmcneill Exp $ include "external/bsd/libfdt/conf/files.libfdt" @@ -72,6 +72,7 @@ file dev/fdt/fdt_dma.c fdt file dev/fdt/fdt_ddb.c fdt & ddb file dev/fdt/fdt_gpio.c fdt file dev/fdt/fdt_i2c.c fdt +file dev/fdt/fdt_iommu.c fdt file dev/fdt/fdt_intr.c fdt file dev/fdt/fdt_mmc_pwrseq.c fdt file dev/fdt/fdt_phy.c fdt Added files: Index: src/sys/dev/fdt/fdt_iommu.c diff -u /dev/null src/sys/dev/fdt/fdt_iommu.c:1.1 --- /dev/null Sat Sep 4 12:34:39 2021 +++ src/sys/dev/fdt/fdt_iommu.c Sat Sep 4 12:34:39 2021 @@ -0,0 +1,206 @@ +/* $NetBSD: fdt_iommu.c,v 1.1 2021/09/04 12:34:39 jmcneill Exp $ */ + +/*- + * Copyright (c) 2021 Jared 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 +__KERNEL_RCSID(0, "$NetBSD: fdt_iommu.c,v 1.1 2021/09/04 12:34:39 jmcneill Exp $"); + +#include +#include +#include +#include + +#include +#include + +struct fdtbus_iommu { + device_t iommu_dev; + intiommu_phandle; + const struct fdtbus_iommu_func *iommu_funcs; + u_intiommu_cells; + LIST_ENTRY(fdtbus_iommu) iommu_next; +}; + +static LIST_HEAD(, fdtbus_iommu) fdtbus_iommus = +LIST_HEAD_INITIALIZER(fdtbus_iommus); + +/* + * fdtbus_get_iommu -- + * + * Return the iommu registered with the specified node, or NULL if + * not found. + */ +static struct
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sat Sep 4 12:34:39 UTC 2021 Modified Files: src/sys/dev/fdt: fdtvar.h files.fdt Added Files: src/sys/dev/fdt: fdt_iommu.c Log Message: Add facility for registering iommus. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/fdt_iommu.c cvs rdiff -u -r1.70 -r1.71 src/sys/dev/fdt/fdtvar.h cvs rdiff -u -r1.61 -r1.62 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.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Mon Aug 30 22:49:42 UTC 2021 Modified Files: src/sys/dev/fdt: dwc3_fdt.c Log Message: Until we have proper FDT iommu support, refuse to attach when an iommu is required. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/fdt/dwc3_fdt.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/dwc3_fdt.c diff -u src/sys/dev/fdt/dwc3_fdt.c:1.16 src/sys/dev/fdt/dwc3_fdt.c:1.17 --- src/sys/dev/fdt/dwc3_fdt.c:1.16 Sat Aug 7 16:19:10 2021 +++ src/sys/dev/fdt/dwc3_fdt.c Mon Aug 30 22:49:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc3_fdt.c,v 1.16 2021/08/07 16:19:10 thorpej Exp $ */ +/* $NetBSD: dwc3_fdt.c,v 1.17 2021/08/30 22:49:42 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.16 2021/08/07 16:19:10 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.17 2021/08/30 22:49:42 jmcneill Exp $"); #include #include @@ -242,6 +242,12 @@ dwc3_fdt_attach(device_t parent, device_ void *ih; u_int n; + /* XXX IOMMUs not supported yet */ + if (of_hasprop(phandle, "iommus")) { + aprint_error(": devices behind IOMMUs not supported\n"); + return; + } + /* Find dwc3 sub-node */ if (of_compatible_lookup(phandle, compat_data_dwc3) == NULL) { dwc3_phandle = of_find_firstchild_byname(phandle, "dwc3");
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Mon Aug 30 22:49:42 UTC 2021 Modified Files: src/sys/dev/fdt: dwc3_fdt.c Log Message: Until we have proper FDT iommu support, refuse to attach when an iommu is required. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/fdt/dwc3_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Aug 8 15:23:42 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_regulator.c Log Message: fdt: regulator: pre-allocate regulator handle Workaround for PR# port-evbarm/54664 To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/fdt/fdt_regulator.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_regulator.c diff -u src/sys/dev/fdt/fdt_regulator.c:1.8 src/sys/dev/fdt/fdt_regulator.c:1.9 --- src/sys/dev/fdt/fdt_regulator.c:1.8 Mon May 27 23:18:33 2019 +++ src/sys/dev/fdt/fdt_regulator.c Sun Aug 8 15:23:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_regulator.c,v 1.8 2019/05/27 23:18:33 jmcneill Exp $ */ +/* $NetBSD: fdt_regulator.c,v 1.9 2021/08/08 15:23:42 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_regulator.c,v 1.8 2019/05/27 23:18:33 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_regulator.c,v 1.9 2021/08/08 15:23:42 jmcneill Exp $"); #include #include @@ -37,6 +37,9 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_regulato #include #include +#define REGULATOR_TO_RC(_reg) \ + container_of((_reg), struct fdtbus_regulator_controller, rc_reg) + struct fdtbus_regulator_controller { device_t rc_dev; int rc_phandle; @@ -44,6 +47,8 @@ struct fdtbus_regulator_controller { u_int rc_enable_ramp_delay; + struct fdtbus_regulator rc_reg; /* handle returned by acquire() */ + LIST_ENTRY(fdtbus_regulator_controller) rc_next; }; @@ -60,6 +65,7 @@ fdtbus_register_regulator_controller(dev rc->rc_dev = dev; rc->rc_phandle = phandle; rc->rc_funcs = funcs; + rc->rc_reg.reg_rc = rc; of_getprop_uint32(phandle, "regulator-enable-ramp-delay", >rc_enable_ramp_delay); @@ -85,7 +91,6 @@ struct fdtbus_regulator * fdtbus_regulator_acquire(int phandle, const char *prop) { struct fdtbus_regulator_controller *rc; - struct fdtbus_regulator *reg; int regulator_phandle; int error; @@ -105,26 +110,21 @@ fdtbus_regulator_acquire(int phandle, co return NULL; } - reg = kmem_alloc(sizeof(*reg), KM_SLEEP); - reg->reg_rc = rc; - - return reg; + return >rc_reg; } void fdtbus_regulator_release(struct fdtbus_regulator *reg) { - struct fdtbus_regulator_controller *rc = reg->reg_rc; + struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg); rc->rc_funcs->release(rc->rc_dev); - - kmem_free(reg, sizeof(*reg)); } int fdtbus_regulator_enable(struct fdtbus_regulator *reg) { - struct fdtbus_regulator_controller *rc = reg->reg_rc; + struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg); int error; error = rc->rc_funcs->enable(rc->rc_dev, true); @@ -140,7 +140,7 @@ fdtbus_regulator_enable(struct fdtbus_re int fdtbus_regulator_disable(struct fdtbus_regulator *reg) { - struct fdtbus_regulator_controller *rc = reg->reg_rc; + struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg); if (of_hasprop(rc->rc_phandle, "regulator-always-on")) return EIO; @@ -152,7 +152,7 @@ int fdtbus_regulator_set_voltage(struct fdtbus_regulator *reg, u_int min_uvol, u_int max_uvol) { - struct fdtbus_regulator_controller *rc = reg->reg_rc; + struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg); if (rc->rc_funcs->set_voltage == NULL) return EINVAL; @@ -163,7 +163,7 @@ fdtbus_regulator_set_voltage(struct fdtb int fdtbus_regulator_get_voltage(struct fdtbus_regulator *reg, u_int *puvol) { - struct fdtbus_regulator_controller *rc = reg->reg_rc; + struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg); if (rc->rc_funcs->get_voltage == NULL) return EINVAL; @@ -175,7 +175,7 @@ int fdtbus_regulator_supports_voltage(struct fdtbus_regulator *reg, u_int min_uvol, u_int max_uvol) { - struct fdtbus_regulator_controller *rc = reg->reg_rc; + struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg); u_int uvol; if (rc->rc_funcs->set_voltage == NULL)
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Aug 8 15:23:42 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_regulator.c Log Message: fdt: regulator: pre-allocate regulator handle Workaround for PR# port-evbarm/54664 To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/fdt/fdt_regulator.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sat Jun 26 10:43:52 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: Fix 32-bit build. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/fdt_memory.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_memory.c diff -u src/sys/dev/fdt/fdt_memory.c:1.2 src/sys/dev/fdt/fdt_memory.c:1.3 --- src/sys/dev/fdt/fdt_memory.c:1.2 Fri Jun 25 08:41:09 2021 +++ src/sys/dev/fdt/fdt_memory.c Sat Jun 26 10:43:52 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_memory.c,v 1.2 2021/06/25 08:41:09 ryo Exp $ */ +/* $NetBSD: fdt_memory.c,v 1.3 2021/06/26 10:43:52 jmcneill Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "opt_fdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.2 2021/06/25 08:41:09 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.3 2021/06/26 10:43:52 jmcneill Exp $"); #include #include @@ -110,11 +110,12 @@ void fdt_memory_remove_reserved(uint64_t min_addr, uint64_t max_addr) { uint64_t lstart = 0, lend = 0; - uint64_t addr, size; int index, error, phandle, child; const int num = fdt_num_mem_rsv(fdtbus_get_data()); for (index = 0; index <= num; index++) { + uint64_t addr, size; + error = fdt_get_mem_rsv(fdtbus_get_data(), index, , ); if (error != 0) @@ -147,6 +148,9 @@ fdt_memory_remove_reserved(uint64_t min_ phandle = OF_finddevice("/reserved-memory"); if (phandle != -1) { for (child = OF_child(phandle); child; child = OF_peer(child)) { + bus_addr_t addr; + bus_size_t size; + if (!of_hasprop(child, "no-map")) continue;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sat Jun 26 10:43:52 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: Fix 32-bit build. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/fdt_memory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Fri Jun 25 08:41:09 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: fdt "/reserved-memory" node should be handled To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_memory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Fri Jun 25 08:41:09 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: fdt "/reserved-memory" node should be handled To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_memory.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_memory.c diff -u src/sys/dev/fdt/fdt_memory.c:1.1 src/sys/dev/fdt/fdt_memory.c:1.2 --- src/sys/dev/fdt/fdt_memory.c:1.1 Sat Dec 12 09:27:31 2020 +++ src/sys/dev/fdt/fdt_memory.c Fri Jun 25 08:41:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_memory.c,v 1.1 2020/12/12 09:27:31 skrll Exp $ */ +/* $NetBSD: fdt_memory.c,v 1.2 2021/06/25 08:41:09 ryo Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "opt_fdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.1 2020/12/12 09:27:31 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.2 2021/06/25 08:41:09 ryo Exp $"); #include #include @@ -111,7 +111,7 @@ fdt_memory_remove_reserved(uint64_t min_ { uint64_t lstart = 0, lend = 0; uint64_t addr, size; - int index, error; + int index, error, phandle, child; const int num = fdt_num_mem_rsv(fdtbus_get_data()); for (index = 0; index <= num; index++) { @@ -139,6 +139,24 @@ fdt_memory_remove_reserved(uint64_t min_ lstart = addr; lend = addr + size; } + + /* + * "no-map" ranges defined in the /reserved-memory node + * must also be excluded. + */ + phandle = OF_finddevice("/reserved-memory"); + if (phandle != -1) { + for (child = OF_child(phandle); child; child = OF_peer(child)) { + if (!of_hasprop(child, "no-map")) +continue; + + if (fdtbus_get_reg(child, 0, , ) != 0) +continue; + if (size == 0) +continue; + fdt_memory_remove_range(addr, size); + } + } } void
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Tue May 18 11:13:31 UTC 2021 Modified Files: src/sys/dev/fdt: dwc3_fdt.c Log Message: Unbreak previous; we have to look for a child node iff our node isn't compatible with snps,dwc3. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/fdt/dwc3_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Tue May 18 11:13:31 UTC 2021 Modified Files: src/sys/dev/fdt: dwc3_fdt.c Log Message: Unbreak previous; we have to look for a child node iff our node isn't compatible with snps,dwc3. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/fdt/dwc3_fdt.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/dwc3_fdt.c diff -u src/sys/dev/fdt/dwc3_fdt.c:1.14 src/sys/dev/fdt/dwc3_fdt.c:1.15 --- src/sys/dev/fdt/dwc3_fdt.c:1.14 Sat Apr 24 23:36:53 2021 +++ src/sys/dev/fdt/dwc3_fdt.c Tue May 18 11:13:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc3_fdt.c,v 1.14 2021/04/24 23:36:53 thorpej Exp $ */ +/* $NetBSD: dwc3_fdt.c,v 1.15 2021/05/18 11:13:31 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.14 2021/04/24 23:36:53 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.15 2021/05/18 11:13:31 jmcneill Exp $"); #include #include @@ -203,14 +203,18 @@ dwc3_fdt_set_mode(struct xhci_softc *sc, } static const struct device_compatible_entry compat_data[] = { - /* 1 = parent of dwc3 subnode */ - { .compat = "allwinner,sun50i-h6-dwc3", .value = 1 }, - { .compat = "amlogic,meson-gxl-dwc3", .value = 1 }, - { .compat = "fsl,imx8mq-dwc3", .value = 1 }, - { .compat = "rockchip,rk3328-dwc3", .value = 1 }, - { .compat = "rockchip,rk3399-dwc3", .value = 1 }, - { .compat = "samsung,exynos5250-dwusb3", .value = 1 }, - { .compat = "snps,dwc3", .value = 0 }, + { .compat = "allwinner,sun50i-h6-dwc3" }, + { .compat = "amlogic,meson-gxl-dwc3" }, + { .compat = "fsl,imx8mq-dwc3" }, + { .compat = "rockchip,rk3328-dwc3" }, + { .compat = "rockchip,rk3399-dwc3" }, + { .compat = "samsung,exynos5250-dwusb3" }, + { .compat = "snps,dwc3" }, + DEVICE_COMPAT_EOL +}; + +static const struct device_compatible_entry compat_data_dwc3[] = { + { .compat = "snps,dwc3" }, DEVICE_COMPAT_EOL }; @@ -228,7 +232,6 @@ dwc3_fdt_attach(device_t parent, device_ struct xhci_softc * const sc = device_private(self); struct fdt_attach_args * const faa = aux; const int phandle = faa->faa_phandle; - const struct device_compatible_entry *dce; struct fdtbus_reset *rst; struct fdtbus_phy *phy; struct clk *clk; @@ -239,11 +242,8 @@ dwc3_fdt_attach(device_t parent, device_ void *ih; u_int n; - dce = of_compatible_lookup(phandle, compat_data); - KASSERT(dce != NULL); - /* Find dwc3 sub-node */ - if (dce->value != 0) { + if (of_compatible_lookup(phandle, compat_data_dwc3) == NULL) { dwc3_phandle = of_find_firstchild_byname(phandle, "dwc3"); } else { dwc3_phandle = phandle;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: thorpej Date: Mon Apr 26 15:02:29 UTC 2021 Modified Files: src/sys/dev/fdt: files.fdt Log Message: simplebus, cpus, and syscon do not need their own interface attribute; they use the "fdt" interface attribute to attach children. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 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/files.fdt diff -u src/sys/dev/fdt/files.fdt:1.60 src/sys/dev/fdt/files.fdt:1.61 --- src/sys/dev/fdt/files.fdt:1.60 Thu Dec 31 15:12:33 2020 +++ src/sys/dev/fdt/files.fdt Mon Apr 26 15:02:29 2021 @@ -1,4 +1,4 @@ -# $NetBSD: files.fdt,v 1.60 2020/12/31 15:12:33 ryo Exp $ +# $NetBSD: files.fdt,v 1.61 2021/04/26 15:02:29 thorpej Exp $ include "external/bsd/libfdt/conf/files.libfdt" @@ -9,7 +9,7 @@ defparam opt_fdt.hFDT_DEFAULT_STDOUT define fdt { [pass = 10] } : clk, pwm -device simplebus { } : fdt +device simplebus: fdt attach simplebus at fdt file dev/fdt/fdtbus.c fdt @@ -84,7 +84,7 @@ file dev/fdt/fdt_spi.c fdt file dev/fdt/fdt_syscon.c fdt file dev/fdt/fdt_pinctrl.c fdt -device cpus { } : fdt +device cpus: fdt attach cpus at fdt file dev/fdt/cpus.ccpus @@ -94,7 +94,7 @@ file dev/fdt/mmc_pwrseq_simple.c mmcpwr attach mmcpwrseq at fdt with mmcpwrseq_emmc file dev/fdt/mmc_pwrseq_emmc.c mmcpwrseq_emmc -device syscon { } : fdt +device syscon: fdt attach syscon at fdt file dev/fdt/syscon.c syscon
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: thorpej Date: Mon Apr 26 15:02:29 UTC 2021 Modified Files: src/sys/dev/fdt: files.fdt Log Message: simplebus, cpus, and syscon do not need their own interface attribute; they use the "fdt" interface attribute to attach children. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 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.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Wed Mar 24 18:19:31 UTC 2021 Modified Files: src/sys/dev/fdt: dwcmmc_fdt.c Log Message: Fix previous To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/fdt/dwcmmc_fdt.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/dwcmmc_fdt.c diff -u src/sys/dev/fdt/dwcmmc_fdt.c:1.17 src/sys/dev/fdt/dwcmmc_fdt.c:1.18 --- src/sys/dev/fdt/dwcmmc_fdt.c:1.17 Tue Mar 23 22:27:38 2021 +++ src/sys/dev/fdt/dwcmmc_fdt.c Wed Mar 24 18:19:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dwcmmc_fdt.c,v 1.17 2021/03/23 22:27:38 jmcneill Exp $ */ +/* $NetBSD: dwcmmc_fdt.c,v 1.18 2021/03/24 18:19:31 skrll Exp $ */ /*- * Copyright (c) 2015-2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.17 2021/03/23 22:27:38 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.18 2021/03/24 18:19:31 skrll Exp $"); #include #include @@ -66,7 +66,7 @@ static const struct dwcmmc_fdt_config dw .intr_cardmask = __BIT(24), }; -static const struct dwmmc_fdt_config dwmmc_default_config = { +static const struct dwcmmc_fdt_config dwmmc_default_config = { .flags = DWC_MMC_F_USE_HOLD_REG | DWC_MMC_F_DMA, }; @@ -164,7 +164,7 @@ dwcmmc_fdt_attach(device_t parent, devic sc->sc_bus_width = 4; sc->sc_fifo_depth = fifo_depth; - sc->sc_entr_cardmask = esc->sc_conf->intr_cardmask; + sc->sc_intr_cardmask = esc->sc_conf->intr_cardmask; sc->sc_ciu_div = esc->sc_conf->ciu_div; sc->sc_flags = esc->sc_conf->flags; sc->sc_pre_power_on = dwcmmc_fdt_pre_power_on;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Wed Mar 24 18:19:31 UTC 2021 Modified Files: src/sys/dev/fdt: dwcmmc_fdt.c Log Message: Fix previous To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/fdt/dwcmmc_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Tue Mar 23 22:27:38 UTC 2021 Modified Files: src/sys/dev/fdt: dwcmmc_fdt.c Log Message: Match generic "snps,dw-mshc" compat string as found in BeagleV. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/fdt/dwcmmc_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Tue Mar 23 22:27:38 UTC 2021 Modified Files: src/sys/dev/fdt: dwcmmc_fdt.c Log Message: Match generic "snps,dw-mshc" compat string as found in BeagleV. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/fdt/dwcmmc_fdt.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/dwcmmc_fdt.c diff -u src/sys/dev/fdt/dwcmmc_fdt.c:1.16 src/sys/dev/fdt/dwcmmc_fdt.c:1.17 --- src/sys/dev/fdt/dwcmmc_fdt.c:1.16 Wed Jan 27 03:10:21 2021 +++ src/sys/dev/fdt/dwcmmc_fdt.c Tue Mar 23 22:27:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dwcmmc_fdt.c,v 1.16 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: dwcmmc_fdt.c,v 1.17 2021/03/23 22:27:38 jmcneill Exp $ */ /*- * Copyright (c) 2015-2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.16 2021/01/27 03:10:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.17 2021/03/23 22:27:38 jmcneill Exp $"); #include #include @@ -66,8 +66,14 @@ static const struct dwcmmc_fdt_config dw .intr_cardmask = __BIT(24), }; +static const struct dwmmc_fdt_config dwmmc_default_config = { + .flags = DWC_MMC_F_USE_HOLD_REG | + DWC_MMC_F_DMA, +}; + static const struct device_compatible_entry compat_data[] = { { .compat = "rockchip,rk3288-dw-mshc", .data = _rk3288_config }, + { .compat = "snps,dw-mshc", .data = _default_config }, DEVICE_COMPAT_EOL }; @@ -158,7 +164,7 @@ dwcmmc_fdt_attach(device_t parent, devic sc->sc_bus_width = 4; sc->sc_fifo_depth = fifo_depth; - sc->sc_intr_cardmask = esc->sc_conf->intr_cardmask; + sc->sc_entr_cardmask = esc->sc_conf->intr_cardmask; sc->sc_ciu_div = esc->sc_conf->ciu_div; sc->sc_flags = esc->sc_conf->flags; sc->sc_pre_power_on = dwcmmc_fdt_pre_power_on;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: mlelstv Date: Mon Mar 8 13:15:06 UTC 2021 Modified Files: src/sys/dev/fdt: genet_fdt.c Log Message: Interrupt no longer needs kernel lock. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/genet_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: mlelstv Date: Mon Mar 8 13:15:06 UTC 2021 Modified Files: src/sys/dev/fdt: genet_fdt.c Log Message: Interrupt no longer needs kernel lock. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/genet_fdt.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/genet_fdt.c diff -u src/sys/dev/fdt/genet_fdt.c:1.4 src/sys/dev/fdt/genet_fdt.c:1.5 --- src/sys/dev/fdt/genet_fdt.c:1.4 Wed Jan 27 03:10:21 2021 +++ src/sys/dev/fdt/genet_fdt.c Mon Mar 8 13:15:06 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: genet_fdt.c,v 1.4 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: genet_fdt.c,v 1.5 2021/03/08 13:15:06 mlelstv Exp $ */ /*- * Copyright (c) 2020 Jared McNeill @@ -29,7 +29,7 @@ #include "opt_net_mpsafe.h" #include -__KERNEL_RCSID(0, "$NetBSD: genet_fdt.c,v 1.4 2021/01/27 03:10:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genet_fdt.c,v 1.5 2021/03/08 13:15:06 mlelstv Exp $"); #include #include @@ -126,7 +126,7 @@ genet_fdt_attach(device_t parent, device if (genet_attach(sc) != 0) return; - ih = fdtbus_intr_establish_xname(phandle, 0, IPL_NET, FDT_INTR_FLAGS, + ih = fdtbus_intr_establish_xname(phandle, 0, IPL_NET, FDT_INTR_MPSAFE, genet_intr, sc, device_xname(self)); if (ih == NULL) { aprint_error_dev(self, "couldn't establish interrupt on %s\n",
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Sat Mar 6 13:21:26 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_ddb.c Log Message: Improve fdt_isprint so that it returns false if there are consecutive zeroes. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_ddb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: skrll Date: Sat Mar 6 13:21:26 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_ddb.c Log Message: Improve fdt_isprint so that it returns false if there are consecutive zeroes. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_ddb.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_ddb.c diff -u src/sys/dev/fdt/fdt_ddb.c:1.1 src/sys/dev/fdt/fdt_ddb.c:1.2 --- src/sys/dev/fdt/fdt_ddb.c:1.1 Fri Oct 30 16:08:45 2020 +++ src/sys/dev/fdt/fdt_ddb.c Sat Mar 6 13:21:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_ddb.c,v 1.1 2020/10/30 16:08:45 skrll Exp $ */ +/* $NetBSD: fdt_ddb.c,v 1.2 2021/03/06 13:21:26 skrll Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_ddb.c,v 1.1 2020/10/30 16:08:45 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_ddb.c,v 1.2 2021/03/06 13:21:26 skrll Exp $"); #include @@ -49,8 +49,16 @@ fdt_isprint(const void *data, int len) if (len == 0) return false; + /* Count consecutive zeroes */ + int cz = 0; for (size_t j = 0; j < len; j++) { - if (!(isprint(c[j]) || c[j] == '\0')) + if (c[j] == '\0') + cz++; + else if (isprint(c[j])) + cz = 0; + else + return false; + if (cz > 1) return false; } return true;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Mon Feb 22 06:21:35 UTC 2021 Modified Files: src/sys/dev/fdt: cpufreq_dt.c Log Message: It is more appropriate to use clk_get_rate() rather than sc->sc_freq_target * 100. ci_data.cpu_cc_freq should be set to a higher precision value. In addition, when cpufreq_dt_init(), or while throttling, sc->sc_freq_target should not be referenced by cpufreq_dt_change_cb() because it does not have the correct value. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/fdt/cpufreq_dt.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/cpufreq_dt.c diff -u src/sys/dev/fdt/cpufreq_dt.c:1.18 src/sys/dev/fdt/cpufreq_dt.c:1.19 --- src/sys/dev/fdt/cpufreq_dt.c:1.18 Wed Jan 27 03:10:21 2021 +++ src/sys/dev/fdt/cpufreq_dt.c Mon Feb 22 06:21:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufreq_dt.c,v 1.18 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: cpufreq_dt.c,v 1.19 2021/02/22 06:21:35 ryo Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.18 2021/01/27 03:10:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.19 2021/02/22 06:21:35 ryo Exp $"); #include #include @@ -86,7 +86,7 @@ cpufreq_dt_change_cb(void *arg1, void *a struct cpufreq_dt_softc * const sc = arg1; struct cpu_info *ci = curcpu(); - ci->ci_data.cpu_cc_freq = sc->sc_freq_target * 100; + ci->ci_data.cpu_cc_freq = clk_get_rate(sc->sc_clk); } static int
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Mon Feb 22 06:21:35 UTC 2021 Modified Files: src/sys/dev/fdt: cpufreq_dt.c Log Message: It is more appropriate to use clk_get_rate() rather than sc->sc_freq_target * 100. ci_data.cpu_cc_freq should be set to a higher precision value. In addition, when cpufreq_dt_init(), or while throttling, sc->sc_freq_target should not be referenced by cpufreq_dt_change_cb() because it does not have the correct value. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/fdt/cpufreq_dt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: thorpej Date: Fri Feb 5 17:20:32 UTC 2021 Modified Files: src/sys/dev/fdt: fdtbus.c Log Message: Assign device handles to devices that attach to the "fdt" interface attribute in fdtbus_device_register(). To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/dev/fdt/fdtbus.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/fdtbus.c diff -u src/sys/dev/fdt/fdtbus.c:1.39 src/sys/dev/fdt/fdtbus.c:1.40 --- src/sys/dev/fdt/fdtbus.c:1.39 Thu Feb 4 22:14:08 2021 +++ src/sys/dev/fdt/fdtbus.c Fri Feb 5 17:20:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtbus.c,v 1.39 2021/02/04 22:14:08 thorpej Exp $ */ +/* $NetBSD: fdtbus.c,v 1.40 2021/02/05 17:20:32 thorpej Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.39 2021/02/04 22:14:08 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.40 2021/02/05 17:20:32 thorpej Exp $"); #include #include @@ -552,7 +552,18 @@ fdtbus_print(void *aux, const char *pnp) } void -fdtbus_device_register(device_t dev __unused, void *aux __unused) +fdtbus_device_register(device_t dev, void *aux) { - /* Placeholder. */ + /* All we do here is set the devhandle in the device_t. */ + int phandle = -1; + + if (device_attached_to_iattr(dev, "fdt")) { + const struct fdt_attach_args *faa = aux; + phandle = faa->faa_phandle; + } else { + return; + } + KASSERT(phandle != -1); + + of_device_register(dev, phandle); }
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: thorpej Date: Fri Feb 5 17:20:32 UTC 2021 Modified Files: src/sys/dev/fdt: fdtbus.c Log Message: Assign device handles to devices that attach to the "fdt" interface attribute in fdtbus_device_register(). To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/dev/fdt/fdtbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: thorpej Date: Thu Feb 4 22:14:08 UTC 2021 Modified Files: src/sys/dev/fdt: fdtbus.c fdtvar.h Log Message: Add fdtbus_device_register(). Just a placeholder for now. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/dev/fdt/fdtbus.c cvs rdiff -u -r1.68 -r1.69 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.
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: thorpej Date: Thu Feb 4 22:14:08 UTC 2021 Modified Files: src/sys/dev/fdt: fdtbus.c fdtvar.h Log Message: Add fdtbus_device_register(). Just a placeholder for now. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/dev/fdt/fdtbus.c cvs rdiff -u -r1.68 -r1.69 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/fdtbus.c diff -u src/sys/dev/fdt/fdtbus.c:1.38 src/sys/dev/fdt/fdtbus.c:1.39 --- src/sys/dev/fdt/fdtbus.c:1.38 Wed Jan 27 03:10:21 2021 +++ src/sys/dev/fdt/fdtbus.c Thu Feb 4 22:14:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtbus.c,v 1.38 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: fdtbus.c,v 1.39 2021/02/04 22:14:08 thorpej Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.38 2021/01/27 03:10:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.39 2021/02/04 22:14:08 thorpej Exp $"); #include #include @@ -550,3 +550,9 @@ fdtbus_print(void *aux, const char *pnp) return UNCONF; } + +void +fdtbus_device_register(device_t dev __unused, void *aux __unused) +{ + /* Placeholder. */ +} Index: src/sys/dev/fdt/fdtvar.h diff -u src/sys/dev/fdt/fdtvar.h:1.68 src/sys/dev/fdt/fdtvar.h:1.69 --- src/sys/dev/fdt/fdtvar.h:1.68 Sat Jan 16 09:09:37 2021 +++ src/sys/dev/fdt/fdtvar.h Thu Feb 4 22:14:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtvar.h,v 1.68 2021/01/16 09:09:37 ryo Exp $ */ +/* $NetBSD: fdtvar.h,v 1.69 2021/02/04 22:14:08 thorpej Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -434,7 +434,9 @@ void fdt_add_child(device_t, int, struc void fdt_remove_byhandle(int); void fdt_remove_bycompat(const char *[]); int fdt_find_with_property(const char *, int *); + int fdtbus_print(void *, const char *); +void fdtbus_device_register(device_t, void *); bus_dma_tag_t fdtbus_dma_tag_create(int, const struct fdt_dma_range *, u_int);
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: thorpej Date: Wed Jan 27 02:24:10 UTC 2021 Modified Files: src/sys/dev/fdt: amdccp_fdt.c connector_fdt.c dwc2_fdt.c dwcmmc_fdt.c fdtbus.c i2cmux_fdt.c ns8250_uart.c panel_fdt.c pinctrl_single.c vmt_fdt.c Log Message: Use DEVICE_COMPAT_EOL. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/amdccp_fdt.c \ src/sys/dev/fdt/panel_fdt.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/connector_fdt.c \ src/sys/dev/fdt/pinctrl_single.c src/sys/dev/fdt/vmt_fdt.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/fdt/dwc2_fdt.c \ src/sys/dev/fdt/i2cmux_fdt.c cvs rdiff -u -r1.14 -r1.15 src/sys/dev/fdt/dwcmmc_fdt.c cvs rdiff -u -r1.36 -r1.37 src/sys/dev/fdt/fdtbus.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/ns8250_uart.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/amdccp_fdt.c diff -u src/sys/dev/fdt/amdccp_fdt.c:1.4 src/sys/dev/fdt/amdccp_fdt.c:1.5 --- src/sys/dev/fdt/amdccp_fdt.c:1.4 Mon Jan 25 14:25:09 2021 +++ src/sys/dev/fdt/amdccp_fdt.c Wed Jan 27 02:24:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: amdccp_fdt.c,v 1.4 2021/01/25 14:25:09 thorpej Exp $ */ +/* $NetBSD: amdccp_fdt.c,v 1.5 2021/01/27 02:24:10 thorpej Exp $ */ /* * Copyright (c) 2018 Jonathan A. Kollasch @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: amdccp_fdt.c,v 1.4 2021/01/25 14:25:09 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: amdccp_fdt.c,v 1.5 2021/01/27 02:24:10 thorpej Exp $"); #include #include @@ -51,7 +51,7 @@ CFATTACH_DECL_NEW(amdccp_fdt, sizeof(str static const struct device_compatible_entry compat_data[] = { { .compat = "amd,ccp-seattle-v1a" }, - { } + DEVICE_COMPAT_EOL }; static int Index: src/sys/dev/fdt/panel_fdt.c diff -u src/sys/dev/fdt/panel_fdt.c:1.4 src/sys/dev/fdt/panel_fdt.c:1.5 --- src/sys/dev/fdt/panel_fdt.c:1.4 Mon Jan 25 14:25:09 2021 +++ src/sys/dev/fdt/panel_fdt.c Wed Jan 27 02:24:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: panel_fdt.c,v 1.4 2021/01/25 14:25:09 thorpej Exp $ */ +/* $NetBSD: panel_fdt.c,v 1.5 2021/01/27 02:24:10 thorpej Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: panel_fdt.c,v 1.4 2021/01/25 14:25:09 thorpej Exp $"); +__KERNEL_RCSID(1, "$NetBSD: panel_fdt.c,v 1.5 2021/01/27 02:24:10 thorpej Exp $"); #include #include @@ -71,7 +71,7 @@ CFATTACH_DECL_NEW(fdt_panel, sizeof(stru static const struct device_compatible_entry compat_data[] = { { .compat = "panel-lvds", .value = PANEL_LVDS}, { .compat = "panel-dual-lvds", .value = PANEL_DUAL_LVDS}, - { } + DEVICE_COMPAT_EOL }; static int Index: src/sys/dev/fdt/connector_fdt.c diff -u src/sys/dev/fdt/connector_fdt.c:1.3 src/sys/dev/fdt/connector_fdt.c:1.4 --- src/sys/dev/fdt/connector_fdt.c:1.3 Mon Jan 25 14:25:09 2021 +++ src/sys/dev/fdt/connector_fdt.c Wed Jan 27 02:24:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: connector_fdt.c,v 1.3 2021/01/25 14:25:09 thorpej Exp $ */ +/* $NetBSD: connector_fdt.c,v 1.4 2021/01/27 02:24:10 thorpej Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: connector_fdt.c,v 1.3 2021/01/25 14:25:09 thorpej Exp $"); +__KERNEL_RCSID(1, "$NetBSD: connector_fdt.c,v 1.4 2021/01/27 02:24:10 thorpej Exp $"); #include #include @@ -74,7 +74,7 @@ static const struct device_compatible_en { .compat = "dvi-connector", .value = CON_DVI}, { .compat = "hdmi-connector", .value = CON_HDMI}, { .compat = "vga-connector", .value = CON_VGA}, - { } + DEVICE_COMPAT_EOL }; static int Index: src/sys/dev/fdt/pinctrl_single.c diff -u src/sys/dev/fdt/pinctrl_single.c:1.3 src/sys/dev/fdt/pinctrl_single.c:1.4 --- src/sys/dev/fdt/pinctrl_single.c:1.3 Mon Jan 25 14:25:09 2021 +++ src/sys/dev/fdt/pinctrl_single.c Wed Jan 27 02:24:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pinctrl_single.c,v 1.3 2021/01/25 14:25:09 thorpej Exp $ */ +/* $NetBSD: pinctrl_single.c,v 1.4 2021/01/27 02:24:10 thorpej Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pinctrl_single.c,v 1.3 2021/01/25 14:25:09 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pinctrl_single.c,v 1.4 2021/01/27 02:24:10 thorpej Exp $"); #include #include @@ -53,7 +53,7 @@ static const struct pinctrl_single_confi static const struct device_compatible_entry compat_data[] = { { .compat = "pinctrl-single", .data = _config }, { .compat = "pinconf-single", .data = _config }, - { } + DEVICE_COMPAT_EOL }; struct pinctrl_single_softc { Index: src/sys/dev/fdt/vmt_fdt.c diff -u src/sys/dev/fdt/vmt_fdt.c:1.3 src/sys/dev/fdt/vmt_fdt.c:1.4 --- src/sys/dev/fdt/vmt_fdt.c:1.3 Mon Jan 25 14:25:09 2021 +++ src/sys/dev/fdt/vmt_fdt.c Wed Jan 27 02:24:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vmt_fdt.c,v 1.3 2021/01/25 14:25:09 thorpej Exp $ */ +/*