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/module.h>
22 #include <linux/platform_device.h>
24 #include <asm/memblock.h>
27 #include "cm2xxx_3xxx.h"
28 #include "prm2xxx_3xxx.h"
29 #ifdef CONFIG_TIDSPBRIDGE_DVFS
34 #include <linux/platform_data/dsp-omap.h>
36 static struct platform_device
*omap_dsp_pdev
;
38 static struct omap_dsp_platform_data omap_dsp_pdata __initdata
= {
39 #ifdef CONFIG_TIDSPBRIDGE_DVFS
40 .dsp_set_min_opp
= omap_pm_dsp_set_min_opp
,
41 .dsp_get_opp
= omap_pm_dsp_get_opp
,
42 .cpu_set_freq
= omap_pm_cpu_set_freq
,
43 .cpu_get_freq
= omap_pm_cpu_get_freq
,
45 .dsp_prm_read
= omap2_prm_read_mod_reg
,
46 .dsp_prm_write
= omap2_prm_write_mod_reg
,
47 .dsp_prm_rmw_bits
= omap2_prm_rmw_mod_reg_bits
,
48 .dsp_cm_read
= omap2_cm_read_mod_reg
,
49 .dsp_cm_write
= omap2_cm_write_mod_reg
,
50 .dsp_cm_rmw_bits
= omap2_cm_rmw_mod_reg_bits
,
52 .set_bootaddr
= omap_ctrl_write_dsp_boot_addr
,
53 .set_bootmode
= omap_ctrl_write_dsp_boot_mode
,
56 static phys_addr_t omap_dsp_phys_mempool_base
;
58 void __init
omap_dsp_reserve_sdram_memblock(void)
60 phys_addr_t size
= CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE
;
63 if (!cpu_is_omap34xx())
69 paddr
= arm_memblock_steal(size
, SZ_1M
);
71 pr_err("%s: failed to reserve %llx bytes\n",
72 __func__
, (unsigned long long)size
);
76 omap_dsp_phys_mempool_base
= paddr
;
79 static phys_addr_t
omap_dsp_get_mempool_base(void)
81 return omap_dsp_phys_mempool_base
;
84 static int __init
omap_dsp_init(void)
86 struct platform_device
*pdev
;
88 struct omap_dsp_platform_data
*pdata
= &omap_dsp_pdata
;
90 if (!cpu_is_omap34xx())
93 pdata
->phys_mempool_base
= omap_dsp_get_mempool_base();
95 if (pdata
->phys_mempool_base
) {
96 pdata
->phys_mempool_size
= CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE
;
97 pr_info("%s: %llx bytes @ %llx\n", __func__
,
98 (unsigned long long)pdata
->phys_mempool_size
,
99 (unsigned long long)pdata
->phys_mempool_base
);
102 pdev
= platform_device_alloc("omap-dsp", -1);
106 err
= platform_device_add_data(pdev
, pdata
, sizeof(*pdata
));
110 err
= platform_device_add(pdev
);
114 omap_dsp_pdev
= pdev
;
118 platform_device_put(pdev
);
121 module_init(omap_dsp_init
);
123 static void __exit
omap_dsp_exit(void)
125 if (!cpu_is_omap34xx())
128 platform_device_unregister(omap_dsp_pdev
);
130 module_exit(omap_dsp_exit
);
132 MODULE_AUTHOR("Hiroshi DOYU");
133 MODULE_DESCRIPTION("TI's OMAP DSP platform device registration");
134 MODULE_LICENSE("GPL");