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 Birje X-Patchwork-Id: 203352 X-Patchwork-Delegate: marek.vasut@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 4A9C92C0080 for ; Tue, 4 Dec 2012 00:25:42 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EDFB64A0F7; Mon, 3 Dec 2012 14:25:40 +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 gTNqZGIxObBg; Mon, 3 Dec 2012 14:25:40 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 65F134A0AF; Mon, 3 Dec 2012 14:25:39 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F25D94A0AF for ; Mon, 3 Dec 2012 14:25:37 +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 AVlVKlBHFURq for ; Mon, 3 Dec 2012 14:25:36 +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 mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by theia.denx.de (Postfix) with ESMTP id 277C54A021 for ; Mon, 3 Dec 2012 14:25:34 +0100 (CET) Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MEG00M5JIMFW630@mailout2.samsung.com> for u-boot@lists.denx.de; Mon, 03 Dec 2012 22:25:32 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.124]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 1E.47.12699.C48ACB05; Mon, 03 Dec 2012 22:25:32 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-18-50bca84c7762 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id AD.47.12699.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> for u-boot@lists.denx.de; Mon, 03 Dec 2012 22:25:31 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de 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+NgFrrNLMWRmVeSWpSXmKPExsWyRsSkRtdnxZ4Agzd/OS3e7u1kd2D0OHtn B2MAYxSXTUpqTmZZapG+XQJXxubNd1gLWsQrtn95wtbAeFaoi5GTQ0LAROL4l+ssELaYxIV7 69m6GLk4hASWMkps+r2aCaZo+tL9TBCJRYwS3zZuhHJWMUncuXUOrIpNwEhi68lpjCC2iICE xK/+q2A2s0C2xOlrTewgtjBQzc65r9lAbBYBVYkV6/+A9fIKuEtMetvFCLFNQeLY1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B ahHMOCYOTqkGxqopB2PL96Wcunv3M8v6KP321hqxX9+0TB4LimmemMSkZHCkVPzbqZUOLRKm Fo1NmtuepbjkVLCu7T/GOX+zuM/tudfnlz9Ypnj4bbv3kg3ZwQfedVee5L5r7Jz6T/H+uePO OQUZS3Lat7rtfWnzRfZlot/c/ddeC/KeMEot2CokHnBHb+trayWW4oxEQy3mouJEAEVTXDme AgAA X-CFilter-Loop: Reflected Cc: marex@denx.de, patches@linaro.org Subject: [U-Boot] [PATCH 1/3] 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 --- 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;