mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-10 06:43:28 +09:00
![Tom Rini](/assets/img/avatar_default.png)
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
45 lines
1.1 KiB
C
45 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* (C) Copyright 2007
|
|
* Sascha Hauer, Pengutronix
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <asm/arch/imx-regs.h>
|
|
#include <asm/io.h>
|
|
|
|
#define TIMER_BASE 0x53f90000 /* General purpose timer 1 */
|
|
|
|
/* General purpose timers registers */
|
|
#define GPTCR __REG(TIMER_BASE) /* Control register */
|
|
#define GPTPR __REG(TIMER_BASE + 0x4) /* Prescaler register */
|
|
#define GPTSR __REG(TIMER_BASE + 0x8) /* Status register */
|
|
#define GPTCNT __REG(TIMER_BASE + 0x24) /* Counter register */
|
|
|
|
/* General purpose timers bitfields */
|
|
#define GPTCR_SWR (1 << 15) /* Software reset */
|
|
#define GPTCR_FRR (1 << 9) /* Freerun / restart */
|
|
#define GPTCR_CLKSOURCE_32 (4 << 6) /* Clock source */
|
|
#define GPTCR_TEN 1 /* Timer enable */
|
|
|
|
/* The 32768Hz 32-bit timer overruns in 131072 seconds */
|
|
int timer_init(void)
|
|
{
|
|
int i;
|
|
|
|
/* setup GP Timer 1 */
|
|
GPTCR = GPTCR_SWR;
|
|
for (i = 0; i < 100; i++)
|
|
GPTCR = 0; /* We have no udelay by now */
|
|
GPTPR = 0; /* 32Khz */
|
|
/* Freerun Mode, PERCLK1 input */
|
|
GPTCR |= GPTCR_CLKSOURCE_32 | GPTCR_TEN;
|
|
|
|
return 0;
|
|
}
|
|
|
|
unsigned long timer_read_counter(void)
|
|
{
|
|
return GPTCNT;
|
|
}
|