Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2543928lqb; Tue, 28 May 2024 03:21:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUayw3BFuLlGoCR8LZR5MqXgXhuQ/j5jjBnegC7w3uZf4J2yV8/bMLzAm6KDZE+nZclBKL3pKPC3GdaCYwqHJUklmgJjxNqbbvN1FBavA== X-Google-Smtp-Source: AGHT+IFRYGI+YHeisy/+4n3QrqLjrga4/YW3lTw7Mj174YqJHy4dFZvHQzSDFE2iFgRbS7SCwtQP X-Received: by 2002:a17:906:7187:b0:a59:c62c:2122 with SMTP id a640c23a62f3a-a62642d80famr841116566b.8.1716891679540; Tue, 28 May 2024 03:21:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716891679; cv=pass; d=google.com; s=arc-20160816; b=Nd+ZjAd2yF+OUqb+qJlWCwpApIj7WcYj3U7/qol+yh9zGaNTIPd8TuwgOKl7KTJUyp E4tdJ2LPYmXN/SjfTtWb8NCE6rtO8OI3ax1UIBG946UaEdauEUyJDNDXnKcJ6burb8OF YWSof5lX5yiLJR0HZH5w5pwJpoNpP6qV6pm2mXWxO9kJHuNkuZNV1HbjK5+jcB6SoG34 cy5Nw7kSattPfau29pRo+Zh71rV8k3Gmugvihs769DBaT4GwbH7u+utKKtCKPfWm0PoZ ROHdImwrCKk7Lq660N3yezBCVTCtgPL7dS3d3+nz0dJLz+PxxzhcGfKykr4E5FpENN22 RA9A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=qsG4a+QexdrWaD9z2b31NrWRE7fUVEl7ydWLvlxj0hU=; fh=uZ9fwDGAJTD4qTLbDZSlyY1iCL0JjAF5oxvOang+BXg=; b=DNyEZo0VOagkj1YWVjzBvGXA0gZhq7YmFaiZ6uPiH+w7FHOPD19XHkBr+bBgBdlaWo c6E/aBZ9ramrAw6DK7/zzQJdBZMuLwJQ0wjXytmyWLSKIVyP3nUSEg25EPxNLMbPMXzd rv1YgH5BL2xVo7XIPNcj6I9Qc4RSPywSRqxVvpXSsbfLVUvyQC6lssEubkD3XMnRoa2l So0seK5C0WPpYWUGhLomtzN2DFVwxS4b/YxCaif+LP/EP2eeomAnOGvky+t5oYnQCzRK 9j/WlB86z/lb/Dz3ljLUugm/Um0nGz10hhfmFBN5PMTaxepTw+rk9mKs0SNiU7xIPWc+ efOw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="eTYE/3jd"; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-192099-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192099-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a626cc37181si492805766b.392.2024.05.28.03.21.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 03:21:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192099-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="eTYE/3jd"; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-192099-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192099-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 49DC71F23D6F for ; Tue, 28 May 2024 10:21:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5DD2316C69D; Tue, 28 May 2024 10:20:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="eTYE/3jd" Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA58916B72D; Tue, 28 May 2024 10:20:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.193 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716891637; cv=none; b=If2ACMpu5ziaeTqZHjWelRMf3GxMz8ibP9/kWvrgnE9GWvX6lDyY7YrpmvDIS12yeXUR2cnpdgztDKH07KRvYw6xuqb2BCvByT09yn6sQrXVn2l6+V0MghCPNH37tFVMAKCDW1J+C5/ey1W86aW9ZprHfqzp6yDm/JyzKEA2SNw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716891637; c=relaxed/simple; bh=lMCM/A3Z7snAmnLzSGIr7jM7SrSUs1WYwlorRMK6qr8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cRCmAOXLQ1j4TJb3ruORDeWyrKxlmRqoiGeRjyadpI3QvqefQXdZjpJioi/V+7IP0Qo1eSiEK06gD009qzD/2LMCP63RR/WsOfSYCojADev76tB+Qgr2stU5d/F5pXamGV5jLuUJTqOv2C4hzrpn8Q44BTXHl0+CA/S+XgrUgP8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=eTYE/3jd; arc=none smtp.client-ip=217.70.183.193 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPA id B72CF240006; Tue, 28 May 2024 10:20:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1716891634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qsG4a+QexdrWaD9z2b31NrWRE7fUVEl7ydWLvlxj0hU=; b=eTYE/3jdhGs5GEmTPLjC0zOErFPdwpIx6cL82ctXvsH22SFUCPeUB17Hsoo6/SHf3kkiGV xdIxWufJv5otteYpxjkhpbOtucCY8cv0tNs9Sh8y7dYGQ3dbK8ZNbqcGdieCedb9ahbkvd aDpqUPn5El7xZnIcCjS9tP7Eu+ggm2v68DEssTyT8Qd9DkmQOnSzfixwG8faZ8q9Lo6ttz BH+PPK/KQu5/mI1pXUnZSdZaiMfhPJRXQlJZndR1ekCy8Gsbvl9KRbq5J6kxE9oXCIhouS 5AeZZ1ekOh28JdrPbzkQdZwA253A0j3QMDjQkZsmHwSRkRNyga/HxfCMAJOMeQ== From: Bastien Curutchet To: Vinod Koul , Kishon Vijay Abraham I , Bin Liu , Greg Kroah-Hartman Cc: linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Thomas Petazzoni , herve.codina@bootlin.com, christophercordahi@nanometrics.ca, Bastien Curutchet Subject: [PATCH 4/4] usb: musb: da8xx: Implement BABBLE recovery Date: Tue, 28 May 2024 12:20:26 +0200 Message-ID: <20240528102026.40136-5-bastien.curutchet@bootlin.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240528102026.40136-1-bastien.curutchet@bootlin.com> References: <20240528102026.40136-1-bastien.curutchet@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: bastien.curutchet@bootlin.com There is no specific behaviour implemented to recover from a babble error. When a BABBLE error happens, recovery fails as connected sticks are no longer detected by the USB controller. Implement the recover callback of the MUSB operation to reset the USB controller when a BABBLE happens. Signed-off-by: Bastien Curutchet --- drivers/usb/musb/da8xx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index c5cf733673a2..fcf06dcf2d61 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -220,6 +220,13 @@ static void __maybe_unused da8xx_musb_try_idle(struct musb *musb, unsigned long mod_timer(&musb->dev_timer, timeout); } +static int da8xx_babble_recover(struct musb *musb) +{ + dev_dbg(musb->controller, "resetting controller to recover from babble\n"); + musb_writel(musb->ctrl_base, DA8XX_USB_CTRL_REG, DA8XX_SOFT_RESET_MASK); + return 0; +} + static irqreturn_t da8xx_musb_interrupt(int irq, void *hci) { struct musb *musb = hci; @@ -480,6 +487,7 @@ static const struct musb_platform_ops da8xx_ops = { #ifndef CONFIG_USB_MUSB_HOST .try_idle = da8xx_musb_try_idle, #endif + .recover = da8xx_babble_recover, .set_vbus = da8xx_musb_set_vbus, }; -- 2.44.0