From patchwork Tue Sep 20 03:36:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 9340993 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C4D6D601C2 for ; Tue, 20 Sep 2016 03:48:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3C5524B44 for ; Tue, 20 Sep 2016 03:48:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A7F3C29AE7; Tue, 20 Sep 2016 03:48:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1AAAE24B44 for ; Tue, 20 Sep 2016 03:48:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bmC1q-0005mw-TJ; Tue, 20 Sep 2016 03:47:30 +0000 Received: from mail-sn1nam02on0059.outbound.protection.outlook.com ([104.47.36.59] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bmBse-0006lI-0f for linux-arm-kernel@lists.infradead.org; Tue, 20 Sep 2016 03:38:02 +0000 Received: from DM5PR03CA0013.namprd03.prod.outlook.com (10.175.104.23) by DM5PR03MB2442.namprd03.prod.outlook.com (10.168.233.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.629.8; Tue, 20 Sep 2016 03:37:38 +0000 Received: from BN1AFFO11FD013.protection.gbl (2a01:111:f400:7c10::195) by DM5PR03CA0013.outlook.office365.com (2603:10b6:3:118::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.629.8 via Frontend Transport; Tue, 20 Sep 2016 03:37:38 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; nxp.com; dmarc=fail action=none header.from=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD013.mail.protection.outlook.com (10.58.52.73) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.629.5 via Frontend Transport; Tue, 20 Sep 2016 03:37:37 +0000 Received: from b29397-desktop.ap.freescale.net (b29397-desktop.ap.freescale.net [10.192.242.114]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u8K3antm006721; Mon, 19 Sep 2016 20:37:30 -0700 From: Peter Chen To: , , , , , , , , Subject: [PATCH v7 5/8] usb: chipidea: let chipidea core device of_node equal's glue layer device of_node Date: Tue, 20 Sep 2016 11:36:44 +0800 Message-ID: <1474342607-27512-6-git-send-email-peter.chen@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474342607-27512-1-git-send-email-peter.chen@nxp.com> References: <1474342607-27512-1-git-send-email-peter.chen@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131188162582782902; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(48376002)(4326007)(68736007)(2906002)(97736004)(8936002)(626004)(76176999)(81166006)(5001770100001)(2201001)(86362001)(104016004)(5660300001)(50466002)(586003)(7846002)(2950100001)(7416002)(50226002)(47776003)(229853001)(77096005)(107886002)(5003940100001)(189998001)(356003)(305945005)(19580405001)(19580395003)(92566002)(50986999)(8666005)(85426001)(81156014)(87936001)(33646002)(106466001)(36756003)(105606002)(8676002)(2171001)(11100500001)(4001430100002)(7059030)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2442; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD013; 1:R8i/oVubRYEg2joubsBPsG8QxTTuEYecdxJRkdjSXH9sBDnefFA6PzKh4RPtfe7pmk03Zyrb1D4/Rsz95uxzBZegYMGe2XYwuTOqyoVIKPoBxVzXLfIONhM9B446tOcqiEEvlhCx5Imb489cOfNHwyegNHy7w+5Vpt+uYkdPDSmBNwtjhyWGTs22iQHvfT6RP2BgeTxrdEsqeApStUVHFhHN8Jg3vi3p5v2McyxXwHP14fK1lJxtMZ7hqrUjU2lziSpOOM39N5AiQucA1cRJUBdeF3T+rS3d/RnXmNs/A7qNqFOdlQVPUtLkBuDxqaGJXLbmVV/y+wuKmzWAZXvnoiWg9u6qXU29L95Smh0iGgkc3M80tSrT9szz0+LUDEJXGq0WK0Xt2z+9/jzqIB1Zu5cGzqlJl8UjywLt/4JJ7nQfNU81D68UNz8EtQ29nke4ZQLMbcEKBjTs6n3wA8/7zW8zGilQHyqu4pJdQo977VgxpWLn1xECU6VTzuI4GqmAdVjMLhGbhN1NH3purUMwkhCPGU6BfV9WiPeShwlE4DjiNN0WV8tA1Kt5gfmeCOpsvfdMdmuAGeXD1YBX6Cis+ssDB/yAwum+BMeh8PkxMnuSYu52nhJEAizebrhutl8DYy0SjmsPHvxZXtks13m9rQIsOCwQvCS1TLW2FNxSGjqpQ0ulWdmB9SfcQEmQgccX7y2k4WgydRTwvykKdPYpAyrqpA1BxkAx4DmMz55Xp6TS+aDTieTu+t+wf6hwVksnDlSrLX29SSYqM7PTJPEUMw== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 81d3ffc6-a9db-4831-4258-08d3e10777f0 X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2442; 2:K/J1a/YAZccyDmgBDAZHTyADIKo5FHnM1yF2E4AAqI3DY+PuC5LMht0PhSKIGgXdPqLFZhz+dJFm1dnYxRBNTZAl07W0UV5GIxFMSN8Qg8PPaEMibqr8+/9uGQeUlkouLK0HblDdgNedNI3VvN57vxHlr/RJhDH7RioJ+fjWhtlRNZd6SXc5ParLwjjyXXS+; 3:DhYH9uBdcPTrMFaMp+upc8gsK0AKSeb+udIRHcDsH/tPSVVICJOkurWX5g2/YRWtqbiy87XOkxoVI2tFrycrbavqCzMV4djO7uK18w9f68lV9S6Bk79clM5Ob7R+QKM39VUqV7SfKl/mop6RjaIDeXooB7Vv4PKAuRUs+FlBNOBq1fkkW89JQEDSMS6DnIX2YLNUpre2PJai6G/kFgoEJTsh8SGuQoKZDvL0YcLyFbQ= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM5PR03MB2442; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2442; 25:HHsKHWfK9c2pxzKziHVRXGe9g7BAuZDGenEQfIlqXfA3nzBYZ2V93lrUSNn/U5rxw85fC2KRcB2Ae5LKQPhpYczMCoju5jEYMN2s7fc7NvSRMW+YX2XAg7uSniSsGHzkDttH0G/rjChJKOINInva9yI+Z2ASTl1vTzFsvc2XYOJ0JGA15muGagxTHXNskZ4TrEsED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XC0HHmXTDErcjtVQ1Axivu1F+VfihE4TeOPGGpmV7gu+SkbVBQKbHTPCts8EHs/Onlv3U4lTAWGqarcmfek/tkc1AxrKc13VnDBBqJ8C6HlZVnnKP/kOmSCCZPbgfdPvwtc1yqaVn1VOX+27SCLwJ9k2Z4VcdUckQp1yZD9K6HxcJzKMFsp95SvadfVouamvM8BB9eLw1citih6p6fNjk6nCc0g7n2HHSaNf7awLmHv/1v+PkLChtWSQeJgEiuETZzXY2KCNllzwk5KlTOPlt+S1OBEx8NPw9ADlBmLXleLdY/kcTeDMoXMQ5GCKYBAanU= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13015025)(13023025)(13017025)(13024025)(13018025)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:DM5PR03MB2442; BCL:0; PCL:0; RULEID:(400006); SRVR:DM5PR03MB2442; X-Forefront-PRVS: 0071BFA85B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2442; 23:2+7FQ0EQFKtTwiCIzz4Q/5OBh2ih6xt/C66ITJfNC?= =?us-ascii?Q?dgQxiFQ4i6gkhaj80TGvup+PbCMg6g278XDlS9CtWOd5X+JFF0ZGiB/lrXX0?= =?us-ascii?Q?66QSoDL8KvevRE5eiGYMa5uDOJ8i/DqIjeOeMu4dOa705dzfO84SdzEqSdkB?= =?us-ascii?Q?R6o3CrtLnOwICPd/rl9mCC5l/OyLRh5ZZSF4yxcH53BVK/O5rDQE6mFIasPb?= =?us-ascii?Q?LjK3l5bSI4c9XPN4xXNWO400vn+ntI58en65msyDD7h313jeTO1C/9gHD7Nx?= =?us-ascii?Q?k+jRzVQEtcCv2yUUsIROLe/8ErIBwB2NDX6gIJ4JOC0mCBflvG1iDUERBbXI?= =?us-ascii?Q?S7LSov7kgMR6PYKT51FtFIzLkpOgct+LUsC0xsOTP6/o/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JPbm9OJZuLrO/gMDY3CPp6L+gNelDRvVbcXMw1KUnLT?= =?us-ascii?B?Zz09?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2442; 6:5ymvwnAGtcdPrJsedyCOgmzvw5QmdDFf99eooKGT6y2rSwBRJP3lmHU6blrYCc/bJ4sgrJzDSWgtmoJx4guHd16bw2hWz0ZpU7X0AsPOEa082RAenic0WKOCfph72mDIevKEiAI5Up52ozmKKs5HCyOWJaLGkJCinSvaRGivkm/KvvyYZz3IdvffPabSn3jkim3Mjvqz1Epy75G7n20wwCqDTGKQMP2qpi4ULwYoBox5NZjEyw8RFtZz3x/K+UJbgMF1YKoMtHYEnfA73wPG2SnXDsqnXresmySYGeqQhmY=; 5:rBkt7ISl2EKklDUfw4vPOk4IWaGsiSRixPmflb/KYx8lEadgywkRbdrRs1oT1jaH1t3DXLX86ejZZLAMOAmbFCq2w6Tiw2r7AFm7hGd+ItVXqhSJOYBPQAIfwAdqWrBYNsn9k8+fMU1cLhTZqg3yT8gRT7VlADxQ9o1pXNlRpzU=; 24:qxFlV8ft7Q1GHKA31Brj368aMHGr+WfOsTgNCJ0XGzmpgGHDEFPvKxB9YZYHgbHwbXij/G0YdhosYtWMTY+VuszZS0vfsZ5EsSPwIdzrwkY=; 7:W3QZeBdENa+VOUNlqC15jXAhMRbE86ZeoGwF1vKgZ6j26HNO1WmqSaDE/STmR/qCijeQVWPgCGfG/X5dKqf/fQBTKNIED8YIXb7gG/OplttkyEkl8wQqiujy0TdV2MsTCxKfPO6c+jMId69DKD8MmWi1WdiJbnkjg2sZMv8p8lzmOe3+1UHlitS8ia70cJVQgJ98HKDykgg2MzDA0eoS2RBwM7pVYYGr31+/89K/7JquUR7T703kBOHNonm2hHZaOgmrP44nUpa+uO/rMg/IjJRYVtz2cZ9D5eIXP5tBRJ4UtyX2t4f4LQ2qekKt/bJX SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2016 03:37:37.9818 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2442 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160919_203800_269776_7C8DFBE5 X-CRM114-Status: GOOD ( 15.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, k.kozlowski@samsung.com, stephen.boyd@linaro.org, oscar@naiandei.net, arnd@arndb.de, pawel.moll@arm.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, s.hauer@pengutronix.de, linux-usb@vger.kernel.org, mail@maciej.szmigiero.name, troy.kisky@boundarydevices.com, vaibhav.hiremath@linaro.org, stillcompiling@gmail.com, Peter Chen , p.zabel@pengutronix.de, festevam@gmail.com, mka@chromium.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Chen At device tree, we have no device node for chipidea core, the glue layer's node is the parent node for host and udc device. But in related driver, the parent device is chipidea core. So, in order to let the common driver get parent's node, we let the core's device node equals glue layer device node. Signed-off-by: Peter Chen Tested-by: Maciej S. Szmigiero Tested-by Joshua Clayton --- drivers/usb/chipidea/core.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 69426e6..6839e19 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -927,6 +927,16 @@ static int ci_hdrc_probe(struct platform_device *pdev) return -ENODEV; } + /* + * At device tree, we have no device node for chipidea core, + * the glue layer's node is the parent node for host and udc + * device. But in related driver, the parent device is chipidea + * core. So, in order to let the common driver get parent's node, + * we let the core's device node equals glue layer's node. + */ + if (dev->parent && dev->parent->of_node) + dev->of_node = dev->parent->of_node; + if (ci->platdata->phy) { ci->phy = ci->platdata->phy; } else if (ci->platdata->usb_phy) { @@ -937,11 +947,15 @@ static int ci_hdrc_probe(struct platform_device *pdev) /* if both generic PHY and USB PHY layers aren't enabled */ if (PTR_ERR(ci->phy) == -ENOSYS && - PTR_ERR(ci->usb_phy) == -ENXIO) - return -ENXIO; + PTR_ERR(ci->usb_phy) == -ENXIO) { + ret = -ENXIO; + goto clear_of_node; + } - if (IS_ERR(ci->phy) && IS_ERR(ci->usb_phy)) - return -EPROBE_DEFER; + if (IS_ERR(ci->phy) && IS_ERR(ci->usb_phy)) { + ret = -EPROBE_DEFER; + goto clear_of_node; + } if (IS_ERR(ci->phy)) ci->phy = NULL; @@ -952,7 +966,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) ret = ci_usb_phy_init(ci); if (ret) { dev_err(dev, "unable to init phy: %d\n", ret); - return ret; + goto clear_of_node; } ci->hw_bank.phys = res->start; @@ -1058,6 +1072,8 @@ stop: ci_role_destroy(ci); deinit_phy: ci_usb_phy_exit(ci); +clear_of_node: + dev->of_node = NULL; return ret; } @@ -1076,6 +1092,7 @@ static int ci_hdrc_remove(struct platform_device *pdev) ci_extcon_unregister(ci); ci_role_destroy(ci); ci_hdrc_enter_lpm(ci, true); + ci->dev->of_node = NULL; ci_usb_phy_exit(ci); return 0;