Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7128824rwb; Mon, 12 Dec 2022 10:23:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf7PbY006fhWCLsNgMrvZPIPRleen6rU8IcmE/wN3IX68xBaMAI6V/q71o2xNM/a0+rGzNPB X-Received: by 2002:a17:902:ccc1:b0:189:3580:48dd with SMTP id z1-20020a170902ccc100b00189358048ddmr20418552ple.37.1670869392021; Mon, 12 Dec 2022 10:23:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670869392; cv=none; d=google.com; s=arc-20160816; b=IAJZDblgZkGk134B13fj7INpqsIR/Y/5j8aIGEQt70aS8o3R2W/y1yjsyX1eO37v7m rzXDBbf2EszHlazT9RHeJ9CGb8Ozm1hB+VNcD5DhATsiVtfHH72TbfmKKx8KBiDRt1fv pKWbZGS09RhjRs/5HsfX+QKSWo6vudU0SklLhOPpl8KtdhcgxmxEwb7pzXFTPv75bNPx 8U/8i9y3ft8NfECjcGOuS34JP+bdf/IOSchmNBzjjuwOvbA7UrXgie2xUhXPyjDjeMOB liIzpnEjZBubnbBH75/VziPHtbPL7zFmnepzdlyCHjktAOjyx6vi9tOcC0e63NdAvVEc hqSw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mtPRqcnGnMJu3Lhjzyyt2cKQspWuIhSj33OJnrwCIF0=; b=HmeT6oBAqPGSlcfKZD9P6cf9zN8h/3/fH+trxtirwP9qrG6iDro4FN20XbDSQzlzk7 zCFcPBpzS2f9R5GBgXs4HH/8Zejqg0G/iGt7ZjYjMvyKC0+CIi2sJ1uazZWqxSkVYVSN Jv60QQGzWqtFGZp+xrF3bklaWqTLvxX41U2XB1VYgXkyAGV+A0ZtfI2/JbS4rKgHNqKr wx/jckmcEq1w+MjCyh74MFJew2nuYw8Ua5gyjW2+hQ3lpoAdcB3qmqkqfqUiw4EWCkCQ T5LrnBx3x5Rt+BuG6jdm9RRp3rvp7uJ2VJ/tdJSDAtPnhlwqXSMbURRxdbE6F77+9s7e BZsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=dic+olsW; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg7-20020a17090326c700b001891ad7051fsi9496449plb.165.2022.12.12.10.23.02; Mon, 12 Dec 2022 10:23:11 -0800 (PST) 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=@sifive.com header.s=google header.b=dic+olsW; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233205AbiLLSJl (ORCPT + 74 others); Mon, 12 Dec 2022 13:09:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233297AbiLLSIW (ORCPT ); Mon, 12 Dec 2022 13:08:22 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93C6A5FB0 for ; Mon, 12 Dec 2022 10:07:51 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id b24-20020a05600c4a9800b003d21efdd61dso4400723wmp.3 for ; Mon, 12 Dec 2022 10:07:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mtPRqcnGnMJu3Lhjzyyt2cKQspWuIhSj33OJnrwCIF0=; b=dic+olsWhbv9Bdud+svAQHzZHug2lLj+vz7hVn19EyP7/8WryNdN+/Ac8gMCuGBZkU uYZwRo2TdqRr2c8T+9GTVOsdjr0TIK2krifSwPPBfojcXy38wrxCPtFgvLg/NfY76g7t 8e/XIrRELDolos2n0GIeUN65WLoTfz2BkcpPlxs4fH3aWc+6fg+1UfhgDt9k/sQzXX/3 qDcadSlnFCH7ygbGyjKNYFi0sxiqgIedHIgUjC5yA/Lw30AVOO8CAwWFHHIdo+IZigWT xbofJbDupAmmm8nls29Ol+1RZQDApqRklwcZZfKdp63b9my0f4ojm9npEEgof4KOHjHi lwzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mtPRqcnGnMJu3Lhjzyyt2cKQspWuIhSj33OJnrwCIF0=; b=seOzWEX8qjpWIUzcRogR6LFT09cxIFrGGEfnv5/MPzOtGXNnTP2PUB7MJ9UW6UFPER 4OqaEMaa9b9Smk3IOXHDnxmRtjMfAxadIjuaaCn0EWbf5PIi3n7En1XKI10bnOYHZtiW KCEZ/Tm0VkcU4HjWGqhCgSpY6+3fNhW3O+6vrwR+A6Ysqzb+tGuAf8ruqMvdmc7+YgOv 77KgBpYeZ9eSxSEV9gaVROyg6LdIBd8qp7gO1kcJdGylSURgp2Q9ckO6s3ORe3I2uzTZ 9fMDxKBWv2RvxKPoY7xEbou0SilKZqiM1RIbKKATCff177pHgx+rrtyKK4BVWDyM945D U2wA== X-Gm-Message-State: ANoB5pltXLVdqyvxtOej+8dWvUR5rhOTbIM65IXKMBGO4mJg6OpDo7Yu DTnegxBzmigD41xJ4kjlPHNWpA== X-Received: by 2002:a05:600c:4147:b0:3d2:2904:dfe9 with SMTP id h7-20020a05600c414700b003d22904dfe9mr2396260wmm.21.1670868471634; Mon, 12 Dec 2022 10:07:51 -0800 (PST) Received: from localhost.localdomain (host-78-150-37-98.as13285.net. [78.150.37.98]) by smtp.gmail.com with ESMTPSA id t123-20020a1c4681000000b003a3170a7af9sm10156808wma.4.2022.12.12.10.07.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Dec 2022 10:07:51 -0800 (PST) From: Sudip Mukherjee To: Serge Semin , Mark Brown , Rob Herring , Krzysztof Kozlowski Cc: jude.onyenegecha@sifive.com, ben.dooks@sifive.com, jeegar.lakhani@sifive.com, linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sudip Mukherjee Subject: [PATCH v2 11/15] spi: dw: adjust size of mem_op Date: Mon, 12 Dec 2022 18:07:28 +0000 Message-Id: <20221212180732.79167-12-sudip.mukherjee@sifive.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221212180732.79167-1-sudip.mukherjee@sifive.com> References: <20221212180732.79167-1-sudip.mukherjee@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 In enhanced mode adjust the size of the data that can be sent or received as this will then be used to set the NDF. Signed-off-by: Sudip Mukherjee --- drivers/spi/spi-dw-core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-dw-core.c b/drivers/spi/spi-dw-core.c index 75f5ce5f377ca..dff7b419af304 100644 --- a/drivers/spi/spi-dw-core.c +++ b/drivers/spi/spi-dw-core.c @@ -546,6 +546,13 @@ static void dw_spi_handle_err(struct spi_controller *master, dw_spi_reset_chip(dws); } +static int dw_spi_adjust_enh_mem_op_size(struct spi_mem *mem, struct spi_mem_op *op) +{ + op->data.nbytes = clamp_val(op->data.nbytes, 0, DW_SPI_NDF_MASK + 1); + + return 0; +} + static int dw_spi_adjust_mem_op_size(struct spi_mem *mem, struct spi_mem_op *op) { if (op->data.dir == SPI_MEM_DATA_IN) @@ -997,13 +1004,14 @@ static void dw_spi_init_mem_ops(struct dw_spi *dws) { if (!dws->mem_ops.exec_op && !(dws->caps & DW_SPI_CAP_CS_OVERRIDE) && !dws->set_cs) { - dws->mem_ops.adjust_op_size = dw_spi_adjust_mem_op_size; if (dws->caps & DW_SPI_CAP_EMODE) { dws->mem_ops.exec_op = dw_spi_exec_enh_mem_op; dws->mem_ops.supports_op = dw_spi_supports_enh_mem_op; + dws->mem_ops.adjust_op_size = dw_spi_adjust_enh_mem_op_size; } else { dws->mem_ops.exec_op = dw_spi_exec_mem_op; dws->mem_ops.supports_op = dw_spi_supports_mem_op; + dws->mem_ops.adjust_op_size = dw_spi_adjust_mem_op_size; } if (!dws->max_mem_freq) dws->max_mem_freq = dws->max_freq; -- 2.30.2