From patchwork Fri Feb 10 10:36:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ramneek mehresh X-Patchwork-Id: 140557 X-Patchwork-Delegate: afleming@freescale.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 29471B6EF7 for ; Fri, 10 Feb 2012 21:37:12 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6F5D428082; Fri, 10 Feb 2012 11:37:08 +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 nc3utwEk-IF8; Fri, 10 Feb 2012 11:37:08 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 809DC2807C; Fri, 10 Feb 2012 11:37:04 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 056CE2807C for ; Fri, 10 Feb 2012 11:37:02 +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 woLXYgoQ06tG for ; Fri, 10 Feb 2012 11:37:01 +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 DB3EHSOBE001.bigfish.com (db3ehsobe003.messaging.microsoft.com [213.199.154.141]) by theia.denx.de (Postfix) with ESMTPS id 1284E2807B for ; Fri, 10 Feb 2012 11:36:59 +0100 (CET) Received: from mail6-db3-R.bigfish.com (10.3.81.242) by DB3EHSOBE001.bigfish.com (10.3.84.21) with Microsoft SMTP Server id 14.1.225.23; Fri, 10 Feb 2012 10:36:58 +0000 Received: from mail6-db3 (localhost [127.0.0.1]) by mail6-db3-R.bigfish.com (Postfix) with ESMTP id 708C620672 for ; Fri, 10 Feb 2012 10:36:58 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839h) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail6-db3 (localhost.localdomain [127.0.0.1]) by mail6-db3 (MessageSwitch) id 1328870217188503_31967; Fri, 10 Feb 2012 10:36:57 +0000 (UTC) Received: from DB3EHSMHS006.bigfish.com (unknown [10.3.81.244]) by mail6-db3.bigfish.com (Postfix) with ESMTP id 20CDA38004A for ; Fri, 10 Feb 2012 10:36:57 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB3EHSMHS006.bigfish.com (10.3.87.106) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 10 Feb 2012 10:36:55 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.355.3; Fri, 10 Feb 2012 04:36:48 -0600 Received: from udp164495uds.ap.freescale.net (udp164495uds.ap.freescale.net [10.232.132.44]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id q1AAajrF022650; Fri, 10 Feb 2012 04:36:46 -0600 (CST) From: Ramneek Mehresh To: Date: Fri, 10 Feb 2012 16:06:43 +0530 Message-ID: <1328870203-3175-1-git-send-email-ramneek.mehresh@freescale.com> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Cc: Ramneek Mehresh Subject: [U-Boot] [PATCH][v3]powerpc/8xxx:Add MPH controller support in USB device-tree fixup 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 Add support for fixing usb mode and phy type for MPH(Multi Port Host) USB controllers in device-tree nodes. Required for socs like P3060, P5020, etc having MPH USB controller Signed-off-by: Ramneek Mehresh --- Changes for v3: - removed const* type cast for node_type - used CONFIG_HAS_FSL_MPH_USB in condition for including fdt_fixup_dr_usb() arch/powerpc/cpu/mpc8xxx/fdt.c | 29 +++++++++++++++++++---------- include/fdt_support.h | 4 ++-- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c index bc1c30e..09810be 100644 --- a/arch/powerpc/cpu/mpc8xxx/fdt.c +++ b/arch/powerpc/cpu/mpc8xxx/fdt.c @@ -86,30 +86,39 @@ void ft_fixup_num_cores(void *blob) { } #endif /* defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) */ -#ifdef CONFIG_HAS_FSL_DR_USB +#if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) static int fdt_fixup_usb_mode_phy_type(void *blob, const char *mode, const char *phy_type, int start_offset) { - const char *compat = "fsl-usb2-dr"; + const char *compat_dr = "fsl-usb2-dr"; + const char *compat_mph = "fsl-usb2-mph"; const char *prop_mode = "dr_mode"; const char *prop_type = "phy_type"; + const char *node_type = NULL; int node_offset; int err; node_offset = fdt_node_offset_by_compatible(blob, - start_offset, compat); + start_offset, compat_mph); if (node_offset < 0) { - printf("WARNING: could not find compatible node %s: %s.\n", - compat, fdt_strerror(node_offset)); - return -1; - } + node_offset = fdt_node_offset_by_compatible(blob, + start_offset, compat_dr); + if (node_offset < 0) { + printf("WARNING: could not find compatible" + " node %s or %s: %s.\n", compat_mph, + compat_dr, fdt_strerror(node_offset)); + return -1; + } else + node_type = compat_dr; + } else + node_type = compat_mph; if (mode) { err = fdt_setprop(blob, node_offset, prop_mode, mode, strlen(mode) + 1); if (err < 0) printf("WARNING: could not set %s for %s: %s.\n", - prop_mode, compat, fdt_strerror(err)); + prop_mode, node_type, fdt_strerror(err)); } if (phy_type) { @@ -117,7 +126,7 @@ static int fdt_fixup_usb_mode_phy_type(void *blob, const char *mode, strlen(phy_type) + 1); if (err < 0) printf("WARNING: could not set %s for %s: %s.\n", - prop_type, compat, fdt_strerror(err)); + prop_type, node_type, fdt_strerror(err)); } return node_offset; @@ -180,7 +189,7 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd) fdt_fixup_usb_mode_phy_type(blob, mode, phy_type, usb_off); } } -#endif /* CONFIG_HAS_FSL_DR_USB */ +#endif /* defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) */ /* * update crypto node properties to a specified revision of the SEC diff --git a/include/fdt_support.h b/include/fdt_support.h index cef3c65..4b9f84a 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -61,11 +61,11 @@ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop, const void *val, int len, int create); void fdt_fixup_qe_firmware(void *fdt); -#ifdef CONFIG_HAS_FSL_DR_USB +#if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) void fdt_fixup_dr_usb(void *blob, bd_t *bd); #else static inline void fdt_fixup_dr_usb(void *blob, bd_t *bd) {} -#endif /* CONFIG_HAS_FSL_DR_USB */ +#endif /* defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) */ #if defined(CONFIG_SYS_FSL_SEC_COMPAT) void fdt_fixup_crypto_node(void *blob, int sec_rev);