| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 | 
							- /*
 
-  * AP4EVB board support
 
-  *
 
-  * Copyright (C) 2010  Magnus Damm
 
-  * Copyright (C) 2008  Yoshihiro Shimoda
 
-  *
 
-  * This program is free software; you can redistribute it and/or modify
 
-  * it under the terms of the GNU General Public License as published by
 
-  * the Free Software Foundation; version 2 of the License.
 
-  *
 
-  * This program is distributed in the hope that it will be useful,
 
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
-  * GNU General Public License for more details.
 
-  *
 
-  * You should have received a copy of the GNU General Public License
 
-  * along with this program; if not, write to the Free Software
 
-  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-  */
 
- #include <linux/clk.h>
 
- #include <linux/kernel.h>
 
- #include <linux/init.h>
 
- #include <linux/interrupt.h>
 
- #include <linux/irq.h>
 
- #include <linux/platform_device.h>
 
- #include <linux/delay.h>
 
- #include <linux/mfd/tmio.h>
 
- #include <linux/mmc/host.h>
 
- #include <linux/mmc/sh_mobile_sdhi.h>
 
- #include <linux/mtd/mtd.h>
 
- #include <linux/mtd/partitions.h>
 
- #include <linux/mtd/physmap.h>
 
- #include <linux/mmc/sh_mmcif.h>
 
- #include <linux/i2c.h>
 
- #include <linux/i2c/tsc2007.h>
 
- #include <linux/io.h>
 
- #include <linux/regulator/fixed.h>
 
- #include <linux/regulator/machine.h>
 
- #include <linux/smsc911x.h>
 
- #include <linux/sh_intc.h>
 
- #include <linux/sh_clk.h>
 
- #include <linux/gpio.h>
 
- #include <linux/input.h>
 
- #include <linux/leds.h>
 
- #include <linux/input/sh_keysc.h>
 
- #include <linux/usb/r8a66597.h>
 
- #include <linux/pm_clock.h>
 
- #include <linux/dma-mapping.h>
 
- #include <media/sh_mobile_ceu.h>
 
- #include <media/sh_mobile_csi2.h>
 
- #include <media/soc_camera.h>
 
- #include <sound/sh_fsi.h>
 
- #include <sound/simple_card.h>
 
- #include <video/sh_mobile_hdmi.h>
 
- #include <video/sh_mobile_lcdc.h>
 
- #include <video/sh_mipi_dsi.h>
 
- #include <mach/common.h>
 
- #include <mach/irqs.h>
 
- #include <mach/sh7372.h>
 
- #include <asm/mach-types.h>
 
- #include <asm/mach/arch.h>
 
- #include <asm/setup.h>
 
- #include "sh-gpio.h"
 
- /*
 
-  * Address	Interface		BusWidth	note
 
-  * ------------------------------------------------------------------
 
-  * 0x0000_0000	NOR Flash ROM (MCP)	16bit		SW7 : bit1 = ON
 
-  * 0x0800_0000	user area		-
 
-  * 0x1000_0000	NOR Flash ROM (MCP)	16bit		SW7 : bit1 = OFF
 
-  * 0x1400_0000	Ether (LAN9220)		16bit
 
-  * 0x1600_0000	user area		-		cannot use with NAND
 
-  * 0x1800_0000	user area		-
 
-  * 0x1A00_0000	-
 
-  * 0x4000_0000	LPDDR2-SDRAM (POP)	32bit
 
-  */
 
- /*
 
-  * NOR Flash ROM
 
-  *
 
-  *  SW1  |     SW2    | SW7  | NOR Flash ROM
 
-  *  bit1 | bit1  bit2 | bit1 | Memory allocation
 
-  * ------+------------+------+------------------
 
-  *  OFF  | ON     OFF | ON   |    Area 0
 
-  *  OFF  | ON     OFF | OFF  |    Area 4
 
-  */
 
- /*
 
-  * NAND Flash ROM
 
-  *
 
-  *  SW1  |     SW2    | SW7  | NAND Flash ROM
 
-  *  bit1 | bit1  bit2 | bit2 | Memory allocation
 
-  * ------+------------+------+------------------
 
-  *  OFF  | ON     OFF | ON   |    FCE 0
 
-  *  OFF  | ON     OFF | OFF  |    FCE 1
 
-  */
 
- /*
 
-  * SMSC 9220
 
-  *
 
-  *  SW1		SMSC 9220
 
-  * -----------------------
 
-  *  ON		access disable
 
-  *  OFF		access enable
 
-  */
 
