From patchwork Fri Jul 8 09:07:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 71660 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp342700qgy; Fri, 8 Jul 2016 02:07:52 -0700 (PDT) X-Received: by 10.66.25.171 with SMTP id d11mr8097737pag.3.1467968871928; Fri, 08 Jul 2016 02:07:51 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o78si3185353pfa.103.2016.07.08.02.07.51; Fri, 08 Jul 2016 02:07:51 -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 S1754264AbcGHJHs (ORCPT + 4 others); Fri, 8 Jul 2016 05:07:48 -0400 Received: from mail-lf0-f41.google.com ([209.85.215.41]:33006 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753955AbcGHJHo (ORCPT ); Fri, 8 Jul 2016 05:07:44 -0400 Received: by mail-lf0-f41.google.com with SMTP id f6so26064194lfg.0 for ; Fri, 08 Jul 2016 02:07:43 -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=8SxFnWBJdsGty2iN+2RBxiWmbV/ZDwpUZz9Y4nnkw3U=; b=fMmgSkYQFiReaGSMamw0FlpcQ6B9ftvajC/ROo7XMO4Mv7oNV9Hme7OIfA4zdEn1fE WjVqhTwCTAeKrySn60/RBSfIzFtC23m07Vu9ow78eFLFysGpIDzgjYKYjCxlktILIm8I sIDzw0p8GoG4sdH+1vh8aKdM7kl42EzZdmzrk= 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=8SxFnWBJdsGty2iN+2RBxiWmbV/ZDwpUZz9Y4nnkw3U=; b=eP3Qqqt4fCMsXyhHPQTG2ycqWMp+0TdnZmbr7zfrnShMtDkdAWDHEqcQUPv5VzLKXU P9SQCUoDIDSTjGalEgKAXai2tWSOy5wO0pmbW5LZ9F3NWg+vyi35pr4ITYouC31UO4j/ ypYzveW3xBRa6wt2nEm2t+M29vIQvfIFUrEAOMlb7rfq6/YDgEWcJSFDD0sTfL4/R9KQ ZQCY0HnYo+ojklVhKry3nSvJxseIjjf4q+KEcJBSN9uACHTwJqyzhSSvYji0fe0FJ+KF 2PF6O5GEf3NqoP5YpTyNPH0a3dwtj7OCGT0mzLsI31ny5nwodWgKrTAmTLeVuwt1b1/P zU2Q== X-Gm-Message-State: ALyK8tJy1proPepCKocqEa9IQ9gWxQ2bUjSkwSO49Gu3VUV0TfO4DYwiBkBpgz45F340914x X-Received: by 10.25.26.194 with SMTP id a185mr1052469lfa.156.1467968862328; Fri, 08 Jul 2016 02:07:42 -0700 (PDT) Received: from localhost.localdomain.localdomain (c-cc7c71d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.124.204]) by smtp.gmail.com with ESMTPSA id 16sm6666907lja.31.2016.07.08.02.07.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Jul 2016 02:07:41 -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] net: smsc911x: request and deassert optional RESET GPIO Date: Fri, 8 Jul 2016 11:07:31 +0200 Message-Id: <1467968852-6175-2-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467968852-6175-1-git-send-email-linus.walleij@linaro.org> References: <1467968852-6175-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 --- drivers/net/ethernet/smsc/smsc911x.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index 8af25563f627..125d58ac22bd 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" @@ -149,6 +150,9 @@ struct smsc911x_data { /* regulators */ struct regulator_bulk_data supplies[SMSC911X_NUM_SUPPLIES]; + /* Reset GPIO */ + struct gpio_desc *reset_gpiod; + /* clock */ struct clk *clk; }; @@ -440,6 +444,15 @@ 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(&pdev->dev, "reset", + GPIOD_OUT_HIGH); + /* Deassert the signal */ + if (!IS_ERR(pdata->reset_gpiod)) { + dev_info(&pdev->dev, "release reset\n"); + gpiod_set_value(pdata->reset_gpiod, 0); + } + /* Request clock */ pdata->clk = clk_get(&pdev->dev, NULL); if (IS_ERR(pdata->clk))