From patchwork Mon Mar 2 16:27:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dinh Nguyen X-Patchwork-Id: 445344 X-Patchwork-Delegate: marek.vasut@gmail.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 7F25214018C for ; Tue, 3 Mar 2015 03:36:03 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9088D4B6DE; Mon, 2 Mar 2015 17:35:16 +0100 (CET) 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 AEV7luOD8LGD; Mon, 2 Mar 2015 17:35:16 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 524E3A741F; Mon, 2 Mar 2015 17:34:44 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6E3274B6AF for ; Mon, 2 Mar 2015 17:34:14 +0100 (CET) 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 Bbq17DcAQTBi for ; Mon, 2 Mar 2015 17:34:14 +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 na01-by2-obe.outbound.protection.outlook.com (mail-by2on0057.outbound.protection.outlook.com [207.46.100.57]) by theia.denx.de (Postfix) with ESMTPS id ED6B84B69C for ; Mon, 2 Mar 2015 17:34:13 +0100 (CET) Received: from BY1PR0301MB1192.namprd03.prod.outlook.com (25.160.195.150) by BY1PR0301MB1175.namprd03.prod.outlook.com (25.160.195.146) with Microsoft SMTP Server (TLS) id 15.1.93.16; Mon, 2 Mar 2015 16:34:00 +0000 Received: from linux-builds1.altera.com (64.129.157.38) by BY1PR0301MB1192.namprd03.prod.outlook.com (25.160.195.150) with Microsoft SMTP Server (TLS) id 15.1.93.16; Mon, 2 Mar 2015 16:33:57 +0000 From: To: , , , , , Date: Mon, 2 Mar 2015 10:27:59 -0600 Message-ID: <1425313688-23595-12-git-send-email-dinguyen@opensource.altera.com> X-Mailer: git-send-email 2.2.1 In-Reply-To: <1425313688-23595-1-git-send-email-dinguyen@opensource.altera.com> References: <1425313688-23595-1-git-send-email-dinguyen@opensource.altera.com> MIME-Version: 1.0 X-Originating-IP: [64.129.157.38] X-ClientProxiedBy: BLUPR08CA0057.namprd08.prod.outlook.com (10.141.200.37) To BY1PR0301MB1192.namprd03.prod.outlook.com (25.160.195.150) Authentication-Results: denx.de; dkim=none (message not signed) header.d=none; X-Microsoft-Antispam: UriScan:;UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1192; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006); SRVR:BY1PR0301MB1192; X-Forefront-PRVS: 0503FF9A3E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(66066001)(50986999)(229853001)(33646002)(575784001)(19580395003)(122386002)(76176999)(50226001)(48376002)(86362001)(50466002)(62966003)(42186005)(40100003)(53416004)(2201001)(19580405001)(46102003)(77156002)(86152002)(87976001)(92566002)(2950100001)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0301MB1192; H:linux-builds1.altera.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:; SRVR:BY1PR0301MB1192; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2015 16:33:57.1949 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1192 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1175; X-OriginatorOrg: opensource.altera.com Cc: u-boot@lists.denx.de, dinh.linux@gmail.com Subject: [U-Boot] [PATCHv2 11/20] arm: socfpga: spl: Add s_init X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Dinh Nguyen Clear OCRAM's ECC. Signed-off-by: Dinh Nguyen --- v2: remove redundant code that is already in arch_early_init_r --- arch/arm/cpu/armv7/socfpga/Makefile | 4 ++-- arch/arm/cpu/armv7/socfpga/s_init.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 arch/arm/cpu/armv7/socfpga/s_init.c diff --git a/arch/arm/cpu/armv7/socfpga/Makefile b/arch/arm/cpu/armv7/socfpga/Makefile index 8b6e108..ee0af9b 100644 --- a/arch/arm/cpu/armv7/socfpga/Makefile +++ b/arch/arm/cpu/armv7/socfpga/Makefile @@ -8,6 +8,6 @@ # obj-y := lowlevel_init.o -obj-y += misc.o timer.o reset_manager.o system_manager.o clock_manager.o \ - fpga_manager.o +obj-y += s_init.o misc.o timer.o reset_manager.o system_manager.o \ + clock_manager.o fpga_manager.o obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o scan_manager.o diff --git a/arch/arm/cpu/armv7/socfpga/s_init.c b/arch/arm/cpu/armv7/socfpga/s_init.c new file mode 100644 index 0000000..bb159c6 --- /dev/null +++ b/arch/arm/cpu/armv7/socfpga/s_init.c @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2014 Altera Corporation + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +/* + * First C function to initialize the critical hardware early + */ +void s_init(void) +{ +#ifdef CONFIG_SPL_BUILD + struct socfpga_system_manager *sysmgr_regs = + (struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS; + unsigned long reg; + /* + * First C code to run. Clear fake OCRAM ECC first as SBE + * and DBE might triggered during power on + */ + reg = readl(&sysmgr_regs->eccgrp_ocram); + if (reg & SYSMGR_ECC_OCRAM_SERR) + writel(SYSMGR_ECC_OCRAM_SERR | SYSMGR_ECC_OCRAM_EN, + &sysmgr_regs->eccgrp_ocram); + if (reg & SYSMGR_ECC_OCRAM_DERR) + writel(SYSMGR_ECC_OCRAM_DERR | SYSMGR_ECC_OCRAM_EN, + &sysmgr_regs->eccgrp_ocram); +#endif /* CONFIG_SPL_BUILD */ +}