From patchwork Sat Oct 14 10:26:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: flashrom-git@coreboot.org X-Patchwork-Id: 825806 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=flashrom.org (client-ip=80.81.252.135; helo=mail.coreboot.org; envelope-from=flashrom-bounces@flashrom.org; receiver=) Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yDgl221fnz9sRn for ; Sat, 14 Oct 2017 21:27:41 +1100 (AEDT) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1e3JeQ-0000Vx-AF; Sat, 14 Oct 2017 12:26:38 +0200 Received: from flashrom-git by mail.coreboot.org with local (Exim 4.86_2) (envelope-from ) id 1e3JeO-0000Ux-Lh for flashrom@flashrom.org; Sat, 14 Oct 2017 12:26:36 +0200 Date: Sat, 14 Oct 2017 12:26:36 +0200 To: flashrom@flashrom.org MIME-Version: 1.0 From: flashrom-git@coreboot.org In-Reply-To: <150797679660.1847.10061219713511533643@ra.coreboot.org> References: <150797679660.1847.10061219713511533643@ra.coreboot.org> X-Git-Host: ra.coreboot.org X-Git-Repo: flashrom X-Git-Refname: refs/heads/staging X-Git-Reftype: branch X-Git-Rev: b1f88360fc806ee69d7cf1b9404b3977bc53aace X-Git-NotificationType: diff X-Git-Multimail-Version: 1.4.dev Auto-Submitted: auto-generated Message-Id: Subject: [flashrom] 01/01: fixup! 4BA: Basic support for 4-bytes addressing mode extensions X-BeenThere: flashrom@flashrom.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: flashrom discussion and development mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: flashrom@flashrom.org Errors-To: flashrom-bounces@flashrom.org Sender: "flashrom" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff This is an automated email from the git hooks/post-receive script. flashrom-git pushed a commit to branch staging in repository flashrom. View the commit online: https://www.flashrom.org/git/flashrom.git/commit/?id=b1f88360fc806ee69d7cf1b9404b3977bc53aace commit b1f88360fc806ee69d7cf1b9404b3977bc53aace Author: Boris Baykov AuthorDate: Sat Jun 11 18:28:59 2016 +0200 fixup! 4BA: Basic support for 4-bytes addressing mode extensions Fix some whitespace, and braces. Remove sector size from comments that I could not verify. Change-Id: I4faaa036fea744135fa37f405686fb9fd0882806 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/21947 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks --- flash.h | 4 ++-- spi4ba.c | 34 +++++++++++++--------------------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/flash.h b/flash.h index 611450fe5..56c0b4fdc 100644 --- a/flash.h +++ b/flash.h @@ -120,8 +120,8 @@ enum write_granularity { #define FEATURE_OTP (1 << 8) #define FEATURE_QPI (1 << 9) /* Feature bits used for 4-bytes addressing mode */ -#define FEATURE_4BA_SUPPORT (1 << 10) -#define FEATURE_4BA_ONLY (1 << 11) +#define FEATURE_4BA_SUPPORT (1 << 10) +#define FEATURE_4BA_ONLY (1 << 11) enum test_state { OK = 0, diff --git a/spi4ba.c b/spi4ba.c index 72df87427..bf0cf9745 100644 --- a/spi4ba.c +++ b/spi4ba.c @@ -43,7 +43,7 @@ int spi_enter_4ba_b7(struct flashctx *flash) msg_trace("-> %s\n", __func__); - /* Switch to 4-bytes addressing mode */ + /* Switch to 4-bytes addressing mode */ return spi_send_command(flash, sizeof(cmd), 0, cmd, NULL); } @@ -71,17 +71,15 @@ int spi_enter_4ba_b7_we(struct flashctx *flash) msg_trace("-> %s\n", __func__); - /* Switch to 4-bytes addressing mode */ + /* Switch to 4-bytes addressing mode */ result = spi_send_multicommand(flash, cmds); - if (result) { + if (result) msg_cerr("%s failed during command execution\n", __func__); - } return result; } /* Program one flash byte from 4-bytes addressing mode */ -int spi_byte_program_4ba(struct flashctx *flash, unsigned int addr, - uint8_t databyte) +int spi_byte_program_4ba(struct flashctx *flash, unsigned int addr, uint8_t databyte) { int result; struct spi_command cmds[] = { @@ -112,16 +110,13 @@ int spi_byte_program_4ba(struct flashctx *flash, unsigned int addr, msg_trace("-> %s (0x%08X)\n", __func__, addr); result = spi_send_multicommand(flash, cmds); - if (result) { - msg_cerr("%s failed during command execution at address 0x%x\n", - __func__, addr); - } + if (result) + msg_cerr("%s failed during command execution at address 0x%x\n", __func__, addr); return result; } /* Program flash bytes from 4-bytes addressing mode */ -int spi_nbyte_program_4ba(struct flashctx *flash, unsigned int addr, - const uint8_t *bytes, unsigned int len) +int spi_nbyte_program_4ba(struct flashctx *flash, unsigned int addr, const uint8_t *bytes, unsigned int len) { int result; unsigned char cmd[(JEDEC_BYTE_PROGRAM_OUTSIZE + 1) - 1 + 256] = { @@ -171,8 +166,7 @@ int spi_nbyte_program_4ba(struct flashctx *flash, unsigned int addr, } /* Read flash bytes from 4-bytes addressing mode */ -int spi_nbyte_read_4ba(struct flashctx *flash, unsigned int addr, - uint8_t *bytes, unsigned int len) +int spi_nbyte_read_4ba(struct flashctx *flash, unsigned int addr, uint8_t *bytes, unsigned int len) { const unsigned char cmd[JEDEC_READ_OUTSIZE + 1] = { JEDEC_READ, @@ -188,9 +182,8 @@ int spi_nbyte_read_4ba(struct flashctx *flash, unsigned int addr, return spi_send_command(flash, sizeof(cmd), len, cmd, bytes); } -/* Erases 4 KB of flash from 4-bytes addressing mode */ -int spi_block_erase_20_4ba(struct flashctx *flash, unsigned int addr, - unsigned int blocklen) +/* Erase one sector of flash from 4-bytes addressing mode */ +int spi_block_erase_20_4ba(struct flashctx *flash, unsigned int addr, unsigned int blocklen) { int result; struct spi_command cmds[] = { @@ -234,9 +227,8 @@ int spi_block_erase_20_4ba(struct flashctx *flash, unsigned int addr, return 0; } -/* Erases 32 KB of flash from 4-bytes addressing mode */ -int spi_block_erase_52_4ba(struct flashctx *flash, unsigned int addr, - unsigned int blocklen) +/* Erase one sector of flash from 4-bytes addressing mode */ +int spi_block_erase_52_4ba(struct flashctx *flash, unsigned int addr, unsigned int blocklen) { int result; struct spi_command cmds[] = { @@ -280,7 +272,7 @@ int spi_block_erase_52_4ba(struct flashctx *flash, unsigned int addr, return 0; } -/* Erases 64 KB of flash from 4-bytes addressing mode */ +/* Erase one sector of flash from 4-bytes addressing mode */ int spi_block_erase_d8_4ba(struct flashctx *flash, unsigned int addr, unsigned int blocklen) {