From patchwork Sat Dec 15 23:38:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10732331 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1E7C1399 for ; Sat, 15 Dec 2018 23:46:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D13DC29F0A for ; Sat, 15 Dec 2018 23:46:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C556A29F26; Sat, 15 Dec 2018 23:46:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4555929F0A for ; Sat, 15 Dec 2018 23:46:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727256AbeLOXqP (ORCPT ); Sat, 15 Dec 2018 18:46:15 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:33098 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727638AbeLOXqP (ORCPT ); Sat, 15 Dec 2018 18:46:15 -0500 Received: by mail-lf1-f68.google.com with SMTP id i26so6906160lfc.0 for ; Sat, 15 Dec 2018 15:46:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kw40h7bKx7SEAJ/VmU1uQ3cysjIgsprCi6NOYoWS84k=; b=efy9fb6EfNUs97v7ULAo/Mt8Vd8d0xmvoypOXluCnyCw5iIgIPBnLBjVvEAZqyh0TB Ao4ZilXjAOtJyWoc7KcnTzwX7Rd4qItKsT9YuiSCCv5RTW7gRVEa85COdMj0HTu1N0t/ xzgH8rom9qexaanADQZ96C9IhhmktwrZBPkMU= 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:mime-version:content-transfer-encoding; bh=kw40h7bKx7SEAJ/VmU1uQ3cysjIgsprCi6NOYoWS84k=; b=iCHb+xaSKOYBaHkcdsZUoa9E8S4/UYiIowFOEW/83wSFEIWyhbZWCeV1YNk4fVmVgv dO3prv+lYdY+XZDmgjVB6/l8YT9lTe31yXjfzLAdO5hVIpb62G13dt4df3eyrMDRZb+l yfkckMjmTyabj2hRvcwaH/TJxN42OJ/2PHGgibMpfmKqwbHSXU76oh/JL8DADknScOQG tQOJRu9B8qoVVsg9YlsSEIBuzr8M0F1gdKbBO2AwwBrw9L6ibmCCXgv+/63fJ27WnLZg DuIdciJsxc/lNL16Vnz9VauVD3hMQZ1/rVPq5n5mSYClPHgeQuAiJezV8tvaZjVgiiIW cj6g== X-Gm-Message-State: AA+aEWZvu67jbF5zyFZqWmQr5vHIXgycMAl8E0HYB6OweNWP4gJDQAu7 zRhzse5k0VcsnkNJixeejVf5CyEHOpnaLQ== X-Google-Smtp-Source: AFSGD/WjmayLiNiqIEmWtuyy7Htg1PxO8uaPT1YnAgYFrWkSvQaPmfwfBXPXwO5njUyhdR5rH68utA== X-Received: by 2002:a19:3b45:: with SMTP id i66mr4792542lfa.28.1544917573595; Sat, 15 Dec 2018 15:46:13 -0800 (PST) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id v19sm1709880lfe.69.2018.12.15.15.46.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Dec 2018 15:46:12 -0800 (PST) From: Linus Walleij To: Mark Brown , linux-spi@vger.kernel.org Cc: linux-gpio@vger.kernel.org, Bartosz Golaszewski , linuxarm@huawei.com, Linus Walleij , Talel Shenhar , Simon Goldschmidt , Alexandre Belloni Subject: [PATCH 7/7 v1] spi: dw: Convert to use CS GPIO descriptors Date: Sun, 16 Dec 2018 00:38:23 +0100 Message-Id: <20181215233823.1042-8-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181215233823.1042-1-linus.walleij@linaro.org> References: <20181215233823.1042-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This converts the DesignWare (dw) SPI master driver to use GPIO descriptors for chip select handling. This driver has a duplicate DT parser in addition to the one in the core, sets up the line as non-asserted and relies on the core to drive the GPIOs. It is a pretty straight-forward conversion. Cc: Talel Shenhar Cc: Simon Goldschmidt Cc: Alexandre Belloni Cc: Linuxarm Signed-off-by: Linus Walleij Tested-by: Jay Fang Reviewed-by: Alexandre Belloni --- drivers/spi/spi-dw-mmio.c | 22 ---------------------- drivers/spi/spi-dw.c | 9 +-------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index 3ffb6a40fe0c..00a43c19f2a4 100644 --- a/drivers/spi/spi-dw-mmio.c +++ b/drivers/spi/spi-dw-mmio.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -184,27 +183,6 @@ static int dw_spi_mmio_probe(struct platform_device *pdev) dws->num_cs = num_cs; - if (pdev->dev.of_node) { - int i; - - for (i = 0; i < dws->num_cs; i++) { - int cs_gpio = of_get_named_gpio(pdev->dev.of_node, - "cs-gpios", i); - - if (cs_gpio == -EPROBE_DEFER) { - ret = cs_gpio; - goto out; - } - - if (gpio_is_valid(cs_gpio)) { - ret = devm_gpio_request(&pdev->dev, cs_gpio, - dev_name(&pdev->dev)); - if (ret) - goto out; - } - } - } - init_func = device_get_match_data(&pdev->dev); if (init_func) { ret = init_func(pdev, dwsmmio); diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index b705f2bdb8b9..22a7998dbc08 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -20,7 +20,6 @@ #include #include #include -#include #include "spi-dw.h" @@ -425,13 +424,6 @@ static int dw_spi_setup(struct spi_device *spi) chip->tmode = SPI_TMOD_TR; - if (gpio_is_valid(spi->cs_gpio)) { - ret = gpio_direction_output(spi->cs_gpio, - !(spi->mode & SPI_CS_HIGH)); - if (ret) - return ret; - } - return 0; } @@ -496,6 +488,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) goto err_free_master; } + master->use_gpio_descriptors = true; master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP; master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16); master->bus_num = dws->bus_num;