| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * linux/arch/sh/boards/se/7722/setup.c | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2007 Nobuhiro Iwamatsu | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Hitachi UL SolutionEngine 7722 Support. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This file is subject to the terms and conditions of the GNU General Public | 
					
						
							|  |  |  |  * License.  See the file "COPYING" in the main directory of this archive | 
					
						
							|  |  |  |  * for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #include <linux/init.h>
 | 
					
						
							|  |  |  | #include <linux/platform_device.h>
 | 
					
						
							| 
									
										
										
										
											2008-02-01 18:02:30 -05:00
										 |  |  | #include <linux/ata_platform.h>
 | 
					
						
							| 
									
										
										
										
											2008-03-04 15:23:46 -08:00
										 |  |  | #include <linux/input.h>
 | 
					
						
							| 
									
										
										
										
											2009-11-27 07:32:24 +00:00
										 |  |  | #include <linux/input/sh_keysc.h>
 | 
					
						
							| 
									
										
										
										
											2008-04-23 20:18:04 +09:00
										 |  |  | #include <linux/smc91x.h>
 | 
					
						
							| 
									
										
										
										
											2008-12-17 14:41:54 +09:00
										 |  |  | #include <mach-se/mach/se7722.h>
 | 
					
						
							|  |  |  | #include <mach-se/mach/mrshpc.h>
 | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | #include <asm/machvec.h>
 | 
					
						
							| 
									
										
										
										
											2008-07-17 19:16:11 +09:00
										 |  |  | #include <asm/clock.h>
 | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | #include <asm/io.h>
 | 
					
						
							| 
									
										
										
										
											2007-11-07 14:56:46 +09:00
										 |  |  | #include <asm/heartbeat.h>
 | 
					
						
							| 
									
										
										
										
											2009-07-31 07:47:44 +00:00
										 |  |  | #include <cpu/sh7722.h>
 | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Heartbeat */ | 
					
						
							| 
									
										
										
										
											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, | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +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-05-01 09:45:29 +09:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* SMC91x */ | 
					
						
							| 
									
										
										
										
											2008-04-23 20:18:04 +09:00
										 |  |  | static struct smc91x_platdata smc91x_info = { | 
					
						
							|  |  |  | 	.flags = SMC91X_USE_16BIT, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | static struct resource smc91x_eth_resources[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.name   = "smc91x-regs" , | 
					
						
							|  |  |  | 		.start  = PA_LAN + 0x300, | 
					
						
							|  |  |  | 		.end    = PA_LAN + 0x300 + 0x10 , | 
					
						
							|  |  |  | 		.flags  = IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							| 
									
										
										
										
											2009-11-04 11:44:21 +09:00
										 |  |  | 		/* Filled in later */ | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | 		.flags  = IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device smc91x_eth_device = { | 
					
						
							|  |  |  | 	.name           = "smc91x", | 
					
						
							|  |  |  | 	.id             = 0, | 
					
						
							|  |  |  | 	.dev = { | 
					
						
							|  |  |  | 		.dma_mask               = NULL,         /* don't use dma */ | 
					
						
							|  |  |  | 		.coherent_dma_mask      = 0xffffffff, | 
					
						
							| 
									
										
										
										
											2008-04-23 20:18:04 +09:00
										 |  |  | 		.platform_data	= &smc91x_info, | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	.num_resources  = ARRAY_SIZE(smc91x_eth_resources), | 
					
						
							|  |  |  | 	.resource       = smc91x_eth_resources, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct resource cf_ide_resources[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.start  = PA_MRSHPC_IO + 0x1f0, | 
					
						
							|  |  |  | 		.end    = PA_MRSHPC_IO + 0x1f0 + 8 , | 
					
						
							|  |  |  | 		.flags  = IORESOURCE_IO, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							|  |  |  | 		.start  = PA_MRSHPC_IO + 0x1f0 + 0x206, | 
					
						
							|  |  |  | 		.end    = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8, | 
					
						
							|  |  |  | 		.flags  = IORESOURCE_IO, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[2] = { | 
					
						
							| 
									
										
										
										
											2009-11-04 11:44:21 +09:00
										 |  |  | 		/* Filled in later */ | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | 		.flags  = IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device cf_ide_device  = { | 
					
						
							|  |  |  | 	.name           = "pata_platform", | 
					
						
							|  |  |  | 	.id             = -1, | 
					
						
							|  |  |  | 	.num_resources  = ARRAY_SIZE(cf_ide_resources), | 
					
						
							|  |  |  | 	.resource       = cf_ide_resources, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-03-04 15:23:46 -08:00
										 |  |  | static struct sh_keysc_info sh_keysc_info = { | 
					
						
							|  |  |  | 	.mode = SH_KEYSC_MODE_1, /* KEYOUT0->5, KEYIN0->4 */ | 
					
						
							|  |  |  | 	.scan_timing = 3, | 
					
						
							|  |  |  | 	.delay = 5, | 
					
						
							|  |  |  | 	.keycodes = { /* SW1 -> SW30 */ | 
					
						
							|  |  |  | 		KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, | 
					
						
							|  |  |  | 		KEY_F, KEY_G, KEY_H, KEY_I, KEY_J, | 
					
						
							|  |  |  | 		KEY_K, KEY_L, KEY_M, KEY_N, KEY_O, | 
					
						
							|  |  |  | 		KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, | 
					
						
							|  |  |  | 		KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y, | 
					
						
							|  |  |  | 		KEY_Z, | 
					
						
							|  |  |  | 		KEY_HOME, KEY_SLEEP, KEY_WAKEUP, KEY_COFFEE, /* life */ | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct resource sh_keysc_resources[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.start  = 0x044b0000, | 
					
						
							|  |  |  | 		.end    = 0x044b000f, | 
					
						
							|  |  |  | 		.flags  = IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							|  |  |  | 		.start  = 79, | 
					
						
							|  |  |  | 		.flags  = IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device sh_keysc_device = { | 
					
						
							|  |  |  | 	.name           = "sh_keysc", | 
					
						
							| 
									
										
										
										
											2008-10-31 20:21:23 +09:00
										 |  |  | 	.id             = 0, /* "keysc0" clock */ | 
					
						
							| 
									
										
										
										
											2008-03-04 15:23:46 -08:00
										 |  |  | 	.num_resources  = ARRAY_SIZE(sh_keysc_resources), | 
					
						
							|  |  |  | 	.resource       = sh_keysc_resources, | 
					
						
							|  |  |  | 	.dev	= { | 
					
						
							|  |  |  | 		.platform_data	= &sh_keysc_info, | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2009-07-31 07:47:44 +00:00
										 |  |  | 	.archdata = { | 
					
						
							|  |  |  | 		.hwblk_id = HWBLK_KEYSC, | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2008-03-04 15:23:46 -08:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | static struct platform_device *se7722_devices[] __initdata = { | 
					
						
							|  |  |  | 	&heartbeat_device, | 
					
						
							|  |  |  | 	&smc91x_eth_device, | 
					
						
							|  |  |  | 	&cf_ide_device, | 
					
						
							| 
									
										
										
										
											2008-03-04 15:23:46 -08:00
										 |  |  | 	&sh_keysc_device, | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int __init se7722_devices_setup(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-12-17 14:41:54 +09:00
										 |  |  | 	mrshpc_setup_windows(); | 
					
						
							| 
									
										
										
										
											2009-11-04 11:44:21 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* Wire-up dynamic vectors */ | 
					
						
							|  |  |  | 	cf_ide_resources[2].start = cf_ide_resources[2].end = | 
					
						
							|  |  |  | 		se7722_fpga_irq[SE7722_FPGA_IRQ_MRSHPC0]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	smc91x_eth_resources[1].start = smc91x_eth_resources[1].end = | 
					
						
							|  |  |  | 		se7722_fpga_irq[SE7722_FPGA_IRQ_SMC]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-17 14:41:54 +09:00
										 |  |  | 	return platform_add_devices(se7722_devices, ARRAY_SIZE(se7722_devices)); | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | } | 
					
						
							|  |  |  | device_initcall(se7722_devices_setup); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void __init se7722_setup(char **cmdline_p) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 	__raw_writew(0x010D, FPGA_OUT);    /* FPGA */ | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 	__raw_writew(0x0000, PORT_PECR);   /* PORT E 1 = IRQ5 ,E 0 = BS */ | 
					
						
							|  |  |  | 	__raw_writew(0x1000, PORT_PJCR);   /* PORT J 1 = IRQ1,J 0 =IRQ0 */ | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* LCDC I/O */ | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 	__raw_writew(0x0020, PORT_PSELD); | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* SIOF1*/ | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 	__raw_writew(0x0003, PORT_PSELB); | 
					
						
							|  |  |  | 	__raw_writew(0xe000, PORT_PSELC); | 
					
						
							|  |  |  | 	__raw_writew(0x0000, PORT_PKCR); | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* LCDC */ | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 	__raw_writew(0x4020, PORT_PHCR); | 
					
						
							|  |  |  | 	__raw_writew(0x0000, PORT_PLCR); | 
					
						
							|  |  |  | 	__raw_writew(0x0000, PORT_PMCR); | 
					
						
							|  |  |  | 	__raw_writew(0x0002, PORT_PRCR); | 
					
						
							|  |  |  | 	__raw_writew(0x0000, PORT_PXCR);   /* LCDC,CS6A */ | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* KEYSC */ | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 	__raw_writew(0x0A10, PORT_PSELA); /* BS,SHHID2 */ | 
					
						
							|  |  |  | 	__raw_writew(0x0000, PORT_PYCR); | 
					
						
							|  |  |  | 	__raw_writew(0x0000, PORT_PZCR); | 
					
						
							|  |  |  | 	__raw_writew(__raw_readw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA); | 
					
						
							|  |  |  | 	__raw_writew(__raw_readw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC); | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * The Machine Vector | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2007-05-15 15:19:34 +09:00
										 |  |  | static struct sh_machine_vector mv_se7722 __initmv = { | 
					
						
							| 
									
										
										
										
											2007-05-01 09:45:29 +09:00
										 |  |  | 	.mv_name                = "Solution Engine 7722" , | 
					
						
							|  |  |  | 	.mv_setup               = se7722_setup , | 
					
						
							|  |  |  | 	.mv_init_irq		= init_se7722_IRQ, | 
					
						
							|  |  |  | }; |