Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1297361

[PATCH v5 5/5] ARM: amba: Properly handle devices with power domains

From Marek Szyprowski <m.szyprowski@samsung.com>
Newsgroups linux.kernel
Subject [PATCH v5 5/5] ARM: amba: Properly handle devices with power domains
Date 2015-12-23 12:10 +0100
Message-ID <qIPsT-oU-43@gated-at.bofh.it> (permalink)
References <qIPsS-oU-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


To read pid/cid registers, the probed device need to be properly turned on.
When it is inside a power domain, the bus code should ensure that the
given power domain is enabled before trying to access device's registers.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/amba/bus.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 643127f..570033b 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -60,6 +60,10 @@ static int amba_read_periphid(struct amba_device *dev)
 	if (!tmp)
 		return -ENOMEM;
 
+	ret = dev_pm_domain_attach(&dev->dev, true);
+	if (ret == -EPROBE_DEFER)
+		goto err_unmap;
+
 	ret = amba_get_enable_pclk(dev);
 	if (ret == 0) {
 		u32 pid, cid;
@@ -84,6 +88,8 @@ static int amba_read_periphid(struct amba_device *dev)
 			ret = -ENODEV;
 	}
 
+	dev_pm_domain_detach(&dev->dev, true);
+err_unmap:
 	iounmap(tmp);
 
 	return ret;
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v5 0/5] AMBA: add complete support for power domains Marek Szyprowski <m.szyprowski@samsung.com> - 2015-12-23 12:10 +0100
  [PATCH v5 2/5] ARM: sa1111: ensure no negative value gets returned on  positive match Marek Szyprowski <m.szyprowski@samsung.com> - 2015-12-23 12:10 +0100
    Re: [PATCH v5 2/5] ARM: sa1111: ensure no negative value gets  returned on positive match Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-23 12:10 +0100
  [PATCH v5 1/5] drivers: nvdimm: ensure no negative value gets returned  on positive match Marek Szyprowski <m.szyprowski@samsung.com> - 2015-12-23 12:10 +0100
  [PATCH v5 4/5] ARM: amba: Move reading of periphid to amba_match() Marek Szyprowski <m.szyprowski@samsung.com> - 2015-12-23 12:10 +0100
  [PATCH v5 3/5] driver core: handle -EPROBE_DEFER from bus_type.match() Marek Szyprowski <m.szyprowski@samsung.com> - 2015-12-23 12:10 +0100
  [PATCH v5 5/5] ARM: amba: Properly handle devices with power domains Marek Szyprowski <m.szyprowski@samsung.com> - 2015-12-23 12:10 +0100

csiph-web