Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2536516ybi; Sun, 9 Jun 2019 14:21:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqykur97P9khaw9P002HYWkQz8bkRwtdlopNhxX54kkc5LcZqJaIGAEfy6cOJ65xeSM01d59 X-Received: by 2002:a63:fb45:: with SMTP id w5mr12260234pgj.397.1560115300106; Sun, 09 Jun 2019 14:21:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560115300; cv=none; d=google.com; s=arc-20160816; b=RIwtbuI5uQTagKxmuce14+g7eip3MQvETmGuK1vvhUh9v3gLhJyTY3RTdIOcU+5pbM MyQZ9PlS6ovMCkarL+5yiGstgUemdrjd49pMzGu0bXq/Z+Ah1BxIangFIhA1Ujq9d44J rMy+ll//IwW5ST9h1qPv8B6rAn1vo5HJmqJSjtRXrvzDjKTMMnL4EoWu5gDJhPSvGdKd 7mnWiJT5ILiPNz29asp2aKqfMDELlH30BSYQpDq4qtwKKARPg+gi4IeqCI2sd9GULOO7 axKwr4D2caShqJEr3xP7s1y6PTcLfhzYW69Ifn9ovwGGhCNGYQREBuajF+VOIf+SYbpk nd+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ihP9CHBNii87NzZFvK45BfkIBAlThjiJWCB4oVnWpok=; b=bdurQZUYENwmaVg2h8UBW/glRxZWyb6WTmcuBN7+U9hqajnBR1VHi08+MUxhtDVEax L+AY7Aujn5bW+5WLBPDqNqVsM0B/hrEjcK88HW6HOP0n25inIpc82pWTubew7yQwoXDx ik89wHJlVMJp/hro0c2lu3sUA5O/NTwWClFP3uCbGcAFDAU8uIN7A6CjyGp6/7qb0np9 gmHeqv1bl0AHznifz24UcN9FzWRqX5YL/syjzoFTb5LQxssc5p8VVGhDi6qvNU36+MnO LwY077bzq/oz+27X2bFYSPeN28Zt2ijdvkB6+uAZMrjAm7PCnAAebAHc3Otn4N6wzWPe XDhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M5iWwlQ+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e20si3920558pgk.218.2019.06.09.14.21.23; Sun, 09 Jun 2019 14:21:40 -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=@linaro.org header.s=google header.b=M5iWwlQ+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729398AbfFIVRj (ORCPT + 99 others); Sun, 9 Jun 2019 17:17:39 -0400 Received: from mail-lj1-f178.google.com ([209.85.208.178]:45409 "EHLO mail-lj1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729090AbfFIVRj (ORCPT ); Sun, 9 Jun 2019 17:17:39 -0400 Received: by mail-lj1-f178.google.com with SMTP id m23so6086645lje.12 for ; Sun, 09 Jun 2019 14:17:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ihP9CHBNii87NzZFvK45BfkIBAlThjiJWCB4oVnWpok=; b=M5iWwlQ+AZHZjR6Dfu1VFt1FA96KmLz7fqBEFA2kG4SlBUpY4QI50lWCFH8IVX1CQa rLhPrwkorA3ar51LnQFpx5yc/7A5O/piuvbpdvpE97/l1Bv/XfUU0CiEtVcRBzstR+G2 YvO9NdOdTXHaEU8O3MsOv+UwOvjxcddeXHLm9AoYw94Aq+l6o5z6IocuAzZ+kkLy20IL IZNYvU/MDywIMJ/HPUdNCPWH2CoKjR4+UNnwLj3xjUU5EehCeZnRSfdx+1NLn00IyfeL yr18shSrswAV9mpRLVbBoHVLBNwJgdDaUv7mOymhpnMMFHypY3xAcu1p38mk3lxTkC74 b7KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ihP9CHBNii87NzZFvK45BfkIBAlThjiJWCB4oVnWpok=; b=YOFAiOC5K3pI6w+XY+Yop5dod90rq3FOuw4yceNxXdoWMcAw3oLBs21U+fb5jIXKq0 JlEVK2fX+BBbhyD4fPMrOkh9R3aV4UzdNyhhzWEHtn/7irOfoRpGYMqrk2waBpE4uIs5 A2j6WFIJ5Be14fAAzkVSQcT8NQE7ihGQ2Rmvk/ybqZwLyhTkH7tSIKcw6XjG6g7CfwcC 3LG1wnK6UINWlJ/R6/HNrhO/v6oRGhmgHm7RS/Bwbdnne2VXxdvbEDmSuBgwqGd61ET0 gC/TsWTp6BgBpvBcLBzKDYxaVY5LDLe+/FeIj4kvLHmGVO67vTS6MRFQjNvWJuPEJOZ1 Av+g== X-Gm-Message-State: APjAAAW8r3JAFifOJvxDju+z0pUUy7SHFl/RhQZweK1oetb9z6A9E/fq yiwDSiufiFLPKvD5a2APIPZ/lwPfxmEN7trFLS8ruQ== X-Received: by 2002:a2e:9753:: with SMTP id f19mr10595654ljj.113.1560115056899; Sun, 09 Jun 2019 14:17:36 -0700 (PDT) MIME-Version: 1.0 References: <20190609180621.7607-1-martin.blumenstingl@googlemail.com> <20190609180621.7607-6-martin.blumenstingl@googlemail.com> In-Reply-To: <20190609180621.7607-6-martin.blumenstingl@googlemail.com> From: Linus Walleij Date: Sun, 9 Jun 2019 23:17:30 +0200 Message-ID: Subject: Re: [RFC next v1 5/5] arm64: dts: meson: g12a: x96-max: fix the Ethernet PHY reset line To: Martin Blumenstingl Cc: netdev , "open list:GPIO SUBSYSTEM" , "open list:ARM/Amlogic Meson..." , Bartosz Golaszewski , Giuseppe CAVALLARO , Alexandre TORGUE , Jose Abreu , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "David S. Miller" , Linux ARM , "linux-kernel@vger.kernel.org" , Kevin Hilman , Neil Armstrong Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 9, 2019 at 8:06 PM Martin Blumenstingl wrote: > The PHY reset line and interrupt line are swapped on the X96 Max > compared to the Odroid-N2 schematics. This means: > - GPIOZ_14 is the interrupt line (on the Odroid-N2 it's the reset line) > - GPIOZ_15 is the reset line (on the Odroid-N2 it's the interrupt line) > > Also the GPIOZ_14 and GPIOZ_15 pins are special. The datasheet describes > that they are "3.3V input tolerant open drain (OD) output pins". This > means the GPIO controller can drive the output LOW to reset the PHY. To > release the reset it can only switch the pin to input mode. The output > cannot be driven HIGH for these pins. > This requires configuring the reset line as GPIO_OPEN_SOURCE because > otherwise the PHY will be stuck in "reset" state (because driving the > pin HIGH seeems to result in the same signal as driving it LOW). This far it seems all right. > Switch to GPIOZ_15 for the reset GPIO with the correct flags and drop > the "snps,reset-active-low" property as this is now encoded in the > GPIO_OPEN_SOURCE flag. Open source doesn't imply active low. We have this in stmmac_mdio_reset(): gpio_direction_output(data->reset_gpio, data->active_low ? 1 : 0); if (data->delays[0]) msleep(DIV_ROUND_UP(data->delays[0], 1000)); gpio_set_value(data->reset_gpio, data->active_low ? 0 : 1); if (data->delays[1]) msleep(DIV_ROUND_UP(data->delays[1], 1000)); gpio_set_value(data->reset_gpio, data->active_low ? 1 : 0); if (data->delays[2]) msleep(DIV_ROUND_UP(data->delays[2], 1000)); If "snps,reset-active-low" was set it results in the sequence 1, 0, 1 if it is not set it results in the sequence 0, 1, 0. The high (reset) is asserted by switching the pin into high-z open drain mode, which happens by switching the line into input mode in some cases. I think the real reason it works now is that reset is actually active high. It makes a lot of sense, since if it resets the device when set as input (open drain) it holds all devices on that line in reset, which is likely what you want as most GPIOs come up as inputs (open drain). A pull-up resistor will ascertain that the devices are in reset. After power on you need to actively de-assert the reset (to low) for it to go out of reset. > Fixes: 51d116557b2044 ("arm64: dts: meson-g12a-x96-max: Add Gigabit Ethernet Support") > Signed-off-by: Martin Blumenstingl Other than the commit message: Reviewed-by: Linus Walleij Yours, Linus Walleij