From patchwork Wed May 15 15:55:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Popov X-Patchwork-Id: 244124 X-Patchwork-Delegate: trini@ti.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 DA5582C009E for ; Thu, 16 May 2013 01:56:14 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 934764A037; Wed, 15 May 2013 17:56:13 +0200 (CEST) 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 DiLwEZtoJO9h; Wed, 15 May 2013 17:56:13 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1EED94A02D; Wed, 15 May 2013 17:56:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1BFD84A02D for ; Wed, 15 May 2013 17:56:04 +0200 (CEST) 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 LSwL4KaKztK1 for ; Wed, 15 May 2013 17:55:58 +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 extserv.mm-sol.com (ns.mm-sol.com [213.240.235.226]) by theia.denx.de (Postfix) with ESMTPS id 871924A02C for ; Wed, 15 May 2013 17:55:51 +0200 (CEST) Received: from intsrv.int.mm-sol.com (unknown [172.18.0.2]) by extserv.mm-sol.com (Postfix) with ESMTP id 990B5C64D; Wed, 15 May 2013 18:55:50 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by intsrv.int.mm-sol.com (Postfix) with ESMTP id 93857FC2CB4; Wed, 15 May 2013 18:55:50 +0300 (EEST) X-Virus-Scanned: by amavisd-new-2.7.1 (20120429) Received: from intsrv.int.mm-sol.com ([127.0.0.1]) by localhost (mail.mm-sol.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A6-gjQRS3qxP; Wed, 15 May 2013 18:55:43 +0300 (EEST) Received: from [172.20.1.4] (unknown [172.20.1.4]) by intsrv.int.mm-sol.com (Postfix) with ESMTPS id CD44AD2E002; Wed, 15 May 2013 18:55:43 +0300 (EEST) Message-ID: <5193AFEC.60700@mm-sol.com> Date: Wed, 15 May 2013 18:55:24 +0300 From: Lubomir Popov Organization: MM Solutions AD User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: u-boot@lists.denx.de Cc: Tom Rini Subject: [U-Boot] [PATCH RFC] OMAP5: uEVM: Enable USB EHCI functionality (preliminary, not tested) 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Prerequisites: appropriate patches to the USB EHCI and Eth drivers, and to the OMAP5 clock register definitions. Signed-off-by: Lubomir Popov --- Assumption is that this code shall run on TI 750-2628-21X hardware (also known as OMAP5432 ES2.0 PandaBoard5) - the GPIOs that I used used for HSIC reset correspond to that board. Looking at mux_data.h however, I'm somewhat concerned. All the uevm board files are inherited from the sEVM, which is a very different hardware platform, and I'm afraid that only changing the file names might not be sufficient. The patch is not tested yet due to lack of hardware. Tom, I'm hoping for your assistance. board/ti/omap5_uevm/evm.c | 59 +++++++++++++++++++++++++++++++++++++++++- include/configs/omap5_uevm.h | 34 +++++++++++++++++++++++- 2 files changed, 91 insertions(+), 2 deletions(-) diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c index 46db1bf..3144fba 100644 --- a/board/ti/omap5_uevm/evm.c +++ b/board/ti/omap5_uevm/evm.c @@ -26,13 +26,20 @@ #include #include #include +#include #include "mux_data.h" +#ifdef CONFIG_USB_EHCI +#include +#include +#include +#endif + DECLARE_GLOBAL_DATA_PTR; const struct omap_sysinfo sysinfo = { - "Board: OMAP5430 EVM\n" + "Board: OMAP5432 uEVM\n" }; /** @@ -99,3 +106,53 @@ int board_mmc_init(bd_t *bis) return 0; } #endif + +#ifdef CONFIG_USB_EHCI +static struct omap_usbhs_board_data usbhs_bdata = { + .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, + .port_mode[1] = OMAP_EHCI_PORT_MODE_HSIC, /* USB3503 hub */ + .port_mode[2] = OMAP_EHCI_PORT_MODE_HSIC, /* LAN9730 Ethernet */ +}; + +int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) +{ + int ret; + + /* Enbale USB ports 2 & 3 UHH, UTMI and HSIC clocks */ + setbits_le32((*prcm)->cm_l3init_hsusbhost_clkctrl, + USB_HOST_HS_CLKCTRL_EN); + /* Enbale USB host ports TLL clocks */ + setbits_le32((*prcm)->cm_l3init_hsusbtll_clkctrl, + USB_TLL_HS_CLKCTRL_EN); + + /* + * The hub uses OMAP FREF_CLK1_OUT at 19.2 MHz. Use default source + * (SYS_CLK) and default divider of 1, so just turn it on. + */ + setbits_le32((*prcm)->scrm_auxclk1, AUXCLK_ENABLE_MASK); + udelay(1000); /* Let PLL lock */ + + ret = omap_ehci_hcd_init(&usbhs_bdata, hccr, hcor); + if (ret < 0) + return ret; + + return 0; +} + +int ehci_hcd_stop(void) +{ + int ret; + + ret = omap_ehci_hcd_stop(); + + clrbits_le32((*prcm)->cm_l3init_hsusbhost_clkctrl, + USB_HOST_HS_CLKCTRL_EN); + clrbits_le32((*prcm)->cm_l3init_hsusbtll_clkctrl, + USB_TLL_HS_CLKCTRL_EN); + + /* Stop FREF_CLK1_OUT */ + clrbits_le32((*prcm)->scrm_auxclk1, AUXCLK_ENABLE_MASK); + return ret; +} +#endif /* CONFIG_USB_EHCI */ + diff --git a/include/configs/omap5_uevm.h b/include/configs/omap5_uevm.h index c791789..e15dd99 100644 --- a/include/configs/omap5_uevm.h +++ b/include/configs/omap5_uevm.h @@ -52,7 +52,39 @@ #define CONFIG_PARTITION_UUIDS #define CONFIG_CMD_PART -#define CONFIG_SYS_PROMPT "OMAP5430 EVM # " +/* USB UHH support options */ +#define CONFIG_CMD_USB +#define CONFIG_USB_HOST +#define CONFIG_USB_EHCI +#define CONFIG_USB_EHCI_OMAP +#define CONFIG_USB_STORAGE +#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3 + +/* + * Due to OMAP5 HSIC connect ussues, device reset is required + * upon applying port power. A GPIO is needed per HSIC device: + */ +#define CONFIG_OMAP_HSIC_PORT2_RESET_GPIO 80 /* USB 3-port hub */ +#define CONFIG_OMAP_HSIC_PORT3_RESET_GPIO 79 /* Ethernet Ctrlr */ + +/* + * Enable bit fields for USB ports 2 & 3 HS clocks setup in regs + * cm_l3init_hsusbhost_clkctrl and cm_l3init_hsusbtll_clkctrl: + */ +#define USB_HOST_HS_CLKCTRL_EN 0x0000d6c0 +#define USB_TLL_HS_CLKCTRL_EN 0x00000600 + +/* USB Networking options */ +#define CONFIG_USB_HOST_ETHER +#define CONFIG_USB_ETHER_SMSC95XX + +/* Enabled commands */ +#define CONFIG_CMD_NET /* bootp, tftpboot, rarpboot */ +#define CONFIG_CMD_NFS /* NFS support */ +#define CONFIG_CMD_DHCP /* DHCP support */ +#define CONFIG_CMD_PING /* PING support */ + +#define CONFIG_SYS_PROMPT "OMAP5432 uEVM # " #define CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC 16296 #endif /* __CONFIG_OMAP5_EVM_H */