diff options
| author | Tom Rini <[email protected]> | 2024-05-20 10:16:33 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2024-05-20 10:16:33 -0600 |
| commit | d4781422d1268aa6deca3e49d2fb227e79c160b4 (patch) | |
| tree | 420073c8a29a401a3908803000df6f54673e1731 /drivers/timer | |
| parent | 85854bc3324edd0c81047780ee60033d056fd490 (diff) | |
| parent | a7f0154c412859323396111dd0c09dbafbc153cb (diff) | |
Merge tag 'v2024.07-rc3' into next
Prepare v2024.07-rc3
Diffstat (limited to 'drivers/timer')
34 files changed, 31 insertions, 161 deletions
diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig index 6b1de82ae38..60519c3b536 100644 --- a/drivers/timer/Kconfig +++ b/drivers/timer/Kconfig @@ -50,14 +50,6 @@ config TIMER_EARLY use an early timer. These functions must be supported by your timer driver: timer_early_get_count() and timer_early_get_rate(). -config ADI_SC5XX_TIMER - bool "ADI ADSP-SC5xx Timer Support" - depends on TIMER && (SC57X || SC58X || SC59X || SC59X_64) - help - gptimer based timer support on ADI's ADSP-SC5xx platforms. Available - but not required on sc59x-64-based platforms (598 and similar). - Required on 32-bit platforms (sc57x, sc58x, sc594 and earlier). - config ALTERA_TIMER bool "Altera timer support" depends on TIMER diff --git a/drivers/timer/Makefile b/drivers/timer/Makefile index fb95c8899e3..b93145e8d43 100644 --- a/drivers/timer/Makefile +++ b/drivers/timer/Makefile @@ -3,7 +3,6 @@ # Copyright (C) 2015 Thomas Chou <[email protected]> obj-y += timer-uclass.o -obj-$(CONFIG_ADI_SC5XX_TIMER) += adi_sc5xx_timer.o obj-$(CONFIG_ALTERA_TIMER) += altera_timer.o obj-$(CONFIG_$(SPL_)ANDES_PLMT_TIMER) += andes_plmt_timer.o obj-$(CONFIG_ARC_TIMER) += arc_timer.o diff --git a/drivers/timer/adi_sc5xx_timer.c b/drivers/timer/adi_sc5xx_timer.c deleted file mode 100644 index 11c098434a8..00000000000 --- a/drivers/timer/adi_sc5xx_timer.c +++ /dev/null @@ -1,145 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * (C) Copyright 2022 - Analog Devices, Inc. - * - * Written and/or maintained by Timesys Corporation - * - * Converted to driver model by Nathan Barrett-Morrison - * - * Author: Greg Malysa <[email protected]> - * Additional Contact: Nathan Barrett-Morrison <[email protected]> - * - * dm timer implementation for ADI ADSP-SC5xx SoCs - * - */ - -#include <clk.h> -#include <dm.h> -#include <timer.h> -#include <asm/io.h> -#include <dm/device_compat.h> -#include <linux/compiler_types.h> - -/* - * Timer Configuration Register Bits - */ -#define TIMER_OUT_DIS 0x0800 -#define TIMER_PULSE_HI 0x0080 -#define TIMER_MODE_PWM_CONT 0x000c - -#define __BFP(m) u16 m; u16 __pad_##m - -struct gptimer3 { - __BFP(config); - u32 counter; - u32 period; - u32 width; - u32 delay; -}; - -struct gptimer3_group_regs { - __BFP(run); - __BFP(enable); - __BFP(disable); - __BFP(stop_cfg); - __BFP(stop_cfg_set); - __BFP(stop_cfg_clr); - __BFP(data_imsk); - __BFP(stat_imsk); - __BFP(tr_msk); - __BFP(tr_ie); - __BFP(data_ilat); - __BFP(stat_ilat); - __BFP(err_status); - __BFP(bcast_per); - __BFP(bcast_wid); - __BFP(bcast_dly); -}; - -#define MAX_TIM_LOAD 0xFFFFFFFF - -struct adi_gptimer_priv { - struct gptimer3_group_regs __iomem *timer_group; - struct gptimer3 __iomem *timer_base; - u32 prev; - u64 upper; -}; - -static u64 adi_gptimer_get_count(struct udevice *udev) -{ - struct adi_gptimer_priv *priv = dev_get_priv(udev); - - u32 now = readl(&priv->timer_base->counter); - - if (now < priv->prev) - priv->upper += (1ull << 32); - - priv->prev = now; - - return (priv->upper + (u64)now); -} - -static const struct timer_ops adi_gptimer_ops = { - .get_count = adi_gptimer_get_count, -}; - -static int adi_gptimer_probe(struct udevice *udev) -{ - struct timer_dev_priv *uc_priv = dev_get_uclass_priv(udev); - struct adi_gptimer_priv *priv = dev_get_priv(udev); - struct clk clk; - u16 imask; - int ret; - - priv->timer_group = dev_remap_addr_index(udev, 0); - priv->timer_base = dev_remap_addr_index(udev, 1); - priv->upper = 0; - priv->prev = 0; - - if (!priv->timer_group || !priv->timer_base) { - dev_err(udev, "Missing timer_group or timer_base reg entries\n"); - return -ENODEV; - } - - ret = clk_get_by_index(udev, 0, &clk); - if (ret < 0) { - dev_err(udev, "Missing clock reference for timer\n"); - return ret; - } - - ret = clk_enable(&clk); - if (ret) { - dev_err(udev, "Failed to enable clock\n"); - return ret; - } - - uc_priv->clock_rate = clk_get_rate(&clk); - - /* Enable timer */ - writew(TIMER_OUT_DIS | TIMER_MODE_PWM_CONT | TIMER_PULSE_HI, - &priv->timer_base->config); - writel(MAX_TIM_LOAD, &priv->timer_base->period); - writel(MAX_TIM_LOAD - 1, &priv->timer_base->width); - - /* We only use timer 0 in uboot */ - imask = readw(&priv->timer_group->data_imsk); - imask &= ~(1 << 0); - writew(imask, &priv->timer_group->data_imsk); - writew((1 << 0), &priv->timer_group->enable); - - return 0; -} - -static const struct udevice_id adi_gptimer_ids[] = { - { .compatible = "adi,sc5xx-gptimer" }, - { }, -}; - -U_BOOT_DRIVER(adi_gptimer) = { - .name = "adi_gptimer", - .id = UCLASS_TIMER, - .of_match = adi_gptimer_ids, - .priv_auto = sizeof(struct adi_gptimer_priv), - .probe = adi_gptimer_probe, - .ops = &adi_gptimer_ops, -}; diff --git a/drivers/timer/altera_timer.c b/drivers/timer/altera_timer.c index ece246c23d2..040dc65f48a 100644 --- a/drivers/timer/altera_timer.c +++ b/drivers/timer/altera_timer.c @@ -7,6 +7,7 @@ * Scott McNutt <[email protected]> */ +#include <common.h> #include <dm.h> #include <errno.h> #include <timer.h> diff --git a/drivers/timer/andes_plmt_timer.c b/drivers/timer/andes_plmt_timer.c index 20baaf61307..42dd4b62317 100644 --- a/drivers/timer/andes_plmt_timer.c +++ b/drivers/timer/andes_plmt_timer.c @@ -8,6 +8,7 @@ * associated with timer tick. */ +#include <common.h> #include <dm.h> #include <timer.h> #include <asm/io.h> diff --git a/drivers/timer/arc_timer.c b/drivers/timer/arc_timer.c index 413bcc32f01..497f8a04155 100644 --- a/drivers/timer/arc_timer.c +++ b/drivers/timer/arc_timer.c @@ -3,6 +3,7 @@ * Copyright (C) 2016 Synopsys, Inc. All rights reserved. */ +#include <common.h> #include <dm.h> #include <errno.h> #include <timer.h> diff --git a/drivers/timer/arm_global_timer.c b/drivers/timer/arm_global_timer.c index b8057929f99..2e50d9fbc58 100644 --- a/drivers/timer/arm_global_timer.c +++ b/drivers/timer/arm_global_timer.c @@ -6,7 +6,7 @@ * ARM Cortext A9 global timer driver */ -#include <config.h> +#include <common.h> #include <dm.h> #include <clk.h> #include <timer.h> diff --git a/drivers/timer/arm_twd_timer.c b/drivers/timer/arm_twd_timer.c index 2b2f3591173..40ccd165874 100644 --- a/drivers/timer/arm_twd_timer.c +++ b/drivers/timer/arm_twd_timer.c @@ -27,6 +27,7 @@ * Alex Zuepke <[email protected]> */ +#include <common.h> #include <dm.h> #include <fdtdec.h> #include <timer.h> diff --git a/drivers/timer/ast_timer.c b/drivers/timer/ast_timer.c index 6601cab7b16..78adc96cc59 100644 --- a/drivers/timer/ast_timer.c +++ b/drivers/timer/ast_timer.c @@ -3,6 +3,7 @@ * Copyright 2016 Google Inc. */ +#include <common.h> #include <dm.h> #include <errno.h> #include <timer.h> diff --git a/drivers/timer/atmel_pit_timer.c b/drivers/timer/atmel_pit_timer.c index 0a367a5a7f4..5cf46f224ab 100644 --- a/drivers/timer/atmel_pit_timer.c +++ b/drivers/timer/atmel_pit_timer.c @@ -4,6 +4,7 @@ * Wenyou.Yang <[email protected]> */ +#include <common.h> #include <clk.h> #include <dm.h> #include <timer.h> diff --git a/drivers/timer/atmel_tcb_timer.c b/drivers/timer/atmel_tcb_timer.c index 3a328b2f6c7..8c17987c7d7 100644 --- a/drivers/timer/atmel_tcb_timer.c +++ b/drivers/timer/atmel_tcb_timer.c @@ -5,6 +5,7 @@ * Author: Clément Léger <[email protected]> */ +#include <common.h> #include <clk.h> #include <dm.h> #include <timer.h> diff --git a/drivers/timer/cadence-ttc.c b/drivers/timer/cadence-ttc.c index 3cffb1bb88d..2eff45060ad 100644 --- a/drivers/timer/cadence-ttc.c +++ b/drivers/timer/cadence-ttc.c @@ -3,6 +3,7 @@ * Copyright (C) 2018 Xilinx, Inc. (Michal Simek) */ +#include <common.h> #include <bootstage.h> #include <dm.h> #include <errno.h> diff --git a/drivers/timer/dw-apb-timer.c b/drivers/timer/dw-apb-timer.c index 77ccb98cb8d..0607f751ca7 100644 --- a/drivers/timer/dw-apb-timer.c +++ b/drivers/timer/dw-apb-timer.c @@ -5,6 +5,7 @@ * Copyright (C) 2018 Marek Vasut <[email protected]> */ +#include <common.h> #include <dm.h> #include <clk.h> #include <dt-structs.h> diff --git a/drivers/timer/fttmr010_timer.c b/drivers/timer/fttmr010_timer.c index c41bbfc1d57..b6289e64610 100644 --- a/drivers/timer/fttmr010_timer.c +++ b/drivers/timer/fttmr010_timer.c @@ -5,6 +5,7 @@ * * 23/08/2022 Port to DM */ +#include <common.h> #include <dm.h> #include <log.h> #include <timer.h> diff --git a/drivers/timer/imx-gpt-timer.c b/drivers/timer/imx-gpt-timer.c index 07b9fdb5e18..9c3b64ae5b1 100644 --- a/drivers/timer/imx-gpt-timer.c +++ b/drivers/timer/imx-gpt-timer.c @@ -4,7 +4,7 @@ * Author(s): Giulio Benetti <[email protected]> */ -#include <config.h> +#include <common.h> #include <clk.h> #include <dm.h> #include <fdtdec.h> diff --git a/drivers/timer/mchp-pit64b-timer.c b/drivers/timer/mchp-pit64b-timer.c index 1a5b2e6a0dc..c9806d7eeeb 100644 --- a/drivers/timer/mchp-pit64b-timer.c +++ b/drivers/timer/mchp-pit64b-timer.c @@ -7,6 +7,7 @@ * Author: Claudiu Beznea <[email protected]> */ +#include <common.h> #include <clk.h> #include <dm.h> #include <timer.h> diff --git a/drivers/timer/mpc83xx_timer.c b/drivers/timer/mpc83xx_timer.c index 9da74479aaa..7814cb6a5d6 100644 --- a/drivers/timer/mpc83xx_timer.c +++ b/drivers/timer/mpc83xx_timer.c @@ -4,7 +4,7 @@ * Mario Six, Guntermann & Drunck GmbH, [email protected] */ -#include <config.h> +#include <common.h> #include <clk.h> #include <dm.h> #include <irq_func.h> diff --git a/drivers/timer/mtk_timer.c b/drivers/timer/mtk_timer.c index 8216c289837..223e63f6c1a 100644 --- a/drivers/timer/mtk_timer.c +++ b/drivers/timer/mtk_timer.c @@ -7,6 +7,7 @@ */ #include <clk.h> +#include <common.h> #include <dm.h> #include <timer.h> #include <asm/io.h> diff --git a/drivers/timer/nomadik-mtu-timer.c b/drivers/timer/nomadik-mtu-timer.c index 9a05582c0d5..4d24de14ae6 100644 --- a/drivers/timer/nomadik-mtu-timer.c +++ b/drivers/timer/nomadik-mtu-timer.c @@ -12,6 +12,7 @@ * Copyright (C) 2010 Linus Walleij for ST-Ericsson */ +#include <common.h> #include <dm.h> #include <timer.h> #include <asm/io.h> diff --git a/drivers/timer/npcm-timer.c b/drivers/timer/npcm-timer.c index 9463fd29ce8..4562a6f2311 100644 --- a/drivers/timer/npcm-timer.c +++ b/drivers/timer/npcm-timer.c @@ -3,6 +3,7 @@ * Copyright (c) 2022 Nuvoton Technology Corp. */ +#include <common.h> #include <clk.h> #include <dm.h> #include <timer.h> diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c index fda6356fdba..9b6d97dae67 100644 --- a/drivers/timer/omap-timer.c +++ b/drivers/timer/omap-timer.c @@ -5,6 +5,7 @@ * Copyright (C) 2015, Texas Instruments, Incorporated */ +#include <common.h> #include <dm.h> #include <errno.h> #include <timer.h> diff --git a/drivers/timer/orion-timer.c b/drivers/timer/orion-timer.c index 821b681a232..9cab27f2e48 100644 --- a/drivers/timer/orion-timer.c +++ b/drivers/timer/orion-timer.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ #include <asm/io.h> -#include <config.h> +#include <common.h> #include <div64.h> #include <dm/device.h> #include <dm/fdtaddr.h> diff --git a/drivers/timer/ostm_timer.c b/drivers/timer/ostm_timer.c index 314f956cdfb..3bf0d4647b5 100644 --- a/drivers/timer/ostm_timer.c +++ b/drivers/timer/ostm_timer.c @@ -5,6 +5,7 @@ * Copyright (C) 2019 Marek Vasut <[email protected]> */ +#include <common.h> #include <clock_legacy.h> #include <malloc.h> #include <asm/global_data.h> diff --git a/drivers/timer/riscv_aclint_timer.c b/drivers/timer/riscv_aclint_timer.c index 35da1ea2fd2..73fb8791285 100644 --- a/drivers/timer/riscv_aclint_timer.c +++ b/drivers/timer/riscv_aclint_timer.c @@ -4,7 +4,7 @@ * Copyright (C) 2018, Bin Meng <[email protected]> */ -#include <config.h> +#include <common.h> #include <clk.h> #include <div64.h> #include <dm.h> diff --git a/drivers/timer/riscv_timer.c b/drivers/timer/riscv_timer.c index 1f4980ceb38..169c03dcb5c 100644 --- a/drivers/timer/riscv_timer.c +++ b/drivers/timer/riscv_timer.c @@ -10,7 +10,7 @@ * This driver provides generic timer support for S-mode U-Boot. */ -#include <config.h> +#include <common.h> #include <div64.h> #include <dm.h> #include <errno.h> diff --git a/drivers/timer/rockchip_timer.c b/drivers/timer/rockchip_timer.c index 96c010f4dcc..e66c49aa6bb 100644 --- a/drivers/timer/rockchip_timer.c +++ b/drivers/timer/rockchip_timer.c @@ -3,6 +3,7 @@ * Copyright (C) 2017 Theobroma Systems Design und Consulting GmbH */ +#include <common.h> #include <bootstage.h> #include <dm.h> #include <init.h> diff --git a/drivers/timer/sandbox_timer.c b/drivers/timer/sandbox_timer.c index e8b54a02965..1da7e0c3a76 100644 --- a/drivers/timer/sandbox_timer.c +++ b/drivers/timer/sandbox_timer.c @@ -3,6 +3,7 @@ * Copyright (C) 2015 Thomas Chou <[email protected]> */ +#include <common.h> #include <dm.h> #include <errno.h> #include <timer.h> diff --git a/drivers/timer/sp804_timer.c b/drivers/timer/sp804_timer.c index a254e295cbf..8fd4afb15a5 100644 --- a/drivers/timer/sp804_timer.c +++ b/drivers/timer/sp804_timer.c @@ -4,6 +4,7 @@ * Copyright (C) 2022 Arm Ltd. */ +#include <common.h> #include <clk.h> #include <dm.h> #include <init.h> diff --git a/drivers/timer/starfive-timer.c b/drivers/timer/starfive-timer.c index 6b79c8858b5..6ac7d7f1d0e 100644 --- a/drivers/timer/starfive-timer.c +++ b/drivers/timer/starfive-timer.c @@ -4,6 +4,7 @@ * Author: Kuan Lim Lee <[email protected]> */ +#include <common.h> #include <clk.h> #include <dm.h> #include <time.h> diff --git a/drivers/timer/stm32_timer.c b/drivers/timer/stm32_timer.c index 1dc21c5c1be..1213a14ef19 100644 --- a/drivers/timer/stm32_timer.c +++ b/drivers/timer/stm32_timer.c @@ -6,7 +6,7 @@ #define LOG_CATEGORY UCLASS_TIMER -#include <config.h> +#include <common.h> #include <clk.h> #include <dm.h> #include <fdtdec.h> diff --git a/drivers/timer/tegra-timer.c b/drivers/timer/tegra-timer.c index 3545424889d..a867c649c3a 100644 --- a/drivers/timer/tegra-timer.c +++ b/drivers/timer/tegra-timer.c @@ -3,6 +3,7 @@ * Copyright (C) 2022 Svyatoslav Ryhel <[email protected]> */ +#include <common.h> #include <dm.h> #include <errno.h> #include <timer.h> diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index 8305f06d318..60ff65529ab 100644 --- a/drivers/timer/timer-uclass.c +++ b/drivers/timer/timer-uclass.c @@ -5,6 +5,7 @@ #define LOG_CATEGORY UCLASS_TIMER +#include <common.h> #include <clk.h> #include <cpu.h> #include <dm.h> diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c index 80c084f380d..f86a0b86921 100644 --- a/drivers/timer/tsc_timer.c +++ b/drivers/timer/tsc_timer.c @@ -6,6 +6,7 @@ * arch/x86/kernel/tsc_msr.c and arch/x86/kernel/tsc.c */ +#include <common.h> #include <bootstage.h> #include <dm.h> #include <log.h> diff --git a/drivers/timer/xilinx-timer.c b/drivers/timer/xilinx-timer.c index 54148aa1689..172fd9f9296 100644 --- a/drivers/timer/xilinx-timer.c +++ b/drivers/timer/xilinx-timer.c @@ -7,6 +7,7 @@ * Michal SIMEK <[email protected]> */ +#include <common.h> #include <dm.h> #include <timer.h> #include <regmap.h> |
