From patchwork Thu Oct 13 07:26:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Riesch X-Patchwork-Id: 119377 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id D685DB6F7C for ; Thu, 13 Oct 2011 18:28:09 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 32BE928BFE; Thu, 13 Oct 2011 09:27:59 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cRhLvghjyfTt; Thu, 13 Oct 2011 09:27:58 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0F50028BAA; Thu, 13 Oct 2011 09:27:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 28F8328715 for ; Thu, 13 Oct 2011 09:27:19 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LZcWdCViJYSY for ; Thu, 13 Oct 2011 09:27:16 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtprelay06.ispgateway.de (smtprelay06.ispgateway.de [80.67.31.104]) by theia.denx.de (Postfix) with ESMTP id 14AC528574 for ; Thu, 13 Oct 2011 09:27:14 +0200 (CEST) Received: from [194.24.158.3] (helo=localhost.localdomain) by smtprelay06.ispgateway.de with esmtpa (Exim 4.68) (envelope-from ) id 1REFhA-0001yL-Qj; Thu, 13 Oct 2011 09:27:14 +0200 From: Christian Riesch To: u-boot@lists.denx.de Date: Thu, 13 Oct 2011 09:26:44 +0200 Message-Id: <1318490804-25065-4-git-send-email-christian.riesch@omicron.at> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1318490804-25065-1-git-send-email-christian.riesch@omicron.at> References: <1318490804-25065-1-git-send-email-christian.riesch@omicron.at> X-Df-Sender: Y2hyaXN0aWFuQHJpZXNjaC5hdA== Cc: Heiko Schocher , Christian Riesch Subject: [U-Boot] [PATCH v2 3/3] arm, davinci: Remove the duplication of LPSC functions in da850_lowlevel.c X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de The LPSC functions defined in arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c are replaced by those already defined in arch/arm/cpu/arm926ejs/davinci/psc.c. Signed-off-by: Christian Riesch Cc: Heiko Schocher Cc: Paulraj Sandeep Cc: Albert ARIBAUD Acked-by: Heiko Schocher Tested-by: Heiko Schocher --- arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c | 96 +---------------------- 1 files changed, 4 insertions(+), 92 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c index a6f0178..490ef8f 100644 --- a/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c +++ b/arch/arm/cpu/arm926ejs/davinci/da850_lowlevel.c @@ -153,49 +153,12 @@ int da850_pll_init(struct davinci_pllc_regs *reg, unsigned long pllmult) return 0; } -void da850_lpc_transition(unsigned char pscnum, unsigned char module, - unsigned char domain, unsigned char state) -{ - struct davinci_psc_regs *reg; - dv_reg_p mdstat, mdctl; - - if (pscnum == 0) { - reg = davinci_psc0_regs; - mdstat = ®->psc0.mdstat[module]; - mdctl = ®->psc0.mdctl[module]; - } else { - reg = davinci_psc1_regs; - mdstat = ®->psc1.mdstat[module]; - mdctl = ®->psc1.mdctl[module]; - } - - /* Wait for any outstanding transition to complete */ - while ((readl(®->ptstat) & (0x00000001 << domain))) - ; - - /* If we are already in that state, just return */ - if ((readl(mdstat) & 0x1F) == state) - return; - - /* Perform transition */ - writel((readl(mdctl) & 0xFFFFFFE0) | state, mdctl); - setbits_le32(®->ptcmd, (0x00000001 << domain)); - - /* Wait for transition to complete */ - while (readl(®->ptstat) & (0x00000001 << domain)) - ; - - /* Wait and verify the state */ - while ((readl(mdstat) & 0x1F) != state) - ; -} - int da850_ddr_setup(unsigned int freq) { unsigned long tmp; /* Enable the Clock to DDR2/mDDR */ - da850_lpc_transition(1, 6, 0, PSC_ENABLE); + lpsc_on(DAVINCI_LPSC_DDR_EMIF); tmp = readl(&davinci_syscfg1_regs->vtpio_ctl); if ((tmp & VTP_POWERDWN) == VTP_POWERDWN) { @@ -244,9 +207,9 @@ int da850_ddr_setup(unsigned int freq) &dv_ddr2_regs_ctrl->sdrcr); /* SyncReset the Clock to EMIF3A SDRAM */ - da850_lpc_transition(1, 6, 0, PSC_SYNCRESET); + lpsc_syncreset(DAVINCI_LPSC_DDR_EMIF); /* Enable the Clock to EMIF3A SDRAM */ - da850_lpc_transition(1, 6, 0, PSC_ENABLE); + lpsc_on(DAVINCI_LPSC_DDR_EMIF); /* disable self refresh */ clrbits_le32(&dv_ddr2_regs_ctrl->sdrcr, 0xc0000000); @@ -255,54 +218,6 @@ int da850_ddr_setup(unsigned int freq) return 0; } -static void da850_set_mdctl(dv_reg_p mdctl) -{ - if ((readl(mdctl) & 0x1F) != PSC_ENABLE) - writel(((readl(mdctl) & 0xFFFFFFE0) | PSC_ENABLE), mdctl); -} - -void da850_psc_init(void) -{ - struct davinci_psc_regs *reg; - int i; - - /* PSC 0 domain 0 init */ - reg = davinci_psc0_regs; - while ((readl(®->ptstat) & 0x00000001)) - ; - - for (i = 3; i <= 4 ; i++) - da850_set_mdctl(®->psc0.mdctl[i]); - - for (i = 7; i <= 12 ; i++) - da850_set_mdctl(®->psc0.mdctl[i]); - - /* Do Always-On Power Domain Transitions */ - setbits_le32(®->ptcmd, 0x00000001); - while (readl(®->ptstat) & 0x00000001) - ; - - /* PSC1, domain 1 init */ - reg = davinci_psc1_regs; - while ((readl(®->ptstat) & 0x00000001)) - ; - - da850_set_mdctl(®->psc1.mdctl[3]); - da850_set_mdctl(®->psc1.mdctl[6]); - - /* UART1 + UART2 */ - for (i = 12 ; i <= 13 ; i++) - da850_set_mdctl(®->psc1.mdctl[i]); - - da850_set_mdctl(®->psc1.mdctl[26]); - da850_set_mdctl(®->psc1.mdctl[31]); - - /* Do Always-On Power Domain Transitions */ - setbits_le32(®->ptcmd, 0x00000001); - while (readl(®->ptstat) & 0x00000001) - ; -} - void da850_pinmux_ctl(unsigned long offset, unsigned long mask, unsigned long value) { @@ -368,9 +283,6 @@ int arch_cpu_init(void) dv_maskbits(&davinci_syscfg_regs->suspsrc, ((1 << 27) | (1 << 22) | (1 << 20) | (1 << 5) | (1 << 16))); - /* System PSC setup - enable all */ - da850_psc_init(); - /* Setup Pinmux */ da850_pinmux_ctl(0, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX0); da850_pinmux_ctl(1, 0xFFFFFFFF, CONFIG_SYS_DA850_PINMUX1); @@ -404,7 +316,7 @@ int arch_cpu_init(void) writel(CONFIG_SYS_DA850_CS2CFG, &davinci_emif_regs->ab1cr); writel(CONFIG_SYS_DA850_CS3CFG, &davinci_emif_regs->ab2cr); - da850_lpc_transition(1, 13, 0, PSC_ENABLE); + lpsc_on(DAVINCI_LPSC_UART2); NS16550_init((NS16550_t)(CONFIG_SYS_NS16550_COM1), CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);