From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Chen Subject: Re: [RFC/PATCH] usb: misc: Add a driver for TC7USB40MU Date: Tue, 27 Sep 2016 12:53:58 +0800 Message-ID: <20160927045357.GB27697@b29397-desktop> References: <20160914014246.31847-1-stephen.boyd@linaro.org> <147384330268.13546.17843140335600627152@sboyd-linaro> <20160917011605.GB10392@b29397-desktop> <147457026249.9057.8712383708019243942@sboyd-linaro> <20160926032927.GA25395@b29397-desktop> <147491549050.5206.9497559526723777799@sboyd-linaro> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <147491549050.5206.9497559526723777799@sboyd-linaro> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Stephen Boyd Cc: Greg Kroah-Hartman , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, MyungJoo Ham , Chanwoo Choi , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Peter Chen List-Id: linux-arm-msm@vger.kernel.org On Mon, Sep 26, 2016 at 11:44:50AM -0700, Stephen Boyd wrote: > Quoting Peter Chen (2016-09-25 20:29:27) > > On Thu, Sep 22, 2016 at 11:51:02AM -0700, Stephen Boyd wrote: > > > Quoting Peter Chen (2016-09-16 18:16:05) > > > > On Wed, Sep 14, 2016 at 01:55:02AM -0700, Stephen Boyd wrote: > > > > > Quoting Stephen Boyd (2016-09-13 18:42:46) > > > > > > On the db410c 96boards platform we have a TC7USB40MU[1] on the > > > > > > board to mux the D+/D- lines from the SoC between a micro usb > > > > > > "device" port and a USB hub for "host" roles. Upon a role switch, > > > > > > we need to change this mux to forward the D+/D- lines to either > > > > > > the port or the hub. Therefore, introduce a driver for this > > > > > > device that intercepts extcon USB_HOST events and logically > > > > > > asserts a gpio to mux the "host" D+/D- lines when a host cable is > > > > > > attached. When the cable goes away, it will logically deassert > > > > > > the gpio and mux the "device" lines. > > > > > > > > > > > > [1] https://toshiba.semicon-storage.com/ap-en/product/logic/bus-switch/detail.TC7USB40MU.html > > > > > > > > > > > > Cc: MyungJoo Ham > > > > > > Cc: Chanwoo Choi > > > > > > Cc: > > > > > > Signed-off-by: Stephen Boyd > > > > > > --- > > > > > > > > > > > > Should I make the extcon part optional? I could see a case where there are two > > > > > > "OTG" ports connected to the mux (or two hubs), and for some reason the > > > > > > software may want to mux between them at runtime. If we mandate an extcon, > > > > > > that won't be possible to support. Perhaps it would be better to have > > > > > > the node, but connect it to the usb controller with a phandle (maybe of_graph > > > > > > endpoints would be useful too) so that when the controller wants to mux over > > > > > > a port it can do so. > > > > > > > > > > Here's some dts mock-up on top of the db410c for the of_graph stuff. I > > > > > haven't written any code around it, but the idea is to allow the binding > > > > > to specify how the mux is connected to upstream and downstream D+/D- > > > > > lines. This way, we can do some dt parsing of the endpoints and their > > > > > parent nodes to figure out if the mux needs to be set high or low to use > > > > > a device connector or a usb hub based on if the id cable is present. > > > > > Maybe I'm over thinking things though and we could just have a DT > > > > > property for that. > > > > > > > > > > soc { > > > > > usb@78d9000 { > > > > > extcon = <&usb_id>, <&usb_id>; > > > > > > > > Why you have two same extcon phandler? From my mind, one should id, > > > > another should is vbus. Besides, I find extcon-usb-gpio.c is lack of > > > > vbus support, how you support vbus detection for > > > > connection/disconnection with PC for your chipidea msm patch set? > > > > > > This was already in the dts files for db410c. In the chipidea binding > > > one is for EXTCON_USB (vbus) and one is for EXTCON_USB_HOST (id). My > > > understanding is that extcon-usb-gpio.c sends events for both EXTCON_USB > > > and EXTCON_USB_HOST when the gpio changes state. vbus detection is not > > > that great on this board because we only have on gpio for this. > > > > I think extcon-usb-gpio.c needs to extend for supporting vbus event, > > otherwise, the micro-b cable's connect/disconnect will introduce > > EXTCON_USB_HOST event, if you use two <&usb_idx> for both id and > > vbus event. > > > > Sorry, I'm lost now. extcon-usb-gpio.c already supports EXTCON_USB as an > event. Is the problem that we're using two of the same phandles in the > binding? No, ID and VBUS are different events. http://www.spinics.net/lists/linux-usb/msg147004.html -- Best Regards, Peter Chen -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751913AbcI0EyX (ORCPT ); Tue, 27 Sep 2016 00:54:23 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36642 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751096AbcI0EyM (ORCPT ); Tue, 27 Sep 2016 00:54:12 -0400 Date: Tue, 27 Sep 2016 12:53:58 +0800 From: Peter Chen To: Stephen Boyd Cc: Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, robh+dt@kernel.org, MyungJoo Ham , Chanwoo Choi , devicetree@vger.kernel.org, Peter Chen Subject: Re: [RFC/PATCH] usb: misc: Add a driver for TC7USB40MU Message-ID: <20160927045357.GB27697@b29397-desktop> References: <20160914014246.31847-1-stephen.boyd@linaro.org> <147384330268.13546.17843140335600627152@sboyd-linaro> <20160917011605.GB10392@b29397-desktop> <147457026249.9057.8712383708019243942@sboyd-linaro> <20160926032927.GA25395@b29397-desktop> <147491549050.5206.9497559526723777799@sboyd-linaro> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <147491549050.5206.9497559526723777799@sboyd-linaro> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 26, 2016 at 11:44:50AM -0700, Stephen Boyd wrote: > Quoting Peter Chen (2016-09-25 20:29:27) > > On Thu, Sep 22, 2016 at 11:51:02AM -0700, Stephen Boyd wrote: > > > Quoting Peter Chen (2016-09-16 18:16:05) > > > > On Wed, Sep 14, 2016 at 01:55:02AM -0700, Stephen Boyd wrote: > > > > > Quoting Stephen Boyd (2016-09-13 18:42:46) > > > > > > On the db410c 96boards platform we have a TC7USB40MU[1] on the > > > > > > board to mux the D+/D- lines from the SoC between a micro usb > > > > > > "device" port and a USB hub for "host" roles. Upon a role switch, > > > > > > we need to change this mux to forward the D+/D- lines to either > > > > > > the port or the hub. Therefore, introduce a driver for this > > > > > > device that intercepts extcon USB_HOST events and logically > > > > > > asserts a gpio to mux the "host" D+/D- lines when a host cable is > > > > > > attached. When the cable goes away, it will logically deassert > > > > > > the gpio and mux the "device" lines. > > > > > > > > > > > > [1] https://toshiba.semicon-storage.com/ap-en/product/logic/bus-switch/detail.TC7USB40MU.html > > > > > > > > > > > > Cc: MyungJoo Ham > > > > > > Cc: Chanwoo Choi > > > > > > Cc: > > > > > > Signed-off-by: Stephen Boyd > > > > > > --- > > > > > > > > > > > > Should I make the extcon part optional? I could see a case where there are two > > > > > > "OTG" ports connected to the mux (or two hubs), and for some reason the > > > > > > software may want to mux between them at runtime. If we mandate an extcon, > > > > > > that won't be possible to support. Perhaps it would be better to have > > > > > > the node, but connect it to the usb controller with a phandle (maybe of_graph > > > > > > endpoints would be useful too) so that when the controller wants to mux over > > > > > > a port it can do so. > > > > > > > > > > Here's some dts mock-up on top of the db410c for the of_graph stuff. I > > > > > haven't written any code around it, but the idea is to allow the binding > > > > > to specify how the mux is connected to upstream and downstream D+/D- > > > > > lines. This way, we can do some dt parsing of the endpoints and their > > > > > parent nodes to figure out if the mux needs to be set high or low to use > > > > > a device connector or a usb hub based on if the id cable is present. > > > > > Maybe I'm over thinking things though and we could just have a DT > > > > > property for that. > > > > > > > > > > soc { > > > > > usb@78d9000 { > > > > > extcon = <&usb_id>, <&usb_id>; > > > > > > > > Why you have two same extcon phandler? From my mind, one should id, > > > > another should is vbus. Besides, I find extcon-usb-gpio.c is lack of > > > > vbus support, how you support vbus detection for > > > > connection/disconnection with PC for your chipidea msm patch set? > > > > > > This was already in the dts files for db410c. In the chipidea binding > > > one is for EXTCON_USB (vbus) and one is for EXTCON_USB_HOST (id). My > > > understanding is that extcon-usb-gpio.c sends events for both EXTCON_USB > > > and EXTCON_USB_HOST when the gpio changes state. vbus detection is not > > > that great on this board because we only have on gpio for this. > > > > I think extcon-usb-gpio.c needs to extend for supporting vbus event, > > otherwise, the micro-b cable's connect/disconnect will introduce > > EXTCON_USB_HOST event, if you use two <&usb_idx> for both id and > > vbus event. > > > > Sorry, I'm lost now. extcon-usb-gpio.c already supports EXTCON_USB as an > event. Is the problem that we're using two of the same phandles in the > binding? No, ID and VBUS are different events. http://www.spinics.net/lists/linux-usb/msg147004.html -- Best Regards, Peter Chen From mboxrd@z Thu Jan 1 00:00:00 1970 From: hzpeterchen@gmail.com (Peter Chen) Date: Tue, 27 Sep 2016 12:53:58 +0800 Subject: [RFC/PATCH] usb: misc: Add a driver for TC7USB40MU In-Reply-To: <147491549050.5206.9497559526723777799@sboyd-linaro> References: <20160914014246.31847-1-stephen.boyd@linaro.org> <147384330268.13546.17843140335600627152@sboyd-linaro> <20160917011605.GB10392@b29397-desktop> <147457026249.9057.8712383708019243942@sboyd-linaro> <20160926032927.GA25395@b29397-desktop> <147491549050.5206.9497559526723777799@sboyd-linaro> Message-ID: <20160927045357.GB27697@b29397-desktop> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Mon, Sep 26, 2016 at 11:44:50AM -0700, Stephen Boyd wrote: > Quoting Peter Chen (2016-09-25 20:29:27) > > On Thu, Sep 22, 2016 at 11:51:02AM -0700, Stephen Boyd wrote: > > > Quoting Peter Chen (2016-09-16 18:16:05) > > > > On Wed, Sep 14, 2016 at 01:55:02AM -0700, Stephen Boyd wrote: > > > > > Quoting Stephen Boyd (2016-09-13 18:42:46) > > > > > > On the db410c 96boards platform we have a TC7USB40MU[1] on the > > > > > > board to mux the D+/D- lines from the SoC between a micro usb > > > > > > "device" port and a USB hub for "host" roles. Upon a role switch, > > > > > > we need to change this mux to forward the D+/D- lines to either > > > > > > the port or the hub. Therefore, introduce a driver for this > > > > > > device that intercepts extcon USB_HOST events and logically > > > > > > asserts a gpio to mux the "host" D+/D- lines when a host cable is > > > > > > attached. When the cable goes away, it will logically deassert > > > > > > the gpio and mux the "device" lines. > > > > > > > > > > > > [1] https://toshiba.semicon-storage.com/ap-en/product/logic/bus-switch/detail.TC7USB40MU.html > > > > > > > > > > > > Cc: MyungJoo Ham > > > > > > Cc: Chanwoo Choi > > > > > > Cc: > > > > > > Signed-off-by: Stephen Boyd > > > > > > --- > > > > > > > > > > > > Should I make the extcon part optional? I could see a case where there are two > > > > > > "OTG" ports connected to the mux (or two hubs), and for some reason the > > > > > > software may want to mux between them at runtime. If we mandate an extcon, > > > > > > that won't be possible to support. Perhaps it would be better to have > > > > > > the node, but connect it to the usb controller with a phandle (maybe of_graph > > > > > > endpoints would be useful too) so that when the controller wants to mux over > > > > > > a port it can do so. > > > > > > > > > > Here's some dts mock-up on top of the db410c for the of_graph stuff. I > > > > > haven't written any code around it, but the idea is to allow the binding > > > > > to specify how the mux is connected to upstream and downstream D+/D- > > > > > lines. This way, we can do some dt parsing of the endpoints and their > > > > > parent nodes to figure out if the mux needs to be set high or low to use > > > > > a device connector or a usb hub based on if the id cable is present. > > > > > Maybe I'm over thinking things though and we could just have a DT > > > > > property for that. > > > > > > > > > > soc { > > > > > usb at 78d9000 { > > > > > extcon = <&usb_id>, <&usb_id>; > > > > > > > > Why you have two same extcon phandler? From my mind, one should id, > > > > another should is vbus. Besides, I find extcon-usb-gpio.c is lack of > > > > vbus support, how you support vbus detection for > > > > connection/disconnection with PC for your chipidea msm patch set? > > > > > > This was already in the dts files for db410c. In the chipidea binding > > > one is for EXTCON_USB (vbus) and one is for EXTCON_USB_HOST (id). My > > > understanding is that extcon-usb-gpio.c sends events for both EXTCON_USB > > > and EXTCON_USB_HOST when the gpio changes state. vbus detection is not > > > that great on this board because we only have on gpio for this. > > > > I think extcon-usb-gpio.c needs to extend for supporting vbus event, > > otherwise, the micro-b cable's connect/disconnect will introduce > > EXTCON_USB_HOST event, if you use two <&usb_idx> for both id and > > vbus event. > > > > Sorry, I'm lost now. extcon-usb-gpio.c already supports EXTCON_USB as an > event. Is the problem that we're using two of the same phandles in the > binding? No, ID and VBUS are different events. http://www.spinics.net/lists/linux-usb/msg147004.html -- Best Regards, Peter Chen