Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5471059rwr; Tue, 9 May 2023 01:47:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4r86ACzDsC8mvTZjzvk7PyY7PU5jVat2aGvXa/9aQe5aU/wJITZRKZN9t4IgxJTbDTAWYO X-Received: by 2002:a17:902:ab84:b0:1ac:9890:1c39 with SMTP id f4-20020a170902ab8400b001ac98901c39mr1276933plr.25.1683622061856; Tue, 09 May 2023 01:47:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683622061; cv=none; d=google.com; s=arc-20160816; b=FVcq5pzL4R+NTW1qZBx9Et1ojPNWM69K1mc1bn418Y3JbJZxyCs1ANO0XoAiCf3kP1 Yoyvohp2M0jMFC+6Fh73EKMYNCsCtI7dIXDMJmmRMg9i1/zBt5jtaYn9xpz0uOm2o/6U x+MSKqtaR6z6ArniRiR6olxQk1Bf+mW/2njDItGt1WiF+LthwcOYBq70hAy2IwhBjrbj +IkZG88L0j3LC5sqgz+YyI2eZFcpzMI/RE0GfUJffsa+ikzlxxCLwynqJB/P1zcgh1Pf tWmkF5yYqYwLcaiUFAyiw/R74b0bS7RfWULtMz9Ilf8UG8n/qz8IwwYI+V9y+yC0Nhzp OR8g== 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=P/eUVtluKbHYoh34+9oF2eiC1PMtH+2gVKFzulzf0Dc=; b=VVXgfJG+j7jYxvJ/Cqd0JnKiy1IPsqsmPjJSudKt6oBHJnMiyrO775O3G8IfGf0YC+ BeE36alFsJgn6jh3ANmzgjreNollW8U+MtCXBUszatn6RSWHG3Xe1k+WP6eCsn/UvGQI 4a2IVlkt3MeX2mufAg6YFjw7wRVEmW/goFoEb+CUgMutIzh7A5s4koRea+rLFU+E+AGb EncpcniQk0Ep7JdbXZqJI9Y9UzvoaNh7Ovz5IympZnnxEIxFjeLvIbpiSig/sbzto/3z nm6/iDSW8CTRiyqAz0jEBuEYRpads6XOKEiBNzjtyrSYX3jMTa7FVgYRBHRXXwZzqqko qqyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b="MOl/ueia"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o4-20020a170902d4c400b001a9b29b675csi1108623plg.317.2023.05.09.01.47.27; Tue, 09 May 2023 01:47:41 -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="MOl/ueia"; 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 S231624AbjEIIXB (ORCPT + 99 others); Tue, 9 May 2023 04:23:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbjEIIW5 (ORCPT ); Tue, 9 May 2023 04:22:57 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D83285FD2 for ; Tue, 9 May 2023 01:22:55 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-55a42c22300so91021157b3.2 for ; Tue, 09 May 2023 01:22:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683620575; x=1686212575; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=P/eUVtluKbHYoh34+9oF2eiC1PMtH+2gVKFzulzf0Dc=; b=MOl/ueia/VczvDyjT3T7HYTqdbT3tGq7e/qZgsdHLgfTJc6xduTdB70L6CR+tIEKXC 6EXTVk126gPItF25Of5O7fVF6UVJFXoeDtJSh85kNratW2ypIYLNIcEJhsWOoD3DwPIA 73gEFnRt9TduebE6GB+/AE02x6hmYT/i305jrOYJ7/i8E2Ts0HH5E1K8nZgHMVItEzpm rWj/3GYLmUzCBiQi1vnGi9jxqMp/fjSVJvegrBlGq8b/qE3OUi6WL2s6MTPgOlrKkeu6 rHrumiATgCHtZa5kExrL9Vu39ZtlDuG8EJJ4C58nMpDZBxy66RKeTFPDH7GkKELaTrDC 9Qdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683620575; x=1686212575; 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=P/eUVtluKbHYoh34+9oF2eiC1PMtH+2gVKFzulzf0Dc=; b=c1yZD/rtJh50444cbmS/Yek/xto4kjPRlxR6FESnXk1Rkm/QXsSa+AYFEu7/A+lUHm L6DkBvONalLVpu7IJPet8s814waTdY32H0YZPdVJ2z5GgBJYfGShihqMVGTzKelxUO8Z KB5HvxijJO9K+7Rg+zHdXdy6IRXiVy5+jtK7PXqtfMseWHTvvfHPN8W3Npk3PR36ejsA M+IlqML0Gt8/5ZIBj+O8gRdpf1gH4eGhW8BNQFacZLj7TZ23ob37IIRi/MsjNHxR6Qne mMYgr4l9xUfh55Bikgm+u2/3BC9ZVlLiTP20vvRqxhVfkoONT5+e52uJxJJZ7E67h411 PX6w== X-Gm-Message-State: AC+VfDz3Tp227gCUzIuRWrbw3IkJ7hS+STDL1RQmHC5lRKtznozsEx3N h+2Nlg3Z+Dqurbnw7loyX265s/zvFOKBow== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a81:b65a:0:b0:55a:8e39:57a7 with SMTP id h26-20020a81b65a000000b0055a8e3957a7mr7726750ywk.6.1683620575080; Tue, 09 May 2023 01:22:55 -0700 (PDT) Date: Tue, 9 May 2023 08:22:40 +0000 In-Reply-To: <20230509082244.1069623-1-joychakr@google.com> Mime-Version: 1.0 References: <20230509082244.1069623-1-joychakr@google.com> X-Mailer: git-send-email 2.40.1.521.gf1e218fcd8-goog Message-ID: <20230509082244.1069623-2-joychakr@google.com> Subject: [PATCH v10 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 Content-Type: text/plain; charset="UTF-8" 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 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 Reviewed-by: Serge Semin Tested-by: Serge Semin * tested on Baikal-T1 based system with DW SPI-looped back interface transferring a chunk of data with DFS:8,12,16. --- 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) -- 2.40.1.521.gf1e218fcd8-goog