Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752225AbcKNBgv (ORCPT ); Sun, 13 Nov 2016 20:36:51 -0500 Received: from mail-sn1nam02on0076.outbound.protection.outlook.com ([104.47.36.76]:36863 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750908AbcKNBgm (ORCPT ); Sun, 13 Nov 2016 20:36:42 -0500 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; X-IncomingTopHeaderMarker: OriginalChecksum:;UpperCasedChecksum:;SizeAsReceived:1478;Count:10 From: Peter Chen To: , , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , Peter Chen Subject: [PATCH v10 5/8] usb: chipidea: let chipidea core device of_node equal's glue layer device of_node Date: Mon, 14 Nov 2016 09:35:56 +0800 Message-ID: <1479087359-7547-6-git-send-email-peter.chen@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479087359-7547-1-git-send-email-peter.chen@nxp.com> References: <1479087359-7547-1-git-send-email-peter.chen@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131235610002493191;(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)(1110001)(1109001)(339900001)(336003)(199003)(189002)(2201001)(85426001)(77096005)(47776003)(76176999)(2171001)(86362001)(87936001)(4326007)(2906002)(626004)(107886002)(586003)(81156014)(81166006)(8676002)(104016004)(48376002)(2950100002)(50466002)(6666003)(305945005)(8666005)(92566002)(8936002)(189998001)(7846002)(105606002)(106466001)(356003)(33646002)(97736004)(7406005)(5003940100001)(68736007)(5660300001)(50226002)(36756003)(4001430100002)(50986999)(5001770100001)(7416002)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR03MB2476;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD023;1:qvY8nIQgup+88xc7zGBTuaohLcTvegZIDmsHi47nSz80votD+xM9DeYPtym3h7485XtFuS5hknGyP8qrNXP+E1bD3YxBGRXgWIzVA4CK13W17vPICWK5fIF769iwBpcA4cohIcL3Del3UMDILYJu3DUolVC7ehMeuGJlTA/4LYmR0bEqceFPxkZBBlePyobrSNlaIyRi4W3wxkhT2CkEJBBEyax68NSRFrbHiQHOWygJYC4ALdGgV1smnTAxetoPyZb1hlB4xkhhjvmaAudYhybA105164x7SfH+PAGp6EHs/WDW0TOd4vWJDuK2mJne66XewxUf4g4xFLsJaNuwassDHALjPU3pUtymhad9cEqwGkjn0Mva45ciCQAEXNBHVeKc9HZ/Z6/1GKJTVdmuiRAGb+KdzFv8Ehc+DdbyjNvWn68wHMAOf+5fStG1xLWPf1RLM0uOB+UyZH796nxxdqV+QoKrofbnhSUSDNdfrewybEN+DDGaO/r/PWpvI5i9Aj4AGt0fWfP3GWwxsocfXBPeRQ1g4ZthbpsMFk0wz5g/xcv9cTJEHq+Q28niBssx0elRTs9W4+UqKulX7vFaIC85uAxR6LT4DQg/mauIGbJtrO8cTLzOwt3dPn5rJ+f2fpuDxg8cHpCzH4WtXHlA3F6F7vEI4xjtkyRRe9MhAqkgsKrlQr0uw0CMi1m4T2CPbhCWIwicAZDODx57OTPnZ8IOGh1UzoIPEX4DuS+yx2hDl8C2lHCgDZ291C3EL2ei MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;DM5PR03MB2476;2:Z7Dp1lmfPZuoSxX2JcBUInkVJAuQZjH1mQ6YaijzN4rx/aGFHpkbZyyyOkK0pZaxZVhfMwYijYq/5WuS1Fjo24BX3JdZ622oYmJf/eCC9tSY2JE9cslNB6TAp0welwUpeHWpls5L39SBxBQplesC4r5R35fM1iDFbOxvULLkceg=;3:GwPtXw6la3o0h2yD+PtW4LTSCqnkC1hSGiuM2zdhgA8/su4gvL7N3HfR3bWSfzb5y7/C41wgh20Hrx9c7H242c1FuICjzNynNPyjbcNkfvg2lMTb2t0IWNo1i0sY0izPM1cb46L6Ik/1ndlhGd1IfI3BXz26kTddnGZzCZlH7wXAjICTN5qc4M3hCs1hKzlM6UevOCwjeXdZBacCftda9GpRnzLTIhT1j4fd1goj+0FEZ/6fRwbp7gFMmg9ddM8REmP6YAmtcDn1ahXD3d8RiA==;25:Aey244F6yUAHUkShGp00X0MvI/azBXxTVRy3r0YoaBiHF+x0gTKQYOPY/3yK6KO4v3n04Sb+areGQeV4j1bQzgiLGCJqv58Bmn3H73lIYTRX3RG51tnloni3Cf/HTwbeZ/wZal9Jxf1Owty4k+CsFs984Mu1jHGljpPmxZhqCHCOWD27JSiJAmZOYlJKRQMyA9K3wxcZdherFHCvEbWDcHSpGwDDTRsAcH4Pil6xl+TBdcgoaNNAFBNOv6k5DaPFN/a5yO7It2VRm6LRpbIqcDw6Ge99HPxsQNwCKweZnrUDJrilDOhDbtpI6/RUhW4T0IjMYPQa+YjLa35mNSEGQtTcj4mU4MY7E+v1VR84GI3LVln6dNm0MZEaSPZcdv7y79ebVPWzXh0jA2LqNtxUIhAHWQtL7y/6m7tlTr31luSSIpld5Kn/u2uD8tFsCE3OZ3dRJ/GuefI4EH8ArkTv5A== X-MS-Office365-Filtering-Correlation-Id: 700b1542-a82b-440d-8f07-08d40c2eae8b X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DM5PR03MB2476; X-Microsoft-Exchange-Diagnostics: 1;DM5PR03MB2476;31:cZW5yPWaXwPEQpFNUsQqEWSMAcDaNlIZqxhlBqKFRa4mSPMdUTutYYSPjLZi93XGmGMD0MKJRY4k80cSLins1twS906G/Jp3uLI0A35WqosVCYR/LaZ2O0HMveeKOH6CrqVxbrSsqu/AXRvclo+geKdE2xl+uYfc9BjlgMq1Psh+V7nOaWZFWqHEnplYSyizGEZyNjMQccNlUhsLpDnpxaY95EQUztwBayqm5qXTCoIkiBMK3s95MAzpZxHwQQt+uBsEQbQEL7R/M6TQu7mEAQ==;4:WWyf6W3DlAvUGLjvO2UzxNS0wtu3Jp0kLTxwZZkUUm2bRq+SpzyrISdNUO/+Cc5Cc7QB9GZP3LYu4/IgPhHfwL9UDPp4/YfztEjFT1SooOrKiWuLmknlMxynjpZO2FmXc7MR3x3QKhGVOqMTho4PmQPHYn66hNFDGNjKKnnIoHPpsAT9QZ+QMbbdmz7p6joTv5CTZRBZKdCkKyafuzLdlKhD9uMgvZLFXq/n1B/AISmSE/Eq9s/hcHJ2o3DsBJe1ssZcyJ7J+TdBAy60xvjzC+yzD6olvSNp4KmrvQoZ1g5iU3BDS3M3sHGkKezEiW2zMbMoVh7dp/Ez28CnqsE2wcgPU22QZdZCOQbAZYFZEA3fJd3WHSCK+DW4sKhbfZeCAwF/OhlXRxp2JR3wjVD2f+BxnIuCHqGggPEs10XNJK//Qm1jxRKSH0GaLrT0NrDBFIT1OjkdfYm4oO34pkxbhfYLie1DhFYN1z+4OzhpIJ8oPC5cz/1qs67eMc5/y2IY4Zy0jr2KWakj0WMYzvt1S++b2kP2qJXMT10hiIdsUw3v8RmkoAbTwfsl6xN9KVRz 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)(13023025)(8121501046)(5005006)(13018025)(13024025)(13015025)(13017025)(3002001)(10201501046)(6055026);SRVR:DM5PR03MB2476;BCL:0;PCL:0;RULEID:(400006);SRVR:DM5PR03MB2476; X-Forefront-PRVS: 0126A32F74 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM5PR03MB2476;23:0i4LTrZs6ZU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6xMOhdusbw+3oON+DWYEcxSUzsENQg39WYuM28iPXBFU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM5PR03MB2476;7:MVrKIZ6Dr/iMT/p/Ksyjv4Pyx1/NJUJBRWA2sXWBGkFjGgWrOryZIUflyfIoUXx/Tx2EnDCt0SowofAB8ZjUwSj4IDCY9kecoi7U8qtbOI99kUki9tTaHBG8SPg440I4n/mOJ0vTHuaEnTSsJqKaGdfrVgsI6dU+SD9SuPp6u4sgEAekvsSz87C3y4ac3d2aSiBMgbyJs4pd20YK9FlFYGPmjIxZvqmHj4mBeWB8VvR9TBZCyNQjoVhEpUHLK4Z5RppyDSPxckFXwrOrQlZgcFmc3HQK6ufpoR10Rf//tVJpzbFOaXyg1cJlaK44EgbjZOTM1SKsjja8O5G3ey2Dki1hf/qhEknE97xkZHxHwmI= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2016 01:36:39.9529 (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: DM5PR03MB2476 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2631 Lines: 84 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 @@ static int ci_hdrc_probe(struct platform_device *pdev) 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; -- 2.7.4