2018-05-07 06:58:06 +09:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2007-05-13 20:58:00 +09:00
|
|
|
/*
|
2009-06-04 19:06:47 +09:00
|
|
|
* (C) Copyright 2009
|
|
|
|
* Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
|
|
|
|
*
|
2012-08-21 13:14:46 +09:00
|
|
|
* (C) Copyright 2007-2012
|
2008-11-20 16:44:42 +09:00
|
|
|
* Nobobuhiro Iwamatsu <iwamatsu@nigauri.org>
|
|
|
|
*
|
|
|
|
* (C) Copyright 2003
|
|
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
2007-05-13 20:58:00 +09:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2020-05-11 02:40:02 +09:00
|
|
|
#include <init.h>
|
2008-07-08 12:03:24 +09:00
|
|
|
#include <asm/processor.h>
|
2008-11-20 16:44:42 +09:00
|
|
|
#include <asm/io.h>
|
2020-05-11 02:40:13 +09:00
|
|
|
#include <linux/bitops.h>
|
2018-08-25 04:37:14 +09:00
|
|
|
|
|
|
|
#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_RMOBILE)
|
2018-08-25 04:43:17 +09:00
|
|
|
#define TSTR 0x4
|
|
|
|
#define TCR0 0x10
|
2018-08-25 04:37:14 +09:00
|
|
|
#endif /* CONFIG_CPU_SH4 */
|
2012-08-21 13:14:46 +09:00
|
|
|
|
2018-08-25 04:43:17 +09:00
|
|
|
#define TCR_TPSC 0x07
|
2018-08-25 04:23:04 +09:00
|
|
|
#define TSTR_STR0 BIT(0)
|
2013-07-23 13:57:24 +09:00
|
|
|
|
2012-08-21 13:14:46 +09:00
|
|
|
int timer_init(void)
|
2007-05-13 20:58:00 +09:00
|
|
|
{
|
2018-08-25 04:43:17 +09:00
|
|
|
writew(readw(TMU_BASE + TCR0) & ~TCR_TPSC, TMU_BASE + TCR0);
|
|
|
|
writeb(readb(TMU_BASE + TSTR) & ~TSTR_STR0, TMU_BASE + TSTR);
|
|
|
|
writeb(readb(TMU_BASE + TSTR) | TSTR_STR0, TMU_BASE + TSTR);
|
2007-05-13 20:58:00 +09:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|