1
0
Files
kernel-49/arch/mips/rt2880/time.c
Andrey Zolotarev 3e16f960d2 MTK patch: MT7621: second udelay calibration fixup
Fix random delay inaccurate issue of MT7621.
2019-07-05 16:56:12 +07:00

94 lines
2.6 KiB
C

/**************************************************************************
*
* BRIEF MODULE DESCRIPTION
* timer setup for Ralink RT2880 solution
*
* Copyright 2007 Ralink Inc. (bruce_chang@ralinktech.com.tw)
*
* 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* 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.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
**************************************************************************
* May 2007 Bruce Chang
*
* Initial Release
*
*
*
**************************************************************************
*/
#include <linux/types.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/timex.h>
#include <linux/jiffies.h>
#include <linux/delay.h>
#include <asm/mipsregs.h>
#include <asm/hardirq.h>
#include <asm/div64.h>
#include <asm/cpu.h>
#include <asm/time.h>
#ifdef CONFIG_CLKSRC_MIPS_GIC
#include <linux/irqchip/mips-gic.h>
#endif
#include <asm/rt2880/generic.h>
#include <asm/rt2880/prom.h>
#include <asm/rt2880/rt_mmap.h>
extern unsigned int mips_hpt_frequency;
extern u32 mips_cpu_feq;
extern u32 surfboard_sysclk;
#if defined(CONFIG_RALINK_MT7621)
static int udelay_recal(void)
{
unsigned int i;
for (i = 1; i < num_present_cpus(); i++)
cpu_data[i].udelay_val = cpu_data[0].udelay_val;
return 0;
}
postcore_initcall(udelay_recal);
#endif
void __init plat_time_init(void)
{
#ifdef CONFIG_CLKSRC_MIPS_GIC
gic_clocksource_init(mips_cpu_feq);
#else
mips_hpt_frequency = mips_cpu_feq / 2;
#endif
}
u32 get_surfboard_sysclk(void)
{
return surfboard_sysclk;
}
EXPORT_SYMBOL(get_surfboard_sysclk);