author: Thierry Reding <treding@nvidia.com> 2017-03-21 08:54:22 +0100
committer: Thierry Reding <treding@nvidia.com> 2017-04-05 18:11:50 +0200
commit: b386c6b73ac6c2a9a2f1201d055ab65cc19890a2
parent: 7e7d432c5a736e7106c8700b65d8c31b93bd1c82
Commit Summary:
Diffstat:
2 files changed, 19 insertions, 1 deletion
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index 8a0d97243c9c..f05ebb14fa63 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -170,6 +170,13 @@ static int host1x_probe(struct platform_device *pdev)
return err;
}
+ host->rst = devm_reset_control_get(&pdev->dev, "host1x");
+ if (IS_ERR(host->rst)) {
+ err = PTR_ERR(host->clk);
+ dev_err(&pdev->dev, "failed to get reset: %d\n", err);
+ return err;
+ }
+
if (iommu_present(&platform_bus_type)) {
struct iommu_domain_geometry *geometry;
unsigned long order;
@@ -203,10 +210,16 @@ static int host1x_probe(struct platform_device *pdev)
goto fail_detach_device;
}
+ err = reset_control_deassert(host->rst);
+ if (err < 0) {
+ dev_err(&pdev->dev, "failed to deassert reset: %d\n", err);
+ goto fail_unprepare_disable;
+ }
+
err = host1x_syncpt_init(host);
if (err) {
dev_err(&pdev->dev, "failed to initialize syncpts\n");
- goto fail_unprepare_disable;
+ goto fail_reset_assert;
}
err = host1x_intr_init(host, syncpt_irq);
@@ -227,6 +240,8 @@ fail_deinit_intr:
host1x_intr_deinit(host);
fail_deinit_syncpt:
host1x_syncpt_deinit(host);
+fail_reset_assert:
+ reset_control_assert(host->rst);
fail_unprepare_disable:
clk_disable_unprepare(host->clk);
fail_detach_device:
@@ -248,6 +263,7 @@ static int host1x_remove(struct platform_device *pdev)
host1x_unregister(host);
host1x_intr_deinit(host);
host1x_syncpt_deinit(host);
+ reset_control_assert(host->rst);
clk_disable_unprepare(host->clk);
if (host->domain) {
diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h
index 561c5776cafb..229d08b6a45e 100644
--- a/drivers/gpu/host1x/dev.h
+++ b/drivers/gpu/host1x/dev.h
@@ -21,6 +21,7 @@
#include <linux/iommu.h>
#include <linux/iova.h>
#include <linux/platform_device.h>
+#include <linux/reset.h>
#include "cdma.h"
#include "channel.h"
@@ -109,6 +110,7 @@ struct host1x {
struct host1x_syncpt_base *bases;
struct device *dev;
struct clk *clk;
+ struct reset_control *rst;
struct iommu_domain *domain;
struct iova_domain iova;