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

Commit befa8285 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: pcie: support the case of no endpoint"

parents 6dae3895 57179b0c
Loading
Loading
Loading
Loading
+25 −10
Original line number Diff line number Diff line
@@ -78,7 +78,8 @@
#define PM_CLK                   0x2
#define PM_GPIO                  0x4
#define PM_VREG                  0x8
#define PM_ALL (PM_IRQ | PM_CLK | PM_GPIO | PM_VREG)
#define PM_PIPE_CLK              0x10
#define PM_ALL (PM_IRQ | PM_CLK | PM_GPIO | PM_VREG | PM_PIPE_CLK)

/* Timing Delays */
#define PERST_PROPAGATION_DELAY_US_MIN        10000
@@ -797,11 +798,13 @@ static int msm_pcie_enable(u32 rc_idx, u32 options)
	/* init PCIe PHY */
	pcie_phy_init(dev);

	if (options & PM_PIPE_CLK) {
		/* Enable the pipe clock */
		ret = msm_pcie_pipe_clk_init(rc_idx, &dev->pdev->dev);
		wmb();
		if (ret)
			goto link_fail;
	}

	PCIE_DBG("waiting for phy ready...\n");

@@ -878,8 +881,9 @@ link_fail:
	msm_pcie_clk_deinit(rc_idx);
clk_fail:
	msm_pcie_vreg_deinit(rc_idx);
	msm_pcie_pipe_clk_deinit(rc_idx);
out:

	dev->link_status = MSM_PCIE_LINK_ENABLED;
	mutex_unlock(&setup_lock);

	return ret;
@@ -897,7 +901,6 @@ void msm_pcie_disable(u32 rc_idx, u32 options)
		msm_pcie_irq_deinit(dev);

	if (options & PM_CLK) {
		msm_pcie_pipe_clk_deinit(rc_idx);
		msm_pcie_write_mask(dev->parf + PCIE20_PARF_PHY_CTRL, 0,
					BIT(0));
		msm_pcie_clk_deinit(rc_idx);
@@ -905,6 +908,11 @@ void msm_pcie_disable(u32 rc_idx, u32 options)

	if (options & PM_VREG)
		msm_pcie_vreg_deinit(rc_idx);

	if (options & PM_PIPE_CLK)
		msm_pcie_pipe_clk_deinit(rc_idx);

	dev->link_status = MSM_PCIE_LINK_DISABLED;
}

static int msm_pcie_setup(int nr, struct pci_sys_data *sys)
@@ -1020,6 +1028,7 @@ static int msm_pcie_probe(struct platform_device *pdev)
	msm_pcie_dev[rc_idx].gpio_n = 0;
	msm_pcie_dev[rc_idx].parf_deemph = 0;
	msm_pcie_dev[rc_idx].parf_swing = 0;
	msm_pcie_dev[rc_idx].link_status = MSM_PCIE_LINK_DEINIT;
	memcpy(msm_pcie_dev[rc_idx].vreg, msm_pcie_vreg_info,
				sizeof(msm_pcie_vreg_info));
	memcpy(msm_pcie_dev[rc_idx].gpio, msm_pcie_gpio_info,
@@ -1171,6 +1180,9 @@ static void msm_pcie_fixup_suspend(struct pci_dev *dev)
	uint32_t val = 0;
	u32 rc_idx = pcie_drv.current_rc; /* need to be replaced later */

	if (msm_pcie_dev[rc_idx].link_status != MSM_PCIE_LINK_ENABLED)
		return;

	pci_save_state(dev);

	spin_lock_irqsave(&msm_pcie_dev[rc_idx].cfg_lock,
@@ -1193,7 +1205,7 @@ static void msm_pcie_fixup_suspend(struct pci_dev *dev)
	else
		PCIE_DBG("PM_Enter_L23 is NOT received\n");

	msm_pcie_disable(rc_idx, PM_CLK | PM_VREG);
	msm_pcie_disable(rc_idx, PM_PIPE_CLK | PM_CLK | PM_VREG);

	PCIE_DBG("enabling wake_n\n");

@@ -1207,6 +1219,9 @@ void msm_pcie_fixup_resume_early(struct pci_dev *dev)
{
	u32 rc_idx = pcie_drv.current_rc; /* need to be replaced later */

	if (msm_pcie_dev[rc_idx].link_status != MSM_PCIE_LINK_DISABLED)
		return;

	PCIE_DBG("disabling wake_n\n");

	disable_irq(msm_pcie_dev[rc_idx].wake_n);
@@ -1217,7 +1232,7 @@ void msm_pcie_fixup_resume_early(struct pci_dev *dev)
	spin_unlock_irqrestore(&msm_pcie_dev[rc_idx].cfg_lock,
				msm_pcie_dev[rc_idx].irqsave_flags);

	if (msm_pcie_enable(rc_idx, PM_CLK | PM_VREG))
	if (msm_pcie_enable(rc_idx, PM_PIPE_CLK | PM_CLK | PM_VREG))
		pr_err("PCIe:failed to enable PCIe link in resume\n");
	else
		pci_restore_state(dev);
+8 −0
Original line number Diff line number Diff line
@@ -78,6 +78,12 @@ enum msm_pcie_gpio {
	MSM_PCIE_MAX_GPIO
};

enum msm_pcie_link_status {
	MSM_PCIE_LINK_DEINIT,
	MSM_PCIE_LINK_ENABLED,
	MSM_PCIE_LINK_DISABLED
};

/* gpio info structure */
struct msm_pcie_gpio_info_t {
	char      *name;
@@ -152,6 +158,8 @@ struct msm_pcie_dev_t {

	struct irq_domain            *irq_domain;
	DECLARE_BITMAP(msi_irq_in_use, PCIE_MSI_NR_IRQS);

	enum msm_pcie_link_status    link_status;
};

extern void msm_pcie_config_msi_controller(struct msm_pcie_dev_t *dev);