From patchwork Thu Jan 5 06:01:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 9498455 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 8227D606E0 for ; Thu, 5 Jan 2017 06:08:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7117627FA3 for ; Thu, 5 Jan 2017 06:08:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65CCA27FB6; Thu, 5 Jan 2017 06:08:45 +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=unavailable 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 047E827FA8 for ; Thu, 5 Jan 2017 06:08:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030644AbdAEGEK (ORCPT ); Thu, 5 Jan 2017 01:04:10 -0500 Received: from mail-bl2nam02on0074.outbound.protection.outlook.com ([104.47.38.74]:34677 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030650AbdAEGCm (ORCPT ); Thu, 5 Jan 2017 01:02:42 -0500 Received: from DM5PR03CA0019.namprd03.prod.outlook.com (10.175.104.29) by CY4PR03MB2472.namprd03.prod.outlook.com (10.168.165.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.817.10; Thu, 5 Jan 2017 06:02:03 +0000 Received: from BY2FFO11FD001.protection.gbl (2a01:111:f400:7c0c::108) by DM5PR03CA0019.outlook.office365.com (2603:10b6:3:118::29) 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; Thu, 5 Jan 2017 06:02:03 +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 BY2FFO11FD001.mail.protection.outlook.com (10.1.14.123) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.803.8 via Frontend Transport; Thu, 5 Jan 2017 06:02:03 +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 v05619tE025211; Wed, 4 Jan 2017 23:01:54 -0700 From: Peter Chen To: , , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , Peter Chen Subject: [PATCH v11 5/8] usb: chipidea: let chipidea core device of_node equal's glue layer device of_node Date: Thu, 5 Jan 2017 14:01:56 +0800 Message-ID: <1483596119-27508-6-git-send-email-peter.chen@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483596119-27508-1-git-send-email-peter.chen@nxp.com> References: <1483596119-27508-1-git-send-email-peter.chen@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131280697236827353; (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)(336005)(39410400002)(39400400002)(39380400002)(39860400002)(39840400002)(39450400003)(39850400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(305945005)(4001430100002)(7416002)(356003)(85426001)(7406005)(5001770100001)(97736004)(2201001)(50986999)(107886002)(76176999)(106466001)(92566002)(86362001)(105606002)(68736007)(81156014)(48376002)(81166006)(36756003)(4326007)(50226002)(2906002)(626004)(54906002)(8676002)(77096006)(2171001)(50466002)(8936002)(5660300001)(8656002)(189998001)(33646002)(38730400001)(104016004)(2950100002)(5003940100001)(47776003)(39060400001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2472; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD001; 1:HyYSF/NRaYV1jojswasRurzmcxo3cSkgCfb3dW2Mway4zOxqz+Wf44IIa89mm8vrzzhN1XH03jds0YAx/8JwTjurTLi53XBwiAXVVmDZ7ZJV9FOmUDdPo8nfdC2TIFB2nc4AipSSiZJ/9plexIEAzq/0SQIrfz1AC8rE3/4cgZCkLyqY1IixfOk0m6BcgEoZZPJeelo/+bGTU/dE51yshMTtk+QifD3qj3ziyOSCI5fofAZ7qDqeUfWBOhFuYRaMJJMs+ybTXhmVp9oHQYAqMyPsJHhXnwAIyMk5k9WD4ha4RfCIbyGUN1kACz90ZttzqAMqvxP4Zod3KB3O2UlVyEmlPhA+dDLWlN+tmpEm7KCC/FKvURGeapK6OwAYNSshHKUgY1Nex2ccjLbqPa6DMPThOu3mOS1DrC9sKLIL6TUkbr4rUnP7eC7EAiGQfWnykOZgovIhCMnCHpt3qt+7Cwk0UZJ1kYIm84TUQiX45uM8VvaFnt4wtD/NOU8fXQj4jsLQKGxbLh17xjFjB5x/9+uch/0WWMnAF9kpVadivtteckXDnOA3d33Ex7glJ2qkI1iw9nhMCY8tlAzbVIeE2rasjyiBhOukLmdiwXQ+dy6Zqql5j6rjp0Dj6qDyoWuBlyg286SK0POJ+1Bm/kAcdkdGHdwrllUrCsswssgrnbTxHpGB7pCUHeLW++KCT0Hj0spdjqr5bANIzyveLP0n5rjmgTQRSJCSvQU1kx9LW2RvMYyA43NkOBdmDaUFBkff MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: a6bf369e-bcd5-4624-a1f1-08d435305f0e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY4PR03MB2472; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2472; 3:kOAthgJc+PzBsdVeeEtHIhRJ3U4GYdsFdE47XfzahxQ2ChO6ewTyP4kdMZZwzco3LwDFGAST/9r9zgO9YEVNq032F+CWaj8maMd+YRDAlzLfLdTSNclgM+uoLYsWLCN4/9SuH0A0ESgL/iH250mXTMO9g1I23jAVDT4Sf8tK6A2wn9lJ6OGkxt2bnROUpc/MLWCF3HaWMTdG00Y73a+hGuOERWE9jx3ev5kRX5wLz8QMHNd/GJWGGUUu0tWQCCUTXj1ne4n03s6bCKnTeq7LfSC3BG4U3wtlDPDuNb6WmLtSBB4Udql2N8NAxxUZA7c4wsE21toUsZgunwBVF7KsivQUTAxRS74k+FxJNgQaeydkGDWKDX6KeK7nrnDbzDAN; 25:T7Tsgx1F5syskvY8WOKSc6bIRGmvo4zqvw0SmLlV2EO7tsyyq/YJsoZ85IvwaY2nGMr0YjjbLe2hWw7RxifytyyXy0KmC47j+hLqIF5UzAayZhGThDSgbukS/9YEkPKVZ4l5QMD4QYrenQPyA5HTjvTymD0g/ozgtwj46ifDIdicypmSNUw8I4CEXovhgAO0Q5Q4OWbpadkmm2YxqARqXQRIkVRH7ptIuNNvXfpouy5fblzsbuFp1eGwVVKUyV/Iz53IqovOogAaV6U2S76/+itsgfi0Qevqg4cpJDJNnjhtJ8dIAck8o3Ng+6KQREDWpgKOT2Zfc91LWFnPqdPhmCyNxG+8nPp4cYRInauCVcX4Kb0OWv02QwOBkk0YsKJyOncSBdZnlihXL3lOsyb+tLQkrXhUVa2zRt0VFOld113IgMe/8BHeN112ZCeyu3bqV6gIQyik8rR3FDv/SbrFuw== X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2472; 31:wCdQKIElbndReUkRrJlnpDc60yPVJXAEPGNIDjxQ8qJg+aB891E+iRNXtivAH7fITMLL46sxHakXvYJOMTangS7yl+2oBxLLJ92Fz81w0uflS7kvyyFywRqx4cYT5Yc8po8qvvgGKEehBWqpp1zI9Gm/QZ5K/nH7vNU7Y7Z/75VMcPu9TnXcLFfneMoOXFV2Ep+CY7z0jvY0jRpJSi8y4uQmFoJP6iKGlwj4s3lF8iyqZRUaTfAJfU585XFOEau6Z2W+sR7CxrqZybo+SQ4doQ/qWkPQx7TqmUM8PQ1goqI= 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)(5005006)(8121501046)(13024025)(13015025)(13023025)(13017025)(13018025)(10201501046)(3002001)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123563025)(20161123565025); SRVR:CY4PR03MB2472; BCL:0; PCL:0; RULEID:(400006); SRVR:CY4PR03MB2472; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2472; 4:wTqgPZkWO9mmDqx+NCMZSudz7KSbDMLQwrhNKw5rW6Ht7WfHTqZJq6s7J2rwcefARzR5g6z8ekehLz2yxKdqDSnBgKSWM68RDOeSjNVM5m7asisyRRTmOgKmeBnszROV4lAOq+cT2FgqNWD88cTh1EovOCxf3stY42D/zq+Gr406VAdUgDKMLW23FF7FiWq5TvGNl59yuyWfOz8tLcbEU57JaCKqpFyrJGkqCEsMGp7IKJEXOHavZ2lxTq2JsvSPB4JrLEzTb5kj1EJD4ENxACTo0bgOXIQ0hH8ZmhLCdbPrZPNyYkK/v78pfGWmNAUtRr7gvhy7hobjvM3Y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T9bEDihF?= =?us-ascii?Q?tVJiiYEcHb7MzbY/fRjV69wSzoeGcKxcnNo9W954eLwF1CM?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2472; 6:TcBa/DPAR16ivaqIcDKiMP4/4MxKh5CHAOJPsp6omshBP3VulsZIK/lVi7gDZv7cvHyugQSDeAR+ozBw2Gcl3AgdxJQhA7n4VFVa+JNq263iMovSWqMYwN1Ryo+WKZlqmIKukUVYz2mg1RYsEa7QRZZqaw+abU4A/nFw/39iLwPm3XGaV29via8wjDTfHw6wAGm9LcmxjNFzHxiGdWhFeVfbpK1B0TkrXJbkRyWN1kOBgtgUvkbHpLLAMW6oKU5k00c7l3rLMkeWt7mmSDvSx3mg1+S4r4gXio8TlrzbStUt8Zdy2DpeS/5qQd3uOBrmlUCUKcsbhzCogK9l2qyXzPG2Ome9mIcYWgrogRoKbtHbTNyBnODQpUOoAyn8uiT95Oqu77AJMyO9KZDxbjYwp/fdjNYLkfU/khOaVrv8KNqCUKDhlVYEmjT3AJpju87y; 5:S5lS4MQU3HtlmipGSHUv8zoiOAeYoHz/4XrQWH8w+zZDj1c9lQLi9eqGkaLHsw5b99/IEPtt8s49zoAtqIDMhHtXiKTyTIsvWVr6RJhsOq/rr9I9i94K6eWpIhbbZfeEu8kcgIh0OwmjdSRed/PYiaPa3pbXDutOhkTPbjntUI24BduW7EZbpsVOsxZPu/zu; 24:CpFDm1m1S92AUDLETbsTpmQlJyhkdWI+CvQGMz+rMZ77AL+L1/GZSXApu/Gcj3A3mAeYxmGhz3IBPuMucl+8SvWJdmDI5XYYAk4xDhL/Xfs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2472; 7:d7nbGtBmd1qSupLozkM37f8q6qWr6VhhQhr3vSlfugdCLo55jsXuNnuF5lwbktDmSFrEJzxzJxQzhwcyO72QAK/NfV1ZxyCZz6nfM4wpUcFb7+DS6KdQ4VrNylfnbw33/X5bmTf9ryWKgmEPVTeX3PcNTmpuHYjS0ZbRbHDg9RNqd0GMXVKnNy4lg4hP4jcb+hwTg79rOf1VykXuJrochgOWW7hs+q5OkBLILLESTGZJ8JWQQ03ZQW57Jmu0OVwR1uaEhf2ZCYBsW8z886yYacLkl9uMXkM4BWvUtX9AE3el1sOXo2/SFP29r8slX3ObsJjfZdy+RlcHrzJUBIhbMlyupdWY25iN9Adsd9rgmxjQt6kZuFejD1T67Mr42tlP4+MoaeaDpHCrDI7SahuHfm78QkUavYA8FQixAe8HQW2RwwqzUDbyPmhJyen/OA4hNqnYZT7ps3HXO/WKeBUcIQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2017 06:02:03.2771 (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: CY4PR03MB2472 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;