PCI: controllers: tidy code up
Subsystems (31)
Yoshihiro Shimoda
maintainerv4 cover PCI: controllers: tidy code up
This patch series tidies the code of PCIe dwc controllers and some controllers up.
Changes from v3:
https://lore.kernel.org/linux-pci/[email protected]/
- Based on the latest pci.git / next branch. So, I modified the patch 1/6 for pci-layerscape.c.
- Add Reviewed-by tag in the patch 4/6.
- Fix locations of read/write accessors by grouped for readability in the patch 4/6.
Changes from v2:
https://lore.kernel.org/linux-pci/[email protected]/
- Based on the latest pci.git / next branch.
- Add Suggestion-by and Reviewed-by tags.
- Move read/write accessors to the header file in the patch 4/6.
- Revise the commit description in the patch 5/6.
Changes from v1:
https://lore.kernel.org/linux-pci/[email protected]/
- Based on the latest pci.git / next branch.
- Add a new patch to drop host prefix of members from dw_pcie_host_ops in the patch 1/6.
- Add Reviewed-by tag in the patch 3/6.
- Drop unneeded local variable in the patch 4/6.
- Add new patches to resolve issues of clang warnings in the patch [56]/6.
Justin Stitt (1):
PCI: iproc: fix -Wvoid-pointer-to-enum-cast warning
Yoshihiro Shimoda (5):
PCI: dwc: Drop host prefix from struct dw_pcie_host_ops
PCI: dwc: Rename to .init in struct dw_pcie_ep_ops
PCI: dwc: Rename to .get_dbi_offset in struct dw_pcie_ep_ops
PCI: dwc: Add dw_pcie_ep_{read,write}_dbi[2] helpers
PCI: rcar-gen4: fix -Wvoid-pointer-to-enum-cast warning
drivers/pci/controller/dwc/pci-dra7xx.c | 4 +- drivers/pci/controller/dwc/pci-exynos.c | 2 +- drivers/pci/controller/dwc/pci-imx6.c | 6 +- drivers/pci/controller/dwc/pci-keystone.c | 8 +- .../pci/controller/dwc/pci-layerscape-ep.c | 7 +- drivers/pci/controller/dwc/pci-layerscape.c | 6 +- drivers/pci/controller/dwc/pci-meson.c | 2 +- drivers/pci/controller/dwc/pcie-al.c | 2 +- drivers/pci/controller/dwc/pcie-armada8k.c | 2 +- drivers/pci/controller/dwc/pcie-artpec6.c | 4 +- drivers/pci/controller/dwc/pcie-bt1.c | 4 +- .../pci/controller/dwc/pcie-designware-ep.c | 188 ++++++------------ .../pci/controller/dwc/pcie-designware-host.c | 30 +-- .../pci/controller/dwc/pcie-designware-plat.c | 2 +- drivers/pci/controller/dwc/pcie-designware.h | 105 +++++++++- drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 +- drivers/pci/controller/dwc/pcie-fu740.c | 2 +- drivers/pci/controller/dwc/pcie-histb.c | 2 +- drivers/pci/controller/dwc/pcie-intel-gw.c | 2 +- drivers/pci/controller/dwc/pcie-keembay.c | 2 +- drivers/pci/controller/dwc/pcie-kirin.c | 2 +- drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 +- drivers/pci/controller/dwc/pcie-qcom.c | 6 +- drivers/pci/controller/dwc/pcie-rcar-gen4.c | 12 +- drivers/pci/controller/dwc/pcie-spear13xx.c | 2 +- drivers/pci/controller/dwc/pcie-tegra194.c | 2 +- drivers/pci/controller/dwc/pcie-uniphier-ep.c | 2 +- drivers/pci/controller/dwc/pcie-uniphier.c | 2 +- drivers/pci/controller/dwc/pcie-visconti.c | 2 +- drivers/pci/controller/pcie-iproc-platform.c | 2 +- 30 files changed, 222 insertions(+), 194 deletions(-)
Signature · 1 line
2.25.1
Yoshihiro Shimoda
maintainerPATCH v4 1/6 PCI: dwc: Drop host prefix from struct dw_pcie_host_ops
Since the name of dw_pcie_host_ops indicates that it's for host obviously, drop host prefix from the struct.
---
Cc: Vignesh Raghavendra <[email protected]>
Cc: Jingoo Han <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Alim Akhtar <[email protected]>
Cc: Richard Zhu <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Minghuan Lian <[email protected]>
Cc: Mingkai Hu <[email protected]>
Cc: Roy Zang <[email protected]>
Cc: Yue Wang <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Kevin Hilman <[email protected]>
Cc: Jerome Brunet <[email protected]>
Cc: Martin Blumenstingl <[email protected]>
Cc: Jonathan Chocron <[email protected]>
Cc: Gustavo Pimentel <[email protected]>
Cc: Paul Walmsley <[email protected]>
Cc: Greentime Hu <[email protected]>
Cc: Xiaowei Song <[email protected]>
Cc: Binghui Wang <[email protected]>
Cc: Andy Gross <[email protected]>
Cc: Bjorn Andersson <[email protected]>
Cc: Konrad Dybcio <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Pratyush Anand <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Jonathan Hunter <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
--- drivers/pci/controller/dwc/pci-dra7xx.c | 2 +- drivers/pci/controller/dwc/pci-exynos.c | 2 +- drivers/pci/controller/dwc/pci-imx6.c | 4 +-- drivers/pci/controller/dwc/pci-keystone.c | 6 ++-- drivers/pci/controller/dwc/pci-layerscape.c | 6 ++-- drivers/pci/controller/dwc/pci-meson.c | 2 +- drivers/pci/controller/dwc/pcie-al.c | 2 +- drivers/pci/controller/dwc/pcie-armada8k.c | 2 +- drivers/pci/controller/dwc/pcie-artpec6.c | 2 +- drivers/pci/controller/dwc/pcie-bt1.c | 4 +-- .../pci/controller/dwc/pcie-designware-host.c | 30 +++++++++---------- drivers/pci/controller/dwc/pcie-designware.h | 8 ++--- drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 +- drivers/pci/controller/dwc/pcie-fu740.c | 2 +- drivers/pci/controller/dwc/pcie-histb.c | 2 +- drivers/pci/controller/dwc/pcie-intel-gw.c | 2 +- drivers/pci/controller/dwc/pcie-kirin.c | 2 +- drivers/pci/controller/dwc/pcie-qcom.c | 6 ++-- drivers/pci/controller/dwc/pcie-rcar-gen4.c | 4 +-- drivers/pci/controller/dwc/pcie-spear13xx.c | 2 +- drivers/pci/controller/dwc/pcie-tegra194.c | 2 +- drivers/pci/controller/dwc/pcie-uniphier.c | 2 +- drivers/pci/controller/dwc/pcie-visconti.c | 2 +- 23 files changed, 49 insertions(+), 49 deletions(-)
drivers/pci/controller/dwc/pci-dra7xx.c +1 -1
@@ -371,7 +371,7 @@ static int dra7xx_pcie_init_irq_domain(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops dra7xx_pcie_host_ops = { - .host_init = dra7xx_pcie_host_init, + .init = dra7xx_pcie_host_init, };static void dra7xx_pcie_ep_init (struct dw_pcie_ep *ep)
drivers/pci/controller/dwc/pci-exynos.c +1 -1
@@ -268,7 +268,7 @@ static int exynos_pcie_host_init(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops exynos_pcie_host_ops = { - .host_init = exynos_pcie_host_init, + .init = exynos_pcie_host_init, }; static int exynos_add_pcie_port(struct exynos_pcie *ep,
drivers/pci/controller/dwc/pci-imx6.c +2 -2
@@ -1039,8 +1039,8 @@ static void imx6_pcie_host_exit(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops imx6_pcie_host_ops = { - .host_init = imx6_pcie_host_init, - .host_deinit = imx6_pcie_host_exit, + .init = imx6_pcie_host_init, + .deinit = imx6_pcie_host_exit, };static const struct dw_pcie_ops dw_pcie_ops = {
drivers/pci/controller/dwc/pci-keystone.c +3 -3
@@ -838,12 +838,12 @@ static int __init ks_pcie_host_init(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops ks_pcie_host_ops = { - .host_init = ks_pcie_host_init, - .msi_host_init = ks_pcie_msi_host_init, + .init = ks_pcie_host_init, + .msi_init = ks_pcie_msi_host_init, };static const struct dw_pcie_host_ops ks_pcie_am654_host_ops = { - .host_init = ks_pcie_host_init, + .init = ks_pcie_host_init, };static irqreturn_t ks_pcie_err_irq_handler (int irq,void *priv)
drivers/pci/controller/dwc/pci-layerscape.c +3 -3
@@ -273,12 +273,12 @@ static int ls1043a_pcie_exit_from_l2(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops ls_pcie_host_ops = { - .host_init = ls_pcie_host_init, + .init = ls_pcie_host_init, .pme_turn_off = ls_pcie_send_turnoff_msg, };static const struct dw_pcie_host_ops ls1021a_pcie_host_ops = { - .host_init = ls_pcie_host_init, + .init = ls_pcie_host_init, .pme_turn_off = ls1021a_pcie_send_turnoff_msg, };
@@ -290,7 +290,7 @@ static const struct ls_pcie_drvdata ls1021a_drvdata = { };static const struct dw_pcie_host_ops ls1043a_pcie_host_ops = { - .host_init = ls_pcie_host_init, + .init = ls_pcie_host_init, .pme_turn_off = ls1043a_pcie_send_turnoff_msg, };
drivers/pci/controller/dwc/pci-meson.c +1 -1
@@ -389,7 +389,7 @@ static int meson_pcie_host_init(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops meson_pcie_host_ops = { - .host_init = meson_pcie_host_init, + .init = meson_pcie_host_init, };static const struct dw_pcie_ops dw_pcie_ops = {
drivers/pci/controller/dwc/pcie-al.c +1 -1
@@ -311,7 +311,7 @@ static int al_pcie_host_init(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops al_pcie_host_ops = { - .host_init = al_pcie_host_init, + .init = al_pcie_host_init, };static int al_pcie_probe (struct platform_device *pdev)
drivers/pci/controller/dwc/pcie-armada8k.c +1 -1
@@ -225,7 +225,7 @@ static irqreturn_t armada8k_pcie_irq_handler(int irq, void *arg) }static const struct dw_pcie_host_ops armada8k_pcie_host_ops = { - .host_init = armada8k_pcie_host_init, + .init = armada8k_pcie_host_init, }; static int armada8k_add_pcie_port(struct armada8k_pcie *pcie,
drivers/pci/controller/dwc/pcie-artpec6.c +1 -1
@@ -333,7 +333,7 @@ static int artpec6_pcie_host_init(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops artpec6_pcie_host_ops = { - .host_init = artpec6_pcie_host_init, + .init = artpec6_pcie_host_init, };static void artpec6_pcie_ep_init (struct dw_pcie_ep *ep)
drivers/pci/controller/dwc/pcie-bt1.c +2 -2
@@ -559,8 +559,8 @@ static void bt1_pcie_host_deinit(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops bt1_pcie_host_ops = { - .host_init = bt1_pcie_host_init, - .host_deinit = bt1_pcie_host_deinit, + .init = bt1_pcie_host_init, + .deinit = bt1_pcie_host_deinit, };static struct bt1_pcie *bt1_pcie_create_data (struct platform_device *pdev)
drivers/pci/controller/dwc/pcie-designware-host.c +15 -15
@@ -441,14 +441,14 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) bridge->ops = &dw_pcie_ops; bridge->child_ops = &dw_child_pcie_ops; -if (pp->ops->host_init) { - ret = pp->ops->host_init (pp); +if (pp->ops->init) { + ret = pp->ops->init (pp);if (ret)return ret; }if (pci_msi_enabled ()) { - pp->has_msi_ctrl = !(pp->ops->msi_host_init || + pp->has_msi_ctrl = !(pp->ops->msi_init ||of_property_read_bool (np,"msi-parent" ) ||of_property_read_bool (np,"msi-map" ));
@@ -464,8 +464,8 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) goto err_deinit_host; } -if (pp->ops->msi_host_init) { - ret = pp->ops->msi_host_init (pp); +if (pp->ops->msi_init) { + ret = pp->ops->msi_init (pp);if (ret <0 ) goto err_deinit_host; }else if (pp->has_msi_ctrl) {
@@ -502,8 +502,8 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)if (ret) goto err_stop_link; -if (pp->ops->host_post_init) - pp->ops->host_post_init (pp); +if (pp->ops->post_init) + pp->ops->post_init (pp);return 0 ;
@@ -518,8 +518,8 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)dw_pcie_free_msi (pp); err_deinit_host: -if (pp->ops->host_deinit) - pp->ops->host_deinit (pp); +if (pp->ops->deinit) + pp->ops->deinit (pp);return ret; }
@@ -539,8 +539,8 @@ void dw_pcie_host_deinit(struct dw_pcie_rp *pp)if (pp->has_msi_ctrl)dw_pcie_free_msi (pp); -if (pp->ops->host_deinit) - pp->ops->host_deinit (pp); +if (pp->ops->deinit) + pp->ops->deinit (pp); }EXPORT_SYMBOL_GPL (dw_pcie_host_deinit);
@@ -842,8 +842,8 @@ int dw_pcie_suspend_noirq(struct dw_pcie *pci)return ret; } -if (pci->pp.ops->host_deinit) - pci->pp.ops->host_deinit (&pci->pp); +if (pci->pp.ops->deinit) + pci->pp.ops->deinit (&pci->pp); pci->suspended = true;
@@ -860,8 +860,8 @@ int dw_pcie_resume_noirq(struct dw_pcie *pci) pci->suspended = false; -if (pci->pp.ops->host_init) { - ret = pci->pp.ops->host_init (&pci->pp); +if (pci->pp.ops->init) { + ret = pci->pp.ops->init (&pci->pp);if (ret) {dev_err (pci->dev,"Host init failed: %d\n" , ret);return ret;
drivers/pci/controller/dwc/pcie-designware.h +4 -4
@@ -300,10 +300,10 @@ enum dw_pcie_ltssm { };struct dw_pcie_host_ops { -int (*host_init)(struct dw_pcie_rp *pp); -void (*host_deinit)(struct dw_pcie_rp *pp); -void (*host_post_init)(struct dw_pcie_rp *pp); -int (*msi_host_init)(struct dw_pcie_rp *pp); +int (*init)(struct dw_pcie_rp *pp); +void (*deinit)(struct dw_pcie_rp *pp); +void (*post_init)(struct dw_pcie_rp *pp); +int (*msi_init)(struct dw_pcie_rp *pp);void (*pme_turn_off)(struct dw_pcie_rp *pp); };
drivers/pci/controller/dwc/pcie-dw-rockchip.c +1 -1
@@ -215,7 +215,7 @@ static int rockchip_pcie_host_init(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops rockchip_pcie_host_ops = { - .host_init = rockchip_pcie_host_init, + .init = rockchip_pcie_host_init, };static int rockchip_pcie_clk_init (struct rockchip_pcie *rockchip)
drivers/pci/controller/dwc/pcie-fu740.c +1 -1
@@ -279,7 +279,7 @@ static int fu740_pcie_host_init(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops fu740_pcie_host_ops = { - .host_init = fu740_pcie_host_init, + .init = fu740_pcie_host_init, };static const struct dw_pcie_ops dw_pcie_ops = {
drivers/pci/controller/dwc/pcie-histb.c +1 -1
@@ -198,7 +198,7 @@ static int histb_pcie_host_init(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops histb_pcie_host_ops = { - .host_init = histb_pcie_host_init, + .init = histb_pcie_host_init, };static void histb_pcie_host_disable (struct histb_pcie *hipcie)
drivers/pci/controller/dwc/pcie-intel-gw.c +1 -1
@@ -391,7 +391,7 @@ static const struct dw_pcie_ops intel_pcie_ops = { };static const struct dw_pcie_host_ops intel_pcie_dw_ops = { - .host_init = intel_pcie_rc_init, + .init = intel_pcie_rc_init, };static int intel_pcie_probe (struct platform_device *pdev)
drivers/pci/controller/dwc/pcie-kirin.c +1 -1
@@ -672,7 +672,7 @@ static const struct dw_pcie_ops kirin_dw_pcie_ops = { };static const struct dw_pcie_host_ops kirin_pcie_host_ops = { - .host_init = kirin_pcie_host_init, + .init = kirin_pcie_host_init, };static int kirin_pcie_power_off (struct kirin_pcie *kirin_pcie)
drivers/pci/controller/dwc/pcie-qcom.c +3 -3
@@ -1244,9 +1244,9 @@ static void qcom_pcie_host_post_init(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops qcom_pcie_dw_ops = { - .host_init = qcom_pcie_host_init, - .host_deinit = qcom_pcie_host_deinit, - .host_post_init = qcom_pcie_host_post_init, + .init = qcom_pcie_host_init, + .deinit = qcom_pcie_host_deinit, + .post_init = qcom_pcie_host_post_init, };/* Qcom IP rev.: 2.1.0 Synopsys IP rev.: 4.01a */
drivers/pci/controller/dwc/pcie-rcar-gen4.c +2 -2
@@ -307,8 +307,8 @@ static void rcar_gen4_pcie_host_deinit(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops rcar_gen4_pcie_host_ops = { - .host_init = rcar_gen4_pcie_host_init, - .host_deinit = rcar_gen4_pcie_host_deinit, + .init = rcar_gen4_pcie_host_init, + .deinit = rcar_gen4_pcie_host_deinit, };static int rcar_gen4_add_dw_pcie_rp (struct rcar_gen4_pcie *rcar)
drivers/pci/controller/dwc/pcie-spear13xx.c +1 -1
@@ -148,7 +148,7 @@ static int spear13xx_pcie_host_init(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops spear13xx_pcie_host_ops = { - .host_init = spear13xx_pcie_host_init, + .init = spear13xx_pcie_host_init, }; static int spear13xx_add_pcie_port(struct spear13xx_pcie *spear13xx_pcie,
drivers/pci/controller/dwc/pcie-tegra194.c +1 -1
@@ -1060,7 +1060,7 @@ static const struct dw_pcie_ops tegra_dw_pcie_ops = { };static const struct dw_pcie_host_ops tegra_pcie_dw_host_ops = { - .host_init = tegra_pcie_dw_host_init, + .init = tegra_pcie_dw_host_init, };static void tegra_pcie_disable_phy (struct tegra_pcie_dw *pcie)
drivers/pci/controller/dwc/pcie-uniphier.c +1 -1
@@ -311,7 +311,7 @@ static int uniphier_pcie_host_init(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops uniphier_pcie_host_ops = { - .host_init = uniphier_pcie_host_init, + .init = uniphier_pcie_host_init, };static int uniphier_pcie_host_enable (struct uniphier_pcie *pcie)
drivers/pci/controller/dwc/pcie-visconti.c +1 -1
@@ -236,7 +236,7 @@ static int visconti_pcie_host_init(struct dw_pcie_rp *pp) }static const struct dw_pcie_host_ops visconti_pcie_host_ops = { - .host_init = visconti_pcie_host_init, + .init = visconti_pcie_host_init, }; static int visconti_get_resources(struct platform_device *pdev,
Signature · 1 line
2.25.1
Yoshihiro Shimoda
maintainerPATCH v4 2/6 PCI: dwc: Rename to .init in struct dw_pcie_ep_ops
In reply to Yoshihiro ShimodaSince the name of dw_pcie_ep_ops indicates that it's for ep obviously, rename a member .ep_init to .init.
---
Cc: Richard Zhu <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Minghuan Lian <[email protected]>
Cc: Mingkai Hu <[email protected]>
Cc: Roy Zang <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
--- drivers/pci/controller/dwc/pci-dra7xx.c | 2 +- drivers/pci/controller/dwc/pci-imx6.c | 2 +- drivers/pci/controller/dwc/pci-keystone.c | 2 +- drivers/pci/controller/dwc/pci-layerscape-ep.c | 2 +- drivers/pci/controller/dwc/pcie-artpec6.c | 2 +- drivers/pci/controller/dwc/pcie-designware-ep.c | 4 ++-- drivers/pci/controller/dwc/pcie-designware-plat.c | 2 +- drivers/pci/controller/dwc/pcie-designware.h | 2 +- drivers/pci/controller/dwc/pcie-keembay.c | 2 +- drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 +- drivers/pci/controller/dwc/pcie-rcar-gen4.c | 2 +- drivers/pci/controller/dwc/pcie-uniphier-ep.c | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-)
drivers/pci/controller/dwc/pci-dra7xx.c +1 -1
@@ -436,7 +436,7 @@ dra7xx_pcie_get_features(struct dw_pcie_ep *ep) }static const struct dw_pcie_ep_ops pcie_ep_ops = { - .ep_init = dra7xx_pcie_ep_init, + .init = dra7xx_pcie_ep_init, .raise_irq = dra7xx_pcie_raise_irq, .get_features = dra7xx_pcie_get_features, };
drivers/pci/controller/dwc/pci-imx6.c +1 -1
@@ -1093,7 +1093,7 @@ imx6_pcie_ep_get_features(struct dw_pcie_ep *ep) }static const struct dw_pcie_ep_ops pcie_ep_ops = { - .ep_init = imx6_pcie_ep_init, + .init = imx6_pcie_ep_init, .raise_irq = imx6_pcie_ep_raise_irq, .get_features = imx6_pcie_ep_get_features, };
drivers/pci/controller/dwc/pci-keystone.c +1 -1
@@ -944,7 +944,7 @@ ks_pcie_am654_get_features(struct dw_pcie_ep *ep) }static const struct dw_pcie_ep_ops ks_pcie_am654_ep_ops = { - .ep_init = ks_pcie_am654_ep_init, + .init = ks_pcie_am654_ep_init, .raise_irq = ks_pcie_am654_raise_irq, .get_features = &ks_pcie_am654_get_features, };
drivers/pci/controller/dwc/pci-layerscape-ep.c +1 -1
@@ -195,7 +195,7 @@ static unsigned int ls_pcie_ep_func_conf_select(struct dw_pcie_ep *ep, }static const struct dw_pcie_ep_ops ls_pcie_ep_ops = { - .ep_init = ls_pcie_ep_init, + .init = ls_pcie_ep_init, .raise_irq = ls_pcie_ep_raise_irq, .get_features = ls_pcie_ep_get_features, .func_conf_select = ls_pcie_ep_func_conf_select,
drivers/pci/controller/dwc/pcie-artpec6.c +1 -1
@@ -370,7 +370,7 @@ static int artpec6_pcie_raise_irq(struct dw_pcie_ep *ep, u8 func_no, }static const struct dw_pcie_ep_ops pcie_ep_ops = { - .ep_init = artpec6_pcie_ep_init, + .init = artpec6_pcie_ep_init, .raise_irq = artpec6_pcie_raise_irq, };
drivers/pci/controller/dwc/pcie-designware-ep.c +2 -2
@@ -794,8 +794,8 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)list_add_tail (&ep_func->list, &ep->func_list); } -if (ep->ops->ep_init) - ep->ops->ep_init (ep); +if (ep->ops->init) + ep->ops->init (ep); ret =pci_epc_mem_init (epc, ep->phys_base, ep->addr_size, ep->page_size);
drivers/pci/controller/dwc/pcie-designware-plat.c +1 -1
@@ -74,7 +74,7 @@ dw_plat_pcie_get_features(struct dw_pcie_ep *ep) }static const struct dw_pcie_ep_ops pcie_ep_ops = { - .ep_init = dw_plat_pcie_ep_init, + .init = dw_plat_pcie_ep_init, .raise_irq = dw_plat_pcie_ep_raise_irq, .get_features = dw_plat_pcie_get_features, };
drivers/pci/controller/dwc/pcie-designware.h +1 -1
@@ -332,7 +332,7 @@ struct dw_pcie_rp {struct dw_pcie_ep_ops {void (*pre_init)(struct dw_pcie_ep *ep); -void (*ep_init)(struct dw_pcie_ep *ep); +void (*init)(struct dw_pcie_ep *ep);void (*deinit)(struct dw_pcie_ep *ep);int (*raise_irq)(struct dw_pcie_ep *ep,u8 func_no,enum pci_epc_irq_type type,u16 interrupt_num);
drivers/pci/controller/dwc/pcie-keembay.c +1 -1
@@ -325,7 +325,7 @@ keembay_pcie_get_features(struct dw_pcie_ep *ep) }static const struct dw_pcie_ep_ops keembay_pcie_ep_ops = { - .ep_init = keembay_pcie_ep_init, + .init = keembay_pcie_ep_init, .raise_irq = keembay_pcie_ep_raise_irq, .get_features = keembay_pcie_get_features, };
drivers/pci/controller/dwc/pcie-qcom-ep.c +1 -1
@@ -796,7 +796,7 @@ static void qcom_pcie_ep_init(struct dw_pcie_ep *ep) }static const struct dw_pcie_ep_ops pci_ep_ops = { - .ep_init = qcom_pcie_ep_init, + .init = qcom_pcie_ep_init, .raise_irq = qcom_pcie_ep_raise_irq, .get_features = qcom_pcie_epc_get_features, };
drivers/pci/controller/dwc/pcie-rcar-gen4.c +1 -1
@@ -408,7 +408,7 @@ static unsigned int rcar_gen4_pcie_ep_get_dbi2_offset(struct dw_pcie_ep *ep,static const struct dw_pcie_ep_ops pcie_ep_ops = { .pre_init = rcar_gen4_pcie_ep_pre_init, - .ep_init = rcar_gen4_pcie_ep_init, + .init = rcar_gen4_pcie_ep_init, .deinit = rcar_gen4_pcie_ep_deinit, .raise_irq = rcar_gen4_pcie_ep_raise_irq, .get_features = rcar_gen4_pcie_ep_get_features,
drivers/pci/controller/dwc/pcie-uniphier-ep.c +1 -1
@@ -284,7 +284,7 @@ uniphier_pcie_get_features(struct dw_pcie_ep *ep) }static const struct dw_pcie_ep_ops uniphier_pcie_ep_ops = { - .ep_init = uniphier_pcie_ep_init, + .init = uniphier_pcie_ep_init, .raise_irq = uniphier_pcie_ep_raise_irq, .get_features = uniphier_pcie_get_features, };
Signature · 1 line
2.25.1
Yoshihiro Shimoda
maintainerPATCH v4 3/6 PCI: dwc: Rename to .get_dbi_offset in struct dw_pcie_ep_ops
In reply to Yoshihiro ShimodaSince meaning of .func_conf_select is difficult to understand, rename it to .get_dbi_offset.
--- .../pci/controller/dwc/pci-layerscape-ep.c | 5 +- .../pci/controller/dwc/pcie-designware-ep.c | 108 +++++++++--------- drivers/pci/controller/dwc/pcie-designware.h | 2 +- drivers/pci/controller/dwc/pcie-rcar-gen4.c | 4 +- 4 files changed, 59 insertions(+), 60 deletions(-)
drivers/pci/controller/dwc/pci-layerscape-ep.c +2 -3
@@ -184,8 +184,7 @@ static int ls_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no, } } -static unsigned int ls_pcie_ep_func_conf_select (struct dw_pcie_ep *ep, -u8 func_no) +static unsigned int ls_pcie_ep_get_dbi_offset (struct dw_pcie_ep *ep,u8 func_no) {struct dw_pcie *pci =to_dw_pcie_from_ep (ep);struct ls_pcie_ep *pcie =to_ls_pcie_ep (pci);
@@ -198,7 +197,7 @@ static const struct dw_pcie_ep_ops ls_pcie_ep_ops = { .init = ls_pcie_ep_init, .raise_irq = ls_pcie_ep_raise_irq, .get_features = ls_pcie_ep_get_features, - .func_conf_select = ls_pcie_ep_func_conf_select, + .get_dbi_offset = ls_pcie_ep_get_dbi_offset, };static const struct ls_pcie_ep_drvdata ls1_ep_drvdata = {
drivers/pci/controller/dwc/pcie-designware-ep.c +54 -54
278 lines not on this page · raw message
drivers/pci/controller/dwc/pcie-designware.h +1 -1
@@ -344,7 +344,7 @@ struct dw_pcie_ep_ops {* return a 0, and implement code in callback function of platform * driver. */ -unsigned int (*func_conf_select)(struct dw_pcie_ep *ep,u8 func_no); +unsigned int (*get_dbi_offset)(struct dw_pcie_ep *ep,u8 func_no);unsigned int (*get_dbi2_offset)(struct dw_pcie_ep *ep,u8 func_no); };
drivers/pci/controller/dwc/pcie-rcar-gen4.c +2 -2
@@ -394,7 +394,7 @@ rcar_gen4_pcie_ep_get_features(struct dw_pcie_ep *ep)return &rcar_gen4_pcie_epc_features; } -static unsigned int rcar_gen4_pcie_ep_func_conf_select (struct dw_pcie_ep *ep, +static unsigned int rcar_gen4_pcie_ep_get_dbi_offset (struct dw_pcie_ep *ep,u8 func_no) {return func_no *RCAR_GEN4_PCIE_EP_FUNC_DBI_OFFSET ;
@@ -412,7 +412,7 @@ static const struct dw_pcie_ep_ops pcie_ep_ops = { .deinit = rcar_gen4_pcie_ep_deinit, .raise_irq = rcar_gen4_pcie_ep_raise_irq, .get_features = rcar_gen4_pcie_ep_get_features, - .func_conf_select = rcar_gen4_pcie_ep_func_conf_select, + .get_dbi_offset = rcar_gen4_pcie_ep_get_dbi_offset, .get_dbi2_offset = rcar_gen4_pcie_ep_get_dbi2_offset, };
Signature · 1 line
2.25.1
Yoshihiro Shimoda
maintainerPATCH v4 4/6 PCI: dwc: Add dw_pcie_ep_{read,write}_dbi[2] helpers
In reply to Yoshihiro ShimodaThe current code calculated some dbi[2] registers' offset by calling dw_pcie_ep_get_dbi[2]_offset() in each function. To improve code readability, add dw_pcie_ep_{read,write}_dbi[2} and some data-width related helpers.
--- .../pci/controller/dwc/pcie-designware-ep.c | 184 ++++++------------ drivers/pci/controller/dwc/pcie-designware.h | 93 +++++++++ 2 files changed, 153 insertions(+), 124 deletions(-)
drivers/pci/controller/dwc/pcie-designware-ep.c +60 -124
@@ -43,46 +43,19 @@ dw_pcie_ep_get_func_from_ep(struct dw_pcie_ep *ep, u8 func_no)return NULL ; } -static unsigned int dw_pcie_ep_get_dbi_offset (struct dw_pcie_ep *ep,u8 func_no) -{ -unsigned int dbi_offset =0 ; - -if (ep->ops->get_dbi_offset) - dbi_offset = ep->ops->get_dbi_offset (ep, func_no); - -return dbi_offset; -} - -static unsigned int dw_pcie_ep_get_dbi2_offset (struct dw_pcie_ep *ep,u8 func_no) -{ -unsigned int dbi2_offset =0 ; - -if (ep->ops->get_dbi2_offset) - dbi2_offset = ep->ops->get_dbi2_offset (ep, func_no); -else if (ep->ops->get_dbi_offset)/* for backward compatibility */ - dbi2_offset = ep->ops->get_dbi_offset (ep, func_no); - -return dbi2_offset; -} -static void __dw_pcie_ep_reset_bar (struct dw_pcie *pci,u8 func_no,enum pci_barno bar,int flags) { -unsigned int dbi_offset, dbi2_offset;struct dw_pcie_ep *ep = &pci->ep; -u32 reg, reg_dbi2; - - dbi_offset =dw_pcie_ep_get_dbi_offset (ep, func_no); - dbi2_offset =dw_pcie_ep_get_dbi2_offset (ep, func_no); +u32 reg; - reg = dbi_offset +PCI_BASE_ADDRESS_0 + (4 * bar); - reg_dbi2 = dbi2_offset +PCI_BASE_ADDRESS_0 + (4 * bar); + reg =PCI_BASE_ADDRESS_0 + (4 * bar);dw_pcie_dbi_ro_wr_en (pci); -dw_pcie_writel_dbi2 (pci, reg_dbi2,0x0 ); -dw_pcie_writel_dbi (pci, reg,0x0 ); +dw_pcie_ep_writel_dbi2 (ep, func_no, reg,0x0 ); +dw_pcie_ep_writel_dbi (ep, func_no, reg,0x0 );if (flags &PCI_BASE_ADDRESS_MEM_TYPE_64 ) { -dw_pcie_writel_dbi2 (pci, reg_dbi2 +4 ,0x0 ); -dw_pcie_writel_dbi (pci, reg +4 ,0x0 ); +dw_pcie_ep_writel_dbi2 (ep, func_no, reg +4 ,0x0 ); +dw_pcie_ep_writel_dbi (ep, func_no, reg +4 ,0x0 ); }dw_pcie_dbi_ro_wr_dis (pci); }
@@ -99,19 +72,15 @@ void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar)EXPORT_SYMBOL_GPL (dw_pcie_ep_reset_bar);static u8 __dw_pcie_ep_find_next_cap (struct dw_pcie_ep *ep,u8 func_no, -u8 cap_ptr,u8 cap) +u8 cap_ptr,u8 cap) { -struct dw_pcie *pci =to_dw_pcie_from_ep (ep); -unsigned int dbi_offset =0 ;u8 cap_id, next_cap_ptr;u16 reg;if (!cap_ptr)return 0 ; - dbi_offset =dw_pcie_ep_get_dbi_offset (ep, func_no); - - reg =dw_pcie_readw_dbi (pci, dbi_offset + cap_ptr); + reg =dw_pcie_ep_readw_dbi (ep, func_no, cap_ptr); cap_id = (reg &0x00ff );if (cap_id >PCI_CAP_ID_MAX )
@@ -126,14 +95,10 @@ static u8 __dw_pcie_ep_find_next_cap(struct dw_pcie_ep *ep, u8 func_no,static u8 dw_pcie_ep_find_capability (struct dw_pcie_ep *ep,u8 func_no,u8 cap) { -struct dw_pcie *pci =to_dw_pcie_from_ep (ep); -unsigned int dbi_offset =0 ;u8 next_cap_ptr;u16 reg; - dbi_offset =dw_pcie_ep_get_dbi_offset (ep, func_no); - - reg =dw_pcie_readw_dbi (pci, dbi_offset +PCI_CAPABILITY_LIST ); + reg =dw_pcie_ep_readw_dbi (ep, func_no,PCI_CAPABILITY_LIST ); next_cap_ptr = (reg &0x00ff );return __dw_pcie_ep_find_next_cap (ep, func_no, next_cap_ptr, cap);
@@ -144,24 +109,21 @@ static int dw_pcie_ep_write_header(struct pci_epc *epc, u8 func_no, u8 vfunc_no, {struct dw_pcie_ep *ep =epc_get_drvdata (epc);struct dw_pcie *pci =to_dw_pcie_from_ep (ep); -unsigned int dbi_offset =0 ; - - dbi_offset =dw_pcie_ep_get_dbi_offset (ep, func_no);dw_pcie_dbi_ro_wr_en (pci); -dw_pcie_writew_dbi (pci, dbi_offset +PCI_VENDOR_ID , hdr->vendorid); -dw_pcie_writew_dbi (pci, dbi_offset +PCI_DEVICE_ID , hdr->deviceid); -dw_pcie_writeb_dbi (pci, dbi_offset +PCI_REVISION_ID , hdr->revid); -dw_pcie_writeb_dbi (pci, dbi_offset +PCI_CLASS_PROG , hdr->progif_code); -dw_pcie_writew_dbi (pci, dbi_offset +PCI_CLASS_DEVICE , - hdr->subclass_code | hdr->baseclass_code <<8 ); -dw_pcie_writeb_dbi (pci, dbi_offset +PCI_CACHE_LINE_SIZE , - hdr->cache_line_size); -dw_pcie_writew_dbi (pci, dbi_offset +PCI_SUBSYSTEM_VENDOR_ID , - hdr->subsys_vendor_id); -dw_pcie_writew_dbi (pci, dbi_offset +PCI_SUBSYSTEM_ID , hdr->subsys_id); -dw_pcie_writeb_dbi (pci, dbi_offset +PCI_INTERRUPT_PIN , - hdr->interrupt_pin); +dw_pcie_ep_writew_dbi (ep, func_no,PCI_VENDOR_ID , hdr->vendorid); +dw_pcie_ep_writew_dbi (ep, func_no,PCI_DEVICE_ID , hdr->deviceid); +dw_pcie_ep_writeb_dbi (ep, func_no,PCI_REVISION_ID , hdr->revid); +dw_pcie_ep_writeb_dbi (ep, func_no,PCI_CLASS_PROG , hdr->progif_code); +dw_pcie_ep_writew_dbi (ep, func_no,PCI_CLASS_DEVICE , + hdr->subclass_code | hdr->baseclass_code <<8 ); +dw_pcie_ep_writeb_dbi (ep, func_no,PCI_CACHE_LINE_SIZE , + hdr->cache_line_size); +dw_pcie_ep_writew_dbi (ep, func_no,PCI_SUBSYSTEM_VENDOR_ID , + hdr->subsys_vendor_id); +dw_pcie_ep_writew_dbi (ep, func_no,PCI_SUBSYSTEM_ID , hdr->subsys_id); +dw_pcie_ep_writeb_dbi (ep, func_no,PCI_INTERRUPT_PIN , + hdr->interrupt_pin);dw_pcie_dbi_ro_wr_dis (pci);return 0 ;
@@ -243,18 +205,13 @@ static int dw_pcie_ep_set_bar(struct pci_epc *epc, u8 func_no, u8 vfunc_no, {struct dw_pcie_ep *ep =epc_get_drvdata (epc);struct dw_pcie *pci =to_dw_pcie_from_ep (ep); -unsigned int dbi_offset, dbi2_offset;enum pci_barno bar = epf_bar->barno;size_t size = epf_bar->size;int flags = epf_bar->flags; -u32 reg, reg_dbi2;int ret, type; +u32 reg; - dbi_offset =dw_pcie_ep_get_dbi_offset (ep, func_no); - dbi2_offset =dw_pcie_ep_get_dbi2_offset (ep, func_no); - - reg =PCI_BASE_ADDRESS_0 + (4 * bar) + dbi_offset; - reg_dbi2 =PCI_BASE_ADDRESS_0 + (4 * bar) + dbi2_offset; + reg =PCI_BASE_ADDRESS_0 + (4 * bar);if (!(flags &PCI_BASE_ADDRESS_SPACE )) type =PCIE_ATU_TYPE_MEM ;
@@ -270,12 +227,12 @@ static int dw_pcie_ep_set_bar(struct pci_epc *epc, u8 func_no, u8 vfunc_no,dw_pcie_dbi_ro_wr_en (pci); -dw_pcie_writel_dbi2 (pci, reg_dbi2,lower_32_bits (size -1 )); -dw_pcie_writel_dbi (pci, reg, flags); +dw_pcie_ep_writel_dbi2 (ep, func_no, reg,lower_32_bits (size -1 )); +dw_pcie_ep_writel_dbi (ep, func_no, reg, flags);if (flags &PCI_BASE_ADDRESS_MEM_TYPE_64 ) { -dw_pcie_writel_dbi2 (pci, reg_dbi2 +4 ,upper_32_bits (size -1 )); -dw_pcie_writel_dbi (pci, reg +4 ,0 ); +dw_pcie_ep_writel_dbi2 (ep, func_no, reg +4 ,upper_32_bits (size -1 )); +dw_pcie_ep_writel_dbi (ep, func_no, reg +4 ,0 ); } ep->epf_bar[bar] = epf_bar;
@@ -335,19 +292,15 @@ static int dw_pcie_ep_map_addr(struct pci_epc *epc, u8 func_no, u8 vfunc_no,static int dw_pcie_ep_get_msi (struct pci_epc *epc,u8 func_no,u8 vfunc_no) {struct dw_pcie_ep *ep =epc_get_drvdata (epc); -struct dw_pcie *pci =to_dw_pcie_from_ep (ep); -u32 val, reg; -unsigned int dbi_offset =0 ;struct dw_pcie_ep_func *ep_func; +u32 val, reg; ep_func =dw_pcie_ep_get_func_from_ep (ep, func_no);if (!ep_func || !ep_func->msi_cap)return -EINVAL ; - dbi_offset =dw_pcie_ep_get_dbi_offset (ep, func_no); - - reg = ep_func->msi_cap + dbi_offset +PCI_MSI_FLAGS ; - val =dw_pcie_readw_dbi (pci, reg); + reg = ep_func->msi_cap +PCI_MSI_FLAGS ; + val =dw_pcie_ep_readw_dbi (ep, func_no, reg);if (!(val &PCI_MSI_FLAGS_ENABLE ))return -EINVAL ;
@@ -361,22 +314,19 @@ static int dw_pcie_ep_set_msi(struct pci_epc *epc, u8 func_no, u8 vfunc_no, {struct dw_pcie_ep *ep =epc_get_drvdata (epc);struct dw_pcie *pci =to_dw_pcie_from_ep (ep); -u32 val, reg; -unsigned int dbi_offset =0 ;struct dw_pcie_ep_func *ep_func; +u32 val, reg; ep_func =dw_pcie_ep_get_func_from_ep (ep, func_no);if (!ep_func || !ep_func->msi_cap)return -EINVAL ; - dbi_offset =dw_pcie_ep_get_dbi_offset (ep, func_no); - - reg = ep_func->msi_cap + dbi_offset +PCI_MSI_FLAGS ; - val =dw_pcie_readw_dbi (pci, reg); + reg = ep_func->msi_cap +PCI_MSI_FLAGS ; + val =dw_pcie_ep_readw_dbi (ep, func_no, reg); val &= ~PCI_MSI_FLAGS_QMASK ; val |=FIELD_PREP (PCI_MSI_FLAGS_QMASK , interrupts);dw_pcie_dbi_ro_wr_en (pci); -dw_pcie_writew_dbi (pci, reg, val); +dw_pcie_ep_writew_dbi (ep, func_no, reg, val);dw_pcie_dbi_ro_wr_dis (pci);return 0 ;
@@ -385,19 +335,15 @@ static int dw_pcie_ep_set_msi(struct pci_epc *epc, u8 func_no, u8 vfunc_no,static int dw_pcie_ep_get_msix (struct pci_epc *epc,u8 func_no,u8 vfunc_no) {struct dw_pcie_ep *ep =epc_get_drvdata (epc); -struct dw_pcie *pci =to_dw_pcie_from_ep (ep); -u32 val, reg; -unsigned int dbi_offset =0 ;struct dw_pcie_ep_func *ep_func; +u32 val, reg; ep_func =dw_pcie_ep_get_func_from_ep (ep, func_no);if (!ep_func || !ep_func->msix_cap)return -EINVAL ; - dbi_offset =dw_pcie_ep_get_dbi_offset (ep, func_no); - - reg = ep_func->msix_cap + dbi_offset +PCI_MSIX_FLAGS ; - val =dw_pcie_readw_dbi (pci, reg); + reg = ep_func->msix_cap +PCI_MSIX_FLAGS ; + val =dw_pcie_ep_readw_dbi (ep, func_no, reg);if (!(val &PCI_MSIX_FLAGS_ENABLE ))return -EINVAL ;
@@ -411,9 +357,8 @@ static int dw_pcie_ep_set_msix(struct pci_epc *epc, u8 func_no, u8 vfunc_no, {struct dw_pcie_ep *ep =epc_get_drvdata (epc);struct dw_pcie *pci =to_dw_pcie_from_ep (ep); -u32 val, reg; -unsigned int dbi_offset =0 ;struct dw_pcie_ep_func *ep_func; +u32 val, reg; ep_func =dw_pcie_ep_get_func_from_ep (ep, func_no);if (!ep_func || !ep_func->msix_cap)
@@ -421,21 +366,19 @@ static int dw_pcie_ep_set_msix(struct pci_epc *epc, u8 func_no, u8 vfunc_no,dw_pcie_dbi_ro_wr_en (pci); - dbi_offset =dw_pcie_ep_get_dbi_offset (ep, func_no); - - reg = ep_func->msix_cap + dbi_offset +PCI_MSIX_FLAGS ; - val =dw_pcie_readw_dbi (pci, reg); + reg = ep_func->msix_cap +PCI_MSIX_FLAGS ; + val =dw_pcie_ep_readw_dbi (ep, func_no, reg); val &= ~PCI_MSIX_FLAGS_QSIZE ; val |= interrupts;dw_pcie_writew_dbi (pci, reg, val); - reg = ep_func->msix_cap + dbi_offset +PCI_MSIX_TABLE ; + reg = ep_func->msix_cap +PCI_MSIX_TABLE ; val = offset | bir; -dw_pcie_writel_dbi (pci, reg, val); +dw_pcie_ep_writel_dbi (ep, func_no, reg, val); - reg = ep_func->msix_cap + dbi_offset +PCI_MSIX_PBA ; + reg = ep_func->msix_cap +PCI_MSIX_PBA ; val = (offset + (interrupts *PCI_MSIX_ENTRY_SIZE )) | bir; -dw_pcie_writel_dbi (pci, reg, val); +dw_pcie_ep_writel_dbi (ep, func_no, reg, val);dw_pcie_dbi_ro_wr_dis (pci);
@@ -510,38 +453,34 @@ EXPORT_SYMBOL_GPL(dw_pcie_ep_raise_legacy_irq);int dw_pcie_ep_raise_msi_irq (struct dw_pcie_ep *ep,u8 func_no,u8 interrupt_num) { -struct dw_pcie *pci =to_dw_pcie_from_ep (ep); +u32 msg_addr_lower, msg_addr_upper, reg;struct dw_pcie_ep_func *ep_func;struct pci_epc *epc = ep->epc;unsigned int aligned_offset; -unsigned int dbi_offset =0 ;u16 msg_ctrl, msg_data; -u32 msg_addr_lower, msg_addr_upper, reg; -u64 msg_addr;bool has_upper; +u64 msg_addr;int ret; ep_func =dw_pcie_ep_get_func_from_ep (ep, func_no);if (!ep_func || !ep_func->msi_cap)return -EINVAL ; - dbi_offset =dw_pcie_ep_get_dbi_offset (ep, func_no); -/* Raise MSI per the PCI Local Bus Specification Revision 3.0, 6.8.1. */ - reg = ep_func->msi_cap + dbi_offset +PCI_MSI_FLAGS ; - msg_ctrl =dw_pcie_readw_dbi (pci, reg); + reg = ep_func->msi_cap +PCI_MSI_FLAGS ; + msg_ctrl =dw_pcie_ep_readw_dbi (ep, func_no, reg); has_upper = !!(msg_ctrl &PCI_MSI_FLAGS_64BIT ); - reg = ep_func->msi_cap + dbi_offset +PCI_MSI_ADDRESS_LO ; - msg_addr_lower =dw_pcie_readl_dbi (pci, reg); + reg = ep_func->msi_cap +PCI_MSI_ADDRESS_LO ; + msg_addr_lower =dw_pcie_ep_readl_dbi (ep, func_no, reg);if (has_upper) { - reg = ep_func->msi_cap + dbi_offset +PCI_MSI_ADDRESS_HI ; - msg_addr_upper =dw_pcie_readl_dbi (pci, reg); - reg = ep_func->msi_cap + dbi_offset +PCI_MSI_DATA_64 ; - msg_data =dw_pcie_readw_dbi (pci, reg); + reg = ep_func->msi_cap +PCI_MSI_ADDRESS_HI ; + msg_addr_upper =dw_pcie_ep_readl_dbi (ep, func_no, reg); + reg = ep_func->msi_cap +PCI_MSI_DATA_64 ; + msg_data =dw_pcie_ep_readw_dbi (ep, func_no, reg); }else { msg_addr_upper =0 ; - reg = ep_func->msi_cap + dbi_offset +PCI_MSI_DATA_32 ; - msg_data =dw_pcie_readw_dbi (pci, reg); + reg = ep_func->msi_cap +PCI_MSI_DATA_32 ; + msg_data =dw_pcie_ep_readw_dbi (ep, func_no, reg); } aligned_offset = msg_addr_lower & (epc->mem->window.page_size -1 ); msg_addr = ((u64)msg_addr_upper) << 32 |
@@ -582,10 +521,9 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no, u16 interrupt_num) {struct dw_pcie *pci =to_dw_pcie_from_ep (ep); -struct dw_pcie_ep_func *ep_func;struct pci_epf_msix_tbl *msix_tbl; +struct dw_pcie_ep_func *ep_func;struct pci_epc *epc = ep->epc; -unsigned int dbi_offset =0 ;u32 reg, msg_data, vec_ctrl;unsigned int aligned_offset;u32 tbl_offset;
@@ -597,10 +535,8 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no,if (!ep_func || !ep_func->msix_cap)return -EINVAL ; - dbi_offset =dw_pcie_ep_get_dbi_offset (ep, func_no); - - reg = ep_func->msix_cap + dbi_offset +PCI_MSIX_TABLE ; - tbl_offset =dw_pcie_readl_dbi (pci, reg); + reg = ep_func->msix_cap +PCI_MSIX_TABLE ; + tbl_offset =dw_pcie_ep_readl_dbi (ep, func_no, reg); bir =FIELD_GET (PCI_MSIX_TABLE_BIR , tbl_offset); tbl_offset &=PCI_MSIX_TABLE_OFFSET ;
drivers/pci/controller/dwc/pcie-designware.h +93 -0
99 lines not on this page · raw message
Signature · 1 line
2.25.1
Yoshihiro Shimoda
maintainerPATCH v4 5/6 PCI: iproc: fix -Wvoid-pointer-to-enum-cast warning
In reply to Yoshihiro ShimodaFrom: Justin Stitt <[email protected]>
When building with clang 18 I see the following warning:
| drivers/pci/controller/pcie-iproc-platform.c:55:15: warning: cast to smaller | integer type 'enum iproc_pcie_type' from 'const void *' [-Wvoid-pointer-to-enum-cast] | 55 | pcie->type = (enum iproc_pcie_type) of_device_get_match_data(dev);
To fix this issue, use uintptr_t instead.
--- drivers/pci/controller/pcie-iproc-platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pcie-iproc-platform.c +1 -1
@@ -52,7 +52,7 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev) pcie =pci_host_bridge_priv (bridge); pcie->dev = dev; - pcie->type = (enum iproc_pcie_type )of_device_get_match_data (dev); + pcie->type = (uintptr_t )of_device_get_match_data (dev); ret =of_address_to_resource (np,0 , ®);if (ret <0 ) {
Signature · 1 line
2.25.1
Yoshihiro Shimoda
maintainerPATCH v4 6/6 PCI: rcar-gen4: fix -Wvoid-pointer-to-enum-cast warning
In reply to Yoshihiro ShimodaWhen building with clang 18 with adding -Wvoid-pointer-to-enum-cast, the following error happens:
drivers/pci/controller/dwc/pcie-rcar-gen4.c:439:15: error: cast to smaller integer type 'enum dw_pcie_device_mode' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
439 | rcar->mode = (enum dw_pcie_device_mode)of_device_get_match_data(&rcar->pdev->dev);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~To fix this issue, use uintptr_t instead.
--- drivers/pci/controller/dwc/pcie-rcar-gen4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-rcar-gen4.c +1 -1
@@ -436,7 +436,7 @@ static void rcar_gen4_remove_dw_pcie_ep(struct rcar_gen4_pcie *rcar)/* Common */ static int rcar_gen4_add_dw_pcie (struct rcar_gen4_pcie *rcar) { - rcar->mode = (enum dw_pcie_device_mode )of_device_get_match_data (&rcar->pdev->dev); + rcar->mode = (uintptr_t )of_device_get_match_data (&rcar->pdev->dev);switch (rcar->mode) {case DW_PCIE_RC_TYPE :
Signature · 1 line
2.25.1
Hi Krzysztof, Lorenzo, Bjorn, Mani
Quoted 10 lines · Yoshihiro Shimoda
This patch series tidies the code of PCIe dwc controllers and some controllers up.
Changes from v3:
https://lore.kernel.org/linux-pci/[email protected]/
- Based on the latest pci.git / next branch. So, I modified the patch 1/6 forpci-layerscape.c.
- Add Reviewed-by tag in the patch 4/6.
- Fix locations of read/write accessors by grouped for readability in the patch 4/6.
The series has got all the Mani's acks. The last nitpick was fixed in v4. No more comments at least from my side. What about merging it in (before merge window v6.8 is opened)?
-Serge(y)
Quoted 63 lines
Changes from v2:
https://lore.kernel.org/linux-pci/[email protected]/
- Based on the latest pci.git / next branch.
- Add Suggestion-by and Reviewed-by tags.
- Move read/write accessors to the header file in the patch 4/6.
- Revise the commit description in the patch 5/6.Changes from v1:
https://lore.kernel.org/linux-pci/[email protected]/
- Based on the latest pci.git / next branch.
- Add a new patch to drop host prefix of members fromdw_pcie_host_opsin the patch 1/6.
- Add Reviewed-by tag in the patch 3/6.
- Drop unneeded local variable in the patch 4/6.
- Add new patches to resolve issues of clang warnings in the patch [56]/6.Justin Stitt (1):
PCI: iproc: fix -Wvoid-pointer-to-enum-cast warningYoshihiro Shimoda (5):
PCI: dwc: Drop host prefix from structdw_pcie_host_ops
PCI: dwc: Rename to .init in structdw_pcie_ep_ops
PCI: dwc: Rename to .get_dbi_offset in structdw_pcie_ep_ops
PCI: dwc: Add dw_pcie_ep_{read,write}_dbi[2] helpers
PCI: rcar-gen4: fix -Wvoid-pointer-to-enum-cast warningdrivers/pci/controller/dwc/pci-dra7xx.c | 4 +- drivers/pci/controller/dwc/pci-exynos.c | 2 +- drivers/pci/controller/dwc/pci-imx6.c | 6 +- drivers/pci/controller/dwc/pci-keystone.c | 8 +- .../pci/controller/dwc/pci-layerscape-ep.c | 7 +- drivers/pci/controller/dwc/pci-layerscape.c | 6 +- drivers/pci/controller/dwc/pci-meson.c | 2 +- drivers/pci/controller/dwc/pcie-al.c | 2 +- drivers/pci/controller/dwc/pcie-armada8k.c | 2 +- drivers/pci/controller/dwc/pcie-artpec6.c | 4 +- drivers/pci/controller/dwc/pcie-bt1.c | 4 +- .../pci/controller/dwc/pcie-designware-ep.c | 188 ++++++------------ .../pci/controller/dwc/pcie-designware-host.c | 30 +-- .../pci/controller/dwc/pcie-designware-plat.c | 2 +- drivers/pci/controller/dwc/pcie-designware.h | 105 +++++++++- drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 +- drivers/pci/controller/dwc/pcie-fu740.c | 2 +- drivers/pci/controller/dwc/pcie-histb.c | 2 +- drivers/pci/controller/dwc/pcie-intel-gw.c | 2 +- drivers/pci/controller/dwc/pcie-keembay.c | 2 +- drivers/pci/controller/dwc/pcie-kirin.c | 2 +- drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 +- drivers/pci/controller/dwc/pcie-qcom.c | 6 +- drivers/pci/controller/dwc/pcie-rcar-gen4.c | 12 +- drivers/pci/controller/dwc/pcie-spear13xx.c | 2 +- drivers/pci/controller/dwc/pcie-tegra194.c | 2 +- drivers/pci/controller/dwc/pcie-uniphier-ep.c | 2 +- drivers/pci/controller/dwc/pcie-uniphier.c | 2 +- drivers/pci/controller/dwc/pcie-visconti.c | 2 +- drivers/pci/controller/pcie-iproc-platform.c | 2 +- 30 files changed, 222 insertions(+), 194 deletions(-)Signature · 1 line
2.25.1
Yoshihiro Shimoda
maintainerHi,
Quoted 16 lines
From: Serge Semin, Sent: Thursday, December 21, 2023 12:21 AM
Hi Krzysztof, Lorenzo, Bjorn, Mani
Quoted 10 lines · Yoshihiro Shimoda
This patch series tidies the code of PCIe dwc controllers and some controllers up.
Changes from v3:
https://lore.kernel.org/linux-pci/[email protected]/
- Based on the latest pci.git / next branch. So, I modified the patch 1/6 forpci-layerscape.c.
- Add Reviewed-by tag in the patch 4/6.
- Fix locations of read/write accessors by grouped for readability in the patch 4/6.
Quoted 3 lines
The series has got all the Mani's acks. The last nitpick was fixed in v4. No more comments at least from my side. What about merging it in (before merge window v6.8 is opened)?
Serge, thank you for your comment.
Hi Krzysztof, Lorenzo, Bjorn, Mani,
Would you apply this patch series into pci.git / next branch?
I confirmed that the patch series could be applied on the latest pci.git / next branch by using the following git-pw command:
$ git-pw --server https://patchwork.kernel.org/api/1.1 --project linux-pci series apply 811670
Best regards,
Yoshihiro Shimoda
Quoted 5 lines
-Serge(y)
Quoted 3 lines
Changes from v2:
<snip URL>
Quoted 7 lines
Quoted 7 lines
- Based on the latest pci.git / next branch.
- Add Suggestion-by and Reviewed-by tags.
- Move read/write accessors to the header file in the patch 4/6.
- Revise the commit description in the patch 5/6.Changes from v1:
<snip URL>
Quoted 53 lines
Quoted 53 lines
- Based on the latest pci.git / next branch.
- Add a new patch to drop host prefix of members fromdw_pcie_host_opsin the patch 1/6.
- Add Reviewed-by tag in the patch 3/6.
- Drop unneeded local variable in the patch 4/6.
- Add new patches to resolve issues of clang warnings in the patch [56]/6.Justin Stitt (1):
PCI: iproc: fix -Wvoid-pointer-to-enum-cast warningYoshihiro Shimoda (5):
PCI: dwc: Drop host prefix from structdw_pcie_host_ops
PCI: dwc: Rename to .init in structdw_pcie_ep_ops
PCI: dwc: Rename to .get_dbi_offset in structdw_pcie_ep_ops
PCI: dwc: Add dw_pcie_ep_{read,write}_dbi[2] helpers
PCI: rcar-gen4: fix -Wvoid-pointer-to-enum-cast warningdrivers/pci/controller/dwc/pci-dra7xx.c | 4 +- drivers/pci/controller/dwc/pci-exynos.c | 2 +- drivers/pci/controller/dwc/pci-imx6.c | 6 +- drivers/pci/controller/dwc/pci-keystone.c | 8 +- .../pci/controller/dwc/pci-layerscape-ep.c | 7 +- drivers/pci/controller/dwc/pci-layerscape.c | 6 +- drivers/pci/controller/dwc/pci-meson.c | 2 +- drivers/pci/controller/dwc/pcie-al.c | 2 +- drivers/pci/controller/dwc/pcie-armada8k.c | 2 +- drivers/pci/controller/dwc/pcie-artpec6.c | 4 +- drivers/pci/controller/dwc/pcie-bt1.c | 4 +- .../pci/controller/dwc/pcie-designware-ep.c | 188 ++++++------------ .../pci/controller/dwc/pcie-designware-host.c | 30 +-- .../pci/controller/dwc/pcie-designware-plat.c | 2 +- drivers/pci/controller/dwc/pcie-designware.h | 105 +++++++++- drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 +- drivers/pci/controller/dwc/pcie-fu740.c | 2 +- drivers/pci/controller/dwc/pcie-histb.c | 2 +- drivers/pci/controller/dwc/pcie-intel-gw.c | 2 +- drivers/pci/controller/dwc/pcie-keembay.c | 2 +- drivers/pci/controller/dwc/pcie-kirin.c | 2 +- drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 +- drivers/pci/controller/dwc/pcie-qcom.c | 6 +- drivers/pci/controller/dwc/pcie-rcar-gen4.c | 12 +- drivers/pci/controller/dwc/pcie-spear13xx.c | 2 +- drivers/pci/controller/dwc/pcie-tegra194.c | 2 +- drivers/pci/controller/dwc/pcie-uniphier-ep.c | 2 +- drivers/pci/controller/dwc/pcie-uniphier.c | 2 +- drivers/pci/controller/dwc/pcie-visconti.c | 2 +- drivers/pci/controller/pcie-iproc-platform.c | 2 +- 30 files changed, 222 insertions(+), 194 deletions(-)--
2.25.1
Hello,
[...]
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Changes from v3:
https://lore.kernel.org/linux-pci/[email protected]/
- Based on the latest pci.git / next branch. So, I modified the patch 1/6 forpci-layerscape.c.
Shimoda-san, don't use next when working on patches. I might have told you this once before, per the following. Something that is easy to forget.
https://lore.kernel.org/all/20230828160712.GA2127814@rocinante/
This is the HEAD branch you should be using:
https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/log/
You should seldom use our "next" or the upstream "linux-next" when working on a series you want to send to us. That is, unless someone explicitly asks you to do so or the changes you wish to submit to be applied are simple.
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
- Add Reviewed-by tag in the patch 4/6.
- Fix locations of read/write accessors by grouped for readability in the patch 4/6.The series has got all the Mani's acks. The last nitpick was fixed in v4. No more comments at least from my side. What about merging it in (before merge window v6.8 is opened)?
Serge, thank you for your comment.
Hi Krzysztof, Lorenzo, Bjorn, Mani,
Hi. Happy New Year 2024!
Quoted 1 line
Would you apply this patch series into pci.git / next branch?
We don't apply specific series like that. Bjorn will collect other branches, and then eventually update our "next", which then will be picked up and the upstream "linux-next" will eventually include it.
Quoted 1 line
I confirmed that the patch series could be applied on the latest pci.git / next branch
[...]
I appreciate that. However, I now need to resolve some conflicts to apply this series. See my comment above. :)
Krzysztof
Yoshihiro Shimoda
maintainerHello Krzysztof-san,
Quoted 7 lines
From: Krzysztof Wilczyński, Sent: Saturday, January 6, 2024 2:27 PM
Hello,
[...]
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Changes from v3:
<snip URL>
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
- Based on the latest pci.git / next branch. So, I modified the patch 1/6 for
pci-layerscape.c.Shimoda-san, don't use next when working on patches. I might have told you this once before, per the following. Something that is easy to forget.
https://lore.kernel.org/all/20230828160712.GA2127814@rocinante/
Oops. I'm sorry. As you mentioned, I completely forgot it...
Quoted 7 lines
This is the HEAD branch you should be using:
https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/log/
You should seldom use our "next" or the upstream "linux-next" when working on a series you want to send to us. That is, unless someone explicitly asks you to do so or the changes you wish to submit to be applied are simple.
I got it.
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
- Add Reviewed-by tag in the patch 4/6.
- Fix locations of read/write accessors by grouped for readability in the patch 4/6.The series has got all the Mani's acks. The last nitpick was fixed in v4. No more comments at least from my side. What about merging it in (before merge window v6.8 is opened)?
Serge, thank you for your comment.
Hi Krzysztof, Lorenzo, Bjorn, Mani,
Quoted 7 lines
Hi. Happy New Year 2024!
Quoted 1 line
Would you apply this patch series into pci.git / next branch?
We don't apply specific series like that. Bjorn will collect other branches, and then eventually update our "next", which then will be picked up and the upstream "linux-next" will eventually include it.
I got it.
Quoted 5 lines
Quoted 1 line
I confirmed that the patch series could be applied on the latest pci.git / next branch
[...]
I appreciate that. However, I now need to resolve some conflicts to apply this series. See my comment above. :)
I understood it.
Now v6.7 had been released. So, should I resubmit this series after v6.8-rc1 was released? Or, would you resolve the conflicts for merging this series into v6.8-rc1?
Best regards,
Yoshihiro Shimoda
Quoted 1 line
Krzysztof
Quoted 5 lines · Yoshihiro Shimoda
...
Now v6.7 had been released. So, should I resubmit this series after v6.8-rc1 was released? Or, would you resolve the conflicts for merging this series into v6.8-rc1?
No need, I think this is already merged in the PCI "next" branch and should appear in v6.8-rc1.
If you take a look at
https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/log/?h=fbfdb71c8c79,
you should be able to confirm that your series is included correctly.
If it's not, please let me know!
Bjorn
Yoshihiro Shimoda
maintainerHi Bjorn,
Quoted 9 lines
From: Bjorn Helgaas, Sent: Wednesday, January 10, 2024 9:22 AM
Quoted 5 lines · Yoshihiro Shimoda
...
Now v6.7 had been released. So, should I resubmit this series after v6.8-rc1 was released? Or, would you resolve the conflicts for merging this series into v6.8-rc1?
Quoted 8 lines
No need, I think this is already merged in the PCI "next" branch and should appear in v6.8-rc1.
If you take a look at
https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/log/?h=fbfdb71c8c79
you should be able to confirm that your series is included correctly.If it's not, please let me know!
Thank you for your reply! I confirmed that this patch series had been merged into the PCI "next" branch correctly.
Best regards,
Yoshihiro Shimoda
Quoted 1 line
Bjorn
Krzysztof Wilczyński
AppliedHello,
Quoted 2 lines
This patch series tidies the code of PCIe dwc controllers and some controllers up.
Applied to controller/dwc, thank you!
[01/06] PCI: dwc: Drop host prefix from struct dw_pcie_host_ops members
https://git.kernel.org/pci/pci/c/aea370b2aec9 [02/06] PCI: dwc: Rename .ep_init to .init in struct dw_pcie_ep_ops https://git.kernel.org/pci/pci/c/756dcb5a820a [03/06] PCI: dwc: Rename .func_conf_select to .get_dbi_offset in struct dw_pcie_ep_ops https://git.kernel.org/pci/pci/c/641f79beeebc [04/06] PCI: dwc: Add dw_pcie_ep_{read,write}_dbi[2] helpers https://git.kernel.org/pci/pci/c/70fa02ca1446 [05/06] PCI: iproc: Fix -Wvoid-pointer-to-enum-cast warning https://git.kernel.org/pci/pci/c/f72896721621 [06/06] PCI: rcar-gen4: Fix -Wvoid-pointer-to-enum-cast error https://git.kernel.org/pci/pci/c/7682f19c3c8c Krzysztof
Hello,
Quoted 6 lines
Quoted 2 lines
This patch series tidies the code of PCIe dwc controllers and some controllers up.
Applied to controller/dwc, thank you!
[01/06] PCI: dwc: Drop host prefix from struct
dw_pcie_host_opsmembers
Quoted 11 lines
https://git.kernel.org/pci/pci/c/aea370b2aec9 [02/06] PCI: dwc: Rename .ep_init to .init in struct dw_pcie_ep_ops https://git.kernel.org/pci/pci/c/756dcb5a820a [03/06] PCI: dwc: Rename .func_conf_select to .get_dbi_offset in struct dw_pcie_ep_ops https://git.kernel.org/pci/pci/c/641f79beeebc [04/06] PCI: dwc: Add dw_pcie_ep_{read,write}_dbi[2] helpers https://git.kernel.org/pci/pci/c/70fa02ca1446 [05/06] PCI: iproc: Fix -Wvoid-pointer-to-enum-cast warning https://git.kernel.org/pci/pci/c/f72896721621 [06/06] PCI: rcar-gen4: Fix -Wvoid-pointer-to-enum-cast error https://git.kernel.org/pci/pci/c/7682f19c3c8c
Bjorn, there will be a minor conflict with the controller/layerscape branch when you pull these changes to apply against our "next"—a side effect of this particular series, which was rebased against our "next" rather than being kept aligned with our HEAD branch, no longer including changes against Frank Li's updates to the driver.
The following simple patch would be needed:
drivers/pci/controller/dwc/pci-layerscape.c +2 -2
@@ -278,7 +278,7 @@ static const struct dw_pcie_host_ops ls_pcie_host_ops = { };static const struct dw_pcie_host_ops ls1021a_pcie_host_ops = { - .host_init = ls_pcie_host_init, + .init = ls_pcie_host_init, .pme_turn_off = ls1021a_pcie_send_turnoff_msg, };
@@ -290,7 +290,7 @@ static const struct ls_pcie_drvdata ls1021a_drvdata = { };static const struct dw_pcie_host_ops ls1043a_pcie_host_ops = { - .host_init = ls_pcie_host_init, + .init = ls_pcie_host_init, .pme_turn_off = ls1043a_pcie_send_turnoff_msg, };
Krzysztof