USB: PHY: Re-organize Tegra USB PHY driver
Subsystems (3)
PATCH RESEND v3 1/1 USB: PHY: Re-organize Tegra USB PHY driver
NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc. In order to support USB PHY drivers on these SoCs, existing PHY driver is split into SoC agnostic common USB PHY driver and Tegra20-specific USB phy driver. This will facilitate easy addition and deletion of phy drivers for Tegra SoCs.
---
delta from v3 resend:
For unknown reasons, email-id in signed-off-by got corrupted. Hence re-sending the patch, after fixing it.
delta from v3:
Rebased the v3 changes on top of xceiv branch.
delta from v2:
Added an if condition to check for device_node to be not NULL, before dereferencing it.
drivers/usb/host/ehci-tegra.c | 20 +-
drivers/usb/phy/Makefile | 1 +
.../usb/phy/{tegra_usb_phy.c => tegra2_usb_phy.c} | 372 ++---------
drivers/usb/phy/tegra2_usb_phy.h | 178 +++++
drivers/usb/phy/tegra_usb_phy.c | 725 +-------------------
include/linux/usb/tegra_usb_phy.h | 34 +-
6 files changed, 304 insertions(+), 1026 deletions(-)
copy drivers/usb/phy/{tegra_usb_phy.c => tegra2_usb_phy.c} (57%)
create mode 100644 drivers/usb/phy/tegra2_usb_phy.hdrivers/usb/host/ehci-tegra.c +18 -2
@@ -618,6 +618,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)int err =0 ;int irq;int instance = pdev->id; +struct device_node *np = pdev->dev.of_node; +struct phy_params params; +int phy_type; pdata = pdev->dev.platform_data;if (!pdata) {
@@ -706,9 +709,22 @@ static int tegra_ehci_probe(struct platform_device *pdev) } } + phy_type =of_property_match_string (np,"phy_type" ,"utmi" ); +if (phy_type >=0 ) + params.type =TEGRA_USB_PHY_TYPE_UTMI ; +else { + phy_type =of_property_match_string (np,"phy_type" ,"ulpi" ); +if (phy_type >=0 ) + params.type =TEGRA_USB_PHY_TYPE_ULPI ; +else + params.type =TEGRA_USB_PHY_TYPE_INVALID ; + } + + params.mode =TEGRA_USB_PHY_MODE_HOST ; + params.config = pdata->phy_config; + tegra->phy =tegra_usb_phy_open (&pdev->dev, instance, hcd->regs, - pdata->phy_config, -TEGRA_USB_PHY_MODE_HOST ); + ¶ms);if (IS_ERR (tegra->phy)) {dev_err (&pdev->dev,"Failed to open USB phy\n" ); err = -ENXIO ;
drivers/usb/phy/Makefile +1 -0
@@ -8,3 +8,4 @@ obj-$(CONFIG_OMAP_USB2) += omap-usb2.o obj-$(CONFIG_USB_ISP1301) += isp1301.o obj-$(CONFIG_MV_U3D_PHY) += mv_u3d_phy.o obj-$(CONFIG_USB_EHCI_TEGRA) += tegra_usb_phy.o +obj-$(CONFIG_USB_EHCI_TEGRA) += tegra2_usb_phy.o
drivers/usb/phy/tegra2_usb_phy.c renamed from drivers/usb/phy/tegra_usb_phy.c +46 -326
528 lines not on this page · raw message
drivers/usb/phy/tegra2_usb_phy.h new file +178 -0
178 lines not on this page · raw message
drivers/usb/phy/tegra_usb_phy.c +32 -693
801 lines not on this page · raw message
include/linux/usb/tegra_usb_phy.h +29 -5
@@ -44,8 +44,34 @@ enum tegra_usb_phy_mode { TEGRA_USB_PHY_MODE_HOST, }; +enum tegra_usb_phy_type { +TEGRA_USB_PHY_TYPE_UTMI =0 , +TEGRA_USB_PHY_TYPE_ULPI , +TEGRA_USB_PHY_TYPE_INVALID , +}; + +struct tegra_usb_phy ; + +struct usb_phy_ops { +int (*open)(struct tegra_usb_phy *phy); +void (*close)(struct tegra_usb_phy *phy); +int (*power_on)(struct tegra_usb_phy *phy); +int (*power_off)(struct tegra_usb_phy *phy); +void (*preresume)(struct tegra_usb_phy *phy); +void (*postresume)(struct tegra_usb_phy *phy); +void (*restore_start)(struct tegra_usb_phy *phy, +enum tegra_usb_phy_port_speed port_speed); +void (*restore_end)(struct tegra_usb_phy *phy); +}; +struct tegra_xtal_freq ; +struct phy_params { +void *config; +enum tegra_usb_phy_mode mode; +enum tegra_usb_phy_type type; +}; +struct tegra_usb_phy {int instance;const struct tegra_xtal_freq *freq;
@@ -58,15 +84,13 @@ struct tegra_usb_phy {void *config;struct usb_phy *ulpi;struct usb_phy u_phy; +struct usb_phy_ops ops; +enum tegra_usb_phy_type type;struct device *dev; };struct tegra_usb_phy *tegra_usb_phy_open (struct device *dev,int instance, -void __iomem *regs,void *config,enum tegra_usb_phy_mode phy_mode); - -void tegra_usb_phy_clk_disable (struct tegra_usb_phy *phy); - -void tegra_usb_phy_clk_enable (struct tegra_usb_phy *phy); +void __iomem *regs,struct phy_params *params);void tegra_usb_phy_preresume (struct tegra_usb_phy *phy);
Signature · 1 line
1.7.0.4
Quoted 12 lines · Venu Byravarasu
NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc. In order to support USB PHY drivers on these SoCs, existing PHY driver is split into SoC agnostic common USB PHY driver and Tegra20-specific USB phy driver. This will facilitate easy addition and deletion of phy drivers for Tegra SoCs.
Signed-off-by Venu Byravarasu <[email protected]>---
delta from v3 resend:
For unknown reasons, email-id in signed-off-by got corrupted. Hence re-sending the patch, after fixing it.
Quoted 6 lines
delta from v3:
Rebased the v3 changes on top of xceiv branch.delta from v2:
Added an if condition to check fordevice_nodeto be not NULL, before dereferencing it.
For the changes to drivers/usb/host/ehci-tegra.c:
Hi,
Quoted 7 lines · Venu Byravarasu
NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc. In order to support USB PHY drivers on these SoCs, existing PHY driver is split into SoC agnostic common USB PHY driver and Tegra20-specific USB phy driver. This will facilitate easy addition and deletion of phy drivers for Tegra SoCs.
Signed-off-by Venu Byravarasu <[email protected]>
I was reading this "driver" more closely and I have a bunch of questions about it, but the most important of all of them is: "why isn't that a real PHY driver ?". It doesn't have a probe() function, it doesn't use struct usb_phy to represent the PHY, it has a bunch of tegra-specific APIs and we can't let those continue.
Please, take a look at drivers/usb/phy/omap_usb2.c (misnamed actually, should be phy-omap-usb2.c so we have a common prefix) to see how your PHY driver should look like and which sort of functionality if should expose to the rest of the kernel.
Please comment on the above.
cheers
Signature · 1 line
balbi
Quoted 9 lines · Felipe Balbi
Hi,
Quoted 6 lines · Venu Byravarasu
NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc. In order to support USB PHY drivers on these SoCs, existing PHY driver is split into SoC agnostic common USB PHY driver and Tegra20-specific USB phy driver. This will facilitate easy addition and deletion of phy drivers for Tegra SoCs.
Quoted 8 lines
Quoted 1 line
Signed-off-by Venu Byravarasu <[email protected]>I was reading this "driver" more closely and I have a bunch of questions about it, but the most important of all of them is: "why isn't that a real PHY driver ?". It doesn't have a
probe()function, it doesn't use structusb_phyto represent the PHY, it has a bunch of tegra-specific APIs and we can't let those continue.
One question here: If the PHY "driver" API changes, there will need to be a bunch of ehci-tegra.c changes too. Will you take all those through the PHY tree? If you expect to do that, then I'd like to request you also take:
usb: host: tegra remove include of <mach/iomap.h>
http://www.spinics.net/lists/linux-usb/msg72429.html
... since that should get merged before any large changes to ehci-tegra.c; it's the EHCI equivalent of the PHY patch you already merged.
(The same request applies to put that into a branch I can pull into the Tegra tree as a basis for cleanup in the Tegra tree)
Thanks!
Hi,
Quoted 19 lines · Stephen Warren
Quoted 9 lines · Felipe Balbi
Hi,
Quoted 6 lines · Venu Byravarasu
NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc. In order to support USB PHY drivers on these SoCs, existing PHY driver is split into SoC agnostic common USB PHY driver and Tegra20-specific USB phy driver. This will facilitate easy addition and deletion of phy drivers for Tegra SoCs.
Quoted 8 lines
Quoted 1 line
Signed-off-by Venu Byravarasu <[email protected]>I was reading this "driver" more closely and I have a bunch of questions about it, but the most important of all of them is: "why isn't that a real PHY driver ?". It doesn't have a
probe()function, it doesn't use structusb_phyto represent the PHY, it has a bunch of tegra-specific APIs and we can't let those continue.
Quoted 2 lines
One question here: If the PHY "driver" API changes, there will need to be a bunch of
ehci-tegra.cchanges too. Will you take all those
hmm.. indeed.
Quoted 1 line
through the PHY tree? If you expect to do that, then I'd like to
I can take those if Alan is ok with it :-) Alan ?
Quoted 11 lines
request you also take:
usb: host: tegra remove include of <
mach/iomap.h>
http://www.spinics.net/lists/linux-usb/msg72429.html... since that should get merged before any large changes to
ehci-tegra.c; it's the EHCI equivalent of the PHY patch you already merged.(The same request applies to put that into a branch I can pull into the Tegra tree as a basis for cleanup in the Tegra tree)
sure, that should be simple enough to do ;-)
Signature · 1 line
balbi
Quoted 22 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Friday, October 19, 2012 9:06 PM
To: Venu Byravarasu
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 resend] USB: PHY: Re-organize Tegra USB PHY driver* PGP Signed by an unknown key
Hi,
Quoted 1 line · Venu Byravarasu
NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
I was reading this "driver" more closely and I have a bunch of questions about it, but the most important of all of them is: "why isn't that a real PHY driver ?". It doesn't have a
probe()function, it doesn't use structusb_phyto represent the PHY, it has a bunch of tegra-specific APIs and we can't let those continue.
Quoted 4 lines
Please, take a look at
drivers/usb/phy/omap_usb2.c(misnamed actually, should bephy-omap-usb2.cso we have a common prefix) to see how your PHY driver should look like and which sort of functionality if should expose to the rest of the kernel.
Hi Felipe,
I'll go through omap phy driver and prepare similar patches for tegra phy driver and push them with upcoming patches.
As current patch is mostly re-organizing the existing phy driver, can you plz merge This as is?
Thanks,
Venu
Quoted 10 lines
Please comment on the above.
cheers
--
balbi* Unknown Key
*0x35CAA444
Hi,
Quoted 26 lines · Venu Byravarasu
Quoted 21 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Friday, October 19, 2012 9:06 PM
To: Venu Byravarasu
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 resend] USB: PHY: Re-organize Tegra USB PHY driver* PGP Signed by an unknown key
Hi,
Quoted 1 line · Venu Byravarasu
NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
I was reading this "driver" more closely and I have a bunch of questions about it, but the most important of all of them is: "why isn't that a real PHY driver ?". It doesn't have a
probe()function, it doesn't use structusb_phyto represent the PHY, it has a bunch of tegra-specific APIs and we can't let those continue.Quoted 4 lines
Please, take a look at
drivers/usb/phy/omap_usb2.c(misnamed actually, should bephy-omap-usb2.cso we have a common prefix) to see how your PHY driver should look like and which sort of functionality if should expose to the rest of the kernel.
Quoted 6 lines
Hi Felipe,
I'll go through omap phy driver and prepare similar patches for tegra phy driver and push them with upcoming patches.
As current patch is mostly re-organizing the existing phy driver, can you plz merge This as is?
I would have to convince me about the need for that (and I'm open to be convinced ;-), because if a later series of patches will come getting rid of the current driver and turning it into a real PHY driver, I don't see the benefit of taking $SUBJECT.
Signature · 1 line
balbi
Quoted 49 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Monday, October 22, 2012 3:33 PM
To: Venu Byravarasu
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3 resend] USB: PHY: Re-organize Tegra USB PHY driver* PGP Signed by an unknown key
Hi,
Quoted 7 lines · Venu Byravarasu
Quoted 7 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Friday, October 19, 2012 9:06 PM
To: Venu Byravarasu
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 resend] USB: PHY: Re-organize Tegra USB PHYdriver
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Old Signed by an unknown key
Hi,
Quoted 1 line · Venu Byravarasu
NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
Quoted 8 lines
Quoted 8 lines
I was reading this "driver" more closely and I have a bunch of questions about it, but the most important of all of them is: "why isn't that a real PHY driver ?". It doesn't have a
probe()function, it doesn't use structusb_phyto represent the PHY, it has a bunch of tegra-specific APIs and we can't let those continue.Please, take a look at
drivers/usb/phy/omap_usb2.c(misnamed actually, should bephy-omap-usb2.cso we have a common prefix) to see howyour
Quoted 9 lines
Quoted 2 lines
PHY driver should look like and which sort of functionality if should expose to the rest of the kernel.
Hi Felipe,
I'll go through omap phy driver and prepare similar patches for tegra phy driver and push them with upcoming patches.
As current patch is mostly re-organizing the existing phy driver, can you plz merge This as is?
Quoted 5 lines
I would have to convince me about the need for that (and I'm open to be convinced ;-), because if a later series of patches will come getting rid of the current driver and turning it into a real PHY driver, I don't see the benefit of taking $SUBJECT.
Hi Felipe,
The current patch splits out the existing tegra USB phy driver into two parts, as you would have already noticed from the code.
The probe and etc changes that you asked to add, will be applicable to common Phy driver and should not have any implications on SOC dependent phy driver. Hence once this patch gets merged, it will be easier for me to modify SOC agnostic common phy driver in the way you suggested.
Thanks,
Venu
Quoted 5 lines
--
balbi* Unknown Key
*0x35CAA444
Hi,
Quoted 55 lines · Venu Byravarasu
Quoted 49 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Monday, October 22, 2012 3:33 PM
To: Venu Byravarasu
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3 resend] USB: PHY: Re-organize Tegra USB PHY driver* PGP Signed by an unknown key
Hi,
Quoted 7 lines · Venu Byravarasu
Quoted 7 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Friday, October 19, 2012 9:06 PM
To: Venu Byravarasu
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 resend] USB: PHY: Re-organize Tegra USB PHYdriver
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Old Signed by an unknown key
Hi,
Quoted 1 line · Venu Byravarasu
NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc.
Quoted 8 lines
Quoted 8 lines
I was reading this "driver" more closely and I have a bunch of questions about it, but the most important of all of them is: "why isn't that a real PHY driver ?". It doesn't have a
probe()function, it doesn't use structusb_phyto represent the PHY, it has a bunch of tegra-specific APIs and we can't let those continue.Please, take a look at
drivers/usb/phy/omap_usb2.c(misnamed actually, should bephy-omap-usb2.cso we have a common prefix) to see howyour
Quoted 9 lines
Quoted 2 lines
PHY driver should look like and which sort of functionality if should expose to the rest of the kernel.
Hi Felipe,
I'll go through omap phy driver and prepare similar patches for tegra phy driver and push them with upcoming patches.
As current patch is mostly re-organizing the existing phy driver, can you plz merge This as is?Quoted 5 lines
I would have to convince me about the need for that (and I'm open to be convinced ;-), because if a later series of patches will come getting rid of the current driver and turning it into a real PHY driver, I don't see the benefit of taking $SUBJECT.
Quoted 6 lines
Hi Felipe,
The current patch splits out the existing tegra USB phy driver into two parts, as you would have already noticed from the code.
The probe and etc changes that you asked to add, will be applicable to common Phy driver and should not have any implications on SOC dependent phy driver.
what is this SOC dependent PHY driver ? What sort of dependencies are there ? Those differences should be handled with runtime checks.
Signature · 1 line
balbi
Quoted 17 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Monday, October 22, 2012 3:46 PM
To: Venu Byravarasu
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v3 resend] USB: PHY: Re-organize Tegra USB PHY driver* PGP Signed by an unknown key
Hi,
Quoted 4 lines
Hi Felipe,
The current patch splits out the existing tegra USB phy driver into two parts,
Quoted 8 lines
as
Quoted 2 lines
you would have already noticed from the code.
The probe and etc changes that you asked to add, will be applicable tocommon
Quoted 1 line
Phy driver and should not have any implications on SOC dependent phy
driver.
what is this SOC dependent PHY driver ?
SOC dependent PHY driver actually deals with the PHY interface programming. e.g. please see code present in tegra2_usb_driver.c.
Quoted 2 lines
What sort of dependencies are
there ? Those differences should be handled with runtime checks.
As PHY related bugs got fixed across different set of SOCs apart from adding few features, wanted to separate this out from common PHY functionality. This will help us in adding support for different SOCs with minimum set of changes.
Quoted 5 lines
--
balbi* Unknown Key
*0x35CAA444
Alan Stern
maintainerQuoted 22 lines · Felipe Balbi
Hi,
Quoted 19 lines · Stephen Warren
Quoted 17 lines · Felipe Balbi
Hi,
Quoted 7 lines · Venu Byravarasu
NVIDIA produces several Tegra SoCs viz Tegra20, Tegra30 etc. In order to support USB PHY drivers on these SoCs, existing PHY driver is split into SoC agnostic common USB PHY driver and Tegra20-specific USB phy driver. This will facilitate easy addition and deletion of phy drivers for Tegra SoCs.
Signed-off-by Venu Byravarasu <[email protected]>I was reading this "driver" more closely and I have a bunch of questions about it, but the most important of all of them is: "why isn't that a real PHY driver ?". It doesn't have a
probe()function, it doesn't use structusb_phyto represent the PHY, it has a bunch of tegra-specific APIs and we can't let those continue.
Quoted 8 lines
Quoted 2 lines
One question here: If the PHY "driver" API changes, there will need to be a bunch of
ehci-tegra.cchanges too. Will you take all thosehmm.. indeed.
Quoted 1 line
through the PHY tree? If you expect to do that, then I'd like to
I can take those if Alan is ok with it :-) Alan ?
I don't mind a bit. It's kind of difficult for me to review changes to the platform-specific parts of the these drivers, anyway. I have no way to test them and I'm not familiar with the interfaces involved.
Alan Stern
Quoted 15 lines
-----Original Message-----
From: Venu Byravarasu
Sent: Monday, October 22, 2012 4:04 PM
To: '[email protected]'
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: RE: [PATCH v3 resend] USB: PHY: Re-organize Tegra USB PHY driverQuoted 2 lines
what is this SOC dependent PHY driver ?
SOC dependent PHY driver actually deals with the PHY interface programming.
e.g. please see code present integra2_usb_driver.c.
Quoted 7 lines
Quoted 2 lines
What sort of dependencies are
there ? Those differences should be handled with runtime checks.As PHY related bugs got fixed across different set of SOCs apart from adding few features, wanted to separate this out from common PHY functionality. This will help us in adding support for different SOCs with minimum set of changes.
Felipe,
Please let me know if you have any more questions on this patch. If not, can you please merge this?
Thanks,
Venu
Quoted 6 lines
Quoted 6 lines
--
balbi* Unknown Key
*0x35CAA444
Hi,
Quoted 23 lines · Venu Byravarasu
Quoted 15 lines
-----Original Message-----
From: Venu Byravarasu
Sent: Monday, October 22, 2012 4:04 PM
To: '[email protected]'
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: RE: [PATCH v3 resend] USB: PHY: Re-organize Tegra USB PHY driverQuoted 2 lines
what is this SOC dependent PHY driver ?
SOC dependent PHY driver actually deals with the PHY interface programming.
e.g. please see code present integra2_usb_driver.c.Quoted 7 lines
Quoted 2 lines
What sort of dependencies are
there ? Those differences should be handled with runtime checks.As PHY related bugs got fixed across different set of SOCs apart from adding few features, wanted to separate this out from common PHY functionality. This will help us in adding support for different SOCs with minimum set of changes.
Quoted 4 lines
Felipe,
Please let me know if you have any more questions on this patch. If not, can you please merge this?
Like I said before, those differences should be handled by runtime checks, you shouldn't need separate files for that. What you need to do is implement a single PHY driver which can handle all tegras known to date, later you can add support for new tegras by patching a few things here and there.
Signature · 1 line
balbi