/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2021 Sean Anderson <[email protected]> */ #ifndef XILINX_TIMER_H #define XILINX_TIMER_H #include <linux/compiler.h> #define TCSR0 … #define TLR0 … #define TCR0 … #define TCSR1 … #define TLR1 … #define TCR1 … #define TCSR_MDT … #define TCSR_UDT … #define TCSR_GENT … #define TCSR_CAPT … #define TCSR_ARHT … #define TCSR_LOAD … #define TCSR_ENIT … #define TCSR_ENT … #define TCSR_TINT … #define TCSR_PWMA … #define TCSR_ENALL … #define TCSR_CASC … struct clk; struct device_node; struct regmap; /** * struct xilinx_timer_priv - Private data for Xilinx AXI timer drivers * @map: Regmap of the device, possibly with an offset * @clk: Parent clock * @max: Maximum value of the counters */ struct xilinx_timer_priv { … }; /** * xilinx_timer_tlr_cycles() - Calculate the TLR for a period specified * in clock cycles * @priv: The timer's private data * @tcsr: The value of the TCSR register for this counter * @cycles: The number of cycles in this period * * Callers of this function MUST ensure that @cycles is representable as * a TLR. * * Return: The calculated value for TLR */ u32 xilinx_timer_tlr_cycles(struct xilinx_timer_priv *priv, u32 tcsr, u64 cycles); /** * xilinx_timer_get_period() - Get the current period of a counter * @priv: The timer's private data * @tlr: The value of TLR for this counter * @tcsr: The value of TCSR for this counter * * Return: The period, in ns */ unsigned int xilinx_timer_get_period(struct xilinx_timer_priv *priv, u32 tlr, u32 tcsr); #endif /* XILINX_TIMER_H */