From patchwork Wed Jan 16 08:21:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 155698 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp377456jaa; Wed, 16 Jan 2019 00:21:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN53Dg1OIN9N+hFjDptwkG4RgSXqed4ZQuSeWNWm4MAJpxxmR/NsBgwdDUFYRijrHw4/nyD9 X-Received: by 2002:a62:16d6:: with SMTP id 205mr8485751pfw.256.1547626879737; Wed, 16 Jan 2019 00:21:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547626879; cv=none; d=google.com; s=arc-20160816; b=QTrUEcvSzg/3E/kosJ7gqP582kJvSFgdxQbAMlFrSYk96wDnOU8Yn109br1oaUVGti h5BBxJoThyMntpEEpYdHZ/Itncez5NhIWWs6gEJsV/1yHHgxHxblr8ute2j+ZGZuPey3 JjVRWwuRZS6ohet4MauMWUA0+yUPeStQ9CsJQKI2do81ZR74UhzbUJxpgsjznYDgohMg nJnZXs2DZ629U5e5O9kHDIdWqGWxsWQXxRhCdwKEg9k9yNyZ5mYKOpgSevlBsAK5dJ+Z K849UheG+44dz1LkVQb1YhCnoPq7yxyOJZLVHb3smr47dr5RPPW3jgu1dQRVoAsqeJrJ 07DQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=z27WWP/cKKdfJ/qLFUMIj0GJqLOsy7raZASVRvwLgfs=; b=t4ClogqPWZv2OxHRKlwrWGp/iuuj7Vxd+Rt8iIWuyb0I5c5cwed3NJfm1Sl4IGqkHA SOLvrCI8K+iqfzEkY99OO979Sqddi0Io+ICV3nKn0Yzod8X4RkkMBcIDkAY91vS9lxMc Pd6WeS59cTtfqeDIyH0zOAZEhfKbX0OnZC5fqczqgKUsj2vWWjA0CcDaG56qyj56yNx5 DpLL7CtEZfK+BOuS3iPNgJIhNUvVTfWOEZ7vox6NlDegiOfEPEd+GdlRSyIH+hiVEai7 sfO6CR5sWxte53CgtUVs+u37u31GC3kJbQr7/WhqyB6lNdVXaWhONdlFk0ovYlmjQ6XR iMYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jjwzezcW; 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 a32si6214670pla.168.2019.01.16.00.21.19; Wed, 16 Jan 2019 00:21:19 -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=jjwzezcW; 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 S1729127AbfAPIVS (ORCPT + 1 other); Wed, 16 Jan 2019 03:21:18 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:41965 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728726AbfAPIVS (ORCPT ); Wed, 16 Jan 2019 03:21:18 -0500 Received: by mail-lf1-f68.google.com with SMTP id c16so4172379lfj.8 for ; Wed, 16 Jan 2019 00:21:17 -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:mime-version :content-transfer-encoding; bh=z27WWP/cKKdfJ/qLFUMIj0GJqLOsy7raZASVRvwLgfs=; b=jjwzezcWZEE8g8Q99D8U6tHCQjOMAkFpQQtBkBxEnUlirOIkQjKlFv+TkaHD83Qy+Q Ah23STm+kAjeMet8PZ7IdRuHqWr4QIv0VoSrWxvrB8mmXtxEu60GhD3y4y0wkhQaWv2a 1zFHm/5F/rJD92PSA0NsPgnBKeChgOmFNExe8= 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:mime-version :content-transfer-encoding; bh=z27WWP/cKKdfJ/qLFUMIj0GJqLOsy7raZASVRvwLgfs=; b=SNnbXu2fxFJHwGXRedN59F7mBXysHSagrs/54IGsu4/scAFsRTF1MfOJpvLtV4MwTl sSpBMleTHPxeZZsjcgGMFQlcqdLDNCSXbfU7/usDCSpAhN4/sc7Au1j7RFoMpaxudH3i hxGM9Zr/wk5dkrYajhU6XUADyM0SsRIUvNMG9WrcjIPhh98VYtglxMtAuqotEZQ9fW4y zSTBbsZ2zmDtbA0vV9OaK4vXqGJJ76IL9+AQmbR21155yTehZN6K7rykoZlI7+W+Wn6H orjm/Zb2+zAggv7OLZNv1Cwp271QWKdBM0mlnfdYbSqeVWC7BNXq5P/q8UnjF1+0T+UU /3bg== X-Gm-Message-State: AJcUukcjtKBPuqkTNzyvH5+r/V6yTgaHs0jYPHOpUtz3csqpTTQFEb1k 12B9Al99mb+xgQFuDFAG4+w7Tw== X-Received: by 2002:a19:db82:: with SMTP id t2mr6181815lfi.130.1547626876662; Wed, 16 Jan 2019 00:21:16 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id z9sm1035095lfj.79.2019.01.16.00.21.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 00:21:15 -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 , Jan Kotas Subject: [PATCH 1/4 v3] spi: Support high CS when using descriptors Date: Wed, 16 Jan 2019 09:21:07 +0100 Message-Id: <20190116082110.5604-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org All controllers using GPIO descriptors can by definition support high CS connections, so just enforce this when registering an SPI controller. This fixes a regression where controllers were missing SPI_CS_HIGH, the drivers would fail like this: spi spi0.0: setup: unsupported mode bits 4 cdns-spi fd0b0000.spi: can't setup spi0.0, status -22 This is because as using descriptors moves the CS inversion logic over to gpiolib, all such controllers are registered with CS active high. Cc: Jan Kotas Reported-by: Jan Kotas Tested-by: Jan Kotas Fixes: f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs") Signed-off-by: Linus Walleij --- ChangeLog v1->v3: - Collected Jan's Tested-by --- drivers/spi/spi.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.20.1 diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 06b9139664a3..31696f2fc8d5 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2336,6 +2336,11 @@ int spi_register_controller(struct spi_controller *ctlr) status = spi_get_gpio_descs(ctlr); if (status) return status; + /* + * A controller using GPIO descriptors always + * supports SPI_CS_HIGH if need be. + */ + ctlr->mode_bits |= SPI_CS_HIGH; } else { /* Legacy code path for GPIOs from DT */ status = of_spi_register_master(ctlr); From patchwork Wed Jan 16 08:21:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 155701 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp377790jaa; Wed, 16 Jan 2019 00:21:44 -0800 (PST) X-Google-Smtp-Source: ALg8bN5L8ZFPO+yto5aP1W0Ik42f04qqTMAqIr/54uUqt56x3Te9nTeC8dVrWSOTG475P2g4RAAh X-Received: by 2002:a62:e201:: with SMTP id a1mr8379798pfi.75.1547626904309; Wed, 16 Jan 2019 00:21:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547626904; cv=none; d=google.com; s=arc-20160816; b=L0DY5Ft4PYrB+xiH6oBKEja1pfhZ/b24aXWFTjLOxzpD1eSt5MFb4lLe1rLssOkQDp ay3a/9NI8hDqDZYa6drMr2bZ2jPzOHw3Tu218QcN8MkShlK1bTSpFgbCOD8jQI4wfoyz sxW/lhI96E1gBYDsN7a20cZsW4FU9/X7/+83Kx8Rum0LoXW0Poz84UwpX8Ti+atK+0t6 Qpmb9XaVIfkocRysihBr9ArtkC1OHqBoqEVzV+B7KXYhpn92wE+yD4saUXodnFVnilRQ aUYjlcUtiaMVXRsXkGtWlsxX2Ugnhen9i+CGucDBfVYjoCxHZryEYEDl6HWLUECiGW6S dyzA== 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=6k8cr/CmrKNAb1C1hzUSi8bPXmLFBSBSAM8T1laVsvk=; b=myKXcUqU5pAhorNOgCyVjrukJmJRA7YA1ialbMrT4wAAIV8D24ySKd2ku61+JjQqDi 8ueg8OYiSy4J4mkVGhzBP8PJASANUfKpKQL0WbVy6Mg8yCXuC8vrhZP5mEeVWd4TYNI8 5lRk2aEKm/YyEOq6vzf4NOUznJHvS5nENR8zTgZix3n77xleyfQUAmAJQz869TZbzwru Vtzt+OUVb6wkfnrk7gQvYAsrHBCSsNtKynbaYrQt71NN5a6O4T34rMYNx+QwePZpdNAJ IUgkbF9DeKjYHPNMrneV6KaAlmmq7a/r6xk0jhosh3+5p5PLKULl+V+Xpdaffmw/wPqw CURQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hTmI0RIB; 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 a5si5585033pgg.120.2019.01.16.00.21.44; Wed, 16 Jan 2019 00:21:44 -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=hTmI0RIB; 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 S2388587AbfAPIV1 (ORCPT + 1 other); Wed, 16 Jan 2019 03:21:27 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:32956 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730345AbfAPIV0 (ORCPT ); Wed, 16 Jan 2019 03:21:26 -0500 Received: by mail-lf1-f68.google.com with SMTP id i26so4212493lfc.0 for ; Wed, 16 Jan 2019 00:21:25 -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=6k8cr/CmrKNAb1C1hzUSi8bPXmLFBSBSAM8T1laVsvk=; b=hTmI0RIBL1+bi7xFbqd2a/maAZmsceWp5kp15PRy2KaJZQA9I2H2duIf1GN75Bik/G 7QniA6L/OURrwPC22RydGW7Q2t47JpORx24wwUE2JAaux3rxMGzKoVW49UH1QKmJY7ZR j5wwXvAQm90DmkxDM/FBeKWbWyoON3mZN/WLk= 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=6k8cr/CmrKNAb1C1hzUSi8bPXmLFBSBSAM8T1laVsvk=; b=WPWGnH5bzqh+T8wrPU8onkO2pv4QIaTFFwcS0K6EfGF5GUpwMuGJndyuRDWqwcm1XO tRyZkYOuUgAsr2n28V4d5NPjFOVeK9g7oPbqK3LWgSJ0V7BsS6xRP7XO78v9H3uYAYR1 euZTAEdj4oUxd3EiEnkgN+38Cbh/ZM1NqvkeYF+xvMMQL3L1GugHGbY49xVxgOPXMbUx dX5he9CANShFCGmGxF+TpwLY8gl6JlycSTt2EpCKRnduCRKF2ao6l0L7o+4BUZhp9l5l YVIFrTejA1QeNMctyxLJmfU0h4GcxPzmCKTidAGohJkyzcy6SPcpdHK4OJ6A4IzmOwKd 4TWA== X-Gm-Message-State: AJcUukeixdHhHIfCeb+X8ZfCdYBdx5rgnsw4ZK8sRNOZW4ImUHYkTOpG 8V5wPosKymD6UvwmtC+iRSgv7g== X-Received: by 2002:a19:ef15:: with SMTP id n21mr6133854lfh.21.1547626885096; Wed, 16 Jan 2019 00:21:25 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id z9sm1035095lfj.79.2019.01.16.00.21.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 00:21:24 -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 , Jan Kotas Subject: [PATCH 4/4 v3] gpio: of: Fix logic inversion Date: Wed, 16 Jan 2019 09:21:10 +0100 Message-Id: <20190116082110.5604-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190116082110.5604-1-linus.walleij@linaro.org> References: <20190116082110.5604-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 The SPI chip selects were not properly inspected due to a logic inversion. This made SPI GPIOs not work. Cc: Jan Kotas Reported-by: Jan Kotas Tested-by: Jan Kotas Fixes: f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs") Signed-off-by: Linus Walleij --- ChangeLog v1->v3: - New patch - Collected Jan's Tested-by This was rootcaused by Jan, Mark please apply this to the SPI tree with the rest of the fixes! --- drivers/gpio/gpiolib-of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index a6e1891217e2..c34eb9d9c59a 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -125,7 +125,7 @@ static void of_gpio_flags_quirks(struct device_node *np, for_each_child_of_node(np, child) { ret = of_property_read_u32(child, "reg", &cs); - if (!ret) + if (ret) continue; if (cs == index) { /*