devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Holland <samuel@sholland.org>
To: qianfanguijin@163.com
Cc: linux-sunxi@lists.linux.dev,
	Andre Przywara <andre.przywara@arm.com>,
	Evgeny Boger <boger@wirenboard.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Chen-Yu Tsai <wens@csie.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] ARM: dts: bananapi-m2-ultra: Enable USB0_OTG and HOST support
Date: Mon, 4 Jul 2022 21:38:38 -0500	[thread overview]
Message-ID: <dcb5db59-df69-e25f-0389-e1617b4805aa@sholland.org> (raw)
In-Reply-To: <20220518101706.26869-3-qianfanguijin@163.com>

Hi Qianfan,

On 5/18/22 5:17 AM, qianfanguijin@163.com wrote:
> From: qianfan Zhao <qianfanguijin@163.com>
> 
> let USB0 work at OTG mode.
> 
> Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
> ---
>  .../boot/dts/sun8i-r40-bananapi-m2-ultra.dts  | 39 +++++++++++++++++++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
> index 28197bbcb1d5..b3421e67967d 100644
> --- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
> +++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
> @@ -122,6 +122,10 @@ &de {
>  	status = "okay";
>  };
>  
> +&ehci0 {
> +	status = "okay";
> +};
> +
>  &ehci1 {
>  	status = "okay";
>  };
> @@ -164,6 +168,7 @@ axp22x: pmic@34 {
>  		reg = <0x34>;
>  		interrupt-parent = <&nmi_intc>;
>  		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> +		x-powers,drive-vbus-en;
>  	};
>  };
>  
> @@ -199,6 +204,10 @@ &mmc2 {
>  	status = "okay";
>  };
>  
> +&ohci0 {
> +	status = "okay";
> +};
> +
>  &ohci1 {
>  	status = "okay";
>  };
> @@ -216,6 +225,15 @@ &pio {
>  	vcc-pe-supply = <&reg_eldo1>;
>  	vcc-pf-supply = <&reg_dcdc1>;
>  	vcc-pg-supply = <&reg_dldo1>;
> +
> +	/* USB0_DRVVBUS connected to both the PMIC.N_VBUSEN and PI13,
> +	 * we chose PMIC.N_VBUSEN for control, so set the gpio as
> +	 * input mode here.
> +	 */

Toggling a GPIO is going to be more efficient and have lower latency than a PMIC
register write over I2C. (And there are several comments in the USB PHY driver
about latency being important.) So I would prefer to model this as a
GPIO-controlled regulator, and leave N_VBUSEN as an input.

Regards,
Samuel

> +	usb0_vbus_enable_gpio: usb0-vbus-enable-gpio {
> +		pins = "PI13";
> +		function = "gpio_in";
> +	};
>  };
>  
>  &reg_aldo2 {
> @@ -298,6 +316,11 @@ &reg_dldo4 {
>  	regulator-name = "vdd2v5-sata";
>  };
>  
> +&reg_drivevbus {
> +	regulator-name = "usb0-vbus";
> +	status = "okay";
> +};
> +
>  &reg_eldo3 {
>  	regulator-min-microvolt = <1200000>;
>  	regulator-max-microvolt = <1200000>;
> @@ -333,7 +356,23 @@ bluetooth {
>  	};
>  };
>  
> +&usb_otg {
> +	dr_mode = "otg";
> +	status = "okay";
> +};
> +
> +&usb_power_supply {
> +	status = "okay";
> +};
> +
>  &usbphy {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&usb0_vbus_enable_gpio>;
> +
> +	usb0_id_det-gpios = <&pio 8 4 GPIO_ACTIVE_HIGH>; /* PI4 */
> +	usb0_vbus_det-gpios = <&pio 8 8 GPIO_ACTIVE_HIGH>; /* PI8 */
> +	usb0_vbus_power-supply = <&usb_power_supply>;
> +	usb0_vbus-supply = <&reg_drivevbus>;
>  	usb1_vbus-supply = <&reg_vcc5v0>;
>  	usb2_vbus-supply = <&reg_vcc5v0>;
>  	status = "okay";
> 


  reply	other threads:[~2022-07-05  2:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18 10:17 [PATCH v4 0/2] ARM: sun8i-r40: Enable usb otg support qianfanguijin
2022-05-18 10:17 ` [PATCH v4 1/2] ARM: dts: sun8i-r40: Add USB0_OTG/HOST support qianfanguijin
2022-07-05  1:55   ` Samuel Holland
2022-05-18 10:17 ` [PATCH v4 2/2] ARM: dts: bananapi-m2-ultra: Enable USB0_OTG and HOST support qianfanguijin
2022-07-05  2:38   ` Samuel Holland [this message]
2022-05-19 10:04 ` [PATCH v4 0/2] ARM: sun8i-r40: Enable usb otg support qianfan
2022-05-19 20:54   ` Evgeny Boger
2022-05-21  4:26     ` qianfan
2022-05-21 11:10       ` Evgeny Boger
2022-07-05  4:05         ` Samuel Holland
2022-05-23 13:10     ` Icenowy Zheng
2022-05-23 13:11 ` Icenowy Zheng
2022-05-24  9:15   ` qianfan
2022-07-05  4:15   ` Samuel Holland

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=dcb5db59-df69-e25f-0389-e1617b4805aa@sholland.org \
    --to=samuel@sholland.org \
    --cc=andre.przywara@arm.com \
    --cc=boger@wirenboard.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=qianfanguijin@163.com \
    --cc=robh+dt@kernel.org \
    --cc=wens@csie.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).