diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2011-08-12 11:21:32 +0300 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-08-25 16:24:49 -0700 |
commit | d3ef98f172c4afa51c1d2880c187952cf559188e (patch) | |
tree | 6d522ec7c70bc792eff85431a9f74681319047fb /drivers | |
parent | dba6aef853a7a03631d45a8a9d87fb8cfd1fb072 (diff) |
tegra: nvhost: Runtime retrieval of chip type
Use tegra_get_chipid() to the chip type at run-time instead of own code
based on build-time flags.
Bug 839973
Change-Id: Iecb20be2bdc909627d4dd096a735518ba9cb2976
Reviewed-on: http://git-master/r/46886
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/tegra/host/chip_support.h | 43 | ||||
-rw-r--r-- | drivers/video/tegra/host/dev.c | 11 | ||||
-rw-r--r-- | drivers/video/tegra/host/dev.h | 1 | ||||
-rw-r--r-- | drivers/video/tegra/host/t30/t30.c | 2 |
4 files changed, 15 insertions, 42 deletions
diff --git a/drivers/video/tegra/host/chip_support.h b/drivers/video/tegra/host/chip_support.h index 16dd55dc0f2b..c0f44d1a2f26 100644 --- a/drivers/video/tegra/host/chip_support.h +++ b/drivers/video/tegra/host/chip_support.h @@ -25,6 +25,17 @@ struct output; struct nvhost_waitchk; struct nvhost_userctx_timeout; +struct nvhost_master; +struct nvhost_channel; +struct nvmap_handle; +struct nvhost_waitchk; +struct nvmap_client; +struct nvhost_hwctx; +struct nvhost_cdma; +struct nvhost_intr; +struct push_buffer; +struct nvhost_syncpt; +struct nvhost_cpuaccess; struct nvhost_chip_support { struct { @@ -141,36 +152,4 @@ struct nvhost_chip_support { int nvhost_init_t20_support(struct nvhost_master *host); int nvhost_init_t30_support(struct nvhost_master *host); - -/* place holder for chip id assumed to live in kernel/arch/arm/mach-tegra */ -struct tegra_chip_info { -#define TEGRA_SOC_CHIP_ARCH_T20 0 -#define TEGRA_SOC_CHIP_IMPL_T20 0 - u16 arch; -#define TEGRA_SOC_CHIP_ARCH_T30 1 -#define TEGRA_SOC_CHIP_IMPL_T30 0 - u16 impl; -}; - -#if 0 -extern int tegra_get_chip_info(struct tegra_chip_info *); -#else -static inline int tegra_get_chip_info(struct tegra_chip_info *ci) -{ -#if defined(CONFIG_ARCH_TEGRA_3x_SOC) - ci->arch = TEGRA_SOC_CHIP_ARCH_T30; - ci->impl = TEGRA_SOC_CHIP_IMPL_T30; - -#elif defined(CONFIG_ARCH_TEGRA_2x_SOC) - ci->arch = TEGRA_SOC_CHIP_ARCH_T20; - ci->impl = TEGRA_SOC_CHIP_IMPL_T20; - -#else - return -ENODEV; -#endif - - return 0; -} -#endif - #endif /* _NVHOST_CHIP_SUPPORT_H_ */ diff --git a/drivers/video/tegra/host/dev.c b/drivers/video/tegra/host/dev.c index 5869e6f9805d..ad1f137fbdcc 100644 --- a/drivers/video/tegra/host/dev.c +++ b/drivers/video/tegra/host/dev.c @@ -41,6 +41,7 @@ #include <linux/nvhost_ioctl.h> #include <mach/nvmap.h> #include <mach/gpufuse.h> +#include <mach/hardware.h> #include "nvhost_scale.h" #include "debug.h" @@ -805,16 +806,12 @@ static void nvhost_remove_chip_support(struct nvhost_master *host) static int __devinit nvhost_init_chip_support(struct nvhost_master *host) { int err; - err = tegra_get_chip_info(&host->chip_info); - if (err) - return err; - - switch (host->chip_info.arch) { - case TEGRA_SOC_CHIP_ARCH_T20: + switch (tegra_get_chipid()) { + case TEGRA_CHIPID_TEGRA2: err = nvhost_init_t20_support(host); break; - case TEGRA_SOC_CHIP_ARCH_T30: + case TEGRA_CHIPID_TEGRA3: err = nvhost_init_t30_support(host); break; default: diff --git a/drivers/video/tegra/host/dev.h b/drivers/video/tegra/host/dev.h index 02b248b38d62..45217a3ea1a1 100644 --- a/drivers/video/tegra/host/dev.h +++ b/drivers/video/tegra/host/dev.h @@ -53,7 +53,6 @@ struct nvhost_master { u32 sync_queue_size; - struct tegra_chip_info chip_info; struct nvhost_chip_support op; }; diff --git a/drivers/video/tegra/host/t30/t30.c b/drivers/video/tegra/host/t30/t30.c index 5185541f029a..2b9c3d8fb186 100644 --- a/drivers/video/tegra/host/t30/t30.c +++ b/drivers/video/tegra/host/t30/t30.c @@ -25,7 +25,6 @@ /* t30 uses t20 entry points */ #include "../t20/t20.h" -#if defined(CONFIG_ARCH_TEGRA_3x_SOC) int nvhost_init_t30_support(struct nvhost_master *host) { int err; @@ -51,4 +50,3 @@ int nvhost_init_t30_support(struct nvhost_master *host) return err; return 0; } -#endif |