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 Shinde X-Patchwork-Id: 13385 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 035B72427C for ; Thu, 6 Dec 2012 06:26:55 +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 8C9A1A180E5 for ; Thu, 6 Dec 2012 06:26:54 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so9375728ieb.11 for ; Wed, 05 Dec 2012 22:26:53 -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=CUcdK7rPdtRXOJd9FQWv79z4ffueGSdSu14jb7mrWKg=; b=JSkvsfhgYCAmaA8SjygmF+ngoUignaJmxY7pEGEjFYtMXq8H6Hu+DhGmWRzKdh25kz upQUJTR+AQ/oKh9VRekU85XLDTZZHHIjFXLO7WSXKNc/eYNJ+v3otOZ9FxMJOg5M0Ty+ bzRFWlJJW1w+rGz13T7AXAl54l7UKy5vD+/R/wJ6qfiQ6EFztnyI1qu1LFsqYdtDcrYY lsBi8PO7SZDdlm2YcqXV61dMUbR/eGB963gdJmZqKMNfgdOPVLD+2yNsR0UQEay9VztU +leGy85NS273dtD2VghC1Zo6chdXn3HzJ7IH51G2r95+uC2DBc6uh9NN6Ovin6ESEnWw 03zg== Received: by 10.43.49.199 with SMTP id vb7mr427025icb.6.1354775213837; Wed, 05 Dec 2012 22:26:53 -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 n20csp391777igt; Wed, 5 Dec 2012 22:26:53 -0800 (PST) Received: by 10.66.72.71 with SMTP id b7mr1606001pav.28.1354775212769; Wed, 05 Dec 2012 22:26:52 -0800 (PST) Received: from mailout4.samsung.com (mailout4.samsung.com. [203.254.224.34]) by mx.google.com with ESMTP id e2si9819113paz.295.2012.12.05.22.26.52; Wed, 05 Dec 2012 22:26:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.34 as permitted sender) client-ip=203.254.224.34; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.34 as permitted sender) smtp.mail=rajeshwari.s@samsung.com Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MEL005JVJ5FE200@mailout4.samsung.com>; Thu, 06 Dec 2012 15:26:49 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.123]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 81.6E.12699.8AA30C05; Thu, 06 Dec 2012 15:26:48 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-3d-50c03aa83a75 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 21.6E.12699.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>; Thu, 06 Dec 2012 15:26:48 +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 V2] EHCI: Exynos: Add fdt support 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+NgFnrILMWRmVeSWpSXmKPExsWyRsSkWneF1YEAg1nNWhYP199ksZhy+AuL A5PHnWt72AIYo7hsUlJzMstSi/TtErgyVt//yljQIlFxunENewPjGuEuRk4OCQETiZdNTYwQ tpjEhXvr2boYuTiEBJYySmw4P5UJpmjthLXsEInpjBI3WluZIZyJTBIzjjxkBaliEzCS2Hpy GtgoEQEJiV/9V8FsZoFsidPXmthBbGEBU4mu54fBbBYBVYnefT/BangFPCQubjoKdYaCxLGp X4FmcnBwCnhKnFhQDxIWAiq5/HMdI0SrgMS3yYdYQEokBGQlNh0AO0dC4DabxITVK5khxkhK HFxxg2UCo/ACRoZVjKKpBckFxUnpuUZ6xYm5xaV56XrJ+bmbGIHhePrfM+kdjKsaLA4xCnAw KvHwWlTvDxBiTSwrrsw9xCjBwawkwnvuM1CINyWxsiq1KD++qDQntfgQow/QJROZpUST84Gx klcSb2hsYm5qbGppZGRmaopDWEmct9kjJUBIID2xJDU7NbUgtQhmHBMHp1QDI2fM4ZMGLAVV K5QUU5i+73v4qkKjifuUwAZFVTPGNS0em/ubiyMYozbcY9Ha0Oj1XF16W9lFwfthyx8X5hfz sB1jnsk8S3D1Et7kf29dNyfw3LK6P2lRedLCE5a592/wLar6L/CIu8F8/6OpPi+6v376tO4w z/PnVj0+FQpT2TUmWcwOuHpQUomlOCPRUIu5qDgRAIteAnh0AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRmVeSWpSXmKPExsVy+t9jQd0VVgcCDC6/lbN4uP4mi8WUw19Y HJg87lzbwxbAGNXAaJORmpiSWqSQmpecn5KZl26r5B0c7xxvamZgqGtoaWGupJCXmJtqq+Ti E6DrlpkDNFtJoSwxpxQoFJBYXKykb4dpQmiIm64FTGOErm9IEFyPkQEaSFjDmLH6/lfGghaJ itONa9gbGNcIdzFyckgImEisnbCWHcIWk7hwbz1bFyMXh5DAdEaJG62tzBDORCaJGUcesoJU sQkYSWw9OY0RxBYRkJD41X8VzGYWyJY4fa0JbJKwgKlE1/PDYDaLgKpE776fYDW8Ah4SFzcd ZYTYpiBxbOpXoJkcHJwCnhInFtSDhIWASi7/XMc4gZF3ASPDKkbR1ILkguKk9FwjveLE3OLS vHS95PzcTYzgYH8mvYNxVYPFIUYBDkYlHl6L6v0BQqyJZcWVuYcYJTiYlUR4z30GCvGmJFZW pRblxxeV5qQWH2L0ATpqIrOUaHI+MBLzSuINjU3MTY1NLU0sTMwscQgrifM2e6QECAmkJ5ak ZqemFqQWwYxj4uCUamCMPWc36cedzm36f5/qcTXLaN+Z3H9n+aYVekIH9/5fvXyLkbT+ip3L Fq7MeZ7YPfP1vnr5iosHP+quCpt0rjyHw3/u7fLri1v5kstqmG8F7OSrY33/T2K/T6qE/6of k16/+KDINtdN9XTnn+CSm0VL+1h1I4xT+BRd+hffd9qn/t2M57fVrEkflFiKMxINtZiLihMB ZrWN2aMCAAA= X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQkQDQf7Zecq9vhNnsKyBSSfNVDnjvFy0wVtJhMOeZZUKfCdxgDxP5lmXACeqxlGbqSuY4zT 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;