From: Kishon Vijay Abraham I <kishon@ti.com>
To: George Cherian <george.cherian@ti.com>
Cc: <linux-usb@vger.kernel.org>, <balbi@ti.com>,
<linux-kernel@vger.kernel.org>, <gregkh@linuxfoundation.org>,
<linux-omap@vger.kernel.org>, <bigeasy@linutronix.de>
Subject: Re: [PATCH 5/5] usb: musb: dsps: Remove the phy control from glue and add phy driver APIs
Date: Mon, 8 Jul 2013 17:38:06 +0530 [thread overview]
Message-ID: <51DAABA6.9050106@ti.com> (raw)
In-Reply-To: <1373280201-31785-6-git-send-email-george.cherian@ti.com>
Hi,
On Monday 08 July 2013 04:13 PM, George Cherian wrote:
> Remove usb phy control module access from platform glue.
> The same is now done using amxxxx phy driver and phy-omap-control.
>
> Signed-off-by: George Cherian <george.cherian@ti.com>
> ---
> drivers/usb/musb/musb_dsps.c | 105 +++++++++++++++----------------------------
> 1 file changed, 36 insertions(+), 69 deletions(-)
>
> diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
> index 41f135a..8f4e04a 100644
> --- a/drivers/usb/musb/musb_dsps.c
> +++ b/drivers/usb/musb/musb_dsps.c
> @@ -123,49 +123,11 @@ struct dsps_glue {
> const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
> struct timer_list timer[2]; /* otg_workaround timer */
> unsigned long last_timer[2]; /* last timer data for each instance */
> - u32 __iomem *usb_ctrl[2];
> };
>
> -#define DSPS_AM33XX_CONTROL_MODULE_PHYS_0 0x44e10620
> -#define DSPS_AM33XX_CONTROL_MODULE_PHYS_1 0x44e10628
> +#define glue_to_musb(g, i) platform_get_drvdata(g->musb[i])
>
> -static const resource_size_t dsps_control_module_phys[] = {
> - DSPS_AM33XX_CONTROL_MODULE_PHYS_0,
> - DSPS_AM33XX_CONTROL_MODULE_PHYS_1,
> -};
> -
> -#define USBPHY_CM_PWRDN (1 << 0)
> -#define USBPHY_OTG_PWRDN (1 << 1)
> -#define USBPHY_OTGVDET_EN (1 << 19)
> -#define USBPHY_OTGSESSEND_EN (1 << 20)
> -
> -/**
> - * musb_dsps_phy_control - phy on/off
> - * @glue: struct dsps_glue *
> - * @id: musb instance
> - * @on: flag for phy to be switched on or off
> - *
> - * This is to enable the PHY using usb_ctrl register in system control
> - * module space.
> - *
> - * XXX: This function will be removed once we have a seperate driver for
> - * control module
> - */
> -static void musb_dsps_phy_control(struct dsps_glue *glue, u8 id, u8 on)
> -{
> - u32 usbphycfg;
>
> - usbphycfg = readl(glue->usb_ctrl[id]);
> -
> - if (on) {
> - usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN);
> - usbphycfg |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN;
> - } else {
> - usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
> - }
> -
> - writel(usbphycfg, glue->usb_ctrl[id]);
> -}
> /**
> * dsps_musb_enable - enable interrupts
> */
> @@ -411,16 +373,31 @@ static int dsps_musb_init(struct musb *musb)
> void __iomem *reg_base = musb->ctrl_base;
> u32 rev, val;
> int status;
> + char phyname[12];
>
> /* mentor core register starts at offset of 0x400 from musb base */
> musb->mregs += wrp->musb_core_offset;
>
> - /* NOP driver needs change if supporting dual instance */
> - usb_nop_xceiv_register();
> - musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
> + if (dev->parent->of_node) {
> + snprintf(phyname , 12, "am335x-usb%d", pdev->id);
> + musb->phy = devm_phy_get(dev->parent, phyname);
> + musb->xceiv = devm_usb_get_phy_by_phandle(dev->parent,
> + "phys", pdev->id);
> + } else {
> + snprintf(phyname , 12, "am335x-usb%d", pdev->id);
Both these snprintf can be moved out of the *if*.
> + musb->phy = devm_phy_get(dev, musb->phy_label);
> + musb->xceiv = devm_usb_get_phy_dev(dev, pdev->id);
> + }
> +
> if (IS_ERR_OR_NULL(musb->xceiv))
> return -EPROBE_DEFER;
>
> + if (IS_ERR_OR_NULL(musb->phy)) {
The framework should never return NULL.
Thanks
Kishon
next prev parent reply other threads:[~2013-07-08 12:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-08 10:43 [PATCH 0/5] Add phy support for AM335X platform using Generic PHy framework George Cherian
2013-07-08 10:43 ` [PATCH 1/5] usb: musb: dsps: enable dual instance support for am33xx platform George Cherian
2013-07-08 10:43 ` [PATCH 2/5] usb: phy: phy-omap-control: Add API to power on/off USB PHY for AM335X George Cherian
2013-07-08 11:37 ` Kishon Vijay Abraham I
2013-07-08 10:43 ` [PATCH 3/5] phy: phy-amxxxx-usb: Add PHY driver for amxxxx platform George Cherian
2013-07-08 11:52 ` Kishon Vijay Abraham I
2013-07-08 10:43 ` [PATCH 4/5] arm: dts: Add USB phy nodes for AM33XX George Cherian
2013-07-08 11:54 ` Kishon Vijay Abraham I
2013-07-08 10:43 ` [PATCH 5/5] usb: musb: dsps: Remove the phy control from glue and add phy driver APIs George Cherian
2013-07-08 12:08 ` Kishon Vijay Abraham I [this message]
2013-07-08 19:44 ` [PATCH 0/5] Add phy support for AM335X platform using Generic PHy framework Sebastian Andrzej Siewior
2013-07-08 20:34 ` Ezequiel Garcia
2013-07-09 7:13 ` Sebastian Andrzej Siewior
2013-07-09 5:40 ` George Cherian
2013-07-09 11:35 ` Kishon Vijay Abraham I
2013-07-10 4:56 ` George Cherian
2013-07-10 5:23 ` Felipe Balbi
2013-07-10 5:43 ` George Cherian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51DAABA6.9050106@ti.com \
--to=kishon@ti.com \
--cc=balbi@ti.com \
--cc=bigeasy@linutronix.de \
--cc=george.cherian@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).