From patchwork Thu Apr 27 12:33:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joy Chakraborty X-Patchwork-Id: 13225448 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1ECE2C77B61 for ; Thu, 27 Apr 2023 12:33:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243767AbjD0Mdj (ORCPT ); Thu, 27 Apr 2023 08:33:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243643AbjD0Mdg (ORCPT ); Thu, 27 Apr 2023 08:33:36 -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 319F64EC3 for ; Thu, 27 Apr 2023 05:33:31 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-b9a7550dca3so1113050276.0 for ; Thu, 27 Apr 2023 05:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682598810; x=1685190810; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Adm4j45gizFfC/DwqDNV4am9AZ8vYB5z8Xwbghf5BGo=; b=zsszPebuf3cwDmVN7gVllalvKOsKsT+K5wl7znryh8N/HuMkkoSIt3lbU+p0W3aYVh SSSaO27ReLEqOCzG3BSuuDNm2DML74Zfb99YQZlQWs65vMnUHWeMpPKTpa65fLps3gi2 vSlUH4rS8Pu+gwunef7GF7styB0VyU+lahLQDrrM1XEL1K1PH+DfH0h555dj0y86CX4S lKaRbe6XIL1XAsx1lcGj5DnQdzwgD/3Qx6kdhWH5H24GnIS9WomZLqartGvw6G98OBZf 1P06hkAeYdfaQtcpR4dTlCKGVVZ+Bs7kqxOzix3okyVRG7k5QpKflpKuUzNRhgNZeD0I XdeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682598810; x=1685190810; 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=Adm4j45gizFfC/DwqDNV4am9AZ8vYB5z8Xwbghf5BGo=; b=H3AqPOnZ7tM6agfhSHWIFZpIGUmyjv64LxF2fBJv780BIGsRblRUg8KRRi2XZKH7c3 cfRW7DPjn1pHGVDNK389kSWC3faT4QfkdpiLvxhzY2w+9hB9BNK8sTBlVvfdgXKWRS6G 9iDZiRP535dWmZK4w3W5/o8RbuwPF2qVTC+AwtAFNjGS7jP+BhW7HbZXDYhYT4fcyv/8 c4aFcZ45A95NuNcdCEFjSHmFQmZGaLR9Yw1TQlsa7DoPMZ/nQ8lIg2v7QbOqmokY+uXN zYHEz1t/GEzlZu8/VFWArOBPA2YF4YFS9fkneOJdDdlqEcYgYDvw1MWgzeIMIXG3yTsg Vg0g== X-Gm-Message-State: AC+VfDzyol0uGAGLtU7S23uWH6PagNhZ+NH5vPgYRmqt99piCUweZKA5 L1mNea2GKkDxTU3AGKsU8dIzSefwZ1y67w== X-Google-Smtp-Source: ACHHUZ7M04scCze/HzlYDa0ELaHPi0YkisN5CNwzyTjHI34vXKspkNUPI/gWhSH8mErgeQAKSzNyVnx+go8Fyw== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a25:c041:0:b0:b96:5b8a:3c34 with SMTP id c62-20020a25c041000000b00b965b8a3c34mr441564ybf.11.1682598810419; Thu, 27 Apr 2023 05:33:30 -0700 (PDT) Date: Thu, 27 Apr 2023 12:33:11 +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-3-joychakr@google.com> Subject: [PATCH v9 2/5] spi: dw: Move dw_spi_can_dma() 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 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Move dw_spi_can_dma() implementation below dw_spi_dma_convert_width() for handing compile dependency in future patches. 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 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-dw-dma.c b/drivers/spi/spi-dw-dma.c index c1b42cb59965..f19c092920a1 100644 --- a/drivers/spi/spi-dw-dma.c +++ b/drivers/spi/spi-dw-dma.c @@ -198,14 +198,6 @@ static irqreturn_t dw_spi_dma_transfer_handler(struct dw_spi *dws) return IRQ_HANDLED; } -static bool dw_spi_can_dma(struct spi_controller *master, - struct spi_device *spi, struct spi_transfer *xfer) -{ - struct dw_spi *dws = spi_controller_get_devdata(master); - - return xfer->len > dws->fifo_len; -} - static enum dma_slave_buswidth dw_spi_dma_convert_width(u8 n_bytes) { switch (n_bytes) { @@ -220,6 +212,14 @@ static enum dma_slave_buswidth dw_spi_dma_convert_width(u8 n_bytes) } } +static bool dw_spi_can_dma(struct spi_controller *master, + struct spi_device *spi, struct spi_transfer *xfer) +{ + struct dw_spi *dws = spi_controller_get_devdata(master); + + return xfer->len > dws->fifo_len; +} + static int dw_spi_dma_wait(struct dw_spi *dws, unsigned int len, u32 speed) { unsigned long long ms;