From patchwork Tue May 11 22:52:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 434347 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAF29C43462 for ; Tue, 11 May 2021 22:52:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A79C61931 for ; Tue, 11 May 2021 22:52:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230026AbhEKWxh (ORCPT ); Tue, 11 May 2021 18:53:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230129AbhEKWxg (ORCPT ); Tue, 11 May 2021 18:53:36 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6AFCC061574 for ; Tue, 11 May 2021 15:52:29 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id i5so12057260pgm.0 for ; Tue, 11 May 2021 15:52:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nPfjNGu0bWmZPxek0tP9ZZksfu5jEL2EIBrcRX1glfg=; b=jI7LM9aVM57XPnXPuJRJkxCqBEh6mrB7droxTox8SAa5ztFsAOv+AVq6skwDMupyfP otqJAg85fAbfowID2PIA+rZ9cccY1SPm2Ce+nBoiqk4Kje74zAqoLIpCN+u4SXJjxY4/ kc6sEXFmF8M9/OF7sxXjvUcv00CRNH/qUQ3Jg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nPfjNGu0bWmZPxek0tP9ZZksfu5jEL2EIBrcRX1glfg=; b=JfC/635FVafFjOkU4e7rsKakrGzPHCubutJnRQzfAhijnMDguoSnMrHIF4FTzPBm9f /7XZvk2f4ovmEeXH2BF1cwO+mJSl1MIfM5Y0whCSbzAqkRFa+FgOU3nLmetMRQRHjyEo Rg+UUEwUD8ztIAQK6irec/5lF6Ey4nzDYaJbj2t07fn8u21G5YYUJi2gBFfqr6I01CfT Q2TBtSuLSu4+0oQwvWJxb57RgYd9mrLg4iJvf5+BgW92yucgcRnvMBMoliXA/+2vO3wR cNWQuzJGWDyX/HhWC5Xqu1MTpVjz5v+MvL4QxXh59XuyjGSgUIafWzznijLmWTmQbLR7 StYQ== X-Gm-Message-State: AOAM531CGdDsBk4zyOzQsanwUDS/jURbo6zFi2gfFcOqT/r/X82LjG0q HvS4ciELi+3O0n4B+YZb6eshyA== X-Google-Smtp-Source: ABdhPJy4yWZ/DcWMdmWwZpF8qxLQuvC1hUn0XzngT8Xx4R8juzOn0k4q8IijTPovE+rhsFXv+j+DFA== X-Received: by 2002:a05:6a00:1ac6:b029:2ae:bde3:621c with SMTP id f6-20020a056a001ac6b02902aebde3621cmr22097698pfv.80.1620773549330; Tue, 11 May 2021 15:52:29 -0700 (PDT) Received: from localhost ([2620:15c:202:201:f1d7:673a:456e:c653]) by smtp.gmail.com with UTF8SMTPSA id c24sm14198088pfi.32.2021.05.11.15.52.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 May 2021 15:52:29 -0700 (PDT) From: Matthias Kaehlcke To: Greg Kroah-Hartman , Alan Stern , Rob Herring , Frank Rowand Cc: Michal Simek , devicetree@vger.kernel.org, Douglas Anderson , linux-usb@vger.kernel.org, Peter Chen , linux-kernel@vger.kernel.org, Stephen Boyd , Ravi Chandra Sadineni , Krzysztof Kozlowski , Bastien Nocera , Matthias Kaehlcke , Rob Herring Subject: [PATCH v10 1/5] dt-bindings: usb: Add binding for Realtek RTS5411 hub controller Date: Tue, 11 May 2021 15:52:19 -0700 Message-Id: <20210511155152.v10.1.I248292623d3d0f6a4f0c5bc58478ca3c0062b49a@changeid> X-Mailer: git-send-email 2.31.1.607.g51e8a6a459-goog In-Reply-To: <20210511225223.550762-1-mka@chromium.org> References: <20210511225223.550762-1-mka@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The Realtek RTS5411 is a USB 3.0 hub controller with 4 ports. This initial version of the binding only describes USB related aspects of the RTS5411, it does not cover the option of connecting the controller as an i2c slave. Signed-off-by: Matthias Kaehlcke Reviewed-by: Rob Herring --- Changes in v10: - none Changes in v9: - added Rob's 'Reviewed-by' tag Changes in v8: - added entry for 'reg' - marked 'companion-hub' as required - changed node name of USB controller to 'usb' Changes in v7: - added type ref for 'companion-hub' property Changes in v6: - Realtek binding instead of generic onboard_usb_hub - added 'companion-hub' property - added reference to 'usb-device.yaml' - 'fixed' indentation of compatible entries to keep yamllint happy - added 'additionalProperties' entry - updated commit message Changes in v5: - updated 'title' - only use standard USB compatible strings - deleted 'usb_hub' node - renamed 'usb_controller' node to 'usb-controller' - removed labels from USB nodes - added 'vdd-supply' to USB nodes Changes in v4: - none Changes in v3: - updated commit message - removed recursive reference to $self - adjusted 'compatible' definition to support multiple entries - changed USB controller phandle to be a node Changes in v2: - removed 'wakeup-source' and 'power-off-in-suspend' properties - consistently use spaces for indentation in example .../bindings/usb/realtek,rts5411.yaml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/realtek,rts5411.yaml diff --git a/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml b/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml new file mode 100644 index 000000000000..04ee255eb4f0 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/realtek,rts5411.yaml @@ -0,0 +1,62 @@ +# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/realtek,rts5411.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Binding for the Realtek RTS5411 USB 3.0 hub controller + +maintainers: + - Matthias Kaehlcke + +allOf: + - $ref: usb-device.yaml# + +properties: + compatible: + items: + - enum: + - usbbda,5411 + - usbbda,411 + + reg: true + + vdd-supply: + description: + phandle to the regulator that provides power to the hub. + + companion-hub: + $ref: '/schemas/types.yaml#/definitions/phandle' + description: + phandle to the companion hub on the controller. + +required: + - companion-hub + - compatible + - reg + +additionalProperties: false + +examples: + - | + usb { + dr_mode = "host"; + #address-cells = <1>; + #size-cells = <0>; + + /* 2.0 hub on port 1 */ + hub_2_0: hub@1 { + compatible = "usbbda,5411"; + reg = <1>; + vdd-supply = <&pp3300_hub>; + companion-hub = <&hub_3_0>; + }; + + /* 3.0 hub on port 2 */ + hub_3_0: hub@2 { + compatible = "usbbda,411"; + reg = <2>; + vdd-supply = <&pp3300_hub>; + companion-hub = <&hub_2_0>; + }; + }; From patchwork Tue May 11 22:52:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 434345 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7AC2C43461 for ; Tue, 11 May 2021 22:52:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C31861432 for ; Tue, 11 May 2021 22:52:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230184AbhEKWxw (ORCPT ); Tue, 11 May 2021 18:53:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbhEKWxp (ORCPT ); Tue, 11 May 2021 18:53:45 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28DD5C06138B for ; Tue, 11 May 2021 15:52:34 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id j12so10741451pgh.7 for ; Tue, 11 May 2021 15:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8aKnVtIxlUG/2eUQmNl0qPhaQg9l3TplAhr5B7EOd6U=; b=LvzERiaiALvJFXjzftXoHUCyKmzQ4UBbwHeONAJXlRmCEFlO7I1pPQBoo51KsymSOC izVUQGDqJF43p1PMQqu3RTbUEknJP2LEoPusHVkm35IFDHE1EcXzm+DDGZ9PnIg4GVln ZePnFPrFMA0JsA1+JnW4vWXx0HQ5ISkwnuUXg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8aKnVtIxlUG/2eUQmNl0qPhaQg9l3TplAhr5B7EOd6U=; b=q0iDKXHJLlaESKBL+qUI7p9/x+DAPrPTD3RN4EFux5vqR543b/hB5iOYYpGi00ADeG cnQYo2h5p94FremrUd/e2V0KR/PnPjQY6C9aZvyKJZkasd0hrl/etkjDuMbJzSn429Uq mJTNJizitz2zDBD9+F5O/ECXidyZThns3IUz+44F2ceIF2U+f+5tA8bDm2J/iNrgy68D bpi5bklPhkGSbeviHDnc2bQ38ODdx3BaS+GAwctrqq0VHpzgggtb20k+joBR0LKyrWpB szgY4BqNzC3nBqUECpOjiwFX0FD6tuqIzYwq729uBZLdKLRBLlJUhn5CZ3Rd8CrsgEgj JAgQ== X-Gm-Message-State: AOAM533h4Blf7c8LLEvyfl9xfPMhhqHSY1yMMYlCgx4UQ3jzCAT5q1Iq p28acXQ1F4t6M++IJTDMlY9QTA== X-Google-Smtp-Source: ABdhPJzcc0HOveQxurQucFIXSEwc1uBL9OYa3E78PzbfuEgM9Oc9XcjLr/Ej3fQt4k23AWDj8Izisg== X-Received: by 2002:a63:540b:: with SMTP id i11mr33172485pgb.44.1620773553616; Tue, 11 May 2021 15:52:33 -0700 (PDT) Received: from localhost ([2620:15c:202:201:f1d7:673a:456e:c653]) by smtp.gmail.com with UTF8SMTPSA id x22sm14230968pfa.24.2021.05.11.15.52.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 May 2021 15:52:33 -0700 (PDT) From: Matthias Kaehlcke To: Greg Kroah-Hartman , Alan Stern , Rob Herring , Frank Rowand Cc: Michal Simek , devicetree@vger.kernel.org, Douglas Anderson , linux-usb@vger.kernel.org, Peter Chen , linux-kernel@vger.kernel.org, Stephen Boyd , Ravi Chandra Sadineni , Krzysztof Kozlowski , Bastien Nocera , Matthias Kaehlcke , Rob Herring Subject: [PATCH v10 3/5] of/platform: Add stubs for of_platform_device_create/destroy() Date: Tue, 11 May 2021 15:52:21 -0700 Message-Id: <20210511155152.v10.3.I08fd2e1c775af04f663730e9fb4d00e6bbb38541@changeid> X-Mailer: git-send-email 2.31.1.607.g51e8a6a459-goog In-Reply-To: <20210511225223.550762-1-mka@chromium.org> References: <20210511225223.550762-1-mka@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Code for platform_device_create() and of_platform_device_destroy() is only generated if CONFIG_OF_ADDRESS=y. Add stubs to avoid unresolved symbols when CONFIG_OF_ADDRESS is not set. Signed-off-by: Matthias Kaehlcke Acked-by: Rob Herring --- Changes in v10: - none Changes in v9: - added Rob's 'Acked-by' tag Changes in v8: - fixed C&P error in commit message Changes in v7: - none Changes in v6: - patch added to the series include/linux/of_platform.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index 84a966623e78..d15b6cd5e1c3 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h @@ -61,16 +61,18 @@ static inline struct platform_device *of_find_device_by_node(struct device_node } #endif +extern int of_platform_bus_probe(struct device_node *root, + const struct of_device_id *matches, + struct device *parent); + +#ifdef CONFIG_OF_ADDRESS /* Platform devices and busses creation */ extern struct platform_device *of_platform_device_create(struct device_node *np, const char *bus_id, struct device *parent); extern int of_platform_device_destroy(struct device *dev, void *data); -extern int of_platform_bus_probe(struct device_node *root, - const struct of_device_id *matches, - struct device *parent); -#ifdef CONFIG_OF_ADDRESS + extern int of_platform_populate(struct device_node *root, const struct of_device_id *matches, const struct of_dev_auxdata *lookup, @@ -84,6 +86,18 @@ extern int devm_of_platform_populate(struct device *dev); extern void devm_of_platform_depopulate(struct device *dev); #else +/* Platform devices and busses creation */ +static inline struct platform_device *of_platform_device_create(struct device_node *np, + const char *bus_id, + struct device *parent) +{ + return NULL; +} +static inline int of_platform_device_destroy(struct device *dev, void *data) +{ + return -ENODEV; +} + static inline int of_platform_populate(struct device_node *root, const struct of_device_id *matches, const struct of_dev_auxdata *lookup, From patchwork Tue May 11 22:52:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 434346 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0038CC433ED for ; Tue, 11 May 2021 22:52:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D38066191D for ; Tue, 11 May 2021 22:52:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229980AbhEKWxv (ORCPT ); Tue, 11 May 2021 18:53:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbhEKWxn (ORCPT ); Tue, 11 May 2021 18:53:43 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85476C06174A for ; Tue, 11 May 2021 15:52:36 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id i5so12057419pgm.0 for ; Tue, 11 May 2021 15:52:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gRQceREUuiCBW1dDPT9pW8DTooXv4gDopBNig6+8fl4=; b=OW/P9sC+CSrENSE0CY93ntk7hv9X6EHj0SeYCSCRFvGnpoEkq8Sew+c+2aaen4Y4K4 kw5ZEA8bZQEfaC22bL9WCkpgBJCw7Oh2I2KMxHBBl09OiE0h3IHk0PpfLa2rRiyKnako YjWRH4n3oKTAQQHr4q8V0LQ2eu/E14u86KaOQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gRQceREUuiCBW1dDPT9pW8DTooXv4gDopBNig6+8fl4=; b=HKzz9No1r7QeEXieEBX0mPcDWFdxDbhoUO1cDnpbOxONmJH+cYdMKoi+l20lnvxWyb pDzpg5icKSTB4aB/fSZpVNYJiAuXJAL51aoi7j4DrewNgzYtO3aIEULsbf78C9FuF7Hf TcYJ106OKl7DozEuMsfzsjlnxvM12Up3xIiUmEhpucdbkE7nskB73N1pg/cWBwTJmzMh w7WjMOSxNM8Ztkz+6/SQprVBcYhlE1vGi7bF1bDYmHCOxSG557RjZ0EZCi1Yb6xACD30 SMkgZMergF/0s9qb/qJSHlMRQtfIdMm1SbZ+cmhhyHZdELCkct9QKsgabe9AE003Fkyd 0z/w== X-Gm-Message-State: AOAM5300pSunraG6dh+2WJQh1o++DCpJ3HMCTEwKDT32ns/spGN0SaXM 5kwkosE/pyOD/TGpxoovGFGQ8Q== X-Google-Smtp-Source: ABdhPJxC4sUDqeEqFhnkGv/ppoRkR1ADL9dIeJz19eEymRt580OLgyluH6yVAteZp+18x70blvmgsw== X-Received: by 2002:aa7:808d:0:b029:2bf:bf00:c6f6 with SMTP id v13-20020aa7808d0000b02902bfbf00c6f6mr12699793pff.64.1620773556081; Tue, 11 May 2021 15:52:36 -0700 (PDT) Received: from localhost ([2620:15c:202:201:f1d7:673a:456e:c653]) by smtp.gmail.com with UTF8SMTPSA id h15sm14441528pfk.26.2021.05.11.15.52.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 May 2021 15:52:35 -0700 (PDT) From: Matthias Kaehlcke To: Greg Kroah-Hartman , Alan Stern , Rob Herring , Frank Rowand Cc: Michal Simek , devicetree@vger.kernel.org, Douglas Anderson , linux-usb@vger.kernel.org, Peter Chen , linux-kernel@vger.kernel.org, Stephen Boyd , Ravi Chandra Sadineni , Krzysztof Kozlowski , Bastien Nocera , Matthias Kaehlcke , Al Cooper , Bjorn Andersson , Christian Lamparter , Colin Ian King , Dmitry Osipenko , Fabio Estevam , Masahiro Yamada , Mathias Nyman , Vinod Koul Subject: [PATCH v10 4/5] usb: host: xhci-plat: Create platform device for onboard hubs in probe() Date: Tue, 11 May 2021 15:52:22 -0700 Message-Id: <20210511155152.v10.4.I7a3a7d9d2126c34079b1cab87aa0b2ec3030f9b7@changeid> X-Mailer: git-send-email 2.31.1.607.g51e8a6a459-goog In-Reply-To: <20210511225223.550762-1-mka@chromium.org> References: <20210511225223.550762-1-mka@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Check during probe() if a hub supported by the onboard_usb_hub driver is connected to the controller. If such a hub is found create the corresponding platform device. This requires the device tree to have a node for the hub with its vendor and product id (which is not common for USB devices). Further the platform device is only created when CONFIG_USB_ONBOARD_HUB=y/m. Signed-off-by: Matthias Kaehlcke --- Changes in v10: - none Changes in v9: - added dependency on USB_ONBOARD_HUB (or !!USB_ONBOARD_HUB) to USB_XHCI_PLATFORM Changes in v8: - none Changes in v7: - none Changes in v6: - none Changes in v5: - patch added to the series drivers/usb/host/Kconfig | 1 + drivers/usb/host/xhci-plat.c | 16 ++++++++++++++++ include/linux/usb/hcd.h | 2 ++ 3 files changed, 19 insertions(+) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index b94f2a070c05..da50496787fe 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -54,6 +54,7 @@ config USB_XHCI_PCI_RENESAS config USB_XHCI_PLATFORM tristate "Generic xHCI driver for a platform device" select USB_XHCI_RCAR if ARCH_RENESAS + depends on USB_ONBOARD_HUB || !USB_ONBOARD_HUB help Adds an xHCI host driver for a generic platform device, which provides a memory space and an irq. diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index c1edcc9b13ce..9c0fb7e8df1f 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -195,6 +196,7 @@ static int xhci_plat_probe(struct platform_device *pdev) int ret; int irq; struct xhci_plat_priv *priv = NULL; + struct device_node *np; if (usb_disabled()) @@ -374,6 +376,17 @@ static int xhci_plat_probe(struct platform_device *pdev) */ pm_runtime_forbid(&pdev->dev); + np = usb_of_get_device_node(hcd->self.root_hub, hcd->self.busnum); + if (np && of_is_onboard_usb_hub(np)) { + struct platform_device *pdev; + + pdev = of_platform_device_create(np, NULL, NULL); + if (pdev) + hcd->onboard_hub_dev = &pdev->dev; + else + xhci_warn(xhci, "failed to create onboard hub platform device\n"); + } + return 0; @@ -420,6 +433,9 @@ static int xhci_plat_remove(struct platform_device *dev) usb_remove_hcd(hcd); usb_put_hcd(shared_hcd); + if (hcd->onboard_hub_dev) + of_platform_device_destroy(hcd->onboard_hub_dev, NULL); + clk_disable_unprepare(clk); clk_disable_unprepare(reg_clk); usb_put_hcd(hcd); diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 96281cd50ff6..d02a508e19b0 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -225,6 +225,8 @@ struct usb_hcd { * (ohci 32, uhci 1024, ehci 256/512/1024). */ + struct device *onboard_hub_dev; + /* The HC driver's private data is stored at the end of * this structure. */