Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad691d67 authored by Gauri Joshi's avatar Gauri Joshi
Browse files

msm: ep-pcie: Add support to vote and scale MX rail



Chipsets which have PCIe Gen4 PHY and controller on MX rail
requires explicit vote for higher corners than the default.
Therefore add support to vote for and scale MX rail based on the
Gen speed which PCIe link operates at.

Change-Id: I6aa595aa6e3955ff09d8eeae604431b47a14985a
Signed-off-by: default avatarGauri Joshi <gaurjosh@codeaurora.org>
parent 9a551ddf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@
#define MAX_IATU_ENTRY_NUM 2

#define EP_PCIE_LOG_PAGES 50
#define EP_PCIE_MAX_VREG 3
#define EP_PCIE_MAX_VREG 4
#define EP_PCIE_MAX_CLK 10
#define EP_PCIE_MAX_PIPE_CLK 1
#define EP_PCIE_MAX_RESET 2
+17 −2
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
 * MSM PCIe endpoint core driver.
 */

#include <dt-bindings/regulator/qcom,rpmh-regulator-levels.h>
#include <linux/module.h>
#include <linux/bitops.h>
#include <linux/clk.h>
@@ -54,7 +55,8 @@ struct ep_pcie_dev_t ep_pcie_dev = {0};
static struct ep_pcie_vreg_info_t ep_pcie_vreg_info[EP_PCIE_MAX_VREG] = {
	{NULL, "vreg-1p8", 1200000, 1200000, 3000, true},
	{NULL, "vreg-0p9", 912000, 912000, 132000, true},
	{NULL, "vreg-cx", 0, 0, 0, false}
	{NULL, "vreg-cx", 0, 0, 0, false},
	{NULL, "vreg-mx", 0, 0, 0, false}
};

static struct ep_pcie_gpio_info_t ep_pcie_gpio_info[EP_PCIE_MAX_GPIO] = {
@@ -311,8 +313,15 @@ static int ep_pcie_vreg_init(struct ep_pcie_dev_t *dev)
		while (i--) {
			struct regulator *hdl = dev->vreg[i].hdl;

			if (hdl)
			if (hdl) {
				regulator_disable(hdl);
				if (!strcmp(dev->vreg[i].name, "vreg-mx")) {
					EP_PCIE_DBG(dev, "PCIe V%d: Removing vote for %s.\n",
						dev->rev, dev->vreg[i].name);
					regulator_set_voltage(hdl, RPMH_REGULATOR_LEVEL_RETENTION,
						RPMH_REGULATOR_LEVEL_MAX);
				}
			}
		}

	return rc;
@@ -329,6 +338,12 @@ static void ep_pcie_vreg_deinit(struct ep_pcie_dev_t *dev)
			EP_PCIE_DBG(dev, "Vreg %s is being disabled\n",
				dev->vreg[i].name);
			regulator_disable(dev->vreg[i].hdl);
			if (!strcmp(dev->vreg[i].name, "vreg-mx")) {
				EP_PCIE_DBG(dev, "PCIe V%d: Removing vote for %s.\n",
					 dev->rev, dev->vreg[i].name);
				regulator_set_voltage(dev->vreg[i].hdl,
					RPMH_REGULATOR_LEVEL_RETENTION, RPMH_REGULATOR_LEVEL_MAX);
			}
		}
	}
}