From patchwork Tue Jan 3 06:33:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 9494419 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 B963860414 for ; Tue, 3 Jan 2017 06:34:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAB832679B for ; Tue, 3 Jan 2017 06:34:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F44F26BE9; Tue, 3 Jan 2017 06:34:10 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D072926861 for ; Tue, 3 Jan 2017 06:34:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934453AbdACGeC (ORCPT ); Tue, 3 Jan 2017 01:34:02 -0500 Received: from mail-by2nam03on0060.outbound.protection.outlook.com ([104.47.42.60]:53792 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934439AbdACGdn (ORCPT ); Tue, 3 Jan 2017 01:33:43 -0500 Received: from DM2PR03CA0005.namprd03.prod.outlook.com (10.141.96.15) by DM2PR0301MB0750.namprd03.prod.outlook.com (10.160.97.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.817.10; Tue, 3 Jan 2017 06:33:40 +0000 Received: from BN1AFFO11FD039.protection.gbl (2a01:111:f400:7c10::109) by DM2PR03CA0005.outlook.office365.com (2a01:111:e400:2428::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.817.10 via Frontend Transport; Tue, 3 Jan 2017 06:33:40 +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 BN1AFFO11FD039.mail.protection.outlook.com (10.58.52.243) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.803.8 via Frontend Transport; Tue, 3 Jan 2017 06:33:39 +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 v036WhRF011369; Mon, 2 Jan 2017 23:33:31 -0700 From: Peter Chen To: , , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , Peter Chen Subject: [PATCH 5/8] usb: chipidea: let chipidea core device of_node equal's glue layer device of_node Date: Tue, 3 Jan 2017 14:33:28 +0800 Message-ID: <1483425211-14473-6-git-send-email-peter.chen@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483425211-14473-1-git-send-email-peter.chen@nxp.com> References: <1483425211-14473-1-git-send-email-peter.chen@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131278988198096972; (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)(336005)(7916002)(39410400002)(39400400002)(39840400002)(39450400003)(39850400002)(39380400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(4001430100002)(356003)(81156014)(50986999)(5003940100001)(50466002)(5660300001)(68736007)(7416002)(2171001)(5001770100001)(92566002)(7406005)(97736004)(104016004)(2201001)(105606002)(2950100002)(85426001)(4326007)(6666003)(47776003)(107886002)(8656002)(8676002)(33646002)(36756003)(48376002)(50226002)(54906002)(2906002)(626004)(189998001)(86362001)(76176999)(305945005)(77096006)(81166006)(8936002)(38730400001)(106466001)(39060400001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0301MB0750; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD039; 1:L/OzMiECdhk1ezHL2B824vAHAsDR2V6iVCAwXBHFHBkX/lP+d7s13KuViJLPUftQb6sCy+uaag2oK/gV+Bdq43KMrRBgqDQq6cyNmB4KzvV+ZbfHtKJeM9Y2YK8/XjImgb57vgWQ0EHxA3HuyNAAx9Rm1PdfBeWn/40NlepIdgOpAQZnfqtPTVb4IoiZ73aLq9q/3K8gsuJr1vgohISvlZTwlgEIS5Iz0h1VY+RwRjUrTwVtb1L4sGh6s7MwHQFLaVHJ1pwa/3Vj6v3Y06cEFbr6W5vvtg6o/d9P6vGD1HbNRNqz+OhZtbw9ewo6+vuDVHvJu6ULtcLEh/k1ufj7vHMRgR9VL9TFUfDitVHBPzcL0x6YORMQil+3XaUi30DoueHj0b5Aaa155vQTVyehUMzAxqdKe7n2jTlWb8R4hwsZskG9rkTc1pI1vyRmiZ8dLA4q0Lho4KRicjL60GW6iLyhLN/8IeSVw41Rh9Dzxk9p6KStjGdLMD/XhpBSl3SFV5Vtrutm7Zpc8SBlLFOI51VBahK98H3BLD3J5JbY5Nmo3TyQlcTugQeyMoVUHJU/nhdgjVsLtDcjunKmxFaJDcJSyoztBQ453V0uETFLfJ2R6EhUU0dUc4ZfXNC+WbcP1M8hLBjYKAWin6LSNmgXS+1vXAn2r7md2g38HtMQGAFws5NnwHaG1L11kUzpfT+MOyqSx4w5UzO/tYH5mZDs5OPT4eZrhJ0yjTlyEcl+fP1QVU0YsZh3udfn98G1BoKeCAS3iJByITL7TZtL9T1nwA== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 29030b95-6acb-4e77-304c-08d433a2747c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DM2PR0301MB0750; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0750; 3:OZRDEQjMNUrqX19iwcDb9wrQJheWDaxR0NyUyWvVMFfRJMF3Btc3LdqGkRB6XaDZDyyoSjSTGWWhQsjdbFa9LCs8Wgd3MQTI95J29UuwG5xmUjIaZ8hfeOfY4LRnC3s0Tl2jcZYf8Nw+AxjdelOfHv19TWnFfHDXrdUqkvN1aozodkmvGV/UTiWzX9tcz6j3fekpMcAMbOoxMkM60Lx93ZhC0Mmh8C1TkjgZAGYL8wfx2N8xpWPCd3MKgM/ykgtavr4GtQTCjHr0G6j8O9q1oZuQHUHZRISgpMwhYRKJkEsXjBrXXneVPnn7TfCN+mSnuz/hbSA0/Rla+AbIZXW5XnpW+CZyC4YNyNVF/77u9VoqN7qAvqGgaJUInHZS3Iad; 25:NL0Aht44WXSHrWo/P94vYmPiWRWpizYXAFm/l+/QvcgcbD9ofPbbTVjm/Qq1wllVdy29C/zsNhdbEFwfJ9ohosbkK+6dRT0lUbO8XDPBNoSwdXOIixGvpRO+YngS9asT8PLAhitq/cH4CiaWe9AE8odTSR0qM47uRM+g9zKL31Ho7SbNkJqNGSTFH5NA+kXIiEhwam7aKf14Jk/BEnZBmXtOI6UGMPBleowAnCarcxYtzW7WRznYVVC1nEgTs7zSuE2uX3jLecx6kPJdF3TMBntF5ERUITFe9L4NE3cBBdKpKUR3N/iTFY5NzSsWnaBfjssAkECtZQAkZ6bEjmBmZsCRnHk2OuxYUFGdz3fVnl24bewHL32+Px7twCYEz6tdZuuwGwTpmmxwXokQIYEwjbMXMwnoh3vM4X57rsulxlGL1vo/+kyZ3TDl8VCzFyzO/tq7PSopf8Om9MakyHrjHQ== X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0750; 31:dxCAZd4TC1tUGVjKVm7csb+JkM9RSmz0QEFr+w2IG93SLs0Uf65N6CaetqBbpT3mi17dJsHJsMDGqrWDeo/VKFFk8ZUQYfXB/osBR+L7b0RaI9KLrSfAgKcQhy0+7iVHyWS5JWYDHfQMDQAnmZsrOEwT8TfMKAh+LCoJneqGV/9rEAi+fRUxO6KIkJQ0/Y7whJ/znbGDil13/NUAfX/Am94yrInV9XbKDhBAaEQZpOOziRzK+eA3YyC1AvIYKQOdO0G2CN2fFccj1IVoT7UYueQJGcS1LxtKoc/KWVISpjw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13024025)(13023025)(13015025)(13017025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123565025)(20161123563025); SRVR:DM2PR0301MB0750; BCL:0; PCL:0; RULEID:(400006); SRVR:DM2PR0301MB0750; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0750; 4:+eYtDarv4Od7jmrXbsPxn1+Iul/XxrqT9eYpkX97aesvC0/v6esFwva5pDh1dl6GU9l3vL/CfC0ZKRDfwiUGhm3XYU1/xXSmQyNpmJzju0IviyX57GyqOkyuwjEGiocj2/LqLqriGdArnGSDTn84O/aRe44hj9yPepMmbpVlX00gATYXqB9L4f/eE2qh2b975pusV1eK9hd/IxNA2ZH9VKdQpNwA+ZI9000ADJykR2SEJujN70vb8T62sptdMCEaXmoKQRWvWs2S0K6GVkS5cCkxIzzNqcK8eE6k86p+NzeIa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wWHF/DhCus8PIPxsFJMC1l5f9/LYdQPiH4t0REtT?= =?us-ascii?Q?AZn1rQQmE5jGeA1dRwKS4s9hGCEV9im+LRuqE414qW/2Zn+Q41Z95c2N4CJl?= =?us-ascii?Q?sLV++wUP5fg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0750; 6:0OnQPnquxxRauYcqFoU9eN4apKCD0Hdc32c583oYSUo4qkQVp3+aZJC3im+ALy67/Ww8f1ew76dY94WAUr3dNjRQmtfIW/x8lWTIBzcYiXe0PxxQ+Vn7xEj4CHEDm072CZp9R2X9XfNM+Cp06ZGQbabV3yPvtbqOuqViGnc+GeIlKbqgakdnXG9rCF84nYwn6K+IH64R8jl7zLXXz3srIkebiB797aAI/wqHSryYx0MjpDwAbwl5TjWZL+R/pSNACze9kpa8ba0DRkRiKNIkM4c7QJrSvafRkygDzKnKNVPZp3X7iNeRUcRoEaVO7PULWrCjW+lFmMquFMVeJev6WajZSr+wgaAE8XRP+xBxCQla+CPRCaiWkQB4goCMaL7EpdBjtptWggyulT7OtsnrzU/6ATrQiEuvJJnclgDh/tgMEgcFkiRPj2eQdu7zX0MV; 5:ZOixBbeQ9Vx/BIpZEr1Karpgpdif3Bb+6DN5FI/v2YRKo7Ff6J8kDwDillCM3sXPHWMxWr4QYPUF+NHC92KmiJaSvWle0tW5MtffQ7M3NlUJY8LDQimYZCwEZLC5Axne9WymanwCFlZJnRqHh3F5hUxrtwgTiISKmRx3pQp49h1/GLKdeGM0djsLlPt9Tvml; 24:iIhYa2zRRf/Obz8fJooT1J+Rn9K6ukheUfBG8XNKfLk3tbMoWNI+mx0MooJ+7xdsbZtQ+P+kwtbtEY9K5j2gtHQSjlX9Qqzlk1kRdAtFfQI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0750; 7:jyDUn8vI/dQOFDX7haPqBGt8Mh4ovK4nLI9xX8z0AwyXFVWdDQAr/lOxKF6QLN3K29hIbINfWRXqI+cQQbDAX+K55WFOIJawyQQdITigxmwErXHqDwh3p/tfjhn0GGufjRVQDibEGmVYa0cth43Dg1bfnSGEpYHVGCl3L2HlDBnu5WUP0DdyiKNcxLRAsJNnc1zXrczxoqjRsjBwKx5VMARjmI1bfCCgGLigtXlDPsgoKkhHLs2/XE77/QSOOLeCPf0EB6wwJdWEbmit798WUimGoPvMxfNPRZ/HuM3ELECZusorTXVkPVaCtn1glYzmi8eJGMczZSlSSEv6IW7jSwZDeR4MVCHjvl7fvnIdsTDSCvjNBCDrjX/r1f55ZORAmPW60LVvSJAUCc8yQkkujoie0M297KXly2KifBTZsmBEPz+GPRbj6DWpz0TsxBzOArm44CY5BWVgEr9EttRIEA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2017 06:33:39.5444 (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: DM2PR0301MB0750 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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 3dbb4a2..fdffc67 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -928,6 +928,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) { @@ -938,11 +948,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; @@ -953,7 +967,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; @@ -1059,6 +1073,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; } @@ -1077,6 +1093,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;