From patchwork Mon Feb 25 06:27:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10828263 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 102761575 for ; Mon, 25 Feb 2019 06:27:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F364E2A935 for ; Mon, 25 Feb 2019 06:27:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7E872AAB0; Mon, 25 Feb 2019 06:27:49 +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 3632C2AAAE for ; Mon, 25 Feb 2019 06:27:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726795AbfBYG1r (ORCPT ); Mon, 25 Feb 2019 01:27:47 -0500 Received: from mail-eopbgr10050.outbound.protection.outlook.com ([40.107.1.50]:49829 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726786AbfBYG1r (ORCPT ); Mon, 25 Feb 2019 01:27:47 -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=1W21FcWtJvPFmSen0vTbhG0qwWTrYXrUTyUC7oK+tYI=; b=kWv/r5Ku5c5s1H72HGkPJCKTttEh7O6zaKgIFc/k/fLM55iuXz3FftuciYGnUkb/tpJ3tpiMAhteCxpn69ClUtjfmGXVhLUhSkcSk0A6DSLDTrZ9biUrq+bXNg81lD4JrPe9g2IObAREEeXO53Ivk3LCmJDB14GfuJPbxZWPTNw= Received: from VI1PR04MB4558.eurprd04.prod.outlook.com (20.177.55.216) by VI1PR04MB3118.eurprd04.prod.outlook.com (10.170.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.15; Mon, 25 Feb 2019 06:27:43 +0000 Received: from VI1PR04MB4558.eurprd04.prod.outlook.com ([fe80::b0fe:dee7:b2d3:9355]) by VI1PR04MB4558.eurprd04.prod.outlook.com ([fe80::b0fe:dee7:b2d3:9355%5]) with mapi id 15.20.1643.019; Mon, 25 Feb 2019 06:27:43 +0000 From: Jun Li To: Peter Chen CC: "gregkh@linuxfoundation.org" , "linux-usb@vger.kernel.org" , dl-linux-imx Subject: [PATCH 2/2] usb: chipidea: imx: enable vbus and id wakeup only for OTG events Thread-Topic: [PATCH 2/2] usb: chipidea: imx: enable vbus and id wakeup only for OTG events Thread-Index: AQHUzNM3YVjQiyZteU68VbQ4zkUmtg== Date: Mon, 25 Feb 2019 06:27:43 +0000 Message-ID: <1551074807-27792-2-git-send-email-jun.li@nxp.com> References: <1551074807-27792-1-git-send-email-jun.li@nxp.com> In-Reply-To: <1551074807-27792-1-git-send-email-jun.li@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK0PR04CA0005.apcprd04.prod.outlook.com (2603:1096:203:36::17) To VI1PR04MB4558.eurprd04.prod.outlook.com (2603:10a6:803:6f::24) authentication-results: spf=none (sender IP is ) smtp.mailfrom=jun.li@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.71] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 721b260e-3f4a-4570-de3e-08d69aea5950 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB3118; x-ms-traffictypediagnostic: VI1PR04MB3118: x-microsoft-exchange-diagnostics: =?iso-8859-1?q?1=3BVI1PR04MB3118=3B23=3AXm?= =?iso-8859-1?q?Rce5LYdgEzdnEIPl5q9gAq5fXugsV+UULQtqUqqyvU+i/Qzd33n5RUj/AIfA?= =?iso-8859-1?q?wZJH/CDzRVjrT/xARCmj3GpamgMqM01VVfhex8tCGLvxhZYfIkX/d6OQlxWi?= =?iso-8859-1?q?A4xlz/yRiqZ0nu6Tys4iKMY5b5WPww8Odpkyb+wLR7xC62K8n+IDYj4vf1X1?= =?iso-8859-1?q?9rY+N49DAfPUtQTtr5O+6v+qRs2JfMKu87Hgl9avrVabjCbqIky0rEIjOwb1?= =?iso-8859-1?q?HzqMRvDMao59PeLWBsMsoJe1iWilQluqIj6+IkdezgjwALSVNd4qLF5QTuOK?= =?iso-8859-1?q?OPMNR56ocnpkXo4wfw/OE11kx6NrDoFTRvkSEAPfr2C1CQlu0NNVSNYKA9VT?= =?iso-8859-1?q?KELj7old/jLMNSz4Nia82qDsk78bq0L7vJunhAp4ZbeMGPOLdOZYl+yj9ywg?= =?iso-8859-1?q?7tC2jyHWH+e2u/iytcP/ylmrgZ0PVbrQ9KfkVUhVVIHKNlN7WSXLK/WaHxUS?= =?iso-8859-1?q?dOR6fhCtUNxr4nbu+9X2gXBOSoUo8ANryDPWJ/SZXdc49vdRX5ggo270gs52?= =?iso-8859-1?q?d/xiNwyUbMqj2/0rWXVQEuOf/rdoLBM4NDuRh+fTQeET2wz9ez7DSVc1ToU2?= =?iso-8859-1?q?dpJ01xdBSg11kZMp2CO9Pnf1cxYXcCy/PA10+fPlcEuzKv9gn2Kh8GyaID4e?= =?iso-8859-1?q?++LtO10jvHnKK/g+Pto3sNRsa20q/NXwM07y8iuemv+mbPS2SzHdWB5G7CiJ?= =?iso-8859-1?q?899DS2LdMsoWBPCpbsBqgVx4z1ctZOYg2qYVvISlfXSwYO5sJJsPiVZB2N52?= =?iso-8859-1?q?lfw93a4hsYoFwPldGycYTW0TxEiGFr4sY8P4XH9ywN6BeOUGd50XW+EVqX4V?= =?iso-8859-1?q?Hk6e+RNqr0CD/tSmf7d1uYxwN1nnCCjwDjs1pJBvV5D/gFpKcnGU+Nczck8o?= =?iso-8859-1?q?7w7z+1BK+byUWjzVkiiAdWnJzTkFkG80+PkNJo+AXmAd6OM/E7RilcT03AnJ?= =?iso-8859-1?q?5eTgMlo35q1Fho5srSGmNkboZ819g1eazRxjstk9sP5ROv7Qk9/QDXC/KQ9e?= =?iso-8859-1?q?Kr16Zv8HbIP2Te7Mtl3FwnFdlyA7Xdzcz6O3YbN0HraO7P6yjnZVFZbOeeqx?= =?iso-8859-1?q?Je/BGmHRCcE8sWqj11g0lzUth+WTTKo7PJoT6y7KbFYHmQQ1hQIjiJmiVAW6?= =?iso-8859-1?q?xnLmAb8hXf3L1j2mo+d2G1sqtXvUVXUUFuXHQ8ujsvOmAvfoszRX4IHwchA4?= =?iso-8859-1?q?ZrXCmlZ8aboFcQ0MgKyY0gHkrT4S6iXUCjaUAkKR55WNpUpHF1K1EPWNs3S3?= =?iso-8859-1?q?vlcWroGTCjaCDSRXHW?= x-microsoft-antispam-prvs: x-forefront-prvs: 095972DF2F x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(39860400002)(366004)(396003)(346002)(376002)(189003)(199004)(50226002)(8936002)(76176011)(2906002)(99286004)(36756003)(25786009)(52116002)(97736004)(6862004)(6116002)(3846002)(68736007)(4326008)(6436002)(6486002)(11346002)(14444005)(256004)(446003)(6636002)(478600001)(44832011)(2616005)(486006)(105586002)(476003)(26005)(106356001)(186003)(53936002)(6512007)(66066001)(7736002)(305945005)(37006003)(54906003)(81166006)(71200400001)(71190400001)(81156014)(102836004)(316002)(386003)(6506007)(14454004)(5660300002)(86362001)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB3118;H:VI1PR04MB4558.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Ba81zadFcA/2cAMnt63rH3teD2BSUxTAgWBCwCmGMY5QP8hyoFqvK6S/VNcAhVBtpOoV6Pgw1HdAVhSdEnzITVLKzIAru2g1+V3R9YdnhgLsQP1dYErKvUcCRKgrD6eVJNOv0zOVQXHwrXnPs0BDLjyVBKZwZonZOOGPWC808+XEvSadpEuf5o76qJw/NfBF4pljQxQHvM6jyrYlSfiiAKpxvgj8MGGqPoBSMceN6UyQz+NQr8+pP4KhunzB2VJHE7hrbCvfKCFf0f5OLsN7hDQCnrqe5dr/xyodV3QjHBjDkCbrXnLqO0K91JfYyDqDJPzCNhuusRndaLd9HWzc9IZKWsSsZ+2lIdQ9KFe5ij0WfH3lsfA9LzRmHOmzIxktbOJdI05nSnLNCcDfrbex61XPWnfRBlUL1PjTaTOmNgs= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 721b260e-3f4a-4570-de3e-08d69aea5950 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Feb 2019 06:27:41.2777 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3118 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 If ID or VBUS is from external block, don't enable its wakeup because it isn't used at all. Signed-off-by: Li Jun --- drivers/usb/chipidea/ci_hdrc_imx.c | 6 ++++++ drivers/usb/chipidea/ci_hdrc_imx.h | 2 ++ drivers/usb/chipidea/usbmisc_imx.c | 17 ++++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index 9b45aa4..ccd59cc 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -419,6 +419,12 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) goto err_clk; } + if (pdata.ext_id) + data->usbmisc_data->ext_id = 1; + + if (pdata.ext_vbus) + data->usbmisc_data->ext_vbus = 1; + ret = imx_usbmisc_init_post(data->usbmisc_data); if (ret) { dev_err(dev, "usbmisc post failed, ret=%d\n", ret); diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h index 7cc53e2..8017144 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.h +++ b/drivers/usb/chipidea/ci_hdrc_imx.h @@ -21,6 +21,8 @@ struct imx_usbmisc_data { unsigned int evdo:1; /* set external vbus divider option */ unsigned int ulpi:1; /* connected to an ULPI phy */ unsigned int hsic:1; /* HSIC controlller */ + unsigned int ext_id:1; /* ID from exteranl event */ + unsigned int ext_vbus:1; /* Vbus from exteranl event */ }; int imx_usbmisc_init(struct imx_usbmisc_data *data); diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 097ffbc..d357288 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -329,6 +329,20 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data) return 0; } +static u32 usbmisc_update_wakeup_setting(struct imx_usbmisc_data *data) +{ + u32 wakeup_setting = (MX6_BM_WAKEUP_ENABLE | + MX6_BM_VBUS_WAKEUP | MX6_BM_ID_WAKEUP); + + if (data->ext_id) + wakeup_setting &= ~MX6_BM_ID_WAKEUP; + + if (data->ext_vbus) + wakeup_setting &= ~MX6_BM_VBUS_WAKEUP; + + return wakeup_setting; +} + static int usbmisc_imx6q_set_wakeup (struct imx_usbmisc_data *data, bool enabled) { @@ -345,7 +359,7 @@ static int usbmisc_imx6q_set_wakeup spin_lock_irqsave(&usbmisc->lock, flags); val = readl(usbmisc->base + data->index * 4); if (enabled) { - val |= wakeup_setting; + val |= usbmisc_update_wakeup_setting(data); } else { if (val & MX6_BM_WAKEUP_INTR) pr_debug("wakeup int at ci_hdrc.%d\n", data->index); @@ -549,6 +563,7 @@ static int usbmisc_imx7d_set_wakeup spin_lock_irqsave(&usbmisc->lock, flags); val = readl(usbmisc->base); if (enabled) { + wakeup_setting = usbmisc_update_wakeup_setting(data); writel(val | wakeup_setting, usbmisc->base); } else { if (val & MX6_BM_WAKEUP_INTR)