| 
									
										
										
										
											2009-04-29 16:46:57 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Lyrtech SFFSDR board support. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2008 Philip Balister, OpenSDR <philip@opensdr.com> | 
					
						
							|  |  |  |  * Copyright (C) 2008 Lyrtech <www.lyrtech.com> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Based on DV-EVM platform, original copyright follows: | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2007 MontaVista Software, Inc. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * 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; either version 2 of the License, or | 
					
						
							|  |  |  |  * (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * 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., 675 Mass Ave, Cambridge, MA 02139, USA. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/init.h>
 | 
					
						
							|  |  |  | #include <linux/platform_device.h>
 | 
					
						
							|  |  |  | #include <linux/i2c.h>
 | 
					
						
							| 
									
										
										
										
											2013-09-27 15:06:28 -04:00
										 |  |  | #include <linux/platform_data/at24.h>
 | 
					
						
							| 
									
										
										
										
											2009-04-29 16:46:57 -07:00
										 |  |  | #include <linux/mtd/mtd.h>
 | 
					
						
							|  |  |  | #include <linux/mtd/nand.h>
 | 
					
						
							|  |  |  | #include <linux/mtd/partitions.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <asm/mach-types.h>
 | 
					
						
							|  |  |  | #include <asm/mach/arch.h>
 | 
					
						
							|  |  |  | #include <asm/mach/flash.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <mach/common.h>
 | 
					
						
							| 
									
										
										
										
											2012-08-24 15:11:34 +02:00
										 |  |  | #include <linux/platform_data/i2c-davinci.h>
 | 
					
						
							| 
									
										
										
										
											2009-04-29 16:46:57 -07:00
										 |  |  | #include <mach/serial.h>
 | 
					
						
							|  |  |  | #include <mach/mux.h>
 | 
					
						
							| 
									
										
										
										
											2012-08-24 15:11:34 +02:00
										 |  |  | #include <linux/platform_data/usb-davinci.h>
 | 
					
						
							| 
									
										
										
										
											2009-04-29 16:46:57 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:35 +05:30
										 |  |  | #include "davinci.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-21 02:48:17 +05:30
										 |  |  | #define SFFSDR_PHY_ID		"davinci_mdio-0:01"
 | 
					
						
							| 
									
										
										
										
											2010-02-25 15:36:38 -08:00
										 |  |  | static struct mtd_partition davinci_sffsdr_nandflash_partition[] = { | 
					
						
							| 
									
										
										
										
											2009-04-29 16:46:57 -07:00
										 |  |  | 	/* U-Boot Environment: Block 0
 | 
					
						
							|  |  |  | 	 * UBL:                Block 1 | 
					
						
							|  |  |  | 	 * U-Boot:             Blocks 6-7 (256 kb) | 
					
						
							|  |  |  | 	 * Integrity Kernel:   Blocks 8-31 (3 Mb) | 
					
						
							|  |  |  | 	 * Integrity Data:     Blocks 100-END | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name		= "Linux Kernel", | 
					
						
							|  |  |  | 		.offset		= 32 * SZ_128K, | 
					
						
							|  |  |  | 		.size		= 16 * SZ_128K, /* 2 Mb */ | 
					
						
							|  |  |  | 		.mask_flags	= MTD_WRITEABLE, /* Force read-only */ | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name		= "Linux ROOT", | 
					
						
							|  |  |  | 		.offset		= MTDPART_OFS_APPEND, | 
					
						
							|  |  |  | 		.size		= 256 * SZ_128K, /* 32 Mb */ | 
					
						
							|  |  |  | 		.mask_flags	= 0, /* R/W */ | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct flash_platform_data davinci_sffsdr_nandflash_data = { | 
					
						
							|  |  |  | 	.parts		= davinci_sffsdr_nandflash_partition, | 
					
						
							|  |  |  | 	.nr_parts	= ARRAY_SIZE(davinci_sffsdr_nandflash_partition), | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct resource davinci_sffsdr_nandflash_resource[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2010-04-16 21:29:11 +04:00
										 |  |  | 		.start		= DM644X_ASYNC_EMIF_DATA_CE0_BASE, | 
					
						
							|  |  |  | 		.end		= DM644X_ASYNC_EMIF_DATA_CE0_BASE + SZ_16M - 1, | 
					
						
							| 
									
										
										
										
											2009-04-29 16:46:57 -07:00
										 |  |  | 		.flags		= IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, { | 
					
						
							| 
									
										
										
										
											2010-04-16 21:29:11 +04:00
										 |  |  | 		.start		= DM644X_ASYNC_EMIF_CONTROL_BASE, | 
					
						
							|  |  |  | 		.end		= DM644X_ASYNC_EMIF_CONTROL_BASE + SZ_4K - 1, | 
					
						
							| 
									
										
										
										
											2009-04-29 16:46:57 -07:00
										 |  |  | 		.flags		= IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device davinci_sffsdr_nandflash_device = { | 
					
						
							|  |  |  | 	.name		= "davinci_nand", /* Name of driver */ | 
					
						
							|  |  |  | 	.id		= 0, | 
					
						
							|  |  |  | 	.dev		= { | 
					
						
							|  |  |  | 		.platform_data	= &davinci_sffsdr_nandflash_data, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	.num_resources	= ARRAY_SIZE(davinci_sffsdr_nandflash_resource), | 
					
						
							|  |  |  | 	.resource	= davinci_sffsdr_nandflash_resource, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct at24_platform_data eeprom_info = { | 
					
						
							|  |  |  | 	.byte_len	= (64*1024) / 8, | 
					
						
							|  |  |  | 	.page_size	= 32, | 
					
						
							|  |  |  | 	.flags		= AT24_FLAG_ADDR16, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct i2c_board_info __initdata i2c_info[] =  { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		I2C_BOARD_INFO("24lc64", 0x50), | 
					
						
							|  |  |  | 		.platform_data	= &eeprom_info, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	/* Other I2C devices:
 | 
					
						
							|  |  |  | 	 * MSP430,  addr 0x23 (not used) | 
					
						
							|  |  |  | 	 * PCA9543, addr 0x70 (setup done by U-Boot) | 
					
						
							|  |  |  | 	 * ADS7828, addr 0x48 (ADC for voltage monitoring.) | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct davinci_i2c_platform_data i2c_pdata = { | 
					
						
							|  |  |  | 	.bus_freq	= 20 /* kHz */, | 
					
						
							|  |  |  | 	.bus_delay	= 100 /* usec */, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void __init sffsdr_init_i2c(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	davinci_init_i2c(&i2c_pdata); | 
					
						
							|  |  |  | 	i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device *davinci_sffsdr_devices[] __initdata = { | 
					
						
							|  |  |  | 	&davinci_sffsdr_nandflash_device, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void __init davinci_sffsdr_map_io(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	dm644x_init(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static __init void davinci_sffsdr_init(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-04-15 12:40:56 -07:00
										 |  |  | 	struct davinci_soc_info *soc_info = &davinci_soc_info; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-29 16:46:57 -07:00
										 |  |  | 	platform_add_devices(davinci_sffsdr_devices, | 
					
						
							|  |  |  | 			     ARRAY_SIZE(davinci_sffsdr_devices)); | 
					
						
							|  |  |  | 	sffsdr_init_i2c(); | 
					
						
							| 
									
										
										
										
											2013-06-19 14:45:42 +05:30
										 |  |  | 	davinci_serial_init(dm644x_serial_device); | 
					
						
							| 
									
										
										
										
											2010-09-15 10:11:25 -04:00
										 |  |  | 	soc_info->emac_pdata->phy_id = SFFSDR_PHY_ID; | 
					
						
							| 
									
										
										
										
											2009-10-30 23:46:14 +04:00
										 |  |  | 	davinci_setup_usb(0, 0); /* We support only peripheral mode. */ | 
					
						
							| 
									
										
										
										
											2009-04-29 16:46:57 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* mux VLYNQ pins */ | 
					
						
							|  |  |  | 	davinci_cfg_reg(DM644X_VLYNQEN); | 
					
						
							|  |  |  | 	davinci_cfg_reg(DM644X_VLYNQWD); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | MACHINE_START(SFFSDR, "Lyrtech SFFSDR") | 
					
						
							| 
									
										
										
										
											2011-07-05 22:38:11 -04:00
										 |  |  | 	.atag_offset  = 0x100, | 
					
						
							| 
									
										
										
										
											2009-04-29 16:46:57 -07:00
										 |  |  | 	.map_io	      = davinci_sffsdr_map_io, | 
					
						
							| 
									
										
										
										
											2010-05-07 17:06:37 -04:00
										 |  |  | 	.init_irq     = davinci_irq_init, | 
					
						
							| 
									
										
										
										
											2012-11-08 12:40:59 -07:00
										 |  |  | 	.init_time	= davinci_timer_init, | 
					
						
							| 
									
										
										
										
											2009-04-29 16:46:57 -07:00
										 |  |  | 	.init_machine = davinci_sffsdr_init, | 
					
						
							| 
									
										
										
										
											2012-04-26 09:45:39 +08:00
										 |  |  | 	.init_late	= davinci_init_late, | 
					
						
							| 
									
										
										
										
											2011-07-05 22:28:08 -04:00
										 |  |  | 	.dma_zone_size	= SZ_128M, | 
					
						
							| 
									
										
										
										
											2011-12-05 11:29:46 +01:00
										 |  |  | 	.restart	= davinci_restart, | 
					
						
							| 
									
										
										
										
											2009-04-29 16:46:57 -07:00
										 |  |  | MACHINE_END |