@@ -880,7 +880,17 @@ static struct dw_edma_plat_ops dw_pcie_edma_ops = {
880
880
.irq_vector = dw_pcie_edma_irq_vector ,
881
881
};
882
882
883
- static int dw_pcie_edma_find_chip (struct dw_pcie * pci )
883
+ static void dw_pcie_edma_init_data (struct dw_pcie * pci )
884
+ {
885
+ pci -> edma .dev = pci -> dev ;
886
+
887
+ if (!pci -> edma .ops )
888
+ pci -> edma .ops = & dw_pcie_edma_ops ;
889
+
890
+ pci -> edma .flags |= DW_EDMA_CHIP_LOCAL ;
891
+ }
892
+
893
+ static int dw_pcie_edma_find_mf (struct dw_pcie * pci )
884
894
{
885
895
u32 val ;
886
896
@@ -902,8 +912,6 @@ static int dw_pcie_edma_find_chip(struct dw_pcie *pci)
902
912
903
913
if (val == 0xFFFFFFFF && pci -> edma .reg_base ) {
904
914
pci -> edma .mf = EDMA_MF_EDMA_UNROLL ;
905
-
906
- val = dw_pcie_readl_dma (pci , PCIE_DMA_CTRL );
907
915
} else if (val != 0xFFFFFFFF ) {
908
916
pci -> edma .mf = EDMA_MF_EDMA_LEGACY ;
909
917
@@ -912,12 +920,14 @@ static int dw_pcie_edma_find_chip(struct dw_pcie *pci)
912
920
return - ENODEV ;
913
921
}
914
922
915
- pci -> edma .dev = pci -> dev ;
923
+ return 0 ;
924
+ }
916
925
917
- if (!pci -> edma .ops )
918
- pci -> edma .ops = & dw_pcie_edma_ops ;
926
+ static int dw_pcie_edma_find_channels (struct dw_pcie * pci )
927
+ {
928
+ u32 val ;
919
929
920
- pci -> edma . flags |= DW_EDMA_CHIP_LOCAL ;
930
+ val = dw_pcie_readl_dma ( pci , PCIE_DMA_CTRL ) ;
921
931
922
932
pci -> edma .ll_wr_cnt = FIELD_GET (PCIE_DMA_NUM_WR_CHAN , val );
923
933
pci -> edma .ll_rd_cnt = FIELD_GET (PCIE_DMA_NUM_RD_CHAN , val );
@@ -930,6 +940,19 @@ static int dw_pcie_edma_find_chip(struct dw_pcie *pci)
930
940
return 0 ;
931
941
}
932
942
943
+ static int dw_pcie_edma_find_chip (struct dw_pcie * pci )
944
+ {
945
+ int ret ;
946
+
947
+ dw_pcie_edma_init_data (pci );
948
+
949
+ ret = dw_pcie_edma_find_mf (pci );
950
+ if (ret )
951
+ return ret ;
952
+
953
+ return dw_pcie_edma_find_channels (pci );
954
+ }
955
+
933
956
static int dw_pcie_edma_irq_verify (struct dw_pcie * pci )
934
957
{
935
958
struct platform_device * pdev = to_platform_device (pci -> dev );
0 commit comments