From patchwork Mon Aug 15 09:13:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 9280645 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 8BADA607FD for ; Mon, 15 Aug 2016 09:25:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79ACF28BF0 for ; Mon, 15 Aug 2016 09:25:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DA8728BF9; Mon, 15 Aug 2016 09:25:06 +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 E2CF828BF0 for ; Mon, 15 Aug 2016 09:25:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753002AbcHOJXf (ORCPT ); Mon, 15 Aug 2016 05:23:35 -0400 Received: from mail-sn1nam01on0084.outbound.protection.outlook.com ([104.47.32.84]:43856 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752941AbcHOJXb (ORCPT ); Mon, 15 Aug 2016 05:23:31 -0400 Received: from BN3PR0301CA0037.namprd03.prod.outlook.com (10.160.180.175) by BN3PR0301MB0836.namprd03.prod.outlook.com (10.160.154.146) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.549.15; Mon, 15 Aug 2016 09:23:28 +0000 Received: from BN1BFFO11FD045.protection.gbl (2a01:111:f400:7c10::1:117) by BN3PR0301CA0037.outlook.office365.com (2a01:111:e400:4000::47) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21 via Frontend Transport; Mon, 15 Aug 2016 09:23:28 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) 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.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD045.mail.protection.outlook.com (10.58.145.0) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.567.7 via Frontend Transport; Mon, 15 Aug 2016 09:23:28 +0000 Received: from shlinux2.ap.freescale.net (shlinux2.ap.freescale.net [10.192.224.44]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id u7F9Mh8f020596; Mon, 15 Aug 2016 02:23:21 -0700 From: Peter Chen To: , , , , , , , , CC: , , , , , , , , , , , , , , , , , , Peter Chen Subject: [PATCH v6 5/8] usb: chipidea: let chipidea core device of_node equal's glue layer device of_node Date: Mon, 15 Aug 2016 17:13:15 +0800 Message-ID: <1471252398-957-6-git-send-email-peter.chen@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1471252398-957-1-git-send-email-peter.chen@nxp.com> References: <1471252398-957-1-git-send-email-peter.chen@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131157266093928795; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(68736007)(4326007)(47776003)(2906002)(76176999)(356003)(81156014)(229853001)(81166006)(106466001)(86362001)(7416002)(11100500001)(33646002)(4001430100002)(77096005)(2201001)(19580395003)(19580405001)(5003940100001)(305945005)(48376002)(36756003)(50466002)(626004)(50986999)(586003)(8676002)(69596002)(92566002)(5001770100001)(2950100001)(104016004)(7846002)(8936002)(105606002)(50226002)(189998001)(85426001)(107886002)(97736004)(87936001)(2171001)(8666005)(7059030)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0301MB0836; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD045; 1:qbvoU3GNGsWYCVQeRmgf1QwBBLRrWjVskMqLhabWU3kW5fD8gjGl3+s5MUjRc6xmSEA0sQ3ki4AeXTIrXGtvwDZYqN9BYlbOPaU9UJMY5wGc2Zvb91FNzSpyW6qyIthZxd/3OnZgNMu0kd6O8TAAFUg5T5qBZbIAAGin6b83BDJdC0OBP9fA2xYqqjDN1mwXLMuo+czQhtKEmNfGQaLNhWXZq5BxKAfdziMd/mIgV9NPZKaBxT5uXKAgirJZ2rUUJeeeMyL6c2c8buI3i5f5DoV5n+oWom7Fe9+SIpuKn83Ycm8td6iWRieuZvjmxWvZ9S5XzKOHq5XJBQnEPz9MSXg5Pj3PrCcby1xFRBtsHSt2XhqRD8H4ci0oNZQYqGLjSTU5DRz5PdZQS3kxm4b2BUHhDu0okWKc0Fko9D9rGSwsFENbLwwwp6Ev61zXnNodVwTIxjBXgQ81R1nODHxWeA7llteetvjNSlFPkjXnGFgAzTDPnCgSk0Ay7ZSNk0D+OuaVxC96TOL16s06oL/Kl3RTGCXtT1PtdxcN1LnUUUciK0veRsM7GIQEoiy2+k1xQUO69y2MhPssAqMyB8xCpp3l7KIg0XYYRXjbjqxJht2bgszaaw0DsaSJMG04Po3xkF9tGUY2Sl3gXsvw9zTFPZilPmUZ7ukFLctFHuflfci0wzNHmqmBzqkrfN3jZaDAY7azwR9plVNPns1OKXsC+QGXRP6Eij2SQ6+WP7iTHyw1Z78RFwikol92M2htTLHM MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: a70d833c-905f-4670-ae9d-08d3c4edd1af X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB0836; 2:1klHcE0KSKqzyDbZoJ7Bvn1A3GHHcZFi5juAZvaLgHPrMf6YG8UBw+OXV9BjjXMxZ4P8HKjwbqO0EKh6oMRemZTAlT2nEwX5+Mw1lMjOOeXxTJtxiq2JeYU+dOkTzsSswX6ndiaebVeZ2VLr08NfuHR9JZQpG7CVOjJrT4PlFQ+myxqAeHt58zZgTcVaz2/T; 3:7mhgSPmByCqJSrXBLJV1uSyMgC7LbArW9A155yNOA2h5IPU33CRH8JNH0RiG2jBOZLqqq79uBWC2iIa7AUMGZy8zMAQgs7YAUz/d+IDtzaNgmedwt9lW52d3xtR7RuYNx+9Coij/HCq7wYrXuf6Gz/VYYJpePrMZ9s9vDHciopjnNciyIVsdRhuDCOFZ7fDPv3doS7pwo9fq+6NgQTw7j1dsWKOIW8/oaW01Q1WGM+M=; 25:satElqySHERjtBdmt+OnXyme4y5wbByrTScNMsNWOMtCi8/ijzgChu2azcI988eW+HdCxqWHIHBezGuzN2YoPINAoXXQDEQWZSgjjcduJaXy4fC34JkOAwLyocK2aeinPqmYwXBQIx4IB87/qRDJO7QiSeA+vFo7gSItydBTRvV07Svg8ks/CrxkxjulQ6OzfDuA38v0cLZfiGne8lk8o8TQfzZbcc1oGdGXYm5QiAQuZfdNRyOjF1VOpI1MMSnhgfSGdWsSr++GTTApk7Ha2b8AmxXcKxMftHli91aUSvxW1hzlMPRcErFgqrFoibE96NKrLCsR9GMMfkDG8rQi0ILIi6DbIPuNbHNxxC3EcSuq4cbXjlEi2X/ddjC9/vKdOEdqy2CPzZ/V3NmTvuQ3M/YkX04HymWhubNJ4JGcO14= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0301MB0836; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB0836; 31:M8D+Oljs9qOh7n6dMvj6g4acWtrwwFvWxq4++4Z28jES0F01IReL/YYg+K1YN0dNPo6JOL+Uz6YycIyEaPExsJ8IE77nT9r5ZQvbysuiN6gE2d2dejEjfI0N+PNN3kpOWfLtj+08q8q300EeFN4ucXpmBS/uSZLvg3iYJBdK6tEkvn5Jydl49bJ8E8E5u6DKDjzHT+Nbo7W1mP/M9KW06yupeUIyD0yx2kXf1GZ/ISw=; 4:W20EHFdT93OD9AFlkaNKBEP46XIzb6Xu8CRxodHxn6DyaGJhbzMPKB12fjnyrbw12ZqrjEM0YkcrZFlzrO7ixiyA4zyhHdU70xLzf/EUOQgOAyCqQ5WXGnJLNtmbBgd+7cPGq6cQ8SWYi6t5uh/jfm90ZHo4ZbFhP1SSP07dkoUsIQKPsVUYmSqAnwIoHyBlVsTJBFOh3xUl7l55J75FDaNeoF21phc3ztGFT4yMg38nf8RK07BUVD4AuONzPbIV/2uM5jseXBWuYSQjQ4S7iy5UHMw4quCh5VqvLvY6V8Euukk28f9nihOr9jQ6C+DYyWHrxz5OHVxduyVdvJnjKVScDJX7Jqu8Rz7vk34qtm4Pto0pxSaiQdl0iIvFi/vZR21t5Nk5UwJokBEUj8oH+wn4tFoqdFWXo8kSofwkcEdmLqhdl1vv8E2mIdCkWLu0GFrTKUKHlWcEQD3w5dofm3IH3T4BHez4qKEs68UIaAn2LDxowAfxMrNFu5ymiise0gk1j0DrIBrgxLh7LzuDbpvXdRg5PpDqtHYeOnfSk6g= 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)(13015025)(13024025)(13023025)(13018025)(5005006)(8121501046)(13017025)(10201501046)(3002001)(6055026); SRVR:BN3PR0301MB0836; BCL:0; PCL:0; RULEID:(400006); SRVR:BN3PR0301MB0836; X-Forefront-PRVS: 0035B15214 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0301MB0836; 23:tkj4i59quxPypETCYtBRpmXWoBp1A4whYrgdUST?= =?us-ascii?Q?V8Hrn/zASF7HRmdJWCfRGqGT1Mq5IBRPQ8NpaZ9z6TryJz1ziozW5q8wrxkS?= =?us-ascii?Q?vveSKx9P8pfsLJkc80Vg5H0MTKbZtyWsKcXjgnAi1O4vKsOsnNwHzOWpa4nL?= =?us-ascii?Q?4/qWYOCjycsYPg7HJda/3EcCV7LCZgCJmwURO6hnL8L8c5tKElztptZ3oIrE?= =?us-ascii?Q?2HBaABpx+whpM1Ry0/CIjiVrO48uo/j/ZCOAFCNjRiuWWv4HoMYzVvYZ0bAN?= =?us-ascii?Q?8RRceXUad2otnaf4EzWg4Yt2R7SJ9llbru24hJyyqsr8IvQXSVAuqOQGWW70?= =?us-ascii?Q?LwlWSq5dcIILOlEJg0V2wn8n+yKxSRHDnejrpKRQeubQ2RPdTmapemhCTq+7?= =?us-ascii?Q?SiXWhJKEFTyBehFcm1QxlYpB4ay7eWiMfEjwukVes5Nr4rd6d8k4jaU+4Vdr?= =?us-ascii?Q?sYTIQbIOutD0w29sO44U/jP+go0Y8PucZ3YTgahFEshVeL7wBDbnUEpvo6ts?= =?us-ascii?Q?xJJyQ1EB2cU3RLzKiEj9XVMV0fVv0ml4Vb1VboavZWHo7rPF4+ZXquA77VTd?= =?us-ascii?Q?dwO3tm/Elgu3da1HqRDPqX5kLvEXJ3SRHqB0jmhTfNRvERAlI2SSSURkTjak?= =?us-ascii?Q?3Jj/9ayjamYpq9ivLs6uuT/hduVpJLN4eBfblca4+dn2LvDJjg8In1baHqGU?= =?us-ascii?Q?Q2HlPBelf17X8JT6evoE7keLFWzcEnR9MZMDSTa6iEq2ONVx8b2oLby+Dlh2?= =?us-ascii?Q?CnM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F8jDPYPZ3twGMczRWhOkF/G1/7ExK8lxob0IC9hCPZM8FUS8PDKSR0HylUK1xVE4rD5tyis5ItrKLjWwCQfrohbZvu96hft7KQCponoq2CH5ZaQ=; 24:dPHQPVcYpQcT0Ou6rYJVzbh+GI41a3g43uTmVYL5aVxNqeWA6Bb/N0bH8aNsm1MljtMgETCbSdEnR91O/X+dxOE4DNWQf24CIyiS5MVmxjY=; 7:uwJtlxoSkTVrY27Kaf2AjQ1s0ZdrpMXaBytm0TKdQkjMYOKHRvP7aObQRTHK4VUE8gs5uuuvPzuzhZg24h/DndkKOMRmu3/IFkgf/nzLrCnVzUM1cdZijkH3w1X0WC/4gXv928z4LWN9QWk7bZDPRRHw6yENZE7H8yBNnemI2Fc6w16Nu11DrKBSWLOose7Fe6lFwDpjhlrFIxMKqWYVN3posHLce090PfPmwE6MDTa+qXg9qxC4XSam40MlurO3 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2016 09:23:28.8468 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0301MB0836 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 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;