From patchwork Mon Mar 27 14:10: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: 75468 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1547919vqo; Mon, 27 Mar 2023 07:18:55 -0700 (PDT) X-Google-Smtp-Source: AKy350YqRcHCwQ/LAdy2ENjxc3ZTBrHCH8Ra1DR5rySXJxOQ76aUrC9x//UcZ1owZATQyjbHbBa+ X-Received: by 2002:a17:907:3e21:b0:930:f953:9614 with SMTP id hp33-20020a1709073e2100b00930f9539614mr16762061ejc.1.1679926734793; Mon, 27 Mar 2023 07:18:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679926734; cv=none; d=google.com; s=arc-20160816; b=onltXiZQR9xi238Huu0QxP6e01sYHqYPzhODySPJPyoR9LDC2VyNK3j7/tMSmd2lLL rAkw8CXP97rSKBqnpQf/Ir2ej0tNz0vsI6ZG10jPWYetGL+V1qslqbTeZ6xZCG8vSiRn cPdZmTSBKOUmJt7Nl3OJAeCcGMz97nrIexhXE/FEOiCLZkBFQ/EP/0NhCw7FrH4CKNNm Qwdk3wYorFf26gdhhGQuQqa52uuG/LzYb7svEPiJI7UehA7Hhe4b3bjuldhY9NnBPZK4 nzSPB+lG5uIvauZPH4GfHotJMQMaFqCh2LTPexNxyiQyCHP4JzXtYycjNQ05ahRp79th heFw== 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=sVb+VQvq+8Sp9A/ftRiE2SBUlVZOPfZp868HAFVyi3c=; b=oc23Ms63R5ADXhNmGOP3KXjOlFq/WhK0w07mM2EtYlD9JIh6xd4SYd3kzm9MVKNjjM LqyNdhKkymMLypvPxRoFrNTCrTIIW8NobyAPO/6E0o6+WsWG8JCD2aGAcTTSdsOHteiD DzrWXRLjP4pt7ql5mnvCG7Aq0krvFvF0pTQXDQ/R2Qz3QntAWtvK6ebsa7jeyQE7ONk9 AMk/y2eyRNUlGw0FF5iRBNjbOoUxsv4EUyQS4WBz2g4TNXLr3XiBsuzv9RxQQT2B5zPl cwF+GINQaQ9lVFxcqY3tSrYDT3ua+WUW2CVt0cG9JQdfkdGRAKfi20s7II6p+vp4T/dB ua1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CSyUh1s0; 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 q6-20020a1709064cc600b00934a633a6c1si16973752ejt.228.2023.03.27.07.18.27; Mon, 27 Mar 2023 07:18:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CSyUh1s0; 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 S232542AbjC0OLH (ORCPT + 99 others); Mon, 27 Mar 2023 10:11:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232401AbjC0OLC (ORCPT ); Mon, 27 Mar 2023 10:11:02 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52432FD; Mon, 27 Mar 2023 07:11:01 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id j24so8983257wrd.0; Mon, 27 Mar 2023 07:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926260; 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=sVb+VQvq+8Sp9A/ftRiE2SBUlVZOPfZp868HAFVyi3c=; b=CSyUh1s0w5yFDOYYim2gDh/XdZVgY4x5WIM7D9EFchqjrBGIoB/cqSyoJtTYOODyai 7MpTyay9H1Y3VKimKvpTwkv3cA+qV7X6XDG+lQdFpfJ3uYJbZBTVvKso5gIK8rkMTfeW q+j+cMzVlGa7iyNMhrOXFzryqnRZoUoof9+Q3uk1jzn8Z9iKyLwz5fxYpm9Alm61T77d eoEcAcRHjuUUuD+zDASjwY1Vu9Jd5xJ2vp2uoHsR+Lp5pNhybmATSM1K0aTo6GZM6jET jGmktpw48fOPtcC2ZNFfrIx+xqqTdZzBfUI3QPyg1gjoDbCYP1VsnIBJ+CsRdjXQFbnJ HhmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926260; 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=sVb+VQvq+8Sp9A/ftRiE2SBUlVZOPfZp868HAFVyi3c=; b=6QYQEjFVZgiQ0BSyc4SIfCsQtBekvUlqgFiBtpmSI5H5oYQSBTj/BrnuPcQ/01h3tl AWLoCIH39uuuilJx241w0wcmHhkgsfTgnsLjzrye4bOyh63NozJPYVunjV6gzzWAl1T8 pDCh7+x2tvMAjVMsGQ5A3exudWPPuu3/Vq/1mpO97xADWxPmrXOVS3R20ogFr4raNCGL 05jMkoEBesQDFXDCS8UVQzprbaWeydOXPi4iU6HtRLO5mN3ixqCy5VH4RCB12qz9mIji O5IQkmTz5NqyWE3Zb/asv9OVoOcjLIUJRcGj+7vIiZnVlwVX6E+afJcXxW5Rx2QMyeKw gqSg== X-Gm-Message-State: AAQBX9eLZU1fipVP4jB99hZaeOA7NjSDxkRa5HWU+OS6AIGX5Uj2rpwp iFdh16rx6AJp+m1bgTk0wvo= X-Received: by 2002:adf:e90c:0:b0:2cf:eeae:88c3 with SMTP id f12-20020adfe90c000000b002cfeeae88c3mr10206818wrm.32.1679926259563; Mon, 27 Mar 2023 07:10:59 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.10.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:10:59 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Cc: Michal Kubiak Subject: [net-next PATCH v6 01/16] net: dsa: qca8k: move qca8k_port_to_phy() to header Date: Mon, 27 Mar 2023 16:10:16 +0200 Message-Id: <20230327141031.11904-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761530855432025100?= X-GMAIL-MSGID: =?utf-8?q?1761530855432025100?= 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 Reviewed-by: Michal Kubiak Reviewed-by: Florian Fainelli --- 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 55df4479ea30..459ea687444a 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -772,21 +772,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 7996975d29d3..dd7deb9095d3 100644 --- a/drivers/net/dsa/qca/qca8k.h +++ b/drivers/net/dsa/qca/qca8k.h @@ -421,6 +421,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 Mon Mar 27 14:10: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: 75470 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1548093vqo; Mon, 27 Mar 2023 07:19:09 -0700 (PDT) X-Google-Smtp-Source: AKy350YoxU75XCHg1E0tq8bmhtVOiC7kggncq41xbIg8tjBX/FFoZok1HK3n2z0oygnuzL2HP1/+ X-Received: by 2002:a17:907:a42a:b0:93f:b391:9a07 with SMTP id sg42-20020a170907a42a00b0093fb3919a07mr8419856ejc.15.1679926749389; Mon, 27 Mar 2023 07:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679926749; cv=none; d=google.com; s=arc-20160816; b=wkiPkCcELYLytSAVBo9Z8L29WhF2GbDTRIr6dWLrLXWo6LqJ/wFRrX5pLjfQK0icVD 3bhOhKFVEFsCYnn+a8fUmvnU+MiFJcXHLwIz3b2xdnEKgDMJeYeYUNbsNuhWM8L5sah2 Fvo3LWbEzZO8udhdcxfE8aqPRzkX6eH+C9YO1FASE932Bu/vh7RyanM14vPEzHWA4OrI zDflx46hHebReOxeS9XDNzoJ2BIZyTdXNVo7XW9eit+REtn31Wo7z29ziLmu05jNUanM 1jYXYFLh1M8TM694kwoEknk+QZVJjToJ6osNL33zTDGohgssBNuLC9t6w1AvU/bpaC0P l/2Q== 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=7JsiYlP/UHLPXsRszSLVr/P2PRvfZwKQBo522zbmzuk=; b=glW7JkQNI+BlSxte1+TUCUnXqxuCzbctx6RD91gOBdIbxhezIFgkdLrV/z8WIbSfdH lMybQIqUumnOssNAdde8sbNRWD+KFlUTnn3DYeP9rjiBNdAB0RRtNlo6OfC+P/WaB5Vi pTDx5ZQYj/d9BJhabFLCdNaXkIJQcRrPMeBXDQ1SVd7pdQhtYfhEZzrzfB2s6/R5sb1i MkqWS8cxA1wJs+h3xs2o5tnk84VkHrM8BTHdQfs1bRz8QP7YRI+j7xTjjhyk0TNQD9uk eU4UB51TXfcecid5edUj9fX/dpaC8/9XyeJ8DL0WAPLDVCfWSGfQoUbKbprR+oeyQLaM 0HpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WveUERyo; 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 gn36-20020a1709070d2400b0093e5bd9064esi9664282ejc.482.2023.03.27.07.18.42; Mon, 27 Mar 2023 07:19:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WveUERyo; 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 S232558AbjC0OLL (ORCPT + 99 others); Mon, 27 Mar 2023 10:11:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232494AbjC0OLF (ORCPT ); Mon, 27 Mar 2023 10:11:05 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDAEFD3; Mon, 27 Mar 2023 07:11:02 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id t4so3713055wra.7; Mon, 27 Mar 2023 07:11:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926261; 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=7JsiYlP/UHLPXsRszSLVr/P2PRvfZwKQBo522zbmzuk=; b=WveUERyoeR79+tvH5ZYJB9GN9YORKPTndnPR+mchFM5Vpg60T2f9iuYFzUzrPAkDuz Zpio3OeDrSGOKjP4i/BPcz2PxfrwehzaLVNGfZ+Zt45+sVmrgwaAxKhBjWJUQwoLGLli r/A+u0LuSp+nAkWw2OkMlcR35ZwG/PXGKXOgbHCTPJV/3ZUOr7afYji38/fPl4pxpYps fUDF+ZBC1xd4UVGzJNhsTUIDi8+rMTqfPB/ELLq67dggd6L0mewcdsReTfQ+I+JzCMhu kqe0I3384jQeIPKeqkoOLMZrVv9ks4tjfp+DBU/vtRmv0YIi5E4AFRJuOIp1XNioh0jm gf2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926261; 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=7JsiYlP/UHLPXsRszSLVr/P2PRvfZwKQBo522zbmzuk=; b=TCTdMZZpwIDqwwwyhyvZeHaBsmNO/NB2cwB284O7i17a3soheED1jhkwFmgmY1f256 3eFAg8oRRKh0GwiqDfK3L5Qz66MDb71P1oEj0o7YmO+te7d/0Vi/onLckDi3NEmuzWsI V1zwAsPcUcXDfZUMu5OiGNR9UWR8j6vt6CN9y8fZait2/NVFWpaqsUyUBX06jBFlLThE z3hCRSR34/RRjzrxQFxArUnQdAqmWF00IFL1SxdfAEnD/oy4jZK4RU/HlPjZWzKL0nzU TPag433a8GIGhRUyhd/huVnZqUZVQkuLCFX4jidn55xO/Rf9uQckNoCvgGjO9GI09edR Rj8Q== X-Gm-Message-State: AAQBX9fYD4gaxDZovHU1hvQu0/hd5Da2I5u28egJkTQfA7KTv00K2vuS izccu4DgNJU/cOy/PNgndlk= X-Received: by 2002:a5d:5001:0:b0:2e0:e728:9471 with SMTP id e1-20020a5d5001000000b002e0e7289471mr1986552wrt.4.1679926261124; Mon, 27 Mar 2023 07:11:01 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.10.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:11:00 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: [net-next PATCH v6 02/16] net: dsa: qca8k: add LEDs basic support Date: Mon, 27 Mar 2023 16:10:17 +0200 Message-Id: <20230327141031.11904-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761530871246736892?= X-GMAIL-MSGID: =?utf-8?q?1761530871246736892?= Add LEDs basic support for qca8k Switch Family by adding basic brightness_set() 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 | 8 ++ drivers/net/dsa/qca/Makefile | 3 + drivers/net/dsa/qca/qca8k-8xxx.c | 5 + drivers/net/dsa/qca/qca8k-leds.c | 232 +++++++++++++++++++++++++++++++ drivers/net/dsa/qca/qca8k.h | 60 ++++++++ drivers/net/dsa/qca/qca8k_leds.h | 16 +++ 6 files changed, 324 insertions(+) create mode 100644 drivers/net/dsa/qca/qca8k-leds.c create mode 100644 drivers/net/dsa/qca/qca8k_leds.h diff --git a/drivers/net/dsa/qca/Kconfig b/drivers/net/dsa/qca/Kconfig index ba339747362c..7a86d6d6a246 100644 --- a/drivers/net/dsa/qca/Kconfig +++ b/drivers/net/dsa/qca/Kconfig @@ -15,3 +15,11 @@ config NET_DSA_QCA8K help This enables support for the Qualcomm Atheros QCA8K Ethernet switch chips. + +config NET_DSA_QCA8K_LEDS_SUPPORT + bool "Qualcomm Atheros QCA8K Ethernet switch family LEDs support" + depends on NET_DSA_QCA8K + depends on LEDS_CLASS + 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..ce66b1984e5f 100644 --- a/drivers/net/dsa/qca/Makefile +++ b/drivers/net/dsa/qca/Makefile @@ -2,3 +2,6 @@ obj-$(CONFIG_NET_DSA_AR9331) += ar9331.o obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o qca8k-y += qca8k-common.o qca8k-8xxx.o +ifdef CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT +qca8k-y += qca8k-leds.o +endif diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 459ea687444a..76bffd6d8e23 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -22,6 +22,7 @@ #include #include "qca8k.h" +#include "qca8k_leds.h" static void qca8k_split_addr(u32 regaddr, u16 *r1, u16 *r2, u16 *page) @@ -1783,6 +1784,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..3ad5e54fcdfd --- /dev/null +++ b/drivers/net/dsa/qca/qca8k-leds.c @@ -0,0 +1,232 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include + +#include "qca8k.h" +#include "qca8k_leds.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_CTRL3_REG; + 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_get_enable_led_reg(led->port_num, led->led_num, ®_info); + + val = QCA8K_LED_ALWAYS_OFF; + if (brightness) + val = QCA8K_LED_ALWAYS_ON; + + /* HW regs to control brightness is special and port 1-2-3 + * are placed in a different reg. + * + * To control port 0 brightness: + * - the 2 bit (15, 14) of: + * - QCA8K_LED_CTRL0_REG for led1 + * - QCA8K_LED_CTRL1_REG for led2 + * - QCA8K_LED_CTRL2_REG for led3 + * + * To control port 4: + * - the 2 bit (31, 30) of: + * - QCA8K_LED_CTRL0_REG for led1 + * - QCA8K_LED_CTRL1_REG for led2 + * - QCA8K_LED_CTRL2_REG for led3 + * + * To control port 1: + * - the 2 bit at (9, 8) of QCA8K_LED_CTRL3_REG are used for led1 + * - the 2 bit at (11, 10) of QCA8K_LED_CTRL3_REG are used for led2 + * - the 2 bit at (13, 12) of QCA8K_LED_CTRL3_REG are used for led3 + * + * To control port 2: + * - the 2 bit at (15, 14) of QCA8K_LED_CTRL3_REG are used for led1 + * - the 2 bit at (17, 16) of QCA8K_LED_CTRL3_REG are used for led2 + * - the 2 bit at (19, 18) of QCA8K_LED_CTRL3_REG are used for led3 + * + * To control port 3: + * - the 2 bit at (21, 20) of QCA8K_LED_CTRL3_REG are used for led1 + * - the 2 bit at (23, 22) of QCA8K_LED_CTRL3_REG are used for led2 + * - the 2 bit at (25, 24) of QCA8K_LED_CTRL3_REG are used for led3 + * + * To abstract this and have less code, we use the port and led numm + * to calculate the shift and the correct reg due to this problem of + * not having a 1:1 map of LED with the regs. + */ + 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; + } + + /* Assume brightness ON only when the LED is set to always ON */ + return val == QCA8K_LED_ALWAYS_ON; +} + +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 = { }; + enum led_default_state state; + struct qca8k_led *port_led; + int led_num, led_index; + 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 most 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 %d defined for port %d", + led_num, port_num); + continue; + } + + led_index = QCA8K_LED_PORT_INDEX(port_num, led_num); + + port_led = &priv->ports_led[led_index]; + port_led->port_num = port_num; + port_led->led_num = led_num; + port_led->priv = priv; + + state = led_init_default_state_get(led); + switch (state) { + case LEDS_DEFSTATE_ON: + port_led->cdev.brightness = 1; + qca8k_led_brightness_set(port_led, 1); + break; + case LEDS_DEFSTATE_KEEP: + port_led->cdev.brightness = + qca8k_led_brightness_get(port_led); + break; + default: + port_led->cdev.brightness = 0; + qca8k_led_brightness_set(port_led, 0); + } + + port_led->cdev.max_brightness = 1; + port_led->cdev.brightness_set_blocking = qca8k_cled_brightness_set_blocking; + 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 init LED %d for port %d", led_num, port_num); + } + + 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!"); + return 0; + } + + fwnode_for_each_child_node(ports, port) { + if (fwnode_property_read_u32(port, "reg", &port_num)) + continue; + + /* Skip checking for CPU port 0 and CPU port 6 as not supported */ + if (port_num == 0 || port_num == 6) + continue; + + /* Each port can have at most 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 dd7deb9095d3..c5cc8a172d65 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,51 @@ #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_PORT_COUNT 3 +#define QCA8K_LED_COUNT ((QCA8K_NUM_PORTS - QCA8K_NUM_CPU_PORTS) * QCA8K_LED_PORT_COUNT) +#define QCA8K_LED_RULE_COUNT 6 +#define QCA8K_LED_RULE_MAX 11 +#define QCA8K_LED_PORT_INDEX(_phy, _led) (((_phy) * QCA8K_LED_PORT_COUNT) + (_led)) + +#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 @@ -382,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; @@ -406,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 { diff --git a/drivers/net/dsa/qca/qca8k_leds.h b/drivers/net/dsa/qca/qca8k_leds.h new file mode 100644 index 000000000000..ab367f05b173 --- /dev/null +++ b/drivers/net/dsa/qca/qca8k_leds.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __QCA8K_LEDS_H +#define __QCA8K_LEDS_H + +/* 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_LEDS_H */ From patchwork Mon Mar 27 14:10: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: 75466 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1547649vqo; Mon, 27 Mar 2023 07:18:32 -0700 (PDT) X-Google-Smtp-Source: AKy350bSJvnY3unJCWMe/K8HAxn4tG8euq+kYP3gbERgaAtxhPajhR2pQG/jqXgLLSSnAVaPmJa1 X-Received: by 2002:a17:907:1ca1:b0:945:5510:2b9f with SMTP id nb33-20020a1709071ca100b0094555102b9fmr3552451ejc.54.1679926711923; Mon, 27 Mar 2023 07:18:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679926711; cv=none; d=google.com; s=arc-20160816; b=cuUFJXSdH63W52xwymnyDrO0oqqpInqVtjVZ90bEfNmnS0A2xUFT4eqDdSCmY4QXGP SNwvd54pZuPF4i1bsn5RCIaOMgFOllIw6D+76x2G33xld1BIjbi6Qa7/txPn7mmlFT0K fqa3PV6qrTlNCx5GI7yDTEJnj1po8n2Eac82bZmHbGDewVlNh/54LIrIp8CEaS944YrA vroPxtzFVqGJ/phQL/k8aN/roqyvz+pAeqU3Nzv8+3Th9VhjE03vipWP4EYycjXZzfxC ovHqCd7hRKQHCciLXpB6/AmJ/P1RqQT3p4A3tTPyi8MEBJgyl9XZuy1elZfduH6zfqFV o3RA== 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=fa8ioINt3A7lUc49MvB+EY/lPc2nYqFxTMECk7yeZBM=; b=Ky0x84kYqf0hO5dj/xaBTTFnLCpB3K9E7tAF2Xe/k0UFHCRnLAzO5iwoUHYTPWvPpX 3+NyL4v4S63xupuxdFtHpVTEOzfPDbnHlyqH6ZgTlgvFNq8ZqvYjxVnRIRaaRzYIPXOl O0EEdg2fS6SE2aNetn6r3k81/BZ2GVRERfYg2NjQG9XPAtKaPg2Mj12+BIeXHql9zRH0 0OJvE8EDv7UwFCUAgKq5Z0ke04C3R+In9OjdiH4cEOkfUOFw/y1+ypsD2S2/+ajO3e+m 2uwIzCdqcYbsV042NaFW9uBNlQ9phhpcgfFu4UJWNcN5CoxAxmbCfcf097UGCVmg6Awl nYMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XNKfsz5S; 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 hu16-20020a170907a09000b0093b05f2035dsi13923184ejc.27.2023.03.27.07.18.01; Mon, 27 Mar 2023 07:18:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XNKfsz5S; 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 S232624AbjC0OLZ (ORCPT + 99 others); Mon, 27 Mar 2023 10:11:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232529AbjC0OLG (ORCPT ); Mon, 27 Mar 2023 10:11:06 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDDF630FA; Mon, 27 Mar 2023 07:11:04 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id e18so8938791wra.9; Mon, 27 Mar 2023 07:11:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926263; 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=fa8ioINt3A7lUc49MvB+EY/lPc2nYqFxTMECk7yeZBM=; b=XNKfsz5SdqRgzm+FLClI8hxxmZ1+HMY1SkmB4nd90z+fCfSjGg9VzPMM7Ref0XQFTV j8FC2AaRhsy+sz4cwpaxRbHwtgRdBkeNrj7VwGxTWncaRo9MwqbbG+fSsOx0Cs5yPA7g k+l39X9PP4nebJ3wleAf+CsqVhIKjtfqnmr178n7UETd9fzDQzcIpDPa8wAltH09fQ/L +V3VemWUJvuGo6YmIo8hWe1StDpku0bflZZ2t3YfV7MWpaT8IuvBiuSzX3/u7LM3c9t1 hAPlxw/p0ts6D3jAnNtMQTW+n5W/8LP7UH8pOlvyKVelJbv2pt8kfpP4apCebRdFDX+H Vq8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926263; 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=fa8ioINt3A7lUc49MvB+EY/lPc2nYqFxTMECk7yeZBM=; b=GoVR72DIUNUVH4pEoqiXP8Lhhqw8yfiLlEKfwhpeB4Y/Ai5699CzUeSn3SexDom2AC zey5mCnNJoaqcL8/7E/RGpEco4MjsO2qG85g1CPxNbfCld8S3pkGsgvFz4M6uHFnVA01 vVt2qhYs4ShfJU6X2KBFRLRTp54plRim2Qma+rKSp3olPckvZfnwwCVCWVi2FjU9e4Fh Tp31JOe6p35m/ICF6TN0sHxPncD9nYBeoF2HwfO0HcaPkhQwy6c4aQIubchkPcC5WFq7 Raum7Zak1XTcwHPOePBYI/Wl3gut2fcQrKPF46YlymOsmPDkAGYkWy4qcOhDVhrbX3hT dn5w== X-Gm-Message-State: AAQBX9eAKFVbJBBrfDZ0AK04tbxtCkK/gHrNwHEx3mWbn4/GsYHRs5py TasvJ4uUfsAI13Wsu3WZ2NE= X-Received: by 2002:a5d:5192:0:b0:2c9:70a4:4f94 with SMTP id k18-20020a5d5192000000b002c970a44f94mr10581523wrv.18.1679926263218; Mon, 27 Mar 2023 07:11:03 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.11.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:11:02 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: [net-next PATCH v6 03/16] net: dsa: qca8k: add LEDs blink_set() support Date: Mon, 27 Mar 2023 16:10:18 +0200 Message-Id: <20230327141031.11904-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761530832165173977?= X-GMAIL-MSGID: =?utf-8?q?1761530832165173977?= 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 Acked-by: Pavel Machek Reviewed-by: Florian Fainelli --- 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 3ad5e54fcdfd..0c104afdeca1 100644 --- a/drivers/net/dsa/qca/qca8k-leds.c +++ b/drivers/net/dsa/qca/qca8k-leds.c @@ -127,6 +127,43 @@ qca8k_led_brightness_get(struct qca8k_led *led) return val == QCA8K_LED_ALWAYS_ON; } +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) { @@ -185,6 +222,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.blink_set = qca8k_cled_blink_set; init_data.default_label = ":port"; init_data.devicename = "qca8k"; init_data.fwnode = led; From patchwork Mon Mar 27 14:10: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: 75479 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1549056vqo; Mon, 27 Mar 2023 07:20:31 -0700 (PDT) X-Google-Smtp-Source: AKy350ZrlU/RjTQsPEs0xkCtzrEsNayBL4/xvz/krsAhV/2/cmHI4+q2A1B37aOz28lf8JEf0EqQ X-Received: by 2002:a17:907:8d09:b0:944:308f:b978 with SMTP id tc9-20020a1709078d0900b00944308fb978mr5018283ejc.11.1679926830952; Mon, 27 Mar 2023 07:20:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679926830; cv=none; d=google.com; s=arc-20160816; b=ym901ijd6m4WB0wcnZVrx9kqk5QR7beUCdMctVsQClD4otEm0C5OoSQz8mFq0i4iv2 ZaOWkVHumMNbY65lcWyWvoqxSowC314YMn0sIFLr6xBGgnOuZxA+WkmOw8rfnFXvPbeq 4Y7Taum0aiKWJXAEWkBDc2cAqfJu2otOfvlRjrNzrNahLbtVj1NH3D0TX7dzl+aCaeI7 7fwxbuaABub0nX/4Iz5j0DoO8mXbOYO0Ehhv5bVNARC2wmiazzyyzyS3qroa8xCbmrOg zBMw3S435JXY+ic9gSjY8+yGwF3iZJCxWNGAGU5NTon+UEhONNuFHPCGRbLeOSRPVkEN g4Uw== 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=B/6cPPqnfkL0XCsWQ9CSmSKrElE+ntPWQyKfv7omo6Q=; b=oBFOrsxOuRPHCyt6HGYg/XKg9IHElvtzp9GIQ4ZNl+wXTfdSqt1x1eyteBHg1sb0Hi F8uGYLlcZFmXyxl33V7krDpVoDcqjMQ+ekfhyQZGuwDM5PCT9yo+QmPGAu6M9fz+9qgr 2nByedtShds2doTTi/MHb1OsRAM7rlNK5tABr1rQE6YoVwgUWQXYI3dX1cWLzhuy8kBc TBNNS2iNyyBqWR7Bt1X548GNsm0cAT3H/w34Kquq912NVoV6X1Pi7sdTXRyWftWldFsv mUQu7KKbCRuGD0g5EQuq5JS/6m1cifLkPTv7J3f43zAow2hTd9NJOkQEKbUXi2/EpTC0 tWiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=e5HxzgtS; 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 c23-20020a170906155700b0093330a0fc5asi21339109ejd.447.2023.03.27.07.20.08; Mon, 27 Mar 2023 07:20:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=e5HxzgtS; 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 S232745AbjC0OLh (ORCPT + 99 others); Mon, 27 Mar 2023 10:11:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232546AbjC0OLI (ORCPT ); Mon, 27 Mar 2023 10:11:08 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DACDF19B9; Mon, 27 Mar 2023 07:11:06 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id r11so8932820wrr.12; Mon, 27 Mar 2023 07:11:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926265; 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=B/6cPPqnfkL0XCsWQ9CSmSKrElE+ntPWQyKfv7omo6Q=; b=e5HxzgtS+Pzj+UsLrWClJb0LAXwayJGcSE1D/xsRAvc38BtM9nmrSmoio7uz4p8fBF Bgpqw8l+d65JG61EZ8uYcxZAga99iSTynYeaqyOz/iIW1b32V4hrbY+g97LyCtlSF6OX mlaL5dSHInHsJZiiT+ucOA0MQvcCXwkImjcwIYH4elJGR0L+PTnmiHkwQKb4eSa8la2t p2weyip0QQR6nfwdLOmnZFwpJWEEw9HOqTS1eNHm8Izu4zXOLpAaUOBcb8LVEc9eTbUG YGzygmuERaK/cLRqF4vCMeDwB7pavUXJ1v/y4uUAcWDuD4Gn/d8QYfwB9O+pAuRvKedB avLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926265; 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=B/6cPPqnfkL0XCsWQ9CSmSKrElE+ntPWQyKfv7omo6Q=; b=QJ+diinSjDFjdKKmvdR4ooP3JYYRjx4GsvQmZDLzxVqyWOw2kNBnQfKo6KmVFpTZxq a9dnv9FK8sWzkGjpg8JF4+TZCk+XJGSw79Gx8he/njKL76/acr/wREG6yFeji7q9orJL Fgbsd1hMjhZWTV2gENCRJOCJwWa+LYu0aGuBSZpVHGpVzj/taaSCCDxYt/UyJk/9gWAo T5VXtLNEe6BBrWeurcwEQKSTed/6ztpENbc9Nd2iMDvY9D+aFKvTOGRVSR31fPgJWTm+ PIbcYBSJ2tY+BYk5DTFFmYiRgmYROIL0qNrDfiE9sEaytb72TlmOiLKwjDkBpiM3oSXB 5S8w== X-Gm-Message-State: AAQBX9fwoqEshguaNsK0GQyWAJb2BNzbyClAmtOg6Abd/ZrO0p+0WfSb a8/f0iWYMOrcIzIKYmtd9Ck= X-Received: by 2002:a5d:4092:0:b0:2dc:c0da:405 with SMTP id o18-20020a5d4092000000b002dcc0da0405mr10175531wrp.34.1679926264832; Mon, 27 Mar 2023 07:11:04 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.11.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:11:04 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: [net-next PATCH v6 04/16] leds: Provide stubs for when CLASS_LED & NEW_LEDS are disabled Date: Mon, 27 Mar 2023 16:10:19 +0200 Message-Id: <20230327141031.11904-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761530956630338590?= X-GMAIL-MSGID: =?utf-8?q?1761530956630338590?= From: Andrew Lunn Provide stubs for devm_led_classdev_register_ext() and led_init_default_state_get() so that LED drivers embedded within other drivers such as PHYs and Ethernet switches still build when LEDS_CLASS or NEW_LEDS are disabled. This also helps with Kconfig dependencies, which are somewhat hairy for phylib and mdio and only get worse when adding a dependency on LED_CLASS. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi Reviewed-by: Florian Fainelli --- include/linux/leds.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/linux/leds.h b/include/linux/leds.h index d71201a968b6..aa48e643f655 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -82,7 +82,15 @@ struct led_init_data { bool devname_mandatory; }; +#if IS_ENABLED(CONFIG_NEW_LEDS) enum led_default_state led_init_default_state_get(struct fwnode_handle *fwnode); +#else +static inline enum led_default_state +led_init_default_state_get(struct fwnode_handle *fwnode) +{ + return LEDS_DEFSTATE_OFF; +} +#endif struct led_hw_trigger_type { int dummy; @@ -217,9 +225,19 @@ static inline int led_classdev_register(struct device *parent, return led_classdev_register_ext(parent, led_cdev, NULL); } +#if IS_ENABLED(CONFIG_LEDS_CLASS) int devm_led_classdev_register_ext(struct device *parent, struct led_classdev *led_cdev, struct led_init_data *init_data); +#else +static inline int +devm_led_classdev_register_ext(struct device *parent, + struct led_classdev *led_cdev, + struct led_init_data *init_data) +{ + return 0; +} +#endif static inline int devm_led_classdev_register(struct device *parent, struct led_classdev *led_cdev) From patchwork Mon Mar 27 14:10: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: 75480 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1549612vqo; Mon, 27 Mar 2023 07:21:23 -0700 (PDT) X-Google-Smtp-Source: AKy350b6g2YLvxVjbB6smxAdSjmfr7WCdSJSGGgc1rKwLnfVdHwo5rjALi5UIka/bkY5+o75n15j X-Received: by 2002:a17:906:4e0a:b0:931:829c:9d58 with SMTP id z10-20020a1709064e0a00b00931829c9d58mr12478406eju.23.1679926883149; Mon, 27 Mar 2023 07:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679926883; cv=none; d=google.com; s=arc-20160816; b=CoQx9cwtnq0ErQXgrtd0QPLHAYan/WSDpO0XgOGg1VjSQWdQ64kSlX/DqJOY63pw9n a+CZhBrpH/U5/Ai916ilpJv/gRXfINK5CfdFtpGMt+vxqphWLEojxyZ3IHB+R2V8EztR Vyz8pTz+Przcb81tI4P137GROWU7RIhcA3+a5PzdcHUNmYIU7/jnl3a7eZiYGwaXq6Vc 7NE5LxL7lMY3Vw7hnPxCA5qblWUyh68uimtbOID7U23PtbJNgEOfHTi8xRrCyyjvjaj9 wr1M8Fkj4HdZJn03yHygujCsQl/OHEDF1T6Q6MfwHO+nPJVmd8djazmRIdHYI3qGdOBG aehw== 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=VS4Y4VE+qD1sbEQA++3DBYlzLaLe6ttk+7bys4bpMfg=; b=kn+HKz4c0T6xekkrlv/vnu1zKo/pjlvjXIczbfJyUUwL8FDeVZekMcyhrJp91Gicm5 7/17+mlBaxDqgBlXD4bmLk1a4qXMVLEWPGmuY2StDF8NAefvZBXJTzQXSYZ/Vv9SuhLC mmp7HiGCCLiTil+qPsnSmtbHYVUCoQgHQjOghcZV9nlb/cKy+AoUZS9cUCstLneSYbBE RzBLX2DtS3wusig/e0GypEbVewjhIc49+GlGyJyweKz//sDg8NQm5OcQVP3TOMHMtM9w EdbsQiWPABliSri8LOWZ90MoQi7lby1x+RDQHjcbcrZH8rijE7EjIlxQxREdXvkLZ3V7 tRMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cM2+GKmy; 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 cr2-20020a170906d54200b008d6d20d1920si28104849ejc.35.2023.03.27.07.20.58; Mon, 27 Mar 2023 07:21:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cM2+GKmy; 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 S232630AbjC0OLl (ORCPT + 99 others); Mon, 27 Mar 2023 10:11:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232401AbjC0OLI (ORCPT ); Mon, 27 Mar 2023 10:11:08 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 373B1FD; Mon, 27 Mar 2023 07:11:07 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id e18so8938971wra.9; Mon, 27 Mar 2023 07:11:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926267; 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=VS4Y4VE+qD1sbEQA++3DBYlzLaLe6ttk+7bys4bpMfg=; b=cM2+GKmy1XCwbinUNKI+uBWEsLSstaR9GMVumm6cBIc+FYJZ3ptKARqeMbKmxyg/qJ C9fuYDgXd64G6zdvqnKfu5SQVOBNpJDkR1fHEqdJGze0wN+TubNqFHuTsSocLiCnC6S1 Qie78HprbbWbD4bqgnPrljqUyAa6t3B2XLfC1FdlJEgRjvBBUGZ3Azef4ETeBaodM16o dnCBPIzBa5ILCjkVO+WbUye7FbGK8v4A51SJCbgvtb6cc1fj0+mtEkRbIK4vtkWlkTaU VMlDYRi0tyU7tRkOd16GpWgMLKEqlCQCHAtthiNWqRY/1NnQS4/7D3Z4JHfdq0WkFJ5d MWqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926267; 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=VS4Y4VE+qD1sbEQA++3DBYlzLaLe6ttk+7bys4bpMfg=; b=Vdfa9zRBAkOdS4rA3wJDsWa/rZBPVN3BpRCj/gP+Cz+ZpKmBFkWrw/Gu1+pMoaN7Mj BvF4g4u/wyuFBY8mxp8BJ2rHeihdNN0gotSbg7TXXZcUCvv4UqGTBBC9eT8jZwY4WYTt gcUz6YJDkGWtmhV1DyB2rD2ARqSNsXFsW5O7lwpaFysvQn/eWBFwFTR28+CtYBCTSIeE 7hU+FRObLe6Ap7dDTxGlUZDzESy5vafkdHZ7yRcpu/4lRou8hjUnW6AchtZMfnrjhjky LcczxN/6GfUwDbXdOUJQXrv58wNi5C+wluZGwa1pqon4s9g+6NNJhg+42YRQ+nTVLxBu DV9Q== X-Gm-Message-State: AAQBX9fL7kxZKIQp0ig1hdbLZ3nH6KGohjFocikeqHXvHrju3bc7ozmb 2FzfU0qAGG4rUJuxgCy5gVQcnvOuNEg= X-Received: by 2002:a5d:4a46:0:b0:2d4:766d:e02f with SMTP id v6-20020a5d4a46000000b002d4766de02fmr9778530wrs.59.1679926266602; Mon, 27 Mar 2023 07:11:06 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.11.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:11:06 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: [net-next PATCH v6 05/16] net: phy: Add a binding for PHY LEDs Date: Mon, 27 Mar 2023 16:10:20 +0200 Message-Id: <20230327141031.11904-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761531011382599097?= X-GMAIL-MSGID: =?utf-8?q?1761531011382599097?= 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. This allows testing since the LED core might otherwise reject an LED whose brightness cannot be set. Add a dependency on LED_CLASS. It either needs to be built in, or not enabled, since a modular build can result in linker errors. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/Kconfig | 1 + drivers/net/phy/phy_device.c | 75 ++++++++++++++++++++++++++++++++++++ include/linux/phy.h | 16 ++++++++ 3 files changed, 92 insertions(+) diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 54874555c921..ae03562efe3a 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -18,6 +18,7 @@ menuconfig PHYLIB depends on NETDEVICES select MDIO_DEVICE select MDIO_DEVRES + depends on LEDS_CLASS || LEDS_CLASS=n help Ethernet controllers are usually attached to PHY devices. This option provides infrastructure for diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index c0760cbf534b..39af989947f9 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 @@ -674,6 +676,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->leds); mutex_init(&dev->lock); INIT_DELAYED_WORK(&dev->state_queue, phy_state_machine); @@ -2988,6 +2991,73 @@ 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; + + cdev = &phyled->led_cdev; + + 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->list, &phydev->leds); + + 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) { + of_node_put(led); + return err; + } + } + + return 0; +} + /** * fwnode_mdio_find_device - Given a fwnode, find the mdio_device * @fwnode: pointer to the mdio_device's fwnode @@ -3183,6 +3253,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. + */ + err = of_phy_leds(phydev); + out: /* Re-assert the reset signal on error */ if (err) diff --git a/include/linux/phy.h b/include/linux/phy.h index fefd5091bc24..11fb76a1c507 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -600,6 +601,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 + * @leds: 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 @@ -699,6 +701,7 @@ struct phy_device { struct phy_led_trigger *led_link_trigger; #endif + struct list_head leds; /* * Interrupt number for this PHY @@ -834,6 +837,19 @@ struct phy_plca_status { bool pst; }; +/** + * struct phy_led: An LED driven by the PHY + * + * @list: List of LEDs + * @led_cdev: Standard LED class structure + * @index: Number of the LED + */ +struct phy_led { + struct list_head list; + struct led_classdev led_cdev; + u32 index; +}; + /** * struct phy_driver - Driver structure for a particular PHY type * From patchwork Mon Mar 27 14:10: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: 75482 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1549774vqo; Mon, 27 Mar 2023 07:21:38 -0700 (PDT) X-Google-Smtp-Source: AKy350Y19NJrA0MKXX3sCZB2x1q4zpDhiJdVnIFJkBDAnbaJMY19DmzjLRXJ1dFJhq02a+7M5VZH X-Received: by 2002:aa7:ce0f:0:b0:502:24a4:b0ad with SMTP id d15-20020aa7ce0f000000b0050224a4b0admr11216570edv.4.1679926898186; Mon, 27 Mar 2023 07:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679926898; cv=none; d=google.com; s=arc-20160816; b=gp7lK0jLt/rZE5rQCVMNhVQl9jLtNATlZm0KustdxTRnYigq0sHipU1XCqD6M4dx1G JOBxR5VZmbPJYyyCdb0YOTmNgFVady/SoMovzL2+fww3YQ23T3nGamBvAvd4++RyTNmH k3wU2wvEpSaJHtaY7O2VxiFbBKyvjYOL1+ctR1vqd5q/HvGDHEXWazBW0ysBWSoXI3Sj N40VhbajUyPaKjFVdFfTm+yrG6LzJVDs40Ba054sM4m9x33+R6Va4hyvxAFWVExjl1yB sOzDtY7/ZjCzgQavBBAa0zV3lw8YyWLbRxCwERTAby1LvRMBwYjCP1QjyjWnnbqCJ24o Vgbg== 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=NCx6caR6IZgTqSPdn2HwL+62wmCa1NHNRk8GEDmxS/c=; b=le1/pwlsBXwFHNJpHF1eg+2TXnKS79oTvSoMXANGfUwV2MU1MnGsSkSV5giYPy9lz+ 4Jxu4tuhgiBhvIHUEQvEtwVkKXcsTkvR/UrwR1F/OCOziv1RG6aLjoNr1BND5scMRBjn 08a/byTd0Seh6z/ttx9sQfh+WIAMEwGkjcnQQ36ax4CeSa1NkkgKK30Wf97ePGDaEa4H cqWL3eMiDZfwl3UmtHLE6vknR5uHD6xTGIdytIj9xzu2e58aJlY3LfwduYhyywAZlXzm RQ5j23OkqHC5nSMdDUFvYyiMd5+eIhW7KWYxDQ8braL9+T2mla9mw8EwofUGw9LJGxvo rO2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SuNkCJ5n; 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 l9-20020aa7c309000000b004acb37caea9si29271902edq.344.2023.03.27.07.21.13; Mon, 27 Mar 2023 07:21:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SuNkCJ5n; 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 S232806AbjC0OLr (ORCPT + 99 others); Mon, 27 Mar 2023 10:11:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232543AbjC0OLf (ORCPT ); Mon, 27 Mar 2023 10:11:35 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8BE749C2; Mon, 27 Mar 2023 07:11:10 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id h17so8935554wrt.8; Mon, 27 Mar 2023 07:11:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926268; 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=NCx6caR6IZgTqSPdn2HwL+62wmCa1NHNRk8GEDmxS/c=; b=SuNkCJ5n76SuyMydmVY30jYSlLMqt5ctuxMv0YdpxEzdgUvl0dJzVUhVkAQWGcUCeH bOuzYtrgR3SmYFNfl65Vlw7agM43eMZ3+hwNXoBCqoglPbcXFiwsX7pH1aX89wxGVnYG D9BAK2lv0e0nKBZoyazzTgkYPiWQ8zvNTdsoUPPNeu42Z1G4prfSuXskhV8lemxlweUD EONcIBC/QOGlLbHluyPdrVEF0URJXsmF6zayRonwxbJKbKLNELVzqpHhI4kGGHFIpC1g ohnOK09ygnHguPlCNHEOASMVGhh31tRxpYQrG9RNLlpGvzhSReglIZva26RV6z43d0DQ G/ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926268; 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=NCx6caR6IZgTqSPdn2HwL+62wmCa1NHNRk8GEDmxS/c=; b=tmvBJ6W9gBC+aU46Qw7pgAnDHmHzmtS2hQQGaNm+kILPg4XpoD9m+ODgzpS2/7MIEQ 5DXUP8AbDKKt9W/sN/+FGOom4Nj9QMi/cskYmgavlAxhBynPp/HPHJjHBF89qv8dJxaI xY/Cj/enDf4v/D5qzELnKCFhv2focgw5TbS2iMJstwpntPAyPdhNulggQwaHtksjL0Dh w9W97dX21Y5oa8qc0BhauAohuHv/TD6HxCAMWR9nCoZOt6n5KdZAzWimeHjPtzIFYvo5 xEPyixhHtYBZkmQTottKycWxShQcC+pqXKsVCaQluQhxDURzbsiMokXSQ850tx3NtluN GMcQ== X-Gm-Message-State: AAQBX9dWQWxE1sfJYbdVlxrns/yj3kVHS8NBXHHUdkmp2/XPXF9TLran T3m7jrOTMpWwyIOV0icMOkY= X-Received: by 2002:adf:e9c9:0:b0:2ce:ae4c:c420 with SMTP id l9-20020adfe9c9000000b002ceae4cc420mr9564282wrn.3.1679926268243; Mon, 27 Mar 2023 07:11:08 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:11:07 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: [net-next PATCH v6 06/16] net: phy: phy_device: Call into the PHY driver to set LED brightness Date: Mon, 27 Mar 2023 16:10:21 +0200 Message-Id: <20230327141031.11904-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761531027141142297?= X-GMAIL-MSGID: =?utf-8?q?1761531027141142297?= 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 Reviewed-by: Florian Fainelli --- drivers/net/phy/phy_device.c | 15 ++++++++++++--- include/linux/phy.h | 11 +++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 39af989947f9..141d63ef3897 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2991,11 +2991,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, @@ -3012,12 +3019,14 @@ static int of_phy_led(struct phy_device *phydev, return -ENOMEM; cdev = &phyled->led_cdev; + phyled->phydev = phydev; err = of_property_read_u32(led, "reg", &phyled->index); 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 11fb76a1c507..2a5ee66b79b0 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -841,15 +841,19 @@ struct phy_plca_status { * struct phy_led: An LED driven by the PHY * * @list: List of LEDs + * @phydev: PHY this LED is attached to * @led_cdev: Standard LED class structure * @index: Number of the LED */ struct phy_led { struct list_head list; + struct phy_device *phydev; struct led_classdev led_cdev; 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 * @@ -1072,6 +1076,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 Mon Mar 27 14:10: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: 75481 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1549622vqo; Mon, 27 Mar 2023 07:21:24 -0700 (PDT) X-Google-Smtp-Source: AKy350aWYdDsowocePpoAqdjKBuir92bHvgDAMBsgI64sgJruvsiB+H0URPhZ8ePKjukV8vs54ag X-Received: by 2002:aa7:cc04:0:b0:4fa:fcee:1727 with SMTP id q4-20020aa7cc04000000b004fafcee1727mr11336425edt.13.1679926884622; Mon, 27 Mar 2023 07:21:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679926884; cv=none; d=google.com; s=arc-20160816; b=yfmjAFdHWL97SsVIEMsRSRkipUAgHxw0JXdlECCHpZS1XxXC3eTZQ4YJhYsbkhidzo fsXbi00BS00GDBUVd2pP5JeO2ov9Rtf+9iSgXMtLBEqp3ndlhKOdsDWjza4qYsfqcH7t zhy5ycAJGvYbNnnqIqlldC9EltR3bEq9YS8mxtf2X0dNw7JM1jJIVot1GUWxJynNY3R5 wteZz8LJhrMz6mnULrHcoZrzMakPM/uwIoOWu+M05ovwOizbX35NvdKEry5lbwl0I4X4 z3dho74gF2fZ9Dn1OzPQfyBz9fKtI7giGwO9/j1uGY9hDSMZEA7wSC2aq12khLiV8RbJ V0kA== 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=bVPm5LTqdstAjglzeKOLAIOblz6QeFFvOdN+bAnB5DQ=; b=ZmhYWZ+aYOwy75KorTA+KVWtu52YcfxNqRqbRAf8FfPViREJfQVDoHKqVWDF10xMlf C/onA3ez8z6hhPi7UkOoQwA24QqgliBo/OKw8eR7FpiJpB/TBeUsYbOEAVFWGSLdN4g8 abTsVb177oPvEVnrdVNnlGxq2cq82lyEET7S93pzMCYQA4TInNrQXc+25QHQQZdRNTqk sDi70yzJ+G+NxgMDN5tBlo9TGBYmRbZi6AnahTK/rkpWXnmE1MSsdIpknmun6uJHV4PQ vFNuN1gxCV3pxo8KR3aJhV5CREGmGppwcrEwf5fUlzOLO2xNH2fO3La1R/yodGmhl2YC GAdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Uan5J+Sg; 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 o19-20020aa7d3d3000000b005021d88ac44si9319112edr.381.2023.03.27.07.21.00; Mon, 27 Mar 2023 07:21:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Uan5J+Sg; 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 S232543AbjC0OML (ORCPT + 99 others); Mon, 27 Mar 2023 10:12:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232763AbjC0OLi (ORCPT ); Mon, 27 Mar 2023 10:11:38 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06D5159C4; Mon, 27 Mar 2023 07:11:11 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id v1so8961447wrv.1; Mon, 27 Mar 2023 07:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926270; 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=bVPm5LTqdstAjglzeKOLAIOblz6QeFFvOdN+bAnB5DQ=; b=Uan5J+SgdnRacxOuVP6099V+JI4h1XGNzESQgiK5xEoWXOOvWXRVq5cht1ZHpsQWMF sUKGm0TzI4kfTAPPrj7KzBEtEhg8b3uMWJtwfkxUFgBdwa0mVKchwa0RGh7BaZuGfsLK rqT9V6l8ooWArRr8m8hLmQtpLOZ/22uK50mpp+W44IGu8dJ232+38pzzoSkQvfd6WH/e 4YMTBoMJ+yWM/71DnROwsEbB7oMpwgU6ZSZE5/5AJ48Bu+3suM/m90/clTpC69oEIOcE 1YaSfwftZmBlEQGYFmJSPWeMYORRjj4MQfpXEWCeba7381+HmbwxROcy7YftIY98AQWo hyjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926270; 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=bVPm5LTqdstAjglzeKOLAIOblz6QeFFvOdN+bAnB5DQ=; b=7va0VSBR0lD+X1PkaCSjnKR8HJ9auv6umKGt8ISjtlnf4jqYxGRUNcxPj3WrHrokHN 2iGyxV6pJv4N/cu0Q1QuZyp03GE5zGxmvipL5dGN2agFo+4+/71kGrhMWLUBfIR+kfs7 1JpqPAsBKu7DNO6ARuwpr8DSF95/xJBi8Pbo2WwzvPrEBRcu0IX1ZqADUFyF473PBgNn VS4XU8r76uykuIOsjiv1bfkaW4zhjN7OkSkVERycSthcBkexM2WDem9sfsZvWL5GQill 3eYPhHqXm11WOXPG1M7lehAvup/gxbKujz07h10OMbkiyTkBzeFeojIZFgB4gxTKIjYu y45g== X-Gm-Message-State: AAQBX9fiuBrZWRoTfbBh0Zuc7MVUDmyPPoWAy7nqPYvjZEtig0+snoDm h86xo9vWfmzhdKNLIUuoTWQ= X-Received: by 2002:adf:e9c3:0:b0:2da:90a8:7180 with SMTP id l3-20020adfe9c3000000b002da90a87180mr8921913wrn.3.1679926269816; Mon, 27 Mar 2023 07:11:09 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.11.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:11:09 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: [net-next PATCH v6 07/16] net: phy: marvell: Add software control of the LEDs Date: Mon, 27 Mar 2023 16:10:22 +0200 Message-Id: <20230327141031.11904-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761531013014244156?= X-GMAIL-MSGID: =?utf-8?q?1761531013014244156?= 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 Acked-by: Pavel Machek Reviewed-by: Florian Fainelli --- 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 63a3644d86c9..5f4caca93983 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) +{ + int 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 Mon Mar 27 14:10: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: 75463 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1546608vqo; Mon, 27 Mar 2023 07:17:18 -0700 (PDT) X-Google-Smtp-Source: AK7set+5d7GGdapQO/eOPs8qY4ICHEf7y2194v/AXT4Wu7lINwP/ZnlDSdrVncqRTGHKeh0/su+w X-Received: by 2002:a05:6a20:9146:b0:db:c5c:e0a3 with SMTP id x6-20020a056a20914600b000db0c5ce0a3mr14957696pzc.10.1679926638104; Mon, 27 Mar 2023 07:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679926638; cv=none; d=google.com; s=arc-20160816; b=Np25EaYeoQ8WOGJUl4vMVB5KFearHYelJ+lBVnPGOV9/A2yw3yDw+Rmutp7dkcbwQP /vO+o1X/RAiNsIqvZvagBwVjYaVUs0dqJZ6T8oD3LOtMC+/zOLXLgHZiLWUkTZzKK+b9 u9I0I5/k4mo31Ztn81y6ZEwdSduntlLGjTx5N1vzrm/elKuo4y+yXBnXfRUeFSPvokl0 AHK1hqYzGtxBU028JicGpuGQjvP7hdqUukGhdu0krln2Xp6Vur8AVOr6Rb3JxD9+SayO TEed9G8F9q3PYGekEh/labSdUMA4JyGppI4k678rmp4pduMeFKn2TbNwArUY+2FNBCZY FhQw== 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=bRiYNrAPbY9LjHto8cdOA0hKely2iuKhfCEH8qUJeKY=; b=zijGT5HlRa1/YX11OXqrgckD0qEfdsTnWivLGrduDIxPTjU3WPnIf9AnoA5UygvuDn Vhvikq9j75cQzfLmqP8mGsEf7L2F6j1M8foa3ohvXW0AiUWXcOMa611wR8Z1FFpPV5sA DNMGq/ZCdwpxYPpa3E63mvHdUbEH8OCwAEhPX6APtYK0GRTGtIrOaq4Wmk0a5nrKTZVU e6Ugsd35HpTBDTXCs3tsr360IKbEck1yeNZTsvv/Zrb4isjDoEEYwh+oCN8uKn5cIDla 7C7RnnwLkDnGnG10lElIPZ1e48ZiOCvIt0XU2ehvuJjDGABAwkWBNQWi/G01AZZcY0X1 Bn1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CNM6QGOG; 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 v16-20020a63d550000000b0050be2ca268csi8269303pgi.762.2023.03.27.07.17.03; Mon, 27 Mar 2023 07:17:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CNM6QGOG; 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 S232777AbjC0OMH (ORCPT + 99 others); Mon, 27 Mar 2023 10:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232767AbjC0OLi (ORCPT ); Mon, 27 Mar 2023 10:11:38 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BB5F5BAD; Mon, 27 Mar 2023 07:11:13 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id l27so8959455wrb.2; Mon, 27 Mar 2023 07:11:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926271; 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=bRiYNrAPbY9LjHto8cdOA0hKely2iuKhfCEH8qUJeKY=; b=CNM6QGOG+p9Jm8pXUoNu0FHagC/JN1PPMk6W47C2fDsyjH+SsXK7POzape3ilu99Yp /DKa2luEgWDowtLoT6AyPZv3fiAPl9I4G1tUBFkV5o4Bkec24jYEsDByYSeRhwhToIy+ goFQjsk2yFqEW+G09ch6c0iTmOU5ZMUqBBx/+/RJeBv441oWBj4V9I4S8v3Exc7mNsW4 zMp3CgACqn6xVMJ3G3LSUwnvGo3A4Ga5ATyhJzhmfpSzLEKl33Ye/f0RKVX2SwUtEGmD gX6YO2zD0pkBuwAAEqA9+vMNQc7vGyFIBAtPoLCLXWu8noro7PsHblCzg4pjdtCTKYTI M+lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926271; 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=bRiYNrAPbY9LjHto8cdOA0hKely2iuKhfCEH8qUJeKY=; b=HbW6XnnmJQmt7nNQhfTDxjEjkNGhrXCpOD4pvoZrfLdiOyzCi9kjqaG0iswKt/pr/0 uAiuHq5vqyrbg/F/drTAPDRbumHyOPspfxD6QXOUjbeMDj2u3SYaIkqaG9bmpK1KCaSU uDZ/jKFuSOtsG0wPGWwfMi02humfDZgJSwt1VtjXSu22BuS6h3eaR5zxBxmjWBAxARjn 4BFkmE+84pXuW3duMEA5w7ct+qoGr1OsXBh/w1FvWx4pb154JsRhPSpWNmWunDNDXbNL CWga52mJKFPe6eb+yPJHkgBcsd81J/tYhNeoJGuSfsXiU4NyVwTTl9UIS8xMeFbKu6oX FpJw== X-Gm-Message-State: AAQBX9fu5+PBYhDetWXF5tpzz7U5YHmKYMF0TuH2x0OlJR0KKl11xiXp qVC/2/LmMigIbYk/lJyj7tY= X-Received: by 2002:a5d:4e52:0:b0:2cd:bc79:5432 with SMTP id r18-20020a5d4e52000000b002cdbc795432mr9735430wrt.25.1679926271438; Mon, 27 Mar 2023 07:11:11 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.11.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:11:11 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Cc: Michal Kubiak Subject: [net-next PATCH v6 08/16] net: phy: phy_device: Call into the PHY driver to set LED blinking Date: Mon, 27 Mar 2023 16:10:23 +0200 Message-Id: <20230327141031.11904-9-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761530754463753929?= X-GMAIL-MSGID: =?utf-8?q?1761530754463753929?= 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 Reviewed-by: Michal Kubiak Reviewed-by: Pavel Machek Reviewed-by: Florian Fainelli --- 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 141d63ef3897..79a52dc3c50a 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3005,6 +3005,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) { @@ -3027,6 +3043,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 2a5ee66b79b0..cad757d55ec9 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1083,6 +1083,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 Mon Mar 27 14:10: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: 75469 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1547960vqo; Mon, 27 Mar 2023 07:18:57 -0700 (PDT) X-Google-Smtp-Source: AKy350aCgyZMkHHVUiTQDAOaNrIzMndplQfs4yQteWUrb4Rta/f6t4i4Qrr2GOE+9ecYC0KRLL22 X-Received: by 2002:a17:906:2990:b0:92f:a6d3:b941 with SMTP id x16-20020a170906299000b0092fa6d3b941mr12947416eje.30.1679926737660; Mon, 27 Mar 2023 07:18:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679926737; cv=none; d=google.com; s=arc-20160816; b=kshRZm4PYTM4TVn5WwFDRyHvy3ftlU0QAlXBoAnYo0hbMeJiLwCj9dpIQmSTO69DuD cx48bn5M0YzTTHs+0npAqWT8EdlGTHI92tixxxLHz2UZBUBqkW6ciIVqD/0LJbWpgPO5 5/K2NYeHojbpnBwF3Vpkj1RLxbCOFq1ptBgUAGstm0TPJQf/JOQE3DsT6yTMjfhUfbGZ dZtF6RzCN5nzFp4e0AxEHprFZRU8E+O2+qncdbBsoOPnQoYtQphdJT1fivagdNukErUU JiHwpQpJm1VWS2zEBdLWYC8+deD8PwNJDkXLV7oj5GYYZGBAM//Ou6Sc2g9cU0QfLKPT nJDQ== 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=ZjvAY85UXOr+ThDvTHRudHDXforsIMNPqrBvOVPkO7w=; b=NCfCsSMxpwGHSsj7Bz9G4WIVAvt+yKr61SYQnxmxglWvBYn6Q/8SpmdH6vHUhsSvzH EC+d7VqfNCDeGa/XtN0OldGna/pBB/aD+EiZVxxBuWNuEYOLHOS924W0UDeVpkarHFM0 lhGnM9r25lW53hY5wmWUz4J2M2Vhsm03DDLkrJcWCmX+p5OPlC5U+fw3x9c7gbqdG89h 5qBJ2lUsJcLj9nhw4xVSXToaNKBXmcDdUG0NkTW++NMWJWX3H5/4xOSVvMhWV/UzjY4E OhpG8PtSxuc+8QmV3hEoSf3VilGLlfFWkxawK7Za7rn3s0uafUF9VTNlMwbCiV5BuAkz 7ffQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BnBagk+9; 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 y14-20020a056402134e00b004cf350e3463si13516602edw.185.2023.03.27.07.18.30; Mon, 27 Mar 2023 07:18:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BnBagk+9; 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 S232812AbjC0OMP (ORCPT + 99 others); Mon, 27 Mar 2023 10:12:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232787AbjC0OLj (ORCPT ); Mon, 27 Mar 2023 10:11:39 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E395C469E; Mon, 27 Mar 2023 07:11:14 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id q19so5881880wrc.5; Mon, 27 Mar 2023 07:11:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926273; 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=ZjvAY85UXOr+ThDvTHRudHDXforsIMNPqrBvOVPkO7w=; b=BnBagk+9VpROq4Tf1RT9RRu/EhgB2nIGt8rdECWKEYlpOn+2R1KjpHlKJO/6REt+aO XFGR5TfJKQ0nuUN5fTbNDE946t3JktNw9oJj0u4t/vMygscrUNVxoqK4m9qEsN1Z+pJF MZqCGo9dsFhLJG38XvG6OSEUAclg5Tj5K5po1Yxb47WEz0nhRQf4Q4IyHNDQFKXAUx+I BFFlZ4/rZ1JVQEbcq8Swdhj9tMseeAbRbohgKSHGg/WXdpofX69nY9r4m/XLtINhcTT2 cX+l0rouWy4G2Km3KG9sEXFRA2fq72z9y7xKXgubftbKT5GUrdUJc+q1yoBG0Sych1a/ zHWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926273; 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=ZjvAY85UXOr+ThDvTHRudHDXforsIMNPqrBvOVPkO7w=; b=OxpHOJVSzTu16ML4HbATn3j2Why6WIsDt/vo/4qSrWYDm4DLoj+/xbFEJkAS+KxLkO U84Vw1Qu0DToBXKGQHcse8k1awL2Wb4rlvXkAdLBufLRU29OA1/yW4LGPRNvZ9WWvbs+ XmPPZjevq5gWi5bjSdb9E1HilmzKFaG/f86N3F8sNbuYt8XMIrgtSEiORZX2NdMJinN5 6mQLWXvQ+ZjbA5ofwdhmaHfz/Kwi0x8MKL1VvjzkstRXjfGHK3TQlQSl9nUY8bpvEyRb gx8osmkGI7vfyighexGE6grOF+IVHDWMQwdSUnMHUqOoIhCpQKPBYi2uWYmy4jqZvBDr YJGw== X-Gm-Message-State: AAQBX9d4lDXLx/SG26AEr60iCnjHi3KHcJtlaNmqxoCiKgzNeYE4ZZZq tZ32JDTgXf/00kvBDR7UYg4= X-Received: by 2002:adf:f04f:0:b0:2d7:a918:a2b7 with SMTP id t15-20020adff04f000000b002d7a918a2b7mr9525140wro.48.1679926273273; Mon, 27 Mar 2023 07:11:13 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.11.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:11:12 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: [net-next PATCH v6 09/16] net: phy: marvell: Implement led_blink_set() Date: Mon, 27 Mar 2023 16:10:24 +0200 Message-Id: <20230327141031.11904-10-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761530859029140913?= X-GMAIL-MSGID: =?utf-8?q?1761530859029140913?= 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 Reviewed-by: Pavel Machek Reviewed-by: Florian Fainelli --- 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 5f4caca93983..c00f67f229f5 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) +{ + int 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 Mon Mar 27 14:10:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 75471 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1548266vqo; Mon, 27 Mar 2023 07:19:24 -0700 (PDT) X-Google-Smtp-Source: AKy350Y04FJ0juiH/InwOT5rH8YKSM6zsVhuA+zyAcOWzVQd8Y+Oq04AOK9lH0/amuCBezKgty0o X-Received: by 2002:a17:906:e8a:b0:930:bcee:eed with SMTP id p10-20020a1709060e8a00b00930bcee0eedmr12997797ejf.9.1679926764268; Mon, 27 Mar 2023 07:19:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679926764; cv=none; d=google.com; s=arc-20160816; b=aDBKOuk5KeK141sP6vhBH1umVPswUnpWUTSuKQAc9FvgNAIFPEOx1QPmZNDGMjmsg3 PY7auCETvYnnbjquojourpHeOoaoE7RCIoyzqWjIri1ceNQAz74KdG5RBpJFv1HAF2+2 J8Y0QEvyQIzOUCs83vTRC30kJ8+tifBxdSuCUtDVJCqDDyPG1Qk3fXkWLzkX1Q2R/o4h WsYZxvVjl7CdcN+JasHdUMuEPEBBwiS7G8v+Jq0dJjn2f4sL36w9RkG3YeeKQO8AW9aW rSHgE8sSCFNEmkLaYy8m9dtzbGe/7iwVHuJP7LjURLkL/5p/S7FTE3bJnBuLjOqB867m v9vg== 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=nAbMbzGoAUXhien3wP1TBou62FlRCxoeRd6GPGyBVkY=; b=j5HSKF8tYxvXpp6eOfL3HIdKLaoOOKkE9+oTlpqeA/K13zB2rMJqsyVc2KDEbqoX38 idVNUmj0AZY7RLDndtNiupVRTWJJCfBKiO6JPqsO6pEBC7A0wQnLsOaEqta49vHPSt2N w3V6S3evXFdykLLafU0Xss1CEiD2iFDgLv38s3WA3E8G98Cxesnhefgwz++Ftzb4WsFI JXAzMI7Hj1JedXQwsrcCaQmW9GM1gjDgEK7HmsMj2Ul95xmoe1SE1VgUgkc2T07TAuLs e3KxslsDHWfjj+JZoYJL+Ty4WIbx/wmbD08Jp9KF9d6JJ2kerdRRzFVpxBZJQzi6neRk dBSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CcaljGgq; 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 o24-20020a17090608d800b0093defbd626bsi7745028eje.1010.2023.03.27.07.18.52; Mon, 27 Mar 2023 07:19:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CcaljGgq; 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 S232957AbjC0OMX (ORCPT + 99 others); Mon, 27 Mar 2023 10:12:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232698AbjC0OL5 (ORCPT ); Mon, 27 Mar 2023 10:11:57 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA1DF524C; Mon, 27 Mar 2023 07:11:16 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id l12so8926941wrm.10; Mon, 27 Mar 2023 07:11:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926275; 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=nAbMbzGoAUXhien3wP1TBou62FlRCxoeRd6GPGyBVkY=; b=CcaljGgqjESmV23PIrcxN9126f60ZABls3i6N2zF/oRUFiympEC3g88iZyVjpMsu03 w2tP4bc6lNH1cv1kp19qwmOnKbaJbd34R5xdwHITjKvaFw1TUuuQVrr6Lf58OO+z3iKz VtlazM4dVBahjRyWYbN9I9tSKwwsmLP6Qh4OW+I/Tf/FNE/kfxfc4ZhkjZ13hMxt9vBb WMoWQoXSEMM4yd1PJGb7bFaYnWFG1lAXm95k4POCK1YtDe/y6lcvCCQwagWghcMFdB7c v+YtmhPYh2KMUensbuSy5TcZSmtDLNV/n/KHg7Qe+lHtwFsNGI9GQNkJdS1iS3IHV/ZR yMaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926275; 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=nAbMbzGoAUXhien3wP1TBou62FlRCxoeRd6GPGyBVkY=; b=nqwZvjDd1KlV6oKsQcBsxuYratFiXS6dizr1USUs2nRnK5ZNIQfK8DOY68IuHxU3R4 Mymb4/LMiTkVIAZg3YHwy6oLz2/b7/xCYJCu8GhNJAAsVpRtpPNZIrlRv8778lLN52i6 aGvaIUYEWbPJ1G/JgREbw+ySjXg9f7A4QApGgWmpBHAjh9Ux57O+pe0YN/TArJZEppLS PM1KT0JBHzpEEPzkH2MYWIboskOcX2ph2lgxMNktKUbSqveuru+dx6UtOqQTkv4wSpoi GZO8uPLb4kBd6e2x1FMbMYEu8vjDhJvAUrwYlcNTQ4EDu41criSRmgJVBkZChaVdoEDD 0feg== X-Gm-Message-State: AAQBX9dlsCohcaBMp/Z93hUmRw9P9hYV3MzCAL4BPNUF4X05mQ+k9H1+ OUqHMLKYPkmCIcEBzmJ/cJc= X-Received: by 2002:adf:dd87:0:b0:2ce:aa62:ff79 with SMTP id x7-20020adfdd87000000b002ceaa62ff79mr9994473wrl.40.1679926274843; Mon, 27 Mar 2023 07:11:14 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.11.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:11:14 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: [net-next PATCH v6 10/16] dt-bindings: leds: Document support for generic ethernet LEDs Date: Mon, 27 Mar 2023 16:10:25 +0200 Message-Id: <20230327141031.11904-11-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761530886939105414?= X-GMAIL-MSGID: =?utf-8?q?1761530886939105414?= Add documentation for support of generic ethernet LEDs. These LEDs are ethernet port LED and are controllable by the ethernet controller or the ethernet PHY. A port may expose multiple LEDs and reg is used to provide an index to differentiate them. Ethernet port LEDs follow generic LED implementation. Signed-off-by: Christian Marangi --- .../bindings/leds/leds-ethernet.yaml | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-ethernet.yaml diff --git a/Documentation/devicetree/bindings/leds/leds-ethernet.yaml b/Documentation/devicetree/bindings/leds/leds-ethernet.yaml new file mode 100644 index 000000000000..0a03d65beea0 --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-ethernet.yaml @@ -0,0 +1,76 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/leds-ethernet.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Common properties for the ethernet port LED. + +maintainers: + - Christian Marangi + +description: + Bindings for the LEDs present in ethernet port and controllable by + the ethernet controller or the ethernet PHY regs. + + These LEDs provide the same feature of a normal LED and follow + the same LED definitions. + + An ethernet port may expose multiple LEDs, reg binding is used to + differentiate them. + +properties: + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + +patternProperties: + '^led@[a-f0-9]+$': + $ref: /schemas/leds/common.yaml# + + properties: + reg: + maxItems: 1 + description: + This define the LED index in the PHY or the MAC. It's really + driver dependent and required for ports that define multiple + LED for the same port. + + required: + - reg + + unevaluatedProperties: false + +required: + - '#address-cells' + - '#size-cells' + +additionalProperties: false + +examples: + - | + #include + + 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"; + }; + }; +... From patchwork Mon Mar 27 14:10:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 75467 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1547721vqo; Mon, 27 Mar 2023 07:18:37 -0700 (PDT) X-Google-Smtp-Source: AKy350ZusqqnOat4iuhGRmr+Bg9vUSyZHtiiKvovAzEnCYMsokumU1KkqngKFXJSBw7sTK0yh8/6 X-Received: by 2002:a17:906:f84e:b0:930:af80:5b9b with SMTP id ks14-20020a170906f84e00b00930af805b9bmr11784653ejb.1.1679926716902; Mon, 27 Mar 2023 07:18:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679926716; cv=none; d=google.com; s=arc-20160816; b=kPKNeNu5b76nTyCaMk/pFHi4ixcUVKoeT7JIwDdF5ihltL7v9a4j9nB6PTH9ky6bM6 9Ke5nwUuOJIuzxCV25rHKXcMTYFycPGUf8uGYVdM40YpfqntbKWUxP7kL5AhD4ilN1QD L/UDUv1iamPEN2prnqO3r/LlSptsdSB5+s2fDWwcer566Ja2+SYVjBVZGPN6T+jefIQa FzgCx5xmMJXwFsUsIqmg3Aag+UIbvPVilhYHBtP3P2VYKYmES+dH/jAVKQkoHZggj2ul 2lzSjYy1o5jF3sTI8KGBRyOc9WxKJ9XCKsvvPTXG6muyySkCHmyxlo090ZHwjjPx5am8 6Alw== 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=kRx8/9Oo8Ezq1aHd7HdN9nepqFDv6AoXlmRIJbikFuk=; b=gC2WFazkh6XjTY8qD6XxVAv4oAOvoiNqrMwf/PB7ppOT3Qpx1dIyoKCZE2eI16xdqZ umoy0nZRWaL7OYknot/v6Bva3YD9uhNXaqwHsH8wCaHTlrHLnDmXZk/l4a6wQ6JNQTua ATUGlsedEXlDdsmQOun16ixBrYx60Dzg50oOJuK+mfzDifJlwPnRe1XnzrjNqxLi8TC/ g55+gSds9MnBJZSRypCIh4u9ze7Mq7SdiUyvmqw959HchF9a2gEQ50ReWeXcamocoGYo A2+1vdwHd5IwF9ZomeK3rht1LVLDn3GnqywwmdIqRijxOkSwtnvG7kAGt3tcVtrJdfyQ PX2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PfKUtNWq; 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 qk34-20020a1709077fa200b0093600fb85c9si24902962ejc.80.2023.03.27.07.18.09; Mon, 27 Mar 2023 07:18:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PfKUtNWq; 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 S232976AbjC0OMf (ORCPT + 99 others); Mon, 27 Mar 2023 10:12:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232734AbjC0OMD (ORCPT ); Mon, 27 Mar 2023 10:12:03 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A12155AE; Mon, 27 Mar 2023 07:11:18 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id d17so8931102wrb.11; Mon, 27 Mar 2023 07:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926276; 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=kRx8/9Oo8Ezq1aHd7HdN9nepqFDv6AoXlmRIJbikFuk=; b=PfKUtNWq3gqDlyLY18gk5tD5VBGNVZa+wUwyTRsZxYlEu9lLSZcjnS+L87V4NFXjXZ auk4OEqDxDvCkNtiD8JSfLEUfddHaKdkyH4Kw1gcNZUDHmgg8YywEyQCr6FxYPcE5CoR SzEI7CfGV/U5MwIkXMCaaGrnvNFR3vnw5mDtQPDY+R6r8RWUQ5JBlBy19WtY1nKTrFHX ArFTcsyl7jrG3T//YctjNW+axo0FABK5GsMWPYI22/tlDafaBQKAWMLt4ig6qQr9+E2s 4BYh6UjHI4nFrDIyzUmZI281rUxkLbhOokfgDy/q9sRnldN8wa9y7oEKm3/0QnzxOLVu Z18A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926276; 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=kRx8/9Oo8Ezq1aHd7HdN9nepqFDv6AoXlmRIJbikFuk=; b=JaD0Bfe8TJwA1J+Oq3AVv0aEJPl8edt2jsxliCFNuiURCa3vXFYpiu8OvnCuNQo/XL BmvtLC4lTRay/VZs7BeO0J6CQluxB5tYdiWXYJhexf8z2b+FGFliHyZ2yiyukHHOtRLd WXCLUEB1BqCduD3RZAwmvmsV30v+v48YBojqQ+LudrLhKvFfESTn5m4lS6i3NAaLvZrF Yxe73jvVaGyC/bs9KIJphdxE/dB0G599pPq24BI26fkiLCcueHSX7ui3ADMnh7sClF7v nwRoUm8xYwA0zAYJMSsWElPOBqHaT4k9qkixC81BSpSvNnRsZIQPEPmtVIl8Ltd4Ai5s 1tpw== X-Gm-Message-State: AAQBX9do8VEpFkak3YUxZyiKAQGZPFqOfkVDj5hdvhqlsWObZACKAEr/ t7TBW3fmIurIJyAWJPhojFQ= X-Received: by 2002:adf:f9cc:0:b0:2ce:a777:90c4 with SMTP id w12-20020adff9cc000000b002cea77790c4mr8409285wrr.31.1679926276396; Mon, 27 Mar 2023 07:11:16 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.11.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:11:16 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: [net-next PATCH v6 11/16] dt-bindings: net: ethernet-controller: Document support for LEDs node Date: Mon, 27 Mar 2023 16:10:26 +0200 Message-Id: <20230327141031.11904-12-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761530837047345132?= X-GMAIL-MSGID: =?utf-8?q?1761530837047345132?= Document support for LEDs node in ethernet-controller. Ethernet Controller 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 ethernet-controller LEDs are controllable by the ethernet controller regs and the possible intergated PHY doesn't have control on them. Signed-off-by: Christian Marangi --- .../devicetree/bindings/net/ethernet-controller.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml index 00be387984ac..e2558787531b 100644 --- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml +++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml @@ -222,6 +222,16 @@ properties: required: - speed + leds: + description: + Describes the LEDs associated by Ethernet Controller. + These LEDs are not integrated in the PHY and PHY doesn't have any + control on them. Ethernet Controller regs are used to control + these defined LEDs. + + allOf: + - $ref: /schemas/leds/leds-ethernet.yaml# + dependencies: pcs-handle-names: [pcs-handle] From patchwork Mon Mar 27 14:10:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 75474 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1548446vqo; Mon, 27 Mar 2023 07:19:38 -0700 (PDT) X-Google-Smtp-Source: AKy350Y5+hDWtwsBV4S0nBemw5QmTmvq3SSUawJ4AX/i+x1zCBLD/TNxKdYs6orNqvHhjrfN0PQK X-Received: by 2002:aa7:da4e:0:b0:4fa:a1a1:9e14 with SMTP id w14-20020aa7da4e000000b004faa1a19e14mr11287346eds.30.1679926777942; Mon, 27 Mar 2023 07:19:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679926777; cv=none; d=google.com; s=arc-20160816; b=bmodUbd5WJLvRDj/N9JSZ7gzwI+8oEN844KlbIupNxPIHuIqwMVPwCP4BFQq3r9+KY vjy06h78qrpztOT/vz3h+WFla8h45LupoOgi0oruI7+Bl9hgPtlBRaPbE0UUPC/ALpDu JW7b6Fdb2VkbRNEe5ddGMfFYfTMRqYMcQ0A/HoWidpX7ZbX0jKiW02JbcIEtiBwI4Tms j0lGz4pq+A+dfmpQ3OlQ75HlcaVuEDtBnrbzMSdba7KmBb7SwCzzxWg0G31F7ppeW95k Rqga/TREQek+MYQPaHC4+K44WU6uGafAFpdO1Z5XT7FeuiiDcxsRNwqKMCTz+UZyCxvB 7vPA== 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=3Z6/vpShlUlg/J0rkwr+qjoQBR81Rffp5jMKcKsFHNI=; b=LheoR1krQU5DwgsJG663BasPj/jBCeM3Oo/WmAk9T8w3baPEuvzOcSX/bGpU4NqTUd V3/EutvaN1LLcQOvaiz0vHvAkvXqgJg7H7pdfx5wNFyMo+rIkJBQip9MpT6Uk3MDX+kX uuoElQMxsC3j01AKpp1DRu/DfPwlpCuUz7vI3cWOrJ4iTUMzNeIA4xsNSxkrsluRAOcS JBgjeXXD9X2PieQRjkSpmlFkfE5NCYOJBMBvHeQzxY2RO2Adhnn4JG7olQhown1gYECB 0aIjN5Lau7DhYJz5LHRjH5PBvecIWPhhpUJzYUr9nWTLJLCh8rPywmPHFoEUoYldNecp HTJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lp+M6+H7; 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 mp8-20020a1709071b0800b0093defbd6271si10890056ejc.1016.2023.03.27.07.19.10; Mon, 27 Mar 2023 07:19:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lp+M6+H7; 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 S232989AbjC0OMo (ORCPT + 99 others); Mon, 27 Mar 2023 10:12:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232856AbjC0OMF (ORCPT ); Mon, 27 Mar 2023 10:12:05 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 943725BB3; Mon, 27 Mar 2023 07:11:19 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id v1so8962018wrv.1; Mon, 27 Mar 2023 07:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926278; 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=3Z6/vpShlUlg/J0rkwr+qjoQBR81Rffp5jMKcKsFHNI=; b=lp+M6+H7U9MucCz9wGB7fQjadR8acyOZHoS+5jL8JC9QKyYD+rhj5QCH/p65CKgRmO Cs3fdKAcSGfB6GafxQCHo5p0v9xzqOatsWDtbmkCiNxkIZ3SX2hwlUHjyCsS3g80bBsk K2yxce0zqgXoC/8WqGrtsCyokYZIX0lEEKeerB4cLt0tgo7Gvz25e97fT3UDxa++5YVN h9Sm5kJoNTVQ7Y52qSuD0c3OU+gzEmreenWyaOiduiqCDhQe0bDGJMxuLeeGsg2HA2jy sTkPv45klKnzBLaiDfMBvyAZrIfEtam//It/VfMkbNBTP7jMKbgYjYya6vDowbcpGSft jbQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926278; 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=3Z6/vpShlUlg/J0rkwr+qjoQBR81Rffp5jMKcKsFHNI=; b=jRDooIU3jkfFYNYLOm8o2Vlz+pIkNLP3cMUEU1cpgHbckaRqR5xCxwOpObOW7omBtm tbKCktyEEvvxZopgmB/Kz1B9QKX3D8R8ajlI6J56ve1LC1K5Ug4IAzu0/di4rR3rALZJ mqQlbqlO/oQKMN4vmTGVcyeMcYQO7uw1/ywOvYatJDlaBz7aHrjaXk+mBeyi54McFBbZ 18i/ZK3XjcaODl6JdgTMomSYE3sbeexfwTzeEKp5+fJuvrbR21AbM8bTC2GJyXba3UAP rVo6uXjdziDkiCLN8cQ6VfVnG8oUNnyRmvklGx3qHjPK9PJmhyPQYSqh1wA6FHgRkyCO eN9w== X-Gm-Message-State: AAQBX9cP/CSuXw9sxr3ESM+Bw7UpUhlrzTWkqundYG3Y3wY5MP0iuvKx re/rn7NykYTRfxpOFWd6470= X-Received: by 2002:adf:f491:0:b0:2ce:da65:12d9 with SMTP id l17-20020adff491000000b002ceda6512d9mr9863140wro.15.1679926277917; Mon, 27 Mar 2023 07:11:17 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.11.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:11:17 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: [net-next PATCH v6 12/16] dt-bindings: net: dsa: qca8k: add LEDs definition example Date: Mon, 27 Mar 2023 16:10:27 +0200 Message-Id: <20230327141031.11904-13-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761530901316948898?= X-GMAIL-MSGID: =?utf-8?q?1761530901316948898?= 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..ad354864187a 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 has at most 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 Mon Mar 27 14:10:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 75483 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1549851vqo; Mon, 27 Mar 2023 07:21:48 -0700 (PDT) X-Google-Smtp-Source: AKy350Yrz+gsLyIF4RJPEVahjThrEUeM4NKkdjVonGZ4EkbJvAbFpHFN7bheOSETHX50V5GcDUGF X-Received: by 2002:a17:906:738a:b0:92f:bef6:7843 with SMTP id f10-20020a170906738a00b0092fbef67843mr11174468ejl.22.1679926907808; Mon, 27 Mar 2023 07:21:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679926907; cv=none; d=google.com; s=arc-20160816; b=N4wkcU71k7vvcOSQBh6Bns1ZAWZ9lnuqrkKcpXGIXAgj7R89kSo5m8TtU3RoOQh4om BJl5CL2x2eQws7z9dZLkqSOMwHNlghTimC6l4kiz2OGjJHYBWExLnrMzO/Tc+cMOOTCN tOiAkkOcX7EUiJ3M9wjp8m0fLaGqlnVJRD/GJV8RIxKzA5Kss7rram/lIFtXP3Im2k5i jsMOAfq4aLi8LANIvaK/jOhjgFXO6z63jLowdBDIa9qke89YgjfxjFLx9qvtAhKALgej harO1SJX7zfGKytzDNGunSnMkD4RKDchpNiOjBQQLjKBuFlRUvwupjJfty7ar6Es/qLA A3ZA== 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=O5lY5FAvjIFTXdgk0MSqYRMciVkIZrsDjb6VN8aqyM3nlszqnLaZrqpwXr7lEq3if/ OVQmwMZyG24YhSgRnP6wvygI/0x4l6EbfGoHQYlNakzzNXCCcG+GBTYuJ4HrBQ9vxtL0 KLzt5cZ2D6y/wW6H4Avs4/G36I7tOhLR/Rd7H+Nxw/bYm9IIWNMMVpfJjTGNZyfBxnDM sA6kGhdSV1D6CKW4IMoy/iLgnQkfeHr7hKPt4DBlox6U7/aQgNTI8vK4JONZN3a/pM3O syQJCVm1JwEJLDYmeBXEzo/SKHCMplbF0T+X058/BHTt4Vv/eGfqdcKDam4Ypkd/gBbS AYog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GJ7fy2U1; 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 f20-20020a056402005400b00501e4bca007si16441686edu.39.2023.03.27.07.21.15; Mon, 27 Mar 2023 07:21:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GJ7fy2U1; 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 S233004AbjC0OM6 (ORCPT + 99 others); Mon, 27 Mar 2023 10:12:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232785AbjC0OMI (ORCPT ); Mon, 27 Mar 2023 10:12:08 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A84815B92; Mon, 27 Mar 2023 07:11:21 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id i9so8959119wrp.3; Mon, 27 Mar 2023 07:11:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926280; 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=GJ7fy2U1vl0eCvIMSPBSrtQb3Gbu/tNzAxV9bgphT0SlEpIc0uURSH25hMP4LervFD rs1SYtK7i/80Ic6LdnW/OAmEOUA8sA7b0eI68Lx8IzpLETOVv13emxgOHomItE6AVnMx qeOfG6XAZe8FRvzVkzowF+mf4UxmJccGpyItXJgPTozUAsSLyNeEAO/w+wRJNIdkV0UD 2m2nXiVU48JbuTtFzyNPupWzqPFclReFYk0dtSP4OHMWss5VE/I1KSavfPtwmEVmyJ1p V8gItfWkM+JFnSNUJ0yIFZ/x703gTRr74j7guiqhTFW0BDAo0tfoG0FBXqeGafLLj0ug aflw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926280; 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=SQ9wd8+KgNTkMD5qeeGrNVuVptsoOAK2bQS+VD8lzIeHNUazGYEnObw2eqsCFh23vs 85kwMMJUVtSnamcyI6OdvJvNAw+4JTg3Ag2lJB0W9Yr6BBqtidRMOiE1TtvTFBesyfdE AJl9HolN5ENk6fRzSZr7xK896avmHKkyDzmz/Fedg2SpU3XFBjsU/EEnbTLDYrpHuUhz 7kRw2Gc+zyq1e1qKMiZ42dVRobU3u/qSQ9XLOaAbiTyH0JH2XPnNAj6DtcuBZgn+bPzq E/EFRJH8OVg6F3Xqruvm+mDfSXEdR94Moh3cD2326HwuS+/ZvsIBvF5sc/7fksHBXm5e HXvA== X-Gm-Message-State: AAQBX9fZYT8ic6VEm2vkggpAu5gGzyTk7OaECo42AFtQbZ00AIZOuGZQ ksUleObQEY24CMrLTLUiaSU= X-Received: by 2002:a5d:408c:0:b0:2ce:9819:1c1e with SMTP id o12-20020a5d408c000000b002ce98191c1emr9592889wrp.30.1679926279590; Mon, 27 Mar 2023 07:11:19 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.11.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:11:19 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Cc: Jonathan McDowell Subject: [net-next PATCH v6 13/16] ARM: dts: qcom: ipq8064-rb3011: Drop unevaluated properties in switch nodes Date: Mon, 27 Mar 2023 16:10:28 +0200 Message-Id: <20230327141031.11904-14-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761531037067284417?= X-GMAIL-MSGID: =?utf-8?q?1761531037067284417?= 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 Reviewed-By: Jonathan McDowell Tested-By: Jonathan McDowell --- 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 Mon Mar 27 14:10:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 75475 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1548467vqo; Mon, 27 Mar 2023 07:19:39 -0700 (PDT) X-Google-Smtp-Source: AKy350ajzzSPKoeW6e5vvV++b8D8IYFiiBfxE76kTPuIG7601cFT2KzO1RnWilNVt0RJFv/vy1NH X-Received: by 2002:a50:ed18:0:b0:502:240f:2704 with SMTP id j24-20020a50ed18000000b00502240f2704mr11161029eds.4.1679926779037; Mon, 27 Mar 2023 07:19:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679926779; cv=none; d=google.com; s=arc-20160816; b=hXzQIxdwExhNfV3aJSzbvH7rEqa4NRcz1uo+P/EbeTEMnuz0xDAn82fHy75bBb/H0G 6NVB+W2rXxhbVb2IYmRuS4xHh0iVoq1IH+FqfJ++kJCacuWwiNcTwkiaU1D7SFJ1Dh6j Aor2a1dYJ7qYIAE7UjMRvbQ6hgqBp39WXArfkMtNSFvJ0TpNhpwOxqYq7UdImYaY2HIB 74hP1iVrvnG5/P04ThYzI0Cd9taU5NgfrY14D2i2JFOPGJV2a3n5IgIpJch3W9bfLuXN uvpDrggBJfCPwmijy9xDOVE4c2Y+fk2ZT+ZgNhuGWQAISVQKoD+C9W70n4paTV5zxeVK mk6g== 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=v990BtUwpO2o2wqLvD9BGqmRSyQiRbHblcgDme8SSsQ0xAX7KC7Lu7Z9fvKlledPpN jVyBJG2BDTP3a8FfAkGGEqGV99glUJmX99KakMrZU9GD5MTje/BE3AG6RBqE5yVh0YFD H+QWyK0yDOgH5lIOHnYHgon0+MVPoRhPzVimIaxyZfEbkpGzVv8l77E3PYbbZYDAHCa2 IPpIqAe2ash6zpU4mRnkRPYsKE//LrgtSLxcF7oR3E4e97yV9bIIRgV2LpwZhF+wSasH Xc4nZdY2CfrXH5eGWo1KobsWsVt2ylI8ppKzSfkrH/St45lFFAoPUkyLIo1X20y83+p/ c0Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Aau3bKl0; 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 by5-20020a0564021b0500b004fc3796b401si26973625edb.337.2023.03.27.07.19.11; Mon, 27 Mar 2023 07:19:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Aau3bKl0; 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 S233019AbjC0ONB (ORCPT + 99 others); Mon, 27 Mar 2023 10:13:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232786AbjC0OMU (ORCPT ); Mon, 27 Mar 2023 10:12:20 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 640D819BE; Mon, 27 Mar 2023 07:11:24 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id r11so8933903wrr.12; Mon, 27 Mar 2023 07:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926282; 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=Aau3bKl0Faip1gZpIvhQqkrG6yIvReZj3HRfyt8/bwDm0ntA7hfwBmbFP+w/G7/DDN TvGLpV0smiqMuRXKg47C4/SsBzcm2zbrAJ4mwqrXKDjlyeHVvUik6O0NSx/ntBVPKE4i GRdlPm1qINSLCl4/VAnVf0RWskvSPgdZ7n2/EeWuXlzZE3faTAEv17XsqO4JoPqYr70u e0pBaY5kgXnLmVPb6gPGMHAlUEpW/eL5HWafIaxfdszcqdJcewyVk953gl07ouH9wQCA GHfZCuN9QkllVSVghdxrlOM0T2Xzoox63vfwhytFVhitG411GqC4jmtOcB9el95zQtzs OJEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926282; 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=udv46BsxG5jMZzUJ4/U8QfLI6pJcBDdyyiFQUBSqrZGY/vlzPuzPKweAkR45gT7Im5 AHv10XXacg1Wzop2zYwJ3jgTIwrCNlOjuMxVdAJuN3WaiY2TzDoAaXdZw5n50Chi3QRX 6QsrWFSfvQZJ9uNQtUds0/eLI8Rx2mOr6C0z6EaxQtLkcBsUnrgBHoTgKncdW34CpiID ly3HT4aw2IKPSajFyFbu0TeIJ8F5m78MhAbPyOG7A5GB7QebueHulVzZOaOBy3TM0T3E VaB90LHAB1ZLm110Tj6oJfEmu1Vb+4CykvJASo+4Pi/Oxf0aYW2tfZAqYfgGIhdkTgzp Gz4A== X-Gm-Message-State: AAQBX9f9u5QDbOvz5tu4yEvQvOz2KJCJNaoIBrFJX0gQOixrEZA1W7WN w2eMwGrFvgeVcehgKGz45ME= X-Received: by 2002:adf:f6c9:0:b0:2da:de23:b555 with SMTP id y9-20020adff6c9000000b002dade23b555mr9981054wrp.51.1679926281981; Mon, 27 Mar 2023 07:11:21 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.11.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:11:20 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Cc: Jonathan McDowell Subject: [net-next PATCH v6 14/16] ARM: dts: qcom: ipq8064-rb3011: Add Switch LED for each port Date: Mon, 27 Mar 2023 16:10:29 +0200 Message-Id: <20230327141031.11904-15-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761530902105473256?= X-GMAIL-MSGID: =?utf-8?q?1761530902105473256?= 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 Mon Mar 27 14:10:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 75478 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1549012vqo; Mon, 27 Mar 2023 07:20:28 -0700 (PDT) X-Google-Smtp-Source: AKy350b+gmDulUuADBrUoB1+NEeLO7VM+XmxARoVETbgmzyuU4qWJeBcIsF3VwxX+NxSxrYjPOO8 X-Received: by 2002:a17:906:8a41:b0:930:18f5:d016 with SMTP id gx1-20020a1709068a4100b0093018f5d016mr12745417ejc.15.1679926827933; Mon, 27 Mar 2023 07:20:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679926827; cv=none; d=google.com; s=arc-20160816; b=Jq1F8nM5z09hrG3z6pXs6mmCU6/UblRGRPuSSlhSLlPXUeYsbJfJ4ljvwsuTrxCmJF ICx0ed1miiqL7RpWIePjOUUfvglwBkHvkNXxYNDuiKEWDFCU4U7YV5PuKW9IKnr/86St RNSIgTp7MeeWS/J6EKFLQa16SvMghslPkv8+fCHbCRPLzMlFiTOCq64Ig21wcYdlGzny dsfkTUX9Aw1wdz8XNkSYcsA5fr6NJ7YOnga3d9JfY06kjSlpDvOxIjjkYUaCPmzLZmh6 ozCP4Sc8AiUZs5MGy3q3e5XO9yMYNUoEjgGl16J+alY+2lVifO3FUMjtOJdVtPfVcSkQ V+pg== 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=LZH9Sk2pJzkh23T3pvC9mL7PUp+XT9d2pmz+5Sv6HfU=; b=zqM/bKeud8GZPxrOPk23nXQ1q/qmaJUHseMX3ZkdibCwx0x/rYYTQ4iC3bIz2qu/hB +jdpULa4HaB2/9eb/NFavHRDFV3v9G4Zan8SmdTKy/ITaDVgmJB0JM4VgvKohsDXoeKU +nYK6iSckeBYlgD33XI0mFmB06W0lJNXrJ0ubQWGez+QK1hO6BGVlu5cYWALENBQWayx 8/NiKnKgeuEsk0jdW4lpybPNhO/DBZtKhy8FOoQcomgxIy7EkJKEnm2bBptsJHr6SfqK eBJKEqZ+Rior1PV0F7xAuFofz48i5jFuIIC0sbgQIPqlZ0pefvqoKLl9pHMH56Qe93Y8 tOAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hiQgcTNb; 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 tg4-20020a1709078dc400b0093e6f0395c1si7438438ejc.687.2023.03.27.07.20.00; Mon, 27 Mar 2023 07:20:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hiQgcTNb; 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 S232757AbjC0ONa (ORCPT + 99 others); Mon, 27 Mar 2023 10:13:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232734AbjC0OMn (ORCPT ); Mon, 27 Mar 2023 10:12:43 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A2FD61B9; Mon, 27 Mar 2023 07:11:28 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id h17so8936487wrt.8; Mon, 27 Mar 2023 07:11:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926284; 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=LZH9Sk2pJzkh23T3pvC9mL7PUp+XT9d2pmz+5Sv6HfU=; b=hiQgcTNbjTwyK1DtXN7v9cBM9rutp52Kssl34K2jFzAy52at99qRhQjWzRb9BOYKV1 EFtjwAhl02g8g5F1CVaa8N0oLKCQjT6jyOVeg6mJtSo/Yclp9SCLDpZj+ApT9VG2o9Dc JCL7/91K1ZOL868IwehOslNdkUkiCL9+oTl1XmAwQ3BSp+D+lGCUuNChW51bCfjlgynZ 80cFtL3QSEDmq1cdH+1xi4HdXSVPdO0JwjjVD9P7wLQ7QGQD/Q3Pa3TGB37a3Ot+5rTG VMAYLJS8+ePGHI2CUW20iY0Po68kEOMn5RNTVnpYIeo15slk28a/WfOU3Fi4/PmFy7jl 3UuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926284; 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=LZH9Sk2pJzkh23T3pvC9mL7PUp+XT9d2pmz+5Sv6HfU=; b=iYLJzcTROVlaSg8pTBOArpbWZ5wOLXMMA7HkDggN7ZmBWG3FkUjt0WafCwP5roPdPm MeelYgmIpbDCiw/DYc724y/1FzuRj0x7O9Kdw2iBUkk2QlSYBgBjYkpb9MJIFOx7IaBE 4GE3kQhH2UgpRbDgR4Dgmir+mZl7vqg1+RquA7hcYnDQat+r9HUpYYrukovWapmXmsj6 hcPzO5UfbUqVaZpfiy4pwJ3utljefP98nWdmNYOiJPevE9cPpenGlo6Fs8u15K6vIRB4 RW4DtgMT+YkDlJQnfk+BggFLtuYAb6EeuISU4/Q5lhvwpuGw+FZ2DSvTnXtJZxeyDJQv rKNw== X-Gm-Message-State: AAQBX9dI+Af4RLUtsjPUCZdf5Oam4/WamlCt8o64pKl8KEZfLz/2p2hL IaPzMVPpjHm62p+BiyOI0Vs= X-Received: by 2002:adf:ea91:0:b0:2c5:9ef9:9bab with SMTP id s17-20020adfea91000000b002c59ef99babmr9424322wrm.43.1679926283679; Mon, 27 Mar 2023 07:11:23 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.11.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:11:23 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: [net-next PATCH v6 15/16] dt-bindings: net: phy: Document support for LEDs node Date: Mon, 27 Mar 2023 16:10:30 +0200 Message-Id: <20230327141031.11904-16-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761530953321799704?= X-GMAIL-MSGID: =?utf-8?q?1761530953321799704?= 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 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Documentation/devicetree/bindings/net/ethernet-phy.yaml b/Documentation/devicetree/bindings/net/ethernet-phy.yaml index 1327b81f15a2..1e55e028c918 100644 --- a/Documentation/devicetree/bindings/net/ethernet-phy.yaml +++ b/Documentation/devicetree/bindings/net/ethernet-phy.yaml @@ -197,6 +197,10 @@ properties: PHY's that have configurable TX internal delays. If this property is present then the PHY applies the TX delay. + leds: + allOf: + - $ref: /schemas/leds/leds-ethernet.yaml# + required: - reg @@ -204,6 +208,8 @@ additionalProperties: true examples: - | + #include + ethernet { #address-cells = <1>; #size-cells = <0>; @@ -219,5 +225,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 Mon Mar 27 14:10:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 75503 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1566440vqo; Mon, 27 Mar 2023 07:48:18 -0700 (PDT) X-Google-Smtp-Source: AKy350bTXKYL3POCrQh+CqwjtkTF6lpYwikW3Q7hwfrmlkkhT1QYWUKc9w8g+5U1fd6QXghScqDE X-Received: by 2002:a17:907:6e22:b0:930:3916:df1d with SMTP id sd34-20020a1709076e2200b009303916df1dmr17214490ejc.0.1679928498495; Mon, 27 Mar 2023 07:48:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679928498; cv=none; d=google.com; s=arc-20160816; b=pciKUKRYHERjwWzF0L6CAw+dr79OBDN1np4jXKT4kYC+6INQOcP+KVte+7Ocqs042H mFst+3EXw80o7JDvDoITQQxKlVMLpd+Mbi4G4KJocODvSbzbYeKr1G2n9LmHQc2OCQaN MUb3iEic6Fio441nrZRwiSOczfWBFrq4bEC0uVjSS64Q9JMYJaBMD1ksLfX4ylojphNt 0kXXf+Wg+kHfVD8p/9wyvbODMx/NwWt8ZLAlsI2moaFBlduVI0oEy5SizpOkGPdxeIA5 SkHsuE+dyN9gKzM5uUmBCvYFhFtb8Vk5lPI4lW+bqFLHpmMQDJY2QeaROGwWNBTj74An 8N+w== 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=oy4rJp/0zV8uQx96aqdFOna+cm21IPd+B8/oErRDE1c=; b=rej1i3u94fnVWyC9taXrfw1ZTS1oh0Fb6uXD/XjbPItsZ5kOGUJX0jgaCPx+u8BlK+ gxksWJ3aUPDIJFLXNqT4rSmOFXW5If3zguobgioK4JoSIuvDO0jpbwkt+XJSIkl3wUoT d5H3CBrCwseipf9ai+27P4Pne1Nh+jRELVM4Wabbf+MVbmY9SEHKWb7Y8dK4ekZtuguc fwytmKU9MAKr8rbJjoFH0kvdOYSPeRW7aIccmMkzu8B4ho9j7GNDNyqLIVKkAXeSUybu KE3RR3WKxQRIIYqMsU0c0qVwzod5TUUTF5fs0GpEDdkrm1keuUit+gXLlR/OeQYIzpw+ oyuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=N1+9G3Tu; 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 nc24-20020a1709071c1800b00945c481efd8si1587227ejc.110.2023.03.27.07.47.55; Mon, 27 Mar 2023 07:48:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=N1+9G3Tu; 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 S233051AbjC0ONe (ORCPT + 99 others); Mon, 27 Mar 2023 10:13:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232866AbjC0OMo (ORCPT ); Mon, 27 Mar 2023 10:12:44 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 725CE658D; Mon, 27 Mar 2023 07:11:29 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id i9so8959448wrp.3; Mon, 27 Mar 2023 07:11:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926285; 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=oy4rJp/0zV8uQx96aqdFOna+cm21IPd+B8/oErRDE1c=; b=N1+9G3TumKrPZKtDgnUYD6HDreYZGrsnCsG3x6VR1o6zsdlKygYn5Z2B/6MK7uSEib /66G9qTuGKBx/QqmSMP7T42XAs/7GFQk8nHeM2yzmROF/lCWibWpheeY7B2GIYdPhN1b 9GOlfffc+AZNhfrEsFIJ3yAaWe0xtdGPgJ7Kl/Hxs1k3JTD2gzvl09ggMzmHbEwGGjX0 5zZz5BzkFOFGFyvfTTjuPhvEr8tGjp/IpmshsxkTYQ/MxRyhYQnC07KfzFJlhNkTtrfr U+DjoUUgEiUUffoufrfwBWTA2WZQ8MQAdVmgCLlpPjCWptllhVOFI+HVVbkY+10eJdED 7MAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926285; 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=oy4rJp/0zV8uQx96aqdFOna+cm21IPd+B8/oErRDE1c=; b=FMq992CpDPrMpcuoNU7v2pHnJ5WKkCjoRtruPc5m3muB4eg9xCAjexKkTsEroi+5hA durhU+5iBGOl/FoytHyGN6pLTqSDuY/4oc/vvpXD/yiORs9XLlExHXAFxEoVc8L4An/G +i61vETMfq9ZVUVG0vFD5rqTdjroN+gwJx2tmmH6zzDJZsXG0In7PZQKEk1cOmWrcK1u lqFFSjWFvUcKg/TBdi4lENPhFWZwAD+ogrU07Prv5zqlTQ+F/eC3wTnfl+jpwj86RfOh jr5rHMMI5fZZqc+W/WHSHoTm/Vq876gIIEmaHN3OH7NB8RINqn+WicFilTAO6HzRXXZ2 dlKg== X-Gm-Message-State: AAQBX9cRRe04NsHN3WvViu0vNRBelz/muQ6LV/Mpp7RhuKm7OiKkH2KZ qdll3xKrzazm0df3Kq7B0nA= X-Received: by 2002:adf:e5d1:0:b0:2ce:a7f5:ff10 with SMTP id a17-20020adfe5d1000000b002cea7f5ff10mr8517757wrn.57.1679926285261; Mon, 27 Mar 2023 07:11:25 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id p17-20020adfcc91000000b002c71dd1109fsm25307591wrj.47.2023.03.27.07.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:11:24 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Subject: [net-next PATCH v6 16/16] arm: mvebu: dt: Add PHY LED support for 370-rd WAN port Date: Mon, 27 Mar 2023 16:10:31 +0200 Message-Id: <20230327141031.11904-17-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327141031.11904-1-ansuelsmth@gmail.com> References: <20230327141031.11904-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761532705251800896?= X-GMAIL-MSGID: =?utf-8?q?1761532705251800896?= 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. 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..15b36aa34ef4 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>; + linux,default-trigger = "netdev"; + }; + }; }; switch: switch@10 {