From patchwork Sun Apr 28 20:28:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 331 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 3C7F33F08F for ; Sun, 28 Apr 2019 22:29:44 +0200 (CEST) Received: by mail-pf1-f197.google.com with SMTP id d21sf6141441pfr.3 for ; Sun, 28 Apr 2019 13:29:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1556483383; cv=pass; d=google.com; s=arc-20160816; b=LBcOLK5Vnm2H7kDZhHcUSv+Dym6v+YEnhvFEGesjy/seibIXBYYtPbZ0nOSL6sh0HY fs7KHZJ9t4O7hC4sIY3NmMPLlrzzunxD+RHJkWN0cMoGxan0rudXmllwqUSF6dpNHbR2 dbH/IEX/g96fzz2eugovU7AR+x8nDopBwiidp6p/l74uPnhQpewuIBvo7lUPECczXakr rj6QqWe63PF9M313Btb/zuAIbLoWbhmLFnGfIuqW3KGmLwyUAfy6gdghPyGbM28YMpPi y2ceh9JPqFPvxz/roWBbRWIjKiV/FknGr/rhYsJNYKertsMQV6UD0RkTGtMhqVxLV14U 8m6A== 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=j3VAK65cVmoFcuKjESxUDxtL/EZ9IETaYwB9ufA8+Nk=; b=yLXQc6BWyN1cXo590bURGkJpBGle6EdpAngLpIUoVdStjSs9rvWc0Zp6kgMy8THikK ARmzptPU1Tc9vbspWRkrio5BY7ARaXqMXvwZx/ZMNoaWZIMa7oPP9gfN+MNibXQzJopQ dqG+TcW8IcZwfZ7OcOIQ7pvNMWGHhoaknd4AkDZWKNGSliJWFI0YzwA+6f7SgDIh2rMh VomtZbwYjhF9g9EMSEmq/u6p9nDWz3QTKP1ufCtxT/ojJOIm22xsQTeVZQ2RScPx5Zzn 3+ZtK3mtGI6wnwv7BZFdTowic3v7vaVvR1O/3lLJHFfxEugUpi+bX9In05jFSj9bfz+t f1wg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=HVDWAzPL; 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=j3VAK65cVmoFcuKjESxUDxtL/EZ9IETaYwB9ufA8+Nk=; b=f6B1UBPBeT9NFOPl3s5RF+1hht7mypKG40cGoyAF2SrTjNI8NyVbmb4I/Gw7WmpsdR fpWgrG2UxcTVwgWBglm1+IGTEBOlwxkECtjCgiJAWasAzJ4DDD1vlrtVdoAwVPaTG+75 PbPj+pToZFb1LLjaBDfTFQB8k8ocklaY/5Vas= 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=j3VAK65cVmoFcuKjESxUDxtL/EZ9IETaYwB9ufA8+Nk=; b=B17CGgpEBXkWRQrgzJUNr0oxtZkTypzbZd2uZr8ckT64h47t9nAX85mkIFFVAdrS7t fmg9ZzQ4ByDiBdo3t8MGl4bg07NpNR4kmHF4tyRBoSIF0QVEriTBFq0Wm1UBDXUhP4Cb Di9p+BT7ZT91gB9n44yuopHLr0nwSoBKgBoH6xPXq9Y++P/qssWYcESwAoEQe4b/+1kt jLzCA6eabmRYfL0ZzayEPAsQrTXJMUti8K/SCYlfkW1etdhrh328J+94zzWlSiXZtnFK wVM+1ei+2Epd4k5MV8W5yaz5J+wtV5RS3nGQC24Zaupol9+d6RW0AWTPICxbMyykf+xO f6OQ== X-Gm-Message-State: APjAAAXYFJC+94GkjAKVDz6bNrG28S5wcYvoKLBnCQDaAB4ADlOLk3Z4 9jNF9jHXj7T6aUdP/CFpLPAZJh7g X-Google-Smtp-Source: APXvYqzePhzYWh8joo/Z0Q5mGpww64hUkGrEHfD7qf1+yAp18n2AG0/ttf7UFWdI/VILPOahm1PNZA== X-Received: by 2002:a63:4a5a:: with SMTP id j26mr52958277pgl.361.1556483383058; Sun, 28 Apr 2019 13:29:43 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:838f:: with SMTP id u15ls193448pfm.14.gmail; Sun, 28 Apr 2019 13:29:42 -0700 (PDT) X-Received: by 2002:a62:e90d:: with SMTP id j13mr18407574pfh.42.1556483382689; Sun, 28 Apr 2019 13:29:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556483382; cv=none; d=google.com; s=arc-20160816; b=YleSQrcDMHI0m8TZB37z10FJi8ATMJgNI98HZYa2a7o/O2zPstRiij6xWJ7Yw+r5L1 Sj4XdeTxxGNq4SsK8DuZ21tkoUh0Doz7lUjrskYpcgDHMy4CEt73VE5K8QnnmGmUi0yg E/px7f/1W59sHAGZEUfM67enPjlrY446IExKz8S96YCWWyA1wydTNexAv5iL5ogY/qT1 TUdF4r+aKrlgoN8JaPsTpUUEFrFIWvE2T/Z14kA8Bji4BL9fNSqflfSW7oric7DBmcax qHO9JgHW7dOfh8MpH7P7tQ/vLwXP04usPRv1J5mSuRgBrSMRTz4Dvzs3JJWU/IvySC8i npfA== 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=Af0JQDkiw7NwHTMJnvOcv/QQFGgcR9xzFcMmqc8Aacs=; b=EJUG8gFM+JRnzgqF+qfnsNojUiXgiIsoH4ef37SWPhx3ft7OWcjJDjzOki1+zMDAJl WRAQvdhWeTkFGRVMdYfBk6sTIA9FOr63FWU0X6RzwsGiCg2wMl/2/jyLwLYoyEfUvIu6 0Y+NCL9dbaiS7VVssVn/i580klk2sJdtlcttNaM2kRArtZ86ILWGVXtuET7AwdCB2FD6 JH3QGbMQH5x8w9XNbRKToyMv3NbaZaVggzSUAm89CEu7c5fZpdZH63pmj2NYFmQq8Ah5 cqCZpaUMKkCiUcD2huKLV1tDPINVyx5r94fgy0ChQ8dj4sv9S9hJ+3HGnGaPd+ke9Aow 2u7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=HVDWAzPL; 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 i65sor1414948pfe.16.2019.04.28.13.29.42 for (Google Transport Security); Sun, 28 Apr 2019 13:29:42 -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:aa7:8e55:: with SMTP id d21mr9096991pfr.62.1556483382383; Sun, 28 Apr 2019 13:29:42 -0700 (PDT) Received: from localhost.localdomain ([115.97.185.144]) by smtp.gmail.com with ESMTPSA id x66sm68841439pfb.78.2019.04.28.13.29.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Apr 2019 13:29:41 -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 15/19] spi: mpc8xxx: Re-order transfer setup Date: Mon, 29 Apr 2019 01:58:50 +0530 Message-Id: <20190428202854.8590-16-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=HVDWAzPL; 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 Minize the time the adapter is disabled (via SPI_MODE_EN clearing/setting) to just the character length setting, and only set up the temporary data writing variable right before we need it, so there is a more clear distinction between setting up the SPI adapter, and setting up the data to be written. Signed-off-by: Mario Six --- drivers/spi/mpc8xxx_spi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c index 1dd5bd9799..1e7c0144c2 100644 --- a/drivers/spi/mpc8xxx_spi.c +++ b/drivers/spi/mpc8xxx_spi.c @@ -116,9 +116,6 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din, u32 tmpdout = 0; uchar xfer_bitlen = (bitlen >= 32 ? 32 : bitlen); - /* Shift data so it's msb-justified */ - tmpdout = *(u32 *)dout >> (32 - xfer_bitlen); - clrbits_be32(&spi->mode, SPI_MODE_EN); /* Set up length for this transfer */ @@ -130,14 +127,17 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din, else /* more than 16 bits -> full 32 bit transfer */ set_char_len(spi, 0); + setbits_be32(&spi->mode, SPI_MODE_EN); + + /* Shift data so it's msb-justified */ + tmpdout = *(u32 *)dout >> (32 - xfer_bitlen); + if (bitlen > 16) { /* Set up the next iteration if sending > 32 bits */ bitlen -= 32; dout += 4; } - setbits_be32(&spi->mode, SPI_MODE_EN); - /* Write the data out */ out_be32(&spi->tx, tmpdout);