m68k/mac: Disentangle VIA and OSS initialization

macintosh_config->via_type is meaningless on Mac IIfx (i.e. the only
model with OSS chip), so skip the via_type switch statement.

Call oss_init() before via_init() because it is more important and
because that is the right place to initialize the oss_present flag.

On this model, bringing forward oss_init() and delaying via_init()
is no problem because those functions are independent.

The only requirement here is that oss_register_interrupts() happens
after via_init(). That is, mac_init_IRQ() happens after config_mac().

Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
Finn Thain 2017-10-26 22:45:24 -04:00 committed by Geert Uytterhoeven
parent 0e37a23ebd
commit 7a0bb44270
3 changed files with 18 additions and 24 deletions

View File

@ -898,8 +898,8 @@ static void __init mac_identify(void)
mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize); mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
iop_init(); iop_init();
via_init();
oss_init(); oss_init();
via_init();
psc_init(); psc_init();
baboon_init(); baboon_init();

View File

@ -31,18 +31,18 @@ volatile struct mac_oss *oss;
/* /*
* Initialize the OSS * Initialize the OSS
*
* The OSS "detection" code is actually in via_init() which is always called
* before us. Thus we can count on oss_present being valid on entry.
*/ */
void __init oss_init(void) void __init oss_init(void)
{ {
int i; int i;
if (!oss_present) return; if (macintosh_config->ident != MAC_MODEL_IIFX)
return;
oss = (struct mac_oss *) OSS_BASE; oss = (struct mac_oss *) OSS_BASE;
pr_debug("OSS detected at %p", oss);
oss_present = 1;
/* Disable all interrupts. Unlike a VIA it looks like we */ /* Disable all interrupts. Unlike a VIA it looks like we */
/* do this by setting the source's interrupt level to zero. */ /* do this by setting the source's interrupt level to zero. */

View File

@ -113,10 +113,6 @@ void via_debug_dump(void);
* First we figure out where they actually _are_ as well as what type of * First we figure out where they actually _are_ as well as what type of
* VIA we have for VIA2 (it could be a real VIA or an RBV or even an OSS.) * VIA we have for VIA2 (it could be a real VIA or an RBV or even an OSS.)
* Then we pretty much clear them out and disable all IRQ sources. * Then we pretty much clear them out and disable all IRQ sources.
*
* Note: the OSS is actually "detected" here and not in oss_init(). It just
* seems more logical to do it here since via_init() needs to know
* these things anyways.
*/ */
void __init via_init(void) void __init via_init(void)
@ -124,21 +120,18 @@ void __init via_init(void)
via1 = (void *)VIA1_BASE; via1 = (void *)VIA1_BASE;
pr_debug("VIA1 detected at %p\n", via1); pr_debug("VIA1 detected at %p\n", via1);
if (oss_present) {
via2 = NULL;
rbv_present = 0;
} else {
switch (macintosh_config->via_type) { switch (macintosh_config->via_type) {
/* IIci, IIsi, IIvx, IIvi (P6xx), LC series */ /* IIci, IIsi, IIvx, IIvi (P6xx), LC series */
case MAC_VIA_IICI: case MAC_VIA_IICI:
if (macintosh_config->ident == MAC_MODEL_IIFX) {
via2 = NULL;
rbv_present = 0;
oss_present = 1;
} else {
via2 = (void *)RBV_BASE; via2 = (void *)RBV_BASE;
pr_debug("VIA2 (RBV) detected at %p\n", via2); pr_debug("VIA2 (RBV) detected at %p\n", via2);
rbv_present = 1; rbv_present = 1;
oss_present = 0;
}
if (macintosh_config->ident == MAC_MODEL_LCIII) { if (macintosh_config->ident == MAC_MODEL_LCIII) {
rbv_clear = 0x00; rbv_clear = 0x00;
} else { } else {
@ -160,16 +153,17 @@ void __init via_init(void)
via2 = (void *) VIA2_BASE; via2 = (void *) VIA2_BASE;
pr_debug("VIA2 detected at %p\n", via2); pr_debug("VIA2 detected at %p\n", via2);
rbv_present = 0; rbv_present = 0;
oss_present = 0;
rbv_clear = 0x00; rbv_clear = 0x00;
gIER = vIER; gIER = vIER;
gIFR = vIFR; gIFR = vIFR;
gBufA = vBufA; gBufA = vBufA;
gBufB = vBufB; gBufB = vBufB;
break; break;
default: default:
panic("UNKNOWN VIA TYPE"); panic("UNKNOWN VIA TYPE");
} }
}
#ifdef DEBUG_VIA #ifdef DEBUG_VIA
via_debug_dump(); via_debug_dump();
@ -295,9 +289,9 @@ void via_debug_dump(void)
(uint) via1[vDirA], (uint) via1[vDirB], (uint) via1[vACR]); (uint) via1[vDirA], (uint) via1[vDirB], (uint) via1[vACR]);
printk(KERN_DEBUG " PCR = 0x%02X IFR = 0x%02X IER = 0x%02X\n", printk(KERN_DEBUG " PCR = 0x%02X IFR = 0x%02X IER = 0x%02X\n",
(uint) via1[vPCR], (uint) via1[vIFR], (uint) via1[vIER]); (uint) via1[vPCR], (uint) via1[vIFR], (uint) via1[vIER]);
if (oss_present) { if (!via2)
printk(KERN_DEBUG "VIA2: <OSS>\n"); return;
} else if (rbv_present) { if (rbv_present) {
printk(KERN_DEBUG "VIA2: IFR = 0x%02X IER = 0x%02X\n", printk(KERN_DEBUG "VIA2: IFR = 0x%02X IER = 0x%02X\n",
(uint) via2[rIFR], (uint) via2[rIER]); (uint) via2[rIFR], (uint) via2[rIER]);
printk(KERN_DEBUG " SIFR = 0x%02X SIER = 0x%02X\n", printk(KERN_DEBUG " SIFR = 0x%02X SIER = 0x%02X\n",