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