From patchwork Wed Dec 14 12:21:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Govindraj X-Patchwork-Id: 131363 X-Patchwork-Delegate: trini@ti.com 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 A93411007D5 for ; Wed, 14 Dec 2011 23:22:21 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4E99A284A4; Wed, 14 Dec 2011 13:22:12 +0100 (CET) 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 B6aSyxHSZRmS; Wed, 14 Dec 2011 13:22:12 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4B3A9284A7; Wed, 14 Dec 2011 13:22:07 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B46402848D for ; Wed, 14 Dec 2011 13:22:04 +0100 (CET) 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 brmhYBuMtIsy for ; Wed, 14 Dec 2011 13:22:04 +0100 (CET) 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 mail-yx0-f172.google.com (mail-yx0-f172.google.com [209.85.213.172]) by theia.denx.de (Postfix) with ESMTPS id A1C2D2846E for ; Wed, 14 Dec 2011 13:21:59 +0100 (CET) Received: by mail-yx0-f172.google.com with SMTP id m7so543069yen.3 for ; Wed, 14 Dec 2011 04:21:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=iebW7D5VjkXGfKLDzTbrUvAUO+/K+NEJQMl+UnVOj40=; b=jK/JVtDvEp6PoCJB+P9aYceubTiHl85aPWrYOBPSLUf3KVZR8oqh8QWjUHtl7sqW5Y TmMawG6eJwFGwE6E5yL8z6LjBuxKJGr3XNa5a5J8IhXdFxygpz27t6fchMyvdz1MRGB6 Va6ZToqCHwKGapzZh4CbS25IS07+MsnBx6i9A= Received: by 10.236.190.97 with SMTP id d61mr11691042yhn.40.1323865319365; Wed, 14 Dec 2011 04:21:59 -0800 (PST) Received: from localhost.localdomain (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id f47sm3679354yhh.8.2011.12.14.04.21.55 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Dec 2011 04:21:58 -0800 (PST) From: "Govindraj.R" To: u-boot@lists.denx.de Date: Wed, 14 Dec 2011 17:51:23 +0530 Message-Id: <1323865287-16601-3-git-send-email-govindraj.raja@ti.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1323865287-16601-1-git-send-email-govindraj.raja@ti.com> References: <1323865287-16601-1-git-send-email-govindraj.raja@ti.com> Cc: Andy Green , Partha Basak , Govindraj R Subject: [U-Boot] [PATCH 2/6] OMAP4: clock-common: Move the usb dppl configuration to new func. X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 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 From: "Govindraj.R" usb dpll configuration is done only part of non-essential dppl configuration however if CONFIG_USB_EHCI_OMAP is defined we may have to configure usb dpll's for proper functioning of usb modules. So move the usb dppl configuration to a new func. and utilise the same during essential dpll configuration. Signed-off-by: Govindraj.R --- arch/arm/cpu/armv7/omap-common/clocks-common.c | 52 ++++++++++++++--------- 1 files changed, 32 insertions(+), 20 deletions(-) diff --git a/arch/arm/cpu/armv7/omap-common/clocks-common.c b/arch/arm/cpu/armv7/omap-common/clocks-common.c index 1da90a4..770ac19 100644 --- a/arch/arm/cpu/armv7/omap-common/clocks-common.c +++ b/arch/arm/cpu/armv7/omap-common/clocks-common.c @@ -251,6 +251,33 @@ void configure_mpu_dpll(void) debug("MPU DPLL locked\n"); } +static void setup_usb_dpll(void) +{ + const struct dpll_params *params; + u32 sys_clk_khz, sd_div, num, den; + + sys_clk_khz = get_sys_clk_freq() / 1000; + /* + * USB: + * USB dpll is J-type. Need to set DPLL_SD_DIV for jitter correction + * DPLL_SD_DIV = CEILING ([DPLL_MULT/(DPLL_DIV+1)]* CLKINP / 250) + * - where CLKINP is sys_clk in MHz + * Use CLKINP in KHz and adjust the denominator accordingly so + * that we have enough accuracy and at the same time no overflow + */ + params = get_usb_dpll_params(); + num = params->m * sys_clk_khz; + den = (params->n + 1) * 250 * 1000; + num += den - 1; + sd_div = num / den; + clrsetbits_le32(&prcm->cm_clksel_dpll_usb, + CM_CLKSEL_DPLL_DPLL_SD_DIV_MASK, + sd_div << CM_CLKSEL_DPLL_DPLL_SD_DIV_SHIFT); + + /* Now setup the dpll with the regular function */ + do_setup_dpll(&prcm->cm_clkmode_dpll_usb, params, DPLL_LOCK, "usb"); +} + static void setup_dplls(void) { u32 temp; @@ -282,13 +309,16 @@ static void setup_dplls(void) /* MPU dpll */ configure_mpu_dpll(); + +#ifdef CONFIG_USB_EHCI_OMAP + setup_usb_dpll(); +#endif } #ifdef CONFIG_SYS_CLOCKS_ENABLE_ALL static void setup_non_essential_dplls(void) { u32 sys_clk_khz, abe_ref_clk; - u32 sd_div, num, den; const struct dpll_params *params; sys_clk_khz = get_sys_clk_freq() / 1000; @@ -300,25 +330,7 @@ static void setup_non_essential_dplls(void) params = get_iva_dpll_params(); do_setup_dpll(&prcm->cm_clkmode_dpll_iva, params, DPLL_LOCK, "iva"); - /* - * USB: - * USB dpll is J-type. Need to set DPLL_SD_DIV for jitter correction - * DPLL_SD_DIV = CEILING ([DPLL_MULT/(DPLL_DIV+1)]* CLKINP / 250) - * - where CLKINP is sys_clk in MHz - * Use CLKINP in KHz and adjust the denominator accordingly so - * that we have enough accuracy and at the same time no overflow - */ - params = get_usb_dpll_params(); - num = params->m * sys_clk_khz; - den = (params->n + 1) * 250 * 1000; - num += den - 1; - sd_div = num / den; - clrsetbits_le32(&prcm->cm_clksel_dpll_usb, - CM_CLKSEL_DPLL_DPLL_SD_DIV_MASK, - sd_div << CM_CLKSEL_DPLL_DPLL_SD_DIV_SHIFT); - - /* Now setup the dpll with the regular function */ - do_setup_dpll(&prcm->cm_clkmode_dpll_usb, params, DPLL_LOCK, "usb"); + setup_usb_dpll(); /* Configure ABE dpll */ params = get_abe_dpll_params();