From patchwork Wed Aug 24 12:59:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 74607 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp303650qga; Wed, 24 Aug 2016 06:00:28 -0700 (PDT) X-Received: by 10.98.157.12 with SMTP id i12mr5456567pfd.164.1472043628000; Wed, 24 Aug 2016 06:00:28 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8si9649755pat.21.2016.08.24.06.00.27; Wed, 24 Aug 2016 06:00:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755292AbcHXNAT (ORCPT + 4 others); Wed, 24 Aug 2016 09:00:19 -0400 Received: from mail-lf0-f46.google.com ([209.85.215.46]:36016 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753012AbcHXNAR (ORCPT ); Wed, 24 Aug 2016 09:00:17 -0400 Received: by mail-lf0-f46.google.com with SMTP id g62so11270104lfe.3 for ; Wed, 24 Aug 2016 05:59:58 -0700 (PDT) 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; bh=X3X0cuQ7DQok7IPT7LuLB9IKTeKEwN3d7XjIosZ4XHM=; b=QPx39/tte/7Wb7Ovmf0uryLLgCViAL2XGrh2FoQvQsMdU834ajbPXobAGEWjmS0L8y A7vRdbIqwT1QC/GVqUXhS8IYwVZPjvwtaU1zGNvetk8DcAD4GL+j4IE4RHYw/r52Jsf/ zB531QodflYlJGrOW/HVtVEZHGwq6dGbqf4og= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=X3X0cuQ7DQok7IPT7LuLB9IKTeKEwN3d7XjIosZ4XHM=; b=GfepISJDOchJGQbCiCTdgPOVcbpG3h7ZYk9p8o3RTJiw+kBAZjhIgKOROT+GO4IOmy YUcT5qS7N1kWMViTwRCoIA/8ZG+ybYvp+IWakbEa7keQrmuUqY1I+Ou+4+V1os5X9yM0 SkBHabt7xVNdVvfMiY6dxP/j5FoJpElSVyQ2/RMxoU1Dg0AyTVOLc6MKguqUEtqicfIX Rl4cdO1W6IpTOOJW8apf6Hrwu9croqZFA/tvfbOJsWjpFI6gydwtaidg9Cs3qvePkJ0V LNq5bbvOsTocSJYoDwepQLfBHPLsocjQhOk6TXHVV4NolsHCJsPiuRRt1a+Al92fRaZB ctTA== X-Gm-Message-State: AEkoouvO1Lf1iF5V7/RE5VVluyC3CHqNEZvZFmCabjF8wZoar44mwcScylPk/RZdigsqHV1R X-Received: by 10.46.1.35 with SMTP id 35mr769815ljb.8.1472043597134; Wed, 24 Aug 2016 05:59:57 -0700 (PDT) Received: from linuslaptop.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 184sm1882012lfz.22.2016.08.24.05.59.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Aug 2016 05:59:56 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" , Steve Glendinning Cc: Guenter Roeck , Jeremy Linton , Kamlakant Patel , Pavel Fedin , Linus Walleij Subject: [PATCH 2/3 v2] net: smsc911x: request and deassert optional RESET GPIO Date: Wed, 24 Aug 2016 14:59:41 +0200 Message-Id: <1472043582-7653-2-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472043582-7653-1-git-send-email-linus.walleij@linaro.org> References: <1472043582-7653-1-git-send-email-linus.walleij@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On some systems (such as the Qualcomm APQ8060 Dragonboard) the RESET signal of the SMSC911x is not pulled up by a resistor but connected to a GPIO line, so that the operating system must explicitly deassert RESET before use. Support this in the SMSC911x driver so this ethernet connector can be used on such targets. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Use devm_gpiod_request_optiona() and request the line with GPIOD_OUT_LOW so it is deasserted immediately if active. --- drivers/net/ethernet/smsc/smsc911x.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index ca3134540d2d..8ab8d4b9614b 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -62,6 +62,7 @@ #include #include #include +#include #include "smsc911x.h" @@ -147,6 +148,9 @@ struct smsc911x_data { /* regulators */ struct regulator_bulk_data supplies[SMSC911X_NUM_SUPPLIES]; + /* Reset GPIO */ + struct gpio_desc *reset_gpiod; + /* clock */ struct clk *clk; }; @@ -438,6 +442,11 @@ static int smsc911x_request_resources(struct platform_device *pdev) netdev_err(ndev, "couldn't get regulators %d\n", ret); + /* Request optional RESET GPIO */ + pdata->reset_gpiod = devm_gpiod_get_optional(&pdev->dev, + "reset", + GPIOD_OUT_LOW); + /* Request clock */ pdata->clk = clk_get(&pdev->dev, NULL); if (IS_ERR(pdata->clk))