Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* $Id: setup.c,v 1.1.2.4 2002/03/02 21:57:07 lethal Exp $ |
| 2 | * |
| 3 | * linux/arch/sh/boards/se/770x/setup.c |
| 4 | * |
| 5 | * Copyright (C) 2000 Kazumoto Kojima |
| 6 | * |
| 7 | * Hitachi SolutionEngine Support. |
| 8 | * |
| 9 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #include <linux/init.h> |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 11 | #include <asm/machvec.h> |
Paul Mundt | 711fa80 | 2006-10-03 13:14:04 +0900 | [diff] [blame^] | 12 | #include <asm/se.h> |
| 13 | #include <asm/io.h> |
| 14 | #include <asm/smc37c93x.h> |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 15 | |
| 16 | void heartbeat_se(void); |
| 17 | void init_se_IRQ(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | |
| 19 | /* |
| 20 | * Configure the Super I/O chip |
| 21 | */ |
| 22 | static void __init smsc_config(int index, int data) |
| 23 | { |
| 24 | outb_p(index, INDEX_PORT); |
| 25 | outb_p(data, DATA_PORT); |
| 26 | } |
| 27 | |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 28 | /* XXX: Another candidate for a more generic cchip machine vector */ |
| 29 | static void __init smsc_setup(char **cmdline_p) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | { |
| 31 | outb_p(CONFIG_ENTER, CONFIG_PORT); |
| 32 | outb_p(CONFIG_ENTER, CONFIG_PORT); |
| 33 | |
| 34 | /* FDC */ |
| 35 | smsc_config(CURRENT_LDN_INDEX, LDN_FDC); |
| 36 | smsc_config(ACTIVATE_INDEX, 0x01); |
| 37 | smsc_config(IRQ_SELECT_INDEX, 6); /* IRQ6 */ |
| 38 | |
| 39 | /* IDE1 */ |
| 40 | smsc_config(CURRENT_LDN_INDEX, LDN_IDE1); |
| 41 | smsc_config(ACTIVATE_INDEX, 0x01); |
| 42 | smsc_config(IRQ_SELECT_INDEX, 14); /* IRQ14 */ |
| 43 | |
| 44 | /* AUXIO (GPIO): to use IDE1 */ |
| 45 | smsc_config(CURRENT_LDN_INDEX, LDN_AUXIO); |
| 46 | smsc_config(GPIO46_INDEX, 0x00); /* nIOROP */ |
| 47 | smsc_config(GPIO47_INDEX, 0x00); /* nIOWOP */ |
| 48 | |
| 49 | /* COM1 */ |
| 50 | smsc_config(CURRENT_LDN_INDEX, LDN_COM1); |
| 51 | smsc_config(ACTIVATE_INDEX, 0x01); |
| 52 | smsc_config(IO_BASE_HI_INDEX, 0x03); |
| 53 | smsc_config(IO_BASE_LO_INDEX, 0xf8); |
| 54 | smsc_config(IRQ_SELECT_INDEX, 4); /* IRQ4 */ |
| 55 | |
| 56 | /* COM2 */ |
| 57 | smsc_config(CURRENT_LDN_INDEX, LDN_COM2); |
| 58 | smsc_config(ACTIVATE_INDEX, 0x01); |
| 59 | smsc_config(IO_BASE_HI_INDEX, 0x02); |
| 60 | smsc_config(IO_BASE_LO_INDEX, 0xf8); |
| 61 | smsc_config(IRQ_SELECT_INDEX, 3); /* IRQ3 */ |
| 62 | |
| 63 | /* RTC */ |
| 64 | smsc_config(CURRENT_LDN_INDEX, LDN_RTC); |
| 65 | smsc_config(ACTIVATE_INDEX, 0x01); |
| 66 | smsc_config(IRQ_SELECT_INDEX, 8); /* IRQ8 */ |
| 67 | |
| 68 | /* XXX: PARPORT, KBD, and MOUSE will come here... */ |
| 69 | outb_p(CONFIG_EXIT, CONFIG_PORT); |
| 70 | } |
| 71 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | /* |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 73 | * The Machine Vector |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | */ |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 75 | struct sh_machine_vector mv_se __initmv = { |
| 76 | .mv_name = "SolutionEngine", |
| 77 | .mv_setup = smsc_setup, |
| 78 | #if defined(CONFIG_CPU_SH4) |
| 79 | .mv_nr_irqs = 48, |
| 80 | #elif defined(CONFIG_CPU_SUBTYPE_SH7708) |
| 81 | .mv_nr_irqs = 32, |
| 82 | #elif defined(CONFIG_CPU_SUBTYPE_SH7709) |
| 83 | .mv_nr_irqs = 61, |
| 84 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) |
| 85 | .mv_nr_irqs = 86, |
| 86 | #endif |
| 87 | |
| 88 | .mv_inb = se_inb, |
| 89 | .mv_inw = se_inw, |
| 90 | .mv_inl = se_inl, |
| 91 | .mv_outb = se_outb, |
| 92 | .mv_outw = se_outw, |
| 93 | .mv_outl = se_outl, |
| 94 | |
| 95 | .mv_inb_p = se_inb_p, |
| 96 | .mv_inw_p = se_inw, |
| 97 | .mv_inl_p = se_inl, |
| 98 | .mv_outb_p = se_outb_p, |
| 99 | .mv_outw_p = se_outw, |
| 100 | .mv_outl_p = se_outl, |
| 101 | |
| 102 | .mv_insb = se_insb, |
| 103 | .mv_insw = se_insw, |
| 104 | .mv_insl = se_insl, |
| 105 | .mv_outsb = se_outsb, |
| 106 | .mv_outsw = se_outsw, |
| 107 | .mv_outsl = se_outsl, |
| 108 | |
| 109 | .mv_init_irq = init_se_IRQ, |
| 110 | #ifdef CONFIG_HEARTBEAT |
| 111 | .mv_heartbeat = heartbeat_se, |
| 112 | #endif |
| 113 | }; |
| 114 | ALIAS_MV(se) |