1 From 27cf0ad95cdf30f52a5fc6c69014a0d7bf5a1222 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Wed, 8 Jan 2020 17:21:09 +0000
4 Subject: [PATCH] pcie-brcmstb: Eliminate arch_dma_ops error message
6 The driver attempts to set the dma_ops for the root complex, but doing
7 so causes an error message and only the end points need it. Fix the
8 error by making the code specific to the end point case.
10 Also copy some cosmetic tidy-ups from 5.5.y.
12 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
14 drivers/pci/controller/pcie-brcmstb.c | 43 ++++++++++++++-------------
15 1 file changed, 22 insertions(+), 21 deletions(-)
17 --- a/drivers/pci/controller/pcie-brcmstb.c
18 +++ b/drivers/pci/controller/pcie-brcmstb.c
19 @@ -633,16 +633,17 @@ static int brcmstb_platform_notifier(str
22 case BUS_NOTIFY_ADD_DEVICE:
23 - if (max_pfn > (bounce_threshold/PAGE_SIZE) &&
24 - strcmp(dev->kobj.name, rc_name)) {
26 - ret = brcm_pcie_bounce_register_dev(dev);
29 - "brcm_pcie_bounce_register_dev() failed: %d\n",
32 + if (strcmp(dev->kobj.name, rc_name)) {
33 + if (max_pfn > (bounce_threshold/PAGE_SIZE)) {
34 + ret = brcm_pcie_bounce_register_dev(dev);
37 + "brcm_pcie_bounce_register_dev() failed: %d\n",
42 + brcm_set_dma_ops(dev);
43 } else if (IS_ENABLED(CONFIG_ARM64)) {
44 ret = of_dma_configure(dev, dev->of_node, true);
46 @@ -650,7 +651,6 @@ static int brcmstb_platform_notifier(str
50 - brcm_set_dma_ops(dev);
53 case BUS_NOTIFY_DEL_DEVICE:
54 @@ -1685,7 +1685,8 @@ MODULE_DEVICE_TABLE(of, brcm_pcie_match)
56 static int brcm_pcie_probe(struct platform_device *pdev)
58 - struct device_node *dn = pdev->dev.of_node, *msi_dn;
59 + struct device *dev = &pdev->dev;
60 + struct device_node *dn = dev->of_node, *msi_dn;
61 const struct of_device_id *of_id;
62 const struct pcie_cfg_data *data;
64 @@ -1696,7 +1697,7 @@ static int brcm_pcie_probe(struct platfo
65 struct pci_bus *child;
66 extern unsigned long max_pfn;
68 - bridge = devm_pci_alloc_host_bridge(&pdev->dev, sizeof(*pcie));
69 + bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
73 @@ -1705,7 +1706,7 @@ static int brcm_pcie_probe(struct platfo
75 of_id = of_match_node(brcm_pcie_match, dn);
77 - dev_err(&pdev->dev, "failed to look up compatible string\n");
78 + dev_err(dev, "failed to look up compatible string\n");
82 @@ -1715,7 +1716,7 @@ static int brcm_pcie_probe(struct platfo
83 pcie->max_burst_size = data->max_burst_size;
84 pcie->type = data->type;
86 - pcie->dev = &pdev->dev;
89 /* We use the domain number as our controller number */
90 pcie->id = of_get_pci_domain_nr(dn);
91 @@ -1726,18 +1727,18 @@ static int brcm_pcie_probe(struct platfo
95 - base = devm_ioremap_resource(&pdev->dev, res);
96 + base = devm_ioremap_resource(dev, res);
100 /* To Do: Add hardware check if this ever gets fixed */
101 if (max_pfn > (bounce_threshold/PAGE_SIZE)) {
103 - ret = brcm_pcie_bounce_init(&pdev->dev, bounce_buffer,
104 + ret = brcm_pcie_bounce_init(dev, bounce_buffer,
105 (dma_addr_t)bounce_threshold);
107 if (ret != -EPROBE_DEFER)
108 - dev_err(&pdev->dev,
110 "could not init bounce buffers: %d\n",
113 @@ -1746,7 +1747,7 @@ static int brcm_pcie_probe(struct platfo
115 pcie->clk = of_clk_get_by_name(dn, "sw_pcie");
116 if (IS_ERR(pcie->clk)) {
117 - dev_warn(&pdev->dev, "could not get clock\n");
118 + dev_warn(dev, "could not get clock\n");
122 @@ -1756,7 +1757,7 @@ static int brcm_pcie_probe(struct platfo
124 pcie->ssc = of_property_read_bool(dn, "brcm,enable-ssc");
126 - ret = irq_of_parse_and_map(pdev->dev.of_node, 0);
127 + ret = irq_of_parse_and_map(dev->of_node, 0);
129 /* keep going, as we don't use this intr yet */
130 dev_warn(pcie->dev, "cannot get PCIe interrupt\n");
131 @@ -1770,7 +1771,7 @@ static int brcm_pcie_probe(struct platfo
132 ret = clk_prepare_enable(pcie->clk);
134 if (ret != -EPROBE_DEFER)
135 - dev_err(&pdev->dev, "could not enable clock\n");
136 + dev_err(dev, "could not enable clock\n");
140 @@ -1797,7 +1798,7 @@ static int brcm_pcie_probe(struct platfo
143 list_splice_init(&pcie->resources, &bridge->windows);
144 - bridge->dev.parent = &pdev->dev;
145 + bridge->dev.parent = dev;
147 bridge->ops = &brcm_pcie_ops;
148 bridge->sysdata = pcie;