Skip to content
Snippets Groups Projects
Select Git revision
  • 0384dcae2b18db80c49117ac57ea15211ca48751
  • vme-testing default
  • ci-test
  • master
  • remoteproc
  • am625-sk-ov5640
  • pcal6534-upstreaming
  • lps22df-upstreaming
  • msc-upstreaming
  • imx8mp
  • iio/noa1305
  • vme-next
  • vme-next-4.14-rc4
  • v4.14-rc4
  • v4.14-rc3
  • v4.14-rc2
  • v4.14-rc1
  • v4.13
  • vme-next-4.13-rc7
  • v4.13-rc7
  • v4.13-rc6
  • v4.13-rc5
  • v4.13-rc4
  • v4.13-rc3
  • v4.13-rc2
  • v4.13-rc1
  • v4.12
  • v4.12-rc7
  • v4.12-rc6
  • v4.12-rc5
  • v4.12-rc4
  • v4.12-rc3
32 results

io_apic.c

Blame
  • time.c 7.48 KiB
    /*
     *  linux/arch/m32r/kernel/time.c
     *
     *  Copyright (c) 2001, 2002  Hiroyuki Kondo, Hirokazu Takata,
     *                            Hitoshi Yamamoto
     *  Taken from i386 version.
     *    Copyright (C) 1991, 1992, 1995  Linus Torvalds
     *    Copyright (C) 1996, 1997, 1998  Ralf Baechle
     *
     *  This file contains the time handling details for PC-style clocks as
     *  found in some MIPS systems.
     *
     *  Some code taken from sh version.
     *    Copyright (C) 1999  Tetsuya Okada & Niibe Yutaka
     *    Copyright (C) 2000  Philipp Rumpf <prumpf@tux.org>
     */
    
    #undef  DEBUG_TIMER
    
    #include <linux/errno.h>
    #include <linux/init.h>
    #include <linux/module.h>
    #include <linux/sched.h>
    #include <linux/kernel.h>
    #include <linux/param.h>
    #include <linux/string.h>
    #include <linux/mm.h>
    #include <linux/interrupt.h>
    #include <linux/profile.h>
    
    #include <asm/io.h>
    #include <asm/m32r.h>
    
    #include <asm/hw_irq.h>
    
    #ifdef CONFIG_SMP
    extern void smp_local_timer_interrupt(void);
    #endif
    
    #define TICK_SIZE	(tick_nsec / 1000)
    
    /*
     * Change this if you have some constant time drift
     */
    
    /* This is for machines which generate the exact clock. */
    #define USECS_PER_JIFFY (1000000/HZ)
    
    static unsigned long latch;
    
    static unsigned long do_gettimeoffset(void)
    {
    	unsigned long  elapsed_time = 0;  /* [us] */
    
    #if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \
    	|| defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \
    	|| defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104)
    #ifndef CONFIG_SMP
    
    	unsigned long count;
    
    	/* timer count may underflow right here */
    	count = inl(M32R_MFT2CUT_PORTL);
    
    	if (inl(M32R_ICU_CR18_PORTL) & 0x00000100)	/* underflow check */
    		count = 0;
    
    	count = (latch - count) * TICK_SIZE;
    	elapsed_time = (count + latch / 2) / latch;
    	/* NOTE: LATCH is equal to the "interval" value (= reload count). */