From patchwork Wed Jan 5 09:12:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Macpaul Lin X-Patchwork-Id: 77581 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 BDF06B711E for ; Wed, 5 Jan 2011 20:12:19 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 531EC28407; Wed, 5 Jan 2011 10:12: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 6v48KwcObZJL; Wed, 5 Jan 2011 10:12:12 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8D383283D8; Wed, 5 Jan 2011 10:12:04 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 25DA528393 for ; Wed, 5 Jan 2011 10:12:02 +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 qEhnqau3hQwY for ; Wed, 5 Jan 2011 10:12:01 +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 ATCPCS06.andestech.com (59-124-160-117.HINET-IP.hinet.net [59.124.160.117]) by theia.denx.de (Postfix) with ESMTP id 0F2ED283CF for ; Wed, 5 Jan 2011 10:12:00 +0100 (CET) Received: from app01.andestech.com ([10.0.4.31]) by ATCPCS06.andestech.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 5 Jan 2011 17:12:28 +0800 From: Macpaul Lin To: u-boot@lists.denx.de, wd@denx.de, ratbert.chuang@gmail.com, ratbert@faraday-tech.com, albert.aribaud@free.fr Date: Wed, 5 Jan 2011 17:12:24 +0800 Message-Id: <1294218744-2535-2-git-send-email-macpaul@andestech.com> X-Mailer: git-send-email 1.7.3.2 In-Reply-To: <1294218744-2535-1-git-send-email-macpaul@andestech.com> References: <1294218744-2535-1-git-send-email-macpaul@andestech.com> X-OriginalArrivalTime: 05 Jan 2011 09:12:28.0476 (UTC) FILETIME=[ACE3C7C0:01CBACB8] Cc: Macpaul Lin Subject: [U-Boot] [PATCH v2 2/2] a320evb: replace built-in ftpmu010 related code 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 Replace built-in ftpmu010 related code in timer.c for shared driver support. Signed-off-by: Macpaul Lin --- Change v2 - Code cleanup arch/arm/cpu/arm920t/a320/timer.c | 22 ++-------------------- include/configs/a320evb.h | 5 +++++ 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/arch/arm/cpu/arm920t/a320/timer.c b/arch/arm/cpu/arm920t/a320/timer.c index d2e316f..106fd7f 100644 --- a/arch/arm/cpu/arm920t/a320/timer.c +++ b/arch/arm/cpu/arm920t/a320/timer.c @@ -19,21 +19,18 @@ #include #include -#include #include static ulong timestamp; static ulong lastdec; static struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE; -static struct ftpmu010 *pmu = (struct ftpmu010 *)CONFIG_FTPMU010_BASE; #define TIMER_CLOCK 32768 #define TIMER_LOAD_VAL 0xffffffff int timer_init(void) { - unsigned int oscc; unsigned int cr; debug("%s()\n", __func__); @@ -41,23 +38,8 @@ int timer_init(void) /* disable timers */ writel(0, &tmr->cr); - /* - * use 32768Hz oscillator for RTC, WDT, TIMER - */ - - /* enable the 32768Hz oscillator */ - oscc = readl(&pmu->OSCC); - oscc &= ~(FTPMU010_OSCC_OSCL_OFF | FTPMU010_OSCC_OSCL_TRI); - writel(oscc, &pmu->OSCC); - - /* wait until ready */ - while (!(readl(&pmu->OSCC) & FTPMU010_OSCC_OSCL_STABLE)) - ; - - /* select 32768Hz oscillator */ - oscc = readl(&pmu->OSCC); - oscc |= FTPMU010_OSCC_OSCL_RTCLSEL; - writel(oscc, &pmu->OSCC); + /* use 32768Hz oscillator for RTC, WDT, TIMER */ + ftpmu010_32768osc_enable(); /* setup timer */ writel(TIMER_LOAD_VAL, &tmr->timer3_load); diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h index f67cf06..f169e5e 100644 --- a/include/configs/a320evb.h +++ b/include/configs/a320evb.h @@ -41,6 +41,11 @@ */ #define CONFIG_RTC_FTRTC010 +/* + * PMU + */ +#define CONFIG_FTPMU010_POWER + /*----------------------------------------------------------------------- * Serial console configuration */