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>
16 static struct resource heartbeat_resource
= {
19 .flags
= IORESOURCE_MEM
| IORESOURCE_MEM_16BIT
,
22 static struct platform_device heartbeat_device
= {
26 .resource
= &heartbeat_resource
,
29 static struct mtd_partition nor_flash_partitions
[] = {
37 .offset
= MTDPART_OFS_APPEND
,
38 .size
= 31 * 1024 * 1024,
42 .offset
= MTDPART_OFS_APPEND
,
43 .size
= MTDPART_SIZ_FULL
,
47 static struct physmap_flash_data nor_flash_data
= {
49 .parts
= nor_flash_partitions
,
50 .nr_parts
= ARRAY_SIZE(nor_flash_partitions
),
53 static struct resource nor_flash_resources
[] = {
57 .flags
= IORESOURCE_MEM
,
61 static struct platform_device nor_flash_device
= {
62 .name
= "physmap-flash",
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
[] = {
75 .mapbase
= 0x16000000,
77 .flags
= ST16C2550C_FLAGS
,
82 .mapbase
= 0x17000000,
84 .flags
= ST16C2550C_FLAGS
,
90 static struct platform_device uart_device
= {
92 .id
= PLAT8250_DEV_PLATFORM
,
94 .platform_data
= serial_platform_data
,
98 static void isp116x_delay(struct device
*dev
, int delay
)
103 static struct resource usb_resources
[] = {
107 .flags
= IORESOURCE_MEM
,
112 .flags
= IORESOURCE_MEM
,
115 /* Filled in later */
116 .flags
= IORESOURCE_IRQ
,
120 static struct isp116x_platform_data usb_platform_data
= {
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",
132 .num_resources
= ARRAY_SIZE(usb_resources
),
133 .resource
= usb_resources
,
135 .platform_data
= &usb_platform_data
,
140 static struct platform_device
*sh7343se_platform_devices
[] __initdata
= {
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");
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
,