diff options
author | Liu Gang <Gang.Liu@nxp.com> | 2016-08-10 07:07:08 (GMT) |
---|---|---|
committer | Xie Xiaobo <xiaobo.xie@nxp.com> | 2017-09-25 07:25:40 (GMT) |
commit | 9e589647fb0418f47d0e02934c06d324d50701c6 (patch) | |
tree | 3e50375af97d5bc141a92f5eb7d1ad35da27ccaa /drivers/pci | |
parent | 0798e71bcf6ccf6f5d774ac1409354025c4d2076 (diff) | |
download | linux-9e589647fb0418f47d0e02934c06d324d50701c6.tar.xz |
pci-ep/ls1046a: Correct LUT offset for different LS platform
There are different LUT offsets for different LS platforms.
Adding a private struct for each LS platform in the of_device_id
struct to bring in the specific LUT offset for the LS platform.
Signed-off-by: Liu Gang <Gang.Liu@nxp.com>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/host/pci-layerscape-ep.c | 45 | ||||
-rw-r--r-- | drivers/pci/host/pci-layerscape-ep.h | 7 |
2 files changed, 43 insertions, 9 deletions
diff --git a/drivers/pci/host/pci-layerscape-ep.c b/drivers/pci/host/pci-layerscape-ep.c index 4ee6884..7b99982 100644 --- a/drivers/pci/host/pci-layerscape-ep.c +++ b/drivers/pci/host/pci-layerscape-ep.c @@ -177,7 +177,7 @@ static int ls_pcie_ep_init(struct ls_pcie *pcie) vf = PCIE_VF_NUM; } else { pcie->sriov = 0; - pf = 0; + pf = 1; vf = 0; } @@ -189,12 +189,45 @@ static int ls_pcie_ep_init(struct ls_pcie *pcie) return 0; } +static struct ls_pcie_ep_drvdata ls1043_drvdata = { + .lut_offset = 0x10000, + .ltssm_shift = 24, + .lut_dbg = 0x7fc, +}; + +static struct ls_pcie_ep_drvdata ls1046_drvdata = { + .lut_offset = 0x80000, + .ltssm_shift = 24, + .lut_dbg = 0x407fc, +}; + +static struct ls_pcie_ep_drvdata ls2080_drvdata = { + .lut_offset = 0x80000, + .ltssm_shift = 0, + .lut_dbg = 0x7fc, +}; + +static const struct of_device_id ls_pcie_ep_of_match[] = { + { .compatible = "fsl,ls1021a-pcie", }, + { .compatible = "fsl,ls1043a-pcie", .data = &ls1043_drvdata }, + { .compatible = "fsl,ls1046a-pcie", .data = &ls1046_drvdata }, + { .compatible = "fsl,ls2080a-pcie", .data = &ls2080_drvdata }, + { .compatible = "fsl,ls2085a-pcie", .data = &ls2080_drvdata }, + { }, +}; +MODULE_DEVICE_TABLE(of, ls_pcie_ep_of_match); + static int ls_pcie_ep_probe(struct platform_device *pdev) { struct ls_pcie *pcie; struct resource *dbi_base, *cfg_res; + const struct of_device_id *match; int ret; + match = of_match_device(ls_pcie_ep_of_match, &pdev->dev); + if (!match) + return -ENODEV; + pcie = devm_kzalloc(&pdev->dev, sizeof(*pcie), GFP_KERNEL); if (!pcie) return -ENOMEM; @@ -209,7 +242,8 @@ static int ls_pcie_ep_probe(struct platform_device *pdev) return PTR_ERR(pcie->dbi); } - pcie->lut = pcie->dbi + PCIE_LUT_BASE; + pcie->drvdata = match->data; + pcie->lut = pcie->dbi + pcie->drvdata->lut_offset; if (ls_pcie_is_bridge(pcie)) return -ENODEV; @@ -258,13 +292,6 @@ static int ls_pcie_ep_remove(struct platform_device *pdev) return 0; } -static const struct of_device_id ls_pcie_ep_of_match[] = { - { .compatible = "fsl,ls2085a-pcie" }, - { .compatible = "fsl,ls2080a-pcie" }, - { }, -}; -MODULE_DEVICE_TABLE(of, ls_pcie_ep_of_match); - static struct platform_driver ls_pcie_ep_driver = { .driver = { .name = "ls-pcie-ep", diff --git a/drivers/pci/host/pci-layerscape-ep.h b/drivers/pci/host/pci-layerscape-ep.h index 89dd109..19e7e36 100644 --- a/drivers/pci/host/pci-layerscape-ep.h +++ b/drivers/pci/host/pci-layerscape-ep.h @@ -66,10 +66,17 @@ #define PCIE_PF_NUM 2 #define PCIE_VF_NUM 64 +struct ls_pcie_ep_drvdata { + u32 lut_offset; + u32 ltssm_shift; + u32 lut_dbg; +}; + struct ls_pcie { struct list_head ep_list; struct device *dev; struct dentry *dir; + const struct ls_pcie_ep_drvdata *drvdata; void __iomem *dbi; void __iomem *lut; phys_addr_t out_base; |