From patchwork Thu Jun 13 20:55:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagannadha Sutradharudu Teki X-Patchwork-Id: 251167 X-Patchwork-Delegate: jagannadh.teki@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 8C2692C008F for ; Fri, 14 Jun 2013 06:59:52 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8DF0C4A103; Thu, 13 Jun 2013 22:59:34 +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 Tx26D2KwuE4s; Thu, 13 Jun 2013 22:59:34 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CA7CC4A105; Thu, 13 Jun 2013 22:57:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 009994A097 for ; Thu, 13 Jun 2013 22:57:06 +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 6I3fn06p3+iO for ; Thu, 13 Jun 2013 22:56:59 +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 co1outboundpool.messaging.microsoft.com (co1ehsobe002.messaging.microsoft.com [216.32.180.185]) by theia.denx.de (Postfix) with ESMTPS id 5CF4A4A09B for ; Thu, 13 Jun 2013 22:56:29 +0200 (CEST) Received: from mail159-co1-R.bigfish.com (10.243.78.244) by CO1EHSOBE018.bigfish.com (10.243.66.81) with Microsoft SMTP Server id 14.1.225.23; Thu, 13 Jun 2013 20:56:27 +0000 Received: from mail159-co1 (localhost [127.0.0.1]) by mail159-co1-R.bigfish.com (Postfix) with ESMTP id 2ACEB1C03BF; Thu, 13 Jun 2013 20:56:27 +0000 (UTC) X-Forefront-Antispam-Report: CIP:149.199.60.83; KIP:(null); UIP:(null); IPV:NLI; H:xsj-gw1; RD:unknown-60-83.xilinx.com; EFVD:NLI X-SpamScore: -2 X-BigFish: VPS-2(zzzz1f42h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ah1fc6hzz17326ah5eeeK8275bh8275dhz2fh95h668h839hd24hf0ah119dh1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h14ddh1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1b0ah1d0ch1d2eh1d3fh1dfeh1dffh1e1dh1e23h906i1155h192ch) Received-SPF: pass (mail159-co1: domain of xilinx.com designates 149.199.60.83 as permitted sender) client-ip=149.199.60.83; envelope-from=jagannadha.sutradharudu-teki@xilinx.com; helo=xsj-gw1 ; helo=xsj-gw1 ; Received: from mail159-co1 (localhost.localdomain [127.0.0.1]) by mail159-co1 (MessageSwitch) id 1371156985101073_23525; Thu, 13 Jun 2013 20:56:25 +0000 (UTC) Received: from CO1EHSMHS019.bigfish.com (unknown [10.243.78.235]) by mail159-co1.bigfish.com (Postfix) with ESMTP id 0A919C80052; Thu, 13 Jun 2013 20:56:25 +0000 (UTC) Received: from xsj-gw1 (149.199.60.83) by CO1EHSMHS019.bigfish.com (10.243.66.29) with Microsoft SMTP Server id 14.1.225.23; Thu, 13 Jun 2013 20:56:22 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-smtp1.xilinx.com) by xsj-gw1 with esmtp (Exim 4.63) (envelope-from ) id 1UnEZC-0001GB-0w; Thu, 13 Jun 2013 13:56:22 -0700 From: Jagannadha Sutradharudu Teki To: Date: Fri, 14 Jun 2013 02:25:23 +0530 X-Mailer: git-send-email 1.8.3 In-Reply-To: <1371156936-23067-1-git-send-email-jaganna@xilinx.com> References: <1371156936-23067-1-git-send-email-jaganna@xilinx.com> X-RCIS-Action: ALLOW MIME-Version: 1.0 Message-ID: <9e80e577-b1b0-4524-aa22-d1018865f6dd@CO1EHSMHS019.ehs.local> X-OriginatorOrg: xilinx.com Cc: Hoyler Gernot , "Todd Legler (tlegler)" , Willis Max , Jagannadha Sutradharudu Teki , Syed@theia.denx.de, Hussain , Rajeshwari Shinde , Tom Rini , Daassi Bacem Subject: [U-Boot] [PATCH v4 01/14] sf: Add bank address register writing support 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This patch provides support to program a flash bank address register. extended/bank address register contains an information to access the 4th byte addressing in 3-byte address mode. reff' the spec for more details about bank addr register in Page-63, Table 8.16 http://www.spansion.com/Support/Datasheets/S25FL128S_256S_00.pdf Signed-off-by: Jagannadha Sutradharudu Teki Reviewed-by: Simon Glass --- Changes for v4: - remove bank cmds Changes for v3: - none Changes for v2: - none drivers/mtd/spi/spi_flash.c | 26 ++++++++++++++++++++++++++ drivers/mtd/spi/spi_flash_internal.h | 3 +++ 2 files changed, 29 insertions(+) diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 0e38f59..9ddd070 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -278,6 +278,32 @@ int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr) return 0; } +int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 bank_sel) +{ + u8 cmd; + int ret; + + ret = spi_flash_cmd_write_enable(flash); + if (ret < 0) { + debug("SF: enabling write failed\n"); + return ret; + } + + ret = spi_flash_cmd_write(flash->spi, &cmd, 1, &bank_sel, 1); + if (ret) { + debug("SF: fail to write bank addr register\n"); + return ret; + } + + ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT); + if (ret < 0) { + debug("SF: write bank addr register timed out\n"); + return ret; + } + + return 0; +} + #ifdef CONFIG_OF_CONTROL int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash) { diff --git a/drivers/mtd/spi/spi_flash_internal.h b/drivers/mtd/spi/spi_flash_internal.h index 141cfa8..772fef6 100644 --- a/drivers/mtd/spi/spi_flash_internal.h +++ b/drivers/mtd/spi/spi_flash_internal.h @@ -77,6 +77,9 @@ static inline int spi_flash_cmd_write_disable(struct spi_flash *flash) /* Program the status register. */ int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr); +/* Program the bank address register */ +int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 bank_sel); + /* * Same as spi_flash_cmd_read() except it also claims/releases the SPI * bus. Used as common part of the ->read() operation.