Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp424713rwa; Sat, 20 Aug 2022 06:30:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR7SH/E7gr32Ub5zso6pTV0NWxlkqPLDBIQKyqSEmwW3YizS2gE3WttCsPZbFz2xoy1u3S5s X-Received: by 2002:a17:907:9484:b0:738:6f9f:6032 with SMTP id dm4-20020a170907948400b007386f9f6032mr7813592ejc.602.1661002240528; Sat, 20 Aug 2022 06:30:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661002240; cv=none; d=google.com; s=arc-20160816; b=mlKJcWAQBdyDH75laHqUoGOm3qTXw8gDmgIr83Co3Q0BB4G+4DDDdoqhS0/KoNW4NZ hFRQOSZVi8qLDvox10aMpmORn4ZecxM6cav0BxHjnqOcJmf68UAlSVpzKZWgnpc6flWQ ESlTGK9WsXE27Pjhm6WDlCI3NUuAbPYGVg6Q5Lcs+qd+ckCXnMTMJdxc40olmgiWJoQy fCwJsFTTbqFrgKt6g31bKRrPLlmEdDA5Ej/1phiAFWvN6EpMkSPG2oJWS3TmhjKwPp8B JTlbF/esV/fzRHoJsoXhQgYm3v9PBZRhp6HhUwhW2JFFfwS14RtNevjCUZe0KSDRhCWq Qtfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Wju/JycOewvIAVmCs/FYO1mPW8ioQwqWjJkyGCWKsb4=; b=HxtPcUdJkzr2eB8cVwNWgGiMG5E0cu6/buAXjlH3cUvICMZvTXe7ZGYu0aMQQ1G/2Q +eKtYCJ7aRfkkIVUZuKUIszkXK5E5OicZ7Y5pBK26eK1/qmPzUnxBBhEL7qgDUvUyNdr nKf4wDib2iSyBshbzaMNV/c8DNlXhrCSq8fxplFlQ7EUXxWIXUlXoq3CT8WpfmXA2w08 4+cd65J3K4Mt5YjazD1/6kyd0H9qkaEDDrCOpO7HVY0WMyFycUcVncB08z/DDpa9PTDK oVmUijvxsdyDFaccsQrEt/VHS+2FOjboHvmjgXjpzznAStGsNjNl4dxTiPjFe60gkD+L VRSQ== 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 hr40-20020a1709073fa800b0073177320828si6449285ejc.943.2022.08.20.06.30.14; Sat, 20 Aug 2022 06:30: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; 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 S1345953AbiHTMBA (ORCPT + 99 others); Sat, 20 Aug 2022 08:01:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243781AbiHTMA5 (ORCPT ); Sat, 20 Aug 2022 08:00:57 -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 0F99FA344E for ; Sat, 20 Aug 2022 05:00:56 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oPN9R-0001x5-Dv; Sat, 20 Aug 2022 14:00:29 +0200 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1oPN9O-0000zR-NS; Sat, 20 Aug 2022 14:00:26 +0200 Date: Sat, 20 Aug 2022 14:00:26 +0200 From: Oleksij Rempel To: Andrew Lunn Cc: Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, David Jander Subject: Re: [PATCH net-next v1 4/7] net: pse-pd: add generic PSE driver Message-ID: <20220820120026.GF10138@pengutronix.de> References: <20220819120109.3857571-1-o.rempel@pengutronix.de> <20220819120109.3857571-5-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@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=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 Fri, Aug 19, 2022 at 10:54:14PM +0200, Andrew Lunn wrote: > > +static int > > +gen_pse_podl_get_admin_sate(struct pse_controller_dev *pcdev, unsigned long id) > > Should that be state? ack. fixed. > > +{ > > + struct gen_pse_priv *priv = to_gen_pse(pcdev); > > + > > + /* aPoDLPSEAdminState can be different to aPoDLPSEPowerDetectionStatus > > + * which is provided by the regulator. > > + */ > > + return priv->admin_state; > > +} > > + > > +static int > > +gen_pse_podl_set_admin_control(struct pse_controller_dev *pcdev, > > + unsigned long id, > > + enum ethtool_podl_pse_admin_state state) > > +{ > > + struct gen_pse_priv *priv = to_gen_pse(pcdev); > > + int ret; > > + > > + if (priv->admin_state == state) > > + goto set_state; > > return 0; ? ack. done > > + platform_set_drvdata(pdev, priv); > > + > > + priv->admin_state = ETHTOOL_PODL_PSE_ADMIN_STATE_DISABLED; > > There is the comment earlier: > > /* aPoDLPSEAdminState can be different to aPoDLPSEPowerDetectionStatus > * which is provided by the regulator. > > Is this because the regulator might of been turned on, but it has > detected a short and turned itself off? So it is administratively on, > but off in order to stop the magic smoke escaping? ack. According to 30.15.1.1.3 aPoDLPSEPowerDetectionStatus, we may have following: /** * enum ethtool_podl_pse_pw_d_status - power detection status of the PoDL PSE. * IEEE 802.3-2018 30.15.1.1.3 aPoDLPSEPowerDetectionStatus: * @ETHTOOL_PODL_PSE_PW_D_STATUS_UNKNOWN: PoDL PSE * @ETHTOOL_PODL_PSE_PW_D_STATUS_DISABLED: "The enumeration “disabled” is * asserted true when the PoDL PSE state diagram variable mr_pse_enable is * false" * @ETHTOOL_PODL_PSE_PW_D_STATUS_SEARCHING: "The enumeration “searching” is * asserted true when either of the PSE state diagram variables * pi_detecting or pi_classifying is true." * @ETHTOOL_PODL_PSE_PW_D_STATUS_DELIVERING: "The enumeration “deliveringPower” * is asserted true when the PoDL PSE state diagram variable pi_powered is * true." * @ETHTOOL_PODL_PSE_PW_D_STATUS_SLEEP: "The enumeration “sleep” is asserted * true when the PoDL PSE state diagram variable pi_sleeping is true." * @ETHTOOL_PODL_PSE_PW_D_STATUS_IDLE: "The enumeration “idle” is asserted true * when the logical combination of the PoDL PSE state diagram variables * pi_prebiased*!pi_sleeping is true." * @ETHTOOL_PODL_PSE_PW_D_STATUS_ERROR: "The enumeration “error” is asserted * true when the PoDL PSE state diagram variable overload_held is true." */ Probably all of them, except of ETHTOOL_PODL_PSE_PW_D_STATUS_SEARCHING can be potentially implemented in this driver on top of regulator framework. > But what about the other way around? Something has already turned the > regulator on, e.g. the bootloader. Should the default be > ETHTOOL_PODL_PSE_ADMIN_STATE_DISABLED even thought power is being > delivered? Do we want to put the regulator into the off state at > probe, so it is in a well defined state? Or set priv->admin_state to > whatever regulator_is_enabled() indicates? Good question. I assume, automotive folks would love be able to enable regulator in the boot loader on the PSE to let the Powered Device boot parallel to the PSE. Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |