aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorRobert Tivy <rtivy@ti.com>2013-03-28 21:41:46 -0400
committerSekhar Nori <nsekhar@ti.com>2013-04-17 09:56:40 -0400
commit5c71d6181f5c23c35415bddf1414f840e9149f8c (patch)
treeee684a2f80a7bf4cc555e8150ef6fbafc6e96778 /arch/arm
parent93bd65150e4ee783b7366fd0e8172f347515df61 (diff)
ARM: davinci: da8xx: add remoteproc support
Add remoteproc platform device for controlling the DSP on da8xx. The patch uses CMA-based reservation of physical memory block for DSP use. A new kernel command-line parameter has been added to allow boot-time specification of the physical memory block. Signed-off-by: Robert Tivy <rtivy@ti.com> [nsekhar@ti.com: edit commit message for readability and style improvements] Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c88
-rw-r--r--arch/arm/mach-davinci/include/mach/da8xx.h4
2 files changed, 91 insertions, 1 deletions
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index cb97e07db284..bf572525175d 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -12,7 +12,7 @@
12 */ 12 */
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/dma-mapping.h> 15#include <linux/dma-contiguous.h>
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/ahci_platform.h> 17#include <linux/ahci_platform.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
@@ -714,6 +714,92 @@ int __init da850_register_mmcsd1(struct davinci_mmc_config *config)
714} 714}
715#endif 715#endif
716 716
717static struct resource da8xx_rproc_resources[] = {
718 { /* DSP boot address */
719 .start = DA8XX_SYSCFG0_BASE + DA8XX_HOST1CFG_REG,
720 .end = DA8XX_SYSCFG0_BASE + DA8XX_HOST1CFG_REG + 3,
721 .flags = IORESOURCE_MEM,
722 },
723 { /* DSP interrupt registers */
724 .start = DA8XX_SYSCFG0_BASE + DA8XX_CHIPSIG_REG,
725 .end = DA8XX_SYSCFG0_BASE + DA8XX_CHIPSIG_REG + 7,
726 .flags = IORESOURCE_MEM,
727 },
728 { /* dsp irq */
729 .start = IRQ_DA8XX_CHIPINT0,
730 .end = IRQ_DA8XX_CHIPINT0,
731 .flags = IORESOURCE_IRQ,
732 },
733};
734
735static struct platform_device da8xx_dsp = {
736 .name = "davinci-rproc",
737 .dev = {
738 .coherent_dma_mask = DMA_BIT_MASK(32),
739 },
740 .num_resources = ARRAY_SIZE(da8xx_rproc_resources),
741 .resource = da8xx_rproc_resources,
742};
743
744#if IS_ENABLED(CONFIG_DA8XX_REMOTEPROC)
745
746static phys_addr_t rproc_base __initdata;
747static unsigned long rproc_size __initdata;
748
749static int __init early_rproc_mem(char *p)
750{
751 char *endp;
752
753 if (p == NULL)
754 return 0;
755
756 rproc_size = memparse(p, &endp);
757 if (*endp == '@')
758 rproc_base = memparse(endp + 1, NULL);
759
760 return 0;
761}
762early_param("rproc_mem", early_rproc_mem);
763
764void __init da8xx_rproc_reserve_cma(void)
765{
766 int ret;
767
768 if (!rproc_base || !rproc_size) {
769 pr_err("%s: 'rproc_mem=nn@address' badly specified\n"
770 " 'nn' and 'address' must both be non-zero\n",
771 __func__);
772
773 return;
774 }
775
776 pr_info("%s: reserving 0x%lx @ 0x%lx...\n",
777 __func__, rproc_size, (unsigned long)rproc_base);
778
779 ret = dma_declare_contiguous(&da8xx_dsp.dev, rproc_size, rproc_base, 0);
780 if (ret)
781 pr_err("%s: dma_declare_contiguous failed %d\n", __func__, ret);
782}
783
784#else
785
786void __init da8xx_rproc_reserve_cma(void)
787{
788}
789
790#endif
791
792int __init da8xx_register_rproc(void)
793{
794 int ret;
795
796 ret = platform_device_register(&da8xx_dsp);
797 if (ret)
798 pr_err("%s: can't register DSP device: %d\n", __func__, ret);
799
800 return ret;
801};
802
717static struct resource da8xx_rtc_resources[] = { 803static struct resource da8xx_rtc_resources[] = {
718 { 804 {
719 .start = DA8XX_RTC_BASE, 805 .start = DA8XX_RTC_BASE,
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index be77ce269cb0..2e1c9eae0a58 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -54,6 +54,8 @@ extern unsigned int da850_max_speed;
54#define DA8XX_SYSCFG0_BASE (IO_PHYS + 0x14000) 54#define DA8XX_SYSCFG0_BASE (IO_PHYS + 0x14000)
55#define DA8XX_SYSCFG0_VIRT(x) (da8xx_syscfg0_base + (x)) 55#define DA8XX_SYSCFG0_VIRT(x) (da8xx_syscfg0_base + (x))
56#define DA8XX_JTAG_ID_REG 0x18 56#define DA8XX_JTAG_ID_REG 0x18
57#define DA8XX_HOST1CFG_REG 0x44
58#define DA8XX_CHIPSIG_REG 0x174
57#define DA8XX_CFGCHIP0_REG 0x17c 59#define DA8XX_CFGCHIP0_REG 0x17c
58#define DA8XX_CFGCHIP1_REG 0x180 60#define DA8XX_CFGCHIP1_REG 0x180
59#define DA8XX_CFGCHIP2_REG 0x184 61#define DA8XX_CFGCHIP2_REG 0x184
@@ -105,6 +107,8 @@ int __init da850_register_vpif_display
105int __init da850_register_vpif_capture 107int __init da850_register_vpif_capture
106 (struct vpif_capture_config *capture_config); 108 (struct vpif_capture_config *capture_config);
107void da8xx_restart(char mode, const char *cmd); 109void da8xx_restart(char mode, const char *cmd);
110void da8xx_rproc_reserve_cma(void);
111int da8xx_register_rproc(void);
108 112
109extern struct platform_device da8xx_serial_device; 113extern struct platform_device da8xx_serial_device;
110extern struct emac_platform_data da8xx_emac_pdata; 114extern struct emac_platform_data da8xx_emac_pdata;