diff options
author | Dave Kleikamp <shaggy@austin.ibm.com> | 2006-01-24 14:34:47 -0600 |
---|---|---|
committer | Dave Kleikamp <shaggy@austin.ibm.com> | 2006-01-24 14:34:47 -0600 |
commit | 0a0fc0ddbe732779366ab6b1b879f62195e65967 (patch) | |
tree | 7b42490a676cf39ae0691b6859ecf7fd410f229b /arch/m68k/mac | |
parent | 4d5dbd0945d9e0833dd7964a3d6ee33157f7cc7a (diff) | |
parent | 3ee68c4af3fd7228c1be63254b9f884614f9ebb2 (diff) |
Merge with /home/shaggy/git/linus-clean/
Diffstat (limited to 'arch/m68k/mac')
-rw-r--r-- | arch/m68k/mac/config.c | 3 | ||||
-rw-r--r-- | arch/m68k/mac/iop.c | 4 | ||||
-rw-r--r-- | arch/m68k/mac/misc.c | 326 |
3 files changed, 222 insertions, 111 deletions
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index cd19cbb213e..14f8d3f4e19 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c @@ -212,9 +212,6 @@ void __init config_mac(void) mach_reset = mac_reset; mach_halt = mac_poweroff; mach_power_off = mac_poweroff; -#ifdef CONFIG_DUMMY_CONSOLE - conswitchp = &dummy_con; -#endif mach_max_dma_address = 0xffffffff; #if 0 mach_debug_init = mac_debug_init; diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c index d889ba80ccd..9179a379840 100644 --- a/arch/m68k/mac/iop.c +++ b/arch/m68k/mac/iop.c @@ -293,8 +293,8 @@ void __init iop_init(void) } for (i = 0 ; i < NUM_IOP_CHAN ; i++) { - iop_send_queue[IOP_NUM_SCC][i] = 0; - iop_send_queue[IOP_NUM_ISM][i] = 0; + iop_send_queue[IOP_NUM_SCC][i] = NULL; + iop_send_queue[IOP_NUM_ISM][i] = NULL; iop_listeners[IOP_NUM_SCC][i].devname = NULL; iop_listeners[IOP_NUM_SCC][i].handler = NULL; iop_listeners[IOP_NUM_ISM][i].devname = NULL; diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c index 5b80d7cd954..bbb0c3b95e9 100644 --- a/arch/m68k/mac/misc.c +++ b/arch/m68k/mac/misc.c @@ -39,72 +39,163 @@ extern struct mac_booter_data mac_bi_data; static void (*rom_reset)(void); -#ifdef CONFIG_ADB -/* - * Return the current time as the number of seconds since January 1, 1904. - */ - -static long adb_read_time(void) +#ifdef CONFIG_ADB_CUDA +static long cuda_read_time(void) { - volatile struct adb_request req; + struct adb_request req; long time; - adb_request((struct adb_request *) &req, NULL, - ADBREQ_RAW|ADBREQ_SYNC, - 2, CUDA_PACKET, CUDA_GET_TIME); + if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME) < 0) + return 0; + while (!req.complete) + cuda_poll(); time = (req.reply[3] << 24) | (req.reply[4] << 16) | (req.reply[5] << 8) | req.reply[6]; return time - RTC_OFFSET; } -/* - * Set the current system time - */ +static void cuda_write_time(long data) +{ + struct adb_request req; + data += RTC_OFFSET; + if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME, + (data >> 24) & 0xFF, (data >> 16) & 0xFF, + (data >> 8) & 0xFF, data & 0xFF) < 0) + return; + while (!req.complete) + cuda_poll(); +} -static void adb_write_time(long data) +static __u8 cuda_read_pram(int offset) { - volatile struct adb_request req; + struct adb_request req; + if (cuda_request(&req, NULL, 4, CUDA_PACKET, CUDA_GET_PRAM, + (offset >> 8) & 0xFF, offset & 0xFF) < 0) + return 0; + while (!req.complete) + cuda_poll(); + return req.reply[3]; +} - data += RTC_OFFSET; +static void cuda_write_pram(int offset, __u8 data) +{ + struct adb_request req; + if (cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_SET_PRAM, + (offset >> 8) & 0xFF, offset & 0xFF, data) < 0) + return; + while (!req.complete) + cuda_poll(); +} +#else +#define cuda_read_time() 0 +#define cuda_write_time(n) +#define cuda_read_pram NULL +#define cuda_write_pram NULL +#endif + +#ifdef CONFIG_ADB_PMU68K +static long pmu_read_time(void) +{ + struct adb_request req; + long time; + + if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0) + return 0; + while (!req.complete) + pmu_poll(); - adb_request((struct adb_request *) &req, NULL, - ADBREQ_RAW|ADBREQ_SYNC, - 6, CUDA_PACKET, CUDA_SET_TIME, + time = (req.reply[0] << 24) | (req.reply[1] << 16) + | (req.reply[2] << 8) | req.reply[3]; + return time - RTC_OFFSET; +} + +static void pmu_write_time(long data) +{ + struct adb_request req; + data += RTC_OFFSET; + if (pmu_request(&req, NULL, 5, PMU_SET_RTC, (data >> 24) & 0xFF, (data >> 16) & 0xFF, - (data >> 8) & 0xFF, data & 0xFF); + (data >> 8) & 0xFF, data & 0xFF) < 0) + return; + while (!req.complete) + pmu_poll(); } -/* - * Get a byte from the NVRAM - */ +static __u8 pmu_read_pram(int offset) +{ + struct adb_request req; + if (pmu_request(&req, NULL, 3, PMU_READ_NVRAM, + (offset >> 8) & 0xFF, offset & 0xFF) < 0) + return 0; + while (!req.complete) + pmu_poll(); + return req.reply[3]; +} -static __u8 adb_read_pram(int offset) +static void pmu_write_pram(int offset, __u8 data) { - volatile struct adb_request req; + struct adb_request req; + if (pmu_request(&req, NULL, 4, PMU_WRITE_NVRAM, + (offset >> 8) & 0xFF, offset & 0xFF, data) < 0) + return; + while (!req.complete) + pmu_poll(); +} +#else +#define pmu_read_time() 0 +#define pmu_write_time(n) +#define pmu_read_pram NULL +#define pmu_write_pram NULL +#endif - adb_request((struct adb_request *) &req, NULL, - ADBREQ_RAW|ADBREQ_SYNC, - 4, CUDA_PACKET, CUDA_GET_PRAM, - (offset >> 8) & 0xFF, offset & 0xFF); - return req.reply[3]; +#ifdef CONFIG_ADB_MACIISI +extern int maciisi_request(struct adb_request *req, + void (*done)(struct adb_request *), int nbytes, ...); + +static long maciisi_read_time(void) +{ + struct adb_request req; + long time; + + if (maciisi_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME)) + return 0; + + time = (req.reply[3] << 24) | (req.reply[4] << 16) + | (req.reply[5] << 8) | req.reply[6]; + return time - RTC_OFFSET; } -/* - * Write a byte to the NVRAM - */ +static void maciisi_write_time(long data) +{ + struct adb_request req; + data += RTC_OFFSET; + maciisi_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME, + (data >> 24) & 0xFF, (data >> 16) & 0xFF, + (data >> 8) & 0xFF, data & 0xFF); +} -static void adb_write_pram(int offset, __u8 data) +static __u8 maciisi_read_pram(int offset) { - volatile struct adb_request req; + struct adb_request req; + if (maciisi_request(&req, NULL, 4, CUDA_PACKET, CUDA_GET_PRAM, + (offset >> 8) & 0xFF, offset & 0xFF)) + return 0; + return req.reply[3]; +} - adb_request((struct adb_request *) &req, NULL, - ADBREQ_RAW|ADBREQ_SYNC, - 5, CUDA_PACKET, CUDA_SET_PRAM, - (offset >> 8) & 0xFF, offset & 0xFF, - data); +static void maciisi_write_pram(int offset, __u8 data) +{ + struct adb_request req; + maciisi_request(&req, NULL, 5, CUDA_PACKET, CUDA_SET_PRAM, + (offset >> 8) & 0xFF, offset & 0xFF, data); } -#endif /* CONFIG_ADB */ +#else +#define maciisi_read_time() 0 +#define maciisi_write_time(n) +#define maciisi_read_pram NULL +#define maciisi_write_pram NULL +#endif /* * VIA PRAM/RTC access routines @@ -305,42 +396,55 @@ static void oss_shutdown(void) static void cuda_restart(void) { - adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC, - 2, CUDA_PACKET, CUDA_RESET_SYSTEM); + struct adb_request req; + if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM) < 0) + return; + while (!req.complete) + cuda_poll(); } static void cuda_shutdown(void) { - adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC, - 2, CUDA_PACKET, CUDA_POWERDOWN); + struct adb_request req; + if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_POWERDOWN) < 0) + return; + while (!req.complete) + cuda_poll(); } #endif /* CONFIG_ADB_CUDA */ -#ifdef CONFIG_ADB_PMU +#ifdef CONFIG_ADB_PMU68K void pmu_restart(void) { - adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC, - 3, PMU_PACKET, PMU_SET_INTR_MASK, - PMU_INT_ADB|PMU_INT_TICK); - - adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC, - 2, PMU_PACKET, PMU_RESET); + struct adb_request req; + if (pmu_request(&req, NULL, + 2, PMU_SET_INTR_MASK, PMU_INT_ADB|PMU_INT_TICK) < 0) + return; + while (!req.complete) + pmu_poll(); + if (pmu_request(&req, NULL, 1, PMU_RESET) < 0) + return; + while (!req.complete) + pmu_poll(); } void pmu_shutdown(void) { - adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC, - 3, PMU_PACKET, PMU_SET_INTR_MASK, - PMU_INT_ADB|PMU_INT_TICK); - - adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC, - 6, PMU_PACKET, PMU_SHUTDOWN, - 'M', 'A', 'T', 'T'); + struct adb_request req; + if (pmu_request(&req, NULL, + 2, PMU_SET_INTR_MASK, PMU_INT_ADB|PMU_INT_TICK) < 0) + return; + while (!req.complete) + pmu_poll(); + if (pmu_request(&req, NULL, 5, PMU_SHUTDOWN, 'M', 'A', 'T', 'T') < 0) + return; + while (!req.complete) + pmu_poll(); } -#endif /* CONFIG_ADB_PMU */ +#endif /* *------------------------------------------------------------------- @@ -351,21 +455,22 @@ void pmu_shutdown(void) void mac_pram_read(int offset, __u8 *buffer, int len) { - __u8 (*func)(int) = NULL; + __u8 (*func)(int); int i; - if (macintosh_config->adb_type == MAC_ADB_IISI || - macintosh_config->adb_type == MAC_ADB_PB1 || - macintosh_config->adb_type == MAC_ADB_PB2 || - macintosh_config->adb_type == MAC_ADB_CUDA) { -#ifdef CONFIG_ADB - func = adb_read_pram; -#else - return; -#endif - } else { + switch(macintosh_config->adb_type) { + case MAC_ADB_IISI: + func = maciisi_read_pram; break; + case MAC_ADB_PB1: + case MAC_ADB_PB2: + func = pmu_read_pram; break; + case MAC_ADB_CUDA: + func = cuda_read_pram; break; + default: func = via_read_pram; } + if (!func) + return; for (i = 0 ; i < len ; i++) { buffer[i] = (*func)(offset++); } @@ -373,21 +478,22 @@ void mac_pram_read(int offset, __u8 *buffer, int len) void mac_pram_write(int offset, __u8 *buffer, int len) { - void (*func)(int, __u8) = NULL; + void (*func)(int, __u8); int i; - if (macintosh_config->adb_type == MAC_ADB_IISI || - macintosh_config->adb_type == MAC_ADB_PB1 || - macintosh_config->adb_type == MAC_ADB_PB2 || - macintosh_config->adb_type == MAC_ADB_CUDA) { -#ifdef CONFIG_ADB - func = adb_write_pram; -#else - return; -#endif - } else { + switch(macintosh_config->adb_type) { + case MAC_ADB_IISI: + func = maciisi_write_pram; break; + case MAC_ADB_PB1: + case MAC_ADB_PB2: + func = pmu_write_pram; break; + case MAC_ADB_CUDA: + func = cuda_write_pram; break; + default: func = via_write_pram; } + if (!func) + return; for (i = 0 ; i < len ; i++) { (*func)(offset++, buffer[i]); } @@ -408,7 +514,7 @@ void mac_poweroff(void) } else if (macintosh_config->adb_type == MAC_ADB_CUDA) { cuda_shutdown(); #endif -#ifdef CONFIG_ADB_PMU +#ifdef CONFIG_ADB_PMU68K } else if (macintosh_config->adb_type == MAC_ADB_PB1 || macintosh_config->adb_type == MAC_ADB_PB2) { pmu_shutdown(); @@ -448,7 +554,7 @@ void mac_reset(void) } else if (macintosh_config->adb_type == MAC_ADB_CUDA) { cuda_restart(); #endif -#ifdef CONFIG_ADB_PMU +#ifdef CONFIG_ADB_PMU68K } else if (macintosh_config->adb_type == MAC_ADB_PB1 || macintosh_config->adb_type == MAC_ADB_PB2) { pmu_restart(); @@ -466,12 +572,13 @@ void mac_reset(void) /* make a 1-to-1 mapping, using the transparent tran. reg. */ unsigned long virt = (unsigned long) mac_reset; unsigned long phys = virt_to_phys(mac_reset); + unsigned long addr = (phys&0xFF000000)|0x8777; unsigned long offset = phys-virt; local_irq_disable(); /* lets not screw this up, ok? */ __asm__ __volatile__(".chip 68030\n\t" "pmove %0,%/tt0\n\t" ".chip 68k" - : : "m" ((phys&0xFF000000)|0x8777)); + : : "m" (addr)); /* Now jump to physical address so we can disable MMU */ __asm__ __volatile__( ".chip 68030\n\t" @@ -588,20 +695,22 @@ int mac_hwclk(int op, struct rtc_time *t) unsigned long now; if (!op) { /* read */ - if (macintosh_config->adb_type == MAC_ADB_II) { + switch (macintosh_config->adb_type) { + case MAC_ADB_II: + case MAC_ADB_IOP: now = via_read_time(); - } else -#ifdef CONFIG_ADB - if ((macintosh_config->adb_type == MAC_ADB_IISI) || - (macintosh_config->adb_type == MAC_ADB_PB1) || - (macintosh_config->adb_type == MAC_ADB_PB2) || - (macintosh_config->adb_type == MAC_ADB_CUDA)) { - now = adb_read_time(); - } else -#endif - if (macintosh_config->adb_type == MAC_ADB_IOP) { - now = via_read_time(); - } else { + break; + case MAC_ADB_IISI: + now = maciisi_read_time(); + break; + case MAC_ADB_PB1: + case MAC_ADB_PB2: + now = pmu_read_time(); + break; + case MAC_ADB_CUDA: + now = cuda_read_time(); + break; + default: now = 0; } @@ -619,15 +728,20 @@ int mac_hwclk(int op, struct rtc_time *t) now = mktime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); - if (macintosh_config->adb_type == MAC_ADB_II) { - via_write_time(now); - } else if ((macintosh_config->adb_type == MAC_ADB_IISI) || - (macintosh_config->adb_type == MAC_ADB_PB1) || - (macintosh_config->adb_type == MAC_ADB_PB2) || - (macintosh_config->adb_type == MAC_ADB_CUDA)) { - adb_write_time(now); - } else if (macintosh_config->adb_type == MAC_ADB_IOP) { + switch (macintosh_config->adb_type) { + case MAC_ADB_II: + case MAC_ADB_IOP: via_write_time(now); + break; + case MAC_ADB_CUDA: + cuda_write_time(now); + break; + case MAC_ADB_PB1: + case MAC_ADB_PB2: + pmu_write_time(now); + break; + case MAC_ADB_IISI: + maciisi_write_time(now); } #endif } |