Merge tag 'davinci-for-v3.10/soc-2-v2' of git://git.kernel.org/pub/scm/linux/kernel...
authorOlof Johansson <olof@lixom.net>
Thu, 18 Apr 2013 06:53:11 +0000 (23:53 -0700)
committerOlof Johansson <olof@lixom.net>
Thu, 18 Apr 2013 06:53:20 +0000 (23:53 -0700)
From Sekhar Nori:
v3.10 SoC updates for DaVinci

This set of patches add support for remoteproc
used to control the DSP and also fix sparse
errors existing for quite some time.

* tag 'davinci-for-v3.10/soc-2-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci:
  ARM: davinci: ensure global variables are declared
  ARM: davinci: sram.c: fix incorrect type in assignment
  ARM: davinci: da8xx dt: make file local symbols static
  ARM: davinci: da8xx: add remoteproc support

Signed-off-by: Olof Johansson <olof@lixom.net>
Documentation/kernel-parameters.txt
arch/arm/mach-davinci/da8xx-dt.c
arch/arm/mach-davinci/devices-da8xx.c
arch/arm/mach-davinci/include/mach/da8xx.h
arch/arm/mach-davinci/pm.c
arch/arm/mach-davinci/sram.c
arch/arm/mach-davinci/usb.c

index 4609e81dbc37fc2dbfa005ff607890df3a8bbc6b..4a6d96214eedfad0c9382cd1c493239fb3298aaa 100644 (file)
@@ -44,6 +44,7 @@ parameter is applicable:
        AVR32   AVR32 architecture is enabled.
        AX25    Appropriate AX.25 support is enabled.
        BLACKFIN Blackfin architecture is enabled.
+       CMA     Contiguous Memory Area support is enabled.
        DRM     Direct Rendering Management support is enabled.
        DYNAMIC_DEBUG Build in debug messages and enable them at runtime
        EDD     BIOS Enhanced Disk Drive Services (EDD) is enabled
@@ -2663,6 +2664,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
                        Useful for devices that are detected asynchronously
                        (e.g. USB and MMC devices).
 
+       rproc_mem=nn[KMG][@address]
+                       [KNL,ARM,CMA] Remoteproc physical memory block.
+                       Memory area to be used by remote processor image,
+                       managed by CMA.
+
        rw              [KNL] Mount root device read-write on boot
 
        S               [KNL] Run init in single mode
index d83de8f8fa6bb395d247698e233fabcdec091594..b1c0a59582751a12142bbbac473dce3c01819fb9 100644 (file)
@@ -20,7 +20,7 @@
 
 #define DA8XX_NUM_UARTS        3
 
-void __init da8xx_uart_clk_enable(void)
+static void __init da8xx_uart_clk_enable(void)
 {
        int i;
        for (i = 0; i < DA8XX_NUM_UARTS; i++)
@@ -37,7 +37,7 @@ static void __init da8xx_init_irq(void)
        of_irq_init(da8xx_irq_match);
 }
 
-struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
+static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
        OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL),
        OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "watchdog", NULL),
        OF_DEV_AUXDATA("ti,da830-mmc", 0x01c40000, "da830-mmc.0", NULL),
index cb97e07db284df9b956b03dd3aeb28bc843cb0f2..bf572525175d44896813c3f03d9f2833e1352b54 100644 (file)
@@ -12,7 +12,7 @@
  */
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-contiguous.h>
 #include <linux/serial_8250.h>
 #include <linux/ahci_platform.h>
 #include <linux/clk.h>
@@ -714,6 +714,92 @@ int __init da850_register_mmcsd1(struct davinci_mmc_config *config)
 }
 #endif
 
