aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2010-10-04 12:09:14 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-05 15:05:11 -0400
commit90173882ed15a8034d6d162da5f343a2c7d87587 (patch)
treeca7a366d93b4d93aa5d43d6e0005b13efee49866 /arch
parent07dea29a110b610a82ab7ecfea99b617d51c4965 (diff)
omap: add dsp platform device
Otherwise tidspbridge cannot work. It looks like this was dropped in the conversion to staging. I took the liberty of doing some cleaning up. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/Makefile4
-rw-r--r--arch/arm/mach-omap2/dsp.c85
-rw-r--r--arch/arm/plat-omap/common.c2
-rw-r--r--arch/arm/plat-omap/devices.c30
-rw-r--r--arch/arm/plat-omap/include/plat/dsp.h31
5 files changed, 152 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 88d3a1e920f5..58288a4771e1 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -102,6 +102,10 @@ obj-y += $(iommu-m) $(iommu-y)
102i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o 102i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
103obj-y += $(i2c-omap-m) $(i2c-omap-y) 103obj-y += $(i2c-omap-m) $(i2c-omap-y)
104 104
105ifneq ($(CONFIG_TIDSPBRIDGE),)
106obj-y += dsp.o
107endif
108
105# Specific board support 109# Specific board support
106obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o 110obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
107obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o 111obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
diff --git a/arch/arm/mach-omap2/dsp.c b/arch/arm/mach-omap2/dsp.c
new file mode 100644
index 000000000000..6feeeae6c21b
--- /dev/null
+++ b/arch/arm/mach-omap2/dsp.c
@@ -0,0 +1,85 @@
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#include <linux/platform_device.h>
15#include "prm.h"
16#include "cm.h"
17#ifdef CONFIG_BRIDGE_DVFS
18#include <plat/omap-pm.h>
19#endif
20
21#include <plat/dsp.h>
22
23extern phys_addr_t omap_dsp_get_mempool_base(void);
24
25static struct platform_device *omap_dsp_pdev;
26
27static struct omap_dsp_platform_data omap_dsp_pdata __initdata = {
28#ifdef CONFIG_BRIDGE_DVFS
29 .dsp_set_min_opp = omap_pm_dsp_set_min_opp,
30 .dsp_get_opp = omap_pm_dsp_get_opp,
31 .cpu_set_freq = omap_pm_cpu_set_freq,
32 .cpu_get_freq = omap_pm_cpu_get_freq,
33#endif
34 .dsp_prm_read = prm_read_mod_reg,
35 .dsp_prm_write = prm_write_mod_reg,
36 .dsp_prm_rmw_bits = prm_rmw_mod_reg_bits,
37 .dsp_cm_read = cm_read_mod_reg,
38 .dsp_cm_write = cm_write_mod_reg,
39 .dsp_cm_rmw_bits = cm_rmw_mod_reg_bits,
40};
41
42static int __init omap_dsp_init(void)
43{
44 struct platform_device *pdev;
45 int err = -ENOMEM;
46 struct omap_dsp_platform_data *pdata = &omap_dsp_pdata;
47
48 pdata->phys_mempool_base = omap_dsp_get_mempool_base();
49
50 if (pdata->phys_mempool_base) {
51 pdata->phys_mempool_size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
52 pr_info("%s: %x bytes @ %x\n", __func__,
53 pdata->phys_mempool_size, pdata->phys_mempool_base);
54 }
55
56 pdev = platform_device_alloc("omap-dsp", -1);
57 if (!pdev)
58 goto err_out;
59
60 err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
61 if (err)
62 goto err_out;
63
64 err = platform_device_add(pdev);
65 if (err)
66 goto err_out;
67
68 omap_dsp_pdev = pdev;
69 return 0;
70
71err_out:
72 platform_device_put(pdev);
73 return err;
74}
75module_init(omap_dsp_init);
76
77static void __exit omap_dsp_exit(void)
78{
79 platform_device_unregister(omap_dsp_pdev);
80}
81module_exit(omap_dsp_exit);
82
83MODULE_AUTHOR("Hiroshi DOYU");
84MODULE_DESCRIPTION("TI's OMAP DSP platform device registration");
85MODULE_LICENSE("GPL");
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 3008e7104487..57205a49289e 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -37,6 +37,7 @@
37#include <plat/fpga.h> 37#include <plat/fpga.h>
38#include <plat/serial.h> 38#include <plat/serial.h>
39#include <plat/vram.h> 39#include <plat/vram.h>
40#include <plat/dsp.h>
40 41
41#include <plat/clock.h> 42#include <plat/clock.h>
42 43
@@ -87,6 +88,7 @@ void __init omap_reserve(void)
87{ 88{
88 omapfb_reserve_sdram_memblock(); 89 omapfb_reserve_sdram_memblock();
89 omap_vram_reserve_sdram_memblock(); 90 omap_vram_reserve_sdram_memblock();
91 omap_dsp_reserve_sdram_memblock();
90} 92}
91 93
92/* 94/*
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index d1920be7833b..4c8f9b96aa6c 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -15,6 +15,7 @@
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/memblock.h>
18 19
19#include <mach/hardware.h> 20#include <mach/hardware.h>
20#include <asm/mach-types.h> 21#include <asm/mach-types.h>
@@ -272,6 +273,35 @@ static void omap_init_wdt(void)
272static inline void omap_init_wdt(void) {} 273static inline void omap_init_wdt(void) {}
273#endif 274#endif
274 275
276#if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE)
277
278static phys_addr_t omap_dsp_phys_mempool_base;
279
280void __init omap_dsp_reserve_sdram_memblock(void)
281{
282 phys_addr_t size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
283 phys_addr_t paddr;
284
285 if (!size)
286 return;
287
288 paddr = __memblock_alloc_base(size, SZ_1M, MEMBLOCK_REAL_LIMIT);
289 if (!paddr) {
290 pr_err("%s: failed to reserve %x bytes\n",
291 __func__, size);
292 return;
293 }
294
295 omap_dsp_phys_mempool_base = paddr;
296}
297
298phys_addr_t omap_dsp_get_mempool_base(void)
299{
300 return omap_dsp_phys_mempool_base;
301}
302EXPORT_SYMBOL(omap_dsp_get_mempool_base);
303#endif
304
275/* 305/*
276 * This gets called after board-specific INIT_MACHINE, and initializes most 306 * This gets called after board-specific INIT_MACHINE, and initializes most
277 * on-chip peripherals accessible on this board (except for few like USB): 307 * on-chip peripherals accessible on this board (except for few like USB):
diff --git a/arch/arm/plat-omap/include/plat/dsp.h b/arch/arm/plat-omap/include/plat/dsp.h
new file mode 100644
index 000000000000..9c604b390f9f
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/dsp.h
@@ -0,0 +1,31 @@
1#ifndef __OMAP_DSP_H__
2#define __OMAP_DSP_H__
3
4#include <linux/types.h>
5
6struct omap_dsp_platform_data {
7 void (*dsp_set_min_opp) (u8 opp_id);
8 u8 (*dsp_get_opp) (void);
9 void (*cpu_set_freq) (unsigned long f);
10 unsigned long (*cpu_get_freq) (void);
11 unsigned long mpu_speed[6];
12
13 /* functions to write and read PRCM registers */
14 void (*dsp_prm_write)(u32, s16 , u16);
15 u32 (*dsp_prm_read)(s16 , u16);
16 u32 (*dsp_prm_rmw_bits)(u32, u32, s16, s16);
17 void (*dsp_cm_write)(u32, s16 , u16);
18 u32 (*dsp_cm_read)(s16 , u16);
19 u32 (*dsp_cm_rmw_bits)(u32, u32, s16, s16);
20
21 phys_addr_t phys_mempool_base;
22 phys_addr_t phys_mempool_size;
23};
24
25#if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE)
26extern void omap_dsp_reserve_sdram_memblock(void);
27#else
28static inline void omap_dsp_reserve_sdram_memblock(void) { }
29#endif
30
31#endif