blob: 74f18f2952df220107c1846e98c4d34b7007243f [file] [log] [blame]
Felipe Contreras90173882010-10-04 19:09:14 +03001/*
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
Paul Walmsley59fb6592010-12-21 15:30:55 -070014/*
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
Tony Lindgrena1bcc1d2011-11-07 12:27:10 -080021#include <linux/module.h>
Felipe Contreras90173882010-10-04 19:09:14 +030022#include <linux/platform_device.h>
Paul Walmsley59fb6592010-12-21 15:30:55 -070023#include "cm2xxx_3xxx.h"
24#include "prm2xxx_3xxx.h"
Felipe Contreras90173882010-10-04 19:09:14 +030025#ifdef CONFIG_BRIDGE_DVFS
26#include <plat/omap-pm.h>
27#endif
28
29#include <plat/dsp.h>
30
31extern phys_addr_t omap_dsp_get_mempool_base(void);
32
33static struct platform_device *omap_dsp_pdev;
34
35static struct omap_dsp_platform_data omap_dsp_pdata __initdata = {
36#ifdef CONFIG_BRIDGE_DVFS
37 .dsp_set_min_opp = omap_pm_dsp_set_min_opp,
38 .dsp_get_opp = omap_pm_dsp_get_opp,
39 .cpu_set_freq = omap_pm_cpu_set_freq,
40 .cpu_get_freq = omap_pm_cpu_get_freq,
41#endif
Paul Walmsleyc4d7e582010-12-21 21:05:14 -070042 .dsp_prm_read = omap2_prm_read_mod_reg,
43 .dsp_prm_write = omap2_prm_write_mod_reg,
44 .dsp_prm_rmw_bits = omap2_prm_rmw_mod_reg_bits,
45 .dsp_cm_read = omap2_cm_read_mod_reg,
46 .dsp_cm_write = omap2_cm_write_mod_reg,
47 .dsp_cm_rmw_bits = omap2_cm_rmw_mod_reg_bits,
Felipe Contreras90173882010-10-04 19:09:14 +030048};
49
50static int __init omap_dsp_init(void)
51{
52 struct platform_device *pdev;
53 int err = -ENOMEM;
54 struct omap_dsp_platform_data *pdata = &omap_dsp_pdata;
55
56 pdata->phys_mempool_base = omap_dsp_get_mempool_base();
57
58 if (pdata->phys_mempool_base) {
59 pdata->phys_mempool_size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
60 pr_info("%s: %x bytes @ %x\n", __func__,
61 pdata->phys_mempool_size, pdata->phys_mempool_base);
62 }
63
64 pdev = platform_device_alloc("omap-dsp", -1);
65 if (!pdev)
66 goto err_out;
67
68 err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
69 if (err)
70 goto err_out;
71
72 err = platform_device_add(pdev);
73 if (err)
74 goto err_out;
75
76 omap_dsp_pdev = pdev;
77 return 0;
78
79err_out:
80 platform_device_put(pdev);
81 return err;
82}
83module_init(omap_dsp_init);
84
85static void __exit omap_dsp_exit(void)
86{
87 platform_device_unregister(omap_dsp_pdev);
88}
89module_exit(omap_dsp_exit);
90
91MODULE_AUTHOR("Hiroshi DOYU");
92MODULE_DESCRIPTION("TI's OMAP DSP platform device registration");
93MODULE_LICENSE("GPL");