From patchwork Mon Oct 22 05:42:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 10651727 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 12670109C for ; Mon, 22 Oct 2018 05:43:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00A4628703 for ; Mon, 22 Oct 2018 05:43:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6AFA287E7; Mon, 22 Oct 2018 05:43:03 +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 7A96228703 for ; Mon, 22 Oct 2018 05:43:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727527AbeJVOAC (ORCPT ); Mon, 22 Oct 2018 10:00:02 -0400 Received: from mail-eopbgr10066.outbound.protection.outlook.com ([40.107.1.66]:36974 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726784AbeJVOAC (ORCPT ); Mon, 22 Oct 2018 10:00:02 -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=nOFk137+TgID7f2/9vIomT6jztbXUDNZM5H3g5JUugdRLCLVq6fYzHKX0Os2F1mYMx28v7MAeYlEyhCCZ3CnqlKYMfvX34aUNkdBTFQRJpb/h51Xg1W40dNpaYzPRcYW0pP/d4YRc76wKcO4I4bPmOsCB2f+DWU3RAFSnr2X6pg= Received: from VI1PR04MB5327.eurprd04.prod.outlook.com (20.177.52.16) by VI1PR04MB4045.eurprd04.prod.outlook.com (10.171.182.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.20; Mon, 22 Oct 2018 05:42:57 +0000 Received: from VI1PR04MB5327.eurprd04.prod.outlook.com ([fe80::e046:4971:4e49:7e97]) by VI1PR04MB5327.eurprd04.prod.outlook.com ([fe80::e046:4971:4e49:7e97%3]) with mapi id 15.20.1250.028; Mon, 22 Oct 2018 05:42:57 +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 v2 1/4] usb: chipidea: add flag for imx hsic implementation Thread-Topic: [PATCH v2 1/4] usb: chipidea: add flag for imx hsic implementation Thread-Index: AQHUacoVjKUbgl66mkyZsu6I4B79fA== Date: Mon, 22 Oct 2018 05:42:56 +0000 Message-ID: <20181022054031.14027-2-peter.chen@nxp.com> References: <20181022054031.14027-1-peter.chen@nxp.com> In-Reply-To: <20181022054031.14027-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: HK0P153CA0036.APCP153.PROD.OUTLOOK.COM (2603:1096:203:17::24) 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;VI1PR04MB4045;6:q7VGa6Hk6aiOD++yXOZNOzuARgRpZ6Bt7JP5F+YP0dMz+HLfGj/0nD+Pe9JjEuPXQxyMZiuayI8Zr6i5QLz0AI5Qz6V+NAF586iNG6PzzZILgc2M4q6u421wov5oxHWm9bDTU7SWg3HgVFzdctOvh6uk+OSVv6UWebIVWhKsC5sBzznzj5PeLkDP+zClkTYODh6+bAxICyQ36evseR7hA/c3N2ffWp4a5g8IKTolkuSBwKTnyyZxxNx9uLek8YovEZfhh3m2otTQFz6orskQlPPHZoWTxnxQaIeEQPTmNI0lzqwn8oZhb72XHzR5aM55RfnxjNNnCg5EpkKAcwsaNUmX8xxqEGdlLl/lyuz6qSB9h0k4FSHqR5cofGCOsOGj5q+MOVVkuJdQ7sY10sxEhaPdvWI8K6fZWrOAtPv8fqKiIR4xjNYWbADAjfdLhM684tBr0mSBvHaL2ty/D15jhQ==;5:hKmBdklBHQ/FUQk2epvptDZMoqGken2Xqn86liqmXla6t/FSJeFTg5S7/7ISTiwLjH45qwMRkwAHql0/39zft9Cc6cuAFZf72fgpszwiTLJyA+G4EGXZWXeeO3dS31vG4Or9YednXnZg399Gb9bA4aIsmlXn2nNZuJ4I/d/q6m8=;7:Up2wVvE9sNYHEjPz9RKrbRyj+AhoSi8NYWVNq0jRldEYh9c5otMtHWhHS3BoFOFAXIoZfoU2w0i27Eof0971MzwceybVbV2fkDzbOj8LaxMggDmNYihAUlDpKKV/J+Sb8Okl0TChDxYlKU215Ol7ofMfXGrntdeQ6Box7g2RylTnqWM3TiS+OXUf4oFc26+M204itiL8wa6ksYHlBGkF6+PlbgI0MtNxTZyaNBXwWcrdRbpzLZesVprOVyv1Fkfb x-ms-office365-filtering-correlation-id: 21dfe8ea-718e-4cf2-b7c0-08d637e13804 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:VI1PR04MB4045; x-ms-traffictypediagnostic: VI1PR04MB4045: 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)(93006095)(93001095)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:VI1PR04MB4045;BCL:0;PCL:0;RULEID:;SRVR:VI1PR04MB4045; x-forefront-prvs: 08331F819E x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(346002)(136003)(376002)(396003)(366004)(199004)(189003)(54906003)(6512007)(186003)(6486002)(305945005)(5640700003)(3846002)(66066001)(478600001)(2351001)(7736002)(6116002)(6916009)(6436002)(106356001)(2900100001)(5660300001)(105586002)(11346002)(44832011)(52116002)(76176011)(2616005)(8676002)(4326008)(81156014)(81166006)(71200400001)(2906002)(25786009)(316002)(6506007)(476003)(2501003)(486006)(68736007)(8936002)(5250100002)(71190400001)(386003)(1076002)(97736004)(446003)(50226002)(26005)(36756003)(53936002)(86362001)(256004)(14444005)(102836004)(99286004)(14454004)(39060400002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB4045;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: 7T5Ca8X6LJi3x8ETxJZNnoFlAA41xVsKrBDFh2DM+K8HN890umcpGa+giQYah7b5V/tRHVQGCtsqiyJLnZKAnExVXn+M5HqvgCCdD7Jd1vuKMA6BfUCjyqMRZQ+MfCjG1TfXiqL2G9SqGwEzh8YSakzc+vlo2sfZnqV2yLbHIwGVUlFEFxpxa1AyHq9QZNX/9Y8/XwYtdAz5Wp/g67N43npO7hH/CszJHQoETiVUMKt3taLu9Xck1bY+YQ+hkB+YQ2rJ5do+57GKEYW7XWXKPwUY70MwNBFYVLj9FG+q87HWF22K2O/FMbI09W6Z2VrUI3th5enTYh9e8OEdAp/lNr/E7MdkIEfnakNVkUG382s= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21dfe8ea-718e-4cf2-b7c0-08d637e13804 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Oct 2018 05:42:57.0100 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4045 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;