From patchwork Fri Mar 4 06:23:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jung Daehwan X-Patchwork-Id: 12768514 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41FB8C433EF for ; Fri, 4 Mar 2022 06:30:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238379AbiCDGa4 (ORCPT ); Fri, 4 Mar 2022 01:30:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232071AbiCDGa4 (ORCPT ); Fri, 4 Mar 2022 01:30:56 -0500 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C81B187BBA for ; Thu, 3 Mar 2022 22:30:07 -0800 (PST) Received: from epcas3p2.samsung.com (unknown [182.195.41.20]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20220304063004epoutp04598ca3a7aead66d0cad8ceaf7d2ba6fd~ZGbUn4GXE2215322153epoutp04k for ; Fri, 4 Mar 2022 06:30:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20220304063004epoutp04598ca3a7aead66d0cad8ceaf7d2ba6fd~ZGbUn4GXE2215322153epoutp04k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1646375404; bh=t16gVV9oSQaljRySboqrBl6RazZm32K+h93uwF0rvx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mf3z2CPaiPXMsWBLD7qMf3+68ws13l0ZiUCupiICqOt11Li4vt/OLPvmUyWxpK+Ol HZlCxhBGXJNEPM8KXLqpbNqXn+udDkMfMqetbAHYnTr0KmEoVEnYwfuBl8+hHC4DcX 2Lrp0T5KQd7MAnMHYUFS4knl2Xp1IPE1F73l1q1k= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas3p1.samsung.com (KnoxPortal) with ESMTP id 20220304063003epcas3p18edac2709d3bb605e50bf2413a757682~ZGbUCCo1x2721227212epcas3p1n; Fri, 4 Mar 2022 06:30:03 +0000 (GMT) Received: from epcpadp3 (unknown [182.195.40.17]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4K8ydR6q2Lz4x9Px; Fri, 4 Mar 2022 06:30:03 +0000 (GMT) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20220304062617epcas2p1ccc051a6d931d4151a7c9e2bb545bd47~ZGYBjXU7N1392713927epcas2p1X; Fri, 4 Mar 2022 06:26:17 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220304062617epsmtrp1b45eca2a481a613393a8970de57fb3e7~ZGYBiaugu1455714557epsmtrp1L; Fri, 4 Mar 2022 06:26:17 +0000 (GMT) X-AuditID: b6c32a29-41fff700000074af-4b-6221b1096024 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 9F.B3.29871.901B1226; Fri, 4 Mar 2022 15:26:17 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [12.36.155.120]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220304062617epsmtip2941d034ecd4dd9128568de9efdb0fc17~ZGYBXMRaE1747117471epsmtip2y; Fri, 4 Mar 2022 06:26:17 +0000 (GMT) From: Daehwan Jung To: Mathias Nyman , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org (open list:USB XHCI DRIVER), linux-kernel@vger.kernel.org (open list), Howard Yen , Jack Pham , Puma Hsu , "J . Avila" , "chihhao . chen" , Daehwan Jung , sc.suh@samsung.com, cpgs@samsung.com, cpgsproxy5@samsung.com Subject: [PATCH v1 3/4] usb: host: add some to xhci overrides for USB offload Date: Fri, 4 Mar 2022 15:23:57 +0900 Message-Id: <252651381.41646375403959.JavaMail.epsvc@epcpadp3> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1646375038-72082-1-git-send-email-dh10.jung@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNLMWRmVeSWpSXmKPExsWy7bCSvC7nRsUkg+kfzSxWHJ7HaPHykKbF 5odX2CzuLJjGZPHkyCJ2i+bF69ksrv95z2jR/vwCm8XlXXPYLBYta2W2aN40hdVi5lpli667 NxgdeD0u9/UyeSzYVOqxeM9LJo/9c9ewe7Sc3M/i0bdlFaPH501yAexRXDYpqTmZZalF+nYJ XBkvFjxiLbgrWHHi/GfWBsb/fF2MnBwSAiYS6+fOYO1i5OIQEtjNKHFl2RYmiISkxNK5N9gh bGGJ+y1HoIq+MUo0b7nB3MXIwcEmoCXxfSEjSI2IQJzEist7WEBqmAX6mSU2NN9iBakRFvCV OHVYBaSGRUBV4vSU18wgNq+Aq8TGzt/MEPPlJG6e6wSzOQXcJLbcP8IGYgsB1TxofcQ4gZFv ASPDKkbJ1ILi3PTcYsMCw7zUcr3ixNzi0rx0veT83E2M4PDV0tzBuH3VB71DjEwcjIcYJTiY lUR4LTUVkoR4UxIrq1KL8uOLSnNSiw8xSnOwKInzXug6GS8kkJ5YkpqdmlqQWgSTZeLglGpg ypWVjb82wcFXUeeu9B6Fm22lLxWif9fx7EipYXYuWL954WZ7nzcKk5rbGu7GiC5Jt/1de+BL TeEhub1FO9IT5wmza7yW01r79FfNdt25b5/nNKUlv4iZ84jVqc389kPr6/sC7679/DNcI33V /cKF2ypfFMcfDc6VeGj9yL3b9s6Vr5xFUb+3Zm+VC/HQ8V0Utkm5cfsSe6O2dYvVORe6Waub XbycNXsad3jJmeNzbmm4XnGyvHdk87GLf//6Rfecn9B+pidRroyT5TmDVBr79QV1not7tOo3 7Tm+39L/oOZVcS+Fr0+kv+2rsfzk/nNHj5iEpd63/5/LNuyfttc21T5Vxtt+AtsDZc4spgdt SizFGYmGWsxFxYkAboDB+84CAAA= X-CMS-MailID: 20220304062617epcas2p1ccc051a6d931d4151a7c9e2bb545bd47 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL X-CPGSPASS: Y X-Hop-Count: 3 MIME-Version: 1.0 X-CMS-RootMailID: 20220304062617epcas2p1ccc051a6d931d4151a7c9e2bb545bd47 References: <1646375038-72082-1-git-send-email-dh10.jung@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Co-processor needs some information about connected usb device. It's proper to pass information after usb device gets address when getting "Set Address" command. It supports vendors to implement it using xhci overrides. There're several power scenarios depending on vendors. It gives vendors flexibilty to meet their power requirement. They can override suspend and resume of root hub. Signed-off-by: Daehwan Jung --- drivers/usb/host/xhci.c | 6 ++++++ drivers/usb/host/xhci.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 10d5e20b710d..7789bf277c8e 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -5557,6 +5557,12 @@ void xhci_init_driver(struct hc_driver *drv, drv->check_bandwidth = over->check_bandwidth; if (over->reset_bandwidth) drv->reset_bandwidth = over->reset_bandwidth; + if (over->address_device) + drv->address_device = over->address_device; + if (over->bus_suspend) + drv->bus_suspend = over->bus_suspend; + if (over->bus_resume) + drv->bus_resume = over->bus_resume; } } EXPORT_SYMBOL_GPL(xhci_init_driver); diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 2efe8ddaab5f..2c7d0e403424 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1944,6 +1944,9 @@ struct xhci_driver_overrides { struct usb_host_endpoint *ep); int (*check_bandwidth)(struct usb_hcd *, struct usb_device *); void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *); + int (*address_device)(struct usb_hcd *hcd, struct usb_device *udev); + int (*bus_suspend)(struct usb_hcd *hcd); + int (*bus_resume)(struct usb_hcd *hcd); }; #define XHCI_CFC_DELAY 10 @@ -2100,6 +2103,7 @@ int xhci_drop_endpoint(struct usb_hcd *hcd, struct usb_device *udev, struct usb_host_endpoint *ep); int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev); void xhci_reset_bandwidth(struct usb_hcd *hcd, struct usb_device *udev); +int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev); int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id); int xhci_ext_cap_init(struct xhci_hcd *xhci);