diff options
author | Stephen Warren <swarren@nvidia.com> | 2013-11-06 18:20:54 -0500 |
---|---|---|
committer | Stephen Warren <swarren@nvidia.com> | 2013-12-11 18:43:04 -0500 |
commit | ca48080a039f667c9a1e2d6236ea18dde2d36e7e (patch) | |
tree | 963d693c3ac969bfc543fa85cad819233ce4d48f | |
parent | 3127a6b2a2342ecd7d7579ccbf39b50908b9df02 (diff) |
drm/tegra: use reset framework
Tegra's clock driver now provides an implementation of the common
reset API (include/linux/reset.h). Use this instead of the old Tegra-
specific API; that will soon be removed.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-By: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r-- | drivers/gpu/drm/tegra/Kconfig | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/dc.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/drm.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/gr3d.c | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/hdmi.c | 15 |
5 files changed, 39 insertions, 6 deletions
diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/drm/tegra/Kconfig index 8961ba6a34b8..8db9b3bce001 100644 --- a/drivers/gpu/drm/tegra/Kconfig +++ b/drivers/gpu/drm/tegra/Kconfig | |||
@@ -2,6 +2,7 @@ config DRM_TEGRA | |||
2 | bool "NVIDIA Tegra DRM" | 2 | bool "NVIDIA Tegra DRM" |
3 | depends on ARCH_TEGRA || ARCH_MULTIPLATFORM | 3 | depends on ARCH_TEGRA || ARCH_MULTIPLATFORM |
4 | depends on DRM | 4 | depends on DRM |
5 | depends on RESET_CONTROLLER | ||
5 | select TEGRA_HOST1X | 6 | select TEGRA_HOST1X |
6 | select DRM_KMS_HELPER | 7 | select DRM_KMS_HELPER |
7 | select DRM_KMS_FB_HELPER | 8 | select DRM_KMS_FB_HELPER |
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index ae1cb31ead7e..cd7f1e499616 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c | |||
@@ -8,8 +8,8 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
11 | #include <linux/clk/tegra.h> | ||
12 | #include <linux/debugfs.h> | 11 | #include <linux/debugfs.h> |
12 | #include <linux/reset.h> | ||
13 | 13 | ||
14 | #include "dc.h" | 14 | #include "dc.h" |
15 | #include "drm.h" | 15 | #include "drm.h" |
@@ -712,7 +712,7 @@ static void tegra_crtc_prepare(struct drm_crtc *crtc) | |||
712 | unsigned long value; | 712 | unsigned long value; |
713 | 713 | ||
714 | /* hardware initialization */ | 714 | /* hardware initialization */ |
715 | tegra_periph_reset_deassert(dc->clk); | 715 | reset_control_deassert(dc->rst); |
716 | usleep_range(10000, 20000); | 716 | usleep_range(10000, 20000); |
717 | 717 | ||
718 | if (dc->pipe) | 718 | if (dc->pipe) |
@@ -1187,6 +1187,12 @@ static int tegra_dc_probe(struct platform_device *pdev) | |||
1187 | return PTR_ERR(dc->clk); | 1187 | return PTR_ERR(dc->clk); |
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | dc->rst = devm_reset_control_get(&pdev->dev, "dc"); | ||
1191 | if (IS_ERR(dc->rst)) { | ||
1192 | dev_err(&pdev->dev, "failed to get reset\n"); | ||
1193 | return PTR_ERR(dc->rst); | ||
1194 | } | ||
1195 | |||
1190 | err = clk_prepare_enable(dc->clk); | 1196 | err = clk_prepare_enable(dc->clk); |
1191 | if (err < 0) | 1197 | if (err < 0) |
1192 | return err; | 1198 | return err; |
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index fdfe259ed7f8..f717c18b28c2 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h | |||
@@ -19,6 +19,8 @@ | |||
19 | #include <drm/drm_fb_helper.h> | 19 | #include <drm/drm_fb_helper.h> |
20 | #include <drm/drm_fixed.h> | 20 | #include <drm/drm_fixed.h> |
21 | 21 | ||
22 | struct reset_control; | ||
23 | |||
22 | struct tegra_fb { | 24 | struct tegra_fb { |
23 | struct drm_framebuffer base; | 25 | struct drm_framebuffer base; |
24 | struct tegra_bo **planes; | 26 | struct tegra_bo **planes; |
@@ -93,6 +95,7 @@ struct tegra_dc { | |||
93 | int pipe; | 95 | int pipe; |
94 | 96 | ||
95 | struct clk *clk; | 97 | struct clk *clk; |
98 | struct reset_control *rst; | ||
96 | void __iomem *regs; | 99 | void __iomem *regs; |
97 | int irq; | 100 | int irq; |
98 | 101 | ||
diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c index 4cec8f526af7..f629e38b00e4 100644 --- a/drivers/gpu/drm/tegra/gr3d.c +++ b/drivers/gpu/drm/tegra/gr3d.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/host1x.h> | 11 | #include <linux/host1x.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/reset.h> | ||
14 | #include <linux/tegra-powergate.h> | 15 | #include <linux/tegra-powergate.h> |
15 | 16 | ||
16 | #include "drm.h" | 17 | #include "drm.h" |
@@ -22,6 +23,8 @@ struct gr3d { | |||
22 | struct host1x_channel *channel; | 23 | struct host1x_channel *channel; |
23 | struct clk *clk_secondary; | 24 | struct clk *clk_secondary; |
24 | struct clk *clk; | 25 | struct clk *clk; |
26 | struct reset_control *rst_secondary; | ||
27 | struct reset_control *rst; | ||
25 | 28 | ||
26 | DECLARE_BITMAP(addr_regs, GR3D_NUM_REGS); | 29 | DECLARE_BITMAP(addr_regs, GR3D_NUM_REGS); |
27 | }; | 30 | }; |
@@ -255,12 +258,25 @@ static int gr3d_probe(struct platform_device *pdev) | |||
255 | return PTR_ERR(gr3d->clk); | 258 | return PTR_ERR(gr3d->clk); |
256 | } | 259 | } |
257 | 260 | ||
261 | gr3d->rst = devm_reset_control_get(&pdev->dev, "3d"); | ||
262 | if (IS_ERR(gr3d->rst)) { | ||
263 | dev_err(&pdev->dev, "cannot get reset\n"); | ||
264 | return PTR_ERR(gr3d->rst); | ||
265 | } | ||
266 | |||
258 | if (of_device_is_compatible(np, "nvidia,tegra30-gr3d")) { | 267 | if (of_device_is_compatible(np, "nvidia,tegra30-gr3d")) { |
259 | gr3d->clk_secondary = devm_clk_get(&pdev->dev, "3d2"); | 268 | gr3d->clk_secondary = devm_clk_get(&pdev->dev, "3d2"); |
260 | if (IS_ERR(gr3d->clk)) { | 269 | if (IS_ERR(gr3d->clk)) { |
261 | dev_err(&pdev->dev, "cannot get secondary clock\n"); | 270 | dev_err(&pdev->dev, "cannot get secondary clock\n"); |
262 | return PTR_ERR(gr3d->clk); | 271 | return PTR_ERR(gr3d->clk); |
263 | } | 272 | } |
273 | |||
274 | gr3d->rst_secondary = devm_reset_control_get(&pdev->dev, | ||
275 | "3d2"); | ||
276 | if (IS_ERR(gr3d->rst_secondary)) { | ||
277 | dev_err(&pdev->dev, "cannot get secondary reset\n"); | ||
278 | return PTR_ERR(gr3d->rst_secondary); | ||
279 | } | ||
264 | } | 280 | } |
265 | 281 | ||
266 | err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_3D, gr3d->clk); | 282 | err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_3D, gr3d->clk); |
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index 0cd9bc2056e8..7f6253ea5cb5 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c | |||
@@ -8,10 +8,10 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
11 | #include <linux/clk/tegra.h> | ||
12 | #include <linux/debugfs.h> | 11 | #include <linux/debugfs.h> |
13 | #include <linux/hdmi.h> | 12 | #include <linux/hdmi.h> |
14 | #include <linux/regulator/consumer.h> | 13 | #include <linux/regulator/consumer.h> |
14 | #include <linux/reset.h> | ||
15 | 15 | ||
16 | #include "hdmi.h" | 16 | #include "hdmi.h" |
17 | #include "drm.h" | 17 | #include "drm.h" |
@@ -49,6 +49,7 @@ struct tegra_hdmi { | |||
49 | 49 | ||
50 | struct clk *clk_parent; | 50 | struct clk *clk_parent; |
51 | struct clk *clk; | 51 | struct clk *clk; |
52 | struct reset_control *rst; | ||
52 | 53 | ||
53 | const struct tegra_hdmi_config *config; | 54 | const struct tegra_hdmi_config *config; |
54 | 55 | ||
@@ -731,9 +732,9 @@ static int tegra_output_hdmi_enable(struct tegra_output *output) | |||
731 | return err; | 732 | return err; |
732 | } | 733 | } |
733 | 734 | ||
734 | tegra_periph_reset_assert(hdmi->clk); | 735 | reset_control_assert(hdmi->rst); |
735 | usleep_range(1000, 2000); | 736 | usleep_range(1000, 2000); |
736 | tegra_periph_reset_deassert(hdmi->clk); | 737 | reset_control_deassert(hdmi->rst); |
737 | 738 | ||
738 | tegra_dc_writel(dc, VSYNC_H_POSITION(1), | 739 | tegra_dc_writel(dc, VSYNC_H_POSITION(1), |
739 | DC_DISP_DISP_TIMING_OPTIONS); | 740 | DC_DISP_DISP_TIMING_OPTIONS); |
@@ -912,7 +913,7 @@ static int tegra_output_hdmi_disable(struct tegra_output *output) | |||
912 | { | 913 | { |
913 | struct tegra_hdmi *hdmi = to_hdmi(output); | 914 | struct tegra_hdmi *hdmi = to_hdmi(output); |
914 | 915 | ||
915 | tegra_periph_reset_assert(hdmi->clk); | 916 | reset_control_assert(hdmi->rst); |
916 | clk_disable(hdmi->clk); | 917 | clk_disable(hdmi->clk); |
917 | regulator_disable(hdmi->pll); | 918 | regulator_disable(hdmi->pll); |
918 | 919 | ||
@@ -1338,6 +1339,12 @@ static int tegra_hdmi_probe(struct platform_device *pdev) | |||
1338 | return PTR_ERR(hdmi->clk); | 1339 | return PTR_ERR(hdmi->clk); |
1339 | } | 1340 | } |
1340 | 1341 | ||
1342 | hdmi->rst = devm_reset_control_get(&pdev->dev, "hdmi"); | ||
1343 | if (IS_ERR(hdmi->rst)) { | ||
1344 | dev_err(&pdev->dev, "failed to get reset\n"); | ||
1345 | return PTR_ERR(hdmi->rst); | ||
1346 | } | ||
1347 | |||
1341 | err = clk_prepare(hdmi->clk); | 1348 | err = clk_prepare(hdmi->clk); |
1342 | if (err < 0) | 1349 | if (err < 0) |
1343 | return err; | 1350 | return err; |