Linux Audio

Check our new training course

In-person Linux kernel drivers training

Jun 16-20, 2025
Register
Loading...
v3.5.6
  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
 24#include <asm/memblock.h>
 25
 26#include "cm2xxx_3xxx.h"
 27#include "prm2xxx_3xxx.h"
 28#ifdef CONFIG_BRIDGE_DVFS
 29#include <plat/omap-pm.h>
 30#endif
 31
 32#include <plat/dsp.h>
 33
 
 
 34static struct platform_device *omap_dsp_pdev;
 35
 36static struct omap_dsp_platform_data omap_dsp_pdata __initdata = {
 37#ifdef CONFIG_BRIDGE_DVFS
 38	.dsp_set_min_opp = omap_pm_dsp_set_min_opp,
 39	.dsp_get_opp = omap_pm_dsp_get_opp,
 40	.cpu_set_freq = omap_pm_cpu_set_freq,
 41	.cpu_get_freq = omap_pm_cpu_get_freq,
 42#endif
 43	.dsp_prm_read = omap2_prm_read_mod_reg,
 44	.dsp_prm_write = omap2_prm_write_mod_reg,
 45	.dsp_prm_rmw_bits = omap2_prm_rmw_mod_reg_bits,
 46	.dsp_cm_read = omap2_cm_read_mod_reg,
 47	.dsp_cm_write = omap2_cm_write_mod_reg,
 48	.dsp_cm_rmw_bits = omap2_cm_rmw_mod_reg_bits,
 49};
 50
 51static phys_addr_t omap_dsp_phys_mempool_base;
 52
 53void __init omap_dsp_reserve_sdram_memblock(void)
 54{
 55	phys_addr_t size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
 56	phys_addr_t paddr;
 57
 58	if (!size)
 59		return;
 60
 61	paddr = arm_memblock_steal(size, SZ_1M);
 62	if (!paddr) {
 63		pr_err("%s: failed to reserve %llx bytes\n",
 64				__func__, (unsigned long long)size);
 65		return;
 66	}
 67
 68	omap_dsp_phys_mempool_base = paddr;
 69}
 70
 71static phys_addr_t omap_dsp_get_mempool_base(void)
 72{
 73	return omap_dsp_phys_mempool_base;
 74}
 75
 76static int __init omap_dsp_init(void)
 77{
 78	struct platform_device *pdev;
 79	int err = -ENOMEM;
 80	struct omap_dsp_platform_data *pdata = &omap_dsp_pdata;
 81
 82	pdata->phys_mempool_base = omap_dsp_get_mempool_base();
 83
 84	if (pdata->phys_mempool_base) {
 85		pdata->phys_mempool_size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
 86		pr_info("%s: %llx bytes @ %llx\n", __func__,
 87			(unsigned long long)pdata->phys_mempool_size,
 88			(unsigned long long)pdata->phys_mempool_base);
 89	}
 90
 91	pdev = platform_device_alloc("omap-dsp", -1);
 92	if (!pdev)
 93		goto err_out;
 94
 95	err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
 96	if (err)
 97		goto err_out;
 98
 99	err = platform_device_add(pdev);
100	if (err)
101		goto err_out;
102
103	omap_dsp_pdev = pdev;
104	return 0;
105
106err_out:
107	platform_device_put(pdev);
108	return err;
109}
110module_init(omap_dsp_init);
111
112static void __exit omap_dsp_exit(void)
113{
114	platform_device_unregister(omap_dsp_pdev);
115}
116module_exit(omap_dsp_exit);
117
118MODULE_AUTHOR("Hiroshi DOYU");
119MODULE_DESCRIPTION("TI's OMAP DSP platform device registration");
120MODULE_LICENSE("GPL");
v3.1
 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/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
27
28#include <plat/dsp.h>
29
30extern phys_addr_t omap_dsp_get_mempool_base(void);
31
32static struct platform_device *omap_dsp_pdev;
33
34static 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49static int __init omap_dsp_init(void)
50{
51	struct platform_device *pdev;
52	int err = -ENOMEM;
53	struct omap_dsp_platform_data *pdata = &omap_dsp_pdata;
54
55	pdata->phys_mempool_base = omap_dsp_get_mempool_base();
56
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);
 
61	}
62
63	pdev = platform_device_alloc("omap-dsp", -1);
64	if (!pdev)
65		goto err_out;
66
67	err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
68	if (err)
69		goto err_out;
70
71	err = platform_device_add(pdev);
72	if (err)
73		goto err_out;
74
75	omap_dsp_pdev = pdev;
76	return 0;
77
78err_out:
79	platform_device_put(pdev);
80	return err;
81}
82module_init(omap_dsp_init);
83
84static void __exit omap_dsp_exit(void)
85{
86	platform_device_unregister(omap_dsp_pdev);
87}
88module_exit(omap_dsp_exit);
89
90MODULE_AUTHOR("Hiroshi DOYU");
91MODULE_DESCRIPTION("TI's OMAP DSP platform device registration");
92MODULE_LICENSE("GPL");