diff options
Diffstat (limited to 'drivers/gpu/nvgpu/tegra/linux')
-rw-r--r-- | drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c | 44 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c | 31 |
2 files changed, 27 insertions, 48 deletions
diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c index 8a83f7d0..f55ea6d2 100644 --- a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c | |||
@@ -15,9 +15,6 @@ | |||
15 | 15 | ||
16 | #include <linux/version.h> | 16 | #include <linux/version.h> |
17 | #include <linux/of_platform.h> | 17 | #include <linux/of_platform.h> |
18 | #ifdef CONFIG_TEGRA_GK20A_NVHOST | ||
19 | #include <linux/nvhost.h> | ||
20 | #endif | ||
21 | #include <linux/debugfs.h> | 18 | #include <linux/debugfs.h> |
22 | #include <linux/platform_data/tegra_edp.h> | 19 | #include <linux/platform_data/tegra_edp.h> |
23 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
@@ -48,6 +45,7 @@ | |||
48 | #include <nvgpu/kmem.h> | 45 | #include <nvgpu/kmem.h> |
49 | #include <nvgpu/bug.h> | 46 | #include <nvgpu/bug.h> |
50 | #include <nvgpu/enabled.h> | 47 | #include <nvgpu/enabled.h> |
48 | #include <nvgpu/nvhost.h> | ||
51 | 49 | ||
52 | #include <nvgpu/linux/dma.h> | 50 | #include <nvgpu/linux/dma.h> |
53 | 51 | ||
@@ -721,8 +719,8 @@ void gk20a_tegra_debug_dump(struct device *dev) | |||
721 | struct gk20a_platform *platform = gk20a_get_platform(dev); | 719 | struct gk20a_platform *platform = gk20a_get_platform(dev); |
722 | struct gk20a *g = platform->g; | 720 | struct gk20a *g = platform->g; |
723 | 721 | ||
724 | if (g->host1x_dev) | 722 | if (g->nvhost_dev) |
725 | nvhost_debug_dump_device(g->host1x_dev); | 723 | nvgpu_nvhost_debug_dump_device(g->nvhost_dev); |
726 | #endif | 724 | #endif |
727 | } | 725 | } |
728 | 726 | ||
@@ -732,8 +730,8 @@ int gk20a_tegra_busy(struct device *dev) | |||
732 | struct gk20a_platform *platform = gk20a_get_platform(dev); | 730 | struct gk20a_platform *platform = gk20a_get_platform(dev); |
733 | struct gk20a *g = platform->g; | 731 | struct gk20a *g = platform->g; |
734 | 732 | ||
735 | if (g->host1x_dev) | 733 | if (g->nvhost_dev) |
736 | return nvhost_module_busy_ext(g->host1x_dev); | 734 | return nvgpu_nvhost_module_busy_ext(g->nvhost_dev); |
737 | #endif | 735 | #endif |
738 | return 0; | 736 | return 0; |
739 | } | 737 | } |
@@ -744,8 +742,8 @@ void gk20a_tegra_idle(struct device *dev) | |||
744 | struct gk20a_platform *platform = gk20a_get_platform(dev); | 742 | struct gk20a_platform *platform = gk20a_get_platform(dev); |
745 | struct gk20a *g = platform->g; | 743 | struct gk20a *g = platform->g; |
746 | 744 | ||
747 | if (g->host1x_dev) | 745 | if (g->nvhost_dev) |
748 | nvhost_module_idle_ext(g->host1x_dev); | 746 | nvgpu_nvhost_module_idle_ext(g->nvhost_dev); |
749 | #endif | 747 | #endif |
750 | } | 748 | } |
751 | 749 | ||
@@ -864,8 +862,6 @@ static int gk20a_tegra_probe(struct device *dev) | |||
864 | { | 862 | { |
865 | struct gk20a_platform *platform = dev_get_drvdata(dev); | 863 | struct gk20a_platform *platform = dev_get_drvdata(dev); |
866 | struct device_node *np = dev->of_node; | 864 | struct device_node *np = dev->of_node; |
867 | const __be32 *host1x_ptr; | ||
868 | struct platform_device *host1x_pdev = NULL; | ||
869 | bool joint_xpu_rail = false; | 865 | bool joint_xpu_rail = false; |
870 | int ret; | 866 | int ret; |
871 | 867 | ||
@@ -887,23 +883,11 @@ static int gk20a_tegra_probe(struct device *dev) | |||
887 | } | 883 | } |
888 | #endif | 884 | #endif |
889 | 885 | ||
890 | host1x_ptr = of_get_property(np, "nvidia,host1x", NULL); | 886 | #ifdef CONFIG_TEGRA_GK20A_NVHOST |
891 | if (host1x_ptr) { | 887 | ret = nvgpu_get_nvhost_dev(platform->g); |
892 | struct device_node *host1x_node = | 888 | if (ret) |
893 | of_find_node_by_phandle(be32_to_cpup(host1x_ptr)); | 889 | return ret; |
894 | 890 | #endif | |
895 | host1x_pdev = of_find_device_by_node(host1x_node); | ||
896 | if (!host1x_pdev) { | ||
897 | dev_warn(dev, "host1x device not available"); | ||
898 | return -EPROBE_DEFER; | ||
899 | } | ||
900 | |||
901 | } else { | ||
902 | host1x_pdev = to_platform_device(dev->parent); | ||
903 | dev_warn(dev, "host1x reference not found. assuming host1x to be parent"); | ||
904 | } | ||
905 | |||
906 | platform->g->host1x_dev = host1x_pdev; | ||
907 | 891 | ||
908 | #ifdef CONFIG_OF | 892 | #ifdef CONFIG_OF |
909 | joint_xpu_rail = of_property_read_bool(of_chosen, | 893 | joint_xpu_rail = of_property_read_bool(of_chosen, |
@@ -967,6 +951,10 @@ static int gk20a_tegra_remove(struct device *dev) | |||
967 | /* deinitialise tegra specific scaling quirks */ | 951 | /* deinitialise tegra specific scaling quirks */ |
968 | gk20a_tegra_scale_exit(dev); | 952 | gk20a_tegra_scale_exit(dev); |
969 | 953 | ||
954 | #ifdef CONFIG_TEGRA_GK20A_NVHOST | ||
955 | nvgpu_free_nvhost_dev(get_gk20a(dev)); | ||
956 | #endif | ||
957 | |||
970 | return 0; | 958 | return 0; |
971 | } | 959 | } |
972 | 960 | ||
diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c index 8b530fac..235473d3 100644 --- a/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c +++ b/drivers/gpu/nvgpu/tegra/linux/platform_gp10b_tegra.c | |||
@@ -14,7 +14,6 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/of_platform.h> | 16 | #include <linux/of_platform.h> |
17 | #include <linux/nvhost.h> | ||
18 | #include <linux/debugfs.h> | 17 | #include <linux/debugfs.h> |
19 | #include <linux/dma-buf.h> | 18 | #include <linux/dma-buf.h> |
20 | #include <linux/nvmap.h> | 19 | #include <linux/nvmap.h> |
@@ -30,6 +29,7 @@ | |||
30 | #include <nvgpu/bug.h> | 29 | #include <nvgpu/bug.h> |
31 | #include <nvgpu/enabled.h> | 30 | #include <nvgpu/enabled.h> |
32 | #include <nvgpu/hashtable.h> | 31 | #include <nvgpu/hashtable.h> |
32 | #include <nvgpu/nvhost.h> | ||
33 | 33 | ||
34 | #include "clk.h" | 34 | #include "clk.h" |
35 | 35 | ||
@@ -130,26 +130,14 @@ static void gp10b_tegra_scale_exit(struct device *dev) | |||
130 | static int gp10b_tegra_probe(struct device *dev) | 130 | static int gp10b_tegra_probe(struct device *dev) |
131 | { | 131 | { |
132 | struct gk20a_platform *platform = dev_get_drvdata(dev); | 132 | struct gk20a_platform *platform = dev_get_drvdata(dev); |
133 | struct gk20a *g = platform->g; | 133 | #ifdef CONFIG_TEGRA_GK20A_NVHOST |
134 | struct device_node *np = dev->of_node; | 134 | int ret; |
135 | struct device_node *host1x_node; | ||
136 | struct platform_device *host1x_pdev; | ||
137 | const __be32 *host1x_ptr; | ||
138 | |||
139 | host1x_ptr = of_get_property(np, "nvidia,host1x", NULL); | ||
140 | if (!host1x_ptr) { | ||
141 | nvgpu_err(g, "host1x device not available"); | ||
142 | return -ENOSYS; | ||
143 | } | ||
144 | 135 | ||
145 | host1x_node = of_find_node_by_phandle(be32_to_cpup(host1x_ptr)); | 136 | ret = nvgpu_get_nvhost_dev(platform->g); |
146 | host1x_pdev = of_find_device_by_node(host1x_node); | 137 | if (ret) |
147 | if (!host1x_pdev) { | 138 | return ret; |
148 | nvgpu_err(g, "host1x device not available"); | 139 | #endif |
149 | return -ENOSYS; | ||
150 | } | ||
151 | 140 | ||
152 | platform->g->host1x_dev = host1x_pdev; | ||
153 | platform->bypass_smmu = !device_is_iommuable(dev); | 141 | platform->bypass_smmu = !device_is_iommuable(dev); |
154 | platform->disable_bigpage = platform->bypass_smmu; | 142 | platform->disable_bigpage = platform->bypass_smmu; |
155 | 143 | ||
@@ -190,8 +178,11 @@ int gp10b_tegra_remove(struct device *dev) | |||
190 | /* deinitialise tegra specific scaling quirks */ | 178 | /* deinitialise tegra specific scaling quirks */ |
191 | gp10b_tegra_scale_exit(dev); | 179 | gp10b_tegra_scale_exit(dev); |
192 | 180 | ||
193 | return 0; | 181 | #ifdef CONFIG_TEGRA_GK20A_NVHOST |
182 | nvgpu_free_nvhost_dev(get_gk20a(dev)); | ||
183 | #endif | ||
194 | 184 | ||
185 | return 0; | ||
195 | } | 186 | } |
196 | 187 | ||
197 | static bool gp10b_tegra_is_railgated(struct device *dev) | 188 | static bool gp10b_tegra_is_railgated(struct device *dev) |