Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 1 | /* |
| 2 | * arch/sh/boards/renesas/r7780rp/setup.c |
| 3 | * |
Paul Mundt | 32351a2 | 2007-03-12 14:38:59 +0900 | [diff] [blame] | 4 | * Renesas Solutions Highlander Support. |
| 5 | * |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 6 | * Copyright (C) 2002 Atom Create Engineering Co., Ltd. |
Paul Mundt | c293396 | 2008-03-25 16:49:30 +0900 | [diff] [blame] | 7 | * Copyright (C) 2005 - 2008 Paul Mundt |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 8 | * |
Paul Mundt | 32351a2 | 2007-03-12 14:38:59 +0900 | [diff] [blame] | 9 | * This contains support for the R7780RP-1, R7780MP, and R7785RP |
| 10 | * Highlander modules. |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 11 | * |
| 12 | * This file is subject to the terms and conditions of the GNU General Public |
| 13 | * License. See the file "COPYING" in the main directory of this archive |
| 14 | * for more details. |
| 15 | */ |
| 16 | #include <linux/init.h> |
| 17 | #include <linux/platform_device.h> |
Jeff Garzik | 0a87e3e | 2008-02-01 18:02:30 -0500 | [diff] [blame] | 18 | #include <linux/ata_platform.h> |
Paul Mundt | b5751e2 | 2007-11-02 14:17:19 +0900 | [diff] [blame] | 19 | #include <linux/types.h> |
Nobuhiro Iwamatsu | 15ba400 | 2009-06-16 07:42:20 +0000 | [diff] [blame] | 20 | #include <linux/mtd/physmap.h> |
Paul Mundt | c293396 | 2008-03-25 16:49:30 +0900 | [diff] [blame] | 21 | #include <linux/i2c.h> |
Paul Mundt | 604437f | 2009-01-09 15:11:58 +0900 | [diff] [blame] | 22 | #include <linux/irq.h> |
Yoshihiro Shimoda | 6239b20 | 2009-05-26 09:33:05 +0000 | [diff] [blame] | 23 | #include <linux/interrupt.h> |
| 24 | #include <linux/usb/r8a66597.h> |
Magnus Damm | c6f93a3 | 2007-10-15 10:36:45 +0900 | [diff] [blame] | 25 | #include <net/ax88796.h> |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 26 | #include <asm/machvec.h> |
Paul Mundt | 7639a45 | 2008-10-20 13:02:48 +0900 | [diff] [blame] | 27 | #include <mach/highlander.h> |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 28 | #include <asm/clock.h> |
Paul Mundt | 8786c95 | 2007-08-20 13:03:41 +0900 | [diff] [blame] | 29 | #include <asm/heartbeat.h> |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 30 | #include <asm/io.h> |
Magnus Damm | c1a34e4 | 2008-02-07 20:23:53 +0900 | [diff] [blame] | 31 | #include <asm/io_trapped.h> |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 32 | |
Yoshihiro Shimoda | 6239b20 | 2009-05-26 09:33:05 +0000 | [diff] [blame] | 33 | static struct r8a66597_platdata r8a66597_data = { |
| 34 | .xtal = R8A66597_PLATDATA_XTAL_12MHZ, |
| 35 | .vif = 1, |
| 36 | }; |
| 37 | |
Yoshihiro Shimoda | e6c972f | 2007-07-17 13:38:54 +0900 | [diff] [blame] | 38 | static struct resource r8a66597_usb_host_resources[] = { |
| 39 | [0] = { |
Yoshihiro Shimoda | e6c972f | 2007-07-17 13:38:54 +0900 | [diff] [blame] | 40 | .start = 0xA4200000, |
| 41 | .end = 0xA42000FF, |
| 42 | .flags = IORESOURCE_MEM, |
| 43 | }, |
| 44 | [1] = { |
Magnus Damm | 897cfcd | 2007-09-10 12:06:03 +0900 | [diff] [blame] | 45 | .start = IRQ_EXT1, /* irq number */ |
| 46 | .end = IRQ_EXT1, |
Yoshihiro Shimoda | 6239b20 | 2009-05-26 09:33:05 +0000 | [diff] [blame] | 47 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, |
Yoshihiro Shimoda | e6c972f | 2007-07-17 13:38:54 +0900 | [diff] [blame] | 48 | }, |
| 49 | }; |
| 50 | |
| 51 | static struct platform_device r8a66597_usb_host_device = { |
| 52 | .name = "r8a66597_hcd", |
| 53 | .id = -1, |
| 54 | .dev = { |
| 55 | .dma_mask = NULL, /* don't use dma */ |
| 56 | .coherent_dma_mask = 0xffffffff, |
Yoshihiro Shimoda | 6239b20 | 2009-05-26 09:33:05 +0000 | [diff] [blame] | 57 | .platform_data = &r8a66597_data, |
Yoshihiro Shimoda | e6c972f | 2007-07-17 13:38:54 +0900 | [diff] [blame] | 58 | }, |
| 59 | .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources), |
| 60 | .resource = r8a66597_usb_host_resources, |
| 61 | }; |
| 62 | |
| 63 | static struct resource m66592_usb_peripheral_resources[] = { |
| 64 | [0] = { |
| 65 | .name = "m66592_udc", |
| 66 | .start = 0xb0000000, |
| 67 | .end = 0xb00000FF, |
| 68 | .flags = IORESOURCE_MEM, |
| 69 | }, |
| 70 | [1] = { |
| 71 | .name = "m66592_udc", |
Magnus Damm | 897cfcd | 2007-09-10 12:06:03 +0900 | [diff] [blame] | 72 | .start = IRQ_EXT4, /* irq number */ |
| 73 | .end = IRQ_EXT4, |
Yoshihiro Shimoda | e6c972f | 2007-07-17 13:38:54 +0900 | [diff] [blame] | 74 | .flags = IORESOURCE_IRQ, |
| 75 | }, |
| 76 | }; |
| 77 | |
| 78 | static struct platform_device m66592_usb_peripheral_device = { |
| 79 | .name = "m66592_udc", |
| 80 | .id = -1, |
| 81 | .dev = { |
| 82 | .dma_mask = NULL, /* don't use dma */ |
| 83 | .coherent_dma_mask = 0xffffffff, |
| 84 | }, |
| 85 | .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources), |
| 86 | .resource = m66592_usb_peripheral_resources, |
| 87 | }; |
| 88 | |
Paul Mundt | 0c020e3 | 2006-12-06 10:43:44 +0900 | [diff] [blame] | 89 | static struct resource cf_ide_resources[] = { |
| 90 | [0] = { |
Paul Mundt | 71074d3 | 2007-02-14 14:49:04 +0900 | [diff] [blame] | 91 | .start = PA_AREA5_IO + 0x1000, |
| 92 | .end = PA_AREA5_IO + 0x1000 + 0x08 - 1, |
| 93 | .flags = IORESOURCE_MEM, |
Paul Mundt | 0c020e3 | 2006-12-06 10:43:44 +0900 | [diff] [blame] | 94 | }, |
| 95 | [1] = { |
Paul Mundt | 71074d3 | 2007-02-14 14:49:04 +0900 | [diff] [blame] | 96 | .start = PA_AREA5_IO + 0x80c, |
| 97 | .end = PA_AREA5_IO + 0x80c + 0x16 - 1, |
| 98 | .flags = IORESOURCE_MEM, |
Paul Mundt | 0c020e3 | 2006-12-06 10:43:44 +0900 | [diff] [blame] | 99 | }, |
| 100 | [2] = { |
Magnus Damm | 897cfcd | 2007-09-10 12:06:03 +0900 | [diff] [blame] | 101 | .start = IRQ_CF, |
Paul Mundt | 0c020e3 | 2006-12-06 10:43:44 +0900 | [diff] [blame] | 102 | .flags = IORESOURCE_IRQ, |
| 103 | }, |
| 104 | }; |
| 105 | |
Paul Mundt | 71074d3 | 2007-02-14 14:49:04 +0900 | [diff] [blame] | 106 | static struct pata_platform_info pata_info = { |
| 107 | .ioport_shift = 1, |
| 108 | }; |
| 109 | |
Paul Mundt | 0c020e3 | 2006-12-06 10:43:44 +0900 | [diff] [blame] | 110 | static struct platform_device cf_ide_device = { |
| 111 | .name = "pata_platform", |
| 112 | .id = -1, |
| 113 | .num_resources = ARRAY_SIZE(cf_ide_resources), |
| 114 | .resource = cf_ide_resources, |
Paul Mundt | 71074d3 | 2007-02-14 14:49:04 +0900 | [diff] [blame] | 115 | .dev = { |
| 116 | .platform_data = &pata_info, |
| 117 | }, |
Paul Mundt | 0c020e3 | 2006-12-06 10:43:44 +0900 | [diff] [blame] | 118 | }; |
| 119 | |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 120 | static struct resource heartbeat_resources[] = { |
| 121 | [0] = { |
| 122 | .start = PA_OBLED, |
Paul Mundt | a1fd306 | 2007-08-23 15:11:44 +0900 | [diff] [blame] | 123 | .end = PA_OBLED, |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 124 | .flags = IORESOURCE_MEM, |
| 125 | }, |
| 126 | }; |
| 127 | |
Paul Mundt | 8786c95 | 2007-08-20 13:03:41 +0900 | [diff] [blame] | 128 | #ifndef CONFIG_SH_R7785RP |
| 129 | static unsigned char heartbeat_bit_pos[] = { 2, 1, 0, 3, 6, 5, 4, 7 }; |
| 130 | |
| 131 | static struct heartbeat_data heartbeat_data = { |
| 132 | .bit_pos = heartbeat_bit_pos, |
| 133 | .nr_bits = ARRAY_SIZE(heartbeat_bit_pos), |
| 134 | }; |
| 135 | #endif |
| 136 | |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 137 | static struct platform_device heartbeat_device = { |
| 138 | .name = "heartbeat", |
| 139 | .id = -1, |
Paul Mundt | 32351a2 | 2007-03-12 14:38:59 +0900 | [diff] [blame] | 140 | |
| 141 | /* R7785RP has a slightly more sensible FPGA.. */ |
| 142 | #ifndef CONFIG_SH_R7785RP |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 143 | .dev = { |
Paul Mundt | a1fd306 | 2007-08-23 15:11:44 +0900 | [diff] [blame] | 144 | .platform_data = &heartbeat_data, |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 145 | }, |
Paul Mundt | 32351a2 | 2007-03-12 14:38:59 +0900 | [diff] [blame] | 146 | #endif |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 147 | .num_resources = ARRAY_SIZE(heartbeat_resources), |
| 148 | .resource = heartbeat_resources, |
| 149 | }; |
| 150 | |
Magnus Damm | c6f93a3 | 2007-10-15 10:36:45 +0900 | [diff] [blame] | 151 | static struct ax_plat_data ax88796_platdata = { |
| 152 | .flags = AXFLG_HAS_93CX6, |
| 153 | .wordlength = 2, |
| 154 | .dcr_val = 0x1, |
| 155 | .rcr_val = 0x40, |
| 156 | }; |
| 157 | |
| 158 | static struct resource ax88796_resources[] = { |
| 159 | { |
| 160 | #ifdef CONFIG_SH_R7780RP |
| 161 | .start = 0xa5800400, |
| 162 | .end = 0xa5800400 + (0x20 * 0x2) - 1, |
| 163 | #else |
| 164 | .start = 0xa4100400, |
| 165 | .end = 0xa4100400 + (0x20 * 0x2) - 1, |
| 166 | #endif |
| 167 | .flags = IORESOURCE_MEM, |
| 168 | }, |
| 169 | { |
| 170 | .start = IRQ_AX88796, |
| 171 | .end = IRQ_AX88796, |
| 172 | .flags = IORESOURCE_IRQ, |
| 173 | }, |
| 174 | }; |
| 175 | |
| 176 | static struct platform_device ax88796_device = { |
| 177 | .name = "ax88796", |
| 178 | .id = 0, |
| 179 | |
| 180 | .dev = { |
| 181 | .platform_data = &ax88796_platdata, |
| 182 | }, |
| 183 | |
| 184 | .num_resources = ARRAY_SIZE(ax88796_resources), |
| 185 | .resource = ax88796_resources, |
| 186 | }; |
| 187 | |
Nobuhiro Iwamatsu | 15ba400 | 2009-06-16 07:42:20 +0000 | [diff] [blame] | 188 | static struct mtd_partition nor_flash_partitions[] = { |
| 189 | { |
| 190 | .name = "loader", |
| 191 | .offset = 0x00000000, |
| 192 | .size = 512 * 1024, |
| 193 | }, |
| 194 | { |
| 195 | .name = "bootenv", |
| 196 | .offset = MTDPART_OFS_APPEND, |
| 197 | .size = 512 * 1024, |
| 198 | }, |
| 199 | { |
| 200 | .name = "kernel", |
| 201 | .offset = MTDPART_OFS_APPEND, |
| 202 | .size = 4 * 1024 * 1024, |
| 203 | }, |
| 204 | { |
| 205 | .name = "data", |
| 206 | .offset = MTDPART_OFS_APPEND, |
| 207 | .size = MTDPART_SIZ_FULL, |
| 208 | }, |
| 209 | }; |
| 210 | |
| 211 | static struct physmap_flash_data nor_flash_data = { |
| 212 | .width = 4, |
| 213 | .parts = nor_flash_partitions, |
| 214 | .nr_parts = ARRAY_SIZE(nor_flash_partitions), |
| 215 | }; |
| 216 | |
| 217 | /* This config is flash board for mass production. */ |
| 218 | static struct resource nor_flash_resources[] = { |
| 219 | [0] = { |
| 220 | .start = PA_NORFLASH_ADDR, |
| 221 | .end = PA_NORFLASH_ADDR + PA_NORFLASH_SIZE - 1, |
| 222 | .flags = IORESOURCE_MEM, |
| 223 | } |
| 224 | }; |
| 225 | |
| 226 | static struct platform_device nor_flash_device = { |
| 227 | .name = "physmap-flash", |
| 228 | .dev = { |
| 229 | .platform_data = &nor_flash_data, |
| 230 | }, |
| 231 | .num_resources = ARRAY_SIZE(nor_flash_resources), |
| 232 | .resource = nor_flash_resources, |
| 233 | }; |
| 234 | |
Paul Mundt | c293396 | 2008-03-25 16:49:30 +0900 | [diff] [blame] | 235 | static struct resource smbus_resources[] = { |
| 236 | [0] = { |
| 237 | .start = PA_SMCR, |
| 238 | .end = PA_SMCR + 0x100 - 1, |
| 239 | .flags = IORESOURCE_MEM, |
| 240 | }, |
| 241 | [1] = { |
| 242 | .start = IRQ_SMBUS, |
| 243 | .end = IRQ_SMBUS, |
| 244 | .flags = IORESOURCE_IRQ, |
| 245 | }, |
| 246 | }; |
| 247 | |
| 248 | static struct platform_device smbus_device = { |
| 249 | .name = "i2c-highlander", |
| 250 | .id = 0, |
| 251 | .num_resources = ARRAY_SIZE(smbus_resources), |
| 252 | .resource = smbus_resources, |
| 253 | }; |
| 254 | |
| 255 | static struct i2c_board_info __initdata highlander_i2c_devices[] = { |
| 256 | { |
Jean Delvare | 3760f73 | 2008-04-29 23:11:40 +0200 | [diff] [blame] | 257 | I2C_BOARD_INFO("r2025sd", 0x32), |
Paul Mundt | c293396 | 2008-03-25 16:49:30 +0900 | [diff] [blame] | 258 | }, |
| 259 | }; |
Magnus Damm | c6f93a3 | 2007-10-15 10:36:45 +0900 | [diff] [blame] | 260 | |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 261 | static struct platform_device *r7780rp_devices[] __initdata = { |
Yoshihiro Shimoda | e6c972f | 2007-07-17 13:38:54 +0900 | [diff] [blame] | 262 | &r8a66597_usb_host_device, |
| 263 | &m66592_usb_peripheral_device, |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 264 | &heartbeat_device, |
Paul Mundt | c293396 | 2008-03-25 16:49:30 +0900 | [diff] [blame] | 265 | &smbus_device, |
Nobuhiro Iwamatsu | 15ba400 | 2009-06-16 07:42:20 +0000 | [diff] [blame] | 266 | &nor_flash_device, |
Magnus Damm | da2d7f4 | 2008-01-25 16:04:29 +0900 | [diff] [blame] | 267 | #ifndef CONFIG_SH_R7780RP |
Magnus Damm | c6f93a3 | 2007-10-15 10:36:45 +0900 | [diff] [blame] | 268 | &ax88796_device, |
Magnus Damm | da2d7f4 | 2008-01-25 16:04:29 +0900 | [diff] [blame] | 269 | #endif |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 270 | }; |
| 271 | |
Magnus Damm | c1a34e4 | 2008-02-07 20:23:53 +0900 | [diff] [blame] | 272 | /* |
| 273 | * The CF is connected using a 16-bit bus where 8-bit operations are |
| 274 | * unsupported. The linux ata driver is however using 8-bit operations, so |
| 275 | * insert a trapped io filter to convert 8-bit operations into 16-bit. |
| 276 | */ |
| 277 | static struct trapped_io cf_trapped_io = { |
| 278 | .resource = cf_ide_resources, |
| 279 | .num_resources = 2, |
| 280 | .minimum_bus_width = 16, |
| 281 | }; |
| 282 | |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 283 | static int __init r7780rp_devices_setup(void) |
| 284 | { |
Paul Mundt | c293396 | 2008-03-25 16:49:30 +0900 | [diff] [blame] | 285 | int ret = 0; |
| 286 | |
Magnus Damm | c1a34e4 | 2008-02-07 20:23:53 +0900 | [diff] [blame] | 287 | #ifndef CONFIG_SH_R7780RP |
| 288 | if (register_trapped_io(&cf_trapped_io) == 0) |
Paul Mundt | c293396 | 2008-03-25 16:49:30 +0900 | [diff] [blame] | 289 | ret |= platform_device_register(&cf_ide_device); |
Magnus Damm | c1a34e4 | 2008-02-07 20:23:53 +0900 | [diff] [blame] | 290 | #endif |
Paul Mundt | c293396 | 2008-03-25 16:49:30 +0900 | [diff] [blame] | 291 | |
| 292 | ret |= platform_add_devices(r7780rp_devices, |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 293 | ARRAY_SIZE(r7780rp_devices)); |
Paul Mundt | c293396 | 2008-03-25 16:49:30 +0900 | [diff] [blame] | 294 | |
| 295 | ret |= i2c_register_board_info(0, highlander_i2c_devices, |
| 296 | ARRAY_SIZE(highlander_i2c_devices)); |
| 297 | |
| 298 | return ret; |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 299 | } |
Paul Mundt | 32351a2 | 2007-03-12 14:38:59 +0900 | [diff] [blame] | 300 | device_initcall(r7780rp_devices_setup); |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 301 | |
| 302 | /* |
| 303 | * Platform specific clocks |
| 304 | */ |
Nobuhiro Iwamatsu | 39f4490 | 2009-06-16 07:44:10 +0000 | [diff] [blame] | 305 | static int ivdr_clk_enable(struct clk *clk) |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 306 | { |
Ryusuke Sakato | 39374aa | 2007-05-07 10:48:56 +0900 | [diff] [blame] | 307 | ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << IVDR_CK_ON), PA_IVDRCTL); |
Nobuhiro Iwamatsu | 39f4490 | 2009-06-16 07:44:10 +0000 | [diff] [blame] | 308 | return 0; |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 309 | } |
| 310 | |
| 311 | static void ivdr_clk_disable(struct clk *clk) |
| 312 | { |
Ryusuke Sakato | 39374aa | 2007-05-07 10:48:56 +0900 | [diff] [blame] | 313 | ctrl_outw(ctrl_inw(PA_IVDRCTL) & ~(1 << IVDR_CK_ON), PA_IVDRCTL); |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 314 | } |
| 315 | |
| 316 | static struct clk_ops ivdr_clk_ops = { |
| 317 | .enable = ivdr_clk_enable, |
| 318 | .disable = ivdr_clk_disable, |
| 319 | }; |
| 320 | |
| 321 | static struct clk ivdr_clk = { |
| 322 | .name = "ivdr_clk", |
| 323 | .ops = &ivdr_clk_ops, |
| 324 | }; |
| 325 | |
| 326 | static struct clk *r7780rp_clocks[] = { |
| 327 | &ivdr_clk, |
| 328 | }; |
| 329 | |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 330 | static void r7780rp_power_off(void) |
| 331 | { |
Paul Mundt | 32351a2 | 2007-03-12 14:38:59 +0900 | [diff] [blame] | 332 | if (mach_is_r7780mp() || mach_is_r7785rp()) |
| 333 | ctrl_outw(0x0001, PA_POFF); |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 334 | } |
| 335 | |
| 336 | /* |
| 337 | * Initialize the board |
| 338 | */ |
Paul Mundt | 32351a2 | 2007-03-12 14:38:59 +0900 | [diff] [blame] | 339 | static void __init highlander_setup(char **cmdline_p) |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 340 | { |
| 341 | u16 ver = ctrl_inw(PA_VERREG); |
| 342 | int i; |
| 343 | |
Paul Mundt | 32351a2 | 2007-03-12 14:38:59 +0900 | [diff] [blame] | 344 | printk(KERN_INFO "Renesas Solutions Highlander %s support.\n", |
| 345 | mach_is_r7780rp() ? "R7780RP-1" : |
| 346 | mach_is_r7780mp() ? "R7780MP" : |
| 347 | "R7785RP"); |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 348 | |
| 349 | printk(KERN_INFO "Board version: %d (revision %d), " |
| 350 | "FPGA version: %d (revision %d)\n", |
| 351 | (ver >> 12) & 0xf, (ver >> 8) & 0xf, |
| 352 | (ver >> 4) & 0xf, ver & 0xf); |
| 353 | |
Paul Mundt | 61dc6ea | 2008-10-23 12:35:43 +0900 | [diff] [blame] | 354 | highlander_plat_pinmux_setup(); |
| 355 | |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 356 | /* |
| 357 | * Enable the important clocks right away.. |
| 358 | */ |
| 359 | for (i = 0; i < ARRAY_SIZE(r7780rp_clocks); i++) { |
| 360 | struct clk *clk = r7780rp_clocks[i]; |
| 361 | |
| 362 | clk_register(clk); |
| 363 | clk_enable(clk); |
| 364 | } |
| 365 | |
| 366 | ctrl_outw(0x0000, PA_OBLED); /* Clear LED. */ |
Paul Mundt | 32351a2 | 2007-03-12 14:38:59 +0900 | [diff] [blame] | 367 | |
| 368 | if (mach_is_r7780rp()) |
| 369 | ctrl_outw(0x0001, PA_SDPOW); /* SD Power ON */ |
| 370 | |
Paul Mundt | 2c081e7 | 2006-12-25 18:28:33 +0900 | [diff] [blame] | 371 | ctrl_outw(ctrl_inw(PA_IVDRCTL) | 0x01, PA_IVDRCTL); /* Si13112 */ |
Paul Mundt | 5283ecb | 2006-09-27 15:59:17 +0900 | [diff] [blame] | 372 | |
| 373 | pm_power_off = r7780rp_power_off; |
| 374 | } |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 375 | |
Magnus Damm | 897cfcd | 2007-09-10 12:06:03 +0900 | [diff] [blame] | 376 | static unsigned char irl2irq[HL_NR_IRL]; |
| 377 | |
Paul Mundt | ae8a534 | 2008-04-25 17:58:21 +0900 | [diff] [blame] | 378 | static int highlander_irq_demux(int irq) |
Magnus Damm | 897cfcd | 2007-09-10 12:06:03 +0900 | [diff] [blame] | 379 | { |
| 380 | if (irq >= HL_NR_IRL || !irl2irq[irq]) |
| 381 | return irq; |
| 382 | |
| 383 | return irl2irq[irq]; |
| 384 | } |
| 385 | |
Paul Mundt | ae8a534 | 2008-04-25 17:58:21 +0900 | [diff] [blame] | 386 | static void __init highlander_init_irq(void) |
Magnus Damm | 897cfcd | 2007-09-10 12:06:03 +0900 | [diff] [blame] | 387 | { |
Paul Mundt | ae8a534 | 2008-04-25 17:58:21 +0900 | [diff] [blame] | 388 | unsigned char *ucp = highlander_plat_irq_setup(); |
Magnus Damm | 897cfcd | 2007-09-10 12:06:03 +0900 | [diff] [blame] | 389 | |
| 390 | if (ucp) { |
| 391 | plat_irq_setup_pins(IRQ_MODE_IRL3210); |
| 392 | memcpy(irl2irq, ucp, HL_NR_IRL); |
| 393 | } |
| 394 | } |
| 395 | |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 396 | /* |
| 397 | * The Machine Vector |
| 398 | */ |
Paul Mundt | 82f81f4 | 2007-05-15 15:19:34 +0900 | [diff] [blame] | 399 | static struct sh_machine_vector mv_highlander __initmv = { |
Paul Mundt | 32351a2 | 2007-03-12 14:38:59 +0900 | [diff] [blame] | 400 | .mv_name = "Highlander", |
Paul Mundt | 32351a2 | 2007-03-12 14:38:59 +0900 | [diff] [blame] | 401 | .mv_setup = highlander_setup, |
| 402 | .mv_init_irq = highlander_init_irq, |
Magnus Damm | 897cfcd | 2007-09-10 12:06:03 +0900 | [diff] [blame] | 403 | .mv_irq_demux = highlander_irq_demux, |
Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 404 | }; |