2007-04-30 22:37:19 +04:00
/*
* 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>
2008-09-08 10:43:02 +04:00
# include <linux/gpio.h>
# include <linux/i2c.h>
# include <linux/i2c/pcf857x.h>
2013-09-27 23:06:28 +04:00
# include <linux/platform_data/at24.h>
2007-04-30 22:37:19 +04:00
# include <linux/mtd/mtd.h>
2009-04-14 20:30:11 +04:00
# include <linux/mtd/nand.h>
2007-04-30 22:37:19 +04:00
# include <linux/mtd/partitions.h>
# include <linux/mtd/physmap.h>
2009-04-14 20:30:11 +04:00
# include <linux/phy.h>
# include <linux/clk.h>
2009-09-16 19:53:18 +04:00
# include <linux/videodev2.h>
2012-10-01 18:39:46 +04:00
# include <linux/v4l2-dv-timings.h>
2011-08-01 00:17:29 +04:00
# include <linux/export.h>
2009-09-16 19:53:18 +04:00
# include <media/tvp514x.h>
2007-04-30 22:37:19 +04:00
# include <asm/mach-types.h>
# include <asm/mach/arch.h>
2008-08-05 19:14:15 +04:00
# include <mach/common.h>
2012-08-24 17:11:34 +04:00
# include <linux/platform_data/i2c-davinci.h>
2009-04-14 20:30:11 +04:00
# include <mach/serial.h>
# include <mach/mux.h>
2012-08-24 17:11:34 +04:00
# 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>
2009-04-14 20:30:11 +04:00
2011-12-21 17:43:35 +04:00
# include "davinci.h"
2012-01-21 01:18:17 +04:00
# define DM644X_EVM_PHY_ID "davinci_mdio-0:01"
2009-04-14 20:30:11 +04:00
# define LXT971_PHY_ID (0x001378e2)
# define LXT971_PHY_MASK (0xfffffff0)
2007-04-30 22:37:19 +04:00
2008-09-08 10:43:02 +04:00
static struct mtd_partition davinci_evm_norflash_partitions [ ] = {
2009-04-14 20:30:11 +04:00
/* bootloader (UBL, U-Boot, etc) in first 5 sectors */
2007-04-30 22:37:19 +04:00
{
. name = " bootloader " ,
. offset = 0 ,
2009-04-14 20:30:11 +04:00
. size = 5 * SZ_64K ,
2007-04-30 22:37:19 +04:00
. 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
}
} ;
2008-09-08 10:43:02 +04:00
static struct physmap_flash_data davinci_evm_norflash_data = {
2007-04-30 22:37:19 +04:00
. width = 2 ,
2008-09-08 10:43:02 +04:00
. parts = davinci_evm_norflash_partitions ,
. nr_parts = ARRAY_SIZE ( davinci_evm_norflash_partitions ) ,
2007-04-30 22:37:19 +04:00
} ;
/* NOTE: CFI probe will correctly detect flash part as 32M, but EMIF
* limits addresses to 16 M , so using addresses past 16 M will wrap */
2008-09-08 10:43:02 +04:00
static struct resource davinci_evm_norflash_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 ,
2007-04-30 22:37:19 +04:00
. flags = IORESOURCE_MEM ,
} ;
2008-09-08 10:43:02 +04:00
static struct platform_device davinci_evm_norflash_device = {
2007-04-30 22:37:19 +04:00
. name = " physmap-flash " ,
. id = 0 ,
. dev = {
2008-09-08 10:43:02 +04:00
. platform_data = & davinci_evm_norflash_data ,
2007-04-30 22:37:19 +04:00
} ,
. num_resources = 1 ,
2008-09-08 10:43:02 +04:00
. resource = & davinci_evm_norflash_resource ,
} ;
2009-04-15 23:19:21 +04:00
/* 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 .
*/
2010-02-26 02:36:38 +03:00
static struct mtd_partition davinci_evm_nandflash_partition [ ] = {
2009-04-15 23:19:21 +04:00
/* 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 */
2009-04-14 20:30:11 +04:00
{
2009-04-15 23:19:21 +04:00
. 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 ,
2009-04-14 20:30:11 +04:00
. size = MTDPART_SIZ_FULL ,
. mask_flags = 0 ,
}
2009-04-15 23:19:21 +04:00
/* 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 .
*/
2009-04-14 20:30:11 +04:00
} ;
2008-09-08 10:43:02 +04:00
2010-08-09 14:16:37 +04:00
static struct davinci_aemif_timing davinci_evm_nandflash_timing = {
. wsetup = 20 ,
. wstrobe = 40 ,
. whold = 20 ,
. rsetup = 10 ,
. rstrobe = 40 ,
. rhold = 10 ,
. ta = 40 ,
} ;
2009-04-14 20:30:11 +04:00
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 ,
2013-08-16 13:13:48 +04:00
. ecc_bits = 1 ,
2011-06-01 03:31:23 +04:00
. bbt_options = NAND_BBT_USE_FLASH ,
2010-08-09 14:16:37 +04:00
. timing = & davinci_evm_nandflash_timing ,
2009-04-14 20:30:11 +04:00
} ;
static struct resource davinci_evm_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-14 20:30:11 +04: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-14 20:30:11 +04:00
. flags = IORESOURCE_MEM ,
} ,
} ;
static struct platform_device davinci_evm_nandflash_device = {
. name = " davinci_nand " ,
. id = 0 ,
. dev = {
. platform_data = & davinci_evm_nandflash_data ,
} ,
. num_resources = ARRAY_SIZE ( davinci_evm_nandflash_resource ) ,
. resource = davinci_evm_nandflash_resource ,
} ;
2009-04-15 23:19:21 +04:00
static u64 davinci_fb_dma_mask = DMA_BIT_MASK ( 32 ) ;
2009-04-14 20:30:11 +04:00
static struct platform_device davinci_fb_device = {
. name = " davincifb " ,
. id = - 1 ,
. dev = {
. dma_mask = & davinci_fb_dma_mask ,
2009-04-15 23:19:21 +04:00
. coherent_dma_mask = DMA_BIT_MASK ( 32 ) ,
2009-04-14 20:30:11 +04:00
} ,
. num_resources = 0 ,
} ;
2011-12-21 17:43:38 +04:00
static struct tvp514x_platform_data dm644xevm_tvp5146_pdata = {
2009-09-16 19:53:18 +04:00
. clk_polarity = 0 ,
. hs_polarity = 1 ,
. vs_polarity = 1
} ;
# define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
/* Inputs available at the TVP5146 */
2011-12-21 17:43:38 +04:00
static struct v4l2_input dm644xevm_tvp5146_inputs [ ] = {
2009-09-16 19:53:18 +04:00
{
. index = 0 ,
. name = " Composite " ,
. type = V4L2_INPUT_TYPE_CAMERA ,
. std = TVP514X_STD_ALL ,
} ,
{
. index = 1 ,
. name = " S-Video " ,
. type = V4L2_INPUT_TYPE_CAMERA ,
. std = TVP514X_STD_ALL ,
} ,
} ;
/*
* this is the route info for connecting each input to decoder
* ouput that goes to vpfe . There is a one to one correspondence
* with tvp5146_inputs
*/
2011-12-21 17:43:38 +04:00
static struct vpfe_route dm644xevm_tvp5146_routes [ ] = {
2009-09-16 19:53:18 +04:00
{
. input = INPUT_CVBS_VI2B ,
. output = OUTPUT_10BIT_422_EMBEDDED_SYNC ,
} ,
{
. input = INPUT_SVIDEO_VI2C_VI1C ,
. output = OUTPUT_10BIT_422_EMBEDDED_SYNC ,
} ,
} ;
2011-12-21 17:43:38 +04:00
static struct vpfe_subdev_info dm644xevm_vpfe_sub_devs [ ] = {
2009-09-16 19:53:18 +04:00
{
. name = " tvp5146 " ,
. grp_id = 0 ,
2011-12-21 17:43:38 +04:00
. num_inputs = ARRAY_SIZE ( dm644xevm_tvp5146_inputs ) ,
. inputs = dm644xevm_tvp5146_inputs ,
. routes = dm644xevm_tvp5146_routes ,
2009-09-16 19:53:18 +04:00
. can_route = 1 ,
. ccdc_if_params = {
. if_type = VPFE_BT656 ,
. hdpol = VPFE_PINPOL_POSITIVE ,
. vdpol = VPFE_PINPOL_POSITIVE ,
} ,
. board_info = {
I2C_BOARD_INFO ( " tvp5146 " , 0x5d ) ,
2011-12-21 17:43:38 +04:00
. platform_data = & dm644xevm_tvp5146_pdata ,
2009-09-16 19:53:18 +04:00
} ,
} ,
} ;
2011-12-21 17:43:38 +04:00
static struct vpfe_config dm644xevm_capture_cfg = {
. num_subdevs = ARRAY_SIZE ( dm644xevm_vpfe_sub_devs ) ,
2009-10-13 19:08:54 +04:00
. i2c_adapter_id = 1 ,
2011-12-21 17:43:38 +04:00
. sub_devs = dm644xevm_vpfe_sub_devs ,
2009-09-16 19:53:18 +04:00
. card_name = " DM6446 EVM " ,
. ccdc = " DM6446 CCDC " ,
} ;
2009-04-14 20:30:11 +04:00
static struct platform_device rtc_dev = {
. name = " rtc_davinci_evm " ,
. id = - 1 ,
} ;
2008-09-08 10:43:02 +04:00
2009-07-15 19:47:48 +04:00
static struct snd_platform_data dm644x_evm_snd_data ;
2009-06-05 14:28:08 +04:00
2008-09-08 10:43:02 +04:00
/*----------------------------------------------------------------------*/
/*
* I2C GPIO expanders
*/
# define PCF_Uxx_BASE(x) (DAVINCI_N_GPIO + ((x) * 8))
/* U2 -- LEDs */
static struct gpio_led evm_leds [ ] = {
{ . name = " DS8 " , . active_low = 1 ,
. default_trigger = " heartbeat " , } ,
{ . name = " DS7 " , . active_low = 1 , } ,
{ . name = " DS6 " , . active_low = 1 , } ,
{ . name = " DS5 " , . active_low = 1 , } ,
{ . name = " DS4 " , . active_low = 1 , } ,
{ . name = " DS3 " , . active_low = 1 , } ,
{ . name = " DS2 " , . active_low = 1 ,
. default_trigger = " mmc0 " , } ,
{ . name = " DS1 " , . active_low = 1 ,
. default_trigger = " ide-disk " , } ,
} ;
static const struct gpio_led_platform_data evm_led_data = {
. num_leds = ARRAY_SIZE ( evm_leds ) ,
. leds = evm_leds ,
} ;
static struct platform_device * evm_led_dev ;
static int
evm_led_setup ( struct i2c_client * client , int gpio , unsigned ngpio , void * c )
{
struct gpio_led * leds = evm_leds ;
int status ;
while ( ngpio - - ) {
leds - > gpio = gpio + + ;
leds + + ;
}
/* what an extremely annoying way to be forced to handle
* device unregistration . . .
*/
evm_led_dev = platform_device_alloc ( " leds-gpio " , 0 ) ;
platform_device_add_data ( evm_led_dev ,
& evm_led_data , sizeof evm_led_data ) ;
evm_led_dev - > dev . parent = & client - > dev ;
status = platform_device_add ( evm_led_dev ) ;
if ( status < 0 ) {
platform_device_put ( evm_led_dev ) ;
evm_led_dev = NULL ;
}
return status ;
}
static int
evm_led_teardown ( struct i2c_client * client , int gpio , unsigned ngpio , void * c )
{
if ( evm_led_dev ) {
platform_device_unregister ( evm_led_dev ) ;
evm_led_dev = NULL ;
}
return 0 ;
}
static struct pcf857x_platform_data pcf_data_u2 = {
. gpio_base = PCF_Uxx_BASE ( 0 ) ,
. setup = evm_led_setup ,
. teardown = evm_led_teardown ,
} ;
/* U18 - A/V clock generator and user switch */
static int sw_gpio ;
static ssize_t
sw_show ( struct device * d , struct device_attribute * a , char * buf )
{
char * s = gpio_get_value_cansleep ( sw_gpio ) ? " on \n " : " off \n " ;
strcpy ( buf , s ) ;
return strlen ( s ) ;
}
static DEVICE_ATTR ( user_sw , S_IRUGO , sw_show , NULL ) ;
static int
evm_u18_setup ( struct i2c_client * client , int gpio , unsigned ngpio , void * c )
{
int status ;
/* export dip switch option */
sw_gpio = gpio + 7 ;
status = gpio_request ( sw_gpio , " user_sw " ) ;
if ( status = = 0 )
status = gpio_direction_input ( sw_gpio ) ;
if ( status = = 0 )
status = device_create_file ( & client - > dev , & dev_attr_user_sw ) ;
else
gpio_free ( sw_gpio ) ;
if ( status ! = 0 )
sw_gpio = - EINVAL ;
/* audio PLL: 48 kHz (vs 44.1 or 32), single rate (vs double) */
gpio_request ( gpio + 3 , " pll_fs2 " ) ;
gpio_direction_output ( gpio + 3 , 0 ) ;
gpio_request ( gpio + 2 , " pll_fs1 " ) ;
gpio_direction_output ( gpio + 2 , 0 ) ;
gpio_request ( gpio + 1 , " pll_sr " ) ;
gpio_direction_output ( gpio + 1 , 0 ) ;
return 0 ;
}
static int
evm_u18_teardown ( struct i2c_client * client , int gpio , unsigned ngpio , void * c )
{
gpio_free ( gpio + 1 ) ;
gpio_free ( gpio + 2 ) ;
gpio_free ( gpio + 3 ) ;
if ( sw_gpio > 0 ) {
device_remove_file ( & client - > dev , & dev_attr_user_sw ) ;
gpio_free ( sw_gpio ) ;
}
return 0 ;
}
static struct pcf857x_platform_data pcf_data_u18 = {
. gpio_base = PCF_Uxx_BASE ( 1 ) ,
. n_latch = ( 1 < < 3 ) | ( 1 < < 2 ) | ( 1 < < 1 ) ,
. setup = evm_u18_setup ,
. teardown = evm_u18_teardown ,
2007-04-30 22:37:19 +04:00
} ;
2008-09-08 10:43:02 +04:00
/* U35 - various I/O signals used to manage USB, CF, ATA, etc */
static int
evm_u35_setup ( struct i2c_client * client , int gpio , unsigned ngpio , void * c )
{
/* p0 = nDRV_VBUS (initial: don't supply it) */
gpio_request ( gpio + 0 , " nDRV_VBUS " ) ;
gpio_direction_output ( gpio + 0 , 1 ) ;
/* p1 = VDDIMX_EN */
gpio_request ( gpio + 1 , " VDDIMX_EN " ) ;
gpio_direction_output ( gpio + 1 , 1 ) ;
/* p2 = VLYNQ_EN */
gpio_request ( gpio + 2 , " VLYNQ_EN " ) ;
gpio_direction_output ( gpio + 2 , 1 ) ;
/* p3 = n3V3_CF_RESET (initial: stay in reset) */
gpio_request ( gpio + 3 , " nCF_RESET " ) ;
gpio_direction_output ( gpio + 3 , 0 ) ;
/* (p4 unused) */
/* p5 = 1V8_WLAN_RESET (initial: stay in reset) */
gpio_request ( gpio + 5 , " WLAN_RESET " ) ;
gpio_direction_output ( gpio + 5 , 1 ) ;
/* p6 = nATA_SEL (initial: select) */
gpio_request ( gpio + 6 , " nATA_SEL " ) ;
gpio_direction_output ( gpio + 6 , 0 ) ;
/* p7 = nCF_SEL (initial: deselect) */
gpio_request ( gpio + 7 , " nCF_SEL " ) ;
gpio_direction_output ( gpio + 7 , 1 ) ;
return 0 ;
}
static int
evm_u35_teardown ( struct i2c_client * client , int gpio , unsigned ngpio , void * c )
{
gpio_free ( gpio + 7 ) ;
gpio_free ( gpio + 6 ) ;
gpio_free ( gpio + 5 ) ;
gpio_free ( gpio + 3 ) ;
gpio_free ( gpio + 2 ) ;
gpio_free ( gpio + 1 ) ;
gpio_free ( gpio + 0 ) ;
return 0 ;
}
static struct pcf857x_platform_data pcf_data_u35 = {
. gpio_base = PCF_Uxx_BASE ( 2 ) ,
. setup = evm_u35_setup ,
. teardown = evm_u35_teardown ,
} ;
/*----------------------------------------------------------------------*/
/* Most of this EEPROM is unused, but U-Boot uses some data:
* - 0x7f00 , 6 bytes Ethernet Address
* - 0x0039 , 1 byte NTSC vs PAL ( bit 0x80 = = PAL )
* - . . . newer boards may have more
*/
2009-04-14 20:30:11 +04:00
2008-09-08 10:43:02 +04:00
static struct at24_platform_data eeprom_info = {
. byte_len = ( 256 * 1024 ) / 8 ,
. page_size = 64 ,
. flags = AT24_FLAG_ADDR16 ,
2009-04-15 23:41:27 +04:00
. setup = davinci_get_mac_addr ,
. context = ( void * ) 0x7f00 ,
2009-04-14 20:30:11 +04:00
} ;
/*
* MSP430 supports RTC , card detection , input from IR remote , and
* a bit more . It triggers interrupts on GPIO ( 7 ) from pressing
* buttons on the IR remote , and for card detect switches .
*/
static struct i2c_client * dm6446evm_msp ;
static int dm6446evm_msp_probe ( struct i2c_client * client ,
const struct i2c_device_id * id )
{
dm6446evm_msp = client ;
return 0 ;
}
static int dm6446evm_msp_remove ( struct i2c_client * client )
{
dm6446evm_msp = NULL ;
return 0 ;
}
static const struct i2c_device_id dm6446evm_msp_ids [ ] = {
{ " dm6446evm_msp " , 0 , } ,
{ /* end of list */ } ,
} ;
static struct i2c_driver dm6446evm_msp_driver = {
. driver . name = " dm6446evm_msp " ,
. id_table = dm6446evm_msp_ids ,
. probe = dm6446evm_msp_probe ,
. remove = dm6446evm_msp_remove ,
2008-09-08 10:43:02 +04:00
} ;
2009-04-14 20:30:11 +04:00
static int dm6444evm_msp430_get_pins ( void )
{
static const char txbuf [ 2 ] = { 2 , 4 , } ;
char buf [ 4 ] ;
struct i2c_msg msg [ 2 ] = {
{
. flags = 0 ,
. len = 2 ,
. buf = ( void __force * ) txbuf ,
} ,
{
. flags = I2C_M_RD ,
. len = 4 ,
. buf = buf ,
} ,
} ;
int status ;
if ( ! dm6446evm_msp )
return - ENXIO ;
2012-09-10 08:49:23 +04:00
msg [ 0 ] . addr = dm6446evm_msp - > addr ;
msg [ 1 ] . addr = dm6446evm_msp - > addr ;
2009-04-14 20:30:11 +04:00
/* Command 4 == get input state, returns port 2 and port3 data
* S Addr W [ A ] len = 2 [ A ] cmd = 4 [ A ]
* RS Addr R [ A ] [ len = 4 ] A [ cmd = 4 ] A [ port2 ] A [ port3 ] N P
*/
status = i2c_transfer ( dm6446evm_msp - > adapter , msg , 2 ) ;
if ( status < 0 )
return status ;
dev_dbg ( & dm6446evm_msp - > dev ,
" PINS: %02x %02x %02x %02x \n " ,
buf [ 0 ] , buf [ 1 ] , buf [ 2 ] , buf [ 3 ] ) ;
return ( buf [ 3 ] < < 8 ) | buf [ 2 ] ;
}
2009-05-12 02:55:03 +04:00
static int dm6444evm_mmc_get_cd ( int module )
{
int status = dm6444evm_msp430_get_pins ( ) ;
return ( status < 0 ) ? status : ! ( status & BIT ( 1 ) ) ;
}
static int dm6444evm_mmc_get_ro ( int module )
{
int status = dm6444evm_msp430_get_pins ( ) ;
return ( status < 0 ) ? status : status & BIT ( 6 + 8 ) ;
}
static struct davinci_mmc_config dm6446evm_mmc_config = {
. get_cd = dm6444evm_mmc_get_cd ,
. get_ro = dm6444evm_mmc_get_ro ,
. wires = 4 ,
} ;
2008-09-08 10:43:02 +04:00
static struct i2c_board_info __initdata i2c_info [ ] = {
2009-04-14 20:30:11 +04:00
{
I2C_BOARD_INFO ( " dm6446evm_msp " , 0x23 ) ,
} ,
2008-09-08 10:43:02 +04:00
{
I2C_BOARD_INFO ( " pcf8574 " , 0x38 ) ,
. platform_data = & pcf_data_u2 ,
} ,
{
I2C_BOARD_INFO ( " pcf8574 " , 0x39 ) ,
. platform_data = & pcf_data_u18 ,
} ,
{
I2C_BOARD_INFO ( " pcf8574 " , 0x3a ) ,
. platform_data = & pcf_data_u35 ,
} ,
{
I2C_BOARD_INFO ( " 24c256 " , 0x50 ) ,
. platform_data = & eeprom_info ,
} ,
2009-08-25 16:20:05 +04:00
{
I2C_BOARD_INFO ( " tlv320aic33 " , 0x1b ) ,
} ,
2008-09-08 10:43:02 +04:00
} ;
/* The msp430 uses a slow bitbanged I2C implementation (ergo 20 KHz),
* which requires 100 usec of idle bus after i2c writes sent to it .
*/
static struct davinci_i2c_platform_data i2c_pdata = {
. bus_freq = 20 /* kHz */ ,
. bus_delay = 100 /* usec */ ,
2010-01-11 13:23:31 +03:00
. sda_pin = 44 ,
. scl_pin = 43 ,
2008-09-08 10:43:02 +04:00
} ;
static void __init evm_init_i2c ( void )
{
davinci_init_i2c ( & i2c_pdata ) ;
2009-04-14 20:30:11 +04:00
i2c_add_driver ( & dm6446evm_msp_driver ) ;
2008-09-08 10:43:02 +04:00
i2c_register_board_info ( 1 , i2c_info , ARRAY_SIZE ( i2c_info ) ) ;
}
2012-02-23 13:47:46 +04:00
# define VENC_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
/* venc standard timings */
static struct vpbe_enc_mode_info dm644xevm_enc_std_timing [ ] = {
{
. name = " ntsc " ,
. timings_type = VPBE_ENC_STD ,
2013-04-12 14:46:19 +04:00
. std_id = V4L2_STD_NTSC ,
2012-02-23 13:47:46 +04:00
. interlaced = 1 ,
. xres = 720 ,
. yres = 480 ,
. aspect = { 11 , 10 } ,
. fps = { 30000 , 1001 } ,
. left_margin = 0x79 ,
. upper_margin = 0x10 ,
} ,
{
. name = " pal " ,
. timings_type = VPBE_ENC_STD ,
2013-04-12 14:46:19 +04:00
. std_id = V4L2_STD_PAL ,
2012-02-23 13:47:46 +04:00
. interlaced = 1 ,
. xres = 720 ,
. yres = 576 ,
. aspect = { 54 , 59 } ,
. fps = { 25 , 1 } ,
. left_margin = 0x7e ,
. upper_margin = 0x16 ,
} ,
} ;
/* venc dv preset timings */
static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing [ ] = {
{
. name = " 480p59_94 " ,
2013-02-15 22:06:28 +04:00
. timings_type = VPBE_ENC_DV_TIMINGS ,
2012-10-01 18:39:46 +04:00
. dv_timings = V4L2_DV_BT_CEA_720X480P59_94 ,
2012-02-23 13:47:46 +04:00
. interlaced = 0 ,
. xres = 720 ,
. yres = 480 ,
. aspect = { 1 , 1 } ,
. fps = { 5994 , 100 } ,
. left_margin = 0x80 ,
. upper_margin = 0x20 ,
} ,
{
. name = " 576p50 " ,
2013-02-15 22:06:28 +04:00
. timings_type = VPBE_ENC_DV_TIMINGS ,
2012-10-01 18:39:46 +04:00
. dv_timings = V4L2_DV_BT_CEA_720X576P50 ,
2012-02-23 13:47:46 +04:00
. interlaced = 0 ,
. xres = 720 ,
. yres = 576 ,
. aspect = { 1 , 1 } ,
. fps = { 50 , 1 } ,
. left_margin = 0x7e ,
. upper_margin = 0x30 ,
} ,
} ;
/*
* The outputs available from VPBE + encoders . Keep the order same
* as that of encoders . First those from venc followed by that from
* encoders . Index in the output refers to index on a particular encoder .
* Driver uses this index to pass it to encoder when it supports more
* than one output . Userspace applications use index of the array to
* set an output .
*/
static struct vpbe_output dm644xevm_vpbe_outputs [ ] = {
{
. output = {
. index = 0 ,
. name = " Composite " ,
. type = V4L2_OUTPUT_TYPE_ANALOG ,
. std = VENC_STD_ALL ,
. capabilities = V4L2_OUT_CAP_STD ,
} ,
2012-11-20 14:30:36 +04:00
. subdev_name = DM644X_VPBE_VENC_SUBDEV_NAME ,
2012-02-23 13:47:46 +04:00
. default_mode = " ntsc " ,
. num_modes = ARRAY_SIZE ( dm644xevm_enc_std_timing ) ,
. modes = dm644xevm_enc_std_timing ,
} ,
{
. output = {
. index = 1 ,
. name = " Component " ,
. type = V4L2_OUTPUT_TYPE_ANALOG ,
2012-10-03 09:25:42 +04:00
. capabilities = V4L2_OUT_CAP_DV_TIMINGS ,
2012-02-23 13:47:46 +04:00
} ,
2012-11-20 14:30:36 +04:00
. subdev_name = DM644X_VPBE_VENC_SUBDEV_NAME ,
2012-02-23 13:47:46 +04:00
. default_mode = " 480p59_94 " ,
. num_modes = ARRAY_SIZE ( dm644xevm_enc_preset_timing ) ,
. modes = dm644xevm_enc_preset_timing ,
} ,
} ;
static struct vpbe_config dm644xevm_display_cfg = {
. module_name = " dm644x-vpbe-display " ,
. i2c_adapter_id = 1 ,
. osd = {
2012-11-20 14:30:36 +04:00
. module_name = DM644X_VPBE_OSD_SUBDEV_NAME ,
2012-02-23 13:47:46 +04:00
} ,
. venc = {
2012-11-20 14:30:36 +04:00
. module_name = DM644X_VPBE_VENC_SUBDEV_NAME ,
2012-02-23 13:47:46 +04:00
} ,
. num_outputs = ARRAY_SIZE ( dm644xevm_vpbe_outputs ) ,
. outputs = dm644xevm_vpbe_outputs ,
} ;
2007-04-30 22:37:19 +04:00
static struct platform_device * davinci_evm_devices [ ] __initdata = {
2009-04-14 20:30:11 +04:00
& davinci_fb_device ,
& rtc_dev ,
} ;
2007-04-30 22:37:19 +04:00
static void __init
davinci_evm_map_io ( void )
{
2009-04-14 20:30:11 +04:00
dm644x_init ( ) ;
2007-04-30 22:37:19 +04:00
}
2009-04-14 20:30:11 +04:00
static int davinci_phy_fixup ( struct phy_device * phydev )
2007-04-30 22:37:19 +04:00
{
2009-04-14 20:30:11 +04:00
unsigned int control ;
/* CRITICAL: Fix for increasing PHY signal drive strength for
* TX lockup issue . On DaVinci EVM , the Intel LXT971 PHY
* signal strength was low causing TX to fail randomly . The
* fix is to Set bit 11 ( Increased MII drive strength ) of PHY
* register 26 ( Digital Config register ) on this phy . */
control = phy_read ( phydev , 26 ) ;
phy_write ( phydev , 26 , ( control | 0x800 ) ) ;
return 0 ;
}
2013-04-01 11:13:44 +04:00
# define HAS_ATA IS_ENABLED(CONFIG_BLK_DEV_PALMCHIP_BK3710)
# define HAS_NOR IS_ENABLED(CONFIG_MTD_PHYSMAP)
# define HAS_NAND IS_ENABLED(CONFIG_MTD_NAND_DAVINCI)
2007-04-30 22:37:19 +04:00
2009-04-14 20:30:11 +04:00
static __init void davinci_evm_init ( void )
{
2013-08-18 09:19:02 +04:00
int ret ;
2009-04-14 20:30:11 +04:00
struct clk * aemif_clk ;
2009-04-15 23:40:56 +04:00
struct davinci_soc_info * soc_info = & davinci_soc_info ;
2009-04-14 20:30:11 +04:00
2013-08-18 09:19:02 +04:00
ret = dm644x_gpio_register ( ) ;
if ( ret )
pr_warn ( " %s: GPIO init failed: %d \n " , __func__ , ret ) ;
2009-04-14 20:30:11 +04:00
aemif_clk = clk_get ( NULL , " aemif " ) ;
2012-08-02 20:53:48 +04:00
clk_prepare_enable ( aemif_clk ) ;
2009-04-14 20:30:11 +04:00
if ( HAS_ATA ) {
if ( HAS_NAND | | HAS_NOR )
pr_warning ( " WARNING: both IDE and Flash are "
" enabled, but they share AEMIF pins. \n "
" \t Disable IDE for NAND/NOR support. \n " ) ;
2010-04-21 18:11:33 +04:00
davinci_init_ide ( ) ;
2009-04-14 20:30:11 +04:00
} else if ( HAS_NAND | | HAS_NOR ) {
davinci_cfg_reg ( DM644X_HPIEN_DISABLE ) ;
davinci_cfg_reg ( DM644X_ATAEN_DISABLE ) ;
/* only one device will be jumpered and detected */
if ( HAS_NAND ) {
platform_device_register ( & davinci_evm_nandflash_device ) ;
2014-01-30 15:03:40 +04:00
if ( davinci_aemif_setup ( & davinci_evm_nandflash_device ) )
pr_warn ( " %s: Cannot configure AEMIF. \n " ,
__func__ ) ;
2009-04-14 20:30:11 +04:00
evm_leds [ 7 ] . default_trigger = " nand-disk " ;
if ( HAS_NOR )
pr_warning ( " WARNING: both NAND and NOR flash "
" are enabled; disable one of them. \n " ) ;
} else if ( HAS_NOR )
platform_device_register ( & davinci_evm_norflash_device ) ;
}
2007-04-30 22:37:19 +04:00
platform_add_devices ( davinci_evm_devices ,
ARRAY_SIZE ( davinci_evm_devices ) ) ;
2008-09-08 10:43:02 +04:00
evm_init_i2c ( ) ;
2009-04-14 20:30:11 +04:00
2009-05-12 02:55:03 +04:00
davinci_setup_mmc ( 0 , & dm6446evm_mmc_config ) ;
2012-02-23 13:47:46 +04:00
dm644x_init_video ( & dm644xevm_capture_cfg , & dm644xevm_display_cfg ) ;
2009-05-12 02:55:03 +04:00
2013-06-19 13:15:42 +04:00
davinci_serial_init ( dm644x_serial_device ) ;
2009-06-05 14:28:08 +04:00
dm644x_init_asp ( & dm644x_evm_snd_data ) ;
2009-04-14 20:30:11 +04:00
2011-03-13 23:06:59 +03:00
/* irlml6401 switches over 1A, in under 8 msec */
davinci_setup_usb ( 1000 , 8 ) ;
2014-03-13 20:50:35 +04:00
if ( IS_BUILTIN ( CONFIG_PHYLIB ) ) {
soc_info - > emac_pdata - > phy_id = DM644X_EVM_PHY_ID ;
/* Register the fixup for PHY on DaVinci */
phy_register_fixup_for_uid ( LXT971_PHY_ID , LXT971_PHY_MASK ,
davinci_phy_fixup ) ;
}
2007-04-30 22:37:19 +04:00
}
2009-04-14 20:30:11 +04:00
MACHINE_START ( DAVINCI_EVM , " DaVinci DM644x EVM " )
2007-04-30 22:37:19 +04:00
/* Maintainer: MontaVista Software <source@mvista.com> */
2011-07-06 06:38:11 +04:00
. atag_offset = 0x100 ,
2007-04-30 22:37:19 +04:00
. map_io = davinci_evm_map_io ,
2010-05-08 01:06:37 +04:00
. init_irq = davinci_irq_init ,
2012-11-08 23:40:59 +04:00
. init_time = davinci_timer_init ,
2007-04-30 22:37:19 +04:00
. init_machine = davinci_evm_init ,
2012-04-26 05:45:39 +04:00
. init_late = davinci_init_late ,
2011-07-06 06:28:08 +04:00
. dma_zone_size = SZ_128M ,
2011-12-05 14:29:46 +04:00
. restart = davinci_restart ,
2007-04-30 22:37:19 +04:00
MACHINE_END