Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp550769rwr; Thu, 4 May 2023 06:50:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5BeemIBKsOFarpo5IgoMdrpp4TVJA2G/6qw4vj7J5Ft9KXDmjUHo+brhYFG7MUC0Gyw9gB X-Received: by 2002:a17:902:c40a:b0:1aa:d866:33cf with SMTP id k10-20020a170902c40a00b001aad86633cfmr5277057plk.56.1683208228667; Thu, 04 May 2023 06:50:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683208228; cv=none; d=google.com; s=arc-20160816; b=oTXRehNhZH2Fkp6WKa3QLU/UDbDA5FOZh6sPlxigbwWEUy0wOLtSriES3owlUg0m5p 3zrI0+/qIBGScGUhjLAp5s9ZP787aoz8y8zoAOGPupSBzDpLgl5+OCw/2ZgBsmOj3tXM hgJnRch8CUYy4Hxadsj3HPNBsUH8Yqh2pOdTHyDaAruexUiCmWU1qzKycj1KjNyubCJC YdqYR9xs3rjFfdD8pp2jWXOoeivyhkRMjDRYsJM/uXjmXSMuRBDLIzwtcb6WctIPPqfr trVjHjuwJ6RfsU3pJtOd/nsthgOL/bsE3LvDaRK19gjxMOtd2jLh34zodm9S8TAjZLYF m7XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=hGwUzuOQID0h6XkyzYjAS7zaFyA0FPpMEkxSvHgc0Mk=; b=JHi+RfYdzteDcuzFcmtP/19UvKB494qjhPp+rYhd7eSTEcacKZkSNF0Q5fMXIhfgt6 v05rvbPiTURtyHPwaLHPB0cU/kIUvunAiAbjsmXF/mqmIPRqFGP9i0XfLeMACzjM0mRr T3KXWb5PCfEsujsQmZQl+D/0XXGkeKP+bscM9bZxtubnr2jiTtMUCINZwE9FbWCeSAy3 mj02QR5Sy01736x5JHwSjMB9jzw54Eor0ZUBBXHXbl5x7gDVemABHZ/ft0tBELxUj/fz D2u3R+ylHGKW48oidUMuNnQsD0STLt3GNY3VT0HoUjRceqO2QXVUNhXGniJkJ6D/N5ki ZNqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z17-20020a170903019100b0019abec982c2si38250063plg.77.2023.05.04.06.50.11; Thu, 04 May 2023 06:50:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231222AbjEDNrm (ORCPT + 99 others); Thu, 4 May 2023 09:47:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231220AbjEDNrk (ORCPT ); Thu, 4 May 2023 09:47:40 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CF487AB7 for ; Thu, 4 May 2023 06:47:38 -0700 (PDT) Received: from dude02.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::28]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1puZIV-0004SX-S9; Thu, 04 May 2023 15:47:03 +0200 From: Marco Felsch Date: Thu, 04 May 2023 15:46:52 +0200 Subject: [PATCH v2 3/4] usb: typec: tcpci: clear the fault status bit MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230504-b4-v6-3-topic-boards-imx8mp-evk-dual-role-usb-v2-3-3889b1b2050c@pengutronix.de> References: <20230504-b4-v6-3-topic-boards-imx8mp-evk-dual-role-usb-v2-0-3889b1b2050c@pengutronix.de> In-Reply-To: <20230504-b4-v6-3-topic-boards-imx8mp-evk-dual-role-usb-v2-0-3889b1b2050c@pengutronix.de> To: andreas@fatal.se, jun.li@nxp.com, Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Heikki Krogerus , Guenter Roeck , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Marco Felsch X-Mailer: b4 0.12.1 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::28 X-SA-Exim-Mail-From: m.felsch@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According the "USB Type-C Port Controller Interface Specification v2.0" the TCPC sets the fault status register bit-7 (AllRegistersResetToDefault) once the registers have been reseted to their default values. This triggers an alert(-irq) on PTN5110 devices albeit we do mask the fault-irq. Fix this gernally by writing a one to the correspondig bit-7. Signed-off-by: Marco Felsch --- drivers/usb/typec/tcpm/tcpci.c | 5 +++++ include/linux/usb/tcpci.h | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c index 8da23240afbe..15632d023e4c 100644 --- a/drivers/usb/typec/tcpm/tcpci.c +++ b/drivers/usb/typec/tcpm/tcpci.c @@ -602,6 +602,11 @@ static int tcpci_init(struct tcpc_dev *tcpc) if (time_after(jiffies, timeout)) return -ETIMEDOUT; + regmap_read(tcpci->regmap, TCPC_FAULT_STATUS, ®); + if (reg & TCPC_FAULT_STATUS_ALL_REG_RST_TO_DEFAULT) + tcpci_write16(tcpci, TCPC_FAULT_STATUS, + TCPC_FAULT_STATUS_ALL_REG_RST_TO_DEFAULT); + /* Handle vendor init */ if (tcpci->data->init) { ret = tcpci->data->init(tcpci, tcpci->data); diff --git a/include/linux/usb/tcpci.h b/include/linux/usb/tcpci.h index 85e95a3251d3..83376473ac76 100644 --- a/include/linux/usb/tcpci.h +++ b/include/linux/usb/tcpci.h @@ -103,6 +103,7 @@ #define TCPC_POWER_STATUS_SINKING_VBUS BIT(0) #define TCPC_FAULT_STATUS 0x1f +#define TCPC_FAULT_STATUS_ALL_REG_RST_TO_DEFAULT BIT(7) #define TCPC_ALERT_EXTENDED 0x21 -- 2.39.2