x86/xen: resume timer irqs early
[linux/fpc-iii.git] / arch / sh / boards / mach-r2d / setup.c
blob4b98a5251f833f5e2eda2013e656a95a5fb3c81a
1 /*
2 * Renesas Technology Sales RTS7751R2D Support.
4 * Copyright (C) 2002 - 2006 Atom Create Engineering Co., Ltd.
5 * Copyright (C) 2004 - 2007 Paul Mundt
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/mtd/physmap.h>
16 #include <linux/ata_platform.h>
17 #include <linux/sm501.h>
18 #include <linux/sm501-regs.h>
19 #include <linux/pm.h>
20 #include <linux/fb.h>
21 #include <linux/spi/spi.h>
22 #include <linux/spi/spi_bitbang.h>
23 #include <asm/machvec.h>
24 #include <mach/r2d.h>
25 #include <asm/io.h>
26 #include <asm/io_trapped.h>
27 #include <asm/spi.h>
29 static struct resource cf_ide_resources[] = {
30 [0] = {
31 .start = PA_AREA5_IO + 0x1000,
32 .end = PA_AREA5_IO + 0x1000 + 0x10 - 0x2,
33 .flags = IORESOURCE_MEM,
35 [1] = {
36 .start = PA_AREA5_IO + 0x80c,
37 .end = PA_AREA5_IO + 0x80c,
38 .flags = IORESOURCE_MEM,
40 #ifndef CONFIG_RTS7751R2D_1 /* For R2D-1 polling is preferred */
41 [2] = {
42 .start = IRQ_CF_IDE,
43 .flags = IORESOURCE_IRQ,
45 #endif
48 static struct pata_platform_info pata_info = {
49 .ioport_shift = 1,
52 static struct platform_device cf_ide_device = {
53 .name = "pata_platform",
54 .id = -1,
55 .num_resources = ARRAY_SIZE(cf_ide_resources),
56 .resource = cf_ide_resources,
57 .dev = {
58 .platform_data = &pata_info,
62 static struct spi_board_info spi_bus[] = {
64 .modalias = "rtc-r9701",
65 .max_speed_hz = 1000000,
66 .mode = SPI_MODE_3,
70 static void r2d_chip_select(struct sh_spi_info *spi, int cs, int state)
72 BUG_ON(cs != 0); /* Single Epson RTC-9701JE attached on CS0 */
73 __raw_writew(state == BITBANG_CS_ACTIVE, PA_RTCCE);
76 static struct sh_spi_info spi_info = {
77 .num_chipselect = 1,
78 .chip_select = r2d_chip_select,
81 static struct resource spi_sh_sci_resources[] = {
83 .start = 0xffe00000,
84 .end = 0xffe0001f,
85 .flags = IORESOURCE_MEM,
89 static struct platform_device spi_sh_sci_device = {
90 .name = "spi_sh_sci",
91 .id = -1,
92 .num_resources = ARRAY_SIZE(spi_sh_sci_resources),
93 .resource = spi_sh_sci_resources,
94 .dev = {
95 .platform_data = &spi_info,
99 static struct resource heartbeat_resources[] = {
100 [0] = {
101 .start = PA_OUTPORT,
102 .end = PA_OUTPORT,
103 .flags = IORESOURCE_MEM,
107 static struct platform_device heartbeat_device = {
108 .name = "heartbeat",
109 .id = -1,
110 .num_resources = ARRAY_SIZE(heartbeat_resources),
111 .resource = heartbeat_resources,
114 static struct resource sm501_resources[] = {
115 [0] = {
116 .start = 0x10000000,
117 .end = 0x13e00000 - 1,
118 .flags = IORESOURCE_MEM,
120 [1] = {
121 .start = 0x13e00000,
122 .end = 0x13ffffff,
123 .flags = IORESOURCE_MEM,
125 [2] = {
126 .start = IRQ_VOYAGER,
127 .flags = IORESOURCE_IRQ,
131 static struct fb_videomode sm501_default_mode = {
132 .pixclock = 35714,
133 .xres = 640,
134 .yres = 480,
135 .left_margin = 105,
136 .right_margin = 50,
137 .upper_margin = 35,
138 .lower_margin = 0,
139 .hsync_len = 96,
140 .vsync_len = 2,
141 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
144 static struct sm501_platdata_fbsub sm501_pdata_fbsub_pnl = {
145 .def_bpp = 16,
146 .def_mode = &sm501_default_mode,
147 .flags = SM501FB_FLAG_USE_INIT_MODE |
148 SM501FB_FLAG_USE_HWCURSOR |
149 SM501FB_FLAG_USE_HWACCEL |
150 SM501FB_FLAG_DISABLE_AT_EXIT,
153 static struct sm501_platdata_fbsub sm501_pdata_fbsub_crt = {
154 .flags = (SM501FB_FLAG_USE_INIT_MODE |
155 SM501FB_FLAG_USE_HWCURSOR |
156 SM501FB_FLAG_USE_HWACCEL |
157 SM501FB_FLAG_DISABLE_AT_EXIT),
161 static struct sm501_platdata_fb sm501_fb_pdata = {
162 .fb_route = SM501_FB_OWN,
163 .fb_crt = &sm501_pdata_fbsub_crt,
164 .fb_pnl = &sm501_pdata_fbsub_pnl,
165 .flags = SM501_FBPD_SWAP_FB_ENDIAN,
168 static struct sm501_initdata sm501_initdata = {
169 .devices = SM501_USE_USB_HOST | SM501_USE_UART0,
172 static struct sm501_platdata sm501_platform_data = {
173 .init = &sm501_initdata,
174 .fb = &sm501_fb_pdata,
177 static struct platform_device sm501_device = {
178 .name = "sm501",
179 .id = -1,
180 .dev = {
181 .platform_data = &sm501_platform_data,
183 .num_resources = ARRAY_SIZE(sm501_resources),
184 .resource = sm501_resources,
187 static struct mtd_partition r2d_partitions[] = {
189 .name = "U-Boot",
190 .offset = 0x00000000,
191 .size = 0x00040000,
192 .mask_flags = MTD_WRITEABLE,
193 }, {
194 .name = "Environment",
195 .offset = MTDPART_OFS_NXTBLK,
196 .size = 0x00040000,
197 .mask_flags = MTD_WRITEABLE,
198 }, {
199 .name = "Kernel",
200 .offset = MTDPART_OFS_NXTBLK,
201 .size = 0x001c0000,
202 }, {
203 .name = "Flash_FS",
204 .offset = MTDPART_OFS_NXTBLK,
205 .size = MTDPART_SIZ_FULL,
209 static struct physmap_flash_data flash_data = {
210 .width = 2,
211 .nr_parts = ARRAY_SIZE(r2d_partitions),
212 .parts = r2d_partitions,
215 static struct resource flash_resource = {
216 .start = 0x00000000,
217 .end = 0x02000000,
218 .flags = IORESOURCE_MEM,
221 static struct platform_device flash_device = {
222 .name = "physmap-flash",
223 .id = -1,
224 .resource = &flash_resource,
225 .num_resources = 1,
226 .dev = {
227 .platform_data = &flash_data,
231 static struct platform_device *rts7751r2d_devices[] __initdata = {
232 &sm501_device,
233 &heartbeat_device,
234 &spi_sh_sci_device,
238 * The CF is connected with a 16-bit bus where 8-bit operations are
239 * unsupported. The linux ata driver is however using 8-bit operations, so
240 * insert a trapped io filter to convert 8-bit operations into 16-bit.
242 static struct trapped_io cf_trapped_io = {
243 .resource = cf_ide_resources,
244 .num_resources = 2,
245 .minimum_bus_width = 16,
248 static int __init rts7751r2d_devices_setup(void)
250 if (register_trapped_io(&cf_trapped_io) == 0)
251 platform_device_register(&cf_ide_device);
253 if (mach_is_r2d_plus())
254 platform_device_register(&flash_device);
256 spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
258 return platform_add_devices(rts7751r2d_devices,
259 ARRAY_SIZE(rts7751r2d_devices));
261 device_initcall(rts7751r2d_devices_setup);
263 static void rts7751r2d_power_off(void)
265 __raw_writew(0x0001, PA_POWOFF);
269 * Initialize the board
271 static void __init rts7751r2d_setup(char **cmdline_p)
273 void __iomem *sm501_reg;
274 u16 ver = __raw_readw(PA_VERREG);
276 printk(KERN_INFO "Renesas Technology Sales RTS7751R2D support.\n");
278 printk(KERN_INFO "FPGA version:%d (revision:%d)\n",
279 (ver >> 4) & 0xf, ver & 0xf);
281 __raw_writew(0x0000, PA_OUTPORT);
282 pm_power_off = rts7751r2d_power_off;
284 /* sm501 dram configuration:
285 * ColSizeX = 11 - External Memory Column Size: 256 words.
286 * APX = 1 - External Memory Active to Pre-Charge Delay: 7 clocks.
287 * RstX = 1 - External Memory Reset: Normal.
288 * Rfsh = 1 - Local Memory Refresh to Command Delay: 12 clocks.
289 * BwC = 1 - Local Memory Block Write Cycle Time: 2 clocks.
290 * BwP = 1 - Local Memory Block Write to Pre-Charge Delay: 1 clock.
291 * AP = 1 - Internal Memory Active to Pre-Charge Delay: 7 clocks.
292 * Rst = 1 - Internal Memory Reset: Normal.
293 * RA = 1 - Internal Memory Remain in Active State: Do not remain.
296 sm501_reg = (void __iomem *)0xb3e00000 + SM501_DRAM_CONTROL;
297 writel(readl(sm501_reg) | 0x00f107c0, sm501_reg);
301 * The Machine Vector
303 static struct sh_machine_vector mv_rts7751r2d __initmv = {
304 .mv_name = "RTS7751R2D",
305 .mv_setup = rts7751r2d_setup,
306 .mv_init_irq = init_rts7751r2d_IRQ,
307 .mv_irq_demux = rts7751r2d_irq_demux,