Merge tag 'timers-v5.20-rc1' of https://git.linaro.org/people/daniel.lezcano/linux...
authorThomas Gleixner <tglx@linutronix.de>
Thu, 28 Jul 2022 10:33:34 +0000 (12:33 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 28 Jul 2022 10:33:34 +0000 (12:33 +0200)
Pull clockevent/source updates from Daniel Lezcano:

  - Add the missing DT bindings for the MTU nomadik timer (Linus
    Walleij)

  - Fix grammar typo in the ARM global timer Kconfig option (Randy
    Dunlap)

  - Add the tegra186 timer and use it on the tegra234 board (Thierry
    Reding)

  - Add the 'CPUXGPT' CPU timer for Mediatek MT6795 and implement a
    workaround to overcome an ATF bug where the timer is not correctly
    initialized (AngeloGioacchino Del Regno)

  - Rework the suspend/resume approach to enable the feature on the
    timer even it is not an active clock and fix a compilation warning
    (Claudiu Beznea)

  - Add the Add R-Car Gen4 timer support along with the DT bindings
    (Wolfram Sang)

  - Add compatible for ti,am654-timer to support AM6 SoC (Tony Lindgren)

  - Fix Kconfig option to put it back to 'bool' instead of 'tristate'
    for the tegra186 (Daniel Lezcano)

  - Sort 'family,type' DT bindings for the Renesas timers (Geert
    Uytterhoeven)

  - Add compatible 'allwinner,sun20i-d1-timer' for Allwinner D1 (Samuel
    Holland)

  - Remove unnecessary (void*) conversions for sun4i (XU pengfei)

  - Remove unnecessary (void*) conversions for sun5i (Li zeming)

Link: https://lore.kernel.org/all/7472984e-f502-5f27-82bf-070127dd85a5@linaro.org
1  2 
arch/arm/mach-omap2/Kconfig
drivers/clocksource/Kconfig
drivers/clocksource/Makefile
drivers/clocksource/timer-ti-dm.c

index a8adbb4d478a8a0cf8e870cfe12fbad2b41adc11,21e99287f5c0e61592080c93114e8b6325c67d58..f7f940282c3f890588a6cbcc24feb4d54d6832ae
@@@ -105,6 -105,7 +105,7 @@@ config ARCH_OMAP2PLU
        select MACH_OMAP_GENERIC
        select MEMORY
        select MFD_SYSCON
+       select OMAP_DM_SYSTIMER
        select OMAP_DM_TIMER
        select OMAP_GPMC
        select PINCTRL
@@@ -123,8 -124,6 +124,8 @@@ config OMAP_INTERCONNECT_BARRIE
        bool
        select ARM_HEAVY_MB
        
 +config ARCH_OMAP
 +      bool
  
  if ARCH_OMAP2PLUS
  
@@@ -155,53 -154,6 +156,53 @@@ config SOC_HAS_REALTIME_COUNTE
        depends on SOC_OMAP5 || SOC_DRA7XX
        default y
  
 +config POWER_AVS_OMAP
 +      bool "AVS(Adaptive Voltage Scaling) support for OMAP IP versions 1&2"
 +      depends on (ARCH_OMAP3 || ARCH_OMAP4) && PM
 +      select POWER_SUPPLY
 +      help
 +        Say Y to enable AVS(Adaptive Voltage Scaling)
 +        support on OMAP containing the version 1 or
 +        version 2 of the SmartReflex IP.
 +        V1 is the 65nm version used in OMAP3430.
 +        V2 is the update for the 45nm version of the IP used in OMAP3630
 +        and OMAP4430
 +
 +        Please note, that by default SmartReflex is only
 +        initialized and not enabled. To enable the automatic voltage
 +        compensation for vdd mpu and vdd core from user space,
 +        user must write 1 to
 +              /debug/smartreflex/sr_<X>/autocomp,
 +        where X is mpu_iva or core for OMAP3.
 +        Optionally autocompensation can be enabled in the kernel
 +        by default during system init via the enable_on_init flag
 +        which an be passed as platform data to the smartreflex driver.
 +
 +config POWER_AVS_OMAP_CLASS3
 +      bool "Class 3 mode of Smartreflex Implementation"
 +      depends on POWER_AVS_OMAP && TWL4030_CORE
 +      help
 +        Say Y to enable Class 3 implementation of Smartreflex
 +
 +        Class 3 implementation of Smartreflex employs continuous hardware
 +        voltage calibration.
 +
 +config OMAP3_L2_AUX_SECURE_SAVE_RESTORE
 +      bool "OMAP3 HS/EMU save and restore for L2 AUX control register"
 +      depends on ARCH_OMAP3 && PM
 +      help
 +        Without this option, L2 Auxiliary control register contents are
 +        lost during off-mode entry on HS/EMU devices. This feature
 +        requires support from PPA / boot-loader in HS/EMU devices, which
 +        currently does not exist by default.
 +
 +config OMAP3_L2_AUX_SECURE_SERVICE_SET_ID
 +      int "Service ID for the support routine to set L2 AUX control"
 +      depends on OMAP3_L2_AUX_SECURE_SAVE_RESTORE
 +      default 43
 +      help
 +        PPA routine service ID for setting L2 auxiliary control register.
 +
  comment "OMAP Core Type"
        depends on ARCH_OMAP2
  
@@@ -209,6 -161,7 +210,7 @@@ config SOC_OMAP242
        bool "OMAP2420 support"
        depends on ARCH_OMAP2
        default y
+       select OMAP_DM_SYSTIMER
        select OMAP_DM_TIMER
        select SOC_HAS_OMAP2_SDRC
  
index 3c0ee102fe73b3463fdfe34c859c01f58fd96bb7,440d4f41d17dd87dae42ed68985b6f62060de266..4f2bb7315b67ae9fb8e0e9ac8d63b5fafe8ff2fe
@@@ -22,7 -22,7 +22,7 @@@ config CLKEVT_I825
  config I8253_LOCK
        bool
  
- config OMAP_DM_TIMER
+ config OMAP_DM_SYSTIMER
        bool
        select TIMER_OF
  
@@@ -56,6 -56,13 +56,13 @@@ config DIGICOLOR_TIME
        help
          Enables the support for the digicolor timer driver.
  
+ config OMAP_DM_TIMER
+       bool "OMAP dual-mode timer driver" if ARCH_K3 || COMPILE_TEST
+       default y if ARCH_K3
+       select TIMER_OF
+       help
+         Enables the support for the TI dual-mode timer driver.
  config DW_APB_TIMER
        bool "DW APB timer driver" if COMPILE_TEST
        help
@@@ -150,6 -157,14 +157,14 @@@ config TEGRA_TIME
        help
          Enables support for the Tegra driver.
  
+ config TEGRA186_TIMER
+       bool "NVIDIA Tegra186 timer driver"
+       depends on ARCH_TEGRA || COMPILE_TEST
+       depends on WATCHDOG && WATCHDOG_CORE
+       help
+         Enables support for the timers and watchdogs found on NVIDIA
+         Tegra186 and later SoCs.
  config VT8500_TIMER
        bool "VT8500 timer driver" if COMPILE_TEST
        depends on HAS_IOMEM
@@@ -367,7 -382,7 +382,7 @@@ config ARM_GT_INITIAL_PRESCALER_VA
        depends on ARM_GLOBAL_TIMER
        help
          When the ARM global timer initializes, its current rate is declared
-         to the kernel and maintained forever. Should it's parent clock
+         to the kernel and maintained forever. Should its parent clock
          change, the driver tries to fix the timer's internal prescaler.
          On some machs (i.e. Zynq) the initial prescaler value thus poses
          bounds about how much the parent clock is allowed to decrease or
@@@ -567,6 -582,26 +582,6 @@@ config CLKSRC_PX
          This enables OST0 support available on PXA and SA-11x0
          platforms.
  
 -config H8300_TMR8
 -      bool "Clockevent timer for the H8300 platform" if COMPILE_TEST
 -      depends on HAS_IOMEM
 -      help
 -        This enables the 8 bits timer for the H8300 platform.
 -
 -config H8300_TMR16
 -      bool "Clockevent timer for the H83069 platform" if COMPILE_TEST
 -      depends on HAS_IOMEM
 -      help
 -        This enables the 16 bits timer for the H8300 platform with the
 -        H83069 CPU.
 -
 -config H8300_TPU
 -      bool "Clocksource for the H8300 platform" if COMPILE_TEST
 -      depends on HAS_IOMEM
 -      help
 -        This enables the clocksource for the H8300 platform with the
 -        H8S2678 CPU.
 -
  config CLKSRC_IMX_GPT
        bool "Clocksource using i.MX GPT" if COMPILE_TEST
        depends on (ARM || ARM64) && HAVE_CLK
@@@ -597,14 -632,6 +612,14 @@@ config CLKSRC_ST_LP
          Enable this option to use the Low Power controller timer
          as clocksource.
  
 +config GXP_TIMER
 +      bool "GXP timer driver" if COMPILE_TEST && !ARCH_HPE
 +      default ARCH_HPE
 +      select TIMER_OF if OF
 +      help
 +        Provides a driver for the timer control found on HPE
 +        GXP SOCs. This is required for all GXP SOCs.
 +
  config RISCV_TIMER
        bool "Timer for the RISC-V platform" if COMPILE_TEST
        depends on GENERIC_SCHED_CLOCK && RISCV && RISCV_SBI
@@@ -699,11 -726,4 +714,11 @@@ config MICROCHIP_PIT64
          modes and high resolution. It is used as a clocksource
          and a clockevent.
  
 +config GOLDFISH_TIMER
 +      bool "Clocksource using goldfish-rtc"
 +      depends on M68K || COMPILE_TEST
 +      depends on RTC_DRV_GOLDFISH
 +      help
 +        Support for the timer/counter of goldfish-rtc
 +
  endmenu
index 6ca640019e10d4e3f48cb373ace65dd73b0fa416,fadb5a8f5e07a3ec7b4a8824b0e7d9331b2985b4..64ab547de97b9ad6bdea001834e50535e919d6a7
@@@ -18,7 -18,7 +18,7 @@@ obj-$(CONFIG_CLKSRC_MMIO)     += mmio.
  obj-$(CONFIG_DAVINCI_TIMER)   += timer-davinci.o
  obj-$(CONFIG_DIGICOLOR_TIMER) += timer-digicolor.o
  obj-$(CONFIG_OMAP_DM_TIMER)   += timer-ti-dm.o
- obj-$(CONFIG_OMAP_DM_TIMER)   += timer-ti-dm-systimer.o
+ obj-$(CONFIG_OMAP_DM_SYSTIMER)        += timer-ti-dm-systimer.o
  obj-$(CONFIG_DW_APB_TIMER)    += dw_apb_timer.o
  obj-$(CONFIG_DW_APB_TIMER_OF) += dw_apb_timer_of.o
  obj-$(CONFIG_FTTMR010_TIMER)  += timer-fttmr010.o
@@@ -36,6 -36,7 +36,7 @@@ obj-$(CONFIG_SUN4I_TIMER)     += timer-sun4
  obj-$(CONFIG_SUN5I_HSTIMER)   += timer-sun5i.o
  obj-$(CONFIG_MESON6_TIMER)    += timer-meson6.o
  obj-$(CONFIG_TEGRA_TIMER)     += timer-tegra.o
+ obj-$(CONFIG_TEGRA186_TIMER)  += timer-tegra186.o
  obj-$(CONFIG_VT8500_TIMER)    += timer-vt8500.o
  obj-$(CONFIG_NSPIRE_TIMER)    += timer-zevio.o
  obj-$(CONFIG_BCM_KONA_TIMER)  += bcm_kona_timer.o
@@@ -73,6 -74,9 +74,6 @@@ obj-$(CONFIG_CLKSRC_IMX_GPT)          += timer-
  obj-$(CONFIG_CLKSRC_IMX_TPM)          += timer-imx-tpm.o
  obj-$(CONFIG_TIMER_IMX_SYS_CTR)               += timer-imx-sysctr.o
  obj-$(CONFIG_ASM9260_TIMER)           += asm9260_timer.o
 -obj-$(CONFIG_H8300_TMR8)              += h8300_timer8.o
 -obj-$(CONFIG_H8300_TMR16)             += h8300_timer16.o
 -obj-$(CONFIG_H8300_TPU)                       += h8300_tpu.o
  obj-$(CONFIG_INGENIC_OST)             += ingenic-ost.o
  obj-$(CONFIG_INGENIC_SYSOST)  += ingenic-sysost.o
  obj-$(CONFIG_INGENIC_TIMER)           += ingenic-timer.o
@@@ -85,5 -89,3 +86,5 @@@ obj-$(CONFIG_GX6605S_TIMER)           += timer-g
  obj-$(CONFIG_HYPERV_TIMER)            += hyperv_timer.o
  obj-$(CONFIG_MICROCHIP_PIT64B)                += timer-microchip-pit64b.o
  obj-$(CONFIG_MSC313E_TIMER)           += timer-msc313e.o
 +obj-$(CONFIG_GOLDFISH_TIMER)          += timer-goldfish.o
 +obj-$(CONFIG_GXP_TIMER)                       += timer-gxp.o
index c194e8f74e1d04c5cd8cd85800a393c03d9e6daa,80d7e5aaefde3cd89dba470cd0a031ab10a93fa2..469f7c91564b664ffeb0317d5e9b1f29579c30ac
@@@ -44,6 -44,121 +44,121 @@@ enum 
        REQUEST_BY_NODE,
  };
  
