@@ -2145,12 +2145,18 @@ static int tegra_pcie_dw_remove(struct platform_device *pdev)
2145
2145
{
2146
2146
struct tegra_pcie_dw * pcie = platform_get_drvdata (pdev );
2147
2147
2148
- if (!pcie -> link_state )
2149
- return 0 ;
2148
+ if (pcie -> mode == DW_PCIE_RC_TYPE ) {
2149
+ if (!pcie -> link_state )
2150
+ return 0 ;
2151
+
2152
+ debugfs_remove_recursive (pcie -> debugfs );
2153
+ tegra_pcie_deinit_controller (pcie );
2154
+ pm_runtime_put_sync (pcie -> dev );
2155
+ } else {
2156
+ disable_irq (pcie -> pex_rst_irq );
2157
+ pex_ep_event_pex_rst_assert (pcie );
2158
+ }
2150
2159
2151
- debugfs_remove_recursive (pcie -> debugfs );
2152
- tegra_pcie_deinit_controller (pcie );
2153
- pm_runtime_put_sync (pcie -> dev );
2154
2160
pm_runtime_disable (pcie -> dev );
2155
2161
tegra_bpmp_put (pcie -> bpmp );
2156
2162
if (pcie -> pex_refclk_sel_gpiod )
@@ -2164,6 +2170,11 @@ static int tegra_pcie_dw_suspend_late(struct device *dev)
2164
2170
struct tegra_pcie_dw * pcie = dev_get_drvdata (dev );
2165
2171
u32 val ;
2166
2172
2173
+ if (pcie -> mode == DW_PCIE_EP_TYPE ) {
2174
+ dev_err (dev , "Failed to Suspend as Tegra PCIe is in EP mode\n" );
2175
+ return - EPERM ;
2176
+ }
2177
+
2167
2178
if (!pcie -> link_state )
2168
2179
return 0 ;
2169
2180
@@ -2251,18 +2262,24 @@ static void tegra_pcie_dw_shutdown(struct platform_device *pdev)
2251
2262
{
2252
2263
struct tegra_pcie_dw * pcie = platform_get_drvdata (pdev );
2253
2264
2254
- if (!pcie -> link_state )
2255
- return ;
2265
+ if (pcie -> mode == DW_PCIE_RC_TYPE ) {
2266
+ if (!pcie -> link_state )
2267
+ return ;
2256
2268
2257
- debugfs_remove_recursive (pcie -> debugfs );
2258
- tegra_pcie_downstream_dev_to_D0 (pcie );
2269
+ debugfs_remove_recursive (pcie -> debugfs );
2270
+ tegra_pcie_downstream_dev_to_D0 (pcie );
2259
2271
2260
- disable_irq (pcie -> pci .pp .irq );
2261
- if (IS_ENABLED (CONFIG_PCI_MSI ))
2262
- disable_irq (pcie -> pci .pp .msi_irq );
2272
+ disable_irq (pcie -> pci .pp .irq );
2273
+ if (IS_ENABLED (CONFIG_PCI_MSI ))
2274
+ disable_irq (pcie -> pci .pp .msi_irq );
2263
2275
2264
- tegra_pcie_dw_pme_turnoff (pcie );
2265
- tegra_pcie_unconfig_controller (pcie );
2276
+ tegra_pcie_dw_pme_turnoff (pcie );
2277
+ tegra_pcie_unconfig_controller (pcie );
2278
+ pm_runtime_put_sync (pcie -> dev );
2279
+ } else {
2280
+ disable_irq (pcie -> pex_rst_irq );
2281
+ pex_ep_event_pex_rst_assert (pcie );
2282
+ }
2266
2283
}
2267
2284
2268
2285
static const struct tegra_pcie_dw_of_data tegra_pcie_dw_rc_of_data = {
0 commit comments