From patchwork Wed Jun 27 15:27:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 167664 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 E21E5B6FBE for ; Thu, 28 Jun 2012 01:27:40 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D6F8B280AB; Wed, 27 Jun 2012 17:27:35 +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 kBlzUmvWzoLJ; Wed, 27 Jun 2012 17:27:35 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 882B02809F; Wed, 27 Jun 2012 17:27:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8A9FA280A0 for ; Wed, 27 Jun 2012 17:27:26 +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 X3bieqmGAtjI for ; Wed, 27 Jun 2012 17:27:14 +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 mail-pz0-f44.google.com (mail-pz0-f44.google.com [209.85.210.44]) by theia.denx.de (Postfix) with ESMTPS id 783872809F for ; Wed, 27 Jun 2012 17:27:10 +0200 (CEST) Received: by dacx6 with SMTP id x6so1483765dac.3 for ; Wed, 27 Jun 2012 08:27:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=VulU9yCcC+Xq9j9GrSZNOloOoH2pSm8PfFh8sRKaE3U=; b=SiXas0n6aTslKT6RJQgOOYFoh4cA6mhyHUz04GkbY6YM6t1/mzfFLnwHTbFHCy0/ge W5OWMH9LMfnzuH2G18+3Ut72HAz1ZXv/lO3M5RMyPB75Dcnt6XucuybdN+jH8sEHzIoh GNvwJWf2lnsu2Lekhj2oDIlQYCIA3eKFVkdSev5LABgphewbT7BNHBr4jCpqnzl6vpDP 8v5YjkJAyt9g7bE81DgaMXCeBG2HI4RfV6eDG3VOFNh8OKlgFpZO5KpwSD9dlahsRC4d alvb72nIQAr8I9Bw0jsby9mElWzhFj/MABKv8LjsyV+DQotY/DWLATc1GmHoqudSfHLh Hnqg== Received: by 10.68.241.228 with SMTP id wl4mr64214000pbc.51.1340810826822; Wed, 27 Jun 2012 08:27:06 -0700 (PDT) Received: from bill-the-cat.ph.cox.net (ip68-230-54-74.ph.ph.cox.net. [68.230.54.74]) by mx.google.com with ESMTPS id jv6sm15457332pbc.40.2012.06.27.08.27.05 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 27 Jun 2012 08:27:05 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de, Dmitry Bondar Date: Wed, 27 Jun 2012 08:27:05 -0700 Message-Id: <1340810825-26471-1-git-send-email-trini@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1340647361-23387-4-git-send-email-bond@inmys.ru> References: <1340647361-23387-4-git-send-email-bond@inmys.ru> Subject: [U-Boot] [PATCH] davinci, c6x: Always use C version of reset code 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 We can safely use the same reset code written in C for both Davinci and C6X platforms. In addition the C version of the code is marginally smaller on Davinci. Tested-by: Matt Porter Signed-off-by: Tom Rini --- arch/arm/cpu/arm926ejs/davinci/Makefile | 9 +--- arch/arm/cpu/arm926ejs/davinci/reset.S | 81 ------------------------------ arch/arm/cpu/arm926ejs/davinci/reset.c | 32 ++++++++++++ arch/arm/cpu/arm926ejs/davinci/reset_c.c | 32 ------------ 4 files changed, 33 insertions(+), 121 deletions(-) delete mode 100644 arch/arm/cpu/arm926ejs/davinci/reset.S create mode 100644 arch/arm/cpu/arm926ejs/davinci/reset.c delete mode 100644 arch/arm/cpu/arm926ejs/davinci/reset_c.c diff --git a/arch/arm/cpu/arm926ejs/davinci/Makefile b/arch/arm/cpu/arm926ejs/davinci/Makefile index 54f096d..c91928e 100644 --- a/arch/arm/cpu/arm926ejs/davinci/Makefile +++ b/arch/arm/cpu/arm926ejs/davinci/Makefile @@ -27,7 +27,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).o -COBJS-y += cpu.o misc.o timer.o psc.o pinmux.o +COBJS-y += cpu.o misc.o timer.o psc.o pinmux.o reset.o COBJS-$(CONFIG_DA850_LOWLEVEL) += da850_lowlevel.o COBJS-$(CONFIG_SOC_DM355) += dm355.o COBJS-$(CONFIG_SOC_DM365) += dm365.o @@ -42,13 +42,6 @@ COBJS-$(CONFIG_SOC_DM365) += dm365_lowlevel.o COBJS-$(CONFIG_SOC_DA8XX) += da850_lowlevel.o endif - -ifeq ($(CPU),c674x) -COBJS-y += reset_c.o -else -SOBJS = reset.o -endif - ifndef CONFIG_SKIP_LOWLEVEL_INIT SOBJS += lowlevel_init.o endif diff --git a/arch/arm/cpu/arm926ejs/davinci/reset.S b/arch/arm/cpu/arm926ejs/davinci/reset.S deleted file mode 100644 index ba0a7c3..0000000 --- a/arch/arm/cpu/arm926ejs/davinci/reset.S +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Processor reset using WDT for TI TMS320DM644x SoC. - * - * Copyright (C) 2007 Sergey Kubushyn - * - * ----------------------------------------------------- - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -.globl reset_cpu -reset_cpu: - ldr r0, WDT_TGCR - mov r1, $0x08 - str r1, [r0] - ldr r1, [r0] - orr r1, r1, $0x03 - str r1, [r0] - mov r1, $0 - ldr r0, WDT_TIM12 - str r1, [r0] - ldr r0, WDT_TIM34 - str r1, [r0] - ldr r0, WDT_PRD12 - str r1, [r0] - ldr r0, WDT_PRD34 - str r1, [r0] - ldr r0, WDT_TCR - ldr r1, [r0] - orr r1, r1, $0x40 - str r1, [r0] - ldr r0, WDT_WDTCR - ldr r1, [r0] - orr r1, r1, $0x4000 - str r1, [r0] - ldr r1, WDTCR_VAL1 - str r1, [r0] - ldr r1, WDTCR_VAL2 - str r1, [r0] - /* Write an invalid value to the WDKEY field to trigger - * an immediate watchdog reset */ - mov r1, $0x4000 - str r1, [r0] - nop - nop - nop - nop -reset_cpu_loop: - b reset_cpu_loop - -WDT_TGCR: - .word 0x01c21c24 -WDT_TIM12: - .word 0x01c21c10 -WDT_TIM34: - .word 0x01c21c14 -WDT_PRD12: - .word 0x01c21c18 -WDT_PRD34: - .word 0x01c21c1c -WDT_TCR: - .word 0x01c21c20 -WDT_WDTCR: - .word 0x01c21c28 -WDTCR_VAL1: - .word 0xa5c64000 -WDTCR_VAL2: - .word 0xda7e4000 diff --git a/arch/arm/cpu/arm926ejs/davinci/reset.c b/arch/arm/cpu/arm926ejs/davinci/reset.c new file mode 100644 index 0000000..44ae364 --- /dev/null +++ b/arch/arm/cpu/arm926ejs/davinci/reset.c @@ -0,0 +1,32 @@ +/* + * Processor reset using WDT. + * + * Copyright (C) 2012 Dmitry Bondar + * Copyright (C) 2007 Sergey Kubushyn + * + * This file is released under the terms of GPL v2 and any later version. + * See the file COPYING in the root directory of the source tree for details. +*/ + +#include +#include +#include + +void reset_cpu(unsigned long a) +{ + struct davinci_timer *const wdttimer = + (struct davinci_timer *)DAVINCI_TIMER1_BASE; + writel(0x08, &wdttimer->tgcr); + writel(readl(&wdttimer->tgcr) | 0x03, &wdttimer->tgcr); + writel(0, &wdttimer->tim12); + writel(0, &wdttimer->tim34); + writel(0, &wdttimer->prd12); + writel(0, &wdttimer->prd34); + writel(readl(&wdttimer->tcr) | 0x40, &wdttimer->tcr); + writel(readl(&wdttimer->wdtcr) | 0x4000, &wdttimer->wdtcr); + writel(0xa5c64000, &wdttimer->wdtcr); + writel(0xda7e4000, &wdttimer->wdtcr); + writel(0x4000, &wdttimer->wdtcr); + while (1) + /*nothing*/; +} diff --git a/arch/arm/cpu/arm926ejs/davinci/reset_c.c b/arch/arm/cpu/arm926ejs/davinci/reset_c.c deleted file mode 100644 index 44ae364..0000000 --- a/arch/arm/cpu/arm926ejs/davinci/reset_c.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Processor reset using WDT. - * - * Copyright (C) 2012 Dmitry Bondar - * Copyright (C) 2007 Sergey Kubushyn - * - * This file is released under the terms of GPL v2 and any later version. - * See the file COPYING in the root directory of the source tree for details. -*/ - -#include -#include -#include - -void reset_cpu(unsigned long a) -{ - struct davinci_timer *const wdttimer = - (struct davinci_timer *)DAVINCI_TIMER1_BASE; - writel(0x08, &wdttimer->tgcr); - writel(readl(&wdttimer->tgcr) | 0x03, &wdttimer->tgcr); - writel(0, &wdttimer->tim12); - writel(0, &wdttimer->tim34); - writel(0, &wdttimer->prd12); - writel(0, &wdttimer->prd34); - writel(readl(&wdttimer->tcr) | 0x40, &wdttimer->tcr); - writel(readl(&wdttimer->wdtcr) | 0x4000, &wdttimer->wdtcr); - writel(0xa5c64000, &wdttimer->wdtcr); - writel(0xda7e4000, &wdttimer->wdtcr); - writel(0x4000, &wdttimer->wdtcr); - while (1) - /*nothing*/; -}