@@ -2095,6 +2095,33 @@ static int cif_isp10_config_mipi(
20952095 return ret ;
20962096}
20972097
2098+ static u32 calc_burst_len (struct cif_isp10_mi_path_config * config )
2099+ {
2100+ u32 cb_offs = config -> cb_offs ;
2101+ u32 cr_offs = config -> cr_offs ;
2102+ u32 burst ;
2103+
2104+ /* MI64bit Y/C base addr should be burstN * 8 aligned */
2105+ if (!(cb_offs % 128 ) && !(cr_offs % 128 ))
2106+ burst = CIF_MI_CTRL_BURST_LEN_LUM_16 |
2107+ CIF_MI_CTRL_BURST_LEN_CHROM_16 ;
2108+ else if (!(cb_offs % 64 ) && !(cr_offs % 64 ))
2109+ burst = CIF_MI_CTRL_BURST_LEN_LUM_8 |
2110+ CIF_MI_CTRL_BURST_LEN_CHROM_8 ;
2111+ else
2112+ burst = CIF_MI_CTRL_BURST_LEN_LUM_4 |
2113+ CIF_MI_CTRL_BURST_LEN_CHROM_4 ;
2114+
2115+ if (cb_offs % 32 || cr_offs % 32 )
2116+ cif_isp10_pltfrm_pr_warn (dev -> dev ,
2117+ "%s %dx%d not support, should be %d aligned\n" ,
2118+ cif_isp10_pix_fmt_string (config -> output .pix_fmt ),
2119+ config -> output .width ,
2120+ config -> output .height ,
2121+ (cb_offs == cr_offs ) ? 32 : 128 );
2122+ return burst ;
2123+ }
2124+
20982125static int cif_isp10_config_mi_mp (
20992126 struct cif_isp10_device * dev )
21002127{
@@ -2111,6 +2138,7 @@ static int cif_isp10_config_mi_mp(
21112138 u32 bpp = CIF_ISP10_PIX_FMT_GET_BPP (out_pix_fmt );
21122139 u32 size = llength * height * bpp / 8 ;
21132140 u32 mi_ctrl ;
2141+ u32 burst_len ;
21142142
21152143 dev -> config .mi_config .mp .input =
21162144 & dev -> config .mp_config .rsz_config .output ;
@@ -2125,6 +2153,8 @@ static int cif_isp10_config_mi_mp(
21252153 dev -> config .mi_config .mp .y_size = size ;
21262154 dev -> config .mi_config .mp .cb_size = 0 ;
21272155 dev -> config .mi_config .mp .cr_size = 0 ;
2156+ burst_len = CIF_MI_CTRL_BURST_LEN_LUM_16 |
2157+ CIF_MI_CTRL_BURST_LEN_CHROM_16 ;
21282158 if (CIF_ISP10_PIX_FMT_IS_YUV (out_pix_fmt )) {
21292159 u32 num_cplanes =
21302160 CIF_ISP10_PIX_FMT_YUV_GET_NUM_CPLANES (out_pix_fmt );
@@ -2174,6 +2204,7 @@ static int cif_isp10_config_mi_mp(
21742204 dev -> config .mi_config .mp .cb_size ;
21752205 }
21762206 }
2207+ burst_len = calc_burst_len (& dev -> config .mi_config .mp );
21772208 } else if (CIF_ISP10_PIX_FMT_IS_RAW_BAYER (out_pix_fmt )) {
21782209 if (CIF_ISP10_PIX_FMT_GET_BPP (out_pix_fmt ) > 8 ) {
21792210 writeformat = CIF_ISP10_BUFF_FMT_RAW12 ;
@@ -2209,11 +2240,16 @@ static int cif_isp10_config_mi_mp(
22092240 dev -> config .base_addr + CIF_MI_XTD_FORMAT_CTRL );
22102241 }
22112242
2243+ /* check MP/SP burst config */
2244+ dev -> config .mi_config .mp .burst_len = burst_len ;
2245+ burst_len = (dev -> config .mi_config .sp .burst_len >
2246+ dev -> config .mi_config .mp .burst_len ) ?
2247+ dev -> config .mi_config .mp .burst_len :
2248+ dev -> config .mi_config .sp .burst_len ;
22122249 mi_ctrl = cif_ioread32 (dev -> config .base_addr + CIF_MI_CTRL );
22132250 mi_ctrl &= ~(CIF_MI_CTRL_MP_WRITE_FMT (3 ));
22142251 mi_ctrl |= CIF_MI_CTRL_MP_WRITE_FMT (writeformat ) |
2215- CIF_MI_CTRL_BURST_LEN_LUM_16 |
2216- CIF_MI_CTRL_BURST_LEN_CHROM_16 |
2252+ burst_len |
22172253 CIF_MI_CTRL_INIT_BASE_EN |
22182254 CIF_MI_CTRL_INIT_OFFSET_EN |
22192255 CIF_MI_MP_AUTOUPDATE_ENABLE ;
@@ -2429,6 +2465,10 @@ static int cif_isp10_config_mi_sp(
24292465 }
24302466 }
24312467
2468+ if (llength == width &&
2469+ CIF_ISP10_PIX_FMT_IS_YUV (out_pix_fmt ))
2470+ burst_len = calc_burst_len (& dev -> config .mi_config .sp );
2471+
24322472 cif_iowrite32_verify (dev -> config .mi_config .sp .y_size ,
24332473 dev -> config .base_addr + CIF_MI_SP_Y_SIZE_INIT ,
24342474 CIF_MI_ADDR_SIZE_ALIGN_MASK );
@@ -2459,6 +2499,11 @@ static int cif_isp10_config_mi_sp(
24592499 dev -> config .base_addr + CIF_MI_XTD_FORMAT_CTRL );
24602500 }
24612501
2502+ dev -> config .mi_config .sp .burst_len = burst_len ;
2503+ burst_len = (dev -> config .mi_config .sp .burst_len >
2504+ dev -> config .mi_config .mp .burst_len ) ?
2505+ dev -> config .mi_config .mp .burst_len :
2506+ dev -> config .mi_config .sp .burst_len ;
24622507 mi_ctrl = cif_ioread32 (dev -> config .base_addr + CIF_MI_CTRL );
24632508 mi_ctrl &= ~(CIF_MI_CTRL_SP_WRITE_FMT (3 ) |/* SP_WRITE_FMT */
24642509 (0x7 << 28 ) | /* SP_OUTPUT_FMT */
@@ -3510,6 +3555,9 @@ static void cif_isp10_init_stream(
35103555 dev -> config .sp_config .rsz_config .ycflt_adjust = false;
35113556 dev -> config .sp_config .rsz_config .ism_adjust = false;
35123557 dev -> config .mi_config .sp .busy = false;
3558+ dev -> config .mi_config .sp .burst_len =
3559+ CIF_MI_CTRL_BURST_LEN_LUM_16 |
3560+ CIF_MI_CTRL_BURST_LEN_CHROM_16 ;
35133561 dev -> sp_stream .updt_cfg = true;
35143562
35153563 ret = cif_isp10_img_src_select_strm_fmt (dev );
@@ -3545,6 +3593,9 @@ static void cif_isp10_init_stream(
35453593 dev -> config .mp_config .rsz_config .ycflt_adjust = false;
35463594 dev -> config .mp_config .rsz_config .ism_adjust = false;
35473595 dev -> config .mi_config .mp .busy = false;
3596+ dev -> config .mi_config .mp .burst_len =
3597+ CIF_MI_CTRL_BURST_LEN_LUM_16 |
3598+ CIF_MI_CTRL_BURST_LEN_CHROM_16 ;
35483599 dev -> mp_stream .updt_cfg = true;
35493600
35503601 ret = cif_isp10_img_src_select_strm_fmt (dev );
@@ -4713,6 +4764,9 @@ static void cif_isp10_stop_mi(
47134764 dev -> config .base_addr + CIF_MI_ICR );
47144765 cif_iowrite32AND_verify (~CIF_MI_CTRL_SP_ENABLE ,
47154766 dev -> config .base_addr + CIF_MI_CTRL , ~0 );
4767+ dev -> config .mi_config .sp .burst_len =
4768+ CIF_MI_CTRL_BURST_LEN_LUM_16 |
4769+ CIF_MI_CTRL_BURST_LEN_CHROM_16 ;
47164770 } else if (stop_mi_mp ) {
47174771 cif_iowrite32 (CIF_MI_MP_FRAME |
47184772 CIF_JPE_STATUS_ENCODE_DONE ,
@@ -4721,6 +4775,9 @@ static void cif_isp10_stop_mi(
47214775 CIF_MI_CTRL_JPEG_ENABLE |
47224776 CIF_MI_CTRL_RAW_ENABLE ),
47234777 dev -> config .base_addr + CIF_MI_CTRL , ~0 );
4778+ dev -> config .mi_config .mp .burst_len =
4779+ CIF_MI_CTRL_BURST_LEN_LUM_16 |
4780+ CIF_MI_CTRL_BURST_LEN_CHROM_16 ;
47244781 }
47254782}
47264783
0 commit comments