From patchwork Tue Nov 27 16:37:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Genoud X-Patchwork-Id: 202275 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 878CA2C0091 for ; Wed, 28 Nov 2012 05:26:30 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CD5334A10B; Tue, 27 Nov 2012 19:26:10 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 7rRZgbNFc7w3; Tue, 27 Nov 2012 19:26:10 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F1BBC4A124; Tue, 27 Nov 2012 19:25:43 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5753E4A0B7 for ; Tue, 27 Nov 2012 17:45:30 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 hgZ9TEbmUsHd for ; Tue, 27 Nov 2012 17:45:29 +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-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by theia.denx.de (Postfix) with ESMTPS id 8FAA54A0AD for ; Tue, 27 Nov 2012 17:45:26 +0100 (CET) Received: by mail-wi0-f180.google.com with SMTP id hn14so3648619wib.9 for ; Tue, 27 Nov 2012 08:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=les5r8BwhLByRGsurB4XSlKQGVOiVkYkkre6l5Tb+2I=; b=pWbOaZETB35CghVOf1Q1CXJY8GFvUzkSCFfSHQzYoAriKWPnLY4RVdE28kzv1Y0k0r rcj/qWQnNf94NDp1mTGhGfdHW1Bs0ugVI0FJkZtI4QnUOyCvNyGVv9pzfBKmVQydVriM jmY3+s3JUL/CscVbz0Rh6p36/T3TRplD9nwwMus5jwXzFjU2sIBsP1GbfGwKbh9Xaf/l PX0nC+V22O9qZNxXuAkzzSJMu8tM3rwzI/nf0TL2AvpmWScyCOs0HJEJMh6ruTIiLuo2 ++Ae7W25nclAG0EW8fGKztfSaPWfnrjXT8kOCQOv4Kd8t0hY9clCA4d648pas0LEYHgg FziA== Received: by 10.216.45.135 with SMTP id p7mr6463898web.129.1354034293738; Tue, 27 Nov 2012 08:38:13 -0800 (PST) Received: from localhost.localdomain (lyon.paratronic.fr. [213.41.177.106]) by mx.google.com with ESMTPS id y3sm3201787wix.6.2012.11.27.08.38.12 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 27 Nov 2012 08:38:13 -0800 (PST) From: Richard Genoud To: =?UTF-8?q?Andreas=20Bie=C3=9Fmann?= Date: Tue, 27 Nov 2012 17:37:51 +0100 Message-Id: <1354034273-15093-3-git-send-email-richard.genoud@gmail.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1354034273-15093-1-git-send-email-richard.genoud@gmail.com> References: <1354034273-15093-1-git-send-email-richard.genoud@gmail.com> X-Mailman-Approved-At: Tue, 27 Nov 2012 19:25:36 +0100 Cc: Richard Genoud , u-boot@lists.denx.de, Bo Shen Subject: [U-Boot] [PATCH 2/4] ARM: at91sam9x5: enable USB OHCI support for 9x5ek board. X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Signed-off-by: Richard Genoud --- arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 9 +++++++++ arch/arm/include/asm/arch-at91/at91sam9x5.h | 2 ++ board/atmel/at91sam9x5ek/at91sam9x5ek.c | 3 +++ drivers/usb/host/ohci-at91.c | 6 ++++-- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c index 9348552..6af5a88 100644 --- a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c +++ b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c @@ -193,6 +193,15 @@ void at91_spi1_hw_init(unsigned long cs_mask) } #endif +#ifdef CONFIG_USB_OHCI_NEW +void at91_uhp_hw_init(void) +{ + /* Enable VBus on UHP ports */ + at91_set_pio_output(AT91_PIO_PORTD, 19, 0); + at91_set_pio_output(AT91_PIO_PORTD, 20, 0); +} +#endif + #ifdef CONFIG_MACB void at91_macb_hw_init(void) { diff --git a/arch/arm/include/asm/arch-at91/at91sam9x5.h b/arch/arm/include/asm/arch-at91/at91sam9x5.h index 0e728c9..de0f1b1 100644 --- a/arch/arm/include/asm/arch-at91/at91sam9x5.h +++ b/arch/arm/include/asm/arch-at91/at91sam9x5.h @@ -154,6 +154,8 @@ #define ATMEL_PIO_PORTS 4 #define CPU_HAS_PIO3 #define PIO_SCDR_DIV (0x3fff << 0) /* Slow Clock Divider Mask */ +#define ATMEL_PMC_UHP AT91SAM926x_PMC_UHP +#define ATMEL_ID_UHP ATMEL_ID_UHPHS /* * at91sam9x5 specific prototypes diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c b/board/atmel/at91sam9x5ek/at91sam9x5ek.c index edb0886..9837a17 100644 --- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c +++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c @@ -295,6 +295,9 @@ int board_init(void) at91_macb_hw_init(); #endif +#ifdef CONFIG_USB_OHCI_NEW + at91_uhp_hw_init(); +#endif #ifdef CONFIG_LCD at91sam9x5ek_lcd_hw_init(); #endif diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 9532dd9..efd711d 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -41,7 +41,8 @@ int usb_cpu_init(void) writel(get_pllb_init(), &pmc->pllbr); while ((readl(&pmc->sr) & AT91_PMC_LOCKB) != AT91_PMC_LOCKB) ; -#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) +#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) || \ + defined(CONFIG_AT91SAM9X5) /* Enable UPLL */ writel(readl(&pmc->uckr) | AT91_PMC_UPLLEN | AT91_PMC_BIASEN, &pmc->uckr); @@ -81,7 +82,8 @@ int usb_cpu_stop(void) writel(0, &pmc->pllbr); while ((readl(&pmc->sr) & AT91_PMC_LOCKB) != 0) ; -#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) +#elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) || \ + defined(CONFIG_AT91SAM9X5) /* Disable UPLL */ writel(readl(&pmc->uckr) & (~AT91_PMC_UPLLEN), &pmc->uckr); while ((readl(&pmc->sr) & AT91_PMC_LOCKU) == AT91_PMC_LOCKU)