Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3301018ybb; Tue, 31 Mar 2020 02:25:53 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu+Pv/OXHTenEolymuuQn2W0bpk+a/iY3mHtt9VlapFYaodpMPj2/N1fuGXTAbp7mv8WpIJ X-Received: by 2002:a05:6830:1697:: with SMTP id k23mr11568700otr.1.1585646753567; Tue, 31 Mar 2020 02:25:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585646753; cv=none; d=google.com; s=arc-20160816; b=Aw1/4wOv4CcnlhbWLks5puwQfdoRVoFladg0r3zKCFzP9fFS8O7PCobNxgh8vU1EZs b2lDUgv9fAec4XllPnOrF9+Ab8eLFFzt15vnCVIqQwYVNgL2jJJPkwQk3/IgBSuvEO3z gFxI4/nyfa7V7eC5KQwzk7PIK6DA6ybDdjsgAB3XgTAr46tlXtMLmsEKcm5r5T6eCUCg HsHWQnzYxlAf4MNu2M8TnhBnIPxe5QDYhjcuHiJsWknvhuyohHk7NaDc+Em0BXvsr2hX NudZZCBtzQdN8bapXYto3+dM+IE1TsXFpFshLvRrHla7sV/KsqduJiHUWVPecTy6jT3A y5jA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tiQU+rutoQlul6+g9GW7GaZqP8vzS9YxpdwL6x20lZ0=; b=VSfd2+uR47cpIQ07aheFTQnHpRjAjGUAG/uIljtEm858I3VYGdOTit4UYtju9yqYzr C8m1gqmPMbSVBz+uZ9iW/nxtbtEfZkXASsn4fuwS87Z5gwHDQoIYU939dCcDjiarra7R vkhp5jpVnXdEBu5cIEu0PhKsFylwyrnj8ZE9evrmgmGDgKbpcLculW7BHJtYG7LzO60H nwzTWPovKz4BTsxOT6HtVqlHgqm/c053lh/jNVQluNSM/vefgeCGz7gLBjZBMifRnYJt UbxqV//oIypei3Mj/Fgc87dSnKAGOop/eSGUV4tU68wuQwbiYDS82navx2Ee95HhJdou /1lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RgVcqwQr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 50si7768262otv.259.2020.03.31.02.25.41; Tue, 31 Mar 2020 02:25:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@kernel.org header.s=default header.b=RgVcqwQr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730216AbgCaJBI (ORCPT + 99 others); Tue, 31 Mar 2020 05:01:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:40098 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730308AbgCaJBD (ORCPT ); Tue, 31 Mar 2020 05:01:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8F87120B1F; Tue, 31 Mar 2020 09:01:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645262; bh=6U8niKXaa2tr8wI02bHehJogCmeJNAgYYNWg/cYBrhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RgVcqwQrT2lwMbDkmwf67zNhPLHPwkBUPq8Rtt6hcSAni5r6INFUoZ8V4TPQB42LS 9UPVWxfJGCbFHwYKRHIl39TVJ8Q+PWiMFrTO5JwQyG5w6kMJVJYqnbZj449rOaunD3 dow4iCAVAU2Ur1H5uDpSdnV3sY5RPN12lUKWW0Mc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH 5.6 14/23] staging: wfx: add proper "compatible" string Date: Tue, 31 Mar 2020 10:59:26 +0200 Message-Id: <20200331085314.775491316@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085308.098696461@linuxfoundation.org> References: <20200331085308.098696461@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michał Mirosław commit eec6e3ee636ec3adaa85ebe4b4acaacfcf06277e upstream. Add "compatible" string matching "vendor,chip" template and proper GPIO flags handling. Keep support for old name and reset polarity for older devicetrees. Cc: stable@vger.kernel.org # d3a5bcb4a17f ("gpio: add gpiod_toggle_active_low()") Cc: stable@vger.kernel.org Fixes: 0096214a59a7 ("staging: wfx: add support for I/O access") Signed-off-by: Michał Mirosław Link: https://lore.kernel.org/r/0e6dda06f145676861860f073a53dc95987c7ab5.1581416843.git.mirq-linux@rere.qmqm.pl Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/siliabs,wfx.txt | 7 ++--- drivers/staging/wfx/bus_spi.c | 14 +++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) --- a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/siliabs,wfx.txt +++ b/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/siliabs,wfx.txt @@ -6,7 +6,7 @@ SPI You have to declare the WFxxx chip in your device tree. Required properties: - - compatible: Should be "silabs,wfx-spi" + - compatible: Should be "silabs,wf200" - reg: Chip select address of device - spi-max-frequency: Maximum SPI clocking speed of device in Hz - interrupts-extended: Should contain interrupt line (interrupt-parent + @@ -15,6 +15,7 @@ Required properties: Optional properties: - reset-gpios: phandle of gpio that will be used to reset chip during probe. Without this property, you may encounter issues with warm boot. + (Legacy: when compatible == "silabs,wfx-spi", the gpio is inverted.) Please consult Documentation/devicetree/bindings/spi/spi-bus.txt for optional SPI connection related properties, @@ -23,12 +24,12 @@ Example: &spi1 { wfx { - compatible = "silabs,wfx-spi"; + compatible = "silabs,wf200"; pinctrl-names = "default"; pinctrl-0 = <&wfx_irq &wfx_gpios>; interrupts-extended = <&gpio 16 IRQ_TYPE_EDGE_RISING>; wakeup-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; - reset-gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>; reg = <0>; spi-max-frequency = <42000000>; }; --- a/drivers/staging/wfx/bus_spi.c +++ b/drivers/staging/wfx/bus_spi.c @@ -27,6 +27,8 @@ MODULE_PARM_DESC(gpio_reset, "gpio numbe #define SET_WRITE 0x7FFF /* usage: and operation */ #define SET_READ 0x8000 /* usage: or operation */ +#define WFX_RESET_INVERTED 1 + static const struct wfx_platform_data wfx_spi_pdata = { .file_fw = "wfm_wf200", .file_pds = "wf200.pds", @@ -201,9 +203,11 @@ static int wfx_spi_probe(struct spi_devi if (!bus->gpio_reset) { dev_warn(&func->dev, "try to load firmware anyway\n"); } else { - gpiod_set_value(bus->gpio_reset, 0); - udelay(100); + if (spi_get_device_id(func)->driver_data & WFX_RESET_INVERTED) + gpiod_toggle_active_low(bus->gpio_reset); gpiod_set_value(bus->gpio_reset, 1); + udelay(100); + gpiod_set_value(bus->gpio_reset, 0); udelay(2000); } @@ -244,14 +248,16 @@ static int wfx_spi_remove(struct spi_dev * stripped. */ static const struct spi_device_id wfx_spi_id[] = { - { "wfx-spi", 0 }, + { "wfx-spi", WFX_RESET_INVERTED }, + { "wf200", 0 }, { }, }; MODULE_DEVICE_TABLE(spi, wfx_spi_id); #ifdef CONFIG_OF static const struct of_device_id wfx_spi_of_match[] = { - { .compatible = "silabs,wfx-spi" }, + { .compatible = "silabs,wfx-spi", .data = (void *)WFX_RESET_INVERTED }, + { .compatible = "silabs,wf200" }, { }, }; MODULE_DEVICE_TABLE(of, wfx_spi_of_match);