ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / m68knommu / platform / 68EZ328 / config.c
1 /*
2  *  linux/arch/$(ARCH)/platform/$(PLATFORM)/config.c
3  *
4  *  Copyright (C) 1993 Hamish Macdonald
5  *  Copyright (C) 1999 D. Jeff Dionne
6  *
7  * This file is subject to the terms and conditions of the GNU General Public
8  * License.  See the file COPYING in the main directory of this archive
9  * for more details.
10  */
11
12 #include <stdarg.h>
13 #include <linux/config.h>
14 #include <linux/types.h>
15 #include <linux/kernel.h>
16 #include <linux/mm.h>
17 #include <linux/tty.h>
18 #include <linux/console.h>
19
20 #include <asm/setup.h>
21 #include <asm/system.h>
22 #include <asm/pgtable.h>
23 #include <asm/irq.h>
24 #include <asm/machdep.h>
25 #include <asm/MC68EZ328.h>
26 #ifdef CONFIG_UCSIMM
27 #include <asm/bootstd.h>
28 #endif
29 #ifdef CONFIG_PILOT
30 #include "PalmV/romfs.h"
31 #endif
32
33 void BSP_sched_init(void (*timer_routine)(int, void *, struct pt_regs *))
34 {
35   /* Restart mode, Enable int, 32KHz, Enable timer */
36   TCTL = TCTL_OM | TCTL_IRQEN | TCTL_CLKSOURCE_32KHZ | TCTL_TEN;
37   /* Set prescaler (Divide 32KHz by 32)*/
38   TPRER = 31;
39   /* Set compare register  32Khz / 32 / 10 = 100 */
40   TCMP = 10;                                                              
41
42   request_irq(TMR_IRQ_NUM, timer_routine, IRQ_FLG_LOCK, "timer", NULL);
43 }
44
45 void BSP_tick(void)
46 {
47         /* Reset Timer1 */
48         TSTAT &= 0;
49 }
50
51 unsigned long BSP_gettimeoffset (void)
52 {
53   return 0;
54 }
55
56 void BSP_gettod (int *yearp, int *monp, int *dayp,
57                    int *hourp, int *minp, int *secp)
58 {
59 }
60
61 int BSP_hwclk(int op, struct hwclk_time *t)
62 {
63   if (!op) {
64     /* read */
65   } else {
66     /* write */
67   }
68   return 0;
69 }
70
71 int BSP_set_clock_mmss (unsigned long nowtime)
72 {
73 #if 0
74   short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
75
76   tod->second1 = real_seconds / 10;
77   tod->second2 = real_seconds % 10;
78   tod->minute1 = real_minutes / 10;
79   tod->minute2 = real_minutes % 10;
80 #endif
81   return 0;
82 }
83
84 void BSP_reset (void)
85 {
86   local_irq_disable();
87   asm volatile ("
88     moveal #0x10c00000, %a0;
89     moveb #0, 0xFFFFF300;
90     moveal 0(%a0), %sp;
91     moveal 4(%a0), %a0;
92     jmp (%a0);
93     ");
94 }
95
96 unsigned char *cs8900a_hwaddr;
97 static int errno;
98
99 #ifdef CONFIG_UCSIMM
100 _bsc0(char *, getserialnum)
101 _bsc1(unsigned char *, gethwaddr, int, a)
102 _bsc1(char *, getbenv, char *, a)
103 #endif
104
105 void config_BSP(char *command, int len)
106 {
107   unsigned char *p;
108
109   printk(KERN_INFO "\n68EZ328 DragonBallEZ support (C) 1999 Rt-Control, Inc\n");
110
111 #ifdef CONFIG_UCSIMM
112   printk(KERN_INFO "uCsimm serial string [%s]\n",getserialnum());
113   p = cs8900a_hwaddr = gethwaddr(0);
114   printk(KERN_INFO "uCsimm hwaddr %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
115          p[0], p[1], p[2], p[3], p[4], p[5]);
116
117   p = getbenv("APPEND");
118   if (p) strcpy(p,command);
119   else command[0] = 0;
120 #endif
121  
122   mach_sched_init      = BSP_sched_init;
123   mach_tick            = BSP_tick;
124   mach_gettimeoffset   = BSP_gettimeoffset;
125   mach_gettod          = BSP_gettod;
126   mach_hwclk           = NULL;
127   mach_set_clock_mmss  = NULL;
128   mach_reset           = BSP_reset;
129 }