From patchwork Thu Jun 13 20:55:29 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: 251164 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 0A4BE2C007E for ; Fri, 14 Jun 2013 06:59:00 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 64A1A4A158; Thu, 13 Jun 2013 22:58:51 +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 JOCD77PIos84; Thu, 13 Jun 2013 22:58:51 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1B9E34A0ED; Thu, 13 Jun 2013 22:57:13 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AB19B4A0BF for ; Thu, 13 Jun 2013 22:56:56 +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 5zJtCWAtLw7q for ; Thu, 13 Jun 2013 22:56:49 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 BL_NJABL=ERR(-1.5) (only DNSBL check requested) Received: from co9outboundpool.messaging.microsoft.com (co9ehsobe001.messaging.microsoft.com [207.46.163.24]) by theia.denx.de (Postfix) with ESMTPS id 6E2FF4A09E for ; Thu, 13 Jun 2013 22:56:29 +0200 (CEST) Received: from mail80-co9-R.bigfish.com (10.236.132.244) by CO9EHSOBE036.bigfish.com (10.236.130.99) with Microsoft SMTP Server id 14.1.225.23; Thu, 13 Jun 2013 20:56:27 +0000 Received: from mail80-co9 (localhost [127.0.0.1]) by mail80-co9-R.bigfish.com (Postfix) with ESMTP id 030EA120322; 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: 1 X-BigFish: VPS1(zzzz1f42h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ah1fc6hzz8275bh8275dhz2fh95h668h839hd24hf0ah119dh1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h14ddh1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1b0ah1d0ch1d2eh1d3fh1dfeh1dffh1e1dh1e23h906i1155h192ch) Received-SPF: pass (mail80-co9: 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 mail80-co9 (localhost.localdomain [127.0.0.1]) by mail80-co9 (MessageSwitch) id 1371156984109894_30999; Thu, 13 Jun 2013 20:56:24 +0000 (UTC) Received: from CO9EHSMHS005.bigfish.com (unknown [10.236.132.253]) by mail80-co9.bigfish.com (Postfix) with ESMTP id 17401E08EE; Thu, 13 Jun 2013 20:56:24 +0000 (UTC) Received: from xsj-gw1 (149.199.60.83) by CO9EHSMHS005.bigfish.com (10.236.130.15) with Microsoft SMTP Server id 14.1.225.23; Thu, 13 Jun 2013 20:56:23 +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-0001GM-SX; Thu, 13 Jun 2013 13:56:22 -0700 From: Jagannadha Sutradharudu Teki To: Date: Fri, 14 Jun 2013 02:25:29 +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: <5301d95f-1aec-4d3f-a091-326102b99bd8@CO9EHSMHS005.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 07/14] sf: Use spi_flash_addr() in write call 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 Use the existing spi_flash_addr() for 3-byte addressing cmd filling in write call. Signed-off-by: Jagannadha Sutradharudu Teki Reviewed-by: Simon Glass --- Changes for v4: - none Changes for v3: - none Changes for v2: - none drivers/mtd/spi/spi_flash.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index c9ef61f..88efa92 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -71,7 +71,7 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len, int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset, size_t len, const void *buf) { - unsigned long page_addr, byte_addr, page_size; + unsigned long byte_addr, page_size; size_t chunk_len, actual; int ret; u8 cmd[4]; @@ -97,16 +97,13 @@ int spi_flash_cmd_write_multi(struct spi_flash *flash, u32 offset, return ret; } #endif - page_addr = offset / page_size; byte_addr = offset % page_size; chunk_len = min(len - actual, page_size - byte_addr); if (flash->spi->max_write_size) chunk_len = min(chunk_len, flash->spi->max_write_size); - cmd[1] = page_addr >> 8; - cmd[2] = page_addr; - cmd[3] = byte_addr; + spi_flash_addr(offset, cmd); debug("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = %zu\n", buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len);