2 * linux/arch/m68knommu/platform/MC68VZ328/de2/config.c
4 * Copyright (C) 1993 Hamish Macdonald
5 * Copyright (C) 1999 D. Jeff Dionne
6 * Copyright (C) 2001 Georges Menie, Ken Desmet
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file COPYING in the main directory of this archive
13 #include <linux/config.h>
14 #include <linux/types.h>
15 #include <linux/kernel.h>
17 #include <linux/tty.h>
18 #include <linux/console.h>
20 #include <linux/netdevice.h>
22 #include <asm/setup.h>
23 #include <asm/system.h>
24 #include <asm/pgtable.h>
26 #include <asm/machdep.h>
27 #include <asm/MC68VZ328.h>
29 #ifdef CONFIG_INIT_LCD
33 /* with a 33.16 MHz clock, this will give usec resolution to the time functions */
34 #define CLOCK_SOURCE TCTL_CLKSOURCE_SYSCLK
36 #define TICKS_PER_JIFFY 41450
39 dragen2_sched_init(irqreturn_t (*timer_routine) (int, void *, struct pt_regs *))
45 if (request_irq(TMR_IRQ_NUM, timer_routine, IRQ_FLG_LOCK, "timer", NULL))
46 panic("Unable to attach timer interrupt\n");
48 /* Restart mode, Enable int, Set clock source */
49 TCTL = TCTL_OM | TCTL_IRQEN | CLOCK_SOURCE;
51 TCMP = TICKS_PER_JIFFY;
57 static void dragen2_tick(void)
63 static unsigned long dragen2_gettimeoffset(void)
65 unsigned long ticks = TCN, offset = 0;
67 /* check for pending interrupt */
68 if (ticks < (TICKS_PER_JIFFY >> 1) && (ISR & (1 << TMR_IRQ_NUM)))
69 offset = 1000000 / HZ;
71 ticks = (ticks * 1000000 / HZ) / TICKS_PER_JIFFY;
73 return ticks + offset;
76 static void dragen2_gettod(int *year, int *mon, int *day, int *hour,
81 *year = *mon = *day = 1;
82 *hour = (now >> 24) % 24;
83 *min = (now >> 16) % 60;
87 static void dragen2_reset(void)
91 #ifdef CONFIG_INIT_LCD
92 PBDATA |= 0x20; /* disable CCFL light */
93 PKDATA |= 0x4; /* disable LCD controller */
99 "moveal #0x04000000, %a0\n\t"
100 "moveal 0(%a0), %sp\n\t"
101 "moveal 4(%a0), %a0\n\t"
106 static void init_hardware(void)
108 #ifdef CONFIG_DIRECT_IO_ACCESS
109 SCR = 0x10; /* allow user access to internal registers */
117 /* PK3: hardware sleep function pin, active low */
118 PKSEL |= PK(3); /* select pin as I/O */
119 PKDIR |= PK(3); /* select pin as output */
120 PKDATA |= PK(3); /* set pin high */
122 /* PF5: hardware reset function pin, active high */
123 PFSEL |= PF(5); /* select pin as I/O */
124 PFDIR |= PF(5); /* select pin as output */
125 PFDATA &= ~PF(5); /* set pin low */
127 /* cs8900 hardware reset */
129 { int i; for (i = 0; i < 32000; ++i); }
132 /* INT1 enable (cs8900 IRQ) */
133 PDPOL &= ~PD(1); /* active high signal */
135 PDIRQEN |= PD(1); /* IRQ enabled */
137 #ifdef CONFIG_68328_SERIAL_UART2
138 /* Enable RXD TXD port bits to enable UART2 */
139 PJSEL &= ~(PJ(5) | PJ(4));
142 #ifdef CONFIG_INIT_LCD
143 /* initialize LCD controller */
144 LSSA = (long) screen_bits;
156 /* Enable LCD controller */
161 /* Enable CCFL backlighting circuit */
166 /* contrast control register */
173 void config_BSP(char *command, int size)
175 printk(KERN_INFO "68VZ328 DragonBallVZ support (c) 2001 Lineo, Inc.\n");
177 #if defined(CONFIG_BOOTPARAM)
178 strncpy(command, CONFIG_BOOTPARAM_STRING, size);
181 memset(command, 0, size);
186 mach_sched_init = (void *)dragen2_sched_init;
187 mach_tick = dragen2_tick;
188 mach_gettimeoffset = dragen2_gettimeoffset;
189 mach_reset = dragen2_reset;
190 mach_gettod = dragen2_gettod;