From patchwork Sun Oct 4 18:58:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siarhei Siamashka X-Patchwork-Id: 7323991 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 21D7D9F54C for ; Sun, 4 Oct 2015 19:01:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 278AB2089B for ; Sun, 4 Oct 2015 19:01:49 +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 38B5A206A2 for ; Sun, 4 Oct 2015 19:01:48 +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 1ZioVZ-0001nU-R2; Sun, 04 Oct 2015 18:59:41 +0000 Received: from mail-lb0-x235.google.com ([2a00:1450:4010:c04::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZioVC-0001XJ-BO for linux-arm-kernel@lists.infradead.org; Sun, 04 Oct 2015 18:59:19 +0000 Received: by lbwr8 with SMTP id r8so47561589lbw.2 for ; Sun, 04 Oct 2015 11:58:56 -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=CyRo1/sIR7fslxkXwkLnXMJXkxlH/3vu8q7fzuPffxk=; b=NtnBLQi1fNZ6HNrAcGOilMldZrLg9JN8729t3Y1w/NES8TYyQyYDYSC6YzzwQKYTew gNlPx0cbu6PsyWcWosIE3/kc/aQOBXpqcvXXJJQfCCc78Ifoa+NOFc2FPy33glV/L1xg r8exaytfO0LOwFGnYCfYRWEtgfNTbgyqj2tVjSEE5Kwb6xsJjA4WqXHpHHdy8u3b+Ea+ 8VgpirDaKPZSxBzJgeQFm+powXP7gyA7xoYWBiNHMjr9CcHgbJ46debMUdGC7QjtF3bM ZtzUqTWdpuKgyAyI2KUigd5THA78NvEVY2pX6uMfXdTWnZnydK7Y5n0av31a1XpCVimj G5Hw== X-Received: by 10.112.32.72 with SMTP id g8mr9584613lbi.22.1443985135955; Sun, 04 Oct 2015 11:58:55 -0700 (PDT) Received: from localhost.localdomain (85-76-146-178-nat.elisa-mobile.fi. [85.76.146.178]) by smtp.gmail.com with ESMTPSA id ug2sm3450987lbc.34.2015.10.04.11.58.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Oct 2015 11:58:55 -0700 (PDT) From: Siarhei Siamashka To: Maxime Ripard Subject: [PATCH 2/3] ARM: dts: sun4i: Enable USB DRC on pcDuino1/2 Date: Sun, 4 Oct 2015 21:58:47 +0300 Message-Id: <1443985128-23137-3-git-send-email-siarhei.siamashka@gmail.com> X-Mailer: git-send-email 2.4.9 In-Reply-To: <1443985128-23137-1-git-send-email-siarhei.siamashka@gmail.com> References: <1443985128-23137-1-git-send-email-siarhei.siamashka@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151004_115918_615917_C45391B1 X-CRM114-Status: GOOD ( 12.62 ) 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 pcDuino2 FEX file from the vendor contains the following information: [usbc0] usb_used = 1 usb_port_type = 0 usb_detect_type = 1 usb_id_gpio = port:PH04<0><1> usb_det_vbus_gpio = port:PH05<0><0> usb_drv_vbus_gpio = port:PD02<1><0><0> usb_host_init_state = 0 The ID pin is indeed PH4. The PD2 pin can be used to switch power on/off for the USB Type A receptacle, 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 and confirmed by doing some tests with the device. The PH5 pin is just one of the pins on the J8 expansion header and has nothing to do with USB OTG. There is also the PB9 pin labelled as USB0-DRV on the schematics. This 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) works as expected. 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 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 fdc074c..c9b9330 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 = ; + }; }; &uart0 { @@ -186,6 +197,14 @@ 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 */ status = "okay"; };