From patchwork Tue Oct 16 05:01:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 10643097 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 A67051057 for ; Tue, 16 Oct 2018 05:02:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98E1F29C1D for ; Tue, 16 Oct 2018 05:02:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D78029C36; Tue, 16 Oct 2018 05:02:11 +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 1FE1129C1D for ; Tue, 16 Oct 2018 05:02:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727567AbeJPMuo (ORCPT ); Tue, 16 Oct 2018 08:50:44 -0400 Received: from mail-ve1eur01on0048.outbound.protection.outlook.com ([104.47.1.48]:46544 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726990AbeJPMun (ORCPT ); Tue, 16 Oct 2018 08:50:43 -0400 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=hWeIemQJ+uHzUcsTuhR+PWzXooglmgxBI1xJRlex8E8=; b=wwVYsIL1tU9KeLjSWOx/X87OUsTZtr4sKIPjYCEDt7HMV0qVj3aQcaQ/7cwaOPoGKODJvsoZD+oR+zae69NKTNtvrK1vnrW7+VZxhXHoYURGxBVMd58qK8yJ0Fgc1NQbc0ULG8BPrr1wKU2p8n5qcTqYzzN/9Jfnj1n0bcVkV+c= Received: from VI1PR04MB5327.eurprd04.prod.outlook.com (20.177.52.16) by VI1PR04MB4976.eurprd04.prod.outlook.com (20.177.49.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.25; Tue, 16 Oct 2018 05:01:19 +0000 Received: from VI1PR04MB5327.eurprd04.prod.outlook.com ([fe80::5c50:30f3:3805:71f9]) by VI1PR04MB5327.eurprd04.prod.outlook.com ([fe80::5c50:30f3:3805:71f9%4]) with mapi id 15.20.1228.027; Tue, 16 Oct 2018 05:01:19 +0000 From: Peter Chen To: "linux-usb@vger.kernel.org" , "frieder.schrempf@exceet.de" CC: dl-linux-imx , "robh+dt@kernel.org" , "devicetree@vger.kernel.org" , Peter Chen Subject: [PATCH 1/4] usb: chipidea: add flag for imx hsic implementation Thread-Topic: [PATCH 1/4] usb: chipidea: add flag for imx hsic implementation Thread-Index: AQHUZQ1GQt3j0WYTh0Woz4dxLZdXFQ== Date: Tue, 16 Oct 2018 05:01:19 +0000 Message-ID: <20181016045846.2345-2-peter.chen@nxp.com> References: <20181016045846.2345-1-peter.chen@nxp.com> In-Reply-To: <20181016045846.2345-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: HK0PR03CA0027.apcprd03.prod.outlook.com (2603:1096:203:2f::15) To VI1PR04MB5327.eurprd04.prod.outlook.com (2603:10a6:803:60::16) 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;VI1PR04MB4976;6:lY+a1xfJgZSi8jU5NDH5Aeqj4ckgWmGxz3v/zfJ2GTEnPPp4RM4P42iBMjnIN3TaFO/32ShGp+qd/GBj5vb5kdcZjROtRCzKApiPxIoT32pKlhqBmxpZuVHtXsSWazzeGp+B33kupdiB0Xhuq2xzFqSwCWiKWK7DOb+Uqul+QhMyvaPcAcNDZIomix21NJtP8sh3g9MBNXp6YyLeezUHA/s4BkEN0dBMoEYr2mjNKJmMucRLsYMUH/p6bFio9BbbuF4WMNeUmksZYGxg0FxGqowGtypnu8LGuZi+zeqMUsPs7ttIAlD3EU0Pr5OqTa53ZpyIDJfEYLkNrZE5tw1p/0X0Gv7IupPH53yY0gOecbI5AEPtpqrLjilppqXsX+PrsfEJIjDqeTxlCdA4+cn9S+K3MACaUiNafQuLLGB10Ww3s6GSvYb5Qqy6/XSLNRKWuagMD5W2kkmH9tcawvSrJQ==;5:YpacYqQU6rX18DN1d0mDo790ZdgKl/cHVJnX/HNLWx6CMMafMr66ejgLng+N3/J5Ctf/zYx3OBLXVXepIRsmKP0n6FsZxNaIjhUT3zCfFS4uEuzQ/Aw5xu3caermQaNTV8dUEMF0zmF1exhkAfRnHQIz49tzY4nW88pg2yPxgMU=;7:vMgaIzqVzPcYrYDbeC1m3i6twZuKS+YFMcm+MEu8VwZygsDCl0k19IoRS2MxKPLQ2nJhw1u9lrn2pdr457WUkaZTX2IxANzEwMMBLc5N8JigrptWXlN05uVpj25OejziXctyRXPIcHpwbr7gjbtOdan/hegTZdriva98Uks62K5iUEZM/E72jL2AkldyeJmspcP77X7UPJahJnDWaoHbahFgLy6AUWka3Kpl4GsiWDk9VsWPLzrRGDTpsFHRFSHF x-ms-office365-filtering-correlation-id: 33cbdd19-6cca-4b27-a522-08d6332468b3 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB4976; x-ms-traffictypediagnostic: VI1PR04MB4976: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051);SRVR:VI1PR04MB4976;BCL:0;PCL:0;RULEID:;SRVR:VI1PR04MB4976; x-forefront-prvs: 0827D7ACB9 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(39860400002)(136003)(346002)(376002)(396003)(189003)(199004)(14444005)(25786009)(11346002)(476003)(6512007)(2616005)(2906002)(478600001)(6486002)(4326008)(110136005)(446003)(6506007)(54906003)(386003)(6436002)(76176011)(71190400001)(71200400001)(102836004)(2900100001)(486006)(53936002)(52116002)(186003)(99286004)(44832011)(66066001)(26005)(2501003)(5250100002)(305945005)(14454004)(97736004)(316002)(6116002)(8676002)(7736002)(1076002)(8936002)(3846002)(5660300001)(256004)(36756003)(86362001)(106356001)(81156014)(105586002)(81166006)(68736007)(50226002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4976;H:VI1PR04MB5327.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: gyVbiUHnRgExuXbu/NmK6f0/pczkkMIhUFIAncJ0e2vLnpAxodvUBmuKVj1aNnjO3/bCdYsF7YKm5Mj3rMoL/NQa6TYqP8ycQoO4tIRvwh/gPAqCXdAdqI973oOPpjjtgM/RQR4rmr3jwSdlQhRcnwvTaKInxbzD0Eb6C75GXTQP5fXXkgkFATIHG6HiSWpWKfyRZJpJDtlZAvrl+1HKuDcfK1qVX7XvFZbG+e+WPbo1ySlysf4pEIdE9DxsNMx2arqY63M3QES5fGftlPs9rRYNU9SfbSEEqGQsebehE6tEPtOAVu5YizObTayzxj9yXzXKkmfANqV7k496TpqUV+gjmUV8fxxo3EBMDBxrir4= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33cbdd19-6cca-4b27-a522-08d6332468b3 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Oct 2018 05:01:19.3040 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4976 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. Signed-off-by: Peter Chen --- drivers/usb/chipidea/host.c | 24 ++++++++++++++++++++++++ include/linux/usb/chipidea.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index d858a82c4f44..d74a13d7c21c 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c @@ -28,6 +28,20 @@ struct ehci_ci_priv { struct regulator *reg_vbus; }; +/* This function is used to override WKCN, WKDN, and WKOC */ +static void ci_ehci_override_wakeup_flag(struct ehci_hcd *ehci, + u32 __iomem *reg, u32 flags, bool set) +{ + u32 val = ehci_readl(ehci, reg); + + if (set) + val |= flags; + else + val &= ~flags; + + ehci_writel(ehci, val, reg); +} + static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) { struct ehci_hcd *ehci = hcd_to_ehci(hcd); @@ -170,6 +184,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 +237,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 +270,9 @@ 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); + if (ci->platdata->flags & CI_HDRC_IMX_IS_HSIC) + ci_ehci_override_wakeup_flag(ehci, reg, + PORT_WKDISC_E | PORT_WKCONN_E, false); 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;