WIP FPC-III support
[linux/fpc-iii.git] / arch / sh / boards / mach-se / 7343 / setup.c
blobfe0e550601a2e2cf6a9b3dac550b44331df2c0b9
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/init.h>
3 #include <linux/platform_device.h>
4 #include <linux/mtd/physmap.h>
5 #include <linux/serial_8250.h>
6 #include <linux/serial_reg.h>
7 #include <linux/usb/isp116x.h>
8 #include <linux/delay.h>
9 #include <linux/irqdomain.h>
10 #include <asm/machvec.h>
11 #include <mach-se/mach/se7343.h>
12 #include <asm/heartbeat.h>
13 #include <asm/irq.h>
14 #include <asm/io.h>
16 static struct resource heartbeat_resource = {
17 .start = PA_LED,
18 .end = PA_LED,
19 .flags = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
22 static struct platform_device heartbeat_device = {
23 .name = "heartbeat",
24 .id = -1,
25 .num_resources = 1,
26 .resource = &heartbeat_resource,
29 static struct mtd_partition nor_flash_partitions[] = {
31 .name = "loader",
32 .offset = 0x00000000,
33 .size = 128 * 1024,
36 .name = "rootfs",
37 .offset = MTDPART_OFS_APPEND,
38 .size = 31 * 1024 * 1024,
41 .name = "data",
42 .offset = MTDPART_OFS_APPEND,
43 .size = MTDPART_SIZ_FULL,
47 static struct physmap_flash_data nor_flash_data = {
48 .width = 2,
49 .parts = nor_flash_partitions,
50 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
53 static struct resource nor_flash_resources[] = {
54 [0] = {
55 .start = 0x00000000,
56 .end = 0x01ffffff,
57 .flags = IORESOURCE_MEM,
61 static struct platform_device nor_flash_device = {
62 .name = "physmap-flash",
63 .dev = {
64 .platform_data = &nor_flash_data,
66 .num_resources = ARRAY_SIZE(nor_flash_resources),
67 .resource = nor_flash_resources,
70 #define ST16C2550C_FLAGS (UPF_BOOT_AUTOCONF | UPF_IOREMAP)
72 static struct plat_serial8250_port serial_platform_data[] = {
73 [0] = {
74 .iotype = UPIO_MEM,
75 .mapbase = 0x16000000,
76 .regshift = 1,
77 .flags = ST16C2550C_FLAGS,
78 .uartclk = 7372800,
80 [1] = {
81 .iotype = UPIO_MEM,
82 .mapbase = 0x17000000,
83 .regshift = 1,
84 .flags = ST16C2550C_FLAGS,
85 .uartclk = 7372800,
87 { },
90 static struct platform_device uart_device = {
91 .name = "serial8250",
92 .id = PLAT8250_DEV_PLATFORM,
93 .dev = {
94 .platform_data = serial_platform_data,
98 static void isp116x_delay(struct device *dev, int delay)
100 ndelay(delay);
103 static struct resource usb_resources[] = {
104 [0] = {
105 .start = 0x11800000,
106 .end = 0x11800001,
107 .flags = IORESOURCE_MEM,
109 [1] = {
110 .start = 0x11800002,
111 .end = 0x11800003,
112 .flags = IORESOURCE_MEM,
114 [2] = {
115 /* Filled in later */
116 .flags = IORESOURCE_IRQ,
120 static struct isp116x_platform_data usb_platform_data = {
121 .sel15Kres = 1,
122 .oc_enable = 1,
123 .int_act_high = 0,
124 .int_edge_triggered = 0,
125 .remote_wakeup_enable = 0,
126 .delay = isp116x_delay,
129 static struct platform_device usb_device = {
130 .name = "isp116x-hcd",
131 .id = -1,
132 .num_resources = ARRAY_SIZE(usb_resources),
133 .resource = usb_resources,
134 .dev = {
135 .platform_data = &usb_platform_data,
140 static struct platform_device *sh7343se_platform_devices[] __initdata = {
141 &heartbeat_device,
142 &nor_flash_device,
143 &uart_device,
144 &usb_device,
147 static int __init sh7343se_devices_setup(void)
149 /* Wire-up dynamic vectors */
150 serial_platform_data[0].irq = irq_find_mapping(se7343_irq_domain,
151 SE7343_FPGA_IRQ_UARTA);
152 serial_platform_data[1].irq = irq_find_mapping(se7343_irq_domain,
153 SE7343_FPGA_IRQ_UARTB);
154 usb_resources[2].start = usb_resources[2].end =
155 irq_find_mapping(se7343_irq_domain, SE7343_FPGA_IRQ_USB);
157 return platform_add_devices(sh7343se_platform_devices,
158 ARRAY_SIZE(sh7343se_platform_devices));
160 device_initcall(sh7343se_devices_setup);
163 * Initialize the board
165 static void __init sh7343se_setup(char **cmdline_p)
167 __raw_writew(0xf900, FPGA_OUT); /* FPGA */
169 __raw_writew(0x0002, PORT_PECR); /* PORT E 1 = IRQ5 */
170 __raw_writew(0x0020, PORT_PSELD);
172 printk(KERN_INFO "MS7343CP01 Setup...done\n");
176 * The Machine Vector
178 static struct sh_machine_vector mv_7343se __initmv = {
179 .mv_name = "SolutionEngine 7343",
180 .mv_setup = sh7343se_setup,
181 .mv_init_irq = init_7343se_IRQ,