From fde084bc490daf99da85292ef87d6dcf3446c212 Mon Sep 17 00:00:00 2001 From: Sam Lewis Date: Tue, 4 Aug 2020 19:47:50 +1000 Subject: soc/ti/am335x: Fix timer implementation Implements the monotonic timer using the am335x dmtimer peripheral. Change-Id: I4736b6d3b6e26370be9e8f369fc02285ad519223 Signed-off-by: Sam Lewis Reviewed-on: https://review.coreboot.org/c/coreboot/+/44383 Reviewed-by: Arthur Heymans Tested-by: build bot (Jenkins) --- src/soc/ti/am335x/dmtimer.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'src/soc/ti/am335x/dmtimer.h') diff --git a/src/soc/ti/am335x/dmtimer.h b/src/soc/ti/am335x/dmtimer.h index ad8515fbba..56f3d0f011 100644 --- a/src/soc/ti/am335x/dmtimer.h +++ b/src/soc/ti/am335x/dmtimer.h @@ -5,9 +5,33 @@ #include -#define OSC_HZ 24000000 +#define M_OSC_MHZ (24) -void dmtimer_start(int num); -uint64_t dmtimer_raw_value(int num); +struct am335x_dmtimer { + uint32_t tidr; + uint8_t res1[12]; + uint32_t tiocp_cfg; + uint8_t res2[12]; + uint32_t irq_eoi; + uint32_t irqstatus_raw; + uint32_t irqstatus; + uint32_t irqenable_set; + uint32_t irqenable_clr; + uint32_t irqwakeen; + uint32_t tclr; + uint32_t tcrr; + uint32_t tldr; + uint32_t ttgr; + uint32_t twps; + uint32_t tmar; + uint32_t tcar1; + uint32_t tsicr; + uint32_t tcar2; +}; + +#define TCLR_ST (0x01 << 0) +#define TCLR_AR (0x01 << 1) + +#define DMTIMER_2 (0x48040000) #endif -- cgit v1.2.3