From patchwork Mon Dec 3 13:30:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 13336 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7F7A423E27 for ; Mon, 3 Dec 2012 13:25:35 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 0EDBEA182C7 for ; Mon, 3 Dec 2012 13:25:34 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so3909281ieb.11 for ; Mon, 03 Dec 2012 05:25:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:x-auditid :from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :dlp-filter:x-mtr:x-brightmail-tracker:x-brightmail-tracker :x-cfilter-loop:x-gm-message-state; bh=RxatZ+tH8C/UiEF4JCi5zYDKm9g1MdBJ8LI3RKLp0DY=; b=ldiAdVxQgmHddZbvkdr/9HbIStGO4oKumM1zVfTSLiP45VtphnBRG/YNpwy3eLvi/8 cMhMBE+0Tql2aMm/zkF1PuNgvZnvEetJqLwhdtYbX6i1+IGKjsLZpLilVOZlqRQlw2sI MNuZcDq14e+BknAuy34PlA/bK4W5THSSw5DFuaFsLQpkp7/MOyfxNsgb5i0snesO0obs nVjW/jzezkvfeoWSo/1LM0DMCUI0SGr0Sd+UoEKYCCNWrzvsQ+/+4ticV6Cbny1ivwLh BpFhfipBVeMJfpw8P0M9Pa4VgwABj4MyUttuANn07XwV73CO8MX4Zn7vL7+zaIV8GWmF RQMw== Received: by 10.43.125.133 with SMTP id gs5mr7773605icc.54.1354541134470; Mon, 03 Dec 2012 05:25:34 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp140714igt; Mon, 3 Dec 2012 05:25:33 -0800 (PST) Received: by 10.66.80.8 with SMTP id n8mr6004238pax.40.1354541133623; Mon, 03 Dec 2012 05:25:33 -0800 (PST) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id vy7si19254676pbc.216.2012.12.03.05.25.33; Mon, 03 Dec 2012 05:25:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.24 as permitted sender) client-ip=203.254.224.24; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.24 as permitted sender) smtp.mail=rajeshwari.s@samsung.com Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MEG00L0NIMJDD80@mailout1.samsung.com>; Mon, 03 Dec 2012 22:25:32 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id DD.B1.01231.B48ACB05; Mon, 03 Dec 2012 22:25:32 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-e2-50bca84b5130 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 8D.B1.01231.B48ACB05; Mon, 03 Dec 2012 22:25:31 +0900 (KST) Received: from rajeshwari-linux.sisodomain.com ([107.108.215.115]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MEG00GX8IK0D390@mmp1.samsung.com>; Mon, 03 Dec 2012 22:25:31 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Cc: patches@linaro.org, sjg@chromium.org, mk7.kang@samsung.com, chander.kashyap@linaro.org, marex@denx.de Subject: [PATCH 1/3] EHCI: Exynos: Add fdt support Date: Mon, 03 Dec 2012 19:00:07 +0530 Message-id: <1354541409-9642-2-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1354541409-9642-1-git-send-email-rajeshwari.s@samsung.com> References: <1354541409-9642-1-git-send-email-rajeshwari.s@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRmVeSWpSXmKPExsWyRsSkVtdnxZ4Ag1f/mCwerr/JYjHl8BcW ByaPO9f2sAUwRnHZpKTmZJalFunbJXBlbN58h7WgRbxi+5cnbA2MZ4W6GDk5JARMJN6svcgM YYtJXLi3nq2LkYtDSGApo8T3E7uYYYr6eyZDJRYxSuztP8AE4Uxkkuj9tIwFpIpNwEhi68lp jCC2iICExK/+q2A2s0C2xOlrTewgtjBQzc65r9lAbBYBVYkV6/8wgdi8Au4Sk952MUJsU5A4 NvUrK4jNKeAh8e/RDqB6DqBl7hI9hxIgWgUkvk0+xAISlhCQldh0gBnkHAmB22wSr+40sEKM kZQ4uOIGywRG4QWMDKsYRVMLkguKk9JzDfWKE3OLS/PS9ZLzczcxAsPx9L9nUjsYVzZYHGIU 4GBU4uF9+GV3gBBrYllxZe4hRgkOZiURXreWPQFCvCmJlVWpRfnxRaU5qcWHGH2ALpnILCWa nA+MlbySeENjE3NTY1NLIyMzU1McwkrivM0eKQFCAumJJanZqakFqUUw45g4OKUaGLe4fpaP 7flzZMPhg6HWExNXWCkdLYxs+PdBZvbGA8wFto4NGqEpLWlRTF8UOdLMQv53s4ve6gm+rnr5 1SodIZak4g/HCqdu2V9XoF6kabfiZ/FFtbBm9Umnuud8OCJq9OuoQCpfYd6349f2LfinfPdx SwdXr8rCRXPX/JBpsdx4PCz/zOkYZyWW4oxEQy3mouJEAKm9OiN0AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRmVeSWpSXmKPExsVy+t9jAV3vFXsCDHY9MrZ4uP4mi8WUw19Y HJg87lzbwxbAGNXAaJORmpiSWqSQmpecn5KZl26r5B0c7xxvamZgqGtoaWGupJCXmJtqq+Ti E6DrlpkDNFtJoSwxpxQoFJBYXKykb4dpQmiIm64FTGOErm9IEFyPkQEaSFjDmLF58x3Wghbx iu1fnrA1MJ4V6mLk5JAQMJHo75nMBmGLSVy4tx7I5uIQEljEKLG3/wAThDORSaL30zIWkCo2 ASOJrSenMYLYIgISEr/6r4LZzALZEqevNbGD2MJANTvnvgabyiKgKrFi/R8mEJtXwF1i0tsu RohtChLHpn5lBbE5BTwk/j3aAVTPAbTMXaLnUMIERt4FjAyrGEVTC5ILipPScw31ihNzi0vz 0vWS83M3MYKD/ZnUDsaVDRaHGAU4GJV4eB9+2R0gxJpYVlyZe4hRgoNZSYTXrWVPgBBvSmJl VWpRfnxRaU5q8SFGH6CjJjJLiSbnAyMxryTe0NjE3NTY1NLEwsTMEoewkjhvs0dKgJBAemJJ anZqakFqEcw4Jg5OqQZGxcBjy13WVvxLPtd6tqrumfeBCYs6pmRe2vyp9YvSl0Wr9zq0unKe PitycZXC23fSh90sTiZYTfljX9BXffy4SdyPrPNz8k8uf985jdVG8NpZKeUMrfPal+MaRcW3 v4z6tzEluuAYm9+0b4+muG4XUS8/km1lmBbfXbmX4znP1dkNyZWNi3ZGKLEUZyQaajEXFScC AKKNXRmjAgAA X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQnpU/oXr4YDshejKibbV9vKTCu3FrAv4fvID857Dw5Omdu/VbXZ7zTw/4ybJEiFG2mi1Dfm Adding fdt support to ehci-exynos in order to parse register base addresses from the device node. Signed-off-by: Vivek Gautam --- drivers/usb/host/ehci-exynos.c | 57 ++++++++++++++++++++++++++++++++++++--- 1 files changed, 52 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index 9f0ed06..f4c873f 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,38 @@ 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 +139,25 @@ 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;