+ static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg,
+                                               int posted)
+ {
+       if (posted)
+               while (readl_relaxed(timer->pend) & (reg >> WPSHIFT))
+                       cpu_relax();
+       return readl_relaxed(timer->func_base + (reg & 0xff));
+ }
+ static inline void __omap_dm_timer_write(struct omap_dm_timer *timer,
+                                       u32 reg, u32 val, int posted)
+ {
+       if (posted)
+               while (readl_relaxed(timer->pend) & (reg >> WPSHIFT))
+                       cpu_relax();
+       writel_relaxed(val, timer->func_base + (reg & 0xff));
+ }
+ static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer)
+ {
+       u32 tidr;
+       /* Assume v1 ip if bits [31:16] are zero */
+       tidr = readl_relaxed(timer->io_base);
+       if (!(tidr >> 16)) {
+               timer->revision = 1;
+               timer->irq_stat = timer->io_base + OMAP_TIMER_V1_STAT_OFFSET;
+               timer->irq_ena = timer->io_base + OMAP_TIMER_V1_INT_EN_OFFSET;
+               timer->irq_dis = timer->io_base + OMAP_TIMER_V1_INT_EN_OFFSET;
+               timer->pend = timer->io_base + _OMAP_TIMER_WRITE_PEND_OFFSET;
+               timer->func_base = timer->io_base;
+       } else {
+               timer->revision = 2;
+               timer->irq_stat = timer->io_base + OMAP_TIMER_V2_IRQSTATUS;
+               timer->irq_ena = timer->io_base + OMAP_TIMER_V2_IRQENABLE_SET;
+               timer->irq_dis = timer->io_base + OMAP_TIMER_V2_IRQENABLE_CLR;
+               timer->pend = timer->io_base +
+                       _OMAP_TIMER_WRITE_PEND_OFFSET +
+                               OMAP_TIMER_V2_FUNC_OFFSET;
+               timer->func_base = timer->io_base + OMAP_TIMER_V2_FUNC_OFFSET;
+       }
+ }
+ /*
+  * __omap_dm_timer_enable_posted - enables write posted mode
+  * @timer:      pointer to timer instance handle
+  *
+  * Enables the write posted mode for the timer. When posted mode is enabled
+  * writes to certain timer registers are immediately acknowledged by the
+  * internal bus and hence prevents stalling the CPU waiting for the write to
+  * complete. Enabling this feature can improve performance for writing to the
+  * timer registers.
+  */
+ static inline void __omap_dm_timer_enable_posted(struct omap_dm_timer *timer)
+ {
+       if (timer->posted)
+               return;
+       if (timer->errata & OMAP_TIMER_ERRATA_I103_I767) {
+               timer->posted = OMAP_TIMER_NONPOSTED;
+               __omap_dm_timer_write(timer, OMAP_TIMER_IF_CTRL_REG, 0, 0);
+               return;
+       }
+       __omap_dm_timer_write(timer, OMAP_TIMER_IF_CTRL_REG,
+                             OMAP_TIMER_CTRL_POSTED, 0);
+       timer->context.tsicr = OMAP_TIMER_CTRL_POSTED;
+       timer->posted = OMAP_TIMER_POSTED;
+ }
+ static inline void __omap_dm_timer_stop(struct omap_dm_timer *timer,
+                                       int posted, unsigned long rate)
+ {
+       u32 l;
+       l = __omap_dm_timer_read(timer, OMAP_TIMER_CTRL_REG, posted);
+       if (l & OMAP_TIMER_CTRL_ST) {
+               l &= ~0x1;
+               __omap_dm_timer_write(timer, OMAP_TIMER_CTRL_REG, l, posted);
+ #ifdef CONFIG_ARCH_OMAP2PLUS
+               /* Readback to make sure write has completed */
+               __omap_dm_timer_read(timer, OMAP_TIMER_CTRL_REG, posted);
+               /*
+                * Wait for functional clock period x 3.5 to make sure that
+                * timer is stopped
+                */
+               udelay(3500000 / rate + 1);
+ #endif
+       }
+       /* Ack possibly pending interrupt */
+       writel_relaxed(OMAP_TIMER_INT_OVERFLOW, timer->irq_stat);
+ }
+ static inline void __omap_dm_timer_int_enable(struct omap_dm_timer *timer,
+                                               unsigned int value)
+ {
+       writel_relaxed(value, timer->irq_ena);
+       __omap_dm_timer_write(timer, OMAP_TIMER_WAKEUP_EN_REG, value, 0);
+ }
+ static inline unsigned int
+ __omap_dm_timer_read_counter(struct omap_dm_timer *timer, int posted)
+ {
+       return __omap_dm_timer_read(timer, OMAP_TIMER_COUNTER_REG, posted);
+ }
+ static inline void __omap_dm_timer_write_status(struct omap_dm_timer *timer,
+                                               unsigned int value)
+ {
+       writel_relaxed(value, timer->irq_stat);
+ }
  /**
   * omap_dm_timer_read_reg - read timer registers in posted and non-posted mode
   * @timer:      timer pointer over which read operation to perform
@@@ -433,7 -548,7 +548,7 @@@ int omap_dm_timer_get_irq(struct omap_d
  }
  
  #if defined(CONFIG_ARCH_OMAP1)
 -#include <mach/hardware.h>
 +#include <linux/soc/ti/omap1-io.h>
  
  static struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
  {
@@@ -921,6 -1036,10 +1036,10 @@@ static const struct dmtimer_platform_da
        .timer_ops = &dmtimer_ops,
  };
  
+ static const struct dmtimer_platform_data am6_pdata = {
+       .timer_ops = &dmtimer_ops,
+ };
  static const struct of_device_id omap_timer_match[] = {
        {
                .compatible = "ti,omap2420-timer",
                .compatible = "ti,dm816-timer",
                .data = &omap3plus_pdata,
        },
+       {
+               .compatible = "ti,am654-timer",
+               .data = &am6_pdata,
+       },
        {},
  };
  MODULE_DEVICE_TABLE(of, omap_timer_match);