Nobuhiro Iwamatsu | aa4a5db | 2006-12-29 01:50:35 +0900 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * linux/arch/sh/boards/se/770x/setup.c |
| 3 | * |
| 4 | * Copyright (C) 2000 Kazumoto Kojima |
| 5 | * |
| 6 | * Hitachi SolutionEngine Support. |
| 7 | * |
| 8 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | #include <linux/init.h> |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 10 | #include <linux/platform_device.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 | |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 16 | void init_se_IRQ(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
| 18 | /* |
| 19 | * Configure the Super I/O chip |
| 20 | */ |
| 21 | static void __init smsc_config(int index, int data) |
| 22 | { |
| 23 | outb_p(index, INDEX_PORT); |
| 24 | outb_p(data, DATA_PORT); |
| 25 | } |
| 26 | |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 27 | /* XXX: Another candidate for a more generic cchip machine vector */ |
| 28 | static void __init smsc_setup(char **cmdline_p) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | { |
| 30 | outb_p(CONFIG_ENTER, CONFIG_PORT); |
| 31 | outb_p(CONFIG_ENTER, CONFIG_PORT); |
| 32 | |
| 33 | /* FDC */ |
| 34 | smsc_config(CURRENT_LDN_INDEX, LDN_FDC); |
| 35 | smsc_config(ACTIVATE_INDEX, 0x01); |
| 36 | smsc_config(IRQ_SELECT_INDEX, 6); /* IRQ6 */ |
| 37 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | /* AUXIO (GPIO): to use IDE1 */ |
| 39 | smsc_config(CURRENT_LDN_INDEX, LDN_AUXIO); |
| 40 | smsc_config(GPIO46_INDEX, 0x00); /* nIOROP */ |
| 41 | smsc_config(GPIO47_INDEX, 0x00); /* nIOWOP */ |
| 42 | |
| 43 | /* COM1 */ |
| 44 | smsc_config(CURRENT_LDN_INDEX, LDN_COM1); |
| 45 | smsc_config(ACTIVATE_INDEX, 0x01); |
| 46 | smsc_config(IO_BASE_HI_INDEX, 0x03); |
| 47 | smsc_config(IO_BASE_LO_INDEX, 0xf8); |
| 48 | smsc_config(IRQ_SELECT_INDEX, 4); /* IRQ4 */ |
| 49 | |
| 50 | /* COM2 */ |
| 51 | smsc_config(CURRENT_LDN_INDEX, LDN_COM2); |
| 52 | smsc_config(ACTIVATE_INDEX, 0x01); |
| 53 | smsc_config(IO_BASE_HI_INDEX, 0x02); |
| 54 | smsc_config(IO_BASE_LO_INDEX, 0xf8); |
| 55 | smsc_config(IRQ_SELECT_INDEX, 3); /* IRQ3 */ |
| 56 | |
| 57 | /* RTC */ |
| 58 | smsc_config(CURRENT_LDN_INDEX, LDN_RTC); |
| 59 | smsc_config(ACTIVATE_INDEX, 0x01); |
| 60 | smsc_config(IRQ_SELECT_INDEX, 8); /* IRQ8 */ |
| 61 | |
| 62 | /* XXX: PARPORT, KBD, and MOUSE will come here... */ |
| 63 | outb_p(CONFIG_EXIT, CONFIG_PORT); |
| 64 | } |
| 65 | |
Nobuhiro Iwamatsu | f987fc8 | 2007-03-12 15:12:27 +0900 | [diff] [blame] | 66 | |
| 67 | static struct resource cf_ide_resources[] = { |
| 68 | [0] = { |
| 69 | .start = PA_MRSHPC_IO + 0x1f0, |
| 70 | .end = PA_MRSHPC_IO + 0x1f0 + 8, |
| 71 | .flags = IORESOURCE_MEM, |
| 72 | }, |
| 73 | [1] = { |
| 74 | .start = PA_MRSHPC_IO + 0x1f0 + 0x206, |
| 75 | .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8, |
| 76 | .flags = IORESOURCE_MEM, |
| 77 | }, |
| 78 | [2] = { |
Nobuhiro Iwamatsu | 2a8ff45 | 2007-04-26 11:51:00 +0900 | [diff] [blame] | 79 | .start = IRQ_CFCARD, |
Nobuhiro Iwamatsu | f987fc8 | 2007-03-12 15:12:27 +0900 | [diff] [blame] | 80 | .flags = IORESOURCE_IRQ, |
| 81 | }, |
| 82 | }; |
| 83 | |
| 84 | static struct platform_device cf_ide_device = { |
| 85 | .name = "pata_platform", |
| 86 | .id = -1, |
| 87 | .num_resources = ARRAY_SIZE(cf_ide_resources), |
| 88 | .resource = cf_ide_resources, |
| 89 | }; |
| 90 | |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 91 | static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 }; |
| 92 | |
| 93 | static struct resource heartbeat_resources[] = { |
| 94 | [0] = { |
| 95 | .start = PA_LED, |
| 96 | .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1, |
| 97 | .flags = IORESOURCE_MEM, |
| 98 | }, |
| 99 | }; |
| 100 | |
| 101 | static struct platform_device heartbeat_device = { |
| 102 | .name = "heartbeat", |
| 103 | .id = -1, |
| 104 | .dev = { |
| 105 | .platform_data = heartbeat_bit_pos, |
| 106 | }, |
| 107 | .num_resources = ARRAY_SIZE(heartbeat_resources), |
| 108 | .resource = heartbeat_resources, |
| 109 | }; |
| 110 | |
| 111 | static struct platform_device *se_devices[] __initdata = { |
| 112 | &heartbeat_device, |
Nobuhiro Iwamatsu | f987fc8 | 2007-03-12 15:12:27 +0900 | [diff] [blame] | 113 | &cf_ide_device, |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 114 | }; |
| 115 | |
| 116 | static int __init se_devices_setup(void) |
| 117 | { |
| 118 | return platform_add_devices(se_devices, ARRAY_SIZE(se_devices)); |
| 119 | } |
Nobuhiro Iwamatsu | 9465a54 | 2007-03-27 18:13:51 +0900 | [diff] [blame] | 120 | device_initcall(se_devices_setup); |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 121 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | /* |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 123 | * The Machine Vector |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | */ |
Paul Mundt | 82f81f4 | 2007-05-15 15:19:34 +0900 | [diff] [blame^] | 125 | static struct sh_machine_vector mv_se __initmv = { |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 126 | .mv_name = "SolutionEngine", |
| 127 | .mv_setup = smsc_setup, |
| 128 | #if defined(CONFIG_CPU_SH4) |
| 129 | .mv_nr_irqs = 48, |
| 130 | #elif defined(CONFIG_CPU_SUBTYPE_SH7708) |
| 131 | .mv_nr_irqs = 32, |
| 132 | #elif defined(CONFIG_CPU_SUBTYPE_SH7709) |
| 133 | .mv_nr_irqs = 61, |
| 134 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) |
| 135 | .mv_nr_irqs = 86, |
Nobuhiro Iwamatsu | 9465a54 | 2007-03-27 18:13:51 +0900 | [diff] [blame] | 136 | #elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) |
| 137 | .mv_nr_irqs = 104, |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 138 | #endif |
| 139 | |
| 140 | .mv_inb = se_inb, |
| 141 | .mv_inw = se_inw, |
| 142 | .mv_inl = se_inl, |
| 143 | .mv_outb = se_outb, |
| 144 | .mv_outw = se_outw, |
| 145 | .mv_outl = se_outl, |
| 146 | |
| 147 | .mv_inb_p = se_inb_p, |
| 148 | .mv_inw_p = se_inw, |
| 149 | .mv_inl_p = se_inl, |
| 150 | .mv_outb_p = se_outb_p, |
| 151 | .mv_outw_p = se_outw, |
| 152 | .mv_outl_p = se_outl, |
| 153 | |
| 154 | .mv_insb = se_insb, |
| 155 | .mv_insw = se_insw, |
| 156 | .mv_insl = se_insl, |
| 157 | .mv_outsb = se_outsb, |
| 158 | .mv_outsw = se_outsw, |
| 159 | .mv_outsl = se_outsl, |
| 160 | |
| 161 | .mv_init_irq = init_se_IRQ, |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 162 | }; |