From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: MIME-Version: 1.0 In-Reply-To: References: <1463133808-10630-1-git-send-email-rogerq@ti.com> <1463133808-10630-9-git-send-email-rogerq@ti.com> <574422CA.8080002@ti.com> <20160525024427.GA31142@shlinux2> <574598D3.5090405@ti.com> From: Peter Chen Date: Fri, 27 May 2016 16:03:43 +0800 Message-ID: Subject: Re: [PATCH v8 08/14] usb: otg: add OTG/dual-role core Content-Type: multipart/alternative; boundary=001a114e33a29d16640533ce59e6 To: Jun Li Cc: Roger Quadros , "peter.chen@freescale.com" , "balbi@kernel.org" , "tony@atomide.com" , "gregkh@linuxfoundation.org" , "dan.j.williams@intel.com" , "mathias.nyman@linux.intel.com" , "Joao.Pinto@synopsys.com" , "sergei.shtylyov@cogentembedded.com" , "jun.li@freescale.com" , "grygorii.strashko@ti.com" , "yoshihiro.shimoda.uh@renesas.com" , "robh@kernel.org" , "nsekhar@ti.com" , "b-liu@ti.com" , "linux-usb@vger.kernel.org" , "linux-omap@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" List-ID: --001a114e33a29d16640533ce59e6 Content-Type: text/plain; charset=UTF-8 On Wed, May 25, 2016 at 10:44 PM, Jun Li wrote: > Hi Roger > > > >> > > >> Here, we should be checking if user needs to disable any OTG > > >> features. So, > > >> > > >> if (dev->of_node) > > >> of_usb_update_otg_caps(dev->of_node, &otg->caps); > > >> > > >> Do you agree? > > >> This means we need to change otg->caps from 'struct usb_otg_caps > > *caps;' > > >> to 'struct usb_otg_caps caps;' so that we can modify the local copy > > >> instead of the one passed by the OTG controller. > > > > > > Why can't modify the one from OTG controller directly? > > > > > > > There are 2 things. > > 1) OTG features supported by hardware. This is the controller's config- > > >otg_caps > > 2) OTG features needed by system designer. This can be a subset of (1). > > Let's make things simple, we only need this subnet, which can be set > by controller driver in config->otg_caps before pass (its address) > to OTG core. > > So controller driver should get the capability of HW(+SW) and user config > by whatever approach, then set its config->otg_caps. > > Li Jun > We may not use controller's otg capabilities after initialization, so struct usb_otg_caps in controller device's structure can standard for board's otg capabilities. My suggestion is passing controller's cap to usb_otg_register, and update in it using of_usb_update_otg_caps, in that case, each controller driver doesn't need to do it by each other. -- BR, Peter Chen --001a114e33a29d16640533ce59e6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Wed, May 25, 2016 at 10:44 PM, Jun Li <jun.li@nxp.com> = wrote:
Hi Roger

> >>
> >> Here, we should be checking if user needs to disable any OTG<= br> > >> features. So,
> >>
> >>=C2=A0 =C2=A0 if (dev->of_node)
> >>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 of_usb_update_otg_ca= ps(dev->of_node, &otg->caps);
> >>
> >> Do you agree?
> >> This means we need to change otg->caps from 'struct us= b_otg_caps
> *caps;'
> >> to 'struct usb_otg_caps caps;' so that we can modify = the local copy
> >> instead of the one passed by the OTG controller.
> >
> > Why can't modify the one from OTG controller directly?
> >
>
> There are 2 things.
> 1) OTG features supported by hardware. This is the controller's co= nfig-
> >otg_caps
> 2) OTG features needed by system designer. This can be a subset of (1)= .

Let's make things simple, we only need this subnet, which can be= set
by controller driver in config->otg_caps before pass (its address)
to OTG core.

So controller driver should get the capability of HW(+SW) and user config by whatever approach, then set its config->otg_caps.

Li Jun

We may not use controller's otg ca= pabilities after initialization, so struct usb_otg_caps
in controller device's structure can standard for board= 9;s otg capabilities.

My suggestion is passing controller's cap to usb_otg_r= egister, and update in it using
of_usb_upda= te_otg_caps, in that case, each controller driver doesn't need to do it= by
each other.

--
BR,
Peter Chen=
--001a114e33a29d16640533ce59e6--