Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8507844ybl; Thu, 16 Jan 2020 18:22:17 -0800 (PST) X-Google-Smtp-Source: APXvYqz8ILObk4gzgUftwsayC28PwfkU8bt/Hdqp17jqLxOG7XdyUd877id4n3V5BhaF5nwbjpfY X-Received: by 2002:aca:c3c4:: with SMTP id t187mr1832938oif.89.1579227737504; Thu, 16 Jan 2020 18:22:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579227737; cv=none; d=google.com; s=arc-20160816; b=0/royRaZk1XVFjYfKCHWrmnh6Li5CZD1GgrPNWTtdCWdTpGTiniT+UwqLngvQgRjDr hGkXnbokVgHeacrg7nxRT0wr6/UzaNI8jXus7RUj5y1S5vFOMYtFC0KGs+4MQ+glgHqk HWUD7v67l7JydYYRZl2Y0TJ5GiT1sfAORhoBGO8rBPiWH3hunPFKImVI2TJgxIj5VFUv ZiErNUsRL5AoZddIoZ2ulypmdjKfABcuEkzin/iL06G+mAQnMaEKOVCZzw0cMSGBC4Mg wV28mb1X4wzE4gHrPpj5BCuMUw0Wzhz7oOU0h3p969SKGtefAmKiP/NEJ7q6XZz7HewE aNQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rUAYbxMaKR5+yK3D4BdIsgcPhRvm8HylZEGy77b8sm0=; b=sG8AF6fZT+NzcVYZBjTIfX8Q5OLPrMU4uUGKGD8IPvbqvW/PBqkUb3gwKvPZNh+9c4 NblTIOXFkZT0C2n5p2DsAexD1jRoaar86FMmyLJDRY6RyKdKGsumKbV2hPpPe+98S+IZ ZFi3rg2XGBDEUo6wBkiUmlVRzP8QPS+ViZh2jXizoKD6xpUiNMkzGYsDnmSiHMAhLfbo YBuj76i63snpQSOeHO7h4xaknGpAGZr0Msq5r0CVAsyKJpwEdvmJZP4Pvl068kFazhFa HvVOEvGIQNGOOacx3Ik3ldXC2s3bXizAkaanWbBNk8GKFVaZ3uWNJ6WDDmoq1qARMQC4 6WWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="uhl/oZSX"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12si14114206otm.224.2020.01.16.18.22.05; Thu, 16 Jan 2020 18:22:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="uhl/oZSX"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730154AbgAPX0L (ORCPT + 99 others); Thu, 16 Jan 2020 18:26:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:55764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731354AbgAPXZu (ORCPT ); Thu, 16 Jan 2020 18:25:50 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D107B2072E; Thu, 16 Jan 2020 23:25:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217149; bh=1RVsmw/AN+bMpGsTR/ZalrOfVHM0V8DoXXYrZD5lshs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uhl/oZSXzR9u+QDL0pzM0Crxo/vUuMN7Ra4lLJqDBkaK8pkGUMxunWoJ2i5taO3q8 dLJJ0COfH0keWkckhkwQJ2OGBcSQl7uqW2vm68rgvjbsSmy4a+tLbmiWsMokwukA65 Aoeh91GWxIyJ6V10OVgs/GWzkuR4zGbY5O+EVMiA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sam Ravnborg , =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= , Andy Shevchenko , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Mark Brown , linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, Daniel Vetter Subject: [PATCH 5.4 168/203] spi: pxa2xx: Set controller->max_transfer_size in dma mode Date: Fri, 17 Jan 2020 00:18:05 +0100 Message-Id: <20200116231759.290885917@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231745.218684830@linuxfoundation.org> References: <20200116231745.218684830@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Vetter commit b2662a164f9dc48da8822e56600686d639056282 upstream. In DMA mode we have a maximum transfer size, past that the driver falls back to PIO (see the check at the top of pxa2xx_spi_transfer_one). Falling back to PIO for big transfers defeats the point of a dma engine, hence set the max transfer size to inform spi clients that they need to do something smarter. This was uncovered by the drm_mipi_dbi spi panel code, which does large spi transfers, but stopped splitting them after: commit e143364b4c1774f68e923a5a0bb0fca28ac25888 Author: Noralf Trønnes Date: Fri Jul 19 17:59:10 2019 +0200 drm/tinydrm: Remove tinydrm_spi_max_transfer_size() After this commit the code relied on the spi core to split transfers into max dma-able blocks, which also papered over the PIO fallback issue. Fix this by setting the overall max transfer size to the DMA limit, but only when the controller runs in DMA mode. Fixes: e143364b4c17 ("drm/tinydrm: Remove tinydrm_spi_max_transfer_size()") Cc: Sam Ravnborg Cc: Noralf Trønnes Cc: Andy Shevchenko Reported-and-tested-by: Andy Shevchenko Cc: Daniel Mack Cc: Haojian Zhuang Cc: Robert Jarzmik Cc: Mark Brown Cc: linux-arm-kernel@lists.infradead.org Cc: linux-spi@vger.kernel.org Signed-off-by: Daniel Vetter Link: https://lore.kernel.org/r/20191017064426.30814-1-daniel.vetter@ffwll.ch Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-pxa2xx.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1612,6 +1612,11 @@ static int pxa2xx_spi_fw_translate_cs(st return cs; } +static size_t pxa2xx_spi_max_dma_transfer_size(struct spi_device *spi) +{ + return MAX_DMA_LEN; +} + static int pxa2xx_spi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1717,6 +1722,8 @@ static int pxa2xx_spi_probe(struct platf } else { controller->can_dma = pxa2xx_spi_can_dma; controller->max_dma_len = MAX_DMA_LEN; + controller->max_transfer_size = + pxa2xx_spi_max_dma_transfer_size; } }