@@ -887,10 +887,25 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
887
887
static void a6xx_set_ubwc_config (struct msm_gpu * gpu )
888
888
{
889
889
struct adreno_gpu * adreno_gpu = to_adreno_gpu (gpu );
890
- u32 lower_bit = 2 ;
891
- u32 amsbc = 0 ;
890
+ /* Unknown, introduced with A650 family, related to UBWC mode/ver 4 */
892
891
u32 rgb565_predicator = 0 ;
892
+ /* Unknown, introduced with A650 family */
893
893
u32 uavflagprd_inv = 0 ;
894
+ /* Whether the minimum access length is 64 bits */
895
+ u32 min_acc_len = 0 ;
896
+ /* Entirely magic, per-GPU-gen value */
897
+ u32 ubwc_mode = 0 ;
898
+ /*
899
+ * The Highest Bank Bit value represents the bit of the highest DDR bank.
900
+ * We then subtract 13 from it (13 is the minimum value allowed by hw) and
901
+ * write the lowest two bits of the remaining value as hbb_lo and the
902
+ * one above it as hbb_hi to the hardware. This should ideally use DRAM
903
+ * type detection.
904
+ */
905
+ u32 hbb_hi = 0 ;
906
+ u32 hbb_lo = 2 ;
907
+ /* Unknown, introduced with A640/680 */
908
+ u32 amsbc = 0 ;
894
909
895
910
/* a618 is using the hw default values */
896
911
if (adreno_is_a618 (adreno_gpu ))
@@ -901,32 +916,38 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
901
916
902
917
if (adreno_is_a650 (adreno_gpu ) || adreno_is_a660 (adreno_gpu )) {
903
918
/* TODO: get ddr type from bootloader and use 2 for LPDDR4 */
904
- lower_bit = 3 ;
919
+ hbb_lo = 3 ;
905
920
amsbc = 1 ;
906
921
rgb565_predicator = 1 ;
907
922
uavflagprd_inv = 2 ;
908
923
}
909
924
910
925
if (adreno_is_a690 (adreno_gpu )) {
911
- lower_bit = 2 ;
926
+ hbb_lo = 2 ;
912
927
amsbc = 1 ;
913
928
rgb565_predicator = 1 ;
914
929
uavflagprd_inv = 2 ;
915
930
}
916
931
917
932
if (adreno_is_7c3 (adreno_gpu )) {
918
- lower_bit = 1 ;
933
+ hbb_lo = 1 ;
919
934
amsbc = 1 ;
920
935
rgb565_predicator = 1 ;
921
936
uavflagprd_inv = 2 ;
922
937
}
923
938
924
939
gpu_write (gpu , REG_A6XX_RB_NC_MODE_CNTL ,
925
- rgb565_predicator << 11 | amsbc << 4 | lower_bit << 1 );
926
- gpu_write (gpu , REG_A6XX_TPL1_NC_MODE_CNTL , lower_bit << 1 );
927
- gpu_write (gpu , REG_A6XX_SP_NC_MODE_CNTL ,
928
- uavflagprd_inv << 4 | lower_bit << 1 );
929
- gpu_write (gpu , REG_A6XX_UCHE_MODE_CNTL , lower_bit << 21 );
940
+ rgb565_predicator << 11 | hbb_hi << 10 | amsbc << 4 |
941
+ min_acc_len << 3 | hbb_lo << 1 | ubwc_mode );
942
+
943
+ gpu_write (gpu , REG_A6XX_TPL1_NC_MODE_CNTL , hbb_hi << 4 |
944
+ min_acc_len << 3 | hbb_lo << 1 | ubwc_mode );
945
+
946
+ gpu_write (gpu , REG_A6XX_SP_NC_MODE_CNTL , hbb_hi << 10 |
947
+ uavflagprd_inv << 4 | min_acc_len << 3 |
948
+ hbb_lo << 1 | ubwc_mode );
949
+
950
+ gpu_write (gpu , REG_A6XX_UCHE_MODE_CNTL , min_acc_len << 23 | hbb_lo << 21 );
930
951
}
931
952
932
953
static int a6xx_cp_init (struct msm_gpu * gpu )
0 commit comments