@@ -620,9 +620,11 @@ static int j721e_pcie_probe(struct platform_device *pdev)
620620 gpiod_set_value_cansleep (pcie -> reset_gpio , 1 );
621621 }
622622
623- ret = cdns_pcie_host_setup (rc );
624- if (ret < 0 )
625- goto err_pcie_setup ;
623+ if (IS_ENABLED (CONFIG_PCI_J721E_HOST )) {
624+ ret = cdns_pcie_host_setup (rc );
625+ if (ret < 0 )
626+ goto err_pcie_setup ;
627+ }
626628
627629 break ;
628630 case PCI_MODE_EP :
@@ -632,9 +634,11 @@ static int j721e_pcie_probe(struct platform_device *pdev)
632634 goto err_get_sync ;
633635 }
634636
635- ret = cdns_pcie_ep_setup (ep );
636- if (ret < 0 )
637- goto err_pcie_setup ;
637+ if (IS_ENABLED (CONFIG_PCI_J721E_EP )) {
638+ ret = cdns_pcie_ep_setup (ep );
639+ if (ret < 0 )
640+ goto err_pcie_setup ;
641+ }
638642
639643 break ;
640644 }
@@ -659,10 +663,11 @@ static void j721e_pcie_remove(struct platform_device *pdev)
659663 struct cdns_pcie_ep * ep ;
660664 struct cdns_pcie_rc * rc ;
661665
662- if (pcie -> mode == PCI_MODE_RC ) {
666+ if (IS_ENABLED (CONFIG_PCI_J721E_HOST ) &&
667+ pcie -> mode == PCI_MODE_RC ) {
663668 rc = container_of (cdns_pcie , struct cdns_pcie_rc , pcie );
664669 cdns_pcie_host_disable (rc );
665- } else {
670+ } else if ( IS_ENABLED ( CONFIG_PCI_J721E_EP )) {
666671 ep = container_of (cdns_pcie , struct cdns_pcie_ep , pcie );
667672 cdns_pcie_ep_disable (ep );
668673 }
@@ -728,10 +733,12 @@ static int j721e_pcie_resume_noirq(struct device *dev)
728733 gpiod_set_value_cansleep (pcie -> reset_gpio , 1 );
729734 }
730735
731- ret = cdns_pcie_host_link_setup (rc );
732- if (ret < 0 ) {
733- clk_disable_unprepare (pcie -> refclk );
734- return ret ;
736+ if (IS_ENABLED (CONFIG_PCI_J721E_HOST )) {
737+ ret = cdns_pcie_host_link_setup (rc );
738+ if (ret < 0 ) {
739+ clk_disable_unprepare (pcie -> refclk );
740+ return ret ;
741+ }
735742 }
736743
737744 /*
@@ -741,10 +748,12 @@ static int j721e_pcie_resume_noirq(struct device *dev)
741748 for (enum cdns_pcie_rp_bar bar = RP_BAR0 ; bar <= RP_NO_BAR ; bar ++ )
742749 rc -> avail_ib_bar [bar ] = true;
743750
744- ret = cdns_pcie_host_init (rc );
745- if (ret ) {
746- clk_disable_unprepare (pcie -> refclk );
747- return ret ;
751+ if (IS_ENABLED (CONFIG_PCI_J721E_HOST )) {
752+ ret = cdns_pcie_host_init (rc );
753+ if (ret ) {
754+ clk_disable_unprepare (pcie -> refclk );
755+ return ret ;
756+ }
748757 }
749758 }
750759
0 commit comments