mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
Merge branch 'pci/controller/stm32'
- Fix a race between link training and endpoint register initialization (Christian Bruel) - Align endpoint allocations to match the ATU requirements (Christian Bruel) - Add #includes to avoid depending on 'proxy' headers (Andy Shevchenko) * pci/controller/stm32: PCI: stm32: Don't use 'proxy' headers PCI: stm32: Fix EP page_size alignment PCI: stm32: Fix LTSSM EP race with start link
This commit is contained in:
commit
7a13e837d2
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/phy/phy.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
|
|
@ -37,36 +37,9 @@ static void stm32_pcie_ep_init(struct dw_pcie_ep *ep)
|
|||
dw_pcie_ep_reset_bar(pci, bar);
|
||||
}
|
||||
|
||||
static int stm32_pcie_enable_link(struct dw_pcie *pci)
|
||||
{
|
||||
struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
|
||||
|
||||
regmap_update_bits(stm32_pcie->regmap, SYSCFG_PCIECR,
|
||||
STM32MP25_PCIECR_LTSSM_EN,
|
||||
STM32MP25_PCIECR_LTSSM_EN);
|
||||
|
||||
return dw_pcie_wait_for_link(pci);
|
||||
}
|
||||
|
||||
static void stm32_pcie_disable_link(struct dw_pcie *pci)
|
||||
{
|
||||
struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
|
||||
|
||||
regmap_update_bits(stm32_pcie->regmap, SYSCFG_PCIECR, STM32MP25_PCIECR_LTSSM_EN, 0);
|
||||
}
|
||||
|
||||
static int stm32_pcie_start_link(struct dw_pcie *pci)
|
||||
{
|
||||
struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
|
||||
int ret;
|
||||
|
||||
dev_dbg(pci->dev, "Enable link\n");
|
||||
|
||||
ret = stm32_pcie_enable_link(pci);
|
||||
if (ret) {
|
||||
dev_err(pci->dev, "PCIe cannot establish link: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
enable_irq(stm32_pcie->perst_irq);
|
||||
|
||||
|
|
@ -77,11 +50,7 @@ static void stm32_pcie_stop_link(struct dw_pcie *pci)
|
|||
{
|
||||
struct stm32_pcie *stm32_pcie = to_stm32_pcie(pci);
|
||||
|
||||
dev_dbg(pci->dev, "Disable link\n");
|
||||
|
||||
disable_irq(stm32_pcie->perst_irq);
|
||||
|
||||
stm32_pcie_disable_link(pci);
|
||||
}
|
||||
|
||||
static int stm32_pcie_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
|
||||
|
|
@ -152,6 +121,9 @@ static void stm32_pcie_perst_assert(struct dw_pcie *pci)
|
|||
|
||||
dev_dbg(dev, "PERST asserted by host\n");
|
||||
|
||||
regmap_update_bits(stm32_pcie->regmap, SYSCFG_PCIECR,
|
||||
STM32MP25_PCIECR_LTSSM_EN, 0);
|
||||
|
||||
pci_epc_deinit_notify(ep->epc);
|
||||
|
||||
stm32_pcie_disable_resources(stm32_pcie);
|
||||
|
|
@ -192,6 +164,11 @@ static void stm32_pcie_perst_deassert(struct dw_pcie *pci)
|
|||
|
||||
pci_epc_init_notify(ep->epc);
|
||||
|
||||
/* Enable link training */
|
||||
regmap_update_bits(stm32_pcie->regmap, SYSCFG_PCIECR,
|
||||
STM32MP25_PCIECR_LTSSM_EN,
|
||||
STM32MP25_PCIECR_LTSSM_EN);
|
||||
|
||||
return;
|
||||
|
||||
err_disable_resources:
|
||||
|
|
@ -237,6 +214,8 @@ static int stm32_add_pcie_ep(struct stm32_pcie *stm32_pcie,
|
|||
|
||||
ep->ops = &stm32_pcie_ep_ops;
|
||||
|
||||
ep->page_size = stm32_pcie_epc_features.align;
|
||||
|
||||
ret = dw_pcie_ep_init(ep);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to initialize ep: %d\n", ret);
|
||||
|
|
|
|||
|
|
@ -7,18 +7,30 @@
|
|||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/phy/phy.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/pm_wakeirq.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/reset.h>
|
||||
#include <linux/stddef.h>
|
||||
|
||||
#include "../../pci.h"
|
||||
|
||||
#include "pcie-designware.h"
|
||||
#include "pcie-stm32.h"
|
||||
#include "../../pci.h"
|
||||
|
||||
struct stm32_pcie {
|
||||
struct dw_pcie pci;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@
|
|||
* Author: Christian Bruel <christian.bruel@foss.st.com>
|
||||
*/
|
||||
|
||||
#include <linux/bits.h>
|
||||
#include <linux/device.h>
|
||||
|
||||
#define to_stm32_pcie(x) dev_get_drvdata((x)->dev)
|
||||
|
||||
#define STM32MP25_PCIECR_TYPE_MASK GENMASK(11, 8)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user