From patchwork Thu Mar 3 10:01: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: 8490821 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0DC989F314 for ; Thu, 3 Mar 2016 10:08:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 322FB202E5 for ; Thu, 3 Mar 2016 10:08:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 361FD20225 for ; Thu, 3 Mar 2016 10:08:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1abQ9k-00037A-M4; Thu, 03 Mar 2016 10:06:52 +0000 Received: from mail-by2on0080.outbound.protection.outlook.com ([207.46.100.80] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1abQ9X-00033Y-Dx for linux-arm-kernel@lists.infradead.org; Thu, 03 Mar 2016 10:06:40 +0000 Received: from BN3PR0301CA0014.namprd03.prod.outlook.com (10.160.180.152) by BL2PR03MB305.namprd03.prod.outlook.com (10.141.68.13) with Microsoft SMTP Server (TLS) id 15.1.427.16; Thu, 3 Mar 2016 10:06:17 +0000 Received: from BL2FFO11FD051.protection.gbl (2a01:111:f400:7c09::187) by BN3PR0301CA0014.outlook.office365.com (2a01:111:e400:4000::24) with Microsoft SMTP Server (TLS) id 15.1.427.16 via Frontend Transport; Thu, 3 Mar 2016 10:06:17 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; freescale.mail.onmicrosoft.com; dmarc=none action=none header.from=nxp.com; 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 BL2FFO11FD051.mail.protection.outlook.com (10.173.161.213) with Microsoft SMTP Server (TLS) id 15.1.427.7 via Frontend Transport; Thu, 3 Mar 2016 10:06:16 +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 u23A60Kt025904; Thu, 3 Mar 2016 03:06:12 -0700 From: Peter Chen To: , Subject: [PATCH 2/3] usb: chipidea: host: let the hcd know's parent device node Date: Thu, 3 Mar 2016 18:01:15 +0800 Message-ID: <1456999276-6315-3-git-send-email-peter.chen@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456999276-6315-1-git-send-email-peter.chen@nxp.com> References: <1456999276-6315-1-git-send-email-peter.chen@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131014731771792938; (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)(2980300002)(1110001)(1109001)(3190300001)(339900001)(199003)(189002)(5001770100001)(4001430100002)(19580405001)(1220700001)(33646002)(5001960100004)(50226001)(5003940100001)(1096002)(2906002)(50466002)(4326007)(2950100001)(48376002)(19580395003)(77096005)(189998001)(586003)(105606002)(47776003)(229853001)(107886002)(85426001)(92566002)(76176999)(106466001)(11100500001)(5008740100001)(104016004)(86362001)(36756003)(87936001)(6806005)(50986999)(2171001); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR03MB305; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD051; 1:HElbITm2zSpw8dp554v1zUptsIt/oNOLOoiNgEdodbd8mOgyTP8RKj9bSdCtI0EfL+VUlsVu09wT1YhRdThmcaXYcfqPplqJMqNLLd8qhmiHtwgmA83Lvp5aa5KePYvYEpGbnYUtXBCIFBPkxTBF56vU0UCoE8SozVjUSxMdHlQC05hdLiPUEzbww/nxqrlk+yVOH5BVuEGl2e6H9TvH3samzs+2Qeze0kjpJGOrCTjSz4B33BKPSEHcDDK48iGeicoWnA/3DGEbc8kfeGIBXp4nZIc4V3z8YlEq+Fl1+mHdrITd39JZ9Q+xStr6XizTwHN7kGE2uel3CqbuVWdxLGB/5fRft4/njOwt+FO4VwKasLucpZ94jUuMTHGIpI49bVoApTV4+WrrVPGwG9CJnjtrjoO04qXfr9CGQrmOfgt5WY+b5qjqHCMqQ8FrXFuF+LP6A21cp9VKgmlZImh3zTeKf7mNqa84SmUdPNiJOAJgVlt9mkU0vuQNmiMI8ZHxxACtFuvevHAY3wqHsdpp+5ty7Ft1buOWKVDsOk+UvWSQK2U3fDVGpHKBdzD9gf6O MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 224c44aa-19e7-4917-6ccc-08d3434b760e X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB305; 2:gSQywniA9Yn2ntn8cnWn3uV4EcUbd30ZG9v6SY3NgmGSTC6J6Mt1St8VX8rYJjyB3KB/mswulKJgKnAe5ZPE9IsR5cuCWRtGZgY6+pozbK2Z7NkLw/DNYUnWuJKeyJHuwcS8DVIDrAR+1WwP7H0qtJrtyQcdDdJ6Jo9DILixyxAtRTxLFCfeBcSs/uYvwNOg; 3:pZABQ9aTUXaEy/JDYMGBBA7rDxPgs37gu9hk1m2mVIaEyoGxgTvFnrgmw186/NPnsXnT65FYNUj4ixAslxcOkYIP1sMS1Uj5oja5sSsILz2ihImF5/Cr+ImjetKFTBkgcUCUm9kMcmxKXrIW9LvZFCe1JmFflZw9PDpD57V6wgLXzMyKrvSkF9Ltsl3ZKOMEd08uE5vZFnlZzkaNaSNKd7zq3jRs2f6dL18J+myFueM=; 25:uV8V0lVCkTeS6gKjAjvpJwdG8i1I76xHuIi4lsIVOO2e8KGf7hgPCnalHZ3D92Gc50V6vsldBRgZrQHgp9WasEc8KszFlRzfayXaGBUq+p+CYzDtDDSuVisT5GgNwprxubIJse2sYeCrM9DVWJTTo6Var2rXP62JAkfMkePtX4W37Dut0c9dVdGqQbGw/JybShz3rCVUditxIR+fmnKqzEOXt6J5aSeNs8Pmcnveox4J2PMXeg2YAMvP8dwLjDBlfMjp4iWgq+9tNXDihxVhE4CZYLYZGt1PBX4sOXgca/DbyWZxG4kv7XMce8aE0CN1tIRuCqw4rfMPYrWt1eWJNA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB305; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(13017025)(13023025)(13024025)(5005006)(8121501046)(13018025)(3002001)(10201501046); SRVR:BL2PR03MB305; BCL:0; PCL:0; RULEID:(400006); SRVR:BL2PR03MB305; X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB305; 4:MhoVxzAs445D8b+wRH0X7kjR09OOMB8kMEsdBVRffj5pwj8RrFq9639WSRoWwS4NSY1SZkjd03tojYlQFnjKOS7N3ChakbAFs1d9QCnVZCxTAdW+gv8sJLsVkP9LE8cYnl7eyQeKvFurmWM23IW8AJc5LnhmiWV2GfPNBET7xMfK+MMK4huYe0rKgxcMjfsSYedRmqLJ3pfG9uqLRDei5kUmrL7mH7QbZkq/yIfqA80YYOqS8JNLhoD6zw7VifmX2U4fW6Sha7uIfASPGsRl5ZpMyFGi59iTBQZ5jIespsaDK5Em4diAIwY+UYRcos+mWxAzRiQQDwmX6pY1M4E5hx/lepMqp7zZVAdhpGh0eRd6XMK1gYDb+MKKaxBjo8qvNM88sI0O1Gr6TUuisWRrTdlotpteePM6z7cAo8lAeCzUh3tw4OTlNb9WPIxarpoELayUqHinjUtNFFw8IPDPkg== X-Forefront-PRVS: 0870212862 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2PR03MB305; 23:VlyesIl1PkR6Ocksb2jZ8MWmDbcu3IkG/RzDhNkLhy?= =?us-ascii?Q?X+4E1OgICBNZa445eN726HIcbNd1AV1kMQDnqEWzQJH7sj3iTvMBe1LP2Kze?= =?us-ascii?Q?HT3UzSrQ+QVhHL7wr5Vy3vj61EEOhiLFsBbjoZfv0CM++1DsOVy/zfwanMI2?= =?us-ascii?Q?KvrRdJ0hqzyf835mTo/Gkspp4danrcS+Y/Dp8gSCKz72r7n1fr343IsPyo5+?= =?us-ascii?Q?UCLRjfIV0wHT0O9oSJMRRSUpeKUjoIYEO7tblXWTMuCvoFUFnxzxeOy2Pg+S?= =?us-ascii?Q?6wIKzV/m8veSTMFz+JluQUis5vUWVRxwFnJbeQnyxSL0LtFghshtx0Sv43mQ?= =?us-ascii?Q?FIsQI91lPTFgou++hN4Veh7OTmWN5AS37Ikvv9TvOjAAvIsQMKIaqqAGIgCc?= =?us-ascii?Q?KUm5pHw8oFlY3rJgE6k0f5zcDXnfyHCNuuuXm6esstbCFldtziuC1EnlXyax?= =?us-ascii?Q?aC+Fwd2W9tku2H7it+q0K9HE2W/rjsL+BHmMQMEplbpiDuS/DSlgYHTbMQf0?= =?us-ascii?Q?pAYdYNgd73torc6JKTe/mC4nJZp6i/DolFXKN+2XP6QolPWAc6jLL+Caxxp1?= =?us-ascii?Q?LJaIBrHzkxTcGXf2irTtLBM7BgAYKR8ARNojIPFxPfRf4yGZG/7E7se0Ghuy?= =?us-ascii?Q?UYrUb89EdCKnlOGeFPwBJ3m5TwvXix00vJps8m8bKSLNpid9ScaEslQN1bX7?= =?us-ascii?Q?kxk3q7YD/7Y/1XA8OibGtoCl8M2T4YTGl3pyFse3w8+qzmKHHfGdGywmLaZj?= =?us-ascii?Q?wRvn6vT3UYPnC1kdH8FUXa7kaQCe1oNtDHFGzcETN5Ytolxm/Dkzqau/Bl0c?= =?us-ascii?Q?EurAJmvSak9WpV783jFrQYdNrONCn53A5buqPPp6Jhql8oKmj2BD9u8xfPrG?= =?us-ascii?Q?LFeEvvh6KZgByw1C96uG7umlab1F64qg8MKlGHZ7Q6QtXdOlCf1JWj0sHJsr?= =?us-ascii?Q?GlMKaTLOjKb11HUGLi+/X7bUkbJqFpy539UrDl/jLzIwYDmLzIX7WI+rUr5g?= =?us-ascii?Q?1yP4ss0hhGrXQtWH64AAI6bc1ulJuBIGzI2/OWYybn2yQVelkJS1IjOP6E8P?= =?us-ascii?Q?f/1wfHm7oBYrsYa5fDjjWI7HNsABFxil3h4OpWll6S54uiSkLsrcnfn7fjFJ?= =?us-ascii?Q?g2sTkDjf+FvAxwmDC2FNs9FZ4gyrYa?= X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB305; 5:HDRHKEp1YyN/eusCkm0UpkQ93WiLqxJqOJNGlcjiQCwmt568HgZrqNVtxBSHEsYdwiT43PiIB1bBlOsYBJikJryMxUWqnrZi6CUVdX9e9gAAePyPkX43nVk02WfZnHIpNwk1VizIyY6lSrZ/baTNqyQ1Fj+yeOoOFY5OjmFNcFk=; 24:cR4SsSaUvK2vZNMBGIfTM+GX/FAZT+8aAWzToB6cJZUkfIdpYlO1z5L9tObIUeVWlitepKpNxX9Sj6hYANzIZ2YHd2uP6rMltHOjLU5wKP4= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2016 10:06:16.8672 (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: BL2PR03MB305 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160303_020639_637276_282185C4 X-CRM114-Status: GOOD ( 13.30 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, mail@maciej.szmigiero.name, arnd@arndb.de, pawel.moll@arm.com, s.hauer@pengutronix.de, linux-usb@vger.kernel.org, troy.kisky@boundarydevices.com, robh+dt@kernel.org, Peter Chen , p.zabel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Chen Since the hcd (chipidea core device) has no device node, so if we want to describe the child node under the hcd, we had to put it under its parent's node (glue layer device), and in the code, we need to let the hcd knows glue layer's code, then the USB core can handle this node. Signed-off-by: Peter Chen --- drivers/usb/chipidea/host.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index 053bac9..55120ef 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c @@ -109,15 +109,25 @@ static int host_start(struct ci_hdrc *ci) struct ehci_hcd *ehci; struct ehci_ci_priv *priv; int ret; + struct device *dev = ci->dev; - if (usb_disabled()) + if (usb_disabled() || !dev) return -ENODEV; - hcd = usb_create_hcd(&ci_ehci_hc_driver, ci->dev, dev_name(ci->dev)); + /* + * USB Core will try to get child node under roothub, + * but chipidea core has no of_node, and the child node + * for controller is located at glue layer's node which + * is chipidea core's parent. + */ + if (dev->parent && dev->parent->of_node) + dev->of_node = dev->parent->of_node; + + hcd = usb_create_hcd(&ci_ehci_hc_driver, dev, dev_name(dev)); if (!hcd) return -ENOMEM; - dev_set_drvdata(ci->dev, ci); + dev_set_drvdata(dev, ci); hcd->rsrc_start = ci->hw_bank.phys; hcd->rsrc_len = ci->hw_bank.size; hcd->regs = ci->hw_bank.abs; @@ -143,7 +153,7 @@ static int host_start(struct ci_hdrc *ci) if (ci->platdata->flags & CI_HDRC_TURN_VBUS_EARLY_ON) { ret = regulator_enable(ci->platdata->reg_vbus); if (ret) { - dev_err(ci->dev, + dev_err(dev, "Failed to enable vbus regulator, ret=%d\n", ret); goto put_hcd;