summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVidya Sagar <vidyas@nvidia.com>2020-01-31 08:16:26 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2020-02-04 17:55:55 -0500
commitcf09fec01be5d52bc857d2cc446cdb33534dcb01 (patch)
tree8d95ac9a2ca07a21ce4566bd62a8739e3172baf9
parent3170a8a784529a4ecfb1e50e92f1281341bf6fbe (diff)
PCI: tegra: Fix bandwidth setting in EP mode
Refactor code to set the EMC bandwidth request based on link speed and width as the first thing once the BME is set by the host. Having the other part of the code as the first thing i.e. sending LTR message to the host has a check where it just returns if ASPM is not enabled in the EP system and this is causing the EMC bandwidth request code to get skipped. Bug 200587858 Change-Id: I22469c4da5197a2474c4ea45e8b27c8991ddbdb8 Signed-off-by: Vidya Sagar <vidyas@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2288242 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
-rw-r--r--drivers/pci/dwc/pcie-tegra.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/pci/dwc/pcie-tegra.c b/drivers/pci/dwc/pcie-tegra.c
index a1dcfb194..6f3919f85 100644
--- a/drivers/pci/dwc/pcie-tegra.c
+++ b/drivers/pci/dwc/pcie-tegra.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2017 - 2019, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017 - 2020, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -3765,6 +3765,21 @@ static void pex_ep_event_bme_change(struct tegra_pcie_dw *pcie)
3765 u32 val = 0, width = 0, speed = 0; 3765 u32 val = 0, width = 0, speed = 0;
3766 unsigned long freq; 3766 unsigned long freq;
3767 3767
3768 /* Make EMC FLOOR freq request based on link width and speed */
3769 val = readl(pci->dbi_base + CFG_LINK_STATUS_CONTROL);
3770 width = ((val >> 16) & PCI_EXP_LNKSTA_NLW) >> 4;
3771 width = find_first_bit((const unsigned long *)&width,
3772 sizeof(width));
3773 speed = ((val >> 16) & PCI_EXP_LNKSTA_CLS);
3774 freq = pcie->dvfs_tbl[width][speed - 1];
3775 dev_dbg(pcie->dev, "EMC Freq requested = %lu\n", freq);
3776
3777 if (tegra_bwmgr_set_emc(pcie->emc_bw, freq, TEGRA_BWMGR_SET_EMC_FLOOR))
3778 dev_err(pcie->dev, "can't set emc clock[%lu]\n", freq);
3779
3780 speed = ((val >> 16) & PCI_EXP_LNKSTA_CLS);
3781 clk_set_rate(pcie->core_clk, pcie_gen_freq[speed - 1]);
3782
3768 /* If EP doesn't advertise L1SS, just return */ 3783 /* If EP doesn't advertise L1SS, just return */
3769 val = readl(pci->dbi_base + pcie->cfg_link_cap_l1sub); 3784 val = readl(pci->dbi_base + pcie->cfg_link_cap_l1sub);
3770 if (!(val & (PCI_L1SS_CAP_ASPM_L1_1 | PCI_L1SS_CAP_ASPM_L1_2))) 3785 if (!(val & (PCI_L1SS_CAP_ASPM_L1_1 | PCI_L1SS_CAP_ASPM_L1_2)))
@@ -3796,21 +3811,6 @@ static void pex_ep_event_bme_change(struct tegra_pcie_dw *pcie)
3796 if (val & APPL_LTR_MSG_2_LTR_MSG_REQ_STATE) 3811 if (val & APPL_LTR_MSG_2_LTR_MSG_REQ_STATE)
3797 dev_err(pcie->dev, "LTR_MSG sending failed\n"); 3812 dev_err(pcie->dev, "LTR_MSG sending failed\n");
3798 } 3813 }
3799
3800 /* Make EMC FLOOR freq request based on link width and speed */
3801 val = readl(pci->dbi_base + CFG_LINK_STATUS_CONTROL);
3802 width = ((val >> 16) & PCI_EXP_LNKSTA_NLW) >> 4;
3803 width = find_first_bit((const unsigned long *)&width,
3804 sizeof(width));
3805 speed = ((val >> 16) & PCI_EXP_LNKSTA_CLS);
3806 freq = pcie->dvfs_tbl[width][speed - 1];
3807 dev_dbg(pcie->dev, "EMC Freq requested = %lu\n", freq);
3808
3809 if (tegra_bwmgr_set_emc(pcie->emc_bw, freq, TEGRA_BWMGR_SET_EMC_FLOOR))
3810 dev_err(pcie->dev, "can't set emc clock[%lu]\n", freq);
3811
3812 speed = ((val >> 16) & PCI_EXP_LNKSTA_CLS);
3813 clk_set_rate(pcie->core_clk, pcie_gen_freq[speed - 1]);
3814} 3814}
3815 3815
3816static int pcie_ep_work_thread(void *p) 3816static int pcie_ep_work_thread(void *p)