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> |
Magnus Damm | 90fce7f | 2008-03-04 15:23:46 -0800 | [diff] [blame] | 16 | #include <linux/input.h> |
Magnus Damm | 57b84f2 | 2008-04-23 20:18:04 +0900 | [diff] [blame] | 17 | #include <linux/smc91x.h> |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 18 | #include <asm/machvec.h> |
| 19 | #include <asm/se7722.h> |
| 20 | #include <asm/io.h> |
Nobuhiro Iwamatsu | 9c88b6b | 2007-11-07 14:56:46 +0900 | [diff] [blame] | 21 | #include <asm/heartbeat.h> |
Magnus Damm | 90fce7f | 2008-03-04 15:23:46 -0800 | [diff] [blame] | 22 | #include <asm/sh_keysc.h> |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 23 | |
| 24 | /* Heartbeat */ |
Nobuhiro Iwamatsu | 9c88b6b | 2007-11-07 14:56:46 +0900 | [diff] [blame] | 25 | static struct heartbeat_data heartbeat_data = { |
| 26 | .regsize = 16, |
| 27 | }; |
| 28 | |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 29 | static struct resource heartbeat_resources[] = { |
| 30 | [0] = { |
| 31 | .start = PA_LED, |
Paul Mundt | a1fd306 | 2007-08-23 15:11:44 +0900 | [diff] [blame] | 32 | .end = PA_LED, |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 33 | .flags = IORESOURCE_MEM, |
| 34 | }, |
| 35 | }; |
| 36 | |
| 37 | static struct platform_device heartbeat_device = { |
| 38 | .name = "heartbeat", |
| 39 | .id = -1, |
Nobuhiro Iwamatsu | 9c88b6b | 2007-11-07 14:56:46 +0900 | [diff] [blame] | 40 | .dev = { |
| 41 | .platform_data = &heartbeat_data, |
| 42 | }, |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 43 | .num_resources = ARRAY_SIZE(heartbeat_resources), |
| 44 | .resource = heartbeat_resources, |
| 45 | }; |
| 46 | |
| 47 | /* SMC91x */ |
Magnus Damm | 57b84f2 | 2008-04-23 20:18:04 +0900 | [diff] [blame] | 48 | static struct smc91x_platdata smc91x_info = { |
| 49 | .flags = SMC91X_USE_16BIT, |
| 50 | }; |
| 51 | |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 52 | static struct resource smc91x_eth_resources[] = { |
| 53 | [0] = { |
| 54 | .name = "smc91x-regs" , |
| 55 | .start = PA_LAN + 0x300, |
| 56 | .end = PA_LAN + 0x300 + 0x10 , |
| 57 | .flags = IORESOURCE_MEM, |
| 58 | }, |
| 59 | [1] = { |
| 60 | .start = SMC_IRQ, |
| 61 | .end = SMC_IRQ, |
| 62 | .flags = IORESOURCE_IRQ, |
| 63 | }, |
| 64 | }; |
| 65 | |
| 66 | static struct platform_device smc91x_eth_device = { |
| 67 | .name = "smc91x", |
| 68 | .id = 0, |
| 69 | .dev = { |
| 70 | .dma_mask = NULL, /* don't use dma */ |
| 71 | .coherent_dma_mask = 0xffffffff, |
Magnus Damm | 57b84f2 | 2008-04-23 20:18:04 +0900 | [diff] [blame] | 72 | .platform_data = &smc91x_info, |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 73 | }, |
| 74 | .num_resources = ARRAY_SIZE(smc91x_eth_resources), |
| 75 | .resource = smc91x_eth_resources, |
| 76 | }; |
| 77 | |
| 78 | static struct resource cf_ide_resources[] = { |
| 79 | [0] = { |
| 80 | .start = PA_MRSHPC_IO + 0x1f0, |
| 81 | .end = PA_MRSHPC_IO + 0x1f0 + 8 , |
| 82 | .flags = IORESOURCE_IO, |
| 83 | }, |
| 84 | [1] = { |
| 85 | .start = PA_MRSHPC_IO + 0x1f0 + 0x206, |
| 86 | .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8, |
| 87 | .flags = IORESOURCE_IO, |
| 88 | }, |
| 89 | [2] = { |
| 90 | .start = MRSHPC_IRQ0, |
Magnus Damm | 493a358 | 2007-07-18 17:54:10 +0900 | [diff] [blame] | 91 | .end = MRSHPC_IRQ0, |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 92 | .flags = IORESOURCE_IRQ, |
| 93 | }, |
| 94 | }; |
| 95 | |
| 96 | static struct platform_device cf_ide_device = { |
| 97 | .name = "pata_platform", |
| 98 | .id = -1, |
| 99 | .num_resources = ARRAY_SIZE(cf_ide_resources), |
| 100 | .resource = cf_ide_resources, |
| 101 | }; |
| 102 | |
Magnus Damm | 90fce7f | 2008-03-04 15:23:46 -0800 | [diff] [blame] | 103 | static struct sh_keysc_info sh_keysc_info = { |
| 104 | .mode = SH_KEYSC_MODE_1, /* KEYOUT0->5, KEYIN0->4 */ |
| 105 | .scan_timing = 3, |
| 106 | .delay = 5, |
| 107 | .keycodes = { /* SW1 -> SW30 */ |
| 108 | KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, |
| 109 | KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, |
| 110 | KEY_K, KEY_L, KEY_M, KEY_N, KEY_O, |
| 111 | KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, |
| 112 | KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, |
| 113 | KEY_Z, |
| 114 | KEY_HOME, KEY_SLEEP, KEY_WAKEUP, KEY_COFFEE, /* life */ |
| 115 | }, |
| 116 | }; |
| 117 | |
| 118 | static struct resource sh_keysc_resources[] = { |
| 119 | [0] = { |
| 120 | .start = 0x044b0000, |
| 121 | .end = 0x044b000f, |
| 122 | .flags = IORESOURCE_MEM, |
| 123 | }, |
| 124 | [1] = { |
| 125 | .start = 79, |
| 126 | .flags = IORESOURCE_IRQ, |
| 127 | }, |
| 128 | }; |
| 129 | |
| 130 | static struct platform_device sh_keysc_device = { |
| 131 | .name = "sh_keysc", |
| 132 | .num_resources = ARRAY_SIZE(sh_keysc_resources), |
| 133 | .resource = sh_keysc_resources, |
| 134 | .dev = { |
| 135 | .platform_data = &sh_keysc_info, |
| 136 | }, |
| 137 | }; |
| 138 | |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 139 | static struct platform_device *se7722_devices[] __initdata = { |
| 140 | &heartbeat_device, |
| 141 | &smc91x_eth_device, |
| 142 | &cf_ide_device, |
Magnus Damm | 90fce7f | 2008-03-04 15:23:46 -0800 | [diff] [blame] | 143 | &sh_keysc_device, |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 144 | }; |
| 145 | |
| 146 | static int __init se7722_devices_setup(void) |
| 147 | { |
| 148 | return platform_add_devices(se7722_devices, |
| 149 | ARRAY_SIZE(se7722_devices)); |
| 150 | } |
| 151 | device_initcall(se7722_devices_setup); |
| 152 | |
| 153 | static void __init se7722_setup(char **cmdline_p) |
| 154 | { |
| 155 | ctrl_outw(0x010D, FPGA_OUT); /* FPGA */ |
| 156 | |
| 157 | ctrl_outl(0x00051001, MSTPCR0); |
| 158 | ctrl_outl(0x00000000, MSTPCR1); |
Yoshihiro Shimoda | 16f393d | 2007-10-30 13:05:51 +0900 | [diff] [blame] | 159 | /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC, USB */ |
| 160 | ctrl_outl(0xffffb7c0, MSTPCR2); |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 161 | |
| 162 | ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */ |
| 163 | ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */ |
| 164 | |
| 165 | /* LCDC I/O */ |
| 166 | ctrl_outw(0x0020, PORT_PSELD); |
| 167 | |
| 168 | /* SIOF1*/ |
| 169 | ctrl_outw(0x0003, PORT_PSELB); |
| 170 | ctrl_outw(0xe000, PORT_PSELC); |
| 171 | ctrl_outw(0x0000, PORT_PKCR); |
| 172 | |
| 173 | /* LCDC */ |
| 174 | ctrl_outw(0x4020, PORT_PHCR); |
| 175 | ctrl_outw(0x0000, PORT_PLCR); |
| 176 | ctrl_outw(0x0000, PORT_PMCR); |
| 177 | ctrl_outw(0x0002, PORT_PRCR); |
| 178 | ctrl_outw(0x0000, PORT_PXCR); /* LCDC,CS6A */ |
| 179 | |
| 180 | /* KEYSC */ |
| 181 | ctrl_outw(0x0A10, PORT_PSELA); /* BS,SHHID2 */ |
| 182 | ctrl_outw(0x0000, PORT_PYCR); |
| 183 | ctrl_outw(0x0000, PORT_PZCR); |
Magnus Damm | 90fce7f | 2008-03-04 15:23:46 -0800 | [diff] [blame] | 184 | ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA); |
| 185 | ctrl_outw(ctrl_inw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC); |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 186 | } |
| 187 | |
| 188 | /* |
| 189 | * The Machine Vector |
| 190 | */ |
Paul Mundt | 82f81f4 | 2007-05-15 15:19:34 +0900 | [diff] [blame] | 191 | static struct sh_machine_vector mv_se7722 __initmv = { |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 192 | .mv_name = "Solution Engine 7722" , |
| 193 | .mv_setup = se7722_setup , |
Magnus Damm | 493a358 | 2007-07-18 17:54:10 +0900 | [diff] [blame] | 194 | .mv_nr_irqs = SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_NR, |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 195 | .mv_init_irq = init_se7722_IRQ, |
Ryusuke Sakato | 6865f0e | 2007-05-01 09:45:29 +0900 | [diff] [blame] | 196 | }; |