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