Message ID | 1352888836-17192-3-git-send-email-p.paneri@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Praveen, On Wednesday 14 of November 2012 15:57:16 Praveen Paneri wrote: > Adding the transceiver to hsotg driver. Keeping the platform data > for continuing the smooth operation for boards which still uses it > > Signed-off-by: Praveen Paneri <p.paneri@samsung.com> > Acked-by: Kyungmin Park <kyungmin.park@samsung.com> > --- > drivers/usb/gadget/s3c-hsotg.c | 37 > +++++++++++++++++++++++++++---------- 1 files changed, 27 > insertions(+), 10 deletions(-) > > diff --git a/drivers/usb/gadget/s3c-hsotg.c > b/drivers/usb/gadget/s3c-hsotg.c index 6f696ee..bc30a2d 100644 > --- a/drivers/usb/gadget/s3c-hsotg.c > +++ b/drivers/usb/gadget/s3c-hsotg.c > @@ -32,6 +32,7 @@ > > #include <linux/usb/ch9.h> > #include <linux/usb/gadget.h> > +#include <linux/usb/phy.h> > #include <linux/platform_data/s3c-hsotg.h> > > #include <mach/map.h> > @@ -133,7 +134,9 @@ struct s3c_hsotg_ep { > * struct s3c_hsotg - driver state. > * @dev: The parent device supplied to the probe function > * @driver: USB gadget driver > - * @plat: The platform specific configuration data. > + * @phy: The otg phy transceiver structure for phy control. > + * @plat: The platform specific configuration data. This can be removed > once + * all SoCs support usb transceiver. > * @regs: The memory area mapped for accessing registers. > * @irq: The IRQ number we are using > * @supplies: Definition of USB power supplies > @@ -153,6 +156,7 @@ struct s3c_hsotg_ep { > struct s3c_hsotg { > struct device *dev; > struct usb_gadget_driver *driver; > + struct usb_phy *phy; > struct s3c_hsotg_plat *plat; > > spinlock_t lock; > @@ -2854,7 +2858,10 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg > *hsotg) struct platform_device *pdev = to_platform_device(hsotg->dev); > > dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev); > - if (hsotg->plat->phy_init) > + > + if (hsotg->phy) > + usb_phy_init(hsotg->phy); > + else if (hsotg->plat->phy_init) > hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); > } > > @@ -2869,7 +2876,9 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg > *hsotg) { > struct platform_device *pdev = to_platform_device(hsotg->dev); > > - if (hsotg->plat->phy_exit) > + if (hsotg->phy) > + usb_phy_shutdown(hsotg->phy); > + else if (hsotg->plat->phy_exit) > hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); > } > > @@ -3493,6 +3502,7 @@ static void s3c_hsotg_release(struct device *dev) > static int __devinit s3c_hsotg_probe(struct platform_device *pdev) > { > struct s3c_hsotg_plat *plat = pdev->dev.platform_data; > + struct usb_phy *phy; > struct device *dev = &pdev->dev; > struct s3c_hsotg_ep *eps; > struct s3c_hsotg *hsotg; > @@ -3501,20 +3511,27 @@ static int __devinit s3c_hsotg_probe(struct > platform_device *pdev) int ret; > int i; > > - plat = pdev->dev.platform_data; > - if (!plat) { > - dev_err(&pdev->dev, "no platform data defined\n"); > - return -EINVAL; > - } > - > hsotg = devm_kzalloc(&pdev->dev, sizeof(struct s3c_hsotg), > GFP_KERNEL); if (!hsotg) { > dev_err(dev, "cannot get memory\n"); > return -ENOMEM; > } > > + phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); > + if (IS_ERR_OR_NULL(phy)) { > + /* Fallback for pdata */ > + plat = pdev->dev.platform_data; > + if (!plat) { > + dev_err(&pdev->dev, "no platform data or transceiver defined\n"); > + return -EPROBE_DEFER; > + } else { > + hsotg->plat = plat; > + } nitpick: The hsotg->plat = plat; assignment can be made without the else statement as well. Best regards, Tomasz Figa
On Thu, Nov 22, 2012 at 1:41 AM, Tomasz Figa <tomasz.figa@gmail.com> wrote: > Hi Praveen, > > On Wednesday 14 of November 2012 15:57:16 Praveen Paneri wrote: >> Adding the transceiver to hsotg driver. Keeping the platform data >> for continuing the smooth operation for boards which still uses it >> >> Signed-off-by: Praveen Paneri <p.paneri@samsung.com> >> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> >> --- >> drivers/usb/gadget/s3c-hsotg.c | 37 >> +++++++++++++++++++++++++++---------- 1 files changed, 27 >> insertions(+), 10 deletions(-) >> >> diff --git a/drivers/usb/gadget/s3c-hsotg.c >> b/drivers/usb/gadget/s3c-hsotg.c index 6f696ee..bc30a2d 100644 >> --- a/drivers/usb/gadget/s3c-hsotg.c >> +++ b/drivers/usb/gadget/s3c-hsotg.c >> @@ -32,6 +32,7 @@ >> >> #include <linux/usb/ch9.h> >> #include <linux/usb/gadget.h> >> +#include <linux/usb/phy.h> >> #include <linux/platform_data/s3c-hsotg.h> >> >> #include <mach/map.h> >> @@ -133,7 +134,9 @@ struct s3c_hsotg_ep { >> * struct s3c_hsotg - driver state. >> * @dev: The parent device supplied to the probe function >> * @driver: USB gadget driver >> - * @plat: The platform specific configuration data. >> + * @phy: The otg phy transceiver structure for phy control. >> + * @plat: The platform specific configuration data. This can be removed >> once + * all SoCs support usb transceiver. >> * @regs: The memory area mapped for accessing registers. >> * @irq: The IRQ number we are using >> * @supplies: Definition of USB power supplies >> @@ -153,6 +156,7 @@ struct s3c_hsotg_ep { >> struct s3c_hsotg { >> struct device *dev; >> struct usb_gadget_driver *driver; >> + struct usb_phy *phy; >> struct s3c_hsotg_plat *plat; >> >> spinlock_t lock; >> @@ -2854,7 +2858,10 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg >> *hsotg) struct platform_device *pdev = to_platform_device(hsotg->dev); >> >> dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev); >> - if (hsotg->plat->phy_init) >> + >> + if (hsotg->phy) >> + usb_phy_init(hsotg->phy); >> + else if (hsotg->plat->phy_init) >> hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); >> } >> >> @@ -2869,7 +2876,9 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg >> *hsotg) { >> struct platform_device *pdev = to_platform_device(hsotg->dev); >> >> - if (hsotg->plat->phy_exit) >> + if (hsotg->phy) >> + usb_phy_shutdown(hsotg->phy); >> + else if (hsotg->plat->phy_exit) >> hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); >> } >> >> @@ -3493,6 +3502,7 @@ static void s3c_hsotg_release(struct device *dev) >> static int __devinit s3c_hsotg_probe(struct platform_device *pdev) >> { >> struct s3c_hsotg_plat *plat = pdev->dev.platform_data; >> + struct usb_phy *phy; >> struct device *dev = &pdev->dev; >> struct s3c_hsotg_ep *eps; >> struct s3c_hsotg *hsotg; >> @@ -3501,20 +3511,27 @@ static int __devinit s3c_hsotg_probe(struct >> platform_device *pdev) int ret; >> int i; >> >> - plat = pdev->dev.platform_data; >> - if (!plat) { >> - dev_err(&pdev->dev, "no platform data defined\n"); >> - return -EINVAL; >> - } >> - >> hsotg = devm_kzalloc(&pdev->dev, sizeof(struct s3c_hsotg), >> GFP_KERNEL); if (!hsotg) { >> dev_err(dev, "cannot get memory\n"); >> return -ENOMEM; >> } >> >> + phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); >> + if (IS_ERR_OR_NULL(phy)) { >> + /* Fallback for pdata */ >> + plat = pdev->dev.platform_data; >> + if (!plat) { >> + dev_err(&pdev->dev, "no platform data or transceiver > defined\n"); >> + return -EPROBE_DEFER; >> + } else { >> + hsotg->plat = plat; >> + } > > nitpick: The hsotg->plat = plat; assignment can be made without the else > statement as well. True! We will anyway remove the platform data part soon. If you say I can resend it again. > > Best regards, > Tomasz Figa > > -- > To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Praveen, On Friday 23 of November 2012 09:54:51 Praveen Paneri wrote: > We will anyway remove the platform data part soon. If you say I can > resend it again. I think that the requirement for platform data on DT-enabled systems should be removed before this series get merged, because there are already patches being worked on to remove auxdata tables (common clock framework support by Thomas Abraham). Adding next auxdata entry (containing platform data that must be provided) would make them depend on phy platform data removal patch, which would complicate things. Best regards,
On Wed, Nov 28, 2012 at 6:50 PM, Tomasz Figa <t.figa@samsung.com> wrote: > Hi Praveen, > > On Friday 23 of November 2012 09:54:51 Praveen Paneri wrote: >> We will anyway remove the platform data part soon. If you say I can >> resend it again. > > I think that the requirement for platform data on DT-enabled systems > should be removed before this series get merged, because there are already > patches being worked on to remove auxdata tables (common clock framework > support by Thomas Abraham). Next is to add support for 4210, 4x12 and Exynos5 (patches were sent by vivek Gautam already). Not only s3c-hsotg but ehci, ohci and dwc will start using phy driver. This will remove phy related platform data passed to these drivers and... > > Adding next auxdata entry (containing platform data that must be provided) > would make them depend on phy platform data removal patch, which would > complicate things. s3c-hsotg platform data is also passing "is_osc" (Clock source info) and "dma" (dma mode info) from platform_data. IT seems they both are not used as on now. May be Lukasz can tell if we can move that to config option and get rid of s3c-hsotg_plat completely. Once that is done only AUXDATA entry, which will be remaining, will be that of phy driver and I understand that we have to work towards removal of that as well but I guess this is a good first step towards the goal. > > Best regards, > -- > Tomasz Figa > Samsung Poland R&D Center > SW Solution Development, Linux Platform > > -- > To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 6f696ee..bc30a2d 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -32,6 +32,7 @@ #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> +#include <linux/usb/phy.h> #include <linux/platform_data/s3c-hsotg.h> #include <mach/map.h> @@ -133,7 +134,9 @@ struct s3c_hsotg_ep { * struct s3c_hsotg - driver state. * @dev: The parent device supplied to the probe function * @driver: USB gadget driver - * @plat: The platform specific configuration data. + * @phy: The otg phy transceiver structure for phy control. + * @plat: The platform specific configuration data. This can be removed once + * all SoCs support usb transceiver. * @regs: The memory area mapped for accessing registers. * @irq: The IRQ number we are using * @supplies: Definition of USB power supplies @@ -153,6 +156,7 @@ struct s3c_hsotg_ep { struct s3c_hsotg { struct device *dev; struct usb_gadget_driver *driver; + struct usb_phy *phy; struct s3c_hsotg_plat *plat; spinlock_t lock; @@ -2854,7 +2858,10 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) struct platform_device *pdev = to_platform_device(hsotg->dev); dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev); - if (hsotg->plat->phy_init) + + if (hsotg->phy) + usb_phy_init(hsotg->phy); + else if (hsotg->plat->phy_init) hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); } @@ -2869,7 +2876,9 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) { struct platform_device *pdev = to_platform_device(hsotg->dev); - if (hsotg->plat->phy_exit) + if (hsotg->phy) + usb_phy_shutdown(hsotg->phy); + else if (hsotg->plat->phy_exit) hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); } @@ -3493,6 +3502,7 @@ static void s3c_hsotg_release(struct device *dev) static int __devinit s3c_hsotg_probe(struct platform_device *pdev) { struct s3c_hsotg_plat *plat = pdev->dev.platform_data; + struct usb_phy *phy; struct device *dev = &pdev->dev; struct s3c_hsotg_ep *eps; struct s3c_hsotg *hsotg; @@ -3501,20 +3511,27 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev) int ret; int i; - plat = pdev->dev.platform_data; - if (!plat) { - dev_err(&pdev->dev, "no platform data defined\n"); - return -EINVAL; - } - hsotg = devm_kzalloc(&pdev->dev, sizeof(struct s3c_hsotg), GFP_KERNEL); if (!hsotg) { dev_err(dev, "cannot get memory\n"); return -ENOMEM; } + phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + if (IS_ERR_OR_NULL(phy)) { + /* Fallback for pdata */ + plat = pdev->dev.platform_data; + if (!plat) { + dev_err(&pdev->dev, "no platform data or transceiver defined\n"); + return -EPROBE_DEFER; + } else { + hsotg->plat = plat; + } + } else { + hsotg->phy = phy; + } + hsotg->dev = dev; - hsotg->plat = plat; hsotg->clk = devm_clk_get(&pdev->dev, "otg"); if (IS_ERR(hsotg->clk)) {