Index: head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c =================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c (nonexistent) +++ head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c (revision 328257) @@ -0,0 +1,212 @@ +/*- + * Copyright (C) 2013-2015 Daisuke Aoyama + * 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 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 AUTHOR 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 +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +static struct ofw_compat_data compat_data[] = { + {"brcm,bcm2835-cprman", 1}, + {"broadcom,bcm2835-cprman", 1}, + {NULL, 0} +}; + +struct bcm2835_clkman_softc { + device_t sc_dev; + + struct resource * sc_m_res; + bus_space_tag_t sc_m_bst; + bus_space_handle_t sc_m_bsh; +}; + +#define BCM_CLKMAN_WRITE(_sc, _off, _val) \ + bus_space_write_4(_sc->sc_m_bst, _sc->sc_m_bsh, _off, _val) +#define BCM_CLKMAN_READ(_sc, _off) \ + bus_space_read_4(_sc->sc_m_bst, _sc->sc_m_bsh, _off) + +#define W_CMCLK(_sc, unit, _val) BCM_CLKMAN_WRITE(_sc, unit, 0x5a000000 | (_val)) +#define R_CMCLK(_sc, unit) BCM_CLKMAN_READ(_sc, unit) +#define W_CMDIV(_sc, unit, _val) BCM_CLKMAN_WRITE(_sc, (unit) + 4, 0x5a000000 | (_val)) +#define R_CMDIV(_sc, unit) BCM_CLKMAN_READ(_sc, (unit) + 4) + +static int +bcm2835_clkman_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "BCM283x Clock Manager"); + + return (BUS_PROBE_DEFAULT); +} + +static int +bcm2835_clkman_attach(device_t dev) +{ + struct bcm2835_clkman_softc *sc; + int rid; + + if (device_get_unit(dev) != 0) { + device_printf(dev, "only one clk manager supported\n"); + return (ENXIO); + } + + sc = device_get_softc(dev); + sc->sc_dev = dev; + + rid = 0; + sc->sc_m_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->sc_m_res) { + device_printf(dev, "cannot allocate memory window\n"); + return (ENXIO); + } + + sc->sc_m_bst = rman_get_bustag(sc->sc_m_res); + sc->sc_m_bsh = rman_get_bushandle(sc->sc_m_res); + + return (bus_generic_attach(dev)); +} + +uint32_t +bcm2835_clkman_set_frequency(device_t dev, uint32_t unit, uint32_t hz) +{ + struct bcm2835_clkman_softc *sc; + int i; + uint32_t u; + + sc = device_get_softc(dev); + + if (unit != BCM_PWM_CLKSRC) { + device_printf(sc->sc_dev, + "Unsupported unit 0x%x", unit); + return (0); + } + + W_CMCLK(sc, unit, 6); + for (i = 0; i < 10; i++) { + u = R_CMCLK(sc, unit); + if (!(u&0x80)) + break; + DELAY(1000); + } + if (u & 0x80) { + device_printf(sc->sc_dev, + "Failed to stop clock for unit 0x%x", unit); + return (0); + } + if (hz == 0) + return (0); + + u = 500000000/hz; + if (u < 4) { + device_printf(sc->sc_dev, + "Frequency too high for unit 0x%x (max: 125MHz)", + unit); + return (0); + } + if (u > 0xfff) { + device_printf(sc->sc_dev, + "Frequency too low for unit 0x%x (min: 123Hz)", + unit); + return (0); + } + hz = 500000000/u; + W_CMDIV(sc, unit, u << 12); + + W_CMCLK(sc, unit, 0x16); + for (i = 0; i < 10; i++) { + u = R_CMCLK(sc, unit); + if ((u&0x80)) + break; + DELAY(1000); + } + if (!(u & 0x80)) { + device_printf(sc->sc_dev, + "Failed to start clock for unit 0x%x", unit); + return (0); + } + return (hz); +} + +static int +bcm2835_clkman_detach(device_t dev) +{ + struct bcm2835_clkman_softc *sc; + + bus_generic_detach(dev); + + sc = device_get_softc(dev); + if (sc->sc_m_res) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_m_res); + + return (0); +} + +static device_method_t bcm2835_clkman_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, bcm2835_clkman_probe), + DEVMETHOD(device_attach, bcm2835_clkman_attach), + DEVMETHOD(device_detach, bcm2835_clkman_detach), + + DEVMETHOD_END +}; + +static devclass_t bcm2835_clkman_devclass; +static driver_t bcm2835_clkman_driver = { + "bcm2835_clkman", + bcm2835_clkman_methods, + sizeof(struct bcm2835_clkman_softc), +}; + +DRIVER_MODULE(bcm2835_clkman, simplebus, bcm2835_clkman_driver, + bcm2835_clkman_devclass, 0, 0); +MODULE_VERSION(bcm2835_clkman, 1); Property changes on: head/sys/arm/broadcom/bcm2835/bcm2835_clkman.c ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/sys/arm/broadcom/bcm2835/bcm2835_clkman.h =================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_clkman.h (nonexistent) +++ head/sys/arm/broadcom/bcm2835/bcm2835_clkman.h (revision 328257) @@ -0,0 +1,43 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017 Poul-Henning Kamp + * + * 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 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 AUTHOR 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. + * + * $FreeBSD$ + */ + +#ifndef _BCM2835_CLKMAN_H_ +#define _BCM2835_CLKMAN_H_ + +// Offset into BAR0 for unit +enum bcm2835_clksrc { + BCM_GPIO0_CLKSRC = 0x70, + BCM_GPIO1_CLKSRC = 0x78, + BCM_GPIO2_CLKSRC = 0x80, + BCM_PWM_CLKSRC = 0xa0, +}; + +uint32_t bcm2835_clkman_set_frequency(device_t, uint32_t, uint32_t); + +#endif /* _BCM2835_CLKMAN_H_ */ Property changes on: head/sys/arm/broadcom/bcm2835/bcm2835_clkman.h ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c =================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c (revision 328256) +++ head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c (revision 328257) @@ -1,441 +1,389 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2017 Poul-Henning Kamp * 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 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 AUTHOR 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 __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include -#include #include #include #include +#include static struct ofw_compat_data compat_data[] = { {"broadcom,bcm2835-pwm", 1}, {"brcm,bcm2835-pwm", 1}, {NULL, 0} }; struct bcm_pwm_softc { device_t sc_dev; struct resource * sc_mem_res; bus_space_tag_t sc_m_bst; bus_space_handle_t sc_m_bsh; - struct resource * sc_clk_res; - bus_space_tag_t sc_c_bst; - bus_space_handle_t sc_c_bsh; + device_t clkman; uint32_t freq; uint32_t period; uint32_t ratio; uint32_t mode; }; #define BCM_PWM_MEM_WRITE(_sc, _off, _val) \ bus_space_write_4(_sc->sc_m_bst, _sc->sc_m_bsh, _off, _val) #define BCM_PWM_MEM_READ(_sc, _off) \ bus_space_read_4(_sc->sc_m_bst, _sc->sc_m_bsh, _off) #define BCM_PWM_CLK_WRITE(_sc, _off, _val) \ bus_space_write_4(_sc->sc_c_bst, _sc->sc_c_bsh, _off, _val) #define BCM_PWM_CLK_READ(_sc, _off) \ bus_space_read_4(_sc->sc_c_bst, _sc->sc_c_bsh, _off) #define W_CTL(_sc, _val) BCM_PWM_MEM_WRITE(_sc, 0x00, _val) #define R_CTL(_sc) BCM_PWM_MEM_READ(_sc, 0x00) #define W_STA(_sc, _val) BCM_PWM_MEM_WRITE(_sc, 0x04, _val) #define R_STA(_sc) BCM_PWM_MEM_READ(_sc, 0x04) #define W_RNG(_sc, _val) BCM_PWM_MEM_WRITE(_sc, 0x10, _val) #define R_RNG(_sc) BCM_PWM_MEM_READ(_sc, 0x10) #define W_DAT(_sc, _val) BCM_PWM_MEM_WRITE(_sc, 0x14, _val) #define R_DAT(_sc) BCM_PWM_MEM_READ(_sc, 0x14) -#define W_CMCLK(_sc, _val) BCM_PWM_CLK_WRITE(_sc, 0x00, 0x5a000000 | (_val)) -#define R_CMCLK(_sc) BCM_PWM_CLK_READ(_sc, 0x00) -#define W_CMDIV(_sc, _val) BCM_PWM_CLK_WRITE(_sc, 0x04, 0x5a000000 | (_val)) -#define R_CMDIV(_s) BCM_PWM_CLK_READ(_sc, 0x04) - static int bcm_pwm_reconf(struct bcm_pwm_softc *sc) { - int i; uint32_t u; device_t gpio; /* Disable PWM */ W_CTL(sc, 0); /* Stop PWM clock */ - W_CMCLK(sc, 6); - for (i = 0; i < 10; i++) { - u = R_CMCLK(sc); - if (!(u&0x80)) - break; - DELAY(1000); - } - if (u&0x80) { - device_printf(sc->sc_dev, "Failed to stop clock\n"); - return(EIO); - } + (void)bcm2835_clkman_set_frequency(sc->clkman, BCM_PWM_CLKSRC, 0); - if (sc->mode == 0) { - // XXX: GPIO cfg ? + if (sc->mode == 0) return (0); - } /* Ask GPIO0 to set ALT0 for pin 12 */ gpio = devclass_get_device(devclass_find("gpio"), 0); if (!gpio) { device_printf(sc->sc_dev, "cannot find gpio0\n"); return (ENXIO); } bcm_gpio_set_alternate(gpio, 12, BCM_GPIO_ALT0); - /* Configure divider */ - u = 500000000/sc->freq; - if (u < 4) { - device_printf(sc->sc_dev, "Freq too high (max 125MHz)\n"); - return(EINVAL); - } - if (u > 0xfff) { - device_printf(sc->sc_dev, "Freq too low (min 123Hz)\n"); - return(EINVAL); - } - sc->freq = 500000000/u; - W_CMDIV(sc, u << 12); + u = bcm2835_clkman_set_frequency(sc->clkman, BCM_PWM_CLKSRC, sc->freq); + if (u == 0) + return (EINVAL); + sc->freq = u; - /* Start PWM clock */ - W_CMCLK(sc, 0x16); - for (i = 0; i < 10; i++) { - u = R_CMCLK(sc); - if ((u&0x80)) - break; - DELAY(1000); - } - if (!(u&0x80)) { - device_printf(sc->sc_dev, "Failed to start clock\n"); - return(EIO); - } - /* Config PWM */ W_RNG(sc, sc->period); if (sc->ratio > sc->period) sc->ratio = sc->period; W_DAT(sc, sc->ratio); /* Start PWM */ if (sc->mode == 1) W_CTL(sc, 0x81); else W_CTL(sc, 0x1); return (0); } static int bcm_pwm_pwm_freq_proc(SYSCTL_HANDLER_ARGS) { struct bcm_pwm_softc *sc; uint32_t r; int error; sc = (struct bcm_pwm_softc *)arg1; if (sc->mode == 1) r = sc->freq / sc->period; else r = 0; error = sysctl_handle_int(oidp, &r, sizeof(r), req); return (error); } static int bcm_pwm_mode_proc(SYSCTL_HANDLER_ARGS) { struct bcm_pwm_softc *sc; uint32_t r; int error; sc = (struct bcm_pwm_softc *)arg1; r = sc->mode; error = sysctl_handle_int(oidp, &r, sizeof(r), req); if (error != 0 || req->newptr == NULL) return (error); if (r > 2) return (EINVAL); sc->mode = r; return (bcm_pwm_reconf(sc)); } static int bcm_pwm_freq_proc(SYSCTL_HANDLER_ARGS) { struct bcm_pwm_softc *sc; uint32_t r; int error; sc = (struct bcm_pwm_softc *)arg1; r = sc->freq; error = sysctl_handle_int(oidp, &r, sizeof(r), req); if (error != 0 || req->newptr == NULL) return (error); if (r > 125000000) return (EINVAL); sc->freq = r; return (bcm_pwm_reconf(sc)); } static int bcm_pwm_period_proc(SYSCTL_HANDLER_ARGS) { struct bcm_pwm_softc *sc; int error; sc = (struct bcm_pwm_softc *)arg1; error = sysctl_handle_int(oidp, &sc->period, sizeof(sc->period), req); if (error != 0 || req->newptr == NULL) return (error); return (bcm_pwm_reconf(sc)); } static int bcm_pwm_ratio_proc(SYSCTL_HANDLER_ARGS) { struct bcm_pwm_softc *sc; uint32_t r; int error; sc = (struct bcm_pwm_softc *)arg1; r = sc->ratio; error = sysctl_handle_int(oidp, &r, sizeof(r), req); if (error != 0 || req->newptr == NULL) return (error); if (r > sc->period) // XXX >= ? return (EINVAL); sc->ratio = r; BCM_PWM_MEM_WRITE(sc, 0x14, sc->ratio); return (0); } static int bcm_pwm_reg_proc(SYSCTL_HANDLER_ARGS) { struct bcm_pwm_softc *sc; uint32_t reg; int error; sc = (struct bcm_pwm_softc *)arg1; - if (arg2 & 0x100) - reg = BCM_PWM_CLK_READ(sc, arg2 & 0xff); - else - reg = BCM_PWM_MEM_READ(sc, arg2 & 0xff); + reg = BCM_PWM_MEM_READ(sc, arg2 & 0xff); error = sysctl_handle_int(oidp, ®, sizeof(reg), req); if (error != 0 || req->newptr == NULL) return (error); - if (arg2 & 0x100) - BCM_PWM_CLK_WRITE(sc, arg2 & 0xff, reg); - else - BCM_PWM_MEM_WRITE(sc, arg2, reg); + BCM_PWM_MEM_WRITE(sc, arg2, reg); return (0); } static void bcm_pwm_sysctl_init(struct bcm_pwm_softc *sc) { struct sysctl_ctx_list *ctx; struct sysctl_oid *tree_node; struct sysctl_oid_list *tree; /* * Add system sysctl tree/handlers. */ ctx = device_get_sysctl_ctx(sc->sc_dev); tree_node = device_get_sysctl_tree(sc->sc_dev); tree = SYSCTL_CHILDREN(tree_node); if (bootverbose) { #define RR(x,y) \ SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, y, \ CTLFLAG_RW | CTLTYPE_UINT, sc, 0x##x, \ bcm_pwm_reg_proc, "IU", "Register 0x" #x " " y); - RR(100, "PWMCTL") - RR(104, "PWMDIV") RR(24, "DAT2") RR(20, "RNG2") RR(18, "FIF1") RR(14, "DAT1") RR(10, "RNG1") RR(08, "DMAC") RR(04, "STA") RR(00, "CTL") #undef RR } SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "pwm_freq", CTLFLAG_RD | CTLTYPE_UINT, sc, 0, bcm_pwm_pwm_freq_proc, "IU", "PWM frequency (Hz)"); SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "period", CTLFLAG_RW | CTLTYPE_UINT, sc, 0, bcm_pwm_period_proc, "IU", "PWM period (#clocks)"); SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "ratio", CTLFLAG_RW | CTLTYPE_UINT, sc, 0, bcm_pwm_ratio_proc, "IU", "PWM ratio (0...period)"); SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "freq", CTLFLAG_RW | CTLTYPE_UINT, sc, 0, bcm_pwm_freq_proc, "IU", "PWM clock (Hz)"); SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "mode", CTLFLAG_RW | CTLTYPE_UINT, sc, 0, bcm_pwm_mode_proc, "IU", "PWM mode (0=off, 1=pwm, 2=dither)"); } static int bcm_pwm_probe(device_t dev) { +#if 0 + // XXX: default state is disabled in RPI3 DTB, assume for now + // XXX: that people want the PWM to work if the KLD this module. if (!ofw_bus_status_okay(dev)) return (ENXIO); +#endif if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); device_set_desc(dev, "BCM2708/2835 PWM controller"); return (BUS_PROBE_DEFAULT); } static int bcm_pwm_attach(device_t dev) { struct bcm_pwm_softc *sc; int rid; if (device_get_unit(dev) != 0) { device_printf(dev, "only one PWM controller supported\n"); return (ENXIO); } sc = device_get_softc(dev); sc->sc_dev = dev; + sc->clkman = devclass_get_device(devclass_find("bcm2835_clkman"), 0); + if (sc->clkman == NULL) { + device_printf(dev, "cannot find Clock Manager\n"); + return (ENXIO); + } + rid = 0; sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (!sc->sc_mem_res) { device_printf(dev, "cannot allocate memory window\n"); return (ENXIO); } sc->sc_m_bst = rman_get_bustag(sc->sc_mem_res); sc->sc_m_bsh = rman_get_bushandle(sc->sc_mem_res); - rid = 1; - sc->sc_clk_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE); - if (!sc->sc_clk_res) { - device_printf(dev, "cannot allocate clock window\n"); - return (ENXIO); - } - sc->sc_c_bst = rman_get_bustag(sc->sc_clk_res); - sc->sc_c_bsh = rman_get_bushandle(sc->sc_clk_res); - /* Add sysctl nodes. */ bcm_pwm_sysctl_init(sc); sc->freq = 125000000; sc->period = 10000; sc->ratio = 2500; return (bus_generic_attach(dev)); } static int bcm_pwm_detach(device_t dev) { struct bcm_pwm_softc *sc; bus_generic_detach(dev); sc = device_get_softc(dev); - sc->mode = 0; + sc->mode = 0; (void)bcm_pwm_reconf(sc); if (sc->sc_mem_res) bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); - if (sc->sc_clk_res) - bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_clk_res); return (0); } static phandle_t bcm_pwm_get_node(device_t bus, device_t dev) { - /* We only have one child, the SPI bus, which needs our own node. */ return (ofw_bus_get_node(bus)); } + static device_method_t bcm_pwm_methods[] = { /* Device interface */ DEVMETHOD(device_probe, bcm_pwm_probe), DEVMETHOD(device_attach, bcm_pwm_attach), DEVMETHOD(device_detach, bcm_pwm_detach), - - /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, bcm_pwm_get_node), DEVMETHOD_END }; static devclass_t bcm_pwm_devclass; static driver_t bcm_pwm_driver = { "pwm", bcm_pwm_methods, sizeof(struct bcm_pwm_softc), }; DRIVER_MODULE(bcm2835_pwm, simplebus, bcm_pwm_driver, bcm_pwm_devclass, 0, 0); +MODULE_DEPEND(bcm2835_pwm, bcm2835_clkman, 1, 1, 1); Index: head/sys/dts/arm/bcm2836.dtsi =================================================================== --- head/sys/dts/arm/bcm2836.dtsi (revision 328256) +++ head/sys/dts/arm/bcm2836.dtsi (revision 328257) @@ -1,503 +1,508 @@ /* * Copyright (c) 2012 Oleksandr Tymoshenko * * 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 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 AUTHOR 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. * * $FreeBSD$ */ / { #address-cells = <1>; #size-cells = <1>; timer { compatible = "arm,armv7-timer"; clock-frequency = <19200000>; interrupts = <0 1 3 2>; interrupt-parent = <&local_intc>; }; SOC: axi { compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; reg = <0x3f000000 0x01000000>; ranges = <0 0x3f000000 0x01000000>, <0x40000000 0x40000000 0x00001000>; local_intc: local_intc { compatible = "brcm,bcm2836-l1-intc"; reg = <0x40000000 0x100>; interrupt-controller; #interrupt-cells = <1>; interrupt-parent = <&local_intc>; }; intc: interrupt-controller { compatible = "broadcom,bcm2835-armctrl-ic", "broadcom,bcm2708-armctrl-ic"; reg = <0xB200 0x200>; interrupt-parent = <&local_intc>; interrupts = <8>; interrupt-controller; #interrupt-cells = <1>; /* Bank 0 * 0: ARM_TIMER * 1: ARM_MAILBOX * 2: ARM_DOORBELL_0 * 3: ARM_DOORBELL_1 * 4: VPU0_HALTED * 5: VPU1_HALTED * 6: ILLEGAL_TYPE0 * 7: ILLEGAL_TYPE1 */ /* Bank 1 * 0: TIMER0 16: DMA0 * 1: TIMER1 17: DMA1 * 2: TIMER2 18: VC_DMA2 * 3: TIMER3 19: VC_DMA3 * 4: CODEC0 20: DMA4 * 5: CODEC1 21: DMA5 * 6: CODEC2 22: DMA6 * 7: VC_JPEG 23: DMA7 * 8: ISP 24: DMA8 * 9: VC_USB 25: DMA9 * 10: VC_3D 26: DMA10 * 11: TRANSPOSER 27: DMA11 * 12: MULTICORESYNC0 28: DMA12 * 13: MULTICORESYNC1 29: AUX * 14: MULTICORESYNC2 30: ARM * 15: MULTICORESYNC3 31: VPUDMA */ /* Bank 2 * 0: HOSTPORT 16: SMI * 1: VIDEOSCALER 17: GPIO0 * 2: CCP2TX 18: GPIO1 * 3: SDC 19: GPIO2 * 4: DSI0 20: GPIO3 * 5: AVE 21: VC_I2C * 6: CAM0 22: VC_SPI * 7: CAM1 23: VC_I2SPCM * 8: HDMI0 24: VC_SDIO * 9: HDMI1 25: VC_UART * 10: PIXELVALVE1 26: SLIMBUS * 11: I2CSPISLV 27: VEC * 12: DSI1 28: CPG * 13: PWA0 29: RNG * 14: PWA1 30: VC_ARASANSDIO * 15: CPR 31: AVSPMON */ }; watchdog0 { compatible = "broadcom,bcm2835-wdt", "broadcom,bcm2708-wdt"; reg = <0x10001c 0x0c>; /* 0x1c, 0x20, 0x24 */ }; gpio: gpio { compatible = "broadcom,bcm2835-gpio", "broadcom,bcm2708-gpio"; reg = <0x200000 0xb0>; /* Unusual arrangement of interrupts * (determined by testing) * 17: Bank 0 (GPIOs 0-31) * 19: Bank 1 (GPIOs 32-53) * 18: Bank 2 * 20: All banks (GPIOs 0-53) */ interrupts = <57 59 58 60>; interrupt-parent = <&intc>; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupt-cells = <2>; pinctrl-names = "default"; pinctrl-0 = <&pins_reserved>; /* Pins that can short 3.3V to GND in output mode: 46 * Pins used by VideoCore: 48-53 */ broadcom,read-only = <46>, <48>, <49>, <50>, <51>, <52>, <53>; /* BSC0 */ pins_bsc0_a: bsc0_a { broadcom,pins = <0>, <1>; }; pins_bsc0_b: bsc0_b { broadcom,pins = <28>, <29>; }; pins_bsc0_c: bsc0_c { broadcom,pins = <44>, <45>; }; /* BSC1 */ pins_bsc1_a: bsc1_a { broadcom,pins = <2>, <3>; }; pins_bsc1_b: bsc1_b { broadcom,pins = <44>, <45>; }; /* GPCLK0 */ pins_gpclk0_a: gpclk0_a { broadcom,pins = <4>; }; pins_gpclk0_b: gpclk0_b { broadcom,pins = <20>; }; pins_gpclk0_c: gpclk0_c { broadcom,pins = <32>; }; pins_gpclk0_d: gpclk0_d { broadcom,pins = <34>; }; /* GPCLK1 */ pins_gpclk1_a: gpclk1_a { broadcom,pins = <5>; }; pins_gpclk1_b: gpclk1_b { broadcom,pins = <21>; }; pins_gpclk1_c: gpclk1_c { broadcom,pins = <42>; }; pins_gpclk1_d: gpclk1_d { broadcom,pins = <44>; }; /* GPCLK2 */ pins_gpclk2_a: gpclk2_a { broadcom,pins = <6>; }; pins_gpclk2_b: gpclk2_b { broadcom,pins = <43>; }; /* SPI0 */ pins_spi0_a: spi0_a { broadcom,pins = <7>, <8>, <9>, <10>, <11>; }; pins_spi0_b: spi0_b { broadcom,pins = <35>, <36>, <37>, <38>, <39>; }; /* PWM */ pins_pwm0_a: pwm0_a { broadcom,pins = <12>; }; pins_pwm0_b: pwm0_b { broadcom,pins = <18>; }; pins_pwm0_c: pwm0_c { broadcom,pins = <40>; }; pins_pwm1_a: pwm1_a { broadcom,pins = <13>; }; pins_pwm1_b: pwm1_b { broadcom,pins = <19>; }; pins_pwm1_c: pwm1_c { broadcom,pins = <41>; }; pins_pwm1_d: pwm1_d { broadcom,pins = <45>; }; /* UART0 */ pins_uart0_a: uart0_a { broadcom,pins = <14>, <15>; }; pins_uart0_b: uart0_b { broadcom,pins = <32>, <33>; }; pins_uart0_c: uart0_c { broadcom,pins = <36>, <37>; }; pins_uart0_fc_a: uart0_fc_a { broadcom,pins = <16>, <17>; }; pins_uart0_fc_b: uart0_fc_b { broadcom,pins = <30>, <31>; }; pins_uart0_fc_c: uart0_fc_c { broadcom,pins = <39>, <38>; }; /* PCM */ pins_pcm_a: pcm_a { broadcom,pins = <18>, <19>, <20>, <21>; }; pins_pcm_b: pcm_b { broadcom,pins = <28>, <29>, <30>, <31>; }; /* Secondary Address Bus */ pins_sm_addr_a: sm_addr_a { broadcom,pins = <5>, <4>, <3>, <2>, <1>, <0>; }; pins_sm_addr_b: sm_addr_b { broadcom,pins = <33>, <32>, <31>, <30>, <29>, <28>; }; pins_sm_ctl_a: sm_ctl_a { broadcom,pins = <6>, <7>; }; pins_sm_ctl_b: sm_ctl_b { broadcom,pins = <34>, <35>; }; pins_sm_data_8bit_a: sm_data_8bit_a { broadcom,pins = <8>, <9>, <10>, <11>, <12>, <13>, <14>, <15>; }; pins_sm_data_8bit_b: sm_data_8bit_b { broadcom,pins = <36>, <37>, <38>, <39>, <40>, <41>, <42>, <43>; }; pins_sm_data_16bit: sm_data_16bit { broadcom,pins = <16>, <17>, <18>, <19>, <20>, <21>, <22>, <23>; }; pins_sm_data_18bit: sm_data_18bit { broadcom,pins = <24>, <25>; }; /* BSCSL */ pins_bscsl: bscsl { broadcom,pins = <18>, <19>; }; /* SPISL */ pins_spisl: spisl { broadcom,pins = <18>, <19>, <20>, <21>; }; /* SPI1 */ pins_spi1: spi1 { broadcom,pins = <16>, <17>, <18>, <19>, <20>, <21>; }; /* UART1 */ pins_uart1_a: uart1_a { broadcom,pins = <14>, <15>; }; pins_uart1_b: uart1_b { broadcom,pins = <32>, <33>; }; pins_uart1_c: uart1_c { broadcom,pins = <40>, <41>; }; pins_uart1_fc_a: uart1_fc_a { broadcom,pins = <16>, <17>; }; pins_uart1_fc_b: uart1_fc_b { broadcom,pins = <30>, <31>; }; pins_uart1_fc_c: uart1_fc_c { broadcom,pins = <43>, <42>; }; /* SPI2 */ pins_spi2: spi2 { broadcom,pins = <40>, <41>, <42>, <43>, <44>, <45>; }; /* ARM JTAG */ pins_arm_jtag_trst: arm_jtag_trst { broadcom,pins = <22>; }; pins_arm_jtag_a: arm_jtag_a { broadcom,pins = <4>, <5>, <6>, <12>, <13>; }; pins_arm_jtag_b: arm_jtag_b { broadcom,pins = <23>, <24>, <25>, <26>, <27>; }; /* Reserved */ pins_reserved: reserved { broadcom,pins = <48>, <49>, <50>, <51>, <52>, <53>; }; }; + cprman { + compatible = "broadcom,bcm2835-cprman"; + reg = <0x101000 0x2000>; + }; + rng { compatible = "broadcom,bcm2835-rng", "broadcom,bcm2708-rng"; reg = <0x104000 0x20>; interrupts = <69>; interrupt-parent = <&intc>; }; bsc0 { #address-cells = <1>; #size-cells = <0>; compatible = "broadcom,bcm2835-bsc", "broadcom,bcm2708-bsc"; reg = <0x205000 0x20>; interrupts = <61>; interrupt-parent = <&intc>; }; bsc1 { #address-cells = <1>; #size-cells = <0>; compatible = "broadcom,bcm2835-bsc", "broadcom,bcm2708-bsc"; reg = <0x804000 0x20>; interrupts = <61>; interrupt-parent = <&intc>; }; spi0 { compatible = "broadcom,bcm2835-spi", "broadcom,bcm2708-spi"; reg = <0x204000 0x20>; interrupts = <62>; interrupt-parent = <&intc>; }; pwm0 { compatible = "broadcom,bcm2835-pwm"; - reg = <0x20c000 0x28>,<0x1010a0 8>; + reg = <0x20c000 0x28>; }; dma: dma { compatible = "broadcom,bcm2835-dma", "broadcom,bcm2708-dma"; reg = <0x7000 0x1000>, <0xE05000 0x1000>; interrupts = <24 25 26 27 28 29 30 31 32 33 34 35 36>; interrupt-parent = <&intc>; broadcom,channels = <0x7f35>; }; vc_mbox: mbox { compatible = "broadcom,bcm2835-mbox", "broadcom,bcm2708-mbox"; reg = <0xB880 0x40>; interrupts = <1>; interrupt-parent = <&intc>; /* Channels * 0: Power * 1: Frame buffer * 2: Virtual UART * 3: VCHIQ * 4: LEDs * 5: Buttons * 6: Touch screen */ }; sdhci { compatible = "broadcom,bcm2835-sdhci", "broadcom,bcm2708-sdhci"; reg = <0x300000 0x100>; interrupts = <70>; interrupt-parent = <&intc>; clock-frequency = <250000000>; /* Set by VideoCore */ }; uart0: uart0 { compatible = "broadcom,bcm2835-uart", "broadcom,bcm2708-uart", "arm,pl011", "arm,primecell"; reg = <0x201000 0x1000>; interrupts = <65>; interrupt-parent = <&intc>; clock-frequency = <3000000>; /* Set by VideoCore */ reg-shift = <2>; }; vchiq: vchiq { compatible = "broadcom,bcm2835-vchiq"; reg = <0xB800 0x50>; interrupts = <2>; interrupt-parent = <&intc>; cache-line-size = <32>; }; usb { compatible = "broadcom,bcm2835-usb", "broadcom,bcm2708-usb", "synopsys,designware-hs-otg2"; reg = <0x980000 0x20000>; interrupts = <17>; interrupt-parent = <&intc>; #address-cells = <1>; #size-cells = <0>; }; }; }; Index: head/sys/modules/Makefile =================================================================== --- head/sys/modules/Makefile (revision 328256) +++ head/sys/modules/Makefile (revision 328257) @@ -1,838 +1,840 @@ # $FreeBSD$ SYSDIR?=${SRCTOP}/sys .include "${SYSDIR}/conf/kern.opts.mk" SUBDIR_PARALLEL= # Modules that include binary-only blobs of microcode should be selectable by # MK_SOURCELESS_UCODE option (see below). .if defined(MODULES_OVERRIDE) && !defined(ALL_MODULES) SUBDIR=${MODULES_OVERRIDE} .else SUBDIR= \ ${_3dfx} \ ${_3dfx_linux} \ ${_aac} \ ${_aacraid} \ accf_data \ accf_dns \ accf_http \ acl_nfs4 \ acl_posix1e \ ${_acpi} \ ae \ ${_aesni} \ age \ ${_agp} \ aha \ ahci \ ${_aic} \ aic7xxx \ alc \ ale \ alq \ ${_amd_ecc_inject} \ ${_amdsbwd} \ ${_amdsmn} \ ${_amdtemp} \ amr \ ${_an} \ ${_aout} \ ${_apm} \ ${_arcmsr} \ ${_arcnet} \ ${_armv8crypto} \ ${_asmc} \ ata \ ath \ ath_dfs \ ath_hal \ ath_hal_ar5210 \ ath_hal_ar5211 \ ath_hal_ar5212 \ ath_hal_ar5416 \ ath_hal_ar9300 \ ath_main \ ath_rate \ ath_pci \ ${_autofs} \ ${_auxio} \ ${_bce} \ + ${_bcm283x_clkman} \ ${_bcm283x_pwm} \ bfe \ bge \ bhnd \ ${_bxe} \ ${_bios} \ ${_bktr} \ ${_bm} \ bnxt \ bridgestp \ bwi \ bwn \ bwn_pci \ ${_bytgpio} \ cam \ ${_cardbus} \ ${_carp} \ cas \ ${_cbb} \ cc \ ${_ccp} \ cd9660 \ cd9660_iconv \ ${_ce} \ ${_cfi} \ chacha20 \ ${_chromebook_platform} \ ${_ciss} \ cloudabi \ ${_cloudabi32} \ ${_cloudabi64} \ ${_cm} \ ${_cmx} \ ${_coff} \ ${_coretemp} \ ${_cp} \ ${_cpsw} \ ${_cpuctl} \ ${_cpufreq} \ ${_crypto} \ ${_cryptodev} \ ${_cs} \ ${_ctau} \ ctl \ ${_cxgb} \ ${_cxgbe} \ dc \ dcons \ dcons_crom \ de \ ${_dpms} \ ${_dpt} \ ${_drm} \ ${_drm2} \ dummynet \ ${_ed} \ ${_efirt} \ ${_em} \ ${_ena} \ ${_ep} \ ${_epic} \ esp \ ${_et} \ evdev \ ${_ex} \ ${_exca} \ ext2fs \ fdc \ fdescfs \ ${_fe} \ ${_ffec} \ filemon \ firewire \ firmware \ fuse \ ${_fxp} \ gem \ geom \ ${_glxiic} \ ${_glxsb} \ gpio \ hifn \ hme \ ${_hpt27xx} \ ${_hptiop} \ ${_hptmv} \ ${_hptnr} \ ${_hptrr} \ hwpmc \ ${_hwpmc_mips24k} \ ${_hwpmc_mips74k} \ ${_hyperv} \ i2c \ ${_ibcore} \ ${_ibcs2} \ ${_ichwd} \ ${_ida} \ if_bridge \ if_disc \ if_edsc \ ${_if_enc} \ if_epair \ ${_if_gif} \ ${_if_gre} \ ${_if_me} \ if_lagg \ ${_if_ndis} \ ${_if_stf} \ if_tap \ if_tun \ if_vlan \ if_vxlan \ ${_iir} \ imgact_binmisc \ ${_intelspi} \ ${_io} \ ${_ioat} \ ${_ipoib} \ ${_ipdivert} \ ${_ipfilter} \ ${_ipfw} \ ipfw_nat \ ${_ipfw_nat64} \ ${_ipfw_nptv6} \ ${_ipfw_pmod} \ ${_ipmi} \ ip6_mroute_mod \ ip_mroute_mod \ ${_ips} \ ${_ipsec} \ ${_ipw} \ ${_ipwfw} \ ${_isci} \ ${_iser} \ isp \ ${_ispfw} \ ${_iwi} \ ${_iwifw} \ ${_iwm} \ ${_iwmfw} \ ${_iwn} \ ${_iwnfw} \ ${_ix} \ ${_ixv} \ ${_ixgb} \ ${_ixl} \ ${_ixlv} \ jme \ joy \ kbdmux \ kgssapi \ kgssapi_krb5 \ khelp \ krpc \ ksyms \ le \ lge \ libalias \ libiconv \ libmchain \ ${_linprocfs} \ ${_linsysfs} \ ${_linux} \ ${_linux_common} \ ${_linux64} \ linuxkpi \ ${_lio} \ lmc \ lpt \ mac_biba \ mac_bsdextended \ mac_ifoff \ mac_lomac \ mac_mls \ mac_none \ mac_partition \ mac_portacl \ mac_seeotheruids \ mac_stub \ mac_test \ malo \ md \ mdio \ mem \ mfi \ mii \ mlx \ ${_mlx4} \ ${_mlx4ib} \ ${_mlx4en} \ ${_mlx5} \ ${_mlx5en} \ ${_mlx5ib} \ ${_mly} \ mmc \ mmcsd \ mpr \ mps \ mpt \ mqueue \ mrsas \ msdosfs \ msdosfs_iconv \ ${_mse} \ msk \ mvs \ mwl \ ${_mwlfw} \ mxge \ my \ ${_nandfs} \ ${_nandsim} \ ${_ncr} \ ${_nctgpio} \ ${_ncv} \ ${_ndis} \ ${_netgraph} \ ${_nfe} \ nfscl \ nfscommon \ nfsd \ nfslock \ nfslockd \ nfssvc \ nge \ nmdm \ ${_nsp} \ nullfs \ ${_ntb} \ ${_nvd} \ ${_nvme} \ ${_nvram} \ ${_nxge} \ oce \ otus \ ${_otusfw} \ ow \ ${_padlock} \ ${_padlock_rng} \ ${_pccard} \ ${_pcfclock} \ pcn \ ${_pf} \ ${_pflog} \ ${_pfsync} \ plip \ ${_pms} \ ppbus \ ppc \ ppi \ pps \ procfs \ proto \ pseudofs \ ${_pst} \ pty \ puc \ ${_qlxge} \ ${_qlxgb} \ ${_qlxgbe} \ ${_qlnx} \ ral \ ${_ralfw} \ ${_random_fortuna} \ ${_random_yarrow} \ ${_random_other} \ rc4 \ ${_rdma} \ ${_rdrand_rng} \ re \ rl \ rtwn \ rtwn_pci \ rtwn_usb \ ${_rtwnfw} \ ${_s3} \ ${_safe} \ ${_sbni} \ scc \ ${_scsi_low} \ sdhci \ ${_sdhci_acpi} \ sdhci_pci \ sem \ send \ ${_sf} \ ${_sfxge} \ sge \ ${_sgx} \ ${_sgx_linux} \ siba_bwn \ siftr \ siis \ sis \ sk \ smbfs \ sn \ snp \ sound \ ${_speaker} \ spigen \ ${_splash} \ ${_sppp} \ ste \ ${_stg} \ stge \ ${_sym} \ ${_syscons} \ sysvipc \ tcp \ ${_ti} \ tl \ tmpfs \ ${_toecore} \ ${_tpm} \ trm \ ${_twa} \ twe \ tws \ tx \ ${_txp} \ uart \ ubsec \ udf \ udf_iconv \ ufs \ uinput \ unionfs \ usb \ ${_vesa} \ ${_virtio} \ vge \ ${_viawd} \ videomode \ vkbd \ ${_vmm} \ ${_vmware} \ ${_vpo} \ vr \ vte \ vx \ ${_vxge} \ wb \ ${_wbwd} \ ${_wi} \ wlan \ wlan_acl \ wlan_amrr \ wlan_ccmp \ wlan_rssadapt \ wlan_tkip \ wlan_wep \ wlan_xauth \ ${_wpi} \ ${_wpifw} \ ${_x86bios} \ ${_xe} \ xl \ zlib .if ${MK_AUTOFS} != "no" || defined(ALL_MODULES) _autofs= autofs .endif .if ${MK_CDDL} != "no" || defined(ALL_MODULES) .if (${MACHINE_CPUARCH} != "arm" || ${MACHINE_ARCH:Marmv[67]*} != "") && \ ${MACHINE_CPUARCH} != "mips" && \ ${MACHINE_CPUARCH} != "sparc64" SUBDIR+= dtrace .endif SUBDIR+= opensolaris .endif .if ${MK_CRYPT} != "no" || defined(ALL_MODULES) .if exists(${SRCTOP}/sys/opencrypto) _crypto= crypto _cryptodev= cryptodev _random_fortuna=random_fortuna _random_yarrow= random_yarrow _random_other= random_other .endif .endif .if ${MK_CUSE} != "no" || defined(ALL_MODULES) SUBDIR+= cuse .endif .if (${MK_INET_SUPPORT} != "no" || ${MK_INET6_SUPPORT} != "no") || \ defined(ALL_MODULES) _carp= carp _toecore= toecore _if_enc= if_enc _if_gif= if_gif _if_gre= if_gre _ipfw_pmod= ipfw_pmod .if ${MK_IPSEC_SUPPORT} != "no" _ipsec= ipsec .endif .endif .if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \ defined(ALL_MODULES) _if_stf= if_stf .endif .if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES) _if_me= if_me _ipdivert= ipdivert _ipfw= ipfw .if ${MK_INET6_SUPPORT} != "no" || defined(ALL_MODULES) _ipfw_nat64= ipfw_nat64 .endif .endif .if ${MK_INET6_SUPPORT} != "no" || defined(ALL_MODULES) _ipfw_nptv6= ipfw_nptv6 .endif .if ${MK_IPFILTER} != "no" || defined(ALL_MODULES) _ipfilter= ipfilter .endif .if ${MK_ISCSI} != "no" || defined(ALL_MODULES) SUBDIR+= cfiscsi SUBDIR+= iscsi SUBDIR+= iscsi_initiator .endif .if ${MK_NAND} != "no" || defined(ALL_MODULES) _nandfs= nandfs _nandsim= nandsim .endif .if ${MK_NETGRAPH} != "no" || defined(ALL_MODULES) _netgraph= netgraph .endif .if (${MK_PF} != "no" && (${MK_INET_SUPPORT} != "no" || \ ${MK_INET6_SUPPORT} != "no")) || defined(ALL_MODULES) _pf= pf _pflog= pflog .if ${MK_INET_SUPPORT} != "no" _pfsync= pfsync .endif .endif .if ${MK_SOURCELESS_UCODE} != "no" _bce= bce _fxp= fxp _ispfw= ispfw _sf= sf _ti= ti _txp= txp .if ${MACHINE_CPUARCH} != "mips" _mwlfw= mwlfw _otusfw= otusfw _ralfw= ralfw _rtwnfw= rtwnfw .endif .endif .if ${MK_SOURCELESS_UCODE} != "no" && ${MACHINE_CPUARCH} != "arm" && \ ${MACHINE_CPUARCH} != "mips" && \ ${MACHINE_ARCH} != "powerpc" && ${MACHINE_ARCH} != "powerpcspe" && \ ${MACHINE_CPUARCH} != "riscv" _cxgbe= cxgbe .endif .if ${MK_TESTS} != "no" || defined(ALL_MODULES) SUBDIR+= tests .endif .if ${MK_ZFS} != "no" || defined(ALL_MODULES) SUBDIR+= zfs .endif .if (${MACHINE_CPUARCH} == "mips" && ${MACHINE_ARCH:Mmips64} == "") _hwpmc_mips24k= hwpmc_mips24k _hwpmc_mips74k= hwpmc_mips74k .endif .if ${MACHINE_CPUARCH} != "aarch64" && ${MACHINE_CPUARCH} != "arm" && \ ${MACHINE_CPUARCH} != "mips" && ${MACHINE_CPUARCH} != "powerpc" && \ ${MACHINE_CPUARCH} != "riscv" _syscons= syscons _vpo= vpo .endif .if ${MACHINE_CPUARCH} != "mips" # no BUS_SPACE_UNSPECIFIED # No barrier instruction support (specific to this driver) _sym= sym # intr_disable() is a macro, causes problems .if ${MK_SOURCELESS_UCODE} != "no" _cxgb= cxgb .endif .endif .if ${MACHINE_CPUARCH} == "aarch64" _armv8crypto= armv8crypto _efirt= efirt _em= em .endif .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" _agp= agp _an= an _aout= aout _bios= bios _bktr= bktr .if ${MK_SOURCELESS_UCODE} != "no" _bxe= bxe .endif _cardbus= cardbus _cbb= cbb _cpuctl= cpuctl _cpufreq= cpufreq _cs= cs _dpms= dpms _drm= drm _drm2= drm2 _ed= ed _em= em _ena= ena _ep= ep _et= et _exca= exca _fe= fe .if ${MK_OFED} != "no" || defined(ALL_MODULES) _ibcore= ibcore .endif _if_ndis= if_ndis _io= io .if ${MK_OFED} != "no" || defined(ALL_MODULES) _ipoib= ipoib _iser= iser .endif _ix= ix _ixv= ixv _linprocfs= linprocfs _linsysfs= linsysfs _linux= linux .if ${MK_SOURCELESS_UCODE} != "no" _lio= lio .endif _nctgpio= nctgpio _ndis= ndis _pccard= pccard .if ${MK_OFED} != "no" || defined(ALL_MODULES) _rdma= rdma .endif _safe= safe _scsi_low= scsi_low _speaker= speaker _splash= splash _sppp= sppp _vmware= vmware _vxge= vxge _wbwd= wbwd _wi= wi _xe= xe _aac= aac _aacraid= aacraid _acpi= acpi .if ${MK_CRYPT} != "no" || defined(ALL_MODULES) _aesni= aesni .endif _amd_ecc_inject=amd_ecc_inject _amdsbwd= amdsbwd _amdsmn= amdsmn _amdtemp= amdtemp _arcmsr= arcmsr _asmc= asmc _bytgpio= bytgpio _ciss= ciss _chromebook_platform= chromebook_platform _cmx= cmx _coretemp= coretemp .if ${MK_SOURCELESS_HOST} != "no" _hpt27xx= hpt27xx .endif _hptiop= hptiop .if ${MK_SOURCELESS_HOST} != "no" _hptmv= hptmv _hptnr= hptnr _hptrr= hptrr .endif _hyperv= hyperv _ichwd= ichwd _ida= ida _iir= iir _intelspi= intelspi _ipmi= ipmi _ips= ips _isci= isci _ipw= ipw _iwi= iwi _iwm= iwm _iwn= iwn _ixgb= ixgb .if ${MK_SOURCELESS_UCODE} != "no" _ipwfw= ipwfw _iwifw= iwifw _iwmfw= iwmfw _iwnfw= iwnfw .endif _mlx4= mlx4 _mlx5= mlx5 .if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \ defined(ALL_MODULES) _mlx4en= mlx4en _mlx5en= mlx5en .endif .if ${MK_OFED} != "no" || defined(ALL_MODULES) _mlx4ib= mlx4ib _mlx5ib= mlx5ib .endif _mly= mly _nfe= nfe _nvd= nvd _nvme= nvme _nvram= nvram _nxge= nxge .if ${MK_CRYPT} != "no" || defined(ALL_MODULES) _padlock= padlock _padlock_rng= padlock_rng _rdrand_rng= rdrand_rng .endif _s3= s3 _sdhci_acpi= sdhci_acpi _tpm= tpm _twa= twa _vesa= vesa _viawd= viawd _virtio= virtio _wpi= wpi .if ${MK_SOURCELESS_UCODE} != "no" _wpifw= wpifw .endif _x86bios= x86bios .endif .if ${MACHINE_CPUARCH} == "amd64" _ccp= ccp _efirt= efirt _ioat= ioat _ixl= ixl _ixlv= ixlv _linux64= linux64 _linux_common= linux_common _ntb= ntb _pms= pms _qlxge= qlxge _qlxgb= qlxgb .if ${MK_SOURCELESS_UCODE} != "no" _qlxgbe= qlxgbe _qlnx= qlnx .endif _sfxge= sfxge _sgx= sgx _sgx_linux= sgx_linux .if ${MK_BHYVE} != "no" || defined(ALL_MODULES) _vmm= vmm .endif .endif .if ${MACHINE_CPUARCH} == "i386" # XXX some of these can move to the general case when de-i386'ed # XXX some of these can move now, but are untested on other architectures. _3dfx= 3dfx _3dfx_linux= 3dfx_linux _aic= aic _apm= apm _arcnet= arcnet .if ${MK_SOURCELESS_UCODE} != "no" _ce= ce .endif _coff= coff .if ${MK_SOURCELESS_UCODE} != "no" _cp= cp .endif _glxiic= glxiic _glxsb= glxsb #_ibcs2= ibcs2 _mse= mse _ncr= ncr _ncv= ncv _nsp= nsp _pcfclock= pcfclock _pst= pst _sbni= sbni _stg= stg _cm= cm .if ${MK_SOURCELESS_UCODE} != "no" _ctau= ctau .endif _dpt= dpt _ex= ex .endif .if ${MACHINE_CPUARCH} == "arm" _cfi= cfi _cpsw= cpsw .endif .if ${MACHINE_CPUARCH} == "powerpc" _agp= agp _an= an _bm= bm _cardbus= cardbus _cbb= cbb _cfi= cfi _cpufreq= cpufreq _drm= drm _exca= exca _ffec= ffec _pccard= pccard _wi= wi .endif .if ${MACHINE_ARCH} == "powerpc64" _drm2= drm2 .endif .if ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_ARCH} == "powerpc" # Don't build powermac_nvram for powerpcspe, it's never supported. _nvram= powermac_nvram .endif .if ${MACHINE_CPUARCH} == "sparc64" _auxio= auxio _em= em _epic= epic .endif .if (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "i386") _cloudabi32= cloudabi32 .endif .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" _cloudabi64= cloudabi64 .endif .endif .if ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "aarch64" +_bcm283x_clkman= bcm283x_clkman _bcm283x_pwm= bcm283x_pwm .endif .if ${MACHINE_ARCH:Marmv[67]*} != "" _ffec= ffec .endif SUBDIR+=${MODULES_EXTRA} .for reject in ${WITHOUT_MODULES} SUBDIR:= ${SUBDIR:N${reject}} .endfor # Calling kldxref(8) for each module is expensive. .if !defined(NO_XREF) .MAKEFLAGS+= -DNO_XREF afterinstall: .PHONY @if type kldxref >/dev/null 2>&1; then \ ${ECHO} kldxref ${DESTDIR}${KMODDIR}; \ kldxref ${DESTDIR}${KMODDIR}; \ fi .endif .include "${SYSDIR}/conf/config.mk" SUBDIR:= ${SUBDIR:u:O} .include