Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757379AbcJNDQu (ORCPT ); Thu, 13 Oct 2016 23:16:50 -0400 Received: from mail-co1nam03on0049.outbound.protection.outlook.com ([104.47.40.49]:47775 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756624AbcJNDQI (ORCPT ); Thu, 13 Oct 2016 23:16:08 -0400 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; From: Peter Chen To: , , , , , , , CC: , , , , , , , , , , , , , , , , , , , Peter Chen Subject: [PATCH v8 5/8] usb: chipidea: let chipidea core device of_node equal's glue layer device of_node Date: Fri, 14 Oct 2016 10:59:52 +0800 Message-ID: <1476413995-20361-6-git-send-email-peter.chen@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476413995-20361-1-git-send-email-peter.chen@nxp.com> References: <1476413995-20361-1-git-send-email-peter.chen@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131208876566790950;(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)(199003)(189002)(189998001)(106466001)(47776003)(2201001)(11100500001)(104016004)(2171001)(87936001)(4001430100002)(19580405001)(76176999)(229853001)(33646002)(86362001)(19580395003)(48376002)(50986999)(50466002)(105606002)(107886002)(2906002)(356003)(68736007)(50226002)(36756003)(8666005)(8936002)(81156014)(81166006)(97736004)(92566002)(5001770100001)(7416002)(5660300001)(626004)(586003)(4326007)(2950100002)(305945005)(85426001)(77096005)(7846002)(6666003)(8676002)(5003940100001)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2PR03MB321;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD022;1:BmHhq75HyqO6GSm8AmEz4RUF5YN1EzLe1rqNsXBy+/2RO8sgaQTVo9DPRgnCtNsdqFN8jcu61Mn/dS+51exyJHYAc9i/x1rtg6bEzeacqg2q90UllW9G7TLSjTgUkebyl+TBKbpzUnbI8cP4Qul8yDSjUxpiXCIDTYasbSHLEFfaceb6t0HsStD5/lCPRW2J0hnRpQwVC4NxhPj/KouYgeAU8CQeHe8pz1sFHHzTRVQsQPHLg6GixrRoiUTo4WuV08SkM+bCeuxefmAl785qTkczRF0KR5oSQldm9TnbmVNcJNTHtEQuz5ROYGk+oTqjy5ggpqaFx4WDDqJ8weT2WURkeo4t2ABvSOrc15SmFn/yodMC0kMMEvH1HVnvd1Cpi+4f1S+63x/ZiVRQuk2kr/0sBqPkkm4mfMmPtwDcNf0jy/2ZAP65X+S+UV1mNGxf3ckPyPPrFGZxRoQgyukK+x/hk0RvEMuve05I2vpJLyP4F57H+X+xfVYZh6T+Lt6so1WpT3LnaBrW6fm8auVJwKws062haOQeN1T4j/KS7WOxZvfuflPdHOu4ab50Sr5uvc+FrKSwmHWn8Koev7MDylt2Pmk3EPdznCjeEof5W3Ap2rdXRYvWCHgYQJf+ntot/sVFZuBpuzp15EqzoUFwoABN6Jxu9YZi9x1lLPJGwLihpqIRFlHOluq+xNDCVv+k28dbe9kr2QgI9KJxTwHLlMSXDR0rylvTg8IlmjQrIcvU2NyLZ0/tvxcE2zt6Ezfl MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 1c8a5ff8-7bc2-4e3d-e1c6-08d3f3de5198 X-Microsoft-Exchange-Diagnostics: 1;BL2PR03MB321;2:1c3/aGnwQSxX2XQMTy6moRN9jnk9fe2lr2p0hLhrfuN57YsW3zQs+rK6Kv2IbgeJcBKrPI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L/F3zZFEAVpiTeWuTgWK/0jieFB0isaTMh+/syqmfomj2FVYn4WxWCETTZuuLh75UU5TGokGDME7sEeE8Y4bjwogZ5SoCD6j1ooRIRuYvoJThGE4OYeriqtKm9+1C60/n+kvFPps5OESe/QD8ZAPOY03x7MuYTQCW2vK+e3wg== X-Microsoft-Exchange-Diagnostics: 1;BL2PR03MB321;31:ptS7VswC+Kll/980pTlObv061TvJdEWaLQcbc52lWo/ZZSQQF1tLovdMGWpP4GLtH5hZ5pxl3uNAMQhVt9s09lpXWSzxVEcweqZTTKvK8SHi2HxHLD3INcBv12XUJrvCb5ZwsbxZcAUbHQcBVdYKMkOxo+nK1/uGwBfcRC7o+psoyNSeGyF+r+vVswbzW2BsvngbWxW9OVy22bpMVEjII4K07+qUSHJF3EZ/NjLBM89O2SQcIabvIra6RzBr7JIBhzPan15CQNdK44eeRNep/g==;4:UPi8aAVyuc192WBfE2l40gMu3VaueLifPBmNOn0HvwU9i4xA4smTTr2JOIZ1bQocrA04GiQrkMVFe3atKFHR6v1JsJdhXFYy8inqGpvqSvpzm2m0GZnEZfBemlt+Ja1kiAjzBLNXvxwyahBUGM5r8gNJtf+xux4llALaTw98F1J/Uwx1drkbhUVGnS1jzfjoMLf7r8ch5t6NckkHsYXd04I2YG4uYS93rGFgmh6s9hbRq+3QG8xf7VCLXPqr5XGQCehqPbPsGu0zL39WgMQU516rJbExTS+WuLUC+LLd3S/PLlv/FJdQ9wYUVg0zJlmdwXnhgsXRAdZk9GX6QcVAsUbGMgvNhHHgiuWxOfV6JfbJNH3zYcWOLVTA2TCsV37wxrfUQm/LvqC/DxW5HsQHR1cLI2suQrSscNhquZcVsDd9rbrlCNKqBbLr/XXcefaQDKbXHGDFrhwQX6382iLG8OWuDjgfLCAr4NnOZMTCammZ3jWuEbUgnLqK3iVnl1CMtqIYKIOGgleyT3CeRjeD5DD5dz2Vqq1KE8YY85qLERM= 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)(8121501046)(13015025)(13024025)(13017025)(13023025)(13018025)(5005006)(3002001)(10201501046)(6055026);SRVR:BL2PR03MB321;BCL:0;PCL:0;RULEID:(400006);SRVR:BL2PR03MB321; X-Forefront-PRVS: 0095BCF226 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BL2PR03MB321;23:mmdetvJBjRaRoIR0wkFo6fNz3zc/SA9Pof+CvUwOTK?= =?us-ascii?Q?Y/jUwj7m4WxY2QCAgkNZc9rpilVt4Cn9PV1w/4iw7fIZ+oslTwiScTuJ3LIb?= =?us-ascii?Q?Fh0Pmx/YrRfOQlehzlWZVKGHKQRCMDhwII3da2zHb9blM8GtiIWcQPfqrh1P?= =?us-ascii?Q?DWoJRqPad7lv3EYF69e5XdsQY4/IS+pidmu6NXCiMKoSFh5IBaJGoQTaz4qf?= =?us-ascii?Q?DFNkFqEzEtPsHqmQt2ZpSZ9dwN+3+xg5J45loybJz5pMSQZNSp54/um2e2/A?= =?us-ascii?Q?UMoQ62gJmhsj025p/lpFQ5E1iANXmXtVYQF7FUFcfdO7Nqwdb3e8x7k8eJri?= =?us-ascii?Q?F1ayjSYJECgJindjrA6HNruPEcBdhtu3rQDDOm0+4wRiHEnKXXhY7YUU8uNQ?= =?us-ascii?Q?eSMixc8ucm0fwOUEWZLxRAo99sb22uNXYD6HIjHp+h28PzA1QpiGakOBNTZz?= =?us-ascii?Q?2CC3Y0v4gWFUMxp8+sq/uU7u37BxNo3wdhramSvyRGhHgYSAR/Gj8tHSxqw5?= =?us-ascii?Q?rJq7qMb2qzdNVgamJDKAZoOGhCHwjqFuBYw2L6MGiwDoHnTILeuQuxAUKHYk?= =?us-ascii?Q?kddD2O8YzTA8UcD0eCc920dPBLnauwk0rJ2VFdFzfzt2RbYiNG3Ikl/2DA5J?= =?us-ascii?Q?EF8hHS2w/VS9vG4tY6sboUEyDirsX9GFpTUxDxnu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cfEjq5qRWeTFg0fd6yMsu3UF0OHmY3OTnmDYM0QC7FHUw=;5:tjfgRDyOYj4UgtbTkR2aLz7+3vgkuxUw5saTa2y+MBMEVnT+3qQZtQ9XyoSBX4OWw4L85rOQP53ksLC2H/mSmdkYp+ZLc9HRe5sNq6UpLd4nprqQNUjLDD9ArMDJ8TZ4Om2T3TkU3Ob1I5/DdVxf6E+qrNzukE/v/wLY5dcCmGY=;24:1IJtzAGEf1JRmxxvMU85K0QajVv4YaZM/sY51txHllNrsTpOQe+N3KbhFM0qB1MOQYEIMBirLOcV2GUT/HAcMbMHQqnnfQCrBVOcxffLR5o=;7:NhBMsVXVDsNzonDn4NNJ+vAknR22V/JkmYD7wsJFAlTMCdgCwSqxeB/wkmo4dD4cNBgwaVBZsaH83vGK1mzL5ri5CnTnBpSZLxcO07X3KZCcdBJ8Bgb0zGGlKg4tYVOhpmu3GD7ykxUHoHzmYA7cFUJ1iBO2+Lqlldif3A8DRMHe44Dw4c4aMEpHJpenElQ+o+ut48861rf/p0T/YAnEZuUFHN+V5kam+qUGmmk3dZmb5AbDCbVZAdYiUepte7k8fFQhrmHUZHsif/nP9qX4W/Py5Quj+awDR6UG431QyYT+B/buNntACqf11xoy24eYf1eeGoFFTbLbgWMWYCUZHA== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2016 03:00:56.1330 (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: BL2PR03MB321 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2582 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 @@ 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; -- 2.7.4