From: Rajashekhara, Sudhakar <sudhakar....@ti.com>

The drivers on da8xx/omapl EVMs do not utilize all the channels
and slots provided by EDMA. Some of these are better utilitzed by
the DSP on the SoC for speeding up codec operations.

Reserve these channels/slots for the DSP.

Signed-off-by: Sudhakar Rajashekhara <sudhakar....@ti.com>
Signed-off-by: Sekhar Nori <nsek...@ti.com>
---
Since v2, the channel/slot reservation has been made board specific
instead of imposing it on all users. Also, the da830 and da850 changes
are now in a single patch since a lot of common code is touched. 

Unfortunately it has been a long time since the patches were reviewed
last. Here is the relevant discussion thread:
http://www.mail-archive.com/davinci-linux-open-source@linux.davincidsp.com/msg16506.html

 arch/arm/mach-davinci/board-da830-evm.c    |   25 +++++++++++++++++-
 arch/arm/mach-davinci/board-da850-evm.c    |   38 +++++++++++++++++++++++++++-
 arch/arm/mach-davinci/devices-da8xx.c      |   26 ++++++++++++------
 arch/arm/mach-davinci/include/mach/da8xx.h |    4 ++-
 4 files changed, 81 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da830-evm.c 
b/arch/arm/mach-davinci/board-da830-evm.c
index dc19870..90088af 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -482,12 +482,35 @@ static struct davinci_i2c_platform_data 
da830_evm_i2c_0_pdata = {
        .bus_delay      = 0,    /* usec */
 };
 
+/*
+ * The following EDMA channels/slots are not being used by drivers (for
+ * example: Timer, GPIO, UART events etc) on da830/omap-l137 EVM, hence
+ * they are being reserved for codecs on the DSP side.
+ */
+static const s16 da830_dma_rsv_chans[][2] = {
+       /* (offset, number) */
+       { 8,  2},
+       {12,  2},
+       {24,  4},
+       {30,  2},
+       {-1, -1}
+};
+
+static const s16 da830_dma_rsv_slots[][2] = {
+       /* (offset, number) */
+       { 8,  2},
+       {12,  2},
+       {24,  4},
+       {30, 26},
+       {-1, -1}
+};
+
 static __init void da830_evm_init(void)
 {
        struct davinci_soc_info *soc_info = &davinci_soc_info;
        int ret;
 
-       ret = da8xx_register_edma();
+       ret = da830_register_edma(da830_dma_rsv_chans, da830_dma_rsv_slots);
        if (ret)
                pr_warning("da830_evm_init: edma registration failed: %d\n",
                                ret);
diff --git a/arch/arm/mach-davinci/board-da850-evm.c 
b/arch/arm/mach-davinci/board-da850-evm.c
index 411284d..37f9714 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -612,6 +612,41 @@ static int __init da850_evm_config_emac(void)
 }
 device_initcall(da850_evm_config_emac);
 
+/*
+ * The following EDMA channels/slots are not being used by drivers (for
+ * example: Timer, GPIO, UART events etc) on da850/omap-l138 EVM, hence
+ * they are being reserved for codecs on the DSP side.
+ */
+static const s16 da850_dma0_rsv_chans[][2] = {
+       /* (offset, number) */
+       { 8,  6},
+       {24,  4},
+       {30,  2},
+       {-1, -1}
+};
+
+static const s16 da850_dma0_rsv_slots[][2] = {
+       /* (offset, number) */
+       { 8,  6},
+       {24,  4},
+       {30, 50},
+       {-1, -1}
+};
+
+static const s16 da850_dma1_rsv_chans[][2] = {
+       /* (offset, number) */
+       { 0, 28},
+       {30,  2},
+       {-1, -1}
+};
+
+static const s16 da850_dma1_rsv_slots[][2] = {
+       /* (offset, number) */
+       { 0, 28},
+       {30, 90},
+       {-1, -1}
+};
+
 static __init void da850_evm_init(void)
 {
        int ret;
@@ -621,7 +656,8 @@ static __init void da850_evm_init(void)
                pr_warning("da850_evm_init: TPS65070 PMIC init failed: %d\n",
                                ret);
 
-       ret = da8xx_register_edma();
+       ret = da850_register_edma(da850_dma0_rsv_chans, da850_dma0_rsv_slots,
+                       da850_dma1_rsv_chans, da850_dma1_rsv_slots);
        if (ret)
                pr_warning("da850_evm_init: edma registration failed: %d\n",
                                ret);
diff --git a/arch/arm/mach-davinci/devices-da8xx.c 
b/arch/arm/mach-davinci/devices-da8xx.c
index 0a96791..6e913f8 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -248,18 +248,26 @@ static struct platform_device da850_edma_device = {
        .resource       = da850_edma_resources,
 };
 
-int __init da8xx_register_edma(void)
+int __init da830_register_edma(const s16 (*rsv_chans)[2],
+               const s16 (*rsv_slots)[2])
 {
-       struct platform_device *pdev;
+       da830_edma_info[0].rsv_chans = rsv_chans;
+       da830_edma_info[0].rsv_slots = rsv_slots;
 
-       if (cpu_is_davinci_da830())
-               pdev = &da830_edma_device;
-       else if (cpu_is_davinci_da850())
-               pdev = &da850_edma_device;
-       else
-               return -ENODEV;
+       return platform_device_register(&da830_edma_device);
+}
 
-       return platform_device_register(pdev);
+int __init da850_register_edma(const s16 (*rsv_chans0)[2],
+               const s16 (*rsv_slots0)[2], const s16 (*rsv_chans1)[2],
+               const s16 (*rsv_slots1)[2])
+{
+       da850_edma_info[0].rsv_chans = rsv_chans0;
+       da850_edma_info[0].rsv_slots = rsv_slots0;
+
+       da850_edma_info[1].rsv_chans = rsv_chans1;
+       da850_edma_info[1].rsv_slots = rsv_slots1;
+
+       return platform_device_register(&da850_edma_device);
 }
 
 static struct resource da8xx_i2c_resources0[] = {
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h 
b/arch/arm/mach-davinci/include/mach/da8xx.h
index b87a6ba..015be8c 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -86,7 +86,9 @@ extern void __iomem *da8xx_syscfg1_base;
 void __init da830_init(void);
 void __init da850_init(void);
 
-int da8xx_register_edma(void);
+int da830_register_edma(const s16 (*rsv_chans)[2], const s16 (*rsv_slots)[2]);
+int da850_register_edma(const s16 (*rsv_chans0)[2], const s16 (*rsv_slots0)[2],
+               const s16 (*rsv_chans1)[2], const s16 (*rsv_slots1)[2]);
 int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata);
 int da8xx_register_watchdog(void);
 int da8xx_register_usb20(unsigned mA, unsigned potpgt);
-- 
1.6.2.4

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to