~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/m68k/hp300/time.c

Version: ~ [ linux-5.1.2 ] ~ [ linux-5.0.16 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.43 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.119 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.176 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.179 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.139 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.67 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  *  linux/arch/m68k/hp300/time.c
  3  *
  4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
  5  *
  6  *  This file contains the HP300-specific time handling code.
  7  */
  8 
  9 #include <asm/ptrace.h>
 10 #include <linux/types.h>
 11 #include <linux/init.h>
 12 #include <linux/sched.h>
 13 #include <linux/kernel_stat.h>
 14 #include <linux/interrupt.h>
 15 #include <asm/machdep.h>
 16 #include <asm/irq.h>
 17 #include <asm/io.h>
 18 #include <asm/system.h>
 19 #include <asm/traps.h>
 20 #include "ints.h"
 21 
 22 /* Clock hardware definitions */
 23 
 24 #define CLOCKBASE       0xf05f8000
 25 
 26 #define CLKCR1          0x1
 27 #define CLKCR2          0x3
 28 #define CLKCR3          CLKCR1
 29 #define CLKSR           CLKCR2
 30 #define CLKMSB1         0x5
 31 #define CLKMSB2         0x9
 32 #define CLKMSB3         0xD
 33 
 34 /* This is for machines which generate the exact clock. */
 35 #define USECS_PER_JIFFY (1000000/HZ)
 36 
 37 #define INTVAL ((10000 / 4) - 1)
 38 
 39 static irqreturn_t hp300_tick(int irq, void *dev_id, struct pt_regs *regs)
 40 {
 41   unsigned long tmp;
 42   irqreturn_t (*vector)(int, void *, struct pt_regs *) = dev_id;
 43   in_8(CLOCKBASE + CLKSR);
 44   asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
 45   return vector(irq, NULL, regs);
 46 }
 47 
 48 unsigned long hp300_gettimeoffset(void)
 49 {
 50   /* Read current timer 1 value */
 51   unsigned char lsb, msb1, msb2;
 52   unsigned short ticks;
 53 
 54   msb1 = in_8(CLOCKBASE + 5);
 55   lsb = in_8(CLOCKBASE + 7);
 56   msb2 = in_8(CLOCKBASE + 5);
 57   if (msb1 != msb2)
 58     /* A carry happened while we were reading.  Read it again */
 59     lsb = in_8(CLOCKBASE + 7);
 60   ticks = INTVAL - ((msb2 << 8) | lsb);
 61   return (USECS_PER_JIFFY * ticks) / INTVAL;
 62 }
 63 
 64 void __init hp300_sched_init(irqreturn_t (*vector)(int, void *, struct pt_regs *))
 65 {
 66   out_8(CLOCKBASE + CLKCR2, 0x1);               /* select CR1 */
 67   out_8(CLOCKBASE + CLKCR1, 0x1);               /* reset */
 68 
 69   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
 70 
 71   sys_request_irq(6, hp300_tick, IRQ_FLG_STD, "timer tick", vector);
 72 
 73   out_8(CLOCKBASE + CLKCR2, 0x1);               /* select CR1 */
 74   out_8(CLOCKBASE + CLKCR1, 0x40);              /* enable irq */
 75 }
 76 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp