From patchwork Mon Oct 26 12:58:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanchayan Maity X-Patchwork-Id: 535927 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 CFD9814012C for ; Tue, 27 Oct 2015 00:03:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=Q66Oz9Q/; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A4AE94B660; Mon, 26 Oct 2015 14:03:39 +0100 (CET) X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" 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 8xL9DwSeZC0d; Mon, 26 Oct 2015 14:03:39 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AFB044B667; Mon, 26 Oct 2015 14:03:30 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DBB744B615 for ; Mon, 26 Oct 2015 14:03:14 +0100 (CET) X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" 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 bx_9wP-O8sbz for ; Mon, 26 Oct 2015 14:03:14 +0100 (CET) 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 mail-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by theia.denx.de (Postfix) with ESMTPS id 342CD4A03A for ; Mon, 26 Oct 2015 14:03:10 +0100 (CET) Received: by padhk11 with SMTP id hk11so188577682pad.1 for ; Mon, 26 Oct 2015 06:03:09 -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 :in-reply-to:references; bh=fROfuM1rglTjNdCNG1hIukJ/dNCE8S3VSVQq6JATSKw=; b=Q66Oz9Q/xFLoMqZLexB6k19fIs2vDrD7XzrNyw93wAoLZ/rN99Zlhgj1ndBZc52C9f peH+PaaiFDryytJ9mr5WMuciA5TVi2HvF/f79koTB6u0LzwyzGHckicIhbPh8XkObD1o XAOWfEzUpF8UntUk6f532AcHFWYcD9cyhaluLh4AyjQ/A6emffGpsRZct9g5aMNr32qA KeEAo7ratKyZFzYUyl08caWizqzsGOHNAnPx1XHwniwmzqmMk2gZ4ITcenCI15sf47ai RBB1sZpLOtcCPIwRNaLz5et3ThEgCv88yLmwnGyNAkIhCnA9DzRRSHulHAXmjBIZyZF4 880w== X-Received: by 10.67.14.161 with SMTP id fh1mr22258883pad.28.1445864589301; Mon, 26 Oct 2015 06:03:09 -0700 (PDT) Received: from localhost ([115.115.225.206]) by smtp.gmail.com with ESMTPSA id ha1sm33971305pbc.54.2015.10.26.06.03.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Oct 2015 06:03:08 -0700 (PDT) From: Sanchayan Maity To: u-boot@lists.denx.de Date: Mon, 26 Oct 2015 18:28:51 +0530 Message-Id: <11f8eded1a7972ae990bf8ce25c9146674503cd8.1445862541.git.maitysanchayan@gmail.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: References: In-Reply-To: References: Cc: marex@denx.de, santhosh.kj@hcl.com Subject: [U-Boot] [PATCH 3/3] colibri_vf: Add board_usb_phy_mode function 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" Add board_usb_phy_mode function for detecting whether a port is being used as host or client using a GPIO. On Colibri Vybrid we provide the GPIO 102 for the very same purpose. Signed-off-by: Sanchayan Maity --- board/toradex/colibri_vf/colibri_vf.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/board/toradex/colibri_vf/colibri_vf.c b/board/toradex/colibri_vf/colibri_vf.c index a6d1c5b..fd90ef2 100644 --- a/board/toradex/colibri_vf/colibri_vf.c +++ b/board/toradex/colibri_vf/colibri_vf.c @@ -34,6 +34,7 @@ DECLARE_GLOBAL_DATA_PTR; PAD_CTL_DSE_50ohm | PAD_CTL_OBE_IBE_ENABLE) #define USB_PEN_GPIO 83 +#define USB_CDET_GPIO 102 static struct ddrmc_cr_setting colibri_vf_cr_settings[] = { /* levelling */ @@ -92,6 +93,7 @@ static struct ddrmc_cr_setting colibri_vf_cr_settings[] = { static const iomux_v3_cfg_t usb_pads[] = { VF610_PAD_PTD4__GPIO_83, + VF610_PAD_PTC29__GPIO_102, }; int dram_init(void) @@ -280,7 +282,6 @@ static void setup_iomux_gpio(void) VF610_PAD_PTB23__GPIO_93, VF610_PAD_PTB26__GPIO_96, VF610_PAD_PTB28__GPIO_98, - VF610_PAD_PTC29__GPIO_102, VF610_PAD_PTC30__GPIO_103, VF610_PAD_PTA7__GPIO_134, }; @@ -554,4 +555,20 @@ int board_ehci_hcd_init(int port) } return 0; } + +int board_usb_phy_mode(int port) +{ + switch (port) { + case 0: + gpio_request(USB_CDET_GPIO, "usb-cdet-gpio"); + return gpio_get_value(USB_CDET_GPIO); + break; + case 1: + return 0; + break; + default: + return 0; + break; + } +} #endif