From patchwork Tue Apr 18 05:28:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 84575 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2597382vqo; Mon, 17 Apr 2023 22:30:59 -0700 (PDT) X-Google-Smtp-Source: AKy350aca94BxWpy0IaqmkYAsSl7r8j7OY+Lf3HQFI508VocceQUZh/qJdgek777jUEC9FE8yF18 X-Received: by 2002:a05:6a20:6a0c:b0:ee:f25e:925f with SMTP id p12-20020a056a206a0c00b000eef25e925fmr12401849pzk.53.1681795859003; Mon, 17 Apr 2023 22:30:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681795858; cv=none; d=google.com; s=arc-20160816; b=LKmOTPsJ2CDz/yfvIzfU5H0dfPWEeNqK1I6dtOidP1EpXKGZoKBJPGIXKVQA2I1rP6 A+LTmfkGO1acNmKSf1YTiyMXqujymQCQBuXRS0ecZs0hWYgY9W+/YRjs2ttYjpaL/SSH rWfv72lFV+cFUM1/FM0rLyHPjZpxPw23QjVTueQQw3lKqcoDWFVHlD65lpyceKh6ks/1 G1pDstmwbG5FGF8tk2+Auxw12J5/HKm0uFs1QZpOoMXMLAekSRgb7DPCKooafX8FcGPs gnT/8XFg0l5Izv+4djpLzZrnTpe0h4o7e/yWXIrFieZ5R9PmkozU/JO8X44d4+Z7tsHq uCfw== 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=q+lIdgxcE+qEo+P1VZ0R0Ps+ZDzFlv/03hCfUtS/6rzEd5V5BnIsMdezsZlK+z1CcR ngATpXBZMQiX+nXLsYq4SGS41jstB+eOurpQ5jDma4JgeCPsxDOY9E8E9wNUZlIqQ+Er z/ZIRyvbsDlLypQ31hoKd7Vfk74XNwAbwcZE6YGejKv7knbmgywo5dh7i3DLbDaUBGxm IcK+5U71a713VjfKgWpQBn0MS4xoqJw9pHjJbwrxKM2jCtEiCr4Vdi+UJIRoxbKdRo54 usOScAxGn8o9BwM84yEIo4Ye2k7N8WtVdkLAk4334XkTkoiqy5J43aG0hYzPPg1prmb2 6g2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=FYeN9SBM; 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 l12-20020a654c4c000000b00514477c4416si13399942pgr.801.2023.04.17.22.30.44; Mon, 17 Apr 2023 22:30:58 -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=FYeN9SBM; 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 S230349AbjDRF3V (ORCPT + 99 others); Tue, 18 Apr 2023 01:29:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbjDRF3O (ORCPT ); Tue, 18 Apr 2023 01:29:14 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70B0E5245 for ; Mon, 17 Apr 2023 22:29:13 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-552f169d85eso27237227b3.13 for ; Mon, 17 Apr 2023 22:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681795752; x=1684387752; 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=FYeN9SBMek5PY0NUGiKB4PDLSCJlT+j7HehxrNt6HMPnXxkb2hDFelKYyUgKjiziLJ tVL1u6x5vxXSoC1takibB3sIH8S5a4H/zcAlUkmwd/KdiZUbajfB7BLtA9HeauREN51e nXpSIgJ6Rhyfs8s9UE+1sdCU+RjVrt24eppqDajoloeN9DjHFI1gZzPGdoKCX21oevkM 7BV4SlPWznZ6RPNiZJQNSzTfqp5FCxtuyrMusF6mbwi3CATBxDGXZAtz2m1Bj2gtnO1D rn6UAwLmvLFoSrIo1NjxrVFRxc7oNUiE8XEtQ3ICRudfANtgmGOv/eB+zA6LPING2H7J jDGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681795752; x=1684387752; 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=dALqd+OYa5KhdCJ4l9bO8MFBfL4Rf2Huoh7cbITabWYfnWc46hsGTWpNlLZnGCZXai bh46ajGmebyD6tJNUwFdzwZfhxH7gyTPZP60czBs3zyjL6Ggcp5Okw0lCZ4GHRweA4Rw QvwmMQlJyig5QfWXgloU5lC2thU29DXNqQmSqHbRYx2Oub9NmIh0iuJwc04DbAKw8fI0 dlb2v0CixSHjcDjz5qxb5KfetRF9XEhtVQqw6PqGonLcW74PU/eZ8whjqu4Iq399k0fM iqqQ1jp/bonBjj3fSu8UOXMICVrUHS/Mh9O6rrPpDpq9+0HuxQTi4dM3ABpO7iMpBOrA yNxw== X-Gm-Message-State: AAQBX9ezczfHePAA/98mZ0nOwtMuE72y5ooqaJhU+uhQRuMOy5eHhni4 RzLME+OQv3te4hCiqWtm2MkT0iTU7/L26g== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a81:ac57:0:b0:54d:3afc:d503 with SMTP id z23-20020a81ac57000000b0054d3afcd503mr11607964ywj.8.1681795752753; Mon, 17 Apr 2023 22:29:12 -0700 (PDT) Date: Tue, 18 Apr 2023 05:28:58 +0000 In-Reply-To: <20230418052902.1336866-1-joychakr@google.com> Mime-Version: 1.0 References: <20230418052902.1336866-1-joychakr@google.com> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog Message-ID: <20230418052902.1336866-2-joychakr@google.com> Subject: [PATCH v7 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?1763490774598486342?= X-GMAIL-MSGID: =?utf-8?q?1763490774598486342?= 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)