Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/sh/boards/se/7724/setup.c |
| 3 | * |
| 4 | * Copyright (C) 2009 Renesas Solutions Corp. |
| 5 | * |
| 6 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> |
| 7 | * |
| 8 | * This file is subject to the terms and conditions of the GNU General Public |
| 9 | * License. See the file "COPYING" in the main directory of this archive |
| 10 | * for more details. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/device.h> |
| 15 | #include <linux/interrupt.h> |
| 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/mtd/physmap.h> |
| 18 | #include <linux/delay.h> |
| 19 | #include <linux/smc91x.h> |
| 20 | #include <linux/gpio.h> |
| 21 | #include <linux/input.h> |
Magnus Damm | fc1d003 | 2009-11-27 07:32:24 +0000 | [diff] [blame] | 22 | #include <linux/input/sh_keysc.h> |
Magnus Damm | 9731f4a | 2009-07-03 09:40:03 +0000 | [diff] [blame] | 23 | #include <linux/usb/r8a66597.h> |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 24 | #include <video/sh_mobile_lcdc.h> |
| 25 | #include <media/sh_mobile_ceu.h> |
Kuninori Morimoto | 3e9ad52 | 2009-08-21 01:24:54 +0000 | [diff] [blame] | 26 | #include <sound/sh_fsi.h> |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 27 | #include <asm/io.h> |
| 28 | #include <asm/heartbeat.h> |
Kuninori Morimoto | a80cad9 | 2009-06-26 07:05:39 +0000 | [diff] [blame] | 29 | #include <asm/sh_eth.h> |
| 30 | #include <asm/clock.h> |
Magnus Damm | 3b9f295 | 2009-10-29 10:52:23 +0000 | [diff] [blame] | 31 | #include <asm/suspend.h> |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 32 | #include <cpu/sh7724.h> |
| 33 | #include <mach-se/mach/se7724.h> |
| 34 | |
| 35 | /* |
| 36 | * SWx 1234 5678 |
| 37 | * ------------------------------------ |
| 38 | * SW31 : 1001 1100 : default |
| 39 | * SW32 : 0111 1111 : use on board flash |
| 40 | * |
| 41 | * SW41 : abxx xxxx -> a = 0 : Analog monitor |
| 42 | * 1 : Digital monitor |
| 43 | * b = 0 : VGA |
Kuninori Morimoto | 4f32431 | 2009-08-03 04:52:03 +0000 | [diff] [blame] | 44 | * 1 : 720p |
| 45 | */ |
| 46 | |
| 47 | /* |
| 48 | * about 720p |
| 49 | * |
| 50 | * When you use 1280 x 720 lcdc output, |
| 51 | * you should change OSC6 lcdc clock from 25.175MHz to 74.25MHz, |
| 52 | * and change SW41 to use 720p |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 53 | */ |
| 54 | |
| 55 | /* Heartbeat */ |
Paul Mundt | a09d283 | 2010-01-15 12:24:34 +0900 | [diff] [blame] | 56 | static struct resource heartbeat_resource = { |
| 57 | .start = PA_LED, |
| 58 | .end = PA_LED, |
| 59 | .flags = IORESOURCE_MEM | IORESOURCE_MEM_16BIT, |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | static struct platform_device heartbeat_device = { |
| 63 | .name = "heartbeat", |
| 64 | .id = -1, |
Paul Mundt | a09d283 | 2010-01-15 12:24:34 +0900 | [diff] [blame] | 65 | .num_resources = 1, |
| 66 | .resource = &heartbeat_resource, |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 67 | }; |
| 68 | |
| 69 | /* LAN91C111 */ |
| 70 | static struct smc91x_platdata smc91x_info = { |
| 71 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, |
| 72 | }; |
| 73 | |
| 74 | static struct resource smc91x_eth_resources[] = { |
| 75 | [0] = { |
| 76 | .name = "SMC91C111" , |
| 77 | .start = 0x1a300300, |
| 78 | .end = 0x1a30030f, |
| 79 | .flags = IORESOURCE_MEM, |
| 80 | }, |
| 81 | [1] = { |
| 82 | .start = IRQ0_SMC, |
| 83 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 84 | }, |
| 85 | }; |
| 86 | |
| 87 | static struct platform_device smc91x_eth_device = { |
| 88 | .name = "smc91x", |
| 89 | .num_resources = ARRAY_SIZE(smc91x_eth_resources), |
| 90 | .resource = smc91x_eth_resources, |
| 91 | .dev = { |
| 92 | .platform_data = &smc91x_info, |
| 93 | }, |
| 94 | }; |
| 95 | |
| 96 | /* MTD */ |
| 97 | static struct mtd_partition nor_flash_partitions[] = { |
| 98 | { |
| 99 | .name = "uboot", |
| 100 | .offset = 0, |
| 101 | .size = (1 * 1024 * 1024), |
| 102 | .mask_flags = MTD_WRITEABLE, /* Read-only */ |
| 103 | }, { |
| 104 | .name = "kernel", |
| 105 | .offset = MTDPART_OFS_APPEND, |
| 106 | .size = (2 * 1024 * 1024), |
| 107 | }, { |
| 108 | .name = "free-area", |
| 109 | .offset = MTDPART_OFS_APPEND, |
| 110 | .size = MTDPART_SIZ_FULL, |
| 111 | }, |
| 112 | }; |
| 113 | |
| 114 | static struct physmap_flash_data nor_flash_data = { |
| 115 | .width = 2, |
| 116 | .parts = nor_flash_partitions, |
| 117 | .nr_parts = ARRAY_SIZE(nor_flash_partitions), |
| 118 | }; |
| 119 | |
| 120 | static struct resource nor_flash_resources[] = { |
| 121 | [0] = { |
| 122 | .name = "NOR Flash", |
| 123 | .start = 0x00000000, |
| 124 | .end = 0x01ffffff, |
| 125 | .flags = IORESOURCE_MEM, |
| 126 | } |
| 127 | }; |
| 128 | |
| 129 | static struct platform_device nor_flash_device = { |
| 130 | .name = "physmap-flash", |
| 131 | .resource = nor_flash_resources, |
| 132 | .num_resources = ARRAY_SIZE(nor_flash_resources), |
| 133 | .dev = { |
| 134 | .platform_data = &nor_flash_data, |
| 135 | }, |
| 136 | }; |
| 137 | |
| 138 | /* LCDC */ |
| 139 | static struct sh_mobile_lcdc_info lcdc_info = { |
| 140 | .clock_source = LCDC_CLK_EXTERNAL, |
| 141 | .ch[0] = { |
| 142 | .chan = LCDC_CHAN_MAINLCD, |
| 143 | .bpp = 16, |
| 144 | .clock_divider = 1, |
| 145 | .lcd_cfg = { |
| 146 | .name = "LB070WV1", |
| 147 | .sync = 0, /* hsync and vsync are active low */ |
| 148 | }, |
| 149 | .lcd_size_cfg = { /* 7.0 inch */ |
| 150 | .width = 152, |
| 151 | .height = 91, |
| 152 | }, |
| 153 | .board_cfg = { |
| 154 | }, |
| 155 | } |
| 156 | }; |
| 157 | |
| 158 | static struct resource lcdc_resources[] = { |
| 159 | [0] = { |
| 160 | .name = "LCDC", |
| 161 | .start = 0xfe940000, |
Phil Edworthy | a6f15ad | 2009-09-15 12:00:30 +0000 | [diff] [blame] | 162 | .end = 0xfe942fff, |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 163 | .flags = IORESOURCE_MEM, |
| 164 | }, |
| 165 | [1] = { |
| 166 | .start = 106, |
| 167 | .flags = IORESOURCE_IRQ, |
| 168 | }, |
| 169 | }; |
| 170 | |
| 171 | static struct platform_device lcdc_device = { |
| 172 | .name = "sh_mobile_lcdc_fb", |
| 173 | .num_resources = ARRAY_SIZE(lcdc_resources), |
| 174 | .resource = lcdc_resources, |
| 175 | .dev = { |
| 176 | .platform_data = &lcdc_info, |
| 177 | }, |
Magnus Damm | df47cd0 | 2009-07-31 07:48:29 +0000 | [diff] [blame] | 178 | .archdata = { |
| 179 | .hwblk_id = HWBLK_LCDC, |
| 180 | }, |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 181 | }; |
| 182 | |
| 183 | /* CEU0 */ |
| 184 | static struct sh_mobile_ceu_info sh_mobile_ceu0_info = { |
| 185 | .flags = SH_CEU_FLAG_USE_8BIT_BUS, |
| 186 | }; |
| 187 | |
| 188 | static struct resource ceu0_resources[] = { |
| 189 | [0] = { |
| 190 | .name = "CEU0", |
| 191 | .start = 0xfe910000, |
| 192 | .end = 0xfe91009f, |
| 193 | .flags = IORESOURCE_MEM, |
| 194 | }, |
| 195 | [1] = { |
| 196 | .start = 52, |
| 197 | .flags = IORESOURCE_IRQ, |
| 198 | }, |
| 199 | [2] = { |
| 200 | /* place holder for contiguous memory */ |
| 201 | }, |
| 202 | }; |
| 203 | |
| 204 | static struct platform_device ceu0_device = { |
| 205 | .name = "sh_mobile_ceu", |
| 206 | .id = 0, /* "ceu0" clock */ |
| 207 | .num_resources = ARRAY_SIZE(ceu0_resources), |
| 208 | .resource = ceu0_resources, |
| 209 | .dev = { |
| 210 | .platform_data = &sh_mobile_ceu0_info, |
| 211 | }, |
Magnus Damm | df47cd0 | 2009-07-31 07:48:29 +0000 | [diff] [blame] | 212 | .archdata = { |
| 213 | .hwblk_id = HWBLK_CEU0, |
| 214 | }, |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 215 | }; |
| 216 | |
| 217 | /* CEU1 */ |
| 218 | static struct sh_mobile_ceu_info sh_mobile_ceu1_info = { |
| 219 | .flags = SH_CEU_FLAG_USE_8BIT_BUS, |
| 220 | }; |
| 221 | |
| 222 | static struct resource ceu1_resources[] = { |
| 223 | [0] = { |
| 224 | .name = "CEU1", |
| 225 | .start = 0xfe914000, |
| 226 | .end = 0xfe91409f, |
| 227 | .flags = IORESOURCE_MEM, |
| 228 | }, |
| 229 | [1] = { |
| 230 | .start = 63, |
| 231 | .flags = IORESOURCE_IRQ, |
| 232 | }, |
| 233 | [2] = { |
| 234 | /* place holder for contiguous memory */ |
| 235 | }, |
| 236 | }; |
| 237 | |
| 238 | static struct platform_device ceu1_device = { |
| 239 | .name = "sh_mobile_ceu", |
| 240 | .id = 1, /* "ceu1" clock */ |
| 241 | .num_resources = ARRAY_SIZE(ceu1_resources), |
| 242 | .resource = ceu1_resources, |
| 243 | .dev = { |
| 244 | .platform_data = &sh_mobile_ceu1_info, |
| 245 | }, |
Magnus Damm | df47cd0 | 2009-07-31 07:48:29 +0000 | [diff] [blame] | 246 | .archdata = { |
| 247 | .hwblk_id = HWBLK_CEU1, |
| 248 | }, |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 249 | }; |
| 250 | |
Kuninori Morimoto | 3e9ad52 | 2009-08-21 01:24:54 +0000 | [diff] [blame] | 251 | /* FSI */ |
| 252 | /* |
| 253 | * FSI-A use external clock which came from ak464x. |
| 254 | * So, we should change parent of fsi |
| 255 | */ |
| 256 | #define FCLKACR 0xa4150008 |
| 257 | static void fsimck_init(struct clk *clk) |
| 258 | { |
Paul Mundt | 9d56dd3 | 2010-01-26 12:58:40 +0900 | [diff] [blame] | 259 | u32 status = __raw_readl(clk->enable_reg); |
Kuninori Morimoto | 3e9ad52 | 2009-08-21 01:24:54 +0000 | [diff] [blame] | 260 | |
| 261 | /* use external clock */ |
| 262 | status &= ~0x000000ff; |
| 263 | status |= 0x00000080; |
Paul Mundt | 9d56dd3 | 2010-01-26 12:58:40 +0900 | [diff] [blame] | 264 | __raw_writel(status, clk->enable_reg); |
Kuninori Morimoto | 3e9ad52 | 2009-08-21 01:24:54 +0000 | [diff] [blame] | 265 | } |
| 266 | |
| 267 | static struct clk_ops fsimck_clk_ops = { |
| 268 | .init = fsimck_init, |
| 269 | }; |
| 270 | |
| 271 | static struct clk fsimcka_clk = { |
| 272 | .name = "fsimcka_clk", |
| 273 | .id = -1, |
| 274 | .ops = &fsimck_clk_ops, |
| 275 | .enable_reg = (void __iomem *)FCLKACR, |
| 276 | .rate = 0, /* unknown */ |
| 277 | }; |
| 278 | |
| 279 | struct sh_fsi_platform_info fsi_info = { |
| 280 | .porta_flags = SH_FSI_BRS_INV | |
| 281 | SH_FSI_OUT_SLAVE_MODE | |
| 282 | SH_FSI_IN_SLAVE_MODE | |
| 283 | SH_FSI_OFMT(PCM) | |
| 284 | SH_FSI_IFMT(PCM), |
| 285 | }; |
| 286 | |
| 287 | static struct resource fsi_resources[] = { |
| 288 | [0] = { |
| 289 | .name = "FSI", |
| 290 | .start = 0xFE3C0000, |
| 291 | .end = 0xFE3C021d, |
| 292 | .flags = IORESOURCE_MEM, |
| 293 | }, |
| 294 | [1] = { |
| 295 | .start = 108, |
| 296 | .flags = IORESOURCE_IRQ, |
| 297 | }, |
| 298 | }; |
| 299 | |
| 300 | static struct platform_device fsi_device = { |
| 301 | .name = "sh_fsi", |
| 302 | .id = 0, |
| 303 | .num_resources = ARRAY_SIZE(fsi_resources), |
| 304 | .resource = fsi_resources, |
| 305 | .dev = { |
| 306 | .platform_data = &fsi_info, |
| 307 | }, |
Kuninori Morimoto | d53bd80 | 2009-11-09 11:12:49 +0900 | [diff] [blame] | 308 | .archdata = { |
| 309 | .hwblk_id = HWBLK_SPU, /* FSI needs SPU hwblk */ |
| 310 | }, |
Kuninori Morimoto | 3e9ad52 | 2009-08-21 01:24:54 +0000 | [diff] [blame] | 311 | }; |
| 312 | |
Magnus Damm | 9747e78b | 2009-08-15 02:53:34 +0000 | [diff] [blame] | 313 | /* KEYSC in SoC (Needs SW33-2 set to ON) */ |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 314 | static struct sh_keysc_info keysc_info = { |
| 315 | .mode = SH_KEYSC_MODE_1, |
| 316 | .scan_timing = 10, |
| 317 | .delay = 50, |
| 318 | .keycodes = { |
| 319 | KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, |
| 320 | KEY_6, KEY_7, KEY_8, KEY_9, KEY_A, |
| 321 | KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, |
| 322 | KEY_G, KEY_H, KEY_I, KEY_K, KEY_L, |
| 323 | KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q, |
| 324 | KEY_R, KEY_S, KEY_T, KEY_U, KEY_V, |
| 325 | }, |
| 326 | }; |
| 327 | |
| 328 | static struct resource keysc_resources[] = { |
| 329 | [0] = { |
Magnus Damm | 9747e78b | 2009-08-15 02:53:34 +0000 | [diff] [blame] | 330 | .name = "KEYSC", |
| 331 | .start = 0x044b0000, |
| 332 | .end = 0x044b000f, |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 333 | .flags = IORESOURCE_MEM, |
| 334 | }, |
| 335 | [1] = { |
Magnus Damm | 9747e78b | 2009-08-15 02:53:34 +0000 | [diff] [blame] | 336 | .start = 79, |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 337 | .flags = IORESOURCE_IRQ, |
| 338 | }, |
| 339 | }; |
| 340 | |
| 341 | static struct platform_device keysc_device = { |
| 342 | .name = "sh_keysc", |
| 343 | .id = 0, /* "keysc0" clock */ |
| 344 | .num_resources = ARRAY_SIZE(keysc_resources), |
| 345 | .resource = keysc_resources, |
| 346 | .dev = { |
| 347 | .platform_data = &keysc_info, |
| 348 | }, |
Magnus Damm | df47cd0 | 2009-07-31 07:48:29 +0000 | [diff] [blame] | 349 | .archdata = { |
| 350 | .hwblk_id = HWBLK_KEYSC, |
| 351 | }, |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 352 | }; |
| 353 | |
Kuninori Morimoto | a80cad9 | 2009-06-26 07:05:39 +0000 | [diff] [blame] | 354 | /* SH Eth */ |
| 355 | static struct resource sh_eth_resources[] = { |
| 356 | [0] = { |
| 357 | .start = SH_ETH_ADDR, |
| 358 | .end = SH_ETH_ADDR + 0x1FC, |
| 359 | .flags = IORESOURCE_MEM, |
| 360 | }, |
| 361 | [1] = { |
| 362 | .start = 91, |
| 363 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 364 | }, |
| 365 | }; |
| 366 | |
| 367 | struct sh_eth_plat_data sh_eth_plat = { |
| 368 | .phy = 0x1f, /* SMSC LAN8187 */ |
| 369 | .edmac_endian = EDMAC_LITTLE_ENDIAN, |
| 370 | }; |
| 371 | |
| 372 | static struct platform_device sh_eth_device = { |
| 373 | .name = "sh-eth", |
| 374 | .id = 0, |
| 375 | .dev = { |
| 376 | .platform_data = &sh_eth_plat, |
| 377 | }, |
| 378 | .num_resources = ARRAY_SIZE(sh_eth_resources), |
| 379 | .resource = sh_eth_resources, |
Magnus Damm | df47cd0 | 2009-07-31 07:48:29 +0000 | [diff] [blame] | 380 | .archdata = { |
| 381 | .hwblk_id = HWBLK_ETHER, |
| 382 | }, |
Kuninori Morimoto | a80cad9 | 2009-06-26 07:05:39 +0000 | [diff] [blame] | 383 | }; |
| 384 | |
Magnus Damm | 9731f4a | 2009-07-03 09:40:03 +0000 | [diff] [blame] | 385 | static struct r8a66597_platdata sh7724_usb0_host_data = { |
Magnus Damm | 719a72b | 2009-07-17 14:59:55 +0000 | [diff] [blame] | 386 | .on_chip = 1, |
Magnus Damm | 9731f4a | 2009-07-03 09:40:03 +0000 | [diff] [blame] | 387 | }; |
| 388 | |
| 389 | static struct resource sh7724_usb0_host_resources[] = { |
| 390 | [0] = { |
| 391 | .start = 0xa4d80000, |
Kuninori Morimoto | 1bc265d | 2009-08-19 00:12:15 +0000 | [diff] [blame] | 392 | .end = 0xa4d80124 - 1, |
Magnus Damm | 9731f4a | 2009-07-03 09:40:03 +0000 | [diff] [blame] | 393 | .flags = IORESOURCE_MEM, |
| 394 | }, |
| 395 | [1] = { |
| 396 | .start = 65, |
| 397 | .end = 65, |
| 398 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, |
| 399 | }, |
| 400 | }; |
| 401 | |
| 402 | static struct platform_device sh7724_usb0_host_device = { |
| 403 | .name = "r8a66597_hcd", |
| 404 | .id = 0, |
| 405 | .dev = { |
| 406 | .dma_mask = NULL, /* not use dma */ |
| 407 | .coherent_dma_mask = 0xffffffff, |
| 408 | .platform_data = &sh7724_usb0_host_data, |
| 409 | }, |
| 410 | .num_resources = ARRAY_SIZE(sh7724_usb0_host_resources), |
| 411 | .resource = sh7724_usb0_host_resources, |
Magnus Damm | df47cd0 | 2009-07-31 07:48:29 +0000 | [diff] [blame] | 412 | .archdata = { |
| 413 | .hwblk_id = HWBLK_USB0, |
| 414 | }, |
Magnus Damm | 9731f4a | 2009-07-03 09:40:03 +0000 | [diff] [blame] | 415 | }; |
| 416 | |
Magnus Damm | f8f8c07 | 2009-08-19 09:52:02 +0000 | [diff] [blame] | 417 | static struct r8a66597_platdata sh7724_usb1_gadget_data = { |
| 418 | .on_chip = 1, |
| 419 | }; |
| 420 | |
| 421 | static struct resource sh7724_usb1_gadget_resources[] = { |
| 422 | [0] = { |
| 423 | .start = 0xa4d90000, |
| 424 | .end = 0xa4d90123, |
| 425 | .flags = IORESOURCE_MEM, |
| 426 | }, |
| 427 | [1] = { |
| 428 | .start = 66, |
| 429 | .end = 66, |
| 430 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, |
| 431 | }, |
| 432 | }; |
| 433 | |
| 434 | static struct platform_device sh7724_usb1_gadget_device = { |
| 435 | .name = "r8a66597_udc", |
| 436 | .id = 1, /* USB1 */ |
| 437 | .dev = { |
| 438 | .dma_mask = NULL, /* not use dma */ |
| 439 | .coherent_dma_mask = 0xffffffff, |
| 440 | .platform_data = &sh7724_usb1_gadget_data, |
| 441 | }, |
| 442 | .num_resources = ARRAY_SIZE(sh7724_usb1_gadget_resources), |
| 443 | .resource = sh7724_usb1_gadget_resources, |
| 444 | }; |
| 445 | |
Magnus Damm | 0f79af6 | 2009-10-02 02:23:07 +0000 | [diff] [blame] | 446 | static struct resource sdhi0_cn7_resources[] = { |
| 447 | [0] = { |
| 448 | .name = "SDHI0", |
| 449 | .start = 0x04ce0000, |
| 450 | .end = 0x04ce01ff, |
| 451 | .flags = IORESOURCE_MEM, |
| 452 | }, |
| 453 | [1] = { |
Magnus Damm | 3844ead | 2010-02-09 06:50:04 +0000 | [diff] [blame] | 454 | .start = 100, |
Magnus Damm | 0f79af6 | 2009-10-02 02:23:07 +0000 | [diff] [blame] | 455 | .flags = IORESOURCE_IRQ, |
| 456 | }, |
| 457 | }; |
| 458 | |
| 459 | static struct platform_device sdhi0_cn7_device = { |
| 460 | .name = "sh_mobile_sdhi", |
Magnus Damm | 5b380ec | 2009-10-27 10:49:55 +0000 | [diff] [blame] | 461 | .id = 0, |
Magnus Damm | 0f79af6 | 2009-10-02 02:23:07 +0000 | [diff] [blame] | 462 | .num_resources = ARRAY_SIZE(sdhi0_cn7_resources), |
| 463 | .resource = sdhi0_cn7_resources, |
| 464 | .archdata = { |
| 465 | .hwblk_id = HWBLK_SDHI0, |
| 466 | }, |
| 467 | }; |
| 468 | |
Magnus Damm | 5b380ec | 2009-10-27 10:49:55 +0000 | [diff] [blame] | 469 | static struct resource sdhi1_cn8_resources[] = { |
| 470 | [0] = { |
| 471 | .name = "SDHI1", |
| 472 | .start = 0x04cf0000, |
| 473 | .end = 0x04cf01ff, |
| 474 | .flags = IORESOURCE_MEM, |
| 475 | }, |
| 476 | [1] = { |
Magnus Damm | 3844ead | 2010-02-09 06:50:04 +0000 | [diff] [blame] | 477 | .start = 23, |
Magnus Damm | 5b380ec | 2009-10-27 10:49:55 +0000 | [diff] [blame] | 478 | .flags = IORESOURCE_IRQ, |
| 479 | }, |
| 480 | }; |
| 481 | |
| 482 | static struct platform_device sdhi1_cn8_device = { |
| 483 | .name = "sh_mobile_sdhi", |
| 484 | .id = 1, |
| 485 | .num_resources = ARRAY_SIZE(sdhi1_cn8_resources), |
| 486 | .resource = sdhi1_cn8_resources, |
| 487 | .archdata = { |
| 488 | .hwblk_id = HWBLK_SDHI1, |
| 489 | }, |
| 490 | }; |
| 491 | |
Kuninori Morimoto | bbb892a | 2010-02-23 08:19:14 +0000 | [diff] [blame^] | 492 | /* IrDA */ |
| 493 | static struct resource irda_resources[] = { |
| 494 | [0] = { |
| 495 | .name = "IrDA", |
| 496 | .start = 0xA45D0000, |
| 497 | .end = 0xA45D0049, |
| 498 | .flags = IORESOURCE_MEM, |
| 499 | }, |
| 500 | [1] = { |
| 501 | .start = 20, |
| 502 | .flags = IORESOURCE_IRQ, |
| 503 | }, |
| 504 | }; |
| 505 | |
| 506 | static struct platform_device irda_device = { |
| 507 | .name = "sh_sir", |
| 508 | .num_resources = ARRAY_SIZE(irda_resources), |
| 509 | .resource = irda_resources, |
| 510 | }; |
| 511 | |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 512 | static struct platform_device *ms7724se_devices[] __initdata = { |
| 513 | &heartbeat_device, |
| 514 | &smc91x_eth_device, |
| 515 | &lcdc_device, |
| 516 | &nor_flash_device, |
| 517 | &ceu0_device, |
| 518 | &ceu1_device, |
| 519 | &keysc_device, |
Kuninori Morimoto | a80cad9 | 2009-06-26 07:05:39 +0000 | [diff] [blame] | 520 | &sh_eth_device, |
Magnus Damm | 9731f4a | 2009-07-03 09:40:03 +0000 | [diff] [blame] | 521 | &sh7724_usb0_host_device, |
Magnus Damm | f8f8c07 | 2009-08-19 09:52:02 +0000 | [diff] [blame] | 522 | &sh7724_usb1_gadget_device, |
Kuninori Morimoto | 3e9ad52 | 2009-08-21 01:24:54 +0000 | [diff] [blame] | 523 | &fsi_device, |
Magnus Damm | 0f79af6 | 2009-10-02 02:23:07 +0000 | [diff] [blame] | 524 | &sdhi0_cn7_device, |
Magnus Damm | 5b380ec | 2009-10-27 10:49:55 +0000 | [diff] [blame] | 525 | &sdhi1_cn8_device, |
Kuninori Morimoto | bbb892a | 2010-02-23 08:19:14 +0000 | [diff] [blame^] | 526 | &irda_device, |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 527 | }; |
| 528 | |
Kuninori Morimoto | 9f815a1 | 2009-12-15 00:27:57 +0000 | [diff] [blame] | 529 | /* I2C device */ |
| 530 | static struct i2c_board_info i2c0_devices[] = { |
| 531 | { |
| 532 | I2C_BOARD_INFO("ak4642", 0x12), |
| 533 | }, |
| 534 | }; |
| 535 | |
Kuninori Morimoto | a80cad9 | 2009-06-26 07:05:39 +0000 | [diff] [blame] | 536 | #define EEPROM_OP 0xBA206000 |
| 537 | #define EEPROM_ADR 0xBA206004 |
| 538 | #define EEPROM_DATA 0xBA20600C |
| 539 | #define EEPROM_STAT 0xBA206010 |
| 540 | #define EEPROM_STRT 0xBA206014 |
| 541 | static int __init sh_eth_is_eeprom_ready(void) |
| 542 | { |
| 543 | int t = 10000; |
| 544 | |
| 545 | while (t--) { |
Paul Mundt | 9d56dd3 | 2010-01-26 12:58:40 +0900 | [diff] [blame] | 546 | if (!__raw_readw(EEPROM_STAT)) |
Kuninori Morimoto | a80cad9 | 2009-06-26 07:05:39 +0000 | [diff] [blame] | 547 | return 1; |
Kuninori Morimoto | c718aff | 2009-12-24 08:31:44 +0000 | [diff] [blame] | 548 | udelay(1); |
Kuninori Morimoto | a80cad9 | 2009-06-26 07:05:39 +0000 | [diff] [blame] | 549 | } |
| 550 | |
| 551 | printk(KERN_ERR "ms7724se can not access to eeprom\n"); |
| 552 | return 0; |
| 553 | } |
| 554 | |
| 555 | static void __init sh_eth_init(void) |
| 556 | { |
| 557 | int i; |
Magnus Damm | 8013cc9 | 2009-10-27 10:47:34 +0000 | [diff] [blame] | 558 | u16 mac; |
Kuninori Morimoto | a80cad9 | 2009-06-26 07:05:39 +0000 | [diff] [blame] | 559 | |
| 560 | /* check EEPROM status */ |
| 561 | if (!sh_eth_is_eeprom_ready()) |
| 562 | return; |
| 563 | |
| 564 | /* read MAC addr from EEPROM */ |
| 565 | for (i = 0 ; i < 3 ; i++) { |
Paul Mundt | 9d56dd3 | 2010-01-26 12:58:40 +0900 | [diff] [blame] | 566 | __raw_writew(0x0, EEPROM_OP); /* read */ |
| 567 | __raw_writew(i*2, EEPROM_ADR); |
| 568 | __raw_writew(0x1, EEPROM_STRT); |
Kuninori Morimoto | a80cad9 | 2009-06-26 07:05:39 +0000 | [diff] [blame] | 569 | if (!sh_eth_is_eeprom_ready()) |
| 570 | return; |
| 571 | |
Paul Mundt | 9d56dd3 | 2010-01-26 12:58:40 +0900 | [diff] [blame] | 572 | mac = __raw_readw(EEPROM_DATA); |
Magnus Damm | 8013cc9 | 2009-10-27 10:47:34 +0000 | [diff] [blame] | 573 | sh_eth_plat.mac_addr[i << 1] = mac & 0xff; |
| 574 | sh_eth_plat.mac_addr[(i << 1) + 1] = mac >> 8; |
Kuninori Morimoto | a80cad9 | 2009-06-26 07:05:39 +0000 | [diff] [blame] | 575 | } |
Kuninori Morimoto | a80cad9 | 2009-06-26 07:05:39 +0000 | [diff] [blame] | 576 | } |
| 577 | |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 578 | #define SW4140 0xBA201000 |
| 579 | #define FPGA_OUT 0xBA200400 |
| 580 | #define PORT_HIZA 0xA4050158 |
Magnus Damm | 9731f4a | 2009-07-03 09:40:03 +0000 | [diff] [blame] | 581 | #define PORT_MSELCRB 0xA4050182 |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 582 | |
| 583 | #define SW41_A 0x0100 |
| 584 | #define SW41_B 0x0200 |
| 585 | #define SW41_C 0x0400 |
| 586 | #define SW41_D 0x0800 |
| 587 | #define SW41_E 0x1000 |
| 588 | #define SW41_F 0x2000 |
| 589 | #define SW41_G 0x4000 |
| 590 | #define SW41_H 0x8000 |
Magnus Damm | 9731f4a | 2009-07-03 09:40:03 +0000 | [diff] [blame] | 591 | |
Magnus Damm | 3b9f295 | 2009-10-29 10:52:23 +0000 | [diff] [blame] | 592 | extern char ms7724se_sdram_enter_start; |
| 593 | extern char ms7724se_sdram_enter_end; |
| 594 | extern char ms7724se_sdram_leave_start; |
| 595 | extern char ms7724se_sdram_leave_end; |
| 596 | |
Kuninori Morimoto | 9f815a1 | 2009-12-15 00:27:57 +0000 | [diff] [blame] | 597 | |
| 598 | static int __init arch_setup(void) |
| 599 | { |
| 600 | /* enable I2C device */ |
| 601 | i2c_register_board_info(0, i2c0_devices, |
| 602 | ARRAY_SIZE(i2c0_devices)); |
| 603 | return 0; |
| 604 | } |
| 605 | arch_initcall(arch_setup); |
| 606 | |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 607 | static int __init devices_setup(void) |
| 608 | { |
Paul Mundt | 9d56dd3 | 2010-01-26 12:58:40 +0900 | [diff] [blame] | 609 | u16 sw = __raw_readw(SW4140); /* select camera, monitor */ |
Kuninori Morimoto | 16afc9f | 2010-02-22 05:18:10 +0000 | [diff] [blame] | 610 | struct clk *clk; |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 611 | |
Magnus Damm | 3b9f295 | 2009-10-29 10:52:23 +0000 | [diff] [blame] | 612 | /* register board specific self-refresh code */ |
| 613 | sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF, |
| 614 | &ms7724se_sdram_enter_start, |
| 615 | &ms7724se_sdram_enter_end, |
| 616 | &ms7724se_sdram_leave_start, |
| 617 | &ms7724se_sdram_leave_end); |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 618 | /* Reset Release */ |
Paul Mundt | 9d56dd3 | 2010-01-26 12:58:40 +0900 | [diff] [blame] | 619 | __raw_writew(__raw_readw(FPGA_OUT) & |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 620 | ~((1 << 1) | /* LAN */ |
| 621 | (1 << 6) | /* VIDEO DAC */ |
Kuninori Morimoto | 3e9ad52 | 2009-08-21 01:24:54 +0000 | [diff] [blame] | 622 | (1 << 7) | /* AK4643 */ |
Kuninori Morimoto | bbb892a | 2010-02-23 08:19:14 +0000 | [diff] [blame^] | 623 | (1 << 8) | /* IrDA */ |
Kuninori Morimoto | a80cad9 | 2009-06-26 07:05:39 +0000 | [diff] [blame] | 624 | (1 << 12) | /* USB0 */ |
| 625 | (1 << 14)), /* RMII */ |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 626 | FPGA_OUT); |
| 627 | |
Magnus Damm | 9731f4a | 2009-07-03 09:40:03 +0000 | [diff] [blame] | 628 | /* turn on USB clocks, use external clock */ |
Paul Mundt | 9d56dd3 | 2010-01-26 12:58:40 +0900 | [diff] [blame] | 629 | __raw_writew((__raw_readw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB); |
Magnus Damm | 9731f4a | 2009-07-03 09:40:03 +0000 | [diff] [blame] | 630 | |
Magnus Damm | 7766e16 | 2009-08-06 15:03:43 +0000 | [diff] [blame] | 631 | #ifdef CONFIG_PM |
| 632 | /* Let LED9 show STATUS2 */ |
| 633 | gpio_request(GPIO_FN_STATUS2, NULL); |
| 634 | |
| 635 | /* Lit LED10 show STATUS0 */ |
| 636 | gpio_request(GPIO_FN_STATUS0, NULL); |
| 637 | |
| 638 | /* Lit LED11 show PDSTATUS */ |
| 639 | gpio_request(GPIO_FN_PDSTATUS, NULL); |
| 640 | #else |
| 641 | /* Lit LED9 */ |
| 642 | gpio_request(GPIO_PTJ6, NULL); |
| 643 | gpio_direction_output(GPIO_PTJ6, 1); |
| 644 | gpio_export(GPIO_PTJ6, 0); |
| 645 | |
| 646 | /* Lit LED10 */ |
| 647 | gpio_request(GPIO_PTJ5, NULL); |
| 648 | gpio_direction_output(GPIO_PTJ5, 1); |
| 649 | gpio_export(GPIO_PTJ5, 0); |
| 650 | |
| 651 | /* Lit LED11 */ |
| 652 | gpio_request(GPIO_PTJ7, NULL); |
| 653 | gpio_direction_output(GPIO_PTJ7, 1); |
| 654 | gpio_export(GPIO_PTJ7, 0); |
| 655 | #endif |
| 656 | |
Magnus Damm | 9731f4a | 2009-07-03 09:40:03 +0000 | [diff] [blame] | 657 | /* enable USB0 port */ |
Paul Mundt | 9d56dd3 | 2010-01-26 12:58:40 +0900 | [diff] [blame] | 658 | __raw_writew(0x0600, 0xa40501d4); |
Magnus Damm | 9731f4a | 2009-07-03 09:40:03 +0000 | [diff] [blame] | 659 | |
Magnus Damm | f8f8c07 | 2009-08-19 09:52:02 +0000 | [diff] [blame] | 660 | /* enable USB1 port */ |
Paul Mundt | 9d56dd3 | 2010-01-26 12:58:40 +0900 | [diff] [blame] | 661 | __raw_writew(0x0600, 0xa4050192); |
Magnus Damm | f8f8c07 | 2009-08-19 09:52:02 +0000 | [diff] [blame] | 662 | |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 663 | /* enable IRQ 0,1,2 */ |
| 664 | gpio_request(GPIO_FN_INTC_IRQ0, NULL); |
| 665 | gpio_request(GPIO_FN_INTC_IRQ1, NULL); |
| 666 | gpio_request(GPIO_FN_INTC_IRQ2, NULL); |
| 667 | |
| 668 | /* enable SCIFA3 */ |
| 669 | gpio_request(GPIO_FN_SCIF3_I_SCK, NULL); |
| 670 | gpio_request(GPIO_FN_SCIF3_I_RXD, NULL); |
| 671 | gpio_request(GPIO_FN_SCIF3_I_TXD, NULL); |
| 672 | gpio_request(GPIO_FN_SCIF3_I_CTS, NULL); |
| 673 | gpio_request(GPIO_FN_SCIF3_I_RTS, NULL); |
| 674 | |
| 675 | /* enable LCDC */ |
| 676 | gpio_request(GPIO_FN_LCDD23, NULL); |
| 677 | gpio_request(GPIO_FN_LCDD22, NULL); |
| 678 | gpio_request(GPIO_FN_LCDD21, NULL); |
| 679 | gpio_request(GPIO_FN_LCDD20, NULL); |
| 680 | gpio_request(GPIO_FN_LCDD19, NULL); |
| 681 | gpio_request(GPIO_FN_LCDD18, NULL); |
| 682 | gpio_request(GPIO_FN_LCDD17, NULL); |
| 683 | gpio_request(GPIO_FN_LCDD16, NULL); |
| 684 | gpio_request(GPIO_FN_LCDD15, NULL); |
| 685 | gpio_request(GPIO_FN_LCDD14, NULL); |
| 686 | gpio_request(GPIO_FN_LCDD13, NULL); |
| 687 | gpio_request(GPIO_FN_LCDD12, NULL); |
| 688 | gpio_request(GPIO_FN_LCDD11, NULL); |
| 689 | gpio_request(GPIO_FN_LCDD10, NULL); |
| 690 | gpio_request(GPIO_FN_LCDD9, NULL); |
| 691 | gpio_request(GPIO_FN_LCDD8, NULL); |
| 692 | gpio_request(GPIO_FN_LCDD7, NULL); |
| 693 | gpio_request(GPIO_FN_LCDD6, NULL); |
| 694 | gpio_request(GPIO_FN_LCDD5, NULL); |
| 695 | gpio_request(GPIO_FN_LCDD4, NULL); |
| 696 | gpio_request(GPIO_FN_LCDD3, NULL); |
| 697 | gpio_request(GPIO_FN_LCDD2, NULL); |
| 698 | gpio_request(GPIO_FN_LCDD1, NULL); |
| 699 | gpio_request(GPIO_FN_LCDD0, NULL); |
| 700 | gpio_request(GPIO_FN_LCDDISP, NULL); |
| 701 | gpio_request(GPIO_FN_LCDHSYN, NULL); |
| 702 | gpio_request(GPIO_FN_LCDDCK, NULL); |
| 703 | gpio_request(GPIO_FN_LCDVSYN, NULL); |
| 704 | gpio_request(GPIO_FN_LCDDON, NULL); |
| 705 | gpio_request(GPIO_FN_LCDVEPWC, NULL); |
| 706 | gpio_request(GPIO_FN_LCDVCPWC, NULL); |
| 707 | gpio_request(GPIO_FN_LCDRD, NULL); |
| 708 | gpio_request(GPIO_FN_LCDLCLK, NULL); |
Paul Mundt | 9d56dd3 | 2010-01-26 12:58:40 +0900 | [diff] [blame] | 709 | __raw_writew((__raw_readw(PORT_HIZA) & ~0x0001), PORT_HIZA); |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 710 | |
| 711 | /* enable CEU0 */ |
| 712 | gpio_request(GPIO_FN_VIO0_D15, NULL); |
| 713 | gpio_request(GPIO_FN_VIO0_D14, NULL); |
| 714 | gpio_request(GPIO_FN_VIO0_D13, NULL); |
| 715 | gpio_request(GPIO_FN_VIO0_D12, NULL); |
| 716 | gpio_request(GPIO_FN_VIO0_D11, NULL); |
| 717 | gpio_request(GPIO_FN_VIO0_D10, NULL); |
| 718 | gpio_request(GPIO_FN_VIO0_D9, NULL); |
| 719 | gpio_request(GPIO_FN_VIO0_D8, NULL); |
| 720 | gpio_request(GPIO_FN_VIO0_D7, NULL); |
| 721 | gpio_request(GPIO_FN_VIO0_D6, NULL); |
| 722 | gpio_request(GPIO_FN_VIO0_D5, NULL); |
| 723 | gpio_request(GPIO_FN_VIO0_D4, NULL); |
| 724 | gpio_request(GPIO_FN_VIO0_D3, NULL); |
| 725 | gpio_request(GPIO_FN_VIO0_D2, NULL); |
| 726 | gpio_request(GPIO_FN_VIO0_D1, NULL); |
| 727 | gpio_request(GPIO_FN_VIO0_D0, NULL); |
| 728 | gpio_request(GPIO_FN_VIO0_VD, NULL); |
| 729 | gpio_request(GPIO_FN_VIO0_CLK, NULL); |
| 730 | gpio_request(GPIO_FN_VIO0_FLD, NULL); |
| 731 | gpio_request(GPIO_FN_VIO0_HD, NULL); |
Magnus Damm | 84f7597 | 2009-07-01 04:55:35 +0000 | [diff] [blame] | 732 | platform_resource_setup_memory(&ceu0_device, "ceu0", 4 << 20); |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 733 | |
| 734 | /* enable CEU1 */ |
| 735 | gpio_request(GPIO_FN_VIO1_D7, NULL); |
| 736 | gpio_request(GPIO_FN_VIO1_D6, NULL); |
| 737 | gpio_request(GPIO_FN_VIO1_D5, NULL); |
| 738 | gpio_request(GPIO_FN_VIO1_D4, NULL); |
| 739 | gpio_request(GPIO_FN_VIO1_D3, NULL); |
| 740 | gpio_request(GPIO_FN_VIO1_D2, NULL); |
| 741 | gpio_request(GPIO_FN_VIO1_D1, NULL); |
| 742 | gpio_request(GPIO_FN_VIO1_D0, NULL); |
| 743 | gpio_request(GPIO_FN_VIO1_FLD, NULL); |
| 744 | gpio_request(GPIO_FN_VIO1_HD, NULL); |
| 745 | gpio_request(GPIO_FN_VIO1_VD, NULL); |
| 746 | gpio_request(GPIO_FN_VIO1_CLK, NULL); |
Magnus Damm | 84f7597 | 2009-07-01 04:55:35 +0000 | [diff] [blame] | 747 | platform_resource_setup_memory(&ceu1_device, "ceu1", 4 << 20); |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 748 | |
| 749 | /* KEYSC */ |
| 750 | gpio_request(GPIO_FN_KEYOUT5_IN5, NULL); |
| 751 | gpio_request(GPIO_FN_KEYOUT4_IN6, NULL); |
| 752 | gpio_request(GPIO_FN_KEYIN4, NULL); |
| 753 | gpio_request(GPIO_FN_KEYIN3, NULL); |
| 754 | gpio_request(GPIO_FN_KEYIN2, NULL); |
| 755 | gpio_request(GPIO_FN_KEYIN1, NULL); |
| 756 | gpio_request(GPIO_FN_KEYIN0, NULL); |
| 757 | gpio_request(GPIO_FN_KEYOUT3, NULL); |
| 758 | gpio_request(GPIO_FN_KEYOUT2, NULL); |
| 759 | gpio_request(GPIO_FN_KEYOUT1, NULL); |
| 760 | gpio_request(GPIO_FN_KEYOUT0, NULL); |
| 761 | |
Kuninori Morimoto | 3e9ad52 | 2009-08-21 01:24:54 +0000 | [diff] [blame] | 762 | /* enable FSI */ |
| 763 | gpio_request(GPIO_FN_FSIMCKB, NULL); |
| 764 | gpio_request(GPIO_FN_FSIMCKA, NULL); |
| 765 | gpio_request(GPIO_FN_FSIOASD, NULL); |
| 766 | gpio_request(GPIO_FN_FSIIABCK, NULL); |
| 767 | gpio_request(GPIO_FN_FSIIALRCK, NULL); |
| 768 | gpio_request(GPIO_FN_FSIOABCK, NULL); |
| 769 | gpio_request(GPIO_FN_FSIOALRCK, NULL); |
| 770 | gpio_request(GPIO_FN_CLKAUDIOAO, NULL); |
| 771 | gpio_request(GPIO_FN_FSIIBSD, NULL); |
| 772 | gpio_request(GPIO_FN_FSIOBSD, NULL); |
| 773 | gpio_request(GPIO_FN_FSIIBBCK, NULL); |
| 774 | gpio_request(GPIO_FN_FSIIBLRCK, NULL); |
| 775 | gpio_request(GPIO_FN_FSIOBBCK, NULL); |
| 776 | gpio_request(GPIO_FN_FSIOBLRCK, NULL); |
| 777 | gpio_request(GPIO_FN_CLKAUDIOBO, NULL); |
| 778 | gpio_request(GPIO_FN_FSIIASD, NULL); |
| 779 | |
Kuninori Morimoto | 16afc9f | 2010-02-22 05:18:10 +0000 | [diff] [blame] | 780 | /* set SPU2 clock to 83.4 MHz */ |
| 781 | clk = clk_get(NULL, "spu_clk"); |
| 782 | clk_set_rate(clk, clk_round_rate(clk, 83333333)); |
| 783 | clk_put(clk); |
| 784 | |
Kuninori Morimoto | 3e9ad52 | 2009-08-21 01:24:54 +0000 | [diff] [blame] | 785 | /* change parent of FSI A */ |
Kuninori Morimoto | 16afc9f | 2010-02-22 05:18:10 +0000 | [diff] [blame] | 786 | clk = clk_get(NULL, "fsia_clk"); |
Kuninori Morimoto | 3e9ad52 | 2009-08-21 01:24:54 +0000 | [diff] [blame] | 787 | clk_register(&fsimcka_clk); |
Kuninori Morimoto | 16afc9f | 2010-02-22 05:18:10 +0000 | [diff] [blame] | 788 | clk_set_parent(clk, &fsimcka_clk); |
| 789 | clk_set_rate(clk, 11000); |
Kuninori Morimoto | 3e9ad52 | 2009-08-21 01:24:54 +0000 | [diff] [blame] | 790 | clk_set_rate(&fsimcka_clk, 11000); |
Kuninori Morimoto | 16afc9f | 2010-02-22 05:18:10 +0000 | [diff] [blame] | 791 | clk_put(clk); |
Kuninori Morimoto | 3e9ad52 | 2009-08-21 01:24:54 +0000 | [diff] [blame] | 792 | |
Magnus Damm | 0f79af6 | 2009-10-02 02:23:07 +0000 | [diff] [blame] | 793 | /* SDHI0 connected to cn7 */ |
| 794 | gpio_request(GPIO_FN_SDHI0CD, NULL); |
| 795 | gpio_request(GPIO_FN_SDHI0WP, NULL); |
| 796 | gpio_request(GPIO_FN_SDHI0D3, NULL); |
| 797 | gpio_request(GPIO_FN_SDHI0D2, NULL); |
| 798 | gpio_request(GPIO_FN_SDHI0D1, NULL); |
| 799 | gpio_request(GPIO_FN_SDHI0D0, NULL); |
| 800 | gpio_request(GPIO_FN_SDHI0CMD, NULL); |
| 801 | gpio_request(GPIO_FN_SDHI0CLK, NULL); |
| 802 | |
Magnus Damm | 5b380ec | 2009-10-27 10:49:55 +0000 | [diff] [blame] | 803 | /* SDHI1 connected to cn8 */ |
| 804 | gpio_request(GPIO_FN_SDHI1CD, NULL); |
| 805 | gpio_request(GPIO_FN_SDHI1WP, NULL); |
| 806 | gpio_request(GPIO_FN_SDHI1D3, NULL); |
| 807 | gpio_request(GPIO_FN_SDHI1D2, NULL); |
| 808 | gpio_request(GPIO_FN_SDHI1D1, NULL); |
| 809 | gpio_request(GPIO_FN_SDHI1D0, NULL); |
| 810 | gpio_request(GPIO_FN_SDHI1CMD, NULL); |
| 811 | gpio_request(GPIO_FN_SDHI1CLK, NULL); |
| 812 | |
Kuninori Morimoto | bbb892a | 2010-02-23 08:19:14 +0000 | [diff] [blame^] | 813 | /* enable IrDA */ |
| 814 | gpio_request(GPIO_FN_IRDA_OUT, NULL); |
| 815 | gpio_request(GPIO_FN_IRDA_IN, NULL); |
| 816 | |
Kuninori Morimoto | a80cad9 | 2009-06-26 07:05:39 +0000 | [diff] [blame] | 817 | /* |
| 818 | * enable SH-Eth |
| 819 | * |
| 820 | * please remove J33 pin from your board !! |
| 821 | * |
| 822 | * ms7724 board should not use GPIO_FN_LNKSTA pin |
| 823 | * So, This time PTX5 is set to input pin |
| 824 | */ |
| 825 | gpio_request(GPIO_FN_RMII_RXD0, NULL); |
| 826 | gpio_request(GPIO_FN_RMII_RXD1, NULL); |
| 827 | gpio_request(GPIO_FN_RMII_TXD0, NULL); |
| 828 | gpio_request(GPIO_FN_RMII_TXD1, NULL); |
| 829 | gpio_request(GPIO_FN_RMII_REF_CLK, NULL); |
| 830 | gpio_request(GPIO_FN_RMII_TX_EN, NULL); |
| 831 | gpio_request(GPIO_FN_RMII_RX_ER, NULL); |
| 832 | gpio_request(GPIO_FN_RMII_CRS_DV, NULL); |
| 833 | gpio_request(GPIO_FN_MDIO, NULL); |
| 834 | gpio_request(GPIO_FN_MDC, NULL); |
| 835 | gpio_request(GPIO_PTX5, NULL); |
| 836 | gpio_direction_input(GPIO_PTX5); |
| 837 | sh_eth_init(); |
| 838 | |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 839 | if (sw & SW41_B) { |
Kuninori Morimoto | 4f32431 | 2009-08-03 04:52:03 +0000 | [diff] [blame] | 840 | /* 720p */ |
| 841 | lcdc_info.ch[0].lcd_cfg.xres = 1280; |
| 842 | lcdc_info.ch[0].lcd_cfg.yres = 720; |
| 843 | lcdc_info.ch[0].lcd_cfg.left_margin = 220; |
| 844 | lcdc_info.ch[0].lcd_cfg.right_margin = 110; |
| 845 | lcdc_info.ch[0].lcd_cfg.hsync_len = 40; |
| 846 | lcdc_info.ch[0].lcd_cfg.upper_margin = 20; |
| 847 | lcdc_info.ch[0].lcd_cfg.lower_margin = 5; |
| 848 | lcdc_info.ch[0].lcd_cfg.vsync_len = 5; |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 849 | } else { |
| 850 | /* VGA */ |
| 851 | lcdc_info.ch[0].lcd_cfg.xres = 640; |
| 852 | lcdc_info.ch[0].lcd_cfg.yres = 480; |
| 853 | lcdc_info.ch[0].lcd_cfg.left_margin = 105; |
| 854 | lcdc_info.ch[0].lcd_cfg.right_margin = 50; |
| 855 | lcdc_info.ch[0].lcd_cfg.hsync_len = 96; |
| 856 | lcdc_info.ch[0].lcd_cfg.upper_margin = 33; |
| 857 | lcdc_info.ch[0].lcd_cfg.lower_margin = 10; |
| 858 | lcdc_info.ch[0].lcd_cfg.vsync_len = 2; |
| 859 | } |
| 860 | |
| 861 | if (sw & SW41_A) { |
| 862 | /* Digital monitor */ |
| 863 | lcdc_info.ch[0].interface_type = RGB18; |
| 864 | lcdc_info.ch[0].flags = 0; |
| 865 | } else { |
| 866 | /* Analog monitor */ |
| 867 | lcdc_info.ch[0].interface_type = RGB24; |
| 868 | lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL; |
| 869 | } |
| 870 | |
| 871 | return platform_add_devices(ms7724se_devices, |
Kuninori Morimoto | a80cad9 | 2009-06-26 07:05:39 +0000 | [diff] [blame] | 872 | ARRAY_SIZE(ms7724se_devices)); |
Kuninori Morimoto | 287c129 | 2009-05-26 07:04:52 +0000 | [diff] [blame] | 873 | } |
| 874 | device_initcall(devices_setup); |
| 875 | |
| 876 | static struct sh_machine_vector mv_ms7724se __initmv = { |
| 877 | .mv_name = "ms7724se", |
| 878 | .mv_init_irq = init_se7724_IRQ, |
| 879 | .mv_nr_irqs = SE7724_FPGA_IRQ_BASE + SE7724_FPGA_IRQ_NR, |
| 880 | }; |