Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp594339rwr; Thu, 4 May 2023 07:17:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/PZ00Hn8a96sHk9vn/BPbqjhDevxFvb7Y+Au4SasXHAcb9/l28ziDOP8PkS1ldFmuE+jd X-Received: by 2002:a05:6a00:cc6:b0:63f:4a9:679b with SMTP id b6-20020a056a000cc600b0063f04a9679bmr3197946pfv.15.1683209860873; Thu, 04 May 2023 07:17:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683209860; cv=none; d=google.com; s=arc-20160816; b=m+4TRsSMQsRTnWygjOAfuGiDYYBF5CX1NnxT+Lh6S/CqbZI2TSY2QHrkZck3T9zb8j pDv9NuN/X+ugOCkKPu4dUxcUxVIq7YSFF1epkqeYvDL7kGXn/6p0KAqF9LloNCBJo25w 9qOumpziiHiOLRjwFDsjceGUjpWYneBSXw6+HLpfSfeDSAKjrT/QQ5vuJ1O90k2spAzr EgkKRJ97Gs/zw14l+RtBk86ikaGyOE6Uvm/Ap/h5Jcld3vUZhWDZ7puSzRTKDDJBUhd4 yh/hDWOE/7znoGj13rCyk2mbHRSGGma4YHA0FctpJ9dIHA/1cYd+6Bb83xKGby3GpPAS 304g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:sender:dkim-signature; bh=ZMOcf6cgy3EJL9X777q3uHwol0/+UlxMtzCPEFX8tV8=; b=hoB2uBeXm8ZFi/74jIq0Ez9bKCFqxk6qnjPwTON+zy9A6gbraIYbPKBS9U8oLRKKST N6hDrFJfBSN7w+aIiE/7NtRVCxvZOJi67wGNoAysPmyDrHfxM4Zd2Vp49jcIejc55WWv 2urh6/3IK4/IBdJuCsmLdZw1bI3gpd9XeRYH6mbgZntHoe+0RALQI6ymQUtcpZVtjxeA hzvtRLb7Do4jpE9rLrd4qi3r4zl0DbhjI35yo5ASZVrMwf48DisqK4uQPaj2wYWLuA/Z PH57HtbLHVG/fQ8+ZNJlQKnfWAdM00nltHQ1vI+EZsU0tmrzaM/SBtfDy+REkTZ4T9fL j4wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=oqNIruYX; 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 c15-20020a056a00008f00b0063b817e3f1esi35011839pfj.166.2023.05.04.07.17.03; Thu, 04 May 2023 07:17:40 -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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=oqNIruYX; 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 S230358AbjEDOI1 (ORCPT + 99 others); Thu, 4 May 2023 10:08:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230193AbjEDOIY (ORCPT ); Thu, 4 May 2023 10:08:24 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06C0B868D; Thu, 4 May 2023 07:08:22 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6436e075166so457634b3a.0; Thu, 04 May 2023 07:08:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683209301; x=1685801301; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:sender :from:to:cc:subject:date:message-id:reply-to; bh=ZMOcf6cgy3EJL9X777q3uHwol0/+UlxMtzCPEFX8tV8=; b=oqNIruYXCumhSceFrFEAT9XYgxpnUN0iDT1Spy0hHcVRH55kSoAhekEaAs+UXByAO3 1mtXMjJF0DbIfNCBRZnhmkXmFIEfFmpWG546ocqCxAeJ386hldOciUDYxUz7xlDw06oL 9uKqKnQXhhawWFxHgJ+K8ABRBQeaIjtd+mov0+on3BJuBCJyxf1mnAV/ipLbXLovIivj +kHeKB1adOnG2CIttQIspZvahQjjZ9wIoC9g8gLvOg8bsS5xCLEmwMrr29CBtMpy7MNx Z5oETK+Rdk5NRpczlBvTj0g3WXKb+OyeY9aWql83LKriZDa/Vt/+tilULMZf6YO4RGyW DcWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683209301; x=1685801301; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZMOcf6cgy3EJL9X777q3uHwol0/+UlxMtzCPEFX8tV8=; b=PEMGfpP4lz1FUnm8FnhHZ7poVXdQYoj/WZFS0Uz5wVcAkbYtPddutPVVrBdofSUw89 eqk5hplZO/4Tu/93gF3sWSQ4+SDuaFaJzLLuOhqQ695ipx2xl2UkhfHIFK8JdX3veNIl ympE+DEWtDROV2uYSrBrPLsZ6uRULafjHYoJy6G9TLEJeicrHJgAXil7giTk/8DFOyTy LpoJQ/6eiTwrhErhJQnSDs+PITKTjnQlilrap28fjOU6aIRe3tpLDtuiut2+tVomu0fQ 461vi20WW4SI7NunbaHBI2lbKIiDpXuabKCNNtDaN3MfsTZ0cqTR/beqdywsDdJmmACJ yW4A== X-Gm-Message-State: AC+VfDzm9db5zanW0ZoGrKac5GGyT+iIsYld88ddfs6PABWztXvPFGMn CdFoRnu0uplvdPSM/HHZg/s= X-Received: by 2002:a05:6a00:158c:b0:63b:5c82:e209 with SMTP id u12-20020a056a00158c00b0063b5c82e209mr3057104pfk.10.1683209301003; Thu, 04 May 2023 07:08:21 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id d7-20020aa78147000000b0063b7c42a070sm2576378pfn.68.2023.05.04.07.08.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 May 2023 07:08:20 -0700 (PDT) Sender: Guenter Roeck Message-ID: <6a894ff0-3232-4ef0-5e26-95471cc33ed9@roeck-us.net> Date: Thu, 4 May 2023 07:08:17 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Content-Language: en-US To: Marco Felsch , andreas@fatal.se, jun.li@nxp.com, Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Heikki Krogerus , 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 References: <20230504-b4-v6-3-topic-boards-imx8mp-evk-dual-role-usb-v2-0-3889b1b2050c@pengutronix.de> <20230504-b4-v6-3-topic-boards-imx8mp-evk-dual-role-usb-v2-3-3889b1b2050c@pengutronix.de> From: Guenter Roeck Subject: Re: [PATCH v2 3/4] usb: typec: tcpci: clear the fault status bit In-Reply-To: <20230504-b4-v6-3-topic-boards-imx8mp-evk-dual-role-usb-v2-3-3889b1b2050c@pengutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 On 5/4/23 06:46, Marco Felsch wrote: > 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 cleared ? set ? > 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 generically ? corresponding > 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, ®); Needs error check. Also, I am not sure if this is the correct place for this code. The alert status is cleared after vendor initialization. Should the same be done here ? Also, why not just write the bit unconditionally, similar to TCPC_ALERT ? Thanks, Guenter > + 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 > >