From patchwork Thu Jun 20 20:53:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1119811 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45VDcf4z1gz9s6w for ; Fri, 21 Jun 2019 06:56:02 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 5B47BC21DB6; Thu, 20 Jun 2019 20:55:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 1F5F4C21D56; Thu, 20 Jun 2019 20:55:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 57222C21DA6; Thu, 20 Jun 2019 20:55:42 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by lists.denx.de (Postfix) with ESMTPS id 31381C21DEC for ; Thu, 20 Jun 2019 20:55:40 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 45VDcC72H0z1rXvq; Thu, 20 Jun 2019 22:55:39 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 45VDcC6nJqz1qqkb; Thu, 20 Jun 2019 22:55:39 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id yPxzwwCGP9tg; Thu, 20 Jun 2019 22:55:38 +0200 (CEST) X-Auth-Info: DVzw94+rdl413MW4QdqmzHZEte6FRtUmYLrXoU0ffRk= Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz [86.49.110.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Thu, 20 Jun 2019 22:55:38 +0200 (CEST) From: Marek Vasut To: u-boot@lists.denx.de Date: Thu, 20 Jun 2019 22:53:58 +0200 Message-Id: <20190620205358.11534-1-marex@denx.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Cc: Marek Vasut , Vagrant Cascadian , Ludwig Zenz Subject: [U-Boot] [PATCH] usb: ehci-mx5: Fix bus enumeration for DM case X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" It is likely that the DM conversion of EHCI iMX5 driver was a derivative of EHCI VF, however the conversion is incomplete and is missing the bind workaround, which updates dev->seq number. Without this, all controllers have dev->seq number 0 . Add this bind workaround into EHCI iMX5 driver as well. Signed-off-by: Marek Vasut Cc: Abel Vesa Cc: Adam Ford Cc: Fabio Estevam Cc: Ludwig Zenz Cc: Peng Fan Cc: Stefano Babic Cc: Vagrant Cascadian Tested-by: Lukasz Majewski --- drivers/usb/host/ehci-mx5.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/usb/host/ehci-mx5.c b/drivers/usb/host/ehci-mx5.c index 0b32728c57..4db513f4e5 100644 --- a/drivers/usb/host/ehci-mx5.c +++ b/drivers/usb/host/ehci-mx5.c @@ -301,6 +301,22 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev) return 0; } +static int ehci_usb_bind(struct udevice *dev) +{ + static int num_controllers; + + /* + * Without this hack, if we return ENODEV for USB Controller 0, on + * probe for the next controller, USB Controller 1 will be given a + * sequence number of 0. This conflicts with our requirement of + * sequence numbers while initialising the peripherals. + */ + dev->req_seq = num_controllers; + num_controllers++; + + return 0; +} + static int ehci_usb_probe(struct udevice *dev) { struct usb_platdata *plat = dev_get_platdata(dev); @@ -362,6 +378,7 @@ U_BOOT_DRIVER(usb_mx5) = { .id = UCLASS_USB, .of_match = mx5_usb_ids, .ofdata_to_platdata = ehci_usb_ofdata_to_platdata, + .bind = ehci_usb_bind, .probe = ehci_usb_probe, .remove = ehci_deregister, .ops = &ehci_usb_ops,