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

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

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  *  linux/arch/m68k/sun3x/time.c
  4  *
  5  *  Sun3x-specific time handling
  6  */
  7 
  8 #include <linux/types.h>
  9 #include <linux/kd.h>
 10 #include <linux/init.h>
 11 #include <linux/sched.h>
 12 #include <linux/kernel_stat.h>
 13 #include <linux/interrupt.h>
 14 #include <linux/rtc.h>
 15 #include <linux/bcd.h>
 16 
 17 #include <asm/irq.h>
 18 #include <asm/io.h>
 19 #include <asm/machdep.h>
 20 #include <asm/traps.h>
 21 #include <asm/sun3x.h>
 22 #include <asm/sun3ints.h>
 23 
 24 #include "time.h"
 25 
 26 #define M_CONTROL 0xf8
 27 #define M_SEC     0xf9
 28 #define M_MIN     0xfa
 29 #define M_HOUR    0xfb
 30 #define M_DAY     0xfc
 31 #define M_DATE    0xfd
 32 #define M_MONTH   0xfe
 33 #define M_YEAR    0xff
 34 
 35 #define C_WRITE   0x80
 36 #define C_READ    0x40
 37 #define C_SIGN    0x20
 38 #define C_CALIB   0x1f
 39 
 40 int sun3x_hwclk(int set, struct rtc_time *t)
 41 {
 42         volatile struct mostek_dt *h =
 43                 (struct mostek_dt *)(SUN3X_EEPROM+M_CONTROL);
 44         unsigned long flags;
 45 
 46         local_irq_save(flags);
 47 
 48         if(set) {
 49                 h->csr |= C_WRITE;
 50                 h->sec = bin2bcd(t->tm_sec);
 51                 h->min = bin2bcd(t->tm_min);
 52                 h->hour = bin2bcd(t->tm_hour);
 53                 h->wday = bin2bcd(t->tm_wday);
 54                 h->mday = bin2bcd(t->tm_mday);
 55                 h->month = bin2bcd(t->tm_mon + 1);
 56                 h->year = bin2bcd(t->tm_year % 100);
 57                 h->csr &= ~C_WRITE;
 58         } else {
 59                 h->csr |= C_READ;
 60                 t->tm_sec = bcd2bin(h->sec);
 61                 t->tm_min = bcd2bin(h->min);
 62                 t->tm_hour = bcd2bin(h->hour);
 63                 t->tm_wday = bcd2bin(h->wday);
 64                 t->tm_mday = bcd2bin(h->mday);
 65                 t->tm_mon = bcd2bin(h->month) - 1;
 66                 t->tm_year = bcd2bin(h->year);
 67                 h->csr &= ~C_READ;
 68                 if (t->tm_year < 70)
 69                         t->tm_year += 100;
 70         }
 71 
 72         local_irq_restore(flags);
 73 
 74         return 0;
 75 }
 76 
 77 #if 0
 78 static irqreturn_t sun3x_timer_tick(int irq, void *dev_id)
 79 {
 80         unsigned long flags;
 81 
 82         local_irq_save(flags);
 83         /* Clear the pending interrupt - pulse the enable line low */
 84         disable_irq(5);
 85         enable_irq(5);
 86         legacy_timer_tick(1);
 87         local_irq_restore(flags);
 88 
 89         return IRQ_HANDLED;
 90 }
 91 #endif
 92 
 93 void __init sun3x_sched_init(void)
 94 {
 95 
 96         sun3_disable_interrupts();
 97 
 98 
 99     /* Pulse enable low to get the clock started */
100         sun3_disable_irq(5);
101         sun3_enable_irq(5);
102         sun3_enable_interrupts();
103 }
104 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php