summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/host/chip_support.c
blob: 9abb1fa026a48b913750a76c31b444567c743206 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * drivers/video/tegra/host/chip_support.c
 *
 * Tegra Graphics Host Chip support module
 *
 * Copyright (c) 2012, NVIDIA Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <linux/errno.h>

#include <mach/hardware.h>

#include "bus.h"
#include "chip_support.h"
#include "t20/t20.h"
#include "t30/t30.h"

struct nvhost_chip_support *nvhost_get_chip_ops(void)
{
	return (nvhost_bus_get())->nvhost_chip_ops;
}

int nvhost_init_chip_support(struct nvhost_master *host)
{
	int err = 0;
	struct nvhost_chip_support *chip_ops;

	chip_ops = nvhost_get_chip_ops();

	switch (tegra_get_chipid()) {
	case TEGRA_CHIPID_TEGRA2:
		err = nvhost_init_t20_support(host, chip_ops);
		break;

	case TEGRA_CHIPID_TEGRA3:
		err = nvhost_init_t30_support(host, chip_ops);
		break;

	default:
		err = -ENODEV;
	}

	return err;
}