Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1485450

Re: [RFC/PATCH] usb: misc: Add a driver for TC7USB40MU

Path csiph.com!news.redatomik.org!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod
From Peter Chen <hzpeterchen@gmail.com>
Newsgroups linux.kernel
Subject Re: [RFC/PATCH] usb: misc: Add a driver for TC7USB40MU
Date Sat, 17 Sep 2016 03:20:01 +0200
Message-ID <sicsp-4cc-9@gated-at.bofh.it> (permalink)
References <sh7uO-1ES-3@gated-at.bofh.it> <shecW-76W-23@gated-at.bofh.it>
X-Original-To Stephen Boyd <stephen.boyd@linaro.org>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=NrMrRcMFJt0IjVFbU5cpQkX0kIHgRHG2esjr/+M44lY=; b=K9l3zFeqlewEGZ2lfkAHPqBRRUXbxRCJOFujHJ4Ip/DEhJftKMos50kumc1w+++wih 1pMDBfeww62yMCQPfvNarvovJbZAN67rfpp1shuqH5VVnSvMb7RLkvs34z8n/y/4aoh4 ntClWCJu6fFifiPatLp59jlrPZvF1sfW2LPnlyZfb1BN++cGSie6w8yEjHeHTddwcSsD tsr8OLeQEv1SEgA/DVXoXRMMFXIU0npCjGWIVGdsARzrTkB6ZAPSoGiz4r/RbrZzRkKd usTc7s2aK+6L6dvdvRiTBsc04TfUZi6Tc5Z7prUzqmXkuX1zCasl9IgLMah2ubJPCH+E dWZg==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=NrMrRcMFJt0IjVFbU5cpQkX0kIHgRHG2esjr/+M44lY=; b=jkeJlHfZcxtYSVYWq4NxfRqblLREhGANVN2VYSK8eHlSjlGTb/fdOZg3/7yPt7c/Ph DntU05APj0uwk51+cRMs5B8PYQaBZIC1AYJquJt+/+ceAtH6aXqCc8ojyihbqlLVxg32 Cpf+GeLUuVmpREmDpdR5drf8d2gGayDmOU8Cv+th++bxlxbA0zjBETpCAS/4ZD+Ams8b 8ezN6iPElv5jZlueOOFkC0DsI0Gy4HOSbTWxmGqeDIDGjhv5mbCe2sZUz3bXFx4BC5N+ /5dY5m7+5XnTekrzM3S3VNOWNjxSYpgFFlENN+IRF8hil2zuXTFAtLCoE/prseYgLZlv nbkA==
X-Gm-Message-State AE9vXwNLXS3nkqobdWI/gqvXbgx9KiSHMBFX6SlEj9e18e+dDXPEBvg0u+cfx6l9gorHQA==
X-Received by 10.66.2.168 with SMTP id 8mr27567576pav.87.1474074973956; Fri, 16 Sep 2016 18:16:13 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.24 (2015-08-30)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 207
Organization linux.* mail to news gateway
X-Original-Cc Greg Kroah-Hartman <gregkh@linuxfoundation.org>, 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 <myungjoo.ham@samsung.com>, Chanwoo Choi <cw00.choi@samsung.com>, devicetree@vger.kernel.org, Peter Chen <peter.chen@nxp.com>
X-Original-Date Sat, 17 Sep 2016 09:16:05 +0800
X-Original-Message-ID <20160917011605.GB10392@b29397-desktop>
X-Original-References <20160914014246.31847-1-stephen.boyd@linaro.org> <147384330268.13546.17843140335600627152@sboyd-linaro>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1485450

Show key headers only | View raw


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 <myungjoo.ham@samsung.com>
> > Cc: Chanwoo Choi <cw00.choi@samsung.com>
> > Cc: <devicetree@vger.kernel.org>
> > Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
> > ---
> > 
> > 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?

> 			usb-controller; // needed?

Not needed. You only need to describe controller, mux ic, and hub 
(if you need platform stuffs the driver needs to know).

