Linux-2.6.12-rc2
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / m68knommu / platform / 68VZ328 / ucdimm / config.c
1 /*
2 * linux/arch/m68knommu/platform/68VZ328/ucdimm/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/MC68VZ328.h>
26 #include <asm/bootstd.h>
27
28 void BSP_sched_init(void (*timer_routine)(int, void *, struct pt_regs *))
29 {
30 /* Restart mode, Enable int, 32KHz, Enable timer */
31 TCTL = TCTL_OM | TCTL_IRQEN | TCTL_CLKSOURCE_32KHZ | TCTL_TEN;
32 /* Set prescaler (Divide 32KHz by 32)*/
33 TPRER = 31;
34 /* Set compare register 32Khz / 32 / 10 = 100 */
35 TCMP = 10;
36
37 request_irq(TMR_IRQ_NUM, timer_routine, IRQ_FLG_LOCK, "timer", NULL);
38 }
39
40 void BSP_tick(void)
41 {
42 /* Reset Timer1 */
43 TSTAT &= 0;
44 }
45
46 unsigned long BSP_gettimeoffset (void)
47 {
48 return 0;
49 }
50
51 void BSP_gettod (int *yearp, int *monp, int *dayp,
52 int *hourp, int *minp, int *secp)
53 {
54 }
55
56 int BSP_hwclk(int op, struct hwclk_time *t)
57 {
58 if (!op) {
59 /* read */
60 } else {
61 /* write */
62 }
63 return 0;
64 }
65
66 int BSP_set_clock_mmss (unsigned long nowtime)
67 {
68 #if 0
69 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
70
71 tod->second1 = real_seconds / 10;
72 tod->second2 = real_seconds % 10;
73 tod->minute1 = real_minutes / 10;
74 tod->minute2 = real_minutes % 10;
75 #endif
76 return 0;
77 }
78
79 void BSP_reset (void)
80 {
81 local_irq_disable();
82 asm volatile ("
83 moveal #0x10c00000, %a0;
84 moveb #0, 0xFFFFF300;
85 moveal 0(%a0), %sp;
86 moveal 4(%a0), %a0;
87 jmp (%a0);
88 ");
89 }
90
91 unsigned char *cs8900a_hwaddr;
92 static int errno;
93
94 _bsc0(char *, getserialnum)
95 _bsc1(unsigned char *, gethwaddr, int, a)
96 _bsc1(char *, getbenv, char *, a)
97
98 void config_BSP(char *command, int len)
99 {
100 unsigned char *p;
101
102 printk(KERN_INFO "\n68VZ328 DragonBallVZ support (c) 2001 Lineo, Inc.\n");
103
104 printk(KERN_INFO "uCdimm serial string [%s]\n",getserialnum());
105 p = cs8900a_hwaddr = gethwaddr(0);
106 printk(KERN_INFO "uCdimm hwaddr %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
107 p[0], p[1], p[2], p[3], p[4], p[5]);
108 p = getbenv("APPEND");
109 if (p) strcpy(p,command);
110 else command[0] = 0;
111
112 mach_sched_init = BSP_sched_init;
113 mach_tick = BSP_tick;
114 mach_gettimeoffset = BSP_gettimeoffset;
115 mach_gettod = BSP_gettod;
116 mach_reset = BSP_reset;
117 }