Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6740070rwi; Mon, 24 Oct 2022 05:38:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Hk1x8A5YO0JqL8K2g8auikM2lPT1xEvjDVsEMn3vEbBkdas8491KQDR7bQ4nh1GEvNhVn X-Received: by 2002:a17:90b:1e0d:b0:213:ae0:fcf8 with SMTP id pg13-20020a17090b1e0d00b002130ae0fcf8mr6384445pjb.189.1666615111024; Mon, 24 Oct 2022 05:38:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615111; cv=none; d=google.com; s=arc-20160816; b=KY0rLM7hae+G2FhKp11RckfDdoSndZ+F8yw+XAwDV7RACP+kCOdbacsHiy3pKpioDT iU2h0gR0GMRQ6RgHS3w71l1hXUG2wrQnWW0uJi9PMn4Q6jhRhHSdYKUy3Qm3ljfNa/4J 8fmskbi6owp3KyQAm1n/GhZ5jjlYaSvaELYkVZZrL0OspIR8JMSzPa+TO1VU+SdkTREB REBk60BJ6cif2rrCP4IveT7z4PjpQS09OxiFSqQAsCh9FLzONTzAyTyYlZ1XaSFGQeeZ k4X3jE5Vj71SsKWy+pfg4iTFKgQDeB8EykyC82/qfFnyzerYq6zfnhVE/lYgzBA9Idab NTqg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H9t2Pd79/ZBnuM+vEv0vU/tnBKXwkoj8KeSkx0yQ00s=; b=pGvjoh9NuNb9i4XJzC5GML0hljDIoPDPHvGtX3G/r22xffL3TAVRum1enbNts0gYeL ABZv1ko1glEWP9P8lZSryctoWNguw9mZrXOGE/uAfrlN0Myh+DCnS2SZURJGtRemxZN2 wmRLbDn4dwchsBpqOWYAcYT2buT4dN29z9VNBPK3CZXNkPeJFnrldBRoleJGyJo6saJi Jn5Q6WjPIOR4vVW8Aorf+0Frg+dLhtNclaqP4R5FGsO1u20DuJsoxz7TpGEJC0lZD1CF UucsohvtcW7sslN9juJ45oZ9qiL7uqLOBx7UwlwX2BxLS+P9oQvAvbF6hLxOeZ+drEHg Av+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wyhJ5D19; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w18-20020aa79552000000b0056b8bbfe687si7732749pfq.171.2022.10.24.05.38.19; Mon, 24 Oct 2022 05:38:31 -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=@linuxfoundation.org header.s=korg header.b=wyhJ5D19; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232564AbiJXMDI (ORCPT + 99 others); Mon, 24 Oct 2022 08:03:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232181AbiJXMAF (ORCPT ); Mon, 24 Oct 2022 08:00:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 659AD2C13B; Mon, 24 Oct 2022 04:49:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 075066122D; Mon, 24 Oct 2022 11:49:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDDFAC433C1; Mon, 24 Oct 2022 11:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612160; bh=9cEPUI0SO0/uP4WT5g3TlaqxPNGzZlpCwpnE79x7qNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wyhJ5D19w5GSfxqxzD2eAY5eqPucN1gPkaP0tvdo9zKSu+AeIVt4V+/CYGuIWXGv2 cw4wukLVBmqbGeSi6E2DGb2N/EuQaJkqNFAYvIC28ZuwaMhEKGE6w18bABKY/uKHTq D9gj8aHE4PiYJ7v1zszAavk50DTstlwWa9kVDyUg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Whitchurch , Mark Brown , Sasha Levin Subject: [PATCH 4.14 092/210] spi: s3c64xx: Fix large transfers with DMA Date: Mon, 24 Oct 2022 13:30:09 +0200 Message-Id: <20221024113000.021214538@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 From: Vincent Whitchurch [ Upstream commit 1224e29572f655facfcd850cf0f0a4784f36a903 ] The COUNT_VALUE in the PACKET_CNT register is 16-bit so the maximum value is 65535. Asking the driver to transfer a larger size currently leads to the DMA transfer timing out. Implement ->max_transfer_size() and have the core split the transfer as needed. Fixes: 230d42d422e7 ("spi: Add s3c64xx SPI Controller driver") Signed-off-by: Vincent Whitchurch Link: https://lore.kernel.org/r/20220927112117.77599-5-vincent.whitchurch@axis.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-s3c64xx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 1a6ec226d6e4..0594e214a636 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -94,6 +94,7 @@ #define S3C64XX_SPI_ST_TX_FIFORDY (1<<0) #define S3C64XX_SPI_PACKET_CNT_EN (1<<16) +#define S3C64XX_SPI_PACKET_CNT_MASK GENMASK(15, 0) #define S3C64XX_SPI_PND_TX_UNDERRUN_CLR (1<<4) #define S3C64XX_SPI_PND_TX_OVERRUN_CLR (1<<3) @@ -640,6 +641,13 @@ static int s3c64xx_spi_prepare_message(struct spi_master *master, return 0; } +static size_t s3c64xx_spi_max_transfer_size(struct spi_device *spi) +{ + struct spi_controller *ctlr = spi->controller; + + return ctlr->can_dma ? S3C64XX_SPI_PACKET_CNT_MASK : SIZE_MAX; +} + static int s3c64xx_spi_transfer_one(struct spi_master *master, struct spi_device *spi, struct spi_transfer *xfer) @@ -1067,6 +1075,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) master->prepare_transfer_hardware = s3c64xx_spi_prepare_transfer; master->prepare_message = s3c64xx_spi_prepare_message; master->transfer_one = s3c64xx_spi_transfer_one; + master->max_transfer_size = s3c64xx_spi_max_transfer_size; master->num_chipselect = sci->num_cs; master->dma_alignment = 8; master->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) | -- 2.35.1