- /*
 
-  * LCD / IRQ / KEYSC / IrDA
 
-  *
 
-  * IRQ = IRQ26 (TS), IRQ27 (VIO), IRQ28 (QHD-TouchScreen)
 
-  * LCD = 2nd LCDC (WVGA)
 
-  *
 
-  * 		|		SW43			|
 
-  * SW3		|	ON		|	OFF	|
 
-  * -------------+-----------------------+---------------+
 
-  * ON		| KEY / IrDA		| LCD		|
 
-  * OFF		| KEY / IrDA / IRQ	| IRQ		|
 
-  *
 
-  *
 
-  * QHD / WVGA display
 
-  *
 
-  * You can choice display type on menuconfig.
 
-  * Then, check above dip-switch.
 
-  */
 
- /*
 
-  * USB
 
-  *
 
-  * J7 : 1-2  MAX3355E VBUS
 
-  *      2-3  DC 5.0V
 
-  *
 
-  * S39: bit2: off
 
-  */
 
- /*
 
-  * FSI/FSMI
 
-  *
 
-  * SW41	:  ON : SH-Mobile AP4 Audio Mode
 
-  *	: OFF : Bluetooth Audio Mode
 
-  */
 
- /*
 
-  * MMC0/SDHI1 (CN7)
 
-  *
 
-  * J22 : select card voltage
 
-  *       1-2 pin : 1.8v
 
-  *       2-3 pin : 3.3v
 
-  *
 
-  *        SW1  |             SW33
 
-  *             | bit1 | bit2 | bit3 | bit4
 
-  * ------------+------+------+------+-------
 
-  * MMC0   OFF  |  OFF |  ON  |  ON  |  X
 
-  * SDHI1  OFF  |  ON  |   X  |  OFF | ON
 
-  *
 
-  * voltage lebel
 
-  * CN7 : 1.8v
 
-  * CN12: 3.3v
 
-  */
 
- /* Dummy supplies, where voltage doesn't matter */
 
- static struct regulator_consumer_supply fixed1v8_power_consumers[] =
 
- {
 
- 	/* J22 default position: 1.8V */
 
- 	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
 
- 	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
 
- 	REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
 
- 	REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
 
- };
 
- static struct regulator_consumer_supply fixed3v3_power_consumers[] =
 
- {
 
- 	REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
 
- 	REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
 
- };
 
- static struct regulator_consumer_supply dummy_supplies[] = {
 
- 	REGULATOR_SUPPLY("vddvario", "smsc911x"),
 
- 	REGULATOR_SUPPLY("vdd33a", "smsc911x"),
 
- };
 
- /* MTD */
 
- static struct mtd_partition nor_flash_partitions[] = {
 
- 	{
 
- 		.name		= "loader",
 
- 		.offset		= 0x00000000,
 
- 		.size		= 512 * 1024,
 
- 		.mask_flags	= MTD_WRITEABLE,
 
- 	},
 
- 	{
 
- 		.name		= "bootenv",
 
- 		.offset		= MTDPART_OFS_APPEND,
 
- 		.size		= 512 * 1024,
 
- 		.mask_flags	= MTD_WRITEABLE,
 
- 	},
 
- 	{
 
- 		.name		= "kernel_ro",
 
- 		.offset		= MTDPART_OFS_APPEND,
 
- 		.size		= 8 * 1024 * 1024,
 
- 		.mask_flags	= MTD_WRITEABLE,
 
- 	},
 
- 	{
 
- 		.name		= "kernel",
 
- 		.offset		= MTDPART_OFS_APPEND,
 
- 		.size		= 8 * 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	= 0x20000000, /* CS0 shadow instead of regular CS0 */
 
- 		.end	= 0x28000000 - 1, /* needed by USB MASK ROM boot */
 
- 		.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,
 
- };
 
- /* SMSC 9220 */
 
- static struct resource smc911x_resources[] = {
 
- 	{
 
- 		.start	= 0x14000000,
 
- 		.end	= 0x16000000 - 1,
 
- 		.flags	= IORESOURCE_MEM,
 
- 	}, {
 
- 		.start	= evt2irq(0x02c0) /* IRQ6A */,
 
- 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
 
- 	},
 
- };
 
- static struct smsc911x_platform_config smsc911x_info = {
 
- 	.flags		= SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
 
- 	.irq_polarity   = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
 
- 	.irq_type       = SMSC911X_IRQ_TYPE_PUSH_PULL,
 
- };
 
- static struct platform_device smc911x_device = {
 
- 	.name           = "smsc911x",
 
- 	.id             = -1,
 
- 	.num_resources  = ARRAY_SIZE(smc911x_resources),
 
- 	.resource       = smc911x_resources,
 
- 	.dev            = {
 
- 		.platform_data = &smsc911x_info,
 
 
  |