| 
					
				 | 
			
			
				@@ -99,3 +99,140 @@ static void __iomem *cpld; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * 2 GByte Micron NAND (MT29F16G08FAA) using 128KB sectors.  If you 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * swap chips with a different block size, partitioning will 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * need to be changed. This NAND chip MT29F16G08FAA is the default 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * NAND shipped with the Spectrum Digital DM365 EVM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define NAND_BLOCK_SIZE		SZ_128K 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static struct mtd_partition davinci_nand_partitions[] = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		/* UBL (a few copies) plus U-Boot */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.name		= "bootloader", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.offset		= 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.size		= 30 * NAND_BLOCK_SIZE, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.mask_flags	= MTD_WRITEABLE, /* force read-only */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}, { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		/* U-Boot environment */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.name		= "params", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.offset		= MTDPART_OFS_APPEND, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.size		= 2 * NAND_BLOCK_SIZE, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.mask_flags	= 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}, { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.name		= "kernel", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.offset		= MTDPART_OFS_APPEND, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.size		= SZ_4M, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.mask_flags	= 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}, { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.name		= "filesystem1", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.offset		= MTDPART_OFS_APPEND, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.size		= SZ_512M, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.mask_flags	= 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}, { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.name		= "filesystem2", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.offset		= MTDPART_OFS_APPEND, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.size		= MTDPART_SIZ_FULL, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.mask_flags	= 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/* two blocks with bad block table (and mirror) at the end */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static struct davinci_nand_pdata davinci_nand_data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.mask_chipsel		= BIT(14), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.parts			= davinci_nand_partitions, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.nr_parts		= ARRAY_SIZE(davinci_nand_partitions), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.ecc_mode		= NAND_ECC_HW, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.bbt_options		= NAND_BBT_USE_FLASH, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.ecc_bits		= 4, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static struct resource davinci_nand_resources[] = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.start		= DM365_ASYNC_EMIF_DATA_CE0_BASE, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.end		= DM365_ASYNC_EMIF_DATA_CE0_BASE + SZ_32M - 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.flags		= IORESOURCE_MEM, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}, { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.start		= DM365_ASYNC_EMIF_CONTROL_BASE, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.end		= DM365_ASYNC_EMIF_CONTROL_BASE + SZ_4K - 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.flags		= IORESOURCE_MEM, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static struct platform_device davinci_nand_device = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.name			= "davinci_nand", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.id			= 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.num_resources		= ARRAY_SIZE(davinci_nand_resources), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.resource		= davinci_nand_resources, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.dev			= { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.platform_data	= &davinci_nand_data, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static struct at24_platform_data eeprom_info = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.byte_len       = (256*1024) / 8, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.page_size      = 64, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.flags          = AT24_FLAG_ADDR16, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.setup          = davinci_get_mac_addr, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.context	= (void *)0x7f00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static struct snd_platform_data dm365_evm_snd_data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.asp_chan_q = EVENTQ_3, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static struct i2c_board_info i2c_info[] = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		I2C_BOARD_INFO("24c256", 0x50), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		.platform_data	= &eeprom_info, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		I2C_BOARD_INFO("tlv320aic3x", 0x18), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static struct davinci_i2c_platform_data i2c_pdata = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.bus_freq	= 400	/* kHz */, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.bus_delay	= 0	/* usec */, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static int dm365evm_keyscan_enable(struct device *dev) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	return davinci_cfg_reg(DM365_KEYSCAN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static unsigned short dm365evm_keymap[] = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_KP2, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_LEFT, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_EXIT, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_DOWN, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_ENTER, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_UP, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_KP1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_RIGHT, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_MENU, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_RECORD, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_REWIND, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_KPMINUS, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_STOP, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_FASTFORWARD, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_KPPLUS, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	KEY_PLAYPAUSE, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static struct davinci_ks_platform_data dm365evm_ks_data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.device_enable	= dm365evm_keyscan_enable, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.keymap		= dm365evm_keymap, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.keymapsize	= ARRAY_SIZE(dm365evm_keymap), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.rep		= 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/* Scan period = strobe + interval */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.strobe		= 0x5, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.interval	= 0x2, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	.matrix_type	= DAVINCI_KEYSCAN_MATRIX_4X4, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static int cpld_mmc_get_cd(int module) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if (!cpld) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return -ENXIO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/* low == card present */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	return !(__raw_readb(cpld + CPLD_CARDSTAT) & BIT(module ? 4 : 0)); 
			 |