Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752350AbbG0LQR (ORCPT ); Mon, 27 Jul 2015 07:16:17 -0400 Received: from mail-bl2on0121.outbound.protection.outlook.com ([65.55.169.121]:31744 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751085AbbG0LQP (ORCPT ); Mon, 27 Jul 2015 07:16:15 -0400 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; From: Nikhil Badola To: , CC: , , Nikhil Badola , Ramneek Mehresh Subject: [PATCH] fsl/usb: Workaround for USB erratum-A005697 Date: Mon, 27 Jul 2015 17:11:04 +0530 Message-ID: <1437997264-31219-1-git-send-email-nikhil.badola@freescale.com> X-Mailer: git-send-email 2.1.0 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD020;1:bxZAWrSkRNdZJ9Zepr0c85xkFN80FYWxY5/9vdCzpRx0Mkyakx9Ie47kuLky3zCMjs/1tTzksvrCYmHuNbdNzxXy5MqaSjcpqrC0haXyMwwsEzk5arbti87v3wPlbfhU0iCgWYCzQJHaRCgyVZyklK3W2558j0jjmbyFm/2BlOTRUSBR/kg5dZlYXbfNvorhl1zZ1temB97Qx9lx267UZngIr2Cmyh68MjlqfZtUNThmPq9WGhrZH6E7JqFOulLGoaZsJfU0u/Hccyxgu5wy2KVT4dwXwU9Mcx7xP7lioitmfdMZ9ZBzRpva7v8GdeYDsCSn+U2heoijEMpQQbo27A== X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(339900001)(199003)(189002)(47776003)(189998001)(6806004)(50226001)(19580395003)(46102003)(92566002)(77096005)(19580405001)(86362001)(551934003)(50986999)(48376002)(5001960100002)(105606002)(36756003)(5001770100001)(107886002)(87936001)(104016003)(5003940100001)(33646002)(77156002)(62966003)(229853001)(50466002)(106466001)(85426001)(4001430100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR0301MB1574;H:az84smr01.freescale.net;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BY2PR0301MB1574;2:AySsQrzy+T6uF5c1GrxV2AHNc9E9up4a4+Fb0cydZ7zXmEPaMtwReiFpqyWeiMKSR8wz2fr9lttwAGy8ANNVwtGE+S1ATkalP9wQhzpFAziZK/ax/ZuXARnZHajvlZjS+wAvTqJEcKDOCWJlRtHnmhYEU98C08JRjOYEjb8JMT8=;3:2KAbD6ZRpzmgL8/6qtNMJIUinucjg4puabJ+RqxOMQb0M527z++j7YmsbqZW6Swoh3xB2rOhHBPMGRxNjXp5o93hyMCEX0TJYE9fuEV+RWU4KnDaEBgg9ujYOnTpGmZa9lRMXPjQVYlTAjfF1+j8v3S88ymIRmMtCdie67rtgtVgMb3vyHB0W+W8qzXNxs+V7wvr5ZC4MiQTFNjrMmtJxetYBvmn2RH37UdBNLaIpvs=;25:2vLSe9uxLRV+qeS0bTjw4UInsnuTcjsOKO81jp22/I9WMG7wQYKbVi0n8O2V6HtmVnH3Yu6xXAlCx41xRTmujNorT8yj+3fHV0N5Yrr0rRxW0hiqwzSvudZQJTETjea1Vhc+9n6LcqJ4dOKgIZiFTOh6stirRX8BYQsZnyN9uz3/F5KoIqsjWivSVdGXh+aOts2EmrFURvvpTXv6N+R67wvD+Hle33QIeL4z4Kf6nzu/oAyOozWbv/8QGVNcoqGcfWC2DZ6hYqh5ZwKLRiHIrQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB1574; X-Microsoft-Exchange-Diagnostics: 1;BY2PR0301MB1574;20:Gddcjf3GgK1aRVWrzODkK2O0IVbJbZFqZKwVEPV2k8nqg+fGQcrzu/GwDzWCrooYu44lHi/iIlv4VVpOSKk94gCbdmBZ0t5FXtD5G3xt2R5oXua21WKD1h9nlahHTvSJxRJBuWrOgDYk1v3vbsYnVNsgxe/ulOhY2DidJOfhV/mTI9gPZGin1/J78Nu2wvAZGR6S2wshy0j1GbSDF6/IwpDsarMT/ULGODSffmaM2Udvwrbw8pRtg9xCEm6u5VivxJDDVQoMahm4vvdg3oZ76nDZpyXCvj2cuWpnnpoujS8vssfu0fHEwuAu3wHnGBjgXsjKhlomPdfyqAfk/gA6vuAgSUwWWq3LeXdvmbr0WYQ=;4:hGUy6aqOIPrvuejtfQVy2mVcB/Y9Jhzwe2WLLlRLuGnGHs1LqPnVEmqhsDl2jGkHA7Y30sZlsVafQaePeZoa/iL71NVStYOFxps8kfNYuNPDEmOcXvLp7jgAJ4EUrWM7KhEPma5L/S7q4G6I5AmoGz7/WoMji4PpOe8fOm3po8hVqnQWR2xQdwS7XA+lsYBMO4BYDw2slvil6rHF/jFxgy1RaE4gJijKPNyo0Zp1q9B0yh41qOCCZ1f+LzZzs11FUn6cOX5txI4DKnsyWCvuc1tbsAVc0qTv96GPNMQXQtQ= BY2PR0301MB1574: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BY2PR0301MB1574;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB1574; X-Forefront-PRVS: 0650714AAA X-Microsoft-Exchange-Diagnostics: 1;BY2PR0301MB1574;23:Ty3HXQp6rjik3/6RdeGhyxn711YyN6/cMvbilCu+VFlfVM42W/BOHiKORO/TW6abcrnER1JQcwcyEpS9xFyjW2AW930WC4MVmhbAG/wOh7BbTLaiYAJN+8q+AKvjIKv/VO/8RcTaiKNg6Z3oeD31fAQWXeIff7y442QxQHiSmmBpJq0SIouKDmUk0WCQjLYZYZwWUt010b+VgGEIBznWSlTOFzgS9U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izgFkJjG3A3Mv+BuFZwy+TDbzDOFb9sF11lA== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2015 11:16:12.1150 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB1574 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4209 Lines: 114 As per USB specification, in the Suspend state, the status bit does not change until the port is suspended. However, there may be a delay in suspending a port if there is a transaction currently in progress on the bus. In the USBDR controller, the PORTSCx[SUSP] bit changes immediately when the application sets it and not when the port is actually suspended Workaround for this issue involves waiting for a minimum of 10ms to allow the controller to go into SUSPEND state before proceeding ahead Signed-off-by: Ramneek Mehresh Signed-off-by: Nikhil Badola --- drivers/usb/host/ehci-fsl.c | 3 +++ drivers/usb/host/ehci-hub.c | 2 ++ drivers/usb/host/ehci.h | 12 ++++++++++++ drivers/usb/host/fsl-mph-dr-of.c | 5 +++++ include/linux/fsl_devices.h | 1 + 5 files changed, 23 insertions(+) diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 202dafb..8904aae 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -278,6 +278,9 @@ static int ehci_fsl_usb_setup(struct ehci_hcd *ehci) out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x80000000 | SNOOP_SIZE_2GB); } + if (pdata->has_fsl_erratum_a005697 == 1) + ehci->has_fsl_susp_errata = 1; + if ((pdata->operating_mode == FSL_USB2_DR_HOST) || (pdata->operating_mode == FSL_USB2_DR_OTG)) if (ehci_fsl_setup_phy(hcd, pdata->phy_mode, 0)) diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 22abb68..7eac923 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c @@ -303,6 +303,8 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) USB_PORT_STAT_HIGH_SPEED) fs_idle_delay = true; ehci_writel(ehci, t2, reg); + if (ehci_has_fsl_susp_errata(ehci)) + usleep_range(10000, 20000); changed = 1; } } diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index f700157..817eab5 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h @@ -215,6 +215,7 @@ struct ehci_hcd { /* one per controller */ /* SILICON QUIRKS */ unsigned no_selective_suspend:1; unsigned has_fsl_port_bug:1; /* FreeScale */ + unsigned has_fsl_susp_errata;/* Freescale SUSP quirk */ unsigned big_endian_mmio:1; unsigned big_endian_desc:1; unsigned big_endian_capbase:1; @@ -675,6 +676,17 @@ ehci_port_speed(struct ehci_hcd *ehci, unsigned int portsc) #define ehci_port_speed(ehci, portsc) USB_PORT_STAT_HIGH_SPEED #endif +#if defined(CONFIG_PPC_85xx) +/* + * Some Freescale processors have an erratum (USB A-005697) in which + * we need to wait for 10ms for bus to go into suspend mode after + * setting SUSP bit + */ +#define ehci_has_fsl_susp_errata(e) ((e)->has_fsl_susp_errata) +#else +#define ehci_has_fsl_susp_errata(e) (0) +#endif + /*-------------------------------------------------------------------------*/ #ifdef CONFIG_PPC_83xx diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c index 9f73141..870b50a 100644 --- a/drivers/usb/host/fsl-mph-dr-of.c +++ b/drivers/usb/host/fsl-mph-dr-of.c @@ -222,6 +222,11 @@ static int fsl_usb2_mph_dr_of_probe(struct platform_device *ofdev) else pdata->has_fsl_erratum_a007792 = 0; + if (of_get_property(np, "fsl,usb-erratum-a005697", NULL)) + pdata->has_fsl_erratum_a005697 = 1; + else + pdata->has_fsl_erratum_a005697 = 0; + /* * Determine whether phy_clk_valid needs to be checked * by reading property in device tree diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index cebdbbb..42bf841 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h @@ -100,6 +100,7 @@ struct fsl_usb2_platform_data { unsigned already_suspended:1; unsigned has_fsl_erratum_a007792:1; unsigned check_phy_clk_valid:1; + unsigned has_fsl_erratum_a005697:1; /* register save area for suspend/resume */ u32 pm_command; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/