Greg Ungerer | 8c2b58c | 2005-09-09 09:32:14 +1000 | [diff] [blame] | 1 | /***************************************************************************/ |
| 2 | |
| 3 | /* |
| 4 | * linux/arch/m68knommu/platform/68VZ328/config.c |
| 5 | * |
| 6 | * Copyright (C) 1993 Hamish Macdonald |
| 7 | * Copyright (C) 1999 D. Jeff Dionne |
| 8 | * Copyright (C) 2001 Georges Menie, Ken Desmet |
| 9 | * |
| 10 | * This file is subject to the terms and conditions of the GNU General Public |
| 11 | * License. See the file COPYING in the main directory of this archive |
| 12 | * for more details. |
| 13 | */ |
| 14 | |
| 15 | /***************************************************************************/ |
| 16 | |
Greg Ungerer | 8c2b58c | 2005-09-09 09:32:14 +1000 | [diff] [blame] | 17 | #include <linux/types.h> |
| 18 | #include <linux/kernel.h> |
Greg Ungerer | 8c2b58c | 2005-09-09 09:32:14 +1000 | [diff] [blame] | 19 | #include <linux/kd.h> |
| 20 | #include <linux/netdevice.h> |
Greg Ungerer | 1ea9acc | 2007-03-07 11:28:13 +1000 | [diff] [blame] | 21 | #include <linux/interrupt.h> |
Greg Ungerer | 65fde4c | 2007-10-24 12:03:32 +1000 | [diff] [blame] | 22 | #include <linux/irq.h> |
Greg Ungerer | 8c2b58c | 2005-09-09 09:32:14 +1000 | [diff] [blame] | 23 | |
Greg Ungerer | 8c2b58c | 2005-09-09 09:32:14 +1000 | [diff] [blame] | 24 | #include <asm/system.h> |
| 25 | #include <asm/pgtable.h> |
Greg Ungerer | 8c2b58c | 2005-09-09 09:32:14 +1000 | [diff] [blame] | 26 | #include <asm/machdep.h> |
| 27 | #include <asm/MC68VZ328.h> |
| 28 | #include <asm/bootstd.h> |
| 29 | |
| 30 | #ifdef CONFIG_INIT_LCD |
| 31 | #include "bootlogo.h" |
| 32 | #endif |
| 33 | |
| 34 | /***************************************************************************/ |
| 35 | |
Greg Ungerer | 8c2b58c | 2005-09-09 09:32:14 +1000 | [diff] [blame] | 36 | void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec); |
| 37 | |
| 38 | /***************************************************************************/ |
| 39 | /* Init Drangon Engine hardware */ |
| 40 | /***************************************************************************/ |
| 41 | #if defined(CONFIG_DRAGEN2) |
| 42 | |
| 43 | static void m68vz328_reset(void) |
| 44 | { |
| 45 | local_irq_disable(); |
| 46 | |
| 47 | #ifdef CONFIG_INIT_LCD |
| 48 | PBDATA |= 0x20; /* disable CCFL light */ |
| 49 | PKDATA |= 0x4; /* disable LCD controller */ |
| 50 | LCKCON = 0; |
| 51 | #endif |
| 52 | |
| 53 | __asm__ __volatile__( |
| 54 | "reset\n\t" |
| 55 | "moveal #0x04000000, %a0\n\t" |
| 56 | "moveal 0(%a0), %sp\n\t" |
| 57 | "moveal 4(%a0), %a0\n\t" |
| 58 | "jmp (%a0)" |
| 59 | ); |
| 60 | } |
| 61 | |
| 62 | static void init_hardware(char *command, int size) |
| 63 | { |
| 64 | #ifdef CONFIG_DIRECT_IO_ACCESS |
| 65 | SCR = 0x10; /* allow user access to internal registers */ |
| 66 | #endif |
| 67 | |
| 68 | /* CSGB Init */ |
| 69 | CSGBB = 0x4000; |
| 70 | CSB = 0x1a1; |
| 71 | |
| 72 | /* CS8900 init */ |
| 73 | /* PK3: hardware sleep function pin, active low */ |
| 74 | PKSEL |= PK(3); /* select pin as I/O */ |
| 75 | PKDIR |= PK(3); /* select pin as output */ |
| 76 | PKDATA |= PK(3); /* set pin high */ |
| 77 | |
| 78 | /* PF5: hardware reset function pin, active high */ |
| 79 | PFSEL |= PF(5); /* select pin as I/O */ |
| 80 | PFDIR |= PF(5); /* select pin as output */ |
| 81 | PFDATA &= ~PF(5); /* set pin low */ |
| 82 | |
| 83 | /* cs8900 hardware reset */ |
| 84 | PFDATA |= PF(5); |
| 85 | { int i; for (i = 0; i < 32000; ++i); } |
| 86 | PFDATA &= ~PF(5); |
| 87 | |
| 88 | /* INT1 enable (cs8900 IRQ) */ |
| 89 | PDPOL &= ~PD(1); /* active high signal */ |
| 90 | PDIQEG &= ~PD(1); |
| 91 | PDIRQEN |= PD(1); /* IRQ enabled */ |
| 92 | |
| 93 | #ifdef CONFIG_68328_SERIAL_UART2 |
| 94 | /* Enable RXD TXD port bits to enable UART2 */ |
| 95 | PJSEL &= ~(PJ(5) | PJ(4)); |
| 96 | #endif |
| 97 | |
| 98 | #ifdef CONFIG_INIT_LCD |
| 99 | /* initialize LCD controller */ |
| 100 | LSSA = (long) screen_bits; |
| 101 | LVPW = 0x14; |
| 102 | LXMAX = 0x140; |
| 103 | LYMAX = 0xef; |
| 104 | LRRA = 0; |
| 105 | LPXCD = 3; |
| 106 | LPICF = 0x08; |
| 107 | LPOLCF = 0; |
| 108 | LCKCON = 0x80; |
| 109 | PCPDEN = 0xff; |
| 110 | PCSEL = 0; |
| 111 | |
| 112 | /* Enable LCD controller */ |
| 113 | PKDIR |= 0x4; |
| 114 | PKSEL |= 0x4; |
| 115 | PKDATA &= ~0x4; |
| 116 | |
| 117 | /* Enable CCFL backlighting circuit */ |
| 118 | PBDIR |= 0x20; |
| 119 | PBSEL |= 0x20; |
| 120 | PBDATA &= ~0x20; |
| 121 | |
| 122 | /* contrast control register */ |
| 123 | PFDIR |= 0x1; |
| 124 | PFSEL &= ~0x1; |
| 125 | PWMR = 0x037F; |
| 126 | #endif |
| 127 | } |
| 128 | |
| 129 | /***************************************************************************/ |
| 130 | /* Init RT-Control uCdimm hardware */ |
| 131 | /***************************************************************************/ |
| 132 | #elif defined(CONFIG_UCDIMM) |
| 133 | |
| 134 | static void m68vz328_reset(void) |
| 135 | { |
| 136 | local_irq_disable(); |
Greg Ungerer | 69614fc | 2006-06-28 16:21:56 +1000 | [diff] [blame] | 137 | asm volatile ( |
| 138 | "moveal #0x10c00000, %a0;\n\t" |
| 139 | "moveb #0, 0xFFFFF300;\n\t" |
| 140 | "moveal 0(%a0), %sp;\n\t" |
| 141 | "moveal 4(%a0), %a0;\n\t" |
| 142 | "jmp (%a0);\n" |
| 143 | ); |
Greg Ungerer | 8c2b58c | 2005-09-09 09:32:14 +1000 | [diff] [blame] | 144 | } |
| 145 | |
| 146 | unsigned char *cs8900a_hwaddr; |
| 147 | static int errno; |
| 148 | |
| 149 | _bsc0(char *, getserialnum) |
| 150 | _bsc1(unsigned char *, gethwaddr, int, a) |
| 151 | _bsc1(char *, getbenv, char *, a) |
| 152 | |
| 153 | static void init_hardware(char *command, int size) |
| 154 | { |
| 155 | char *p; |
| 156 | |
| 157 | printk(KERN_INFO "uCdimm serial string [%s]\n", getserialnum()); |
| 158 | p = cs8900a_hwaddr = gethwaddr(0); |
| 159 | printk(KERN_INFO "uCdimm hwaddr %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n", |
| 160 | p[0], p[1], p[2], p[3], p[4], p[5]); |
| 161 | p = getbenv("APPEND"); |
| 162 | if (p) |
| 163 | strcpy(p, command); |
| 164 | else |
| 165 | command[0] = 0; |
| 166 | } |
| 167 | |
| 168 | /***************************************************************************/ |
| 169 | #else |
| 170 | |
| 171 | static void m68vz328_reset(void) |
| 172 | { |
| 173 | } |
| 174 | |
| 175 | static void init_hardware(char *command, int size) |
| 176 | { |
| 177 | } |
| 178 | |
| 179 | /***************************************************************************/ |
| 180 | #endif |
| 181 | /***************************************************************************/ |
| 182 | |
| 183 | void config_BSP(char *command, int size) |
| 184 | { |
| 185 | printk(KERN_INFO "68VZ328 DragonBallVZ support (c) 2001 Lineo, Inc.\n"); |
| 186 | |
Greg Ungerer | 8c2b58c | 2005-09-09 09:32:14 +1000 | [diff] [blame] | 187 | init_hardware(command, size); |
| 188 | |
Greg Ungerer | 8c2b58c | 2005-09-09 09:32:14 +1000 | [diff] [blame] | 189 | mach_gettod = m68328_timer_gettod; |
| 190 | mach_reset = m68vz328_reset; |
| 191 | } |
| 192 | |
| 193 | /***************************************************************************/ |