From patchwork Thu Dec 6 06:32:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Birje X-Patchwork-Id: 204140 X-Patchwork-Delegate: promsoft@gmail.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 84EA72C0100 for ; Thu, 6 Dec 2012 17:27:12 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EB1EC4A199; Thu, 6 Dec 2012 07:27: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 RhCNVElxxx7R; Thu, 6 Dec 2012 07:27:10 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AF29D4A19F; Thu, 6 Dec 2012 07:27:03 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0AE5E4A17E for ; Thu, 6 Dec 2012 07:27:01 +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 yoFM-a5I4y1C for ; Thu, 6 Dec 2012 07:26:58 +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 mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by theia.denx.de (Postfix) with ESMTP id 9908A4A165 for ; Thu, 6 Dec 2012 07:26:56 +0100 (CET) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MEL00HMDJ8MP430@mailout3.samsung.com> for u-boot@lists.denx.de; Thu, 06 Dec 2012 15:26:48 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.124]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 62.28.01231.8AA30C05; Thu, 06 Dec 2012 15:26:48 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-62-50c03aa83882 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id E1.28.01231.8AA30C05; Thu, 06 Dec 2012 15:26:48 +0900 (KST) Received: from rajeshwari-linux.sisodomain.com ([107.108.215.115]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MEL00CEOJ8F0GD0@mmp2.samsung.com> for u-boot@lists.denx.de; Thu, 06 Dec 2012 15:26:48 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Date: Thu, 06 Dec 2012 12:02:34 +0530 Message-id: <1354775556-23212-2-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1354775556-23212-1-git-send-email-rajeshwari.s@samsung.com> References: <1354775556-23212-1-git-send-email-rajeshwari.s@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsWyRsSkRneF1YEAgzen9S3e7u1kd2D0OHtn B2MAYxSXTUpqTmZZapG+XQJXxur7XxkLWiQqTjeuYW9gXCPcxcjJISFgIrGy9wA7hC0mceHe ejYQW0hgKaPE41e1MDXvbz1l6mLkAopPZ5R483YWC4Szikmi5dlPsG42ASOJrSenMYLYIgIS Er/6r4LZzALZEqevNYHVCAuYSnQ9PwxmswioSvTu+wlWwyvgIXFx01FGiG0KEsemfmXtY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 WgQzjomDU6qBsVmtYZpg3aIfRyrsPVjnukove2t0XuzwrynMmXJT4twX8IgX3bok1OOb2nrr cUNgY/5kQTfWR2+FU2Z+e/FqwmzZzW5vV54MmN9zSXzF54p9X3KO6SnpVG26+n7pJ5ctP5c8 i/tYqph+bJlUg4jf5bN/XDcZBnGXqx0unaS0QfRlXqKtMas/qxJLcUaioRZzUXEiALbdeBye AgAA X-CFilter-Loop: Reflected Cc: marex@denx.de, patches@linaro.org Subject: [U-Boot] [PATCH 1/3 V2] EHCI: Exynos: Add fdt support 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 Adding fdt support to ehci-exynos in order to parse register base addresses from the device node. Signed-off-by: Vivek Gautam Signed-off-by: Rajeshwari Shinde --- Chnages in V2: - Removed checkpatch errors. drivers/usb/host/ehci-exynos.c | 59 ++++++++++++++++++++++++++++++++++++--- 1 files changed, 54 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index 9f0ed06..f9189a5 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -21,6 +21,8 @@ */ #include +#include +#include #include #include #include @@ -28,6 +30,9 @@ #include #include "ehci.h" +/* Declare global data pointer */ +DECLARE_GLOBAL_DATA_PTR; + /* Setup the EHCI host controller. */ static void setup_usb_phy(struct exynos_usb_phy *usb) { @@ -86,12 +91,39 @@ static void reset_usb_phy(struct exynos_usb_phy *usb) */ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) { - struct exynos_usb_phy *usb; + struct exynos_usb_phy *usb = NULL; + unsigned int *hcd = NULL; + unsigned int node; + + node = fdtdec_next_compatible(gd->fdt_blob, 0, + COMPAT_SAMSUNG_EXYNOS_EHCI); + if (node <= 0) { + debug("EHCI: Can't get device tree node for ehci\n"); + return -1; + } + + /* + * Get the base address for usbphy from the device node + */ + usb = (struct exynos_usb_phy *)fdtdec_get_addr(gd->fdt_blob, node, + "phyreg"); + if (usb == NULL) { + debug("Can't get the usbphy register address\n"); + return -1; + } - usb = (struct exynos_usb_phy *)samsung_get_base_usb_phy(); setup_usb_phy(usb); - *hccr = (struct ehci_hccr *)samsung_get_base_usb_ehci(); + /* + * Get the base address for XHCI controller from the device node + */ + hcd = (unsigned int *)fdtdec_get_addr(gd->fdt_blob, node, "reg"); + if (hcd == NULL) { + debug("Can't get the XHCI registere address\n"); + return -1; + } + + *hccr = (struct ehci_hccr *)hcd; *hcor = (struct ehci_hcor *)((uint32_t) *hccr + HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase))); @@ -108,9 +140,26 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) */ int ehci_hcd_stop(int index) { - struct exynos_usb_phy *usb; + struct exynos_usb_phy *usb = NULL; + unsigned int node; + + node = fdtdec_next_compatible(gd->fdt_blob, 0, + COMPAT_SAMSUNG_EXYNOS_EHCI); + if (node <= 0) { + debug("EHCI: Can't get device tree node for ehci\n"); + return -1; + } + + /* + * Get the base address for usbphy from the device node + */ + usb = (struct exynos_usb_phy *)fdtdec_get_addr(gd->fdt_blob, node, + "phyreg"); + if (usb == NULL) { + debug("Can't get the usbphy register address\n"); + return -1; + } - usb = (struct exynos_usb_phy *)samsung_get_base_usb_phy(); reset_usb_phy(usb); return 0;