From patchwork Sun Apr 28 20:28:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 330 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C0FE73F08F for ; Sun, 28 Apr 2019 22:29:41 +0200 (CEST) Received: by mail-pf1-f197.google.com with SMTP id t5sf5349579pfh.21 for ; Sun, 28 Apr 2019 13:29:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1556483380; cv=pass; d=google.com; s=arc-20160816; b=Oy81BP8SlBqAPqhZVkDVUkP0UzDoHrGylflhBNAbqqEIsfqDEXuaviqrQzf0n3xYJz 7Choju1TlGRqMO4tFJGLsbgMWaE8v04TZR/c/969mfecTh+cnVA/aLH44eZ6ONUd66q+ MQ8IcQ4Ih3N2XtTxRB7MNoLxGruXotdchw0XUSt613+vdx1akkpyQQv+l3w05WU6Mw70 hoMVfqQmutgd/92imLI9EU3roY9CvuEDGbtiSPA9AVxz3PfNdrYcOIeHnO4cKUDJ505F cr4WzsNkMegifZNIpUJUO3IQRcDMskdPvHk3/9WJwIlfYhc1SXyVKIhnVyeFDEHsiIMD DGHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=UoByjMdJTaI7RjBVCsbm2AVb3QeNYnPSqxCP/NlIG5s=; b=nOHek5fxDMBgXrS2QSiKW3SmqjN4wftO+nb40c0C+hNyyhmNyo4tuiwGo7En4ZRMt2 XKTTlnrMeYSSFTtLbOXPoVEmAJQ+E/vacgLdB7gcuQOmgBIgxTRZJdONu52LJBIW2bH7 GcZfkYyH90XNbHfxbiZgjdCGAEib1M8FHE3blZbvFn5AauzY3a8++W5MEjsMFtK2qM6C Dvj8Aps8cy74GXP3Xz7zbHcyLGnC2qwypedUXNLZ31GtwloL1spo5AxKqblfG3OP0bMv HzayiGAWOjR4+ph1SDdpFQAhZ++w/Hix1FhmPxcc/7kq5wc129q9krLjH7XCuWFeVU5E 45Bw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=MPqxGtQn; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=UoByjMdJTaI7RjBVCsbm2AVb3QeNYnPSqxCP/NlIG5s=; b=XBcz3jBWbCMlMn7MpUHa7X/yhXIp9vmpMvJbyBk6QHJV6YXYVgx6wSsl9GskMIT1wF oFJreHi2HkST3CBcTIksl+/WDnV1QYPhhY1LZPjMDToAl5EkVZt8Gk6rlz2wYLZGYYbO b5YblqsnEBVrHh5DEYKx1XYLWuRHaw+zpEiew= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=UoByjMdJTaI7RjBVCsbm2AVb3QeNYnPSqxCP/NlIG5s=; b=lEDQn5PBEElYgbtilbFi2zmuPVsIE10MnxSbFqRpLN8V+hCkbJCWVIriKddSI1aFXS iM38yR6FYcoxRLnwn5HAf7p8btHRXQ9zYHL1PiCbVoKFXc7mp3cV4MU1VyaHPBBaCnYC CrBxeNK6TIpZRQzmeiB/gonX3A0mfP3br6C44GL3GdGMuq97GDtxImocU8Pn3YbBtQzr inEmKaY4x3RM2Ac/SIG13DPEsek77zHsLqI75ku3Olt30CivyCnFZN/LS6YW4DCyWBH8 nDOpv/40VIO5P/nm3TnBt4cYdMLbjR39z11xq5etDenXSZY+nCl9N8C1mzdRjjsLEDNn 08yA== X-Gm-Message-State: APjAAAXhddaWzG1HXxNyzGXNDSBM7j0AEKZXvHW0q83d9ltxjmUhSPhz 5BiRm2Apoj8S5hL7mLO8/Ef8MgFC X-Google-Smtp-Source: APXvYqxOj+9FVzS+ncbDyUxZ3nf3H4ihjT1gXHCVbv0edOD3DFJvCLFuFoFFTvP2BhbwH/VpjWOGaQ== X-Received: by 2002:a62:2fc1:: with SMTP id v184mr27105712pfv.258.1556483380587; Sun, 28 Apr 2019 13:29:40 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:868e:: with SMTP id g14ls8389341plo.15.gmail; Sun, 28 Apr 2019 13:29:40 -0700 (PDT) X-Received: by 2002:a17:902:1024:: with SMTP id b33mr56725176pla.46.1556483380280; Sun, 28 Apr 2019 13:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556483380; cv=none; d=google.com; s=arc-20160816; b=BEyZZno7kVM6GboWNrOqXg6n8SvDuxtZuVieIkmCNUxzOvoi/UPcGTM2L++4uEo8b+ cS8XfGP8URxBSivLNwXHVpQO9GCfDtoyX1EWm5zMq2zwsfruiBPRYE4VoAhOC0h8Ci2i OULG+zO9xY+PbL15/JFEmfnfPPI3wZN+ClcSsy0cIRYHIsqrK35i+AvMBJmLdy9Rfykk abcPN9hPuR2zHimyR/EMf+D2YU+FFygHqvcmgopZX4zsxg2C24DGZx9RGcORiRe5Cwvn +qoC1q67DXkTMm/wY8uY6x8sf8RWGkMJ3/4lh1/n9mcWR3MOPfbq5VxHPC7KGxrNKanI AoTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=5iUy/onrKyb2vM2ZlUwsLfl5EkxNlnANZNxhJT3G9LY=; b=0eq6cysmrVsP6N04Ad098CPh7us3l960Pt8JazLioDJ2v66Ro+7fIyvWtIGNl9wrJL wYoJNYr3u2uUPoRD3k6/+0nGq+gK3DA+ODm415HrbrsG4jNGAfcYLdclUXm8Td2qiOXg XYGD9qPvOVnmfvlkDGI7ILZU82IfA889jC+H0Ri/lUrXZo6NXwEDPx8YdRQ2+1PLcsR6 4hFfs2WbGqpPB94CG5iFYYlTlcpa8KFNNMKs2xdhYFsSwJbunveI1hoqqneMoBw44Fy/ DyZC9iLF0HnSOcIEjvXfjNuUI8uvPmPSWvhcvHmf3NxYUlWQ2b0byK/ZtfaOR7BfBCwY qqwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=MPqxGtQn; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id g18sor35345125pfi.1.2019.04.28.13.29.40 for (Google Transport Security); Sun, 28 Apr 2019 13:29:40 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a62:b40b:: with SMTP id h11mr57546179pfn.133.1556483379972; Sun, 28 Apr 2019 13:29:39 -0700 (PDT) Received: from localhost.localdomain ([115.97.185.144]) by smtp.gmail.com with ESMTPSA id x66sm68841439pfb.78.2019.04.28.13.29.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Apr 2019 13:29:39 -0700 (PDT) From: Jagan Teki To: Heiko Schocher , Tom Rini Cc: u-boot@lists.denx.de, linux-amarula@amarulasolutions.com, Mario Six Subject: [PATCH v2 14/19] spi: mpc8xxx: Document LEN setting better Date: Mon, 29 Apr 2019 01:58:49 +0530 Message-Id: <20190428202854.8590-15-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190428202854.8590-1-jagan@amarulasolutions.com> References: <20190428202854.8590-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=MPqxGtQn; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Mario Six 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 --- drivers/spi/mpc8xxx_spi.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c index 63d956a295..1dd5bd9799 100644 --- a/drivers/spi/mpc8xxx_spi.c +++ b/drivers/spi/mpc8xxx_spi.c @@ -119,21 +119,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) {