From: "Antoine Ténart" <antoine.tenart@free-electrons.com>
To: Peter Chen <Peter.Chen@freescale.com>
Cc: "Antoine Ténart" <antoine.tenart@free-electrons.com>,
"balbi@ti.com" <balbi@ti.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"kishon@ti.com" <kishon@ti.com>,
"stern@rowland.harvard.edu" <stern@rowland.harvard.edu>,
"sergei.shtylyov@cogentembedded.com"
<sergei.shtylyov@cogentembedded.com>,
"yoshihiro.shimoda.uh@renesas.com"
<yoshihiro.shimoda.uh@renesas.com>,
"alexandre.belloni@free-electrons.com"
<alexandre.belloni@free-electrons.com>,
"thomas.petazzoni@free-electrons.com"
<thomas.petazzoni@free-electrons.com>,
"zmxu@marvell.com" <zmxu@marvell.com>,
"jszhang@marvell.com" <jszhang@marvell.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 8/8] usb: chipidea: add support to the generic PHY framework in ChipIdea
Date: Fri, 25 Jul 2014 10:38:10 +0200 [thread overview]
Message-ID: <20140725083810.GC9756@kwain> (raw)
In-Reply-To: <2ca1959dbb8c44659e6ec4e0c9426e24@BN1PR0301MB0772.namprd03.prod.outlook.com>
On Fri, Jul 25, 2014 at 08:33:28AM +0000, Peter Chen wrote:
>
> > > >
> > >
> > > Just add OTG member into ci_hdrc structure, see below patch
> > >
> > > diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
> > > index 9563cb5..186fb3f 100644
> > > --- a/drivers/usb/chipidea/ci.h
> > > +++ b/drivers/usb/chipidea/ci.h
> > > @@ -207,6 +207,7 @@ struct ci_hdrc {
> > > bool id_event;
> > > bool b_sess_valid_event;
> > > bool imx28_write_fix;
> > > + struct usb_otg otg;
> > > };
> > >
> > > static inline struct ci_role_driver *ci_role(struct ci_hdrc *ci) diff
> > > --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> > > index a93d950..70d7fe2 100644
> > > --- a/drivers/usb/chipidea/host.c
> > > +++ b/drivers/usb/chipidea/host.c
> > > @@ -85,7 +85,7 @@ static int host_start(struct ci_hdrc *ci)
> > > if (ret) {
> > > goto disable_reg;
> > > } else {
> > > - struct usb_otg *otg = ci->transceiver->otg;
> > > + struct usb_otg *otg = &ci->otg;
> > >
> > > ci->hcd = hcd;
> > > if (otg) {
> > > diff --git a/drivers/usb/chipidea/otg_fsm.c
> > > b/drivers/usb/chipidea/otg_fsm.c index 8cb2508..fc8847e 100644
> > > --- a/drivers/usb/chipidea/otg_fsm.c
> > > +++ b/drivers/usb/chipidea/otg_fsm.c
> > > @@ -778,20 +778,8 @@ void ci_hdrc_otg_fsm_start(struct ci_hdrc *ci)
> > > int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) {
> > > int retval = 0;
> > > - struct usb_otg *otg;
> > >
> > > - otg = devm_kzalloc(ci->dev,
> > > - sizeof(struct usb_otg), GFP_KERNEL);
> > > - if (!otg) {
> > > - dev_err(ci->dev,
> > > - "Failed to allocate usb_otg structure for ci hdrc
> > otg!\n");
> > > - return -ENOMEM;
> > > - }
> > > -
> > > - otg->phy = ci->transceiver;
> > > - otg->gadget = &ci->gadget;
> > > - ci->fsm.otg = otg;
> > > - ci->transceiver->otg = ci->fsm.otg;
> > > + ci->fsm.otg = &ci->otg;
> > > ci->fsm.power_up = 1;
> > > ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0;
> > > ci->fsm.otg->state = OTG_STATE_UNDEFINED; diff --git
> > > a/include/linux/usb/otg.h b/include/linux/usb/otg.h index
> > > 33d3480..b2f7587 100644
> > > --- a/include/linux/usb/otg.h
> > > +++ b/include/linux/usb/otg.h
> > > @@ -14,7 +14,6 @@
> > > struct usb_otg {
> > > u8 default_a;
> > >
> > > - struct usb_phy *phy;
> > > struct usb_bus *host;
> > > struct usb_gadget *gadget;
> > >
> > > diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index
> > > ac7d791..b732541 100644
> > > --- a/include/linux/usb/phy.h
> > > +++ b/include/linux/usb/phy.h
> > > @@ -79,8 +79,6 @@ struct usb_phy {
> > > enum usb_phy_type type;
> > > enum usb_phy_events last_event;
> > >
> > > - struct usb_otg *otg;
> > > -
> > > struct device *io_dev;
> > > struct usb_phy_io_ops *io_ops;
> > > void __iomem *io_priv;
> > > b29397@shlinux1:~/work/projects/upstream/usb/usb$ git diff > a.diff
> > > b29397@shlinux1:~/work/projects/upstream/usb/usb$ cat a.diff diff
> > > --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index
> > > 9563cb5..186fb3f 100644
> > > --- a/drivers/usb/chipidea/ci.h
> > > +++ b/drivers/usb/chipidea/ci.h
> > > @@ -207,6 +207,7 @@ struct ci_hdrc {
> > > bool id_event;
> > > bool b_sess_valid_event;
> > > bool imx28_write_fix;
> > > + struct usb_otg otg;
> > > };
> > >
> > > static inline struct ci_role_driver *ci_role(struct ci_hdrc *ci) diff
> > > --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> > > index a93d950..70d7fe2 100644
> > > --- a/drivers/usb/chipidea/host.c
> > > +++ b/drivers/usb/chipidea/host.c
> > > @@ -85,7 +85,7 @@ static int host_start(struct ci_hdrc *ci)
> > > if (ret) {
> > > goto disable_reg;
> > > } else {
> > > - struct usb_otg *otg = ci->transceiver->otg;
> > > + struct usb_otg *otg = &ci->otg;
> > >
> > > ci->hcd = hcd;
> > > if (otg) {
> > > diff --git a/drivers/usb/chipidea/otg_fsm.c
> > > b/drivers/usb/chipidea/otg_fsm.c index 8cb2508..fc8847e 100644
> > > --- a/drivers/usb/chipidea/otg_fsm.c
> > > +++ b/drivers/usb/chipidea/otg_fsm.c
> > > @@ -778,20 +778,8 @@ void ci_hdrc_otg_fsm_start(struct ci_hdrc *ci)
> > > int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) {
> > > int retval = 0;
> > > - struct usb_otg *otg;
> > >
> > > - otg = devm_kzalloc(ci->dev,
> > > - sizeof(struct usb_otg), GFP_KERNEL);
> > > - if (!otg) {
> > > - dev_err(ci->dev,
> > > - "Failed to allocate usb_otg structure for ci hdrc otg!\n");
> > > - return -ENOMEM;
> > > - }
> > > -
> > > - otg->phy = ci->transceiver;
> > > - otg->gadget = &ci->gadget;
> > > - ci->fsm.otg = otg;
> > > - ci->transceiver->otg = ci->fsm.otg;
> > > + ci->fsm.otg = &ci->otg;
> > > ci->fsm.power_up = 1;
> > > ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0;
> > > ci->fsm.otg->state = OTG_STATE_UNDEFINED; diff --git
> > > a/include/linux/usb/otg.h b/include/linux/usb/otg.h index
> > > 33d3480..b2f7587 100644
> > > --- a/include/linux/usb/otg.h
> > > +++ b/include/linux/usb/otg.h
> > > @@ -14,7 +14,6 @@
> > > struct usb_otg {
> > > u8 default_a;
> > >
> > > - struct usb_phy *phy;
> > > struct usb_bus *host;
> > > struct usb_gadget *gadget;
> > >
> > > diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index
> > > ac7d791..b732541 100644
> > > --- a/include/linux/usb/phy.h
> > > +++ b/include/linux/usb/phy.h
> > > @@ -79,8 +79,6 @@ struct usb_phy {
> > > enum usb_phy_type type;
> > > enum usb_phy_events last_event;
> > >
> > > - struct usb_otg *otg;
> > > -
> > > struct device *io_dev;
> > > struct usb_phy_io_ops *io_ops;
> > > void __iomem *io_priv;
> >
> > Where does the ci->otg setup occurs? It seems to me it's never filled.
> >
>
> Currently, only two fields at struct usb_otg are needed for chipidea, they are:
> struct usb_bus *host;
> enum usb_otg_state state;
>
> They are initialized at:
> ci_hdrc_otg_fsm_init and host_start.
Ok, I get it. I'll update and add an OTG member into the ci_hdrc
structure.
Thanks!
Antoine
--
Antoine Ténart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2014-07-25 8:38 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-15 14:39 [PATCH v2 0/8] usb: add support for the generic PHY framework Antoine Ténart
2014-07-15 14:39 ` [PATCH v2 1/8] usb: move the OTG state from the USB PHY to the OTG structure Antoine Ténart
2014-07-15 14:39 ` [PATCH v2 2/8] usb: rename phy to usb_phy in OTG Antoine Ténart
2014-07-15 14:39 ` [PATCH v2 3/8] usb: add support to the generic PHY framework " Antoine Ténart
2014-07-15 14:39 ` [PATCH v2 4/8] usb: rename phy to usb_phy in HCD Antoine Ténart
2014-07-15 15:55 ` Sergei Shtylyov
2014-07-16 15:09 ` Felipe Balbi
2014-07-16 17:02 ` Sergei Shtylyov
2014-07-15 14:39 ` [PATCH v2 5/8] usb: rename gen_phy to phy " Antoine Ténart
2014-07-15 14:39 ` [PATCH v2 6/8] usb: allow to supply the PHY in the drivers when using HCD Antoine Ténart
2014-07-23 10:59 ` Peter Chen
2014-07-15 14:39 ` [PATCH v2 7/8] usb: rename transceiver and phy to usb_phy in ChipIdea Antoine Ténart
2014-07-24 11:12 ` Peter Chen
2014-07-15 14:39 ` [PATCH v2 8/8] usb: chipidea: add support to the generic PHY framework " Antoine Ténart
2014-07-24 11:39 ` Peter Chen
2014-07-24 12:25 ` Antoine Ténart
2014-07-25 0:34 ` Peter Chen
2014-07-25 8:13 ` Antoine Ténart
2014-07-25 8:33 ` Peter Chen
2014-07-25 8:38 ` Antoine Ténart [this message]
2014-07-15 15:58 ` [PATCH v2 0/8] usb: add support for the generic PHY framework Alan Stern
2014-07-16 17:45 ` Felipe Balbi
2014-07-17 8:03 ` Antoine Ténart
2014-07-17 17:23 ` Felipe Balbi
2014-07-23 11:36 ` Peter Chen
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=20140725083810.GC9756@kwain \
--to=antoine.tenart@free-electrons.com \
--cc=Peter.Chen@freescale.com \
--cc=alexandre.belloni@free-electrons.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=jszhang@marvell.com \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=stern@rowland.harvard.edu \
--cc=thomas.petazzoni@free-electrons.com \
--cc=yoshihiro.shimoda.uh@renesas.com \
--cc=zmxu@marvell.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.