Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp920307rdg; Fri, 13 Oct 2023 05:24:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG3EDNm43rQIJnpFCxVM7n1N2c4LzifElM+7+lO2EECtfyJ7OaZmXrAGNuGyzLXemWn3H3U X-Received: by 2002:a17:90a:fe90:b0:27d:2109:6279 with SMTP id co16-20020a17090afe9000b0027d21096279mr4309965pjb.12.1697199894614; Fri, 13 Oct 2023 05:24:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697199894; cv=none; d=google.com; s=arc-20160816; b=ZElBCXEhDTUIBns+kdLoWPKct5qRlxoQ2HFpWsu1VJQy6Zi9Qjc02/YZUU/vO6JzJD LI3/Ff+SqqHab2hgPE5imUzQcmNmcbsQE6456uGtvb0Sq41kgVmCjYu4y3dPLZHEp9yb RN7uTvvPnnB50WJXL6/yh2vu0Ul8SmrWml3oLOVP/PbbRxXHWdEdfOWJiYoC5q8Ch6wL t+DKmkAcFjyNIHB7QHKoWlvocA7XWpMe054DQeQJ8pOyifsP/SVb7J/XUx1CK4Gh3n6D uE+1rb2t8/6/iEhZLIY/jbKnoNBgl5dXtxMFkmI85zHG88zKonsllkmcoV+UhCcJD76b YS0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=A9ILIrRKsu7eLJ9E9Khjt7ys7KTCTU6On668mTtQI/A=; fh=J4gjwt0mePoRaYCjaHLm28JnUFi5LyPM6ZZbSRFLAL0=; b=NzSfKom4/5c+dYw7YFuCeDKtNmJBK8uYDN4r7brv+K0ecmqcR5fTiELEMFr0l24yjg sD3tPgeLNQT+s2LbrCXh48F/VkeRDHoOP4Hh1NLFtD4kXohpURHcwyhXi4J22oYPGlFK YjW3Hfe3IDzKw+UsOdqddtXYjcKc5SfBPE4yavg4MFz/DMh+dIjyeeD4IUcal2ab1A7x 1kspLfjPf5a6+VRhLaq6dEoXQJFlahtOLQyQMX1etM83+zabNjdY1iYprqrpqdBrU50t 8Ci+K+nnWRGlPnm/74K/Q4arS5EosAG/INSrFRGf+8rpJPdsRyp5GHm3v/Lt3iOEKGHV KY5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id b22-20020a63d316000000b005890aa054fcsi4576574pgg.400.2023.10.13.05.24.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 05:24:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 256838313345; Fri, 13 Oct 2023 05:24:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231764AbjJMMYl (ORCPT + 99 others); Fri, 13 Oct 2023 08:24:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231723AbjJMMYa (ORCPT ); Fri, 13 Oct 2023 08:24:30 -0400 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B457FC0 for ; Fri, 13 Oct 2023 05:24:27 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qrHD6-00016I-4U; Fri, 13 Oct 2023 14:24:08 +0200 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qrHD5-001OKo-3b; Fri, 13 Oct 2023 14:24:07 +0200 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1qrHD4-00FiOR-3D; Fri, 13 Oct 2023 14:24:06 +0200 From: Oleksij Rempel To: "David S. Miller" , Andrew Lunn , Eric Dumazet , Florian Fainelli , Jakub Kicinski , Paolo Abeni , Vladimir Oltean , Woojung Huh , Arun Ramadoss , Conor Dooley , Krzysztof Kozlowski , Rob Herring Cc: Oleksij Rempel , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, UNGLinuxDriver@microchip.com, "Russell King (Oracle)" , devicetree@vger.kernel.org Subject: [PATCH net-next v3 6/7] net: dsa: microchip: use wakeup-source DT property to enable PME output Date: Fri, 13 Oct 2023 14:24:04 +0200 Message-Id: <20231013122405.3745475-7-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231013122405.3745475-1-o.rempel@pengutronix.de> References: <20231013122405.3745475-1-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.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 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 13 Oct 2023 05:24:53 -0700 (PDT) KSZ switches with WoL support signals wake event over PME pin. If this pin is attached to some external PMIC or System Controller can't be described as GPIO, the only way to describe it in the devicetree is to use wakeup-source property. So, add support for this property and enable PME switch output if this property is present. Signed-off-by: Oleksij Rempel --- drivers/net/dsa/microchip/ksz9477.c | 3 +++ drivers/net/dsa/microchip/ksz_common.c | 3 +++ drivers/net/dsa/microchip/ksz_common.h | 1 + 3 files changed, 7 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c index 8d51ec629d76..8035e14ac372 100644 --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -1241,6 +1241,9 @@ int ksz9477_setup(struct dsa_switch *ds) /* enable global MIB counter freeze function */ ksz_cfg(dev, REG_SW_MAC_CTRL_6, SW_MIB_COUNTER_FREEZE, true); + if (dev->wakeup_source) + ksz_write8(dev, REG_SW_PME_CTRL, PME_ENABLE); + return 0; } diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index bef1951fe6f2..820edda82cea 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -4240,6 +4240,9 @@ int ksz_switch_register(struct ksz_device *dev) dev_err(dev->dev, "inconsistent synclko settings\n"); return -EINVAL; } + + dev->wakeup_source = of_property_read_bool(dev->dev->of_node, + "wakeup-source"); } ret = dsa_register_switch(dev->ds); diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h index 43d0d8717eaa..80679f38ee12 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -163,6 +163,7 @@ struct ksz_device { phy_interface_t compat_interface; bool synclko_125; bool synclko_disable; + bool wakeup_source; struct vlan_table *vlan_cache; -- 2.39.2