From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933627Ab3GWQ3j (ORCPT ); Tue, 23 Jul 2013 12:29:39 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:45574 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932595Ab3GWQ3f (ORCPT ); Tue, 23 Jul 2013 12:29:35 -0400 Message-ID: <51EEAF32.4040905@ti.com> Date: Tue, 23 Jul 2013 21:58:34 +0530 From: Kishon Vijay Abraham I User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: Greg KH CC: Alan Stern , Tomasz Figa , Laurent Pinchart , , Sylwester Nawrocki , Sascha Hauer , , , , , , , , , , , , , , , , , , , , , , , , Stephen Warren , , Daniel Lezcano Subject: Re: [PATCH 01/15] drivers: phy: add generic PHY framework References: <51EE9EC0.6060905@ti.com> <20130723161846.GD2486@kroah.com> In-Reply-To: <20130723161846.GD2486@kroah.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, On Tuesday 23 July 2013 09:48 PM, Greg KH wrote: > On Tue, Jul 23, 2013 at 08:48:24PM +0530, Kishon Vijay Abraham I wrote: >> Hi, >> >> On Tuesday 23 July 2013 08:07 PM, Alan Stern wrote: >>> On Tue, 23 Jul 2013, Tomasz Figa wrote: >>> >>>> On Tuesday 23 of July 2013 09:29:32 Tomasz Figa wrote: >>>>> Hi Alan, >>> >>> Thanks for helping to clarify the issues here. >>> >>>>>> Okay. Are PHYs _always_ platform devices? >>>>> >>>>> They can be i2c, spi or any other device types as well. >>> >>> In those other cases, presumably there is no platform data associated >>> with the PHY since it isn't a platform device. Then how does the >>> kernel know which controller is attached to the PHY? Is this spelled >>> out in platform data associated with the PHY's i2c/spi/whatever parent? . . . . >> >> static struct phy *phy_lookup(void *priv) { >> . >> . >> if (phy->priv==priv) //instead of string comparison, we'll use pointer >> return phy; >> } >> >> PHY driver should be like >> phy_create((dev, ops, pdata->info); >> >> The controller driver would do >> phy_get(dev, NULL, pdata->info); >> >> Now the PHY framework will check for a match of *priv* pointer and return the PHY. >> >> I think this should be possible? > > Ick, no. Why can't you just pass the pointer to the phy itself? If you > had a "priv" pointer to search from, then you could have just passed the > original phy pointer in the first place, right? > > The issue is that a string "name" is not going to scale at all, as it > requires hard-coded information that will change over time (as the > existing clock interface is already showing.) > > Please just pass the real "phy" pointer around, that's what it is there > for. Your "board binding" logic/code should be able to handle this, as > it somehow was going to do the same thing with a "name". The problem is the board file won't have the *phy* pointer. *phy* pointer is created at a much later time when the phy driver is probed. Thanks Kishon From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kishon Vijay Abraham I Date: Tue, 23 Jul 2013 16:40:34 +0000 Subject: Re: [PATCH 01/15] drivers: phy: add generic PHY framework Message-Id: <51EEAF32.4040905@ti.com> List-Id: References: <51EE9EC0.6060905@ti.com> <20130723161846.GD2486@kroah.com> In-Reply-To: <20130723161846.GD2486@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-arm-kernel@lists.infradead.org Hi Greg, On Tuesday 23 July 2013 09:48 PM, Greg KH wrote: > On Tue, Jul 23, 2013 at 08:48:24PM +0530, Kishon Vijay Abraham I wrote: >> Hi, >> >> On Tuesday 23 July 2013 08:07 PM, Alan Stern wrote: >>> On Tue, 23 Jul 2013, Tomasz Figa wrote: >>> >>>> On Tuesday 23 of July 2013 09:29:32 Tomasz Figa wrote: >>>>> Hi Alan, >>> >>> Thanks for helping to clarify the issues here. >>> >>>>>> Okay. Are PHYs _always_ platform devices? >>>>> >>>>> They can be i2c, spi or any other device types as well. >>> >>> In those other cases, presumably there is no platform data associated >>> with the PHY since it isn't a platform device. Then how does the >>> kernel know which controller is attached to the PHY? Is this spelled >>> out in platform data associated with the PHY's i2c/spi/whatever parent? . . . . >> >> static struct phy *phy_lookup(void *priv) { >> . >> . >> if (phy->priv=priv) //instead of string comparison, we'll use pointer >> return phy; >> } >> >> PHY driver should be like >> phy_create((dev, ops, pdata->info); >> >> The controller driver would do >> phy_get(dev, NULL, pdata->info); >> >> Now the PHY framework will check for a match of *priv* pointer and return the PHY. >> >> I think this should be possible? > > Ick, no. Why can't you just pass the pointer to the phy itself? If you > had a "priv" pointer to search from, then you could have just passed the > original phy pointer in the first place, right? > > The issue is that a string "name" is not going to scale at all, as it > requires hard-coded information that will change over time (as the > existing clock interface is already showing.) > > Please just pass the real "phy" pointer around, that's what it is there > for. Your "board binding" logic/code should be able to handle this, as > it somehow was going to do the same thing with a "name". The problem is the board file won't have the *phy* pointer. *phy* pointer is created at a much later time when the phy driver is probed. Thanks Kishon From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kishon Vijay Abraham I Subject: Re: [PATCH 01/15] drivers: phy: add generic PHY framework Date: Tue, 23 Jul 2013 21:58:34 +0530 Message-ID: <51EEAF32.4040905@ti.com> References: <51EE9EC0.6060905@ti.com> <20130723161846.GD2486@kroah.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20130723161846.GD2486@kroah.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Greg KH Cc: linux-fbdev@vger.kernel.org, Daniel Lezcano , linux-doc@vger.kernel.org, tony@atomide.com, nsekhar@ti.com, Tomasz Figa , Laurent Pinchart , s.nawrocki@samsung.com, kgene.kim@samsung.com, swarren@nvidia.com, jg1.han@samsung.com, Alan Stern , grant.likely@linaro.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, george.cherian@ti.com, arnd@arndb.de, Stephen Warren , b.zolnierkie@samsung.com, Sascha Hauer , linux-samsung-soc@vger.kernel.org, Sylwester Nawrocki , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, balajitk@ti.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, balbi@ti.com, kyungmin.park@samsung.com, broonie@kernel.org, olof@lixom.neta List-Id: linux-omap@vger.kernel.org Hi Greg, On Tuesday 23 July 2013 09:48 PM, Greg KH wrote: > On Tue, Jul 23, 2013 at 08:48:24PM +0530, Kishon Vijay Abraham I wrote: >> Hi, >> >> On Tuesday 23 July 2013 08:07 PM, Alan Stern wrote: >>> On Tue, 23 Jul 2013, Tomasz Figa wrote: >>> >>>> On Tuesday 23 of July 2013 09:29:32 Tomasz Figa wrote: >>>>> Hi Alan, >>> >>> Thanks for helping to clarify the issues here. >>> >>>>>> Okay. Are PHYs _always_ platform devices? >>>>> >>>>> They can be i2c, spi or any other device types as well. >>> >>> In those other cases, presumably there is no platform data associated >>> with the PHY since it isn't a platform device. Then how does the >>> kernel know which controller is attached to the PHY? Is this spelled >>> out in platform data associated with the PHY's i2c/spi/whatever parent? . . . . >> >> static struct phy *phy_lookup(void *priv) { >> . >> . >> if (phy->priv==priv) //instead of string comparison, we'll use pointer >> return phy; >> } >> >> PHY driver should be like >> phy_create((dev, ops, pdata->info); >> >> The controller driver would do >> phy_get(dev, NULL, pdata->info); >> >> Now the PHY framework will check for a match of *priv* pointer and return the PHY. >> >> I think this should be possible? > > Ick, no. Why can't you just pass the pointer to the phy itself? If you > had a "priv" pointer to search from, then you could have just passed the > original phy pointer in the first place, right? > > The issue is that a string "name" is not going to scale at all, as it > requires hard-coded information that will change over time (as the > existing clock interface is already showing.) > > Please just pass the real "phy" pointer around, that's what it is there > for. Your "board binding" logic/code should be able to handle this, as > it somehow was going to do the same thing with a "name". The problem is the board file won't have the *phy* pointer. *phy* pointer is created at a much later time when the phy driver is probed. Thanks Kishon From mboxrd@z Thu Jan 1 00:00:00 1970 From: kishon@ti.com (Kishon Vijay Abraham I) Date: Tue, 23 Jul 2013 21:58:34 +0530 Subject: [PATCH 01/15] drivers: phy: add generic PHY framework In-Reply-To: <20130723161846.GD2486@kroah.com> References: <51EE9EC0.6060905@ti.com> <20130723161846.GD2486@kroah.com> Message-ID: <51EEAF32.4040905@ti.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Greg, On Tuesday 23 July 2013 09:48 PM, Greg KH wrote: > On Tue, Jul 23, 2013 at 08:48:24PM +0530, Kishon Vijay Abraham I wrote: >> Hi, >> >> On Tuesday 23 July 2013 08:07 PM, Alan Stern wrote: >>> On Tue, 23 Jul 2013, Tomasz Figa wrote: >>> >>>> On Tuesday 23 of July 2013 09:29:32 Tomasz Figa wrote: >>>>> Hi Alan, >>> >>> Thanks for helping to clarify the issues here. >>> >>>>>> Okay. Are PHYs _always_ platform devices? >>>>> >>>>> They can be i2c, spi or any other device types as well. >>> >>> In those other cases, presumably there is no platform data associated >>> with the PHY since it isn't a platform device. Then how does the >>> kernel know which controller is attached to the PHY? Is this spelled >>> out in platform data associated with the PHY's i2c/spi/whatever parent? . . . . >> >> static struct phy *phy_lookup(void *priv) { >> . >> . >> if (phy->priv==priv) //instead of string comparison, we'll use pointer >> return phy; >> } >> >> PHY driver should be like >> phy_create((dev, ops, pdata->info); >> >> The controller driver would do >> phy_get(dev, NULL, pdata->info); >> >> Now the PHY framework will check for a match of *priv* pointer and return the PHY. >> >> I think this should be possible? > > Ick, no. Why can't you just pass the pointer to the phy itself? If you > had a "priv" pointer to search from, then you could have just passed the > original phy pointer in the first place, right? > > The issue is that a string "name" is not going to scale at all, as it > requires hard-coded information that will change over time (as the > existing clock interface is already showing.) > > Please just pass the real "phy" pointer around, that's what it is there > for. Your "board binding" logic/code should be able to handle this, as > it somehow was going to do the same thing with a "name". The problem is the board file won't have the *phy* pointer. *phy* pointer is created at a much later time when the phy driver is probed. Thanks Kishon