From patchwork Tue Nov 27 09:30:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 10699899 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 B5C5C14BD for ; Tue, 27 Nov 2018 09:31:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A67F52AAFD for ; Tue, 27 Nov 2018 09:31:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A6F02AB21; Tue, 27 Nov 2018 09:31: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 2F6192AB37 for ; Tue, 27 Nov 2018 09:31:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729815AbeK0U2Q (ORCPT ); Tue, 27 Nov 2018 15:28:16 -0500 Received: from mail-eopbgr60054.outbound.protection.outlook.com ([40.107.6.54]:26834 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728512AbeK0U2Q (ORCPT ); Tue, 27 Nov 2018 15:28:16 -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=R+cx55gSopHc3WUzn9PXX1xq/0Eipp5KPIjYyL2Y0zQ=; b=tmRv/HOGdJulpJtdlcOQcpWuA9UsbpyWzqFjMU3HDasPzJ0iZ2mAgo5Fxf03PJOGq885oY9wSh+uR4RZxmMnUabXC5PA2slLlYf2PZlhv8CzZJW+KT50Rzjt/Vh6diFDYa/Vwdj8LQI48RI4FTyR9VHsWGv2vxl2IXNumg88/wA= Received: from VI1PR04MB5327.eurprd04.prod.outlook.com (20.177.52.16) by VI1PR04MB4158.eurprd04.prod.outlook.com (52.133.15.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1361.14; Tue, 27 Nov 2018 09:30:53 +0000 Received: from VI1PR04MB5327.eurprd04.prod.outlook.com ([fe80::811d:1992:9a6a:bb3f]) by VI1PR04MB5327.eurprd04.prod.outlook.com ([fe80::811d:1992:9a6a:bb3f%4]) with mapi id 15.20.1361.019; Tue, 27 Nov 2018 09:30:53 +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 v3 1/4] usb: chipidea: add flag for imx hsic implementation Thread-Topic: [PATCH v3 1/4] usb: chipidea: add flag for imx hsic implementation Thread-Index: AQHUhjPkvOLr3Bf/mka8F+Eqo1Omig== Date: Tue, 27 Nov 2018 09:30:53 +0000 Message-ID: <20181127092824.22756-2-peter.chen@nxp.com> References: <20181127092824.22756-1-peter.chen@nxp.com> In-Reply-To: <20181127092824.22756-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: HK2PR06CA0011.apcprd06.prod.outlook.com (2603:1096:202:2e::23) 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;VI1PR04MB4158;6:CPU1Ga0NyHj4DPlZZXpa/iGXwx7Yt36Is5WwwV5SGxxLb8ob1HMY776Pt/4qtfMbC//J3iTX2OIWJmpqtqgwOvkdlPFNehRYoXcGc+v1jqZkNTBl1JM+UW5bVtiMbEQ8LmVw06tLIOAtdQGfrUndn1zEB51DMPzi+ergPcgVWTIl722x2Tekk4hp4vte0xREl7lYKernasUrlyNl/9oKbTug8GoFj6z0weX4SW0M3nWaacWNuu99Cwz0jdI2tVAkFvrXHT9dummMZ8Dn9XUX4m5KEqV+WsViMhyTYt+lqFRY0KPVVjhOLCkS9PrvRcuqsVqhl1Zn4fH2hqxEE0br+Pje7EXjl5YE1ZnBgsWJML8o69gvfhw0bmdrQVsgK6XinBEgMdVWeR5YDUhQaZXD1rpBWzcy5CxVFIzbeyxttIU913VBawM4KeKM+NnVNf5Twe7k6Vo521rF/qY5aMbNOQ==;5:2hSu435/klKFPWMhMIBtcpfvQXuJrbKSm/+CvaEoiPI6IgIbsmsyWtUCVlt/EoJo9E2fbxuB1UA2Oo/J/bm1G2ssDbF1eKSZDSD3r/AeZpio8vOl0sPh4ZpxnqUTyExXXTI0ikW2sAMgRtVvKC5Jn9ZTG3VQqpxGVUGpxYn34/0=;7:Gbp/9tMtgx/VDf91wos7lIq3UpOKqRURSME8Jq9NJRO8z9VJwK01F/uruX4ZQoyjHvO+PCYOX5X5bf73pFFZgv5Ez2If7nT+DQ/Jh5o1wzxpgT6H21ZLiwuH+QtE78Wbk2z+/j4biR9a/4Iu6ymLVg== x-ms-office365-filtering-correlation-id: d1da8db6-57ab-4b99-b1fd-08d6544b06e1 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:VI1PR04MB4158; x-ms-traffictypediagnostic: VI1PR04MB4158: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231443)(944501410)(52105112)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051)(76991095);SRVR:VI1PR04MB4158;BCL:0;PCL:0;RULEID:;SRVR:VI1PR04MB4158; x-forefront-prvs: 086943A159 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(136003)(366004)(376002)(346002)(396003)(199004)(189003)(71200400001)(25786009)(14454004)(476003)(97736004)(99286004)(11346002)(446003)(2616005)(4326008)(66066001)(39060400002)(6916009)(102836004)(86362001)(71190400001)(26005)(14444005)(6506007)(8936002)(68736007)(36756003)(8676002)(256004)(386003)(81156014)(81166006)(486006)(50226002)(52116002)(76176011)(186003)(2906002)(6486002)(6436002)(5640700003)(316002)(53936002)(3846002)(6116002)(1076002)(5660300001)(305945005)(54906003)(6512007)(7736002)(478600001)(53346004)(105586002)(106356001)(2351001)(2501003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4158;H:VI1PR04MB5327.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Z46+bjbY6rtUUScoJ93NuEo1ASx2tSiCAMVFsrjy220kVatDwd0BsuwmsAwR6edAbmPKdz0LF0byKp124XV1RhtieJwdsLbt4yqt+ntEk4Yy5qnhvwcVCL5b4Ta/ZvM4dLcwqFY+p8rzwyUFdqigpni2DpMDuqBkM/rnJ3YoR6cAW+8GyQL7fK+664g7ULdmUHwg4l38jFiHaa3MApPlh4/OQGyyvAXRcIntx2pxOsDYOhmsPSRZ7X33Lqu2ryO9OTpq9BuuUuerFzGEcMjDfaoNs+jg3d+5NhqcKe75C09pNuJTFMTvVbx6ir8uaKHeSVEd5EruygN8zQAeVsH6B6H+njfjEAEBs8fHYxBnE0Y= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1da8db6-57ab-4b99-b1fd-08d6544b06e1 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Nov 2018 09:30:53.6894 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4158 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 Reviewed-by: Frieder Schrempf Tested-by: Frieder Schrempf --- 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;