summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVince Hsu <vinceh@nvidia.com>2015-04-20 17:59:53 +0800
committerAlexandre Courbot <acourbot@nvidia.com>2015-08-06 13:26:23 +0900
commitc26cce979be2a99b4cf05a242328c93b641e8380 (patch)
treefd40630f6b498a16e6b02c9ad2ed1d93810edf32
parent4cff9d533fae3e7a63e90e2350c26a67eec030a7 (diff)
downloadnouveau-c26cce979be2a99b4cf05a242328c93b641e8380.tar.gz
drm/nouveau/platform: add one more reference clock
GM20B and GK20A have different reference clocks. Add one more handle for GM20B so taht the clock subdev can choose which one to use. Signed-off-by: Vince Hsu <vinceh@nvidia.com>
-rw-r--r--drm/nouveau/nouveau_platform.c16
-rw-r--r--drm/nouveau/nouveau_platform.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/drm/nouveau/nouveau_platform.c b/drm/nouveau/nouveau_platform.c
index 7a39d449f..c6ffbf0a8 100644
--- a/drm/nouveau/nouveau_platform.c
+++ b/drm/nouveau/nouveau_platform.c
@@ -45,6 +45,11 @@ static int nouveau_platform_power_up(struct nouveau_platform_gpu *gpu)
err = clk_prepare_enable(gpu->clk);
if (err)
goto err_clk;
+ if (gpu->clk_ref) {
+ err = clk_prepare_enable(gpu->clk_ref);
+ if (err)
+ goto err_clk_ref;
+ }
err = clk_prepare_enable(gpu->clk_pwr);
if (err)
goto err_clk_pwr;
@@ -67,6 +72,9 @@ static int nouveau_platform_power_up(struct nouveau_platform_gpu *gpu)
err_clamp:
clk_disable_unprepare(gpu->clk_pwr);
err_clk_pwr:
+ if (gpu->clk_ref)
+ clk_disable_unprepare(gpu->clk_ref);
+err_clk_ref:
clk_disable_unprepare(gpu->clk);
err_clk:
regulator_disable(gpu->vdd);
@@ -82,6 +90,8 @@ static int nouveau_platform_power_down(struct nouveau_platform_gpu *gpu)
udelay(10);
clk_disable_unprepare(gpu->clk_pwr);
+ if (gpu->clk_ref)
+ clk_disable_unprepare(gpu->clk_ref);
clk_disable_unprepare(gpu->clk);
udelay(10);
@@ -201,6 +211,12 @@ static int nouveau_platform_probe(struct platform_device *pdev)
if (IS_ERR(gpu->clk_pwr))
return PTR_ERR(gpu->clk_pwr);
+ gpu->clk_ref = devm_clk_get(&pdev->dev, "pllg_ref");
+ if (IS_ERR(gpu->clk_ref)) {
+ WARN(1, "failed to get gpu_ref clock\n");
+ gpu->clk_ref = NULL;
+ }
+
nouveau_platform_probe_iommu(&pdev->dev, gpu);
err = nouveau_platform_power_up(gpu);
diff --git a/drm/nouveau/nouveau_platform.h b/drm/nouveau/nouveau_platform.h
index 392874cf4..51e04c55e 100644
--- a/drm/nouveau/nouveau_platform.h
+++ b/drm/nouveau/nouveau_platform.h
@@ -35,6 +35,7 @@ struct platform_driver;
struct nouveau_platform_gpu {
struct reset_control *rst;
struct clk *clk;
+ struct clk *clk_ref;
struct clk *clk_pwr;
struct regulator *vdd;