da850: add support to wake up DSP during board init
authorNagabhushana Netagunte <nagabhushana.netagunte@ti.com>
Sun, 4 Sep 2011 02:19:28 +0000 (22:19 -0400)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Sun, 4 Sep 2011 09:36:19 +0000 (11:36 +0200)
add support for DSP wake-up by default on DA850/OMAP-L138
during board initialization. Enable hwconfig environment and added
extra env setting through CONFIG_EXTRA_ENV_SETTINGS.
To prevent DSP from being woken up,set the environment variable as,
set hwconfig "dsp:wake=no"

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Nagabhushana Netagunte <nagabhushana.netagunte@ti.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
arch/arm/include/asm/arch-davinci/hardware.h
board/davinci/da8xxevm/da850evm.c
include/configs/da850evm.h

index 646e2ced82709d6fdfc4ceae36788fbbaa53d638..4a3af7d3b6ad8e389de7daf7b391e60e9f5d8710 100644 (file)
@@ -153,7 +153,11 @@ typedef volatile unsigned int *    dv_reg_p;
 #define DAVINCI_DDR_EMIF_DATA_BASE             0xc0000000
 #define DAVINCI_INTC_BASE                      0xfffee000
 #define DAVINCI_BOOTCFG_BASE                   0x01c14000
+#define DAVINCI_L3CBARAM_BASE                  0x80000000
 #define JTAG_ID_REG                            (DAVINCI_BOOTCFG_BASE + 0x18)
+#define CHIP_REV_ID_REG                                (DAVINCI_BOOTCFG_BASE + 0x24)
+#define HOST1CFG                               (DAVINCI_BOOTCFG_BASE + 0x44)
+#define PSC0_MDCTL                             (DAVINCI_PSC0_BASE + 0xa00)
 
 #define GPIO_BANK2_REG_DIR_ADDR                        (DAVINCI_GPIO_BASE + 0x38)
 #define GPIO_BANK2_REG_OPDATA_ADDR             (DAVINCI_GPIO_BASE + 0x3c)
index d3d965cdaba68ed17aca45b3b2b056c7ab53c46a..8c3d64e787179e2c1ee53c61699b82a4b2d0ea68 100644 (file)
@@ -30,6 +30,7 @@
 #include <asm/arch/emac_defs.h>
 #include <asm/io.h>
 #include <asm/arch/davinci_misc.h>
+#include <hwconfig.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -163,6 +164,64 @@ const struct pinmux_config nor_pins[] = {
 #endif
 #endif /* CONFIG_DRIVER_TI_EMAC */
 
+void dsp_lpsc_on(unsigned domain, unsigned int id)
+{
+       dv_reg_p mdstat, mdctl, ptstat, ptcmd;
+       struct davinci_psc_regs *psc_regs;
+
+       psc_regs = davinci_psc0_regs;
+       mdstat = &psc_regs->psc0.mdstat[id];
+       mdctl = &psc_regs->psc0.mdctl[id];
+       ptstat = &psc_regs->ptstat;
+       ptcmd = &psc_regs->ptcmd;
+
+       while (*ptstat & (0x1 << domain))
+               ;
+
+       if ((*mdstat & 0x1f) == 0x03)
+               return;                 /* Already on and enabled */
+
+       *mdctl |= 0x03;
+
+       *ptcmd = 0x1 << domain;
+
+       while (*ptstat & (0x1 << domain))
+               ;
+       while ((*mdstat & 0x1f) != 0x03)
+               ;               /* Probably an overkill... */
+}
+
+static void dspwake(void)
+{
+       unsigned *resetvect = (unsigned *)DAVINCI_L3CBARAM_BASE;
+       u32 val;
+
+       /* if the device is ARM only, return */
+       if ((readl(CHIP_REV_ID_REG) & 0x3f) == 0x10)
+               return;
+
+       if (hwconfig_subarg_cmp_f("dsp", "wake", "no", NULL))
+               return;
+
+       *resetvect++ = 0x1E000; /* DSP Idle */
+       /* clear out the next 10 words as NOP */
+       memset(resetvect, 0, sizeof(unsigned) *10);
+
+       /* setup the DSP reset vector */
+       writel(DAVINCI_L3CBARAM_BASE, HOST1CFG);
+
+       dsp_lpsc_on(1, DAVINCI_LPSC_GEM);
+       val = readl(PSC0_MDCTL + (15 * 4));
+       val |= 0x100;
+       writel(val, (PSC0_MDCTL + (15 * 4)));
+}
+
+int misc_init_r(void)
+{
+       dspwake();
+       return 0;
+}
+
 static const struct pinmux_resource pinmuxes[] = {
 #ifdef CONFIG_SPI_FLASH
        PINMUX_ITEM(spi1_pins),
index cf0ceac4e397a85234dc2e382c98707ecce721db..9c924896b3c97a16d5d60c802f970f91076267af 100644 (file)
 /*
  * U-Boot general configuration
  */
+#define CONFIG_MISC_INIT_R
 #define CONFIG_BOOTFILE                "uImage" /* Boot file name */
 #define CONFIG_SYS_PROMPT      "U-Boot > " /* Command Prompt */
 #define CONFIG_SYS_CBSIZE      1024 /* Console I/O Buffer Size */
  * Linux Information
  */
 #define LINUX_BOOT_PARAM_ADDR  (PHYS_SDRAM_1 + 0x100)
+#define CONFIG_HWCONFIG                /* enable hwconfig */
 #define CONFIG_CMDLINE_TAG
 #define CONFIG_REVISION_TAG
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_BOOTARGS                \
        "mem=32M console=ttyS2,115200n8 root=/dev/mtdblock2 rw noinitrd ip=dhcp"
 #define CONFIG_BOOTDELAY       3
+#define CONFIG_EXTRA_ENV_SETTINGS      "hwconfig=dsp:wake=yes"
 
 /*
  * U-Boot commands