From patchwork Fri Dec 6 00:22:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 3291811 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4B5F9C0D4A for ; Fri, 6 Dec 2013 00:23:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 806CB204EC for ; Fri, 6 Dec 2013 00:23:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AD140204EB for ; Fri, 6 Dec 2013 00:23:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756603Ab3LFAWr (ORCPT ); Thu, 5 Dec 2013 19:22:47 -0500 Received: from ring0.de ([91.143.88.219]:39873 "EHLO smtp.ring0.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756540Ab3LFAWm (ORCPT ); Thu, 5 Dec 2013 19:22:42 -0500 Received: from comu.ring0.de (unknown [127.0.0.1]) by smtp.ring0.de (Postfix) with ESMTP id D2F922C58EE7; Fri, 6 Dec 2013 01:22:41 +0100 (CET) Received: (from spamd@localhost) by comu.ring0.de (8.13.8/8.13.8/Submit) id rB60Mea1004616; Fri, 6 Dec 2013 01:22:40 +0100 X-Authentication-Warning: comu.ring0.de: spamd set sender to sre@ring0.de using -f X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 From: Sebastian Reichel To: Sebastian Reichel , Luciano Coelho , Tony Lindgren , "John W. Linville" Cc: Rob Herring , Pawel Moll , Mark Rutland , Stephen Warren , Ian Campbell , Rob Landley , Kumar Gala , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, linux-omap@vger.kernel.org, netdev@vger.kernel.org, Sebastian Reichel Subject: [PATCHv2 4/5] wl1251: spi: add device tree support Date: Fri, 6 Dec 2013 01:22:15 +0100 Message-Id: <1386289336-26704-5-git-send-email-sre@debian.org> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1386289336-26704-1-git-send-email-sre@debian.org> References: <1382890469-25286-1-git-send-email-sre@debian.org> <1386289336-26704-1-git-send-email-sre@debian.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add device tree support for the spi variant of wl1251. Signed-off-by: Sebastian Reichel --- drivers/net/wireless/ti/wl1251/spi.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c index 0a8aacc..b06d36d 100644 --- a/drivers/net/wireless/ti/wl1251/spi.c +++ b/drivers/net/wireless/ti/wl1251/spi.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include "wl1251.h" @@ -240,13 +242,13 @@ static const struct wl1251_if_operations wl1251_spi_ops = { static int wl1251_spi_probe(struct spi_device *spi) { - struct wl1251_platform_data *pdata; + struct wl1251_platform_data *pdata = dev_get_platdata(&spi->dev); + struct device_node *np = spi->dev.of_node; struct ieee80211_hw *hw; struct wl1251 *wl; int ret; - pdata = dev_get_platdata(&spi->dev); - if (!pdata) { + if (!np && !pdata) { wl1251_error("no platform data"); return -ENODEV; } @@ -273,7 +275,18 @@ static int wl1251_spi_probe(struct spi_device *spi) goto out_free; } - wl->power_gpio = pdata->power_gpio; + if (np) { + wl->use_eeprom = of_property_read_bool(np, "ti,wl1251-has-eeprom"); + wl->power_gpio = of_get_named_gpio(np, "ti,power-gpio", 0); + } else if (pdata) { + wl->power_gpio = pdata->power_gpio; + wl->use_eeprom = pdata->use_eeprom; + } + + if (wl->power_gpio == -EPROBE_DEFER) { + ret = -EPROBE_DEFER; + goto out_free; + } if (gpio_is_valid(wl->power_gpio)) { ret = devm_gpio_request_one(&spi->dev, wl->power_gpio, @@ -295,8 +308,6 @@ static int wl1251_spi_probe(struct spi_device *spi) goto out_free; } - wl->use_eeprom = pdata->use_eeprom; - irq_set_status_flags(wl->irq, IRQ_NOAUTOEN); ret = devm_request_irq(&spi->dev, wl->irq, wl1251_irq, 0, DRIVER_NAME, wl);