Re: [PATCH 1/2] omap: add dsp platform device

2010-10-05 Thread Greg KH
On Mon, Oct 04, 2010 at 07:09:14PM +0300, Felipe Contreras wrote:
 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.contre...@gmail.com
 ---
  arch/arm/mach-omap2/Makefile  |4 ++
  arch/arm/mach-omap2/dsp.c |   85 
 +
  arch/arm/plat-omap/common.c   |2 +
  arch/arm/plat-omap/devices.c  |   30 
  arch/arm/plat-omap/include/plat/dsp.h |   31 

I need an ack from some omap maintainers before I can take this into the
staging tree.

thanks,

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] omap: add dsp platform device

2010-10-05 Thread Greg KH
On Tue, Oct 05, 2010 at 09:28:30AM -0700, Tony Lindgren wrote:
 * Greg KH g...@kroah.com [101005 09:01]:
  On Mon, Oct 04, 2010 at 07:09:14PM +0300, Felipe Contreras wrote:
   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.contre...@gmail.com
   ---
arch/arm/mach-omap2/Makefile  |4 ++
arch/arm/mach-omap2/dsp.c |   85 
   +
arch/arm/plat-omap/common.c   |2 +
arch/arm/plat-omap/devices.c  |   30 
arch/arm/plat-omap/include/plat/dsp.h |   31 
  
  I need an ack from some omap maintainers before I can take this into the
  staging tree.
 
 Looks good to me
 
 Acked-by: Tony Lindgren t...@atomide.com

Thanks, I'll go queue it up now.

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] omap: add dsp platform device

2010-10-04 Thread Felipe Contreras
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.contre...@gmail.com
---
 arch/arm/mach-omap2/Makefile  |4 ++
 arch/arm/mach-omap2/dsp.c |   85 +
 arch/arm/plat-omap/common.c   |2 +
 arch/arm/plat-omap/devices.c  |   30 
 arch/arm/plat-omap/include/plat/dsp.h |   31 
 5 files changed, 152 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/dsp.c
 create mode 100644 arch/arm/plat-omap/include/plat/dsp.h

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 88d3a1e..58288a4 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -102,6 +102,10 @@ obj-y  += $(iommu-m) 
$(iommu-y)
 i2c-omap-$(CONFIG_I2C_OMAP):= i2c.o
 obj-y  += $(i2c-omap-m) $(i2c-omap-y)
 
+ifneq ($(CONFIG_TIDSPBRIDGE),)
+obj-y  += dsp.o
+endif
+
 # Specific board support
 obj-$(CONFIG_MACH_OMAP_GENERIC)+= board-generic.o
 obj-$(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 000..6feeeae
--- /dev/null
+++ b/arch/arm/mach-omap2/dsp.c
@@ -0,0 +1,85 @@
+/*
+ * TI's OMAP DSP platform device registration
+ *
+ * Copyright (C) 2005-2006 Texas Instruments, Inc.
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * Written by Hiroshi DOYU hiroshi.d...@nokia.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/platform_device.h
+#include prm.h
+#include cm.h
+#ifdef CONFIG_BRIDGE_DVFS
+#include plat/omap-pm.h
+#endif
+
+#include plat/dsp.h
+
+extern phys_addr_t omap_dsp_get_mempool_base(void);
+
+static struct platform_device *omap_dsp_pdev;
+
+static struct omap_dsp_platform_data omap_dsp_pdata __initdata = {
+#ifdef CONFIG_BRIDGE_DVFS
+   .dsp_set_min_opp = omap_pm_dsp_set_min_opp,
+   .dsp_get_opp = omap_pm_dsp_get_opp,
+   .cpu_set_freq = omap_pm_cpu_set_freq,
+   .cpu_get_freq = omap_pm_cpu_get_freq,
+#endif
+   .dsp_prm_read = prm_read_mod_reg,
+   .dsp_prm_write = prm_write_mod_reg,
+   .dsp_prm_rmw_bits = prm_rmw_mod_reg_bits,
+   .dsp_cm_read = cm_read_mod_reg,
+   .dsp_cm_write = cm_write_mod_reg,
+   .dsp_cm_rmw_bits = cm_rmw_mod_reg_bits,
+};
+
+static int __init omap_dsp_init(void)
+{
+   struct platform_device *pdev;
+   int err = -ENOMEM;
+   struct omap_dsp_platform_data *pdata = omap_dsp_pdata;
+
+   pdata-phys_mempool_base = omap_dsp_get_mempool_base();
+
+   if (pdata-phys_mempool_base) {
+   pdata-phys_mempool_size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
+   pr_info(%s: %x bytes @ %x\n, __func__,
+   pdata-phys_mempool_size, pdata-phys_mempool_base);
+   }
+
+   pdev = platform_device_alloc(omap-dsp, -1);
+   if (!pdev)
+   goto err_out;
+
+   err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
+   if (err)
+   goto err_out;
+
+   err = platform_device_add(pdev);
+   if (err)
+   goto err_out;
+
+   omap_dsp_pdev = pdev;
+   return 0;
+
+err_out:
+   platform_device_put(pdev);
+   return err;
+}
+module_init(omap_dsp_init);
+
+static void __exit omap_dsp_exit(void)
+{
+   platform_device_unregister(omap_dsp_pdev);
+}
+module_exit(omap_dsp_exit);
+
+MODULE_AUTHOR(Hiroshi DOYU);
+MODULE_DESCRIPTION(TI's OMAP DSP platform device registration);
+MODULE_LICENSE(GPL);
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 3008e71..57205a4 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -37,6 +37,7 @@
 #include plat/fpga.h
 #include plat/serial.h
 #include plat/vram.h
+#include plat/dsp.h
 
 #include plat/clock.h
 
@@ -87,6 +88,7 @@ void __init omap_reserve(void)
 {
omapfb_reserve_sdram_memblock();
omap_vram_reserve_sdram_memblock();
+   omap_dsp_reserve_sdram_memblock();
 }
 
 /*
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index d1920be..4c8f9b9 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -15,6 +15,7 @@
 #include linux/platform_device.h
 #include linux/io.h
 #include linux/slab.h
+#include linux/memblock.h
 
 #include mach/hardware.h
 #include asm/mach-types.h
@@ -272,6 +273,35 @@ static void omap_init_wdt(void)
 static inline void omap_init_wdt(void) {}
 #endif
 
+#if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE)
+
+static phys_addr_t omap_dsp_phys_mempool_base;
+
+void __init omap_dsp_reserve_sdram_memblock(void)