Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp638653pxu; Thu, 3 Dec 2020 09:02:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxezSU316Fz65iMcxJhrckrLRdIqCD+XTWMxULj4acAMJxbzYNkOGWJcxBricvQhlRv5A52 X-Received: by 2002:a17:906:b307:: with SMTP id n7mr3347202ejz.102.1607014968359; Thu, 03 Dec 2020 09:02:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607014968; cv=none; d=google.com; s=arc-20160816; b=H+wTaAOHRo5KGDkcEmufyv9KoZbxyFjXnH/NwOHfqR3SV9IKDOSf1uFWA2yN+EWIoN 1Qn1dK6cqWFRh+QNjMYExketHmWvcBuhfp1U7+p7tDV+eBc+lplbd8JUmRJVm6PgHp/R YlVmKmqki240di0Gb7wzolG1KQFF+ppVNJU9CKK6CeaiCBhlH2Oqu/3pkZT03iI47I6W HzLSE9N+iZiAZxBSYrn4O8wUq2yhIOqe9gppsa1lmLFk/7KjRoYKKdnJWx4t7J3ZfIXj uDCbgofXizVihYZwwujt81leB/GwlYgnKKdzwecXPmBjfy4w6HkH/ynGkN2Ttq87vufa B0QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:subject:message-id:date:from:mime-version :dkim-signature; bh=4RN4lDKcBCUJRe+wn8srvtMYKGE3DNBe+LKKp0gOoAk=; b=gPjY8ja3g6l75OgSx/O+bj/zOJ1MNuUbv5Om+GTg0EkuwuyWCa5Jw9H7tScrxG/TdS 9TZ/84Ha9uCfisfuKNMbLjH6+n5ZWdWW43vhwwsDATAGcGLNdDu1W4Wo+HmB5iyU308H oY0o+x8PL0yueNqAMEBy1DMJOG4gmjhYE+5vNiiry7+UorwLd4YY9yA1iUS3Hg4E6Uzl qQT+ZEbSj/31r6ykGaWY0fmdewMnDkcjiavXPSYR++xiFYfiUyEO+Wb0MEb+tELpsvOS 4hQ2tcvfIO3BM4PCzgMmn5kYry9+/Ou6+YkvHACAqQjpUlzKN/dF3it4K0Du4B+7OHR6 /0Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Gz81ipfa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k3si1508649eds.56.2020.12.03.09.02.19; Thu, 03 Dec 2020 09:02:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Gz81ipfa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727169AbgLCQ6e (ORCPT + 99 others); Thu, 3 Dec 2020 11:58:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbgLCQ6e (ORCPT ); Thu, 3 Dec 2020 11:58:34 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E937C061A4F; Thu, 3 Dec 2020 08:57:48 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id q10so1695007pfn.0; Thu, 03 Dec 2020 08:57:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=4RN4lDKcBCUJRe+wn8srvtMYKGE3DNBe+LKKp0gOoAk=; b=Gz81ipfafeXXxDWwoD7NhXxSdejww5z0emFjuapn3aVcTUxw37OKDZNqULpzdD4dj7 q765lFPvNtmR9Omi4KGwZtJaD5KFYD2LrRMpDzdquFg92DhrxOqRcPgy9Dsdu1UrogBL frULSkTqRr2TmDWUV5FRAyRh4gmniAQ1o87y89moD3159GNcbT03JWVSs4cg8TT3B/18 UdlOeGA9YKp1JPUe6/WQhZRtKsbK4FS880B9PkRP0xRhfPLo64RqQ2UUyJW95EkuqMJq mb5JQ1L9NhVqVjdo338dcmDxyl11FYRPCj/n5ipSlH6Xvi4M1pPqX3lu8zhpqohJMWGx jQVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=4RN4lDKcBCUJRe+wn8srvtMYKGE3DNBe+LKKp0gOoAk=; b=LfScWR1D/BXik/cN/0Qfq4fqZ74tQTHPlWdU6MNY9so27n634FIZWlcLtmQbMqXARP W386WbbFcFnARF++iAp1JuNpRLUqkR73hQckKCKuinfriiW8Ti2GI/2eNdsR/kfW581D PX/CohJRMnoNb66hrVQorIE/WXIBsOML6D6NBD+Nm63KvKVEWDdQqHsfnTABf++uN/6l gC4R1XcuEnPZNfzE6XjpkX8MG0O236Ys2mRBFdIcGjGwtL19r/qx7tNrsDiZI9BIBB37 aIK9xcTIlzHoPBWZ4NowBqVZyA7oOeuwntfHmyz86hmnHV9g0zWPw2PJsGoj/aQIaoIg +Pag== X-Gm-Message-State: AOAM5307XlUusNd6px5nkkZCZJnLoCkuW7dI+A0HkofPv09xGf77z6dT yF1mEYAc1LkEAH+tssDK09ki6pnF8s4TPCDaFbk= X-Received: by 2002:a63:a0b:: with SMTP id 11mr3807266pgk.21.1607014667655; Thu, 03 Dec 2020 08:57:47 -0800 (PST) MIME-Version: 1.0 From: =?UTF-8?B?0JzQsNC60YHQuNC8INCa0LjRgdC10LvRkdCy?= Date: Thu, 3 Dec 2020 19:57:36 +0300 Message-ID: Subject: To: Vladimir Oltean , Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?B?0JzQsNC60YHQuNC8INCa0LjRgdC10LvRkdCy?= , Maxim Kochetkov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From 772007b92eda50186c2e420b5bd895d4e4006ae8 Mon Sep 17 00:00:00 2001 From: Maxim Kiselev Date: Thu, 3 Dec 2020 18:56:12 +0300 Subject: [PATCH] spi: spi-fsl-dspi: Add GPIO chip select support This patch allows use of GPIO for the chip select. Because dSPI controller can't send transactions without hardware chip selects, so first unused native CS will be set in SPI_PUSHR_CMD_PCS Signed-off-by: Maxim Kiselev --- drivers/spi/spi-fsl-dspi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 028736687488..d5fba34de740 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -913,9 +913,14 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr, dspi->cur_transfer = transfer; dspi->cur_msg = message; dspi->cur_chip = spi_get_ctldata(spi); + + if (spi->cs_gpiod) + gpiod_set_value(spi->cs_gpiod, 1); + /* Prepare command word for CMD FIFO */ dspi->tx_cmd = SPI_PUSHR_CMD_CTAS(0) | - SPI_PUSHR_CMD_PCS(spi->chip_select); + SPI_PUSHR_CMD_PCS(spi->cs_gpiod ? + ctlr->unused_native_cs : spi->chip_select); if (list_is_last(&dspi->cur_transfer->transfer_list, &dspi->cur_msg->transfers)) { /* Leave PCS activated after last transfer when @@ -1240,6 +1245,7 @@ static int dspi_probe(struct platform_device *pdev) dspi->pdev = pdev; dspi->ctlr = ctlr; + ctlr->use_gpio_descriptors = true; ctlr->setup = dspi_setup; ctlr->transfer_one_message = dspi_transfer_one_message; ctlr->dev.of_node = pdev->dev.of_node; -- 2.27.0