From patchwork Tue Mar 22 19:27:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 600917 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3qV2lk3Hrzz9s5l for ; Wed, 23 Mar 2016 06:27:45 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=cogentembedded-com.20150623.gappssmtp.com header.i=@cogentembedded-com.20150623.gappssmtp.com header.b=drqJOTUz; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751793AbcCVT1o (ORCPT ); Tue, 22 Mar 2016 15:27:44 -0400 Received: from mail-lb0-f173.google.com ([209.85.217.173]:33777 "EHLO mail-lb0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750772AbcCVT1n (ORCPT ); Tue, 22 Mar 2016 15:27:43 -0400 Received: by mail-lb0-f173.google.com with SMTP id oe12so172485025lbc.0 for ; Tue, 22 Mar 2016 12:27:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:organization:user-agent :mime-version:content-transfer-encoding; bh=HJ/QTWx3A4uFXJj35udwP+E7+NzEsp504GZxJ0YG4Ww=; b=drqJOTUz6P/UxQV8iIFibrHw45rqU4qDbOG5VBOuvycFqw5u3EdimoT8HrIUrn5V8V MFuSOl5Fv61eIaZqSXydjTJGV6cs052Xl8QTdy9/FQK/tkbVaoGFMpuWdvXBC8N5auF5 pvzwntv2euFjFiv5g2CRPyvXDRFJnxb9ASSepeZgTWXIDUPLi3gUMxJ/b8CQlxaKKowT DOA5ocf3BpLhHRPXorbJhcF/FJ7m5j3siPnyjt6zvM1dWb2plLAazAfYMXfwubSE633J E2AhE7zzn0RYqA/tEP90rxCMnwzkkQll2ijUHF9k/vPeQvzg1FgHyHNQPynaTGEEmnWi qWQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:organization :user-agent:mime-version:content-transfer-encoding; bh=HJ/QTWx3A4uFXJj35udwP+E7+NzEsp504GZxJ0YG4Ww=; b=Ga/PZWvuLCg7WXrTRZzJohvjKK52rzn4kHucn9DBFoU3ved1r2tSOg2D3b3VeK3moh pOPfOlc8DjxUlwUqWiag3TZOFpzJAXmQzL2HL/HmdoM9dcwMaMalqAK+eCRZ/tocEvXj EdVHoSAbItzm4R+aFhow79mbkSMz050wwdwVTLj3IOJso+23ZIZEWjXaDtrQtNhzS17m 34Y2jIdoecjAWdqi86otDcHOlFaFZOEy7Xiyc/88vWjCraSMPI0bvJpEnR0+4pTz/PTW pbbcXNJu/eZXYoavZXWq6E3BqGlFPfIVE1o+3IwtDHiwZs7MTtWKwjpi7ESFRQxwLqTL E3+g== X-Gm-Message-State: AD7BkJKMRAIcDK5yeIjQ5u7MZwWWakpMhgRBMFKc9C7tCyyi5jJYMu7Mfsmu3P9P5LMn/w== X-Received: by 10.112.171.163 with SMTP id av3mr13817165lbc.145.1458674861180; Tue, 22 Mar 2016 12:27:41 -0700 (PDT) Received: from wasted.cogentembedded.com ([83.149.8.89]) by smtp.gmail.com with ESMTPSA id n66sm5468340lfb.33.2016.03.22.12.27.39 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 22 Mar 2016 12:27:40 -0700 (PDT) From: Sergei Shtylyov To: netdev@vger.kernel.org, nicolas.ferre@atmel.com Subject: [PATCH] macb: fix PHY reset Date: Tue, 22 Mar 2016 22:27:38 +0300 Message-ID: <3349780.3Prc3uV314@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.10 (Linux/4.4.5-200.fc22.x86_64; KDE/4.14.17; x86_64; ; ) MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The driver calls gpiod_set_value() with GPIOD_OUT_* instead of 0 and 1, as a result the PHY isn't really put back into reset state in macb_remove(). Moreover, the driver assumes that something else has set the GPIO direction to output, so if it has not, the PHY wouldn't be taken out of reset in macb_probe() either... Signed-off-by: Sergei Shtylyov Acked-by: Nicolas Ferre --- The patch is against David Miller's 'net.git' repo. drivers/net/ethernet/cadence/macb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Index: net/drivers/net/ethernet/cadence/macb.c =================================================================== --- net.orig/drivers/net/ethernet/cadence/macb.c +++ net/drivers/net/ethernet/cadence/macb.c @@ -2959,7 +2959,7 @@ static int macb_probe(struct platform_de int gpio = of_get_named_gpio(phy_node, "reset-gpios", 0); if (gpio_is_valid(gpio)) bp->reset_gpio = gpio_to_desc(gpio); - gpiod_set_value(bp->reset_gpio, GPIOD_OUT_HIGH); + gpiod_direction_output(bp->reset_gpio, 1); } of_node_put(phy_node); @@ -3029,7 +3029,7 @@ static int macb_remove(struct platform_d mdiobus_free(bp->mii_bus); /* Shutdown the PHY if there is a GPIO reset */ - gpiod_set_value(bp->reset_gpio, GPIOD_OUT_LOW); + gpiod_set_value(bp->reset_gpio, 0); unregister_netdev(dev); clk_disable_unprepare(bp->tx_clk);