summaryrefslogtreecommitdiffstats
path: root/arch/m68k/apollo
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-03-17 22:05:47 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-03-17 22:05:47 +0000
commit27cfca1ec98e91261b1a5355d10a8996464b63af (patch)
tree8e895a53e372fa682b4c0a585b9377d67ed70d0e /arch/m68k/apollo
parent6a76fb7214c477ccf6582bd79c5b4ccc4f9c41b1 (diff)
Look Ma' what I found on my harddisk ...
o New faster syscalls for 2.1.x, too o Upgrade to 2.1.89. Don't try to run this. It's flaky as hell. But feel free to debug ...
Diffstat (limited to 'arch/m68k/apollo')
-rw-r--r--arch/m68k/apollo/Makefile14
-rw-r--r--arch/m68k/apollo/config.c245
-rw-r--r--arch/m68k/apollo/dn_debug.c23
-rw-r--r--arch/m68k/apollo/dn_ints.c166
4 files changed, 448 insertions, 0 deletions
diff --git a/arch/m68k/apollo/Makefile b/arch/m68k/apollo/Makefile
new file mode 100644
index 000000000..530be849c
--- /dev/null
+++ b/arch/m68k/apollo/Makefile
@@ -0,0 +1,14 @@
+#
+# Makefile for Linux arch/m68k/amiga source directory
+#
+# Note! Dependencies are done automagically by 'make dep', which also
+# removes any old dependencies. DON'T put your own dependencies here
+# unless it's something special (ie not a .c file).
+#
+# Note 2! The CFLAGS definitions are now in the main makefile...
+
+O_TARGET := apollo.o
+O_OBJS := config.o dn_ints.o \
+
+
+include $(TOPDIR)/Rules.make
diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c
new file mode 100644
index 000000000..2ad8f9c24
--- /dev/null
+++ b/arch/m68k/apollo/config.c
@@ -0,0 +1,245 @@
+#include <stdarg.h>
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/kd.h>
+#include <linux/tty.h>
+#include <linux/console.h>
+
+#include <asm/setup.h>
+#include <asm/system.h>
+#include <asm/pgtable.h>
+#include <asm/apollohw.h>
+#include <asm/irq.h>
+#include <asm/machdep.h>
+
+extern struct consw fb_con;
+extern void dn_sched_init(void (*handler)(int,void *,struct pt_regs *));
+extern int dn_keyb_init(void);
+extern int dn_dummy_kbdrate(struct kbd_repeat *);
+extern void dn_init_IRQ(void);
+#if 0
+extern void (*dn_default_handler[])(int,void *,struct pt_regs *);
+#endif
+extern int dn_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id);
+extern void dn_free_irq(unsigned int irq, void *dev_id);
+extern void dn_enable_irq(unsigned int);
+extern void dn_disable_irq(unsigned int);
+extern int dn_get_irq_list(char *);
+extern unsigned long dn_gettimeoffset(void);
+extern void dn_gettod(int *, int *, int *, int *, int *, int *);
+extern int dn_dummy_hwclk(int, struct hwclk_time *);
+extern int dn_dummy_set_clock_mmss(unsigned long);
+extern void dn_mksound(unsigned int count, unsigned int ticks);
+extern void dn_dummy_reset(void);
+extern void dn_dummy_waitbut(void);
+extern struct fb_info *dn_fb_init(long *);
+extern void dn_dummy_debug_init(void);
+extern void (*kd_mksound)(unsigned int, unsigned int);
+extern void dn_dummy_video_setup(char *,int *);
+extern void dn_process_int(int irq, struct pt_regs *fp);
+
+static struct console dn_console_driver;
+static void dn_debug_init(void);
+static void dn_timer_int(int irq,void *, struct pt_regs *);
+static void (*sched_timer_handler)(int, void *, struct pt_regs *)=NULL;
+
+int dn_serial_console_wait_key(void) {
+
+ while(!(sio01.srb_csrb & 1))
+ barrier();
+ return sio01.rhrb_thrb;
+}
+
+void dn_serial_console_write (const char *str,unsigned int count)
+{
+ while(count--) {
+ if (*str == '\n') {
+ sio01.rhrb_thrb = (unsigned char)'\r';
+ while (!(sio01.srb_csrb & 0x4))
+ ;
+ }
+ sio01.rhrb_thrb = (unsigned char)*str++;
+ while (!(sio01.srb_csrb & 0x4))
+ ;
+ }
+}
+
+void dn_serial_print (const char *str)
+{
+ while (*str) {
+ if (*str == '\n') {
+ sio01.rhrb_thrb = (unsigned char)'\r';
+ while (!(sio01.srb_csrb & 0x4))
+ ;
+ }
+ sio01.rhrb_thrb = (unsigned char)*str++;
+ while (!(sio01.srb_csrb & 0x4))
+ ;
+ }
+}
+
+void config_apollo(void) {
+
+ dn_serial_print("Config apollo !\n");
+#if 0
+ dn_debug_init();
+#endif
+ printk("Config apollo !\n");
+
+
+ mach_sched_init=dn_sched_init; /* */
+ mach_keyb_init=dn_keyb_init;
+ mach_kbdrate=dn_dummy_kbdrate;
+ mach_init_IRQ=dn_init_IRQ;
+ mach_default_handler=NULL;
+ mach_request_irq = dn_request_irq;
+ mach_free_irq = dn_free_irq;
+ enable_irq = dn_enable_irq;
+ disable_irq = dn_disable_irq;
+ mach_get_irq_list = dn_get_irq_list;
+ mach_gettimeoffset = dn_gettimeoffset;
+ mach_gettod = dn_gettod; /* */
+ mach_max_dma_address = 0xffffffff;
+ mach_hwclk = dn_dummy_hwclk; /* */
+ mach_set_clock_mmss = dn_dummy_set_clock_mmss; /* */
+ mach_process_int = dn_process_int;
+#ifdef CONFIG_BLK_DEV_FD
+ mach_floppy_init = dn_dummy_floppy_init;
+ mach_floppy_setup = dn_dummy_floppy_setup;
+#endif
+ mach_reset = dn_dummy_reset; /* */
+ conswitchp = &fb_con;
+#if 0
+ mach_fb_init = dn_fb_init;
+ mach_video_setup = dn_dummy_video_setup;
+#endif
+ kd_mksound = dn_mksound;
+
+}
+
+void dn_timer_int(int irq, void *dev_id, struct pt_regs *fp) {
+
+ volatile unsigned char x;
+
+ sched_timer_handler(irq,dev_id,fp);
+
+ x=*(volatile unsigned char *)(IO_BASE+0x10803);
+ x=*(volatile unsigned char *)(IO_BASE+0x10805);
+
+}
+
+void dn_sched_init(void (*timer_routine)(int, void *, struct pt_regs *)) {
+
+ dn_serial_print("dn sched_init\n");
+
+#if 0
+ /* program timer 2 */
+ *(volatile unsigned char *)(IO_BASE+0x10803)=0x00;
+ *(volatile unsigned char *)(IO_BASE+0x10809)=0;
+ *(volatile unsigned char *)(IO_BASE+0x1080b)=50;
+
+ /* program timer 3 */
+ *(volatile unsigned char *)(IO_BASE+0x10801)=0x00;
+ *(volatile unsigned char *)(IO_BASE+0x1080c)=0;
+ *(volatile unsigned char *)(IO_BASE+0x1080f)=50;
+#endif
+ /* program timer 1 */
+ *(volatile unsigned char *)(IO_BASE+0x10803)=0x01;
+ *(volatile unsigned char *)(IO_BASE+0x10801)=0x40;
+ *(volatile unsigned char *)(IO_BASE+0x10805)=0x09;
+ *(volatile unsigned char *)(IO_BASE+0x10807)=0xc4;
+
+ /* enable IRQ of PIC B */
+ *(volatile unsigned char *)(IO_BASE+PICA+1)&=(~8);
+
+
+
+ printk("*(0x10803) %02x\n",*(volatile unsigned char *)(IO_BASE+0x10803));
+ printk("*(0x10803) %02x\n",*(volatile unsigned char *)(IO_BASE+0x10803));
+
+ sched_timer_handler=timer_routine;
+ request_irq(0,dn_timer_int,0,NULL,NULL);
+
+
+}
+
+unsigned long dn_gettimeoffset(void) {
+
+ return 0xdeadbeef;
+
+}
+
+void dn_gettod(int *yearp, int *monp, int *dayp,
+ int *hourp, int *minp, int *secp) {
+
+ *yearp=rtc->year;
+ *monp=rtc->month;
+ *dayp=rtc->day_of_month;
+ *hourp=rtc->hours;
+ *minp=rtc->minute;
+ *secp=rtc->second;
+
+printk("gettod: %d %d %d %d %d %d\n",*yearp,*monp,*dayp,*hourp,*minp,*secp);
+
+}
+
+int dn_dummy_hwclk(int op, struct hwclk_time *t) {
+
+ dn_serial_print("hwclk !\n");
+
+ if(!op) { /* read */
+ t->sec=rtc->second;
+ t->min=rtc->minute;
+ t->hour=rtc->hours;
+ t->day=rtc->day_of_month;
+ t->wday=rtc->day_of_week;
+ t->mon=rtc->month;
+ t->year=rtc->year;
+ } else {
+ rtc->second=t->sec;
+ rtc->minute=t->min;
+ rtc->hours=t->hour;
+ rtc->day_of_month=t->day;
+ if(t->wday!=-1)
+ rtc->day_of_week=t->wday;
+ rtc->month=t->mon;
+ rtc->year=t->year;
+ }
+
+ dn_serial_print("hwclk end!\n");
+ return 0;
+
+}
+
+int dn_dummy_set_clock_mmss(unsigned long nowtime) {
+
+ printk("set_clock_mmss\n");
+
+ return 0;
+
+}
+
+void dn_dummy_reset(void) {
+
+ dn_serial_print("The end !\n");
+
+ for(;;);
+
+}
+
+void dn_dummy_waitbut(void) {
+
+ dn_serial_print("waitbut\n");
+
+}
+
+#if 0
+void dn_debug_init(void) {
+
+ dn_console_driver.write=dn_serial_console_write;
+ register_console(&dn_console_driver);
+
+}
+#endif
diff --git a/arch/m68k/apollo/dn_debug.c b/arch/m68k/apollo/dn_debug.c
new file mode 100644
index 000000000..cba26779a
--- /dev/null
+++ b/arch/m68k/apollo/dn_debug.c
@@ -0,0 +1,23 @@
+#include <stdarg.h>
+
+#define DN_DEBUG_BUFFER_BASE 0x82800000
+#define DN_DEBUG_BUFFER_SIZE 8*1024*1024
+
+static char *current_dbg_ptr=DN_DEBUG_BUFFER_BASE;
+
+int dn_deb_printf(const char *fmt, ...) {
+
+ va_list args;
+ int i;
+
+ if(current_dbg_ptr<(DN_DEBUG_BUFFER_BASE + DN_DEBUG_BUFFER_SIZE)) {
+ va_start(args,fmt);
+ i=vsprintf(current_dbg_ptr,fmt,args);
+ va_end(args);
+ current_dbg_ptr+=i;
+
+ return i;
+ }
+ else
+ return 0;
+}
diff --git a/arch/m68k/apollo/dn_ints.c b/arch/m68k/apollo/dn_ints.c
new file mode 100644
index 000000000..c4cffcdf9
--- /dev/null
+++ b/arch/m68k/apollo/dn_ints.c
@@ -0,0 +1,166 @@
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/kernel_stat.h>
+
+#include <asm/system.h>
+#include <asm/irq.h>
+#include <asm/traps.h>
+#include <asm/page.h>
+#include <asm/machdep.h>
+#include <asm/apollohw.h>
+
+static irq_handler_t dn_irqs[16];
+
+extern void write_keyb_cmd(u_short length, u_char *cmd);
+static char BellOnCommand[] = { 0xFF, 0x21, 0x81 },
+ BellOffCommand[] = { 0xFF, 0x21, 0x82 };
+
+void dn_process_int(int irq, struct pt_regs *fp) {
+
+#if 0
+ unsigned char x;
+#endif
+
+#if 0
+ printk("Aha DN interrupt ! : %d\n",irq);
+#endif
+
+ if(dn_irqs[irq-160].handler) {
+ dn_irqs[irq-160].handler(irq,dn_irqs[irq-160].dev_id,fp);
+ }
+ else {
+ printk("spurious irq %d occured\n",irq);
+ }
+
+#if 0
+ printk("*(0x10803) %02x\n",*(volatile unsigned char *)(IO_BASE+0x10803));
+ x=*(volatile unsigned char *)(IO_BASE+0x10805);
+#endif
+
+ *(volatile unsigned char *)(IO_BASE+0x11000)=0x20;
+ *(volatile unsigned char *)(IO_BASE+0x11100)=0x20;
+
+}
+
+void dn_init_IRQ(void) {
+
+ int i;
+
+ printk("Init IRQ\n");
+
+ for(i=0;i<16;i++) {
+ dn_irqs[i].handler=NULL;
+ dn_irqs[i].flags=IRQ_FLG_STD;
+ dn_irqs[i].dev_id=NULL;
+ dn_irqs[i].devname=NULL;
+ }
+
+}
+
+int dn_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id) {
+
+ printk("dn request IRQ\n");
+
+ if((irq<0) || (irq>15)) {
+ printk("Trying to request illegal IRQ\n");
+ return -ENXIO;
+ }
+
+ if(!dn_irqs[irq].handler) {
+ dn_irqs[irq].handler=handler;
+ dn_irqs[irq].flags=IRQ_FLG_STD;
+ dn_irqs[irq].dev_id=dev_id;
+ dn_irqs[irq].devname=devname;
+ if(irq<8)
+ *(volatile unsigned char *)(IO_BASE+PICA+1)&=~(1<<irq);
+ else
+ *(volatile unsigned char *)(IO_BASE+PICB+1)&=~(1<<(irq-8));
+ return 0;
+ }
+ else {
+ printk("Trying to request already assigned irq %d\n",irq);
+ return -ENXIO;
+ }
+
+}
+
+void dn_free_irq(unsigned int irq, void *dev_id) {
+
+ printk("dn free irq\n");
+
+ if((irq<0) || (irq>15)) {
+ printk("Trying to free illegal IRQ\n");
+ return ;
+ }
+
+ if(irq<8)
+ *(volatile unsigned char *)(IO_BASE+PICA+1)|=(1<<irq);
+ else
+ *(volatile unsigned char *)(IO_BASE+PICB+1)|=(1<<(irq-8));
+
+ dn_irqs[irq].handler=NULL;
+ dn_irqs[irq].flags=IRQ_FLG_STD;
+ dn_irqs[irq].dev_id=NULL;
+ dn_irqs[irq].devname=NULL;
+
+ return ;
+
+}
+
+void dn_enable_irq(unsigned int irq) {
+
+ printk("dn enable irq\n");
+
+}
+
+void dn_disable_irq(unsigned int irq) {
+
+ printk("dn disable irq\n");
+
+}
+
+int dn_get_irq_list(char *buf) {
+
+ printk("dn get irq list\n");
+
+ return 0;
+
+}
+
+struct fb_info *dn_dummy_fb_init(long *mem_start) {
+
+ printk("fb init\n");
+
+ return NULL;
+
+}
+
+static void dn_nosound (unsigned long ignored) {
+
+ write_keyb_cmd(sizeof(BellOffCommand),BellOffCommand);
+
+}
+
+void dn_mksound( unsigned int count, unsigned int ticks ) {
+
+ static struct timer_list sound_timer = { NULL, NULL, 0, 0,
+ dn_nosound };
+
+ del_timer( &sound_timer );
+ if(count) {
+ write_keyb_cmd(sizeof(BellOnCommand),BellOnCommand);
+ if (ticks) {
+ sound_timer.expires = jiffies + ticks;
+ add_timer( &sound_timer );
+ }
+ }
+ else
+ write_keyb_cmd(sizeof(BellOffCommand),BellOffCommand);
+}
+
+void dn_dummy_video_setup(char *options,int *ints) {
+
+ printk("no video yet\n");
+
+}