Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / arch / m68k / mac / config.c
index e6666a3..1c16b1b 100644 (file)
@@ -23,6 +23,8 @@
 #include <linux/init.h>
 #include <linux/vt_kern.h>
 #include <linux/platform_device.h>
+#include <linux/adb.h>
+#include <linux/cuda.h>
 
 #define BOOTINFO_COMPAT_1_0
 #include <asm/setup.h>
@@ -146,7 +148,7 @@ static void mac_cache_card_flush(int writeback)
 void __init config_mac(void)
 {
        if (!MACH_IS_MAC)
-               printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n");
+               printk(KERN_ERR "ERROR: no Mac, but config_mac() called!!\n");
 
        mach_sched_init = mac_sched_init;
        mach_init_IRQ = mac_init_IRQ;
@@ -792,6 +794,32 @@ static struct mac_model mac_data_table[] = {
        }
 };
 
+static struct resource scc_a_rsrcs[] = {
+       { .flags = IORESOURCE_MEM },
+       { .flags = IORESOURCE_IRQ },
+};
+
+static struct resource scc_b_rsrcs[] = {
+       { .flags = IORESOURCE_MEM },
+       { .flags = IORESOURCE_IRQ },
+};
+
+struct platform_device scc_a_pdev = {
+       .name           = "scc",
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(scc_a_rsrcs),
+       .resource       = scc_a_rsrcs,
+};
+EXPORT_SYMBOL(scc_a_pdev);
+
+struct platform_device scc_b_pdev = {
+       .name           = "scc",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(scc_b_rsrcs),
+       .resource       = scc_b_rsrcs,
+};
+EXPORT_SYMBOL(scc_b_pdev);
+
 static void __init mac_identify(void)
 {
        struct mac_model *m;
@@ -814,6 +842,24 @@ static void __init mac_identify(void)
                }
        }
 
+       /* Set up serial port resources for the console initcall. */
+
+       scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2;
+       scc_a_rsrcs[0].end   = scc_a_rsrcs[0].start;
+       scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase;
+       scc_b_rsrcs[0].end   = scc_b_rsrcs[0].start;
+
+       switch (macintosh_config->scc_type) {
+       case MAC_SCC_PSC:
+               scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
+               scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
+               break;
+       default:
+               scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
+               scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
+               break;
+       }
+
        /*
         * We need to pre-init the IOPs, if any. Otherwise
         * the serial console won't work if the user had
@@ -821,7 +867,7 @@ static void __init mac_identify(void)
         */
        iop_preinit();
 
-       printk(KERN_INFO "Detected Macintosh model: %d \n", model);
+       printk(KERN_INFO "Detected Macintosh model: %d\n", model);
 
        /*
         * Report booter data:
@@ -832,12 +878,12 @@ static void __init mac_identify(void)
                mac_bi_data.videoaddr, mac_bi_data.videorow,
                mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
                mac_bi_data.dimensions >> 16);
-       printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n",
+       printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
                mac_bi_data.videological, mac_orig_videoaddr,
                mac_bi_data.sccbase);
-       printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n",
+       printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
                mac_bi_data.boottime, mac_bi_data.gmtbias);
-       printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n",
+       printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
                mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
 
        iop_init();
@@ -845,6 +891,10 @@ static void __init mac_identify(void)
        oss_init();
        psc_init();
        baboon_init();
+
+#ifdef CONFIG_ADB_CUDA
+       find_via_cuda();
+#endif
 }
 
 static void __init mac_report_hardware(void)
@@ -867,10 +917,37 @@ static struct platform_device swim_pdev = {
        .resource       = &swim_rsrc,
 };
 
+static struct platform_device esp_0_pdev = {
+       .name           = "mac_esp",
+       .id             = 0,
+};
+
+static struct platform_device esp_1_pdev = {
+       .name           = "mac_esp",
+       .id             = 1,
+};
+
+static struct platform_device sonic_pdev = {
+       .name           = "macsonic",
+       .id             = -1,
+};
+
+static struct platform_device mace_pdev = {
+       .name           = "macmace",
+       .id             = -1,
+};
+
 int __init mac_platform_init(void)
 {
        u8 *swim_base;
 
+       /*
+        * Serial devices
+        */
+
+       platform_device_register(&scc_a_pdev);
+       platform_device_register(&scc_b_pdev);
+
        /*
         * Floppy device
         */
@@ -893,6 +970,36 @@ int __init mac_platform_init(void)
                platform_device_register(&swim_pdev);
        }
 
+       /*
+        * SCSI device(s)
+        */
+
+       switch (macintosh_config->scsi_type) {
+       case MAC_SCSI_QUADRA:
+       case MAC_SCSI_QUADRA3:
+               platform_device_register(&esp_0_pdev);
+               break;
+       case MAC_SCSI_QUADRA2:
+               platform_device_register(&esp_0_pdev);
+               if ((macintosh_config->ident == MAC_MODEL_Q900) ||
+                   (macintosh_config->ident == MAC_MODEL_Q950))
+                       platform_device_register(&esp_1_pdev);
+               break;
+       }
+
+       /*
+        * Ethernet device
+        */
+
+       switch (macintosh_config->ether_type) {
+       case MAC_ETHER_SONIC:
+               platform_device_register(&sonic_pdev);
+               break;
+       case MAC_ETHER_MACE:
+               platform_device_register(&mace_pdev);
+               break;
+       }
+
        return 0;
 }