Date: Wed, 23 Apr 2025 17:46:09 GMT From: Oskar Holmlund <oh@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 10bb91672a02 - main - Remove OMAP4 support Message-ID: <202504231746.53NHk9NT033280@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by oh: URL: https://cgit.FreeBSD.org/src/commit/?id=10bb91672a02b646e6dad6cdfe10ff75a192db99 commit 10bb91672a02b646e6dad6cdfe10ff75a192db99 Author: Oskar Holmlund <oh@FreeBSD.org> AuthorDate: 2025-04-23 15:43:39 +0000 Commit: Oskar Holmlund <oh@FreeBSD.org> CommitDate: 2025-04-23 15:43:39 +0000 Remove OMAP4 support Due to lack of boards with OMAP4 on the market and the shortcoming of resources to maintain the code base, it is time to let it go. Previous diff rev see https://reviews.freebsd.org/D42116 Relnotes: Yes Approved by: manu (mentor) Differential revision: https://reviews.freebsd.org/D49661 --- sys/arm/ti/clk/ti_clkctrl.c | 6 - sys/arm/ti/omap4/files.omap4 | 21 - sys/arm/ti/omap4/omap4_gpio.c | 145 --- sys/arm/ti/omap4/omap4_l2cache.c | 89 -- sys/arm/ti/omap4/omap4_machdep.h | 38 - sys/arm/ti/omap4/omap4_mp.c | 74 -- sys/arm/ti/omap4/omap4_prcm_clks.c | 1499 ------------------------------ sys/arm/ti/omap4/omap4_reg.h | 540 ----------- sys/arm/ti/omap4/omap4_scm_padconf.c | 302 ------ sys/arm/ti/omap4/omap4_scm_padconf.h | 81 -- sys/arm/ti/omap4/omap4_smc.h | 53 -- sys/arm/ti/omap4/omap4_wugen.c | 245 ----- sys/arm/ti/omap4/pandaboard/pandaboard.c | 167 ---- sys/arm/ti/omap4/pandaboard/pandaboard.h | 29 - sys/arm/ti/omap4/std.omap4 | 7 - sys/arm/ti/ti_cpuid.c | 133 --- sys/arm/ti/ti_cpuid.h | 36 - sys/arm/ti/ti_gpio.c | 44 +- sys/arm/ti/ti_i2c.c | 31 - sys/arm/ti/ti_machdep.c | 47 - sys/arm/ti/ti_pinmux.c | 6 - sys/arm/ti/ti_prcm.c | 53 -- sys/arm/ti/ti_sdhci.c | 8 - sys/arm/ti/twl/twl.c | 456 --------- sys/arm/ti/twl/twl.h | 39 - sys/arm/ti/twl/twl_clks.c | 647 ------------- sys/arm/ti/twl/twl_clks.h | 36 - sys/arm/ti/twl/twl_vreg.c | 1026 -------------------- sys/arm/ti/twl/twl_vreg.h | 35 - sys/arm/ti/usb/omap_ehci.c | 466 ---------- sys/arm/ti/usb/omap_host.c | 467 ---------- sys/arm/ti/usb/omap_tll.c | 356 ------- sys/arm/ti/usb/omap_usb.h | 48 - 33 files changed, 1 insertion(+), 7229 deletions(-) diff --git a/sys/arm/ti/clk/ti_clkctrl.c b/sys/arm/ti/clk/ti_clkctrl.c index cba832640fa3..72fa8548d4f8 100644 --- a/sys/arm/ti/clk/ti_clkctrl.c +++ b/sys/arm/ti/clk/ti_clkctrl.c @@ -167,12 +167,6 @@ ti_clkctrl_attach(device_t dev) /* Check if this is a clkctrl with special registers like gpio */ switch (ti_chip()) { -#ifdef SOC_OMAP4 - case CHIP_OMAP_4: - /* FIXME: Todo */ - break; - -#endif /* SOC_OMAP4 */ #ifdef SOC_TI_AM335X /* Checkout TRM 8.1.12.1.29 - 8.1.12.31 and 8.1.12.2.3 * and the DTS. diff --git a/sys/arm/ti/omap4/files.omap4 b/sys/arm/ti/omap4/files.omap4 deleted file mode 100644 index 6926488a8716..000000000000 --- a/sys/arm/ti/omap4/files.omap4 +++ /dev/null @@ -1,21 +0,0 @@ - -arm/ti/ti_smc.S standard - -arm/ti/usb/omap_ehci.c optional usb ehci -arm/ti/usb/omap_host.c optional usb -arm/ti/usb/omap_tll.c optional usb -arm/ti/ti_sdma.c optional ti_sdma - -arm/ti/omap4/omap4_gpio.c optional gpio -arm/ti/omap4/omap4_l2cache.c optional pl310 -#arm/ti/omap4/omap4_prcm_clks.c standard -arm/ti/omap4/omap4_scm_padconf.c standard -arm/ti/omap4/omap4_mp.c optional smp -arm/ti/omap4/omap4_wugen.c standard - -arm/ti/omap4/pandaboard/pandaboard.c standard - -arm/ti/twl/twl.c optional twl -arm/ti/twl/twl_vreg.c optional twl twl_vreg -arm/ti/twl/twl_clks.c optional twl twl_clks - diff --git a/sys/arm/ti/omap4/omap4_gpio.c b/sys/arm/ti/omap4/omap4_gpio.c deleted file mode 100644 index 08c878107b48..000000000000 --- a/sys/arm/ti/omap4/omap4_gpio.c +++ /dev/null @@ -1,145 +0,0 @@ -/*- - * Copyright (c) 2011 Ben Gray <ben.r.gray@gmail.com>. - * Copyright (c) 2014 Andrew Turner <andrew@FreeBSD.org> - * 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. - * 3. The name of the company nor the name of the author may be used to - * endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY BEN GRAY ``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 BEN GRAY 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 <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <sys/gpio.h> - -#include <machine/bus.h> -#include <machine/intr.h> - -#include <dev/ofw/ofw_bus.h> -#include <dev/ofw/ofw_bus_subr.h> - -#include <arm/ti/ti_cpuid.h> -#include <arm/ti/ti_gpio.h> -#include <arm/ti/ti_pinmux.h> - -#include <arm/ti/omap4/omap4_scm_padconf.h> - -#include "ti_gpio_if.h" - -static struct ofw_compat_data compat_data[] = { - {"ti,omap4-gpio", 1}, - {"ti,gpio", 1}, - {NULL, 0}, -}; - -static int -omap4_gpio_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); - if (ti_chip() != CHIP_OMAP_4) - return (ENXIO); - - device_set_desc(dev, "TI OMAP4 General Purpose I/O (GPIO)"); - - return (0); -} - -static int -omap4_gpio_set_flags(device_t dev, uint32_t gpio, uint32_t flags) -{ - unsigned int state = 0; - struct ti_gpio_softc *sc; - - sc = device_get_softc(dev); - /* First the SCM driver needs to be told to put the pad into GPIO mode */ - if (flags & GPIO_PIN_OUTPUT) - state = PADCONF_PIN_OUTPUT; - else if (flags & GPIO_PIN_INPUT) { - if (flags & GPIO_PIN_PULLUP) - state = PADCONF_PIN_INPUT_PULLUP; - else if (flags & GPIO_PIN_PULLDOWN) - state = PADCONF_PIN_INPUT_PULLDOWN; - else - state = PADCONF_PIN_INPUT; - } - return ti_pinmux_padconf_set_gpiomode((sc->sc_bank-1)*32 + gpio, state); -} - -static int -omap4_gpio_get_flags(device_t dev, uint32_t gpio, uint32_t *flags) -{ - unsigned int state; - struct ti_gpio_softc *sc; - - sc = device_get_softc(dev); - - /* Get the current pin state */ - if (ti_pinmux_padconf_get_gpiomode((sc->sc_bank-1)*32 + gpio, &state) != 0) { - *flags = 0; - return (EINVAL); - } else { - switch (state) { - case PADCONF_PIN_OUTPUT: - *flags = GPIO_PIN_OUTPUT; - break; - case PADCONF_PIN_INPUT: - *flags = GPIO_PIN_INPUT; - break; - case PADCONF_PIN_INPUT_PULLUP: - *flags = GPIO_PIN_INPUT | GPIO_PIN_PULLUP; - break; - case PADCONF_PIN_INPUT_PULLDOWN: - *flags = GPIO_PIN_INPUT | GPIO_PIN_PULLDOWN; - break; - default: - *flags = 0; - break; - } - } - - return (0); -} - -static device_method_t omap4_gpio_methods[] = { - /* bus interface */ - DEVMETHOD(device_probe, omap4_gpio_probe), - - /* ti_gpio interface */ - DEVMETHOD(ti_gpio_set_flags, omap4_gpio_set_flags), - DEVMETHOD(ti_gpio_get_flags, omap4_gpio_get_flags), - - DEVMETHOD_END -}; - -extern driver_t ti_gpio_driver; - -DEFINE_CLASS_1(gpio, omap4_gpio_driver, omap4_gpio_methods, - sizeof(struct ti_gpio_softc), ti_gpio_driver); -DRIVER_MODULE(omap4_gpio, simplebus, omap4_gpio_driver, 0, 0); diff --git a/sys/arm/ti/omap4/omap4_l2cache.c b/sys/arm/ti/omap4/omap4_l2cache.c deleted file mode 100644 index 74b204268176..000000000000 --- a/sys/arm/ti/omap4/omap4_l2cache.c +++ /dev/null @@ -1,89 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2012 Olivier Houchard. 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 <sys/types.h> -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/bus.h> -#include <sys/rman.h> -#include <sys/lock.h> -#include <sys/mutex.h> - -#include <machine/bus.h> -#include <machine/pl310.h> -#include <machine/platformvar.h> - -#include <arm/ti/ti_smc.h> -#include <arm/ti/omap4/omap4_machdep.h> -#include <arm/ti/omap4/omap4_smc.h> - -#include "platform_pl310_if.h" - -void -omap4_pl310_init(platform_t plat, struct pl310_softc *sc) -{ - uint32_t aux, prefetch; - - aux = pl310_read4(sc, PL310_AUX_CTRL); - prefetch = pl310_read4(sc, PL310_PREFETCH_CTRL); - - /* - * Disable instruction prefetch - */ - prefetch &= ~PREFETCH_CTRL_INSTR_PREFETCH; - aux &= ~AUX_CTRL_INSTR_PREFETCH; - - // prefetch &= ~PREFETCH_CTRL_DATA_PREFETCH; - // aux &= ~AUX_CTRL_DATA_PREFETCH; - - /* - * Make sure data prefetch is on - */ - prefetch |= PREFETCH_CTRL_DATA_PREFETCH; - aux |= AUX_CTRL_DATA_PREFETCH; - - /* - * TODO: add tunable for prefetch offset - * and experiment with performance - */ - - ti_smc0(aux, 0, WRITE_AUXCTRL_REG); - ti_smc0(prefetch, 0, WRITE_PREFETCH_CTRL_REG); -} - -void -omap4_pl310_write_ctrl(platform_t plat, struct pl310_softc *sc, uint32_t val) -{ - - ti_smc0(val, 0, L2CACHE_WRITE_CTRL_REG); -} - -void -omap4_pl310_write_debug(platform_t plat, struct pl310_softc *sc, uint32_t val) -{ - - ti_smc0(val, 0, L2CACHE_WRITE_DEBUG_REG); -} diff --git a/sys/arm/ti/omap4/omap4_machdep.h b/sys/arm/ti/omap4/omap4_machdep.h deleted file mode 100644 index 7c9f696d2090..000000000000 --- a/sys/arm/ti/omap4/omap4_machdep.h +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * Copyright (c) 2016 Olivier Houchard <cognet@FreeBSD.org> - * 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. - */ - -#ifndef _OMAP4_MACHDEP_H_ -#define _OMAP4_MACHDEP_H_ - -struct pl310_softc; - -void omap4_mp_setmaxid(platform_t plat); -void omap4_mp_start_ap(platform_t plat); - -void omap4_pl310_init(platform_t, struct pl310_softc *); -void omap4_pl310_write_ctrl(platform_t, struct pl310_softc *, uint32_t); -void omap4_pl310_write_debug(platform_t, struct pl310_softc *, uint32_t); - -#endif /* _OMAP4_MACHDEP_H_ */ diff --git a/sys/arm/ti/omap4/omap4_mp.c b/sys/arm/ti/omap4/omap4_mp.c deleted file mode 100644 index 1affd08583db..000000000000 --- a/sys/arm/ti/omap4/omap4_mp.c +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2012 Olivier Houchard. 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 <sys/param.h> -#include <sys/systm.h> -#include <sys/bus.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/smp.h> - -#include <vm/vm.h> -#include <vm/pmap.h> - -#include <machine/cpu.h> -#include <machine/smp.h> -#include <machine/fdt.h> -#include <machine/intr.h> -#include <machine/platformvar.h> - -#include <arm/ti/ti_smc.h> -#include <arm/ti/omap4/omap4_machdep.h> -#include <arm/ti/omap4/omap4_smc.h> - -void -omap4_mp_setmaxid(platform_t plat) -{ - - if (mp_ncpus != 0) - return; - mp_maxid = 1; - mp_ncpus = 2; -} - -void -omap4_mp_start_ap(platform_t plat) -{ - bus_addr_t scu_addr; - - if (bus_space_map(fdtbus_bs_tag, 0x48240000, 0x1000, 0, &scu_addr) != 0) - panic("Couldn't map the SCU\n"); - /* Enable the SCU */ - *(volatile unsigned int *)scu_addr |= 1; - //*(volatile unsigned int *)(scu_addr + 0x30) |= 1; - dcache_wbinv_poc_all(); - - ti_smc0(0x200, 0xfffffdff, MODIFY_AUX_CORE_0); - ti_smc0(pmap_kextract((vm_offset_t)mpentry), 0, WRITE_AUX_CORE_1); - dsb(); - sev(); - bus_space_unmap(fdtbus_bs_tag, scu_addr, 0x1000); -} diff --git a/sys/arm/ti/omap4/omap4_prcm_clks.c b/sys/arm/ti/omap4/omap4_prcm_clks.c deleted file mode 100644 index 63c679f178bc..000000000000 --- a/sys/arm/ti/omap4/omap4_prcm_clks.c +++ /dev/null @@ -1,1499 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 2011 - * Ben Gray <ben.r.gray@gmail.com>. - * 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. - * 3. The name of the company nor the name of the author may be used to - * endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY BEN GRAY ``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 BEN GRAY 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 <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <sys/resource.h> -#include <sys/rman.h> -#include <sys/lock.h> -#include <sys/malloc.h> - -#include <machine/bus.h> -#include <machine/resource.h> -#include <machine/intr.h> - -#include <arm/arm/mpcore_timervar.h> -#include <arm/ti/tivar.h> -#include <arm/ti/ti_prcm.h> -#include <arm/ti/omap4/omap4_reg.h> - -#include <dev/ofw/openfirm.h> -#include <dev/ofw/ofw_bus.h> -#include <dev/ofw/ofw_bus_subr.h> - -/* - * This file defines the clock configuration for the OMAP4xxx series of - * devices. - * - * How This is Suppose to Work - * =========================== - * - There is a top level omap_prcm module that defines all OMAP SoC drivers - * should use to enable/disable the system clocks regardless of the version - * of OMAP device they are running on. This top level PRCM module is just - * a thin shim to chip specific functions that perform the donkey work of - * configuring the clock - this file is the 'donkey' for OMAP44xx devices. - * - * - The key bit in this file is the omap_clk_devmap array, it's - * used by the omap_prcm driver to determine what clocks are valid and which - * functions to call to manipulate them. - * - * - In essence you just need to define some callbacks for each of the - * clocks and then you're done. - * - * - The other thing that is worth noting is that when the omap_prcm device - * is registered you typically pass in some memory ranges which are the - * SYS_MEMORY resources. These resources are in turn allocated using - * bus_allocate_resources(...) and the resource handles are passed to all - * individual clock callback handlers. - * - * - * - * OMAP4 devices are different from the previous OMAP3 devices in that there - * is no longer a separate functional and interface clock for each module, - * instead there is typically an interface clock that spans many modules. - */ - -#define FREQ_96MHZ 96000000 -#define FREQ_64MHZ 64000000 -#define FREQ_48MHZ 48000000 -#define FREQ_32KHZ 32000 - -#define PRM_INSTANCE 1 -#define CM1_INSTANCE 2 -#define CM2_INSTANCE 3 - -/** - * Address offsets from the PRM memory region to the top level clock control - * registers. - */ -#define CKGEN_PRM_OFFSET 0x00000100UL -#define MPU_PRM_OFFSET 0x00000300UL -#define DSP_PRM_OFFSET 0x00000400UL -#define ABE_PRM_OFFSET 0x00000500UL -#define ALWAYS_ON_PRM_OFFSET 0x00000600UL -#define CORE_PRM_OFFSET 0x00000700UL -#define IVAHD_PRM_OFFSET 0x00000F00UL -#define CAM_PRM_OFFSET 0x00001000UL -#define DSS_PRM_OFFSET 0x00001100UL -#define SGX_PRM_OFFSET 0x00001200UL -#define L3INIT_PRM_OFFSET 0x00001300UL -#define L4PER_PRM_OFFSET 0x00001400UL -#define WKUP_PRM_OFFSET 0x00001700UL -#define WKUP_CM_OFFSET 0x00001800UL -#define EMU_PRM_OFFSET 0x00001900UL -#define EMU_CM_OFFSET 0x00001A00UL -#define DEVICE_PRM_OFFSET 0x00001B00UL -#define INSTR_PRM_OFFSET 0x00001F00UL - -#define CM_ABE_DSS_SYS_CLKSEL_OFFSET (CKGEN_PRM_OFFSET + 0x0000UL) -#define CM_L4_WKUP_CLKSELL_OFFSET (CKGEN_PRM_OFFSET + 0x0008UL) -#define CM_ABE_PLL_REF_CLKSEL_OFFSET (CKGEN_PRM_OFFSET + 0x000CUL) -#define CM_SYS_CLKSEL_OFFSET (CKGEN_PRM_OFFSET + 0x0010UL) - -/** - * Address offsets from the CM1 memory region to the top level clock control - * registers. - */ -#define CKGEN_CM1_OFFSET 0x00000100UL -#define MPU_CM1_OFFSET 0x00000300UL -#define DSP_CM1_OFFSET 0x00000400UL -#define ABE_CM1_OFFSET 0x00000500UL -#define RESTORE_CM1_OFFSET 0x00000E00UL -#define INSTR_CM1_OFFSET 0x00000F00UL - -#define CM_CLKSEL_DPLL_MPU (CKGEN_CM1_OFFSET + 0x006CUL) - -/** - * Address offsets from the CM2 memory region to the top level clock control - * registers. - */ -#define INTRCONN_SOCKET_CM2_OFFSET 0x00000000UL -#define CKGEN_CM2_OFFSET 0x00000100UL -#define ALWAYS_ON_CM2_OFFSET 0x00000600UL -#define CORE_CM2_OFFSET 0x00000700UL -#define IVAHD_CM2_OFFSET 0x00000F00UL -#define CAM_CM2_OFFSET 0x00001000UL -#define DSS_CM2_OFFSET 0x00001100UL -#define SGX_CM2_OFFSET 0x00001200UL -#define L3INIT_CM2_OFFSET 0x00001300UL -#define L4PER_CM2_OFFSET 0x00001400UL -#define RESTORE_CM2_OFFSET 0x00001E00UL -#define INSTR_CM2_OFFSET 0x00001F00UL - -#define CLKCTRL_MODULEMODE_MASK 0x00000003UL -#define CLKCTRL_MODULEMODE_DISABLE 0x00000000UL -#define CLKCTRL_MODULEMODE_AUTO 0x00000001UL -#define CLKCTRL_MODULEMODE_ENABLE 0x00000001UL - -#define CLKCTRL_IDLEST_MASK 0x00030000UL -#define CLKCTRL_IDLEST_ENABLED 0x00000000UL -#define CLKCTRL_IDLEST_WAKING 0x00010000UL -#define CLKCTRL_IDLEST_IDLE 0x00020000UL -#define CLKCTRL_IDLEST_DISABLED 0x00030000UL - -static struct ofw_compat_data compat_data[] = { - {"ti,omap4-cm1", (uintptr_t)CM1_INSTANCE}, - {"ti,omap4-cm2", (uintptr_t)CM2_INSTANCE}, - {"ti,omap4-prm", (uintptr_t)PRM_INSTANCE}, - {NULL, (uintptr_t)0}, -}; - -struct omap4_prcm_softc { - struct resource *sc_res; - int sc_rid; - int sc_instance; - int attach_done; -}; - -static int omap4_clk_generic_activate(struct ti_clock_dev *clkdev); -static int omap4_clk_generic_deactivate(struct ti_clock_dev *clkdev); -static int omap4_clk_generic_accessible(struct ti_clock_dev *clkdev); -static int omap4_clk_generic_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc); -static int omap4_clk_generic_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq); - -static int omap4_clk_gptimer_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc); -static int omap4_clk_gptimer_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq); - -static int omap4_clk_hsmmc_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc); -static int omap4_clk_hsmmc_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq); - -static int omap4_clk_hsusbhost_set_source(struct ti_clock_dev *clkdev, clk_src_t clksrc); -static int omap4_clk_hsusbhost_activate(struct ti_clock_dev *clkdev); -static int omap4_clk_hsusbhost_deactivate(struct ti_clock_dev *clkdev); -static int omap4_clk_hsusbhost_accessible(struct ti_clock_dev *clkdev); - -static int omap4_clk_get_sysclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq); -static int omap4_clk_get_arm_fclk_freq(struct ti_clock_dev *clkdev, unsigned int *freq); - -/** - * omap_clk_devmap - Array of clock devices available on OMAP4xxx devices - * - * This map only defines which clocks are valid and the callback functions - * for clock activate, deactivate, etc. It is used by the top level omap_prcm - * driver. - * - * The actual details of the clocks (config registers, bit fields, sources, - * etc) are in the private g_omap3_clk_details array below. - * - */ - -#define OMAP4_GENERIC_CLOCK_DEV(i) \ - { .id = (i), \ - .clk_activate = omap4_clk_generic_activate, \ - .clk_deactivate = omap4_clk_generic_deactivate, \ - .clk_set_source = omap4_clk_generic_set_source, \ - .clk_accessible = omap4_clk_generic_accessible, \ - .clk_get_source_freq = omap4_clk_generic_get_source_freq, \ - .clk_set_source_freq = NULL \ - } - -#define OMAP4_GPTIMER_CLOCK_DEV(i) \ - { .id = (i), \ - .clk_activate = omap4_clk_generic_activate, \ - .clk_deactivate = omap4_clk_generic_deactivate, \ - .clk_set_source = omap4_clk_gptimer_set_source, \ - .clk_accessible = omap4_clk_generic_accessible, \ - .clk_get_source_freq = omap4_clk_gptimer_get_source_freq, \ - .clk_set_source_freq = NULL \ - } - -#define OMAP4_HSMMC_CLOCK_DEV(i) \ - { .id = (i), \ - .clk_activate = omap4_clk_generic_activate, \ - .clk_deactivate = omap4_clk_generic_deactivate, \ - .clk_set_source = omap4_clk_hsmmc_set_source, \ - .clk_accessible = omap4_clk_generic_accessible, \ - .clk_get_source_freq = omap4_clk_hsmmc_get_source_freq, \ - .clk_set_source_freq = NULL \ - } - -#define OMAP4_HSUSBHOST_CLOCK_DEV(i) \ - { .id = (i), \ - .clk_activate = omap4_clk_hsusbhost_activate, \ - .clk_deactivate = omap4_clk_hsusbhost_deactivate, \ - .clk_set_source = omap4_clk_hsusbhost_set_source, \ - .clk_accessible = omap4_clk_hsusbhost_accessible, \ - .clk_get_source_freq = NULL, \ - .clk_set_source_freq = NULL \ - } - -struct ti_clock_dev ti_omap4_clk_devmap[] = { - /* System clocks */ - { .id = SYS_CLK, - .clk_activate = NULL, - .clk_deactivate = NULL, - .clk_set_source = NULL, - .clk_accessible = NULL, - .clk_get_source_freq = omap4_clk_get_sysclk_freq, - .clk_set_source_freq = NULL, - }, - /* MPU (ARM) core clocks */ - { .id = MPU_CLK, - .clk_activate = NULL, - .clk_deactivate = NULL, - .clk_set_source = NULL, - .clk_accessible = NULL, - .clk_get_source_freq = omap4_clk_get_arm_fclk_freq, - .clk_set_source_freq = NULL, - }, - - /* UART device clocks */ - OMAP4_GENERIC_CLOCK_DEV(UART1_CLK), - OMAP4_GENERIC_CLOCK_DEV(UART2_CLK), - OMAP4_GENERIC_CLOCK_DEV(UART3_CLK), - OMAP4_GENERIC_CLOCK_DEV(UART4_CLK), - - /* Timer device source clocks */ - OMAP4_GPTIMER_CLOCK_DEV(TIMER1_CLK), - OMAP4_GPTIMER_CLOCK_DEV(TIMER2_CLK), - OMAP4_GPTIMER_CLOCK_DEV(TIMER3_CLK), - OMAP4_GPTIMER_CLOCK_DEV(TIMER4_CLK), - OMAP4_GPTIMER_CLOCK_DEV(TIMER5_CLK), - OMAP4_GPTIMER_CLOCK_DEV(TIMER6_CLK), - OMAP4_GPTIMER_CLOCK_DEV(TIMER7_CLK), - OMAP4_GPTIMER_CLOCK_DEV(TIMER8_CLK), - OMAP4_GPTIMER_CLOCK_DEV(TIMER9_CLK), - OMAP4_GPTIMER_CLOCK_DEV(TIMER10_CLK), - OMAP4_GPTIMER_CLOCK_DEV(TIMER11_CLK), - - /* MMC device clocks (MMC1 and MMC2 can have different input clocks) */ - OMAP4_HSMMC_CLOCK_DEV(MMC1_CLK), - OMAP4_HSMMC_CLOCK_DEV(MMC2_CLK), - OMAP4_GENERIC_CLOCK_DEV(MMC3_CLK), - OMAP4_GENERIC_CLOCK_DEV(MMC4_CLK), - OMAP4_GENERIC_CLOCK_DEV(MMC5_CLK), - - /* USB HS (high speed TLL, EHCI and OHCI) */ - OMAP4_HSUSBHOST_CLOCK_DEV(USBTLL_CLK), - OMAP4_HSUSBHOST_CLOCK_DEV(USBHSHOST_CLK), - OMAP4_HSUSBHOST_CLOCK_DEV(USBFSHOST_CLK), - OMAP4_HSUSBHOST_CLOCK_DEV(USBP1_PHY_CLK), - OMAP4_HSUSBHOST_CLOCK_DEV(USBP2_PHY_CLK), - OMAP4_HSUSBHOST_CLOCK_DEV(USBP1_UTMI_CLK), - OMAP4_HSUSBHOST_CLOCK_DEV(USBP2_UTMI_CLK), - OMAP4_HSUSBHOST_CLOCK_DEV(USBP1_HSIC_CLK), - OMAP4_HSUSBHOST_CLOCK_DEV(USBP2_HSIC_CLK), - - /* GPIO */ - OMAP4_GENERIC_CLOCK_DEV(GPIO1_CLK), - OMAP4_GENERIC_CLOCK_DEV(GPIO2_CLK), - OMAP4_GENERIC_CLOCK_DEV(GPIO3_CLK), - OMAP4_GENERIC_CLOCK_DEV(GPIO4_CLK), - OMAP4_GENERIC_CLOCK_DEV(GPIO5_CLK), - OMAP4_GENERIC_CLOCK_DEV(GPIO6_CLK), - - /* sDMA */ - OMAP4_GENERIC_CLOCK_DEV(SDMA_CLK), - - /* I2C */ - OMAP4_GENERIC_CLOCK_DEV(I2C1_CLK), - OMAP4_GENERIC_CLOCK_DEV(I2C2_CLK), - OMAP4_GENERIC_CLOCK_DEV(I2C3_CLK), - OMAP4_GENERIC_CLOCK_DEV(I2C4_CLK), - { INVALID_CLK_IDENT, NULL, NULL, NULL, NULL } -}; - -/** - * omap4_clk_details - Stores details for all the different clocks supported - * - * Whenever an operation on a clock is being performed (activated, deactivated, - * etc) this array is looked up to find the correct register and bit(s) we - * should be modifying. - * - */ -struct omap4_clk_details { - clk_ident_t id; - - uint32_t instance; - uint32_t clksel_reg; - - int32_t src_freq; - - uint32_t enable_mode; -}; - -#define OMAP4_GENERIC_CLOCK_DETAILS(i, f, di, r, e) \ - { .id = (i), \ - .instance = (di), \ - .clksel_reg = (r), \ - .src_freq = (f), \ - .enable_mode = (e), \ - } - -static struct omap4_clk_details g_omap4_clk_details[] = { - /* UART */ - OMAP4_GENERIC_CLOCK_DETAILS(UART1_CLK, FREQ_48MHZ, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x0140), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(UART2_CLK, FREQ_48MHZ, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x0148), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(UART3_CLK, FREQ_48MHZ, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x0150), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(UART4_CLK, FREQ_48MHZ, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x0158), CLKCTRL_MODULEMODE_ENABLE), - - /* General purpose timers */ - OMAP4_GENERIC_CLOCK_DETAILS(TIMER1_CLK, -1, PRM_INSTANCE, - (WKUP_CM_OFFSET + 0x040), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(TIMER2_CLK, -1, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x038), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(TIMER3_CLK, -1, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x040), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(TIMER4_CLK, -1, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x048), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(TIMER5_CLK, -1, CM1_INSTANCE, - (ABE_CM1_OFFSET + 0x068), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(TIMER6_CLK, -1, CM1_INSTANCE, - (ABE_CM1_OFFSET + 0x070), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(TIMER7_CLK, -1, CM1_INSTANCE, - (ABE_CM1_OFFSET + 0x078), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(TIMER8_CLK, -1, CM1_INSTANCE, - (ABE_CM1_OFFSET + 0x080), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(TIMER9_CLK, -1, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x050), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(TIMER10_CLK, -1, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x028), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(TIMER11_CLK, -1, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x030), CLKCTRL_MODULEMODE_ENABLE), - - /* HSMMC (MMC1 and MMC2 can have different input clocks) */ - OMAP4_GENERIC_CLOCK_DETAILS(MMC1_CLK, -1, CM2_INSTANCE, - (L3INIT_CM2_OFFSET + 0x028), /*CLKCTRL_MODULEMODE_ENABLE*/2), - OMAP4_GENERIC_CLOCK_DETAILS(MMC2_CLK, -1, CM2_INSTANCE, - (L3INIT_CM2_OFFSET + 0x030), /*CLKCTRL_MODULEMODE_ENABLE*/2), - OMAP4_GENERIC_CLOCK_DETAILS(MMC3_CLK, FREQ_48MHZ, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x120), /*CLKCTRL_MODULEMODE_ENABLE*/2), - OMAP4_GENERIC_CLOCK_DETAILS(MMC4_CLK, FREQ_48MHZ, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x128), /*CLKCTRL_MODULEMODE_ENABLE*/2), - OMAP4_GENERIC_CLOCK_DETAILS(MMC5_CLK, FREQ_48MHZ, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x160), /*CLKCTRL_MODULEMODE_ENABLE*/1), - - /* GPIO modules */ - OMAP4_GENERIC_CLOCK_DETAILS(GPIO1_CLK, -1, PRM_INSTANCE, - (WKUP_CM_OFFSET + 0x038), CLKCTRL_MODULEMODE_AUTO), - OMAP4_GENERIC_CLOCK_DETAILS(GPIO2_CLK, -1, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x060), CLKCTRL_MODULEMODE_AUTO), - OMAP4_GENERIC_CLOCK_DETAILS(GPIO3_CLK, -1, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x068), CLKCTRL_MODULEMODE_AUTO), - OMAP4_GENERIC_CLOCK_DETAILS(GPIO4_CLK, -1, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x070), CLKCTRL_MODULEMODE_AUTO), - OMAP4_GENERIC_CLOCK_DETAILS(GPIO5_CLK, -1, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x078), CLKCTRL_MODULEMODE_AUTO), - OMAP4_GENERIC_CLOCK_DETAILS(GPIO6_CLK, -1, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x080), CLKCTRL_MODULEMODE_AUTO), - - /* sDMA block */ - OMAP4_GENERIC_CLOCK_DETAILS(SDMA_CLK, -1, CM2_INSTANCE, - (CORE_CM2_OFFSET + 0x300), CLKCTRL_MODULEMODE_AUTO), - - /* I2C modules */ - OMAP4_GENERIC_CLOCK_DETAILS(I2C1_CLK, -1, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x0A0), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(I2C2_CLK, -1, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x0A8), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(I2C3_CLK, -1, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x0B0), CLKCTRL_MODULEMODE_ENABLE), - OMAP4_GENERIC_CLOCK_DETAILS(I2C4_CLK, -1, CM2_INSTANCE, - (L4PER_CM2_OFFSET + 0x0B8), CLKCTRL_MODULEMODE_ENABLE), - - { INVALID_CLK_IDENT, 0, 0, 0, 0 }, -}; - -/** - * MAX_MODULE_ENABLE_WAIT - the number of loops to wait for the module to come - * alive. - * - */ -#define MAX_MODULE_ENABLE_WAIT 100 - -/** - * ARRAY_SIZE - Macro to return the number of elements in a static const array. - * - */ -#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) - -/** - * omap4_clk_details - writes a 32-bit value to one of the timer registers - * @timer: Timer device context - * @off: The offset of a register from the timer register address range - * @val: The value to write into the register - * - * - * RETURNS: - * nothing - */ -static struct omap4_clk_details* -omap4_clk_details(clk_ident_t id) -{ - struct omap4_clk_details *walker; - - for (walker = g_omap4_clk_details; walker->id != INVALID_CLK_IDENT; walker++) { - if (id == walker->id) - return (walker); - } - - return NULL; -} - -static struct omap4_prcm_softc * -omap4_prcm_get_instance_softc(int module_instance) -{ - int i, maxunit; - devclass_t prcm_devclass; - device_t dev; - struct omap4_prcm_softc *sc; - - prcm_devclass = devclass_find("omap4_prcm"); - maxunit = devclass_get_maxunit(prcm_devclass); - - for (i = 0; i < maxunit; i++) { - dev = devclass_get_device(prcm_devclass, i); - sc = device_get_softc(dev); - if (sc->sc_instance == module_instance) - return (sc); - } - - return (NULL); -} - -/** - * omap4_clk_generic_activate - checks if a module is accessible - * @module: identifier for the module to check, see omap3_prcm.h for a list - * of possible modules. - * Example: OMAP3_MODULE_MMC1 - * - * - * - * LOCKING: - * Inherits the locks from the omap_prcm driver, no internal locking. - * - * RETURNS: - * Returns 0 on success or a positive error code on failure. - */ -static int -omap4_clk_generic_activate(struct ti_clock_dev *clkdev) -{ - struct omap4_prcm_softc *sc; - struct omap4_clk_details* clk_details; - struct resource* clk_mem_res; - uint32_t clksel; - unsigned int i; - clk_details = omap4_clk_details(clkdev->id); - *** 6657 LINES SKIPPED ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202504231746.53NHk9NT033280>