From eea473d268548ffb8524bd41d0acce2acc2b2ec7 Mon Sep 17 00:00:00 2001 From: Sekhar Nori Date: Tue, 14 Jul 2009 11:44:32 +0530 Subject: u-boot: da850/omap-l138: include provision to wake up DSP. DSP is woken-up by default on DA850/OMAP-L138. To prevent DSP from being woken up, set the environment variable dspwake to no. --- board/da8xx/da8xx-evm/da830.c | 19 ++++++++-------- board/da8xx/da8xx-evm/da850.c | 41 +++++++++++++++++++++++++---------- drivers/usb/da8xx_usb.c | 4 ++-- include/asm-arm/arch-da8xx/hardware.h | 2 ++ 4 files changed, 43 insertions(+), 23 deletions(-) diff --git a/board/da8xx/da8xx-evm/da830.c b/board/da8xx/da8xx-evm/da830.c index 716caf65df..7268384a94 100644 --- a/board/da8xx/da8xx-evm/da830.c +++ b/board/da8xx/da8xx-evm/da830.c @@ -40,8 +40,7 @@ DECLARE_GLOBAL_DATA_PTR; extern void timer_init(void); extern int eth_hw_init(void); -/* Works on Always On power domain only (no PD argument) */ -void lpsc_on(unsigned int id) +void lpsc_on(unsigned domain, unsigned int id) { dv_reg_p mdstat, mdctl, ptstat, ptcmd; @@ -61,16 +60,16 @@ void lpsc_on(unsigned int id) ptcmd = REG_P(PSC1_PTCMD); } - while (*ptstat & 0x01) {;} + while (*ptstat & (0x1 << domain)) {;} if ((*mdstat & 0x1f) == 0x03) return; /* Already on and enabled */ *mdctl |= 0x03; - *ptcmd = 0x01; + *ptcmd = 0x01 << domain; - while (*ptstat & 0x01) {;} + while (*ptstat & (0x1 << domain)) {;} while ((*mdstat & 0x1f) != 0x03) {;} /* Probably an overkill... */ } @@ -122,11 +121,11 @@ int board_init(void) * assuming here that the DSP bootloader has set the IOPU * such that PSC access is available to ARM */ - lpsc_on(DAVINCI_LPSC_AEMIF); /* NAND, NOR */ - lpsc_on(DAVINCI_LPSC_SPI0); /* Serial Flash */ - lpsc_on(DAVINCI_LPSC_EMAC); /* image download */ - lpsc_on(DAVINCI_LPSC_UART2); /* console */ - lpsc_on(DAVINCI_LPSC_GPIO); + lpsc_on(0, DAVINCI_LPSC_AEMIF); /* NAND, NOR */ + lpsc_on(0, DAVINCI_LPSC_SPI0); /* Serial Flash */ + lpsc_on(0, DAVINCI_LPSC_EMAC); /* image download */ + lpsc_on(0, DAVINCI_LPSC_UART2); /* console */ + lpsc_on(0, DAVINCI_LPSC_GPIO); /* Pin Muxing support */ diff --git a/board/da8xx/da8xx-evm/da850.c b/board/da8xx/da8xx-evm/da850.c index 9702e3f368..ccc464d124 100644 --- a/board/da8xx/da8xx-evm/da850.c +++ b/board/da8xx/da8xx-evm/da850.c @@ -44,8 +44,7 @@ DECLARE_GLOBAL_DATA_PTR; extern void timer_init(void); extern int eth_hw_init(void); -/* Works on Always On power domain only (no PD argument) */ -void lpsc_on(unsigned int id) +void lpsc_on(unsigned domain, unsigned int id) { dv_reg_p mdstat, mdctl, ptstat, ptcmd; @@ -53,7 +52,7 @@ void lpsc_on(unsigned int id) return; if(id < 32) { - mdstat = REG_P(PSC0_MDSTAT + (id * 4)); + mdstat = REG_P(PSC0_MDSTAT + (id * 4)); mdctl = REG_P(PSC0_MDCTL + (id * 4)); ptstat = REG_P(PSC0_PTSTAT); ptcmd = REG_P(PSC0_PTCMD); @@ -65,16 +64,16 @@ void lpsc_on(unsigned int id) ptcmd = REG_P(PSC1_PTCMD); } - while (*ptstat & 0x01) {;} + while (*ptstat & (0x1 << domain)) {;} if ((*mdstat & 0x1f) == 0x03) return; /* Already on and enabled */ *mdctl |= 0x03; - *ptcmd = 0x01; + *ptcmd = 0x1 << domain; - while (*ptstat & 0x01) {;} + while (*ptstat & (0x1 << domain)) {;} while ((*mdstat & 0x1f) != 0x03) {;} /* Probably an overkill... */ } @@ -126,11 +125,11 @@ int board_init(void) * assuming here that the DSP bootloader has set the IOPU * such that PSC access is available to ARM */ - lpsc_on(DAVINCI_LPSC_AEMIF); /* NAND, NOR */ - lpsc_on(DAVINCI_LPSC_SPI1); /* Serial Flash */ - lpsc_on(DAVINCI_LPSC_EMAC); /* image download */ - lpsc_on(DAVINCI_LPSC_UART2); /* console */ - lpsc_on(DAVINCI_LPSC_GPIO); + lpsc_on(0, DAVINCI_LPSC_AEMIF); /* NAND, NOR */ + lpsc_on(0, DAVINCI_LPSC_SPI1); /* Serial Flash */ + lpsc_on(0, DAVINCI_LPSC_EMAC); /* image download */ + lpsc_on(0, DAVINCI_LPSC_UART2); /* console */ + lpsc_on(0, DAVINCI_LPSC_GPIO); /* Pin Muxing support */ @@ -234,6 +233,24 @@ err_probe: return ret; } +static void dspwake() +{ + unsigned *resetvect = (unsigned *)DAVINCI_L3CBARAM_BASE; + + if (!strcmp(getenv("dspwake"), "no")) + return; + + *resetvect++ = 0x1E000; /* DSP Idle */ + /* clear out the next 10 words as NOP */ + memset(resetvect, 0, sizeof(unsigned) * 10); + + /* setup the DSP reset vector */ + REG(HOST1CFG) = DAVINCI_L3CBARAM_BASE; + + lpsc_on(1, DAVINCI_LPSC_GEM); + REG(PSC0_MDCTL + (15 * 4)) |= 0x100; +} + int misc_init_r (void) { u_int8_t tmp[20], addr[10]; @@ -259,6 +276,8 @@ int misc_init_r (void) printf("Error: Ethernet init failed!\n"); } + dspwake(); + return(0); } diff --git a/drivers/usb/da8xx_usb.c b/drivers/usb/da8xx_usb.c index 6e46d436b0..8b45dfd21b 100755 --- a/drivers/usb/da8xx_usb.c +++ b/drivers/usb/da8xx_usb.c @@ -24,7 +24,7 @@ #include "da8xx_usb.h" /* extern functions */ -extern void lpsc_on(unsigned int id); +extern void lpsc_on(unsigned domain, unsigned int id); /* Timeout for DA8xx usb module */ #define DA8XX_USB_TIMEOUT 0x3FFFF @@ -173,7 +173,7 @@ int musb_platform_init(void) u32 revision; /* enable psc for usb2.0 */ - lpsc_on(33); + lpsc_on(0, 33); /* enable usb vbus */ enable_vbus(); diff --git a/include/asm-arm/arch-da8xx/hardware.h b/include/asm-arm/arch-da8xx/hardware.h index 84789d646f..670daa62ce 100644 --- a/include/asm-arm/arch-da8xx/hardware.h +++ b/include/asm-arm/arch-da8xx/hardware.h @@ -70,6 +70,7 @@ #define DAVINCI_ASYNC_EMIF_DATA_CE3_BASE (0x62000000) #define DAVINCI_ASYNC_EMIF_DATA_CE4_BASE (0x64000000) #define DAVINCI_ASYNC_EMIF_DATA_CE5_BASE (0x66000000) +#define DAVINCI_L3CBARAM_BASE (0x80000000) #define DAVINCI_DDR_EMIF_CTRL_BASE (0xb0000000) #define DAVINCI_DDR_EMIF_DATA_BASE (0xc0000000) #define DAVINCI_INTC_BASE (0xfffee000) @@ -177,6 +178,7 @@ /* Boot config */ #define JTAG_ID_REG (DAVINCI_BOOTCFG_BASE + 0x18) +#define HOST1CFG (DAVINCI_BOOTCFG_BASE + 0x44) #define PINMUX0 (DAVINCI_BOOTCFG_BASE + 0x120) #define PINMUX1 (DAVINCI_BOOTCFG_BASE + 0x124) #define PINMUX2 (DAVINCI_BOOTCFG_BASE + 0x128) -- cgit v1.2.3