From patchwork Fri Apr 23 09:08:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Wegner X-Patchwork-Id: 71776 X-Patchwork-Delegate: wd@denx.de Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id 0EDF4E22AD9 for ; Fri, 23 Apr 2010 11:10:24 +0200 (CEST) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id EB833C913130 for ; Fri, 23 Apr 2010 11:10:23 +0200 (CEST) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.9) for (single-drop); Fri, 23 Apr 2010 11:10:23 +0200 (CEST) Received: from murder (svr19.m-online.net [192.168.3.147]) by backend2 (Cyrus v2.2.12) with LMTPA; Fri, 23 Apr 2010 11:08:28 +0200 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend3.pop.m-online.net (Cyrus v2.2.13) with LMTPA; Fri, 23 Apr 2010 11:08:28 +0200 Received: from scanner-1.m-online.net (unknown [192.168.8.165]) by mail.m-online.net (Postfix) with ESMTP id F10A1200343; Fri, 23 Apr 2010 11:08:27 +0200 (CEST) Received: from mxin-2.m-online.net ([192.168.1.21]) by scanner-1.m-online.net (scanner-1.m-online.net [192.168.8.165]) (amavisd-new, port 10026) with ESMTP id 12274-04; Fri, 23 Apr 2010 11:08:25 +0200 (CEST) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-2.m-online.net (Postfix) with ESMTP id 845EB46C0DC; Fri, 23 Apr 2010 11:08:24 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 677D428269; Fri, 23 Apr 2010 11:08:18 +0200 (CEST) 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 JPT1pZ0RwdGZ; Fri, 23 Apr 2010 11:08:18 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DBEBC28227; Fri, 23 Apr 2010 11:08:12 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1B194281FF for ; Fri, 23 Apr 2010 11:08:11 +0200 (CEST) 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 Zsf1BXmgO-ym for ; Fri, 23 Apr 2010 11:08:09 +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 mrbusi4.netcologne.de (mrbusi4.netcologne.de [195.14.230.5]) by theia.denx.de (Postfix) with ESMTP id 07F5F281D0 for ; Fri, 23 Apr 2010 11:08:07 +0200 (CEST) X-NetCologne-SenderNetwork: netcologne X-NetCologne-SenderNetwork: netcologne Received: from labor2.local (unknown [213.196.222.82]) by mrbusi4.netcologne.de (Postfix) with ESMTP id 8B42BA822D; Fri, 23 Apr 2010 11:08:06 +0200 (CEST) From: Wolfgang Wegner To: u-boot@lists.denx.de Date: Fri, 23 Apr 2010 11:08:05 +0200 Message-Id: <1272013685-1032-1-git-send-email-w.wegner@astro-kom.de> Cc: Wolfgang Wegner Subject: [U-Boot] [PATCH] add Xilinx_abort_fn to Xilinx_Spartan3_Slave_Serial_fns 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 X-Virus-Scanned: by amavisd-new at m-online.net Currently the hardware was left in an undefined state in case Spartan3 serial load failed. This patch adds Xilinx_abort_fn to give the board a possibility to clean up in this case. Signed-off-by: Wolfgang Wegner --- All other FPGA drivers already support such an abort function - it seems Spartan3 serial load was a bit neglected (only discovered this because it messed up things on my board after a failed FPGA load). drivers/fpga/spartan3.c | 6 ++++++ include/spartan3.h | 1 + 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/fpga/spartan3.c b/drivers/fpga/spartan3.c index 7a89b56..1dd6f26 100644 --- a/drivers/fpga/spartan3.c +++ b/drivers/fpga/spartan3.c @@ -366,6 +366,8 @@ static int Spartan3_ss_load (Xilinx_desc * desc, void *buf, size_t bsize) CONFIG_FPGA_DELAY (); if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) { /* check the time */ puts ("** Timeout waiting for INIT to start.\n"); + if (*fn->abort) + (*fn->abort) (cookie); return FPGA_FAIL; } } while (!(*fn->init) (cookie)); @@ -380,6 +382,8 @@ static int Spartan3_ss_load (Xilinx_desc * desc, void *buf, size_t bsize) CONFIG_FPGA_DELAY (); if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) { /* check the time */ puts ("** Timeout waiting for INIT to clear.\n"); + if (*fn->abort) + (*fn->abort) (cookie); return FPGA_FAIL; } } while ((*fn->init) (cookie)); @@ -394,6 +398,8 @@ static int Spartan3_ss_load (Xilinx_desc * desc, void *buf, size_t bsize) while DONE is low (inactive) */ if ((*fn->done) (cookie) == 0 && (*fn->init) (cookie)) { puts ("** CRC error during FPGA load.\n"); + if (*fn->abort) + (*fn->abort) (cookie); return (FPGA_FAIL); } val = data [bytecount ++]; diff --git a/include/spartan3.h b/include/spartan3.h index d5a589d..0f0b400 100644 --- a/include/spartan3.h +++ b/include/spartan3.h @@ -58,6 +58,7 @@ typedef struct { Xilinx_wr_fn wr; Xilinx_post_fn post; Xilinx_bwr_fn bwr; /* block write function */ + Xilinx_abort_fn abort; } Xilinx_Spartan3_Slave_Serial_fns; /* Device Image Sizes