This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Question about L138EVM add ov7670 driver error

Other Parts Discussed in Thread: TVP5146, PCA9306

Hi,

  Recently I am engaged in the work of add the ov7670 driver to L138 evm board .The figure below shows  a block diagram of the system. Motherboard is LOGIC L138EVM board,I design a daughter board connect to the pin of J29 . The daughter board connect a OV7670 camera as the Video Input.

  

The main file In dvsdk_ompla38-evm_04_03_00_06 Software Development Kit I modify is :

  First:  add the ov7670 driver when make menuconfig.

 

Second: modify the board initialization file of board da850-evm.c add the ov7670 struct information to replace the mt9t031 camera infomation.

Third: modfiy the psp/linux-2.6.37-psp03.21.00.04.sdk/drivers/media/video/davinci/vpif_capture.c 

file function of

static __init int vpif_probe(struct platform_device *pdev) to register the ov7670 device.

 But when I loaded the modified kernel into board ,it comes follows error ,the log is follows, 

we cannot register the ov7670 device successfully .could you explain it or how to make the ov7670

 camera work with the L138EVM .

     Thanks very much.

log session :

5123.log session.txt
Linux video capture interface: v2.00
vpif_capture vpif_capture: Error registering v4l2 subdevice
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT
last sysfs file: 
Modules linked in:
CPU: 0    Not tainted  (2.6.37 #0)
PC is at __wake_up_common+0x14/0x7c
LR is at complete_all+0x58/0x8c
pc : [<c00416a8>]    lr : [<c00445ec>]    psr: 60000093
sp : c7827d70  ip : c7827da0  fp : c7827d9c
r10: 00000000  r9 : 00000003  r8 : c04b9ce4
r7 : c79e6c00  r6 : 00000000  r5 : c04ca9a4  r4 : 00000000
r3 : 00000000  r2 : 00000000  r1 : 00000003  r0 : c79f1cb4
Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 0005317f  Table: c0004000  DAC: 00000017
Process swapper (pid: 1, stack limit = 0xc7826270)
Stack: (0xc7827d70 to 0xc7828000)
7d60:                                     00000000 60000013 c04ca9a4 00000000
7d80: c79e6c00 c04b9ce4 00000000 00000000 c7827dbc c7827da0 c00445ec c00416a4
7da0: 00000000 c7827db0 c03953d4 c79f1c50 c7827dd4 c7827dc0 c01eaf68 c00445a4
7dc0: c79f1c50 c79f1c50 c7827df4 c7827dd8 c01e30dc c01eaf5c c79f1c50 c79f1600
7de0: c04fd9f4 c79e6c00 c7827e0c c7827df8 c01e3224 c01e30b0 c79f1c48 c79f1600
7e00: c7827e24 c7827e10 c026c1a0 c01e3220 c79f1c00 c79f1600 c7827e3c c7827e28
7e20: c0271558 c026c15c c79f1c00 c79f1600 c7827e5c c7827e40 c0271778 c02714dc
7e40: c79b3f20 00000000 00000002 c79e6c00 c7827ea4 c7827e60 c002074c c027175c
7e60: 00000000 00000001 c04b4f00 c04b999c c7850200 00000001 c7827e94 c04b4f08
7e80: c04b4f08 c04e2c64 c79ea660 c04ca630 00000000 00000000 c7827eb4 c7827ea8
7ea0: c01e6af8 c00201d8 c7827ed4 c7827eb8 c01e5a54 c01e6ae8 c04b4f08 c04b4f3c
7ec0: c04e2c64 c79ea660 c7827ef4 c7827ed8 c01e5b84 c01e5988 00000000 c01e5b1c
7ee0: c04e2c64 c79ea660 c7827f1c c7827ef8 c01e518c c01e5b2c c7837038 c7856930
7f00: c019c858 c0029088 c00083ac c04e2c64 c7827f2c c7827f20 c01e586c c01e514c
7f20: c7827f5c c7827f30 c01e4a5c c01e585c c0448345 c7827f40 c0029088 c00083ac
7f40: c04e2c64 00000013 c00201ac 00000000 c7827f84 c7827f60 c01e5ec4 c01e49b8
7f60: c0029088 c00083ac c004b2c4 00000013 c00201ac 00000000 c7827f94 c7827f88
7f80: c01e6f9c c01e5e24 c7827fa4 c7827f98 c00201c0 c01e6f60 c7827fdc c7827fa8
7fa0: c0032420 c00201bc 000000f5 c00083ac c004b2c4 00000013 c0029088 c00083ac
7fc0: c004b2c4 00000013 00000000 00000000 c7827ff4 c7827fe0 c0008448 c0032360
7fe0: 00000000 c00083ac 00000000 c7827ff8 c004b2c4 c00083bc 00000000 00000000
Backtrace: 
[<c0041694>] (__wake_up_common+0x0/0x7c) from [<c00445ec>] (complete_all+0x58/0x8c)
[<c0044594>] (complete_all+0x0/0x8c) from [<c01eaf68>] (device_pm_remove+0x1c/0x60)
 r4:c79f1c50
[<c01eaf4c>] (device_pm_remove+0x0/0x60) from [<c01e30dc>] (device_del+0x3c/0x170)
 r5:c79f1c50 r4:c79f1c50
[<c01e30a0>] (device_del+0x0/0x170) from [<c01e3224>] (device_unregister+0x14/0x20)
 r7:c79e6c00 r6:c04fd9f4 r5:c79f1600 r4:c79f1c50
[<c01e3210>] (device_unregister+0x0/0x20) from [<c026c1a0>] (video_unregister_device+0x54/0x5c)
 r5:c79f1600 r4:c79f1c48
[<c026c14c>] (video_unregister_device+0x0/0x5c) from [<c0271558>] (v4l2_device_unregister_subdev+0x8c/0x98)
 r5:c79f1600 r4:c79f1c00
[<c02714cc>] (v4l2_device_unregister_subdev+0x0/0x98) from [<c0271778>] (v4l2_device_unregister+0x2c/0x7c)
 r5:c79f1600 r4:c79f1c00
[<c027174c>] (v4l2_device_unregister+0x0/0x7c) from [<c002074c>] (vpif_probe+0x584/0x6b0)
 r7:c79e6c00 r6:00000002 r5:00000000 r4:c79b3f20
[<c00201c8>] (vpif_probe+0x0/0x6b0) from [<c01e6af8>] (platform_drv_probe+0x20/0x24)
[<c01e6ad8>] (platform_drv_probe+0x0/0x24) from [<c01e5a54>] (driver_probe_device+0xdc/0x1a4)
[<c01e5978>] (driver_probe_device+0x0/0x1a4) from [<c01e5b84>] (__driver_attach+0x68/0x8c)
 r7:c79ea660 r6:c04e2c64 r5:c04b4f3c r4:c04b4f08

  • Hello,

    Second: modify the board initialization file of board da850-evm.c add the ov7670 struct information to replace the mt9t031 camera infomation.

    Can you attach the diff what you changed here ?

    Third: modfiy the psp/linux-2.6.37-psp03.21.00.04.sdk/drivers/media/video/davinci/vpif_capture.c 

    file function of

    static __init int vpif_probe(struct platform_device *pdev) to register the ov7670 device.

    What you dont have to do that, the vpif driver will pick up the details of ov7670 from the platform data and register for you.

    Thanks,

    --Prabhakar Lad

  • Hi Ouyang,

    As Prabhakar said, you no need to change any driver file unless TI has mentioned any changes/patches required.

    Have you seen any where that we need any patches for 2.6.37 linux kernel ?

    1) We have to enable "OV7670 Camera" support in kernel.  --->  Done.

    2) We have to hook up i2c slave address (0x42) and need add  "OV7670 Camera" platform data support in board file .  --->  Done but need to check.

  •  Hi,

    Thanks for you replay,the main file I modified is:

    Secnod:In  file /psp/linux-2.6.37-psp03.21.00.04.sdk/arch/arm/mach-davinci/board-da850-evm.c

     Add follows:

    1)#include "../../../drivers/media/video/ov7670.h"

    static struct ov7670_config ov7670_info ={                  

          .min_width =320,                           // Filter out smaller sizes 

          .min_height =240,                          // Filter out smaller sizes 

          .clock_speed       = 24,                   // External clock speed (MHz) 

        .use_smbus        =true,                     // Use smbus I/O instead of I2C 

     };

    static struct i2c_board_info ov7670_i2c_camera[] = {

       {

         I2C_BOARD_INFO("ov7670",0x42),

         .platform_data = &ov7670_info,

        }

      };

    static struct soc_camera_link ov7670_link = {

    //    .power        = ov7670_power,

          .board_info    = &ov7670_i2c_camera[0],

          .i2c_adapter_id    = 1,

          .bus_id        = 1,

          .priv        = &ov7670_info,

    };

    2)、Add follows to replace the mt9t031 infomation :

    static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = {

    #if defined(CONFIG_DA850_UI_CAMERA)

    /*{

    .name = "mt9t031",

    .board_info = {

    I2C_BOARD_INFO("mt9t031", 0x5d),

    .platform_data = (void *)1,

    },

    .vpif_if = {

    .if_type = VPIF_IF_RAW_BAYER,                     //vpif_if has three format vpif_if BT656 BT1120 and VPIF_IF_RAW_BAYER

    .hd_pol = 0,

    .vd_pol = 0,

    .fid_pol = 0,

    },

    },*/  

                 {

                    .name="ov7670",

                    .board_info={

                                 I2C_BOARD_INFO("ov7670",0x42),

                                .platform_data=&ov7670_link,

                         },

                   .vpif_if = {

                               .if_type=VPIF_IF_RAW_BAYER,

                               .hd_pol=0,

                               .vd_pol=1,

                               .fid_pol=0,

                     },  

               } 

    }

     

    static const struct vpif_input da850_ch2_inputs[] = {

     /*  {

    .input = {

    .index = 0,

    .name = "Camera",

    .type = V4L2_INPUT_TYPE_CAMERA,

    .std = V4L2_STD_BAYER_ALL

    },

    .subdev_name = "mt9t031",

    },*/

     

          {

               .input={

                    .index=0,

                    .name="Camera",

                    .type= V4L2_INPUT_TYPE_CAMERA,

                    .std = V4L2_STD_BAYER_ALL

               },

                  .subdev_name="ov7670",

              },                                      //  revised as the ov7670 device 

     

     

    Third: In file psp/linux-2.6.37-psp03.21.00.04.sdk/drivers/media/video/davinci/vpif_capture.c

    The function of :

    static __init int vpif_probe(struct platform_device *pdev)

      /*if (cpu_is_davinci_da850() &&!strcmp(subdevdata->name, "mt9t031")) {  */

                 if (cpu_is_davinci_da850() && !strcmp(subdevdata->name,"ov7670")){  

        I also have a doubt ,should we modify the file psp/linux-2.6.37-psp03.21.00.04.sdk/drivers/media/video ov7670_read() and ov7670_write()function ? because the ov7670 use sccb communicationprotocal .

       At last a brief introduce daughter boards as follows,could you confirm some problems in the daughter baoard design.

    My daughterboard schematic as follows:

      1)、the first figure is LOGIC L138EVM J29 Port that connect to daughter board.

    I mainly use CVIDEO_DIN[0:7] I2C_SDL,I2C_SCL,VPIF_CLKIN0,CVIDEO_DIN14_HSYNC and CVIDEO_DIN15_VSYNC to connect to ov7670 camera.

    2)、the second figure is the DIP_16 pin to connect a ov7670 camera module.

    Attached is the LOGIC L138 EVM board shcematic and daughter board shcematic.

    1488.L138daughter boards.pdf1732.1016572B_AM1808_OMAP-L138_Baseboard_Schematic.pdf


       Thanks every much.

  • Hi Titusrathinaraj,

           Thanks for you reply, the post you suggest i have visited it ,First i add the ov7670 driver when make menuconfig ,then i add the ov7670 infomation to board-da850-evm.c

          I attach the board file , But the problem is the same before i post  ,could you help me to find what is wrong i have made .

         

    3568.board-da850-evm.c
    /*
     * TI DA850/OMAP-L138 EVM board
     *
     * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
     *
     * Derived from: arch/arm/mach-davinci/board-da830-evm.c
     * Original Copyrights follow:
     *
     * 2007, 2009 (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/console.h>
    #include <linux/i2c.h>
    #include <linux/i2c/at24.h>
    #include <linux/i2c/pca953x.h>
    #include <linux/input.h>
    #include <linux/mfd/tps6507x.h>
    #include <linux/gpio.h>
    #include <linux/gpio_keys.h>
    #include <linux/platform_device.h>
    #include <linux/interrupt.h>
    #include <linux/mtd/mtd.h>
    #include <linux/mtd/nand.h>
    #include <linux/mtd/partitions.h>
    #include <linux/regulator/machine.h>
    #include <linux/regulator/tps6507x.h>
    #include <linux/input/tps6507x-ts.h>
    #include <linux/spi/spi.h>
    #include <linux/spi/flash.h>
    #include <linux/delay.h>
    #include <linux/i2c-gpio.h>
    #include <linux/pwm_backlight.h>
    #include <linux/wl12xx.h>
    
    #include <asm/mach-types.h>
    #include <asm/mach/arch.h>
    
    #include <mach/cp_intc.h>
    #include <mach/da8xx.h>
    #include <mach/nand.h>
    #include <mach/mux.h>
    #include <mach/aemif.h>
    #include <mach/spi.h>
    #include <mach/flash.h>
    #include <mach/usb.h>
    #include <mach/vpif.h>
    #include <media/davinci/videohd.h>
    
    #include <media/tvp514x.h>
    
    #include <media/soc_camera.h>             //add the head file 
    #include "../../../drivers/media/video/ov7670.h"
    #define DA850_EVM_PHY_ID		"0:00"
    #define DA850_LCD_PWR_PIN		GPIO_TO_PIN(2, 8)
    #define DA850_LCD_BL_PIN		GPIO_TO_PIN(2, 15)
    
    #define DA850_MMCSD_CD_PIN		GPIO_TO_PIN(4, 0)
    #define DA850_MMCSD_WP_PIN		GPIO_TO_PIN(4, 1)
    
    #define DA850_MII_MDIO_CLKEN_PIN	GPIO_TO_PIN(2, 6)
    
    #define DA850_SD_ENABLE_PIN		GPIO_TO_PIN(0, 11)
    
    #define DA850_WLAN_EN			GPIO_TO_PIN(6, 9)
    #define DA850_WLAN_IRQ			GPIO_TO_PIN(6, 10)
    
    #define DAVINCI_BACKLIGHT_MAX_BRIGHTNESS	250
    #define DAVINVI_BACKLIGHT_DEFAULT_BRIGHTNESS	250
    #define DAVINCI_PWM_PERIOD_NANO_SECONDS		(10000 * 10)
    
    #define PWM_DEVICE_ID	"ehrpwm.1"
    
    
    /* Enabling GPIO for WL1271's Bluetooth */
    #define WL1271_BT_EN_GPIO GPIO_TO_PIN(0, 15)
    
    /* Enabling GPIOs for WL1271's BT, FM, GPS respectively (-1 if not used) */
    static int gpios[] = { WL1271_BT_EN_GPIO, -1, -1};
    
    static struct platform_device wl1271_device = {
           .name           = "kim",
           .id             = -1,
           .dev.platform_data = &gpios,
    };
    
    
    static struct platform_pwm_backlight_data da850evm_backlight_data = {
    	.pwm_id		= PWM_DEVICE_ID,
    	.ch		= 0,
    	.max_brightness	= DAVINCI_BACKLIGHT_MAX_BRIGHTNESS,
    	.dft_brightness	= DAVINVI_BACKLIGHT_DEFAULT_BRIGHTNESS,
    	.pwm_period_ns	= DAVINCI_PWM_PERIOD_NANO_SECONDS,
    };
    
    static struct platform_device da850evm_backlight = {
    	.name		= "pwm-backlight",
    	.id		= -1,
    	.dev		= {
    		.platform_data	= &da850evm_backlight_data,
    	}
    };
    
    static struct davinci_spi_platform_data da850evm_spi1_pdata = {
    	.version	= SPI_VERSION_2,
    	.num_chipselect = 1,
    	.intr_line      = 1,
    };
    
    static struct mtd_partition da850evm_spiflash_part[] = {
    	[0] = {
    		.name = "UBL",
    		.offset = 0,
    		.size = SZ_64K,
    		.mask_flags = MTD_WRITEABLE,
    	},
    	[1] = {
    		.name = "U-Boot",
    		.offset = MTDPART_OFS_APPEND,
    		.size = SZ_512K,
    		.mask_flags = MTD_WRITEABLE,
    	},
    	[2] = {
    		.name = "U-Boot-Env",
    		.offset = MTDPART_OFS_APPEND,
    		.size = SZ_64K,
    		.mask_flags = MTD_WRITEABLE,
    	},
    	[3] = {
    		.name = "Kernel",
    		.offset = MTDPART_OFS_APPEND,
    		.size = SZ_2M + SZ_512K,
    		.mask_flags = 0,
    	},
    	[4] = {
    		.name = "Filesystem",
    		.offset = MTDPART_OFS_APPEND,
    		.size = SZ_4M,
    		.mask_flags = 0,
    	},
    	[5] = {
    		.name = "MAC-Address",
    		.offset = SZ_8M - SZ_64K,
    		.size = SZ_64K,
    		.mask_flags = MTD_WRITEABLE,
    	},
    };
    
    static struct flash_platform_data da850evm_spiflash_data = {
    	.name		= "m25p80",
    	.parts		= da850evm_spiflash_part,
    	.nr_parts	= ARRAY_SIZE(da850evm_spiflash_part),
    };
    
    static struct davinci_spi_config da850evm_spiflash_cfg = {
    	.io_type	= SPI_IO_TYPE_DMA,
    	.c2tdelay	= 8,
    	.t2cdelay	= 8,
    };
    
    static struct spi_board_info da850evm_spi_info[] = {
    	{
    		.modalias		= "m25p80",
    		.platform_data		= &da850evm_spiflash_data,
    		.controller_data	= &da850evm_spiflash_cfg,
    		.mode			= SPI_MODE_0,
    		.max_speed_hz		= 30000000,
    		.bus_num		= 1,
    		.chip_select		= 0,
    	},
    };
    
    static void m25p80_notify_add(struct mtd_info *mtd)
    {
    	char *mac_addr = davinci_soc_info.emac_pdata->mac_addr;
    	size_t retlen;
    
    	if (!strcmp(mtd->name, "MAC-Address")) {
    		mtd->read(mtd, 0, ETH_ALEN, &retlen, mac_addr);
    		if (retlen == ETH_ALEN)
    			pr_info("Read MAC addr from SPI Flash: %pM\n",
    					mac_addr);
    	}
    }
    
    static struct mtd_notifier spi_notifier = {
    	.add    = m25p80_notify_add,
    };
    
    static void __init da850evm_init_spi1(struct spi_board_info *info, unsigned len)
    {
    	int ret;
    
    	ret = spi_register_board_info(info, len);
    	if (ret)
    		pr_warning("failed to register board info : %d\n", ret);
    
    	ret = da8xx_register_spi(1, &da850evm_spi1_pdata);
    	if (ret)
    		pr_warning("failed to register spi 1 device : %d\n", ret);
    
    	if (!(system_rev & 0x100))
    		register_mtd_user(&spi_notifier);
    }
    
    #define TVP5147_CH0		"tvp514x-0"
    #define TVP5147_CH1		"tvp514x-1"
    
    #define VPIF_STATUS	(0x002C)
    #define VPIF_STATUS_CLR	(0x0030)
    
    static struct mtd_partition da850_evm_norflash_partition[] = {
    	{
    		.name           = "bootloaders + env",
    		.offset         = 0,
    		.size           = SZ_512K,
    		.mask_flags     = MTD_WRITEABLE,
    	},
    	{
    		.name           = "kernel",
    		.offset         = MTDPART_OFS_APPEND,
    		.size           = SZ_2M,
    		.mask_flags     = 0,
    	},
    	{
    		.name           = "filesystem",
    		.offset         = MTDPART_OFS_APPEND,
    		.size           = MTDPART_SIZ_FULL,
    		.mask_flags     = 0,
    	},
    };
    
    static struct davinci_aemif_timing da850_evm_norflash_timing = {
    	.wsetup		= 10,
    	.wstrobe	= 60,
    	.whold		= 10,
    	.rsetup		= 10,
    	.rstrobe	= 110,
    	.rhold		= 10,
    	.ta		= 30,
    };
    
    static struct davinciflash_pdata da850_evm_norflash_data = {
    	.width		= 2,
    	.parts		= da850_evm_norflash_partition,
    	.nr_parts	= ARRAY_SIZE(da850_evm_norflash_partition),
    	.timing		= &da850_evm_norflash_timing,
    };
    
    static struct resource da850_evm_norflash_resource[] = {
    	{
    		.start	= DA8XX_AEMIF_CS2_BASE,
    		.end	= DA8XX_AEMIF_CS2_BASE + SZ_32M - 1,
    		.flags	= IORESOURCE_MEM,
    	},
    	{
    		.start	= DA8XX_AEMIF_CTL_BASE,
    		.end	= DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
    		.flags	= IORESOURCE_MEM,
    	},
    };
    
    static struct platform_device da850_evm_norflash_device = {
    	.name		= "davinci-flash",
    	.id		= 0,
    	.dev		= {
    		.platform_data  = &da850_evm_norflash_data,
    	},
    	.num_resources	= ARRAY_SIZE(da850_evm_norflash_resource),
    	.resource	= da850_evm_norflash_resource,
    };
    
    static struct davinci_pm_config da850_pm_pdata = {
    	.sleepcount = 128,
    };
    
    static struct platform_device da850_pm_device = {
    	.name           = "pm-davinci",
    	.dev = {
    		.platform_data	= &da850_pm_pdata,
    	},
    	.id             = -1,
    };
    
    /* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash
     * (128K blocks). It may be used instead of the (default) SPI flash
     * to boot, using TI's tools to install the secondary boot loader
     * (UBL) and U-Boot.
     */
    static struct mtd_partition da850_evm_nandflash_partition[] = {
    	{
    		.name		= "u-boot env",
    		.offset		= 0,
    		.size		= SZ_128K,
    		.mask_flags	= MTD_WRITEABLE,
    	 },
    	{
    		.name		= "UBL",
    		.offset		= MTDPART_OFS_APPEND,
    		.size		= SZ_128K,
    		.mask_flags	= MTD_WRITEABLE,
    	},
    	{
    		.name		= "u-boot",
    		.offset		= MTDPART_OFS_APPEND,
    		.size		= 4 * SZ_128K,
    		.mask_flags	= MTD_WRITEABLE,
    	},
    	{
    		.name		= "kernel",
    		.offset		= 0x200000,
    		.size		= SZ_4M,
    		.mask_flags	= 0,
    	},
    	{
    		.name		= "filesystem",
    		.offset		= MTDPART_OFS_APPEND,
    		.size		= MTDPART_SIZ_FULL,
    		.mask_flags	= 0,
    	},
    };
    
    static struct davinci_aemif_timing da850_evm_nandflash_timing = {
    	.wsetup		= 24,
    	.wstrobe	= 21,
    	.whold		= 14,
    	.rsetup		= 19,
    	.rstrobe	= 50,
    	.rhold		= 0,
    	.ta		= 20,
    };
    
    static struct davinci_nand_pdata da850_evm_nandflash_data = {
    	.parts		= da850_evm_nandflash_partition,
    	.nr_parts	= ARRAY_SIZE(da850_evm_nandflash_partition),
    	.ecc_mode	= NAND_ECC_HW,
    	.ecc_bits	= 4,
    	.options	= NAND_USE_FLASH_BBT,
    	.timing		= &da850_evm_nandflash_timing,
    };
    
    static struct resource da850_evm_nandflash_resource[] = {
    	{
    		.start	= DA8XX_AEMIF_CS3_BASE,
    		.end	= DA8XX_AEMIF_CS3_BASE + SZ_512K + 2 * SZ_1K - 1,
    		.flags	= IORESOURCE_MEM,
    	},
    	{
    		.start	= DA8XX_AEMIF_CTL_BASE,
    		.end	= DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
    		.flags	= IORESOURCE_MEM,
    	},
    };
    
    static struct platform_device da850_evm_nandflash_device = {
    	.name		= "davinci_nand",
    	.id		= 1,
    	.dev		= {
    		.platform_data	= &da850_evm_nandflash_data,
    	},
    	.num_resources	= ARRAY_SIZE(da850_evm_nandflash_resource),
    	.resource	= da850_evm_nandflash_resource,
    };
    
    static struct platform_device *da850_evm_devices[] __initdata = {
    	&da850_evm_nandflash_device,
    	&da850_evm_norflash_device,
    };
    
    static const short da850_evm_nand_pins[] = {
    	DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3,
    	DA850_EMA_D_4, DA850_EMA_D_5, DA850_EMA_D_6, DA850_EMA_D_7,
    	DA850_EMA_A_1, DA850_EMA_A_2, DA850_NEMA_CS_3, DA850_NEMA_CS_4,
    	DA850_NEMA_WE, DA850_NEMA_OE,
    	-1
    };
    
    static const short da850_evm_nor_pins[] = {
    	DA850_EMA_BA_1, DA850_EMA_CLK, DA850_EMA_WAIT_1, DA850_NEMA_CS_2,
    	DA850_NEMA_WE, DA850_NEMA_OE, DA850_EMA_D_0, DA850_EMA_D_1,
    	DA850_EMA_D_2, DA850_EMA_D_3, DA850_EMA_D_4, DA850_EMA_D_5,
    	DA850_EMA_D_6, DA850_EMA_D_7, DA850_EMA_D_8, DA850_EMA_D_9,
    	DA850_EMA_D_10, DA850_EMA_D_11, DA850_EMA_D_12, DA850_EMA_D_13,
    	DA850_EMA_D_14, DA850_EMA_D_15, DA850_EMA_A_0, DA850_EMA_A_1,
    	DA850_EMA_A_2, DA850_EMA_A_3, DA850_EMA_A_4, DA850_EMA_A_5,
    	DA850_EMA_A_6, DA850_EMA_A_7, DA850_EMA_A_8, DA850_EMA_A_9,
    	DA850_EMA_A_10, DA850_EMA_A_11, DA850_EMA_A_12, DA850_EMA_A_13,
    	DA850_EMA_A_14, DA850_EMA_A_15, DA850_EMA_A_16, DA850_EMA_A_17,
    	DA850_EMA_A_18, DA850_EMA_A_19, DA850_EMA_A_20, DA850_EMA_A_21,
    	DA850_EMA_A_22, DA850_EMA_A_23,
    	-1
    };
    
    static u32 ui_card_detected;
    
    #if defined(CONFIG_MMC_DAVINCI) || \
        defined(CONFIG_MMC_DAVINCI_MODULE)
    #define HAS_MMC 1
    #else
    #define HAS_MMC 0
    #endif
    
    /* have_imager() - Check if we have support for imager interface */
    static inline int have_imager(void)
    {
    #if defined(CONFIG_DA850_UI_CAMERA)
    	return 1;
    #else
    	return 0;
    #endif
    }
    
    static inline void da850_evm_setup_nor_nand(void)
    {
    	int ret = 0;
    
    	if (ui_card_detected && !HAS_MMC) {
    		ret = davinci_cfg_reg_list(da850_evm_nand_pins);
    		if (ret)
    			pr_warning("da850_evm_init: nand mux setup failed: "
    					"%d\n", ret);
    
    		ret = davinci_cfg_reg(DA850_GPIO0_11);
    		if (ret)
    			pr_warning("da850_evm_init:GPIO(0,11) mux setup "
    					"failed\n");
    
    		ret = gpio_request(DA850_SD_ENABLE_PIN, "mmc_sd_en");
    		if (ret)
    			pr_warning("Cannot open GPIO %d\n",
    					DA850_SD_ENABLE_PIN);
    
    		/* Driver GP0[11] low for NOR to work */
    		gpio_direction_output(DA850_SD_ENABLE_PIN, 0);
    
    		ret = davinci_cfg_reg_list(da850_evm_nor_pins);
    		if (ret)
    			pr_warning("da850_evm_init: nor mux setup failed: %d\n",
    				ret);
    
    		platform_add_devices(da850_evm_devices,
    					ARRAY_SIZE(da850_evm_devices));
    	} else if (ui_card_detected && HAS_MMC) {
    		/*
    		 * On Logic PD Rev.3 EVMs GP0[11] pin needs to be configured
    		 * for MMC and NOR to work. When GP0[11] is low, the SD0
    		 * interface will not work, but NOR flash will. When GP0[11]
    		 * is high, SD0 will work but NOR flash will not. By default
    		 * we are assuming that GP0[11] pin is driven high, when UI
    		 * card is not connected. Hence we are not configuring the
    		 * GP0[11] pin when MMC/SD is enabled and UI card is not
    		 * connected. Not configuring the GPIO pin will enable the
    		 * bluetooth to work on AM18x as it requires the GP0[11]
    		 * pin for UART flow control.
    		 */
    		ret = davinci_cfg_reg(DA850_GPIO0_11);
    		if (ret)
    			pr_warning("da850_evm_init:GPIO(0,11) mux setup "
    					"failed\n");
    
    		ret = gpio_request(DA850_SD_ENABLE_PIN, "mmc_sd_en");
    		if (ret)
    			pr_warning("Cannot open GPIO %d\n",
    					DA850_SD_ENABLE_PIN);
    
    		/* Driver GP0[11] high for SD to work */
    		gpio_direction_output(DA850_SD_ENABLE_PIN, 1);
    	}
    }
    
    #ifdef CONFIG_DA850_UI_RMII
    static inline void da850_evm_setup_emac_rmii(int rmii_sel)
    {
    	struct davinci_soc_info *soc_info = &davinci_soc_info;
    
    	soc_info->emac_pdata->rmii_en = 1;
    	gpio_set_value_cansleep(rmii_sel, 0);
    }
    #else
    static inline void da850_evm_setup_emac_rmii(int rmii_sel) { }
    #endif
    
    
    #define DA850_KEYS_DEBOUNCE_MS	10
    /*
     * At 200ms polling interval it is possible to miss an
     * event by tapping very lightly on the push button but most
     * pushes do result in an event; longer intervals require the
     * user to hold the button whereas shorter intervals require
     * more CPU time for polling.
     */
    #define DA850_GPIO_KEYS_POLL_MS	200
    
    enum da850_evm_ui_exp_pins {
    	DA850_EVM_UI_EXP_SEL_C = 5,
    	DA850_EVM_UI_EXP_SEL_B,
    	DA850_EVM_UI_EXP_SEL_A,
    	DA850_EVM_UI_EXP_PB8,
    	DA850_EVM_UI_EXP_PB7,
    	DA850_EVM_UI_EXP_PB6,
    	DA850_EVM_UI_EXP_PB5,
    	DA850_EVM_UI_EXP_PB4,
    	DA850_EVM_UI_EXP_PB3,
    	DA850_EVM_UI_EXP_PB2,
    	DA850_EVM_UI_EXP_PB1,
    };
    
    static const char const *da850_evm_ui_exp[] = {
    	[DA850_EVM_UI_EXP_SEL_C]        = "sel_c",
    	[DA850_EVM_UI_EXP_SEL_B]        = "sel_b",
    	[DA850_EVM_UI_EXP_SEL_A]        = "sel_a",
    	[DA850_EVM_UI_EXP_PB8]          = "pb8",
    	[DA850_EVM_UI_EXP_PB7]          = "pb7",
    	[DA850_EVM_UI_EXP_PB6]          = "pb6",
    	[DA850_EVM_UI_EXP_PB5]          = "pb5",
    	[DA850_EVM_UI_EXP_PB4]          = "pb4",
    	[DA850_EVM_UI_EXP_PB3]          = "pb3",
    	[DA850_EVM_UI_EXP_PB2]          = "pb2",
    	[DA850_EVM_UI_EXP_PB1]          = "pb1",
    };
    
    #define DA850_N_UI_PB		8
    
    static struct gpio_keys_button da850_evm_ui_keys[] = {
    	[0 ... DA850_N_UI_PB - 1] = {
    		.type			= EV_KEY,
    		.active_low		= 1,
    		.wakeup			= 0,
    		.debounce_interval	= DA850_KEYS_DEBOUNCE_MS,
    		.code			= -1, /* assigned at runtime */
    		.gpio			= -1, /* assigned at runtime */
    		.desc			= NULL, /* assigned at runtime */
    	},
    };
    
    static struct gpio_keys_platform_data da850_evm_ui_keys_pdata = {
    	.buttons = da850_evm_ui_keys,
    	.nbuttons = ARRAY_SIZE(da850_evm_ui_keys),
    	.poll_interval = DA850_GPIO_KEYS_POLL_MS,
    };
    
    static struct platform_device da850_evm_ui_keys_device = {
    	.name = "gpio-keys-polled",
    	.id = 0,
    	.dev = {
    		.platform_data = &da850_evm_ui_keys_pdata
    	},
    };
    
    static void da850_evm_ui_keys_init(unsigned gpio)
    {
    	int i;
    	struct gpio_keys_button *button;
    
    	for (i = 0; i < DA850_N_UI_PB; i++) {
    		button = &da850_evm_ui_keys[i];
    		button->code = KEY_F8 - i;
    		button->desc = (char *)
    				da850_evm_ui_exp[DA850_EVM_UI_EXP_PB8 + i];
    		button->gpio = gpio + DA850_EVM_UI_EXP_PB8 + i;
    	}
    }
    
    #ifdef CONFIG_DA850_UI_CLCD
    static inline void da850_evm_setup_char_lcd(int a, int b, int c)
    {
    	gpio_set_value_cansleep(a, 0);
    	gpio_set_value_cansleep(b, 0);
    	gpio_set_value_cansleep(c, 0);
    }
    #else
    static inline void da850_evm_setup_char_lcd(int a, int b, int c) { }
    #endif
    
    static struct at24_platform_data da850_evm_i2c_eeprom_info = {
    	.byte_len	= SZ_256K / 8,
    	.page_size	= 64,
    	.flags		= AT24_FLAG_ADDR16,
    	.setup		= davinci_get_mac_addr,
    	.context	= (void *)0x7f00,
    };
    
    #ifdef CONFIG_DA850_UI_SD_VIDEO_PORT
    static inline void da850_evm_setup_video_port(int video_sel)
    {
    	gpio_set_value_cansleep(video_sel, 0);
    }
    #else
    static inline void da850_evm_setup_video_port(int video_sel) { }
    #endif
    
    #ifdef CONFIG_DA850_UI_CAMERA
    static inline void da850_evm_setup_camera(int camera_sel)
    {
    	gpio_set_value_cansleep(camera_sel, 0);
    }
    #else
    static inline void da850_evm_setup_camera(int camera_sel) { }
    #endif
    
    static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
    						unsigned ngpio, void *c)
    {
    	int sel_a, sel_b, sel_c, ret;
    
    	sel_a = gpio + DA850_EVM_UI_EXP_SEL_A;
    	sel_b = gpio + DA850_EVM_UI_EXP_SEL_B;
    	sel_c = gpio + DA850_EVM_UI_EXP_SEL_C;
    
    	ret = gpio_request(sel_a, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]);
    	if (ret) {
    		pr_warning("Cannot open UI expander pin %d\n", sel_a);
    		goto exp_setup_sela_fail;
    	}
    
    	ret = gpio_request(sel_b, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]);
    	if (ret) {
    		pr_warning("Cannot open UI expander pin %d\n", sel_b);
    		goto exp_setup_selb_fail;
    	}
    
    	ret = gpio_request(sel_c, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_C]);
    	if (ret) {
    		pr_warning("Cannot open UI expander pin %d\n", sel_c);
    		goto exp_setup_selc_fail;
    	}
    
    	/* deselect all functionalities */
    	gpio_direction_output(sel_a, 1);
    	gpio_direction_output(sel_b, 1);
    	gpio_direction_output(sel_c, 1);
    
    	da850_evm_ui_keys_init(gpio);
    	ret = platform_device_register(&da850_evm_ui_keys_device);
    	if (ret) {
    		pr_warning("Could not register UI GPIO expander push-buttons");
    		goto exp_setup_keys_fail;
    	}
    
    	ui_card_detected = 1;
    	pr_info("DA850/OMAP-L138 EVM UI card detected\n");
    
    	da850_evm_setup_nor_nand();
    
    	da850_evm_setup_emac_rmii(sel_a);
    
    	da850_evm_setup_char_lcd(sel_a, sel_b, sel_c);
    
    	da850_evm_setup_video_port(sel_c);
    
    	da850_evm_setup_camera(sel_b);
    
    	return 0;
    
    exp_setup_keys_fail:
    	gpio_free(sel_c);
    exp_setup_selc_fail:
    	gpio_free(sel_b);
    exp_setup_selb_fail:
    	gpio_free(sel_a);
    exp_setup_sela_fail:
    	return ret;
    }
    
    static int da850_evm_ui_expander_teardown(struct i2c_client *client,
    					unsigned gpio, unsigned ngpio, void *c)
    {
    	platform_device_unregister(&da850_evm_ui_keys_device);
    
    	/* deselect all functionalities */
    	gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_C, 1);
    	gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_B, 1);
    	gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_A, 1);
    
    	gpio_free(gpio + DA850_EVM_UI_EXP_SEL_C);
    	gpio_free(gpio + DA850_EVM_UI_EXP_SEL_B);
    	gpio_free(gpio + DA850_EVM_UI_EXP_SEL_A);
    
    	return 0;
    }
    
    /* assign the baseboard expander's GPIOs after the UI board's */
    #define DA850_UI_EXPANDER_N_GPIOS ARRAY_SIZE(da850_evm_ui_exp)
    #define DA850_BB_EXPANDER_GPIO_BASE (DAVINCI_N_GPIO + DA850_UI_EXPANDER_N_GPIOS)
    
    enum da850_evm_bb_exp_pins {
    	DA850_EVM_BB_EXP_DEEP_SLEEP_EN = 0,
    	DA850_EVM_BB_EXP_SW_RST,
    	DA850_EVM_BB_EXP_TP_23,
    	DA850_EVM_BB_EXP_TP_22,
    	DA850_EVM_BB_EXP_TP_21,
    	DA850_EVM_BB_EXP_USER_PB1,
    	DA850_EVM_BB_EXP_USER_LED2,
    	DA850_EVM_BB_EXP_USER_LED1,
    	DA850_EVM_BB_EXP_USER_SW1,
    	DA850_EVM_BB_EXP_USER_SW2,
    	DA850_EVM_BB_EXP_USER_SW3,
    	DA850_EVM_BB_EXP_USER_SW4,
    	DA850_EVM_BB_EXP_USER_SW5,
    	DA850_EVM_BB_EXP_USER_SW6,
    	DA850_EVM_BB_EXP_USER_SW7,
    	DA850_EVM_BB_EXP_USER_SW8
    };
    
    static const char const *da850_evm_bb_exp[] = {
    	[DA850_EVM_BB_EXP_DEEP_SLEEP_EN]	= "deep_sleep_en",
    	[DA850_EVM_BB_EXP_SW_RST]		= "sw_rst",
    	[DA850_EVM_BB_EXP_TP_23]		= "tp_23",
    	[DA850_EVM_BB_EXP_TP_22]		= "tp_22",
    	[DA850_EVM_BB_EXP_TP_21]		= "tp_21",
    	[DA850_EVM_BB_EXP_USER_PB1]		= "user_pb1",
    	[DA850_EVM_BB_EXP_USER_LED2]		= "user_led2",
    	[DA850_EVM_BB_EXP_USER_LED1]		= "user_led1",
    	[DA850_EVM_BB_EXP_USER_SW1]		= "user_sw1",
    	[DA850_EVM_BB_EXP_USER_SW2]		= "user_sw2",
    	[DA850_EVM_BB_EXP_USER_SW3]		= "user_sw3",
    	[DA850_EVM_BB_EXP_USER_SW4]		= "user_sw4",
    	[DA850_EVM_BB_EXP_USER_SW5]		= "user_sw5",
    	[DA850_EVM_BB_EXP_USER_SW6]		= "user_sw6",
    	[DA850_EVM_BB_EXP_USER_SW7]		= "user_sw7",
    	[DA850_EVM_BB_EXP_USER_SW8]		= "user_sw8",
    };
    
    #define DA850_N_BB_USER_SW	8
    
    static struct gpio_keys_button da850_evm_bb_keys[] = {
    	[0] = {
    		.type			= EV_KEY,
    		.active_low		= 1,
    		.wakeup			= 0,
    		.debounce_interval	= DA850_KEYS_DEBOUNCE_MS,
    		.code			= KEY_PROG1,
    		.desc			= NULL, /* assigned at runtime */
    		.gpio			= -1, /* assigned at runtime */
    	},
    	[1 ... DA850_N_BB_USER_SW] = {
    		.type			= EV_SW,
    		.active_low		= 1,
    		.wakeup			= 0,
    		.debounce_interval	= DA850_KEYS_DEBOUNCE_MS,
    		.code			= -1, /* assigned at runtime */
    		.desc			= NULL, /* assigned at runtime */
    		.gpio			= -1, /* assigned at runtime */
    	},
    };
    
    static struct gpio_keys_platform_data da850_evm_bb_keys_pdata = {
    	.buttons = da850_evm_bb_keys,
    	.nbuttons = ARRAY_SIZE(da850_evm_bb_keys),
    	.poll_interval = DA850_GPIO_KEYS_POLL_MS,
    };
    
    static struct platform_device da850_evm_bb_keys_device = {
    	.name = "gpio-keys-polled",
    	.id = 1,
    	.dev = {
    		.platform_data = &da850_evm_bb_keys_pdata
    	},
    };
    
    static void da850_evm_bb_keys_init(unsigned gpio)
    {
    	int i;
    	struct gpio_keys_button *button;
    
    	button = &da850_evm_bb_keys[0];
    	button->desc = (char *)
    		da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_PB1];
    	button->gpio = gpio + DA850_EVM_BB_EXP_USER_PB1;
    
    	for (i = 0; i < DA850_N_BB_USER_SW; i++) {
    		button = &da850_evm_bb_keys[i + 1];
    		button->code = SW_LID + i;
    		button->desc = (char *)
    				da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_SW1 + i];
    		button->gpio = gpio + DA850_EVM_BB_EXP_USER_SW1 + i;
    	}
    }
    
    #define DA850_N_BB_USER_LED	2
    
    static struct gpio_led da850_evm_bb_leds[] = {
    	[0 ... DA850_N_BB_USER_LED - 1] = {
    		.active_low = 1,
    		.gpio = -1, /* assigned at runtime */
    		.name = NULL, /* assigned at runtime */
    	},
    };
    
    static struct gpio_led_platform_data da850_evm_bb_leds_pdata = {
    	.leds = da850_evm_bb_leds,
    	.num_leds = ARRAY_SIZE(da850_evm_bb_leds),
    };
    
    static struct platform_device da850_evm_bb_leds_device = {
    	.name		= "leds-gpio",
    	.id		= -1,
    	.dev = {
    		.platform_data = &da850_evm_bb_leds_pdata
    	}
    };
    
    static void da850_evm_bb_leds_init(unsigned gpio)
    {
    	int i;
    	struct gpio_led *led;
    
    	for (i = 0; i < DA850_N_BB_USER_LED; i++) {
    		led = &da850_evm_bb_leds[i];
    
    		led->gpio = gpio + DA850_EVM_BB_EXP_USER_LED2 + i;
    		led->name =
    			da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_LED2 + i];
    	}
    }
    
    static int da850_evm_bb_expander_setup(struct i2c_client *client,
    						unsigned gpio, unsigned ngpio,
    						void *c)
    {
    	int ret;
    
    	/*
    	 * Register the switches and pushbutton on the baseboard as a gpio-keys
    	 * device.
    	 */
    	da850_evm_bb_keys_init(gpio);
    	ret = platform_device_register(&da850_evm_bb_keys_device);
    	if (ret) {
    		pr_warning("Could not register baseboard GPIO expander keys");
    		goto io_exp_setup_sw_fail;
    	}
    
    	da850_evm_bb_leds_init(gpio);
    	ret = platform_device_register(&da850_evm_bb_leds_device);
    	if (ret) {
    		pr_warning("Could not register baseboard GPIO expander LEDS");
    		goto io_exp_setup_leds_fail;
    	}
    
    	return 0;
    
    io_exp_setup_leds_fail:
    	platform_device_unregister(&da850_evm_bb_keys_device);
    io_exp_setup_sw_fail:
    	return ret;
    }
    
    static int da850_evm_bb_expander_teardown(struct i2c_client *client,
    					unsigned gpio, unsigned ngpio, void *c)
    {
    	platform_device_unregister(&da850_evm_bb_leds_device);
    	platform_device_unregister(&da850_evm_bb_keys_device);
    
    	return 0;
    }
    
    static struct pca953x_platform_data da850_evm_ui_expander_info = {
    	.gpio_base	= DAVINCI_N_GPIO,
    	.setup		= da850_evm_ui_expander_setup,
    	.teardown	= da850_evm_ui_expander_teardown,
    	.names		= da850_evm_ui_exp,
    };
    
    static struct pca953x_platform_data da850_evm_bb_expander_info = {
    	.gpio_base	= DA850_BB_EXPANDER_GPIO_BASE,
    	.setup		= da850_evm_bb_expander_setup,
    	.teardown	= da850_evm_bb_expander_teardown,
    	.names		= da850_evm_bb_exp,
    };
    
    /*
     * USB1 VBUS is controlled by GPIO2[4], over-current is reported on GPIO6[13].
     */
    #define ON_BD_USB_DRV	GPIO_TO_PIN(2, 4)
    #define ON_BD_USB_OVC	GPIO_TO_PIN(6, 13)
    
    static const short da850_evm_usb11_pins[] = {
    	DA850_GPIO2_4, DA850_GPIO6_13,
    	-1
    };
    
    static da8xx_ocic_handler_t da850_evm_usb_ocic_handler;
    
    static int da850_evm_usb_set_power(unsigned port, int on)
    {
    	gpio_set_value(ON_BD_USB_DRV, on);
    	return 0;
    }
    
    static int da850_evm_usb_get_power(unsigned port)
    {
    	return gpio_get_value(ON_BD_USB_DRV);
    }
    
    static int da850_evm_usb_get_oci(unsigned port)
    {
    	return !gpio_get_value(ON_BD_USB_OVC);
    }
    
    static irqreturn_t da850_evm_usb_ocic_irq(int, void *);
    
    static int da850_evm_usb_ocic_notify(da8xx_ocic_handler_t handler)
    {
    	int irq		= gpio_to_irq(ON_BD_USB_OVC);
    	int error	= 0;
    
    	if (handler != NULL) {
    		da850_evm_usb_ocic_handler = handler;
    
    		error = request_irq(irq, da850_evm_usb_ocic_irq, IRQF_DISABLED |
    				    IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
    				    "OHCI over-current indicator", NULL);
    		if (error)
    			printk(KERN_ERR "%s: could not request IRQ to watch "
    			       "over-current indicator changes\n", __func__);
    	} else
    		free_irq(irq, NULL);
    
    	return error;
    }
    
    static struct da8xx_ohci_root_hub da850_evm_usb11_pdata = {
    	.set_power	= da850_evm_usb_set_power,
    	.get_power	= da850_evm_usb_get_power,
    	.get_oci	= da850_evm_usb_get_oci,
    	.ocic_notify	= da850_evm_usb_ocic_notify,
    
    	/* TPS2065 switch @ 5V */
    	.potpgt		= (3 + 1) / 2,	/* 3 ms max */
    };
    
    static irqreturn_t da850_evm_usb_ocic_irq(int irq, void *dev_id)
    {
    	da850_evm_usb_ocic_handler(&da850_evm_usb11_pdata, 1);
    	return IRQ_HANDLED;
    }
    
    static __init void da850_evm_usb_init(void)
    {
    	u32 cfgchip2;
    	int ret;
    
    	/*
    	 * Set up USB clock/mode in the CFGCHIP2 register.
    	 * FYI:  CFGCHIP2 is 0x0000ef00 initially.
    	 */
    	cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
    
    	/* USB2.0 PHY reference clock is 24 MHz */
    	cfgchip2 &= ~CFGCHIP2_REFFREQ;
    	cfgchip2 |=  CFGCHIP2_REFFREQ_24MHZ;
    
    	/*
    	 * Select internal reference clock for USB 2.0 PHY
    	 * and use it as a clock source for USB 1.1 PHY
    	 * (this is the default setting anyway).
    	 */
    	cfgchip2 &= ~CFGCHIP2_USB1PHYCLKMUX;
    	cfgchip2 |=  CFGCHIP2_USB2PHYCLKMUX;
    
    	/*
    	 * We have to override VBUS/ID signals when MUSB is configured into the
    	 * host-only mode -- ID pin will float if no cable is connected, so the
    	 * controller won't be able to drive VBUS thinking that it's a B-device.
    	 * Otherwise, we want to use the OTG mode and enable VBUS comparators.
    	 */
    	cfgchip2 &= ~CFGCHIP2_OTGMODE;
    #ifdef	CONFIG_USB_MUSB_HOST
    	cfgchip2 |=  CFGCHIP2_FORCE_HOST;
    #else
    	cfgchip2 |=  CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN;
    #endif
    
    	__raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
    
    	/*
    	 * TPS2065 switch @ 5V supplies 1 A (sustains 1.5 A),
    	 * with the power on to power good time of 3 ms.
    	 */
    	ret = da8xx_register_usb20(1000, 3);
    	if (ret)
    		pr_warning("%s: USB 2.0 registration failed: %d\n",
    			   __func__, ret);
    
    	ret = davinci_cfg_reg_list(da850_evm_usb11_pins);
    	if (ret) {
    		pr_warning("%s: USB 1.1 PinMux setup failed: %d\n",
    			   __func__, ret);
    		return;
    	}
    
    	ret = gpio_request(ON_BD_USB_DRV, "ON_BD_USB_DRV");
    	if (ret) {
    		printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
    		       "power control: %d\n", __func__, ret);
    		return;
    	}
    	gpio_direction_output(ON_BD_USB_DRV, 0);
    
    	ret = gpio_request(ON_BD_USB_OVC, "ON_BD_USB_OVC");
    	if (ret) {
    		printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
    		       "over-current indicator: %d\n", __func__, ret);
    		return;
    	}
    	gpio_direction_input(ON_BD_USB_OVC);
    
    	ret = da8xx_register_usb11(&da850_evm_usb11_pdata);
    	if (ret)
    		pr_warning("%s: USB 1.1 registration failed: %d\n",
    			   __func__, ret);
    }
    
    static struct davinci_uart_config da850_evm_uart_config __initdata = {
    	.enabled_uarts = 0x7,
    };
    
    /* davinci da850 evm audio machine driver */
    static u8 da850_iis_serializer_direction[] = {
    	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
    	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
    	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	TX_MODE,
    	RX_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
    };
    
    static struct snd_platform_data da850_evm_snd_data = {
    	.tx_dma_offset	= 0x2000,
    	.rx_dma_offset	= 0x2000,
    	.op_mode	= DAVINCI_MCASP_IIS_MODE,
    	.num_serializer	= ARRAY_SIZE(da850_iis_serializer_direction),
    	.tdm_slots	= 2,
    	.serial_dir	= da850_iis_serializer_direction,
    	.asp_chan_q	= EVENTQ_0,
    	.version	= MCASP_VERSION_2,
    	.txnumevt	= 1,
    	.rxnumevt	= 1,
    };
    
    static struct davinci_mcbsp_platform_data da850_mcbsp0_config = {
    	.inst	= 0,
    };
    
    static struct davinci_mcbsp_platform_data da850_mcbsp1_config = {
    	.inst	= 1,
    };
    
    static int da850_evm_mmc_get_ro(int index)
    {
    	return gpio_get_value(DA850_MMCSD_WP_PIN);
    }
    
    static int da850_evm_mmc_get_cd(int index)
    {
    	return !gpio_get_value(DA850_MMCSD_CD_PIN);
    }
    
    static int wl12xx_set_power(int slot, int power_on)
    {
    	static int power_state;
    
    	pr_debug("Powering %s wifi", (power_on ? "on" : "off"));
    
    	if (power_on == power_state)
    		return 0;
    	power_state = power_on;
    
    	if (power_on) {
    		gpio_set_value(DA850_WLAN_EN, 1);
    		mdelay(15);
    		gpio_set_value(DA850_WLAN_EN, 0);
    		mdelay(1);
    		gpio_set_value(DA850_WLAN_EN, 1);
    		mdelay(70);
    	} else {
    		gpio_set_value(DA850_WLAN_EN, 0);
    	}
    
    	return 0;
    }
    
    static struct davinci_mmc_config da850_mmc_config[] = {
    	{
    		.get_ro		= da850_evm_mmc_get_ro,
    		.get_cd		= da850_evm_mmc_get_cd,
    		.wires		= 4,
    		.max_freq	= 50000000,
    		.caps		= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
    		.version	= MMC_CTLR_VERSION_2,
    	},
    	{
    		.get_ro		= NULL,
    		.get_cd		= NULL,
    		.set_power	= wl12xx_set_power,
    		.wires		= 4,
    		.max_freq	= 25000000,
    		.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_NONREMOVABLE |
    				  MMC_CAP_POWER_OFF_CARD,
    		.version	= MMC_CTLR_VERSION_2,
    	},
    	{}	/* Terminator */
    };
    
    static void da850_panel_power_ctrl(int val)
    {
    	/* lcd power */
    	gpio_set_value(DA850_LCD_PWR_PIN, val);
    
    	mdelay(200);
    
    	/* lcd backlight */
    	gpio_set_value(DA850_LCD_BL_PIN, val);
    }
    
    static int da850_lcd_hw_init(void)
    {
    	void __iomem *cfg_mstpri2_base;
    	int status;
    	u32 val;
    
    	/*
    	 * Reconfigure the LCDC priority to the highest to ensure that
    	 * the throughput/latency requirements for the LCDC are met.
    	 */
    	cfg_mstpri2_base = DA8XX_SYSCFG0_VIRT(DA8XX_MSTPRI2_REG);
    
    	val = __raw_readl(cfg_mstpri2_base);
    	val &= 0x0fffffff;
    	__raw_writel(val, cfg_mstpri2_base);
    
    	status = gpio_request(DA850_LCD_BL_PIN, "lcd bl\n");
    	if (status < 0)
    		return status;
    
    	status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr\n");
    	if (status < 0) {
    		gpio_free(DA850_LCD_BL_PIN);
    		return status;
    	}
    
    	gpio_direction_output(DA850_LCD_BL_PIN, 0);
    	gpio_direction_output(DA850_LCD_PWR_PIN, 0);
    
    	return 0;
    }
    
    /* TPS65070 voltage regulator support */
    
    /* 3.3V */
    static struct regulator_consumer_supply tps65070_dcdc1_consumers[] = {
    	{
    		.supply = "usb0_vdda33",
    	},
    	{
    		.supply = "usb1_vdda33",
    	},
    };
    
    /* 3.3V or 1.8V */
    static struct regulator_consumer_supply tps65070_dcdc2_consumers[] = {
    	{
    		.supply = "dvdd3318_a",
    	},
    	{
    		.supply = "dvdd3318_b",
    	},
    	{
    		.supply = "dvdd3318_c",
    	},
    };
    
    /* 1.2V */
    static struct regulator_consumer_supply tps65070_dcdc3_consumers[] = {
    	{
    		.supply = "cvdd",
    	},
    };
    
    /* 1.8V LDO */
    static struct regulator_consumer_supply tps65070_ldo1_consumers[] = {
    	{
    		.supply = "sata_vddr",
    	},
    	{
    		.supply = "usb0_vdda18",
    	},
    	{
    		.supply = "usb1_vdda18",
    	},
    	{
    		.supply = "ddr_dvdd18",
    	},
    };
    
    /* 1.2V LDO */
    static struct regulator_consumer_supply tps65070_ldo2_consumers[] = {
    	{
    		.supply = "sata_vdd",
    	},
    	{
    		.supply = "pll0_vdda",
    	},
    	{
    		.supply = "pll1_vdda",
    	},
    	{
    		.supply = "usbs_cvdd",
    	},
    	{
    		.supply = "vddarnwa1",
    	},
    };
    
    /* We take advantage of the fact that both defdcdc{2,3} are tied high */
    static struct tps6507x_reg_platform_data tps6507x_platform_data = {
    	.defdcdc_default = true,
    };                                                                   //only set true or faluse to whether DCDC is high or low 
    
    static struct regulator_init_data tps65070_regulator_data[] = {
    	/* dcdc1 */
    	{
    		.constraints = {
    			.min_uV = 3150000,
    			.max_uV = 3450000,
    			.valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
    				REGULATOR_CHANGE_STATUS),
    			.boot_on = 1,
    		},
    		.num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc1_consumers),
    		.consumer_supplies = tps65070_dcdc1_consumers,
    	},
    
    	/* dcdc2 */
    	{
    		.constraints = {
    			.min_uV = 1710000,
    			.max_uV = 3450000,
    			.valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
    				REGULATOR_CHANGE_STATUS),
    			.boot_on = 1,
    		},
    		.num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc2_consumers),
    		.consumer_supplies = tps65070_dcdc2_consumers,
    		.driver_data = &tps6507x_platform_data,
    	},
    
    	/* dcdc3 */
    	{
    		.constraints = {
    			.min_uV = 950000,
    			.max_uV = 1350000,
    			.valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
    				REGULATOR_CHANGE_STATUS),
    			.boot_on = 1,
    		},
    		.num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc3_consumers),
    		.consumer_supplies = tps65070_dcdc3_consumers,
    		.driver_data = &tps6507x_platform_data,
    	},
    
    	/* ldo1 */
    	{
    		.constraints = {
    			.min_uV = 1710000,
    			.max_uV = 1890000,
    			.valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
    				REGULATOR_CHANGE_STATUS),
    			.boot_on = 1,
    		},
    		.num_consumer_supplies = ARRAY_SIZE(tps65070_ldo1_consumers),
    		.consumer_supplies = tps65070_ldo1_consumers,
    	},
    
    	/* ldo2 */
    	{
    		.constraints = {
    			.min_uV = 1140000,
    			.max_uV = 1320000,
    			.valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
    				REGULATOR_CHANGE_STATUS),
    			.boot_on = 1,
    		},
    		.num_consumer_supplies = ARRAY_SIZE(tps65070_ldo2_consumers),
    		.consumer_supplies = tps65070_ldo2_consumers,
    	},                                                                                //set the TPS6507X  five output voltage 
    };
    
    static struct touchscreen_init_data tps6507x_touchscreen_data = {                         //set the touchscreen data information 
    	.poll_period =  30,	/* ms between touch samples */
    	.min_pressure = 0x30,	/* minimum pressure to trigger touch */
    	.vref = 0,		/* turn off vref when not using A/D */
    	.vendor = 0,		/* /sys/class/input/input?/id/vendor */
    	.product = 65070,	/* /sys/class/input/input?/id/product */
    	.version = 0x100,	/* /sys/class/input/input?/id/version */
    };
    
    static struct tps6507x_board tps_board = {
    	.tps6507x_pmic_init_data = &tps65070_regulator_data[0],
    	.tps6507x_ts_init_data = &tps6507x_touchscreen_data,
    };
    
    static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
    	{
    		I2C_BOARD_INFO("24c256", 0x50),
    		.platform_data = &da850_evm_i2c_eeprom_info,
    	},
    	{
    		I2C_BOARD_INFO("tlv320aic3x", 0x18),
    	},
    	{
    		I2C_BOARD_INFO("tca6416", 0x20),
    		.platform_data = &da850_evm_ui_expander_info,
    	},
    	/*{
    		I2C_BOARD_INFO("tca6416", 0x21),
    		.platform_data = &da850_evm_bb_expander_info,
    	},*/
    	{
    		I2C_BOARD_INFO("tps6507x", 0x48),
    		.platform_data = &tps_board,
    	},
    	{
    		I2C_BOARD_INFO("cdce913", 0x65),
    	},
    	{
    		I2C_BOARD_INFO("PCA9543A", 0x73),
    	},
    };
    
    static const short da850_evm_lcdc_pins[] = {
    	DA850_GPIO2_8, DA850_GPIO2_15,
    	-1
    };
    
    static struct i2c_client *pca9543a;
    
    static int pca9543a_probe(struct i2c_client *client,
    		const struct i2c_device_id *id)
    {
    	pr_info("pca9543a_probe");
    	pca9543a = client;
    	return 0;
    }
    
    static int pca9543a_remove(struct i2c_client *client)
    {
    	pca9543a = NULL;
    	return 0;
    }
    
    static const struct i2c_device_id pca9543a_ids[] = {
    	{ "PCA9543A", 0, },
    	{ /* end of list */ },
    };
    
    /* This is for i2c driver for the MT9T031 header i2c switch */
    static struct i2c_driver pca9543a_driver = {
    	.driver.name	= "PCA9543A",
    	.id_table	= pca9543a_ids,
    	.probe		= pca9543a_probe,
    	.remove		= pca9543a_remove,
    };
    
    /**
     * da850_enable_pca9543a() - Enable/Disable I2C switch PCA9543A for sensor
     * @en: enable/disable flag
     */
    static int da850_enable_pca9543a(int en)
    {
    	static char val = 1;
    	int status = 1;
    	struct i2c_msg msg = {
    			.flags = 0,
    			.len = 1,
    			.buf = &val,
    		};
    
    	pr_info("da850evm_enable_pca9543a\n");
    	if (!en)
    		val = 0;
    
    	if (!pca9543a)
    		return -ENXIO;
    
    	msg.addr = pca9543a->addr;
    	/* turn i2c switch, pca9543a, on/off */
    	status = i2c_transfer(pca9543a->adapter, &msg, 1);       //if it has transfer 1 message succeed  ,it means i2c switch is on 
    	if (status == 1)
    		status = 0;
    
    	return status;
    }
    
    static const short da850_evm_mii_pins[] = {
    	DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
    	DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER,
    	DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3,
    	DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK,
    	DA850_MDIO_D,
    	-1
    };
    
    static const short da850_evm_rmii_pins[] = {
    	DA850_RMII_TXD_0, DA850_RMII_TXD_1, DA850_RMII_TXEN,
    	DA850_RMII_CRS_DV, DA850_RMII_RXD_0, DA850_RMII_RXD_1,
    	DA850_RMII_RXER, DA850_RMII_MHZ_50_CLK, DA850_MDIO_CLK,
    	DA850_MDIO_D,
    	-1
    };
    
    static int __init da850_evm_config_emac(void)
    {
    	void __iomem *cfg_chip3_base;
    	int ret;
    	u32 val;
    	struct davinci_soc_info *soc_info = &davinci_soc_info;
    	u8 rmii_en = soc_info->emac_pdata->rmii_en;
    
    	if (!machine_is_davinci_da850_evm())
    		return 0;
    
    	cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
    
    	val = __raw_readl(cfg_chip3_base);
    
    	if (rmii_en) {
    		val |= BIT(8);
    		ret = davinci_cfg_reg_list(da850_evm_rmii_pins);
    		pr_info("EMAC: RMII PHY configured, MII PHY will not be"
    							" functional\n");
    	} else {
    		val &= ~BIT(8);
    		ret = davinci_cfg_reg_list(da850_evm_mii_pins);
    		pr_info("EMAC: MII PHY configured, RMII PHY will not be"
    							" functional\n");
    	}
    
    	if (ret)
    		pr_warning("da850_evm_init: cpgmac/rmii mux setup failed: %d\n",
    				ret);
    
    	/* configure the CFGCHIP3 register for RMII or MII */
    	__raw_writel(val, cfg_chip3_base);
    
    	ret = davinci_cfg_reg(DA850_GPIO2_6);
    	if (ret)
    		pr_warning("da850_evm_init:GPIO(2,6) mux setup "
    							"failed\n");
    
    	ret = gpio_request(DA850_MII_MDIO_CLKEN_PIN, "mdio_clk_en");
    	if (ret) {
    		pr_warning("Cannot open GPIO %d\n",
    					DA850_MII_MDIO_CLKEN_PIN);
    		return ret;
    	}
    
    	/* Enable/Disable MII MDIO clock */
    	gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, rmii_en);
    
    	soc_info->emac_pdata->phy_id = DA850_EVM_PHY_ID;
    
    	ret = da8xx_register_emac();
    	if (ret)
    		pr_warning("da850_evm_init: emac registration failed: %d\n",
    				ret);
    
    	return 0;
    }
    device_initcall(da850_evm_config_emac);
    
    static const struct vpif_input da850_ch2_inputs[] = {
    	#if 0 	
                {
    		.input = {
    			.index = 0,
    			.name = "Camera",
    			.type = V4L2_INPUT_TYPE_CAMERA,
    			.std = V4L2_STD_BAYER_ALL
    		},
    		.subdev_name = "mt9t031",
    	  },
    
          #else
              {
               .input={
                    .index=0,
                    .name="Camera",
                    .type= V4L2_INPUT_TYPE_CAMERA,
                    .std = V4L2_STD_CAMERA_VGA
               },
                  .subdev_name="ov7670",
              },   
          #endif                                                 //  revised as the ov7670 device 
    };
    
    /*
     * The following EDMA channels/slots are not being used by drivers (for
     * example: Timer, GPIO, UART events etc) on da850/omap-l138 EVM, hence
     * they are being reserved for codecs on the DSP side.
     */
    static const s16 da850_dma0_rsv_chans[][2] = {
    	/* (offset, number) */
    	{ 8,  6},
    	{24,  4},
    	{30,  2},
    	{-1, -1}
    };
    
    static const s16 da850_dma0_rsv_slots[][2] = {
    	/* (offset, number) */
    	{ 8,  6},
    	{24,  4},
    	{30, 50},
    	{-1, -1}
    };
    
    static const s16 da850_dma1_rsv_chans[][2] = {
    	/* (offset, number) */
    	{ 0, 28},
    	{30,  2},
    	{-1, -1}
    };
    
    static const s16 da850_dma1_rsv_slots[][2] = {
    	/* (offset, number) */
    	{ 0, 28},
    	{30, 90},
    	{-1, -1}
    };
    
    static struct edma_rsv_info da850_edma_cc0_rsv = {
    	.rsv_chans	= da850_dma0_rsv_chans,
    	.rsv_slots	= da850_dma0_rsv_slots,
    };
    
    static struct edma_rsv_info da850_edma_cc1_rsv = {
    	.rsv_chans	= da850_dma1_rsv_chans,
    	.rsv_slots	= da850_dma1_rsv_slots,
    };
    
    static struct edma_rsv_info *da850_edma_rsv[2] = {
    	&da850_edma_cc0_rsv,
    	&da850_edma_cc1_rsv,
    };
    
    #ifdef CONFIG_CPU_FREQ
    static __init int da850_evm_init_cpufreq(void)
    {
    	switch (system_rev & 0xF) {
    	case 3:
    		da850_max_speed = 456000;
    		break;
    	case 2:
    		da850_max_speed = 408000;
    		break;
    	case 1:
    		da850_max_speed = 372000;
    		break;
    	}
    
    	return da850_register_cpufreq("pll0_sysclk3");
    }
    #else
    static __init int da850_evm_init_cpufreq(void) { return 0; }
    #endif
    
    static struct i2c_gpio_platform_data da850_gpio_i2c_pdata = {
    	.sda_pin	= GPIO_TO_PIN(1, 4),
    	.scl_pin	= GPIO_TO_PIN(1, 5),
    	.udelay		= 2,			/* 250 KHz */
    };
    
    static struct platform_device da850_gpio_i2c = {
    	.name		= "i2c-gpio",
    	.id		= 1,
    	.dev		= {
    		.platform_data	= &da850_gpio_i2c_pdata,
    	},
    };
    
    /* Retaining these APIs, since the VPIF drivers do not check NULL handlers */
    static int da850_set_vpif_clock(int mux_mode, int hd)
    {
    	return 0;
    }
    
    static int da850_setup_vpif_input_channel_mode(int mux_mode)
    {
    	return 0;
    }
    
    /*Enable mt9t031 by configuring pca9543a i2c switch on sensor
     */
    int da850_vpif_setup_input_path(int ch, const char *name)
    {
    	int ret = 0;
    
    	//if (have_imager())
    	//	ret = da850_enable_pca9543a(1);
          /*because we donot has pca9543a so  the input_path is always on donnot depend on pca9543a  revised by oyz 1023 */
    	return ret;
    }
    
    static int da850_vpif_intr_status(void __iomem *vpif_base, int channel)
    {
    	int status = 0;
    	int mask;
    
    	if (channel < 0 || channel > 3)
    		return 0;
    
    	mask = 1 << channel;
    	status = __raw_readl((vpif_base + VPIF_STATUS)) & mask;
    	__raw_writel(status, (vpif_base + VPIF_STATUS_CLR));
    
    	return status;
    }
    
    
    #if defined(CONFIG_DA850_UI_SD_VIDEO_PORT)
    /* VPIF capture configuration */
    static struct tvp514x_platform_data tvp5146_pdata = {
    	.clk_polarity = 0,
    	.hs_polarity = 1,
    	.vs_polarity = 1
    };
    #endif
    static struct ov7670_config ov7670_info ={                  
          .min_width =320,                           // Filter out smaller sizes 
          .min_height =240,                          // Filter out smaller sizes 
          .clock_speed       = 24,                   // External clock speed (MHz) 
          .use_smbus        =true,                     // Use smbus I/O instead of I2C 
     };
    static struct i2c_board_info ov7670_i2c_camera[] = {
       {
         I2C_BOARD_INFO("ov7670",0x21),
        // .platform_data = &ov7670_info,
        }
      };
    
    
    static struct soc_camera_link ov7670_link = {
    //    .power        = ov7670_power,
          .board_info    = &ov7670_i2c_camera[0],
          .i2c_adapter_id    = 1,                        //1,        //default is 1 modified oyz 1028
          .bus_id        = 1,
          .priv        = &ov7670_info,
    };                                                        //add follows 0514 
    
    // add the platform device to ov7670 oyz 1023 
    static struct platform_device ov7670_camera[] = {
    	{
    	.name = "ov7670",
    	.id = 0,
    	.dev = {
    		.platform_data = &ov7670_link,//(void *) 1, //&tw9900_info,
    		},
    	},
    };
    
    static struct platform_device *ov7670_devices[] __initdata = {
          &ov7670_camera[0],
    };
          
    #define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
    
    static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = {
    #if defined(CONFIG_DA850_UI_CAMERA)
    	#if 0
                    {
    		.name	= "mt9t031",
    		.board_info = {
    			I2C_BOARD_INFO("mt9t031", 0x5d),
    			.platform_data = (void *)1,
    		},
    		.vpif_if = {
    			.if_type = VPIF_IF_RAW_BAYER,                     //vpif_if has three format vpif_if BT656 BT1120 and VPIF_IF_RAW_BAYER
    			.hd_pol = 0,
    			.vd_pol = 0,
    			.fid_pol = 0,
    		},
    	},
           #else  
                 {
                    .name="ov7670",
                    .board_info={
                                 I2C_BOARD_INFO("ov7670",0x21),
                                .platform_data=&ov7670_link, // (void *)1, //                  //&ov7670_link, modified 1027
                         },
                   .vpif_if = {
                               .if_type=VPIF_IF_RAW_BAYER,
                               .hd_pol=1,
                               .vd_pol=1,
                               .fid_pol=0,
                     },  
               }   
          #endif                                                                      //add this forhead 0512
    #elif defined(CONFIG_DA850_UI_SD_VIDEO_PORT)
    	{
    		.name	= TVP5147_CH0,
    		.board_info = {
    			I2C_BOARD_INFO("tvp5146", 0x5d),
    			.platform_data = &tvp5146_pdata,
    		},
    		.input = INPUT_CVBS_VI2B,
    		.output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
    		.can_route = 1,
    		.vpif_if = {
    			.if_type = VPIF_IF_BT656,
    			.hd_pol = 1,
    			.vd_pol = 1,
    			.fid_pol = 0,
    		},
    	},
    	{
    		.name	= TVP5147_CH1,
    		.board_info = {
    			I2C_BOARD_INFO("tvp5146", 0x5c),
    			.platform_data = &tvp5146_pdata,
    		},
    		.input = INPUT_SVIDEO_VI2C_VI1C,
    		.output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
    		.can_route = 1,
    		.vpif_if = {
    			.if_type = VPIF_IF_BT656,
    			.hd_pol = 1,
    			.vd_pol = 1,
    			.fid_pol = 0,
    		},
    	},
    #endif
    };
    
    static const struct vpif_input da850_ch0_inputs[] = {
    	{
    		.input = {
    			.index = 0,
    			.name = "Composite",
    			.type = V4L2_INPUT_TYPE_CAMERA,
    			.std = TVP514X_STD_ALL,
    		},
    		.subdev_name = TVP5147_CH0,
    	},
    };
    
    static const struct vpif_input da850_ch1_inputs[] = {
           {
    		.input = {
    			.index = 0,
    			.name = "S-Video",
    			.type = V4L2_INPUT_TYPE_CAMERA,
    			.std = TVP514X_STD_ALL,
    		},
    		.subdev_name = TVP5147_CH1,
    	},
    };
    
    static struct vpif_capture_config da850_vpif_capture_config = {
    	.setup_input_channel_mode = da850_setup_vpif_input_channel_mode,
    	//.setup_input_path = da850_vpif_setup_input_path,
    	.intr_status = da850_vpif_intr_status,
    	.subdev_info = da850_vpif_capture_sdev_info,
    	.subdev_count = ARRAY_SIZE(da850_vpif_capture_sdev_info),
    #if defined(CONFIG_DA850_UI_SD_VIDEO_PORT)
    	.chan_config[0] = {
    		.inputs = da850_ch0_inputs,
    		.input_count = ARRAY_SIZE(da850_ch0_inputs),
    	},
    	.chan_config[1] = {
    		.inputs = da850_ch1_inputs,
    		.input_count = ARRAY_SIZE(da850_ch1_inputs),
    	},
    #elif defined(CONFIG_DA850_UI_CAMERA)
    	.chan_config[0] = {
    		.inputs = da850_ch2_inputs,
    		.input_count = ARRAY_SIZE(da850_ch2_inputs),
    	},
    #endif
    	.card_name      = "DA850/OMAP-L138 Video Capture",
    };
    
    /* VPIF display configuration */
    static struct vpif_subdev_info da850_vpif_subdev[] = {
    	{
    		.name	= "adv7343",
    		.board_info = {
    			I2C_BOARD_INFO("adv7343", 0x2a),
    		},
    	},
    };
    
    static const char *vpif_output[] = {
    	"Composite",
    	"Component",
    	"S-Video",
    };
    
    static struct vpif_display_config da850_vpif_display_config = {
    	.set_clock	= da850_set_vpif_clock,
    	.intr_status	= da850_vpif_intr_status,
    	.subdevinfo	= da850_vpif_subdev,
    	.subdev_count	= ARRAY_SIZE(da850_vpif_subdev),
    	.output		= vpif_output,
    	.output_count	= ARRAY_SIZE(vpif_output),
    	.card_name	= "DA850/OMAP-L138 Video Display",
    };
    
    #if defined(CONFIG_DAVINCI_MCBSP0)
    #define HAS_MCBSP0 1
    #else
    #define HAS_MCBSP0 0
    #endif
    
    #if defined(CONFIG_DAVINCI_MCBSP1)
    #define HAS_MCBSP1 1
    #else
    #define HAS_MCBSP1 0
    #endif
    
    #if defined(CONFIG_TI_DAVINCI_EMAC) || \
    	defined(CONFIG_TI_DAVINCI_EMAC_MODULE)
    #define HAS_EMAC 1
    #else
    #define HAS_EMAC 0
    #endif
    
    #if defined(CONFIG_SND_DA850_SOC_EVM) || \
    	defined(CONFIG_SND_DA850_SOC_EVM_MODULE)
    #define HAS_MCASP 1
    #else
    #define HAS_MCASP 0
    #endif
    
    #if defined(CONFIG_DAVINCI_UART1_AFE)
    #define HAS_UART1_AFE 1
    #else
    #define HAS_UART1_AFE 0
    #endif
    
    #if defined(CONFIG_DA850_UI_RMII) && (HAS_EMAC)
    #define HAS_RMII 1
    #else
    #define HAS_RMII 0
    #endif
    
    #if defined(CONFIG_DA850_UI_LCD) && defined(CONFIG_FB_DA8XX) ||\
    		defined(CONFIG_FB_DA8XX_MODULE)
    #define HAS_GLCD 1
    #else
    #define HAS_GLCD 0
    #endif
    
    #if defined(CONFIG_VIDEO_DAVINCI_VPIF_DISPLAY) ||\
    		defined(CONFIG_VIDEO_DAVINCI_VPIF_DISPLAY_MODULE)
    #define HAS_VPIF_DISPLAY 1
    #else
    #define HAS_VPIF_DISPLAY 0
    #endif
    
    #if defined(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) ||\
    		defined(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE_MODULE)
    #define HAS_VPIF_CAPTURE 1
    #else
    #define HAS_VPIF_CAPTURE 0
    #endif
    
    #if defined(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) ||\
    		defined(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE_MODULE)
    #define HAS_VPIF_CAPTURE 1
    #else
    #define HAS_VPIF_CAPTURE 0
    #endif
    
    #define DA850EVM_SATA_REFCLKPN_RATE	(100 * 1000 * 1000)
    
    #if defined(CONFIG_SPI_DAVINCI)
    #define HAS_SPI 1
    #else
    #define HAS_SPI 0
    #endif
    
    #if defined(CONFIG_FB_DA8XX)
    #define HAS_LCD	1
    #else
    #define HAS_LCD	0
    #endif
    
    #ifdef CONFIG_DA850_MISTRAL_WL12XX
    
    static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
    	.irq = -1,
    	.board_ref_clock = CONFIG_DA850_MISTRAL_WL12XX_REFCLOCK,
    	.platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
    };
    
    static void da850_wl12xx_set_platform_data(void)
    {
    	da850_wl12xx_wlan_data.irq = gpio_to_irq(DA850_WLAN_IRQ);
    	if (wl12xx_set_platform_data(&da850_wl12xx_wlan_data))
    		pr_err("Error setting wl12xx data\n");
    }
    
    #else
    
    static void da850_wl12xx_set_platform_data(void) { }
    
    #endif
    
    static void da850_wl12xx_init(void)
    {
    	if (gpio_request(DA850_WLAN_EN, "wl12xx") ||
    	    gpio_direction_output(DA850_WLAN_EN, 0))
    		pr_err("Error initializing the wl12xx enable gpio\n");
    
    	if (gpio_request(DA850_WLAN_IRQ, "wl12xx_irq") ||
    	    gpio_direction_input(DA850_WLAN_IRQ))
    		pr_err("Error initializing the wl12xx irq gpio\n");
    	if (gpio_request(WL1271_BT_EN_GPIO, "wl1271 BT Enable") ||
    	    gpio_direction_output(WL1271_BT_EN_GPIO,0))
    		pr_err("Failed to request BT_EN GPIO\n");
    
    	da850_wl12xx_set_platform_data();
    }
    
    static __init void da850_evm_init(void)
    {
    	int ret;
    	char mask = 0;
    	struct davinci_soc_info *soc_info = &davinci_soc_info;
    
    	u8 rmii_en = soc_info->emac_pdata->rmii_en;
    	ret = da850_register_edma(da850_edma_rsv);
    	if (ret)
    		pr_warning("da850_evm_init: edma registration failed: %d\n",
    				ret);
    
    	ret = davinci_cfg_reg_list(da850_i2c0_pins);
    	if (ret)
    		pr_warning("da850_evm_init: i2c0 mux setup failed: %d\n",
    				ret);
    
    	platform_device_register(&da850_gpio_i2c);
    
    	/* Register PRUSS device */
    	da8xx_register_pruss();
    
    	ret = da8xx_register_watchdog();
    	if (ret)
    		pr_warning("da830_evm_init: watchdog registration failed: %d\n",
    				ret);
    
    	/* Support for UART 1 */
    	ret = davinci_cfg_reg_list(da850_uart1_pins);                                 //the  i2c1_scl i2c1_sda uart1 is config as 
    	if (ret)
    		pr_warning("da850_evm_init: UART 1 mux setup failed:"
    						" %d\n", ret);
    
    	ret = da850_register_sata(DA850EVM_SATA_REFCLKPN_RATE);
    	if (ret)
    		pr_warning("da850_evm_init: sata registration failed: %d\n",
    				ret);
    
    	if (HAS_MMC) {
    		ret = davinci_cfg_reg_list(da850_mmcsd0_pins);
    		if (ret)
    			pr_warning("da850_evm_init: mmcsd0 mux setup failed:"
    					" %d\n", ret);
    
    		ret = davinci_cfg_reg_list(da850_mmcsd1_pins);
    		if (ret)
    			pr_warning("da850_evm_init: mmcsd1 mux setup failed:"
    					" %d\n", ret);
    
    		ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n");
    		if (ret)
    			pr_warning("da850_evm_init: can not open GPIO %d\n",
    					DA850_MMCSD_CD_PIN);
    		gpio_direction_input(DA850_MMCSD_CD_PIN);
    
    		ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n");
    		if (ret)
    			pr_warning("da850_evm_init: can not open GPIO %d\n",
    					DA850_MMCSD_WP_PIN);
    		gpio_direction_input(DA850_MMCSD_WP_PIN);
    
    		ret = da8xx_register_mmcsd0(&da850_mmc_config[0]);
    		if (ret)
    			pr_warning("da850_evm_init: mmcsd0 registration failed:"
    					" %d\n", ret);
    		ret = da850_register_mmcsd1(&da850_mmc_config[1]);
    		if (ret)
    			pr_warning("da850_evm_init: mmcsd0 registration failed:"
    					" %d\n", ret);
    
    		da850_wl12xx_init();
    	}
    
    	davinci_serial_init(&da850_evm_uart_config);
    
    	if (have_imager())
    		i2c_add_driver(&pca9543a_driver);
    
    	i2c_register_board_info(1, da850_evm_i2c_devices,
    			ARRAY_SIZE(da850_evm_i2c_devices));
    
    	/*
    	 * shut down uart 0 and 1; they are not used on the board and
    	 * accessing them causes endless "too much work in irq53" messages
    	 * with arago fs
    	 */
    	__raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30);
    
    	if (HAS_MCBSP0) {
    		if (HAS_EMAC)
    			pr_warning("WARNING: both MCBSP0 and EMAC are "
    				"enabled, but they share pins.\n"
    				"\tDisable one of them.\n");
    
    		ret = davinci_cfg_reg_list(da850_mcbsp0_pins);
    		if (ret)
    			pr_warning("da850_evm_init: mcbsp0 mux setup failed:"
    					" %d\n", ret);
    
    		ret = da850_init_mcbsp(&da850_mcbsp0_config);
    		if (ret)
    			pr_warning("da850_evm_init: mcbsp0 registration"
    					"failed: %d\n",	ret);
    	}
    
    	if (HAS_MCBSP1) {
    		ret = davinci_cfg_reg_list(da850_mcbsp1_pins);
    		if (ret)
    			pr_warning("da850_evm_init: mcbsp1 mux setup failed:"
    					" %d\n", ret);
    
    		ret = da850_init_mcbsp(&da850_mcbsp1_config);
    		if (ret)
    			pr_warning("da850_evm_init: mcbsp1 registration"
    					" failed: %d\n", ret);
    	}
    	 
    	if (HAS_MCASP) {
    		if ((HAS_MCBSP0 || HAS_MCBSP1))
    			pr_warning("WARNING: both McASP and McBSP are enabled, "
    					"but they share pins.\n"
    					"\tOnly McASP will work. If you want "
    					"McBSP support, disable McASP.\n");
    		if (HAS_UART1_AFE)
    			pr_warning("WARNING: both McASP and UART1_AFE are "
    				"enabled, but they share pins.\n"
    					"\tDisable one of them.\n");
    
    		ret = davinci_cfg_reg_list(da850_mcasp_pins);
    		if (ret)
    			pr_warning("da850_evm_init: mcasp mux setup failed:"
    					"%d\n", ret);
    
    		da8xx_register_mcasp(0, &da850_evm_snd_data);
    	}
    
    	ret = davinci_cfg_reg_list(da850_lcdcntl_pins);
    	if (ret)
    		pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n",
    				ret);
    
    	/* Handle board specific muxing for LCD here */
    	ret = davinci_cfg_reg_list(da850_evm_lcdc_pins);
    	if (ret)
    		pr_warning("da850_evm_init: evm specific lcd mux setup "
    				"failed: %d\n",	ret);
    
    	ret = da850_lcd_hw_init();
    	if (ret)
    		pr_warning("da850_evm_init: lcd initialization failed: %d\n",
    				ret);
    
    	sharp_lk043t1dg01_pdata.panel_power_ctrl = da850_panel_power_ctrl,
    	ret = da8xx_register_lcdc(&sharp_lk043t1dg01_pdata);
    	if (ret)
    		pr_warning("da850_evm_init: lcdc registration failed: %d\n",
    				ret);
    
    	ret = da8xx_register_rtc();
    	if (ret)
    		pr_warning("da850_evm_init: rtc setup failed: %d\n", ret);
    
    	ret = da850_evm_init_cpufreq();
    	if (ret)
    		pr_warning("da850_evm_init: cpufreq registration failed: %d\n",
    				ret);
    
    	ret = da8xx_register_cpuidle();
    	if (ret)
    		pr_warning("da850_evm_init: cpuidle registration failed: %d\n",
    				ret);
    
    	ret = da850_register_pm(&da850_pm_device);
    	if (ret)
    		pr_warning("da850_evm_init: suspend registration failed: %d\n",
    				ret);
    
    	if (system_rev & 0x100) {
    		((struct flash_platform_data *)da850evm_spi_info[0] \
    		.platform_data)->type = "w25x64";
    	} else {
    		((struct flash_platform_data *)da850evm_spi_info[0] \
    		.platform_data)->type = "m25p64";
    	}
    
    	da850evm_init_spi1(da850evm_spi_info, ARRAY_SIZE(da850evm_spi_info));
    
    	if (HAS_VPIF_DISPLAY || HAS_VPIF_CAPTURE) {
    		ret = da850_register_vpif();
    		if (ret)
    			pr_warning("da850_evm_init: VPIF registration failed: "
    					"%d\n",	ret);
    	}
    
    	if (!HAS_RMII && HAS_VPIF_CAPTURE) {
    		ret = davinci_cfg_reg_list(da850_vpif_capture_pins);
    		if (ret)
    			pr_warning("da850_evm_init: vpif capture mux failed: "
    					"%d\n",	ret);              
    		ret = da850_register_vpif_capture(&da850_vpif_capture_config);
    
    		if (ret)
    			pr_warning("da850_evm_init: VPIF registration failed: "
    					"%d\n",	ret);
                 
    	}
    
    	if (!HAS_GLCD && HAS_VPIF_DISPLAY) {
    		ret = davinci_cfg_reg_list(da850_vpif_display_pins);
    		if (ret)
    			pr_warning("da850_evm_init: vpif capture mux failed: "
    					"%d\n",	ret);
    
    		ret = da850_register_vpif_display(&da850_vpif_display_config);
    		if (ret)
    			pr_warning("da850_evm_init: VPIF registration failed: "
    					"%d\n",	ret);
    
    	}
    
    	if (rmii_en) {
    		ret = davinci_cfg_reg_list(da850_ehrpwm0_pins);
    		if (ret)
    			pr_warning("da850_evm_init: ehrpwm0 mux setup failed:"
    			       "%d\n",	ret);
    		else
    			mask = BIT(0) | BIT(1);
    	} else {
    		pr_warning("da850_evm_init: eHRPWM module 0 cannot be used"
    			" since it is being used by MII interface\n");
    		mask = 0;
    	}
    
    	if (!HAS_LCD) {
    		ret = davinci_cfg_reg_list(da850_ehrpwm1_pins);
    		if (ret)
    			pr_warning("da850_evm_init: eHRPWM module1 output A mux"
    			" setup failed %d\n", ret);
    		else
    			mask = mask | BIT(2);
    	} else {
    		pr_warning("da850_evm_init: eHRPWM module1 outputA cannot be"
    			" used since it is being used by LCD\n");
    	}
    
    	if (!HAS_SPI) {
    		ret = davinci_cfg_reg(DA850_EHRPWM1_B);
    		if (ret)
    			pr_warning("da850_evm_init: eHRPWM module1 outputB mux"
    				" setup failed %d\n", ret);
    		else
    			mask =  mask  | BIT(3);
    	} else {
    		pr_warning("da850_evm_init: eHRPWM module1 outputB cannot be"
    			" used since it is being used by spi1\n");
    	}
    
    	da850_register_ehrpwm(mask);
    
    	ret = platform_device_register(&da850evm_backlight);
    	if (ret)
    		pr_warning("da850_evm_init: backlight device registration"
    				" failed: %d\n", ret);
    
    	ret = davinci_cfg_reg(DA850_ECAP2_APWM2);
    	if (ret)
    		pr_warning("da850_evm_init:ecap mux failed: %d\n", ret);
    
    	ret = da850_register_ecap(2);
    	if (ret)
    		pr_warning("da850_evm_init: eCAP registration failed: %d\n",
    			       ret);
    	ret = davinci_cfg_reg_list(da850_wl1271_pins);
    	if (ret)
    		pr_warning("da850_evm_init: wl1271 mux setup failed:"
    		       "%d\n",	ret);
     
    	ret = platform_device_register(&wl1271_device);
    	if (ret)
    		pr_warning("da850_evm_init: wl1271 device registration"
    				" failed: %d\n", ret);
    	/* initilaize usb module */
    	da850_evm_usb_init();
          //-------------------add API platform_add_device 1028 oyz---------------------
          #if 1
                    platform_add_devices(ov7670_devices,ARRAY_SIZE(ov7670_devices));
          #endif
    }
    
    #ifdef CONFIG_SERIAL_8250_CONSOLE
    static int __init da850_evm_console_init(void)
    {
    	if (!machine_is_davinci_da850_evm())
    		return 0;
    
    	return add_preferred_console("ttyS", 2, "115200");
    }
    console_initcall(da850_evm_console_init);
    #endif
    
    static void __init da850_evm_map_io(void)
    {
    	da850_init();
    }
    
    MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM")
    	.boot_params	= (DA8XX_DDR_BASE + 0x100),
    	.map_io		= da850_evm_map_io,
    	.init_irq	= cp_intc_init,
    	.timer		= &davinci_timer,
    	.init_machine	= da850_evm_init,
    MACHINE_END
    

        The  full log file is follows:

    4405.log.txt
    U-Boot 2010.12 (Dec 23 2011 - 11:22:43)
    
    I2C:   ready
    DRAM:  128 MiB
    MMC:   davinci: 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    In:    serial
    Out:   serial
    Err:   serial
    ARM Clock : 300000000 Hz
    DDR Clock : 132000000 Hz
    Net:   Ethernet PHY: GENERIC @ 0x00
    DaVinci-EMAC
    Hit any key to stop autoboot:  0 
    U-Boot > tftpboot 0xc0700000 uImage
    Using DaVinci-EMAC device
    TFTP from server 192.168.1.41; our IP address is 192.168.1.144
    Filename 'uImage'.
    Load address: 0xc0700000
    Loading: #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             ##################
    done
    Bytes transferred = 2420020 (24ed34 hex)
    U-Boot > sf probe 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    8192 KiB M25P64 at 0:0 is now current device
    U-Boot > sf erase 0x080000 0x280000
    U-Boot > sf write 0xc0700000 0x080000 0x280000
    U-Boot > 
    Booting with TI UBL
    Device OPP (300MHz, 1.2V)
    
    U-Boot 2010.12 (Dec 23 2011 - 11:22:43)
    
    I2C:   ready
    DRAM:  128 MiB
    MMC:   davinci: 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    In:    serial
    Out:   serial
    Err:   serial
    ARM Clock : 300000000 Hz
    DDR Clock : 132000000 Hz
    Net:   Ethernet PHY: GENERIC @ 0x00
    DaVinci-EMAC
    Hit any key to stop autoboot:  0 
    SF: Detected M25P64 with page size 256, total 8 MiB
    8192 KiB M25P64 at 0:0 is now current device
    ## Booting kernel from Legacy Image at c0700000 ...
       Image Name:   Linux-2.6.37
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    2419956 Bytes = 2.3 MiB
       Load Address: c0008000
       Entry Point:  c0008000
       Verifying Checksum ... OK
       Loading Kernel Image ... OK
    OK
    
    Starting kernel ...
    
    Uncompressing Linux... done, booting the kernel.
    Linux version 2.6.37 (root@ubuntu) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #0 PREEMPT Wed Oct 22 07:00:42 PDT 2014
    CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
    CPU: VIVT data cache, VIVT instruction cache
    Machine: DaVinci DA850/OMAP-L138/AM18x EVM
    Memory policy: ECC disabled, Data cache writeback
    DaVinci da850/omap-l138/am18x variant 0x1
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 24320
    Kernel command line: console=ttyS2,115200n8 noinitrd root=/dev/nfs/ nfsroot=192.168.1.41:/home/ouyang/L138filesys,nolock ip=192.168.1.144:192.168.1.41:255.255.255.0 ::eth0:off rw  mem=32M@0Xc0000000 mem=64M@0xc4000000 rootdelay=5
    PID hash table entries: 512 (order: -1, 2048 bytes)
    Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    Memory: 32MB 64MB = 96MB total
    Memory: 92256k/92256k available, 6048k reserved, 0K highmem
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
        DMA     : 0xff000000 - 0xffe00000   (  14 MB)
        vmalloc : 0xc8800000 - 0xfea00000   ( 866 MB)
        lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
        modules : 0xbf000000 - 0xc0000000   (  16 MB)
          .init : 0xc0008000 - 0xc0032000   ( 168 kB)
          .text : 0xc0032000 - 0xc04b0000   (4600 kB)
          .data : 0xc04b0000 - 0xc04e2d20   ( 204 kB)
    SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    Preemptable hierarchical RCU implementation.
            RCU-based detection of stalled CPUs is disabled.
            Verbose stalled-CPUs detection is disabled.
    NR_IRQS:245
    Console: colour dummy device 80x30
    Calibrating delay loop... 149.50 BogoMIPS (lpj=747520)
    pid_max: default: 32768 minimum: 301
    Security Framework initialized
    Mount-cache hash table entries: 512
    CPU: Testing write buffer coherency: ok
    DaVinci: 144 gpio irqs
    regulator: core version 0.5
    regulator: dummy: 
    NET: Registered protocol family 16
    WARNING: both McASP and McBSP are enabled, but they share pins.
            Only McASP will work. If you want McBSP support, disable McASP.
    WARNING: both McASP and UART1_AFE are enabled, but they share pins.
            Disable one of them.
    da850_evm_init: eHRPWM module 0 cannot be used since it is being used by MII interface
    da850_evm_init: eHRPWM module1 outputA cannot be used since it is being used by LCD
    da850_evm_init: eHRPWM module1 outputB cannot be used since it is being used by spi1
    bio: create slab <bio-0> at 0
    SCSI subsystem initialized
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    pca953x 1-0020: failed reading register
    regulator: VDCDC1: 3200 <--> 3300 mV at 3300 mV 
    regulator: VDCDC2: 1750 <--> 3300 mV at 3300 mV 
    regulator: VDCDC3: 950 <--> 1350 mV at 1200 mV 
    regulator: LDO1: 1800 mV 
    regulator: LDO2: 1150 <--> 1300 mV at 1200 mV 
    pca9543a_probe
    i2c-gpio i2c-gpio.1: using pins 20 (SDA) and 21 (SCL)
    vpif vpif: vpif probe success
    Advanced Linux Sound Architecture Driver Version 1.0.23.
    Bluetooth: Core ver 2.15
    NET: Registered protocol family 31
    Bluetooth: HCI device and connection manager initialized
    Bluetooth: HCI socket layer initialized
    Switching to clocksource timer0_1
    musb-hdrc: version 6.0, host, debug=0
    musb-hdrc musb-hdrc: dma type: dma-cppi41
    Waiting for USB PHY clock good...
    musb-hdrc musb-hdrc: MUSB HDRC host driver
    musb-hdrc musb-hdrc: new USB bus registered, assigned bus number 1
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 1 port detected
    musb-hdrc musb-hdrc: USB Host mode controller at fee00000 using DMA, IRQ 58
    NET: Registered protocol family 2
    IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
    TCP established hash table entries: 4096 (order: 3, 32768 bytes)
    TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    TCP: Hash tables configured (established 4096 bind 4096)
    TCP reno registered
    UDP hash table entries: 256 (order: 0, 4096 bytes)
    UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    NET: Registered protocol family 1
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    EMAC: MII PHY configured, RMII PHY will not be functional
    McBSP:Probed McBSP1
    JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
    msgmni has been set to 180
    io scheduler noop registered (default)
    da8xx_lcdc da8xx_lcdc.0: GLCD: Found Sharp_LK043T1DG01 panel
    Console: switching to colour frame buffer device 60x34
    Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
    serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25) is a AR7
    serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a AR7
    serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a AR7
    console [ttyS2] enabled
    brd: module loaded
    at24 1-0050: 32768 byte 24c256 EEPROM (writable)
    Read MAC addr from EEPROM: ff:ff:ff:ff:ff:ff
    ahci ahci: forcing PORTS_IMPL to 0x1
    ahci ahci: AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl platform mode
    ahci ahci: flags: ncq sntf pm led clo only pmp pio slum part ccc 
    scsi0 : ahci_platform
    ata1: SATA max UDMA/133 mmio [mem 0x01e18000-0x01e19fff] port 0x100 irq 67
    spi_davinci spi_davinci.1: DMA: supported
    spi_davinci spi_davinci.1: DMA: RX channel: 18, TX channel: 19, event queue: 0
    m25p80 spi1.0: found m25p64, expected w25x64
    m25p80 spi1.0: m25p64 (8192 Kbytes)
    Creating 6 MTD partitions on "m25p80":
    0x000000000000-0x000000010000 : "UBL"
    0x000000010000-0x000000090000 : "U-Boot"
    0x000000090000-0x0000000a0000 : "U-Boot-Env"
    0x0000000a0000-0x000000320000 : "Kernel"
    0x000000320000-0x000000720000 : "Filesystem"
    0x0000007f0000-0x000000800000 : "MAC-Address"
    spi_davinci spi_davinci.1: Controller at 0xfef0e000
    davinci_mdio davinci_mdio.0: davinci mdio revision 1.5
    davinci_mdio davinci_mdio.0: detected phy mask fffffffe
    davinci_mdio.0: probed
    davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver SMSC LAN8710/LAN8720
    console [netcon0] enabled
    netconsole: network logging started
    ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
    ohci ohci.0: DA8xx OHCI
    ohci ohci.0: new USB bus registered, assigned bus number 2
    Waiting for USB PHY clock good...
    ohci ohci.0: irq 59, io mem 0x01e25000
    hub 2-0:1.0: USB hub found
    hub 2-0:1.0: 1 port detected
    Initializing USB Mass Storage driver...
    usbcore: registered new interface driver usb-storage
    USB Mass Storage support registered.
    input: TPS6507x Touchscreen as /devices/platform/i2c-gpio.1/i2c-1/1-0048/input/input0
    omap_rtc omap_rtc: rtc core: registered omap_rtc as rtc0
    omap_rtc: RTC power up reset detected
    i2c /dev entries driver
    ata1: SATA link down (SStatus 0 SControl 300)
    lirc_dev: IR Remote Control driver registered, major 252 
    IR NEC protocol handler initialized
    IR RC5(x) protocol handler initialized
    IR RC6 protocol handler initialized
    IR JVC protocol handler initialized
    IR Sony protocol handler initialized
    IR RC5 (streamzap) protocol handler initialized
    IR LIRC bridge handler initialized
    Linux video capture interface: v2.00
    ov7670 1-0021: chip found @ 0x42 (i2c-gpio1) is not an ov7670 chip.
    Unable to handle kernel NULL pointer dereference at virtual address 00000004
    pgd = c0004000
    [00000004] *pgd=00000000
    Internal error: Oops: 805 [#1] PREEMPT
    last sysfs file: 
    Modules linked in:
    CPU: 0    Not tainted  (2.6.37 #0)
    PC is at v4l2_device_unregister_subdev+0x5c/0xdc
    LR is at v4l2_i2c_new_subdev_board+0x1a8/0x1e4
    pc : [<c0271444>]    lr : [<c0276578>]    psr: a0000013
    sp : c7827e28  ip : c7827e40  fp : c7827e3c
    r10: c04b98e8  r9 : 00000000  r8 : 00000000
    r7 : c04fd710  r6 : c04b98ec  r5 : c78ff000  r4 : c78ff000
    r3 : 00200200  r2 : c7826000  r1 : 00000000  r0 : c04fd714
    Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
    Control: 0005317f  Table: c0004000  DAC: 00000017
    Process swapper (pid: 1, stack limit = 0xc7826270)
    Stack: (0xc7827e28 to 0xc7828000)
    7e20:                   c78ff000 c79e9400 c7827e5c c7827e40 c0276578 c02713f8
    7e40: c79e5c80 00000000 c04fd710 c79b6800 c7827ea4 c7827e60 c00206dc c02763e0
    7e60: 00000000 00000001 c04b4f00 c04b95bc c7893000 00000001 c7827e94 c04b4f08
    7e80: c04b4f08 c04e297c c79b53c0 c04ca348 00000000 00000000 c7827eb4 c7827ea8
    7ea0: c01e69f8 c00201e8 c7827ed4 c7827eb8 c01e5954 c01e69e8 c04b4f08 c04b4f3c
    7ec0: c04e297c c79b53c0 c7827ef4 c7827ed8 c01e5a84 c01e5888 00000000 c01e5a1c
    7ee0: c04e297c c79b53c0 c7827f1c c7827ef8 c01e508c c01e5a2c c7837038 c7856930
    7f00: c019c758 c0029098 c00083ac c04e297c c7827f2c c7827f20 c01e576c c01e504c
    7f20: c7827f5c c7827f30 c01e495c c01e575c c0448215 c7827f40 c0029098 c00083ac
    7f40: c04e297c 00000013 c00201bc 00000000 c7827f84 c7827f60 c01e5dc4 c01e48b8
    7f60: c0029098 c00083ac c004b1c0 00000013 c00201bc 00000000 c7827f94 c7827f88
    7f80: c01e6e9c c01e5d24 c7827fa4 c7827f98 c00201d0 c01e6e60 c7827fdc c7827fa8
    7fa0: c0032420 c00201cc 000000f5 c00083ac c004b1c0 00000013 c0029098 c00083ac
    7fc0: c004b1c0 00000013 00000000 00000000 c7827ff4 c7827fe0 c0008448 c0032360
    7fe0: 00000000 c00083ac 00000000 c7827ff8 c004b1c0 c00083bc 00000000 00000000
    Backtrace: 
    [<c02713e8>] (v4l2_device_unregister_subdev+0x0/0xdc) from [<c0276578>] (v4l2_i2c_new_subdev_board+0x1a8/0x1e4)
     r5:c79e9400 r4:c78ff000
    [<c02763d0>] (v4l2_i2c_new_subdev_board+0x0/0x1e4) from [<c00206dc>] (vpif_probe+0x504/0x6b8)
     r7:c79b6800 r6:c04fd710 r5:00000000 r4:c79e5c80
    [<c00201d8>] (vpif_probe+0x0/0x6b8) from [<c01e69f8>] (platform_drv_probe+0x20/0x24)
    [<c01e69d8>] (platform_drv_probe+0x0/0x24) from [<c01e5954>] (driver_probe_device+0xdc/0x1a4)
    [<c01e5878>] (driver_probe_device+0x0/0x1a4) from [<c01e5a84>] (__driver_attach+0x68/0x8c)
     r7:c79b53c0 r6:c04e297c r5:c04b4f3c r4:c04b4f08
    [<c01e5a1c>] (__driver_attach+0x0/0x8c) from [<c01e508c>] (bus_for_each_dev+0x50/0x84)
     r7:c79b53c0 r6:c04e297c r5:c01e5a1c r4:00000000
    [<c01e503c>] (bus_for_each_dev+0x0/0x84) from [<c01e576c>] (driver_attach+0x20/0x28)
     r6:c04e297c r5:c00083ac r4:c0029098
    [<c01e574c>] (driver_attach+0x0/0x28) from [<c01e495c>] (bus_add_driver+0xb4/0x238)
    [<c01e48a8>] (bus_add_driver+0x0/0x238) from [<c01e5dc4>] (driver_register+0xb0/0x13c)
    [<c01e5d14>] (driver_register+0x0/0x13c) from [<c01e6e9c>] (platform_driver_register+0x4c/0x60)
     r9:00000000 r8:c00201bc r7:00000013 r6:c004b1c0 r5:c00083ac
    r4:c0029098
    [<c01e6e50>] (platform_driver_register+0x0/0x60) from [<c00201d0>] (vpif_init+0x14/0x1c)
    [<c00201bc>] (vpif_init+0x0/0x1c) from [<c0032420>] (do_one_initcall+0xd0/0x1ac)
    [<c0032350>] (do_one_initcall+0x0/0x1ac) from [<c0008448>] (kernel_init+0x9c/0x154)
    [<c00083ac>] (kernel_init+0x0/0x154) from [<c004b1c0>] (do_exit+0x0/0x6e0)
     r5:c00083ac r4:00000000
    Code: e5951000 e5801000 e5853000 e59f306c (e5810004) 
    ---[ end trace ed1d0baca137d6ef ]---
    note: swapper[1] exited with preempt_count 1
    Kernel panic - not syncing: Attempted to kill init!
    Backtrace: 
    [<c0036730>] (dump_backtrace+0x0/0x114) from [<c03949ec>] (dump_stack+0x18/0x1c)
     r7:c7824000 r6:c7824000 r5:00000001 r4:c04e32f0
    [<c03949d4>] (dump_stack+0x0/0x1c) from [<c0394a68>] (panic+0x78/0x19c)
    [<c03949f0>] (panic+0x0/0x19c) from [<c004b234>] (do_exit+0x74/0x6e0)
     r3:c04bbfa4 r2:00000001 r1:c7824110 r0:c044a208
    [<c004b1c0>] (do_exit+0x0/0x6e0) from [<c0036b20>] (die+0x2dc/0x31c)
    [<c0036844>] (die+0x0/0x31c) from [<c0038368>] (__do_kernel_fault+0x6c/0x8c)
    [<c00382fc>] (__do_kernel_fault+0x0/0x8c) from [<c0038558>] (do_page_fault+0x1d0/0x1e8)
     r9:c7827de0 r8:00000805 r7:00000000 r6:00000004 r5:c7824000
    r4:c04b407c
    [<c0038388>] (do_page_fault+0x0/0x1e8) from [<c0038604>] (do_translation_fault+0x24/0xac)
    [<c00385e0>] (do_translation_fault+0x0/0xac) from [<c00322ec>] (do_DataAbort+0x3c/0x9c)
     r7:c7827de0 r6:00000805 r5:c7827e14 r4:c04b407c
    [<c00322b0>] (do_DataAbort+0x0/0x9c) from [<c0032b2c>] (__dabt_svc+0x4c/0x60)
    Exception stack(0xc7827de0 to 0xc7827e28)
    7de0: c04fd714 00000000 c7826000 00200200 c78ff000 c78ff000 c04b98ec c04fd710
    7e00: 00000000 00000000 c04b98e8 c7827e3c c7827e40 c7827e28 c0276578 c0271444
    7e20: a0000013 ffffffff
     r8:00000000 r7:c04fd710 r6:c04b98ec r5:c7827e14 r4:ffffffff
    [<c02713e8>] (v4l2_device_unregister_subdev+0x0/0xdc) from [<c0276578>] (v4l2_i2c_new_subdev_board+0x1a8/0x1e4)
     r5:c79e9400 r4:c78ff000
    [<c02763d0>] (v4l2_i2c_new_subdev_board+0x0/0x1e4) from [<c00206dc>] (vpif_probe+0x504/0x6b8)
     r7:c79b6800 r6:c04fd710 r5:00000000 r4:c79e5c80
    [<c00201d8>] (vpif_probe+0x0/0x6b8) from [<c01e69f8>] (platform_drv_probe+0x20/0x24)
    [<c01e69d8>] (platform_drv_probe+0x0/0x24) from [<c01e5954>] (driver_probe_device+0xdc/0x1a4)
    [<c01e5878>] (driver_probe_device+0x0/0x1a4) from [<c01e5a84>] (__driver_attach+0x68/0x8c)
     r7:c79b53c0 r6:c04e297c r5:c04b4f3c r4:c04b4f08
    [<c01e5a1c>] (__driver_attach+0x0/0x8c) from [<c01e508c>] (bus_for_each_dev+0x50/0x84)
     r7:c79b53c0 r6:c04e297c r5:c01e5a1c r4:00000000
    [<c01e503c>] (bus_for_each_dev+0x0/0x84) from [<c01e576c>] (driver_attach+0x20/0x28)
     r6:c04e297c r5:c00083ac r4:c0029098
    [<c01e574c>] (driver_attach+0x0/0x28) from [<c01e495c>] (bus_add_driver+0xb4/0x238)
    [<c01e48a8>] (bus_add_driver+0x0/0x238) from [<c01e5dc4>] (driver_register+0xb0/0x13c)
    [<c01e5d14>] (driver_register+0x0/0x13c) from [<c01e6e9c>] (platform_driver_register+0x4c/0x60)
     r9:00000000 r8:c00201bc r7:00000013 r6:c004b1c0 r5:c00083ac
    r4:c0029098
    [<c01e6e50>] (platform_driver_register+0x0/0x60) from [<c00201d0>] (vpif_init+0x14/0x1c)
    [<c00201bc>] (vpif_init+0x0/0x1c) from [<c0032420>] (do_one_initcall+0xd0/0x1ac)
    [<c0032350>] (do_one_initcall+0x0/0x1ac) from [<c0008448>] (kernel_init+0x9c/0x154)
    [<c00083ac>] (kernel_init+0x0/0x154) from [<c004b1c0>] (do_exit+0x0/0x6e0)
     r5:c00083ac r4:00000000
     

           Thanks very much.

    Ouyang,

  • Hi,

    Just try below diff, and let me know the results

    diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
    index 80710f1..a3d80ed 100644
    --- a/arch/arm/mach-davinci/board-da850-evm.c
    +++ b/arch/arm/mach-davinci/board-da850-evm.c
    @@ -1422,7 +1422,7 @@ static const struct vpif_input da850_ch2_inputs[] = {
                            .type = V4L2_INPUT_TYPE_CAMERA,
                            .std = V4L2_STD_BAYER_ALL
                    },
    -               .subdev_name = "mt9t031",
    +               .subdev_name = "ov7670",
            },
     };
     
    @@ -1563,9 +1563,9 @@ static struct tvp514x_platform_data tvp5146_pdata = {
     static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = {
     #if defined(CONFIG_DA850_UI_CAMERA)
            {
    -               .name   = "mt9t031",
    +               .name   = "ov7670",
                    .board_info = {
    -                       I2C_BOARD_INFO("mt9t031", 0x5d),
    +                       I2C_BOARD_INFO("ov7670", 0x42),
                            .platform_data = (void *)1,
                    },
                    .vpif_if = {

    Thanks,

    --Prabhakar Lad

  • Hi Prabhakar Lad,
         Thanks for you reply, I try modified the board-da850-evm.c file as you said ,the error is the same as before .
         It cannot execute the function ov7670_s_config successed. This function is used to write the default reg value to ov7670 device and read the device ID to detect the ov7670.
         Follows is the new board file and logs.

     

    5141.board-da850-evm.c
    /*
     * TI DA850/OMAP-L138 EVM board
     *
     * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
     *
     * Derived from: arch/arm/mach-davinci/board-da830-evm.c
     * Original Copyrights follow:
     *
     * 2007, 2009 (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/console.h>
    #include <linux/i2c.h>
    #include <linux/i2c/at24.h>
    #include <linux/i2c/pca953x.h>
    #include <linux/input.h>
    #include <linux/mfd/tps6507x.h>
    #include <linux/gpio.h>
    #include <linux/gpio_keys.h>
    #include <linux/platform_device.h>
    #include <linux/interrupt.h>
    #include <linux/mtd/mtd.h>
    #include <linux/mtd/nand.h>
    #include <linux/mtd/partitions.h>
    #include <linux/regulator/machine.h>
    #include <linux/regulator/tps6507x.h>
    #include <linux/input/tps6507x-ts.h>
    #include <linux/spi/spi.h>
    #include <linux/spi/flash.h>
    #include <linux/delay.h>
    #include <linux/i2c-gpio.h>
    #include <linux/pwm_backlight.h>
    #include <linux/wl12xx.h>
    
    #include <asm/mach-types.h>
    #include <asm/mach/arch.h>
    
    #include <mach/cp_intc.h>
    #include <mach/da8xx.h>
    #include <mach/nand.h>
    #include <mach/mux.h>
    #include <mach/aemif.h>
    #include <mach/spi.h>
    #include <mach/flash.h>
    #include <mach/usb.h>
    #include <mach/vpif.h>
    #include <media/davinci/videohd.h>
    
    #include <media/tvp514x.h>
    
    #include <media/soc_camera.h>             //add the head file 
    #include "../../../drivers/media/video/ov7670.h"
    #define DA850_EVM_PHY_ID		"0:00"
    #define DA850_LCD_PWR_PIN		GPIO_TO_PIN(2, 8)
    #define DA850_LCD_BL_PIN		GPIO_TO_PIN(2, 15)
    
    #define DA850_MMCSD_CD_PIN		GPIO_TO_PIN(4, 0)
    #define DA850_MMCSD_WP_PIN		GPIO_TO_PIN(4, 1)
    
    #define DA850_MII_MDIO_CLKEN_PIN	GPIO_TO_PIN(2, 6)
    
    #define DA850_SD_ENABLE_PIN		GPIO_TO_PIN(0, 11)
    
    #define DA850_WLAN_EN			GPIO_TO_PIN(6, 9)
    #define DA850_WLAN_IRQ			GPIO_TO_PIN(6, 10)
    
    #define DAVINCI_BACKLIGHT_MAX_BRIGHTNESS	250
    #define DAVINVI_BACKLIGHT_DEFAULT_BRIGHTNESS	250
    #define DAVINCI_PWM_PERIOD_NANO_SECONDS		(10000 * 10)
    
    #define PWM_DEVICE_ID	"ehrpwm.1"
    
    
    /* Enabling GPIO for WL1271's Bluetooth */
    #define WL1271_BT_EN_GPIO GPIO_TO_PIN(0, 15)
    
    /* Enabling GPIOs for WL1271's BT, FM, GPS respectively (-1 if not used) */
    static int gpios[] = { WL1271_BT_EN_GPIO, -1, -1};
    
    static struct platform_device wl1271_device = {
           .name           = "kim",
           .id             = -1,
           .dev.platform_data = &gpios,
    };
    
    
    static struct platform_pwm_backlight_data da850evm_backlight_data = {
    	.pwm_id		= PWM_DEVICE_ID,
    	.ch		= 0,
    	.max_brightness	= DAVINCI_BACKLIGHT_MAX_BRIGHTNESS,
    	.dft_brightness	= DAVINVI_BACKLIGHT_DEFAULT_BRIGHTNESS,
    	.pwm_period_ns	= DAVINCI_PWM_PERIOD_NANO_SECONDS,
    };
    
    static struct platform_device da850evm_backlight = {
    	.name		= "pwm-backlight",
    	.id		= -1,
    	.dev		= {
    		.platform_data	= &da850evm_backlight_data,
    	}
    };
    
    static struct davinci_spi_platform_data da850evm_spi1_pdata = {
    	.version	= SPI_VERSION_2,
    	.num_chipselect = 1,
    	.intr_line      = 1,
    };
    
    static struct mtd_partition da850evm_spiflash_part[] = {
    	[0] = {
    		.name = "UBL",
    		.offset = 0,
    		.size = SZ_64K,
    		.mask_flags = MTD_WRITEABLE,
    	},
    	[1] = {
    		.name = "U-Boot",
    		.offset = MTDPART_OFS_APPEND,
    		.size = SZ_512K,
    		.mask_flags = MTD_WRITEABLE,
    	},
    	[2] = {
    		.name = "U-Boot-Env",
    		.offset = MTDPART_OFS_APPEND,
    		.size = SZ_64K,
    		.mask_flags = MTD_WRITEABLE,
    	},
    	[3] = {
    		.name = "Kernel",
    		.offset = MTDPART_OFS_APPEND,
    		.size = SZ_2M + SZ_512K,
    		.mask_flags = 0,
    	},
    	[4] = {
    		.name = "Filesystem",
    		.offset = MTDPART_OFS_APPEND,
    		.size = SZ_4M,
    		.mask_flags = 0,
    	},
    	[5] = {
    		.name = "MAC-Address",
    		.offset = SZ_8M - SZ_64K,
    		.size = SZ_64K,
    		.mask_flags = MTD_WRITEABLE,
    	},
    };
    
    static struct flash_platform_data da850evm_spiflash_data = {
    	.name		= "m25p80",
    	.parts		= da850evm_spiflash_part,
    	.nr_parts	= ARRAY_SIZE(da850evm_spiflash_part),
    };
    
    static struct davinci_spi_config da850evm_spiflash_cfg = {
    	.io_type	= SPI_IO_TYPE_DMA,
    	.c2tdelay	= 8,
    	.t2cdelay	= 8,
    };
    
    static struct spi_board_info da850evm_spi_info[] = {
    	{
    		.modalias		= "m25p80",
    		.platform_data		= &da850evm_spiflash_data,
    		.controller_data	= &da850evm_spiflash_cfg,
    		.mode			= SPI_MODE_0,
    		.max_speed_hz		= 30000000,
    		.bus_num		= 1,
    		.chip_select		= 0,
    	},
    };
    
    static void m25p80_notify_add(struct mtd_info *mtd)
    {
    	char *mac_addr = davinci_soc_info.emac_pdata->mac_addr;
    	size_t retlen;
    
    	if (!strcmp(mtd->name, "MAC-Address")) {
    		mtd->read(mtd, 0, ETH_ALEN, &retlen, mac_addr);
    		if (retlen == ETH_ALEN)
    			pr_info("Read MAC addr from SPI Flash: %pM\n",
    					mac_addr);
    	}
    }
    
    static struct mtd_notifier spi_notifier = {
    	.add    = m25p80_notify_add,
    };
    
    static void __init da850evm_init_spi1(struct spi_board_info *info, unsigned len)
    {
    	int ret;
    
    	ret = spi_register_board_info(info, len);
    	if (ret)
    		pr_warning("failed to register board info : %d\n", ret);
    
    	ret = da8xx_register_spi(1, &da850evm_spi1_pdata);
    	if (ret)
    		pr_warning("failed to register spi 1 device : %d\n", ret);
    
    	if (!(system_rev & 0x100))
    		register_mtd_user(&spi_notifier);
    }
    
    #define TVP5147_CH0		"tvp514x-0"
    #define TVP5147_CH1		"tvp514x-1"
    
    #define VPIF_STATUS	(0x002C)
    #define VPIF_STATUS_CLR	(0x0030)
    
    static struct mtd_partition da850_evm_norflash_partition[] = {
    	{
    		.name           = "bootloaders + env",
    		.offset         = 0,
    		.size           = SZ_512K,
    		.mask_flags     = MTD_WRITEABLE,
    	},
    	{
    		.name           = "kernel",
    		.offset         = MTDPART_OFS_APPEND,
    		.size           = SZ_2M,
    		.mask_flags     = 0,
    	},
    	{
    		.name           = "filesystem",
    		.offset         = MTDPART_OFS_APPEND,
    		.size           = MTDPART_SIZ_FULL,
    		.mask_flags     = 0,
    	},
    };
    
    static struct davinci_aemif_timing da850_evm_norflash_timing = {
    	.wsetup		= 10,
    	.wstrobe	= 60,
    	.whold		= 10,
    	.rsetup		= 10,
    	.rstrobe	= 110,
    	.rhold		= 10,
    	.ta		= 30,
    };
    
    static struct davinciflash_pdata da850_evm_norflash_data = {
    	.width		= 2,
    	.parts		= da850_evm_norflash_partition,
    	.nr_parts	= ARRAY_SIZE(da850_evm_norflash_partition),
    	.timing		= &da850_evm_norflash_timing,
    };
    
    static struct resource da850_evm_norflash_resource[] = {
    	{
    		.start	= DA8XX_AEMIF_CS2_BASE,
    		.end	= DA8XX_AEMIF_CS2_BASE + SZ_32M - 1,
    		.flags	= IORESOURCE_MEM,
    	},
    	{
    		.start	= DA8XX_AEMIF_CTL_BASE,
    		.end	= DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
    		.flags	= IORESOURCE_MEM,
    	},
    };
    
    static struct platform_device da850_evm_norflash_device = {
    	.name		= "davinci-flash",
    	.id		= 0,
    	.dev		= {
    		.platform_data  = &da850_evm_norflash_data,
    	},
    	.num_resources	= ARRAY_SIZE(da850_evm_norflash_resource),
    	.resource	= da850_evm_norflash_resource,
    };
    
    static struct davinci_pm_config da850_pm_pdata = {
    	.sleepcount = 128,
    };
    
    static struct platform_device da850_pm_device = {
    	.name           = "pm-davinci",
    	.dev = {
    		.platform_data	= &da850_pm_pdata,
    	},
    	.id             = -1,
    };
    
    /* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash
     * (128K blocks). It may be used instead of the (default) SPI flash
     * to boot, using TI's tools to install the secondary boot loader
     * (UBL) and U-Boot.
     */
    static struct mtd_partition da850_evm_nandflash_partition[] = {
    	{
    		.name		= "u-boot env",
    		.offset		= 0,
    		.size		= SZ_128K,
    		.mask_flags	= MTD_WRITEABLE,
    	 },
    	{
    		.name		= "UBL",
    		.offset		= MTDPART_OFS_APPEND,
    		.size		= SZ_128K,
    		.mask_flags	= MTD_WRITEABLE,
    	},
    	{
    		.name		= "u-boot",
    		.offset		= MTDPART_OFS_APPEND,
    		.size		= 4 * SZ_128K,
    		.mask_flags	= MTD_WRITEABLE,
    	},
    	{
    		.name		= "kernel",
    		.offset		= 0x200000,
    		.size		= SZ_4M,
    		.mask_flags	= 0,
    	},
    	{
    		.name		= "filesystem",
    		.offset		= MTDPART_OFS_APPEND,
    		.size		= MTDPART_SIZ_FULL,
    		.mask_flags	= 0,
    	},
    };
    
    static struct davinci_aemif_timing da850_evm_nandflash_timing = {
    	.wsetup		= 24,
    	.wstrobe	= 21,
    	.whold		= 14,
    	.rsetup		= 19,
    	.rstrobe	= 50,
    	.rhold		= 0,
    	.ta		= 20,
    };
    
    static struct davinci_nand_pdata da850_evm_nandflash_data = {
    	.parts		= da850_evm_nandflash_partition,
    	.nr_parts	= ARRAY_SIZE(da850_evm_nandflash_partition),
    	.ecc_mode	= NAND_ECC_HW,
    	.ecc_bits	= 4,
    	.options	= NAND_USE_FLASH_BBT,
    	.timing		= &da850_evm_nandflash_timing,
    };
    
    static struct resource da850_evm_nandflash_resource[] = {
    	{
    		.start	= DA8XX_AEMIF_CS3_BASE,
    		.end	= DA8XX_AEMIF_CS3_BASE + SZ_512K + 2 * SZ_1K - 1,
    		.flags	= IORESOURCE_MEM,
    	},
    	{
    		.start	= DA8XX_AEMIF_CTL_BASE,
    		.end	= DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
    		.flags	= IORESOURCE_MEM,
    	},
    };
    
    static struct platform_device da850_evm_nandflash_device = {
    	.name		= "davinci_nand",
    	.id		= 1,
    	.dev		= {
    		.platform_data	= &da850_evm_nandflash_data,
    	},
    	.num_resources	= ARRAY_SIZE(da850_evm_nandflash_resource),
    	.resource	= da850_evm_nandflash_resource,
    };
    
    static struct platform_device *da850_evm_devices[] __initdata = {
    	&da850_evm_nandflash_device,
    	&da850_evm_norflash_device,
    };
    
    static const short da850_evm_nand_pins[] = {
    	DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3,
    	DA850_EMA_D_4, DA850_EMA_D_5, DA850_EMA_D_6, DA850_EMA_D_7,
    	DA850_EMA_A_1, DA850_EMA_A_2, DA850_NEMA_CS_3, DA850_NEMA_CS_4,
    	DA850_NEMA_WE, DA850_NEMA_OE,
    	-1
    };
    
    static const short da850_evm_nor_pins[] = {
    	DA850_EMA_BA_1, DA850_EMA_CLK, DA850_EMA_WAIT_1, DA850_NEMA_CS_2,
    	DA850_NEMA_WE, DA850_NEMA_OE, DA850_EMA_D_0, DA850_EMA_D_1,
    	DA850_EMA_D_2, DA850_EMA_D_3, DA850_EMA_D_4, DA850_EMA_D_5,
    	DA850_EMA_D_6, DA850_EMA_D_7, DA850_EMA_D_8, DA850_EMA_D_9,
    	DA850_EMA_D_10, DA850_EMA_D_11, DA850_EMA_D_12, DA850_EMA_D_13,
    	DA850_EMA_D_14, DA850_EMA_D_15, DA850_EMA_A_0, DA850_EMA_A_1,
    	DA850_EMA_A_2, DA850_EMA_A_3, DA850_EMA_A_4, DA850_EMA_A_5,
    	DA850_EMA_A_6, DA850_EMA_A_7, DA850_EMA_A_8, DA850_EMA_A_9,
    	DA850_EMA_A_10, DA850_EMA_A_11, DA850_EMA_A_12, DA850_EMA_A_13,
    	DA850_EMA_A_14, DA850_EMA_A_15, DA850_EMA_A_16, DA850_EMA_A_17,
    	DA850_EMA_A_18, DA850_EMA_A_19, DA850_EMA_A_20, DA850_EMA_A_21,
    	DA850_EMA_A_22, DA850_EMA_A_23,
    	-1
    };
    
    static u32 ui_card_detected;
    
    #if defined(CONFIG_MMC_DAVINCI) || \
        defined(CONFIG_MMC_DAVINCI_MODULE)
    #define HAS_MMC 1
    #else
    #define HAS_MMC 0
    #endif
    
    /* have_imager() - Check if we have support for imager interface */
    static inline int have_imager(void)
    {
    #if defined(CONFIG_DA850_UI_CAMERA)
    	return 1;
    #else
    	return 0;
    #endif
    }
    
    static inline void da850_evm_setup_nor_nand(void)
    {
    	int ret = 0;
    
    	if (ui_card_detected && !HAS_MMC) {
    		ret = davinci_cfg_reg_list(da850_evm_nand_pins);
    		if (ret)
    			pr_warning("da850_evm_init: nand mux setup failed: "
    					"%d\n", ret);
    
    		ret = davinci_cfg_reg(DA850_GPIO0_11);
    		if (ret)
    			pr_warning("da850_evm_init:GPIO(0,11) mux setup "
    					"failed\n");
    
    		ret = gpio_request(DA850_SD_ENABLE_PIN, "mmc_sd_en");
    		if (ret)
    			pr_warning("Cannot open GPIO %d\n",
    					DA850_SD_ENABLE_PIN);
    
    		/* Driver GP0[11] low for NOR to work */
    		gpio_direction_output(DA850_SD_ENABLE_PIN, 0);
    
    		ret = davinci_cfg_reg_list(da850_evm_nor_pins);
    		if (ret)
    			pr_warning("da850_evm_init: nor mux setup failed: %d\n",
    				ret);
    
    		platform_add_devices(da850_evm_devices,
    					ARRAY_SIZE(da850_evm_devices));
    	} else if (ui_card_detected && HAS_MMC) {
    		/*
    		 * On Logic PD Rev.3 EVMs GP0[11] pin needs to be configured
    		 * for MMC and NOR to work. When GP0[11] is low, the SD0
    		 * interface will not work, but NOR flash will. When GP0[11]
    		 * is high, SD0 will work but NOR flash will not. By default
    		 * we are assuming that GP0[11] pin is driven high, when UI
    		 * card is not connected. Hence we are not configuring the
    		 * GP0[11] pin when MMC/SD is enabled and UI card is not
    		 * connected. Not configuring the GPIO pin will enable the
    		 * bluetooth to work on AM18x as it requires the GP0[11]
    		 * pin for UART flow control.
    		 */
    		ret = davinci_cfg_reg(DA850_GPIO0_11);
    		if (ret)
    			pr_warning("da850_evm_init:GPIO(0,11) mux setup "
    					"failed\n");
    
    		ret = gpio_request(DA850_SD_ENABLE_PIN, "mmc_sd_en");
    		if (ret)
    			pr_warning("Cannot open GPIO %d\n",
    					DA850_SD_ENABLE_PIN);
    
    		/* Driver GP0[11] high for SD to work */
    		gpio_direction_output(DA850_SD_ENABLE_PIN, 1);
    	}
    }
    
    #ifdef CONFIG_DA850_UI_RMII
    static inline void da850_evm_setup_emac_rmii(int rmii_sel)
    {
    	struct davinci_soc_info *soc_info = &davinci_soc_info;
    
    	soc_info->emac_pdata->rmii_en = 1;
    	gpio_set_value_cansleep(rmii_sel, 0);
    }
    #else
    static inline void da850_evm_setup_emac_rmii(int rmii_sel) { }
    #endif
    
    
    #define DA850_KEYS_DEBOUNCE_MS	10
    /*
     * At 200ms polling interval it is possible to miss an
     * event by tapping very lightly on the push button but most
     * pushes do result in an event; longer intervals require the
     * user to hold the button whereas shorter intervals require
     * more CPU time for polling.
     */
    #define DA850_GPIO_KEYS_POLL_MS	200
    
    enum da850_evm_ui_exp_pins {
    	DA850_EVM_UI_EXP_SEL_C = 5,
    	DA850_EVM_UI_EXP_SEL_B,
    	DA850_EVM_UI_EXP_SEL_A,
    	DA850_EVM_UI_EXP_PB8,
    	DA850_EVM_UI_EXP_PB7,
    	DA850_EVM_UI_EXP_PB6,
    	DA850_EVM_UI_EXP_PB5,
    	DA850_EVM_UI_EXP_PB4,
    	DA850_EVM_UI_EXP_PB3,
    	DA850_EVM_UI_EXP_PB2,
    	DA850_EVM_UI_EXP_PB1,
    };
    
    static const char const *da850_evm_ui_exp[] = {
    	[DA850_EVM_UI_EXP_SEL_C]        = "sel_c",
    	[DA850_EVM_UI_EXP_SEL_B]        = "sel_b",
    	[DA850_EVM_UI_EXP_SEL_A]        = "sel_a",
    	[DA850_EVM_UI_EXP_PB8]          = "pb8",
    	[DA850_EVM_UI_EXP_PB7]          = "pb7",
    	[DA850_EVM_UI_EXP_PB6]          = "pb6",
    	[DA850_EVM_UI_EXP_PB5]          = "pb5",
    	[DA850_EVM_UI_EXP_PB4]          = "pb4",
    	[DA850_EVM_UI_EXP_PB3]          = "pb3",
    	[DA850_EVM_UI_EXP_PB2]          = "pb2",
    	[DA850_EVM_UI_EXP_PB1]          = "pb1",
    };
    
    #define DA850_N_UI_PB		8
    
    static struct gpio_keys_button da850_evm_ui_keys[] = {
    	[0 ... DA850_N_UI_PB - 1] = {
    		.type			= EV_KEY,
    		.active_low		= 1,
    		.wakeup			= 0,
    		.debounce_interval	= DA850_KEYS_DEBOUNCE_MS,
    		.code			= -1, /* assigned at runtime */
    		.gpio			= -1, /* assigned at runtime */
    		.desc			= NULL, /* assigned at runtime */
    	},
    };
    
    static struct gpio_keys_platform_data da850_evm_ui_keys_pdata = {
    	.buttons = da850_evm_ui_keys,
    	.nbuttons = ARRAY_SIZE(da850_evm_ui_keys),
    	.poll_interval = DA850_GPIO_KEYS_POLL_MS,
    };
    
    static struct platform_device da850_evm_ui_keys_device = {
    	.name = "gpio-keys-polled",
    	.id = 0,
    	.dev = {
    		.platform_data = &da850_evm_ui_keys_pdata
    	},
    };
    
    static void da850_evm_ui_keys_init(unsigned gpio)
    {
    	int i;
    	struct gpio_keys_button *button;
    
    	for (i = 0; i < DA850_N_UI_PB; i++) {
    		button = &da850_evm_ui_keys[i];
    		button->code = KEY_F8 - i;
    		button->desc = (char *)
    				da850_evm_ui_exp[DA850_EVM_UI_EXP_PB8 + i];
    		button->gpio = gpio + DA850_EVM_UI_EXP_PB8 + i;
    	}
    }
    
    #ifdef CONFIG_DA850_UI_CLCD
    static inline void da850_evm_setup_char_lcd(int a, int b, int c)
    {
    	gpio_set_value_cansleep(a, 0);
    	gpio_set_value_cansleep(b, 0);
    	gpio_set_value_cansleep(c, 0);
    }
    #else
    static inline void da850_evm_setup_char_lcd(int a, int b, int c) { }
    #endif
    
    static struct at24_platform_data da850_evm_i2c_eeprom_info = {
    	.byte_len	= SZ_256K / 8,
    	.page_size	= 64,
    	.flags		= AT24_FLAG_ADDR16,
    	.setup		= davinci_get_mac_addr,
    	.context	= (void *)0x7f00,
    };
    
    #ifdef CONFIG_DA850_UI_SD_VIDEO_PORT
    static inline void da850_evm_setup_video_port(int video_sel)
    {
    	gpio_set_value_cansleep(video_sel, 0);
    }
    #else
    static inline void da850_evm_setup_video_port(int video_sel) { }
    #endif
    
    #ifdef CONFIG_DA850_UI_CAMERA
    static inline void da850_evm_setup_camera(int camera_sel)
    {
    	gpio_set_value_cansleep(camera_sel, 0);
    }
    #else
    static inline void da850_evm_setup_camera(int camera_sel) { }
    #endif
    
    static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
    						unsigned ngpio, void *c)
    {
    	int sel_a, sel_b, sel_c, ret;
    
    	sel_a = gpio + DA850_EVM_UI_EXP_SEL_A;
    	sel_b = gpio + DA850_EVM_UI_EXP_SEL_B;
    	sel_c = gpio + DA850_EVM_UI_EXP_SEL_C;
    
    	ret = gpio_request(sel_a, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]);
    	if (ret) {
    		pr_warning("Cannot open UI expander pin %d\n", sel_a);
    		goto exp_setup_sela_fail;
    	}
    
    	ret = gpio_request(sel_b, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]);
    	if (ret) {
    		pr_warning("Cannot open UI expander pin %d\n", sel_b);
    		goto exp_setup_selb_fail;
    	}
    
    	ret = gpio_request(sel_c, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_C]);
    	if (ret) {
    		pr_warning("Cannot open UI expander pin %d\n", sel_c);
    		goto exp_setup_selc_fail;
    	}
    
    	/* deselect all functionalities */
    	gpio_direction_output(sel_a, 1);
    	gpio_direction_output(sel_b, 1);
    	gpio_direction_output(sel_c, 1);
    
    	da850_evm_ui_keys_init(gpio);
    	ret = platform_device_register(&da850_evm_ui_keys_device);
    	if (ret) {
    		pr_warning("Could not register UI GPIO expander push-buttons");
    		goto exp_setup_keys_fail;
    	}
    
    	ui_card_detected = 1;
    	pr_info("DA850/OMAP-L138 EVM UI card detected\n");
    
    	da850_evm_setup_nor_nand();
    
    	da850_evm_setup_emac_rmii(sel_a);
    
    	da850_evm_setup_char_lcd(sel_a, sel_b, sel_c);
    
    	da850_evm_setup_video_port(sel_c);
    
    	da850_evm_setup_camera(sel_b);
    
    	return 0;
    
    exp_setup_keys_fail:
    	gpio_free(sel_c);
    exp_setup_selc_fail:
    	gpio_free(sel_b);
    exp_setup_selb_fail:
    	gpio_free(sel_a);
    exp_setup_sela_fail:
    	return ret;
    }
    
    static int da850_evm_ui_expander_teardown(struct i2c_client *client,
    					unsigned gpio, unsigned ngpio, void *c)
    {
    	platform_device_unregister(&da850_evm_ui_keys_device);
    
    	/* deselect all functionalities */
    	gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_C, 1);
    	gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_B, 1);
    	gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_A, 1);
    
    	gpio_free(gpio + DA850_EVM_UI_EXP_SEL_C);
    	gpio_free(gpio + DA850_EVM_UI_EXP_SEL_B);
    	gpio_free(gpio + DA850_EVM_UI_EXP_SEL_A);
    
    	return 0;
    }
    
    /* assign the baseboard expander's GPIOs after the UI board's */
    #define DA850_UI_EXPANDER_N_GPIOS ARRAY_SIZE(da850_evm_ui_exp)
    #define DA850_BB_EXPANDER_GPIO_BASE (DAVINCI_N_GPIO + DA850_UI_EXPANDER_N_GPIOS)
    
    enum da850_evm_bb_exp_pins {
    	DA850_EVM_BB_EXP_DEEP_SLEEP_EN = 0,
    	DA850_EVM_BB_EXP_SW_RST,
    	DA850_EVM_BB_EXP_TP_23,
    	DA850_EVM_BB_EXP_TP_22,
    	DA850_EVM_BB_EXP_TP_21,
    	DA850_EVM_BB_EXP_USER_PB1,
    	DA850_EVM_BB_EXP_USER_LED2,
    	DA850_EVM_BB_EXP_USER_LED1,
    	DA850_EVM_BB_EXP_USER_SW1,
    	DA850_EVM_BB_EXP_USER_SW2,
    	DA850_EVM_BB_EXP_USER_SW3,
    	DA850_EVM_BB_EXP_USER_SW4,
    	DA850_EVM_BB_EXP_USER_SW5,
    	DA850_EVM_BB_EXP_USER_SW6,
    	DA850_EVM_BB_EXP_USER_SW7,
    	DA850_EVM_BB_EXP_USER_SW8
    };
    
    static const char const *da850_evm_bb_exp[] = {
    	[DA850_EVM_BB_EXP_DEEP_SLEEP_EN]	= "deep_sleep_en",
    	[DA850_EVM_BB_EXP_SW_RST]		= "sw_rst",
    	[DA850_EVM_BB_EXP_TP_23]		= "tp_23",
    	[DA850_EVM_BB_EXP_TP_22]		= "tp_22",
    	[DA850_EVM_BB_EXP_TP_21]		= "tp_21",
    	[DA850_EVM_BB_EXP_USER_PB1]		= "user_pb1",
    	[DA850_EVM_BB_EXP_USER_LED2]		= "user_led2",
    	[DA850_EVM_BB_EXP_USER_LED1]		= "user_led1",
    	[DA850_EVM_BB_EXP_USER_SW1]		= "user_sw1",
    	[DA850_EVM_BB_EXP_USER_SW2]		= "user_sw2",
    	[DA850_EVM_BB_EXP_USER_SW3]		= "user_sw3",
    	[DA850_EVM_BB_EXP_USER_SW4]		= "user_sw4",
    	[DA850_EVM_BB_EXP_USER_SW5]		= "user_sw5",
    	[DA850_EVM_BB_EXP_USER_SW6]		= "user_sw6",
    	[DA850_EVM_BB_EXP_USER_SW7]		= "user_sw7",
    	[DA850_EVM_BB_EXP_USER_SW8]		= "user_sw8",
    };
    
    #define DA850_N_BB_USER_SW	8
    
    static struct gpio_keys_button da850_evm_bb_keys[] = {
    	[0] = {
    		.type			= EV_KEY,
    		.active_low		= 1,
    		.wakeup			= 0,
    		.debounce_interval	= DA850_KEYS_DEBOUNCE_MS,
    		.code			= KEY_PROG1,
    		.desc			= NULL, /* assigned at runtime */
    		.gpio			= -1, /* assigned at runtime */
    	},
    	[1 ... DA850_N_BB_USER_SW] = {
    		.type			= EV_SW,
    		.active_low		= 1,
    		.wakeup			= 0,
    		.debounce_interval	= DA850_KEYS_DEBOUNCE_MS,
    		.code			= -1, /* assigned at runtime */
    		.desc			= NULL, /* assigned at runtime */
    		.gpio			= -1, /* assigned at runtime */
    	},
    };
    
    static struct gpio_keys_platform_data da850_evm_bb_keys_pdata = {
    	.buttons = da850_evm_bb_keys,
    	.nbuttons = ARRAY_SIZE(da850_evm_bb_keys),
    	.poll_interval = DA850_GPIO_KEYS_POLL_MS,
    };
    
    static struct platform_device da850_evm_bb_keys_device = {
    	.name = "gpio-keys-polled",
    	.id = 1,
    	.dev = {
    		.platform_data = &da850_evm_bb_keys_pdata
    	},
    };
    
    static void da850_evm_bb_keys_init(unsigned gpio)
    {
    	int i;
    	struct gpio_keys_button *button;
    
    	button = &da850_evm_bb_keys[0];
    	button->desc = (char *)
    		da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_PB1];
    	button->gpio = gpio + DA850_EVM_BB_EXP_USER_PB1;
    
    	for (i = 0; i < DA850_N_BB_USER_SW; i++) {
    		button = &da850_evm_bb_keys[i + 1];
    		button->code = SW_LID + i;
    		button->desc = (char *)
    				da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_SW1 + i];
    		button->gpio = gpio + DA850_EVM_BB_EXP_USER_SW1 + i;
    	}
    }
    
    #define DA850_N_BB_USER_LED	2
    
    static struct gpio_led da850_evm_bb_leds[] = {
    	[0 ... DA850_N_BB_USER_LED - 1] = {
    		.active_low = 1,
    		.gpio = -1, /* assigned at runtime */
    		.name = NULL, /* assigned at runtime */
    	},
    };
    
    static struct gpio_led_platform_data da850_evm_bb_leds_pdata = {
    	.leds = da850_evm_bb_leds,
    	.num_leds = ARRAY_SIZE(da850_evm_bb_leds),
    };
    
    static struct platform_device da850_evm_bb_leds_device = {
    	.name		= "leds-gpio",
    	.id		= -1,
    	.dev = {
    		.platform_data = &da850_evm_bb_leds_pdata
    	}
    };
    
    static void da850_evm_bb_leds_init(unsigned gpio)
    {
    	int i;
    	struct gpio_led *led;
    
    	for (i = 0; i < DA850_N_BB_USER_LED; i++) {
    		led = &da850_evm_bb_leds[i];
    
    		led->gpio = gpio + DA850_EVM_BB_EXP_USER_LED2 + i;
    		led->name =
    			da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_LED2 + i];
    	}
    }
    
    static int da850_evm_bb_expander_setup(struct i2c_client *client,
    						unsigned gpio, unsigned ngpio,
    						void *c)
    {
    	int ret;
    
    	/*
    	 * Register the switches and pushbutton on the baseboard as a gpio-keys
    	 * device.
    	 */
    	da850_evm_bb_keys_init(gpio);
    	ret = platform_device_register(&da850_evm_bb_keys_device);
    	if (ret) {
    		pr_warning("Could not register baseboard GPIO expander keys");
    		goto io_exp_setup_sw_fail;
    	}
    
    	da850_evm_bb_leds_init(gpio);
    	ret = platform_device_register(&da850_evm_bb_leds_device);
    	if (ret) {
    		pr_warning("Could not register baseboard GPIO expander LEDS");
    		goto io_exp_setup_leds_fail;
    	}
    
    	return 0;
    
    io_exp_setup_leds_fail:
    	platform_device_unregister(&da850_evm_bb_keys_device);
    io_exp_setup_sw_fail:
    	return ret;
    }
    
    static int da850_evm_bb_expander_teardown(struct i2c_client *client,
    					unsigned gpio, unsigned ngpio, void *c)
    {
    	platform_device_unregister(&da850_evm_bb_leds_device);
    	platform_device_unregister(&da850_evm_bb_keys_device);
    
    	return 0;
    }
    
    static struct pca953x_platform_data da850_evm_ui_expander_info = {
    	.gpio_base	= DAVINCI_N_GPIO,
    	.setup		= da850_evm_ui_expander_setup,
    	.teardown	= da850_evm_ui_expander_teardown,
    	.names		= da850_evm_ui_exp,
    };
    
    static struct pca953x_platform_data da850_evm_bb_expander_info = {
    	.gpio_base	= DA850_BB_EXPANDER_GPIO_BASE,
    	.setup		= da850_evm_bb_expander_setup,
    	.teardown	= da850_evm_bb_expander_teardown,
    	.names		= da850_evm_bb_exp,
    };
    
    /*
     * USB1 VBUS is controlled by GPIO2[4], over-current is reported on GPIO6[13].
     */
    #define ON_BD_USB_DRV	GPIO_TO_PIN(2, 4)
    #define ON_BD_USB_OVC	GPIO_TO_PIN(6, 13)
    
    static const short da850_evm_usb11_pins[] = {
    	DA850_GPIO2_4, DA850_GPIO6_13,
    	-1
    };
    
    static da8xx_ocic_handler_t da850_evm_usb_ocic_handler;
    
    static int da850_evm_usb_set_power(unsigned port, int on)
    {
    	gpio_set_value(ON_BD_USB_DRV, on);
    	return 0;
    }
    
    static int da850_evm_usb_get_power(unsigned port)
    {
    	return gpio_get_value(ON_BD_USB_DRV);
    }
    
    static int da850_evm_usb_get_oci(unsigned port)
    {
    	return !gpio_get_value(ON_BD_USB_OVC);
    }
    
    static irqreturn_t da850_evm_usb_ocic_irq(int, void *);
    
    static int da850_evm_usb_ocic_notify(da8xx_ocic_handler_t handler)
    {
    	int irq		= gpio_to_irq(ON_BD_USB_OVC);
    	int error	= 0;
    
    	if (handler != NULL) {
    		da850_evm_usb_ocic_handler = handler;
    
    		error = request_irq(irq, da850_evm_usb_ocic_irq, IRQF_DISABLED |
    				    IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
    				    "OHCI over-current indicator", NULL);
    		if (error)
    			printk(KERN_ERR "%s: could not request IRQ to watch "
    			       "over-current indicator changes\n", __func__);
    	} else
    		free_irq(irq, NULL);
    
    	return error;
    }
    
    static struct da8xx_ohci_root_hub da850_evm_usb11_pdata = {
    	.set_power	= da850_evm_usb_set_power,
    	.get_power	= da850_evm_usb_get_power,
    	.get_oci	= da850_evm_usb_get_oci,
    	.ocic_notify	= da850_evm_usb_ocic_notify,
    
    	/* TPS2065 switch @ 5V */
    	.potpgt		= (3 + 1) / 2,	/* 3 ms max */
    };
    
    static irqreturn_t da850_evm_usb_ocic_irq(int irq, void *dev_id)
    {
    	da850_evm_usb_ocic_handler(&da850_evm_usb11_pdata, 1);
    	return IRQ_HANDLED;
    }
    
    static __init void da850_evm_usb_init(void)
    {
    	u32 cfgchip2;
    	int ret;
    
    	/*
    	 * Set up USB clock/mode in the CFGCHIP2 register.
    	 * FYI:  CFGCHIP2 is 0x0000ef00 initially.
    	 */
    	cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
    
    	/* USB2.0 PHY reference clock is 24 MHz */
    	cfgchip2 &= ~CFGCHIP2_REFFREQ;
    	cfgchip2 |=  CFGCHIP2_REFFREQ_24MHZ;
    
    	/*
    	 * Select internal reference clock for USB 2.0 PHY
    	 * and use it as a clock source for USB 1.1 PHY
    	 * (this is the default setting anyway).
    	 */
    	cfgchip2 &= ~CFGCHIP2_USB1PHYCLKMUX;
    	cfgchip2 |=  CFGCHIP2_USB2PHYCLKMUX;
    
    	/*
    	 * We have to override VBUS/ID signals when MUSB is configured into the
    	 * host-only mode -- ID pin will float if no cable is connected, so the
    	 * controller won't be able to drive VBUS thinking that it's a B-device.
    	 * Otherwise, we want to use the OTG mode and enable VBUS comparators.
    	 */
    	cfgchip2 &= ~CFGCHIP2_OTGMODE;
    #ifdef	CONFIG_USB_MUSB_HOST
    	cfgchip2 |=  CFGCHIP2_FORCE_HOST;
    #else
    	cfgchip2 |=  CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN;
    #endif
    
    	__raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
    
    	/*
    	 * TPS2065 switch @ 5V supplies 1 A (sustains 1.5 A),
    	 * with the power on to power good time of 3 ms.
    	 */
    	ret = da8xx_register_usb20(1000, 3);
    	if (ret)
    		pr_warning("%s: USB 2.0 registration failed: %d\n",
    			   __func__, ret);
    
    	ret = davinci_cfg_reg_list(da850_evm_usb11_pins);
    	if (ret) {
    		pr_warning("%s: USB 1.1 PinMux setup failed: %d\n",
    			   __func__, ret);
    		return;
    	}
    
    	ret = gpio_request(ON_BD_USB_DRV, "ON_BD_USB_DRV");
    	if (ret) {
    		printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
    		       "power control: %d\n", __func__, ret);
    		return;
    	}
    	gpio_direction_output(ON_BD_USB_DRV, 0);
    
    	ret = gpio_request(ON_BD_USB_OVC, "ON_BD_USB_OVC");
    	if (ret) {
    		printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
    		       "over-current indicator: %d\n", __func__, ret);
    		return;
    	}
    	gpio_direction_input(ON_BD_USB_OVC);
    
    	ret = da8xx_register_usb11(&da850_evm_usb11_pdata);
    	if (ret)
    		pr_warning("%s: USB 1.1 registration failed: %d\n",
    			   __func__, ret);
    }
    
    static struct davinci_uart_config da850_evm_uart_config __initdata = {
    	.enabled_uarts = 0x7,
    };
    
    /* davinci da850 evm audio machine driver */
    static u8 da850_iis_serializer_direction[] = {
    	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
    	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
    	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	TX_MODE,
    	RX_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
    };
    
    static struct snd_platform_data da850_evm_snd_data = {
    	.tx_dma_offset	= 0x2000,
    	.rx_dma_offset	= 0x2000,
    	.op_mode	= DAVINCI_MCASP_IIS_MODE,
    	.num_serializer	= ARRAY_SIZE(da850_iis_serializer_direction),
    	.tdm_slots	= 2,
    	.serial_dir	= da850_iis_serializer_direction,
    	.asp_chan_q	= EVENTQ_0,
    	.version	= MCASP_VERSION_2,
    	.txnumevt	= 1,
    	.rxnumevt	= 1,
    };
    
    static struct davinci_mcbsp_platform_data da850_mcbsp0_config = {
    	.inst	= 0,
    };
    
    static struct davinci_mcbsp_platform_data da850_mcbsp1_config = {
    	.inst	= 1,
    };
    
    static int da850_evm_mmc_get_ro(int index)
    {
    	return gpio_get_value(DA850_MMCSD_WP_PIN);
    }
    
    static int da850_evm_mmc_get_cd(int index)
    {
    	return !gpio_get_value(DA850_MMCSD_CD_PIN);
    }
    
    static int wl12xx_set_power(int slot, int power_on)
    {
    	static int power_state;
    
    	pr_debug("Powering %s wifi", (power_on ? "on" : "off"));
    
    	if (power_on == power_state)
    		return 0;
    	power_state = power_on;
    
    	if (power_on) {
    		gpio_set_value(DA850_WLAN_EN, 1);
    		mdelay(15);
    		gpio_set_value(DA850_WLAN_EN, 0);
    		mdelay(1);
    		gpio_set_value(DA850_WLAN_EN, 1);
    		mdelay(70);
    	} else {
    		gpio_set_value(DA850_WLAN_EN, 0);
    	}
    
    	return 0;
    }
    
    static struct davinci_mmc_config da850_mmc_config[] = {
    	{
    		.get_ro		= da850_evm_mmc_get_ro,
    		.get_cd		= da850_evm_mmc_get_cd,
    		.wires		= 4,
    		.max_freq	= 50000000,
    		.caps		= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
    		.version	= MMC_CTLR_VERSION_2,
    	},
    	{
    		.get_ro		= NULL,
    		.get_cd		= NULL,
    		.set_power	= wl12xx_set_power,
    		.wires		= 4,
    		.max_freq	= 25000000,
    		.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_NONREMOVABLE |
    				  MMC_CAP_POWER_OFF_CARD,
    		.version	= MMC_CTLR_VERSION_2,
    	},
    	{}	/* Terminator */
    };
    
    static void da850_panel_power_ctrl(int val)
    {
    	/* lcd power */
    	gpio_set_value(DA850_LCD_PWR_PIN, val);
    
    	mdelay(200);
    
    	/* lcd backlight */
    	gpio_set_value(DA850_LCD_BL_PIN, val);
    }
    
    static int da850_lcd_hw_init(void)
    {
    	void __iomem *cfg_mstpri2_base;
    	int status;
    	u32 val;
    
    	/*
    	 * Reconfigure the LCDC priority to the highest to ensure that
    	 * the throughput/latency requirements for the LCDC are met.
    	 */
    	cfg_mstpri2_base = DA8XX_SYSCFG0_VIRT(DA8XX_MSTPRI2_REG);
    
    	val = __raw_readl(cfg_mstpri2_base);
    	val &= 0x0fffffff;
    	__raw_writel(val, cfg_mstpri2_base);
    
    	status = gpio_request(DA850_LCD_BL_PIN, "lcd bl\n");
    	if (status < 0)
    		return status;
    
    	status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr\n");
    	if (status < 0) {
    		gpio_free(DA850_LCD_BL_PIN);
    		return status;
    	}
    
    	gpio_direction_output(DA850_LCD_BL_PIN, 0);
    	gpio_direction_output(DA850_LCD_PWR_PIN, 0);
    
    	return 0;
    }
    
    /* TPS65070 voltage regulator support */
    
    /* 3.3V */
    static struct regulator_consumer_supply tps65070_dcdc1_consumers[] = {
    	{
    		.supply = "usb0_vdda33",
    	},
    	{
    		.supply = "usb1_vdda33",
    	},
    };
    
    /* 3.3V or 1.8V */
    static struct regulator_consumer_supply tps65070_dcdc2_consumers[] = {
    	{
    		.supply = "dvdd3318_a",
    	},
    	{
    		.supply = "dvdd3318_b",
    	},
    	{
    		.supply = "dvdd3318_c",
    	},
    };
    
    /* 1.2V */
    static struct regulator_consumer_supply tps65070_dcdc3_consumers[] = {
    	{
    		.supply = "cvdd",
    	},
    };
    
    /* 1.8V LDO */
    static struct regulator_consumer_supply tps65070_ldo1_consumers[] = {
    	{
    		.supply = "sata_vddr",
    	},
    	{
    		.supply = "usb0_vdda18",
    	},
    	{
    		.supply = "usb1_vdda18",
    	},
    	{
    		.supply = "ddr_dvdd18",
    	},
    };
    
    /* 1.2V LDO */
    static struct regulator_consumer_supply tps65070_ldo2_consumers[] = {
    	{
    		.supply = "sata_vdd",
    	},
    	{
    		.supply = "pll0_vdda",
    	},
    	{
    		.supply = "pll1_vdda",
    	},
    	{
    		.supply = "usbs_cvdd",
    	},
    	{
    		.supply = "vddarnwa1",
    	},
    };
    
    /* We take advantage of the fact that both defdcdc{2,3} are tied high */
    static struct tps6507x_reg_platform_data tps6507x_platform_data = {
    	.defdcdc_default = true,
    };                                                                   //only set true or faluse to whether DCDC is high or low 
    
    static struct regulator_init_data tps65070_regulator_data[] = {
    	/* dcdc1 */
    	{
    		.constraints = {
    			.min_uV = 3150000,
    			.max_uV = 3450000,
    			.valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
    				REGULATOR_CHANGE_STATUS),
    			.boot_on = 1,
    		},
    		.num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc1_consumers),
    		.consumer_supplies = tps65070_dcdc1_consumers,
    	},
    
    	/* dcdc2 */
    	{
    		.constraints = {
    			.min_uV = 1710000,
    			.max_uV = 3450000,
    			.valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
    				REGULATOR_CHANGE_STATUS),
    			.boot_on = 1,
    		},
    		.num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc2_consumers),
    		.consumer_supplies = tps65070_dcdc2_consumers,
    		.driver_data = &tps6507x_platform_data,
    	},
    
    	/* dcdc3 */
    	{
    		.constraints = {
    			.min_uV = 950000,
    			.max_uV = 1350000,
    			.valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
    				REGULATOR_CHANGE_STATUS),
    			.boot_on = 1,
    		},
    		.num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc3_consumers),
    		.consumer_supplies = tps65070_dcdc3_consumers,
    		.driver_data = &tps6507x_platform_data,
    	},
    
    	/* ldo1 */
    	{
    		.constraints = {
    			.min_uV = 1710000,
    			.max_uV = 1890000,
    			.valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
    				REGULATOR_CHANGE_STATUS),
    			.boot_on = 1,
    		},
    		.num_consumer_supplies = ARRAY_SIZE(tps65070_ldo1_consumers),
    		.consumer_supplies = tps65070_ldo1_consumers,
    	},
    
    	/* ldo2 */
    	{
    		.constraints = {
    			.min_uV = 1140000,
    			.max_uV = 1320000,
    			.valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
    				REGULATOR_CHANGE_STATUS),
    			.boot_on = 1,
    		},
    		.num_consumer_supplies = ARRAY_SIZE(tps65070_ldo2_consumers),
    		.consumer_supplies = tps65070_ldo2_consumers,
    	},                                                                                //set the TPS6507X  five output voltage 
    };
    
    static struct touchscreen_init_data tps6507x_touchscreen_data = {                         //set the touchscreen data information 
    	.poll_period =  30,	/* ms between touch samples */
    	.min_pressure = 0x30,	/* minimum pressure to trigger touch */
    	.vref = 0,		/* turn off vref when not using A/D */
    	.vendor = 0,		/* /sys/class/input/input?/id/vendor */
    	.product = 65070,	/* /sys/class/input/input?/id/product */
    	.version = 0x100,	/* /sys/class/input/input?/id/version */
    };
    
    static struct tps6507x_board tps_board = {
    	.tps6507x_pmic_init_data = &tps65070_regulator_data[0],
    	.tps6507x_ts_init_data = &tps6507x_touchscreen_data,
    };
    
    static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
    	{
    		I2C_BOARD_INFO("24c256", 0x50),
    		.platform_data = &da850_evm_i2c_eeprom_info,
    	},
    	{
    		I2C_BOARD_INFO("tlv320aic3x", 0x18),
    	},
    	{
    		I2C_BOARD_INFO("tca6416", 0x20),
    		.platform_data = &da850_evm_ui_expander_info,
    	},
    	/*{
    		I2C_BOARD_INFO("tca6416", 0x21),
    		.platform_data = &da850_evm_bb_expander_info,
    	},*/
    	{
    		I2C_BOARD_INFO("tps6507x", 0x48),
    		.platform_data = &tps_board,
    	},
    	{
    		I2C_BOARD_INFO("cdce913", 0x65),
    	},
    	{
    		I2C_BOARD_INFO("PCA9543A", 0x73),
    	},
    };
    
    static const short da850_evm_lcdc_pins[] = {
    	DA850_GPIO2_8, DA850_GPIO2_15,
    	-1
    };
    
    static struct i2c_client *pca9543a;
    
    static int pca9543a_probe(struct i2c_client *client,
    		const struct i2c_device_id *id)
    {
    	pr_info("pca9543a_probe");
    	pca9543a = client;
    	return 0;
    }
    
    static int pca9543a_remove(struct i2c_client *client)
    {
    	pca9543a = NULL;
    	return 0;
    }
    
    static const struct i2c_device_id pca9543a_ids[] = {
    	{ "PCA9543A", 0, },
    	{ /* end of list */ },
    };
    
    /* This is for i2c driver for the MT9T031 header i2c switch */
    static struct i2c_driver pca9543a_driver = {
    	.driver.name	= "PCA9543A",
    	.id_table	= pca9543a_ids,
    	.probe		= pca9543a_probe,
    	.remove		= pca9543a_remove,
    };
    
    /**
     * da850_enable_pca9543a() - Enable/Disable I2C switch PCA9543A for sensor
     * @en: enable/disable flag
     */
    static int da850_enable_pca9543a(int en)
    {
    	static char val = 1;
    	int status = 1;
    	struct i2c_msg msg = {
    			.flags = 0,
    			.len = 1,
    			.buf = &val,
    		};
    
    	pr_info("da850evm_enable_pca9543a\n");
    	if (!en)
    		val = 0;
    
    	if (!pca9543a)
    		return -ENXIO;
    
    	msg.addr = pca9543a->addr;
    	/* turn i2c switch, pca9543a, on/off */
    	status = i2c_transfer(pca9543a->adapter, &msg, 1);       //if it has transfer 1 message succeed  ,it means i2c switch is on 
    	if (status == 1)
    		status = 0;
    
    	return status;
    }
    
    static const short da850_evm_mii_pins[] = {
    	DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
    	DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER,
    	DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3,
    	DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK,
    	DA850_MDIO_D,
    	-1
    };
    
    static const short da850_evm_rmii_pins[] = {
    	DA850_RMII_TXD_0, DA850_RMII_TXD_1, DA850_RMII_TXEN,
    	DA850_RMII_CRS_DV, DA850_RMII_RXD_0, DA850_RMII_RXD_1,
    	DA850_RMII_RXER, DA850_RMII_MHZ_50_CLK, DA850_MDIO_CLK,
    	DA850_MDIO_D,
    	-1
    };
    
    static int __init da850_evm_config_emac(void)
    {
    	void __iomem *cfg_chip3_base;
    	int ret;
    	u32 val;
    	struct davinci_soc_info *soc_info = &davinci_soc_info;
    	u8 rmii_en = soc_info->emac_pdata->rmii_en;
    
    	if (!machine_is_davinci_da850_evm())
    		return 0;
    
    	cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
    
    	val = __raw_readl(cfg_chip3_base);
    
    	if (rmii_en) {
    		val |= BIT(8);
    		ret = davinci_cfg_reg_list(da850_evm_rmii_pins);
    		pr_info("EMAC: RMII PHY configured, MII PHY will not be"
    							" functional\n");
    	} else {
    		val &= ~BIT(8);
    		ret = davinci_cfg_reg_list(da850_evm_mii_pins);
    		pr_info("EMAC: MII PHY configured, RMII PHY will not be"
    							" functional\n");
    	}
    
    	if (ret)
    		pr_warning("da850_evm_init: cpgmac/rmii mux setup failed: %d\n",
    				ret);
    
    	/* configure the CFGCHIP3 register for RMII or MII */
    	__raw_writel(val, cfg_chip3_base);
    
    	ret = davinci_cfg_reg(DA850_GPIO2_6);
    	if (ret)
    		pr_warning("da850_evm_init:GPIO(2,6) mux setup "
    							"failed\n");
    
    	ret = gpio_request(DA850_MII_MDIO_CLKEN_PIN, "mdio_clk_en");
    	if (ret) {
    		pr_warning("Cannot open GPIO %d\n",
    					DA850_MII_MDIO_CLKEN_PIN);
    		return ret;
    	}
    
    	/* Enable/Disable MII MDIO clock */
    	gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, rmii_en);
    
    	soc_info->emac_pdata->phy_id = DA850_EVM_PHY_ID;
    
    	ret = da8xx_register_emac();
    	if (ret)
    		pr_warning("da850_evm_init: emac registration failed: %d\n",
    				ret);
    
    	return 0;
    }
    device_initcall(da850_evm_config_emac);
    
    static const struct vpif_input da850_ch2_inputs[] = {
    		
                {
    		.input = {
    			.index = 0,
    			.name = "Camera",
    			.type = V4L2_INPUT_TYPE_CAMERA,
    			.std = V4L2_STD_BAYER_ALL
    		},
                  // .subdev_name = "mt9t031", 
    		.subdev_name = "ov7670",              
    	  },
    
         /* #else
              {
               .input={
                    .index=0,
                    .name="Camera",
                    .type= V4L2_INPUT_TYPE_CAMERA,
                    .std = V4L2_STD_CAMERA_VGA
               },
                  .subdev_name="ov7670",
              },   
          #endif                 */                                //  revised as the ov7670 device 
    };
    
    /*
     * The following EDMA channels/slots are not being used by drivers (for
     * example: Timer, GPIO, UART events etc) on da850/omap-l138 EVM, hence
     * they are being reserved for codecs on the DSP side.
     */
    static const s16 da850_dma0_rsv_chans[][2] = {
    	/* (offset, number) */
    	{ 8,  6},
    	{24,  4},
    	{30,  2},
    	{-1, -1}
    };
    
    static const s16 da850_dma0_rsv_slots[][2] = {
    	/* (offset, number) */
    	{ 8,  6},
    	{24,  4},
    	{30, 50},
    	{-1, -1}
    };
    
    static const s16 da850_dma1_rsv_chans[][2] = {
    	/* (offset, number) */
    	{ 0, 28},
    	{30,  2},
    	{-1, -1}
    };
    
    static const s16 da850_dma1_rsv_slots[][2] = {
    	/* (offset, number) */
    	{ 0, 28},
    	{30, 90},
    	{-1, -1}
    };
    
    static struct edma_rsv_info da850_edma_cc0_rsv = {
    	.rsv_chans	= da850_dma0_rsv_chans,
    	.rsv_slots	= da850_dma0_rsv_slots,
    };
    
    static struct edma_rsv_info da850_edma_cc1_rsv = {
    	.rsv_chans	= da850_dma1_rsv_chans,
    	.rsv_slots	= da850_dma1_rsv_slots,
    };
    
    static struct edma_rsv_info *da850_edma_rsv[2] = {
    	&da850_edma_cc0_rsv,
    	&da850_edma_cc1_rsv,
    };
    
    #ifdef CONFIG_CPU_FREQ
    static __init int da850_evm_init_cpufreq(void)
    {
    	switch (system_rev & 0xF) {
    	case 3:
    		da850_max_speed = 456000;
    		break;
    	case 2:
    		da850_max_speed = 408000;
    		break;
    	case 1:
    		da850_max_speed = 372000;
    		break;
    	}
    
    	return da850_register_cpufreq("pll0_sysclk3");
    }
    #else
    static __init int da850_evm_init_cpufreq(void) { return 0; }
    #endif
    
    static struct i2c_gpio_platform_data da850_gpio_i2c_pdata = {
    	.sda_pin	= GPIO_TO_PIN(1, 4),
    	.scl_pin	= GPIO_TO_PIN(1, 5),
    	.udelay		= 2,			/* 250 KHz */
    };
    
    static struct platform_device da850_gpio_i2c = {
    	.name		= "i2c-gpio",
    	.id		= 1,
    	.dev		= {
    		.platform_data	= &da850_gpio_i2c_pdata,
    	},
    };
    
    /* Retaining these APIs, since the VPIF drivers do not check NULL handlers */
    static int da850_set_vpif_clock(int mux_mode, int hd)
    {
    	return 0;
    }
    
    static int da850_setup_vpif_input_channel_mode(int mux_mode)
    {
    	return 0;
    }
    
    /*Enable mt9t031 by configuring pca9543a i2c switch on sensor
     */
    int da850_vpif_setup_input_path(int ch, const char *name)
    {
    	int ret = 0;
    
    	//if (have_imager())
    	//	ret = da850_enable_pca9543a(1);
          /*because we donot has pca9543a so  the input_path is always on donnot depend on pca9543a  revised by oyz 1023 */
    	return ret;
    }
    
    static int da850_vpif_intr_status(void __iomem *vpif_base, int channel)
    {
    	int status = 0;
    	int mask;
    
    	if (channel < 0 || channel > 3)
    		return 0;
    
    	mask = 1 << channel;
    	status = __raw_readl((vpif_base + VPIF_STATUS)) & mask;
    	__raw_writel(status, (vpif_base + VPIF_STATUS_CLR));
    
    	return status;
    }
    
    
    #if defined(CONFIG_DA850_UI_SD_VIDEO_PORT)
    /* VPIF capture configuration */
    static struct tvp514x_platform_data tvp5146_pdata = {
    	.clk_polarity = 0,
    	.hs_polarity = 1,
    	.vs_polarity = 1
    };
    #endif
    static struct ov7670_config ov7670_info ={                  
          .min_width =320,                           // Filter out smaller sizes 
          .min_height =240,                          // Filter out smaller sizes 
          .clock_speed       = 24,                   // External clock speed (MHz) 
          .use_smbus        =true,                     // Use smbus I/O instead of I2C 
     };
    static struct i2c_board_info ov7670_i2c_camera[] = {
       {
         I2C_BOARD_INFO("ov7670",0x21),
        // .platform_data = &ov7670_info,
        }
      };
    
    
    static struct soc_camera_link ov7670_link = {
    //    .power        = ov7670_power,
          .board_info    = &ov7670_i2c_camera[0],
          .i2c_adapter_id    = 1,                        //1,        //default is 1 modified oyz 1028
          .bus_id        = 1,
          .priv        = &ov7670_info,
    };                                                        //add follows 0514 
    
    // add the platform device to ov7670 oyz 1023 
    static struct platform_device ov7670_camera[] = {
    	{
    	.name = "ov7670",
    	.id = 0,
    	.dev = {
    		.platform_data = &ov7670_link,//(void *) 1, //&tw9900_info,
    		},
    	},
    };
    
    static struct platform_device *ov7670_devices[] __initdata = {
          &ov7670_camera[0],
    };
          
    #define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
    
    static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = {
    #if defined(CONFIG_DA850_UI_CAMERA)
    	//#if 0
                    {
    		//.name	= "mt9t031",
                    .name	= "ov7670",
    		.board_info = {
    			//I2C_BOARD_INFO("mt9t031", 0x5d),
                            I2C_BOARD_INFO("ov7670", 0x42),
    			.platform_data = (void *)1,
    		},
    		.vpif_if = {
    			.if_type = VPIF_IF_RAW_BAYER,                     //vpif_if has three format vpif_if BT656 BT1120 and VPIF_IF_RAW_BAYER
    			.hd_pol = 0,
    			.vd_pol = 0,
    			.fid_pol = 0,
    		},
    	},
          /* #else  
                 {
                    .name="ov7670",
                    .board_info={
                                 I2C_BOARD_INFO("ov7670",0x21),
                                .platform_data=&ov7670_link, // (void *)1, //                  //&ov7670_link, modified 1027
                         },
                   .vpif_if = {
                               .if_type=VPIF_IF_RAW_BAYER,
                               .hd_pol=1,
                               .vd_pol=1,
                               .fid_pol=0,
                     },  
               }   
          #endif    */                                                                  //add this forhead 0512
    #elif defined(CONFIG_DA850_UI_SD_VIDEO_PORT)
    	{
    		.name	= TVP5147_CH0,
    		.board_info = {
    			I2C_BOARD_INFO("tvp5146", 0x5d),
    			.platform_data = &tvp5146_pdata,
    		},
    		.input = INPUT_CVBS_VI2B,
    		.output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
    		.can_route = 1,
    		.vpif_if = {
    			.if_type = VPIF_IF_BT656,
    			.hd_pol = 1,
    			.vd_pol = 1,
    			.fid_pol = 0,
    		},
    	},
    	{
    		.name	= TVP5147_CH1,
    		.board_info = {
    			I2C_BOARD_INFO("tvp5146", 0x5c),
    			.platform_data = &tvp5146_pdata,
    		},
    		.input = INPUT_SVIDEO_VI2C_VI1C,
    		.output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
    		.can_route = 1,
    		.vpif_if = {
    			.if_type = VPIF_IF_BT656,
    			.hd_pol = 1,
    			.vd_pol = 1,
    			.fid_pol = 0,
    		},
    	},
    #endif
    };
    
    static const struct vpif_input da850_ch0_inputs[] = {
    	{
    		.input = {
    			.index = 0,
    			.name = "Composite",
    			.type = V4L2_INPUT_TYPE_CAMERA,
    			.std = TVP514X_STD_ALL,
    		},
    		.subdev_name = TVP5147_CH0,
    	},
    };
    
    static const struct vpif_input da850_ch1_inputs[] = {
           {
    		.input = {
    			.index = 0,
    			.name = "S-Video",
    			.type = V4L2_INPUT_TYPE_CAMERA,
    			.std = TVP514X_STD_ALL,
    		},
    		.subdev_name = TVP5147_CH1,
    	},
    };
    
    static struct vpif_capture_config da850_vpif_capture_config = {
    	.setup_input_channel_mode = da850_setup_vpif_input_channel_mode,
    	//.setup_input_path = da850_vpif_setup_input_path,
    	.intr_status = da850_vpif_intr_status,
    	.subdev_info = da850_vpif_capture_sdev_info,
    	.subdev_count = ARRAY_SIZE(da850_vpif_capture_sdev_info),
    #if defined(CONFIG_DA850_UI_SD_VIDEO_PORT)
    	.chan_config[0] = {
    		.inputs = da850_ch0_inputs,
    		.input_count = ARRAY_SIZE(da850_ch0_inputs),
    	},
    	.chan_config[1] = {
    		.inputs = da850_ch1_inputs,
    		.input_count = ARRAY_SIZE(da850_ch1_inputs),
    	},
    #elif defined(CONFIG_DA850_UI_CAMERA)
    	.chan_config[0] = {
    		.inputs = da850_ch2_inputs,
    		.input_count = ARRAY_SIZE(da850_ch2_inputs),
    	},
    #endif
    	.card_name      = "DA850/OMAP-L138 Video Capture",
    };
    
    /* VPIF display configuration */
    static struct vpif_subdev_info da850_vpif_subdev[] = {
    	{
    		.name	= "adv7343",
    		.board_info = {
    			I2C_BOARD_INFO("adv7343", 0x2a),
    		},
    	},
    };
    
    static const char *vpif_output[] = {
    	"Composite",
    	"Component",
    	"S-Video",
    };
    
    static struct vpif_display_config da850_vpif_display_config = {
    	.set_clock	= da850_set_vpif_clock,
    	.intr_status	= da850_vpif_intr_status,
    	.subdevinfo	= da850_vpif_subdev,
    	.subdev_count	= ARRAY_SIZE(da850_vpif_subdev),
    	.output		= vpif_output,
    	.output_count	= ARRAY_SIZE(vpif_output),
    	.card_name	= "DA850/OMAP-L138 Video Display",
    };
    
    #if defined(CONFIG_DAVINCI_MCBSP0)
    #define HAS_MCBSP0 1
    #else
    #define HAS_MCBSP0 0
    #endif
    
    #if defined(CONFIG_DAVINCI_MCBSP1)
    #define HAS_MCBSP1 1
    #else
    #define HAS_MCBSP1 0
    #endif
    
    #if defined(CONFIG_TI_DAVINCI_EMAC) || \
    	defined(CONFIG_TI_DAVINCI_EMAC_MODULE)
    #define HAS_EMAC 1
    #else
    #define HAS_EMAC 0
    #endif
    
    #if defined(CONFIG_SND_DA850_SOC_EVM) || \
    	defined(CONFIG_SND_DA850_SOC_EVM_MODULE)
    #define HAS_MCASP 1
    #else
    #define HAS_MCASP 0
    #endif
    
    #if defined(CONFIG_DAVINCI_UART1_AFE)
    #define HAS_UART1_AFE 1
    #else
    #define HAS_UART1_AFE 0
    #endif
    
    #if defined(CONFIG_DA850_UI_RMII) && (HAS_EMAC)
    #define HAS_RMII 1
    #else
    #define HAS_RMII 0
    #endif
    
    #if defined(CONFIG_DA850_UI_LCD) && defined(CONFIG_FB_DA8XX) ||\
    		defined(CONFIG_FB_DA8XX_MODULE)
    #define HAS_GLCD 1
    #else
    #define HAS_GLCD 0
    #endif
    
    #if defined(CONFIG_VIDEO_DAVINCI_VPIF_DISPLAY) ||\
    		defined(CONFIG_VIDEO_DAVINCI_VPIF_DISPLAY_MODULE)
    #define HAS_VPIF_DISPLAY 1
    #else
    #define HAS_VPIF_DISPLAY 0
    #endif
    
    #if defined(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) ||\
    		defined(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE_MODULE)
    #define HAS_VPIF_CAPTURE 1
    #else
    #define HAS_VPIF_CAPTURE 0
    #endif
    
    #if defined(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) ||\
    		defined(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE_MODULE)
    #define HAS_VPIF_CAPTURE 1
    #else
    #define HAS_VPIF_CAPTURE 0
    #endif
    
    #define DA850EVM_SATA_REFCLKPN_RATE	(100 * 1000 * 1000)
    
    #if defined(CONFIG_SPI_DAVINCI)
    #define HAS_SPI 1
    #else
    #define HAS_SPI 0
    #endif
    
    #if defined(CONFIG_FB_DA8XX)
    #define HAS_LCD	1
    #else
    #define HAS_LCD	0
    #endif
    
    #ifdef CONFIG_DA850_MISTRAL_WL12XX
    
    static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
    	.irq = -1,
    	.board_ref_clock = CONFIG_DA850_MISTRAL_WL12XX_REFCLOCK,
    	.platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
    };
    
    static void da850_wl12xx_set_platform_data(void)
    {
    	da850_wl12xx_wlan_data.irq = gpio_to_irq(DA850_WLAN_IRQ);
    	if (wl12xx_set_platform_data(&da850_wl12xx_wlan_data))
    		pr_err("Error setting wl12xx data\n");
    }
    
    #else
    
    static void da850_wl12xx_set_platform_data(void) { }
    
    #endif
    
    static void da850_wl12xx_init(void)
    {
    	if (gpio_request(DA850_WLAN_EN, "wl12xx") ||
    	    gpio_direction_output(DA850_WLAN_EN, 0))
    		pr_err("Error initializing the wl12xx enable gpio\n");
    
    	if (gpio_request(DA850_WLAN_IRQ, "wl12xx_irq") ||
    	    gpio_direction_input(DA850_WLAN_IRQ))
    		pr_err("Error initializing the wl12xx irq gpio\n");
    	if (gpio_request(WL1271_BT_EN_GPIO, "wl1271 BT Enable") ||
    	    gpio_direction_output(WL1271_BT_EN_GPIO,0))
    		pr_err("Failed to request BT_EN GPIO\n");
    
    	da850_wl12xx_set_platform_data();
    }
    
    static __init void da850_evm_init(void)
    {
    	int ret;
    	char mask = 0;
    	struct davinci_soc_info *soc_info = &davinci_soc_info;
    
    	u8 rmii_en = soc_info->emac_pdata->rmii_en;
    	ret = da850_register_edma(da850_edma_rsv);
    	if (ret)
    		pr_warning("da850_evm_init: edma registration failed: %d\n",
    				ret);
    
    	ret = davinci_cfg_reg_list(da850_i2c0_pins);
    	if (ret)
    		pr_warning("da850_evm_init: i2c0 mux setup failed: %d\n",
    				ret);
    
    	platform_device_register(&da850_gpio_i2c);
    
    	/* Register PRUSS device */
    	da8xx_register_pruss();
    
    	ret = da8xx_register_watchdog();
    	if (ret)
    		pr_warning("da830_evm_init: watchdog registration failed: %d\n",
    				ret);
    
    	/* Support for UART 1 */
    	ret = davinci_cfg_reg_list(da850_uart1_pins);                                 //the  i2c1_scl i2c1_sda uart1 is config as 
    	if (ret)
    		pr_warning("da850_evm_init: UART 1 mux setup failed:"
    						" %d\n", ret);
    
    	ret = da850_register_sata(DA850EVM_SATA_REFCLKPN_RATE);
    	if (ret)
    		pr_warning("da850_evm_init: sata registration failed: %d\n",
    				ret);
    
    	if (HAS_MMC) {
    		ret = davinci_cfg_reg_list(da850_mmcsd0_pins);
    		if (ret)
    			pr_warning("da850_evm_init: mmcsd0 mux setup failed:"
    					" %d\n", ret);
    
    		ret = davinci_cfg_reg_list(da850_mmcsd1_pins);
    		if (ret)
    			pr_warning("da850_evm_init: mmcsd1 mux setup failed:"
    					" %d\n", ret);
    
    		ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n");
    		if (ret)
    			pr_warning("da850_evm_init: can not open GPIO %d\n",
    					DA850_MMCSD_CD_PIN);
    		gpio_direction_input(DA850_MMCSD_CD_PIN);
    
    		ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n");
    		if (ret)
    			pr_warning("da850_evm_init: can not open GPIO %d\n",
    					DA850_MMCSD_WP_PIN);
    		gpio_direction_input(DA850_MMCSD_WP_PIN);
    
    		ret = da8xx_register_mmcsd0(&da850_mmc_config[0]);
    		if (ret)
    			pr_warning("da850_evm_init: mmcsd0 registration failed:"
    					" %d\n", ret);
    		ret = da850_register_mmcsd1(&da850_mmc_config[1]);
    		if (ret)
    			pr_warning("da850_evm_init: mmcsd0 registration failed:"
    					" %d\n", ret);
    
    		da850_wl12xx_init();
    	}
    
    	davinci_serial_init(&da850_evm_uart_config);
    
    	if (have_imager())
    		i2c_add_driver(&pca9543a_driver);
    
    	i2c_register_board_info(1, da850_evm_i2c_devices,
    			ARRAY_SIZE(da850_evm_i2c_devices));
    
    	/*
    	 * shut down uart 0 and 1; they are not used on the board and
    	 * accessing them causes endless "too much work in irq53" messages
    	 * with arago fs
    	 */
    	__raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30);
    
    	if (HAS_MCBSP0) {
    		if (HAS_EMAC)
    			pr_warning("WARNING: both MCBSP0 and EMAC are "
    				"enabled, but they share pins.\n"
    				"\tDisable one of them.\n");
    
    		ret = davinci_cfg_reg_list(da850_mcbsp0_pins);
    		if (ret)
    			pr_warning("da850_evm_init: mcbsp0 mux setup failed:"
    					" %d\n", ret);
    
    		ret = da850_init_mcbsp(&da850_mcbsp0_config);
    		if (ret)
    			pr_warning("da850_evm_init: mcbsp0 registration"
    					"failed: %d\n",	ret);
    	}
    
    	if (HAS_MCBSP1) {
    		ret = davinci_cfg_reg_list(da850_mcbsp1_pins);
    		if (ret)
    			pr_warning("da850_evm_init: mcbsp1 mux setup failed:"
    					" %d\n", ret);
    
    		ret = da850_init_mcbsp(&da850_mcbsp1_config);
    		if (ret)
    			pr_warning("da850_evm_init: mcbsp1 registration"
    					" failed: %d\n", ret);
    	}
    	 
    	if (HAS_MCASP) {
    		if ((HAS_MCBSP0 || HAS_MCBSP1))
    			pr_warning("WARNING: both McASP and McBSP are enabled, "
    					"but they share pins.\n"
    					"\tOnly McASP will work. If you want "
    					"McBSP support, disable McASP.\n");
    		if (HAS_UART1_AFE)
    			pr_warning("WARNING: both McASP and UART1_AFE are "
    				"enabled, but they share pins.\n"
    					"\tDisable one of them.\n");
    
    		ret = davinci_cfg_reg_list(da850_mcasp_pins);
    		if (ret)
    			pr_warning("da850_evm_init: mcasp mux setup failed:"
    					"%d\n", ret);
    
    		da8xx_register_mcasp(0, &da850_evm_snd_data);
    	}
    
    	ret = davinci_cfg_reg_list(da850_lcdcntl_pins);
    	if (ret)
    		pr_warning("da850_evm_init: lcdcntl mux setup failed: %d\n",
    				ret);
    
    	/* Handle board specific muxing for LCD here */
    	ret = davinci_cfg_reg_list(da850_evm_lcdc_pins);
    	if (ret)
    		pr_warning("da850_evm_init: evm specific lcd mux setup "
    				"failed: %d\n",	ret);
    
    	ret = da850_lcd_hw_init();
    	if (ret)
    		pr_warning("da850_evm_init: lcd initialization failed: %d\n",
    				ret);
    
    	sharp_lk043t1dg01_pdata.panel_power_ctrl = da850_panel_power_ctrl,
    	ret = da8xx_register_lcdc(&sharp_lk043t1dg01_pdata);
    	if (ret)
    		pr_warning("da850_evm_init: lcdc registration failed: %d\n",
    				ret);
    
    	ret = da8xx_register_rtc();
    	if (ret)
    		pr_warning("da850_evm_init: rtc setup failed: %d\n", ret);
    
    	ret = da850_evm_init_cpufreq();
    	if (ret)
    		pr_warning("da850_evm_init: cpufreq registration failed: %d\n",
    				ret);
    
    	ret = da8xx_register_cpuidle();
    	if (ret)
    		pr_warning("da850_evm_init: cpuidle registration failed: %d\n",
    				ret);
    
    	ret = da850_register_pm(&da850_pm_device);
    	if (ret)
    		pr_warning("da850_evm_init: suspend registration failed: %d\n",
    				ret);
    
    	if (system_rev & 0x100) {
    		((struct flash_platform_data *)da850evm_spi_info[0] \
    		.platform_data)->type = "w25x64";
    	} else {
    		((struct flash_platform_data *)da850evm_spi_info[0] \
    		.platform_data)->type = "m25p64";
    	}
    
    	da850evm_init_spi1(da850evm_spi_info, ARRAY_SIZE(da850evm_spi_info));
    
    	if (HAS_VPIF_DISPLAY || HAS_VPIF_CAPTURE) {
    		ret = da850_register_vpif();
    		if (ret)
    			pr_warning("da850_evm_init: VPIF registration failed: "
    					"%d\n",	ret);
    	}
    
    	if (!HAS_RMII && HAS_VPIF_CAPTURE) {
    		ret = davinci_cfg_reg_list(da850_vpif_capture_pins);
    		if (ret)
    			pr_warning("da850_evm_init: vpif capture mux failed: "
    					"%d\n",	ret);              
    		ret = da850_register_vpif_capture(&da850_vpif_capture_config);
    
    		if (ret)
    			pr_warning("da850_evm_init: VPIF registration failed: "
    					"%d\n",	ret);
                 
    	}
    
    	if (!HAS_GLCD && HAS_VPIF_DISPLAY) {
    		ret = davinci_cfg_reg_list(da850_vpif_display_pins);
    		if (ret)
    			pr_warning("da850_evm_init: vpif capture mux failed: "
    					"%d\n",	ret);
    
    		ret = da850_register_vpif_display(&da850_vpif_display_config);
    		if (ret)
    			pr_warning("da850_evm_init: VPIF registration failed: "
    					"%d\n",	ret);
    
    	}
    
    	if (rmii_en) {
    		ret = davinci_cfg_reg_list(da850_ehrpwm0_pins);
    		if (ret)
    			pr_warning("da850_evm_init: ehrpwm0 mux setup failed:"
    			       "%d\n",	ret);
    		else
    			mask = BIT(0) | BIT(1);
    	} else {
    		pr_warning("da850_evm_init: eHRPWM module 0 cannot be used"
    			" since it is being used by MII interface\n");
    		mask = 0;
    	}
    
    	if (!HAS_LCD) {
    		ret = davinci_cfg_reg_list(da850_ehrpwm1_pins);
    		if (ret)
    			pr_warning("da850_evm_init: eHRPWM module1 output A mux"
    			" setup failed %d\n", ret);
    		else
    			mask = mask | BIT(2);
    	} else {
    		pr_warning("da850_evm_init: eHRPWM module1 outputA cannot be"
    			" used since it is being used by LCD\n");
    	}
    
    	if (!HAS_SPI) {
    		ret = davinci_cfg_reg(DA850_EHRPWM1_B);
    		if (ret)
    			pr_warning("da850_evm_init: eHRPWM module1 outputB mux"
    				" setup failed %d\n", ret);
    		else
    			mask =  mask  | BIT(3);
    	} else {
    		pr_warning("da850_evm_init: eHRPWM module1 outputB cannot be"
    			" used since it is being used by spi1\n");
    	}
    
    	da850_register_ehrpwm(mask);
    
    	ret = platform_device_register(&da850evm_backlight);
    	if (ret)
    		pr_warning("da850_evm_init: backlight device registration"
    				" failed: %d\n", ret);
    
    	ret = davinci_cfg_reg(DA850_ECAP2_APWM2);
    	if (ret)
    		pr_warning("da850_evm_init:ecap mux failed: %d\n", ret);
    
    	ret = da850_register_ecap(2);
    	if (ret)
    		pr_warning("da850_evm_init: eCAP registration failed: %d\n",
    			       ret);
    	ret = davinci_cfg_reg_list(da850_wl1271_pins);
    	if (ret)
    		pr_warning("da850_evm_init: wl1271 mux setup failed:"
    		       "%d\n",	ret);
     
    	ret = platform_device_register(&wl1271_device);
    	if (ret)
    		pr_warning("da850_evm_init: wl1271 device registration"
    				" failed: %d\n", ret);
    	/* initilaize usb module */
    	da850_evm_usb_init();
          //-------------------add API platform_add_device 1028 oyz---------------------
          #if 1
                   // platform_add_devices(ov7670_devices,ARRAY_SIZE(ov7670_devices));
          #endif
    }
    
    #ifdef CONFIG_SERIAL_8250_CONSOLE
    static int __init da850_evm_console_init(void)
    {
    	if (!machine_is_davinci_da850_evm())
    		return 0;
    
    	return add_preferred_console("ttyS", 2, "115200");
    }
    console_initcall(da850_evm_console_init);
    #endif
    
    static void __init da850_evm_map_io(void)
    {
    	da850_init();
    }
    
    MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM")
    	.boot_params	= (DA8XX_DDR_BASE + 0x100),
    	.map_io		= da850_evm_map_io,
    	.init_irq	= cp_intc_init,
    	.timer		= &davinci_timer,
    	.init_machine	= da850_evm_init,
    MACHINE_END
    

    1258.log session.txt
    Booting with TI UBL
    Device OPP (300MHz, 1.2V)
    
    U-Boot 2010.12 (Dec 23 2011 - 11:22:43)
    
    I2C:   ready
    DRAM:  128 MiB
    MMC:   davinci: 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    In:    serial
    Out:   serial
    Err:   serial
    ARM Clock : 300000000 Hz
    DDR Clock : 132000000 Hz
    Net:   Ethernet PHY: GENERIC @ 0x00
    DaVinci-EMAC
    Hit any key to stop autoboot:  0 
    U-Boot > tftpboot 0xc0700000 uImage
    Using DaVinci-EMAC device
    TFTP from server 192.168.1.41; our IP address is 192.168.1.144
    Filename 'uImage'.
    Load address: 0xc0700000
    Loading: #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             ##################
    done
    Bytes transferred = 2420020 (24ed34 hex)
    U-Boot > sf probe 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    8192 KiB M25P64 at 0:0 is now current device
    U-Boot > sf erase 0x080000 0x280000
    U-Boot > sf write 0xc0700000 0x080000 0x280000
    U-Boot > 
    Booting with TI UBL
    Device OPP (300MHz, 1.2V)
    
    U-Boot 2010.12 (Dec 23 2011 - 11:22:43)
    
    I2C:   ready
    DRAM:  128 MiB
    MMC:   davinci: 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    In:    serial
    Out:   serial
    Err:   serial
    ARM Clock : 300000000 Hz
    DDR Clock : 132000000 Hz
    Net:   Ethernet PHY: GENERIC @ 0x00
    DaVinci-EMAC
    Hit any key to stop autoboot:  0 
    SF: Detected M25P64 with page size 256, total 8 MiB
    8192 KiB M25P64 at 0:0 is now current device
    ## Booting kernel from Legacy Image at c0700000 ...
       Image Name:   Linux-2.6.37
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    2419956 Bytes = 2.3 MiB
       Load Address: c0008000
       Entry Point:  c0008000
       Verifying Checksum ... OK
       Loading Kernel Image ... OK
    OK
    
    Starting kernel ...
    
    Uncompressing Linux... done, booting the kernel.
    Linux version 2.6.37 (root@ubuntu) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #0 PREEMPT Wed Oct 22 07:00:42 PDT 2014
    CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
    CPU: VIVT data cache, VIVT instruction cache
    Machine: DaVinci DA850/OMAP-L138/AM18x EVM
    Memory policy: ECC disabled, Data cache writeback
    DaVinci da850/omap-l138/am18x variant 0x1
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 24320
    Kernel command line: console=ttyS2,115200n8 noinitrd root=/dev/nfs/ nfsroot=192.168.1.41:/home/ouyang/L138filesys,nolock ip=192.168.1.144:192.168.1.41:255.255.255.0 ::eth0:off rw  mem=32M@0Xc0000000 mem=64M@0xc4000000 rootdelay=5
    PID hash table entries: 512 (order: -1, 2048 bytes)
    Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    Memory: 32MB 64MB = 96MB total
    Memory: 92256k/92256k available, 6048k reserved, 0K highmem
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
        DMA     : 0xff000000 - 0xffe00000   (  14 MB)
        vmalloc : 0xc8800000 - 0xfea00000   ( 866 MB)
        lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
        modules : 0xbf000000 - 0xc0000000   (  16 MB)
          .init : 0xc0008000 - 0xc0032000   ( 168 kB)
          .text : 0xc0032000 - 0xc04b0000   (4600 kB)
          .data : 0xc04b0000 - 0xc04e2d20   ( 204 kB)
    SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    Preemptable hierarchical RCU implementation.
            RCU-based detection of stalled CPUs is disabled.
            Verbose stalled-CPUs detection is disabled.
    NR_IRQS:245
    Console: colour dummy device 80x30
    Calibrating delay loop... 149.50 BogoMIPS (lpj=747520)
    pid_max: default: 32768 minimum: 301
    Security Framework initialized
    Mount-cache hash table entries: 512
    CPU: Testing write buffer coherency: ok
    DaVinci: 144 gpio irqs
    regulator: core version 0.5
    regulator: dummy: 
    NET: Registered protocol family 16
    WARNING: both McASP and McBSP are enabled, but they share pins.
            Only McASP will work. If you want McBSP support, disable McASP.
    WARNING: both McASP and UART1_AFE are enabled, but they share pins.
            Disable one of them.
    da850_evm_init: eHRPWM module 0 cannot be used since it is being used by MII interface
    da850_evm_init: eHRPWM module1 outputA cannot be used since it is being used by LCD
    da850_evm_init: eHRPWM module1 outputB cannot be used since it is being used by spi1
    bio: create slab <bio-0> at 0
    SCSI subsystem initialized
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    pca953x 1-0020: failed reading register
    regulator: VDCDC1: 3200 <--> 3300 mV at 3300 mV 
    regulator: VDCDC2: 1750 <--> 3300 mV at 3300 mV 
    regulator: VDCDC3: 950 <--> 1350 mV at 1200 mV 
    regulator: LDO1: 1800 mV 
    regulator: LDO2: 1150 <--> 1300 mV at 1200 mV 
    pca9543a_probe
    i2c-gpio i2c-gpio.1: using pins 20 (SDA) and 21 (SCL)
    vpif vpif: vpif probe success
    Advanced Linux Sound Architecture Driver Version 1.0.23.
    Bluetooth: Core ver 2.15
    NET: Registered protocol family 31
    Bluetooth: HCI device and connection manager initialized
    Bluetooth: HCI socket layer initialized
    Switching to clocksource timer0_1
    musb-hdrc: version 6.0, host, debug=0
    musb-hdrc musb-hdrc: dma type: dma-cppi41
    Waiting for USB PHY clock good...
    musb-hdrc musb-hdrc: MUSB HDRC host driver
    musb-hdrc musb-hdrc: new USB bus registered, assigned bus number 1
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 1 port detected
    musb-hdrc musb-hdrc: USB Host mode controller at fee00000 using DMA, IRQ 58
    NET: Registered protocol family 2
    IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
    TCP established hash table entries: 4096 (order: 3, 32768 bytes)
    TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    TCP: Hash tables configured (established 4096 bind 4096)
    TCP reno registered
    UDP hash table entries: 256 (order: 0, 4096 bytes)
    UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    NET: Registered protocol family 1
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    EMAC: MII PHY configured, RMII PHY will not be functional
    McBSP:Probed McBSP1
    JFFS2 version 2.2. (NAND) ? 2001-2006 Red Hat, Inc.
    msgmni has been set to 180
    io scheduler noop registered (default)
    da8xx_lcdc da8xx_lcdc.0: GLCD: Found Sharp_LK043T1DG01 panel
    Console: switching to colour frame buffer device 60x34
    Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
    serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25) is a AR7
    serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a AR7
    serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a AR7
    console [ttyS2] enabled
    brd: module loaded
    at24 1-0050: 32768 byte 24c256 EEPROM (writable)
    Read MAC addr from EEPROM: ff:ff:ff:ff:ff:ff
    ahci ahci: forcing PORTS_IMPL to 0x1
    ahci ahci: AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl platform mode
    ahci ahci: flags: ncq sntf pm led clo only pmp pio slum part ccc 
    scsi0 : ahci_platform
    ata1: SATA max UDMA/133 mmio [mem 0x01e18000-0x01e19fff] port 0x100 irq 67
    spi_davinci spi_davinci.1: DMA: supported
    spi_davinci spi_davinci.1: DMA: RX channel: 18, TX channel: 19, event queue: 0
    m25p80 spi1.0: found m25p64, expected w25x64
    m25p80 spi1.0: m25p64 (8192 Kbytes)
    Creating 6 MTD partitions on "m25p80":
    0x000000000000-0x000000010000 : "UBL"
    0x000000010000-0x000000090000 : "U-Boot"
    0x000000090000-0x0000000a0000 : "U-Boot-Env"
    0x0000000a0000-0x000000320000 : "Kernel"
    0x000000320000-0x000000720000 : "Filesystem"
    0x0000007f0000-0x000000800000 : "MAC-Address"
    spi_davinci spi_davinci.1: Controller at 0xfef0e000
    davinci_mdio davinci_mdio.0: davinci mdio revision 1.5
    davinci_mdio davinci_mdio.0: detected phy mask fffffffe
    davinci_mdio.0: probed
    davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver SMSC LAN8710/LAN8720
    console [netcon0] enabled
    netconsole: network logging started
    ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
    ohci ohci.0: DA8xx OHCI
    ohci ohci.0: new USB bus registered, assigned bus number 2
    Waiting for USB PHY clock good...
    ohci ohci.0: irq 59, io mem 0x01e25000
    hub 2-0:1.0: USB hub found
    hub 2-0:1.0: 1 port detected
    Initializing USB Mass Storage driver...
    usbcore: registered new interface driver usb-storage
    USB Mass Storage support registered.
    input: TPS6507x Touchscreen as /devices/platform/i2c-gpio.1/i2c-1/1-0048/input/input0
    omap_rtc omap_rtc: rtc core: registered omap_rtc as rtc0
    omap_rtc: RTC power up reset detected
    i2c /dev entries driver
    ata1: SATA link down (SStatus 0 SControl 300)
    lirc_dev: IR Remote Control driver registered, major 252 
    IR NEC protocol handler initialized
    IR RC5(x) protocol handler initialized
    IR RC6 protocol handler initialized
    IR JVC protocol handler initialized
    IR Sony protocol handler initialized
    IR RC5 (streamzap) protocol handler initialized
    IR LIRC bridge handler initialized
    Linux video capture interface: v2.00
    Unable to handle kernel NULL pointer dereference at virtual address 00000001
    pgd = c0004000
    [00000001] *pgd=00000000
    Internal error: Oops: 1 [#1] PREEMPT
    last sysfs file: 
    Modules linked in:
    CPU: 0    Not tainted  (2.6.37 #0)
    PC is at ov7670_s_config+0x28/0x198
    LR is at v4l2_i2c_new_subdev_board+0x180/0x1e4
    pc : [<c027937c>]    lr : [<c0276550>]    psr: 20000013
    sp : c7827e10  ip : c7827e40  fp : c7827e3c
    r10: c04b98e8  r9 : 00000000  r8 : 00000000
    r7 : c04fd710  r6 : c79e9400  r5 : c78ff000  r4 : c78ff000
    r3 : 00000018  r2 : 00000001  r1 : 00000000  r0 : c78ff000
    Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
    Control: 0005317f  Table: c0004000  DAC: 00000017
    Process swapper (pid: 1, stack limit = 0xc7826270)
    Stack: (0xc7827e10 to 0xc7828000)
    7e00:                                     c02715f8 c01a0dd4 c7888000 00000000
    7e20: c78ff000 c79e9400 c04b98ec c04fd710 c7827e5c c7827e40 c0276550 c0279364
    7e40: c79e5c80 00000000 c04fd710 c79b6800 c7827ea4 c7827e60 c00206dc c02763e0
    7e60: 00000000 00000001 c04b4f00 c04b95bc c7888000 00000001 c7827e94 c04b4f08
    7e80: c04b4f08 c04e297c c79b53c0 c04ca348 00000000 00000000 c7827eb4 c7827ea8
    7ea0: c01e69f8 c00201e8 c7827ed4 c7827eb8 c01e5954 c01e69e8 c04b4f08 c04b4f3c
    7ec0: c04e297c c79b53c0 c7827ef4 c7827ed8 c01e5a84 c01e5888 00000000 c01e5a1c
    7ee0: c04e297c c79b53c0 c7827f1c c7827ef8 c01e508c c01e5a2c c7837038 c7856930
    7f00: c019c758 c0029098 c00083ac c04e297c c7827f2c c7827f20 c01e576c c01e504c
    7f20: c7827f5c c7827f30 c01e495c c01e575c c0448215 c7827f40 c0029098 c00083ac
    7f40: c04e297c 00000013 c00201bc 00000000 c7827f84 c7827f60 c01e5dc4 c01e48b8
    7f60: c0029098 c00083ac c004b1c0 00000013 c00201bc 00000000 c7827f94 c7827f88
    7f80: c01e6e9c c01e5d24 c7827fa4 c7827f98 c00201d0 c01e6e60 c7827fdc c7827fa8
    7fa0: c0032420 c00201cc 000000f5 c00083ac c004b1c0 00000013 c0029098 c00083ac
    7fc0: c004b1c0 00000013 00000000 00000000 c7827ff4 c7827fe0 c0008448 c0032360
    7fe0: 00000000 c00083ac 00000000 c7827ff8 c004b1c0 c00083bc 00000000 00000000
    Backtrace: 
    [<c0279354>] (ov7670_s_config+0x0/0x198) from [<c0276550>] (v4l2_i2c_new_subdev_board+0x180/0x1e4)
     r7:c04fd710 r6:c04b98ec r5:c79e9400 r4:c78ff000
    [<c02763d0>] (v4l2_i2c_new_subdev_board+0x0/0x1e4) from [<c00206dc>] (vpif_probe+0x504/0x6b8)
     r7:c79b6800 r6:c04fd710 r5:00000000 r4:c79e5c80
    [<c00201d8>] (vpif_probe+0x0/0x6b8) from [<c01e69f8>] (platform_drv_probe+0x20/0x24)
    [<c01e69d8>] (platform_drv_probe+0x0/0x24) from [<c01e5954>] (driver_probe_device+0xdc/0x1a4)
    [<c01e5878>] (driver_probe_device+0x0/0x1a4) from [<c01e5a84>] (__driver_attach+0x68/0x8c)
     r7:c79b53c0 r6:c04e297c r5:c04b4f3c r4:c04b4f08
    [<c01e5a1c>] (__driver_attach+0x0/0x8c) from [<c01e508c>] (bus_for_each_dev+0x50/0x84)
     r7:c79b53c0 r6:c04e297c r5:c01e5a1c r4:00000000
    [<c01e503c>] (bus_for_each_dev+0x0/0x84) from [<c01e576c>] (driver_attach+0x20/0x28)
     r6:c04e297c r5:c00083ac r4:c0029098
    [<c01e574c>] (driver_attach+0x0/0x28) from [<c01e495c>] (bus_add_driver+0xb4/0x238)
    [<c01e48a8>] (bus_add_driver+0x0/0x238) from [<c01e5dc4>] (driver_register+0xb0/0x13c)
    [<c01e5d14>] (driver_register+0x0/0x13c) from [<c01e6e9c>] (platform_driver_register+0x4c/0x60)
     r9:00000000 r8:c00201bc r7:00000013 r6:c004b1c0 r5:c00083ac
    r4:c0029098
    [<c01e6e50>] (platform_driver_register+0x0/0x60) from [<c00201d0>] (vpif_init+0x14/0x1c)
    [<c00201bc>] (vpif_init+0x0/0x1c) from [<c0032420>] (do_one_initcall+0xd0/0x1ac)
    [<c0032350>] (do_one_initcall+0x0/0x1ac) from [<c0008448>] (kernel_init+0x9c/0x154)
    [<c00083ac>] (kernel_init+0x0/0x154) from [<c004b1c0>] (do_exit+0x0/0x6e0)
     r5:c00083ac r4:00000000
    Code: e1a05000 e58031f4 e5906040 0a000008 (e5923000) 
    ---[ end trace 71ac73cd273f6a6a ]---
    Kernel panic - not syncing: Attempted to kill init!
    Backtrace: 
    [<c0036730>] (dump_backtrace+0x0/0x114) from [<c03949ec>] (dump_stack+0x18/0x1c)
     r7:c7824000 r6:c7824000 r5:00000001 r4:c04e32f0
    [<c03949d4>] (dump_stack+0x0/0x1c) from [<c0394a68>] (panic+0x78/0x19c)
    [<c03949f0>] (panic+0x0/0x19c) from [<c004b234>] (do_exit+0x74/0x6e0)
     r3:c04bbfa4 r2:00000000 r1:c7824110 r0:c044a208
    [<c004b1c0>] (do_exit+0x0/0x6e0) from [<c0036b20>] (die+0x2dc/0x31c)
    [<c0036844>] (die+0x0/0x31c) from [<c0038368>] (__do_kernel_fault+0x6c/0x8c)
    [<c00382fc>] (__do_kernel_fault+0x0/0x8c) from [<c00385d4>] (do_bad_area+0x64/0x70)
     r9:c027937c r8:00000004 r7:00000000 r6:00000000 r5:00000000
    r4:e5923000
    [<c0038570>] (do_bad_area+0x0/0x70) from [<c003a5fc>] (do_alignment+0x5b0/0x71c)
    [<c003a04c>] (do_alignment+0x0/0x71c) from [<c00322ec>] (do_DataAbort+0x3c/0x9c)
    [<c00322b0>] (do_DataAbort+0x0/0x9c) from [<c0032b2c>] (__dabt_svc+0x4c/0x60)
    Exception stack(0xc7827dc8 to 0xc7827e10)
    7dc0:                   c78ff000 00000000 00000001 00000018 c78ff000 c78ff000
    7de0: c79e9400 c04fd710 00000000 00000000 c04b98e8 c7827e3c c7827e40 c7827e10
    7e00: c0276550 c027937c 20000013 ffffffff
     r8:00000000 r7:c04fd710 r6:c79e9400 r5:c7827dfc r4:ffffffff
    [<c0279354>] (ov7670_s_config+0x0/0x198) from [<c0276550>] (v4l2_i2c_new_subdev_board+0x180/0x1e4)
     r7:c04fd710 r6:c04b98ec r5:c79e9400 r4:c78ff000
    [<c02763d0>] (v4l2_i2c_new_subdev_board+0x0/0x1e4) from [<c00206dc>] (vpif_probe+0x504/0x6b8)
     r7:c79b6800 r6:c04fd710 r5:00000000 r4:c79e5c80
    [<c00201d8>] (vpif_probe+0x0/0x6b8) from [<c01e69f8>] (platform_drv_probe+0x20/0x24)
    [<c01e69d8>] (platform_drv_probe+0x0/0x24) from [<c01e5954>] (driver_probe_device+0xdc/0x1a4)
    [<c01e5878>] (driver_probe_device+0x0/0x1a4) from [<c01e5a84>] (__driver_attach+0x68/0x8c)
     r7:c79b53c0 r6:c04e297c r5:c04b4f3c r4:c04b4f08
    [<c01e5a1c>] (__driver_attach+0x0/0x8c) from [<c01e508c>] (bus_for_each_dev+0x50/0x84)
     r7:c79b53c0 r6:c04e297c r5:c01e5a1c r4:00000000
    [<c01e503c>] (bus_for_each_dev+0x0/0x84) from [<c01e576c>] (driver_attach+0x20/0x28)
     r6:c04e297c r5:c00083ac r4:c0029098
    [<c01e574c>] (driver_attach+0x0/0x28) from [<c01e495c>] (bus_add_driver+0xb4/0x238)
    [<c01e48a8>] (bus_add_driver+0x0/0x238) from [<c01e5dc4>] (driver_register+0xb0/0x13c)
    [<c01e5d14>] (driver_register+0x0/0x13c) from [<c01e6e9c>] (platform_driver_register+0x4c/0x60)
     r9:00000000 r8:c00201bc r7:00000013 r6:c004b1c0 r5:c00083ac
    r4:c0029098
    [<c01e6e50>] (platform_driver_register+0x0/0x60) from [<c00201d0>] (vpif_init+0x14/0x1c)
    [<c00201bc>] (vpif_init+0x0/0x1c) from [<c0032420>] (do_one_initcall+0xd0/0x1ac)
    [<c0032350>] (do_one_initcall+0x0/0x1ac) from [<c0008448>] (kernel_init+0x9c/0x154)
    [<c00083ac>] (kernel_init+0x0/0x154) from [<c004b1c0>] (do_exit+0x0/0x6e0)
     r5:c00083ac r4:00000000
    

       Thanks very much.
    Ouyang,

  • Hi,

    Compile the kernel without VPIF, and try to see you can do i2c communication on ov7670 sensor via i2c tools

    Thanks,

    --Prabhakar Lad

  • Hi,

    I assume you are using the same driver for ov7670 from the release ?
     Please undo all your changes to  board file and vpif driver and try the below diff,

    index 80710f1..ce700d9 100644
    --- a/arch/arm/mach-davinci/board-da850-evm.c
    +++ b/arch/arm/mach-davinci/board-da850-evm.c
    @@ -49,6 +49,8 @@
     #include <mach/vpif.h>
     #include <media/davinci/videohd.h>
     
    +#include "../../../drivers/media/video/ov7670.h"
    +
     #include <media/tvp514x.h>
     
     #define DA850_EVM_PHY_ID               "0:00"
    @@ -1422,7 +1424,7 @@ static const struct vpif_input da850_ch2_inputs[] = {
                            .type = V4L2_INPUT_TYPE_CAMERA,
                            .std = V4L2_STD_BAYER_ALL
                    },
    -               .subdev_name = "mt9t031",
    +               .subdev_name = "ov7670",
            },
     };
     
    @@ -1558,15 +1560,22 @@ static struct tvp514x_platform_data tvp5146_pdata = {
     };
     #endif
     
    +static struct ov7670_config ov7670_info = {
    +       .min_width = 320, // Filter out smaller sizes
    +       .min_height = 240, // Filter out smaller sizes
    +       .clock_speed = 24, // External clock speed (MHz)
    +       .use_smbus = true, // Use smbus I/O instead of I2C
    + };
    +
     #define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
     
     static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = {
     #if defined(CONFIG_DA850_UI_CAMERA)
            {
    -               .name   = "mt9t031",
    +               .name   = "ov7670",
                    .board_info = {
    -                       I2C_BOARD_INFO("mt9t031", 0x5d),
    -                       .platform_data = (void *)1,
    +                       I2C_BOARD_INFO("ov7670", 0x42),
    +                       .platform_data = &ov7670_info,
                    },
                    .vpif_if = {
                            .if_type = VPIF_IF_RAW_BAYER,

    Thanks,

    --Prabhakar Lad

  • Hi Prabhakar Lad,
          Thanks for you reply,I don't compile the VPIF in kernel, after boot the kernel ,i use the i2c-tools to set the ov7670  register it can not get/set ov7670 register value sucessfuly, follows is the log text , can you help me to find what mistake i made.

       

    8372.log-i2ctools.txt
    U-Boot 2010.12 (Dec 23 2011 - 11:22:43)
    
    I2C:   ready
    DRAM:  128 MiB
    MMC:   davinci: 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    In:    serial
    Out:   serial
    Err:   serial
    ARM Clock : 300000000 Hz
    DDR Clock : 132000000 Hz
    Net:   Ethernet PHY: GENERIC @ 0x00
    DaVinci-EMAC
    Hit any key to stop autoboot:  0 
    SF: Detected M25P64 with page size 256, total 8 MiB
    8192 KiB M25P64 at 0:0 is now current device
    ## Booting kernel from Legacy Image at c0700000 ...
       Image Name:   Linux-2.6.37
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    2369684 Bytes = 2.3 MiB
       Load Address: c0008000
       Entry Point:  c0008000
       Verifying Checksum ... OK
       Loading Kernel Image ... OK
    OK
    
    Starting kernel ...
    
    Uncompressing Linux... done, booting the kernel.
    Linux version 2.6.37 (root@ubuntu) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #84 PREEMPT Wed Oct 29 02:24:09 PDT 2014
    CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
    CPU: VIVT data cache, VIVT instruction cache
    Machine: DaVinci DA850/OMAP-L138/AM18x EVM
    Memory policy: ECC disabled, Data cache writeback
    DaVinci da850/omap-l138/am18x variant 0x1
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 24320
    Kernel command line: console=ttyS2,115200n8 noinitrd root=/dev/nfs/ nfsroot=192.168.1.41:/home/ouyang/L138filesys,nolock ip=192.168.1.144:192.168.1.41:255.255.255.0 ::eth0:off rw  mem=32M@0Xc0000000 mem=64M@0xc4000000 rootdelay=5
    PID hash table entries: 512 (order: -1, 2048 bytes)
    Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    Memory: 32MB 64MB = 96MB total
    Memory: 92356k/92356k available, 5948k reserved, 0K highmem
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
        DMA     : 0xff000000 - 0xffe00000   (  14 MB)
        vmalloc : 0xc8800000 - 0xfea00000   ( 866 MB)
        lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
        modules : 0xbf000000 - 0xc0000000   (  16 MB)
          .init : 0xc0008000 - 0xc0032000   ( 168 kB)
          .text : 0xc0032000 - 0xc0497000   (4500 kB)
          .data : 0xc0498000 - 0xc04ca320   ( 201 kB)
    SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    Preemptable hierarchical RCU implementation.
            RCU-based detection of stalled CPUs is disabled.
            Verbose stalled-CPUs detection is disabled.
    NR_IRQS:245
    Console: colour dummy device 80x30
    Calibrating delay loop... 149.50 BogoMIPS (lpj=747520)
    pid_max: default: 32768 minimum: 301
    Security Framework initialized
    Mount-cache hash table entries: 512
    CPU: Testing write buffer coherency: ok
    DaVinci: 144 gpio irqs
    regulator: core version 0.5
    regulator: dummy: 
    NET: Registered protocol family 16
    WARNING: both McASP and McBSP are enabled, but they share pins.
            Only McASP will work. If you want McBSP support, disable McASP.
    WARNING: both McASP and UART1_AFE are enabled, but they share pins.
            Disable one of them.
    da850_evm_init: eHRPWM module 0 cannot be used since it is being used by MII interface
    da850_evm_init: eHRPWM module1 outputA cannot be used since it is being used by LCD
    da850_evm_init: eHRPWM module1 outputB cannot be used since it is being used by spi1
    bio: create slab <bio-0> at 0
    SCSI subsystem initialized
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    pca953x 1-0020: failed reading register
    regulator: VDCDC1: 3200 <--> 3300 mV at 3300 mV 
    regulator: VDCDC2: 1750 <--> 3300 mV at 3300 mV 
    regulator: VDCDC3: 950 <--> 1350 mV at 1200 mV 
    regulator: LDO1: 1800 mV 
    regulator: LDO2: 1150 <--> 1300 mV at 1200 mV 
    pca9543a_probe
    i2c-gpio i2c-gpio.1: using pins 20 (SDA) and 21 (SCL)
    Advanced Linux Sound Architecture Driver Version 1.0.23.
    Bluetooth: Core ver 2.15
    NET: Registered protocol family 31
    Bluetooth: HCI device and connection manager initialized
    Bluetooth: HCI socket layer initialized
    Switching to clocksource timer0_1
    musb-hdrc: version 6.0, host, debug=0
    musb-hdrc musb-hdrc: dma type: dma-cppi41
    Waiting for USB PHY clock good...
    musb-hdrc musb-hdrc: MUSB HDRC host driver
    musb-hdrc musb-hdrc: new USB bus registered, assigned bus number 1
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 1 port detected
    musb-hdrc musb-hdrc: USB Host mode controller at fee00000 using DMA, IRQ 58
    NET: Registered protocol family 2
    IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
    TCP established hash table entries: 4096 (order: 3, 32768 bytes)
    TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    TCP: Hash tables configured (established 4096 bind 4096)
    TCP reno registered
    UDP hash table entries: 256 (order: 0, 4096 bytes)
    UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    NET: Registered protocol family 1
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    EMAC: MII PHY configured, RMII PHY will not be functional
    McBSP:Probed McBSP1
    JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
    msgmni has been set to 180
    io scheduler noop registered (default)
    da8xx_lcdc da8xx_lcdc.0: GLCD: Found Sharp_LK043T1DG01 panel
    Console: switching to colour frame buffer device 60x34
    Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
    serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25) is a AR7
    serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a AR7
    serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a AR7
    console [ttyS2] enabled
    brd: module loaded
    at24 1-0050: 32768 byte 24c256 EEPROM (writable)
    Read MAC addr from EEPROM: ff:ff:ff:ff:ff:ff
    ahci ahci: forcing PORTS_IMPL to 0x1
    ahci ahci: AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl platform mode
    ahci ahci: flags: ncq sntf pm led clo only pmp pio slum part ccc 
    scsi0 : ahci_platform
    ata1: SATA max UDMA/133 mmio [mem 0x01e18000-0x01e19fff] port 0x100 irq 67
    spi_davinci spi_davinci.1: DMA: supported
    spi_davinci spi_davinci.1: DMA: RX channel: 18, TX channel: 19, event queue: 0
    m25p80 spi1.0: found m25p64, expected w25x64
    m25p80 spi1.0: m25p64 (8192 Kbytes)
    Creating 6 MTD partitions on "m25p80":
    0x000000000000-0x000000010000 : "UBL"
    0x000000010000-0x000000090000 : "U-Boot"
    0x000000090000-0x0000000a0000 : "U-Boot-Env"
    0x0000000a0000-0x000000320000 : "Kernel"
    0x000000320000-0x000000720000 : "Filesystem"
    0x0000007f0000-0x000000800000 : "MAC-Address"
    spi_davinci spi_davinci.1: Controller at 0xfef0e000
    davinci_mdio davinci_mdio.0: davinci mdio revision 1.5
    davinci_mdio davinci_mdio.0: detected phy mask fffffffe
    davinci_mdio.0: probed
    davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver SMSC LAN8710/LAN8720
    console [netcon0] enabled
    netconsole: network logging started
    ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
    ohci ohci.0: DA8xx OHCI
    ohci ohci.0: new USB bus registered, assigned bus number 2
    Waiting for USB PHY clock good...
    ohci ohci.0: irq 59, io mem 0x01e25000
    hub 2-0:1.0: USB hub found
    hub 2-0:1.0: 1 port detected
    Initializing USB Mass Storage driver...
    usbcore: registered new interface driver usb-storage
    USB Mass Storage support registered.
    input: TPS6507x Touchscreen as /devices/platform/i2c-gpio.1/i2c-1/1-0048/input/input0
    omap_rtc omap_rtc: rtc core: registered omap_rtc as rtc0
    omap_rtc: RTC power up reset detected
    i2c /dev entries driver
    ata1: SATA link down (SStatus 0 SControl 300)
    lirc_dev: IR Remote Control driver registered, major 252 
    IR NEC protocol handler initialized
    IR RC5(x) protocol handler initialized
    IR RC6 protocol handler initialized
    IR JVC protocol handler initialized
    IR Sony protocol handler initialized
    IR RC5 (streamzap) protocol handler initialized
    IR LIRC bridge handler initialized
    Linux video capture interface: v2.00
    watchdog watchdog: heartbeat 60 sec
    Bluetooth: HCI UART driver ver 2.2
    Bluetooth: HCI H4 protocol initialized
    Bluetooth: HCILL protocol initialized
    cpuidle: using governor ladder
    cpuidle: using governor menu
    davinci_mmc davinci_mmc.0: Using DMA, 4-bit mode
    davinci_mmc davinci_mmc.1: Using DMA, 4-bit mode
    usbcore: registered new interface driver usbhid
    usbhid: USB HID core driver
    1-0018 supply IOVDD not found, using dummy regulator
    1-0018 supply DVDD not found, using dummy regulator
    1-0018 supply AVDD not found, using dummy regulator
    1-0018 supply DRVDD not found, using dummy regulator
    asoc: tlv320aic3x-hifi <-> davinci-mcasp.0 mapping ok
    ALSA device list:
      #0: DA850/OMAP-L138 EVM
    nf_conntrack version 0.5.0 (1443 buckets, 5772 max)
    ip_tables: (C) 2000-2006 Netfilter Core Team
    TCP cubic registered
    NET: Registered protocol family 17
    Bluetooth: L2CAP ver 2.15
    Bluetooth: L2CAP socket layer initialized
    Bluetooth: SCO (Voice Link) ver 0.6
    Bluetooth: SCO socket layer initialized
    Bluetooth: RFCOMM TTY layer initialized
    Bluetooth: RFCOMM socket layer initialized
    Bluetooth: RFCOMM ver 1.11
    Bluetooth: BNEP (Ethernet Emulation) ver 1.3
    Bluetooth: BNEP filters: protocol multicast
    Bluetooth: HIDP (Human Interface Emulation) ver 1.2
    regulator_init_complete: incomplete constraints, leaving LDO2 on
    regulator_init_complete: incomplete constraints, leaving LDO1 on
    regulator_init_complete: incomplete constraints, leaving VDCDC3 on
    regulator_init_complete: incomplete constraints, leaving VDCDC2 on
    regulator_init_complete: incomplete constraints, leaving VDCDC1 on
    davinci_emac_probe: using random MAC addr: f6:b4:b0:0d:3d:56
    omap_rtc omap_rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
    davinci_mdio davinci_mdio.0: resetting idled controller
    net eth0: attached PHY driver [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=0:00, id=7c0f1)
    IP-Config: Guessing netmask 255.255.255.0
    IP-Config: Gateway not on directly connected network.
    Waiting 5sec before mounting root device...
    PHY: 0:00 - Link is Up - 100/Full
    VFS: Mounted root (nfs filesystem) on device 0:13.
    Freeing init memory: 168K
    INIT: version 2.86 booting
    Please wait: booting...
    Starting udev
    udevd (603): /proc/603/oom_adj is deprecated, please use /proc/603/oom_score_adj instead.
    udev: starting version 141
    Root filesystem already rw, not remounting
    Caching udev devnodes
    Populating dev cachemv: cannot rename '/tmp/devices': No such file or directory
    logger: mount: mount point /proc/bus/usb does not exist
    ALSA: Restoring mixer settings...
    NOT configuring network interfaces: / is an NFS mount
    Fri Dec 23 12:42:00 UTC 2011
    INIT: Entering runlevel: 5
    Starting system message bus: dbus.
    Starting Dropbear SSH server: NET: Registered protocol family 10
    dropbear.
    Starting telnet daemon.
    Starting network benchmark server: netserver.
    Starting syslogd/klogd: done
    Starting thttpd.
    CMEMK module: built on Dec 23 2011 at 12:04:44
      Reference Linux version 2.6.37
      File /datalocal/DVSDK43_HPDL380G7/arago-tmp/work/da850-omapl138-evm-arago-linux-gnueabi/ti-linuxutils-1_2_26_02_05-r57d/linuxutils_2_26_02_05/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c
    CMEM Range Overlaps Kernel Physical - allowing overlap
    CMEM phys_start (0xc2000000) overlaps kernel (0xc0000000 -> 0xc6000000)
    allocated heap buffer 0xc9000000 of size 0x1200000
    heap fallback enabled - will try heap if pool buffer is not available
    cmemk initialized
    DSPLINK Module (1.65.01.05_eng) created on Date: Dec 23 2011 Time: 12:07:46
    
     _____                    _____           _         _   
    |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_ 
    |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
    |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
                  |___|                    |___|            
    
    Arago Project http://arago-project.org arago ttyS2
    
    Arago 2011.06 arago ttyS2
    
    arago login: root
    root@arago:~# cd /usr/share/i2c-tools/
    root@arago:/usr/share/i2c-tools# ls
    i2cdetect  i2cdump    i2cget     i2cset
    root@arago:/usr/share/i2c-tools# i2cdetect -y -r 1
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
    10: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
    20: -- 21 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
    50: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    70: -- -- -- UU -- -- -- --                         
    root@arago:/usr/share/i2c-tools# i2cget -f -y 1 0x18 0x14
    0x78
    root@arago:/usr/share/i2c-tools# i2cset -f -y 1 0x18 0x14 0x11
    root@arago:/usr/share/i2c-tools# i2cget -f -y 1 0x18 0x14
    0x10
    root@arago:/usr/share/i2c-tools# i2cget -f -y 1 0x21 0x14
    0xff
    root@arago:/usr/share/i2c-tools# i2cset -f -y 1 0x21 0x14 0x11 
    root@arago:/usr/share/i2c-tools# i2cget -f -y 1 0x21 0x14
    0xff
    root@arago:/usr/share/i2c-tools# i2cget -f -y 1 0x21 0x1c
    0xff
    root@arago:/usr/share/i2c-tools# i2cget -f -y 1 0x21 0x1d
    0xff

         Also I try the way only modify the board-da850-evm.c file and undo other change i cannot also add the ov7670 driver sucessed, the logs is follows. Thanks you spend time to discuss this problem.

     

    7026.log-only modify board-da850-evm.txt
    U-Boot 2010.12 (Dec 23 2011 - 11:22:43)
    
    I2C:   ready
    DRAM:  128 MiB
    MMC:   davinci: 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    In:    serial
    Out:   serial
    Err:   serial
    ARM Clock : 300000000 Hz
    DDR Clock : 132000000 Hz
    Net:   Ethernet PHY: GENERIC @ 0x00
    DaVinci-EMAC
    Hit any key to stop autoboot:  0 
    SF: Detected M25P64 with page size 256, total 8 MiB
    8192 KiB M25P64 at 0:0 is now current device
    ## Booting kernel from Legacy Image at c0700000 ...
       Image Name:   Linux-2.6.37
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    2420048 Bytes = 2.3 MiB
       Load Address: c0008000
       Entry Point:  c0008000
       Verifying Checksum ... OK
       Loading Kernel Image ... OK
    OK
    
    Starting kernel ...
    
    Uncompressing Linux... done, booting the kernel.
    Linux version 2.6.37 (root@ubuntu) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #1 PREEMPT Wed Oct 29 05:24:31 PDT 2014
    CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
    CPU: VIVT data cache, VIVT instruction cache
    Machine: DaVinci DA850/OMAP-L138/AM18x EVM
    Memory policy: ECC disabled, Data cache writeback
    DaVinci da850/omap-l138/am18x variant 0x1
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 24320
    Kernel command line: console=ttyS2,115200n8 noinitrd root=/dev/nfs/ nfsroot=192.168.1.41:/home/ouyang/L138filesys,nolock ip=192.168.1.144:192.168.1.41:255.255.255.0 ::eth0:off rw  mem=32M@0Xc0000000 mem=64M@0xc4000000 rootdelay=5
    PID hash table entries: 512 (order: -1, 2048 bytes)
    Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    Memory: 32MB 64MB = 96MB total
    Memory: 92256k/92256k available, 6048k reserved, 0K highmem
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
        DMA     : 0xff000000 - 0xffe00000   (  14 MB)
        vmalloc : 0xc8800000 - 0xfea00000   ( 866 MB)
        lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
        modules : 0xbf000000 - 0xc0000000   (  16 MB)
          .init : 0xc0008000 - 0xc0032000   ( 168 kB)
          .text : 0xc0032000 - 0xc04b0000   (4600 kB)
          .data : 0xc04b0000 - 0xc04e2fc0   ( 204 kB)
    SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    Preemptable hierarchical RCU implementation.
            RCU-based detection of stalled CPUs is disabled.
            Verbose stalled-CPUs detection is disabled.
    NR_IRQS:245
    Console: colour dummy device 80x30
    Calibrating delay loop... 149.50 BogoMIPS (lpj=747520)
    pid_max: default: 32768 minimum: 301
    Security Framework initialized
    Mount-cache hash table entries: 512
    CPU: Testing write buffer coherency: ok
    DaVinci: 144 gpio irqs
    regulator: core version 0.5
    regulator: dummy: 
    NET: Registered protocol family 16
    WARNING: both McASP and McBSP are enabled, but they share pins.
            Only McASP will work. If you want McBSP support, disable McASP.
    WARNING: both McASP and UART1_AFE are enabled, but they share pins.
            Disable one of them.
    da850_evm_init: eHRPWM module 0 cannot be used since it is being used by MII interface
    da850_evm_init: eHRPWM module1 outputA cannot be used since it is being used by LCD
    da850_evm_init: eHRPWM module1 outputB cannot be used since it is being used by spi1
    bio: create slab <bio-0> at 0
    SCSI subsystem initialized
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    pca953x 1-0020: failed reading register
    pca953x 1-0021: interrupt support not compiled in
    regulator: VDCDC1: 3200 <--> 3300 mV at 3300 mV 
    regulator: VDCDC2: 1750 <--> 3300 mV at 3300 mV 
    regulator: VDCDC3: 950 <--> 1350 mV at 1200 mV 
    regulator: LDO1: 1800 mV 
    regulator: LDO2: 1150 <--> 1300 mV at 1200 mV 
    pca9543a_probe
    i2c-gpio i2c-gpio.1: using pins 20 (SDA) and 21 (SCL)
    vpif vpif: vpif probe success
    Advanced Linux Sound Architecture Driver Version 1.0.23.
    Bluetooth: Core ver 2.15
    NET: Registered protocol family 31
    Bluetooth: HCI device and connection manager initialized
    Bluetooth: HCI socket layer initialized
    Switching to clocksource timer0_1
    musb-hdrc: version 6.0, host, debug=0
    musb-hdrc musb-hdrc: dma type: dma-cppi41
    Waiting for USB PHY clock good...
    musb-hdrc musb-hdrc: MUSB HDRC host driver
    musb-hdrc musb-hdrc: new USB bus registered, assigned bus number 1
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 1 port detected
    musb-hdrc musb-hdrc: USB Host mode controller at fee00000 using DMA, IRQ 58
    NET: Registered protocol family 2
    IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
    TCP established hash table entries: 4096 (order: 3, 32768 bytes)
    TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    TCP: Hash tables configured (established 4096 bind 4096)
    TCP reno registered
    UDP hash table entries: 256 (order: 0, 4096 bytes)
    UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    NET: Registered protocol family 1
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    EMAC: MII PHY configured, RMII PHY will not be functional
    McBSP:Probed McBSP1
    JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
    msgmni has been set to 180
    io scheduler noop registered (default)
    da8xx_lcdc da8xx_lcdc.0: GLCD: Found Sharp_LK043T1DG01 panel
    Console: switching to colour frame buffer device 60x34
    Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
    serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25) is a AR7
    serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a AR7
    serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a AR7
    console [ttyS2] enabled
    brd: module loaded
    at24 1-0050: 32768 byte 24c256 EEPROM (writable)
    Read MAC addr from EEPROM: ff:ff:ff:ff:ff:ff
    ahci ahci: forcing PORTS_IMPL to 0x1
    ahci ahci: AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl platform mode
    ahci ahci: flags: ncq sntf pm led clo only pmp pio slum part ccc 
    scsi0 : ahci_platform
    ata1: SATA max UDMA/133 mmio [mem 0x01e18000-0x01e19fff] port 0x100 irq 67
    spi_davinci spi_davinci.1: DMA: supported
    spi_davinci spi_davinci.1: DMA: RX channel: 18, TX channel: 19, event queue: 0
    m25p80 spi1.0: found m25p64, expected w25x64
    m25p80 spi1.0: m25p64 (8192 Kbytes)
    Creating 6 MTD partitions on "m25p80":
    0x000000000000-0x000000010000 : "UBL"
    0x000000010000-0x000000090000 : "U-Boot"
    0x000000090000-0x0000000a0000 : "U-Boot-Env"
    0x0000000a0000-0x000000320000 : "Kernel"
    0x000000320000-0x000000720000 : "Filesystem"
    0x0000007f0000-0x000000800000 : "MAC-Address"
    spi_davinci spi_davinci.1: Controller at 0xfef0e000
    davinci_mdio davinci_mdio.0: davinci mdio revision 1.5
    davinci_mdio davinci_mdio.0: detected phy mask fffffffe
    davinci_mdio.0: probed
    davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver SMSC LAN8710/LAN8720
    console [netcon0] enabled
    netconsole: network logging started
    ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
    ohci ohci.0: DA8xx OHCI
    ohci ohci.0: new USB bus registered, assigned bus number 2
    Waiting for USB PHY clock good...
    ohci ohci.0: irq 59, io mem 0x01e25000
    hub 2-0:1.0: USB hub found
    hub 2-0:1.0: 1 port detected
    Initializing USB Mass Storage driver...
    usbcore: registered new interface driver usb-storage
    USB Mass Storage support registered.
    input: gpio-keys-polled as /devices/platform/gpio-keys-polled.1/input/input0
    input: TPS6507x Touchscreen as /devices/platform/i2c-gpio.1/i2c-1/1-0048/input/input1
    ata1: SATA link down (SStatus 0 SControl 300)
    omap_rtc omap_rtc: rtc core: registered omap_rtc as rtc0
    omap_rtc: RTC power up reset detected
    i2c /dev entries driver
    lirc_dev: IR Remote Control driver registered, major 252 
    IR NEC protocol handler initialized
    IR RC5(x) protocol handler initialized
    IR RC6 protocol handler initialized
    IR JVC protocol handler initialized
    IR Sony protocol handler initialized
    IR RC5 (streamzap) protocol handler initialized
    IR LIRC bridge handler initialized
    Linux video capture interface: v2.00
    vpif_capture vpif_capture: Error registering v4l2 subdevice
    Unable to handle kernel NULL pointer dereference at virtual address 00000000
    pgd = c0004000
    [00000000] *pgd=00000000
    Internal error: Oops: 5 [#1] PREEMPT
    last sysfs file: 
    Modules linked in:
    CPU: 0    Not tainted  (2.6.37 #1)
    PC is at __wake_up_common+0x14/0x7c
    LR is at complete_all+0x58/0x8c
    pc : [<c004171c>]    lr : [<c0044660>]    psr: 60000093
    sp : c7827d70  ip : c7827da0  fp : c7827d9c
    r10: 00000000  r9 : 00000003  r8 : c04b9ce8
    r7 : c791ac00  r6 : 00000000  r5 : c04ca954  r4 : 00000000
    r3 : 00000000  r2 : 00000000  r1 : 00000003  r0 : c7a840b4
    Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
    Control: 0005317f  Table: c0004000  DAC: 00000017
    Process swapper (pid: 1, stack limit = 0xc7826270)
    Stack: (0xc7827d70 to 0xc7828000)
    7d60:                                     00000000 60000013 c04ca954 00000000
    7d80: c791ac00 c04b9ce8 00000000 00000000 c7827dbc c7827da0 c0044660 c0041718
    7da0: 00000000 00000000 00000000 c7a84050 c7827dd4 c7827dc0 c01eafe8 c0044618
    7dc0: c7a84050 c7a84050 c7827df4 c7827dd8 c01e315c c01eafdc c7a84050 c7a84400
    7de0: c04fd9b4 c791ac00 c7827e0c c7827df8 c01e32a4 c01e3130 c7a84048 c7a84400
    7e00: c7827e24 c7827e10 c026c1f8 c01e32a0 c7a84000 c7a84400 c7827e3c c7827e28
    7e20: c02715b0 c026c1b4 c7a84000 c7a84400 c7827e5c c7827e40 c02717d0 c0271534
    7e40: c79b9e60 00000000 00000002 c791ac00 c7827ea4 c7827e60 c002074c c02717b4
    7e60: 00000000 00000001 c04b4f00 c04b999c c7851200 00000001 c7827e94 c04b4f08
    7e80: c04b4f08 c04e2c14 c79e8660 c04ca5e0 00000000 00000000 c7827eb4 c7827ea8
    7ea0: c01e6b78 c00201d8 c7827ed4 c7827eb8 c01e5ad4 c01e6b68 c04b4f08 c04b4f3c
    7ec0: c04e2c14 c79e8660 c7827ef4 c7827ed8 c01e5c04 c01e5a08 00000000 c01e5b9c
    7ee0: c04e2c14 c79e8660 c7827f1c c7827ef8 c01e520c c01e5bac c7837038 c7856930
    7f00: c019c8d8 c0029088 c00083ac c04e2c14 c7827f2c c7827f20 c01e58ec c01e51cc
    7f20: c7827f5c c7827f30 c01e4adc c01e58dc c04482f9 c7827f40 c0029088 c00083ac
    7f40: c04e2c14 00000013 c00201ac 00000000 c7827f84 c7827f60 c01e5f44 c01e4a38
    7f60: c0029088 c00083ac c004b338 00000013 c00201ac 00000000 c7827f94 c7827f88
    7f80: c01e701c c01e5ea4 c7827fa4 c7827f98 c00201c0 c01e6fe0 c7827fdc c7827fa8
    7fa0: c0032420 c00201bc 000000f5 c00083ac c004b338 00000013 c0029088 c00083ac
    7fc0: c004b338 00000013 00000000 00000000 c7827ff4 c7827fe0 c0008448 c0032360
    7fe0: 00000000 c00083ac 00000000 c7827ff8 c004b338 c00083bc 00000000 00000000
    Backtrace: 
    [<c0041708>] (__wake_up_common+0x0/0x7c) from [<c0044660>] (complete_all+0x58/0x8c)
    [<c0044608>] (complete_all+0x0/0x8c) from [<c01eafe8>] (device_pm_remove+0x1c/0x60)
     r4:c7a84050
    [<c01eafcc>] (device_pm_remove+0x0/0x60) from [<c01e315c>] (device_del+0x3c/0x170)
     r5:c7a84050 r4:c7a84050
    [<c01e3120>] (device_del+0x0/0x170) from [<c01e32a4>] (device_unregister+0x14/0x20)
     r7:c791ac00 r6:c04fd9b4 r5:c7a84400 r4:c7a84050
    [<c01e3290>] (device_unregister+0x0/0x20) from [<c026c1f8>] (video_unregister_device+0x54/0x5c)
     r5:c7a84400 r4:c7a84048
    [<c026c1a4>] (video_unregister_device+0x0/0x5c) from [<c02715b0>] (v4l2_device_unregister_subdev+0x8c/0x98)
     r5:c7a84400 r4:c7a84000
    [<c0271524>] (v4l2_device_unregister_subdev+0x0/0x98) from [<c02717d0>] (v4l2_device_unregister+0x2c/0x7c)
     r5:c7a84400 r4:c7a84000
    [<c02717a4>] (v4l2_device_unregister+0x0/0x7c) from [<c002074c>] (vpif_probe+0x584/0x6b0)
     r7:c791ac00 r6:00000002 r5:00000000 r4:c79b9e60
    [<c00201c8>] (vpif_probe+0x0/0x6b0) from [<c01e6b78>] (platform_drv_probe+0x20/0x24)
    [<c01e6b58>] (platform_drv_probe+0x0/0x24) from [<c01e5ad4>] (driver_probe_device+0xdc/0x1a4)
    [<c01e59f8>] (driver_probe_device+0x0/0x1a4) from [<c01e5c04>] (__driver_attach+0x68/0x8c)
     r7:c79e8660 r6:c04e2c14 r5:c04b4f3c r4:c04b4f08
    [<c01e5b9c>] (__driver_attach+0x0/0x8c) from [<c01e520c>] (bus_for_each_dev+0x50/0x84)
     r7:c79e8660 r6:c04e2c14 r5:c01e5b9c r4:00000000
    [<c01e51bc>] (bus_for_each_dev+0x0/0x84) from [<c01e58ec>] (driver_attach+0x20/0x28)
     r6:c04e2c14 r5:c00083ac r4:c0029088
    [<c01e58cc>] (driver_attach+0x0/0x28) from [<c01e4adc>] (bus_add_driver+0xb4/0x238)
    [<c01e4a28>] (bus_add_driver+0x0/0x238) from [<c01e5f44>] (driver_register+0xb0/0x13c)
    [<c01e5e94>] (driver_register+0x0/0x13c) from [<c01e701c>] (platform_driver_register+0x4c/0x60)
     r9:00000000 r8:c00201ac r7:00000013 r6:c004b338 r5:c00083ac
    r4:c0029088
    [<c01e6fd0>] (platform_driver_register+0x0/0x60) from [<c00201c0>] (vpif_init+0x14/0x1c)
    [<c00201ac>] (vpif_init+0x0/0x1c) from [<c0032420>] (do_one_initcall+0xd0/0x1ac)
    [<c0032350>] (do_one_initcall+0x0/0x1ac) from [<c0008448>] (kernel_init+0x9c/0x154)
    [<c00083ac>] (kernel_init+0x0/0x154) from [<c004b338>] (do_exit+0x0/0x6e0)
     r5:c00083ac r4:00000000
    Code: e92ddff8 e24cb004 e5904000 e1a09001 (e414100c) 
    ---[ end trace 8117be0681028c85 ]---
    note: swapper[1] exited with preempt_count 1
    Kernel panic - not syncing: Attempted to kill init!
    Backtrace: 
    [<c0036730>] (dump_backtrace+0x0/0x114) from [<c0394af8>] (dump_stack+0x18/0x1c)
     r7:c7824000 r6:c7824000 r5:00000001 r4:c04e3590
    [<c0394ae0>] (dump_stack+0x0/0x1c) from [<c0394b74>] (panic+0x78/0x19c)
    [<c0394afc>] (panic+0x0/0x19c) from [<c004b3ac>] (do_exit+0x74/0x6e0)
     r3:c04bc23c r2:00000001 r1:c7824110 r0:c044a401
    [<c004b338>] (do_exit+0x0/0x6e0) from [<c0036b20>] (die+0x2dc/0x31c)
    [<c0036844>] (die+0x0/0x31c) from [<c0038368>] (__do_kernel_fault+0x6c/0x8c)
    [<c00382fc>] (__do_kernel_fault+0x0/0x8c) from [<c0038558>] (do_page_fault+0x1d0/0x1e8)
     r9:c7827d28 r8:00000005 r7:00000000 r6:00000000 r5:c7824000
    r4:c04b407c
    [<c0038388>] (do_page_fault+0x0/0x1e8) from [<c0038604>] (do_translation_fault+0x24/0xac)
    [<c00385e0>] (do_translation_fault+0x0/0xac) from [<c00322ec>] (do_DataAbort+0x3c/0x9c)
     r7:c7827d28 r6:00000005 r5:c7827d5c r4:c04b407c
    [<c00322b0>] (do_DataAbort+0x0/0x9c) from [<c0032b2c>] (__dabt_svc+0x4c/0x60)
    Exception stack(0xc7827d28 to 0xc7827d70)
    7d20:                   c7a840b4 00000003 00000000 00000000 00000000 c04ca954
    7d40: 00000000 c791ac00 c04b9ce8 00000003 00000000 c7827d9c c7827da0 c7827d70
    7d60: c0044660 c004171c 60000093 ffffffff
     r8:c04b9ce8 r7:c791ac00 r6:00000000 r5:c7827d5c r4:ffffffff
    [<c0041708>] (__wake_up_common+0x0/0x7c) from [<c0044660>] (complete_all+0x58/0x8c)
    [<c0044608>] (complete_all+0x0/0x8c) from [<c01eafe8>] (device_pm_remove+0x1c/0x60)
     r4:c7a84050
    [<c01eafcc>] (device_pm_remove+0x0/0x60) from [<c01e315c>] (device_del+0x3c/0x170)
     r5:c7a84050 r4:c7a84050
    [<c01e3120>] (device_del+0x0/0x170) from [<c01e32a4>] (device_unregister+0x14/0x20)
     r7:c791ac00 r6:c04fd9b4 r5:c7a84400 r4:c7a84050
    [<c01e3290>] (device_unregister+0x0/0x20) from [<c026c1f8>] (video_unregister_device+0x54/0x5c)
     r5:c7a84400 r4:c7a84048
    [<c026c1a4>] (video_unregister_device+0x0/0x5c) from [<c02715b0>] (v4l2_device_unregister_subdev+0x8c/0x98)
     r5:c7a84400 r4:c7a84000
    [<c0271524>] (v4l2_device_unregister_subdev+0x0/0x98) from [<c02717d0>] (v4l2_device_unregister+0x2c/0x7c)
     r5:c7a84400 r4:c7a84000
    [<c02717a4>] (v4l2_device_unregister+0x0/0x7c) from [<c002074c>] (vpif_probe+0x584/0x6b0)
     r7:c791ac00 r6:00000002 r5:00000000 r4:c79b9e60
    [<c00201c8>] (vpif_probe+0x0/0x6b0) from [<c01e6b78>] (platform_drv_probe+0x20/0x24)
    [<c01e6b58>] (platform_drv_probe+0x0/0x24) from [<c01e5ad4>] (driver_probe_device+0xdc/0x1a4)
    [<c01e59f8>] (driver_probe_device+0x0/0x1a4) from [<c01e5c04>] (__driver_attach+0x68/0x8c)
     r7:c79e8660 r6:c04e2c14 r5:c04b4f3c r4:c04b4f08
    [<c01e5b9c>] (__driver_attach+0x0/0x8c) from [<c01e520c>] (bus_for_each_dev+0x50/0x84)
     r7:c79e8660 r6:c04e2c14 r5:c01e5b9c r4:00000000
    [<c01e51bc>] (bus_for_each_dev+0x0/0x84) from [<c01e58ec>] (driver_attach+0x20/0x28)
     r6:c04e2c14 r5:c00083ac r4:c0029088
    [<c01e58cc>] (driver_attach+0x0/0x28) from [<c01e4adc>] (bus_add_driver+0xb4/0x238)
    [<c01e4a28>] (bus_add_driver+0x0/0x238) from [<c01e5f44>] (driver_register+0xb0/0x13c)
    [<c01e5e94>] (driver_register+0x0/0x13c) from [<c01e701c>] (platform_driver_register+0x4c/0x60)
     r9:00000000 r8:c00201ac r7:00000013 r6:c004b338 r5:c00083ac
    r4:c0029088
    [<c01e6fd0>] (platform_driver_register+0x0/0x60) from [<c00201c0>] (vpif_init+0x14/0x1c)
    [<c00201ac>] (vpif_init+0x0/0x1c) from [<c0032420>] (do_one_initcall+0xd0/0x1ac)
    [<c0032350>] (do_one_initcall+0x0/0x1ac) from [<c0008448>] (kernel_init+0x9c/0x154)
    [<c00083ac>] (kernel_init+0x0/0x154) from [<c004b338>] (do_exit+0x0/0x6e0)
     r5:c00083ac r4:00000000

          Thank you very much .
    Ouyang, 

  • Hi,

    Please try the attached uImage (rename it to uImage)and post the bootup msg.

    5287.uImage.txt

    Thanks,

    --Prabhakar Lad

  •   Hi Prabhakar Lad,

        Thanks for you reply,I use tftp load uImage and flashed to board ,The  cmd is as follows:

        tftpboot 0xc0700000 uImage

       sf probe 0
      sf erase 0x080000 0x280000
      sf write 0xc0700000 0x080000 0x280000 

      sf probe 0
      sf read 0xc0700000 0x080000 0x280000
    setenv bootargs 'console=ttyS2,115200n8 noinitrd root=/dev/nfs/ nfsroot=192.168.1.41:/home/ouyang/L138filesys,nolock ip=192.168.1.144:192.168.1.41:255.255.255.0 ::eth0:off rw  mem=32M@0Xc0000000 mem=64M@0xc4000000 rootdelay=5'
    saveenv
    bootm 0xc0700000

     The uImage is follows:

    0081.uimagge.rar

      Thanks very much again.

    Ouyang,

  • Hi,

    Did you try the uImage which I shared ? can you post the boot log of it once booted.

    Thanks,

    --Prabhakar Lad

  • Hi Prabhakar Lad,
          Thanks for you reply,I misunderstood what you said , now I used your uImage.txt rename to uImage after I loaded into board. It stopped at function of i2c_check_addr_busy. I attatched the full log message .
          Thanks very much.

     

    7103.log session .txt
    Booting with TI UBL
    Device OPP (300MHz, 1.2V)
    
    U-Boot 2010.12 (Dec 23 2011 - 11:22:43)
    
    I2C:   ready
    DRAM:  128 MiB
    MMC:   davinci: 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    In:    serial
    Out:   serial
    Err:   serial
    ARM Clock : 300000000 Hz
    DDR Clock : 132000000 Hz
    Net:   Ethernet PHY: GENERIC @ 0x00
    DaVinci-EMAC
    Hit any key to stop autoboot:  0 
    U-Boot > tftpboot 0xc0700000 uImage
    Using DaVinci-EMAC device
    TFTP from server 192.168.1.41; our IP address is 192.168.1.144
    Filename 'uImage'.
    Load address: 0xc0700000
    Loading: #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             ##########################
    done
    Bytes transferred = 1796396 (1b692c hex)
    U-Boot > sf probe 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    8192 KiB M25P64 at 0:0 is now current device
    U-Boot > sf erase 0x080000 0x280000
    U-Boot > sf write 0xc0700000 0x080000 0x280000
    U-Boot > 
    Booting with TI UBL
    Device OPP (300MHz, 1.2V)
    
    U-Boot 2010.12 (Dec 23 2011 - 11:22:43)
    
    I2C:   ready
    DRAM:  128 MiB
    MMC:   davinci: 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    In:    serial
    Out:   serial
    Err:   serial
    ARM Clock : 300000000 Hz
    DDR Clock : 132000000 Hz
    Net:   Ethernet PHY: GENERIC @ 0x00
    DaVinci-EMAC
    Hit any key to stop autoboot:  0 
    SF: Detected M25P64 with page size 256, total 8 MiB
    8192 KiB M25P64 at 0:0 is now current device
    ## Booting kernel from Legacy Image at c0700000 ...
       Image Name:   Linux-2.6.37-00001-g3de4d5c-dirt
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    1796332 Bytes = 1.7 MiB
       Load Address: c0008000
       Entry Point:  c0008000
       Verifying Checksum ... OK
       Loading Kernel Image ... OK
    OK
    
    Starting kernel ...
    
    Uncompressing Linux... done, booting the kernel.
    Linux version 2.6.37-00001-g3de4d5c-dirty (prabhakar@tango-charlie) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #4 PREEMPT Wed Oct 29 13:30:45 GMT 2014
    CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
    CPU: VIVT data cache, VIVT instruction cache
    Machine: DaVinci DA850/OMAP-L138/AM18x EVM
    Memory policy: ECC disabled, Data cache writethrough
    DaVinci da850/omap-l138/am18x variant 0x1
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 24320
    Kernel command line: console=ttyS2,115200n8 noinitrd root=/dev/nfs/ nfsroot=192.168.1.41:/home/ouyang/L138filesys,nolock ip=192.168.1.144:192.168.1.41:255.255.255.0 ::eth0:off rw  mem=32M@0Xc0000000 mem=64M@0xc4000000 rootdelay=5
    PID hash table entries: 512 (order: -1, 2048 bytes)
    Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    Memory: 32MB 64MB = 96MB total
    Memory: 93660k/93660k available, 4644k reserved, 0K highmem
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
        DMA     : 0xff000000 - 0xffe00000   (  14 MB)
        vmalloc : 0xc8800000 - 0xfea00000   ( 866 MB)
        lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
        modules : 0xbf000000 - 0xc0000000   (  16 MB)
          .init : 0xc0008000 - 0xc0029000   ( 132 kB)
          .text : 0xc0029000 - 0xc0350c84   (3232 kB)
          .data : 0xc0352000 - 0xc037a100   ( 161 kB)
    SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    Preemptable hierarchical RCU implementation.
            RCU-based detection of stalled CPUs is disabled.
            Verbose stalled-CPUs detection is disabled.
    NR_IRQS:245
    Console: colour dummy device 80x30
    Calibrating delay loop... 149.50 BogoMIPS (lpj=747520)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 512
    CPU: Testing write buffer coherency: ok
    DaVinci: 144 gpio irqs
    regulator: core version 0.5
    regulator: dummy: 
    NET: Registered protocol family 16
    da850_evm_init: eHRPWM module 0 cannot be used since it is being used by MII interface
    da850_evm_init: eHRPWM module1 outputA cannot be used since it is being used by LCD
    bio: create slab <bio-0> at 0
    vpif vpif: vpif probe success
    Switching to clocksource timer0_1
    NET: Registered protocol family 2
    IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
    TCP established hash table entries: 4096 (order: 3, 32768 bytes)
    TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    TCP: Hash tables configured (established 4096 bind 4096)
    TCP reno registered
    UDP hash table entries: 256 (order: 0, 4096 bytes)
    UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    NET: Registered protocol family 1
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    EMAC: MII PHY configured, RMII PHY will not be functional
    msgmni has been set to 182
    io scheduler noop registered (default)
    da8xx_lcdc da8xx_lcdc.0: GLCD: Found Sharp_LK043T1DG01 panel
    Console: switching to colour frame buffer device 60x34
    Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
    serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25) is a AR7
    serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a AR7
    serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a AR7
    console [ttyS2] enabled
    brd: module loaded
    davinci_mdio davinci_mdio.0: davinci mdio revision 1.5
    davinci_mdio davinci_mdio.0: detected phy mask fffffffe
    davinci_mdio.0: probed
    davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver unknown
    console [netcon0] enabled
    netconsole: network logging started
    i2c /dev entries driver
    lirc_dev: IR Remote Control driver registered, major 254 
    IR NEC protocol handler initialized
    IR RC5(x) protocol handler initialized
    IR RC6 protocol handler initialized
    IR JVC protocol handler initialized
    IR Sony protocol handler initialized
    IR RC5 (streamzap) protocol handler initialized
    IR LIRC bridge handler initialized
    Linux video capture interface: v2.00
    Unable to handle kernel NULL pointer dereference at virtual address 00000050
    pgd = c0004000
    [00000050] *pgd=00000000
    Internal error: Oops: 5 [#1] PREEMPT
    last sysfs file: 
    Modules linked in:
    CPU: 0    Not tainted  (2.6.37-00001-g3de4d5c-dirty #4)
    PC is at i2c_check_addr_busy+0x8/0x58
    LR is at i2c_new_device+0x134/0x158
    pc : [<c01abba4>]    lr : [<c01ac21c>]    psr: 80000013
    sp : c7827ec0  ip : 00000033  fp : 00000001
    r10: 00000001  r9 : 00000000  r8 : c7838600
    r7 : c7838604  r6 : 00000000  r5 : c7838600  r4 : 00000000
    r3 : 00290000  r2 : 0000002a  r1 : 0000002a  r0 : 00000000
    Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
    Control: 0005317f  Table: c0004000  DAC: 00000017
    Process swapper (pid: 1, stack limit = 0xc7826270)
    Stack: (0xc7827ec0 to 0xc7828000)
    7ec0: 00000000 0000002a c035a520 c01ac21c 00000000 c035a520 00000000 00000000
    7ee0: c035a520 c039f378 00000002 c01bde68 c79da940 00000000 c035a51c c039f378
    7f00: 00000002 c001bc98 00000000 00000001 c0356bf8 c039f378 c0379efc c0356c00
    7f20: c0356c00 c0379efc c79db0c0 c036b1d0 00000000 00000000 00000000 c019a5e0
    7f40: c0356c00 c0199758 c0356c00 c0356c34 c0379efc c0199874 00000000 c0199814
    7f60: c0379efc c0198f9c c7804db8 c786e150 c0022188 c0008338 c0379efc c01988ec
    7f80: c02f6866 c02f6866 c7827f88 c0022188 c0008338 c0379efc 00000013 c001b7e0
    7fa0: 00000000 c0199b44 c0022188 c0008338 c002a99c 00000013 c001b7e0 c0029430
    7fc0: c0008338 3031bc00 00000030 00000000 00000013 c0022188 c0008338 c002a99c
    7fe0: 00000013 00000000 00000000 c00083cc 00000000 c002a99c 00000000 00000000
    [<c01abba4>] (i2c_check_addr_busy+0x8/0x58) from [<c01ac21c>] (i2c_new_device+0x134/0x158)
    [<c01ac21c>] (i2c_new_device+0x134/0x158) from [<c01bde68>] (v4l2_i2c_new_subdev_board+0x70/0x1c8)
    [<c01bde68>] (v4l2_i2c_new_subdev_board+0x70/0x1c8) from [<c001bc98>] (vpif_probe+0x4ac/0x624)
    [<c001bc98>] (vpif_probe+0x4ac/0x624) from [<c019a5e0>] (platform_drv_probe+0x18/0x1c)
    [<c019a5e0>] (platform_drv_probe+0x18/0x1c) from [<c0199758>] (driver_probe_device+0xb0/0x16c)
    [<c0199758>] (driver_probe_device+0xb0/0x16c) from [<c0199874>] (__driver_attach+0x60/0x84)
    [<c0199874>] (__driver_attach+0x60/0x84) from [<c0198f9c>] (bus_for_each_dev+0x44/0x74)
    [<c0198f9c>] (bus_for_each_dev+0x44/0x74) from [<c01988ec>] (bus_add_driver+0xa8/0x228)
    [<c01988ec>] (bus_add_driver+0xa8/0x228) from [<c0199b44>] (driver_register+0xa8/0x134)
    [<c0199b44>] (driver_register+0xa8/0x134) from [<c0029430>] (do_one_initcall+0xc8/0x1a4)
    [<c0029430>] (do_one_initcall+0xc8/0x1a4) from [<c00083cc>] (kernel_init+0x94/0x14c)
    [<c00083cc>] (kernel_init+0x94/0x14c) from [<c002a99c>] (kernel_thread_exit+0x0/0x8)
    Code: c036c2ac c01ab774 e92d4013 e1a04000 (e5900050) 
    ---[ end trace 120e365dc63187da ]---
    Kernel panic - not syncing: Attempted to kill init!
    [<c002e79c>] (unwind_backtrace+0x0/0xec) from [<c0271e98>] (panic+0x5c/0x180)
    [<c0271e98>] (panic+0x5c/0x180) from [<c0041a30>] (do_exit+0x6c/0x690)
    [<c0041a30>] (do_exit+0x6c/0x690) from [<c002d5a4>] (die+0x1c8/0x1f4)
    [<c002d5a4>] (die+0x1c8/0x1f4) from [<c002f6c4>] (__do_kernel_fault+0x64/0x84)
    [<c002f6c4>] (__do_kernel_fault+0x64/0x84) from [<c002f8a8>] (do_page_fault+0x1c4/0x1d8)
    [<c002f8a8>] (do_page_fault+0x1c4/0x1d8) from [<c0029304>] (do_DataAbort+0x34/0x94)
    [<c0029304>] (do_DataAbort+0x34/0x94) from [<c0029b2c>] (__dabt_svc+0x4c/0x60)
    Exception stack(0xc7827e78 to 0xc7827ec0)
    7e60:                                                       00000000 0000002a
    7e80: 0000002a 00290000 00000000 c7838600 00000000 c7838604 c7838600 00000000
    7ea0: 00000001 00000001 00000033 c7827ec0 c01ac21c c01abba4 80000013 ffffffff
    [<c0029b2c>] (__dabt_svc+0x4c/0x60) from [<c01abba4>] (i2c_check_addr_busy+0x8/0x58)
    [<c01abba4>] (i2c_check_addr_busy+0x8/0x58) from [<c01ac21c>] (i2c_new_device+0x134/0x158)
    [<c01ac21c>] (i2c_new_device+0x134/0x158) from [<c01bde68>] (v4l2_i2c_new_subdev_board+0x70/0x1c8)
    [<c01bde68>] (v4l2_i2c_new_subdev_board+0x70/0x1c8) from [<c001bc98>] (vpif_probe+0x4ac/0x624)
    [<c001bc98>] (vpif_probe+0x4ac/0x624) from [<c019a5e0>] (platform_drv_probe+0x18/0x1c)
    [<c019a5e0>] (platform_drv_probe+0x18/0x1c) from [<c0199758>] (driver_probe_device+0xb0/0x16c)
    [<c0199758>] (driver_probe_device+0xb0/0x16c) from [<c0199874>] (__driver_attach+0x60/0x84)
    [<c0199874>] (__driver_attach+0x60/0x84) from [<c0198f9c>] (bus_for_each_dev+0x44/0x74)
    [<c0198f9c>] (bus_for_each_dev+0x44/0x74) from [<c01988ec>] (bus_add_driver+0xa8/0x228)
    [<c01988ec>] (bus_add_driver+0xa8/0x228) from [<c0199b44>] (driver_register+0xa8/0x134)
    [<c0199b44>] (driver_register+0xa8/0x134) from [<c0029430>] (do_one_initcall+0xc8/0x1a4)
    [<c0029430>] (do_one_initcall+0xc8/0x1a4) from [<c00083cc>] (kernel_init+0x94/0x14c)
    [<c00083cc>] (kernel_init+0x94/0x14c) from [<c002a99c>] (kernel_thread_exit+0x0/0x8)
    

    Ouyang,

  • Hi,

    Please try the attached uImage0042.uImage.txt. If it boot's up completely post the op of following commands,

    1:  i2cdetect -l

    2:  i2cdetect -y -r 1

    3: i2cdump 1 0x42

    4: i2cget 1 0x42 0x0b

    5: i2cget 1 0x42 0x0c

    6: i2cget 1 0x42 0x00

    7: i2cset 1 0x42 0x00 0x05

    8: i2cget 1 0x42 0x00

    Thanks,

    --Prabhakar Lad

  • Hi Prabhakar Lad,

               Thanks for you reply, I use the Image you post ,It can load sucessfuly ,but when I use i2c-tools it cannot open the file of dev/i2c1 device, I attached the full log session as follows.

    7713.log session.txt
    U-Boot 2010.12 (Dec 23 2011 - 11:22:43)
    
    I2C:   ready
    DRAM:  128 MiB
    MMC:   davinci: 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    In:    serial
    Out:   serial
    Err:   serial
    ARM Clock : 300000000 Hz
    DDR Clock : 132000000 Hz
    Net:   Ethernet PHY: GENERIC @ 0x00
    DaVinci-EMAC
    Hit any key to stop autoboot:  0 
    U-Boot > tftpboot 0xc0700000 uImage
    Using DaVinci-EMAC device
    TFTP from server 192.168.1.41; our IP address is 192.168.1.144
    Filename 'uImage'.
    Load address: 0xc0700000
    Loading: #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################
    done
    Bytes transferred = 1747580 (1aaa7c hex)
    U-Boot > sf probe 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    8192 KiB M25P64 at 0:0 is now current device
    U-Boot > sf erase 0x080000 0x280000
    U-Boot > sf write 0xc0700000 0x080000 0x280000
    U-Boot > 
    Booting with TI UBL
    Device OPP (300MHz, 1.2V)
    
    U-Boot 2010.12 (Dec 23 2011 - 11:22:43)
    
    I2C:   ready
    DRAM:  128 MiB
    MMC:   davinci: 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    In:    serial
    Out:   serial
    Err:   serial
    ARM Clock : 300000000 Hz
    DDR Clock : 132000000 Hz
    Net:   Ethernet PHY: GENERIC @ 0x00
    DaVinci-EMAC
    Hit any key to stop autoboot:  0 
    SF: Detected M25P64 with page size 256, total 8 MiB
    8192 KiB M25P64 at 0:0 is now current device
    ## Booting kernel from Legacy Image at c0700000 ...
       Image Name:   Linux-2.6.37-00001-g3de4d5c-dirt
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    1747516 Bytes = 1.7 MiB
       Load Address: c0008000
       Entry Point:  c0008000
       Verifying Checksum ... OK
       Loading Kernel Image ... OK
    OK
    
    Starting kernel ...
    
    Uncompressing Linux... done, booting the kernel.
    Linux version 2.6.37-00001-g3de4d5c-dirty (prabhakar@tango-charlie) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #7 PREEMPT Thu Oct 30 13:32:27 GMT 2014
    CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
    CPU: VIVT data cache, VIVT instruction cache
    Machine: DaVinci DA850/OMAP-L138/AM18x EVM
    Memory policy: ECC disabled, Data cache writethrough
    DaVinci da850/omap-l138/am18x variant 0x1
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 24320
    Kernel command line: console=ttyS2,115200n8 noinitrd root=/dev/nfs/ nfsroot=192.168.1.41:/home/ouyang/L138filesys,nolock ip=192.168.1.144:192.168.1.41:255.255.255.0 ::eth0:off rw  mem=32M@0Xc0000000 mem=64M@0xc4000000 rootdelay=5
    PID hash table entries: 512 (order: -1, 2048 bytes)
    Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    Memory: 32MB 64MB = 96MB total
    Memory: 93764k/93764k available, 4540k reserved, 0K highmem
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
        DMA     : 0xff000000 - 0xffe00000   (  14 MB)
        vmalloc : 0xc8800000 - 0xfea00000   ( 866 MB)
        lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
        modules : 0xbf000000 - 0xc0000000   (  16 MB)
          .init : 0xc0008000 - 0xc0028000   ( 128 kB)
          .text : 0xc0028000 - 0xc03375ac   (3134 kB)
          .data : 0xc0338000 - 0xc035fde0   ( 160 kB)
    SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    Preemptable hierarchical RCU implementation.
            RCU-based detection of stalled CPUs is disabled.
            Verbose stalled-CPUs detection is disabled.
    NR_IRQS:245
    Console: colour dummy device 80x30
    Calibrating delay loop... 149.50 BogoMIPS (lpj=747520)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 512
    CPU: Testing write buffer coherency: ok
    DaVinci: 144 gpio irqs
    regulator: core version 0.5
    regulator: dummy: 
    NET: Registered protocol family 16
    da850_evm_init: eHRPWM module 0 cannot be used since it is being used by MII interface
    da850_evm_init: eHRPWM module1 outputA cannot be used since it is being used by LCD
    bio: create slab <bio-0> at 0
    Switching to clocksource timer0_1
    NET: Registered protocol family 2
    IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
    TCP established hash table entries: 4096 (order: 3, 32768 bytes)
    TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    TCP: Hash tables configured (established 4096 bind 4096)
    TCP reno registered
    UDP hash table entries: 256 (order: 0, 4096 bytes)
    UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    NET: Registered protocol family 1
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    EMAC: MII PHY configured, RMII PHY will not be functional
    msgmni has been set to 183
    io scheduler noop registered (default)
    da8xx_lcdc da8xx_lcdc.0: GLCD: Found Sharp_LK043T1DG01 panel
    Console: switching to colour frame buffer device 60x34
    Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
    serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25) is a AR7
    serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a AR7
    serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a AR7
    console [ttyS2] enabled
    brd: module loaded
    davinci_mdio davinci_mdio.0: davinci mdio revision 1.5
    davinci_mdio davinci_mdio.0: detected phy mask fffffffe
    davinci_mdio.0: probed
    davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver unknown
    console [netcon0] enabled
    netconsole: network logging started
    i2c /dev entries driver
    lirc_dev: IR Remote Control driver registered, major 254 
    IR NEC protocol handler initialized
    IR RC5(x) protocol handler initialized
    IR RC6 protocol handler initialized
    IR JVC protocol handler initialized
    IR Sony protocol handler initialized
    IR RC5 (streamzap) protocol handler initialized
    IR LIRC bridge handler initialized
    Linux video capture interface: v2.00
    ov: init
    cpuidle: using governor ladder
    cpuidle: using governor menu
    TCP cubic registered
    NET: Registered protocol family 17
    deviceless supply cvdd not found, using dummy regulator
    davinci_emac_probe: using random MAC addr: 16:ec:4e:40:8e:87
    davinci_mdio davinci_mdio.0: resetting idled controller
    net eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:00, id=7c0f1)
    IP-Config: Guessing netmask 255.255.255.0
    IP-Config: Gateway not on directly connected network.
    Waiting 5sec before mounting root device...
    PHY: 0:00 - Link is Up - 100/Full
    VFS: Mounted root (nfs filesystem) on device 0:12.
    Freeing init memory: 128K
    INIT: version 2.86 booting
    Please wait: booting...
    Starting udev
    udevd (891): /proc/891/oom_adj is deprecated, please use /proc/891/oom_score_adj instead.
    udev: starting version 141
    Root filesystem already rw, not remounting
    Caching udev devnodes
    Populating dev cachemv: cannot rename '/tmp/devices': No such file or directory
    logger: mount: mount point /proc/bus/usb does not exist
    ALSA: Restoring mixer settings...
    NOT configuring network interfaces: / is an NFS mount
    hwclock: can't open '/dev/misc/rtc': No such file or directory
    Fri Dec 23 12:42:00 UTC 2011
    hwclock: can't open '/dev/misc/rtc': No such file or directory
    INIT: Entering runlevel: 5
    Starting system message bus: dbus.
    Starting Dropbear SSH server: dropbear.
    Starting telnet daemon.
    Starting network benchmark server: netserver.
    Starting syslogd/klogd: done
    Starting thttpd.
    FATAL: Module cmemk not found.
    FATAL: Module dsplinkk not found.
    FATAL: Module dm365mmap not found.
    BusyBox v1.13.2 (2011-12-23 12:39:34 IST) multi-call binary
    
    Usage: mknod [OPTIONS] NAME TYPE MAJOR MINOR
    
    Create a special file (block, character, or pipe)
    
    Options:
            -m      Create the special file using the specified mode (default a=rw)
    TYPEs include:
            b:      Make a block device
            c or u: Make a character device
            p:      Make a named pipe (MAJOR and MINOR are ignored)
    
    
     _____                    _____           _         _   
    |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_ 
    |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
    |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
                  |___|                    |___|            
    
    Arago Project http://arago-project.org arago ttyS2
    
    Arago 2011.06 arago ttyS2
    
    arago login: root
    root@arago:~# cd /dev
    root@arago:/dev# ls
    block               ptyva               ttyde
    char                ptyvb               ttydf
    console             ptyvc               ttye0
    cpu_dma_latency     ptyvd               ttye1
    fb                  ptyve               ttye2
    fb0                 ptyvf               ttye3
    full                ptyw0               ttye4
    initctl             ptyw1               ttye5
    kmem                ptyw2               ttye6
    kmsg                ptyw3               ttye7
    log                 ptyw4               ttye8
    mem                 ptyw5               ttye9
    network_latency     ptyw6               ttyea
    network_throughput  ptyw7               ttyeb
    null                ptyw8               ttyec
    ptmx                ptyw9               ttyed
    pts                 ptywa               ttyee
    ptya0               ptywb               ttyef
    ptya1               ptywc               ttyp0
    ptya2               ptywd               ttyp1
    ptya3               ptywe               ttyp2
    ptya4               ptywf               ttyp3
    ptya5               ptyx0               ttyp4
    ptya6               ptyx1               ttyp5
    ptya7               ptyx2               ttyp6
    ptya8               ptyx3               ttyp7
    ptya9               ptyx4               ttyp8
    ptyaa               ptyx5               ttyp9
    ptyab               ptyx6               ttypa
    ptyac               ptyx7               ttypb
    ptyad               ptyx8               ttypc
    ptyae               ptyx9               ttypd
    ptyaf               ptyxa               ttype
    ptyb0               ptyxb               ttypf
    ptyb1               ptyxc               ttyq0
    ptyb2               ptyxd               ttyq1
    ptyb3               ptyxe               ttyq2
    ptyb4               ptyxf               ttyq3
    ptyb5               ptyy0               ttyq4
    ptyb6               ptyy1               ttyq5
    ptyb7               ptyy2               ttyq6
    ptyb8               ptyy3               ttyq7
    ptyb9               ptyy4               ttyq8
    ptyba               ptyy5               ttyq9
    ptybb               ptyy6               ttyqa
    ptybc               ptyy7               ttyqb
    ptybd               ptyy8               ttyqc
    ptybe               ptyy9               ttyqd
    ptybf               ptyya               ttyqe
    ptyc0               ptyyb               ttyqf
    ptyc1               ptyyc               ttyr0
    ptyc2               ptyyd               ttyr1
    ptyc3               ptyye               ttyr2
    ptyc4               ptyyf               ttyr3
    ptyc5               ptyz0               ttyr4
    ptyc6               ptyz1               ttyr5
    ptyc7               ptyz2               ttyr6
    ptyc8               ptyz3               ttyr7
    ptyc9               ptyz4               ttyr8
    ptyca               ptyz5               ttyr9
    ptycb               ptyz6               ttyra
    ptycc               ptyz7               ttyrb
    ptycd               ptyz8               ttyrc
    ptyce               ptyz9               ttyrd
    ptycf               ptyza               ttyre
    ptyd0               ptyzb               ttyrf
    ptyd1               ptyzc               ttys0
    ptyd2               ptyzd               ttys1
    ptyd3               ptyze               ttys2
    ptyd4               ptyzf               ttys3
    ptyd5               ram0                ttys4
    ptyd6               random              ttys5
    ptyd7               shm                 ttys6
    ptyd8               tty                 ttys7
    ptyd9               tty0                ttys8
    ptyda               tty1                ttys9
    ptydb               tty10               ttysa
    ptydc               tty11               ttysb
    ptydd               tty12               ttysc
    ptyde               tty13               ttysd
    ptydf               tty14               ttyse
    ptye0               tty15               ttysf
    ptye1               tty16               ttyt0
    ptye2               tty17               ttyt1
    ptye3               tty18               ttyt2
    ptye4               tty19               ttyt3
    ptye5               tty2                ttyt4
    ptye6               tty20               ttyt5
    ptye7               tty21               ttyt6
    ptye8               tty22               ttyt7
    ptye9               tty23               ttyt8
    ptyea               tty24               ttyt9
    ptyeb               tty25               ttyta
    ptyec               tty26               ttytb
    ptyed               tty27               ttytc
    ptyee               tty28               ttytd
    ptyef               tty29               ttyte
    ptyp0               tty3                ttytf
    ptyp1               tty30               ttyu0
    ptyp2               tty31               ttyu1
    ptyp3               tty32               ttyu2
    ptyp4               tty33               ttyu3
    ptyp5               tty34               ttyu4
    ptyp6               tty35               ttyu5
    ptyp7               tty36               ttyu6
    ptyp8               tty37               ttyu7
    ptyp9               tty38               ttyu8
    ptypa               tty39               ttyu9
    ptypb               tty4                ttyua
    ptypc               tty40               ttyub
    ptypd               tty41               ttyuc
    ptype               tty42               ttyud
    ptypf               tty43               ttyue
    ptyq0               tty44               ttyuf
    ptyq1               tty45               ttyv0
    ptyq2               tty46               ttyv1
    ptyq3               tty47               ttyv2
    ptyq4               tty48               ttyv3
    ptyq5               tty49               ttyv4
    ptyq6               tty5                ttyv5
    ptyq7               tty50               ttyv6
    ptyq8               tty51               ttyv7
    ptyq9               tty52               ttyv8
    ptyqa               tty53               ttyv9
    ptyqb               tty54               ttyva
    ptyqc               tty55               ttyvb
    ptyqd               tty56               ttyvc
    ptyqe               tty57               ttyvd
    ptyqf               tty58               ttyve
    ptyr0               tty59               ttyvf
    ptyr1               tty6                ttyw0
    ptyr2               tty60               ttyw1
    ptyr3               tty61               ttyw2
    ptyr4               tty62               ttyw3
    ptyr5               tty63               ttyw4
    ptyr6               tty7                ttyw5
    ptyr7               tty8                ttyw6
    ptyr8               tty9                ttyw7
    ptyr9               ttyS0               ttyw8
    ptyra               ttyS1               ttyw9
    ptyrb               ttyS2               ttywa
    ptyrc               ttya0               ttywb
    ptyrd               ttya1               ttywc
    ptyre               ttya2               ttywd
    ptyrf               ttya3               ttywe
    ptys0               ttya4               ttywf
    ptys1               ttya5               ttyx0
    ptys2               ttya6               ttyx1
    ptys3               ttya7               ttyx2
    ptys4               ttya8               ttyx3
    ptys5               ttya9               ttyx4
    ptys6               ttyaa               ttyx5
    ptys7               ttyab               ttyx6
    ptys8               ttyac               ttyx7
    ptys9               ttyad               ttyx8
    ptysa               ttyae               ttyx9
    ptysb               ttyaf               ttyxa
    ptysc               ttyb0               ttyxb
    ptysd               ttyb1               ttyxc
    ptyse               ttyb2               ttyxd
    ptysf               ttyb3               ttyxe
    ptyt0               ttyb4               ttyxf
    ptyt1               ttyb5               ttyy0
    ptyt2               ttyb6               ttyy1
    ptyt3               ttyb7               ttyy2
    ptyt4               ttyb8               ttyy3
    ptyt5               ttyb9               ttyy4
    ptyt6               ttyba               ttyy5
    ptyt7               ttybb               ttyy6
    ptyt8               ttybc               ttyy7
    ptyt9               ttybd               ttyy8
    ptyta               ttybe               ttyy9
    ptytb               ttybf               ttyya
    ptytc               ttyc0               ttyyb
    ptytd               ttyc1               ttyyc
    ptyte               ttyc2               ttyyd
    ptytf               ttyc3               ttyye
    ptyu0               ttyc4               ttyyf
    ptyu1               ttyc5               ttyz0
    ptyu2               ttyc6               ttyz1
    ptyu3               ttyc7               ttyz2
    ptyu4               ttyc8               ttyz3
    ptyu5               ttyc9               ttyz4
    ptyu6               ttyca               ttyz5
    ptyu7               ttycb               ttyz6
    ptyu8               ttycc               ttyz7
    ptyu9               ttycd               ttyz8
    ptyua               ttyce               ttyz9
    ptyub               ttycf               ttyza
    ptyuc               ttyd0               ttyzb
    ptyud               ttyd1               ttyzc
    ptyue               ttyd2               ttyzd
    ptyuf               ttyd3               ttyze
    ptyv0               ttyd4               ttyzf
    ptyv1               ttyd5               udev_network_queue
    ptyv2               ttyd6               urandom
    ptyv3               ttyd7               vcs
    ptyv4               ttyd8               vcs1
    ptyv5               ttyd9               vcs2
    ptyv6               ttyda               vcsa
    ptyv7               ttydb               vcsa1
    ptyv8               ttydc               vcsa2
    ptyv9               ttydd               zero
    root@arago:/dev# cd /usr/share/i2c-tools/
    root@arago:/usr/share/i2c-tools# ls
    i2cdetect  i2cdump    i2cget     i2cset
    root@arago:/usr/share/i2c-tools# i2cdetect -1
    Error: Unsupported option "-1"!
    Usage: i2cdetect [-y] [-a] [-q|-r] I2CBUS [FIRST LAST]
           i2cdetect -F I2CBUS
           i2cdetect -l
      I2CBUS is an integer or an I2C bus name
      If provided, FIRST and LAST limit the probing range.
    root@arago:/usr/share/i2c-tools# i2cdetect -l
    root@arago:/usr/share/i2c-tools# i2cdetect -y -r 1
    Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory
    root@arago:/usr/share/i2c-tools# i2cdump 1 0x42
    No size specified (using byte-data access)
    Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory
    root@arago:/usr/share/i2c-tools# i2cget 1 0x42 0x0b
    Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory
    root@arago:/usr/share/i2c-tools# i2cget 1 0x42 0x0c
    Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory
    root@arago:/usr/share/i2c-tools# i2cget 1 0x42 0x00
    Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory
    root@arago:/usr/share/i2c-tools# i2cset 1 0x42 0x00 0x05
    Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory
    root@arago:/usr/share/i2c-tools# i2cget 1 0x42 0x00
    Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory

             Now i doubt if i make some mistake in hardware design that it cannot use i2c bus communicate with the device.

              Thank you very much again.

    Ouyang,

  • Hi,

    With the same uImage above can you post to output of 'ls  /dev/i2*'

    Thanks,

    --Prabhakar Lad

  • Hi Prabhakar Lad,
      Thanks for you reply, I Use the same uImage,and excute the command of ls /dev/i2* the log is follows:
      
    arago login: root
    root@arago:~# cd /dev  
    root@arago:/dev# ls /dev/i2*
    ls: /dev/i2*: No such file or directory
    root@arago:/dev#


           It indicate the i2c driver is not built in kernel ,Is that right?
           Thanks very much.
    Ouyang,

  • Hi,

    Can you try the attached uImage.4274.uImage.txt

    Thanks,

    --Prabhakar Lad

  • Hi Prabhakar Lad,

       I use the uImage as you post ,the kernel can't load sucessfully,Follows is the full log session.

    5148.log4272.txt
    Booting with TI UBL
    Device OPP (300MHz, 1.2V)
    
    U-Boot 2010.12 (Dec 23 2011 - 11:22:43)
    
    I2C:   ready
    DRAM:  128 MiB
    MMC:   davinci: 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    In:    serial
    Out:   serial
    Err:   serial
    ARM Clock : 300000000 Hz
    DDR Clock : 132000000 Hz
    Net:   Ethernet PHY: GENERIC @ 0x00
    DaVinci-EMAC
    Hit any key to stop autoboot:  0 
    SF: Detected M25P64 with page size 256, total 8 MiB
    8192 KiB M25P64 at 0:0 is now current device
    ## Booting kernel from Legacy Image at c0700000 ...
       Image Name:   Linux-2.6.37-00001-g3de4d5c-dirt
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    1754860 Bytes = 1.7 MiB
       Load Address: c0008000
       Entry Point:  c0008000
       Verifying Checksum ... OK
       Loading Kernel Image ... OK
    OK
    
    Starting kernel ...
    
    Uncompressing Linux... done, booting the kernel.
    Linux version 2.6.37-00001-g3de4d5c-dirty (prabhakar@tango-charlie) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #10 PREEMPT Fri Oct 31 08:58:28 GMT 2014
    CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
    CPU: VIVT data cache, VIVT instruction cache
    Machine: DaVinci DA850/OMAP-L138/AM18x EVM
    Memory policy: ECC disabled, Data cache writethrough
    DaVinci da850/omap-l138/am18x variant 0x1
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 24320
    Kernel command line: console=ttyS2,115200n8 noinitrd root=/dev/nfs/ nfsroot=192.168.1.41:/home/ouyang/L138filesys,nolock ip=192.168.1.144:192.168.1.41:255.255.255.0 ::eth0:off rw  mem=32M@0Xc0000000 mem=64M@0xc4000000 rootdelay=5
    PID hash table entries: 512 (order: -1, 2048 bytes)
    Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    Memory: 32MB 64MB = 96MB total
    Memory: 93740k/93740k available, 4564k reserved, 0K highmem
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
        DMA     : 0xff000000 - 0xffe00000   (  14 MB)
        vmalloc : 0xc8800000 - 0xfea00000   ( 866 MB)
        lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
        modules : 0xbf000000 - 0xc0000000   (  16 MB)
          .init : 0xc0008000 - 0xc0029000   ( 132 kB)
          .text : 0xc0029000 - 0xc033d6d8   (3154 kB)
          .data : 0xc033e000 - 0xc0365b60   ( 159 kB)
    SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    Preemptable hierarchical RCU implementation.
            RCU-based detection of stalled CPUs is disabled.
            Verbose stalled-CPUs detection is disabled.
    NR_IRQS:245
    Console: colour dummy device 80x30
    Calibrating delay loop... 149.50 BogoMIPS (lpj=747520)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 512
    CPU: Testing write buffer coherency: ok
    DaVinci: 144 gpio irqs
    regulator: core version 0.5
    regulator: dummy: 
    NET: Registered protocol family 16
    da850_evm_init: eHRPWM module 0 cannot be used since it is being used by MII interface
    da850_evm_init: eHRPWM module1 outputA cannot be used since it is being used by LCD
    bio: create slab <bio-0> at 0
    vpif vpif: vpif probe success
    Switching to clocksource timer0_1
    NET: Registered protocol family 2
    IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
    TCP established hash table entries: 4096 (order: 3, 32768 bytes)
    TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    TCP: Hash tables configured (established 4096 bind 4096)
    TCP reno registered
    UDP hash table entries: 256 (order: 0, 4096 bytes)
    UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    NET: Registered protocol family 1
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    EMAC: MII PHY configured, RMII PHY will not be functional
    msgmni has been set to 183
    io scheduler noop registered (default)
    da8xx_lcdc da8xx_lcdc.0: GLCD: Found Sharp_LK043T1DG01 panel
    Console: switching to colour frame buffer device 60x34
    Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
    serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25) is a AR7
    serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a AR7
    serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a AR7
    console [ttyS2] enabled
    brd: module loaded
    davinci_mdio davinci_mdio.0: davinci mdio revision 1.5
    davinci_mdio davinci_mdio.0: detected phy mask fffffffe
    davinci_mdio.0: probed
    davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver unknown
    console [netcon0] enabled
    netconsole: network logging started
    i2c /dev entries driver
    lirc_dev: IR Remote Control driver registered, major 254 
    IR NEC protocol handler initialized
    IR RC5(x) protocol handler initialized
    IR RC6 protocol handler initialized
    IR JVC protocol handler initialized
    IR Sony protocol handler initialized
    IR RC5 (streamzap) protocol handler initialized
    IR LIRC bridge handler initialized
    Linux video capture interface: v2.00
    ov: init
    Unable to handle kernel NULL pointer dereference at virtual address 00000050
    pgd = c0004000
    [00000050] *pgd=00000000
    Internal error: Oops: 5 [#1] PREEMPT
    last sysfs file: 
    Modules linked in:
    CPU: 0    Not tainted  (2.6.37-00001-g3de4d5c-dirty #10)
    PC is at i2c_check_addr_busy+0x8/0x58
    LR is at i2c_new_device+0x15c/0x188
    pc : [<c01abc00>]    lr : [<c01ac33c>]    psr: 80000013
    sp : c7827eb8  ip : 00000030  fp : c0346324
    r10: 00000000  r9 : 00000000  r8 : c7838500
    r7 : c7838504  r6 : 00000000  r5 : c7838500  r4 : 00000000
    r3 : 00410000  r2 : 00000042  r1 : 00000042  r0 : 00000000
    Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
    Control: 0005317f  Table: c0004000  DAC: 00000017
    Process swapper (pid: 1, stack limit = 0xc7826270)
    Stack: (0xc7827eb8 to 0xc7828000)
    7ea0:                                                       00000000 00000042
    7ec0: c03464c4 c01ac33c 00000000 c03464c4 00000000 00000000 c03464c4 c038adc8
    7ee0: c03464c0 c01be1f8 c79e6320 00000000 c038adc8 c78d0400 c03464c0 c001bc8c
    7f00: 00000000 00000001 c7804dd8 c0342b38 00000000 00000001 c0365994 c0342b40
    7f20: c0342b40 c0365994 c79e4600 c0357168 00000000 00000000 00000000 c019a5e0
    7f40: c0342b40 c0199758 c0342b40 c0342b74 c0365994 c0199874 00000000 c0199814
    7f60: c0365994 c0198f9c c7804db8 c786e030 c00219a8 c0008338 c0365994 c01988ec
    7f80: c02e57b9 c02e57b9 c7827f88 c00219a8 c0008338 c0365994 00000013 c001b794
    7fa0: 00000000 c0199b44 c00219a8 c0008338 c002a99c 00000013 c001b794 c0029430
    7fc0: c0008338 3031bc00 00000030 00000000 00000013 c00219a8 c0008338 c002a99c
    7fe0: 00000013 00000000 00000000 c00083cc 00000000 c002a99c 00000000 00000000
    [<c01abc00>] (i2c_check_addr_busy+0x8/0x58) from [<c01ac33c>] (i2c_new_device+0x15c/0x188)
    [<c01ac33c>] (i2c_new_device+0x15c/0x188) from [<c01be1f8>] (v4l2_i2c_new_subdev_board+0x70/0x1c8)
    [<c01be1f8>] (v4l2_i2c_new_subdev_board+0x70/0x1c8) from [<c001bc8c>] (vpif_probe+0x4ec/0x698)
    [<c001bc8c>] (vpif_probe+0x4ec/0x698) from [<c019a5e0>] (platform_drv_probe+0x18/0x1c)
    [<c019a5e0>] (platform_drv_probe+0x18/0x1c) from [<c0199758>] (driver_probe_device+0xb0/0x16c)
    [<c0199758>] (driver_probe_device+0xb0/0x16c) from [<c0199874>] (__driver_attach+0x60/0x84)
    [<c0199874>] (__driver_attach+0x60/0x84) from [<c0198f9c>] (bus_for_each_dev+0x44/0x74)
    [<c0198f9c>] (bus_for_each_dev+0x44/0x74) from [<c01988ec>] (bus_add_driver+0xa8/0x228)
    [<c01988ec>] (bus_add_driver+0xa8/0x228) from [<c0199b44>] (driver_register+0xa8/0x134)
    [<c0199b44>] (driver_register+0xa8/0x134) from [<c0029430>] (do_one_initcall+0xc8/0x1a4)
    [<c0029430>] (do_one_initcall+0xc8/0x1a4) from [<c00083cc>] (kernel_init+0x94/0x14c)
    [<c00083cc>] (kernel_init+0x94/0x14c) from [<c002a99c>] (kernel_thread_exit+0x0/0x8)
    Code: c0358244 c01ab774 e92d4013 e1a04000 (e5900050) 
    ---[ end trace c4adcd06f5056952 ]---
    Kernel panic - not syncing: Attempted to kill init!
    [<c002e79c>] (unwind_backtrace+0x0/0xec) from [<c0263838>] (panic+0x5c/0x180)
    [<c0263838>] (panic+0x5c/0x180) from [<c0041a28>] (do_exit+0x6c/0x690)
    [<c0041a28>] (do_exit+0x6c/0x690) from [<c002d5a4>] (die+0x1c8/0x1f4)
    [<c002d5a4>] (die+0x1c8/0x1f4) from [<c002f6c4>] (__do_kernel_fault+0x64/0x84)
    [<c002f6c4>] (__do_kernel_fault+0x64/0x84) from [<c002f8a8>] (do_page_fault+0x1c4/0x1d8)
    [<c002f8a8>] (do_page_fault+0x1c4/0x1d8) from [<c0029304>] (do_DataAbort+0x34/0x94)
    [<c0029304>] (do_DataAbort+0x34/0x94) from [<c0029b2c>] (__dabt_svc+0x4c/0x60)
    Exception stack(0xc7827e70 to 0xc7827eb8)
    7e60:                                     00000000 00000042 00000042 00410000
    7e80: 00000000 c7838500 00000000 c7838504 c7838500 00000000 00000000 c0346324
    7ea0: 00000030 c7827eb8 c01ac33c c01abc00 80000013 ffffffff
    [<c0029b2c>] (__dabt_svc+0x4c/0x60) from [<c01abc00>] (i2c_check_addr_busy+0x8/0x58)
    [<c01abc00>] (i2c_check_addr_busy+0x8/0x58) from [<c01ac33c>] (i2c_new_device+0x15c/0x188)
    [<c01ac33c>] (i2c_new_device+0x15c/0x188) from [<c01be1f8>] (v4l2_i2c_new_subdev_board+0x70/0x1c8)
    [<c01be1f8>] (v4l2_i2c_new_subdev_board+0x70/0x1c8) from [<c001bc8c>] (vpif_probe+0x4ec/0x698)
    [<c001bc8c>] (vpif_probe+0x4ec/0x698) from [<c019a5e0>] (platform_drv_probe+0x18/0x1c)
    [<c019a5e0>] (platform_drv_probe+0x18/0x1c) from [<c0199758>] (driver_probe_device+0xb0/0x16c)
    [<c0199758>] (driver_probe_device+0xb0/0x16c) from [<c0199874>] (__driver_attach+0x60/0x84)
    [<c0199874>] (__driver_attach+0x60/0x84) from [<c0198f9c>] (bus_for_each_dev+0x44/0x74)
    [<c0198f9c>] (bus_for_each_dev+0x44/0x74) from [<c01988ec>] (bus_add_driver+0xa8/0x228)
    [<c01988ec>] (bus_add_driver+0xa8/0x228) from [<c0199b44>] (driver_register+0xa8/0x134)
    [<c0199b44>] (driver_register+0xa8/0x134) from [<c0029430>] (do_one_initcall+0xc8/0x1a4)
    [<c0029430>] (do_one_initcall+0xc8/0x1a4) from [<c00083cc>] (kernel_init+0x94/0x14c)
    [<c00083cc>] (kernel_init+0x94/0x14c) from [<c002a99c>] (kernel_thread_exit+0x0/0x8)
    

      Thanks for you very much,I will modify the hardware,It mainly add a PCA9306 circuite to transfer the i2c bus voltage,And I will tell you the progress.
    Ouyang,

  • Hi Prabhakar Lad,
         I have modified the hardware which is add a PCA9306 circuit But it still cannot  register the ov7670 successed .
        Follows is the full logs ,It seems the problem is like as before when unchanged the  hardware.

    3704.1102log.txt
    Device OPP (300MHz, 1.2V)
    Booting with TI UBL
    Device OPP (300MHz, 1.2V)
    
    U-Boot 2010.12 (Dec 23 2011 - 11:22:43)
    
    I2C:   ready
    DRAM:  128 MiB
    MMC:   davinci: 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    In:    serial
    Out:   serial
    Err:   serial
    ARM Clock : 300000000 Hz
    DDR Clock : 132000000 Hz
    Net:   Ethernet PHY: GENERIC @ 0x00
    DaVinci-EMAC
    Hit any key to stop autoboot:  0 
    U-Boot > tftpboot 0xc0700000 uImage
    Using DaVinci-EMAC device
    TFTP from server 192.168.1.41; our IP address is 192.168.1.144
    Filename 'uImage'.
    Load address: 0xc0700000
    Loading: #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             ##################
    done
    Bytes transferred = 2419888 (24ecb0 hex)
    U-Boot > sf probe 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    8192 KiB M25P64 at 0:0 is now current device
    U-Boot > sf erase 0x080000 0x280000
    U-Boot > sf write 0xc0700000 0x080000 0x280000
    U-Boot > 
    Booting with TI UBL
    Device OPP (300MHz, 1.2V)
    
    U-Boot 2010.12 (Dec 23 2011 - 11:22:43)
    
    I2C:   ready
    DRAM:  128 MiB
    MMC:   davinci: 0
    SF: Detected M25P64 with page size 256, total 8 MiB
    In:    serial
    Out:   serial
    Err:   serial
    ARM Clock : 300000000 Hz
    DDR Clock : 132000000 Hz
    Net:   Ethernet PHY: GENERIC @ 0x00
    DaVinci-EMAC
    Hit any key to stop autoboot:  0 
    SF: Detected M25P64 with page size 256, total 8 MiB
    8192 KiB M25P64 at 0:0 is now current device
    ## Booting kernel from Legacy Image at c0700000 ...
       Image Name:   Linux-2.6.37
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    2419824 Bytes = 2.3 MiB
       Load Address: c0008000
       Entry Point:  c0008000
       Verifying Checksum ... OK
       Loading Kernel Image ... OK
    OK
    
    Starting kernel ...
    
    Uncompressing Linux... done, booting the kernel.
    Linux version 2.6.37 (root@ubuntu) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #103 PREEMPT Mon Nov 3 00:47:25 PST 2014
    CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
    CPU: VIVT data cache, VIVT instruction cache
    Machine: DaVinci DA850/OMAP-L138/AM18x EVM
    Memory policy: ECC disabled, Data cache writeback
    DaVinci da850/omap-l138/am18x variant 0x1
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 24320
    Kernel command line: console=ttyS2,115200n8 noinitrd root=/dev/nfs/ nfsroot=192.168.1.41:/home/ouyang/L138filesys,nolock ip=192.168.1.144:192.168.1.41:255.255.255.0 ::eth0:off rw  mem=32M@0Xc0000000 mem=64M@0xc4000000 rootdelay=5
    PID hash table entries: 512 (order: -1, 2048 bytes)
    Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    Memory: 32MB 64MB = 96MB total
    Memory: 92260k/92260k available, 6044k reserved, 0K highmem
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
        DMA     : 0xff000000 - 0xffe00000   (  14 MB)
        vmalloc : 0xc8800000 - 0xfea00000   ( 866 MB)
        lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
        modules : 0xbf000000 - 0xc0000000   (  16 MB)
          .init : 0xc0008000 - 0xc0032000   ( 168 kB)
          .text : 0xc0032000 - 0xc04b0000   (4600 kB)
          .data : 0xc04b0000 - 0xc04e2880   ( 203 kB)
    SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    Preemptable hierarchical RCU implementation.
            RCU-based detection of stalled CPUs is disabled.
            Verbose stalled-CPUs detection is disabled.
    NR_IRQS:245
    Console: colour dummy device 80x30
    Calibrating delay loop... 149.50 BogoMIPS (lpj=747520)
    pid_max: default: 32768 minimum: 301
    Security Framework initialized
    Mount-cache hash table entries: 512
    CPU: Testing write buffer coherency: ok
    DaVinci: 144 gpio irqs
    regulator: core version 0.5
    regulator: dummy: 
    NET: Registered protocol family 16
    WARNING: both McASP and McBSP are enabled, but they share pins.
            Only McASP will work. If you want McBSP support, disable McASP.
    WARNING: both McASP and UART1_AFE are enabled, but they share pins.
            Disable one of them.
    da850_evm_init: eHRPWM module 0 cannot be used since it is being used by MII interface
    da850_evm_init: eHRPWM module1 outputA cannot be used since it is being used by LCD
    da850_evm_init: eHRPWM module1 outputB cannot be used since it is being used by spi1
    bio: create slab <bio-0> at 0
    SCSI subsystem initialized
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    pca953x 1-0020: failed reading register
    pca9543a_probe
    i2c-gpio i2c-gpio.1: using pins 20 (SDA) and 21 (SCL)
    vpif vpif: vpif probe success
    Advanced Linux Sound Architecture Driver Version 1.0.23.
    Bluetooth: Core ver 2.15
    NET: Registered protocol family 31
    Bluetooth: HCI device and connection manager initialized
    Bluetooth: HCI socket layer initialized
    Switching to clocksource timer0_1
    musb-hdrc: version 6.0, host, debug=0
    musb-hdrc musb-hdrc: dma type: dma-cppi41
    Waiting for USB PHY clock good...
    musb-hdrc musb-hdrc: MUSB HDRC host driver
    musb-hdrc musb-hdrc: new USB bus registered, assigned bus number 1
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 1 port detected
    musb-hdrc musb-hdrc: USB Host mode controller at fee00000 using DMA, IRQ 58
    NET: Registered protocol family 2
    IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
    TCP established hash table entries: 4096 (order: 3, 32768 bytes)
    TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    TCP: Hash tables configured (established 4096 bind 4096)
    TCP reno registered
    UDP hash table entries: 256 (order: 0, 4096 bytes)
    UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    NET: Registered protocol family 1
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    EMAC: MII PHY configured, RMII PHY will not be functional
    McBSP:Probed McBSP1
    JFFS2 version 2.2. (NAND) ? 2001-2006 Red Hat, Inc.
    msgmni has been set to 180
    io scheduler noop registered (default)
    da8xx_lcdc da8xx_lcdc.0: GLCD: Found Sharp_LK043T1DG01 panel
    Console: switching to colour frame buffer device 60x34
    Serial: 8250/16550 driver, 3 ports, IRQ sharing disabled
    serial8250.0: ttyS0 at MMIO 0x1c42000 (irq = 25) is a AR7
    serial8250.0: ttyS1 at MMIO 0x1d0c000 (irq = 53) is a AR7
    serial8250.0: ttyS2 at MMIO 0x1d0d000 (irq = 61) is a AR7
    console [ttyS2] enabled
    brd: module loaded
    at24 1-0050: 32768 byte 24c256 EEPROM (writable)
    ahci ahci: forcing PORTS_IMPL to 0x1
    ahci ahci: AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl platform mode
    ahci ahci: flags: ncq sntf pm led clo only pmp pio slum part ccc 
    scsi0 : ahci_platform
    ata1: SATA max UDMA/133 mmio [mem 0x01e18000-0x01e19fff] port 0x100 irq 67
    spi_davinci spi_davinci.1: DMA: supported
    spi_davinci spi_davinci.1: DMA: RX channel: 18, TX channel: 19, event queue: 0
    m25p80 spi1.0: m25p64 (8192 Kbytes)
    Creating 6 MTD partitions on "m25p80":
    0x000000000000-0x000000010000 : "UBL"
    0x000000010000-0x000000090000 : "U-Boot"
    0x000000090000-0x0000000a0000 : "U-Boot-Env"
    0x0000000a0000-0x000000320000 : "Kernel"
    0x000000320000-0x000000720000 : "Filesystem"
    0x0000007f0000-0x000000800000 : "MAC-Address"
    Read MAC addr from SPI Flash: ff:ff:ff:ff:ff:ff
    spi_davinci spi_davinci.1: Controller at 0xfef0e000
    davinci_mdio davinci_mdio.0: davinci mdio revision 1.5
    davinci_mdio davinci_mdio.0: detected phy mask fffffffe
    davinci_mdio.0: probed
    davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver SMSC LAN8710/LAN8720
    console [netcon0] enabled
    netconsole: network logging started
    ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
    ohci ohci.0: DA8xx OHCI
    ohci ohci.0: new USB bus registered, assigned bus number 2
    Waiting for USB PHY clock good...
    ohci ohci.0: irq 59, io mem 0x01e25000
    hub 2-0:1.0: USB hub found
    hub 2-0:1.0: 1 port detected
    Initializing USB Mass Storage driver...
    usbcore: registered new interface driver usb-storage
    USB Mass Storage support registered.
    omap_rtc omap_rtc: rtc core: registered omap_rtc as rtc0
    omap_rtc: RTC power up reset detected
    i2c /dev entries driver
    lirc_dev: IR Remote Control driver registered, major 252 
    IR NEC protocol handler initialized
    ata1: SATA link down (SStatus 0 SControl 300)
    IR RC5(x) protocol handler initialized
    IR RC6 protocol handler initialized
    IR JVC protocol handler initialized
    IR Sony protocol handler initialized
    IR RC5 (streamzap) protocol handler initialized
    IR LIRC bridge handler initialized
    Linux video capture interface: v2.00
    ov7670 1-0042: chip found @ 0x84 (i2c-gpio1) is not an ov7670 chip.
    vpif_capture vpif_capture: Error registering v4l2 subdevice
    Unable to handle kernel paging request at virtual address 04000138
    pgd = c0004000
    [04000138] *pgd=00000000
    Internal error: Oops: 5 [#1] PREEMPT
    last sysfs file: 
    Modules linked in:
    CPU: 0    Not tainted  (2.6.37 #103)
    PC is at module_put+0x2c/0x7c
    LR is at v4l2_device_unregister_subdev+0x94/0xac
    pc : [<c00770c0>]    lr : [<c0271500>]    psr: 20000013
    sp : c7827e18  ip : c7827e28  fp : c7827e24
    r10: c04b98e0  r9 : 00000000  r8 : ffffffed
    r7 : c79ee400  r6 : c04fd274  r5 : c7923800  r4 : c7923600
    r3 : 00000001  r2 : c7826000  r1 : c7923800  r0 : 04000020
    Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
    Control: 0005317f  Table: c0004000  DAC: 00000017
    Process swapper (pid: 1, stack limit = 0xc7826270)
    Stack: (0xc7827e18 to 0xc7828000)
    7e00:                                                       c7827e3c c7827e28
    7e20: c0271500 c00770a4 c7923600 c7923800 c7827e5c c7827e40 c027172c c027147c
    7e40: c79e06a0 00000000 00000002 c79ee400 c7827ea4 c7827e60 c0020754 c0271710
    7e60: 00000000 00000001 c04b4f00 c04b95bc c788f200 00000001 c7827e94 c04b4f08
    7e80: c04b4f08 c04e24dc c79eaf00 c04c9ea8 00000000 00000000 c7827eb4 c7827ea8
    7ea0: c01e69f8 c00201d8 c7827ed4 c7827eb8 c01e5954 c01e69e8 c04b4f08 c04b4f3c
    7ec0: c04e24dc c79eaf00 c7827ef4 c7827ed8 c01e5a84 c01e5888 00000000 c01e5a1c
    7ee0: c04e24dc c79eaf00 c7827f1c c7827ef8 c01e508c c01e5a2c c7837038 c7856930
    7f00: c019c758 c0029088 c00083ac c04e24dc c7827f2c c7827f20 c01e576c c01e504c
    7f20: c7827f5c c7827f30 c01e495c c01e575c c044828a c7827f40 c0029088 c00083ac
    7f40: c04e24dc 00000013 c00201ac 00000000 c7827f84 c7827f60 c01e5dc4 c01e48b8
    7f60: c0029088 c00083ac c004b1c0 00000013 c00201ac 00000000 c7827f94 c7827f88
    7f80: c01e6e9c c01e5d24 c7827fa4 c7827f98 c00201c0 c01e6e60 c7827fdc c7827fa8
    7fa0: c0032420 c00201bc 000000f5 c00083ac c004b1c0 00000013 c0029088 c00083ac
    7fc0: c004b1c0 00000013 00000000 00000000 c7827ff4 c7827fe0 c0008448 c0032360
    7fe0: 00000000 c00083ac 00000000 c7827ff8 c004b1c0 c00083bc 00000000 00000000
    Backtrace: 
    [<c0077094>] (module_put+0x0/0x7c) from [<c0271500>] (v4l2_device_unregister_subdev+0x94/0xac)
    [<c027146c>] (v4l2_device_unregister_subdev+0x0/0xac) from [<c027172c>] (v4l2_device_unregister+0x2c/0x7c)
     r5:c7923800 r4:c7923600
    [<c0271700>] (v4l2_device_unregister+0x0/0x7c) from [<c0020754>] (vpif_probe+0x58c/0x6b8)
     r7:c79ee400 r6:00000002 r5:00000000 r4:c79e06a0
    [<c00201c8>] (vpif_probe+0x0/0x6b8) from [<c01e69f8>] (platform_drv_probe+0x20/0x24)
    [<c01e69d8>] (platform_drv_probe+0x0/0x24) from [<c01e5954>] (driver_probe_device+0xdc/0x1a4)
    [<c01e5878>] (driver_probe_device+0x0/0x1a4) from [<c01e5a84>] (__driver_attach+0x68/0x8c)
     r7:c79eaf00 r6:c04e24dc r5:c04b4f3c r4:c04b4f08
    [<c01e5a1c>] (__driver_attach+0x0/0x8c) from [<c01e508c>] (bus_for_each_dev+0x50/0x84)
     r7:c79eaf00 r6:c04e24dc r5:c01e5a1c r4:00000000
    [<c01e503c>] (bus_for_each_dev+0x0/0x84) from [<c01e576c>] (driver_attach+0x20/0x28)
     r6:c04e24dc r5:c00083ac r4:c0029088
    [<c01e574c>] (driver_attach+0x0/0x28) from [<c01e495c>] (bus_add_driver+0xb4/0x238)
    [<c01e48a8>] (bus_add_driver+0x0/0x238) from [<c01e5dc4>] (driver_register+0xb0/0x13c)
    [<c01e5d14>] (driver_register+0x0/0x13c) from [<c01e6e9c>] (platform_driver_register+0x4c/0x60)
     r9:00000000 r8:c00201ac r7:00000013 r6:c004b1c0 r5:c00083ac
    r4:c0029088
    [<c01e6e50>] (platform_driver_register+0x0/0x60) from [<c00201c0>] (vpif_init+0x14/0x1c)
    [<c00201ac>] (vpif_init+0x0/0x1c) from [<c0032420>] (do_one_initcall+0xd0/0x1ac)
    [<c0032350>] (do_one_initcall+0x0/0x1ac) from [<c0008448>] (kernel_init+0x9c/0x154)
    [<c00083ac>] (kernel_init+0x0/0x154) from [<c004b1c0>] (do_exit+0x0/0x6e0)
     r5:c00083ac r4:00000000
    Code: e3c2203f e5923004 e2833001 e5823004 (e5902118) 
    ---[ end trace 3e33eb3b39bd21ce ]---
    note: swapper[1] exited with preempt_count 1
    Kernel panic - not syncing: Attempted to kill init!
    Backtrace: 
    [<c0036730>] (dump_backtrace+0x0/0x114) from [<c0394a74>] (dump_stack+0x18/0x1c)
     r7:c7824000 r6:c7824000 r5:00000001 r4:c04e2e50
    [<c0394a5c>] (dump_stack+0x0/0x1c) from [<c0394af0>] (panic+0x78/0x19c)
    [<c0394a78>] (panic+0x0/0x19c) from [<c004b234>] (do_exit+0x74/0x6e0)
     r3:c04bbb04 r2:00000001 r1:c7824110 r0:c044a1e6
    [<c004b1c0>] (do_exit+0x0/0x6e0) from [<c0036b20>] (die+0x2dc/0x31c)
    [<c0036844>] (die+0x0/0x31c) from [<c0038368>] (__do_kernel_fault+0x6c/0x8c)
    [<c00382fc>] (__do_kernel_fault+0x0/0x8c) from [<c0038558>] (do_page_fault+0x1d0/0x1e8)
     r9:c7827dd0 r8:00000005 r7:00000000 r6:04000138 r5:c7824000
    r4:c04b407c
    [<c0038388>] (do_page_fault+0x0/0x1e8) from [<c0038604>] (do_translation_fault+0x24/0xac)
    [<c00385e0>] (do_translation_fault+0x0/0xac) from [<c00322ec>] (do_DataAbort+0x3c/0x9c)
     r7:c7827dd0 r6:00000005 r5:c7827e04 r4:c04b407c
    [<c00322b0>] (do_DataAbort+0x0/0x9c) from [<c0032b2c>] (__dabt_svc+0x4c/0x60)
    Exception stack(0xc7827dd0 to 0xc7827e18)
    7dc0:                                     04000020 c7923800 c7826000 00000001
    7de0: c7923600 c7923800 c04fd274 c79ee400 ffffffed 00000000 c04b98e0 c7827e24
    7e00: c7827e28 c7827e18 c0271500 c00770c0 20000013 ffffffff
     r8:ffffffed r7:c79ee400 r6:c04fd274 r5:c7827e04 r4:ffffffff
    [<c0077094>] (module_put+0x0/0x7c) from [<c0271500>] (v4l2_device_unregister_subdev+0x94/0xac)
    [<c027146c>] (v4l2_device_unregister_subdev+0x0/0xac) from [<c027172c>] (v4l2_device_unregister+0x2c/0x7c)
     r5:c7923800 r4:c7923600
    [<c0271700>] (v4l2_device_unregister+0x0/0x7c) from [<c0020754>] (vpif_probe+0x58c/0x6b8)
     r7:c79ee400 r6:00000002 r5:00000000 r4:c79e06a0
    [<c00201c8>] (vpif_probe+0x0/0x6b8) from [<c01e69f8>] (platform_drv_probe+0x20/0x24)
    [<c01e69d8>] (platform_drv_probe+0x0/0x24) from [<c01e5954>] (driver_probe_device+0xdc/0x1a4)
    [<c01e5878>] (driver_probe_device+0x0/0x1a4) from [<c01e5a84>] (__driver_attach+0x68/0x8c)
     r7:c79eaf00 r6:c04e24dc r5:c04b4f3c r4:c04b4f08
    [<c01e5a1c>] (__driver_attach+0x0/0x8c) from [<c01e508c>] (bus_for_each_dev+0x50/0x84)
     r7:c79eaf00 r6:c04e24dc r5:c01e5a1c r4:00000000
    [<c01e503c>] (bus_for_each_dev+0x0/0x84) from [<c01e576c>] (driver_attach+0x20/0x28)
     r6:c04e24dc r5:c00083ac r4:c0029088
    [<c01e574c>] (driver_attach+0x0/0x28) from [<c01e495c>] (bus_add_driver+0xb4/0x238)
    [<c01e48a8>] (bus_add_driver+0x0/0x238) from [<c01e5dc4>] (driver_register+0xb0/0x13c)
    [<c01e5d14>] (driver_register+0x0/0x13c) from [<c01e6e9c>] (platform_driver_register+0x4c/0x60)
     r9:00000000 r8:c00201ac r7:00000013 r6:c004b1c0 r5:c00083ac
    r4:c0029088
    [<c01e6e50>] (platform_driver_register+0x0/0x60) from [<c00201c0>] (vpif_init+0x14/0x1c)
    [<c00201ac>] (vpif_init+0x0/0x1c) from [<c0032420>] (do_one_initcall+0xd0/0x1ac)
    [<c0032350>] (do_one_initcall+0x0/0x1ac) from [<c0008448>] (kernel_init+0x9c/0x154)
    [<c00083ac>] (kernel_init+0x0/0x154) from [<c004b1c0>] (do_exit+0x0/0x6e0)
     r5:c00083ac r4:00000000
    

        Thanks very much.
    Ouyang,

  • Hi Prabhakar Lad,

          Recently I am focus on add the driver to OMAP_L138. I met some problems, can you provide some about ov7670  hardware design files or infomation  which is implement on  TI platform board.
          Thanks for you help.
    Ouyang,