| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * arch/sh/boards/renesas/r7780rp/setup.c | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2007-03-12 14:38:59 +09:00
										 |  |  |  * Renesas Solutions Highlander Support. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  |  * Copyright (C) 2002 Atom Create Engineering Co., Ltd. | 
					
						
							| 
									
										
										
										
											2008-03-25 16:49:30 +09:00
										 |  |  |  * Copyright (C) 2005 - 2008 Paul Mundt | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2007-03-12 14:38:59 +09:00
										 |  |  |  * This contains support for the R7780RP-1, R7780MP, and R7785RP | 
					
						
							|  |  |  |  * Highlander modules. | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  |  * | 
					
						
							|  |  |  |  * 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>
 | 
					
						
							| 
									
										
										
										
											2010-05-11 09:37:05 +00:00
										 |  |  | #include <linux/io.h>
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | #include <linux/platform_device.h>
 | 
					
						
							| 
									
										
										
										
											2008-02-01 18:02:30 -05:00
										 |  |  | #include <linux/ata_platform.h>
 | 
					
						
							| 
									
										
										
										
											2007-11-02 14:17:19 +09:00
										 |  |  | #include <linux/types.h>
 | 
					
						
							| 
									
										
										
										
											2009-06-16 07:42:20 +00:00
										 |  |  | #include <linux/mtd/physmap.h>
 | 
					
						
							| 
									
										
										
										
											2008-03-25 16:49:30 +09:00
										 |  |  | #include <linux/i2c.h>
 | 
					
						
							| 
									
										
										
										
											2009-01-09 15:11:58 +09:00
										 |  |  | #include <linux/irq.h>
 | 
					
						
							| 
									
										
										
										
											2009-05-26 09:33:05 +00:00
										 |  |  | #include <linux/interrupt.h>
 | 
					
						
							|  |  |  | #include <linux/usb/r8a66597.h>
 | 
					
						
							| 
									
										
										
										
											2009-07-22 14:41:35 +00:00
										 |  |  | #include <linux/usb/m66592.h>
 | 
					
						
							| 
									
										
										
										
											2010-11-17 10:04:33 +01:00
										 |  |  | #include <linux/clkdev.h>
 | 
					
						
							| 
									
										
										
										
											2007-10-15 10:36:45 +09:00
										 |  |  | #include <net/ax88796.h>
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | #include <asm/machvec.h>
 | 
					
						
							| 
									
										
										
										
											2008-10-20 13:02:48 +09:00
										 |  |  | #include <mach/highlander.h>
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | #include <asm/clock.h>
 | 
					
						
							| 
									
										
										
										
											2007-08-20 13:03:41 +09:00
										 |  |  | #include <asm/heartbeat.h>
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | #include <asm/io.h>
 | 
					
						
							| 
									
										
										
										
											2008-02-07 20:23:53 +09:00
										 |  |  | #include <asm/io_trapped.h>
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-26 09:33:05 +00:00
										 |  |  | static struct r8a66597_platdata r8a66597_data = { | 
					
						
							|  |  |  | 	.xtal = R8A66597_PLATDATA_XTAL_12MHZ, | 
					
						
							|  |  |  | 	.vif = 1, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-17 13:38:54 +09:00
										 |  |  | static struct resource r8a66597_usb_host_resources[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.start	= 0xA4200000, | 
					
						
							|  |  |  | 		.end	= 0xA42000FF, | 
					
						
							|  |  |  | 		.flags	= IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							| 
									
										
										
										
											2007-09-10 12:06:03 +09:00
										 |  |  | 		.start	= IRQ_EXT1,		/* irq number */ | 
					
						
							|  |  |  | 		.end	= IRQ_EXT1, | 
					
						
							| 
									
										
										
										
											2009-05-26 09:33:05 +00:00
										 |  |  | 		.flags	= IORESOURCE_IRQ | IRQF_TRIGGER_LOW, | 
					
						
							| 
									
										
										
										
											2007-07-17 13:38:54 +09:00
										 |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device r8a66597_usb_host_device = { | 
					
						
							|  |  |  | 	.name		= "r8a66597_hcd", | 
					
						
							|  |  |  | 	.id		= -1, | 
					
						
							|  |  |  | 	.dev = { | 
					
						
							|  |  |  | 		.dma_mask		= NULL,		/* don't use dma */ | 
					
						
							|  |  |  | 		.coherent_dma_mask	= 0xffffffff, | 
					
						
							| 
									
										
										
										
											2009-05-26 09:33:05 +00:00
										 |  |  | 		.platform_data		= &r8a66597_data, | 
					
						
							| 
									
										
										
										
											2007-07-17 13:38:54 +09:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	.num_resources	= ARRAY_SIZE(r8a66597_usb_host_resources), | 
					
						
							|  |  |  | 	.resource	= r8a66597_usb_host_resources, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-22 14:41:35 +00:00
										 |  |  | static struct m66592_platdata usbf_platdata = { | 
					
						
							|  |  |  | 	.xtal = M66592_PLATDATA_XTAL_24MHZ, | 
					
						
							|  |  |  | 	.vif = 1, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-17 13:38:54 +09:00
										 |  |  | static struct resource m66592_usb_peripheral_resources[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.name	= "m66592_udc", | 
					
						
							|  |  |  | 		.start	= 0xb0000000, | 
					
						
							|  |  |  | 		.end	= 0xb00000FF, | 
					
						
							|  |  |  | 		.flags	= IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							|  |  |  | 		.name	= "m66592_udc", | 
					
						
							| 
									
										
										
										
											2007-09-10 12:06:03 +09:00
										 |  |  | 		.start	= IRQ_EXT4,		/* irq number */ | 
					
						
							|  |  |  | 		.end	= IRQ_EXT4, | 
					
						
							| 
									
										
										
										
											2007-07-17 13:38:54 +09:00
										 |  |  | 		.flags	= IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device m66592_usb_peripheral_device = { | 
					
						
							|  |  |  | 	.name		= "m66592_udc", | 
					
						
							|  |  |  | 	.id		= -1, | 
					
						
							|  |  |  | 	.dev = { | 
					
						
							|  |  |  | 		.dma_mask		= NULL,		/* don't use dma */ | 
					
						
							|  |  |  | 		.coherent_dma_mask	= 0xffffffff, | 
					
						
							| 
									
										
										
										
											2009-07-22 14:41:35 +00:00
										 |  |  | 		.platform_data		= &usbf_platdata, | 
					
						
							| 
									
										
										
										
											2007-07-17 13:38:54 +09:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	.num_resources	= ARRAY_SIZE(m66592_usb_peripheral_resources), | 
					
						
							|  |  |  | 	.resource	= m66592_usb_peripheral_resources, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-12-06 10:43:44 +09:00
										 |  |  | static struct resource cf_ide_resources[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							| 
									
										
										
										
											2007-02-14 14:49:04 +09:00
										 |  |  | 		.start	= PA_AREA5_IO + 0x1000, | 
					
						
							|  |  |  | 		.end	= PA_AREA5_IO + 0x1000 + 0x08 - 1, | 
					
						
							|  |  |  | 		.flags	= IORESOURCE_MEM, | 
					
						
							| 
									
										
										
										
											2006-12-06 10:43:44 +09:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							| 
									
										
										
										
											2007-02-14 14:49:04 +09:00
										 |  |  | 		.start	= PA_AREA5_IO + 0x80c, | 
					
						
							|  |  |  | 		.end	= PA_AREA5_IO + 0x80c + 0x16 - 1, | 
					
						
							|  |  |  | 		.flags	= IORESOURCE_MEM, | 
					
						
							| 
									
										
										
										
											2006-12-06 10:43:44 +09:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	[2] = { | 
					
						
							| 
									
										
										
										
											2007-09-10 12:06:03 +09:00
										 |  |  | 		.start	= IRQ_CF, | 
					
						
							| 
									
										
										
										
											2006-12-06 10:43:44 +09:00
										 |  |  | 		.flags	= IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-02-14 14:49:04 +09:00
										 |  |  | static struct pata_platform_info pata_info = { | 
					
						
							|  |  |  | 	.ioport_shift	= 1, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-12-06 10:43:44 +09:00
										 |  |  | static struct platform_device cf_ide_device  = { | 
					
						
							|  |  |  | 	.name		= "pata_platform", | 
					
						
							|  |  |  | 	.id		= -1, | 
					
						
							|  |  |  | 	.num_resources	= ARRAY_SIZE(cf_ide_resources), | 
					
						
							|  |  |  | 	.resource	= cf_ide_resources, | 
					
						
							| 
									
										
										
										
											2007-02-14 14:49:04 +09:00
										 |  |  | 	.dev	= { | 
					
						
							|  |  |  | 		.platform_data	= &pata_info, | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2006-12-06 10:43:44 +09:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-02-13 15:42:28 +09:00
										 |  |  | static struct resource heartbeat_resources[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.start	= PA_OBLED, | 
					
						
							| 
									
										
										
										
											2007-08-23 15:11:44 +09:00
										 |  |  | 		.end	= PA_OBLED, | 
					
						
							| 
									
										
										
										
											2007-02-13 15:42:28 +09:00
										 |  |  | 		.flags	= IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-08-20 13:03:41 +09:00
										 |  |  | #ifndef CONFIG_SH_R7785RP
 | 
					
						
							|  |  |  | static unsigned char heartbeat_bit_pos[] = { 2, 1, 0, 3, 6, 5, 4, 7 }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct heartbeat_data heartbeat_data = { | 
					
						
							|  |  |  | 	.bit_pos	= heartbeat_bit_pos, | 
					
						
							|  |  |  | 	.nr_bits	= ARRAY_SIZE(heartbeat_bit_pos), | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-02-13 15:42:28 +09:00
										 |  |  | static struct platform_device heartbeat_device = { | 
					
						
							|  |  |  | 	.name		= "heartbeat", | 
					
						
							|  |  |  | 	.id		= -1, | 
					
						
							| 
									
										
										
										
											2007-03-12 14:38:59 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* R7785RP has a slightly more sensible FPGA.. */ | 
					
						
							|  |  |  | #ifndef CONFIG_SH_R7785RP
 | 
					
						
							| 
									
										
										
										
											2007-02-13 15:42:28 +09:00
										 |  |  | 	.dev	= { | 
					
						
							| 
									
										
										
										
											2007-08-23 15:11:44 +09:00
										 |  |  | 		.platform_data	= &heartbeat_data, | 
					
						
							| 
									
										
										
										
											2007-02-13 15:42:28 +09:00
										 |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2007-03-12 14:38:59 +09:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2007-02-13 15:42:28 +09:00
										 |  |  | 	.num_resources	= ARRAY_SIZE(heartbeat_resources), | 
					
						
							|  |  |  | 	.resource	= heartbeat_resources, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-10-15 10:36:45 +09:00
										 |  |  | static struct ax_plat_data ax88796_platdata = { | 
					
						
							|  |  |  | 	.flags          = AXFLG_HAS_93CX6, | 
					
						
							|  |  |  | 	.wordlength     = 2, | 
					
						
							|  |  |  | 	.dcr_val        = 0x1, | 
					
						
							|  |  |  | 	.rcr_val        = 0x40, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct resource ax88796_resources[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | #ifdef CONFIG_SH_R7780RP
 | 
					
						
							|  |  |  | 		.start  = 0xa5800400, | 
					
						
							|  |  |  | 		.end    = 0xa5800400 + (0x20 * 0x2) - 1, | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | 		.start  = 0xa4100400, | 
					
						
							|  |  |  | 		.end    = 0xa4100400 + (0x20 * 0x2) - 1, | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 		.flags  = IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.start  = IRQ_AX88796, | 
					
						
							|  |  |  | 		.end    = IRQ_AX88796, | 
					
						
							|  |  |  | 		.flags  = IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device ax88796_device = { | 
					
						
							|  |  |  | 	.name           = "ax88796", | 
					
						
							|  |  |  | 	.id             = 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.dev    = { | 
					
						
							|  |  |  | 		.platform_data = &ax88796_platdata, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.num_resources  = ARRAY_SIZE(ax88796_resources), | 
					
						
							|  |  |  | 	.resource       = ax88796_resources, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-16 07:42:20 +00:00
										 |  |  | static struct mtd_partition nor_flash_partitions[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name		= "loader", | 
					
						
							|  |  |  | 		.offset		= 0x00000000, | 
					
						
							|  |  |  | 		.size		= 512 * 1024, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name		= "bootenv", | 
					
						
							|  |  |  | 		.offset		= MTDPART_OFS_APPEND, | 
					
						
							|  |  |  | 		.size		= 512 * 1024, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name		= "kernel", | 
					
						
							|  |  |  | 		.offset		= MTDPART_OFS_APPEND, | 
					
						
							|  |  |  | 		.size		= 4 * 1024 * 1024, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name		= "data", | 
					
						
							|  |  |  | 		.offset		= MTDPART_OFS_APPEND, | 
					
						
							|  |  |  | 		.size		= MTDPART_SIZ_FULL, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct physmap_flash_data nor_flash_data = { | 
					
						
							|  |  |  | 	.width		= 4, | 
					
						
							|  |  |  | 	.parts		= nor_flash_partitions, | 
					
						
							|  |  |  | 	.nr_parts	= ARRAY_SIZE(nor_flash_partitions), | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* This config is flash board for mass production. */ | 
					
						
							|  |  |  | static struct resource nor_flash_resources[] = { | 
					
						
							|  |  |  | 	[0]	= { | 
					
						
							|  |  |  | 		.start	= PA_NORFLASH_ADDR, | 
					
						
							|  |  |  | 		.end	= PA_NORFLASH_ADDR + PA_NORFLASH_SIZE - 1, | 
					
						
							|  |  |  | 		.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-03-25 16:49:30 +09:00
										 |  |  | static struct resource smbus_resources[] = { | 
					
						
							|  |  |  | 	[0] = { | 
					
						
							|  |  |  | 		.start	= PA_SMCR, | 
					
						
							|  |  |  | 		.end	= PA_SMCR + 0x100 - 1, | 
					
						
							|  |  |  | 		.flags	= IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	[1] = { | 
					
						
							|  |  |  | 		.start	= IRQ_SMBUS, | 
					
						
							|  |  |  | 		.end	= IRQ_SMBUS, | 
					
						
							|  |  |  | 		.flags	= IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device smbus_device = { | 
					
						
							|  |  |  | 	.name		= "i2c-highlander", | 
					
						
							|  |  |  | 	.id		= 0, | 
					
						
							|  |  |  | 	.num_resources	= ARRAY_SIZE(smbus_resources), | 
					
						
							|  |  |  | 	.resource	= smbus_resources, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct i2c_board_info __initdata highlander_i2c_devices[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2008-04-29 23:11:40 +02:00
										 |  |  | 		I2C_BOARD_INFO("r2025sd", 0x32), | 
					
						
							| 
									
										
										
										
											2008-03-25 16:49:30 +09:00
										 |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2007-10-15 10:36:45 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | static struct platform_device *r7780rp_devices[] __initdata = { | 
					
						
							| 
									
										
										
										
											2007-07-17 13:38:54 +09:00
										 |  |  | 	&r8a66597_usb_host_device, | 
					
						
							|  |  |  | 	&m66592_usb_peripheral_device, | 
					
						
							| 
									
										
										
										
											2007-02-13 15:42:28 +09:00
										 |  |  | 	&heartbeat_device, | 
					
						
							| 
									
										
										
										
											2008-03-25 16:49:30 +09:00
										 |  |  | 	&smbus_device, | 
					
						
							| 
									
										
										
										
											2009-06-16 07:42:20 +00:00
										 |  |  | 	&nor_flash_device, | 
					
						
							| 
									
										
										
										
											2008-01-25 16:04:29 +09:00
										 |  |  | #ifndef CONFIG_SH_R7780RP
 | 
					
						
							| 
									
										
										
										
											2007-10-15 10:36:45 +09:00
										 |  |  | 	&ax88796_device, | 
					
						
							| 
									
										
										
										
											2008-01-25 16:04:29 +09:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-07 20:23:53 +09:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * The CF is connected using a 16-bit bus where 8-bit operations are | 
					
						
							|  |  |  |  * unsupported. The linux ata driver is however using 8-bit operations, so | 
					
						
							|  |  |  |  * insert a trapped io filter to convert 8-bit operations into 16-bit. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static struct trapped_io cf_trapped_io = { | 
					
						
							|  |  |  | 	.resource		= cf_ide_resources, | 
					
						
							|  |  |  | 	.num_resources		= 2, | 
					
						
							|  |  |  | 	.minimum_bus_width	= 16, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | static int __init r7780rp_devices_setup(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2008-03-25 16:49:30 +09:00
										 |  |  | 	int ret = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-07 20:23:53 +09:00
										 |  |  | #ifndef CONFIG_SH_R7780RP
 | 
					
						
							|  |  |  | 	if (register_trapped_io(&cf_trapped_io) == 0) | 
					
						
							| 
									
										
										
										
											2008-03-25 16:49:30 +09:00
										 |  |  | 		ret |= platform_device_register(&cf_ide_device); | 
					
						
							| 
									
										
										
										
											2008-02-07 20:23:53 +09:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2008-03-25 16:49:30 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	ret |= platform_add_devices(r7780rp_devices, | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | 				    ARRAY_SIZE(r7780rp_devices)); | 
					
						
							| 
									
										
										
										
											2008-03-25 16:49:30 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	ret |= i2c_register_board_info(0, highlander_i2c_devices, | 
					
						
							|  |  |  | 				       ARRAY_SIZE(highlander_i2c_devices)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return ret; | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2007-03-12 14:38:59 +09:00
										 |  |  | device_initcall(r7780rp_devices_setup); | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Platform specific clocks | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2009-06-16 07:44:10 +00:00
										 |  |  | static int ivdr_clk_enable(struct clk *clk) | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 	__raw_writew(__raw_readw(PA_IVDRCTL) | (1 << IVDR_CK_ON), PA_IVDRCTL); | 
					
						
							| 
									
										
										
										
											2009-06-16 07:44:10 +00:00
										 |  |  | 	return 0; | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void ivdr_clk_disable(struct clk *clk) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 	__raw_writew(__raw_readw(PA_IVDRCTL) & ~(1 << IVDR_CK_ON), PA_IVDRCTL); | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-29 22:18:11 +09:00
										 |  |  | static struct sh_clk_ops ivdr_clk_ops = { | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | 	.enable		= ivdr_clk_enable, | 
					
						
							|  |  |  | 	.disable	= ivdr_clk_disable, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct clk ivdr_clk = { | 
					
						
							|  |  |  | 	.ops		= &ivdr_clk_ops, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct clk *r7780rp_clocks[] = { | 
					
						
							|  |  |  | 	&ivdr_clk, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-11 09:37:05 +00:00
										 |  |  | static struct clk_lookup lookups[] = { | 
					
						
							|  |  |  | 	/* main clocks */ | 
					
						
							|  |  |  | 	CLKDEV_CON_ID("ivdr_clk", &ivdr_clk), | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | static void r7780rp_power_off(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2007-03-12 14:38:59 +09:00
										 |  |  | 	if (mach_is_r7780mp() || mach_is_r7785rp()) | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 		__raw_writew(0x0001, PA_POFF); | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Initialize the board | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2007-03-12 14:38:59 +09:00
										 |  |  | static void __init highlander_setup(char **cmdline_p) | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 	u16 ver = __raw_readw(PA_VERREG); | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | 	int i; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-03-12 14:38:59 +09:00
										 |  |  | 	printk(KERN_INFO "Renesas Solutions Highlander %s support.\n", | 
					
						
							|  |  |  | 			 mach_is_r7780rp() ? "R7780RP-1" : | 
					
						
							|  |  |  | 			 mach_is_r7780mp() ? "R7780MP"	 : | 
					
						
							|  |  |  | 					     "R7785RP"); | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	printk(KERN_INFO "Board version: %d (revision %d), " | 
					
						
							|  |  |  | 			 "FPGA version: %d (revision %d)\n", | 
					
						
							|  |  |  | 			 (ver >> 12) & 0xf, (ver >> 8) & 0xf, | 
					
						
							|  |  |  | 			 (ver >>  4) & 0xf, ver & 0xf); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-10-23 12:35:43 +09:00
										 |  |  | 	highlander_plat_pinmux_setup(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Enable the important clocks right away.. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	for (i = 0; i < ARRAY_SIZE(r7780rp_clocks); i++) { | 
					
						
							|  |  |  | 		struct clk *clk = r7780rp_clocks[i]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		clk_register(clk); | 
					
						
							|  |  |  | 		clk_enable(clk); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-11 09:37:05 +00:00
										 |  |  | 	clkdev_add_table(lookups, ARRAY_SIZE(lookups)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 	__raw_writew(0x0000, PA_OBLED);	/* Clear LED. */ | 
					
						
							| 
									
										
										
										
											2007-03-12 14:38:59 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (mach_is_r7780rp()) | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 		__raw_writew(0x0001, PA_SDPOW);	/* SD Power ON */ | 
					
						
							| 
									
										
										
										
											2007-03-12 14:38:59 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-26 12:58:40 +09:00
										 |  |  | 	__raw_writew(__raw_readw(PA_IVDRCTL) | 0x01, PA_IVDRCTL);	/* Si13112 */ | 
					
						
							| 
									
										
										
										
											2006-09-27 15:59:17 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	pm_power_off = r7780rp_power_off; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2006-09-27 18:17:31 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-10 12:06:03 +09:00
										 |  |  | static unsigned char irl2irq[HL_NR_IRL]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-04-25 17:58:21 +09:00
										 |  |  | static int highlander_irq_demux(int irq) | 
					
						
							| 
									
										
										
										
											2007-09-10 12:06:03 +09:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-11-02 16:14:42 +00:00
										 |  |  | 	if (irq >= HL_NR_IRL || irq < 0 || !irl2irq[irq]) | 
					
						
							| 
									
										
										
										
											2007-09-10 12:06:03 +09:00
										 |  |  | 		return irq; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return irl2irq[irq]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-04-25 17:58:21 +09:00
										 |  |  | static void __init highlander_init_irq(void) | 
					
						
							| 
									
										
										
										
											2007-09-10 12:06:03 +09:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2008-04-25 17:58:21 +09:00
										 |  |  | 	unsigned char *ucp = highlander_plat_irq_setup(); | 
					
						
							| 
									
										
										
										
											2007-09-10 12:06:03 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (ucp) { | 
					
						
							|  |  |  | 		plat_irq_setup_pins(IRQ_MODE_IRL3210); | 
					
						
							|  |  |  | 		memcpy(irl2irq, ucp, HL_NR_IRL); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-27 18:17:31 +09:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * The Machine Vector | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2007-05-15 15:19:34 +09:00
										 |  |  | static struct sh_machine_vector mv_highlander __initmv = { | 
					
						
							| 
									
										
										
										
											2007-03-12 14:38:59 +09:00
										 |  |  | 	.mv_name		= "Highlander", | 
					
						
							|  |  |  | 	.mv_setup		= highlander_setup, | 
					
						
							|  |  |  | 	.mv_init_irq		= highlander_init_irq, | 
					
						
							| 
									
										
										
										
											2007-09-10 12:06:03 +09:00
										 |  |  | 	.mv_irq_demux		= highlander_irq_demux, | 
					
						
							| 
									
										
										
										
											2006-09-27 18:17:31 +09:00
										 |  |  | }; |