Merge tag 'omap-cleanup-a-for-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git...
[deliverable/linux.git] / arch / arm / mach-omap2 / dsp.c
1 /*
2 * TI's OMAP DSP platform device registration
3 *
4 * Copyright (C) 2005-2006 Texas Instruments, Inc.
5 * Copyright (C) 2009 Nokia Corporation
6 *
7 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14 /*
15 * XXX The function pointers to the PRM/CM functions are incorrect and
16 * should be removed. No device driver should be changing PRM/CM bits
17 * directly; that's a layering violation -- those bits are the responsibility
18 * of the OMAP PM core code.
19 */
20
21 #include <linux/module.h>
22 #include <linux/platform_device.h>
23 #include "control.h"
24 #include "cm2xxx_3xxx.h"
25 #include "prm2xxx_3xxx.h"
26 #ifdef CONFIG_BRIDGE_DVFS
27 #include <plat/omap-pm.h>
28 #endif
29
30 #include <plat/dsp.h>
31
32 static struct platform_device *omap_dsp_pdev;
33
34 static struct omap_dsp_platform_data omap_dsp_pdata __initdata = {
35 #ifdef CONFIG_BRIDGE_DVFS
36 .dsp_set_min_opp = omap_pm_dsp_set_min_opp,
37 .dsp_get_opp = omap_pm_dsp_get_opp,
38 .cpu_set_freq = omap_pm_cpu_set_freq,
39 .cpu_get_freq = omap_pm_cpu_get_freq,
40 #endif
41 .dsp_prm_read = omap2_prm_read_mod_reg,
42 .dsp_prm_write = omap2_prm_write_mod_reg,
43 .dsp_prm_rmw_bits = omap2_prm_rmw_mod_reg_bits,
44 .dsp_cm_read = omap2_cm_read_mod_reg,
45 .dsp_cm_write = omap2_cm_write_mod_reg,
46 .dsp_cm_rmw_bits = omap2_cm_rmw_mod_reg_bits,
47
48 .set_bootaddr = omap_ctrl_write_dsp_boot_addr,
49 .set_bootmode = omap_ctrl_write_dsp_boot_mode,
50 };
51
52 static phys_addr_t omap_dsp_phys_mempool_base;
53
54 void __init omap_dsp_reserve_sdram_memblock(void)
55 {
56 phys_addr_t size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
57 phys_addr_t paddr;
58
59 if (!size)
60 return;
61
62 paddr = arm_memblock_steal(size, SZ_1M);
63 if (!paddr) {
64 pr_err("%s: failed to reserve %llx bytes\n",
65 __func__, (unsigned long long)size);
66 return;
67 }
68
69 omap_dsp_phys_mempool_base = paddr;
70 }
71
72 static phys_addr_t omap_dsp_get_mempool_base(void)
73 {
74 return omap_dsp_phys_mempool_base;
75 }
76
77 static int __init omap_dsp_init(void)
78 {
79 struct platform_device *pdev;
80 int err = -ENOMEM;
81 struct omap_dsp_platform_data *pdata = &omap_dsp_pdata;
82
83 pdata->phys_mempool_base = omap_dsp_get_mempool_base();
84
85 if (pdata->phys_mempool_base) {
86 pdata->phys_mempool_size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
87 pr_info("%s: %llx bytes @ %llx\n", __func__,
88 (unsigned long long)pdata->phys_mempool_size,
89 (unsigned long long)pdata->phys_mempool_base);
90 }
91
92 pdev = platform_device_alloc("omap-dsp", -1);
93 if (!pdev)
94 goto err_out;
95
96 err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
97 if (err)
98 goto err_out;
99
100 err = platform_device_add(pdev);
101 if (err)
102 goto err_out;
103
104 omap_dsp_pdev = pdev;
105 return 0;
106
107 err_out:
108 platform_device_put(pdev);
109 return err;
110 }
111 module_init(omap_dsp_init);
112
113 static void __exit omap_dsp_exit(void)
114 {
115 platform_device_unregister(omap_dsp_pdev);
116 }
117 module_exit(omap_dsp_exit);
118
119 MODULE_AUTHOR("Hiroshi DOYU");
120 MODULE_DESCRIPTION("TI's OMAP DSP platform device registration");
121 MODULE_LICENSE("GPL");
This page took 0.039225 seconds and 5 git commands to generate.