From patchwork Sat Apr 13 18:24:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Noralf_Tr=C3=B8nnes?= X-Patchwork-Id: 10899583 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0917017E1 for ; Sat, 13 Apr 2019 18:25:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0240285A7 for ; Sat, 13 Apr 2019 18:25:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C437228C6A; Sat, 13 Apr 2019 18:25:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38A0628660 for ; Sat, 13 Apr 2019 18:25:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726930AbfDMSZI (ORCPT ); Sat, 13 Apr 2019 14:25:08 -0400 Received: from smtp.domeneshop.no ([194.63.252.55]:57877 "EHLO smtp.domeneshop.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726922AbfDMSZI (ORCPT ); Sat, 13 Apr 2019 14:25:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tronnes.org; s=ds201810; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date:Subject:Cc:To:From; bh=7fV9uF+4cawiInOUzAfChWU/oar75aQbhzq3jTZbP/I=; b=rKuQV4oarcUNssjk2B5L3kVsvfn61dJCa2oNWFzE3SOJAsAfOg4iQk+TZZelhMZG3egssT70ys/ogPVqb9cZGfx2m5X+Yv4vLxJPmdHDSjmtBZftrr1FG82oYilHWSvcxhx3SYzw/v127XdV+tKNvmta9DCv+v6BLZcy9tehKPwmXJPj3fgy9tTEO/mrDMupNMGtNS2dHbLsZ9FsVQ+RUADNCjyV1KGAucBzavB1JN5koGwQAs02LpDYfVlDYT8BcKKDEVDZlIgZ+XAbBXjBJ/DXc2tjakcH4tWzc9J3ie55Hb6baBktWDWUCpvVibu3CczIxDraj/NaKOOZjAiULA==; Received: from 211.81-166-168.customer.lyse.net ([81.166.168.211]:48766 helo=localhost.localdomain) by smtp.domeneshop.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.84_2) (envelope-from ) id 1hFNKr-0005SF-9s; Sat, 13 Apr 2019 20:25:05 +0200 From: =?utf-8?q?Noralf_Tr=C3=B8nnes?= To: linux-spi@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: broonie@kernel.org, eric@anholt.net, stefan.wahren@i2se.com, kernel@martin.sperl.org, meghana.madhyastha@gmail.com, lukas@wunner.de, linux-rpi-kernel@lists.infradead.org, =?utf-8?q?Noralf_Tr=C3=B8nnes?= Subject: [PATCH v5 0/4] Chunk splitting of spi transfers Date: Sat, 13 Apr 2019 20:24:11 +0200 Message-Id: <20190413182415.38543-1-noralf@tronnes.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP spi-bcm2835 has a ~64kB upper limit on DMA transfers. Drivers in drivers/gpu/drm/tinydrm work around this limitation by splitting the buffer into multiple transfers. This patchset lifts this driver limitation by splitting affected transfers using spi_split_transfers_maxsize(). Based on the feedback on the previous version, I now understand that ->max_dma_len is used to make scatter gather entries that the DMA engine can handle. For a BCM2835 Lite DMA channel this is 65535 bytes, the same limitation that the SPI block has on the combined DMA transfer length through its DLEN register. The SPI block in DMA mode accesses the FIFO 4 bytes at a time, so the aligned maximum length is thus 65532 bytes. Since this is a BCM2835 SPI block limitation and not a common DMA limitation that drivers face, I've moved the splitting to the driver. I also found out why buffer unmapping happened on the original transfer instead of the split one. spi_res_release() restored the original transfer before the message was finalized. AFAICT reordering this shouldn't cause any problems. Noralf. Meghana Madhyastha (2): spi/spi-bcm2835: Split transfers that exceed DLEN drm/tinydrm: Remove chunk splitting in tinydrm_spi_transfer Noralf Trønnes (2): spi: Remove warning in spi_split_transfers_maxsize() spi: Release spi_res after finalizing message .../gpu/drm/tinydrm/core/tinydrm-helpers.c | 83 ++----------------- drivers/gpu/drm/tinydrm/mipi-dbi.c | 10 +-- drivers/spi/spi-bcm2835.c | 39 +++------ drivers/spi/spi.c | 9 +- 4 files changed, 20 insertions(+), 121 deletions(-)