From patchwork Thu Apr 19 12:36:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 900833 X-Patchwork-Delegate: jagannadh.teki@gmail.com 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=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gdsys.cc Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40Rdv66df3z9s2M for ; Thu, 19 Apr 2018 22:43:14 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id A62A0C21F7D; Thu, 19 Apr 2018 12:40:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id EBFAEC21FC6; Thu, 19 Apr 2018 12:37:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2A742C22009; Thu, 19 Apr 2018 12:37:08 +0000 (UTC) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.31.94]) by lists.denx.de (Postfix) with ESMTPS id D288BC21F8C for ; Thu, 19 Apr 2018 12:37:03 +0000 (UTC) Received: from [80.151.34.241] (helo=bob3.testumgebung.local) by smtprelay05.ispgateway.de with esmtpa (Exim 4.90_1) (envelope-from ) id 1f98oB-0000SL-C1; Thu, 19 Apr 2018 14:37:03 +0200 From: Mario Six To: U-Boot Mailing List , Jagan Teki Date: Thu, 19 Apr 2018 14:36:29 +0200 Message-Id: <20180419123633.32172-15-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180419123633.32172-1-mario.six@gdsys.cc> References: <20180419123633.32172-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v2 14/18] spi: mpc8xxx: Document LEN setting better X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Instead of having a table right before the code implementing the length setting for documentation, have inline comments for the if branches actually implementing the length setting described table's entries (which is readable thanks to the set_char_len function). Signed-off-by: Mario Six --- Changes v1 -> v2: None --- drivers/spi/mpc8xxx_spi.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) -- 2.16.1 diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c index ce2a77c1aa..d22206f4b7 100644 --- a/drivers/spi/mpc8xxx_spi.c +++ b/drivers/spi/mpc8xxx_spi.c @@ -120,21 +120,15 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din, /* Shift data so it's msb-justified */ tmpdout = *(u32 *)dout >> (32 - xfer_bitlen); - /* The LEN field of the SPMODE register is set as follows: - * - * Bit length setting - * len <= 4 3 - * 4 < len <= 16 len - 1 - * len > 16 0 - */ - clrbits_be32(&spi->mode, SPI_MODE_EN); - if (bitlen <= 4) + /* Set up length for this transfer */ + + if (bitlen <= 4) /* 4 bits or less */ set_char_len(spi, 3); - else if (bitlen <= 16) + else if (bitlen <= 16) /* at most 16 bits */ set_char_len(spi, bitlen - 1); - else + else /* more than 16 bits -> full 32 bit transfer */ set_char_len(spi, 0); if (bitlen > 16) {