| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 | /* * TI DaVinci EVM board support * * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com> * * 2007 (c) MontaVista Software, Inc. This file is licensed under * the terms of the GNU General Public License version 2. This program * is licensed "as is" without any warranty of any kind, whether express * or implied. */#include <linux/kernel.h>#include <linux/init.h>#include <linux/dma-mapping.h>#include <linux/platform_device.h>#include <linux/gpio.h>#include <linux/i2c.h>#include <linux/i2c/pcf857x.h>#include <linux/i2c/at24.h>#include <linux/mtd/mtd.h>#include <linux/mtd/nand.h>#include <linux/mtd/partitions.h>#include <linux/mtd/physmap.h>#include <linux/phy.h>#include <linux/clk.h>#include <linux/videodev2.h>#include <linux/v4l2-dv-timings.h>#include <linux/export.h>#include <media/tvp514x.h>#include <asm/mach-types.h>#include <asm/mach/arch.h>#include <mach/common.h>#include <linux/platform_data/i2c-davinci.h>#include <mach/serial.h>#include <mach/mux.h>#include <linux/platform_data/mtd-davinci.h>#include <linux/platform_data/mmc-davinci.h>#include <linux/platform_data/usb-davinci.h>#include <linux/platform_data/mtd-davinci-aemif.h>#include "davinci.h"#define DM644X_EVM_PHY_ID		"davinci_mdio-0:01"#define LXT971_PHY_ID	(0x001378e2)#define LXT971_PHY_MASK	(0xfffffff0)static struct mtd_partition davinci_evm_norflash_partitions[] = {	/* bootloader (UBL, U-Boot, etc) in first 5 sectors */	{		.name		= "bootloader",		.offset		= 0,		.size		= 5 * SZ_64K,		.mask_flags	= MTD_WRITEABLE, /* force read-only */	},	/* bootloader params in the next 1 sectors */	{		.name		= "params",		.offset		= MTDPART_OFS_APPEND,		.size		= SZ_64K,		.mask_flags	= 0,	},	/* kernel */	{		.name		= "kernel",		.offset		= MTDPART_OFS_APPEND,		.size		= SZ_2M,		.mask_flags	= 0	},	/* file system */	{		.name		= "filesystem",		.offset		= MTDPART_OFS_APPEND,		.size		= MTDPART_SIZ_FULL,		.mask_flags	= 0	}};static struct physmap_flash_data davinci_evm_norflash_data = {	.width		= 2,	.parts		= davinci_evm_norflash_partitions,	.nr_parts	= ARRAY_SIZE(davinci_evm_norflash_partitions),};/* NOTE: CFI probe will correctly detect flash part as 32M, but EMIF * limits addresses to 16M, so using addresses past 16M will wrap */static struct resource davinci_evm_norflash_resource = {	.start		= DM644X_ASYNC_EMIF_DATA_CE0_BASE,	.end		= DM644X_ASYNC_EMIF_DATA_CE0_BASE + SZ_16M - 1,	.flags		= IORESOURCE_MEM,};static struct platform_device davinci_evm_norflash_device = {	.name		= "physmap-flash",	.id		= 0,	.dev		= {		.platform_data	= &davinci_evm_norflash_data,	},	.num_resources	= 1,	.resource	= &davinci_evm_norflash_resource,};/* DM644x EVM includes a 64 MByte small-page NAND flash (16K blocks). * It may used instead of the (default) NOR chip to boot, using TI's * tools to install the secondary boot loader (UBL) and U-Boot. */static struct mtd_partition davinci_evm_nandflash_partition[] = {	/* Bootloader layout depends on whose u-boot is installed, but we	 * can hide all the details.	 *  - block 0 for u-boot environment ... in mainline u-boot	 *  - block 1 for UBL (plus up to four backup copies in blocks 2..5)	 *  - blocks 6...? for u-boot	 *  - blocks 16..23 for u-boot environment ... in TI's u-boot	 */	{		.name		= "bootloader",		.offset		= 0,		.size		= SZ_256K + SZ_128K,		.mask_flags	= MTD_WRITEABLE,	/* force read-only */	},	/* Kernel */	{		.name		= "kernel",		.offset		= MTDPART_OFS_APPEND,		.size		= SZ_4M,		.mask_flags	= 0,	},	/* File system (older GIT kernels started this on the 5MB mark) */	{		.name		= "filesystem",		.offset		= MTDPART_OFS_APPEND,		.size		= MTDPART_SIZ_FULL,		.mask_flags	= 0,	}	/* A few blocks at end hold a flash BBT ... created by TI's CCS	 * using flashwriter_nand.out, but ignored by TI's versions of	 * Linux and u-boot.  We boot faster by using them.	 */};static struct davinci_aemif_timing davinci_evm_nandflash_timing = {	.wsetup		= 20,	.wstrobe	= 40,	.whold		= 20,	.rsetup		= 10,	.rstrobe	= 40,	.rhold		= 10,	.ta		= 40,};static struct davinci_nand_pdata davinci_evm_nandflash_data = {	.parts		= davinci_evm_nandflash_partition,	.nr_parts	= ARRAY_SIZE(davinci_evm_nandflash_partition),	.ecc_mode	= NAND_ECC_HW,	.bbt_options	= NAND_BBT_USE_FLASH,	.timing		= &davinci_evm_nandflash_timing,};static struct resource davinci_evm_nandflash_resource[] = {	{		.start		= DM644X_ASYNC_EMIF_DATA_CE0_BASE,		.end		= DM644X_ASYNC_EMIF_DATA_CE0_BASE + SZ_16M - 1,
 |