Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3263463pxf; Sun, 28 Mar 2021 19:02:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxP7O2nVG5MWPpOK6BvLyHTACffzndUby8bwhr72tSi1tdY7RW7wcxdxoi/+snUhFvXRHX4 X-Received: by 2002:a17:906:acb:: with SMTP id z11mr26494718ejf.193.1616983335792; Sun, 28 Mar 2021 19:02:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616983335; cv=none; d=google.com; s=arc-20160816; b=hIImAJqacOzKu6LbieChOHxEj+/MDjD0oMnohAouT25H1QOmW9zpsoTna40fEdJhL7 A7CzrhrvdFBNfhFPjPpRgAzK4mQByM8559syVpxWCbYVDW23O1eh7DxxKZa8p51RPhuD QjFJkoRjjQxViyXyLO4P/ce8vlnNtlIPJglwYHvnmVyB2n4alVPCD9qNPnIbi94TInuO q7bYAcsvcYsbDa92oSheLctHiRDRzaYjXBolUKQGx3PlFdcSc3R1WTYtSf3+mla+1MhT 91lVjvSHeW5+OCq/cP2o/51ie5aJ7iumDZlKESHc/9o2O4TC5g6sfoWHszX2QcDALumY 8DXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=b/jZDT68x0JaSsnv/hQubN3XpQ9Z0D2o2MVObC/l6Fo=; b=toViSQzvSTPpBAU+p+5yPgfq0TIaO2ZdQr3fzG77c6JyXMQA6WXLTpjo9nWXN7fiot 4mCCMBYESTL903mapD/cqo0wZLefSCPycJG96rQD8DzUf6nirXKPICpFbuumkDIaeq0s FOMdqKBuJ2c9sjdWYWrLwNkZqifn/M5KGnSccIRgX8LnXRm6ftoUAVI4JhET0XhAVOMH 8UdnAw30O7vB1QMdvr0mPDN92TsoWT+5mWrT96vv1UKoEz7aHIJlvg8UpkD5jEDWF+YY ielXtaSZ//drrJpf10GU9PIuuOUosOGUVSa/AhhZ6Jt2Y0RQJwo4GgFZSvpkMYl62OEo j2PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@pensando.io header.s=google header.b=sS489wwL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t10si12045737edq.420.2021.03.28.19.01.53; Sun, 28 Mar 2021 19:02:15 -0700 (PDT) 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=fail header.i=@pensando.io header.s=google header.b=sS489wwL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231255AbhC2CAW (ORCPT + 99 others); Sun, 28 Mar 2021 22:00:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230506AbhC2CAA (ORCPT ); Sun, 28 Mar 2021 22:00:00 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5844DC0613B2 for ; Sun, 28 Mar 2021 18:59:50 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id ay2so3659180plb.3 for ; Sun, 28 Mar 2021 18:59:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b/jZDT68x0JaSsnv/hQubN3XpQ9Z0D2o2MVObC/l6Fo=; b=sS489wwLelB1CB5dqgyh7wsTUSVBUtBg0ud34L7zg1rSE4zuKq9rsTChXF0WjHfgYx xnSOv2X282S8mYn7IZJg/6eYIGVZ9dubYVudpHyA+ZaL7YwJxZK2Ny03oqS5OBawLxpS PiQeu1Dok3KDzEklhvtEC24G39YDFa+JPFHUfbXOwn7nK0CHREyzEbRdb+HQtLSyhl2J rgeF2/ez0smsld+3IwHP7eNDeR2DspbavesDBIuSo/oNVx9zRy2MmwYIHoXGUMShcL7X 6U5NzbaKiStC3MqBZsTDf7Di3QMpfI5dEZ7w5tCF2sBPHqNF+L7A4HUUtMpqIbJBpv1g t/XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=b/jZDT68x0JaSsnv/hQubN3XpQ9Z0D2o2MVObC/l6Fo=; b=n2wJ34OO9h0hQlyHU5TmNVlkGhTBALvyT0HQLmzW09WYwprCHJ4d1aLeSdxFxzZM0K Da3WU6eIPp8fP+b9sxEqLa/HMO0h2UgwUly6r7CCQBxd2o1v2afk9/SW02vHIooYQZ9T jVpjSJyvQnvZYDTQpwMvCXDvMrq/6TehTUpQRFE/oYqpRAZ2HKhDrZbruS44NUhaY3M/ WNcpm+PQbhK6+DbUSTLTRc08i1R71DByZ4OwDisRYB5xRYgQRtcD9kSMn4Z8XzPeTD/z R7uMkbgX6bxcICLdSOa7DE2qwuAci/JIRbik8zlWBfibjRD0k1DcDzU7P7f6I7Lo9y0Q u7/Q== X-Gm-Message-State: AOAM530VcSEGTueB1G1jmFs6cDi8J5/Ag0aeCi6Tjdt5cYo6ho4S0Q+F 9um3/hY4wV9n/efaWiIxHjeRdw== X-Received: by 2002:a17:90b:514:: with SMTP id r20mr24421108pjz.145.1616983189818; Sun, 28 Mar 2021 18:59:49 -0700 (PDT) Received: from platform-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id w37sm14728027pgl.13.2021.03.28.18.59.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Mar 2021 18:59:49 -0700 (PDT) From: Brad Larson To: linux-arm-kernel@lists.infradead.org Cc: arnd@arndb.de, linus.walleij@linaro.org, bgolaszewski@baylibre.com, broonie@kernel.org, fancer.lancer@gmail.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, olof@lixom.net, brad@pensando.io, linux-gpio@vger.kernel.org, linux-spi@vger.kernel.org, linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 03/13] spi: dw: Add support for Pensando Elba SoC SPI Date: Sun, 28 Mar 2021 18:59:28 -0700 Message-Id: <20210329015938.20316-4-brad@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210329015938.20316-1-brad@pensando.io> References: <20210329015938.20316-1-brad@pensando.io> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Pensando Elba SoC uses a GPIO based chip select for two DW SPI busses with each bus having two chip selects. Signed-off-by: Brad Larson --- drivers/spi/spi-dw-mmio.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index 17c06039a74d..c323a5ceecb8 100644 --- a/drivers/spi/spi-dw-mmio.c +++ b/drivers/spi/spi-dw-mmio.c @@ -56,7 +56,7 @@ struct dw_spi_mscc { /* * The Designware SPI controller (referred to as master in the documentation) * automatically deasserts chip select when the tx fifo is empty. The chip - * selects then needs to be either driven as GPIOs or, for the first 4 using the + * selects then needs to be either driven as GPIOs or, for the first 4 using * the SPI boot controller registers. the final chip select is an OR gate * between the Designware SPI controller and the SPI boot controller. */ @@ -237,6 +237,31 @@ static int dw_spi_canaan_k210_init(struct platform_device *pdev, return 0; } +static void dw_spi_elba_set_cs(struct spi_device *spi, bool enable) +{ + struct dw_spi *dws = spi_master_get_devdata(spi->master); + + if (!enable) { + /* + * Using a GPIO-based chip-select, the DW SPI + * controller still needs its own CS bit selected + * to start the serial engine. On Elba the specific + * CS doesn't matter to start the serial engine, + * so using CS0. + */ + dw_writel(dws, DW_SPI_SER, BIT(0)); + } else { + dw_writel(dws, DW_SPI_SER, 0); + } +} + +static int dw_spi_elba_init(struct platform_device *pdev, + struct dw_spi_mmio *dwsmmio) +{ + dwsmmio->dws.set_cs = dw_spi_elba_set_cs; + return 0; +} + static int dw_spi_mmio_probe(struct platform_device *pdev) { int (*init_func)(struct platform_device *pdev, @@ -351,6 +376,7 @@ static const struct of_device_id dw_spi_mmio_of_match[] = { { .compatible = "intel,keembay-ssi", .data = dw_spi_keembay_init}, { .compatible = "microchip,sparx5-spi", dw_spi_mscc_sparx5_init}, { .compatible = "canaan,k210-spi", dw_spi_canaan_k210_init}, + { .compatible = "pensando,elba-spi", .data = dw_spi_elba_init}, { /* end of table */} }; MODULE_DEVICE_TABLE(of, dw_spi_mmio_of_match); -- 2.17.1