ENABLE MIPI FOR I.MX6 SOLO BOARD

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ENABLE MIPI FOR I.MX6 SOLO BOARD

2,751 Views
dhanaj
Contributor I

Hi all,

          I am working in a imx6 solo wandboard, in that i need to integrate the camera ov5640 with mipi interface, for that i want to done the mux pad settings for camera data, clock, reset and pwdn, can any one tell me how to do that, i am new to this camera and linux drivers

Thanks,

dhana

Labels (2)
0 Kudos
4 Replies

1,030 Views
davemcmordie
Contributor III

Hi,

I believe John Weber's recent kernel release includes a version of arch/arch/mach-mx6/board-wand.c which sets the pads correctly for mipi input from this camera:

https://groups.google.com/d/topic/wandboard/8T9L1LFL0G0/discussion

The relevant snippets are below:

#ifdef CONFIG_IMX_HAVE_PLATFORM_IMX_MIPI_CSI2

/****************************************************************************

*

* MIPI CSI

*

****************************************************************************/

static void wand_mipi_sensor_io_init(void)

{

  struct clk *mipi_csi_mclk;

  int rate;

  IMX6_SETUP_PAD(GPIO_3__CCM_CLKO2);  /* Camera clock */

  IMX6_SETUP_PAD(KEY_COL4__GPIO_4_14);/* Camera reset */

  IMX6_SETUP_PAD(GPIO_6__GPIO_1_6);   /* Camera power down */

  pr_debug("%s\n", __func__);

  gpio_request(WAND_MIPICSI_RESET, "cam-reset");

  gpio_direction_output(WAND_MIPICSI_RESET, 1);

  gpio_request(WAND_MIPICSI_PWN, "cam-pwdn");

  gpio_direction_output(WAND_MIPICSI_PWN, 1);

  /* Master clock for the sensor */

  mipi_csi_mclk = clk_get(NULL, "clko2_clk");

  if (IS_ERR(mipi_csi_mclk)) {

  pr_err("can't get CLKO2 clock.\n");

  return;

  }

  rate = clk_round_rate(mipi_csi_mclk, 24000000);

  clk_set_rate(mipi_csi_mclk, rate);

  clk_enable(mipi_csi_mclk);

  msleep(5);

  /* Power up */

  gpio_set_value(WAND_MIPICSI_PWN, 0);

  msleep(5);

  /* Reset on */

  gpio_set_value(WAND_MIPICSI_RESET, 0);

  msleep(1);

  /* Reset off */

  gpio_set_value(WAND_MIPICSI_RESET, 1);

  msleep(5);

  /* power down */

  gpio_set_value(WAND_MIPICSI_PWN, 1);

  /* For MX6Q:

  * GPR1 bit19 and bit20 meaning:

  * Bit19:       0 - Enable mipi to IPU1 CSI0

  *                      virtual channel is fixed to 0

  *              1 - Enable parallel interface to IPU1 CSI0

  * Bit20:       0 - Enable mipi to IPU2 CSI1

  *                      virtual channel is fixed to 3

  *              1 - Enable parallel interface to IPU2 CSI1

  * IPU1 CSI1 directly connect to mipi csi2,

  *      virtual channel is fixed to 1

  * IPU2 CSI0 directly connect to mipi csi2,

  *      virtual channel is fixed to 2

  *

  * For MX6DL:

  * GPR13 bit 0-2 IPU_CSI0_MUX

  *   000 MIPI_CSI0

  *   100 IPU CSI0

  */

  if (cpu_is_mx6q())

  mxc_iomux_set_gpr_register(1, 19, 1, 0);

  else if (cpu_is_mx6dl())

  mxc_iomux_set_gpr_register(13, 0, 3, 0);

}

static void wand_mipi_powerdown(int powerdown)

{

  pr_debug("%s: powerdown=%d\n", __func__, powerdown);

  if (powerdown)

  gpio_set_value(WAND_MIPICSI_PWN, 1); /* Power off */

  else

  gpio_set_value(WAND_MIPICSI_PWN, 0); /* Power on */

  msleep(2);

}

/* Platform data for CSI sensor driver, passed to driver

   through i2c platform data */

static struct fsl_mxc_camera_platform_data wand_mipi_csi2_data = {

  .mclk = 24000000,

  .mclk_source = 0,

  .csi = 0,

  .io_init = wand_mipi_sensor_io_init,

  .pwdn = wand_mipi_powerdown,

};

/* TODO - reorg code so that adding i2c board info is done all in one

   step at init.  This makes adding I2C devices easier */

static struct i2c_board_info wand_mipi_csi_i2c_board_info[] __initdata = {

  {

  I2C_BOARD_INFO("ov5640_mipi", 0x3C),

  .platform_data = (void *)&wand_mipi_csi2_data,

  },

  {

  I2C_BOARD_INFO("ov5647_mipi", 0x36),

  .platform_data = (void *)&wand_mipi_csi2_data,

  },

};

/* Platform data for MIPI CSI init */

static struct mipi_csi2_platform_data wand_mipi_csi2_platform_data = {

  .ipu_id = 0,

  .csi_id = 0,

  .v_channel = 0,

  .lanes = 2,

  .dphy_clk = "mipi_pllref_clk",

  .pixel_clk = "emi_clk",

};

HTH,

Dave

0 Kudos

1,030 Views
imx6zeng
Contributor I

hi Dave ,

Can you tell me  where can i  download John Weber's recent kernel?


Thanks,

andy zeng

0 Kudos

1,030 Views
davemcmordie
Contributor III

Right here (use wandboard_imx_3.0.35_4.0.0 branch):

johnweber/linux · GitHub

Best,

Dave

0 Kudos

1,030 Views
imx6zeng
Contributor I

Hi Dave

Thank you very much.

Best

Andy

发件人: Dave McMordie

发送时间: 2013年8月28日 20:58

收件人: imx6 zeng

主题: Re: - ENABLE MIPI FOR I.MX6 SOLO BOARD

<https://community.freescale.com/> Freescale Community

ENABLE MIPI FOR I.MX6 SOLO BOARD

reply from Dave <https://community.freescale.com/people/davemcmordie?et=watches.email.thread> McMordie in i.MX Community - View <https://community.freescale.com/message/347182?et=watches.email.thread#347182> the full discussion

0 Kudos