Peter
> 
> 			ports {
> 				#address-cells = <1>;
> 				#size-cells = <0>;
> 
> 				port@0 {
> 					#address-cells = <1>;
> 					#size-cells = <0>;
> 					reg = <0>;
> 
> 					usb_output: endpoint@0 { // USB D+/D-
> 						reg = <0>;
> 						remote-endpoint = <&usb_switch_input>;
> 					};
> 				};
> 			};
> 		};
> 	};
> 
> 	usb2513 {
> 		compatible = "smsc,usb3503";
> 		reset-gpios = <&pm8916_gpios 3 GPIO_ACTIVE_LOW>;
> 		initial-mode = <1>;
> 		usb-hub; // indicate this is a hub
> 
> 		ports {
> 			#address-cells = <1>;
> 			#size-cells = <0>;
> 
> 			port@0 {
> 				#address-cells = <1>;
> 				#size-cells = <0>;
> 				reg = <0>;
> 
> 				usb_hub_input: endpoint@0 { // USB{DP,DM}_UP
> 					reg = <0>;
> 					remote-endpoint = <&usb_switch_hub_ep>;
> 				};
> 
> 				usb_hub_output1: endpoint@1 { // USB{DP,DM}_DN1
> 					reg = <1>;
> 					remote-endpoint = <&usb_a2_connector>;
> 				};
> 
> 				usb_hub_output2: endpoint@2 { // USB{DP,DM}_DN2
> 					reg = <2>;
> 					remote-endpoint = <&usb_a1_connector>;
> 				};
> 
> 				usb_hub_output3: endpoint@3 { // USB{DP,DM}_DN3
> 					reg = <3>;
> 					// goes to expansion connector
> 				};
> 			};
> 		};
> 	};
> 
> 	usb_id: usb-id {
> 		compatible = "linux,extcon-usb-gpio";
> 		id-gpio = <&msmgpio 121 GPIO_ACTIVE_HIGH>;
> 		pinctrl-names = "default";
> 		pinctrl-0 = <&usb_id_default>;
> 	};
> 
> 	usb-switch {
> 		compatible = "toshiba,tc7usb40mu";
> 		switch-gpios = <&pm8916_gpios 4 GPIO_ACTIVE_HIGH>;
> 		extcon = <&usb_id>;
> 		pinctrl-names = "default";
> 		pinctrl-0 = <&usb_sw_sel_pm>;
> 
> 		ports {
> 			#address-cells = <1>;
> 			#size-cells = <0>;
> 
> 			port@0 {
> 				#address-cells = <1>;
> 				#size-cells = <0>;
> 				reg = <0>;
> 
> 				usb_switch_input: endpoint@0 { // D+/D-
> 					reg = <0>;
> 					remote-endpoint = <&usb_output>;
> 				};
> 
> 				usb_switch_device_ep: endpoint@1 { // D1+/D1-
> 					reg = <1>;
> 					remote-endpoint = <&usb_ub_connector>;
> 				};
> 
> 				usb_switch_hub_ep: endpoint@2 { // D2+/D2-
> 					reg = <2>;
> 					remote-endpoint = <&usb_hub_input>;
> 				};
> 			};
> 		};
> 	};
> 
> 	uB-connector {
> 		compatible = "usb-ub-connector";
> 		#address-cells = <1>;
> 		#size-cells = <0>;
> 		usb-connector;
> 		port@0 {
> 			#address-cells = <1>;
> 			#size-cells = <0>;
> 			reg = <0>;
> 			usb_ub_connector: endpoint@0 {
> 				reg = <0>;
> 				remote-endpoint = <&usb_switch_device_ep>;
> 			};
> 		};
> 	};
> 
> 	usb-A-connector1 {
> 		compatible = "usb-A-connector";
> 		#address-cells = <1>;
> 		#size-cells = <0>;
> 		usb-connector;
> 		port@0 {
> 			#address-cells = <1>;
> 			#size-cells = <0>;
> 			reg = <0>;
> 			usb_a1_connector: endpoint@0 {
> 				reg = <0>;
> 				remote-endpoint = <&usb_hub_output2>;
> 			};
> 		};
> 	};
> 
> 	usb-A-connector2 {
> 		compatible = "usb-A-connector";
> 		#address-cells = <1>;
> 		#size-cells = <0>;
> 		usb-connector;
> 		port@0 {
> 			#address-cells = <1>;
> 			#size-cells = <0>;
> 			reg = <0>;
> 			usb_a2_connector: endpoint@0 {
> 				reg = <0>;
> 				remote-endpoint = <&usb_hub_output1>;
> 			};
> 		};
> 	};
> };
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 

Best Regards,
Peter Chen

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[RFC/PATCH] usb: misc: Add a driver for TC7USB40MU Stephen Boyd <stephen.boyd@linaro.org> - 2016-09-14 03:50 +0200
  Re: [RFC/PATCH] usb: misc: Add a driver for TC7USB40MU Peter Chen <hzpeterchen@gmail.com> - 2016-09-14 05:40 +0200
    Re: [RFC/PATCH] usb: misc: Add a driver for TC7USB40MU Peter Chen <hzpeterchen@gmail.com> - 2016-09-14 10:10 +0200
      Re: [RFC/PATCH] usb: misc: Add a driver for TC7USB40MU Peter Chen <hzpeterchen@gmail.com> - 2016-09-15 11:10 +0200
        Re: [RFC/PATCH] usb: misc: Add a driver for TC7USB40MU Peter Chen <hzpeterchen@gmail.com> - 2016-09-17 02:30 +0200
  Re: [RFC/PATCH] usb: misc: Add a driver for TC7USB40MU Stephen Boyd <stephen.boyd@linaro.org> - 2016-09-14 11:00 +0200
    Re: [RFC/PATCH] usb: misc: Add a driver for TC7USB40MU Peter Chen <hzpeterchen@gmail.com> - 2016-09-17 03:20 +0200

csiph-web