From patchwork Wed Oct 23 14:42:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 3089011 Return-Path: X-Original-To: patchwork-linux-arm@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 28D60BF924 for ; Wed, 23 Oct 2013 14:43:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DF506203A3 for ; Wed, 23 Oct 2013 14:43:19 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8CFEC202FF for ; Wed, 23 Oct 2013 14:43:18 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYzeU-0001l1-Vh; Wed, 23 Oct 2013 14:43:15 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYzeS-00005o-Dj; Wed, 23 Oct 2013 14:43:12 +0000 Received: from mail-ob0-f175.google.com ([209.85.214.175]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYzeO-00004y-Sv for linux-arm-kernel@lists.infradead.org; Wed, 23 Oct 2013 14:43:09 +0000 Received: by mail-ob0-f175.google.com with SMTP id wm4so867454obc.20 for ; Wed, 23 Oct 2013 07:42:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=8YJV0azgB008TOQnltI+z7Zzd6MNYXLMr79X1C3j2y0=; b=WTJ2uZratvQZNG+tLHOdQXjh+9zz/4Ilt/e+xql7KnHaYPskjw+k0+Dgoy0ePbQOlU XhxFmQxDJdSdoFvH1vVEhLMygcjYAPdETJLKsdqBhY7233Q0tiZlwkrZehnJ/vKRAyaF oNndnWk9SSMi231fUQ0U1YZ+r7oU0ClbetaTqTB0EtWg5g6vn/AoYr6/1EtZ/ADHW+cx CXx1khQ8IkOSl2amnXMlZux8BpURoQHJCUxy+3sQyWo+FgxEaxNv/XPxHPMxiq6mhwOD bU3a7ZBTwNO5lhy9FjGZuT1d2Q7Z2Zz4DwhZpFN9/ZUjh7GvYXB/rnGMfdmiddmZ/3Cd cnDA== X-Gm-Message-State: ALoCoQk79t3DxoC7YHJM5ub4T+n8g/4XsSTPykurvOCNq0XP1kt48AdyQRm7+ceT66CLRM+4U+R7 X-Received: by 10.60.51.196 with SMTP id m4mr1916760oeo.1.1382539366839; Wed, 23 Oct 2013 07:42:46 -0700 (PDT) Received: from beef (cpe-98-27-254-98.neo.res.rr.com. [98.27.254.98]) by mx.google.com with ESMTPSA id hl3sm50679124obb.0.2013.10.23.07.42.44 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 23 Oct 2013 07:42:46 -0700 (PDT) Date: Wed, 23 Oct 2013 10:42:42 -0400 From: Matt Porter To: Rob Herring Subject: Re: [RFC] Does PHY UTMI data width belong to DWC2 or PHY binding? Message-ID: <20131023144242.GI29341@beef> References: <20131018141221.GH2721@beef> <5264F37E.9060307@ti.com> <20131022104829.GF15425@login.drsnuggles.stderr.nl> <20131022112520.GE29341@beef> <5266F06C.2080701@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5266F06C.2080701@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131023_104308_994879_3797BEC5 X-CRM114-Status: GOOD ( 32.45 ) X-Spam-Score: -2.6 (--) Cc: Mark Rutland , Devicetree List , Stephen Warren , Pawel Moll , Ian Campbell , Greg Kroah-Hartman , Linux USB List , Linux Kernel Mailing List , Felipe Balbi , Kishon Vijay Abraham I , Matthijs Kooijman , Paul Zimmerman , Linux ARM Kernel List X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Oct 22, 2013 at 04:38:52PM -0500, Rob Herring wrote: > On 10/22/2013 06:25 AM, Matt Porter wrote: > > On Tue, Oct 22, 2013 at 12:48:29PM +0200, Matthijs Kooijman wrote: > >> Hi Kishon, > >> > >> On Mon, Oct 21, 2013 at 02:57:26PM +0530, Kishon Vijay Abraham I wrote: > >>> I think it makes sense to keep the data width property in the dwc2 node itself. > >>> I mean it describes how the dwc2 IP is configured in that particular SoC (given > >>> that it can be either <8> or <16>). > >> If I'm reading the RT3052 datasheet correctly (GHWCFG4 register), the IP > >> can be configured for 8, 16 or 8 _and_ 16. In the latter case, the "8 > >> and 16 supported" would make sense as a property of dwc2 (though this > >> value should be autodetectable through GHWCFG4), while the actual 8 or > >> 16 supported by the PHY would make sense as property of a phy. > > > > There would be no value in adding a property for an already detectable > > value to dwc2's binding. To be honest, it's pretty much useless > > information due to the existence of the "8 and 16" option. > > > >> Note sure if this is really useful in practice as well, or if just > >> setting the actual width to use on dwc2 makes more sense... > > > > The GHWCFG4 information itself is not useful in practice, as described > > in the original thread: https://lkml.org/lkml/2013/10/10/477 > > > > It's certainly useful in practice to have this width property in either > > the dwc2 or the phy binding. One can make a case for either. As I > > mentioned in the original post, if we put it in the phy binding we'll be > > updating the generic phy binding. We'll then need an api added into the > > generic phy framework to fetch the width of a phy. > > > > Both cases are doable and trivial, we just need the canonical decision > > from a DT maintainer as to where the property belongs. Given that they > > are in ARM ksummit, I'm not expecting to hear anything right this > > moment. :) > > The host can support both, so it is not a property of the host and is a > property of the phy. It is no different than what mode a SPI slave > requires or whether an i2c slave supports 8 or 10-bit addressing. Those > examples are all 1 to many rather than 1 to 1 where it doesn't really > matter, but the same logic applies. Makes good sense, thanks. In this case, given the PHY ownership of width, we can completely avoid any DT properties. The generic phy compliant BCM Kona phy driver can report via the generic phy framework that it is 8-bit wide. There's no support for this type of thing now but it's pretty trivial to add. I went ahead and did a quick proof-of-concept that adds a free-form phy attributes struct for the generic phy. Given that generic phys can be for any transmission technology this could be filled with a jumble unrelated and often unpopulated attributes over time. In any case, the below patch allows the phy provider to choose to specify utmi_width and a controller driver that cares can use phy_get_attrs() to fetch the optional phy attributes and use the utmi_width field if applicable. Kishon: I'll start a separate thread to discuss what approach you'd like to see in the generic phy framework to manage this. -Matt diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 6d72269..b763d7b 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -38,6 +38,14 @@ struct phy_ops { }; /** + * struct phy_attrs - represents phy attributes + * @utmi_width: Data path width implemented by UTMI PHY + */ +struct phy_attrs { + int utmi_width; +}; + +/** * struct phy - represents the phy device * @dev: phy device * @id: id of the phy device @@ -51,6 +59,7 @@ struct phy { struct device dev; int id; const struct phy_ops *ops; + struct phy_attrs *attrs; struct phy_init_data *init_data; struct mutex mutex; int init_count; @@ -127,6 +136,9 @@ int phy_init(struct phy *phy); int phy_exit(struct phy *phy); int phy_power_on(struct phy *phy); int phy_power_off(struct phy *phy); +static inline struct phy_attrs *phy_get_attrs(struct phy *phy) { + return phy->attrs; +}; struct phy *phy_get(struct device *dev, const char *string); struct phy *devm_phy_get(struct device *dev, const char *string); void phy_put(struct phy *phy);