aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap_dmm.c
blob: c2c44d2195151c0df65206e43accf3a295521d65 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * DMM driver support functions for TI OMAP processors.
 *
 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation version 2.
 *
 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
 * kind, whether express or implied; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
#include <linux/io.h>
#include <linux/init.h>
#include <linux/module.h>
#include <mach/dmm.h>
#include <plat/omap_device.h>
#include <plat/omap_hwmod.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <mach/dmm.h>
#include <mach/tiler.h>

#ifdef CONFIG_TI_TILER

static struct omap_dmm_platform_data dmm_data = {
	.oh_name = "dmm",
};

static struct platform_device omap_tiler_device = {
	.name           = "tiler",
	.id             = -1,
};

static struct omap_device_pm_latency omap_dmm_latency[] = {
	[0] = {
		.deactivate_func = omap_device_idle_hwmods,
		.activate_func = omap_device_enable_hwmods,
		.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
	},
};


void __init omap_dmm_init(void)
{
	struct omap_hwmod *oh = NULL;
	struct omap_device *od = NULL;

	oh = omap_hwmod_lookup(dmm_data.oh_name);
	if (!oh)
		return;

	dmm_data.base = omap_hwmod_get_mpu_rt_va(oh);
	dmm_data.irq = oh->mpu_irqs[0].irq;

	od = omap_device_build(dmm_data.oh_name, -1, oh, &dmm_data,
				sizeof(dmm_data), omap_dmm_latency,
				ARRAY_SIZE(omap_dmm_latency), false);

	/* register tiler platform device to go along with the dmm device */
	if (platform_device_register(&omap_tiler_device) < 0)
		printk(KERN_ERR "Unable to register OMAP Tiler device\n");

	return;
}

#else
void __init omap_dmm_init(void)
{
}
#endif