Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/sh/boards/cat68701/setup.c |
| 3 | * |
| 4 | * Copyright (C) 2000 Niibe Yutaka |
| 5 | * 2001 Yutaro Ebihara |
| 6 | * |
| 7 | * Setup routines for A-ONE Corp CAT-68701 SH7708 Board |
| 8 | * |
| 9 | * This file is subject to the terms and conditions of the GNU General Public |
| 10 | * License. See the file "COPYING" in the main directory of this archive |
| 11 | * for more details. |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #include <asm/io.h> |
| 16 | #include <asm/machvec.h> |
| 17 | #include <asm/mach/io.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <linux/module.h> |
| 19 | #include <linux/init.h> |
| 20 | #include <linux/sched.h> |
| 21 | |
| 22 | const char *get_system_type(void) |
| 23 | { |
| 24 | return "CAT-68701"; |
| 25 | } |
| 26 | |
| 27 | #ifdef CONFIG_HEARTBEAT |
| 28 | void heartbeat_cat68701() |
| 29 | { |
| 30 | static unsigned int cnt = 0, period = 0 , bit = 0; |
| 31 | cnt += 1; |
| 32 | if (cnt < period) { |
| 33 | return; |
| 34 | } |
| 35 | cnt = 0; |
| 36 | |
| 37 | /* Go through the points (roughly!): |
| 38 | * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110 |
| 39 | */ |
| 40 | period = 110 - ( (300<<FSHIFT)/ |
| 41 | ((avenrun[0]/5) + (3<<FSHIFT)) ); |
| 42 | |
| 43 | if(bit){ bit=0; }else{ bit=1; } |
| 44 | outw(bit<<15,0x3fe); |
| 45 | } |
| 46 | #endif /* CONFIG_HEARTBEAT */ |
| 47 | |
| 48 | unsigned long cat68701_isa_port2addr(unsigned long offset) |
| 49 | { |
| 50 | /* CompactFlash (IDE) */ |
| 51 | if (((offset >= 0x1f0) && (offset <= 0x1f7)) || (offset==0x3f6)) |
| 52 | return 0xba000000 + offset; |
| 53 | |
| 54 | /* INPUT PORT */ |
| 55 | if ((offset >= 0x3fc) && (offset <= 0x3fd)) |
| 56 | return 0xb4007000 + offset; |
| 57 | |
| 58 | /* OUTPUT PORT */ |
| 59 | if ((offset >= 0x3fe) && (offset <= 0x3ff)) |
| 60 | return 0xb4007400 + offset; |
| 61 | |
| 62 | return offset + 0xb4000000; /* other I/O (EREA 5)*/ |
| 63 | } |
| 64 | |
| 65 | /* |
| 66 | * The Machine Vector |
| 67 | */ |
| 68 | |
| 69 | struct sh_machine_vector mv_cat68701 __initmv = { |
| 70 | .mv_nr_irqs = 32, |
| 71 | .mv_isa_port2addr = cat68701_isa_port2addr, |
| 72 | .mv_irq_demux = cat68701_irq_demux, |
| 73 | |
| 74 | .mv_init_irq = init_cat68701_IRQ, |
| 75 | #ifdef CONFIG_HEARTBEAT |
| 76 | .mv_heartbeat = heartbeat_cat68701, |
| 77 | #endif |
| 78 | }; |
| 79 | ALIAS_MV(cat68701) |
| 80 | |
| 81 | int __init platform_setup(void) |
| 82 | { |
| 83 | /* dummy read erea5 (CS8900A) */ |
| 84 | } |
| 85 | |