From patchwork Sat Apr 2 19:10:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 605454 X-Patchwork-Delegate: hdegoede@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3qcnsY5ct0z9sC4 for ; Sun, 3 Apr 2016 05:11:13 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B79ADA760D; Sat, 2 Apr 2016 21:11:09 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0D7gEkw7FE8Z; Sat, 2 Apr 2016 21:11:09 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A6044A760F; Sat, 2 Apr 2016 21:11:05 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ADD5FA74C3 for ; Sat, 2 Apr 2016 21:11:01 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WlQhgV8WwRgY for ; Sat, 2 Apr 2016 21:11:01 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by theia.denx.de (Postfix) with ESMTPS id 63DF4A75F9 for ; Sat, 2 Apr 2016 21:10:57 +0200 (CEST) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C1ABC19D004; Sat, 2 Apr 2016 19:10:54 +0000 (UTC) Received: from localhost.localdomain.com (vpn1-6-73.ams2.redhat.com [10.36.6.73]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u32JAp72028049; Sat, 2 Apr 2016 15:10:52 -0400 From: Hans de Goede To: Ian Campbell Date: Sat, 2 Apr 2016 21:10:46 +0200 Message-Id: <1459624248-13306-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 1/3] sunxi: Add INITIAL_USB_SCAN_DELAY Kconfig option X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Some boards have on board usb devices which need longer then the USB spec's 1 second to connect from board powerup. Add a config option which when non 0 adds an extra delay before the first usb bus scan. Signed-off-by: Hans de Goede Acked-by: Ian Campbell --- arch/arm/mach-sunxi/usb_phy.c | 7 +++++++ board/sunxi/Kconfig | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/arch/arm/mach-sunxi/usb_phy.c b/arch/arm/mach-sunxi/usb_phy.c index b258ce4..f9993d2 100644 --- a/arch/arm/mach-sunxi/usb_phy.c +++ b/arch/arm/mach-sunxi/usb_phy.c @@ -85,6 +85,8 @@ static struct sunxi_usb_phy { #endif }; +static int initial_usb_scan_delay = CONFIG_INITIAL_USB_SCAN_DELAY; + static int get_vbus_gpio(int index) { switch (index) { @@ -269,6 +271,11 @@ void sunxi_usb_phy_power_on(int index) { struct sunxi_usb_phy *phy = &sunxi_usb_phy[index]; + if (initial_usb_scan_delay) { + mdelay(initial_usb_scan_delay); + initial_usb_scan_delay = 0; + } + phy->power_on_count++; if (phy->power_on_count != 1) return; diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 464fa0f..2b0d1df 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -312,6 +312,15 @@ config MMC_SUNXI_SLOT_EXTRA slot or emmc on mmc1 - mmc3. Setting this to 1, 2 or 3 will enable support for this. +config INITIAL_USB_SCAN_DELAY + int "delay initial usb scan by x ms to allow builtin devices to init" + default 0 + ---help--- + Some boards have on board usb devices which need longer then the + USB spec's 1 second to connect from board powerup. Set this config + option to a non 0 value to add an extra delay before the first usb + bus scan. + config USB0_VBUS_PIN string "Vbus enable pin for usb0 (otg)" default ""