sh: replace sh specific CONFIG_VOYAGERGX with CONFIG_MFD_SM501
[linux-2.6/linux-loongson.git] / arch / sh / boards / renesas / rts7751r2d / setup.c
blobbea9848e5ff895422a6f9a7b9f29a372b154c2db
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/pata_platform.h>
14 #include <linux/serial_8250.h>
15 #include <linux/sm501.h>
16 #include <linux/pm.h>
17 #include <asm/machvec.h>
18 #include <asm/rts7751r2d.h>
19 #include <asm/voyagergx.h>
20 #include <asm/io.h>
22 static void __init voyagergx_serial_init(void)
24 unsigned long val;
27 * GPIO Control
29 val = readl((void __iomem *)GPIO_MUX_HIGH);
30 val |= 0x00001fe0;
31 writel(val, (void __iomem *)GPIO_MUX_HIGH);
34 * Power Mode Gate
36 val = readl((void __iomem *)POWER_MODE0_GATE);
37 val |= (POWER_MODE0_GATE_U0 | POWER_MODE0_GATE_U1);
38 writel(val, (void __iomem *)POWER_MODE0_GATE);
40 val = readl((void __iomem *)POWER_MODE1_GATE);
41 val |= (POWER_MODE1_GATE_U0 | POWER_MODE1_GATE_U1);
42 writel(val, (void __iomem *)POWER_MODE1_GATE);
45 static struct resource cf_ide_resources[] = {
46 [0] = {
47 .start = PA_AREA5_IO + 0x1000,
48 .end = PA_AREA5_IO + 0x1000 + 0x08 - 1,
49 .flags = IORESOURCE_MEM,
51 [1] = {
52 .start = PA_AREA5_IO + 0x80c,
53 .end = PA_AREA5_IO + 0x80c + 0x16 - 1,
54 .flags = IORESOURCE_MEM,
56 [2] = {
57 .start = IRQ_CF_IDE,
58 .flags = IORESOURCE_IRQ,
62 static struct pata_platform_info pata_info = {
63 .ioport_shift = 1,
66 static struct platform_device cf_ide_device = {
67 .name = "pata_platform",
68 .id = -1,
69 .num_resources = ARRAY_SIZE(cf_ide_resources),
70 .resource = cf_ide_resources,
71 .dev = {
72 .platform_data = &pata_info,
76 static struct resource heartbeat_resources[] = {
77 [0] = {
78 .start = PA_OUTPORT,
79 .end = PA_OUTPORT + 8 - 1,
80 .flags = IORESOURCE_MEM,
84 static struct platform_device heartbeat_device = {
85 .name = "heartbeat",
86 .id = -1,
87 .num_resources = ARRAY_SIZE(heartbeat_resources),
88 .resource = heartbeat_resources,
91 #ifdef CONFIG_MFD_SM501
92 static struct plat_serial8250_port uart_platform_data[] = {
94 .membase = (void __iomem *)VOYAGER_UART_BASE,
95 .mapbase = VOYAGER_UART_BASE,
96 .iotype = UPIO_MEM,
97 .irq = IRQ_SM501_U0,
98 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
99 .regshift = 2,
100 .uartclk = (9600 * 16),
102 { 0 },
105 static struct platform_device uart_device = {
106 .name = "serial8250",
107 .id = PLAT8250_DEV_PLATFORM,
108 .dev = {
109 .platform_data = uart_platform_data,
113 static struct resource sm501_resources[] = {
114 [0] = {
115 .start = 0x10000000,
116 .end = 0x13e00000 - 1,
117 .flags = IORESOURCE_MEM,
119 [1] = {
120 .start = 0x13e00000,
121 .end = 0x13ffffff,
122 .flags = IORESOURCE_MEM,
124 [2] = {
125 .start = IRQ_SM501_CV,
126 .flags = IORESOURCE_IRQ,
130 static struct platform_device sm501_device = {
131 .name = "sm501",
132 .id = -1,
133 .num_resources = ARRAY_SIZE(sm501_resources),
134 .resource = sm501_resources,
137 #endif /* CONFIG_MFD_SM501 */
139 static struct platform_device *rts7751r2d_devices[] __initdata = {
140 #ifdef CONFIG_MFD_SM501
141 &uart_device,
142 &sm501_device,
143 #endif
144 &heartbeat_device,
147 static int __init rts7751r2d_devices_setup(void)
149 int ret;
151 if (ctrl_inw(PA_BVERREG) == 0x10) { /* R2D-PLUS */
152 ret = platform_device_register(&cf_ide_device);
153 if (ret)
154 return ret;
157 return platform_add_devices(rts7751r2d_devices,
158 ARRAY_SIZE(rts7751r2d_devices));
160 __initcall(rts7751r2d_devices_setup);
162 static void rts7751r2d_power_off(void)
164 ctrl_outw(0x0001, PA_POWOFF);
168 * Initialize the board
170 static void __init rts7751r2d_setup(char **cmdline_p)
172 u16 ver = ctrl_inw(PA_VERREG);
174 printk(KERN_INFO "Renesas Technology Sales RTS7751R2D support.\n");
176 printk(KERN_INFO "FPGA version:%d (revision:%d)\n",
177 (ver >> 4) & 0xf, ver & 0xf);
179 ctrl_outw(0x0000, PA_OUTPORT);
180 pm_power_off = rts7751r2d_power_off;
182 voyagergx_serial_init();
186 * The Machine Vector
188 static struct sh_machine_vector mv_rts7751r2d __initmv = {
189 .mv_name = "RTS7751R2D",
190 .mv_setup = rts7751r2d_setup,
192 .mv_init_irq = init_rts7751r2d_IRQ,
193 .mv_irq_demux = rts7751r2d_irq_demux,
195 #if defined(CONFIG_MFD_SM501) && defined(CONFIG_USB_OHCI_HCD)
196 .mv_consistent_alloc = voyagergx_consistent_alloc,
197 .mv_consistent_free = voyagergx_consistent_free,
198 #endif