Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19198308rwd; Wed, 28 Jun 2023 06:25:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7x3pPsWK6k5M0Zs+ZzQn4Qs24bAyaGrb9H5NEVeTnauarJlW01yxm/2Qj1TtDCCJMrcEKn X-Received: by 2002:a17:907:983:b0:94e:2db:533e with SMTP id bf3-20020a170907098300b0094e02db533emr34652614ejc.49.1687958726778; Wed, 28 Jun 2023 06:25:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687958726; cv=none; d=google.com; s=arc-20160816; b=bgp16hExI4ncD4M3P4UVHDm9+lUytzop/s4pNIthtn4B0jGM90EEfjdbMO/6Y6p42u 4ZzAci9Q5W2P215KwA2Q2BIvWmllXCUOSsIPnT8E9/akKAsO9GXtIN2IIg1DLf5MGKsI YLog1xBfalBWVmXTWnYrjMbiAckgQFoBfrOTgzi5O1/4pi83a9m9+i64onIwsnOk22/H H52W0H6SYRi/XIcT8PSlibeZwgwTwIOjoC/gecNVaq3qTa7aJ8D7U/yp2wUWAn6vkOKm /6p5PmqM1Z651Tw749oQSatolJPMauq3CjjFMcd8LYYy+oQkyEd0tUrcnu0jGNyO5VG/ 9jdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=rhoE/hOU88UBbnOfrfm2/MGIVLb91cXx21MeqmNwUZw=; fh=9ubfb2xbPp8BtoH163x6BWFxwEamlqk5+p1XwsjjKKY=; b=L34PSnLjmHmmr+qrYAgwePp2LI2RgpgXPc3p3PCzq3nmLyoZs/biz4QjI4tTSInuvi J+Hv2mOCUzQd5TgHcjv15f3v4Gjl1CNVDMZcF+jUyA0Bh+dYOEP0OCvvQapU1a0+bRRm bPf5iA5KGn0HyrmN4MjNaw7KvTeBP3op4efPr5jo8tWuaSUW1P/AlkQO3qgI9jQSZ3yE Rcs4irbQSOOshnZdGRaD0XZnJWF2e5aLAuhFsn3MM03mV2UklJwdD33TMfTsd1GxLJdt 7U1poXAYq/U09seT0aaRZNrSmL3MDK8+5CD7Q0DBB5rVpB1C77ke2cIzumMJ0rwzi4rr W2SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@technolution.nl header.s=google header.b=Npt0Tn85; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=technolution.nl Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lx24-20020a170906af1800b0098870446117si5819209ejb.4.2023.06.28.06.25.01; Wed, 28 Jun 2023 06:25:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@technolution.nl header.s=google header.b=Npt0Tn85; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=technolution.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229804AbjF1M4e (ORCPT + 99 others); Wed, 28 Jun 2023 08:56:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231918AbjF1Myu (ORCPT ); Wed, 28 Jun 2023 08:54:50 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4A751FFE for ; Wed, 28 Jun 2023 05:54:45 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2b69e6cce7dso56518841fa.2 for ; Wed, 28 Jun 2023 05:54:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=technolution.nl; s=google; t=1687956884; x=1690548884; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=rhoE/hOU88UBbnOfrfm2/MGIVLb91cXx21MeqmNwUZw=; b=Npt0Tn85u814tonQVf53TAZhdKLQB+57Y8w4w3VZP+BNUQf+hcfeytqDl9knhUAGcL E+PTgJSQOhBbcyVFH7iRAJGOtbPV59HTS1Aut/PD1EwmVux+zCbeIVQbTRpnIR9MSCM/ 8ltf+TGp9AuvL3we8eWSwfa/eAs+VMzps4yl0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687956884; x=1690548884; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rhoE/hOU88UBbnOfrfm2/MGIVLb91cXx21MeqmNwUZw=; b=aCcmPEbmTaOVA+YqlSQ9bHkLrnTwOnafpRs0jZb2onhYkUWJlGVzIFmbP7707J3NaS XXdp448Ok2K5tHgdJ5aC0zt2mbHuKdu+SN78V7mAaozsEqiZuH6j9Xz3ghfGdvHu3qF8 rHxJX9OPlb4Grqmu4Z0oUR2vKeTRVMO1sTZbVBV0TwkimYMxMeRhV1y5Nqs5f1Iuuc7v 5um8QqeG8ayO9MN+tRiuvLhVjxNT2G3e+4pS66KhGwPvQrjTvzescuu1TsHc0CgwL6cJ kRUUkcRS23HohmMgAlyPcqnc1rlD27o4oAPRbnrodIyBbGgUD1UKxvj9C/ms1e020fyd UQTQ== X-Gm-Message-State: AC+VfDy04cf63DAXczswPF2pWyNC5ZCFmnDfdgqcvnrdSHbzX/TQ11gN OxqboOzdprfD26gqSg8erb48N8lj8rTXmGtISH8tCUJMLFwqoPdu5YZj0xhDO3u+wsWeQzJXFlW MNnfaqt1USpK+OKOhuQ== X-Received: by 2002:a2e:9943:0:b0:2b6:9909:79ca with SMTP id r3-20020a2e9943000000b002b6990979camr8036311ljj.30.1687956883878; Wed, 28 Jun 2023 05:54:43 -0700 (PDT) Received: from STM-Latitude-5530.intranet.technolution.nl (90-145-157-240.bbserv.nl. [90.145.157.240]) by smtp.gmail.com with ESMTPSA id h8-20020aa7c948000000b0051d87e72159sm4440636edt.13.2023.06.28.05.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 05:54:43 -0700 (PDT) From: Stefan Moring To: broonie@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Stefan Moring Subject: [PATCH] spi: Increase imx51 ecspi burst length based on transfer length Date: Wed, 28 Jun 2023 14:54:06 +0200 Message-Id: <20230628125406.237949-1-stefan.moring@technolution.nl> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-techno-validated: techno-validated X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org IMX51 supports 4096 bit burst lengths. Using the spi transfer length instead of bits_per_word increases performance significantly. Signed-off-by: Stefan Moring --- drivers/spi/spi-imx.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 34e5f81ec431..cbd306c25d28 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -644,9 +644,13 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, if (spi_imx->slave_mode && is_imx53_ecspi(spi_imx)) ctrl |= (spi_imx->slave_burst * 8 - 1) << MX51_ECSPI_CTRL_BL_OFFSET; - else - ctrl |= (spi_imx->bits_per_word - 1) - << MX51_ECSPI_CTRL_BL_OFFSET; + else { + if (spi_imx->count >= 512) + ctrl |= 0xFFF << MX51_ECSPI_CTRL_BL_OFFSET; + else + ctrl |= (spi_imx->count*8 - 1) + << MX51_ECSPI_CTRL_BL_OFFSET; + } /* set clock speed */ ctrl &= ~(0xf << MX51_ECSPI_CTRL_POSTDIV_OFFSET | @@ -1243,6 +1247,7 @@ static int spi_imx_setupxfer(struct spi_device *spi, spi_imx->spi_bus_clk = t->speed_hz; spi_imx->bits_per_word = t->bits_per_word; + spi_imx->count = t->len; /* * Initialize the functions for transfer. To transfer non byte-aligned -- 2.34.1