]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
m68k/mac: Disentangle VIA and OSS initialization
authorFinn Thain <fthain@telegraphics.com.au>
Fri, 27 Oct 2017 02:45:24 +0000 (22:45 -0400)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Thu, 9 Nov 2017 22:02:56 +0000 (23:02 +0100)
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>
arch/m68k/mac/config.c
arch/m68k/mac/oss.c
arch/m68k/mac/via.c

index 22123f7e8f750c4c16fb456952810af9e777e415..16cd5cea52076d95908b790419a4344483411618 100644 (file)
@@ -898,8 +898,8 @@ static void __init mac_identify(void)
                mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
 
        iop_init();
-       via_init();
        oss_init();
+       via_init();
        psc_init();
        baboon_init();
 
index ca84dcf41fc971dd5518b2f67bf6b56e2cce8f62..61906eb67d0f4979e99d1fc043a76ae771b96557 100644 (file)
@@ -31,18 +31,18 @@ volatile struct mac_oss *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)
 {
        int i;
 
-       if (!oss_present) return;
+       if (macintosh_config->ident != MAC_MODEL_IIFX)
+               return;
 
        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    */
        /* do this by setting the source's interrupt level to zero. */
index 05021381af0b94457e21e30f54285e212b6593ed..19ad46ba4787e61096d447a7722caffbeb171365 100644 (file)
@@ -113,10 +113,6 @@ void via_debug_dump(void);
  * 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.)
  * 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)
@@ -124,21 +120,18 @@ void __init via_init(void)
        via1 = (void *)VIA1_BASE;
        pr_debug("VIA1 detected at %p\n", via1);
 
-       switch(macintosh_config->via_type) {
+       if (oss_present) {
+               via2 = NULL;
+               rbv_present = 0;
+       } else {
+               switch (macintosh_config->via_type) {
 
                /* IIci, IIsi, IIvx, IIvi (P6xx), LC series */
 
                case MAC_VIA_IICI:
-                       if (macintosh_config->ident == MAC_MODEL_IIFX) {
-                               via2 = NULL;
-                               rbv_present = 0;
-                               oss_present = 1;
-                       } else {
-                               via2 = (void *) RBV_BASE;
-                               pr_debug("VIA2 (RBV) detected at %p\n", via2);
-                               rbv_present = 1;
-                               oss_present = 0;
-                       }
+                       via2 = (void *)RBV_BASE;
+                       pr_debug("VIA2 (RBV) detected at %p\n", via2);
+                       rbv_present = 1;
                        if (macintosh_config->ident == MAC_MODEL_LCIII) {
                                rbv_clear = 0x00;
                        } else {
@@ -160,15 +153,16 @@ void __init via_init(void)
                        via2 = (void *) VIA2_BASE;
                        pr_debug("VIA2 detected at %p\n", via2);
                        rbv_present = 0;
-                       oss_present = 0;
                        rbv_clear = 0x00;
                        gIER = vIER;
                        gIFR = vIFR;
                        gBufA = vBufA;
                        gBufB = vBufB;
                        break;
+
                default:
                        panic("UNKNOWN VIA TYPE");
+               }
        }
 
 #ifdef DEBUG_VIA
@@ -295,9 +289,9 @@ void via_debug_dump(void)
                (uint) via1[vDirA], (uint) via1[vDirB], (uint) via1[vACR]);
        printk(KERN_DEBUG "         PCR = 0x%02X  IFR = 0x%02X IER = 0x%02X\n",
                (uint) via1[vPCR], (uint) via1[vIFR], (uint) via1[vIER]);
-       if (oss_present) {
-               printk(KERN_DEBUG "VIA2: <OSS>\n");
-       } else if (rbv_present) {
+       if (!via2)
+               return;
+       if (rbv_present) {
                printk(KERN_DEBUG "VIA2:  IFR = 0x%02X  IER = 0x%02X\n",
                        (uint) via2[rIFR], (uint) via2[rIER]);
                printk(KERN_DEBUG "      SIFR = 0x%02X SIER = 0x%02X\n",