Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752933AbcKHCw0 (ORCPT ); Mon, 7 Nov 2016 21:52:26 -0500 Received: from mail-by2nam03on0081.outbound.protection.outlook.com ([104.47.42.81]:63552 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752142AbcKHCwC (ORCPT ); Mon, 7 Nov 2016 21:52:02 -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:1479;Count:10 From: Peter Chen To: , , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , Peter Chen Subject: [PATCH v9 5/8] usb: chipidea: let chipidea core device of_node equal's glue layer device of_node Date: Tue, 8 Nov 2016 10:51:09 +0800 Message-ID: <1478573472-29516-6-git-send-email-peter.chen@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478573472-29516-1-git-send-email-peter.chen@nxp.com> References: <1478573472-29516-1-git-send-email-peter.chen@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131230471193532255;(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)(199003)(189002)(97736004)(8676002)(5001770100001)(626004)(85426001)(6666003)(8936002)(81156014)(4001430100002)(81166006)(2950100002)(33646002)(586003)(2906002)(48376002)(76176999)(50466002)(50986999)(106466001)(229853001)(50226002)(68736007)(2201001)(77096005)(47776003)(104016004)(107886002)(36756003)(305945005)(87936001)(5660300001)(2171001)(7416002)(8666005)(7406005)(105606002)(7846002)(189998001)(4326007)(92566002)(5003940100001)(356003)(86362001)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR03MB2881;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD051;1:LNtkIktczelzd9TJm+CLP9o3EJ37R65gcQ3sk5nfGgORPCn2W7DFkW/NW8p0f8XwJpFiuk6iWiPMvK92bMSHMvuJ+X5c3snt2C35WWPKmyu//EZVmBlO8LD6wHyJEHAj1avxDGAMwOBgGZdemvFG/nFPVZY1qKG88I9+0Z8WkiQcd5BtL0iKSvNVVTRsoxs0lUD5TbXUQ+wOQulC7mFZRcJB2/eTQKwHLJ3ZLk/l45yFShpLFyHnKicw4XWR+WZRwH+JDuHpCRT50VRVZ+I8RFODr1emkFAGGAlRS7Szfv4Hqo4rwgjmiPfLb7nFHq5wINlJ4PY5fxf3/y6s89KecyQB16dxo2incxcqDQbxjwmnQafEUcrHmKkxW6ok8rTwp40m2KMMbOYhH9udvfdOj6vqp07nmB3Gy6IEOIgkuKZ3r7IKwQvwuWSgdVGXLVwfEItMkZdn+ZZQRaCTWSo/9zmwdPtuGE53Y1FIKj6YG+j0OwSEUUqmQFxVqi7jvaHq/qk0i5+uG4Lrsyu53ovRIpDUH02Qxy7ov9mVC/m0q13Oyqoo//kVRPkoyP9fz9fpLfYWzGI985anQB63MTwqyuZOb+mJuZy+29mMKhs+ny86d0GejBn/G/+QowQL2QDmMlF+kjFY3CsmAT26C4MXLgi3MmnxZZV0a3fFha0c2Pz4iR9WwMWVnN+z3t+1efh6YOwbMwjF4/ektTiH4rIOavBOLB6Y0pgFdjKDuE0GkoRUhp6Y9z5yGR73lZtzyf2IJiSkacQ19TtTMM3xfIn1KCQ7xqWu1Q8EHmOElxmKUig= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 3e1abf13-1af6-4a3f-975f-08d4078235a9 X-Microsoft-Exchange-Diagnostics: 1;BN6PR03MB2881;2:42gozX5Yj1HOIQXD1A0K8ehwpysYElFKgulLqU2EC38lPzu7BHmrRyOPeqzJW9Uew5OXzf7bXNkwWjGZhUgSaqeAWxbHNXnFlw5nKbxUmGgXEZi7AQ5eljf6c+g2FT4N8ZYvVvPcVMoj9GHM4vO33usjgWfHSo031mCWUvI7FEh4Ud5/50snkIs1FKAVmEpS3HX3G/xVa0nwnpb8xB389A==;3:OVapNk4JwmvCapGwVPSO98z3EiRGy3FZqn1xyuarQ8eKlXXqbIwlO9qk3ywBJPeyOkQAmUtOSXZsJtk+p9rVnsQNywy7SQzeHl0PitB5CQHhtGbqbY3BZnNHaRucwcUPlUU0yy07UrHyJ/L5ETilWnE0iIcSAzo0ms3AIL4+6X50Nh1aegfneo98DgGgVKzsCIxwX/0X6XDTkYNgQ6izSxXHeMDPveUJ8ok1Avkg9R95NKHbzDShbAlC7snFEa0B X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN6PR03MB2881; X-Microsoft-Exchange-Diagnostics: 1;BN6PR03MB2881;25:/UV+t5/P4crNGK26pR8U2oHT4oIpCVaFNMrbgywNYovZFrSoy8SZHTvuRl8G4ndwfm8FyP1z7XuzFSCCljszUt6NTEMNS1TkQRx1x0SoJrEJz2KoV+dzVTZThhrYxnsoABaIn+m/JGVioCtbidYlUjdQ0g2bHko7MyuMlKxHpveied4PJupJn/WDW27yQ0w974U/W20z3qrn/KZlQklOfTatHAohLI8LCyc+i36C753EIicSF8Ae225Ei4JLtSYCzrJf7PQIW51O0RfxlpMfNfI2aBBb5b4AspxCPNDD1BzMnalf0ZHjfe0yQ09fX6rWX/L7wzm1jgRpzwRzRFWtnsLRqVgwS1p2HCinb1uYsB/dUpH5ifmviC4npCgkOQOKfIhMNvBP89ryrVASXXCpIdNub5EOm8TMrjbathp4YPcTdj76VHasJCX90uXdms5QfXs3Q7jdAZ5VSN3jdb/rrCXWOWQr+j/nR6Bm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mBvf/x9lL7rgwgheIy1SxgtEXJWeuV0BB7ZVjy+etXzmAmNaP/PazYijxZqFaMwOOyCU0UNsGMfqh8G8nJaUnD0OliRadjwcJjrKXN6Vrpqsi+3Nss+sqtqIGS7WNT+s8Se16X35O5lafvf/eXEwEOR30nenC1rXNGaLQ9K 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)(13017025)(13024025)(5005006)(13023025)(13015025)(13018025)(8121501046)(10201501046)(3002001)(6055026);SRVR:BN6PR03MB2881;BCL:0;PCL:0;RULEID:(400006);SRVR:BN6PR03MB2881; X-Forefront-PRVS: 01208B1E18 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN6PR03MB2881;23:nRMr6CZKAga0eDTBVentE9HFYFCJ+XyawjycXv4XZ?= =?us-ascii?Q?6qK9gxk7rC/XxqMg3kIU9tLDOHiFk+WTs4Ry2ksCH1W+psXc1kacddGEycvI?= =?us-ascii?Q?LWdiZVkgW/3NLwpK4SgsGi+odmYjwutHjnVSQfhuWNFEI2kC5T0tEh8Zyevd?= =?us-ascii?Q?deOuZa3giXhThjqGKB1WDHF9GUvJuR7oLW9AQXN7cvlcQcpSP3Sqjr8BLnBo?= =?us-ascii?Q?niv6CXOo3WoxMsWKP28nBeGXDtwWwBz1a31OJZesFkXWEqE3a7pW7gcxWL4H?= =?us-ascii?Q?w9geo8/b95NeCVW0lqmx6nYtaX1Hm3WlcZ6AbFvL7F8g3N3dyef4jPaccXBi?= =?us-ascii?Q?yuvLLswkX8IXtk+864M4HGXjYO3gCD/vvfj66J4BM3Y/Tx1BQk9QI+TPTY6v?= =?us-ascii?Q?J8++1h+12pWhZc8Ai60aDH638UBTeufz8V1kixbVsDe41oWOycD79aNs7RjB?= =?us-ascii?Q?AJ36SpEIsty5wcZmDOlCpBSQ6zOVH6ES14k++vmeY+AtsIZVOxq9hWsfO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Pi1d8qhr8VDpyO4aFLvA0Pn8vwIWGRrsiGu2m2a3XOc69Fc3Nuumu6gFvorBfIfTsnKutxmE3d8aU9LNcRUdc/q/xJ5BzN0Kvu4jDIyYP6YGgYTBeTqfvwquULIUI7ywaJvn8VGICgLS2LAqYGQ1aQR+ktmhTk0qYeJvzxMk3cZ0GXPxUjxeRRF1/bWfW+U1P;5:udf43U+81kim0SufAdMHwIlAssKrdtO2Tm0a3FjEtwRGYgEf9KHBZwjSZ+Ox4XPhR1M21VtUwHhu3cG680RVJ/9jM23B/0ASZetGlmhm6gdW5jL1+fSV5Tls8pcexjYdYYqOq51ZLZwJ7xJXZV3HLuBySQlaCL0YcpthdXNSFtSZVxihWCG7POobeYRgD399;24:jgtxI57En4mxBlIxyGB4SsYGqubo39LQnVwqYp65GgEtCiy1MLb/FDT8aLexLj2HplzMhpkrVtA+RXzwjd1tg1uKVqKklVlMCPNwl/XSpd0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BN6PR03MB2881;7:hV+NINX6z4o5wXlXvjUBItmXyR3DZPMsbtSAZcKK/t3YLE5Oxii6tuyLavFII0jEQ+4ObQGCtZKD1cc2WFtl3+yC486VVK4UJzLtAnwC7hyq+WUhxVPBpEa3VlSmJEoM4Aasy2Z0sjlyAkjFKMuqmIIxTERCg4VKjTDxgpe+xuW/TTzmG0rgIEF41WCYy41jHqPbnqXrHGw0PmHvAAMVyclYm74b1sN02oPiIsotJLM6eeCwmWFR4ZCOlw7RNT6GZ1Mq2aK/vzcT+pLTPZdpYc8KJQIqtd6TNzPinfm4/Luphlec47XdZsfOBeP7nrF8gYIL3W1gcrF0vcFqbWkV0/mzBaahKd6CkmF9evehSzs= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2016 02:51:59.0100 (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: BN6PR03MB2881 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