aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>2019-03-08 22:52:13 +0530
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>2019-03-09 07:05:07 +0530
commite912de4f907aec13459b64e0d64e51abd31d1e06 (patch)
treef123e22bc7d6fb336e7530bcb489b97d79a449a0
parent851ca779d110f694b5d078bc4af06d3ad37169e8 (diff)
download96b-common-e912de4f907aec13459b64e0d64e51abd31d1e06.tar.gz
amba: Take device out of reset before reading pid and cid values
For the AMBA Primecell devices having the reset lines wired, it is necessary to take them out of reset before reading the pid and cid values. Earlier we were dependent on the bootloader to do this but a more cleaner approach would be to do it in the kernel itself. Hence, this commit deasserts the reset line just before reading the pid and cid values. Suggested-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-rw-r--r--drivers/amba/bus.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 41b706403ef7..da8f1aac5315 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -21,6 +21,7 @@
#include <linux/limits.h>
#include <linux/clk/clk-conf.h>
#include <linux/platform_device.h>
+#include <linux/reset.h>
#include <asm/irq.h>
@@ -352,6 +353,7 @@ static void amba_device_release(struct device *dev)
static int amba_device_try_add(struct amba_device *dev, struct resource *parent)
{
+ struct reset_control *rst;
u32 size;
void __iomem *tmp;
int i, ret;
@@ -388,6 +390,13 @@ static int amba_device_try_add(struct amba_device *dev, struct resource *parent)
if (ret == 0) {
u32 pid, cid;
+ /* De-assert the reset line to take the device out of reset */
+ rst = reset_control_get_optional_exclusive(&dev->dev, NULL);
+ if (IS_ERR(rst))
+ return PTR_ERR(rst);
+
+ reset_control_deassert(rst);
+
/*
* Read pid and cid based on size of resource
* they are located at end of region