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

Commit 4df3496e authored by Yan He's avatar Yan He
Browse files

msm: ep_pcie: add the support of MDM2AP GPIO



Add the support of MDM2AP GPIO so that MDM can notify AP about
updated status.

Change-Id: Ia5a020898d4d04dcd4fec6b3928aba380663ac56
Signed-off-by: default avatarYan He <yanhe@codeaurora.org>
parent 22772af9
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -45,6 +45,7 @@ Optional Properties:
  - qcom,pcie-active-config: boolean type; active configuration of PCIe
  - qcom,pcie-active-config: boolean type; active configuration of PCIe
    addressing.
    addressing.
  - qcom,pcie-aggregated-irq: boolean type; interrupts are aggregated.
  - qcom,pcie-aggregated-irq: boolean type; interrupts are aggregated.
  - mdm2apstatus-gpio: GPIO used by PCIe endpoint side to notify the host side.
  - Refer to "Documentation/devicetree/bindings/arm/msm/msm_bus.txt" for
  - Refer to "Documentation/devicetree/bindings/arm/msm/msm_bus.txt" for
    below optional properties:
    below optional properties:
	- qcom,msm-bus,name
	- qcom,msm-bus,name
@@ -83,6 +84,7 @@ Example:
		perst-gpio = <&msmgpio 65 0>;
		perst-gpio = <&msmgpio 65 0>;
		wake-gpio = <&msmgpio 61 0>;
		wake-gpio = <&msmgpio 61 0>;
		clkreq-gpio = <&msmgpio 64 0>;
		clkreq-gpio = <&msmgpio 64 0>;
		mdm2apstatus-gpio = <&tlmm_pinmux 16 0>;


		gdsc-vdd-supply = <&gdsc_pcie_0>;
		gdsc-vdd-supply = <&gdsc_pcie_0>;
		vreg-1.8-supply = <&pmd9635_l8>;
		vreg-1.8-supply = <&pmd9635_l8>;
+1 −0
Original line number Original line Diff line number Diff line
@@ -212,6 +212,7 @@ enum ep_pcie_gpio {
	EP_PCIE_GPIO_PERST,
	EP_PCIE_GPIO_PERST,
	EP_PCIE_GPIO_WAKE,
	EP_PCIE_GPIO_WAKE,
	EP_PCIE_GPIO_CLKREQ,
	EP_PCIE_GPIO_CLKREQ,
	EP_PCIE_GPIO_MDM2AP,
	EP_PCIE_MAX_GPIO,
	EP_PCIE_MAX_GPIO,
};
};


+23 −2
Original line number Original line Diff line number Diff line
@@ -53,7 +53,8 @@ static struct ep_pcie_vreg_info_t ep_pcie_vreg_info[EP_PCIE_MAX_VREG] = {
static struct ep_pcie_gpio_info_t ep_pcie_gpio_info[EP_PCIE_MAX_GPIO] = {
static struct ep_pcie_gpio_info_t ep_pcie_gpio_info[EP_PCIE_MAX_GPIO] = {
	{"perst-gpio",      0, 0, 0, 1},
	{"perst-gpio",      0, 0, 0, 1},
	{"wake-gpio",       0, 1, 0, 1},
	{"wake-gpio",       0, 1, 0, 1},
	{"clkreq-gpio",     0, 1, 0, 0}
	{"clkreq-gpio",     0, 1, 0, 0},
	{"mdm2apstatus-gpio",    0, 1, 1, 0}
};
};


static struct ep_pcie_clk_info_t
static struct ep_pcie_clk_info_t
@@ -775,7 +776,9 @@ static int ep_pcie_get_resources(struct ep_pcie_dev_t *dev,
			EP_PCIE_DBG(dev, "GPIO num for %s is %d\n",
			EP_PCIE_DBG(dev, "GPIO num for %s is %d\n",
				gpio_info->name, gpio_info->num);
				gpio_info->name, gpio_info->num);
		} else {
		} else {
			goto out;
			EP_PCIE_DBG(dev,
				"GPIO %s is not supported in this configuration.\n",
				gpio_info->name);
		}
		}
	}
	}


@@ -1135,6 +1138,24 @@ int ep_pcie_core_enable_endpoint(enum ep_pcie_options opt)
			"PCIe V%d: PCIe link is up and BME is enabled after %d checkings (%d ms).\n",
			"PCIe V%d: PCIe link is up and BME is enabled after %d checkings (%d ms).\n",
			dev->rev, retries,
			dev->rev, retries,
			BME_TIMEOUT_US_MIN * retries / 1000);
			BME_TIMEOUT_US_MIN * retries / 1000);

		if (dev->gpio[EP_PCIE_GPIO_MDM2AP].num) {
			/* assert MDM2AP Status GPIO */
			EP_PCIE_DBG2(dev, "PCIe V%d: assert MDM2AP Status .\n",
				dev->rev);
			EP_PCIE_DBG(dev,
				"PCIe V%d: MDM2APStatus GPIO initial:%d.\n",
				dev->rev,
				gpio_get_value(
					dev->gpio[EP_PCIE_GPIO_MDM2AP].num));
			gpio_set_value(dev->gpio[EP_PCIE_GPIO_MDM2AP].num,
					dev->gpio[EP_PCIE_GPIO_MDM2AP].on);
			EP_PCIE_DBG(dev,
				"PCIe V%d: MDM2APStatus GPIO after assertion:%d.\n",
				dev->rev,
				gpio_get_value(
					dev->gpio[EP_PCIE_GPIO_MDM2AP].num));
		}
	} else {
	} else {
		EP_PCIE_ERR(dev,
		EP_PCIE_ERR(dev,
			"PCIe V%d: PCIe link is up but BME is still disabled after max waiting time.\n",
			"PCIe V%d: PCIe link is up but BME is still disabled after max waiting time.\n",