@@ -3026,24 +3026,54 @@ static void rtw89_pci_declaim_device(struct rtw89_dev *rtwdev,
3026
3026
pci_disable_device (pdev );
3027
3027
}
3028
3028
3029
- static void rtw89_pci_cfg_dac (struct rtw89_dev * rtwdev )
3029
+ static bool rtw89_pci_chip_is_manual_dac (struct rtw89_dev * rtwdev )
3030
3030
{
3031
- struct rtw89_pci * rtwpci = (struct rtw89_pci * )rtwdev -> priv ;
3032
3031
const struct rtw89_chip_info * chip = rtwdev -> chip ;
3033
3032
3034
- if (!rtwpci -> enable_dac )
3035
- return ;
3036
-
3037
3033
switch (chip -> chip_id ) {
3038
3034
case RTL8852A :
3039
3035
case RTL8852B :
3040
3036
case RTL8851B :
3041
3037
case RTL8852BT :
3042
- break ;
3038
+ return true ;
3043
3039
default :
3044
- return ;
3040
+ return false;
3041
+ }
3042
+ }
3043
+
3044
+ static bool rtw89_pci_is_dac_compatible_bridge (struct rtw89_dev * rtwdev )
3045
+ {
3046
+ struct rtw89_pci * rtwpci = (struct rtw89_pci * )rtwdev -> priv ;
3047
+ struct pci_dev * bridge = pci_upstream_bridge (rtwpci -> pdev );
3048
+
3049
+ if (!rtw89_pci_chip_is_manual_dac (rtwdev ))
3050
+ return true;
3051
+
3052
+ if (!bridge )
3053
+ return false;
3054
+
3055
+ switch (bridge -> vendor ) {
3056
+ case PCI_VENDOR_ID_INTEL :
3057
+ return true;
3058
+ case PCI_VENDOR_ID_ASMEDIA :
3059
+ if (bridge -> device == 0x2806 )
3060
+ return true;
3061
+ break ;
3045
3062
}
3046
3063
3064
+ return false;
3065
+ }
3066
+
3067
+ static void rtw89_pci_cfg_dac (struct rtw89_dev * rtwdev )
3068
+ {
3069
+ struct rtw89_pci * rtwpci = (struct rtw89_pci * )rtwdev -> priv ;
3070
+
3071
+ if (!rtwpci -> enable_dac )
3072
+ return ;
3073
+
3074
+ if (!rtw89_pci_chip_is_manual_dac (rtwdev ))
3075
+ return ;
3076
+
3047
3077
rtw89_pci_config_byte_set (rtwdev , RTW89_PCIE_L1_CTRL , RTW89_PCIE_BIT_EN_64BITS );
3048
3078
}
3049
3079
@@ -3061,6 +3091,9 @@ static int rtw89_pci_setup_mapping(struct rtw89_dev *rtwdev,
3061
3091
goto err ;
3062
3092
}
3063
3093
3094
+ if (!rtw89_pci_is_dac_compatible_bridge (rtwdev ))
3095
+ goto no_dac ;
3096
+
3064
3097
ret = dma_set_mask_and_coherent (& pdev -> dev , DMA_BIT_MASK (36 ));
3065
3098
if (!ret ) {
3066
3099
rtwpci -> enable_dac = true;
@@ -3073,6 +3106,7 @@ static int rtw89_pci_setup_mapping(struct rtw89_dev *rtwdev,
3073
3106
goto err_release_regions ;
3074
3107
}
3075
3108
}
3109
+ no_dac :
3076
3110
3077
3111
resource_len = pci_resource_len (pdev , bar_id );
3078
3112
rtwpci -> mmap = pci_iomap (pdev , bar_id , resource_len );
0 commit comments