CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: jmcneill Date: Wed Sep 28 10:23:37 UTC 2022 Modified Files: src/sys/arch/arm/amlogic: mesongx_wdt.c Log Message: Match Meson GXBB watchdog. >From Vincent DEFERT on port-arm: http://mail-index.netbsd.org/port-arm/2022/09/21/msg007860.html To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/amlogic/mesongx_wdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/amlogic/mesongx_wdt.c diff -u src/sys/arch/arm/amlogic/mesongx_wdt.c:1.2 src/sys/arch/arm/amlogic/mesongx_wdt.c:1.3 --- src/sys/arch/arm/amlogic/mesongx_wdt.c:1.2 Wed Jan 27 03:10:18 2021 +++ src/sys/arch/arm/amlogic/mesongx_wdt.c Wed Sep 28 10:23:37 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: mesongx_wdt.c,v 1.2 2021/01/27 03:10:18 thorpej Exp $ */ +/* $NetBSD: mesongx_wdt.c,v 1.3 2022/09/28 10:23:37 jmcneill Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mesongx_wdt.c,v 1.2 2021/01/27 03:10:18 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mesongx_wdt.c,v 1.3 2022/09/28 10:23:37 jmcneill Exp $"); #include #include @@ -56,6 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: mesongx_wdt. static const struct device_compatible_entry compat_data[] = { { .compat = "amlogic,meson-gx-wdt" }, + { .compat = "amlogic,meson-gxbb-wdt" }, DEVICE_COMPAT_EOL };
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: jmcneill Date: Wed Sep 28 10:23:37 UTC 2022 Modified Files: src/sys/arch/arm/amlogic: mesongx_wdt.c Log Message: Match Meson GXBB watchdog. >From Vincent DEFERT on port-arm: http://mail-index.netbsd.org/port-arm/2022/09/21/msg007860.html To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/amlogic/mesongx_wdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: brook Date: Thu Jun 23 03:36:00 UTC 2022 Modified Files: src/sys/arch/arm/amlogic: meson8b_pinctrl.c Log Message: Add a mising gpio pin description. This file enumerates the gpio pins in two different ways: as enum values and as an array of data. The enum values are used as keys into the array. One of the enums, GPIODV_9, is missing from the table. As a result, lookup fails to find a matching entry and returns an invalid entry, which causes the kernel to panic. This patch adds the missing data to the array. However, the underlying problem is not fixed. Somewhere in the kernel is lookup logic that does not check the validity of the results to ensure that a match indeed occurred. There are no doubt other potential panics to be triggered by the same lookup code applied to other tables (or future versions of this one). To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/amlogic/meson8b_pinctrl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/amlogic/meson8b_pinctrl.c diff -u src/sys/arch/arm/amlogic/meson8b_pinctrl.c:1.2 src/sys/arch/arm/amlogic/meson8b_pinctrl.c:1.3 --- src/sys/arch/arm/amlogic/meson8b_pinctrl.c:1.2 Wed Aug 14 09:50:20 2019 +++ src/sys/arch/arm/amlogic/meson8b_pinctrl.c Thu Jun 23 03:36:00 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: meson8b_pinctrl.c,v 1.2 2019/08/14 09:50:20 jmcneill Exp $ */ +/* $NetBSD: meson8b_pinctrl.c,v 1.3 2022/06/23 03:36:00 brook Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: meson8b_pinctrl.c,v 1.2 2019/08/14 09:50:20 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson8b_pinctrl.c,v 1.3 2022/06/23 03:36:00 brook Exp $"); #include @@ -226,6 +226,7 @@ static const struct meson_pinctrl_gpio m CBUS_GPIO(GPIOY_14, 3, 14, 3, 14), /* GPIODV */ + CBUS_GPIO(GPIODV_9, 6, 9, 0, 9), CBUS_GPIO(GPIODV_24, 6, 24, 0, 24), CBUS_GPIO(GPIODV_25, 6, 25, 0, 25), CBUS_GPIO(GPIODV_26, 6, 26, 0, 26),
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: brook Date: Thu Jun 23 03:36:00 UTC 2022 Modified Files: src/sys/arch/arm/amlogic: meson8b_pinctrl.c Log Message: Add a mising gpio pin description. This file enumerates the gpio pins in two different ways: as enum values and as an array of data. The enum values are used as keys into the array. One of the enums, GPIODV_9, is missing from the table. As a result, lookup fails to find a matching entry and returns an invalid entry, which causes the kernel to panic. This patch adds the missing data to the array. However, the underlying problem is not fixed. Somewhere in the kernel is lookup logic that does not check the validity of the results to ensure that a match indeed occurred. There are no doubt other potential panics to be triggered by the same lookup code applied to other tables (or future versions of this one). To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/amlogic/meson8b_pinctrl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: riastradh Date: Sat Mar 19 11:36:43 UTC 2022 Modified Files: src/sys/arch/arm/amlogic: meson_rng.c Log Message: meson_rng(4): No need for lock -- delete it. We only ever read a single register at a time; no exclusive access or serialization needed. XXX This driver should have some kind of hardware-specific health test -- is there documentation anywhere for what this RNG actually is? To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/amlogic/meson_rng.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/amlogic/meson_rng.c diff -u src/sys/arch/arm/amlogic/meson_rng.c:1.4 src/sys/arch/arm/amlogic/meson_rng.c:1.5 --- src/sys/arch/arm/amlogic/meson_rng.c:1.4 Wed Jan 27 03:10:18 2021 +++ src/sys/arch/arm/amlogic/meson_rng.c Sat Mar 19 11:36:43 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: meson_rng.c,v 1.4 2021/01/27 03:10:18 thorpej Exp $ */ +/* $NetBSD: meson_rng.c,v 1.5 2022/03/19 11:36:43 riastradh Exp $ */ /*- * Copyright (c) 2015-2019 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: meson_rng.c,v 1.4 2021/01/27 03:10:18 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_rng.c,v 1.5 2022/03/19 11:36:43 riastradh Exp $"); #include #include @@ -49,7 +49,6 @@ struct meson_rng_softc { bus_space_tag_t sc_bst; bus_space_handle_t sc_bsh; - kmutex_t sc_lock; krndsource_t sc_rndsource; }; @@ -91,8 +90,6 @@ meson_rng_attach(device_t parent, device return; } - mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_VM); - /* Core clock is optional */ clk = fdtbus_clock_get(phandle, "core"); if (clk != NULL && clk_enable(clk) != 0) { @@ -114,7 +111,6 @@ meson_rng_get(size_t bytes_wanted, void struct meson_rng_softc * const sc = priv; uint32_t data; - mutex_spin_enter(&sc->sc_lock); while (bytes_wanted) { data = bus_space_read_4(sc->sc_bst, sc->sc_bsh, 0); rnd_add_data_sync(&sc->sc_rndsource, &data, sizeof(data), @@ -122,5 +118,4 @@ meson_rng_get(size_t bytes_wanted, void bytes_wanted -= MIN(bytes_wanted, sizeof(data)); } explicit_memset(&data, 0, sizeof(data)); - mutex_spin_exit(&sc->sc_lock); }
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: riastradh Date: Sat Mar 19 11:36:43 UTC 2022 Modified Files: src/sys/arch/arm/amlogic: meson_rng.c Log Message: meson_rng(4): No need for lock -- delete it. We only ever read a single register at a time; no exclusive access or serialization needed. XXX This driver should have some kind of hardware-specific health test -- is there documentation anywhere for what this RNG actually is? To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/amlogic/meson_rng.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: jdc Date: Fri Nov 19 07:04:27 UTC 2021 Modified Files: src/sys/arch/arm/amlogic: meson_dwmac.c Log Message: PR port-evbarm/50416 Redo the previous change. The "snps,..." properties are on the ethernet node and the "reset-..." properties are on the phy node. Handle this by creating a separate reset routine for each case. Idea from Jared. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/amlogic/meson_dwmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/amlogic/meson_dwmac.c diff -u src/sys/arch/arm/amlogic/meson_dwmac.c:1.13 src/sys/arch/arm/amlogic/meson_dwmac.c:1.14 --- src/sys/arch/arm/amlogic/meson_dwmac.c:1.13 Wed Nov 17 11:57:27 2021 +++ src/sys/arch/arm/amlogic/meson_dwmac.c Fri Nov 19 07:04:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: meson_dwmac.c,v 1.13 2021/11/17 11:57:27 jdc Exp $ */ +/* $NetBSD: meson_dwmac.c,v 1.14 2021/11/19 07:04:27 jdc Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.13 2021/11/17 11:57:27 jdc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.14 2021/11/19 07:04:27 jdc Exp $"); #include #include @@ -66,72 +66,69 @@ static const struct device_compatible_en }; static int -meson_dwmac_reset(const int phandle) +meson_dwmac_reset_eth(const int phandle) { struct fdtbus_gpio_pin *pin_reset; const u_int *reset_delay_us; - const u_int *reset_assert_us, *reset_deassert_us, *reset_gpios; bool reset_active_low; int len, val; - /* - * Depending on the DTS, we need to check either the "snps,...", - * or the "reset-..." properties for the MAC reset information. - */ - pin_reset = fdtbus_gpio_acquire(phandle, "snps,reset-gpio", GPIO_PIN_OUTPUT); - if (pin_reset != NULL) { + if (pin_reset == NULL) + return ENXIO; - reset_delay_us = fdtbus_get_prop(phandle, - "snps,reset-delays-us", &len); - if (reset_delay_us == NULL || len != 12) - return ENXIO; + reset_delay_us = fdtbus_get_prop(phandle, "snps,reset-delays-us", &len); + if (reset_delay_us == NULL || len != 12) + return ENXIO; - reset_active_low = of_hasprop(phandle, "snps,reset-active-low"); + reset_active_low = of_hasprop(phandle, "snps,reset-active-low"); - val = reset_active_low ? 1 : 0; + val = reset_active_low ? 1 : 0; - fdtbus_gpio_write(pin_reset, val); - delay(be32toh(reset_delay_us[0])); - fdtbus_gpio_write(pin_reset, !val); - delay(be32toh(reset_delay_us[1])); - fdtbus_gpio_write(pin_reset, val); - delay(be32toh(reset_delay_us[2])); + fdtbus_gpio_write(pin_reset, val); + delay(be32toh(reset_delay_us[0])); + fdtbus_gpio_write(pin_reset, !val); + delay(be32toh(reset_delay_us[1])); + fdtbus_gpio_write(pin_reset, val); + delay(be32toh(reset_delay_us[2])); - return 0; - } + return 0; +} + +static int +meson_dwmac_reset_phy(const int phandle) +{ + struct fdtbus_gpio_pin *pin_reset; + const u_int *reset_assert_us, *reset_deassert_us, *reset_gpios; + bool reset_active_low; + int len, val; pin_reset = fdtbus_gpio_acquire(phandle, "reset-gpios", GPIO_PIN_OUTPUT); - if (pin_reset != NULL) { - reset_assert_us = fdtbus_get_prop(phandle, - "reset-assert-us", &len); - if (reset_assert_us == NULL || len != 4) - return ENXIO; - reset_deassert_us = fdtbus_get_prop(phandle, - "reset-deassert-us", &len); - if (reset_deassert_us == NULL || len != 4) - return ENXIO; - reset_gpios = fdtbus_get_prop(phandle, - "reset-gpios", &len); - if (reset_gpios == NULL || len != 12) - return ENXIO; - - reset_active_low = be32toh(reset_gpios[2]); - - val = reset_active_low ? 1 : 0; - - - fdtbus_gpio_write(pin_reset, val); - delay(be32toh(reset_assert_us[0])); - fdtbus_gpio_write(pin_reset, !val); - delay(be32toh(reset_deassert_us[0])); + if (pin_reset == NULL) + return ENXIO; - return 0; - } + reset_assert_us = fdtbus_get_prop(phandle, "reset-assert-us", &len); + if (reset_assert_us == NULL || len != 4) + return ENXIO; + reset_deassert_us = fdtbus_get_prop(phandle, "reset-deassert-us", &len); + if (reset_deassert_us == NULL || len != 4) + return ENXIO; + reset_gpios = fdtbus_get_prop(phandle, "reset-gpios", &len); + if (reset_gpios == NULL || len != 12) + return ENXIO; + + reset_active_low = be32toh(reset_gpios[2]); + + val = reset_active_low ? 1 : 0; + + fdtbus_gpio_write(pin_reset, val); + delay(be32toh(reset_assert_us[0])); + fdtbus_gpio_write(pin_reset, !val); + delay(be32toh(reset_deassert_us[0])); - return ENXIO; + return 0; } static void @@ -276,8 +273,19 @@ meson_dwmac_attach(device_t parent, devi } aprint_normal_dev(self, "interrupting on %s\n", intrstr); - if (meson_dwmac_reset(phandle_phy) != 0) - aprint_error_dev(self, "PHY reset failed\n"); + /* + * Depending on the DTS, we need to check either the "snps,...", + * properties on the ethernet node, or
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: jdc Date: Fri Nov 19 07:04:27 UTC 2021 Modified Files: src/sys/arch/arm/amlogic: meson_dwmac.c Log Message: PR port-evbarm/50416 Redo the previous change. The "snps,..." properties are on the ethernet node and the "reset-..." properties are on the phy node. Handle this by creating a separate reset routine for each case. Idea from Jared. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/amlogic/meson_dwmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: jdc Date: Wed Nov 17 11:57:27 UTC 2021 Modified Files: src/sys/arch/arm/amlogic: meson_dwmac.c Log Message: PR port-evbarm/50416 Also check the "reset_gpios", "reset-assert-us", and "reset-deassert-us" properties for ethernet MAC reset information. Makes the built-in ethernet work on Odroid C1 and Odroid C2 (with mesongxbb_pinctrl.c >= r1.3). Based on a hint from Jared. C2 tested by Martin. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/amlogic/meson_dwmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: jdc Date: Wed Nov 17 11:57:27 UTC 2021 Modified Files: src/sys/arch/arm/amlogic: meson_dwmac.c Log Message: PR port-evbarm/50416 Also check the "reset_gpios", "reset-assert-us", and "reset-deassert-us" properties for ethernet MAC reset information. Makes the built-in ethernet work on Odroid C1 and Odroid C2 (with mesongxbb_pinctrl.c >= r1.3). Based on a hint from Jared. C2 tested by Martin. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/amlogic/meson_dwmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/amlogic/meson_dwmac.c diff -u src/sys/arch/arm/amlogic/meson_dwmac.c:1.12 src/sys/arch/arm/amlogic/meson_dwmac.c:1.13 --- src/sys/arch/arm/amlogic/meson_dwmac.c:1.12 Sun Nov 7 19:21:32 2021 +++ src/sys/arch/arm/amlogic/meson_dwmac.c Wed Nov 17 11:57:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: meson_dwmac.c,v 1.12 2021/11/07 19:21:32 jmcneill Exp $ */ +/* $NetBSD: meson_dwmac.c,v 1.13 2021/11/17 11:57:27 jdc Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.12 2021/11/07 19:21:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.13 2021/11/17 11:57:27 jdc Exp $"); #include #include @@ -70,29 +70,68 @@ meson_dwmac_reset(const int phandle) { struct fdtbus_gpio_pin *pin_reset; const u_int *reset_delay_us; + const u_int *reset_assert_us, *reset_deassert_us, *reset_gpios; bool reset_active_low; int len, val; - pin_reset = fdtbus_gpio_acquire(phandle, "snps,reset-gpio", GPIO_PIN_OUTPUT); - if (pin_reset == NULL) + /* + * Depending on the DTS, we need to check either the "snps,...", + * or the "reset-..." properties for the MAC reset information. + */ + + pin_reset = fdtbus_gpio_acquire(phandle, "snps,reset-gpio", + GPIO_PIN_OUTPUT); + if (pin_reset != NULL) { + + reset_delay_us = fdtbus_get_prop(phandle, + "snps,reset-delays-us", &len); + if (reset_delay_us == NULL || len != 12) + return ENXIO; + + reset_active_low = of_hasprop(phandle, "snps,reset-active-low"); + + val = reset_active_low ? 1 : 0; + + fdtbus_gpio_write(pin_reset, val); + delay(be32toh(reset_delay_us[0])); + fdtbus_gpio_write(pin_reset, !val); + delay(be32toh(reset_delay_us[1])); + fdtbus_gpio_write(pin_reset, val); + delay(be32toh(reset_delay_us[2])); + return 0; + } + + pin_reset = fdtbus_gpio_acquire(phandle, "reset-gpios", + GPIO_PIN_OUTPUT); + if (pin_reset != NULL) { + reset_assert_us = fdtbus_get_prop(phandle, + "reset-assert-us", &len); + if (reset_assert_us == NULL || len != 4) + return ENXIO; + reset_deassert_us = fdtbus_get_prop(phandle, + "reset-deassert-us", &len); + if (reset_deassert_us == NULL || len != 4) + return ENXIO; + reset_gpios = fdtbus_get_prop(phandle, + "reset-gpios", &len); + if (reset_gpios == NULL || len != 12) + return ENXIO; + + reset_active_low = be32toh(reset_gpios[2]); + + val = reset_active_low ? 1 : 0; + + + fdtbus_gpio_write(pin_reset, val); + delay(be32toh(reset_assert_us[0])); + fdtbus_gpio_write(pin_reset, !val); + delay(be32toh(reset_deassert_us[0])); - reset_delay_us = fdtbus_get_prop(phandle, "snps,reset-delays-us", &len); - if (reset_delay_us == NULL || len != 12) - return ENXIO; - - reset_active_low = of_hasprop(phandle, "snps,reset-active-low"); - - val = reset_active_low ? 1 : 0; - - fdtbus_gpio_write(pin_reset, val); - delay(be32toh(reset_delay_us[0])); - fdtbus_gpio_write(pin_reset, !val); - delay(be32toh(reset_delay_us[1])); - fdtbus_gpio_write(pin_reset, val); - delay(be32toh(reset_delay_us[2])); + return 0; + } - return 0; + return ENXIO; } static void
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: jmcneill Date: Wed Nov 17 11:31:12 UTC 2021 Modified Files: src/sys/arch/arm/amlogic: mesongxbb_pinctrl.c Log Message: Add missing GPIOZ direction / input / output register defs. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/amlogic/mesongxbb_pinctrl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/amlogic/mesongxbb_pinctrl.c diff -u src/sys/arch/arm/amlogic/mesongxbb_pinctrl.c:1.2 src/sys/arch/arm/amlogic/mesongxbb_pinctrl.c:1.3 --- src/sys/arch/arm/amlogic/mesongxbb_pinctrl.c:1.2 Tue Feb 26 21:55:28 2019 +++ src/sys/arch/arm/amlogic/mesongxbb_pinctrl.c Wed Nov 17 11:31:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mesongxbb_pinctrl.c,v 1.2 2019/02/26 21:55:28 jmcneill Exp $ */ +/* $NetBSD: mesongxbb_pinctrl.c,v 1.3 2021/11/17 11:31:12 jmcneill Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mesongxbb_pinctrl.c,v 1.2 2019/02/26 21:55:28 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mesongxbb_pinctrl.c,v 1.3 2021/11/17 11:31:12 jmcneill Exp $"); #include @@ -309,7 +309,25 @@ static const struct meson_pinctrl_gpio m CBUS_GPIO(CARD_5, 2, 25), CBUS_GPIO(CARD_6, 2, 26), - /* CARD */ + /* GPIOZ */ + CBUS_GPIO(GPIOZ_0, 3, 0), + CBUS_GPIO(GPIOZ_1, 3, 1), + CBUS_GPIO(GPIOZ_2, 3, 2), + CBUS_GPIO(GPIOZ_3, 3, 3), + CBUS_GPIO(GPIOZ_4, 3, 4), + CBUS_GPIO(GPIOZ_5, 3, 5), + CBUS_GPIO(GPIOZ_6, 3, 6), + CBUS_GPIO(GPIOZ_7, 3, 7), + CBUS_GPIO(GPIOZ_8, 3, 8), + CBUS_GPIO(GPIOZ_9, 3, 9), + CBUS_GPIO(GPIOZ_10, 3, 10), + CBUS_GPIO(GPIOZ_11, 3, 11), + CBUS_GPIO(GPIOZ_12, 3, 12), + CBUS_GPIO(GPIOZ_13, 3, 13), + CBUS_GPIO(GPIOZ_14, 3, 14), + CBUS_GPIO(GPIOZ_15, 3, 15), + + /* CLK */ CBUS_GPIO(GPIOCLK_0, 3, 28), CBUS_GPIO(GPIOCLK_1, 3, 29), CBUS_GPIO(GPIOCLK_2, 3, 30),
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: jmcneill Date: Wed Nov 17 11:31:12 UTC 2021 Modified Files: src/sys/arch/arm/amlogic: mesongxbb_pinctrl.c Log Message: Add missing GPIOZ direction / input / output register defs. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/amlogic/mesongxbb_pinctrl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: jmcneill Date: Fri Aug 16 10:36:06 UTC 2019 Modified Files: src/sys/arch/arm/amlogic: meson8b_clkc.c Log Message: Use correct register for mpll2_div clock To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/amlogic/meson8b_clkc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/amlogic/meson8b_clkc.c diff -u src/sys/arch/arm/amlogic/meson8b_clkc.c:1.4 src/sys/arch/arm/amlogic/meson8b_clkc.c:1.5 --- src/sys/arch/arm/amlogic/meson8b_clkc.c:1.4 Tue Aug 13 09:56:08 2019 +++ src/sys/arch/arm/amlogic/meson8b_clkc.c Fri Aug 16 10:36:06 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: meson8b_clkc.c,v 1.4 2019/08/13 09:56:08 skrll Exp $ */ +/* $NetBSD: meson8b_clkc.c,v 1.5 2019/08/16 10:36:06 jmcneill Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: meson8b_clkc.c,v 1.4 2019/08/13 09:56:08 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: meson8b_clkc.c,v 1.5 2019/08/16 10:36:06 jmcneill Exp $"); #include #include @@ -268,9 +268,9 @@ static struct meson_clk_clk meson8b_clkc MESON_CLK_PLL_REG_INVALID,/* ssen */ 0), MESON_CLK_MPLL(MESON8B_CLOCK_MPLL2_DIV, "mpll2_div", "mpll_prediv", - MESON_CLK_PLL_REG(HHI_MPLL_CNTL8, __BITS(13,0)), /* sdm */ - MESON_CLK_PLL_REG(HHI_MPLL_CNTL8, __BIT(15)), /* sdm_enable */ - MESON_CLK_PLL_REG(HHI_MPLL_CNTL8, __BITS(24,16)), /* n2 */ + MESON_CLK_PLL_REG(HHI_MPLL_CNTL9, __BITS(13,0)), /* sdm */ + MESON_CLK_PLL_REG(HHI_MPLL_CNTL9, __BIT(15)), /* sdm_enable */ + MESON_CLK_PLL_REG(HHI_MPLL_CNTL9, __BITS(24,16)), /* n2 */ MESON_CLK_PLL_REG_INVALID,/* ssen */ 0),
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: jmcneill Date: Fri Aug 16 10:36:06 UTC 2019 Modified Files: src/sys/arch/arm/amlogic: meson8b_clkc.c Log Message: Use correct register for mpll2_div clock To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/amlogic/meson8b_clkc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: jmcneill Date: Wed Aug 14 09:50:20 UTC 2019 Modified Files: src/sys/arch/arm/amlogic: meson8b_pinctrl.c Log Message: Add eth_rxd3 and eth_rxd2 pinctrl groups To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/amlogic/meson8b_pinctrl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: jmcneill Date: Wed Aug 14 09:50:20 UTC 2019 Modified Files: src/sys/arch/arm/amlogic: meson8b_pinctrl.c Log Message: Add eth_rxd3 and eth_rxd2 pinctrl groups To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/amlogic/meson8b_pinctrl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/amlogic/meson8b_pinctrl.c diff -u src/sys/arch/arm/amlogic/meson8b_pinctrl.c:1.1 src/sys/arch/arm/amlogic/meson8b_pinctrl.c:1.2 --- src/sys/arch/arm/amlogic/meson8b_pinctrl.c:1.1 Sat Jan 19 20:56:03 2019 +++ src/sys/arch/arm/amlogic/meson8b_pinctrl.c Wed Aug 14 09:50:20 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: meson8b_pinctrl.c,v 1.1 2019/01/19 20:56:03 jmcneill Exp $ */ +/* $NetBSD: meson8b_pinctrl.c,v 1.2 2019/08/14 09:50:20 jmcneill Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: meson8b_pinctrl.c,v 1.1 2019/01/19 20:56:03 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson8b_pinctrl.c,v 1.2 2019/08/14 09:50:20 jmcneill Exp $"); #include @@ -481,6 +481,8 @@ static const struct meson_pinctrl_group { "eth_ref_clk", REG6, 8, { DIF_3_N }, 1 }, { "eth_mdc", REG6, 9, { DIF_4_P }, 1 }, { "eth_mdio_en", REG6, 10, { DIF_4_N }, 1 }, + { "eth_rxd3", REG7, 22, { DIF_2_P }, 1 }, + { "eth_rxd2", REG7, 23, { DIF_2_N }, 1 }, }; static const struct meson_pinctrl_group meson8b_aobus_groups[] = {
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: skrll Date: Tue Aug 13 09:52:57 UTC 2019 Modified Files: src/sys/arch/arm/amlogic: meson_platform.c Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/amlogic/meson_platform.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/amlogic/meson_platform.c diff -u src/sys/arch/arm/amlogic/meson_platform.c:1.11 src/sys/arch/arm/amlogic/meson_platform.c:1.12 --- src/sys/arch/arm/amlogic/meson_platform.c:1.11 Sun Apr 21 15:57:33 2019 +++ src/sys/arch/arm/amlogic/meson_platform.c Tue Aug 13 09:52:57 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: meson_platform.c,v 1.11 2019/04/21 15:57:33 jmcneill Exp $ */ +/* $NetBSD: meson_platform.c,v 1.12 2019/08/13 09:52:57 skrll Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -33,7 +33,7 @@ #include "arml2cc.h" #include -__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.11 2019/04/21 15:57:33 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.12 2019/08/13 09:52:57 skrll Exp $"); #include #include @@ -256,7 +256,7 @@ meson8b_platform_device_register(device_ strcat(boot_args, rootarg); } } - + meson_platform_device_register(self, aux); } #endif
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: skrll Date: Tue Aug 13 09:52:57 UTC 2019 Modified Files: src/sys/arch/arm/amlogic: meson_platform.c Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/amlogic/meson_platform.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: ryo Date: Tue May 28 05:08:47 UTC 2019 Modified Files: src/sys/arch/arm/amlogic: meson_uart.c Log Message: - since ttyinput (t_linesw->l_rint) should not be called from interrupt context, it has been modified to use softint like other serial drivers. - add spinlock for interrupt. ok jmcneill@. thanks To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/amlogic/meson_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/arch/arm/amlogic
Module Name:src Committed By: ryo Date: Tue May 28 05:08:47 UTC 2019 Modified Files: src/sys/arch/arm/amlogic: meson_uart.c Log Message: - since ttyinput (t_linesw->l_rint) should not be called from interrupt context, it has been modified to use softint like other serial drivers. - add spinlock for interrupt. ok jmcneill@. thanks To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/amlogic/meson_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/arch/arm/amlogic/meson_uart.c diff -u src/sys/arch/arm/amlogic/meson_uart.c:1.2 src/sys/arch/arm/amlogic/meson_uart.c:1.3 --- src/sys/arch/arm/amlogic/meson_uart.c:1.2 Sun Jan 20 15:56:40 2019 +++ src/sys/arch/arm/amlogic/meson_uart.c Tue May 28 05:08:47 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: meson_uart.c,v 1.2 2019/01/20 15:56:40 jmcneill Exp $ */ +/* $NetBSD: meson_uart.c,v 1.3 2019/05/28 05:08:47 ryo Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: meson_uart.c,v 1.2 2019/01/20 15:56:40 jmcneill Exp $"); +__KERNEL_RCSID(1, "$NetBSD: meson_uart.c,v 1.3 2019/05/28 05:08:47 ryo Exp $"); #define cn_trap() \ do {\ @@ -64,6 +64,7 @@ static int meson_uart_match(device_t, cf static void meson_uart_attach(device_t, device_t, void *); static int meson_uart_intr(void *); +static void meson_uart_rxsoft(void *); static int meson_uart_cngetc(dev_t); static void meson_uart_cnputc(dev_t, int); @@ -86,14 +87,20 @@ struct meson_uart_softc { device_t sc_dev; bus_space_tag_t sc_bst; bus_space_handle_t sc_bsh; + kmutex_t sc_intr_lock; void *sc_ih; + void *sc_sih; struct tty *sc_tty; int sc_ospeed; + unsigned int sc_rbuf_w; /* write ptr of sc_rbuf[] */ + unsigned int sc_rbuf_r; /* read ptr of sc_rbuf[] */ tcflag_t sc_cflag; u_char sc_buf[1024]; +#define MESON_RBUFSZ 128 /* must be 2^n */ + u_char sc_rbuf[MESON_RBUFSZ]; /* good enough for sizeof RXFIFO */ }; static int meson_uart_console_phandle = -1; @@ -179,6 +186,7 @@ meson_uart_attach(device_t parent, devic return; } + mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SERIAL); sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_SERIAL, FDT_INTR_MPSAFE, meson_uart_intr, sc); if (sc->sc_ih == NULL) { @@ -187,6 +195,12 @@ meson_uart_attach(device_t parent, devic return; } + sc->sc_sih = softint_establish(SOFTINT_SERIAL, meson_uart_rxsoft, sc); + if (sc->sc_sih == NULL) { + aprint_error(": failed to establish softint\n"); + return; + } + if (meson_uart_cmajor == -1) { /* allocate a major number */ int bmajor = -1, cmajor = -1; @@ -450,6 +464,7 @@ meson_uart_intr(void *priv) struct tty *tp = sc->sc_tty; uint32_t status, c; + mutex_spin_enter(&sc->sc_intr_lock); for (;;) { int cn_trapped = 0; status = bus_space_read_4(sc->sc_bst, sc->sc_bsh, @@ -468,12 +483,33 @@ meson_uart_intr(void *priv) cn_check_magic(tp->t_dev, c & 0xff, meson_uart_cnm_state); if (cn_trapped) continue; - tp->t_linesw->l_rint(c & 0xff, tp); + + if ((sc->sc_rbuf_w - sc->sc_rbuf_r) >= (MESON_RBUFSZ - 1)) + continue; + sc->sc_rbuf[sc->sc_rbuf_w++ & (MESON_RBUFSZ - 1)] = c; } + mutex_spin_exit(&sc->sc_intr_lock); + + if (sc->sc_rbuf_w != sc->sc_rbuf_r) + softint_schedule(sc->sc_sih); return 0; } +static void +meson_uart_rxsoft(void *priv) +{ + struct meson_uart_softc *sc = priv; + struct tty *tp = sc->sc_tty; + int c; + + while (sc->sc_rbuf_w != sc->sc_rbuf_r) { + c = sc->sc_rbuf[sc->sc_rbuf_r++ & (MESON_RBUFSZ - 1)]; + if (tp->t_linesw->l_rint(c & 0xff, tp) == -1) + break; + } +} + static int meson_uart_console_match(int phandle) {