aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/xmon/start.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-01-15 01:30:44 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-15 01:30:44 -0500
commita7fdd90bc43e3e9cb08bc1b13650024d419b89e5 (patch)
tree5c99a41b9d157186668ed63c001f72a09965143b /arch/ppc/xmon/start.c
parente8625d463560198cff7cb3eb22886c47d728d501 (diff)
[PATCH] ppc: Remove powermac support from ARCH=ppc
This makes it possible to build kernels for PReP and/or CHRP with ARCH=ppc by removing the (non-building) powermac support. It's now also possible to select PReP and CHRP independently. Powermac users should now build with ARCH=powerpc instead of ARCH=ppc. (This does mean that it is no longer possible to build a 32-bit kernel for a G5.) Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc/xmon/start.c')
-rw-r--r--arch/ppc/xmon/start.c161
1 files changed, 13 insertions, 148 deletions
diff --git a/arch/ppc/xmon/start.c b/arch/ppc/xmon/start.c
index c80177f8ec04..4344cbe9b5c5 100644
--- a/arch/ppc/xmon/start.c
+++ b/arch/ppc/xmon/start.c
@@ -18,7 +18,6 @@
18#include <asm/bootx.h> 18#include <asm/bootx.h>
19#include <asm/machdep.h> 19#include <asm/machdep.h>
20#include <asm/errno.h> 20#include <asm/errno.h>
21#include <asm/pmac_feature.h>
22#include <asm/processor.h> 21#include <asm/processor.h>
23#include <asm/delay.h> 22#include <asm/delay.h>
24#include <asm/btext.h> 23#include <asm/btext.h>
@@ -27,11 +26,9 @@ static volatile unsigned char *sccc, *sccd;
27unsigned int TXRDY, RXRDY, DLAB; 26unsigned int TXRDY, RXRDY, DLAB;
28static int xmon_expect(const char *str, unsigned int timeout); 27static int xmon_expect(const char *str, unsigned int timeout);
29 28
30static int use_serial;
31static int use_screen; 29static int use_screen;
32static int via_modem; 30static int via_modem;
33static int xmon_use_sccb; 31static int xmon_use_sccb;
34static struct device_node *channel_node;
35 32
36#define TB_SPEED 25000000 33#define TB_SPEED 25000000
37 34
@@ -112,96 +109,21 @@ xmon_map_scc(void)
112#ifdef CONFIG_PPC_MULTIPLATFORM 109#ifdef CONFIG_PPC_MULTIPLATFORM
113 volatile unsigned char *base; 110 volatile unsigned char *base;
114 111
115 if (_machine == _MACH_Pmac) {
116 struct device_node *np;
117 unsigned long addr;
118#ifdef CONFIG_BOOTX_TEXT
119 if (!use_screen && !use_serial
120 && !machine_is_compatible("iMac")) {
121 /* see if there is a keyboard in the device tree
122 with a parent of type "adb" */
123 for (np = find_devices("keyboard"); np; np = np->next)
124 if (np->parent && np->parent->type
125 && strcmp(np->parent->type, "adb") == 0)
126 break;
127
128 /* needs to be hacked if xmon_printk is to be used
129 from within find_via_pmu() */
130#ifdef CONFIG_ADB_PMU
131 if (np != NULL && boot_text_mapped && find_via_pmu())
132 use_screen = 1;
133#endif
134#ifdef CONFIG_ADB_CUDA
135 if (np != NULL && boot_text_mapped && find_via_cuda())
136 use_screen = 1;
137#endif
138 }
139 if (!use_screen && (np = find_devices("escc")) != NULL) {
140 /*
141 * look for the device node for the serial port
142 * we're using and see if it says it has a modem
143 */
144 char *name = xmon_use_sccb? "ch-b": "ch-a";
145 char *slots;
146 int l;
147
148 np = np->child;
149 while (np != NULL && strcmp(np->name, name) != 0)
150 np = np->sibling;
151 if (np != NULL) {
152 /* XXX should parse this properly */
153 channel_node = np;
154 slots = get_property(np, "slot-names", &l);
155 if (slots != NULL && l >= 10
156 && strcmp(slots+4, "Modem") == 0)
157 via_modem = 1;
158 }
159 }
160 btext_drawstring("xmon uses ");
161 if (use_screen)
162 btext_drawstring("screen and keyboard\n");
163 else {
164 if (via_modem)
165 btext_drawstring("modem on ");
166 btext_drawstring(xmon_use_sccb? "printer": "modem");
167 btext_drawstring(" port\n");
168 }
169
170#endif /* CONFIG_BOOTX_TEXT */
171
172#ifdef CHRP_ESCC
173 addr = 0xc1013020;
174#else
175 addr = 0xf3013020;
176#endif
177 TXRDY = 4;
178 RXRDY = 1;
179
180 np = find_devices("mac-io");
181 if (np && np->n_addrs)
182 addr = np->addrs[0].address + 0x13020;
183 base = (volatile unsigned char *) ioremap(addr & PAGE_MASK, PAGE_SIZE);
184 sccc = base + (addr & ~PAGE_MASK);
185 sccd = sccc + 0x10;
186
187 }
188#ifdef CONFIG_PPC_CHRP 112#ifdef CONFIG_PPC_CHRP
189 else { 113 base = (volatile unsigned char *) isa_io_base;
190 base = (volatile unsigned char *) isa_io_base; 114 if (_machine == _MACH_chrp)
191 if (_machine == _MACH_chrp) 115 base = (volatile unsigned char *)
192 base = (volatile unsigned char *) 116 ioremap(chrp_find_phys_io_base(), 0x1000);
193 ioremap(chrp_find_phys_io_base(), 0x1000); 117
194 118 sccc = base + 0x3fd;
195 sccc = base + 0x3fd; 119 sccd = base + 0x3f8;
196 sccd = base + 0x3f8; 120 if (xmon_use_sccb) {
197 if (xmon_use_sccb) { 121 sccc -= 0x100;
198 sccc -= 0x100; 122 sccd -= 0x100;
199 sccd -= 0x100;
200 }
201 TXRDY = 0x20;
202 RXRDY = 1;
203 DLAB = 0x80;
204 } 123 }
124 TXRDY = 0x20;
125 RXRDY = 1;
126 DLAB = 0x80;
205#endif /* CONFIG_PPC_CHRP */ 127#endif /* CONFIG_PPC_CHRP */
206#elif defined(CONFIG_GEMINI) 128#elif defined(CONFIG_GEMINI)
207 /* should already be mapped by the kernel boot */ 129 /* should already be mapped by the kernel boot */
@@ -385,16 +307,6 @@ xmon_read_poll(void)
385 return *sccd; 307 return *sccd;
386} 308}
387 309
388static unsigned char scc_inittab[] = {
389 13, 0, /* set baud rate divisor */
390 12, 1,
391 14, 1, /* baud rate gen enable, src=rtxc */
392 11, 0x50, /* clocks = br gen */
393 5, 0xea, /* tx 8 bits, assert DTR & RTS */
394 4, 0x46, /* x16 clock, 1 stop */
395 3, 0xc1, /* rx enable, 8 bits */
396};
397
398void 310void
399xmon_init_scc(void) 311xmon_init_scc(void)
400{ 312{
@@ -407,43 +319,6 @@ xmon_init_scc(void)
407 sccd[3] = 3; eieio(); /* LCR = 8N1 */ 319 sccd[3] = 3; eieio(); /* LCR = 8N1 */
408 sccd[1] = 0; eieio(); /* IER = 0 */ 320 sccd[1] = 0; eieio(); /* IER = 0 */
409 } 321 }
410 else if ( _machine == _MACH_Pmac )
411 {
412 int i, x;
413
414 if (channel_node != 0)
415 pmac_call_feature(
416 PMAC_FTR_SCC_ENABLE,
417 channel_node,
418 PMAC_SCC_ASYNC | PMAC_SCC_FLAG_XMON, 1);
419 printk(KERN_INFO "Serial port locked ON by debugger !\n");
420 if (via_modem && channel_node != 0) {
421 unsigned int t0;
422
423 pmac_call_feature(
424 PMAC_FTR_MODEM_ENABLE,
425 channel_node, 0, 1);
426 printk(KERN_INFO "Modem powered up by debugger !\n");
427 t0 = readtb();
428 while (readtb() - t0 < 3*TB_SPEED)
429 eieio();
430 }
431 /* use the B channel if requested */
432 if (xmon_use_sccb) {
433 sccc = (volatile unsigned char *)
434 ((unsigned long)sccc & ~0x20);
435 sccd = sccc + 0x10;
436 }
437 for (i = 20000; i != 0; --i) {
438 x = *sccc; eieio();
439 }
440 *sccc = 9; eieio(); /* reset A or B side */
441 *sccc = ((unsigned long)sccc & 0x20)? 0x80: 0x40; eieio();
442 for (i = 0; i < sizeof(scc_inittab); ++i) {
443 *sccc = scc_inittab[i];
444 eieio();
445 }
446 }
447 scc_initialized = 1; 322 scc_initialized = 1;
448 if (via_modem) { 323 if (via_modem) {
449 for (;;) { 324 for (;;) {
@@ -632,19 +507,9 @@ xmon_fgets(char *str, int nb, void *f)
632void 507void
633xmon_enter(void) 508xmon_enter(void)
634{ 509{
635#ifdef CONFIG_ADB_PMU
636 if (_machine == _MACH_Pmac) {
637 pmu_suspend();
638 }
639#endif
640} 510}
641 511
642void 512void
643xmon_leave(void) 513xmon_leave(void)
644{ 514{
645#ifdef CONFIG_ADB_PMU
646 if (_machine == _MACH_Pmac) {
647 pmu_resume();
648 }
649#endif
650} 515}