| 
									
										
										
										
											2006-09-27 18:09:34 +09:00
										 |  |  | #include <linux/init.h>
 | 
					
						
							|  |  |  | #include <linux/platform_device.h>
 | 
					
						
							| 
									
										
										
										
											2008-07-07 21:11:54 +09:00
										 |  |  | #include <linux/mtd/physmap.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-04 18:00:11 +09:00
										 |  |  | #include <linux/serial_8250.h>
 | 
					
						
							|  |  |  | #include <linux/serial_reg.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-04 18:00:22 +09:00
										 |  |  | #include <linux/usb/isp116x.h>
 | 
					
						
							|  |  |  | #include <linux/delay.h>
 | 
					
						
							| 
									
										
										
										
											2008-07-29 21:41:37 +09:00
										 |  |  | #include <asm/machvec.h>
 | 
					
						
							|  |  |  | #include <mach-se/mach/se7343.h>
 | 
					
						
							| 
									
										
										
										
											2008-07-07 21:11:54 +09:00
										 |  |  | #include <asm/heartbeat.h>
 | 
					
						
							| 
									
										
										
										
											2006-09-27 18:09:34 +09:00
										 |  |  | #include <asm/irq.h>
 | 
					
						
							| 
									
										
										
										
											2008-07-07 21:11:54 +09:00
										 |  |  | #include <asm/io.h>
 | 
					
						
							| 
									
										
										
										
											2006-09-27 18:09:34 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-15 12:24:34 +09:00
										 |  |  | static struct resource heartbeat_resource = { | 
					
						
							|  |  |  | 	.start	= PA_LED, | 
					
						
							|  |  |  | 	.end	= PA_LED, | 
					
						
							|  |  |  | 	.flags	= IORESOURCE_MEM | IORESOURCE_MEM_16BIT, | 
					
						
							| 
									
										
										
										
											2008-07-07 21:11:54 +09:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-02-13 15:42:28 +09:00
										 |  |  | static struct platform_device heartbeat_device = { | 
					
						
							|  |  |  | 	.name		= "heartbeat", | 
					
						
							|  |  |  | 	.id		= -1, | 
					
						
							| 
									
										
										
										
											2010-01-15 12:24:34 +09:00
										 |  |  | 	.num_resources	= 1, | 
					
						
							|  |  |  | 	.resource	= &heartbeat_resource, | 
					
						
							| 
									
										
										
										
											2007-02-13 15:42:28 +09:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-07 21:11:54 +09:00
										 |  |  | static struct mtd_partition nor_flash_partitions[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name		= "loader", | 
					
						
							|  |  |  | 		.offset		= 0x00000000, | 
					
						
							|  |  |  | 		.size		= 128 * 1024, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name		= "rootfs", | 
					
						
							|  |  |  | 		.offset		= MTDPART_OFS_APPEND, | 
					
						
							|  |  |  | 		.size		= 31 * 1024 * 1024, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name		= "data", | 
					
						
							|  |  |  | 		.offset		= MTDPART_OFS_APPEND, | 
					
						
							|  |  |  | 		.size		= MTDPART_SIZ_FULL, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct physmap_flash_data nor_flash_data = { | 
					
						
							|  |  |  | 	.width		= 2, | 
					
						
							|  |  |  | 	.parts		= nor_flash_partitions, | 
					
						
							|  |  |  | 	.nr_parts	= ARRAY_SIZE(nor_flash_partitions), | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct resource nor_flash_resources[] = { | 
					
						
							|  |  |  | 	[0]	= { | 
					
						
							|  |  |  | 		.start	= 0x00000000, | 
					
						
							|  |  |  | 		.end	= 0x01ffffff, | 
					
						
							|  |  |  | 		.flags	= IORESOURCE_MEM, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device nor_flash_device = { | 
					
						
							|  |  |  | 	.name		= "physmap-flash", | 
					
						
							|  |  |  | 	.dev		= { | 
					
						
							|  |  |  | 		.platform_data	= &nor_flash_data, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	.num_resources	= ARRAY_SIZE(nor_flash_resources), | 
					
						
							|  |  |  | 	.resource	= nor_flash_resources, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-04 18:00:11 +09:00
										 |  |  | #define ST16C2550C_FLAGS (UPF_BOOT_AUTOCONF | UPF_IOREMAP)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct plat_serial8250_port serial_platform_data[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.iotype		= UPIO_MEM, | 
					
						
							|  |  |  | 		.mapbase	= 0x16000000, | 
					
						
							|  |  |  | 		.regshift	= 1, | 
					
						
							|  |  |  | 		.flags		= ST16C2550C_FLAGS, | 
					
						
							|  |  |  | 		.uartclk	= 7372800, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							|  |  |  | 		.iotype		= UPIO_MEM, | 
					
						
							|  |  |  | 		.mapbase	= 0x17000000, | 
					
						
							|  |  |  | 		.regshift	= 1, | 
					
						
							|  |  |  | 		.flags		= ST16C2550C_FLAGS, | 
					
						
							|  |  |  | 		.uartclk	= 7372800, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ }, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device uart_device = { | 
					
						
							|  |  |  | 	.name			= "serial8250", | 
					
						
							|  |  |  | 	.id			= PLAT8250_DEV_PLATFORM, | 
					
						
							|  |  |  | 	.dev			= { | 
					
						
							|  |  |  | 		.platform_data	= serial_platform_data, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-04 18:00:22 +09:00
										 |  |  | static void isp116x_delay(struct device *dev, int delay) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	ndelay(delay); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct resource usb_resources[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.start  = 0x11800000, | 
					
						
							|  |  |  | 		.end    = 0x11800001, | 
					
						
							|  |  |  | 		.flags  = IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							|  |  |  | 		.start  = 0x11800002, | 
					
						
							|  |  |  | 		.end    = 0x11800003, | 
					
						
							|  |  |  | 		.flags  = IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[2] = { | 
					
						
							| 
									
										
										
										
											2010-01-12 13:37:04 +09:00
										 |  |  | 		/* Filled in later */ | 
					
						
							| 
									
										
										
										
											2008-12-04 18:00:22 +09:00
										 |  |  | 		.flags  = IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct isp116x_platform_data usb_platform_data = { | 
					
						
							|  |  |  | 	.sel15Kres		= 1, | 
					
						
							|  |  |  | 	.oc_enable		= 1, | 
					
						
							|  |  |  | 	.int_act_high		= 0, | 
					
						
							|  |  |  | 	.int_edge_triggered	= 0, | 
					
						
							|  |  |  | 	.remote_wakeup_enable	= 0, | 
					
						
							|  |  |  | 	.delay			= isp116x_delay, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device usb_device = { | 
					
						
							|  |  |  | 	.name			= "isp116x-hcd", | 
					
						
							|  |  |  | 	.id			= -1, | 
					
						
							| 
									
										
										
										
											2010-01-12 13:37:04 +09:00
										 |  |  | 	.num_resources		= ARRAY_SIZE(usb_resources), | 
					
						
							|  |  |  | 	.resource		= usb_resources, | 
					
						
							| 
									
										
										
										
											2008-12-04 18:00:22 +09:00
										 |  |  | 	.dev			= { | 
					
						
							|  |  |  | 		.platform_data	= &usb_platform_data, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-02-13 15:42:28 +09:00
										 |  |  | static struct platform_device *sh7343se_platform_devices[] __initdata = { | 
					
						
							|  |  |  | 	&heartbeat_device, | 
					
						
							| 
									
										
										
										
											2008-07-07 21:11:54 +09:00
										 |  |  | 	&nor_flash_device, | 
					
						
							| 
									
										
										
										
											2008-12-04 18:00:11 +09:00
										 |  |  | 	&uart_device, | 
					
						
							| 
									
										
										
										
											2008-12-04 18:00:22 +09:00
										 |  |  | 	&usb_device, | 
					
						
							| 
									
										
										
										
											2006-09-27 18:09:34 +09:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int __init sh7343se_devices_setup(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-12 13:37:04 +09:00
										 |  |  | 	/* Wire-up dynamic vectors */ | 
					
						
							|  |  |  | 	serial_platform_data[0].irq = se7343_fpga_irq[SE7343_FPGA_IRQ_UARTA]; | 
					
						
							|  |  |  | 	serial_platform_data[1].irq = se7343_fpga_irq[SE7343_FPGA_IRQ_UARTB]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	usb_resources[2].start = usb_resources[2].end = | 
					
						
							|  |  |  | 		se7343_fpga_irq[SE7343_FPGA_IRQ_USB]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-02-13 15:42:28 +09:00
										 |  |  | 	return platform_add_devices(sh7343se_platform_devices, | 
					
						
							|  |  |  | 				    ARRAY_SIZE(sh7343se_platform_devices)); | 
					
						
							| 
									
										
										
										
											2006-09-27 18:09:34 +09:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2008-07-07 21:11:54 +09:00
										 |  |  | device_initcall(sh7343se_devices_setup); | 
					
						
							| 
									
										
										
										
											2006-09-27 18:09:34 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-07 21:11:54 +09:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Initialize the board | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2006-09-27 18:09:34 +09:00
										 |  |  | static void __init sh7343se_setup(char **cmdline_p) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 	__raw_writew(0xf900, FPGA_OUT);	/* FPGA */ | 
					
						
							| 
									
										
										
										
											2008-07-07 21:11:54 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 	__raw_writew(0x0002, PORT_PECR);	/* PORT E 1 = IRQ5 */ | 
					
						
							|  |  |  | 	__raw_writew(0x0020, PORT_PSELD); | 
					
						
							| 
									
										
										
										
											2008-07-07 21:11:54 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	printk(KERN_INFO "MS7343CP01 Setup...done\n"); | 
					
						
							| 
									
										
										
										
											2006-09-27 18:09:34 +09:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * The Machine Vector | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2007-05-15 15:19:34 +09:00
										 |  |  | static struct sh_machine_vector mv_7343se __initmv = { | 
					
						
							| 
									
										
										
										
											2006-09-27 18:09:34 +09:00
										 |  |  | 	.mv_name = "SolutionEngine 7343", | 
					
						
							|  |  |  | 	.mv_setup = sh7343se_setup, | 
					
						
							|  |  |  | 	.mv_init_irq = init_7343se_IRQ, | 
					
						
							|  |  |  | }; |