From patchwork Fri Oct 9 11:09:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siarhei Siamashka X-Patchwork-Id: 7360801 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 99729BEEA4 for ; Fri, 9 Oct 2015 11:12:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 96D6A2089F for ; Fri, 9 Oct 2015 11:12:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BD76F20896 for ; Fri, 9 Oct 2015 11:12:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZkVZM-0005aj-85; Fri, 09 Oct 2015 11:10:36 +0000 Received: from mail-lb0-x236.google.com ([2a00:1450:4010:c04::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZkVYw-000441-W8 for linux-arm-kernel@lists.infradead.org; Fri, 09 Oct 2015 11:10:13 +0000 Received: by lbbwt4 with SMTP id wt4so76812186lbb.1 for ; Fri, 09 Oct 2015 04:09:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=g4oTTPes2ZYLmgk/6cy0U3KYGGBsG77Rm83KwHkFU2I=; b=KPZ0ZYHUSI6SMKy8s3raQHF8UhtgKxKFBE2l4EZ4sCWKUjsYC7dZJbZeRQrcdKyH03 ETUEPiJtq1/qVq0gQpSGMLEX+v15VJxx56GwsM/Z3qNc72SNAUhshAWvUhvtWLMxUn51 uMfwzUzFkg6hMM2tcPhuxRLWgASji1LyzQElahsEsL7JyUfipBs5ZO8pqYh2/ooBvDY1 n4pJ+O8LzC71SrOFj+SjkA9Dd6g33+5daR1irsKjS50nkuNIJDHWbNlbwAqmGux84f20 nHsqA1I+omXtIVe7mO0v1w2n6R0V3QWy9ewtwmzvlvcMswaBHOG5aF3rWsAcsH6UDy+r Caag== X-Received: by 10.25.150.199 with SMTP id y190mr4206109lfd.35.1444388988748; Fri, 09 Oct 2015 04:09:48 -0700 (PDT) Received: from localhost.localdomain (85-76-179-242-nat.elisa-mobile.fi. [85.76.179.242]) by smtp.gmail.com with ESMTPSA id v19sm202299lfd.7.2015.10.09.04.09.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Oct 2015 04:09:47 -0700 (PDT) From: Siarhei Siamashka To: Maxime Ripard Subject: [PATCH v2 3/3] ARM: dts: sun4i: Enable USB DRC on pcDuino1/2 Date: Fri, 9 Oct 2015 14:09:39 +0300 Message-Id: <1444388979-12072-4-git-send-email-siarhei.siamashka@gmail.com> X-Mailer: git-send-email 2.4.9 In-Reply-To: <1444388979-12072-1-git-send-email-siarhei.siamashka@gmail.com> References: <1444388979-12072-1-git-send-email-siarhei.siamashka@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151009_041011_311521_5F55E33C X-CRM114-Status: GOOD ( 13.63 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree , linux-sunxi@googlegroups.com, Zoltan HERPAI , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Enable the otg/drc usb controller on the pcDuino1/2 board. Note that the pcDuino1 FEX file from the vendor contains the following information in the [usbc0] section: usb_id_gpio = port:PH04<0><1> usb_det_vbus_gpio = port:PH05<0><0> usb_drv_vbus_gpio = port:PB09<1><0><0> While the pcDuino2 FEX has: usb_id_gpio = port:PH04<0><1> usb_det_vbus_gpio = port:PH05<0><0> usb_drv_vbus_gpio = port:PD02<1><0><0> The ID pin is indeed PH4. The PD2 pin can be used to switch power on/off for the USB Type A receptacle on pcDuino2, but it has nothing to do with the MicroUSB OTG receptacle. The VBUS pin of the MicroUSB receptacle is always connected to 5V according to the schematics (both pcDuino1 and pcDuino2) and confirmed by doing some tests on pcDuino2. The PH5 pin is just one of the pins on the J8 expansion header and has nothing to do with USB OTG. The PB9 pin is pulled up and connected to the N_VBUSEN pin of AXP209 PMIC, while the VBUS pin of AXP209 only has a capacitor between it and the ground (this pin is not used for anything else). To sum it up. Only the ID pin (PH4) has a real use. And 5V voltage is always served to the MicroUSB OTG receptacle no matter what is the state of the PB9/PD2 pins. This patch has been tested on pcDuino2 to work fine in a host role with a USB keyboard connected via an OTG cable. It also works fine in a device role (cdc_ether) with a regular Micro-B cable connected to a desktop PC. Signed-off-by: Siarhei Siamashka --- arch/arm/boot/dts/sun4i-a10-pcduino.dts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/boot/dts/sun4i-a10-pcduino.dts b/arch/arm/boot/dts/sun4i-a10-pcduino.dts index 0b45d27..39034aa 100644 --- a/arch/arm/boot/dts/sun4i-a10-pcduino.dts +++ b/arch/arm/boot/dts/sun4i-a10-pcduino.dts @@ -164,6 +164,10 @@ status = "okay"; }; +&otg_sram { + status = "okay"; +}; + &pio { led_pins_pcduino: led_pins@0 { allwinner,pins = "PH15", "PH16"; @@ -178,6 +182,13 @@ allwinner,drive = ; allwinner,pull = ; }; + + usb0_id_detect_pin: usb0_id_detect_pin@0 { + allwinner,pins = "PH4"; + allwinner,function = "gpio_in"; + allwinner,drive = ; + allwinner,pull = ; + }; }; #include "axp209.dtsi" @@ -213,7 +224,15 @@ status = "okay"; }; +&usb_otg { + dr_mode = "otg"; + status = "okay"; +}; + &usbphy { + pinctrl-names = "default"; + pinctrl-0 = <&usb0_id_detect_pin>; + usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */ usb1_vbus-supply = <®_vcc5v0>; /* USB1 VBUS is always on */ usb2_vbus-supply = <®_vcc5v0>; /* USB2 VBUS is always on */ status = "okay";