All of lore.kernel.org
 help / color / mirror / Atom feed
* [1/2] usb: chipiea: add flags for id and vbus from external block
@ 2019-02-26  6:52 Peter Chen
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Chen @ 2019-02-26  6:52 UTC (permalink / raw)
  To: Jun Li; +Cc: gregkh, linux-usb, dl-linux-imx

>  drivers/usb/chipidea/core.c  | 2 ++
>  include/linux/usb/chipidea.h | 4 ++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index
> 7bfcbb2..0bfa850 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -706,6 +706,7 @@ static int ci_get_platdata(struct device *dev,
>  	cable->edev = ext_vbus;
> 
>  	if (!IS_ERR(ext_vbus)) {
> +		platdata->ext_vbus = true;
>  		ret = extcon_get_state(cable->edev, EXTCON_USB);
>  		if (ret)
>  			cable->connected = true;
> @@ -718,6 +719,7 @@ static int ci_get_platdata(struct device *dev,
>  	cable->edev = ext_id;
> 
>  	if (!IS_ERR(ext_id)) {
> +		platdata->ext_id = true;
>  		ret = extcon_get_state(cable->edev, EXTCON_USB_HOST);
>  		if (ret)
>  			cable->connected = true;
> diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index
> 911e05a..cd72d82 100644
> --- a/include/linux/usb/chipidea.h
> +++ b/include/linux/usb/chipidea.h
> @@ -70,6 +70,10 @@ struct ci_hdrc_platform_data {
>  	struct regulator	*reg_vbus;
>  	struct usb_otg_caps	ci_otg_caps;
>  	bool			tpl_support;
> +	/* ID state is from external event out side of USB */
> +	bool			ext_id;
> +	/* VBUS state is from external event out side of USB */
> +	bool			ext_vbus;

We already have struct ci_hdrc_cable at this structure, please use it instead.

Peter

>  	/* interrupt threshold setting */
>  	u32			itc_setting;
>  	u32			ahb_burst_config;
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [1/2] usb: chipiea: add flags for id and vbus from external block
@ 2019-03-05  8:22 Peter Chen
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Chen @ 2019-03-05  8:22 UTC (permalink / raw)
  To: Jun Li; +Cc: gregkh, linux-usb, dl-linux-imx

> >
> > > >
> > > >
> > > > >  drivers/usb/chipidea/core.c  | 2 ++
> > > > > include/linux/usb/chipidea.h
> > > > > |
> > > > > 4 ++++
> > > > >  2 files changed, 6 insertions(+)
> > > > >
> > > > > diff --git a/drivers/usb/chipidea/core.c
> > > > > b/drivers/usb/chipidea/core.c index
> > > > > 7bfcbb2..0bfa850 100644
> > > > > --- a/drivers/usb/chipidea/core.c
> > > > > +++ b/drivers/usb/chipidea/core.c
> > > > > @@ -706,6 +706,7 @@ static int ci_get_platdata(struct device *dev,
> > > > >  	cable->edev = ext_vbus;
> > > > >
> > > > >  	if (!IS_ERR(ext_vbus)) {
> > > > > +		platdata->ext_vbus = true;
> > > > >  		ret = extcon_get_state(cable->edev, EXTCON_USB);
> > > > >  		if (ret)
> > > > >  			cable->connected = true;
> > > > > @@ -718,6 +719,7 @@ static int ci_get_platdata(struct device *dev,
> > > > >  	cable->edev = ext_id;
> > > > >
> > > > >  	if (!IS_ERR(ext_id)) {
> > > > > +		platdata->ext_id = true;
> > > > >  		ret = extcon_get_state(cable->edev, EXTCON_USB_HOST);
> > > > >  		if (ret)
> > > > >  			cable->connected = true;
> > > > > diff --git a/include/linux/usb/chipidea.h
> > > > > b/include/linux/usb/chipidea.h index
> > > > > 911e05a..cd72d82 100644
> > > > > --- a/include/linux/usb/chipidea.h
> > > > > +++ b/include/linux/usb/chipidea.h
> > > > > @@ -70,6 +70,10 @@ struct ci_hdrc_platform_data {
> > > > >  	struct regulator	*reg_vbus;
> > > > >  	struct usb_otg_caps	ci_otg_caps;
> > > > >  	bool			tpl_support;
> > > > > +	/* ID state is from external event out side of USB */
> > > > > +	bool			ext_id;
> > > > > +	/* VBUS state is from external event out side of USB */
> > > > > +	bool			ext_vbus;
> > > >
> > > > We already have struct ci_hdrc_cable at this structure, please use it instead.
> > >
> > > I am going to extend ci_hdrc_cable also for type-C case, which has
> > > no edev, So it's OK to add a flag in ci_hdrc_cable for both edev and
> > > type-C to indicate external block is used?
> > >
> >
> > Why there is no external cable (edev) for Type-C case? If there is no
> > external cable phandle at controller dts, how driver knows the Type-C connection
> occurs?
> 
> The new usb_role class doesn't depends on edev, see how this can work on dwc3:
> https://patchwork.kernel.org/patch/10836519/
> 

I see, you could add role switch class for chipidea first, then put Type-C on it.

Peter

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [1/2] usb: chipiea: add flags for id and vbus from external block
@ 2019-03-05  7:09 Jun Li
  0 siblings, 0 replies; 6+ messages in thread
From: Jun Li @ 2019-03-05  7:09 UTC (permalink / raw)
  To: Peter Chen; +Cc: gregkh, linux-usb, dl-linux-imx

Hi Peter,

> -----Original Message-----
> From: Peter Chen
> Sent: 2019年3月1日 11:04
> To: Jun Li <jun.li@nxp.com>
> Cc: gregkh@linuxfoundation.org; linux-usb@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: RE: [PATCH 1/2] usb: chipiea: add flags for id and vbus from external block
> 
> 
> > >
> > >
> > > >  drivers/usb/chipidea/core.c  | 2 ++  include/linux/usb/chipidea.h
> > > > |
> > > > 4 ++++
> > > >  2 files changed, 6 insertions(+)
> > > >
> > > > diff --git a/drivers/usb/chipidea/core.c
> > > > b/drivers/usb/chipidea/core.c index
> > > > 7bfcbb2..0bfa850 100644
> > > > --- a/drivers/usb/chipidea/core.c
> > > > +++ b/drivers/usb/chipidea/core.c
> > > > @@ -706,6 +706,7 @@ static int ci_get_platdata(struct device *dev,
> > > >  	cable->edev = ext_vbus;
> > > >
> > > >  	if (!IS_ERR(ext_vbus)) {
> > > > +		platdata->ext_vbus = true;
> > > >  		ret = extcon_get_state(cable->edev, EXTCON_USB);
> > > >  		if (ret)
> > > >  			cable->connected = true;
> > > > @@ -718,6 +719,7 @@ static int ci_get_platdata(struct device *dev,
> > > >  	cable->edev = ext_id;
> > > >
> > > >  	if (!IS_ERR(ext_id)) {
> > > > +		platdata->ext_id = true;
> > > >  		ret = extcon_get_state(cable->edev, EXTCON_USB_HOST);
> > > >  		if (ret)
> > > >  			cable->connected = true;
> > > > diff --git a/include/linux/usb/chipidea.h
> > > > b/include/linux/usb/chipidea.h index
> > > > 911e05a..cd72d82 100644
> > > > --- a/include/linux/usb/chipidea.h
> > > > +++ b/include/linux/usb/chipidea.h
> > > > @@ -70,6 +70,10 @@ struct ci_hdrc_platform_data {
> > > >  	struct regulator	*reg_vbus;
> > > >  	struct usb_otg_caps	ci_otg_caps;
> > > >  	bool			tpl_support;
> > > > +	/* ID state is from external event out side of USB */
> > > > +	bool			ext_id;
> > > > +	/* VBUS state is from external event out side of USB */
> > > > +	bool			ext_vbus;
> > >
> > > We already have struct ci_hdrc_cable at this structure, please use it instead.
> >
> > I am going to extend ci_hdrc_cable also for type-C case, which has no
> > edev, So it's OK to add a flag in ci_hdrc_cable for both edev and
> > type-C to indicate external block is used?
> >
> 
> Why there is no external cable (edev) for Type-C case? If there is no external cable
> phandle at controller dts, how driver knows the Type-C connection occurs?

The new usb_role class doesn't depends on edev, see how this can work on dwc3:
https://patchwork.kernel.org/patch/10836519/

Li Jun

> 
> Peter

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [1/2] usb: chipiea: add flags for id and vbus from external block
@ 2019-03-01  3:03 Peter Chen
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Chen @ 2019-03-01  3:03 UTC (permalink / raw)
  To: Jun Li; +Cc: gregkh, linux-usb, dl-linux-imx

> >
> >
> > >  drivers/usb/chipidea/core.c  | 2 ++  include/linux/usb/chipidea.h |
> > > 4 ++++
> > >  2 files changed, 6 insertions(+)
> > >
> > > diff --git a/drivers/usb/chipidea/core.c
> > > b/drivers/usb/chipidea/core.c index
> > > 7bfcbb2..0bfa850 100644
> > > --- a/drivers/usb/chipidea/core.c
> > > +++ b/drivers/usb/chipidea/core.c
> > > @@ -706,6 +706,7 @@ static int ci_get_platdata(struct device *dev,
> > >  	cable->edev = ext_vbus;
> > >
> > >  	if (!IS_ERR(ext_vbus)) {
> > > +		platdata->ext_vbus = true;
> > >  		ret = extcon_get_state(cable->edev, EXTCON_USB);
> > >  		if (ret)
> > >  			cable->connected = true;
> > > @@ -718,6 +719,7 @@ static int ci_get_platdata(struct device *dev,
> > >  	cable->edev = ext_id;
> > >
> > >  	if (!IS_ERR(ext_id)) {
> > > +		platdata->ext_id = true;
> > >  		ret = extcon_get_state(cable->edev, EXTCON_USB_HOST);
> > >  		if (ret)
> > >  			cable->connected = true;
> > > diff --git a/include/linux/usb/chipidea.h
> > > b/include/linux/usb/chipidea.h index
> > > 911e05a..cd72d82 100644
> > > --- a/include/linux/usb/chipidea.h
> > > +++ b/include/linux/usb/chipidea.h
> > > @@ -70,6 +70,10 @@ struct ci_hdrc_platform_data {
> > >  	struct regulator	*reg_vbus;
> > >  	struct usb_otg_caps	ci_otg_caps;
> > >  	bool			tpl_support;
> > > +	/* ID state is from external event out side of USB */
> > > +	bool			ext_id;
> > > +	/* VBUS state is from external event out side of USB */
> > > +	bool			ext_vbus;
> >
> > We already have struct ci_hdrc_cable at this structure, please use it instead.
> 
> I am going to extend ci_hdrc_cable also for type-C case, which has no edev, So it's
> OK to add a flag in ci_hdrc_cable for both edev and type-C to indicate external
> block is used?
> 
 
Why there is no external cable (edev) for Type-C case? If there is no external cable
phandle at controller dts, how driver knows the Type-C connection occurs?

Peter

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [1/2] usb: chipiea: add flags for id and vbus from external block
@ 2019-02-28  8:58 Jun Li
  0 siblings, 0 replies; 6+ messages in thread
From: Jun Li @ 2019-02-28  8:58 UTC (permalink / raw)
  To: Peter Chen; +Cc: gregkh, linux-usb, dl-linux-imx

> -----Original Message-----
> From: Peter Chen
> Sent: 2019年2月26日 14:53
> To: Jun Li <jun.li@nxp.com>
> Cc: gregkh@linuxfoundation.org; linux-usb@vger.kernel.org; dl-linux-imx
> <linux-imx@nxp.com>
> Subject: RE: [PATCH 1/2] usb: chipiea: add flags for id and vbus from external block
> 
> 
> >  drivers/usb/chipidea/core.c  | 2 ++
> >  include/linux/usb/chipidea.h | 4 ++++
> >  2 files changed, 6 insertions(+)
> >
> > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index
> > 7bfcbb2..0bfa850 100644
> > --- a/drivers/usb/chipidea/core.c
> > +++ b/drivers/usb/chipidea/core.c
> > @@ -706,6 +706,7 @@ static int ci_get_platdata(struct device *dev,
> >  	cable->edev = ext_vbus;
> >
> >  	if (!IS_ERR(ext_vbus)) {
> > +		platdata->ext_vbus = true;
> >  		ret = extcon_get_state(cable->edev, EXTCON_USB);
> >  		if (ret)
> >  			cable->connected = true;
> > @@ -718,6 +719,7 @@ static int ci_get_platdata(struct device *dev,
> >  	cable->edev = ext_id;
> >
> >  	if (!IS_ERR(ext_id)) {
> > +		platdata->ext_id = true;
> >  		ret = extcon_get_state(cable->edev, EXTCON_USB_HOST);
> >  		if (ret)
> >  			cable->connected = true;
> > diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index
> > 911e05a..cd72d82 100644
> > --- a/include/linux/usb/chipidea.h
> > +++ b/include/linux/usb/chipidea.h
> > @@ -70,6 +70,10 @@ struct ci_hdrc_platform_data {
> >  	struct regulator	*reg_vbus;
> >  	struct usb_otg_caps	ci_otg_caps;
> >  	bool			tpl_support;
> > +	/* ID state is from external event out side of USB */
> > +	bool			ext_id;
> > +	/* VBUS state is from external event out side of USB */
> > +	bool			ext_vbus;
> 
> We already have struct ci_hdrc_cable at this structure, please use it instead.

I am going to extend ci_hdrc_cable also for type-C case, which has no edev,
So it's OK to add a flag in ci_hdrc_cable for both edev and type-C to indicate
external block is used?

Thanks
Li Jun
> 
> Peter
> 
> >  	/* interrupt threshold setting */
> >  	u32			itc_setting;
> >  	u32			ahb_burst_config;
> > --
> > 2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [1/2] usb: chipiea: add flags for id and vbus from external block
@ 2019-02-25  6:27 Jun Li
  0 siblings, 0 replies; 6+ messages in thread
From: Jun Li @ 2019-02-25  6:27 UTC (permalink / raw)
  To: Peter Chen; +Cc: gregkh, linux-usb, dl-linux-imx

Add 2 flags for id and vbus if the state is from external blocks
instead of OTG block inside of USB controller.

Signed-off-by: Li Jun <jun.li@nxp.com>
---
 drivers/usb/chipidea/core.c  | 2 ++
 include/linux/usb/chipidea.h | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 7bfcbb2..0bfa850 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -706,6 +706,7 @@ static int ci_get_platdata(struct device *dev,
 	cable->edev = ext_vbus;
 
 	if (!IS_ERR(ext_vbus)) {
+		platdata->ext_vbus = true;
 		ret = extcon_get_state(cable->edev, EXTCON_USB);
 		if (ret)
 			cable->connected = true;
@@ -718,6 +719,7 @@ static int ci_get_platdata(struct device *dev,
 	cable->edev = ext_id;
 
 	if (!IS_ERR(ext_id)) {
+		platdata->ext_id = true;
 		ret = extcon_get_state(cable->edev, EXTCON_USB_HOST);
 		if (ret)
 			cable->connected = true;
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 911e05a..cd72d82 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -70,6 +70,10 @@ struct ci_hdrc_platform_data {
 	struct regulator	*reg_vbus;
 	struct usb_otg_caps	ci_otg_caps;
 	bool			tpl_support;
+	/* ID state is from external event out side of USB */
+	bool			ext_id;
+	/* VBUS state is from external event out side of USB */
+	bool			ext_vbus;
 	/* interrupt threshold setting */
 	u32			itc_setting;
 	u32			ahb_burst_config;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-03-05  8:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-26  6:52 [1/2] usb: chipiea: add flags for id and vbus from external block Peter Chen
  -- strict thread matches above, loose matches on Subject: below --
2019-03-05  8:22 Peter Chen
2019-03-05  7:09 Jun Li
2019-03-01  3:03 Peter Chen
2019-02-28  8:58 Jun Li
2019-02-25  6:27 Jun Li

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.