From patchwork Thu Mar 9 22:35:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 67142 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp562527wrd; Thu, 9 Mar 2023 14:51:14 -0800 (PST) X-Google-Smtp-Source: AK7set+5B3HT/T8oJWOO+lAO0gHa3TVyZvWpOTVm5JXPcBDDxGPBFzM9E3rnykq/XNMZ5M497ZRy X-Received: by 2002:a05:6a20:840c:b0:cd:1e80:5840 with SMTP id c12-20020a056a20840c00b000cd1e805840mr29702265pzd.34.1678402273713; Thu, 09 Mar 2023 14:51:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678402273; cv=none; d=google.com; s=arc-20160816; b=AgePHLqOfJs5NRFuP54r2NZel3tN5E1PvJikh68790oCbyLaAW5QxTVI+g8WyYsErA 1UWT/aBpmWnfTCz3ILBJAo23foL3P5oWYcaKwTIyTw4F4QnJd35iGV1MMMjx77MazVzx Jz29/TAlQk7/z97H4VUIARhTuTPdXcZML/hIbdnUmHaD3sWSTXG8elC5UPY8S2JRDaWE qyUhILhHi1qOBT2ciWjDLqDkgjUgVikOY5AHCTSGvndv7UJVtC6Vc5ZLEmosyUQSQsqR C5XRaFear/g+P2aGIkMh+Y+utRKaRjwwOc0s51aGNZ5158vn/PU4ejTio6R9QtNeueei VQAQ== 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:to:from :dkim-signature; bh=76LV00udkXPQUwmYWl6PMAZgt1+JmaJY28CfXEIfxZA=; b=caaxhBXxAj0Ez/R8+jAGQdLZpH3bmcc/fZ6EEeB0odh9XlebJygLtq1dYca0iGKw7R CjLuowyueCW82i4UHYROD/U1dUKGj+9PZ2mOYxF1irf6RF+p0cXeZGyfhZquLdXgzndB EB4kg4E2CC+d7tiW1zFwDM9hjarA800zlbb0M2vuZC1oTF3Ev+SPooJqk1O8Ywu7xUpi BdI11m3MvozAIh4oHMliXfy6fel4EaPywKYwb0lxnKQPqN31dAT5fJBMUflc49mVaQ0c cNxXCRyMnie9Kk+yqnt0j2Lumtxh+gRMEN5Bod1xBgluqQjivOB5eqOzTJoK/KwbWgHC aLQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kGmrRGym; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a63ff41000000b005077dda047csi249372pgk.803.2023.03.09.14.50.59; Thu, 09 Mar 2023 14:51:13 -0800 (PST) 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=20210112 header.b=kGmrRGym; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231437AbjCIWiK (ORCPT + 99 others); Thu, 9 Mar 2023 17:38:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbjCIWiB (ORCPT ); Thu, 9 Mar 2023 17:38:01 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCFA27A84; Thu, 9 Mar 2023 14:37:59 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id j19-20020a05600c1c1300b003e9b564fae9so4765614wms.2; Thu, 09 Mar 2023 14:37:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678401478; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=76LV00udkXPQUwmYWl6PMAZgt1+JmaJY28CfXEIfxZA=; b=kGmrRGymM4KXv3p2daK6qNA4CyjMECD39z2HhDe0pT7ZEek364CCVqdK+HgebbR3dV ISnvWARvuOTIyQNnslRwauZjxVg10QJFNfnZhnLLkbJ6b9BHrTG+lKRxlHN2SIws9ZZf H9fvOwlf43/Vtja+WL+PfrX9PThWjAu3H4BXXtjTLtBM1m8N4XvDYFKrDhXf3Jj2N+3j VppzFhHXUx39g9BXVmliwyz4EujqWhRDv1k9LwgasM4ZFzq3ScpBu513mI9xiW411MVY KFSXf7MxNJwwKtuZtZjd1cAeJGJA85tEpLspSJ490jXw9n6cHCwpaMywLIPAu7jdZ0Ij t9+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678401478; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=76LV00udkXPQUwmYWl6PMAZgt1+JmaJY28CfXEIfxZA=; b=L6C/v3aQPyzALM/Iu+4OKavvU+8pxwmRKDXNnTzV7VY6vL6VwIuJXUrCjerpZCRfyp gFXH/+H0sZwbNz8hA8dCCwSKOFTvsKCvynutg3yCEja7IDI8RC62d46OdVX0cPce4+sr eOI7lADWwiSly0QX3poWO8cSBUZHA+FPrceqJ9kvp4NqkOniELPf1OQegJWHZsc+0gDk q0T3giJ/dyWGWx+RGupK1ijfuVjOoO25B3IHbCRRXyDrZ6uenzu+nKT/P8qr9BjaGvVc AcGkt649SFAc8exZAnC+uo64+1pS8moJvsnsLBD3ZjhwXofkuRtQywXVjv9cjAwChiKH er3w== X-Gm-Message-State: AO0yUKWU+z9UkuS7Xm/7GIxAvvH4XRMZeIPMJONscfE9RbxzAUFu0x02 L3dRn8Mj6mxxvK8vKhM8xcMWB9KkEkA= X-Received: by 2002:a05:600c:3ca7:b0:3da:2ba4:b97 with SMTP id bg39-20020a05600c3ca700b003da2ba40b97mr120602wmb.19.1678401478052; Thu, 09 Mar 2023 14:37:58 -0800 (PST) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id g12-20020a05600c310c00b003e209b45f6bsm1183981wmo.29.2023.03.09.14.37.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 14:37:57 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v2 01/14] net: dsa: qca8k: move qca8k_port_to_phy() to header Date: Thu, 9 Mar 2023 23:35:11 +0100 Message-Id: <20230309223524.23364-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230309223524.23364-1-ansuelsmth@gmail.com> References: <20230309223524.23364-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759932342304774246?= X-GMAIL-MSGID: =?utf-8?q?1759932342304774246?= Move qca8k_port_to_phy() to qca8k header as it's useful for future reference in Switch LEDs module since the same logic is applied to get the right index of the switch port. Make it inline as it's simple function that just decrease the port. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/dsa/qca/qca8k-8xxx.c | 15 --------------- drivers/net/dsa/qca/qca8k.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 2f224b166bbb..8dfc5db84700 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -716,21 +716,6 @@ qca8k_phy_eth_command(struct qca8k_priv *priv, bool read, int phy, return ret; } -static u32 -qca8k_port_to_phy(int port) -{ - /* From Andrew Lunn: - * Port 0 has no internal phy. - * Port 1 has an internal PHY at MDIO address 0. - * Port 2 has an internal PHY at MDIO address 1. - * ... - * Port 5 has an internal PHY at MDIO address 4. - * Port 6 has no internal PHY. - */ - - return port - 1; -} - static int qca8k_mdio_busy_wait(struct mii_bus *bus, u32 reg, u32 mask) { diff --git a/drivers/net/dsa/qca/qca8k.h b/drivers/net/dsa/qca/qca8k.h index 03514f7a20be..4e48e4dd8b0f 100644 --- a/drivers/net/dsa/qca/qca8k.h +++ b/drivers/net/dsa/qca/qca8k.h @@ -422,6 +422,20 @@ struct qca8k_fdb { u8 mac[6]; }; +static inline u32 qca8k_port_to_phy(int port) +{ + /* From Andrew Lunn: + * Port 0 has no internal phy. + * Port 1 has an internal PHY at MDIO address 0. + * Port 2 has an internal PHY at MDIO address 1. + * ... + * Port 5 has an internal PHY at MDIO address 4. + * Port 6 has no internal PHY. + */ + + return port - 1; +} + /* Common setup function */ extern const struct qca8k_mib_desc ar8327_mib[]; extern const struct regmap_access_table qca8k_readable_table; From patchwork Thu Mar 9 22:35:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 67138 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp560905wrd; Thu, 9 Mar 2023 14:46:51 -0800 (PST) X-Google-Smtp-Source: AK7set/G/E/XDp4df0hkcb210mo/mwRzJcoeLiIWZOV3bqb7X1FS34mVpyJLHG/2SB876zBSVBUp X-Received: by 2002:aa7:968e:0:b0:5aa:72c6:4a7d with SMTP id f14-20020aa7968e000000b005aa72c64a7dmr2952908pfk.16.1678402011185; Thu, 09 Mar 2023 14:46:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678402011; cv=none; d=google.com; s=arc-20160816; b=BWfROYqAJIwxkho9p76o73RbfIQ4INWxSrD99bc4kGOYmEA6SD8WNz5nkxb8i5HHDw fOLAKWfItJMYEBiSYawCylM+eslMRCvEQvY2z+Ch7vjnONTx8TmEj8vtouWzYqgR1ofZ K/oI51jzYRthQmTBiOF7LS1JvlKqwdGSmSYAAaLP0zGsSaLH7xKD7o/2ss2Zk834K3uE cL0E7+BF8i/z4Y/H6iyehc0H4Yjqn6lqZm6l2iZjkWvnS8LEIwSKnOVAXlCVLYp/bUOc 5yeIm8Rea35EWEOrKB/8vzS9iURGCkMsn5Gy9CM0l8wDbQUMB3EeHygFTagiX/NlVxQU AQOw== 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:to:from :dkim-signature; bh=R5QIXccLdikooU31j6nPRcsueMUDtDT9gBbA9i0LLOw=; b=spWS4khTv5P+LsG8bcSHWzN+xHBDDFg8LdwDouIV5vdfCZ+MScMxKMHxB1Ru59svdb 3ugOSY5m3WvNjDC+ty/h0mEK3GC/R2tsiAAJoyt2cBRcvDSQG33O8uzIktWycZKnTpbj fVCG9PLolXOZhXBaCwl26Gnn28k0SnJ0h9UlFd8BumxwSThTdWE5gdq5jWo/d076hS+a ynfovBfPl909ZW8xkU7t0+/+v/GRIbbR3sWG+y2ELqeGDZb2yVILyzPU0zfgd+LjjvL5 R9vZ8YlSL3ViYpf+8Uf02792McHz/5x89FtRSzllvjW/OEmGgRnqWBeVLw6I/tXolDha 9Q2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hyiqtzUH; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a127-20020a624d85000000b0058c800a75f6si224840pfb.335.2023.03.09.14.46.35; Thu, 09 Mar 2023 14:46:51 -0800 (PST) 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=20210112 header.b=hyiqtzUH; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230206AbjCIWiQ (ORCPT + 99 others); Thu, 9 Mar 2023 17:38:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231324AbjCIWiE (ORCPT ); Thu, 9 Mar 2023 17:38:04 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 575D8E04A; Thu, 9 Mar 2023 14:38:01 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id az36so2260695wmb.1; Thu, 09 Mar 2023 14:38:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678401480; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=R5QIXccLdikooU31j6nPRcsueMUDtDT9gBbA9i0LLOw=; b=hyiqtzUHkKxK5qITEC2ExCwbO7etmiwEJRdZv/bDnD4lDt7DcGMPy1+riGhcyYQoKW s9D1GTuANvS5wP6cW0cemOmA03pN2DCFwQAAQdMcdIstSLfsbmmo6hVWMyJhuoljsIdY rElcbjIFyhBTi+4vWOtmJq5bvl9FZEX2BFEVDSGmkVe/afQMu3jcdNsEFxLBYA5Cq06H vbDH6EAIou+zyfSX8k8uVeFnlToEYs2FrIvBkhwxOMGTmhSwqQUDyEdEgfq7Qw9k36qC l/Kbqa44Y250pBck8UTPr3cr6yXgeZZyWVGU/JCwTPPTTxHDctDkoJfeneHJaZPbfEjQ Z/Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678401480; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R5QIXccLdikooU31j6nPRcsueMUDtDT9gBbA9i0LLOw=; b=isoc2QQ+t4jKZDPCh0Nq/GRQIg3w2GhOEzHy0QhweqohHpxvQeL6UW2razToIHhp3B KiUEtOtsTVdZmftTWbhgdPvnrW6yv0uu35NmVTeVlWteAzP5N1eukZb75Wt8MbmVQi8B /vFeAv1y6S4tEQiZhVeYxzPHOfDdRjfIF+moexV8xgcANuepUeuB1ZL//9abuI7aOHH1 clOaK/34YLkTUpCCJnHy8f0Xj22qYl3qLE6f9FlMR6AXyQlZ4jwhnXf9hpui2EJ36SiR iN9sbyLUedoI4ZSHCcvYfX/mt+L9yWMSmtbi9XHiuRBBl7IHcmbjBcaeG3Q54bIW+HJv DiFg== X-Gm-Message-State: AO0yUKUu3XW78alXwbRU4G86lC01BoBG6TKr1GJsm6IGFsaw7XJOeLLY KbLOzKcmwbY53KKQaYT0Tvs= X-Received: by 2002:a05:600c:4746:b0:3dc:58a2:3900 with SMTP id w6-20020a05600c474600b003dc58a23900mr682560wmo.29.1678401479592; Thu, 09 Mar 2023 14:37:59 -0800 (PST) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id g12-20020a05600c310c00b003e209b45f6bsm1183981wmo.29.2023.03.09.14.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 14:37:59 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v2 02/14] net: dsa: qca8k: add LEDs basic support Date: Thu, 9 Mar 2023 23:35:12 +0100 Message-Id: <20230309223524.23364-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230309223524.23364-1-ansuelsmth@gmail.com> References: <20230309223524.23364-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759932067654782445?= X-GMAIL-MSGID: =?utf-8?q?1759932067654782445?= Add LEDs basic support for qca8k Switch Family by adding basic brightness_set() and brightness_get() support. Since these LEDs refelect port status, the default label is set to ":port". DT binding should describe the color, function and number of the leds using standard LEDs api. These LEDs supports only blocking variant of the brightness_set() function since they can sleep during access of the switch leds to set the brightness. While at it add to the qca8k header file each mode defined by the Switch Documentation for future use. Signed-off-by: Christian Marangi --- drivers/net/dsa/qca/Kconfig | 7 ++ drivers/net/dsa/qca/Makefile | 1 + drivers/net/dsa/qca/qca8k-8xxx.c | 4 + drivers/net/dsa/qca/qca8k-leds.c | 198 +++++++++++++++++++++++++++++++ drivers/net/dsa/qca/qca8k.h | 69 +++++++++++ 5 files changed, 279 insertions(+) create mode 100644 drivers/net/dsa/qca/qca8k-leds.c diff --git a/drivers/net/dsa/qca/Kconfig b/drivers/net/dsa/qca/Kconfig index ba339747362c..dab648f88391 100644 --- a/drivers/net/dsa/qca/Kconfig +++ b/drivers/net/dsa/qca/Kconfig @@ -15,3 +15,10 @@ config NET_DSA_QCA8K help This enables support for the Qualcomm Atheros QCA8K Ethernet switch chips. + +config NET_DSA_QCA8K_LEDS_SUPPORT + tristate "Qualcomm Atheros QCA8K Ethernet switch family LEDs support" + depends on NET_DSA_QCA8K + help + This enabled support for LEDs present on the Qualcomm Atheros + QCA8K Ethernet switch chips. diff --git a/drivers/net/dsa/qca/Makefile b/drivers/net/dsa/qca/Makefile index 701f1d199e93..330ae389e489 100644 --- a/drivers/net/dsa/qca/Makefile +++ b/drivers/net/dsa/qca/Makefile @@ -2,3 +2,4 @@ obj-$(CONFIG_NET_DSA_AR9331) += ar9331.o obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o qca8k-y += qca8k-common.o qca8k-8xxx.o +obj-$(CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT) += qca8k-leds.o diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 8dfc5db84700..fe68ac7e4030 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -1727,6 +1727,10 @@ qca8k_setup(struct dsa_switch *ds) if (ret) return ret; + ret = qca8k_setup_led_ctrl(priv); + if (ret) + return ret; + qca8k_setup_pcs(priv, &priv->pcs_port_0, 0); qca8k_setup_pcs(priv, &priv->pcs_port_6, 6); diff --git a/drivers/net/dsa/qca/qca8k-leds.c b/drivers/net/dsa/qca/qca8k-leds.c new file mode 100644 index 000000000000..7ae2ea082aae --- /dev/null +++ b/drivers/net/dsa/qca/qca8k-leds.c @@ -0,0 +1,198 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include + +#include "qca8k.h" + +static int +qca8k_get_enable_led_reg(int port_num, int led_num, struct qca8k_led_pattern_en *reg_info) +{ + switch (port_num) { + case 0: + reg_info->reg = QCA8K_LED_CTRL_REG(led_num); + reg_info->shift = QCA8K_LED_PHY0123_CONTROL_RULE_SHIFT; + break; + case 1: + case 2: + case 3: + /* Port 123 are controlled on a different reg */ + reg_info->reg = QCA8K_LED_CTRL_REG(3); + reg_info->shift = QCA8K_LED_PHY123_PATTERN_EN_SHIFT(port_num, led_num); + break; + case 4: + reg_info->reg = QCA8K_LED_CTRL_REG(led_num); + reg_info->shift = QCA8K_LED_PHY4_CONTROL_RULE_SHIFT; + break; + default: + return -EINVAL; + } + + return 0; +} + +static int +qca8k_led_brightness_set(struct qca8k_led *led, + enum led_brightness brightness) +{ + struct qca8k_led_pattern_en reg_info; + struct qca8k_priv *priv = led->priv; + u32 mask, val = QCA8K_LED_ALWAYS_OFF; + + qca8k_get_enable_led_reg(led->port_num, led->led_num, ®_info); + + if (brightness) + val = QCA8K_LED_ALWAYS_ON; + + if (led->port_num == 0 || led->port_num == 4) { + mask = QCA8K_LED_PATTERN_EN_MASK; + val <<= QCA8K_LED_PATTERN_EN_SHIFT; + } else { + mask = QCA8K_LED_PHY123_PATTERN_EN_MASK; + } + + return regmap_update_bits(priv->regmap, reg_info.reg, + mask << reg_info.shift, + val << reg_info.shift); +} + +static int +qca8k_cled_brightness_set_blocking(struct led_classdev *ldev, + enum led_brightness brightness) +{ + struct qca8k_led *led = container_of(ldev, struct qca8k_led, cdev); + + return qca8k_led_brightness_set(led, brightness); +} + +static enum led_brightness +qca8k_led_brightness_get(struct qca8k_led *led) +{ + struct qca8k_led_pattern_en reg_info; + struct qca8k_priv *priv = led->priv; + u32 val; + int ret; + + qca8k_get_enable_led_reg(led->port_num, led->led_num, ®_info); + + ret = regmap_read(priv->regmap, reg_info.reg, &val); + if (ret) + return 0; + + val >>= reg_info.shift; + + if (led->port_num == 0 || led->port_num == 4) { + val &= QCA8K_LED_PATTERN_EN_MASK; + val >>= QCA8K_LED_PATTERN_EN_SHIFT; + } else { + val &= QCA8K_LED_PHY123_PATTERN_EN_MASK; + } + + return val > 0 ? 1 : 0; +} + +static enum led_brightness +qca8k_cled_brightness_get(struct led_classdev *ldev) +{ + struct qca8k_led *led = container_of(ldev, struct qca8k_led, cdev); + + return qca8k_led_brightness_get(led); +} + +static int +qca8k_parse_port_leds(struct qca8k_priv *priv, struct fwnode_handle *port, int port_num) +{ + struct fwnode_handle *led = NULL, *leds = NULL; + struct led_init_data init_data = { }; + struct qca8k_led *port_led; + int led_num, port_index; + const char *state; + int ret; + + leds = fwnode_get_named_child_node(port, "leds"); + if (!leds) { + dev_dbg(priv->dev, "No Leds node specified in device tree for port %d!\n", + port_num); + return 0; + } + + fwnode_for_each_child_node(leds, led) { + /* Reg represent the led number of the port. + * Each port can have at least 3 leds attached + * Commonly: + * 1. is gigabit led + * 2. is mbit led + * 3. additional status led + */ + if (fwnode_property_read_u32(led, "reg", &led_num)) + continue; + + if (led_num >= QCA8K_LED_PORT_COUNT) { + dev_warn(priv->dev, "Invalid LED reg defined %d", port_num); + continue; + } + + port_index = 3 * port_num + led_num; + + port_led = &priv->ports_led[port_index]; + port_led->port_num = port_num; + port_led->led_num = led_num; + port_led->priv = priv; + + ret = fwnode_property_read_string(led, "default-state", &state); + if (!ret) { + if (!strcmp(state, "on")) { + port_led->cdev.brightness = 1; + qca8k_led_brightness_set(port_led, 1); + } else if (!strcmp(state, "off")) { + port_led->cdev.brightness = 0; + qca8k_led_brightness_set(port_led, 0); + } else if (!strcmp(state, "keep")) { + port_led->cdev.brightness = + qca8k_led_brightness_get(port_led); + } + } + + port_led->cdev.max_brightness = 1; + port_led->cdev.brightness_set_blocking = qca8k_cled_brightness_set_blocking; + port_led->cdev.brightness_get = qca8k_cled_brightness_get; + init_data.default_label = ":port"; + init_data.devicename = "qca8k"; + init_data.fwnode = led; + + ret = devm_led_classdev_register_ext(priv->dev, &port_led->cdev, &init_data); + if (ret) + dev_warn(priv->dev, "Failed to int led"); + } + + return 0; +} + +int +qca8k_setup_led_ctrl(struct qca8k_priv *priv) +{ + struct fwnode_handle *ports, *port; + int port_num; + int ret; + + ports = device_get_named_child_node(priv->dev, "ports"); + if (!ports) { + dev_info(priv->dev, "No ports node specified in device tree!\n"); + return 0; + } + + fwnode_for_each_child_node(ports, port) { + if (fwnode_property_read_u32(port, "reg", &port_num)) + continue; + + /* Each port can have at least 3 different leds attached. + * Switch port starts from 0 to 6, but port 0 and 6 are CPU + * port. The port index needs to be decreased by one to identify + * the correct port for LED setup. + */ + ret = qca8k_parse_port_leds(priv, port, qca8k_port_to_phy(port_num)); + if (ret) + return ret; + } + + return 0; +} diff --git a/drivers/net/dsa/qca/qca8k.h b/drivers/net/dsa/qca/qca8k.h index 4e48e4dd8b0f..25fab385f0f7 100644 --- a/drivers/net/dsa/qca/qca8k.h +++ b/drivers/net/dsa/qca/qca8k.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #define QCA8K_ETHERNET_MDIO_PRIORITY 7 @@ -85,6 +86,50 @@ #define QCA8K_MDIO_MASTER_DATA(x) FIELD_PREP(QCA8K_MDIO_MASTER_DATA_MASK, x) #define QCA8K_MDIO_MASTER_MAX_PORTS 5 #define QCA8K_MDIO_MASTER_MAX_REG 32 + +/* LED control register */ +#define QCA8K_LED_COUNT 15 +#define QCA8K_LED_PORT_COUNT 3 +#define QCA8K_LED_RULE_COUNT 6 +#define QCA8K_LED_RULE_MAX 11 + +#define QCA8K_LED_PHY123_PATTERN_EN_SHIFT(_phy, _led) ((((_phy) - 1) * 6) + 8 + (2 * (_led))) +#define QCA8K_LED_PHY123_PATTERN_EN_MASK GENMASK(1, 0) + +#define QCA8K_LED_PHY0123_CONTROL_RULE_SHIFT 0 +#define QCA8K_LED_PHY4_CONTROL_RULE_SHIFT 16 + +#define QCA8K_LED_CTRL_REG(_i) (0x050 + (_i) * 4) +#define QCA8K_LED_CTRL0_REG 0x50 +#define QCA8K_LED_CTRL1_REG 0x54 +#define QCA8K_LED_CTRL2_REG 0x58 +#define QCA8K_LED_CTRL3_REG 0x5C +#define QCA8K_LED_CTRL_SHIFT(_i) (((_i) % 2) * 16) +#define QCA8K_LED_CTRL_MASK GENMASK(15, 0) +#define QCA8K_LED_RULE_MASK GENMASK(13, 0) +#define QCA8K_LED_BLINK_FREQ_MASK GENMASK(1, 0) +#define QCA8K_LED_BLINK_FREQ_SHITF 0 +#define QCA8K_LED_BLINK_2HZ 0 +#define QCA8K_LED_BLINK_4HZ 1 +#define QCA8K_LED_BLINK_8HZ 2 +#define QCA8K_LED_BLINK_AUTO 3 +#define QCA8K_LED_LINKUP_OVER_MASK BIT(2) +#define QCA8K_LED_TX_BLINK_MASK BIT(4) +#define QCA8K_LED_RX_BLINK_MASK BIT(5) +#define QCA8K_LED_COL_BLINK_MASK BIT(7) +#define QCA8K_LED_LINK_10M_EN_MASK BIT(8) +#define QCA8K_LED_LINK_100M_EN_MASK BIT(9) +#define QCA8K_LED_LINK_1000M_EN_MASK BIT(10) +#define QCA8K_LED_POWER_ON_LIGHT_MASK BIT(11) +#define QCA8K_LED_HALF_DUPLEX_MASK BIT(12) +#define QCA8K_LED_FULL_DUPLEX_MASK BIT(13) +#define QCA8K_LED_PATTERN_EN_MASK GENMASK(15, 14) +#define QCA8K_LED_PATTERN_EN_SHIFT 14 +#define QCA8K_LED_ALWAYS_OFF 0 +#define QCA8K_LED_ALWAYS_BLINK_4HZ 1 +#define QCA8K_LED_ALWAYS_ON 2 +#define QCA8K_LED_RULE_CONTROLLED 3 + #define QCA8K_GOL_MAC_ADDR0 0x60 #define QCA8K_GOL_MAC_ADDR1 0x64 #define QCA8K_MAX_FRAME_SIZE 0x78 @@ -383,6 +428,19 @@ struct qca8k_pcs { int port; }; +struct qca8k_led_pattern_en { + u32 reg; + u8 shift; +}; + +struct qca8k_led { + u8 port_num; + u8 led_num; + u16 old_rule; + struct qca8k_priv *priv; + struct led_classdev cdev; +}; + struct qca8k_priv { u8 switch_id; u8 switch_revision; @@ -407,6 +465,7 @@ struct qca8k_priv { struct qca8k_pcs pcs_port_0; struct qca8k_pcs pcs_port_6; const struct qca8k_match_data *info; + struct qca8k_led ports_led[QCA8K_LED_COUNT]; }; struct qca8k_mib_desc { @@ -526,4 +585,14 @@ int qca8k_port_lag_join(struct dsa_switch *ds, int port, struct dsa_lag lag, int qca8k_port_lag_leave(struct dsa_switch *ds, int port, struct dsa_lag lag); +/* Leds Support function */ +#ifdef CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT +int qca8k_setup_led_ctrl(struct qca8k_priv *priv); +#else +static inline int qca8k_setup_led_ctrl(struct qca8k_priv *priv) +{ + return 0; +} +#endif + #endif /* __QCA8K_H */ From patchwork Thu Mar 9 22:35:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 67137 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp560832wrd; Thu, 9 Mar 2023 14:46:42 -0800 (PST) X-Google-Smtp-Source: AK7set8sx7frEOVjKYifyClc5kbZ6INXQ4ecIQQ1lDcROtRYx2UfwRf4TQhiX1PTo/Rp2uLrMuSk X-Received: by 2002:a17:90b:4c85:b0:234:b23:ead3 with SMTP id my5-20020a17090b4c8500b002340b23ead3mr24018064pjb.3.1678402002173; Thu, 09 Mar 2023 14:46:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678402002; cv=none; d=google.com; s=arc-20160816; b=w9k2uhzRbrpJ2UCLAubwU8U02NbbaXhqQlwjUIOYHP8LUs62OmXymgyIMSi0Soa2ur wLDY9kmpJuY5cXKfvTpc5wRJLsyDkyk0APLXKUYi7HAmPL7KGGjIUuM9jAGoKV2rzfhT UtB8CnEkU7usXzpYXir0kfG8FGqONxSGSv+Vgz9xRNv4JjfO41Lz+TFwwKaNWEllNIAz pRcE4xaL6RlBXZ5pKNWzUS1Fl4fOM55aU/iF7jrnCa6dIKUrzoVrqd1PHaHfJVGXp654 ChB+eEXdze4AXED7VRQqlu+lu0/KUyjzOkGv72rSb+xBILvQjWvnsjm72t92xDKRdE5h Dd2g== 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:to:from :dkim-signature; bh=jAjYaCokdDFeoHBYZ8ajEHyinrj2ay5j+y5y2pyEMkc=; b=jQKJkei7NjHNXZMKjBvgdO48YwAkYcdVukVbzCI+crGUF1z4r/KzeoZIcMro4xDx4B UZswkjx39kRjFWZSjh+M8Mc0olEZY1PfdSCoNmsZEiZfqri1XZxGdJkRIr3I1iQmo5vS 9nqA/+ewTp1CdsSQsZiJAHFoPUfOxptZ9Iy4YG45ZD0SC+Hj7XVNJ/AnCKVQsre3pQv6 xTk4rv3j8UIaAA0Gx8otFIKysnLVNgAuiRXx9oeqKzEMKtxgXVwWle9LClx/PiyIB/E8 8Pb6qnOyD4VJ29v97x02GQqmL1upH+o1zARpt17XewfpsOWz5CNoctVok4cxysi99HBx YA/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DirXdVf5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020a63e14e000000b00502d861f9e5si317063pgk.322.2023.03.09.14.46.26; Thu, 09 Mar 2023 14:46:42 -0800 (PST) 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=20210112 header.b=DirXdVf5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231490AbjCIWia (ORCPT + 99 others); Thu, 9 Mar 2023 17:38:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231338AbjCIWiE (ORCPT ); Thu, 9 Mar 2023 17:38:04 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C12A81913D; Thu, 9 Mar 2023 14:38:02 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id bg16-20020a05600c3c9000b003eb34e21bdfso4792713wmb.0; Thu, 09 Mar 2023 14:38:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678401481; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=jAjYaCokdDFeoHBYZ8ajEHyinrj2ay5j+y5y2pyEMkc=; b=DirXdVf5HBsEqP0FuGmWmFyGILlI68FKvJs+WbmYdTMj7rBphcg5E+Js76FQF1gUvb 3md+bEy9mi1Y90r1AWW7kvFU1Sixd0spfyHx8GPIG4OyAZzIs1j2n7rQc8qB8g//bO7w wzcebbNtq0XnDQgIA/mE4x8YUyBa2odPk2sv4tFY5VwdpFTI9XeUN8cWtVuhgog28LvS LCiuBLPF984KdIKG+IrrXPkJxHWAShwTN/Zz0vuIFIYWw55WrbIKWGu0Mu3sxJlm4nLC dhfrUHJGta0K0B+Yrw+r2BRAxL/eeBMycB2kyFT8RapdCLkTY6KsFbFxO7Ytjd+HMr/z PxWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678401481; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jAjYaCokdDFeoHBYZ8ajEHyinrj2ay5j+y5y2pyEMkc=; b=iWGta3DBc5fIpBcmPeNQ2dsu938DKN12L07bflPaImz69FtnVlnLqDC1uPNyV/D2Hl ykJT0EfNu/mb10LFp5EQkMM6fujTpzNOOWYd/MMfsHQlW2egF+GkrEZyDfDc7NBo950o DxoMTuP4Xm86GapGxfQLAmEw7nUoXLSjj4hxkareF5Z1G7k2Ut06rpEiJDbJBV07gSGu rEVKxfHoXYElRN0M6WvcDcafT4Oe3fCb2c+TfmfbOvE/ySBeWPk03ZroYtuDgqNakYet y5e+oksuPL4sTz/EdYtoAP4HmVqz3sv9dRxefeJiMq5OfOnJ4kaa4W3SD+S9o7w9tMiQ 3dYg== X-Gm-Message-State: AO0yUKW2iwOr7g+UkupD/2UdzKCUoFpD7dVqYz5VHmJzu0Yht2iuMvne 0Pj5e0gMPW6Tnptejaf2kqc= X-Received: by 2002:a05:600c:1553:b0:3d9:f769:2115 with SMTP id f19-20020a05600c155300b003d9f7692115mr752038wmg.26.1678401481047; Thu, 09 Mar 2023 14:38:01 -0800 (PST) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id g12-20020a05600c310c00b003e209b45f6bsm1183981wmo.29.2023.03.09.14.37.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 14:38:00 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v2 03/14] net: dsa: qca8k: add LEDs blink_set() support Date: Thu, 9 Mar 2023 23:35:13 +0100 Message-Id: <20230309223524.23364-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230309223524.23364-1-ansuelsmth@gmail.com> References: <20230309223524.23364-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759932057783400695?= X-GMAIL-MSGID: =?utf-8?q?1759932057783400695?= Add LEDs blink_set() support to qca8k Switch Family. These LEDs support hw accellerated blinking at a fixed rate of 4Hz. Reject any other value since not supported by the LEDs switch. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/dsa/qca/qca8k-leds.c | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/net/dsa/qca/qca8k-leds.c b/drivers/net/dsa/qca/qca8k-leds.c index 7ae2ea082aae..df7106d498db 100644 --- a/drivers/net/dsa/qca/qca8k-leds.c +++ b/drivers/net/dsa/qca/qca8k-leds.c @@ -98,6 +98,43 @@ qca8k_cled_brightness_get(struct led_classdev *ldev) return qca8k_led_brightness_get(led); } +static int +qca8k_cled_blink_set(struct led_classdev *ldev, + unsigned long *delay_on, + unsigned long *delay_off) +{ + struct qca8k_led *led = container_of(ldev, struct qca8k_led, cdev); + u32 mask, val = QCA8K_LED_ALWAYS_BLINK_4HZ; + struct qca8k_led_pattern_en reg_info; + struct qca8k_priv *priv = led->priv; + + if (*delay_on == 0 && *delay_off == 0) { + *delay_on = 125; + *delay_off = 125; + } + + if (*delay_on != 125 || *delay_off != 125) { + /* The hardware only supports blinking at 4Hz. Fall back + * to software implementation in other cases. + */ + return -EINVAL; + } + + qca8k_get_enable_led_reg(led->port_num, led->led_num, ®_info); + + if (led->port_num == 0 || led->port_num == 4) { + mask = QCA8K_LED_PATTERN_EN_MASK; + val <<= QCA8K_LED_PATTERN_EN_SHIFT; + } else { + mask = QCA8K_LED_PHY123_PATTERN_EN_MASK; + } + + regmap_update_bits(priv->regmap, reg_info.reg, mask << reg_info.shift, + val << reg_info.shift); + + return 0; +} + static int qca8k_parse_port_leds(struct qca8k_priv *priv, struct fwnode_handle *port, int port_num) { @@ -155,6 +192,7 @@ qca8k_parse_port_leds(struct qca8k_priv *priv, struct fwnode_handle *port, int p port_led->cdev.max_brightness = 1; port_led->cdev.brightness_set_blocking = qca8k_cled_brightness_set_blocking; port_led->cdev.brightness_get = qca8k_cled_brightness_get; + port_led->cdev.blink_set = qca8k_cled_blink_set; init_data.default_label = ":port"; init_data.devicename = "qca8k"; init_data.fwnode = led; From patchwork Thu Mar 9 22:35:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 67135 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp557731wrd; Thu, 9 Mar 2023 14:39:52 -0800 (PST) X-Google-Smtp-Source: AK7set8i9ZUvLMzsy9lAfUnajFLbszr/sotmOhZ6WqxvnEok6oz19qmkftn7MuQxqZv6qvUb1s0j X-Received: by 2002:a05:6a21:338a:b0:cc:b73a:6f63 with SMTP id yy10-20020a056a21338a00b000ccb73a6f63mr25746053pzb.4.1678401592291; Thu, 09 Mar 2023 14:39:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678401592; cv=none; d=google.com; s=arc-20160816; b=kCZiLnlLr7x9KrmXVcnkncr52tBb9NmyhY88FQvr4GHn6a6h3X0oi7axuiMNy9Jj+z AH6xjlqzzjw+Ow5pSWnK+vxIBT0tx6c88eMpdxYwR56CKV3UprVELrD9IrAjh43nXwV6 QxEgx3bVBvg5YrzX1YfoWsPF7UxNBZ4xneH8/KuGYQyQXsdyIxq1ZOcz7jJs1GEo96Yq WxGDltTyQFyM23+odZX4zj1NA2Y24jiH4Nng1+jV1P9sjjHzWiU0SRYow4nhyGw3EkBN dRzOMwi/tOZBAUL+CgoQBx7k6NgscdhGaAnHl1JXqSv5qipI7YDA2PRwP2f7ahmL3ztz Hmgg== 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:to:from :dkim-signature; bh=qIIOBe7NJABZRFq7ORmufJwFdwVU7XOjO161+6pddBo=; b=jnrFgxe6TfC6BfhW2jQj6Wyt4+g6j6+hVCVW85D4oMm8jWPdElQ+miw6MObXVVjdt4 rBMjFkMd9HBIj/mIuZ7lm4zUnRK3ZI77Lw24f0WK92Sk/xQsAow1BESOhRwDBztzDVnr sb8JXHiR9olrLSKt13l70QlpvhK7L3btVLhJ2Mjiuc2B6pjkshvAtK9Uj0TqHV5XB9n3 GppP9xWC334iuoTq7DjYKj7nzHcv0/8uPp+tHz+GBATAeqUFcK4BT0yeyp8RCAi/Kbxk 7lPr13Vz8EUeuGXbRHWhuzD18BzvW8JuxSVcfWjAvWClVROpC7dDIjpxA2Snk7Lmp6+X yUlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Masif1S0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a63f045000000b004fb20bf5812si225576pgj.729.2023.03.09.14.39.35; Thu, 09 Mar 2023 14:39:52 -0800 (PST) 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=20210112 header.b=Masif1S0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231434AbjCIWif (ORCPT + 99 others); Thu, 9 Mar 2023 17:38:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231383AbjCIWiG (ORCPT ); Thu, 9 Mar 2023 17:38:06 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F3E51EBCF; Thu, 9 Mar 2023 14:38:04 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id k37so2272155wms.0; Thu, 09 Mar 2023 14:38:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678401482; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=qIIOBe7NJABZRFq7ORmufJwFdwVU7XOjO161+6pddBo=; b=Masif1S0fO/HzOLeFOFiB9wUaUzXk71R88G2gPdZjJOK5uH7CWdu2lBiNDXnyYp6zF n7t04tdzPXMANF8t5p84W2pDfBQ2cp72X675hEbOWpVJgmhDeGEIBnvNXowmvt67F6h0 hybKlXa6QDci/obN006XsN6Hzzu2yMQ4NP1kRZusuXpu8YXRSNHM3O6BEO3dc7KAxVdw McBM9zkQtrGpPI1MeiZWhQ00w3M+uggIZRENPh/RHFIwYiow9lY69eakYR2DYR3YPWi6 mFBZS98oPPz2Gj9JnHv2k4IOcQN8Z8aUQ3ibxasgWPDItTWmTDLvyUUOZxmFhxAoWeue Ri+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678401482; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qIIOBe7NJABZRFq7ORmufJwFdwVU7XOjO161+6pddBo=; b=3NNfRL00EYiIUaziTZJuABEKle0j+887UmK8iUNqk7s0Yw2lYHSaVeNmzxI6+wetj2 f+EmbjmfwhSI7fouO6NYJdCwI0OMFlOMAKHkK3suytqAKwCeNscunl6Tl1w42KItrN3L jt6rpDSJIiPSb/RL1C7Ar3TPR/rT3BRRQyAOSK8DU5Lx24jrCeMdRxzGWaHNYL2xILbw excj5gt52X/QOS1/TFo0Js+M4Vwhy9uwPaazOp7crznXtBCgJeulXTdgzr7hhYRDh1DP phZP20eDi3CoajtyVV2YSSmdnE4Mit56bQXvyzs6PIJff1Y19n2ZsCA1K4CxvgWq4yBt ofKA== X-Gm-Message-State: AO0yUKXwlammP1besmYQVrJ03qHEX6GXPUCEmYhhkby3Y7pcrZGhc4Vj 6KqQzLcyMUTl4NSgknpCi8E5+tetbAE= X-Received: by 2002:a05:600c:1d84:b0:3eb:2de8:b72a with SMTP id p4-20020a05600c1d8400b003eb2de8b72amr769570wms.7.1678401482398; Thu, 09 Mar 2023 14:38:02 -0800 (PST) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id g12-20020a05600c310c00b003e209b45f6bsm1183981wmo.29.2023.03.09.14.38.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 14:38:02 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v2 04/14] net: phy: Add a binding for PHY LEDs Date: Thu, 9 Mar 2023 23:35:14 +0100 Message-Id: <20230309223524.23364-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230309223524.23364-1-ansuelsmth@gmail.com> References: <20230309223524.23364-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759931627845395604?= X-GMAIL-MSGID: =?utf-8?q?1759931627845395604?= From: Andrew Lunn Define common binding parsing for all PHY drivers with LEDs using phylib. Parse the DT as part of the phy_probe and add LEDs to the linux LED class infrastructure. For the moment, provide a dummy brightness function, which will later be replaced with a call into the PHY driver. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/phy_device.c | 89 ++++++++++++++++++++++++++++++++++++ include/linux/phy.h | 16 +++++++ 2 files changed, 105 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 9ba8f973f26f..8acade42615c 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -19,10 +19,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -658,6 +660,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, device_initialize(&mdiodev->dev); dev->state = PHY_DOWN; + INIT_LIST_HEAD(&dev->led_list); mutex_init(&dev->lock); INIT_DELAYED_WORK(&dev->state_queue, phy_state_machine); @@ -2964,6 +2967,85 @@ static bool phy_drv_supports_irq(struct phy_driver *phydrv) return phydrv->config_intr && phydrv->handle_interrupt; } +/* Dummy implementation until calls into PHY driver are added */ +static int phy_led_set_brightness(struct led_classdev *led_cdev, + enum led_brightness value) +{ + return 0; +} + +static int of_phy_led(struct phy_device *phydev, + struct device_node *led) +{ + struct device *dev = &phydev->mdio.dev; + struct led_init_data init_data = {}; + struct led_classdev *cdev; + struct phy_led *phyled; + int err; + + phyled = devm_kzalloc(dev, sizeof(*phyled), GFP_KERNEL); + if (!phyled) + return -ENOMEM; + + phyled->phydev = phydev; + cdev = &phyled->led_cdev; + INIT_LIST_HEAD(&phyled->led_list); + + err = of_property_read_u32(led, "reg", &phyled->index); + if (err) + return err; + + cdev->brightness_set_blocking = phy_led_set_brightness; + cdev->max_brightness = 1; + init_data.devicename = dev_name(&phydev->mdio.dev); + init_data.fwnode = of_fwnode_handle(led); + + err = devm_led_classdev_register_ext(dev, cdev, &init_data); + if (err) + return err; + + list_add(&phyled->led_list, &phydev->led_list); + + return 0; +} + +static int of_phy_leds(struct phy_device *phydev) +{ + struct device_node *node = phydev->mdio.dev.of_node; + struct device_node *leds, *led; + int err; + + if (!IS_ENABLED(CONFIG_OF_MDIO)) + return 0; + + if (!node) + return 0; + + leds = of_get_child_by_name(node, "leds"); + if (!leds) + return 0; + + for_each_available_child_of_node(leds, led) { + err = of_phy_led(phydev, led); + if (err) + return err; + } + + return 0; +} + +static void phy_leds_remove(struct phy_device *phydev) +{ + struct device *dev = &phydev->mdio.dev; + struct led_classdev *cdev; + struct phy_led *phyled; + + list_for_each_entry(phyled, &phydev->led_list, led_list) { + cdev = &phyled->led_cdev; + devm_led_classdev_unregister(dev, cdev); + } +} + /** * fwnode_mdio_find_device - Given a fwnode, find the mdio_device * @fwnode: pointer to the mdio_device's fwnode @@ -3142,6 +3224,11 @@ static int phy_probe(struct device *dev) /* Set the state to READY by default */ phydev->state = PHY_READY; + /* Get the LEDs from the device tree, and instantiate standard + * LEDs for them. + */ + of_phy_leds(phydev); + out: /* Assert the reset signal */ if (err) @@ -3156,6 +3243,8 @@ static int phy_remove(struct device *dev) { struct phy_device *phydev = to_phy_device(dev); + phy_leds_remove(phydev); + cancel_delayed_work_sync(&phydev->state_queue); mutex_lock(&phydev->lock); diff --git a/include/linux/phy.h b/include/linux/phy.h index fbeba4fee8d4..1b1efe120f0f 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -595,6 +596,7 @@ struct macsec_ops; * @phy_num_led_triggers: Number of triggers in @phy_led_triggers * @led_link_trigger: LED trigger for link up/down * @last_triggered: last LED trigger for link speed + * @led_list: list of PHY LED structures * @master_slave_set: User requested master/slave configuration * @master_slave_get: Current master/slave advertisement * @master_slave_state: Current master/slave configuration @@ -690,6 +692,7 @@ struct phy_device { struct phy_led_trigger *led_link_trigger; #endif + struct list_head led_list; /* * Interrupt number for this PHY @@ -825,6 +828,19 @@ struct phy_plca_status { bool pst; }; +/* phy_led: An LED driven by the PHY + * + * phydev: Pointer to the PHY this LED belongs to + * led_cdev: Standard LED class structure + * index: Number of the LED + */ +struct phy_led { + struct list_head led_list; + struct phy_device *phydev; + struct led_classdev led_cdev; + u32 index; +}; + /** * struct phy_driver - Driver structure for a particular PHY type * From patchwork Thu Mar 9 22:35:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 67147 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp562662wrd; Thu, 9 Mar 2023 14:51:36 -0800 (PST) X-Google-Smtp-Source: AK7set/TtSlZ+qIzX6xXGbrwcMKMfbUiQPN3aYTYnW2ZHXGaQeshBxsU2cBMzClvgDKWaVi5HUHz X-Received: by 2002:a17:902:cec6:b0:198:adc4:229d with SMTP id d6-20020a170902cec600b00198adc4229dmr212075plg.24.1678402296026; Thu, 09 Mar 2023 14:51:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678402296; cv=none; d=google.com; s=arc-20160816; b=gxom69A4vKc31J+MYSODAawq8sB1lUqKaSAf6tnQPuxmgFdNmR1d4D36EOdnkMLv+e 2mC/2Rab8ox9KGna6+U9z/Ev+9hiaPdqVBoKBzoawly2OrJHtANH9g627cZB8Mcj/dHr qbEBiCOocXUeyTg47YKrBXJa0uReYWLSlZfwcoM3hTL/+W82uQFP4Xhyu0r2TJdNT4UU 7k8r1czpAmvgFmXsQ0BbJnf0S9KNPtfD8q9zDwMVx2p8+AWcR7GRmFMfi+fN8KTnvJCC 0bxIs7/tFQKuFhUZ2AKlkaXRnDiG1zD9Mdn4Hd35TeTkrlN72zmT9Ui8lxRhZuSBEiDV fIaw== 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:to:from :dkim-signature; bh=tDRoLkLZ4ceS0IqWkmGrgNhXPijtgv6U26EGp7OciKo=; b=s8g64TjIegQZGFngnA9UxIjfpbK0bXfk5Ih8C7xKueUsIUHXw/cvjSBYI1MPRCYGcx r943P0THbTLjSlKoFNf1t83LPVBc5hHpBDJrclh8bMwCNFWYQ8YQ+fc7iAURNvqSTJLK anDNSAW/M35dko2Rwr3W4q7QgpvXuBhz1R97Q+Jz2R0jJKeobVRvkWDIvOmc0awQVWqf 1OPM0KnFSzSNHh8Fm3O0wosNi7vBV9jTy8Vuh7z86kOpSniuNV2FHUcnyDn0tP5kJlfb essxWI+1D7cOVxPPy9BBbUQY/TCn6dUgU2g9u//8CAFkXQOvreMnO2uMaR/YKDldK7ka clWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kJWeoVWr; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d18-20020a630e12000000b004faba8d86aesi324353pgl.300.2023.03.09.14.51.22; Thu, 09 Mar 2023 14:51:35 -0800 (PST) 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=20210112 header.b=kJWeoVWr; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231438AbjCIWij (ORCPT + 99 others); Thu, 9 Mar 2023 17:38:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231355AbjCIWiJ (ORCPT ); Thu, 9 Mar 2023 17:38:09 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCFB821A28; Thu, 9 Mar 2023 14:38:05 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id t25-20020a1c7719000000b003eb052cc5ccso4760621wmi.4; Thu, 09 Mar 2023 14:38:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678401484; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=tDRoLkLZ4ceS0IqWkmGrgNhXPijtgv6U26EGp7OciKo=; b=kJWeoVWro/WHEmM9GBnZFxWYJc70QnoBY+rdDq2a8KBy6TjLM8yjHHkgdk5dMJqHJ1 lD/CpHUPZddFSS+GgBAGOVZTTfhgOv80gAtBr9XHwH0UZ8zgHRFfH+BR3zZnxjT65wId oK2jgzZknCXw0sjnSs30GeLudFDz754/kfq1fCO/vO3F52JlUiR92aZd94IPImPiO4Zu WgtZMqu/k/ME5NVMUBeXB5+rRW6WmaOmC9xjYTaN5S/ApsnDNsUlt+OJccsIf41yywrf B927tJsAcnFWZrTYPwvQpEsvnxxJk7ihKeFObQ5H1CTptC3meSWJUb1yWOjRsn80d9Cl OzPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678401484; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tDRoLkLZ4ceS0IqWkmGrgNhXPijtgv6U26EGp7OciKo=; b=hxfO5jkirNgLBW3llTZWXy1WiRX0q5HFuNs1QgmTo6pB8e/jsGuD8CHF0NrsXxRBaY WvoPhjSoL+9+vRsx/ufQRRD9hkAkOr8/gTR7dery7RUzPliEXAIAHjkWBZAjukJNABur QtYVlfar8kSr+d9h/nRH7sfjcdTCw2Ti1CVxZ7NXMPACanEKgqT3sn+TeR6mxchj+3+o FdyUg1iDhV3IvPyhsGVAYmueIZajL/qG7ByzV0LCRojTAa6GvTXtOjXyFa+Dx3vwDbaI +qrfr9x3V2efz8lA67RbILbBsCZTu9sQmcO/c/uXSthjY0kSm/ZbF8soc0gmVAsfD8de SwkQ== X-Gm-Message-State: AO0yUKXhkGimwLfZmkwoiZDaMlNBu93/s+6xLgT9dKuiXUYjOiObpfNp bUCDnu3XDhSXzBHsYRtKBVnFkI8GtbA= X-Received: by 2002:a05:600c:3d88:b0:3eb:33fb:9dcf with SMTP id bi8-20020a05600c3d8800b003eb33fb9dcfmr732506wmb.5.1678401483775; Thu, 09 Mar 2023 14:38:03 -0800 (PST) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id g12-20020a05600c310c00b003e209b45f6bsm1183981wmo.29.2023.03.09.14.38.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 14:38:03 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v2 05/14] net: phy: phy_device: Call into the PHY driver to set LED brightness. Date: Thu, 9 Mar 2023 23:35:15 +0100 Message-Id: <20230309223524.23364-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230309223524.23364-1-ansuelsmth@gmail.com> References: <20230309223524.23364-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759932366009657796?= X-GMAIL-MSGID: =?utf-8?q?1759932366009657796?= From: Andrew Lunn Linux LEDs can be software controlled via the brightness file in /sys. LED drivers need to implement a brightness_set function which the core will call. Implement an intermediary in phy_device, which will call into the phy driver if it implements the necessary function. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/phy_device.c | 14 +++++++++++--- include/linux/phy.h | 9 +++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 8acade42615c..e4df4fcb6b05 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2967,11 +2967,18 @@ static bool phy_drv_supports_irq(struct phy_driver *phydrv) return phydrv->config_intr && phydrv->handle_interrupt; } -/* Dummy implementation until calls into PHY driver are added */ static int phy_led_set_brightness(struct led_classdev *led_cdev, enum led_brightness value) { - return 0; + struct phy_led *phyled = to_phy_led(led_cdev); + struct phy_device *phydev = phyled->phydev; + int err; + + mutex_lock(&phydev->lock); + err = phydev->drv->led_brightness_set(phydev, phyled->index, value); + mutex_unlock(&phydev->lock); + + return err; } static int of_phy_led(struct phy_device *phydev, @@ -2995,7 +3002,8 @@ static int of_phy_led(struct phy_device *phydev, if (err) return err; - cdev->brightness_set_blocking = phy_led_set_brightness; + if (phydev->drv->led_brightness_set) + cdev->brightness_set_blocking = phy_led_set_brightness; cdev->max_brightness = 1; init_data.devicename = dev_name(&phydev->mdio.dev); init_data.fwnode = of_fwnode_handle(led); diff --git a/include/linux/phy.h b/include/linux/phy.h index 1b1efe120f0f..83d3ed7485e0 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -841,6 +841,8 @@ struct phy_led { u32 index; }; +#define to_phy_led(d) container_of(d, struct phy_led, led_cdev) + /** * struct phy_driver - Driver structure for a particular PHY type * @@ -1063,6 +1065,13 @@ struct phy_driver { /** @get_plca_status: Return the current PLCA status info */ int (*get_plca_status)(struct phy_device *dev, struct phy_plca_status *plca_st); + + /* Set a PHY LED brightness. Index indicates which of the PHYs + * led should be set. Value follows the standard LED class meaning, + * e.g. LED_OFF, LED_HALF, LED_FULL. + */ + int (*led_brightness_set)(struct phy_device *dev, + u32 index, enum led_brightness value); }; #define to_phy_driver(d) container_of(to_mdio_common_driver(d), \ struct phy_driver, mdiodrv) From patchwork Thu Mar 9 22:35:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 67141 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp562379wrd; Thu, 9 Mar 2023 14:50:48 -0800 (PST) X-Google-Smtp-Source: AK7set/aKs5SCzO1SCcs1w0srRd+631fF0Nu5FX1XBk01QslfzJw6rWnawXG3LVLSdZINTzPBxHU X-Received: by 2002:a17:902:db0e:b0:19d:1c5:adb9 with SMTP id m14-20020a170902db0e00b0019d01c5adb9mr27839942plx.3.1678402248158; Thu, 09 Mar 2023 14:50:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678402248; cv=none; d=google.com; s=arc-20160816; b=BDach4pWmEi18qC7y7T6ynI4ZAe4d2Rl/guYmSjqO+LgafSa25d5fhPzn4m5zXRKnB YD2VZnRKK8zZ4Ae/xQd6ESS9/vDnuB/EAJJQVFzIhyQCeM+qHE2N2pgyV7UwmXvO8Yzn N2Ysh1k1YE+iNIC1xfwfdxMUkv1UdUce370Gn1dgE3meo1zK6SfwUazCut4MeXWUNR31 0MPRf5voWCDtee7XSjaM5gc2YFaV40FK5kV7Ckd+P6+IY9YbzxePrxr3AhUcDwBW121Y vjjoJdi5ImpFftY08QiFCQWCEGE02JYsG4hAte1q/hpWfOhwk6H6K1aE/35UVMXpDE2X SinA== 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:to:from :dkim-signature; bh=bhHnF/S3YeXHYbPEZLJBWZo9IBQDiim5+f+K7WIjxP8=; b=s+7i8pNDPxU1bE9eKlJzFwHkrKI530Xy2byAMibW+aOg9BT604vzpqX118QSuNYKe2 L3STrZT1Iw6JVuaUvJM7LDnkv6Aex2EMaXVD+dJwoTnAga+eckA+avLN4LcZmHXJ7lQs ltmW+gE6/SglV/Ti7irvIKyaDAcRAEsyRkcFe+riScpt6Z6xvC1088r42UM8mLkqJfVe 3vpyhwfdJBZZTK3Qs8tl4tcEw5HaspBpQ/LdV/4oLcmMf1NAgnZZ4J0rp4stLNk6nHQT fJ8xFiI23XJl4ppm8p8adHPI/9cFX4w1VG4t2ENnk1oJ4mS3Mkly3v4Uur/TTmQ1VhTD uW2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Msbj9ENR; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ka13-20020a170903334d00b0019cec510e68si408553plb.411.2023.03.09.14.50.36; Thu, 09 Mar 2023 14:50:48 -0800 (PST) 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=20210112 header.b=Msbj9ENR; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231509AbjCIWin (ORCPT + 99 others); Thu, 9 Mar 2023 17:38:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231417AbjCIWiK (ORCPT ); Thu, 9 Mar 2023 17:38:10 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A66427495; Thu, 9 Mar 2023 14:38:07 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id o11-20020a05600c4fcb00b003eb33ea29a8so2289937wmq.1; Thu, 09 Mar 2023 14:38:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678401485; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=bhHnF/S3YeXHYbPEZLJBWZo9IBQDiim5+f+K7WIjxP8=; b=Msbj9ENRk06fMPzEMv/Wyoa2FJc/S+oOh/LmsG4hUtjKlf3tgzGDGpNHL9v/H1oVke oVTXl1/sQNv1+SFz47L2EYMQJE4xMg/KVcQir4WZ0gselZs4+ktgDidvhi26KDOzUZBV ihgd6Gtn94F+ZkRo56y8cYXkO8JqkJ6GCJyYCchVkYorFCVmh5Xnv/DhgVNz7FIsWdcx vtjyOcaWyD0C5wD1s+TorbFKzIIB5HCxkl5BP+Hlic/yvtb6N8pY/rFYHW9AI2wzOiC0 Z4seoOMt1hW521xuqEtcTx4l37NArk7vNV6tQe+hCUa29dlZLh8PywA0392zn7BGtclV poKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678401485; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bhHnF/S3YeXHYbPEZLJBWZo9IBQDiim5+f+K7WIjxP8=; b=K0RAau43CxxQwCzmjz4efsmlQYNhsgi52PxMuOtg2GXHTtOThzoACpttf4HcVxHYPq G/9+RPsb9YP261Vl4wVS6g6MCfBGONNzehjJBKmrDZYM9zOvvSdpO2OBdoIt5IHNF5p8 vAlYIavQmgah4wM1HO8mazCzO6Ol67npy9bSY9fOnHaDEVwQTVzPrkfwmMyS5wERCW2J A5/9g4BQClHoqhuc1EvKUQb4An3IVciWP/Z1kqRgIYY90sIBNpEZehUCbweHQZBnwzs7 +y2w13K0DCIvxVGEMWBxZ4ZBrRpjf921GlqjiWLnTi2GgUtWw2qt4okH3w0JdXF2n3u+ OpHw== X-Gm-Message-State: AO0yUKVsBXFvkAWnm7P8X32Q7dviIcjmvemMz7LGdivgpFhPt29SDTPN 3zW3KRHmKRjklfs5OjUc/uo= X-Received: by 2002:a05:600c:3585:b0:3eb:2b88:5af1 with SMTP id p5-20020a05600c358500b003eb2b885af1mr763836wmq.18.1678401485180; Thu, 09 Mar 2023 14:38:05 -0800 (PST) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id g12-20020a05600c310c00b003e209b45f6bsm1183981wmo.29.2023.03.09.14.38.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 14:38:04 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v2 06/14] net: phy: marvell: Add software control of the LEDs Date: Thu, 9 Mar 2023 23:35:16 +0100 Message-Id: <20230309223524.23364-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230309223524.23364-1-ansuelsmth@gmail.com> References: <20230309223524.23364-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759932315575450481?= X-GMAIL-MSGID: =?utf-8?q?1759932315575450481?= From: Andrew Lunn Add a brightness function, so the LEDs can be controlled from software using the standard Linux LED infrastructure. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/marvell.c | 45 ++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 0d706ee266af..e44a4a26346a 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -144,11 +144,13 @@ /* WOL Event Interrupt Enable */ #define MII_88E1318S_PHY_CSIER_WOL_EIE BIT(7) -/* LED Timer Control Register */ -#define MII_88E1318S_PHY_LED_TCR 0x12 -#define MII_88E1318S_PHY_LED_TCR_FORCE_INT BIT(15) -#define MII_88E1318S_PHY_LED_TCR_INTn_ENABLE BIT(7) -#define MII_88E1318S_PHY_LED_TCR_INT_ACTIVE_LOW BIT(11) +#define MII_88E1318S_PHY_LED_FUNC 0x10 +#define MII_88E1318S_PHY_LED_FUNC_OFF (0x8) +#define MII_88E1318S_PHY_LED_FUNC_ON (0x9) +#define MII_88E1318S_PHY_LED_TCR 0x12 +#define MII_88E1318S_PHY_LED_TCR_FORCE_INT BIT(15) +#define MII_88E1318S_PHY_LED_TCR_INTn_ENABLE BIT(7) +#define MII_88E1318S_PHY_LED_TCR_INT_ACTIVE_LOW BIT(11) /* Magic Packet MAC address registers */ #define MII_88E1318S_PHY_MAGIC_PACKET_WORD2 0x17 @@ -2832,6 +2834,34 @@ static int marvell_hwmon_probe(struct phy_device *phydev) } #endif +static int m88e1318_led_brightness_set(struct phy_device *phydev, + u32 index, enum led_brightness value) +{ + u16 reg; + + reg = phy_read_paged(phydev, MII_MARVELL_LED_PAGE, + MII_88E1318S_PHY_LED_FUNC); + if (reg < 0) + return reg; + + switch (index) { + case 0: + case 1: + case 2: + reg &= ~(0xf << (4 * index)); + if (value == LED_OFF) + reg |= MII_88E1318S_PHY_LED_FUNC_OFF << (4 * index); + else + reg |= MII_88E1318S_PHY_LED_FUNC_ON << (4 * index); + break; + default: + return -EINVAL; + } + + return phy_write_paged(phydev, MII_MARVELL_LED_PAGE, + MII_88E1318S_PHY_LED_FUNC, reg); +} + static int marvell_probe(struct phy_device *phydev) { struct marvell_priv *priv; @@ -3081,6 +3111,7 @@ static struct phy_driver marvell_drivers[] = { .get_sset_count = marvell_get_sset_count, .get_strings = marvell_get_strings, .get_stats = marvell_get_stats, + .led_brightness_set = m88e1318_led_brightness_set, }, { .phy_id = MARVELL_PHY_ID_88E1145, @@ -3187,6 +3218,7 @@ static struct phy_driver marvell_drivers[] = { .cable_test_start = marvell_vct7_cable_test_start, .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, .cable_test_get_status = marvell_vct7_cable_test_get_status, + .led_brightness_set = m88e1318_led_brightness_set, }, { .phy_id = MARVELL_PHY_ID_88E1540, @@ -3213,6 +3245,7 @@ static struct phy_driver marvell_drivers[] = { .cable_test_start = marvell_vct7_cable_test_start, .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, .cable_test_get_status = marvell_vct7_cable_test_get_status, + .led_brightness_set = m88e1318_led_brightness_set, }, { .phy_id = MARVELL_PHY_ID_88E1545, @@ -3239,6 +3272,7 @@ static struct phy_driver marvell_drivers[] = { .cable_test_start = marvell_vct7_cable_test_start, .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, .cable_test_get_status = marvell_vct7_cable_test_get_status, + .led_brightness_set = m88e1318_led_brightness_set, }, { .phy_id = MARVELL_PHY_ID_88E3016, @@ -3380,6 +3414,7 @@ static struct phy_driver marvell_drivers[] = { .get_stats = marvell_get_stats, .get_tunable = m88e1540_get_tunable, .set_tunable = m88e1540_set_tunable, + .led_brightness_set = m88e1318_led_brightness_set, }, }; From patchwork Thu Mar 9 22:35:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 67136 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp559458wrd; Thu, 9 Mar 2023 14:44:14 -0800 (PST) X-Google-Smtp-Source: AK7set/Tzz4byVygaAv1R5ZlFbrLBzzXaU6T2qzwUGYg3U+Zez/9QsqSAWhYGRWO7EJQ4sKrAZ0Q X-Received: by 2002:a17:903:22c4:b0:19d:1897:8192 with SMTP id y4-20020a17090322c400b0019d18978192mr28099471plg.47.1678401854681; Thu, 09 Mar 2023 14:44:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678401854; cv=none; d=google.com; s=arc-20160816; b=DQIqpwVoZJBPwvnZqVycTMFD/4PuZdP7/6+gPPzaydeip0qA3qqXSHb6PNKJhS7T7E wowXz62wPg6oSQdRkzBO5cmbUhOCnqEaccjSKwkn7+4nKGLhmIIUh+h5zT5BJwZmBegq 0wBwT3DVwcRmDE48/K8NQFA7Fr8PuhEHUxl5SNYyxYb91izAyCnTmLAIgidxfa2R/QcV Eqch4F5UoDXGAW55KzOhKy0sAJkxOl0JZxtQZAsw0okJS8Oo5mGq+SprB/nFbYgEw2co e01qgN87LFLgLVZfy287rEwV6njidKaSSlWjp2y6VCxV7ffNJkxkYu1ZaLtdm3pXNi3V aZQQ== 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:to:from :dkim-signature; bh=cWl8tt6nddXYjDq6pzISEdAAK++EcnsjtXcgJ1R08pw=; b=AjizqmWfdqmQRDhBPyxea6c+2wJ6B6sL3wX93vrhC3hDyFw+NJ9QPHlw3oJXRvf3vU 7MjUTIOA+yFDk4Vke/iETxB9a53RoFAlEIGNMI393zKzbJ11EapV4NQ9qjq5h4XMKChg Zvmw5bCA5ScWhhEDtlWOR9h3cktXqLEVzWGMGuVmvOw8bu8W+9A/4n7BKsJyFWU3Dmgo HHif5Jq1lTYdg19+FgXRN3MFsgK0oyWpfW5C/eBsGyUGFIk4iP1iSwawNq0SF5qhCCo8 Ag7sAppoqNqA9ktuPO5Ro3In0HezHWSG+1RrcZj3nIzlEjl9UpZ/A+su0+FHnpvkrQd7 Ja+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JTu31Ve2; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a170903240600b001870c4d4378si397863plo.498.2023.03.09.14.43.57; Thu, 09 Mar 2023 14:44:14 -0800 (PST) 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=20210112 header.b=JTu31Ve2; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231520AbjCIWiw (ORCPT + 99 others); Thu, 9 Mar 2023 17:38:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231313AbjCIWiY (ORCPT ); Thu, 9 Mar 2023 17:38:24 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76347E04A; Thu, 9 Mar 2023 14:38:08 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id t25-20020a1c7719000000b003eb052cc5ccso4760681wmi.4; Thu, 09 Mar 2023 14:38:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678401487; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=cWl8tt6nddXYjDq6pzISEdAAK++EcnsjtXcgJ1R08pw=; b=JTu31Ve2uMOa0DO/Q88ivYP2vPQ4zDyJxtst3rMTz0vTYDCwb9tkhwc2CjoySBigGN 0vJy4MWyg/xSOXAdfCqXTDS0Uns/1cgJRiQleHi6NLW44vTRpCo7nAyk93QzwEznOCMX +5eYVjVRsYK6DoVRUPtvB15+8Ib9RETLrPmHbWIF+3O1xc69Fw7ZGLuT/U+kTehkOSHz mYojPGpg9Z8rmdjwgyGAmcvf8CLA2iYNTratgfT23fJGVMWTERPuHCNRol65R7C1H112 WLTotJZ15QqpY106x/SeZezoOqnvR8XcbhC+ye7UMfHhUKVwyNlJBtzNBU1pmqna8XZD W/xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678401487; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cWl8tt6nddXYjDq6pzISEdAAK++EcnsjtXcgJ1R08pw=; b=rw+s+6AasXDDW3XTbs/OvSt733Z1WDhrPu8F7cZvjTSHI5bE83J7j9WDCjsv8eC+fT UIElrnApOFEJtwTSk3voiXBNe/zAmTFPlAl1dyg5FoKQH1E82daOS7rPJ8MoJfCBELMb if7X+xLQTbPemAG9aji1tiG5I4kC38/qylLkb6BgAZcc0morqYysW4oyyogz/Y20dG9E ljPzXzXh39pLbrv8n1n3X4hIQH7gJuCEWpBc25v/F1KqLiOqk8trjCjnUx1s1c4OulCY VIaJgfTVjFXdzf3dl/CAof2cYmVrbOX0dzYqaQgo+KjweSEHIyzIiVZG7u5y3ZEgD4Xb yI7w== X-Gm-Message-State: AO0yUKU0QUtVHB6tt7P3PwnG7TRZtVnut4xtKmd8b/vfk8os/Jwn58PH AMdA/x+j7JPox538daoQkt8= X-Received: by 2002:a7b:c403:0:b0:3e2:669:757 with SMTP id k3-20020a7bc403000000b003e206690757mr144905wmi.10.1678401486594; Thu, 09 Mar 2023 14:38:06 -0800 (PST) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id g12-20020a05600c310c00b003e209b45f6bsm1183981wmo.29.2023.03.09.14.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 14:38:06 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v2 07/14] net: phy: phy_device: Call into the PHY driver to set LED blinking. Date: Thu, 9 Mar 2023 23:35:17 +0100 Message-Id: <20230309223524.23364-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230309223524.23364-1-ansuelsmth@gmail.com> References: <20230309223524.23364-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759931903461305419?= X-GMAIL-MSGID: =?utf-8?q?1759931903461305419?= From: Andrew Lunn Linux LEDs can be requested to perform hardware accelerated blinking. Pass this to the PHY driver, if it implements the op. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/phy_device.c | 18 ++++++++++++++++++ include/linux/phy.h | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index e4df4fcb6b05..ae8ec721353d 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2981,6 +2981,22 @@ static int phy_led_set_brightness(struct led_classdev *led_cdev, return err; } +static int phy_led_blink_set(struct led_classdev *led_cdev, + unsigned long *delay_on, + unsigned long *delay_off) +{ + struct phy_led *phyled = to_phy_led(led_cdev); + struct phy_device *phydev = phyled->phydev; + int err; + + mutex_lock(&phydev->lock); + err = phydev->drv->led_blink_set(phydev, phyled->index, + delay_on, delay_off); + mutex_unlock(&phydev->lock); + + return err; +} + static int of_phy_led(struct phy_device *phydev, struct device_node *led) { @@ -3004,6 +3020,8 @@ static int of_phy_led(struct phy_device *phydev, if (phydev->drv->led_brightness_set) cdev->brightness_set_blocking = phy_led_set_brightness; + if (phydev->drv->led_blink_set) + cdev->blink_set = phy_led_blink_set; cdev->max_brightness = 1; init_data.devicename = dev_name(&phydev->mdio.dev); init_data.fwnode = of_fwnode_handle(led); diff --git a/include/linux/phy.h b/include/linux/phy.h index 83d3ed7485e0..b1ac3c8a97e6 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1072,6 +1072,14 @@ struct phy_driver { */ int (*led_brightness_set)(struct phy_device *dev, u32 index, enum led_brightness value); + /* Activate hardware accelerated blink, delays are in milliseconds + * and if both are zero then a sensible default should be chosen. + * The call should adjust the timings in that case and if it can't + * match the values specified exactly. + */ + int (*led_blink_set)(struct phy_device *dev, u32 index, + unsigned long *delay_on, + unsigned long *delay_off); }; #define to_phy_driver(d) container_of(to_mdio_common_driver(d), \ struct phy_driver, mdiodrv) From patchwork Thu Mar 9 22:35:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 67145 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp562619wrd; Thu, 9 Mar 2023 14:51:30 -0800 (PST) X-Google-Smtp-Source: AK7set/M5zMK58gJ3P6A4R/UP4v08cK/jHsVJUv2wvq66+CQO7+YB1yRgM+Jc3QwU9jjsUSdO68X X-Received: by 2002:a05:6a20:3fa8:b0:cb:f92f:374e with SMTP id ay40-20020a056a203fa800b000cbf92f374emr21559652pzb.22.1678402289968; Thu, 09 Mar 2023 14:51:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678402289; cv=none; d=google.com; s=arc-20160816; b=zVltR/dVySS6xuHMdHTiLRz7JgWWHAl4crjXY4jZPEyUXu7pI25uYGa/egjKphwwbJ ds+0JuKG7639NDZKo84D7E5Gmz79YbGSk5bkA7qyBmOYubMZDb7uUd3UOInOhoP/ftkw 9KkteKAdZLKW9EWL7BMdXrphCLJV91IvCMaMHoTFY+m9L2whMDaFu84iFejv7Zd9OKUA IMixOB7fk518JrVBFKJPtOd/k6nbGaYKOT8nz/5rzYlksPCgXL5TKsoVmTzH/8spJJvh TDwgIC9e5tUWCOeoVzDDlam7uNVjMZfc0UbOLGCMmFmNgEAoxaBDN6tQXeSZUkJq/hA7 0DZQ== 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:to:from :dkim-signature; bh=mcPDqv1MH0gdrEhrxsDvDnbiYWzw+6vrk0oNxbr+mS0=; b=UpA6Kl+ecr8qjsUianftdFgvrTZmDqim04j8cxC8B3wzxqHDBx5D7rnqBO1trdQ9jf 4LYPvRTD5lLxUs0aywXVX/+Sn51WwI/ch/Dl6NjGL4XPkhqH3MisJ4n3jiVVclEDpaRP DglZj1e5tEvSu2cmRrVQlCe/6AU0L4iAUoH7lIFLd/nowPYFThBgeQ6Q8ie0W2PO1wSQ JJzSE8b0Rn30coc6cQT8BJx+zNmWI5d1nVwrX24/I7B6nkE6WNbAkVgXCt8podwTIAeW Sxe2f92rHubA2H5QfOPrnqB3paz6wmLDQKR9UbTyKj65dmocrMU3yzAfhJrUabDSHh16 aY9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UZZU3U5y; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j7-20020a625507000000b005a910b0445fsi333426pfb.28.2023.03.09.14.51.17; Thu, 09 Mar 2023 14:51:29 -0800 (PST) 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=20210112 header.b=UZZU3U5y; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231623AbjCIWj3 (ORCPT + 99 others); Thu, 9 Mar 2023 17:39:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231497AbjCIWii (ORCPT ); Thu, 9 Mar 2023 17:38:38 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBDA125E2F; Thu, 9 Mar 2023 14:38:09 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id p26so2248240wmc.4; Thu, 09 Mar 2023 14:38:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678401488; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=mcPDqv1MH0gdrEhrxsDvDnbiYWzw+6vrk0oNxbr+mS0=; b=UZZU3U5y9JkKuLbM1R9BY5P+i6lbdy/dbuK9ew8mtnHOjDhbcDjmjizbQsucNbtmOl af8PMhIyIYtDkggtZ6yFvCSGku+48/nryi2ftj2gM//t6x+CqsVrSfuo9CZWOra7+tj+ +7pNt/jsNzmlremUoIWJOflc48XvjRGdChiI7SPm3uC3t5t704+4zZSlp3oaX6tGWIIM NsosEEJF+PdQ3UwJFYNK+pZnmbJfNjBtilfZJWY/mhdinIGquMz/EzWiVs0u51VtZBAl 8EQIXKohawbcseSjNlMG6+SxUIq1B8E4/13wuZsBnyjIQ/wJQBtrPPV/sKE9t6O/zIuD yfiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678401488; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mcPDqv1MH0gdrEhrxsDvDnbiYWzw+6vrk0oNxbr+mS0=; b=PORl4ZB/YYnh+ndUt8RM/qdkZIHanLB8Fe6RovLep71vcIWdU58ad4r6If5kLV+k8Z m13QVAA1ynqxV3wyYgxwK8364clqVq5+BUSQJIOm1fY8NT0rmNDK/8kPLxU/Q+L4yff1 OJfKBWDYMlAcqFT3JmyEkZFAhfgD49EfMjCQhjE0Q/f5g4OkxXyQi9Bn+UmCxLzxZ8SZ tGPVBlbWG3BhQsjAB1SUTk855C35Z6Txi4TZj9kOLHgCzLHwS7tllmjGqf4beS6QmbOR mSw/5OoVljV2cIMaEWlokyKeHKjBH/C8jhZR+Y06ySQSoO326bIII/jMSUWwZbvO6Ogh RuPA== X-Gm-Message-State: AO0yUKX2+TX/47fCuOSudNBlTwcn1/CmvpBLyoIAppyiz3DuX1+K9RDe eZrv6ijphFUQ0c7CbvU3ARkNgDzTw68= X-Received: by 2002:a05:600c:4592:b0:3e2:201a:5bcc with SMTP id r18-20020a05600c459200b003e2201a5bccmr720942wmo.33.1678401488038; Thu, 09 Mar 2023 14:38:08 -0800 (PST) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id g12-20020a05600c310c00b003e209b45f6bsm1183981wmo.29.2023.03.09.14.38.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 14:38:07 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v2 08/14] net: phy: marvell: Implement led_blink_set() Date: Thu, 9 Mar 2023 23:35:18 +0100 Message-Id: <20230309223524.23364-9-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230309223524.23364-1-ansuelsmth@gmail.com> References: <20230309223524.23364-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759932359471765767?= X-GMAIL-MSGID: =?utf-8?q?1759932359471765767?= From: Andrew Lunn The Marvell PHY can blink the LEDs, simple on/off. All LEDs blink at the same rate, and the reset default is 84ms per blink, which is around 12Hz. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/marvell.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index e44a4a26346a..3252b15266e2 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -147,6 +147,8 @@ #define MII_88E1318S_PHY_LED_FUNC 0x10 #define MII_88E1318S_PHY_LED_FUNC_OFF (0x8) #define MII_88E1318S_PHY_LED_FUNC_ON (0x9) +#define MII_88E1318S_PHY_LED_FUNC_HI_Z (0xa) +#define MII_88E1318S_PHY_LED_FUNC_BLINK (0xb) #define MII_88E1318S_PHY_LED_TCR 0x12 #define MII_88E1318S_PHY_LED_TCR_FORCE_INT BIT(15) #define MII_88E1318S_PHY_LED_TCR_INTn_ENABLE BIT(7) @@ -2862,6 +2864,35 @@ static int m88e1318_led_brightness_set(struct phy_device *phydev, MII_88E1318S_PHY_LED_FUNC, reg); } +static int m88e1318_led_blink_set(struct phy_device *phydev, u32 index, + unsigned long *delay_on, + unsigned long *delay_off) +{ + u16 reg; + + reg = phy_read_paged(phydev, MII_MARVELL_LED_PAGE, + MII_88E1318S_PHY_LED_FUNC); + if (reg < 0) + return reg; + + switch (index) { + case 0: + case 1: + case 2: + reg &= ~(0xf << (4 * index)); + reg |= MII_88E1318S_PHY_LED_FUNC_BLINK << (4 * index); + /* Reset default is 84ms */ + *delay_on = 84 / 2; + *delay_off = 84 / 2; + break; + default: + return -EINVAL; + } + + return phy_write_paged(phydev, MII_MARVELL_LED_PAGE, + MII_88E1318S_PHY_LED_FUNC, reg); +} + static int marvell_probe(struct phy_device *phydev) { struct marvell_priv *priv; @@ -3112,6 +3143,7 @@ static struct phy_driver marvell_drivers[] = { .get_strings = marvell_get_strings, .get_stats = marvell_get_stats, .led_brightness_set = m88e1318_led_brightness_set, + .led_blink_set = m88e1318_led_blink_set, }, { .phy_id = MARVELL_PHY_ID_88E1145, @@ -3219,6 +3251,7 @@ static struct phy_driver marvell_drivers[] = { .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, .cable_test_get_status = marvell_vct7_cable_test_get_status, .led_brightness_set = m88e1318_led_brightness_set, + .led_blink_set = m88e1318_led_blink_set, }, { .phy_id = MARVELL_PHY_ID_88E1540, @@ -3246,6 +3279,7 @@ static struct phy_driver marvell_drivers[] = { .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, .cable_test_get_status = marvell_vct7_cable_test_get_status, .led_brightness_set = m88e1318_led_brightness_set, + .led_blink_set = m88e1318_led_blink_set, }, { .phy_id = MARVELL_PHY_ID_88E1545, @@ -3273,6 +3307,7 @@ static struct phy_driver marvell_drivers[] = { .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, .cable_test_get_status = marvell_vct7_cable_test_get_status, .led_brightness_set = m88e1318_led_brightness_set, + .led_blink_set = m88e1318_led_blink_set, }, { .phy_id = MARVELL_PHY_ID_88E3016, @@ -3415,6 +3450,7 @@ static struct phy_driver marvell_drivers[] = { .get_tunable = m88e1540_get_tunable, .set_tunable = m88e1540_set_tunable, .led_brightness_set = m88e1318_led_brightness_set, + .led_blink_set = m88e1318_led_blink_set, }, }; From patchwork Thu Mar 9 22:35:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 67148 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp562735wrd; Thu, 9 Mar 2023 14:51:50 -0800 (PST) X-Google-Smtp-Source: AK7set9tSC17RJu8HK9//UsigEaf8UtiEE1Sckl+c8BZnaoiUzPtksWQnzz+0oqF2uU788rKomW0 X-Received: by 2002:a62:3042:0:b0:5a8:31a1:2f05 with SMTP id w63-20020a623042000000b005a831a12f05mr20037346pfw.5.1678402310640; Thu, 09 Mar 2023 14:51:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678402310; cv=none; d=google.com; s=arc-20160816; b=KEyyuzQruv1k+rXLD7nsCVz2jvuHlXuGfYtyDgIa+78LEWwklVQd09Uu1Ut7NoLzI7 C3vaagCK+pqneqRNsDKsdF68OL9+xOzDbE0jPNQqnm1x1wRb+jtRL41HO/9xb3q7g0IF evkSsNBS7JQIdu809D+Mgmh3F5PAxlEwHMQ4GBEV93GrLLe6XB5lCzhOuXyeCbNeQeJo 2i59c1PNd6J0jgXEZAW1mtcwEhry0BC6oOxCfpzK2oaSvr9rxYygq8wrhV7ykrPG/U/e Ok5JOtCGu9By2SeMjULEczFbMdgTx459ygCnMRaob70f6zVqpYLEbhtfIwn3YemWvcKF aAQA== 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:to:from :dkim-signature; bh=WgoBUd5mOfOzbUIgE9ennXfu8Bk6ZG8n46SEtwJM8yA=; b=Vkeds1lM3PqmJ3j4HoYq8ygw0isjszeekAnnvfekdBtL0/SEHRib0HmekxHi25XhoB kerEqabYwO35271Mu6flV1co03GaCBkOzb1O10ykOOmYmKXkyrO5vDRzWH891qi8IQE9 y0ryS0OR2j6XkIOiEMdC/drtVPvQyS9R+X9p+V4nGD9c3Plm/Gqkczx2zSMVKX4JJRRM AByltm6UB/QUD0V30IE7/FflEZc9LvGaDydiHh/J85OB6IaU+Zz1RlH7n6bPo23jjYL8 8Zxy19S09npkxmhA05++fPlQbrjpkuFz/I/s9S6cs8ZLlnyWoKI6KCuZSUVJxP9dfCQl X2AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=H+NsYENR; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a625306000000b005a8da0b042bsi228279pfb.378.2023.03.09.14.51.38; Thu, 09 Mar 2023 14:51:50 -0800 (PST) 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=20210112 header.b=H+NsYENR; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231526AbjCIWjc (ORCPT + 99 others); Thu, 9 Mar 2023 17:39:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231527AbjCIWi4 (ORCPT ); Thu, 9 Mar 2023 17:38:56 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D24C5D880; Thu, 9 Mar 2023 14:38:11 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id l7-20020a05600c1d0700b003eb5e6d906bso2248645wms.5; Thu, 09 Mar 2023 14:38:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678401489; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=WgoBUd5mOfOzbUIgE9ennXfu8Bk6ZG8n46SEtwJM8yA=; b=H+NsYENR+8EzbAxFKg+zIE/cBeVSmrDAAzXByhMLc8G2et1gp51FNU0M66oY4Rb+0c f7TB14Z6bW/0FhzqUOlPJnDoSBcGUOgIdolmunAjYFtmcQ1MlFfIqxIf3avdkA7IbRJZ Llzz+Se3pMWOF+i24TcNidZ4QBnJc25hrrBbrkfHKjRnh1aexUealsE/XtsmfGoBeX1q /bEoWAt0z1cHWdD5GUNojHoR2OG4P+byRrLt+FfPMKg9sV+xIgcPqmRQINdhT4Os3KeC XazOQ0Mvfaljp/ahmfO7IeN4mA15gpqKEcjqG7hb6vGm7bCOKeQib1FD3RIsbbeDLb7V ZTjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678401489; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WgoBUd5mOfOzbUIgE9ennXfu8Bk6ZG8n46SEtwJM8yA=; b=wUYzShfb9FWa0kfH7Vr9tCB4vRwA8naHzA9QR9CISqn0NHilKKaKctGkbnkb2JC2yG f0z0MTXl/6ldyCEGkWOVHY84IYgrfV7szo2BIvZcc8Wfx6Fc0pZgjiBuDDyuFq81rc8a mLt0IFaOAVldEbN0CvhpU26yMQwO2BO2UK/vBzYGr7pnzoim7EWx5loW4QpuXLYpqx65 Sbeba5CyXGkyS965d7kcdjVDa806LmsPltWi9gBwAAiaXeGGJ42QX5MpeJj2kxz98gBH cod6vWaMwMAH3A9S1MbsypWJhCKVqXFYjsFRLXlw5nEpX7XPOXJKdxSDsxSgVy0rLEML +prQ== X-Gm-Message-State: AO0yUKX0xAdRvo+S6YQZIRnNse0i9dUnonl1Ol0JG7rQFxBj0XtmwFHQ 75qakF4SFOi0VWYU2JkLWbU= X-Received: by 2002:a1c:e913:0:b0:3eb:3912:5ae9 with SMTP id q19-20020a1ce913000000b003eb39125ae9mr689396wmc.24.1678401489517; Thu, 09 Mar 2023 14:38:09 -0800 (PST) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id g12-20020a05600c310c00b003e209b45f6bsm1183981wmo.29.2023.03.09.14.38.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 14:38:09 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v2 09/14] dt-bindings: net: dsa: dsa-port: Document support for LEDs node Date: Thu, 9 Mar 2023 23:35:19 +0100 Message-Id: <20230309223524.23364-10-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230309223524.23364-1-ansuelsmth@gmail.com> References: <20230309223524.23364-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759932380800076669?= X-GMAIL-MSGID: =?utf-8?q?1759932380800076669?= Document support for LEDs node in dsa port. Switch may support different LEDs that can be configured for different operation like blinking on traffic event or port link. Also add some Documentation to describe the difference of these nodes compared to PHY LEDs, since dsa-port LEDs are controllable by the switch regs and the possible intergated PHY doesn't have control on them. Signed-off-by: Christian Marangi --- .../devicetree/bindings/net/dsa/dsa-port.yaml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml index 480120469953..1bf4151e5155 100644 --- a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml +++ b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml @@ -59,6 +59,27 @@ properties: - rtl8_4t - seville + leds: + type: object + description: + Describes the LEDs associated by the Switch Port and controllable + in its MACs. These LEDs are not integrated in the PHY and PHY + doesn't have any control on them. Switch regs are used to control + these Switch Port LEDs. + + properties: + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + patternProperties: + '^led(@[a-f0-9]+)?$': + $ref: /schemas/leds/common.yaml# + + additionalProperties: false + # CPU and DSA ports must have phylink-compatible link descriptions if: oneOf: From patchwork Thu Mar 9 22:35:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 67146 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp562659wrd; Thu, 9 Mar 2023 14:51:35 -0800 (PST) X-Google-Smtp-Source: AK7set/XNWHmulQ+/oj4Zwb9w8RQG0KymYM1ulYa56MDWm2BxD6FR1s8Wrvw+Ci3te9S09AYlvRB X-Received: by 2002:a17:90b:1b4a:b0:237:b5d4:c0df with SMTP id nv10-20020a17090b1b4a00b00237b5d4c0dfmr23417798pjb.6.1678402295608; Thu, 09 Mar 2023 14:51:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678402295; cv=none; d=google.com; s=arc-20160816; b=GinTGBsUAmusspuFE8K6QPNejjQi9cXMfz85mS2Yb6mWs3jxg8TO7vuifk4or7mf8T RPdz0PeuzUSz9weZi+D9+18v7zdi6zxib3nxkBa0uEMToybaH/ERvVPB0R7jJEQ3Cpaz FuDWrX7wrhIFc7SB1S9Vu2zDGTIOBYyDMubkhYlHdyXONc7+ChnG84jUxRc3g5+vKkBc WmhaPLwpCeWcwF504agq1MIOhHEM6D8uIA9lAyCeCnWqUfY40bMXOEjuPQgaurjbOEI+ 5v38uw8KNPA3WBZanEmq9/BuLtPuMbsCJTXKzCVFc5uDQ6FuQ1+sRnpe2V8Tm0DqkfsM 5KJg== 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:to:from :dkim-signature; bh=1wDcE5BTiRUWu5IpXdTXJGaa7mTD/67d24QZlEDxG4g=; b=TxqncP93P3ifpOTvhlVIZ4vFwuntD2UwgzRfqzoAQRWDUkpP45Yb4C4jBbRKYH4621 h4FWgKECPeJ2Uz3IXz9jv8uEGWts9mwJ7rBwM9dnBfzSDezQJ15ThUk6RmvVCbDE+eUj O9iHg9JYo3oHOxtAI6Tp8DtQy18mWZYy9wi8DseyU7wCm8vqAA1YyVe+NtD8ONt970iF Z74Qb3snyAa45+7hwYHo3g2nAjwJMphEbOokbBlk3Ygg54iaZyJXnKQfc0KRVuA8wc4S lk32xApZR1teRiyncKflRjsn7F0K/8Pfr6uBUaW7Zv7QQmi3vN4Tw2cwVRv3X6tLEDjX qmnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nMUIAGY+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 84-20020a630657000000b0050028c526aasi323258pgg.270.2023.03.09.14.51.22; Thu, 09 Mar 2023 14:51:35 -0800 (PST) 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=20210112 header.b=nMUIAGY+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231596AbjCIWj0 (ORCPT + 99 others); Thu, 9 Mar 2023 17:39:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231473AbjCIWi0 (ORCPT ); Thu, 9 Mar 2023 17:38:26 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCB535B40F; Thu, 9 Mar 2023 14:38:11 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id bg16-20020a05600c3c9000b003eb34e21bdfso4792936wmb.0; Thu, 09 Mar 2023 14:38:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678401491; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=1wDcE5BTiRUWu5IpXdTXJGaa7mTD/67d24QZlEDxG4g=; b=nMUIAGY+Atog3NJeC0iVwCtwZ33VBxWlZDHiK1JCXPVAiMdBEifjkqmkHuLqpTWJze e/eyPzJmD4oJOhYkbmaXxO1B7VIY/4TlYQAsB3JSappMsobKhYB7DS1rhIkIGt0aLQom FVrcGC2oCc9Y8jodqa1FIiG6EHfvLPikewd4ZbA97akUmh+vBQJyuFiGGEntB+AKJkHl QMqy9Kvr5fwp3TicpklUCBp08NKSDB+ojKvwzTDt/ZU/9hXUPCAltM4kVcx6ftzSpDuH +bKya8uyLA6uEtTwr0UaT2dhuruKV1CL4Jdsg6ePqdegEqICWxdw5x6o8FpVlL7VKHze 5T9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678401491; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1wDcE5BTiRUWu5IpXdTXJGaa7mTD/67d24QZlEDxG4g=; b=qtXtHmt08cm4nHVcSWMsRp644uhyvXdhC38CmzjNh+1AEYrakUbm5wCmvHx2404WjT crWwLNK90yFEsj3LninxjP2HW5BiyeOOe0y4yDiv8vDN/0LmS7+/5nfNfVeMFCze66JF jye5IUhKB/56Bbxl3FTTtVMpfbNp54Wt5szinw0k3+JoA8R5PAjvQTYlN/4RAF8IGXl+ 4+I25/QazOKVJKVXktAzJ+z8N1R+uW9cWoQYmM6tjY9WsQm64Wh+bbCmQrR1FauZjJ/M 9dHbWopWX6PQU5eq4C+rZbrgRWB6fr1RiTmpXHcgj5CMbt+Vdy5Pq+pWs6RP+k+K/hlg d5zw== X-Gm-Message-State: AO0yUKVPUatrUTllT483HXSd4hQdliF9E0mS5+rPgi7lmnRn5d8AKfdy IxdUc07sgKinbv42IF8p7ps= X-Received: by 2002:a05:600c:1d88:b0:3e0:17d:aeaf with SMTP id p8-20020a05600c1d8800b003e0017daeafmr845627wms.7.1678401490932; Thu, 09 Mar 2023 14:38:10 -0800 (PST) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id g12-20020a05600c310c00b003e209b45f6bsm1183981wmo.29.2023.03.09.14.38.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 14:38:10 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v2 10/14] dt-bindings: net: dsa: qca8k: add LEDs definition example Date: Thu, 9 Mar 2023 23:35:20 +0100 Message-Id: <20230309223524.23364-11-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230309223524.23364-1-ansuelsmth@gmail.com> References: <20230309223524.23364-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759932365604710329?= X-GMAIL-MSGID: =?utf-8?q?1759932365604710329?= Add LEDs definition example for qca8k Switch Family to describe how they should be defined for a correct usage. Signed-off-by: Christian Marangi --- .../devicetree/bindings/net/dsa/qca8k.yaml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml index 389892592aac..866b3cc73216 100644 --- a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml +++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml @@ -18,6 +18,8 @@ description: PHY it is connected to. In this config, an internal mdio-bus is registered and the MDIO master is used for communication. Mixed external and internal mdio-bus configurations are not supported by the hardware. + Each phy have at least 3 LEDs connected and can be declared + using the standard LEDs structure. properties: compatible: @@ -117,6 +119,7 @@ unevaluatedProperties: false examples: - | #include + #include mdio { #address-cells = <1>; @@ -226,6 +229,27 @@ examples: label = "lan1"; phy-mode = "internal"; phy-handle = <&internal_phy_port1>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + default-state = "keep"; + }; + + led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + default-state = "keep"; + }; + }; }; port@2 { From patchwork Thu Mar 9 22:35:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 67140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp562324wrd; Thu, 9 Mar 2023 14:50:40 -0800 (PST) X-Google-Smtp-Source: AK7set+j+IoInQm35T6wAlidAHzQ05aNv8v6gDVPxT63+oRoEyWjb0goKBF3+qVxPgHGuv84+QQc X-Received: by 2002:a05:6a21:329b:b0:cc:c80f:fa6b with SMTP id yt27-20020a056a21329b00b000ccc80ffa6bmr27005662pzb.27.1678402239987; Thu, 09 Mar 2023 14:50:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678402239; cv=none; d=google.com; s=arc-20160816; b=SCknboTyMbgI2K2aOD9MNoDK9q86kjwLWzhKq4v7FaO55Zwx//sfCLbZ4lBUE7ifEV ax9N71vGhv9lBK1TTI2tkfq3JJwOJ+odKPodl2jh5z8w9jbK0i4qQzQtDz3SgJap6l23 3ffoINgCLGACP0nPUiypFw+LagUYPH9uhG1rxAbsSc9DwUNjRdLOrxwqVyGq+wSN2jmE wrp4yxuzV+qscE5yTR28Td/N1eMswDe3YNIJR5079k+vzQhXTfTqCVCt7qb3WlCs/65J G5ZvhVp0IjtAZu42F5wswF8y1CBeWyK2pnabsyRiQRrgjTOYHfY/chdluCzSkwm4xmEr AeWw== 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 :dkim-signature; bh=y2fNz2U3Pb1myw1nW6JzmHX3WnYBSrD+c2lY+3aHW8M=; b=Xi6v8EbOD7j3iEavcW6ijwZLtebz0dYPeC35GJEf5RvH1+6krnbU6MgSeVNn1FTM3i NY3jQOEfVq3wpg5/rDy0paTQ7OwzHYGiutpIiuxcBORHT1TzU1gDtKLjH4KCuE6ImyIA FAES8HgBhULsmLK+ge4Qg2WhVw1zewSif39xiiNUBbCui/H9xBi1NDMu62DWm7skXxXN I0E9aRBYx0EBjG4QChKyPG1hFJ15ncX+6Qex36s4NrcIfMAm6f7QMA665191rMUYG3JN AoV8IiItNfMD9h++TSnqL8Xpj2WDCxNpkwTHu0Ceo2rBkLuNhyR38lujRXB2QSUFhgLh 7BQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VMC1fBG5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t5-20020a625f05000000b005a90c913344si214703pfb.368.2023.03.09.14.50.24; Thu, 09 Mar 2023 14:50:39 -0800 (PST) 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=20210112 header.b=VMC1fBG5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231783AbjCIWkC (ORCPT + 99 others); Thu, 9 Mar 2023 17:40:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231466AbjCIWjX (ORCPT ); Thu, 9 Mar 2023 17:39:23 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 634EFF4D91; Thu, 9 Mar 2023 14:38:14 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id j19-20020a05600c191300b003eb3e1eb0caso4765769wmq.1; Thu, 09 Mar 2023 14:38:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678401493; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=y2fNz2U3Pb1myw1nW6JzmHX3WnYBSrD+c2lY+3aHW8M=; b=VMC1fBG5a3K5yvny/yfu3vMpe9zjjlud0NIygPwpOwT+VmqcbqoYNNCZxsIPj/Nkuq jDubkkDElPJNacWO6eQo1YxK8ryxwUlumbImj/ewzzLtsH21D1JQQvlNtzDyykixSXvz VK0bWIJ4nGy52WHPf2xccFng1l8E3ro6+469igHmB3pLmFce92kjl9gWcp1LfuvXXwEe vMEOXCYzGomnd+SLjdXS109KmDr7J6TAjcmjoRvobRWlQo8BbcpdPAK7H26VtO7hps9r RNrhz15q+v9p5mpE8Lj4XPTHHz9I1x9wA8fcXsIvvxoETMv70L2PjDZfhpn7ET4UTBt8 Y+bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678401493; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y2fNz2U3Pb1myw1nW6JzmHX3WnYBSrD+c2lY+3aHW8M=; b=4o/3tnwfNXveZkbj2NZ+FxxuZD7wrmA/rUQ+xJyQdHykNDLvNli5y9QgDwY4WR4HbF nQQJYZT0PiR+0xV1Pbc5RkoF8KkQjXUW7lUGyGrvBlAiLpgQeMwua5IaUehdR76g1eg6 olauaG01CIZWjFcxBbXxgc+K7TdFjxXh23HL+fvZpK0qI3Ch7qlcV8l2jsTg7TsiSCAi yx96FDKs1EUYf0lR4ugaOgJ7RQ8SgHmjS2SRxSvgUv/ZtZDuOt+V0rxztYBrmq7LbxL+ SuPrgfG05w/iBQoS6ZKf6hx6O6qpsN5d32dQTGsvOnUQmGYL2/7cmleaKTpnFf/L+XPJ NQrg== X-Gm-Message-State: AO0yUKVtJ34QeZyQ5UiE2RhmklA53aWCPhElmBo7QHxGNK6M9wW9u3e2 G8it9N+s2UOgKR0QTBRV2LNTd83uX8s= X-Received: by 2002:a05:600c:b8e:b0:3e0:98c:dd93 with SMTP id fl14-20020a05600c0b8e00b003e0098cdd93mr707470wmb.29.1678401492562; Thu, 09 Mar 2023 14:38:12 -0800 (PST) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id g12-20020a05600c310c00b003e209b45f6bsm1183981wmo.29.2023.03.09.14.38.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 14:38:12 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Cc: Jonathan McDowell Subject: [net-next PATCH v2 11/14] arm: qcom: dt: Drop unevaluated properties in switch nodes for rb3011 Date: Thu, 9 Mar 2023 23:35:21 +0100 Message-Id: <20230309223524.23364-12-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230309223524.23364-1-ansuelsmth@gmail.com> References: <20230309223524.23364-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759932307178948314?= X-GMAIL-MSGID: =?utf-8?q?1759932307178948314?= IPQ8064 MikroTik RB3011UiAS-RM DT have currently unevaluted properties in the 2 switch nodes. The bindings #address-cells and #size-cells are redundant and cause warning for 'Unevaluated properties are not allowed'. Drop these bindings to mute these warning as they should not be there from the start. Cc: Jonathan McDowell Signed-off-by: Christian Marangi --- arch/arm/boot/dts/qcom-ipq8064-rb3011.dts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/arm/boot/dts/qcom-ipq8064-rb3011.dts b/arch/arm/boot/dts/qcom-ipq8064-rb3011.dts index f908889c4f95..47a5d1849c72 100644 --- a/arch/arm/boot/dts/qcom-ipq8064-rb3011.dts +++ b/arch/arm/boot/dts/qcom-ipq8064-rb3011.dts @@ -38,8 +38,6 @@ mdio0: mdio-0 { switch0: switch@10 { compatible = "qca,qca8337"; - #address-cells = <1>; - #size-cells = <0>; dsa,member = <0 0>; @@ -105,8 +103,6 @@ mdio1: mdio-1 { switch1: switch@14 { compatible = "qca,qca8337"; - #address-cells = <1>; - #size-cells = <0>; dsa,member = <1 0>; From patchwork Thu Mar 9 22:35:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 67144 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp562594wrd; Thu, 9 Mar 2023 14:51:24 -0800 (PST) X-Google-Smtp-Source: AK7set/a7BQmadBQOSRINYD81FIB9cJ2diAah5R5mv1LEsms/UzuUiXPRlwsoX2WoxH6Lf+A4Jrv X-Received: by 2002:a17:902:b489:b0:19e:29ce:697f with SMTP id y9-20020a170902b48900b0019e29ce697fmr21667930plr.41.1678402284658; Thu, 09 Mar 2023 14:51:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678402284; cv=none; d=google.com; s=arc-20160816; b=x0YKsMVhm3dufVvWonPJCxbx/xXt0nhLT8R9EuqkKVrSaAUkg7KFnuGcZD2/6FmPPL Old3ieXqRyYfAYzX2loyD6tT0/qq21nf7ErDFlabeciv7zpZHrQe0D8yHHZeFCLNgwy3 V/AICxGxk/pdi3HQhveH+tXmvq0QDYmNRbgQsSvOKvNyo6uIOY7NmRzIlg6f37I5EnEy YIJw7AAbVOQGlRPbLB7h3gOlTvIEerWymxJpCuxum3Bn8Qser297PfGCkFXs3uZHok71 /42a0EjKHACB5cxX4lSejnkNXzFlkaw2ykFkNoOhaTmjLezdpqA7/N7KmYti8gr6CFMT FCqA== 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 :dkim-signature; bh=4yEvSncVqO5CEElyQ6q0WPYP3z8pHrofnI3Ooo06uR0=; b=DtQNlFFRgExBKbUiYAeQmzIlW/DZCAjnH+uj8HQ7jZ+LR9uh9cARFpwBc3i8g3O4fM 3zVKegjpWlkwmfQp4qGMj062gU1K5FMh2KJMJ9Z1JC/NeDZzHi0F1lnqfEfgUY4Hbj9a VFTS7nJjz9Zhae/jPEwfztYnjt7xYsQcTvM+tV7Wm0E/fnJGwSqqjgSEEapbd/d2TLsx QhSzCYcs383/HnS5a/uxNGVJkU4b4X9zP2073SZIrnIJh0DLLw9p2bdCxgx4qqZZtdx6 AeB+iqbPh0UgVr0brmDNoRJywjph1Uk8CVvw31Mv6Vg1L8RmDB/4wrI1Y+udZdwdprVH xfzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=AlBX5JNq; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k19-20020a170902ba9300b0019a6ca56219si407281pls.313.2023.03.09.14.51.11; Thu, 09 Mar 2023 14:51:24 -0800 (PST) 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=20210112 header.b=AlBX5JNq; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231658AbjCIWju (ORCPT + 99 others); Thu, 9 Mar 2023 17:39:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231461AbjCIWjJ (ORCPT ); Thu, 9 Mar 2023 17:39:09 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61B6029175; Thu, 9 Mar 2023 14:38:14 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id t25-20020a1c7719000000b003eb052cc5ccso4760839wmi.4; Thu, 09 Mar 2023 14:38:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678401494; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4yEvSncVqO5CEElyQ6q0WPYP3z8pHrofnI3Ooo06uR0=; b=AlBX5JNqNXAA55d3QNsdibcq4SPn1jBTkVAfacjnB4w4Ii8+3mcse308G5N5GI6pFn 9f2UiyqJkbwAyvmIZzeh+1+TELyESzYdb+/qTUmaXeyGR46rjDEfNaKXUAqufwBow76r T4ZsBIwKn6VQxDcaYsqof/HYSMf/+b8BoDGQDUSTiYlNuUa0TIs+mJWJHdrpAqVZvYuE 9EaGXdX7d5DMgvH57SEPQfv5FBR/BZlj7p+hNChe7qmyos5swlOkrH2JmNvvrmeqcZTa o+0dp+4Z99vBqmvHzy63tHn+nBh5wRvFuB8iOc5HWRmYC5re0V3Ct7zdR1xk1e0J8O4m i8qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678401494; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4yEvSncVqO5CEElyQ6q0WPYP3z8pHrofnI3Ooo06uR0=; b=jYmrwqL0GN2K+mLRfs0yL3YVCz86seWX/4ONG/imvJm9jy5Gc6s2e7fe724yixfvax /wCE/GwFi84LSyd0VobgTxzOgecIFZlrACIdjdVUnWe1uErnjiXkifL4sCJbUWo66tV1 w2KahbsY654LWHek8nMhmSTN+1d96tcUSqkNfldKd/WIurrBNXtNX+Am0GresfE9a/07 X6ODNerJTdku2SeXyLAZEtrkdD2bPWeslkxA6elAkeWgO4nkTYf6hU2ld74QS8WYNRjt VzHQzUieI/ilS+947ZuxDaYb3qdmdNoU1s5ZwCyS9Tc9Up0IRJ8mWbsySBCy5TwFNIkJ pzNQ== X-Gm-Message-State: AO0yUKXkfn8TUeyJINqPXdxqyxKGE00yhz/xDhftBf/O2HSu/P5K0S+c tzesy7x7P5QV9hF2waHVFpM= X-Received: by 2002:a05:600c:a41:b0:3eb:9822:f0 with SMTP id c1-20020a05600c0a4100b003eb982200f0mr665189wmq.30.1678401494076; Thu, 09 Mar 2023 14:38:14 -0800 (PST) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id g12-20020a05600c310c00b003e209b45f6bsm1183981wmo.29.2023.03.09.14.38.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 14:38:13 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Cc: Jonathan McDowell Subject: [net-next PATCH v2 12/14] arm: qcom: dt: Add Switch LED for each port for rb3011 Date: Thu, 9 Mar 2023 23:35:22 +0100 Message-Id: <20230309223524.23364-13-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230309223524.23364-1-ansuelsmth@gmail.com> References: <20230309223524.23364-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759932354049022698?= X-GMAIL-MSGID: =?utf-8?q?1759932354049022698?= Add Switch LED for each port for MikroTik RB3011UiAS-RM. MikroTik RB3011UiAS-RM is a 10 port device with 2 qca8337 switch chips connected. It was discovered that in the hardware design all 3 Switch LED trace of the related port is connected to the same LED. This was discovered by setting to 'always on' the related led in the switch regs and noticing that all 3 LED for the specific port (for example for port 1) cause the connected LED for port 1 to turn on. As an extra test we tried enabling 2 different LED for the port resulting in the LED turned off only if every led in the reg was off. Aside from this funny and strange hardware implementation, the device itself have one green LED for each port, resulting in 10 green LED one for each of the 10 supported port. Cc: Jonathan McDowell Signed-off-by: Christian Marangi --- arch/arm/boot/dts/qcom-ipq8064-rb3011.dts | 120 ++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/arch/arm/boot/dts/qcom-ipq8064-rb3011.dts b/arch/arm/boot/dts/qcom-ipq8064-rb3011.dts index 47a5d1849c72..472b5a2912a1 100644 --- a/arch/arm/boot/dts/qcom-ipq8064-rb3011.dts +++ b/arch/arm/boot/dts/qcom-ipq8064-rb3011.dts @@ -65,26 +65,86 @@ fixed-link { port@1 { reg = <1>; label = "sw1"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + }; + }; }; port@2 { reg = <2>; label = "sw2"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <2>; + }; + }; }; port@3 { reg = <3>; label = "sw3"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <3>; + }; + }; }; port@4 { reg = <4>; label = "sw4"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <4>; + }; + }; }; port@5 { reg = <5>; label = "sw5"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <5>; + }; + }; }; }; }; @@ -130,26 +190,86 @@ fixed-link { port@1 { reg = <1>; label = "sw6"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <6>; + }; + }; }; port@2 { reg = <2>; label = "sw7"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <7>; + }; + }; }; port@3 { reg = <3>; label = "sw8"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <8>; + }; + }; }; port@4 { reg = <4>; label = "sw9"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <9>; + }; + }; }; port@5 { reg = <5>; label = "sw10"; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <10>; + }; + }; }; }; }; From patchwork Thu Mar 9 22:35:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 67139 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp562111wrd; Thu, 9 Mar 2023 14:50:01 -0800 (PST) X-Google-Smtp-Source: AK7set9Qj8YElrcAd7WJxh+9Gf9GLT243NzOPmdXv6QhHCe/E1SkoOq6uQf+w0N8ejj3BY5mC7Vo X-Received: by 2002:a05:6a21:33a2:b0:cc:606a:4349 with SMTP id yy34-20020a056a2133a200b000cc606a4349mr28042294pzb.8.1678402201544; Thu, 09 Mar 2023 14:50:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678402201; cv=none; d=google.com; s=arc-20160816; b=SKgwmQSvJCUzrPPnJbcM4/yvdKmdLjLQaxhlG0l6IQ/yrfHCKir7tnnVkyEvtEWh6N VxCzODGaEpgx6ZLRKiWeI6ZA8u6dZPjaUHV74nbBqWR1+WPlIDoLg66KkHQW5Ju9zzuh 3teBEd4KzcUXMYAjeplcyuZdi6XH5bJfukxVeLLbj5FFvrxLfugBy6IKn19Rfr/zWml8 y377ys0nT9rYbvgkS/M+SSNrSPDw9oxYGPuXOHh1fqPhUHYTmc9Mt+Hzn175O+ghJLF1 ZwnXci+syfQ3rm10O1uzq57XjEjdNZMUzTpTpOi6O7tZN7THTGnL2hMCnXDbMC9lftHe BpzQ== 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:to:from :dkim-signature; bh=NdFLu8rYGgfYob/UUJ7xHBPYmBqXvfPClb24ZxTT2Ls=; b=BXQgBMqbpN4GAvJnzTNKfYMdA+Wcf3EhhL7DYkQ+5CiSLOsWSyj+Ss7OHFM/R0biq8 U31rGlNBOMrn6vzCMGEpD6p3b8DtnfwzFZ8KgkfclQpRMhUtzYPDA+MYFARf1OmGehsf nYBhcSTuvbtyah7nw+8qusrEZHeNLZTBW+3oFe0ya8YuzTGEDtySRj39X+kcmugotEUV 7/kQInWxXob7idnm9rusTpk1ZI13wXEw1zRIlwpQIzzCFNpHQrEoHI59AnSreYy3Bhew bK7VZIN/Y66OOKNeQhxUB1+FZiD7D/7TghT6HsO+z8wV415xVsCCC+0gDk+vIR6ZMMnh SrUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LY12PGb5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a1-20020a624d01000000b005ce3fc94e21si283666pfb.123.2023.03.09.14.49.48; Thu, 09 Mar 2023 14:50:01 -0800 (PST) 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=20210112 header.b=LY12PGb5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231524AbjCIWkO (ORCPT + 99 others); Thu, 9 Mar 2023 17:40:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231469AbjCIWjX (ORCPT ); Thu, 9 Mar 2023 17:39:23 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EDDA102853; Thu, 9 Mar 2023 14:38:16 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id t25-20020a1c7719000000b003eb052cc5ccso4760873wmi.4; Thu, 09 Mar 2023 14:38:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678401495; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=NdFLu8rYGgfYob/UUJ7xHBPYmBqXvfPClb24ZxTT2Ls=; b=LY12PGb5U36RAyvwk4Ct7zflsozHYkIIlhvHkrKH2nJqMc1/DGhRpL+DhwyM44V+ww /gxLhY7o/Mmfcod8SAxZ56oZwzZdMte9cHXeNJUUbPOEv3u5tIfk5hz1dnOUgWv+bZ/1 b+bebnttbuJXDFVwlTCZ9SReSjjc6Pn8cFCPBdAtHvZvX089U7xuIVxybi76pvJdIlHQ 7w8ldSpPJqyiEGfaQEZ+HVN6uegxguD+uII7ppHbWZMYC3rCbjr/HsOEUr4RV548SaoR 0FYIodjRM1LKZ0jqO9wT/XxZtJVVRnv/F1zsxgSN3S2Sj+6YuXysyf7xe+2aCSBOxBwc w6eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678401495; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NdFLu8rYGgfYob/UUJ7xHBPYmBqXvfPClb24ZxTT2Ls=; b=p8AoyjJjnesfazuBszubweOhzspMrwYYn3Dl2dB6rqsdxeJETKLAHeXO2RJs+/PTjH SmFgmdMlsmAY5N1/nsfIlKy/4WP8RdY6D2qm8hRUcDK/fJyB/iayjfMOJSe85Wk76yiE hbgc/V/hJrrL8VIgNbBvZGDre8hBMUBjcoktGXYqXW4Jz8m6LhpJflHGXmGwT+v2+A2a 6xaCAxAf5E/0RvfahPslSfTLngb2Jb0WEp/y25IeTFEJKW45dyrt7RJ1JPUnKcH/DMX4 u45LACWIk/Qw4evNlo39aBPgfWzyAPAA8IsXSWCXnBwY/wKD9TJjTTNdXDlkQI9AFMx7 t+3w== X-Gm-Message-State: AO0yUKXuWLlfNwv4AEia1ZE9KVeu4VcASs3ygx3OwHaC2iOxNqLWUadF WzlCweyhug4XO6l9j0+S7Y4= X-Received: by 2002:a05:600c:35cd:b0:3e9:f4c2:b604 with SMTP id r13-20020a05600c35cd00b003e9f4c2b604mr702682wmq.24.1678401495464; Thu, 09 Mar 2023 14:38:15 -0800 (PST) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id g12-20020a05600c310c00b003e209b45f6bsm1183981wmo.29.2023.03.09.14.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 14:38:15 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v2 13/14] dt-bindings: net: phy: Document support for LEDs node Date: Thu, 9 Mar 2023 23:35:23 +0100 Message-Id: <20230309223524.23364-14-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230309223524.23364-1-ansuelsmth@gmail.com> References: <20230309223524.23364-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759932266756657076?= X-GMAIL-MSGID: =?utf-8?q?1759932266756657076?= Document support for LEDs node in phy and add an example for it. PHY LED will have to match led pattern and should be treated as a generic led. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- .../devicetree/bindings/net/ethernet-phy.yaml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Documentation/devicetree/bindings/net/ethernet-phy.yaml b/Documentation/devicetree/bindings/net/ethernet-phy.yaml index 1327b81f15a2..84e15cee27c7 100644 --- a/Documentation/devicetree/bindings/net/ethernet-phy.yaml +++ b/Documentation/devicetree/bindings/net/ethernet-phy.yaml @@ -197,6 +197,22 @@ properties: PHY's that have configurable TX internal delays. If this property is present then the PHY applies the TX delay. + leds: + type: object + + properties: + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + patternProperties: + '^led(@[a-f0-9]+)?$': + $ref: /schemas/leds/common.yaml# + + additionalProperties: false + required: - reg @@ -204,6 +220,8 @@ additionalProperties: true examples: - | + #include + ethernet { #address-cells = <1>; #size-cells = <0>; @@ -219,5 +237,18 @@ examples: reset-gpios = <&gpio1 4 1>; reset-assert-us = <1000>; reset-deassert-us = <2000>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + default-state = "keep"; + }; + }; }; }; From patchwork Thu Mar 9 22:35:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 67149 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp562756wrd; Thu, 9 Mar 2023 14:51:54 -0800 (PST) X-Google-Smtp-Source: AK7set+FI9xnmxzSrg1CrsKTvP9iQUiLAitMyzsNVhhnkRhxykWktHVWfMxF2w2/bbZ+KOHoFtUq X-Received: by 2002:a05:6a20:4e2f:b0:c7:73de:5aa7 with SMTP id gk47-20020a056a204e2f00b000c773de5aa7mr2122890pzb.43.1678402314257; Thu, 09 Mar 2023 14:51:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678402314; cv=none; d=google.com; s=arc-20160816; b=a0NmvsM+ls8G3V26WOFixPoEMIoymWbs9WB4+t5yGnjCYu5tTapm9qezvfqFdvsB5O BDt9nYb93fj7gFgWWsKBqIzh8mP7GtND/7C1qW9Ln84U57Tx3VHIHxlY/XyV6aMuXdlr LLrpS/CwAbbnlMWaaMg5Fsyj5t57uHES1ydm4Zcbbo5h9feTWXzT3L4Rs/NTLdUn2Fcl fnMM0rCWBqMOQO38qcxrnnPG8DPUpKOuesBFFzU/9HZl0szOyRp6K3VJRIs2MaN30jeM v9RqFXbh2zp1gwbJs1QxNkNq5Wg0kIj/ZSdYWJnZMK3d+cHbKaII5KB0jhBTcC60v9OS L8mg== 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:to:from :dkim-signature; bh=hKTAoz/5c2gh8Y+1xcGszVL+VPGe5qIqtDhWxElzHg8=; b=OrHX09k1okEKmO/iX3fx3o2lI7dUTqLsTDx64zIKo/y8XD4YvOVZ1kcN+AVRXaBwnW ECSYUG0KpyMJRR7q4Y0YKgrTrMOPypvNJ83AScVVfIROe114l3v46pE0X+vlUYbBtjmq aNg1LvYlkrdvpmaUvVfRhmVwI2ZM2ziCMLA2TGcQHiJopJ8vSQeh5I0RgqTyMq5WN5GP hz+2Etpialxiu6rjeiKM7j8qwRu/ZtOZ7l5ZagzNTk43JP2kDbIRQHvD+r8ngcfhzU7R jOIZtyzj9zSYH+xLzQOx8Az1bC7wCifv/351jHSpQvrnp9okdyPHaF45tE3TSJNgL5lo +zSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Lz9RBu9C; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d15-20020a63f24f000000b004fbfc2b436bsi278140pgk.517.2023.03.09.14.51.41; Thu, 09 Mar 2023 14:51:54 -0800 (PST) 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=20210112 header.b=Lz9RBu9C; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231251AbjCIWkK (ORCPT + 99 others); Thu, 9 Mar 2023 17:40:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229989AbjCIWj0 (ORCPT ); Thu, 9 Mar 2023 17:39:26 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C76B26CC5; Thu, 9 Mar 2023 14:38:20 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id j3so2257134wms.2; Thu, 09 Mar 2023 14:38:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678401497; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=hKTAoz/5c2gh8Y+1xcGszVL+VPGe5qIqtDhWxElzHg8=; b=Lz9RBu9CNknt0QOl1Aljn3cwAQU50LY+AV7pSEK2Fj8y3Hddbp4bpOTZi5rdS139F9 8ptUcoz9oF26o4TdIU880734mFr6D//0Pup+yhl4sl+qWhzxl1EQsry/0hWIrecGVCYX irkJVeam6BQf1XKfDhMOAItTSlHyiuUnGkQIZ69rZJp9rLO7ToxONC/5gBKjkgcQYWSn aEgSeFeD1BuSXWBATUry4dvmFsB+d+jTHeR+0pf9nT6vw1LcZ1N5nbxeVBRBAl57csCT E61stkETe6G9jYvNriFX3ip8Yen/ibpiuilcO10mTst/5qyra0K1kpwYzwAC22YbidoR 1EsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678401497; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hKTAoz/5c2gh8Y+1xcGszVL+VPGe5qIqtDhWxElzHg8=; b=kEcujqqqkijUj054l9C65d3BYTAubaAtZqRFgtOeHs3QyUtz5aqXWNTmkiydFMo2SC CwAbtBQjt8WIpVNvZs6mViXyjFz8bPMkE8YfoIm6NvHek3wU1AD8V/NVGYCLn/UWi7YS J6sEHzkqyK1Vl9qKc1ifxaLgVkc5AGiTnhOw4kFmo9PFjCLT/G/RTr7Z42eSOxrEWExk n8phLQAXr7IEWxX5MLKJ//TM2Pvqv83gN07TkAsloVCi4pISdcO0JU+RnnGRRCyB2b+Y l+VnLkus75FalDRthkJDC0bIGpMw9LowcM8Eu20qj0JoA10Kd2I5jXWdaHIhylLKpF2P MJGg== X-Gm-Message-State: AO0yUKW49xoQZ9bEjANu8wxWWFCoOoKX2l44u8mqpJFZ5YqZ5DwS/tbh 2CyXWVafnruB4ogXDbm1jYM= X-Received: by 2002:a05:600c:3c8f:b0:3ea:bc08:b63e with SMTP id bg15-20020a05600c3c8f00b003eabc08b63emr808544wmb.2.1678401496818; Thu, 09 Mar 2023 14:38:16 -0800 (PST) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id g12-20020a05600c310c00b003e209b45f6bsm1183981wmo.29.2023.03.09.14.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 14:38:16 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v2 14/14] arm: mvebu: dt: Add PHY LED support for 370-rd WAN port Date: Thu, 9 Mar 2023 23:35:24 +0100 Message-Id: <20230309223524.23364-15-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230309223524.23364-1-ansuelsmth@gmail.com> References: <20230309223524.23364-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759932384678249630?= X-GMAIL-MSGID: =?utf-8?q?1759932384678249630?= From: Andrew Lunn The WAN port of the 370-RD has a Marvell PHY, with one LED on the front panel. List this LED in the device tree. Set the LED default state to "keep" to not change any blink rule set by default. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- arch/arm/boot/dts/armada-370-rd.dts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm/boot/dts/armada-370-rd.dts b/arch/arm/boot/dts/armada-370-rd.dts index be005c9f42ef..ccd4699b219f 100644 --- a/arch/arm/boot/dts/armada-370-rd.dts +++ b/arch/arm/boot/dts/armada-370-rd.dts @@ -20,6 +20,7 @@ /dts-v1/; #include #include +#include #include #include "armada-370.dtsi" @@ -135,6 +136,19 @@ &mdio { pinctrl-names = "default"; phy0: ethernet-phy@0 { reg = <0>; + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + label = "WAN"; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + default-state = "keep"; + }; + }; }; switch: switch@10 {