From patchwork Thu Apr 27 12:33:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 88255 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp254755vqo; Thu, 27 Apr 2023 06:08:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6FSB5UBa2iL0LXsByfKGl5DbVIrCMyqG3K6EPlnNlaXxngipfGoBMVKw6Evz43ERDu0agp X-Received: by 2002:a05:6a00:2294:b0:63d:2d99:2e72 with SMTP id f20-20020a056a00229400b0063d2d992e72mr2604975pfe.7.1682600935589; Thu, 27 Apr 2023 06:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682600935; cv=none; d=google.com; s=arc-20160816; b=xte40lZfjk7u73W3P4PXkzKfRutQh0aX4GIe/wC3fOxECXPrV21dCLHvgDigZd+Vwi 5g++qUE861JSJD8CK7E8RTb3yRwCogBlXsl+KZwaiEv7q27nhN9LQhu1CfTmdpXSQToR YDN3cEgZ40w4w+xb+rf5lz/Hge8NNlGESlamw/bNpZ++i1GCBQd5T8OgtSsAK4CSXfni He+MwuPC2ZMqgTeh35bZIEl9j8yICXbr14ajimJ8NEw+5M7kI3rAAJMLoItEMVwDFi42 dHhG+9XKeDgCfnx7jwb2zJr8xqK4YAz6THoeKSCI5tErk5xNC/6HgCqKYJDafwv/EYjX X8tw== 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=S6Q/VO/y6Fq41tZ4izLIBk5IF+y5iSwGGeoALfMszCI=; b=nKsJluDYN/97ZiN1Rc01UK7b22XCXA3UOvGwWqUwNPc5skS2A1NNc/6IZVbMO1aOnI rtbD8pPD0MepPTP/hjCmxh4PIc74e/QurKXSwmeIKmCxAYSagWHWZ82PyqNBedDlcV7F DOXv4Y8M0y6nt5W6icwFqfMS59eQ/hMrv9YBibKDRAZkJTPCHYvhSg6yYSlYZ1pOAIPR n/98pimlDFYkLPd6G2ADJlm9v6t5oCTDR2x/cBWehcQaKCBnJCKrFHcGTpEnwv0Cxv1p M26JbBysXb1tiZ4Wrw3BrsI90kxAyYidX33vr7d8ZTsQ/CrDJlFlvAbWxvzSV0vVX9zU oJyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=7SF3AaYc; 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 o10-20020aa7978a000000b0063b733e67c2si18759702pfp.121.2023.04.27.06.08.40; Thu, 27 Apr 2023 06:08:55 -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=7SF3AaYc; 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 S243555AbjD0Mdd (ORCPT + 99 others); Thu, 27 Apr 2023 08:33:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243201AbjD0Mdb (ORCPT ); Thu, 27 Apr 2023 08:33:31 -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 6D00D4ECA for ; Thu, 27 Apr 2023 05:33:26 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-556f4e20131so17568977b3.1 for ; Thu, 27 Apr 2023 05:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682598805; x=1685190805; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=S6Q/VO/y6Fq41tZ4izLIBk5IF+y5iSwGGeoALfMszCI=; b=7SF3AaYcSGoW/ypNoGCNNc3chh/C711C/2zAVabYkzWAjXS5uyIHJjMv2VhpJCI9gE Ry4FjZgURKjz7Orp7MNpjEeG+C+Ud35NeSimsViU8ifp/RZjHbUQoHR2KqcOcI73D27C KIMkrFI0jgZiBCRYSEOaW7GJo+hme96imkeLIPRGUp+zzoG9rX9fqexYwtdXAne8cxIY E1Izj/Lk3eB8spEO5RpQr2XxNYls/ajcmzrfrQCxYOUnjVzOsNkXQl5IPHQMp67aon4J 2LojHEtH9Nkvr90LmeyKmUEzS6yaQ5RN4fuDox9tgy4P5j5DVnHnggAWctFk9STKNJQG 0m0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682598805; x=1685190805; 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=S6Q/VO/y6Fq41tZ4izLIBk5IF+y5iSwGGeoALfMszCI=; b=cOWDzh4dzg59uzm4qavsaYpvzwfcNBUl6ZuDQNh+7BNaEPSV2VGMxgph0juKyot0RO vqgzdYHv5WMJ61r5afZvG07oGFkGC7AOGmBP3C+z8AHKacIcSLZmrAHO0UTILbujxXkS bEt/bxxuLRZxiLfecTRs4pqAIOI9TQe6kGgJe/B/6eN75oActiz+nbW/4ftwL70Zw1GF y8Qrxbf9Gt6yAThd89SAnvBTXEC3svixROZEnHzhyziDwUeiAMBxBUtbX03M3di89xob Sl3OoQUegmQqvzspIX/EdJu2kgzV84feY5fOXJ39qnDrpCuIQhy3Edlu2TfVGFjWDZyu kf2A== X-Gm-Message-State: AC+VfDzOSJBz8HmWGesA+15i2JhQfAwQThNOcrotcjtkIG5k12WImLyg yOCRR49hBJ+6H+XX1okBo6S6i0hEcHB5UA== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:690c:725:b0:54f:bb71:c7b3 with SMTP id bt5-20020a05690c072500b0054fbb71c7b3mr997276ywb.9.1682598805726; Thu, 27 Apr 2023 05:33:25 -0700 (PDT) Date: Thu, 27 Apr 2023 12:33:10 +0000 In-Reply-To: <20230427123314.1997152-1-joychakr@google.com> Mime-Version: 1.0 References: <20230427123314.1997152-1-joychakr@google.com> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog Message-ID: <20230427123314.1997152-2-joychakr@google.com> Subject: [PATCH v9 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=unavailable 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?1764334958709113223?= X-GMAIL-MSGID: =?utf-8?q?1764334958709113223?= 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)