From patchwork Mon Jan 7 15:51:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 154896 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3630613ljp; Mon, 7 Jan 2019 07:56:57 -0800 (PST) X-Google-Smtp-Source: ALg8bN6IcxPdF3qA6A+b9tFtwrrYwlHXE6nvRwJFPDW+87IBzeJfdJfEEstnCVOcTAuc9vFzdmvz X-Received: by 2002:a17:902:680f:: with SMTP id h15mr60816996plk.40.1546876617002; Mon, 07 Jan 2019 07:56:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546876616; cv=none; d=google.com; s=arc-20160816; b=ZGvXkMxHo0TnaThKo7nsjMbC9HUGDuWQnWrr5lPxoXwgmwTOK8SjtwV0aXfTGRVr7n CwI1F6lxASPCg9x9KJnKJJw+ePUCYyViESypyfuckr8Y9YB6Ci0WfwRaicsNdEPjA45X Ak7T4j3xGnY6keVMYTqq7IlMET3ugKDKEXCklCNSX/p9R/Bbp8fk/INOrXK9mioUKY4e AQavi8eQgyQwF4ch4Agsib23h3WTKCo5MES1bR1RYXeQI4Ro+DIBcM0M+dot5VkvqDOn CMdHLg5aBNRDIYQkliudhdoOOrCiuthBFZz84pKIpx5KzzCLgZEBywGOEKh1gWOhdo3a egSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dbTeetkKkenvzLrTieSfQxTaPQNcOHrf+mj+vmNzfaU=; b=cS9M/6xh8VZbW70xmSlHq1hC90c1Y8X/kr2DcgEij7qhEJaqoU5HnmCnDILLPRLI86 ShDfi9Wg3hK35vHFfvS4uSk7FKxa18VfWNHGMXrlFeMlZp/FKqZvYYzJtidEES3AQDTM OngRtcewz6jxy4PWt4Gw93+/flde3lRMnCJwqXS9QAm+XHs5rbfN/j7g6S0E9oE4BLb4 +Gxu8A57ZWoww/fi+bb40ItI0wHQPV7AJIt7wvgNR1tYWM6tLC3tKg1AU0GTu0QYZbM/ Okdi/fzJ6Z3fgtA/p/5pfPIFvQZul0XvIONCneeQEQoYMgjfY0/UXRc/C6U89dFDjS2a l+iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N1uNOoa2; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si43262427pgf.452.2019.01.07.07.56.56; Mon, 07 Jan 2019 07:56:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N1uNOoa2; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726903AbfAGP44 (ORCPT + 1 other); Mon, 7 Jan 2019 10:56:56 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:36994 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727469AbfAGP4z (ORCPT ); Mon, 7 Jan 2019 10:56:55 -0500 Received: by mail-lj1-f193.google.com with SMTP id t18-v6so763149ljd.4 for ; Mon, 07 Jan 2019 07:56:54 -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=dbTeetkKkenvzLrTieSfQxTaPQNcOHrf+mj+vmNzfaU=; b=N1uNOoa2AW/HAtLpjdEHtAPnCKtpXGgl50xhmpPWdozAwrnCWaLYMiGmyhzHvpSrHd JhzUfQLp/+SaevIh9SeHkRsSKJgX3CzSFg9huOoIAXut51wUwkapQVundnsqwA2G+RIV T6o9YLTUQ/jS8DhR0k25D68sFBZlUqqJ1e9CU= 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=dbTeetkKkenvzLrTieSfQxTaPQNcOHrf+mj+vmNzfaU=; b=Eo500J9HGpfs3n5lTllbyso9lcqVZLExpSP80XyDbqeVjivaFkyui14Sx/NFQKOooz Pz4+nypXLivv9U26zv/7IFSx6xcR9hTxDmRFn1FLm76hBH2CFvtUVZ0RfUbvhQK7ivRy Uhfskmq920b+ldF33mFAyaHk1mTYgQzgWabejdA1SwdK6Ipvl1bhFXZmsM913n/8Yfs4 u7wa/46zKFRp8XLFhhe4Yzz1zDufy3zScKzUdIME0l6AN3cs3tEbek4ZvCCeWIvqKQLu l3SzEQ/+zDOvfPNNjpal+91tgsPwU3WIin1w2A3sCDRp8H3/bRHAwnrCR4e3YKtqTpqH w+Hw== X-Gm-Message-State: AJcUukfqo8dZzUO7aqI1KhzSXggclVpd/oAI7LrL7ULr5oRRxtyJiXM1 b1QrbHXDYWFzKi8p4eIdya5Cpw== X-Received: by 2002:a2e:484:: with SMTP id a4-v6mr34176665ljf.27.1546876613517; Mon, 07 Jan 2019 07:56:53 -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 t22sm13269164lfb.0.2019.01.07.07.56.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Jan 2019 07:56:52 -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 v2] spi: dw: Convert to use CS GPIO descriptors Date: Mon, 7 Jan 2019 16:51:56 +0100 Message-Id: <20190107155156.3738-8-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190107155156.3738-1-linus.walleij@linaro.org> References: <20190107155156.3738-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 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 Tested-by: Jay Fang Reviewed-by: Alexandre Belloni Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Rebase on v5.0-rc1 --- drivers/spi/spi-dw-mmio.c | 22 ---------------------- drivers/spi/spi-dw.c | 9 +-------- 2 files changed, 1 insertion(+), 30 deletions(-) -- 2.19.2 diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index d0dd7814e997..4bd59a93d988 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 @@ -185,27 +184,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 2e822a56576a..531f6ce5900d 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;