+static struct resource da8xx_rproc_resources[] = {
+       { /* DSP boot address */
+               .start          = DA8XX_SYSCFG0_BASE + DA8XX_HOST1CFG_REG,
+               .end            = DA8XX_SYSCFG0_BASE + DA8XX_HOST1CFG_REG + 3,
+               .flags          = IORESOURCE_MEM,
+       },
+       { /* DSP interrupt registers */
+               .start          = DA8XX_SYSCFG0_BASE + DA8XX_CHIPSIG_REG,
+               .end            = DA8XX_SYSCFG0_BASE + DA8XX_CHIPSIG_REG + 7,
+               .flags          = IORESOURCE_MEM,
+       },
+       { /* dsp irq */
+               .start          = IRQ_DA8XX_CHIPINT0,
+               .end            = IRQ_DA8XX_CHIPINT0,
+               .flags          = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device da8xx_dsp = {
+       .name   = "davinci-rproc",
+       .dev    = {
+               .coherent_dma_mask      = DMA_BIT_MASK(32),
+       },
+       .num_resources  = ARRAY_SIZE(da8xx_rproc_resources),
+       .resource       = da8xx_rproc_resources,
+};
+
+#if IS_ENABLED(CONFIG_DA8XX_REMOTEPROC)
+
+static phys_addr_t rproc_base __initdata;
+static unsigned long rproc_size __initdata;
+
+static int __init early_rproc_mem(char *p)
+{
+       char *endp;
+
+       if (p == NULL)
+               return 0;
+
+       rproc_size = memparse(p, &endp);
+       if (*endp == '@')
+               rproc_base = memparse(endp + 1, NULL);
+
+       return 0;
+}
+early_param("rproc_mem", early_rproc_mem);
+
+void __init da8xx_rproc_reserve_cma(void)
+{
+       int ret;
+
+       if (!rproc_base || !rproc_size) {
+               pr_err("%s: 'rproc_mem=nn@address' badly specified\n"
+                      "    'nn' and 'address' must both be non-zero\n",
+                      __func__);
+
+               return;
+       }
+
+       pr_info("%s: reserving 0x%lx @ 0x%lx...\n",
+               __func__, rproc_size, (unsigned long)rproc_base);
+
+       ret = dma_declare_contiguous(&da8xx_dsp.dev, rproc_size, rproc_base, 0);
+       if (ret)
+               pr_err("%s: dma_declare_contiguous failed %d\n", __func__, ret);
+}
+
+#else
+
+void __init da8xx_rproc_reserve_cma(void)
+{
+}
+
+#endif
+
+int __init da8xx_register_rproc(void)
+{
+       int ret;
+
+       ret = platform_device_register(&da8xx_dsp);
+       if (ret)
+               pr_err("%s: can't register DSP device: %d\n", __func__, ret);
+
+       return ret;
+};
+
 static struct resource da8xx_rtc_resources[] = {
        {
                .start          = DA8XX_RTC_BASE,
index be77ce269cb0302282ec12aa1affec04bbe5db58..2e1c9eae0a5846932bf237d9b35a9155397e3744 100644 (file)
@@ -54,6 +54,8 @@ extern unsigned int da850_max_speed;
 #define DA8XX_SYSCFG0_BASE     (IO_PHYS + 0x14000)
 #define DA8XX_SYSCFG0_VIRT(x)  (da8xx_syscfg0_base + (x))
 #define DA8XX_JTAG_ID_REG      0x18
+#define DA8XX_HOST1CFG_REG     0x44
+#define DA8XX_CHIPSIG_REG      0x174
 #define DA8XX_CFGCHIP0_REG     0x17c
 #define DA8XX_CFGCHIP1_REG     0x180
 #define DA8XX_CFGCHIP2_REG     0x184
@@ -105,6 +107,8 @@ int __init da850_register_vpif_display
 int __init da850_register_vpif_capture
                        (struct vpif_capture_config *capture_config);
 void da8xx_restart(char mode, const char *cmd);
+void da8xx_rproc_reserve_cma(void);
+int da8xx_register_rproc(void);
 
 extern struct platform_device da8xx_serial_device;
 extern struct emac_platform_data da8xx_emac_pdata;
index eb8360b33aa9d4528a73562c585186949fe38657..a508fe587af731f7122fd0e1a745b99a12130874 100644 (file)
@@ -19,6 +19,7 @@
 #include <asm/delay.h>
 #include <asm/io.h>
 
+#include <mach/common.h>
 #include <mach/da8xx.h>
 #include <mach/sram.h>
 #include <mach/pm.h>
index c5f7ee5cc80ab3b6b6c2226798b233a8f59f1d0c..f18928b073f55de40cfab4d96ea7dd85c606d778 100644 (file)
@@ -62,7 +62,7 @@ static int __init sram_init(void)
        phys_addr_t phys = davinci_soc_info.sram_dma;
        unsigned len = davinci_soc_info.sram_len;
        int status = 0;
-       void *addr;
+       void __iomem *addr;
 
        if (len) {
                len = min_t(unsigned, len, SRAM_SIZE);
@@ -75,7 +75,7 @@ static int __init sram_init(void)
                addr = ioremap(phys, len);
                if (!addr)
                        return -ENOMEM;
-               status = gen_pool_add_virt(sram_pool, (unsigned)addr,
+               status = gen_pool_add_virt(sram_pool, (unsigned long) addr,
                                           phys, len, -1);
                if (status < 0)
                        iounmap(addr);
index 34509ffba221e18fb65670b5760870b71460f032..2b4c648f99b69a26cc5d946c1ed580d2c2e34585 100644 (file)
@@ -10,6 +10,7 @@
 #include <mach/common.h>
 #include <mach/irqs.h>
 #include <mach/cputype.h>
+#include <mach/da8xx.h>
 #include <linux/platform_data/usb-davinci.h>
 
 #define DAVINCI_USB_OTG_BASE   0x01c64000