2007-07-05 16:01:28 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2000, 2001
|
|
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
*
|
|
|
|
* See file CREDITS for list of people who contributed to this
|
|
|
|
* project.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2007-07-05 16:01:28 +00:00
|
|
|
#include <clock.h>
|
|
|
|
#include <init.h>
|
2009-10-22 12:21:30 +00:00
|
|
|
#include <mach/clocks.h>
|
2007-07-05 16:02:16 +00:00
|
|
|
#include <asm/common.h>
|
2007-07-05 16:01:28 +00:00
|
|
|
|
2007-07-05 16:01:28 +00:00
|
|
|
uint64_t ppc_clocksource_read(void)
|
|
|
|
{
|
|
|
|
return get_ticks();
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct clocksource cs = {
|
|
|
|
.read = ppc_clocksource_read,
|
2010-11-29 14:14:04 +00:00
|
|
|
.mask = CLOCKSOURCE_MASK(32),
|
2007-07-05 16:01:28 +00:00
|
|
|
.shift = 15,
|
|
|
|
};
|
|
|
|
|
2012-05-01 09:26:00 +00:00
|
|
|
static int clocksource_init(void)
|
2007-07-05 16:01:28 +00:00
|
|
|
{
|
2012-05-01 09:26:00 +00:00
|
|
|
/* reset time base */
|
|
|
|
asm ("li 3,0 ; mttbu 3 ; mttbl 3 ;");
|
2007-07-05 16:01:28 +00:00
|
|
|
|
2007-09-13 14:06:02 +00:00
|
|
|
cs.mult = clocksource_hz2mult(get_timebase_clock(), cs.shift);
|
2007-07-05 16:01:28 +00:00
|
|
|
|
2007-09-13 14:06:02 +00:00
|
|
|
init_clock(&cs);
|
2007-07-05 16:01:28 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
core_initcall(clocksource_init);
|