]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.11.5/revert-ata-sata_mv-convert-to-devm_ioremap_resource.patch
Linux 5.1.5
[thirdparty/kernel/stable-queue.git] / releases / 4.11.5 / revert-ata-sata_mv-convert-to-devm_ioremap_resource.patch
1 From 3e4240da0e3673637c1c995bdd14cfdbc8f4dc4c Mon Sep 17 00:00:00 2001
2 From: Andrew Lunn <andrew@lunn.ch>
3 Date: Wed, 24 May 2017 01:39:35 +0200
4 Subject: Revert "ata: sata_mv: Convert to devm_ioremap_resource()"
5
6 From: Andrew Lunn <andrew@lunn.ch>
7
8 commit 3e4240da0e3673637c1c995bdd14cfdbc8f4dc4c upstream.
9
10 This reverts commit 368e5fbdfc60732643f34f538823ed4bc8829827.
11
12 devm_ioremap_resource() enforces that there are no overlapping
13 resources, where as devm_ioremap() does not. The sata phy driver needs
14 a subset of the sata IO address space, so maps some of the sata
15 address space. As a result, sata_mv now fails to probe, reporting it
16 cannot get its resources, and so we don't have any SATA disks.
17
18 Signed-off-by: Andrew Lunn <andrew@lunn.ch>
19 Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
20 Signed-off-by: Tejun Heo <tj@kernel.org>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22
23 ---
24 drivers/ata/sata_mv.c | 13 ++++++++-----
25 1 file changed, 8 insertions(+), 5 deletions(-)
26
27 --- a/drivers/ata/sata_mv.c
28 +++ b/drivers/ata/sata_mv.c
29 @@ -4067,7 +4067,6 @@ static int mv_platform_probe(struct plat
30 struct ata_host *host;
31 struct mv_host_priv *hpriv;
32 struct resource *res;
33 - void __iomem *mmio;
34 int n_ports = 0, irq = 0;
35 int rc;
36 int port;
37 @@ -4086,9 +4085,8 @@ static int mv_platform_probe(struct plat
38 * Get the register base first
39 */
40 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
41 - mmio = devm_ioremap_resource(&pdev->dev, res);
42 - if (IS_ERR(mmio))
43 - return PTR_ERR(mmio);
44 + if (res == NULL)
45 + return -EINVAL;
46
47 /* allocate host */
48 if (pdev->dev.of_node) {
49 @@ -4132,7 +4130,12 @@ static int mv_platform_probe(struct plat
50 hpriv->board_idx = chip_soc;
51
52 host->iomap = NULL;
53 - hpriv->base = mmio - SATAHC0_REG_BASE;
54 + hpriv->base = devm_ioremap(&pdev->dev, res->start,
55 + resource_size(res));
56 + if (!hpriv->base)
57 + return -ENOMEM;
58 +
59 + hpriv->base -= SATAHC0_REG_BASE;
60
61 hpriv->clk = clk_get(&pdev->dev, NULL);
62 if (IS_ERR(hpriv->clk))