From patchwork Fri Apr 14 12:05:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 83384 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp342292vqo; Fri, 14 Apr 2023 05:28:22 -0700 (PDT) X-Google-Smtp-Source: AKy350ZG32YQgibLVSm+kPhxb7OyrlGZN/23UQXkseweh8/xk9KMfLXDAM3CUhxSMHpaK0UjbTzR X-Received: by 2002:a05:6a00:174c:b0:5a8:abd2:2beb with SMTP id j12-20020a056a00174c00b005a8abd22bebmr8737437pfc.30.1681475301789; Fri, 14 Apr 2023 05:28:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681475301; cv=none; d=google.com; s=arc-20160816; b=LnQpePNhd/YNXhnuuYO6b/ICS0mVQlaTPC/vgWBbpk2uP79/cxILrRXeG1tX3JrrgB C+fbpio8jKlYe7hVDXz6s0nx7GGA4dtKeABkASbDMfT7XfhnwxQorCpU/Plo4Qu5Lixc dbYmq2If+05i5exb+q6uZrytn1ly7M/FNFL1Uvt6R2MeeEd0cundqPWyGSwhV2FXmGDI f9x2EKvk7K0M3tVwbhN27vfCiwmWK5UhI0drHnheqcDKxIJoUV8QzOtl7xKi1LARyKLd PU7sWcWvuaklqywRQOTVywlgiBNx17TrFIuPqq9aSeBLWacE6uXUABsPIagmjOWRuJzo K0jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=nKDaeGp5EKkZDqIsokus1OmDmfvkWgZNrRNY08uRrUc=; b=NnTNZz0HKpMcPljGIpuaqZSpTasLn3NJcZagdul5jvf/I5HpnNbVqieCbZad+YQp/U NHujaJu86WatCrHBSCTy8Ezq4ty8hUXD326AIKMt9LsZ76OIlvsS1BtHvlvqvtRqfBRO HqApOe+ukSkUeJOLq0MBOw9VhKbLF7eKn0D0/Vflx8gKqJdEYm0WBmHIhau2N2fQbwhI Ac1/4zYnfeq2EQzU4c89s2VbRgG3NX0LJQnVKL1DppTxhRjCWQLSQ0MTS3fJU7E4Lfn5 6e+T4MMlBh6BqSHkHYkD1q+mWsBWJBrKLRCQ1lKJdipIhupvNOg4cNApHeBJlX403sbf BIqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=MileTBwt; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x3-20020aa79ac3000000b00639e52424a6si4315318pfp.146.2023.04.14.05.28.08; Fri, 14 Apr 2023 05:28:21 -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=@google.com header.s=20221208 header.b=MileTBwt; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230167AbjDNMFf (ORCPT + 99 others); Fri, 14 Apr 2023 08:05:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229950AbjDNMFd (ORCPT ); Fri, 14 Apr 2023 08:05:33 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDCB7127 for ; Fri, 14 Apr 2023 05:05:31 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id j193-20020a2523ca000000b00b8f6b82ec94so2504129ybj.18 for ; Fri, 14 Apr 2023 05:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681473931; x=1684065931; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=nKDaeGp5EKkZDqIsokus1OmDmfvkWgZNrRNY08uRrUc=; b=MileTBwtlL0qqRT9AiQfm9JMqrnFA9bJsAcMj7ZZ9KppF1hAzoRuBJa+Y6TzrKhNh9 0zpRMfy7KoXKTtjw/1phr1Ju8Q7MUC3Pv2KXsUmij4naENHQWdy5ESjF2rESYm0/J1nH ZnXqByO+tcKc/Uosx35Kpn+fCdC0j9wB2QkGB8bZgQAQQ0gPupXYv3MWdmOAItIRdjlp wtWbEs8sADYLMeffdzvE/pty1M/x1pgUZbGEUahJgaG3Q4TzOWLa8UGhJfh4ER628TTZ M7K0CE9thwSsjjvv6lkLhAR6VG4lMylReBNHP7mHOm+66jtDweWML0O0f9DBsbI3hIWD HkAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681473931; x=1684065931; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nKDaeGp5EKkZDqIsokus1OmDmfvkWgZNrRNY08uRrUc=; b=Z7K41qR3JqJUIr5OjM+7ZuNgi3cPxtJ1vNL/pfv6svvk5Tpnq/ROauM/feBgQX0Orm KipAKag1XNWy5t2lV+y6Fs5PJJQLjExu9UkvaZw94VBGUC/Zkp7SiE6mm06Ix4c4OtqP wPBfmSRiZ+rpiP8o6jdWD7TSs5ioQm7x+ZYUsx+gdk051e6BXRLjwGYB/VA4aZswgL0A Yd+rWY7iHQOaF2su7MuxQ7bAacc4iDQhvBAT6G3lv5j2VD9DDQTWqAL0z1Tso3cNK6uH uzrR+QfMPBDRp1awApezpdf4IRhS1OhfxW5Gpl8rSRh1AX981hGX/aCw3XgfwYM2avGE zu5A== X-Gm-Message-State: AAQBX9fJ8i4opiv0QfmYZJdJ5kjjI/6e6sXekykAQYZNKrK4gSqEOP7K 9lKbwPSRYUOZUaSEQQkT3B/8pyeGY2hrsA== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a25:73d1:0:b0:b92:1f57:8d03 with SMTP id o200-20020a2573d1000000b00b921f578d03mr355881ybc.9.1681473931261; Fri, 14 Apr 2023 05:05:31 -0700 (PDT) Date: Fri, 14 Apr 2023 12:05:16 +0000 In-Reply-To: <20230414120520.360291-1-joychakr@google.com> Mime-Version: 1.0 References: <20230414120520.360291-1-joychakr@google.com> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog Message-ID: <20230414120520.360291-2-joychakr@google.com> Subject: [PATCH v6 1/5] spi: dw: Add 32 bpw support to SPI DW DMA driver From: Joy Chakraborty To: Serge Semin , Mark Brown , Andy Shevchenko Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, manugautam@google.com, rohitner@google.com, Joy Chakraborty X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763154645722041612?= X-GMAIL-MSGID: =?utf-8?q?1763154645722041612?= Add Support for AxSize = 4 bytes configuration from dw dma driver if n_bytes i.e. number of bytes per write to fifo is 4. Number of bytes written to fifo per write is depended on the bits/word configuration being used which the DW core driver translates to n_bytes. Hence, for bits per word values between 17 and 32 n_bytes should be equal to 4. Signed-off-by: Joy Chakraborty --- drivers/spi/spi-dw-dma.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-dw-dma.c b/drivers/spi/spi-dw-dma.c index ababb910b391..c1b42cb59965 100644 --- a/drivers/spi/spi-dw-dma.c +++ b/drivers/spi/spi-dw-dma.c @@ -208,12 +208,16 @@ static bool dw_spi_can_dma(struct spi_controller *master, static enum dma_slave_buswidth dw_spi_dma_convert_width(u8 n_bytes) { - if (n_bytes == 1) + switch (n_bytes) { + case 1: return DMA_SLAVE_BUSWIDTH_1_BYTE; - else if (n_bytes == 2) + case 2: return DMA_SLAVE_BUSWIDTH_2_BYTES; - - return DMA_SLAVE_BUSWIDTH_UNDEFINED; + case 4: + return DMA_SLAVE_BUSWIDTH_4_BYTES; + default: + return DMA_SLAVE_BUSWIDTH_UNDEFINED; + } } static int dw_spi_dma_wait(struct dw_spi *dws, unsigned int len, u32 speed)