Add linux-next specific files for 20110516
[linux-2.6/next.git] / arch / arm / mach-omap2 / dsp.c
blob911cd2e68d46e060291e67a14110e86f17e232f5
1 /*
2 * TI's OMAP DSP platform device registration
4 * Copyright (C) 2005-2006 Texas Instruments, Inc.
5 * Copyright (C) 2009 Nokia Corporation
7 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
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.
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.
21 #include <linux/platform_device.h>
22 #include "cm2xxx_3xxx.h"
23 #include "prm2xxx_3xxx.h"
24 #ifdef CONFIG_BRIDGE_DVFS
25 #include <plat/omap-pm.h>
26 #endif
28 #include <plat/dsp.h>
30 extern phys_addr_t omap_dsp_get_mempool_base(void);
32 static struct platform_device *omap_dsp_pdev;
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,
49 static int __init omap_dsp_init(void)
51 struct platform_device *pdev;
52 int err = -ENOMEM;
53 struct omap_dsp_platform_data *pdata = &omap_dsp_pdata;
55 pdata->phys_mempool_base = omap_dsp_get_mempool_base();
57 if (pdata->phys_mempool_base) {
58 pdata->phys_mempool_size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
59 pr_info("%s: %x bytes @ %x\n", __func__,
60 pdata->phys_mempool_size, pdata->phys_mempool_base);
63 pdev = platform_device_alloc("omap-dsp", -1);
64 if (!pdev)
65 goto err_out;
67 err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
68 if (err)
69 goto err_out;
71 err = platform_device_add(pdev);
72 if (err)
73 goto err_out;
75 omap_dsp_pdev = pdev;
76 return 0;
78 err_out:
79 platform_device_put(pdev);
80 return err;
82 module_init(omap_dsp_init);
84 static void __exit omap_dsp_exit(void)
86 platform_device_unregister(omap_dsp_pdev);
88 module_exit(omap_dsp_exit);
90 MODULE_AUTHOR("Hiroshi DOYU");
91 MODULE_DESCRIPTION("TI's OMAP DSP platform device registration");
92 MODULE_LICENSE("GPL");