Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/sh/boards/se/7722/setup.c |
| 3 | * |
| 4 | * Copyright (C) 2007 Nobuhiro Iwamatsu |
| 5 | * |
| 6 | * Hitachi UL SolutionEngine 7722 Support. |
| 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/platform_device.h> |
Jeff Garzik | 0a87e3e | 2008-02-01 18:02:30 -0500 | [diff] [blame^] | 15 | #include <linux/ata_platform.h> |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 16 | #include <asm/machvec.h> |
| 17 | #include <asm/se7722.h> |
| 18 | #include <asm/io.h> |
Nobuhiro Iwamatsu | 9c88b6b | 2007-11-07 14:56:46 +0900 | [diff] [blame] | 19 | #include <asm/heartbeat.h> |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 20 | |
| 21 | /* Heartbeat */ |
Nobuhiro Iwamatsu | 9c88b6b | 2007-11-07 14:56:46 +0900 | [diff] [blame] | 22 | static struct heartbeat_data heartbeat_data = { |
| 23 | .regsize = 16, |
| 24 | }; |
| 25 | |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 26 | static struct resource heartbeat_resources[] = { |
| 27 | [0] = { |
| 28 | .start = PA_LED, |
Paul Mundt | a1fd306 | 2007-08-23 15:11:44 +0900 | [diff] [blame] | 29 | .end = PA_LED, |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 30 | .flags = IORESOURCE_MEM, |
| 31 | }, |
| 32 | }; |
| 33 | |
| 34 | static struct platform_device heartbeat_device = { |
| 35 | .name = "heartbeat", |
| 36 | .id = -1, |
Nobuhiro Iwamatsu | 9c88b6b | 2007-11-07 14:56:46 +0900 | [diff] [blame] | 37 | .dev = { |
| 38 | .platform_data = &heartbeat_data, |
| 39 | }, |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 40 | .num_resources = ARRAY_SIZE(heartbeat_resources), |
| 41 | .resource = heartbeat_resources, |
| 42 | }; |
| 43 | |
| 44 | /* SMC91x */ |
| 45 | static struct resource smc91x_eth_resources[] = { |
| 46 | [0] = { |
| 47 | .name = "smc91x-regs" , |
| 48 | .start = PA_LAN + 0x300, |
| 49 | .end = PA_LAN + 0x300 + 0x10 , |
| 50 | .flags = IORESOURCE_MEM, |
| 51 | }, |
| 52 | [1] = { |
| 53 | .start = SMC_IRQ, |
| 54 | .end = SMC_IRQ, |
| 55 | .flags = IORESOURCE_IRQ, |
| 56 | }, |
| 57 | }; |
| 58 | |
| 59 | static struct platform_device smc91x_eth_device = { |
| 60 | .name = "smc91x", |
| 61 | .id = 0, |
| 62 | .dev = { |
| 63 | .dma_mask = NULL, /* don't use dma */ |
| 64 | .coherent_dma_mask = 0xffffffff, |
| 65 | }, |
| 66 | .num_resources = ARRAY_SIZE(smc91x_eth_resources), |
| 67 | .resource = smc91x_eth_resources, |
| 68 | }; |
| 69 | |
| 70 | static struct resource cf_ide_resources[] = { |
| 71 | [0] = { |
| 72 | .start = PA_MRSHPC_IO + 0x1f0, |
| 73 | .end = PA_MRSHPC_IO + 0x1f0 + 8 , |
| 74 | .flags = IORESOURCE_IO, |
| 75 | }, |
| 76 | [1] = { |
| 77 | .start = PA_MRSHPC_IO + 0x1f0 + 0x206, |
| 78 | .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8, |
| 79 | .flags = IORESOURCE_IO, |
| 80 | }, |
| 81 | [2] = { |
| 82 | .start = MRSHPC_IRQ0, |
Magnus Damm | 493a358 | 2007-07-18 17:54:10 +0900 | [diff] [blame] | 83 | .end = MRSHPC_IRQ0, |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 84 | .flags = IORESOURCE_IRQ, |
| 85 | }, |
| 86 | }; |
| 87 | |
| 88 | static struct platform_device cf_ide_device = { |
| 89 | .name = "pata_platform", |
| 90 | .id = -1, |
| 91 | .num_resources = ARRAY_SIZE(cf_ide_resources), |
| 92 | .resource = cf_ide_resources, |
| 93 | }; |
| 94 | |
| 95 | static struct platform_device *se7722_devices[] __initdata = { |
| 96 | &heartbeat_device, |
| 97 | &smc91x_eth_device, |
| 98 | &cf_ide_device, |
| 99 | }; |
| 100 | |
| 101 | static int __init se7722_devices_setup(void) |
| 102 | { |
| 103 | return platform_add_devices(se7722_devices, |
| 104 | ARRAY_SIZE(se7722_devices)); |
| 105 | } |
| 106 | device_initcall(se7722_devices_setup); |
| 107 | |
| 108 | static void __init se7722_setup(char **cmdline_p) |
| 109 | { |
| 110 | ctrl_outw(0x010D, FPGA_OUT); /* FPGA */ |
| 111 | |
| 112 | ctrl_outl(0x00051001, MSTPCR0); |
| 113 | ctrl_outl(0x00000000, MSTPCR1); |
Yoshihiro Shimoda | 16f393d | 2007-10-30 13:05:51 +0900 | [diff] [blame] | 114 | /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC, USB */ |
| 115 | ctrl_outl(0xffffb7c0, MSTPCR2); |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 116 | |
| 117 | ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */ |
| 118 | ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */ |
| 119 | |
| 120 | /* LCDC I/O */ |
| 121 | ctrl_outw(0x0020, PORT_PSELD); |
| 122 | |
| 123 | /* SIOF1*/ |
| 124 | ctrl_outw(0x0003, PORT_PSELB); |
| 125 | ctrl_outw(0xe000, PORT_PSELC); |
| 126 | ctrl_outw(0x0000, PORT_PKCR); |
| 127 | |
| 128 | /* LCDC */ |
| 129 | ctrl_outw(0x4020, PORT_PHCR); |
| 130 | ctrl_outw(0x0000, PORT_PLCR); |
| 131 | ctrl_outw(0x0000, PORT_PMCR); |
| 132 | ctrl_outw(0x0002, PORT_PRCR); |
| 133 | ctrl_outw(0x0000, PORT_PXCR); /* LCDC,CS6A */ |
| 134 | |
| 135 | /* KEYSC */ |
| 136 | ctrl_outw(0x0A10, PORT_PSELA); /* BS,SHHID2 */ |
| 137 | ctrl_outw(0x0000, PORT_PYCR); |
| 138 | ctrl_outw(0x0000, PORT_PZCR); |
| 139 | } |
| 140 | |
| 141 | /* |
| 142 | * The Machine Vector |
| 143 | */ |
Paul Mundt | 82f81f4 | 2007-05-15 15:19:34 +0900 | [diff] [blame] | 144 | static struct sh_machine_vector mv_se7722 __initmv = { |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 145 | .mv_name = "Solution Engine 7722" , |
| 146 | .mv_setup = se7722_setup , |
Magnus Damm | 493a358 | 2007-07-18 17:54:10 +0900 | [diff] [blame] | 147 | .mv_nr_irqs = SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_NR, |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 148 | .mv_init_irq = init_se7722_IRQ, |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 149 | }; |