From patchwork Sat Mar 25 14:50:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Icenowy Zheng X-Patchwork-Id: 9644653 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A8E0560327 for ; Sat, 25 Mar 2017 14:54:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94E1425D9E for ; Sat, 25 Mar 2017 14:54:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87A3527165; Sat, 25 Mar 2017 14:54:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 03B3C25D9E for ; Sat, 25 Mar 2017 14:54:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=5MdT2BjJnWu0zcJD5BExxMhcdBw+3544FwHz/4fEpAQ=; b=Gjlh9LbDwVwQMv2QwdEIv+r1jI RtKp/BZIS2hFbaRSSxpy3dwZSka3jq4Wn+/oBY7B9r5MTmkeYXJa39drrtiYPZe69l1APIPXcEJgu 2iLl5qZWk7WMhrjTJpK+plqWaePdGdH1VMpVUBRCCzSsT4eGCIIEca0873I8o1RZCyqyTDCGONOfD stGlkAMKouFpGNOQZOwD46UFUiOmZ1niOF0QwBaqZt2uMDEd/WsUNMKHiJh06/q8tXDSHkzkSXsv9 BT4O9GwgNT7PC/WtCRlS/yhSFmMDRp672zoAvRbei1aGbAJxrjdpSuc+EwFVTGWxVX+HIfIpcQIUS KHdeNBwA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1crn4w-0004nH-Ev; Sat, 25 Mar 2017 14:54:06 +0000 Received: from forward20j.cmail.yandex.net ([5.255.227.239]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1crn4l-0004Tl-Jo for linux-arm-kernel@lists.infradead.org; Sat, 25 Mar 2017 14:53:57 +0000 Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b6:6]) by forward20j.cmail.yandex.net (Yandex) with ESMTP id 7566C2158E; Sat, 25 Mar 2017 17:53:30 +0300 (MSK) Received: from smtp1p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp1p.mail.yandex.net (Yandex) with ESMTP id 5C5031780624; Sat, 25 Mar 2017 17:53:24 +0300 (MSK) Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id FLDdwlGmvF-rI9K8Xre; Sat, 25 Mar 2017 17:53:22 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aosc.xyz; s=mail; t=1490453603; bh=c7RzwrCOH4Pck9IH7NuJf7N1NaBxVQn4+i6O2zjzJ5M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=PCY7FIST5ASBi6GJvVY1H/cBA6ME7QV/P2gF3gXdV2yOyUMOrbGscBBr9MMeMiaWA I1wveXpb7d9d4qWBF+NSi56tn3DME+/kwjF9VVPtLSbZE2oUUL1pMiEBh9+k6doE7y l+iuuVlTgEptQ09zRJjW2kbpfaWL7ZtdnqPM8boY= Authentication-Results: smtp1p.mail.yandex.net; dkim=pass header.i=@aosc.xyz X-Yandex-ForeignMX: GB X-Yandex-Suid-Status: 1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 1130000036118848 From: Icenowy Zheng To: Kishon Vijay Abraham I , Rob Herring , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v5 7/8] ARM: sun8i: h2+: enable USB OTG for Orange Pi Zero board Date: Sat, 25 Mar 2017 22:50:14 +0800 Message-Id: <20170325145015.22076-8-icenowy@aosc.xyz> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170325145015.22076-1-icenowy@aosc.xyz> References: <20170325145015.22076-1-icenowy@aosc.xyz> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170325_075355_907456_822BDF9F X-CRM114-Status: GOOD ( 12.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Icenowy Zheng MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Orange Pi Zero board features a USB OTG port, which has a ID pin, and can be used to power up the board. However, even if the board is powered via +5V pin in GPIO/expansion headers, the VBUS in the OTG port cannot be powered up, thus it's impossible to use it in host mode with simple OTG cables. Add support for it in peripheral mode. If someone really want to use it in host mode, the mode of PHY can be switch via sysfs, then use a powered USB OTG cable or powered USB HUB to power up external USB devices. Signed-off-by: Icenowy Zheng Acked-by: Chen-Yu Tsai --- Changes in v5: - Add Chen-Yu's ACK. Changes in v3: - Add "h2+:" in commit message. arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts index 96c32293598a..9e8b082c134f 100644 --- a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +++ b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts @@ -95,6 +95,10 @@ }; }; +&ehci0 { + status = "okay"; +}; + &ehci1 { status = "okay"; }; @@ -131,6 +135,10 @@ bias-pull-up; }; +&ohci0 { + status = "okay"; +}; + &ohci1 { status = "okay"; }; @@ -153,7 +161,17 @@ status = "disabled"; }; +&usb_otg { + dr_mode = "peripheral"; + status = "okay"; +}; + &usbphy { - /* USB VBUS is always on */ + /* + * USB Type-A port VBUS is always on. However, MicroUSB VBUS can only + * power up the board; when it's used as OTG port, this VBUS is + * always off even if the board is powered via GPIO pins. + */ status = "okay"; + usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */ };