void ipu_dump() { ipu_dump_registers(); printk(KERN_INFO "IPU_INT_STAT_1 = \t0x%08X\n", __raw_readl(IPU_STAT)); printk(KERN_INFO "IPU_INT_CTRL_1 = \t0x%08X\n", __raw_readl(IPU_INT_CTRL(1))); printk(KERN_INFO "IPU_INT_CTRL_2 = \t0x%08X\n", __raw_readl(IPU_INT_CTRL(2))); printk(KERN_INFO "IPU_INT_CTRL_3 = \t0x%08X\n", __raw_readl(IPU_INT_CTRL(3))); printk(KERN_INFO "IPU_INT_CTRL_4 = \t0x%08X\n", __raw_readl(IPU_INT_CTRL(4))); printk(KERN_INFO "IPU_INT_CTRL_5 = \t0x%08X\n", __raw_readl(IPU_INT_CTRL(5))); printk(KERN_INFO "IPU_INT_CTRL_6 = \t0x%08X\n", __raw_readl(IPU_INT_CTRL(6))); printk(KERN_INFO "IPU_INT_CTRL_7 = \t0x%08X\n", __raw_readl(IPU_INT_CTRL(7))); printk(KERN_INFO "IPU_INT_CTRL_8 = \t0x%08X\n", __raw_readl(IPU_INT_CTRL(8))); printk(KERN_INFO "IPU_INT_CTRL_9 = \t0x%08X\n", __raw_readl(IPU_INT_CTRL(9))); printk(KERN_INFO "IPU_INT_CTRL_10 = \t0x%08X\n", __raw_readl(IPU_INT_CTRL(10))); printk(KERN_INFO "IPU_INT_CTRL_11 = \t0x%08X\n", __raw_readl(IPU_INT_CTRL(11))); printk(KERN_INFO "IPU_INT_CTRL_12 = \t0x%08X\n", __raw_readl(IPU_INT_CTRL(12))); printk(KERN_INFO "IPU_INT_CTRL_13 = \t0x%08X\n", __raw_readl(IPU_INT_CTRL(13))); printk(KERN_INFO "IPU_INT_CTRL_14 = \t0x%08X\n", __raw_readl(IPU_INT_CTRL(14))); printk(KERN_INFO "IPU_INT_CTRL_15 = \t0x%08X\n", __raw_readl(IPU_INT_CTRL(15))); printk(KERN_INFO "IPU_INT_STAT_1 = \t0x%08X\n", __raw_readl(IPU_INT_STAT(1))); printk(KERN_INFO "IPU_INT_STAT_2 = \t0x%08X\n", __raw_readl(IPU_INT_STAT(2))); printk(KERN_INFO "IPU_INT_STAT_3 = \t0x%08X\n", __raw_readl(IPU_INT_STAT(3))); printk(KERN_INFO "IPU_INT_STAT_4 = \t0x%08X\n", __raw_readl(IPU_INT_STAT(4))); printk(KERN_INFO "IPU_INT_STAT_5 = \t0x%08X\n", __raw_readl(IPU_INT_STAT(5))); printk(KERN_INFO "IPU_INT_STAT_6 = \t0x%08X\n", __raw_readl(IPU_INT_STAT(6))); printk(KERN_INFO "IPU_INT_STAT_7 = \t0x%08X\n", __raw_readl(IPU_INT_STAT(7))); printk(KERN_INFO "IPU_INT_STAT_8 = \t0x%08X\n", __raw_readl(IPU_INT_STAT(8))); printk(KERN_INFO "IPU_INT_STAT_9 = \t0x%08X\n", __raw_readl(IPU_INT_STAT(9))); printk(KERN_INFO "IPU_INT_STAT_10 = \t0x%08X\n", __raw_readl(IPU_INT_STAT(10))); printk(KERN_INFO "IPU_INT_STAT_11 = \t0x%08X\n", __raw_readl(IPU_INT_STAT(11))); printk(KERN_INFO "IPU_INT_STAT_12 = \t0x%08X\n", __raw_readl(IPU_INT_STAT(12))); printk(KERN_INFO "IPU_INT_STAT_13 = \t0x%08X\n", __raw_readl(IPU_INT_STAT(13))); printk(KERN_INFO "IPU_INT_STAT_14 = \t0x%08X\n", __raw_readl(IPU_INT_STAT(14))); printk(KERN_INFO "IPU_INT_STAT_15 = \t0x%08X\n", __raw_readl(IPU_INT_STAT(15))); printk(KERN_INFO "IPU_CHA_BUF0_RDY(27) = \t0x%08X\n", __raw_readl(IPU_CHA_BUF0_RDY(27))); printk(KERN_INFO "IPU_CHA_BUF0_RDY(23) = \t0x%08X\n", __raw_readl(IPU_CHA_BUF0_RDY(23))); printk(KERN_INFO "IPU_CHA_CUR_BUF(27) = \t0x%08X\n", __raw_readl(IPU_CHA_CUR_BUF(27))); printk(KERN_INFO "IDMAC_CH_BUSY1(27) = \t0x%08X\n", __raw_readl(IDMAC_CH_BUSY1)); ipu_ch_param_dump(23); ipu_ch_param_dump(27); ipu_ch_param_dump(15); ipu_ch_param_dump(20); ipu_ch_param_dump(0); }
/* * This function is called by the driver framework to initialize the IPU * hardware. * * @param dev The device structure for the IPU passed in by the * driver framework. * * @return Returns 0 on success or negative error code on error */ int ipu_probe(void) { unsigned long ipu_base; #if defined CONFIG_MX51 u32 temp; u32 *reg_hsc_mcd = (u32 *)MIPI_HSC_BASE_ADDR; u32 *reg_hsc_mxt_conf = (u32 *)(MIPI_HSC_BASE_ADDR + 0x800); __raw_writel(0xF00, reg_hsc_mcd); /* CSI mode reserved*/ temp = __raw_readl(reg_hsc_mxt_conf); __raw_writel(temp | 0x0FF, reg_hsc_mxt_conf); temp = __raw_readl(reg_hsc_mxt_conf); __raw_writel(temp | 0x10000, reg_hsc_mxt_conf); #endif ipu_base = IPU_CTRL_BASE_ADDR; ipu_cpmem_base = (u32 *)(ipu_base + IPU_CPMEM_REG_BASE); ipu_dc_tmpl_reg = (u32 *)(ipu_base + IPU_DC_TMPL_REG_BASE); g_pixel_clk[0] = &pixel_clk[0]; g_pixel_clk[1] = &pixel_clk[1]; g_ipu_clk = &ipu_clk; debug("ipu_clk = %u\n", clk_get_rate(g_ipu_clk)); g_ldb_clk = &ldb_clk; debug("ldb_clk = %u\n", clk_get_rate(g_ldb_clk)); ipu_reset(); clk_set_parent(g_pixel_clk[0], g_ipu_clk); clk_set_parent(g_pixel_clk[1], g_ipu_clk); clk_enable(g_ipu_clk); g_di_clk[0] = NULL; g_di_clk[1] = NULL; __raw_writel(0x807FFFFF, IPU_MEM_RST); while (__raw_readl(IPU_MEM_RST) & 0x80000000) ; ipu_init_dc_mappings(); __raw_writel(0, IPU_INT_CTRL(5)); __raw_writel(0, IPU_INT_CTRL(6)); __raw_writel(0, IPU_INT_CTRL(9)); __raw_writel(0, IPU_INT_CTRL(10)); /* DMFC Init */ ipu_dmfc_init(DMFC_NORMAL, 1); /* Set sync refresh channels as high priority */ __raw_writel(0x18800000L, IDMAC_CHA_PRI(0)); /* Set MCU_T to divide MCU access window into 2 */ __raw_writel(0x00400000L | (IPU_MCU_T_DEFAULT << 18), IPU_DISP_GEN); clk_disable(g_ipu_clk); return 0; }
/* * This function is called by the driver framework to initialize the IPU * hardware. * * @param dev The device structure for the IPU passed in by the * driver framework. * * @return Returns 0 on success or negative error code on error */ int ipu_probe(int di, ipu_di_clk_parent_t di_clk_parent, int di_clk_val) { unsigned long ipu_base; #if defined(CONFIG_MXC_HSC) u32 temp; u32 *reg_hsc_mcd = (u32 *)MIPI_HSC_BASE_ADDR; u32 *reg_hsc_mxt_conf = (u32 *)(MIPI_HSC_BASE_ADDR + 0x800); __raw_writel(0xF00, reg_hsc_mcd); /* CSI mode reserved*/ temp = __raw_readl(reg_hsc_mxt_conf); __raw_writel(temp | 0x0FF, reg_hsc_mxt_conf); temp = __raw_readl(reg_hsc_mxt_conf); __raw_writel(temp | 0x10000, reg_hsc_mxt_conf); #endif ipu_base = IPU_CTRL_BASE_ADDR; ipu_cpmem_base = (u32 *)(ipu_base + IPU_CPMEM_REG_BASE); ipu_dc_tmpl_reg = (u32 *)(ipu_base + IPU_DC_TMPL_REG_BASE); ipu_csi_reg[0] = (u32 *)(ipu_base + IPU_CSI0_REG_BASE); ipu_csi_reg[1] = (u32 *)(ipu_base + IPU_CSI1_REG_BASE); ipu_smfc_reg = (u32 *)(ipu_base + IPU_SMFC_REG_BASE); ipu_ic_reg = (u32*)(ipu_base + IPU_IC_REG_BASE); g_pixel_clk[0] = &pixel_clk[0]; g_pixel_clk[1] = &pixel_clk[1]; g_di_clk[0] = &di_clk[0]; g_di_clk[1] = &di_clk[1]; g_di_clk[di]->rate = di_clk_val; g_ipu_clk = &ipu_clk; //printf("ipu_clk = %u\n", clk_get_rate(g_ipu_clk)); ipu_reset(); if (di_clk_parent == DI_PCLK_LDB) { clk_set_parent(g_pixel_clk[di], g_di_clk[di]); } else { clk_set_parent(g_pixel_clk[0], g_ipu_clk); // clk_set_parent(g_pixel_clk[1], g_ipu_clk); } clk_enable(g_ipu_clk); __raw_writel(0x807FFFFF, IPU_MEM_RST); while (__raw_readl(IPU_MEM_RST) & 0x80000000) ; ipu_init_dc_mappings(); __raw_writel(0, IPU_INT_CTRL(5)); __raw_writel(0, IPU_INT_CTRL(6)); __raw_writel(0, IPU_INT_CTRL(9)); __raw_writel(0, IPU_INT_CTRL(10)); /* DMFC Init */ ipu_dmfc_init(DMFC_NORMAL, 1); /* Set sync refresh channels as high priority */ __raw_writel(0x18900000L, IDMAC_CHA_PRI(0)); /* Set MCU_T to divide MCU access window into 2 */ __raw_writel(0x00400000L | (IPU_MCU_T_DEFAULT << 18), IPU_DISP_GEN); clk_disable(g_ipu_clk); return 0; }