forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c
....@@ -52,18 +52,18 @@
5252 clk_set_rate(tdev->clk_pwr, 204000000);
5353 udelay(10);
5454
55
- reset_control_assert(tdev->rst);
56
- udelay(10);
57
-
5855 if (!tdev->pdev->dev.pm_domain) {
56
+ reset_control_assert(tdev->rst);
57
+ udelay(10);
58
+
5959 ret = tegra_powergate_remove_clamping(TEGRA_POWERGATE_3D);
6060 if (ret)
6161 goto err_clamp;
6262 udelay(10);
63
- }
6463
65
- reset_control_deassert(tdev->rst);
66
- udelay(10);
64
+ reset_control_deassert(tdev->rst);
65
+ udelay(10);
66
+ }
6767
6868 return 0;
6969
....@@ -123,7 +123,7 @@
123123
124124 mutex_init(&tdev->iommu.mutex);
125125
126
- if (iommu_present(&platform_bus_type)) {
126
+ if (device_iommu_mapped(dev)) {
127127 tdev->iommu.domain = iommu_domain_alloc(&platform_bus_type);
128128 if (!tdev->iommu.domain)
129129 goto error;
....@@ -279,6 +279,7 @@
279279 struct nvkm_device **pdevice)
280280 {
281281 struct nvkm_device_tegra *tdev;
282
+ unsigned long rate;
282283 int ret;
283284
284285 if (!(tdev = kzalloc(sizeof(*tdev), GFP_KERNEL)))
....@@ -307,6 +308,17 @@
307308 goto free;
308309 }
309310
311
+ rate = clk_get_rate(tdev->clk);
312
+ if (rate == 0) {
313
+ ret = clk_set_rate(tdev->clk, ULONG_MAX);
314
+ if (ret < 0)
315
+ goto free;
316
+
317
+ rate = clk_get_rate(tdev->clk);
318
+
319
+ dev_dbg(&pdev->dev, "GPU clock set to %lu\n", rate);
320
+ }
321
+
310322 if (func->require_ref_clk)
311323 tdev->clk_ref = devm_clk_get(&pdev->dev, "ref");
312324 if (IS_ERR(tdev->clk_ref)) {