From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D94AC433DB for ; Thu, 4 Mar 2021 03:47:36 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A44C964EE3 for ; Thu, 4 Mar 2021 03:47:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A44C964EE3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pensando.io Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2hN8ooJFrbgdljG9cB7GT6RhWrgmGGAa72G6TNx05/w=; b=CsKc2kcAuKSBg41X46PQD4VtzV WQGGwfiW8VaTLhCIiBKVff10toJHwid60m+FvqduOTqcnxxU5Nss8sn4L70jMeAjvZR1aCBigkK/L TOXnywr0VzexoBxMTYho9E0NRfcRstJl47DDC0/rwKoEItA2LpADwJM0GivXMtGw3ls/9YvrDCq0j yLBRQH1FTPLuAqfHiGDeuADRASuW/5GFvIZkyrWHviOLoE3OnrVu65s3xf/24c3QG8PsjVfZzXGZo h6dIGboKdWXaRR22+R0PIoQc/bjAbQXxFUtC6VDQDOvWSygR/pFbFLBLj1zwsr3edEta60A7LHKPZ aJaX9YZA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHeuu-007dg0-W8; Thu, 04 Mar 2021 03:44:49 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHesf-007dFZ-GS for linux-arm-kernel@lists.infradead.org; Thu, 04 Mar 2021 03:43:18 +0000 Received: by mail-pg1-x534.google.com with SMTP id n10so17977248pgl.10 for ; Wed, 03 Mar 2021 19:42:29 -0800 (PST) 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=7dD8l0mb5sDAQVSmMBFA7qaeWU8j70zeIRTlsOReUoY=; b=jYfGthLTJ7UnILPrxfDEyfnuE3YVIbtrs4TNr4n7KhPBnuOYoyhBb4oiNyDV5lgLtn kIXILi9nTZRmwnDodUzJYN+g+MBqQhE5ojBa0Az2OjPjNRuZX2rBLyBQ6bXYza6yRPJY fLxnyo9gvJUCSSAK6AhOckx0uaPaQE7j4uS+g/1p0K2KJbNnrLsmcgU6NO2f7K343Z/X xXfjIIRxMioez9qZQ6lyq6a47YThOFjp6gjQKA/7gBs6k7Nr3IEtlSf5eb/9Y+nptHO/ gGISGy3FX7Gf3yblt8t1xj/j8oe52f0NO8ix3llxy8u7wOHu6UyHDNdvGoWxQIOO2+5H Rp9g== 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=7dD8l0mb5sDAQVSmMBFA7qaeWU8j70zeIRTlsOReUoY=; b=louQYSwObNrB4hEk72BUzVrA/SlIvZfYhq4Bq4OLF+GQLd6lhz54x4Y3O00JHEyAtd 5fuYCvYPTF1IdQE/omsdioWO1bo0RPMnJME1VyrMU/xU18PKIOra0i2+5QwPKlULqWzL O8YbPW0HSuHZK/kyw8QedVKRssO5flf0giUKUderUNGR6b7YJ8EFIk7zcTjjtGZoPplT rHQXZT/9ywYGthSi6bUxWKVn2gR840KVUv5lZgCEWvDogoRsOQvVd+3RZzckZzoroDO+ buoFyI0BAj/W/mDfYmF1ZSiob/UdmppSqXPd8k8aDY8pL5ZFvlnHgX6aoZkr3n4VG8J8 XNlQ== X-Gm-Message-State: AOAM531cvNVosedZ/HMllLGRrpzLUo2tMfEOMmOvm492jsRaAlLdbgel A96+Q7zuUWpHIgvQJ3tMSu5+mxaqVXpfGPlx X-Google-Smtp-Source: ABdhPJxc0749oEr4+QpvMEe4o0sa6qqQ6vfJQgl2a6HS1YjYrOhOFYJiFGgUZDGQH7Y7v+jcIV/3QQ== X-Received: by 2002:aa7:9d91:0:b029:1ed:e15b:631d with SMTP id f17-20020aa79d910000b02901ede15b631dmr1980685pfq.72.1614829347628; Wed, 03 Mar 2021 19:42:27 -0800 (PST) Received: from platform-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id h17sm2403989pfc.211.2021.03.03.19.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 19:42:27 -0800 (PST) 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 3/8] spi: dw: Add support for Pensando Elba SoC SPI Date: Wed, 3 Mar 2021 19:41:36 -0800 Message-Id: <20210304034141.7062-4-brad@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210304034141.7062-1-brad@pensando.io> References: <20210304034141.7062-1-brad@pensando.io> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index 17c06039a74d..417bd2125c07 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,38 @@ 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) { + if (spi->cs_gpiod) { + /* + * 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, so use CS0. + */ + dw_writel(dws, DW_SPI_SER, BIT(0)); + } else { + /* + * Using the intrinsic DW chip-select; set the + * appropriate CS. + */ + dw_writel(dws, DW_SPI_SER, BIT(spi->chip_select)); + } + } 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 +383,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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel