From patchwork Tue Dec 11 02:08:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 10722973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 55EFB1751 for ; Tue, 11 Dec 2018 02:09:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 461FB29FC2 for ; Tue, 11 Dec 2018 02:09:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A26F2A0A6; Tue, 11 Dec 2018 02:09:00 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 BFC1729FC2 for ; Tue, 11 Dec 2018 02:08:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729487AbeLKCI6 (ORCPT ); Mon, 10 Dec 2018 21:08:58 -0500 Received: from mail-eopbgr00088.outbound.protection.outlook.com ([40.107.0.88]:11072 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729474AbeLKCI6 (ORCPT ); Mon, 10 Dec 2018 21:08:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CuXhReK6X8uKCQpHOWfuUNle6LtrvH0HTdJm3AljDoc=; b=evaNik/jfLsDrebsxqmtDeytSq+uOjdZR9m8+/R+uBvP7ZZ37C2N89sXSdfEvSqZRoEqKU44qbfzLf9uYPLVpgAri+i6eTW/DXoIGNTkHCgYgLRZA1OcR9LK7McY51DgChIUeP1snRfZCsmWxcbg3EueEQ/7kvx4We+n6dxc5Xw= Received: from AM0PR04MB5314.eurprd04.prod.outlook.com (20.177.42.87) by AM0PR04MB5986.eurprd04.prod.outlook.com (20.178.114.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.17; Tue, 11 Dec 2018 02:08:54 +0000 Received: from AM0PR04MB5314.eurprd04.prod.outlook.com ([fe80::7456:34a:3cbc:a78a]) by AM0PR04MB5314.eurprd04.prod.outlook.com ([fe80::7456:34a:3cbc:a78a%4]) with mapi id 15.20.1404.026; Tue, 11 Dec 2018 02:08:54 +0000 From: Peter Chen To: "linux-usb@vger.kernel.org" CC: dl-linux-imx , "robh+dt@kernel.org" , "devicetree@vger.kernel.org" , "frieder.schrempf@exceet.de" , "festevam@gmail.com" , Peter Chen Subject: [PATCH v5 1/4] usb: chipidea: add flag for imx hsic implementation Thread-Topic: [PATCH v5 1/4] usb: chipidea: add flag for imx hsic implementation Thread-Index: AQHUkPZ3GuejTF2QbkaTL+pOVv2q9g== Date: Tue, 11 Dec 2018 02:08:54 +0000 Message-ID: <20181211020624.9433-2-peter.chen@nxp.com> References: <20181211020624.9433-1-peter.chen@nxp.com> In-Reply-To: <20181211020624.9433-1-peter.chen@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.14.1 x-clientproxiedby: HK0PR03CA0085.apcprd03.prod.outlook.com (2603:1096:203:72::25) To AM0PR04MB5314.eurprd04.prod.outlook.com (2603:10a6:208:d0::23) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peter.chen@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AM0PR04MB5986;6:oupOrC0P5tg0zghAnm1I/0A06I5mbxPoTQNB62GQnIEFC2URwpdDrIlARbZu7BdDuYeRBGhne0YglqCLAIyarRUIUomP82+4BXXGrti81VIiXA7BaDdvgYkPEzGFsg4Wbn8mdbSbXVmnoNN1i/pu0ThVM6mWydYAMtXLYT1MMiU6PPJX7FfD6uz1BtyO2nWMU/uIueape0XmR/QXAdmrOktb6nw6Dlnc+7txUgxk18/0lJ7fQ95Uafbf2BQ1kihTAMFZVh5IDKx4au/Ob71mo/1P76nez86ownp81+BjR5wKefVl8W5PdtsGO+WBA5bP4tccui/aYWjUvItPZtvd9O3TIguVs338JcyJTsBPG0twuy5E6xgtBbxlAUQVoy9xJpYWcv+0pyoZljFTda0by+rXJcYYFwQ5CBD7bsc6u3I/ZKvwDoRRbXNszjyw5c0dCb2tQzKcYXqoFNOTXxlqkg==;5:/gulDyyCunBG2/D+g1s68bNx+IA8OrZjotv15ldFzTLnPni3cDVrRqQUoWHqCT/4mXzy+b8+014jbP/X7qK4nrKzUOYNrdZouixALqaUgb+lRUJyGaGzSfYVw8LOn/3UD+QrKgoAjCwgOdy0w16u29+86qs5sxIMmQiJ8Q9r6PM=;7:y84RsPMZNpvtaiQVRWay8K/lOeL6TbwYjeGHYBzFZBnmaMmNwcZCwaE1OQfPu1j3Gczj7MDK+e81xOK6ArueL3KFT/c4XVNLvLn/BxPDVUoKAujfnXnf5kl4UQGG+gIRWn+0VgkTCbVdIPXzrlJ3BA== x-ms-office365-filtering-correlation-id: 17218ad2-f4d0-42bf-62fc-08d65f0d9a23 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM0PR04MB5986; x-ms-traffictypediagnostic: AM0PR04MB5986: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(3230017)(999002)(6040522)(2401047)(8121501046)(5005006)(3231472)(944501520)(52105112)(3002001)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:AM0PR04MB5986;BCL:0;PCL:0;RULEID:;SRVR:AM0PR04MB5986; x-forefront-prvs: 08831F51DC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(346002)(376002)(136003)(396003)(39860400002)(189003)(199004)(99286004)(6512007)(4326008)(305945005)(36756003)(39060400002)(5660300001)(53936002)(81156014)(7736002)(81166006)(8676002)(14454004)(3846002)(8936002)(2906002)(6116002)(50226002)(105586002)(106356001)(2351001)(66066001)(1076002)(97736004)(25786009)(54906003)(68736007)(316002)(478600001)(76176011)(6436002)(52116002)(2616005)(26005)(476003)(86362001)(446003)(6916009)(386003)(6486002)(186003)(102836004)(11346002)(256004)(6506007)(44832011)(14444005)(2501003)(71200400001)(5640700003)(486006)(71190400001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB5986;H:AM0PR04MB5314.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: z5J1YSzdKNN1/Z0SQfGyYuEKAlEbjBuIrKZ7tI74ZYzNH2jTzMfg2IsFOnWMoiq5yLjvNYhr3f5UDKpVwMqeVX5DFK1yT8npWIJiooIbomdQKwUacUQc9Mi5KAf/A7cLQGc1EIovHU5vnYR0ubyk4oXbYj8goRS7Lp94xqvcPhol8xUAjUINZfClRCnPuWaC0RyUfzeZBY+7YCJ5LzUgEdOc7h1z2sIF6YDUIQbZ4i6MQpegvWMVQzqavwOg026jNdvsu01rd4Ppf42sKCjY343GeHibm7UMRWK+Ia9SMnnqDNQm9Sme20vS1hCilv86 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17218ad2-f4d0-42bf-62fc-08d65f0d9a23 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Dec 2018 02:08:54.7159 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5986 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP NXP (Freecale) imx HSIC design has some special requirements, add some flags at host code to handle them. Reviewed-by: Frieder Schrempf Tested-by: Frieder Schrempf Signed-off-by: Peter Chen --- drivers/usb/chipidea/host.c | 17 +++++++++++++++++ include/linux/usb/chipidea.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index d858a82c4f44..028a3574266a 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c @@ -170,6 +170,11 @@ static int host_start(struct ci_hdrc *ci) otg->host = &hcd->self; hcd->self.otg_port = 1; } + + if (ci->platdata->notify_event && + (ci->platdata->flags & CI_HDRC_IMX_IS_HSIC)) + ci->platdata->notify_event + (ci, CI_HDRC_IMX_HSIC_ACTIVE_EVENT); } return ret; @@ -218,6 +223,8 @@ void ci_hdrc_host_destroy(struct ci_hdrc *ci) static int ci_ehci_bus_suspend(struct usb_hcd *hcd) { struct ehci_hcd *ehci = hcd_to_ehci(hcd); + struct device *dev = hcd->self.controller; + struct ci_hdrc *ci = dev_get_drvdata(dev); int port; u32 tmp; @@ -249,6 +256,16 @@ static int ci_ehci_bus_suspend(struct usb_hcd *hcd) * It needs a short delay between set RS bit and PHCD. */ usleep_range(150, 200); + /* + * Need to clear WKCN and WKOC for imx HSIC, + * otherwise, there will be wakeup event. + */ + if (ci->platdata->flags & CI_HDRC_IMX_IS_HSIC) { + tmp = ehci_readl(ehci, reg); + tmp &= ~(PORT_WKDISC_E | PORT_WKCONN_E); + ehci_writel(ehci, tmp, reg); + } + break; } } diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index 63758c399e4e..911e05af671e 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h @@ -60,9 +60,12 @@ struct ci_hdrc_platform_data { #define CI_HDRC_OVERRIDE_RX_BURST BIT(11) #define CI_HDRC_OVERRIDE_PHY_CONTROL BIT(12) /* Glue layer manages phy */ #define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13) +#define CI_HDRC_IMX_IS_HSIC BIT(14) enum usb_dr_mode dr_mode; #define CI_HDRC_CONTROLLER_RESET_EVENT 0 #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 +#define CI_HDRC_IMX_HSIC_ACTIVE_EVENT 2 +#define CI_HDRC_IMX_HSIC_SUSPEND_EVENT 3 int (*notify_event) (struct ci_hdrc *ci, unsigned event); struct regulator *reg_vbus; struct usb_otg_caps ci_otg_caps;