From patchwork Fri Mar 17 02:31:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 71038 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp106721wrt; Thu, 16 Mar 2023 19:34:52 -0700 (PDT) X-Google-Smtp-Source: AK7set9+Hs1kMnLZOTJBTvOiymoZHgLBWMG6d3PqG9DzoNviXvsKul4WQHkjfbhCOeZoexYLmDuU X-Received: by 2002:a05:6a21:329f:b0:d5:58df:fbaa with SMTP id yt31-20020a056a21329f00b000d558dffbaamr7549506pzb.12.1679020492705; Thu, 16 Mar 2023 19:34:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679020492; cv=none; d=google.com; s=arc-20160816; b=t/VYwY3KaFUIX+h7upe0OnQltAZZ6kv9Nl0SS8W2I5VHv4VCCxIdu6yp/SbhU39ec5 gkfl7AvI2Mp2xzXUuZx/GizQiBIo/BIde8iv9WGRZvMl4dASXo0K8nwOTwmVvpWv0Y/G JZ1hgyS0Gs/uPWnMg3pRTqg1uIiDlvmOESpAAHP4X+5kRIQAPZYuzSZZ25OdwvRsIy3S 71DgzRw7xRO5YbcSH5IP0a16vraUJ2YHrsIGX9rhb4wfAfnzbgxgWJd+fziN6iTUgdIL 7YV2ME5h8OPXR1fnw62ORspM2qO0VDANoJUmVkhCqhuKvrXm7aYd7peVNZnGCDKKHPPH zpcQ== 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=ymG14CaAzsom/NpfgXxdIjVcFWXkyKWBzQS1t9W8TsU=; b=0SucO5wUeVzQrcJwZjXgX2B6R+QgpEv59tUkZdeKP3VGTbzvZi7FBRpFJKYwEYMtkr p8V9wks8y7a34yNtLxDeLZc9Iye0oDHvlBnTQR5cnOtjwYSnZxIe5TlnlpOUKiqh5dCe LOxSzfjfHlnU3sg5/Z6Rk0q0gvmy3R8I8wJmAbkArkkN25JhTPUTthtikoxLhknAJUt5 Lizeq07/6Aj1ue8ejImMQJlSCOEriEohBaT+EKiSBJj5o6n6GVvwI3d1zKvqGzxuySHk HVHkzhkNjxQZkXFvYjrBwSx15Nb7liuCrjYocjKvNad22PPGtpy6lUhC/IQXySDKI+GN 3fRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZnLfPimu; 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 i18-20020a63d452000000b004fbf6b6908asi1091103pgj.480.2023.03.16.19.34.40; Thu, 16 Mar 2023 19:34:52 -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=ZnLfPimu; 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 S229705AbjCQCdn (ORCPT + 99 others); Thu, 16 Mar 2023 22:33:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbjCQCd2 (ORCPT ); Thu, 16 Mar 2023 22:33:28 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35EA82C64F; Thu, 16 Mar 2023 19:33:23 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id c8-20020a05600c0ac800b003ed2f97a63eso4282955wmr.3; Thu, 16 Mar 2023 19:33:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679020401; 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=ymG14CaAzsom/NpfgXxdIjVcFWXkyKWBzQS1t9W8TsU=; b=ZnLfPimuNMRCq+vueikd9c51+25vJac2ZxxU7UyB76QTmrEIwo4rN+PyOOWNsvEoaj Jpk2GQC59J0kpQPcP4jlt+pBegpHzcQs6kh34OmzoU3nzzmauNRSFH96dVwUqrKqwO1J DR3CoZhP+vfNFcJET39aGxyGhiakx+KWxKqc+BVFrSlps7tyjCZJ+aMqv/hESueQcCW5 86DbqSuK0vu9AGUfCmv2UZkJQhivnD5SN5YoBUBk0UK0W4waKdMM4f7UdCROArjIZPZR e9u9xV6K7b65yrY8SOtrKbAfXKCOwPdLSi/d8lpeL9OBJrxV1MZTaeL5iHskCQsBiGVy BOzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679020401; 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=ymG14CaAzsom/NpfgXxdIjVcFWXkyKWBzQS1t9W8TsU=; b=F2cWIHXnky7rCW0qrIA59K+xbvZO2DJldf62Cf2VNibUxOm1fcUB1/UAoE//cYLB65 geJu5yxUTp9IcAaqY8QgQNPHQKyjkxMYbcU9BI3J8I1CiVIGEq+4QGqwJY3UTDc2wMbU f7OmEze//EvcDm1g+7i3l8xxGFzPEHMZPCeeQlt1v1LC9GjIk4j6Ka9QAiRbKa1TDtPx CRMVRf9M1up1y60eL+vQOZW/0hM9d5aA/6hud85WTVy4yKN+uHItggCanJ4nB6IEGNIO tDzmOiJ37DDah/qhU2aEdWWMYqkjO/4/7+5JTMPbot7fwImdf9KlpBNWnZEIpOWhXFis JBFA== X-Gm-Message-State: AO0yUKVQy3ggl8TY3G4qaoyxMpRqH4FPUUWRu28bZJ148gHOHZlWOfVB JNnUZr7C83FuQlykoB80Aoc= X-Received: by 2002:a05:600c:5487:b0:3ed:418a:ec06 with SMTP id iv7-20020a05600c548700b003ed418aec06mr5342265wmb.28.1679020401323; Thu, 16 Mar 2023 19:33: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 z15-20020a5d44cf000000b002ce9f0e4a8fsm782313wrr.84.2023.03.16.19.33.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:33:21 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v4 01/14] net: dsa: qca8k: move qca8k_port_to_phy() to header Date: Fri, 17 Mar 2023 03:31:12 +0100 Message-Id: <20230317023125.486-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317023125.486-1-ansuelsmth@gmail.com> References: <20230317023125.486-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760580592018092795?= X-GMAIL-MSGID: =?utf-8?q?1760580592018092795?= Move qca8k_port_to_phy() to qca8k header as it's useful for future reference in Switch LEDs module since the same logic is applied to get the right index of the switch port. Make it inline as it's simple function that just decrease the port. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/dsa/qca/qca8k-8xxx.c | 15 --------------- drivers/net/dsa/qca/qca8k.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 2f224b166bbb..8dfc5db84700 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -716,21 +716,6 @@ qca8k_phy_eth_command(struct qca8k_priv *priv, bool read, int phy, return ret; } -static u32 -qca8k_port_to_phy(int port) -{ - /* From Andrew Lunn: - * Port 0 has no internal phy. - * Port 1 has an internal PHY at MDIO address 0. - * Port 2 has an internal PHY at MDIO address 1. - * ... - * Port 5 has an internal PHY at MDIO address 4. - * Port 6 has no internal PHY. - */ - - return port - 1; -} - static int qca8k_mdio_busy_wait(struct mii_bus *bus, u32 reg, u32 mask) { diff --git a/drivers/net/dsa/qca/qca8k.h b/drivers/net/dsa/qca/qca8k.h index 03514f7a20be..4e48e4dd8b0f 100644 --- a/drivers/net/dsa/qca/qca8k.h +++ b/drivers/net/dsa/qca/qca8k.h @@ -422,6 +422,20 @@ struct qca8k_fdb { u8 mac[6]; }; +static inline u32 qca8k_port_to_phy(int port) +{ + /* From Andrew Lunn: + * Port 0 has no internal phy. + * Port 1 has an internal PHY at MDIO address 0. + * Port 2 has an internal PHY at MDIO address 1. + * ... + * Port 5 has an internal PHY at MDIO address 4. + * Port 6 has no internal PHY. + */ + + return port - 1; +} + /* Common setup function */ extern const struct qca8k_mib_desc ar8327_mib[]; extern const struct regmap_access_table qca8k_readable_table; From patchwork Fri Mar 17 02:31:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 71047 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp108945wrt; Thu, 16 Mar 2023 19:42:24 -0700 (PDT) X-Google-Smtp-Source: AK7set8/WWw5LupYmFegLn/mPgQ4Arx0Cezec4AP4TJ2sNj2ZLhadnpUTjSRZ1lMaScS9216tPW5 X-Received: by 2002:a17:902:e845:b0:1a1:953b:9559 with SMTP id t5-20020a170902e84500b001a1953b9559mr4222499plg.3.1679020943778; Thu, 16 Mar 2023 19:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679020943; cv=none; d=google.com; s=arc-20160816; b=OQvAtSJxi15sOuBdxn/G9FDKZpvufAog3hsR1TVQOshvlLSCp9G2SFOp47R3FLUSlG Z4wF9+UyzCBErZIUBPd0PXNYotjMevwaw2a6uUTeSZemNbXnlf+bayKaNtNN0nHuC+K4 ZWvIMR3+LkvGp3bz6bjdyCAYwf3sMdA9cQPTZzJ7lIXdj19ttRes/4IikZWEqjuZYWVw px5kiQmYaqiqSQnuNV4iSMzA/L3mLIthGYqbeQ6z5bLJh3O0aVvV0OoQqwYpmS1mdkT0 0Rnfggs5jn5awhkcZl0F5lVwx+40hpVeCu2cirWWCpSHWE3/entxmIscWrSy1VNa3PTy es+A== 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=M0xMG6givT4f8o19qLRLHBsIA04l82xMiUCl6G/kflM=; b=0j6Rl98QaBX61H1zCDEfckDRVZy6mjNQrXNlMt8PAux3ZOqzF3D84a4SfkIumr0U6A zrQO4mfIS2AuwioTd1UvCaYi4Ypo4Fvmh+LuQWl3imoGvuvLQiOIKDIf70c0n9P9J5Ee 7Nn7Nk20c4Z8xVqH1k3H6gm6bneGf6rdgew7exkXw0jMI6hZGY1J+/LO+xe7lOUf6NuM 8vLBmwJ19noyvcHxHFQJfm4iDGsm/wNjUaMnAheHer+uO7ZnIeLJ2DSpTAaNk/rB4tdH MZHik7IcPB8ZicvyH9iht3GvzaIUD79esZIpkWdM3+V48vjthn6ZKnv8kf9+VdmH2Yft pRvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bC458e1q; 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 i2-20020a170902c94200b0019cd505cdc5si1272984pla.440.2023.03.16.19.42.11; Thu, 16 Mar 2023 19:42: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=bC458e1q; 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 S229892AbjCQCde (ORCPT + 99 others); Thu, 16 Mar 2023 22:33:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbjCQCd1 (ORCPT ); Thu, 16 Mar 2023 22:33:27 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BD963431F; Thu, 16 Mar 2023 19:33:24 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id t15so3183670wrz.7; Thu, 16 Mar 2023 19:33:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679020403; 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=M0xMG6givT4f8o19qLRLHBsIA04l82xMiUCl6G/kflM=; b=bC458e1qURaA/VvgQSyeR3vF4HY/Sfu1FxSQrDTbzxwq22Cn9VYYfa6a42a+nxsP/s 3VwRmJtv7i4YKf+S5ynI2BwRU1V/0cKM0QL4pnG9mR347ZvfyB2ripPu6x+xUIWOLXhy 6grH2/vlIpGtJwRCbq8Pwe0MO0yU1TdlnKPIUsdrHiiwff9TlF8AsMyhwW1bwcq/3B+w OIcgw33UgUX16fDzV6ev1GwWnmz+oj1t3HnckDJePbgS0tjZ51kDbhzPswt/EUcuYhBb n8uCGWFW2ZOs9rlq5IUbroOQSOHs6lvkLPYvuWEuDAW3XoTHkWOrzsPlZd71NQVfeIRK iPmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679020403; 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=M0xMG6givT4f8o19qLRLHBsIA04l82xMiUCl6G/kflM=; b=GK+g2Bk0CauqsFMl/JKe61ynA6PLGTpe73uKszcql4Wf4oAQeoYCsVEurq/Ms/LGe3 rXwQ7KXnJwhy6bKO/ivZVFkQRmNnnOT6sj4wuTSeQSJdsnc+cyTeFjYwAql34sa9EVWo mIGOr1mLucouQ5C6YgezU70mkKtVYEQsrGsCwYKCbNrqFYTNRGz65X4MePCFQ2CFRmEs UTjzVfFreac8ZePUl47dXyta+WGvsAysKr9BtfdcRr3iXG2Z2Fcp5vQ7vcwiO5RExcCU VKypE8vHqySfDQIn1hjXQcs2u76IMY7zawha6D7S2buVWzgTzzszz0gWc8I7oJDcG54L JvbQ== X-Gm-Message-State: AO0yUKXoomNlP0N+h9AfpLYRazpeDx4YbbPzM9fjYb1dCanm/IoRENY+ M57mBcmLDVRrVY95NG7WkhY= X-Received: by 2002:adf:f150:0:b0:2c9:70a4:4f94 with SMTP id y16-20020adff150000000b002c970a44f94mr6479728wro.18.1679020402653; Thu, 16 Mar 2023 19:33:22 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id z15-20020a5d44cf000000b002ce9f0e4a8fsm782313wrr.84.2023.03.16.19.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:33:22 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v4 02/14] net: dsa: qca8k: add LEDs basic support Date: Fri, 17 Mar 2023 03:31:13 +0100 Message-Id: <20230317023125.486-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317023125.486-1-ansuelsmth@gmail.com> References: <20230317023125.486-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760581065161377062?= X-GMAIL-MSGID: =?utf-8?q?1760581065161377062?= 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 | 192 +++++++++++++++++++++++++++++++ drivers/net/dsa/qca/qca8k.h | 59 ++++++++++ drivers/net/dsa/qca/qca8k_leds.h | 16 +++ 6 files changed, 283 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 8dfc5db84700..5decf6fe3832 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) @@ -1727,6 +1728,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..adbe7f6e2994 --- /dev/null +++ b/drivers/net/dsa/qca/qca8k-leds.c @@ -0,0 +1,192 @@ +// 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_CTRL_REG(3); + reg_info->shift = QCA8K_LED_PHY123_PATTERN_EN_SHIFT(port_num, led_num); + break; + case 4: + reg_info->reg = QCA8K_LED_CTRL_REG(led_num); + reg_info->shift = QCA8K_LED_PHY4_CONTROL_RULE_SHIFT; + break; + default: + return -EINVAL; + } + + return 0; +} + +static int +qca8k_led_brightness_set(struct qca8k_led *led, + enum led_brightness brightness) +{ + struct qca8k_led_pattern_en reg_info; + struct qca8k_priv *priv = led->priv; + u32 mask, val = QCA8K_LED_ALWAYS_OFF; + + qca8k_get_enable_led_reg(led->port_num, led->led_num, ®_info); + + if (brightness) + val = QCA8K_LED_ALWAYS_ON; + + if (led->port_num == 0 || led->port_num == 4) { + mask = QCA8K_LED_PATTERN_EN_MASK; + val <<= QCA8K_LED_PATTERN_EN_SHIFT; + } else { + mask = QCA8K_LED_PHY123_PATTERN_EN_MASK; + } + + return regmap_update_bits(priv->regmap, reg_info.reg, + mask << reg_info.shift, + val << reg_info.shift); +} + +static int +qca8k_cled_brightness_set_blocking(struct led_classdev *ldev, + enum led_brightness brightness) +{ + struct qca8k_led *led = container_of(ldev, struct qca8k_led, cdev); + + return qca8k_led_brightness_set(led, brightness); +} + +static enum led_brightness +qca8k_led_brightness_get(struct qca8k_led *led) +{ + struct qca8k_led_pattern_en reg_info; + struct qca8k_priv *priv = led->priv; + u32 val; + int ret; + + qca8k_get_enable_led_reg(led->port_num, led->led_num, ®_info); + + ret = regmap_read(priv->regmap, reg_info.reg, &val); + if (ret) + return 0; + + val >>= reg_info.shift; + + if (led->port_num == 0 || led->port_num == 4) { + val &= QCA8K_LED_PATTERN_EN_MASK; + val >>= QCA8K_LED_PATTERN_EN_SHIFT; + } else { + val &= QCA8K_LED_PHY123_PATTERN_EN_MASK; + } + + /* 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, port_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 least 3 leds attached + * Commonly: + * 1. is gigabit led + * 2. is mbit led + * 3. additional status led + */ + if (fwnode_property_read_u32(led, "reg", &led_num)) + continue; + + if (led_num >= QCA8K_LED_PORT_COUNT) { + dev_warn(priv->dev, "Invalid LED reg defined %d", port_num); + continue; + } + + port_index = 3 * port_num + led_num; + + port_led = &priv->ports_led[port_index]; + port_led->port_num = port_num; + port_led->led_num = led_num; + port_led->priv = priv; + + 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 int led"); + } + + return 0; +} + +int +qca8k_setup_led_ctrl(struct qca8k_priv *priv) +{ + struct fwnode_handle *ports, *port; + int port_num; + int ret; + + ports = device_get_named_child_node(priv->dev, "ports"); + if (!ports) { + dev_info(priv->dev, "No ports node specified in device tree!\n"); + return 0; + } + + fwnode_for_each_child_node(ports, port) { + if (fwnode_property_read_u32(port, "reg", &port_num)) + continue; + + /* Each port can have at least 3 different leds attached. + * Switch port starts from 0 to 6, but port 0 and 6 are CPU + * port. The port index needs to be decreased by one to identify + * the correct port for LED setup. + */ + ret = qca8k_parse_port_leds(priv, port, qca8k_port_to_phy(port_num)); + if (ret) + return ret; + } + + return 0; +} diff --git a/drivers/net/dsa/qca/qca8k.h b/drivers/net/dsa/qca/qca8k.h index 4e48e4dd8b0f..3c3c072fa9c2 100644 --- a/drivers/net/dsa/qca/qca8k.h +++ b/drivers/net/dsa/qca/qca8k.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #define QCA8K_ETHERNET_MDIO_PRIORITY 7 @@ -85,6 +86,50 @@ #define QCA8K_MDIO_MASTER_DATA(x) FIELD_PREP(QCA8K_MDIO_MASTER_DATA_MASK, x) #define QCA8K_MDIO_MASTER_MAX_PORTS 5 #define QCA8K_MDIO_MASTER_MAX_REG 32 + +/* LED control register */ +#define QCA8K_LED_COUNT 15 +#define QCA8K_LED_PORT_COUNT 3 +#define QCA8K_LED_RULE_COUNT 6 +#define QCA8K_LED_RULE_MAX 11 + +#define QCA8K_LED_PHY123_PATTERN_EN_SHIFT(_phy, _led) ((((_phy) - 1) * 6) + 8 + (2 * (_led))) +#define QCA8K_LED_PHY123_PATTERN_EN_MASK GENMASK(1, 0) + +#define QCA8K_LED_PHY0123_CONTROL_RULE_SHIFT 0 +#define QCA8K_LED_PHY4_CONTROL_RULE_SHIFT 16 + +#define QCA8K_LED_CTRL_REG(_i) (0x050 + (_i) * 4) +#define QCA8K_LED_CTRL0_REG 0x50 +#define QCA8K_LED_CTRL1_REG 0x54 +#define QCA8K_LED_CTRL2_REG 0x58 +#define QCA8K_LED_CTRL3_REG 0x5C +#define QCA8K_LED_CTRL_SHIFT(_i) (((_i) % 2) * 16) +#define QCA8K_LED_CTRL_MASK GENMASK(15, 0) +#define QCA8K_LED_RULE_MASK GENMASK(13, 0) +#define QCA8K_LED_BLINK_FREQ_MASK GENMASK(1, 0) +#define QCA8K_LED_BLINK_FREQ_SHITF 0 +#define QCA8K_LED_BLINK_2HZ 0 +#define QCA8K_LED_BLINK_4HZ 1 +#define QCA8K_LED_BLINK_8HZ 2 +#define QCA8K_LED_BLINK_AUTO 3 +#define QCA8K_LED_LINKUP_OVER_MASK BIT(2) +#define QCA8K_LED_TX_BLINK_MASK BIT(4) +#define QCA8K_LED_RX_BLINK_MASK BIT(5) +#define QCA8K_LED_COL_BLINK_MASK BIT(7) +#define QCA8K_LED_LINK_10M_EN_MASK BIT(8) +#define QCA8K_LED_LINK_100M_EN_MASK BIT(9) +#define QCA8K_LED_LINK_1000M_EN_MASK BIT(10) +#define QCA8K_LED_POWER_ON_LIGHT_MASK BIT(11) +#define QCA8K_LED_HALF_DUPLEX_MASK BIT(12) +#define QCA8K_LED_FULL_DUPLEX_MASK BIT(13) +#define QCA8K_LED_PATTERN_EN_MASK GENMASK(15, 14) +#define QCA8K_LED_PATTERN_EN_SHIFT 14 +#define QCA8K_LED_ALWAYS_OFF 0 +#define QCA8K_LED_ALWAYS_BLINK_4HZ 1 +#define QCA8K_LED_ALWAYS_ON 2 +#define QCA8K_LED_RULE_CONTROLLED 3 + #define QCA8K_GOL_MAC_ADDR0 0x60 #define QCA8K_GOL_MAC_ADDR1 0x64 #define QCA8K_MAX_FRAME_SIZE 0x78 @@ -383,6 +428,19 @@ struct qca8k_pcs { int port; }; +struct qca8k_led_pattern_en { + u32 reg; + u8 shift; +}; + +struct qca8k_led { + u8 port_num; + u8 led_num; + u16 old_rule; + struct qca8k_priv *priv; + struct led_classdev cdev; +}; + struct qca8k_priv { u8 switch_id; u8 switch_revision; @@ -407,6 +465,7 @@ struct qca8k_priv { struct qca8k_pcs pcs_port_0; struct qca8k_pcs pcs_port_6; const struct qca8k_match_data *info; + struct qca8k_led ports_led[QCA8K_LED_COUNT]; }; struct qca8k_mib_desc { 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 Fri Mar 17 02:31:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 71034 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp106617wrt; Thu, 16 Mar 2023 19:34:31 -0700 (PDT) X-Google-Smtp-Source: AK7set/r7lRAnyw9adt4/0/+FaAuBTdOzVfhh8PHLdbqeC5kLKGrtfGXGVBEkrdTQVkWMaIufZGO X-Received: by 2002:a17:90b:2241:b0:23b:3f18:a8f9 with SMTP id hk1-20020a17090b224100b0023b3f18a8f9mr6737955pjb.16.1679020471260; Thu, 16 Mar 2023 19:34:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679020471; cv=none; d=google.com; s=arc-20160816; b=KKv6tyK7bUiPpkL4VA2f6s0oODa23QquOVwlD/J+6dLY352BGsSbtxrdUN2C8th04F sH94JxwNUkx4AIvqDUH9fJEbQS9sryBKjmQWiSWYWsTjxo6m+z9YPqzI1UdpJCO3ZuZP ajhjs/QlhXR/tQIT/FW+MPgLnqR8AfCJO0TdDQrFzLsGr+fbRPWiXizhHl5ATXybDupN lMkPN4tszLIsJfURYX9bMWutl/gu5BjDinfgUMcDYspERiPE265vOPtbGgPG72OY7Byl ZfeQeSxkbT8OVYCm2cINuBd1lbhmKDakWuyLP/oS/s9kf6DS8wB1rKXa86hbq6BltGk3 1noA== 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=afDlpxoJaGOlge6oF8HK8w7bmxxAcRYUXmg7BTlAgHY=; b=xp2GDzf+7uvLqZP053FhiO9FfkGPocDJz+LOuMcBXKgPk0R3L+xZt3IS90navyEuP6 fsDJr6ykMX1bAgC3Uh8D0dr47mgqnuxw03Xap3Fy+JLJlSsGTtyXezkg0jQlOCzt88X5 +q36fnuaflQYByN/369k+IsVNggloZOGF4Y0oRibFOYqAxQW1ASoJTciBMTDnE/7Ghce yA45adGe9TJ1Z/IAX+RD6s0T4BHuPdIQyTbkPlFa0YnJiSkRTZjueiKsshLRnKIaazcQ +3PQ2EXZOiqElr0+625YuTv5JtVVtdZ91n1didcCT0OYFdWKf5V84RO4Jef2+/j+fT9A pYIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FKAuylYM; 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 o3-20020a17090aac0300b0023b4d01f319si866114pjq.75.2023.03.16.19.34.18; Thu, 16 Mar 2023 19:34: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=FKAuylYM; 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 S229928AbjCQCdi (ORCPT + 99 others); Thu, 16 Mar 2023 22:33:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229754AbjCQCd1 (ORCPT ); Thu, 16 Mar 2023 22:33:27 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B28E32E0C0; Thu, 16 Mar 2023 19:33:25 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id m2so3186805wrh.6; Thu, 16 Mar 2023 19:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679020404; 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=afDlpxoJaGOlge6oF8HK8w7bmxxAcRYUXmg7BTlAgHY=; b=FKAuylYM2ILHFDRqDE7mBB8P8EzedX9Ga+jNpeK44hfNSKZUjsOqRsShUjLMHTJi1C tfHNagocmUOHYAq22hcqMXbJOM+MNzCn0T07uZWFKVhEWBNBmzpaeUHKYJZeOQet+XqP pUFC1pjHzLjBoPs6SJ9plyBgOu0va1ObyPpfkSwAus+cXoJjJUfilUJq4eBEfd41sRDu nMQEZibL8MipUEeU1igSeqx8uIEk864xehzTp9paNjBPTRIZWh8VdH/kE5WecR7cv7ti 4O+QtNtXRoD+P+qwiemcebIaASbVDVMXncGibDYJyPQ9P6BCr3JPgFAy1KM8BP11I6eL iytQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679020404; 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=afDlpxoJaGOlge6oF8HK8w7bmxxAcRYUXmg7BTlAgHY=; b=gY5TIFpwVW0+zLM+DmVUffnA8VP28OvPQWTHczPMyaVkYHl0ysTFRijzu/9GneAXqv vEN4ZlODarCSHe1aQHawW6CBHdeV7GP8qkj+TIyEzvV8zI8OueG2K36cRD9pQG/h1Ast BjnraeUoL85rVxqDUu3h12AeYy2QqWstf2zqjkMYKcFhhCjnbq1DOl0H89KOFJ9/vJP8 nTsA6Doh50fRY4tB5K/0oH5WJL5YGGDqIN9o60rnM/Fhmg9srxCOWp1E0E9IxMhn+O/x ViLZVIN8F+XlNGUh/Ia2jeR0tUh4thWe5XH6WUStQ+Pb7eXSkgYIW6uUUbye3RqRk9lc EMPQ== X-Gm-Message-State: AO0yUKU1tDQ5ZecNU2SjTaHGYziOFFM+6I4VcXPVC0ePHjrarU/NWFea GU5pG5BUZLT14l96C5SWcvs= X-Received: by 2002:a5d:5003:0:b0:2cf:3396:9126 with SMTP id e3-20020a5d5003000000b002cf33969126mr6507894wrt.10.1679020403968; Thu, 16 Mar 2023 19:33: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 z15-20020a5d44cf000000b002ce9f0e4a8fsm782313wrr.84.2023.03.16.19.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:33:23 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v4 03/14] net: dsa: qca8k: add LEDs blink_set() support Date: Fri, 17 Mar 2023 03:31:14 +0100 Message-Id: <20230317023125.486-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317023125.486-1-ansuelsmth@gmail.com> References: <20230317023125.486-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760580569591228486?= X-GMAIL-MSGID: =?utf-8?q?1760580569591228486?= Add LEDs blink_set() support to qca8k Switch Family. These LEDs support hw accellerated blinking at a fixed rate of 4Hz. Reject any other value since not supported by the LEDs switch. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/net/dsa/qca/qca8k-leds.c | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/net/dsa/qca/qca8k-leds.c b/drivers/net/dsa/qca/qca8k-leds.c index adbe7f6e2994..c229575c7e8c 100644 --- a/drivers/net/dsa/qca/qca8k-leds.c +++ b/drivers/net/dsa/qca/qca8k-leds.c @@ -92,6 +92,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) { @@ -149,6 +186,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 Fri Mar 17 02:31:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 71035 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp106659wrt; Thu, 16 Mar 2023 19:34:39 -0700 (PDT) X-Google-Smtp-Source: AK7set8pMETqTMBk3yU7vkoVmvho1U5oKOEgeZeMKHWHXxQiCIzsFry8vU2G+YdawFKG+0vjd8i7 X-Received: by 2002:a62:1845:0:b0:60d:461a:d03c with SMTP id 66-20020a621845000000b0060d461ad03cmr4834589pfy.27.1679020479400; Thu, 16 Mar 2023 19:34:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679020479; cv=none; d=google.com; s=arc-20160816; b=bAkp++eyHsUAOWuAOUvzvmchvzvdoGE9+sV+IvbZhdfQO2wiNfMqhhpQ+Leay++8JK 8wnx8p0cWJnsS32GEYSiyq+qyBJe1OIqBq7m/13q/GLkGKdFaasDWsZvNQFu6B1FXyAW G19a3p2Ab3mdbdrFpRR/t6msDlEkRqyBJ/uqFSQFxGFNe6HH9fZNT5P+59+8Oyj3jPx7 HV1EqQpiyTV2ug0hYTm7uOZAuTa3K17FIBfblhzYA1c0pr2EXRx3ZC//ZwsFOaQA81Yw 8jipv2tBtYJU2HjACZO8Z/8s0vrL95uTyfcl0mC0M6h3JaZijmTGOk5OAeIg77oTHGTe 7mEQ== 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=VM3DoNMLu3F/k6wPO3qYiXVgdAsBr9H+lF3WwRw8JHY=; b=tqvfkI5JhuXHcJElgLN443UeYrohEnw6LzeG65mvN6UQcLj38ktUdU7iyT3XbiCZ4z QMbTUFmLfH+zCnuOYIekRf2s4OHhKrhZKor0IAFXGln4QV1wG3KA2O0OWixeLfTjndQZ Hv8koxCTrNq+B0Xot1n7bbx99WoQQdB/Y7YvcfoEBzFMrIJlG91t2A2cJkMZViQJEihZ Gz4fasdwtrkB0mGKWwndDxQ1N4DW48m1OSPk1xVOABa0UVKn2oYBF410bizk6EcSzXPA Qoeth86oIayfU/khJlJAPWUDZNXKyz2W59Sz+EduvHlitE/sA7yUDDCQyyOP1txb70MV cO7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GI3I0nTO; 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 p41-20020a056a0026e900b0059b98e82de3si1040291pfw.314.2023.03.16.19.34.26; Thu, 16 Mar 2023 19:34: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=GI3I0nTO; 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 S229972AbjCQCdr (ORCPT + 99 others); Thu, 16 Mar 2023 22:33:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229863AbjCQCda (ORCPT ); Thu, 16 Mar 2023 22:33:30 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42FBC3B87F; Thu, 16 Mar 2023 19:33:27 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id j42-20020a05600c1c2a00b003ed363619ddso2707955wms.1; Thu, 16 Mar 2023 19:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679020405; 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=VM3DoNMLu3F/k6wPO3qYiXVgdAsBr9H+lF3WwRw8JHY=; b=GI3I0nTOe0aBeLI0l3/lUpIAY7Pet947XD0nFynMbOz6OX8jfYop8gvJZHiLq1O3Xo rcHANTn9UTVOALoTXuXcKBprhvxFjsmTK3W72xmyTFGPfERQj6rg2Fz7N1I3iCG8a30e Gyz0o2jBWMN4XUnPY0qsSFkk8CogUxAZsdiIrl9ObI0TVov2j2i6l37Ftwtnjdl2s9ei 6n/MEl+U4oEGOoygSea+KB9B9/7ccQYCNDBI5eXRQLyi1nPxMZ3voYJLEJnyrszEXhFX fHmHGKqsc4SM8MJo2Eu659xoog8RDZ+D5EuQ8mW+nSqjIORg/cbzza7H+xNx3Z0R+GR8 KcTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679020405; 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=VM3DoNMLu3F/k6wPO3qYiXVgdAsBr9H+lF3WwRw8JHY=; b=zVN5eh/GBboxcAoVfgZXCMPC0B1aTjPUug9af4qI76fsbSVZg2yiIhsYZOqF7G6oBc BUXdwGDByD8l60ALgbPQfueRWSMEgCL/MCI+uOO8U160ntaWvRocvkreL4MUK5Ui/iZO 1oLCOaKRIiQa2VpLUG5DL5pv0fz30qIggLhAJXxQAMxpx21jraFR7NlapO+LxLWkuv7a 4Fw3atNv6NwKWgx5pqppchvU77jCSlQNVsoroiJ5ah/EI0wRWKYSfj/tgkOoaOngs00Q RROWig2zgg0ZdXqegCJTWebPr/O18Nx/RM0++MiF6Ks8MBe4Ck/7bAJftwEoWV1iMztN KPeg== X-Gm-Message-State: AO0yUKV0YTY8wsdXlNLIqsBPBR6E/NZkG5XKDAbzMIK808A+MAOv2ChA eiWAhk8RLlRTTH9wr7xjB74= X-Received: by 2002:a1c:f701:0:b0:3ed:809b:79ac with SMTP id v1-20020a1cf701000000b003ed809b79acmr405573wmh.19.1679020405234; Thu, 16 Mar 2023 19:33: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 z15-20020a5d44cf000000b002ce9f0e4a8fsm782313wrr.84.2023.03.16.19.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:33:24 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v4 04/14] net: phy: Add a binding for PHY LEDs Date: Fri, 17 Mar 2023 03:31:15 +0100 Message-Id: <20230317023125.486-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317023125.486-1-ansuelsmth@gmail.com> References: <20230317023125.486-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760580577800472522?= X-GMAIL-MSGID: =?utf-8?q?1760580577800472522?= From: Andrew Lunn Define common binding parsing for all PHY drivers with LEDs using phylib. Parse the DT as part of the phy_probe and add LEDs to the linux LED class infrastructure. For the moment, provide a dummy brightness function, which will later be replaced with a call into the PHY driver. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/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 f5df2edc94a5..666efa6b1c8e 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -16,6 +16,7 @@ config PHYLINK menuconfig PHYLIB tristate "PHY Device support and infrastructure" depends on NETDEVICES + depends on LEDS_CLASS select MDIO_DEVICE select MDIO_DEVRES help diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 9ba8f973f26f..ee800f93c8c3 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -19,10 +19,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -658,6 +660,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, device_initialize(&mdiodev->dev); dev->state = PHY_DOWN; + INIT_LIST_HEAD(&dev->leds); mutex_init(&dev->lock); INIT_DELAYED_WORK(&dev->state_queue, phy_state_machine); @@ -2964,6 +2967,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 @@ -3142,6 +3212,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: /* Assert the reset signal */ if (err) diff --git a/include/linux/phy.h b/include/linux/phy.h index fbeba4fee8d4..88a77ff60be9 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -595,6 +596,7 @@ struct macsec_ops; * @phy_num_led_triggers: Number of triggers in @phy_led_triggers * @led_link_trigger: LED trigger for link up/down * @last_triggered: last LED trigger for link speed + * @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 @@ -690,6 +692,7 @@ struct phy_device { struct phy_led_trigger *led_link_trigger; #endif + struct list_head leds; /* * Interrupt number for this PHY @@ -825,6 +828,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 Fri Mar 17 02:31: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: 71037 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp106696wrt; Thu, 16 Mar 2023 19:34:49 -0700 (PDT) X-Google-Smtp-Source: AK7set8alLUtlNdjOsmyO3fvI0oKwLKUjiqnClN86nCocl07FENzU4voAbRSm/WU+nuT69QUTZxX X-Received: by 2002:a05:6a20:b285:b0:d7:5f98:d2a3 with SMTP id ei5-20020a056a20b28500b000d75f98d2a3mr2351595pzb.54.1679020488854; Thu, 16 Mar 2023 19:34:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679020488; cv=none; d=google.com; s=arc-20160816; b=Ats6ggvEBKAyQfW29pfdv7A52KGTpWXj/oOTFAx2e/I94JO5OWnvZmLU3pRhumdCq3 wltZsnsxUXtc7Qq/jm1FS2Mh0gKiXuppFtRhc2fGBLEPTAe5Nlx9gt1rRpwYMmcyGgrO XPl7dapV/I2PpI4Uc9S43U7atp7Zm3Ml/giGnsTjbI3XfGKccOlfnqRrM0OnjGUeRKde urnTaShJ4v7eBWDxu2GuQ1q61iKUUii/e6I8yGvHFTMlj7Ao8/180R2eHvhCfc/HfGud kPpGnGXh0aNjSljXsFZ4sg1Q/Ki+5W0grMybiJeRZ6DqFbcdPhfJ3zcKFhU0r22cAj6Y xo7w== 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=VMcNLbmNu1IC9Ea6lnqltnBFoBgoPx4QsFmf6AH28VU=; b=QOgF8+uCnAvTBVkiO/O7ppWcT/+GShKMn1cO7NqrZBGG2eBF7V3bmBbYkMO5HZQTrN 4ftGzlfVpB4YG1epujmo2gCQYW8DXTMXg1h4HgxsL2NAM+kZIKfrXm0/nKhUWdNOeTrX Ju1v7sF1EhV4GY+1QR+UQNhVTM5rjGzBt6ECXg+lGh+XPYyMRVu9wMV0Pw1h8pHNPPOk ymkj4MN+ZMZQ9Anezm1C5mUYYkXLIALOLMWEqO5gLrqU7rjAC7XIXAuWS55HnJRZ8+ew J0q72L9VqtZND0ixB4vKKfe2au1K+B1XMqfQQFUMOsC5r8WrJKMp7WFh7rbSaV8/U+8o FslA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bPAzEkLk; 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 h4-20020a056a00170400b005a8d987d003si1179178pfc.55.2023.03.16.19.34.36; Thu, 16 Mar 2023 19:34:48 -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=bPAzEkLk; 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 S230028AbjCQCeB (ORCPT + 99 others); Thu, 16 Mar 2023 22:34:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229897AbjCQCdg (ORCPT ); Thu, 16 Mar 2023 22:33:36 -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 5506F10407; Thu, 16 Mar 2023 19:33:28 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id o7so3191160wrg.5; Thu, 16 Mar 2023 19:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679020406; 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=VMcNLbmNu1IC9Ea6lnqltnBFoBgoPx4QsFmf6AH28VU=; b=bPAzEkLkh2idGz96hGdIeQqeotS/uUEVkZssv/m3V2O5F8nb5Nq+D3Z6yNxGly88B/ 6+otGpsasteHFvS0Ggmjf5pgW7et/WdxQkU4oZwmFS3rI4bPGX1Cv6+2c9HU0/B6/zVL DwckB4/YaGXXcb8PICGs7dhI/D7oUbxDopvRzCdgXHVaMtgojrYiWa/+cfBGmChOKHcx hsOQMTQK4UoGOWwPIFyz2P/YjRRXvWBVYYwAclAc71Uh92pCTB/NXCZ8Bg2UG7Nh1aBj LtpcBNSYded+jUB7S+5eJaUWRndfIbzt5IqgMCsiBDFmwqBDSFuG1mzPbscOcDc+Kdrn EQCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679020406; 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=VMcNLbmNu1IC9Ea6lnqltnBFoBgoPx4QsFmf6AH28VU=; b=dA0Ry8rv5DXh9wg1O79AVPFCLJolVZhSwUWvNBF1OpVQEv0lB7cZgItL23ls/sQW/X 1LviPlwUX7FCT8n6MuLzKqYTEeNwflY5qDcOtCdSI4+XrLdXwmdzwENpUZRwt6dklm8q n6Wej/u0kFZSbgmNezsPtKnT00xj+8+G16l4H4QGBhJFJaZkcculQF9jakTRHqxENEaM prVPYoUOlxB2DBRV8c21PSRVrzJQGcY4EUWp4wwCmFpL0Psa+3cFRpilhxJ77KEmAUIj WoCN9k7ZG//k3PCMrjH+rWPjkjjPff5Wjdg799LbAf5lLmsZn5Y6h+GByeGgjrpnuGOM f7oA== X-Gm-Message-State: AO0yUKV9iExaw5SLhJUPWu1TmNTVKhMjrj3DXihSTNxh4n0KPh75eMjp zt4qTfS47V2W2F6kDock9Ic= X-Received: by 2002:adf:e8cd:0:b0:2ce:a85b:17b with SMTP id k13-20020adfe8cd000000b002cea85b017bmr5490389wrn.61.1679020406514; Thu, 16 Mar 2023 19:33:26 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id z15-20020a5d44cf000000b002ce9f0e4a8fsm782313wrr.84.2023.03.16.19.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:33:26 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v4 05/14] net: phy: phy_device: Call into the PHY driver to set LED brightness Date: Fri, 17 Mar 2023 03:31:16 +0100 Message-Id: <20230317023125.486-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317023125.486-1-ansuelsmth@gmail.com> References: <20230317023125.486-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760580588290542998?= X-GMAIL-MSGID: =?utf-8?q?1760580588290542998?= From: Andrew Lunn Linux LEDs can be software controlled via the brightness file in /sys. LED drivers need to implement a brightness_set function which the core will call. Implement an intermediary in phy_device, which will call into the phy driver if it implements the necessary function. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/phy_device.c | 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 ee800f93c8c3..c7312a9e820d 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2967,11 +2967,18 @@ static bool phy_drv_supports_irq(struct phy_driver *phydrv) return phydrv->config_intr && phydrv->handle_interrupt; } -/* Dummy implementation until calls into PHY driver are added */ static int phy_led_set_brightness(struct led_classdev *led_cdev, enum led_brightness value) { - return 0; + struct phy_led *phyled = to_phy_led(led_cdev); + struct phy_device *phydev = phyled->phydev; + int err; + + mutex_lock(&phydev->lock); + err = phydev->drv->led_brightness_set(phydev, phyled->index, value); + mutex_unlock(&phydev->lock); + + return err; } static int of_phy_led(struct phy_device *phydev, @@ -2988,12 +2995,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 88a77ff60be9..94fd21d5e145 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -832,15 +832,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 * @@ -1063,6 +1067,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 Fri Mar 17 02:31: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: 71036 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp106686wrt; Thu, 16 Mar 2023 19:34:46 -0700 (PDT) X-Google-Smtp-Source: AK7set+piqVctZU8NNlU1zhBzYJXbmbc+VGFTD/vjw1koEzPZULN8exGjdZEQ2g2bPWYwnGeOpvU X-Received: by 2002:a17:90b:1e11:b0:23d:1e5f:eea6 with SMTP id pg17-20020a17090b1e1100b0023d1e5feea6mr6580210pjb.24.1679020485936; Thu, 16 Mar 2023 19:34:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679020485; cv=none; d=google.com; s=arc-20160816; b=USO8mg3MoFDgFj1MYuDqpJyMa4wI2aA3I4B5WEVzh2oUFEaP6B+HLmkiw0eTOGfUGu 1w6+07Z/vGQRbIVIUcoXxQDxKuXbt1pPMaE5MDhSUZHU9mxQZBfwHFnVRr7UH5F+KkWp 87FKte81CitkIEGssYeEqlzhfa74R8GiFWqfOCtStuua+FeiuS/BB39vWr960fvUiVpg l3v4gGJ6aWNhvHVYmf7hcEG53Xk5DM8/IT+Jc5WaVrgH0xnFsIxnFeE5B38vRIbZ69dB MrdX4xsiAaJlm1VkwEZiSDeocApjlUdP+69eQP0eu6+eP1lqUBI74GauSnGksbF4TzJY 0+HA== 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=aWZQzx1QVjFR7PtxmwDYhslTiYmGtSqjdVyVCfsWuRM=; b=EHq2Rbd+ooWKZj7Rk4EWpaqrgK+Cy7r519OYsnK6j/7km6P4qwjLs5XTGOaTpIdDR9 Tgbuo2gk/zqqGiRR94doaqQNts0ht1Lvs9bHn0R77EjB3skwE9qBf84CYIdNsoEO30rM x09z9ojSnvnJg1T2ATVgivmIdzAzXsr48K/p018DHKp3vsdyTZUCgPSr4M/FcD8OLdb3 OkvrNuzYi9dzjy65TuiPT4dfOk3Q/tXbA8shLupfBGP/6cf1E+YkKKGAl/dn9ftgS+W/ Ms87y8MbowEZ7ChmA8krDUrtGojlqrJA9XR3HMdq0hiGoxBSPqKWxX+PojksPlb9qi8k G+sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Hea5y6uv; 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 x26-20020a63171a000000b00502d6f14309si930796pgl.809.2023.03.16.19.34.33; Thu, 16 Mar 2023 19:34:45 -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=Hea5y6uv; 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 S229991AbjCQCdz (ORCPT + 99 others); Thu, 16 Mar 2023 22:33:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229903AbjCQCdh (ORCPT ); Thu, 16 Mar 2023 22:33:37 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0DBC6A2F1; Thu, 16 Mar 2023 19:33:29 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id h17so3181040wrt.8; Thu, 16 Mar 2023 19:33:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679020408; 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=aWZQzx1QVjFR7PtxmwDYhslTiYmGtSqjdVyVCfsWuRM=; b=Hea5y6uv72ob2BxPMzKr5SLIt3lH3fGM6CC/7dTHPf2KLuWsDLdzFt7TR6nEUVBA6D MdDPFJ2D+Oh6kBt0nmWs5QPfLllSgq00jjVFVxeksZ5RgD7SwGOxH5Sn/WlwKdKm3Ukh LePp9CPLcNFUhIsDXKQOs4XQVUotb9TRjuoIfXC91sejGqHm0QBZTNYRDdTTB56hrT4X AEWXBbelwr1nHm+eDTEOOy1GfgxmYmOIrbWDO4j5I0H18FXIq6q2n5JhO791S7htKvPp MZ5dIvtAhzfYFOwUxibnCQ+wAdlNcULHWSEwHtdM/gL/MYB1UNvqzgVKzkBpawdeL29G dKQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679020408; 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=aWZQzx1QVjFR7PtxmwDYhslTiYmGtSqjdVyVCfsWuRM=; b=E12LNEnAQUloyzOjNAi6J4bXD9QspPEZreZlhsnppDjxy4QJe5u27jKDAsH3cHgmOM XOuX1oVItd+v/53ZHz53wx5hiUESnDqE2jFDu5cGajVJeuxhmR3LYFOz+TtNECIILxU4 Wqr5han8aWzgXNIdkNqd2eCs9tYoZhvE4T0VcA/Gwb7lJAaCvEexHAXYVhHSjF7BSx15 LiAFIIApiszGrH3FsiYVoSecPridv+EiNfudxwMfzujtLsozVGaxPt3mXZTzixZ96qL1 LExQRpv1+YOocQ08Kt6qIcPVmX8d4jb7njIi+aF/y8reLDOmHj36OdraaABO66pB+c5l 9t3w== X-Gm-Message-State: AO0yUKW6HTZh7ac0gnuiM2C2Q3A9TUe00SLpotRqMi9NiMJ2KMO4pYyj AybLQ2YluyRkLs9NdG08mDE= X-Received: by 2002:a5d:6304:0:b0:2cf:e67d:d046 with SMTP id i4-20020a5d6304000000b002cfe67dd046mr5698138wru.28.1679020407803; Thu, 16 Mar 2023 19:33:27 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id z15-20020a5d44cf000000b002ce9f0e4a8fsm782313wrr.84.2023.03.16.19.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:33:27 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v4 06/14] net: phy: marvell: Add software control of the LEDs Date: Fri, 17 Mar 2023 03:31:17 +0100 Message-Id: <20230317023125.486-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317023125.486-1-ansuelsmth@gmail.com> References: <20230317023125.486-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760580585056071646?= X-GMAIL-MSGID: =?utf-8?q?1760580585056071646?= From: Andrew Lunn Add a brightness function, so the LEDs can be controlled from software using the standard Linux LED infrastructure. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/marvell.c | 45 ++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 0d706ee266af..cadf9da13b82 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 Fri Mar 17 02:31: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: 71045 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp107865wrt; Thu, 16 Mar 2023 19:38:40 -0700 (PDT) X-Google-Smtp-Source: AK7set+hb4Lwnu8oNGqz344qSGkDb3Dvjkgqnd1IBkSnx6QH/wSYrDXVYLrCB89B38K8uotSUmhZ X-Received: by 2002:a05:6a20:258d:b0:c7:8644:a9ff with SMTP id k13-20020a056a20258d00b000c78644a9ffmr6726584pzd.57.1679020720290; Thu, 16 Mar 2023 19:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679020720; cv=none; d=google.com; s=arc-20160816; b=otvuYgFkV32qDwAO4qNLVLJZk+aChsu+ndeJ2oKkXxDa9ry2UTCtwHi92Dh7SW7lv9 O8kz60H1OPc68jTwy2w2AJBJaqNRNoF8yJ02XNElZ/V8ZokEkpX8yqOwDqX7qV+QZwkm f1c8iiPmlHh36kaTv2BwITtUAKw9msz1wE1aqq7BTasg8CV9DDDNIEfCHO1/cCbrzZS9 M8/H64pI32szBWeZ2zvGSDGEyeYO1//LplSphUmriA21BAWQkwGx/orMmTBYEsMG+7Xb WF9jQINNAyCmsLhtczv1Hn2fcku9mhANgYlTihCYSHgA7HxJmcgt5i9ZFX/QRCceaox7 mQDg== 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=5HAlDMClSna0/uEvZR0Ovj6OmaH2Z8PGvM5wxNKi3Tc=; b=ejlRj2BxcEOu8ptKTnwba83w7GkAdJ4wOw0jAsuTFXmOoTfpvBpXV3vLIY9P4QiROk 9AidHUuqt6CiesBZcfFsvNpagGj09wFckFrBU0oBwTFyVpP3xMdQGgKApHYKjOuWiqGZ JLzKcbUagTKSBUi4BVu3JJTJAqWxupJ2I9xeAgHs71NavIn2t7h0GeGOVg0dEvY2LiXF cTMow2RG/gJzKGuoVj8PrZpdOfJfH7osPsWyTgAVHfPuyul70+NL1/aA9+c0qhoLfaLJ UW9W5642jpp/HU0BDVAaCUN1hpLzU3Wx5hzD4rzs9P714hBfun8K0BqlAZpKz2ymzCXj +bzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nKQ0XdS4; 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 bc22-20020a656d96000000b0050bedf49bb3si940193pgb.821.2023.03.16.19.38.27; Thu, 16 Mar 2023 19:38:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nKQ0XdS4; 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 S229982AbjCQCdw (ORCPT + 99 others); Thu, 16 Mar 2023 22:33:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbjCQCdh (ORCPT ); Thu, 16 Mar 2023 22:33:37 -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 C6CCF6BDD1; Thu, 16 Mar 2023 19:33:30 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id q16so3199344wrw.2; Thu, 16 Mar 2023 19:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679020409; 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=5HAlDMClSna0/uEvZR0Ovj6OmaH2Z8PGvM5wxNKi3Tc=; b=nKQ0XdS4521tYgbCKplAGUd7qQrJrc3wFKD3qy2l6gz1CG38r6JayUzjqLhnnaAu6s tQ6KBRxgmywpSHZJdn6SFVQgJQaVSCDUKGcPenmGgoX93il8SIU4Y83deG7oIs8EuQkc nbEFXbs+gW4mTzvOijBzMnB20X22z760q4qacbhvaBHDlatKVj/baXJAebc156c7BeD6 /h4U3zeA2VlEWZoMYlr2L6C9K/Tl33kL0i5OCVfxHQZd7ZKvC3sdofLxoZc+MelV2f/R CVT/qSb+f2uYMCDOwGw9cQza7JvX7i/wyo1IlGzbSOuBusu/lvS9pWscUci1Rfbp9G+L ilgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679020409; 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=5HAlDMClSna0/uEvZR0Ovj6OmaH2Z8PGvM5wxNKi3Tc=; b=SlK9tgmuy9pogumxu3iDtQOWkOZqTypPjKOnOpu3Lj2/2K0Y/ijwkXcCI9TzM/uolV maa7pct78fwVdotCDTmGtzlwXZid7BG3Gm4I5aZ7SgfQaOJSo761IOVHyRnS3Euc3oRh EtEP59pgpLRnIf2NliRzlHZ/5Dbv+PfNuMQoV52EUDggi3wG5DFbrvUMzG93p2CUoESB wCnJchoAV9DvY/Yik6Lg/SChbwZ5zNdvsve9/Elh1AFn6MOuHPg7DlEHzDwf8ll0dlau PX+I0FUcjmZA7zSS/u99jJYIdPtJDY3SCoH+4ZZaGx6aOEtVmOzNf6v+zTUEYXWMMNQH h7Kg== X-Gm-Message-State: AO0yUKWWpnDAF7gCFkEULpARgXhyDvUyuPRs5AkYJX2l/yOwcRCmktA/ YQKmHblEZpUuSFczntC+ONg= X-Received: by 2002:a5d:5249:0:b0:2bf:bf05:85ac with SMTP id k9-20020a5d5249000000b002bfbf0585acmr971817wrc.23.1679020409058; Thu, 16 Mar 2023 19:33:29 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id z15-20020a5d44cf000000b002ce9f0e4a8fsm782313wrr.84.2023.03.16.19.33.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:33:28 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v4 07/14] net: phy: phy_device: Call into the PHY driver to set LED blinking Date: Fri, 17 Mar 2023 03:31:18 +0100 Message-Id: <20230317023125.486-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317023125.486-1-ansuelsmth@gmail.com> References: <20230317023125.486-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760580831011714127?= X-GMAIL-MSGID: =?utf-8?q?1760580831011714127?= From: Andrew Lunn Linux LEDs can be requested to perform hardware accelerated blinking. Pass this to the PHY driver, if it implements the op. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/phy_device.c | 18 ++++++++++++++++++ include/linux/phy.h | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index c7312a9e820d..b4be02a21bb8 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2981,6 +2981,22 @@ static int phy_led_set_brightness(struct led_classdev *led_cdev, return err; } +static int phy_led_blink_set(struct led_classdev *led_cdev, + unsigned long *delay_on, + unsigned long *delay_off) +{ + struct phy_led *phyled = to_phy_led(led_cdev); + struct phy_device *phydev = phyled->phydev; + int err; + + mutex_lock(&phydev->lock); + err = phydev->drv->led_blink_set(phydev, phyled->index, + delay_on, delay_off); + mutex_unlock(&phydev->lock); + + return err; +} + static int of_phy_led(struct phy_device *phydev, struct device_node *led) { @@ -3003,6 +3019,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 94fd21d5e145..58cb44960573 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1074,6 +1074,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 Fri Mar 17 02:31: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: 71040 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp106803wrt; Thu, 16 Mar 2023 19:35:10 -0700 (PDT) X-Google-Smtp-Source: AK7set/6aEW2Bx+FBdOoulpYOzcgjFkzTy7ljkuOgNeBzoiE+9wfvUCAHLt7EJPaZeFX4ZvDsChI X-Received: by 2002:a05:6a20:8f03:b0:d3:bce6:2224 with SMTP id b3-20020a056a208f0300b000d3bce62224mr7208634pzk.6.1679020510280; Thu, 16 Mar 2023 19:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679020510; cv=none; d=google.com; s=arc-20160816; b=jpjOmMugzSaBXukPPYDbb0Z8X3DEVlvshDsTw55kMfQAW8DUdZpVx5V6zFuIpEVAPD lwATbwdbwuKF7eXsJnHad8cafMfPtogarT6IqUr9qhsVjgqxa8u/UDKppYWiPlBLJuNS QwZ2O209fITdyLjIjUsZwGqD3fT3rCf9SUISCgHBRCxN135Z1iVkGQdkrt8mA4bw1CMD R4RI4bF/GQZuhpUipwn9NN80V2aGr6Ft8N9bGlHfDO7zQk6DSePDJcdjlci+kkuOjZee 7MRdyc5ikRVk38uBH4MsvPNyHHRGrarMxs3E/KYmrZv7OJwf/3hUdAT38FDpzL0f/MAA tz1Q== 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=EAIyowZ09FXZUmzLZp+e5DauphCJoO6duVGhgX3FJVo=; b=xfSo5Aq7o46GiuJ97N3AybD8ni2QW49elsCuBwmB6bY7Zzfy/nhxh8qu9xOR8OcfjW F3AmdeHpa2ECC+nETgI5XlHWpeRE1R1A1d8SE8R27t6yJ8RTpo3q3U2CL+Dy4amYSeVg NKUwajvAzHVd1orxENmgAZwNU9ajp8LXCbQInj2rtgMXh2F7iI699zCJrL6kj4r/3r8+ Oolq0ppdXKWbA7Kk+VKaHYrdFfs4Xi4YSFmqOfj/XvAulP0fKw/4nF4TjwHCJybH/6tP 7Enmc3dewr7cJaECeU0IoS3R2TE/eKqZVWLxDGsYolYf6mOq8Sqz2MRoStL2U/EJrRQF BHBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WmTIDck6; 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 23-20020a631557000000b004fb3c246af5si903069pgv.274.2023.03.16.19.34.58; Thu, 16 Mar 2023 19:35:10 -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=WmTIDck6; 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 S230116AbjCQCeP (ORCPT + 99 others); Thu, 16 Mar 2023 22:34:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbjCQCdl (ORCPT ); Thu, 16 Mar 2023 22:33:41 -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 B379E6E83; Thu, 16 Mar 2023 19:33:33 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id o7so3191234wrg.5; Thu, 16 Mar 2023 19:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679020410; 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=EAIyowZ09FXZUmzLZp+e5DauphCJoO6duVGhgX3FJVo=; b=WmTIDck6RfM6KIxwjL+6WbrVKpHsyN/oiYJ6CrLgqmzPgKKyo/U6AMZ3/6XSd0VjUh mvYHtD6mBFd0PgdTDdFG3ltEgyVyYUinJ3Wx9axdB9xaSGJvLhWcMFTs49N3CR2lIfeZ Q9B17hiLUJJiOlltnC7FACFsDLW7VIt4fR2fFeSKtE8rJnB81Riz0p3aqWqBWrBLNQ+8 SiwqcwLE3wCXAHspGgtjwASeDGs5UHO713KMmI3b2J+1jsgPeAI5YKq7VEuBG2w66g9j k+9V1d7kpj6CS8D+aIg5CynIok22SI/EAXXgP9CR9WoWQXrYRxri0BxWv9O8rMjHUi5Y 27KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679020410; 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=EAIyowZ09FXZUmzLZp+e5DauphCJoO6duVGhgX3FJVo=; b=WYS+39facGA9HYRh0Kx40wLtZPLML4QGBbQwPWAH4pCVlAj/t3UOBe9C91Q8+SrSk6 pizJqSb6t8SjNxTbIV8Y8lnx9LUH/5BBomHUVoyzL0FmdJ783vHP158aO223fFAM7zKF /QMcxNBcN6xklxsQNNpzwblUNNF1kOyNRvPP18S20UNT6VGZs/6iEjFpZfI2sx7vu7CD Cwd8BvZXcmSTJbj9mQjc5qiuOd6xUSB9j7/28pecnLT99cF5vCzzDfHUP2J19x/XyCQO ZOdHmPaVvHUcmE/VEQT+TBZS+7Qe5pD0PZPkC3YfDn+Ln4GRNN0pCSp3j5Ci86aYfULC Eufg== X-Gm-Message-State: AO0yUKUu0nJNo9/hAerdpoogA2d0C6UIv9MnStTkhlJUYTgAWKCW9nD0 Ifhtr6pqXEVgshMQkOpXrUU= X-Received: by 2002:a5d:6084:0:b0:2ce:9e0a:10ae with SMTP id w4-20020a5d6084000000b002ce9e0a10aemr5657138wrt.53.1679020410340; Thu, 16 Mar 2023 19:33:30 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id z15-20020a5d44cf000000b002ce9f0e4a8fsm782313wrr.84.2023.03.16.19.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:33:30 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v4 08/14] net: phy: marvell: Implement led_blink_set() Date: Fri, 17 Mar 2023 03:31:19 +0100 Message-Id: <20230317023125.486-9-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317023125.486-1-ansuelsmth@gmail.com> References: <20230317023125.486-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760580610701388309?= X-GMAIL-MSGID: =?utf-8?q?1760580610701388309?= From: Andrew Lunn The Marvell PHY can blink the LEDs, simple on/off. All LEDs blink at the same rate, and the reset default is 84ms per blink, which is around 12Hz. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/marvell.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index cadf9da13b82..c86283a4c0a9 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 Fri Mar 17 02:31: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: 71046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp108883wrt; Thu, 16 Mar 2023 19:42:12 -0700 (PDT) X-Google-Smtp-Source: AK7set+UKAluTb5HP0ICSl/Xrld6xNRiWGH2RKCEKUtep15QIAFfv8fpZ6pY1tL1bwA3oUHVVQ1X X-Received: by 2002:a17:90a:1a01:b0:23b:55f3:d32e with SMTP id 1-20020a17090a1a0100b0023b55f3d32emr6216340pjk.41.1679020932044; Thu, 16 Mar 2023 19:42:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679020932; cv=none; d=google.com; s=arc-20160816; b=thxJeWrLQNESFkhHbfMDi05Ul2V7b2xPMgRrNUSPBOBtVmNH7ooenpNJH8jRW28Gl1 zmIKiySq1NzBhiz3MKOC4+BtqIJ8mBlrtuRE2vKojTru78s9+JvLAR8y8YejINxLFgKz UiUIace2IhioOff+Pzz7YuuOv/GzwRAVEoRBQMZJpErSj3dQZoJ+kozCG2MrQb/aQxxO nBRj6YQz5yF/SjNM34mjZ4rY9Al6AWYR4G6qu8N77vdJ/taKJQr8RyFED5TPO+dwm8QP MVaXDawh75dOiWuAKSjJpcChB46xaBCU44ssa4rrslCZvQlhYkDZa5BJm282TgL37r3t Od5w== 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=mZv5FnCiudZKDVGAnq53ZSH02fIH+isgRk91M2T3n+E=; b=V3OYnf55e1Mec5AUP4SDQETK7pjE7notzcGOAK7orENYEubk/1Yc8eo18lVhQ7cfk4 W8eNiC1AgkBi9f3Rbr7ddieD5kRRM7ASh5BZcHQaBaex6WZiT16sewvwsFGE4P76cRkp 9416vk1uj2UQVTBeBdBWG2p78Gh1h8NDCO96Ab7qGkBWoEMC5EKpJk0m1paqNeyWJqL0 ihRajRtyVQLrlHC6HM0CI4vWE/eczc7qT2ORuVvaKHaJo+GUFp7DFYtzl4gQUj2/rIoR n4jFi2GYq/A1hh2/YbxD6PsAbJ2cFteY9k0yxWSsADHDKvAanPPs6NsMfQEKOU8ZnyKY BaBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RTp0mEPG; 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 gq12-20020a17090b104c00b002340e488cc5si6511844pjb.96.2023.03.16.19.41.59; Thu, 16 Mar 2023 19:42:12 -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=RTp0mEPG; 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 S230102AbjCQCeL (ORCPT + 99 others); Thu, 16 Mar 2023 22:34:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229966AbjCQCdm (ORCPT ); Thu, 16 Mar 2023 22:33:42 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72DDBB328A; Thu, 16 Mar 2023 19:33:33 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id p4so3182125wre.11; Thu, 16 Mar 2023 19:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679020412; 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=mZv5FnCiudZKDVGAnq53ZSH02fIH+isgRk91M2T3n+E=; b=RTp0mEPG1x3QJnyW+mXKNUnNncVZBTlmPW9XN1NL6oKJ2YK/P6EiNv4TetcqzBuVrt aVAXC6nHT/OwmIgPFOyOz2Hl3f4MCFJwpWxFWOArr4Ha0f12Lhm/31IP0ssyeFXLBtcx rImaOYJtfuOw8QzUq5GfxJ1TIcG/0k8I5pkpAAoJb/czmE/QTnPEajyVU+gqkPrngOLL B/WBB1Ex04tUUBPXlAvQC76DuOyJkYx+RS67GJ7TI4APDMTp/1sc9cKINbCAKxKL0qEu qeOvFFIOiAESrufZCaThJe+6Guj1JTaWwOn4IFTkMVRIehW6NQu+hAEHU+UIpr4rh07B aFWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679020412; 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=mZv5FnCiudZKDVGAnq53ZSH02fIH+isgRk91M2T3n+E=; b=w/Ol2ZXOs/QCshLBg8/XSsoVYQvF8lxqTQ3IYtNXzHugjWMQNFKU+k5G6ZAfihIf4N Q3/xm47uxleD8Kih7T8ZKCDCxvwGa3nZeicliM6FIgDpmsG8/KiEg/YBGBlk/7zWFfcn e4UnNuDv9eA+3MNRf5MrwAuwig/szZs6+teRUT8r8RIqd7cSnZdEPATKDYFkVNIYre0s MXT/4SIOGR9cEBPr7HyHyi2m4ZSgV8SRkZcV2jbPH2H6Zf0DhbE34W/3CZMW+YHa/yGN MhEPQ7NZbzLPfVsg671G5scpP9tyzMeluvzrNgnstQrOAZCsCe+HYcwJL41dpuJwYqWB HY5g== X-Gm-Message-State: AO0yUKXGPOyQfB7i30dFzUixDZRnZSG20JIO+dRizr+ZjOYkKbTp9rI4 HkjYOBERNrzH1mBTj8S6rXM= X-Received: by 2002:adf:ee52:0:b0:2ce:a938:ecc9 with SMTP id w18-20020adfee52000000b002cea938ecc9mr6245320wro.69.1679020411651; Thu, 16 Mar 2023 19:33:31 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id z15-20020a5d44cf000000b002ce9f0e4a8fsm782313wrr.84.2023.03.16.19.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:33:31 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v4 09/14] dt-bindings: net: ethernet-controller: Document support for LEDs node Date: Fri, 17 Mar 2023 03:31:20 +0100 Message-Id: <20230317023125.486-10-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317023125.486-1-ansuelsmth@gmail.com> References: <20230317023125.486-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760581052700855499?= X-GMAIL-MSGID: =?utf-8?q?1760581052700855499?= 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 --- .../bindings/net/ethernet-controller.yaml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml index 00be387984ac..a93673592314 100644 --- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml +++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml @@ -222,6 +222,27 @@ properties: required: - speed + leds: + type: object + 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. + + properties: + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + patternProperties: + '^led(@[a-f0-9]+)?$': + $ref: /schemas/leds/common.yaml# + + additionalProperties: false + dependencies: pcs-handle-names: [pcs-handle] From patchwork Fri Mar 17 02:31: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: 71039 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp106777wrt; Thu, 16 Mar 2023 19:35:05 -0700 (PDT) X-Google-Smtp-Source: AK7set/IPfuZv94sMT302XMnCbpxuF/hp+jfxSZijONJcNBbUASTfSIlyWLdnusRJUwtKiQcaqpo X-Received: by 2002:a05:6a20:bb12:b0:c0:53f7:7d16 with SMTP id fc18-20020a056a20bb1200b000c053f77d16mr5396772pzb.39.1679020504969; Thu, 16 Mar 2023 19:35:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679020504; cv=none; d=google.com; s=arc-20160816; b=iG2Is8CvX4p2g5S6/jcok1jTQ2aks6RI0dX8imqaME4NOBLcIgPWMigyAtWip0tjGh m7XBnIqGdwuLRu7RdyZxw0W6h3TUVJ8UYKQPhzXMszZYNR4vmOtf2V7Ju6h+fXmJwmj+ 6a/lrn0RW73AexDYZr+kHf1kT44QwpWAy7d0GMHKz+ye/uO0/wZRkKH70l83QCpdOrRd 6KT+IrygRb0fqck0hgOgRAdwu/GfwEClFA1KWKfmN/4N2sv/Jgrd/rIrfC/yZEQl37rL gsyF4O0rA6IjRYxD0fJVDIWXMZWppz5aG7XWUA8cvQ/7/Qn4vj4CJb9CWhD7IsH6J9EQ cJaQ== 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=YxutGMPJva579mmTcYCtLi8ZBTi3DvGd1nN+fb8Tx6U=; b=S+EhB19zPGoMjSzkj12rtHuB78JP5zGud7FuNSfoaMukuuYJLfZLNZlaI1Ee4/r0zB oEJ6iT3xNJwXdLWbPa/qRYVxe81iYQHfHGmIVtvSyT6aIj8lYu9O0jbs/DrTk2SAO+lo 1MF2RoTH6Ue+faCmYQNh8CVSQLuKiYaKPKhAoGEkMJOpmWEa7zXwjlceozBwUyo/+kOE B1qKnQJDOBRGLtbawOowYl5u6OB45nT94h+qsngFDGjtDxAOAGSuPVDnUgGcSpC5CgoI unG59aiqnGyS7SSTRbewTlhBBw39ROS3vrou8GtZVufocrmCqg0D8TdGNJISXn7VrIQG /R2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nDOcGQfT; 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 7-20020a631447000000b00508cd5d9f6dsi955494pgu.290.2023.03.16.19.34.52; Thu, 16 Mar 2023 19:35:04 -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=nDOcGQfT; 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 S230061AbjCQCeI (ORCPT + 99 others); Thu, 16 Mar 2023 22:34:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbjCQCdm (ORCPT ); Thu, 16 Mar 2023 22:33:42 -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 2FC2AD503; Thu, 16 Mar 2023 19:33:33 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id r18so3199936wrx.1; Thu, 16 Mar 2023 19:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679020413; 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=YxutGMPJva579mmTcYCtLi8ZBTi3DvGd1nN+fb8Tx6U=; b=nDOcGQfTe+PWjvaki2Z3MC2j4Gqvodmqm+7lZRZfBxswVyOOJ2Qy3b92wZjiy2VYGa gtSBY5HVAYVJi3CdnEbkzurM4dpeyOSGV2SSw9WoAPzkS8HnBMtYRXjHLxnM66NrDbNi 3dD+IBQ1Bhp5EQAllKXtrSMI2EHiXXeBlcV9LzOdMrnj2acEkrnKOM/8AwPdXi3FhPWN sGsfjFpLDRnwjdntBMHxxfK0uale20WI1u0bO8rqvHjYeEV81P5byxamqURLHGCwXN1u vV3yMuRujrFvsGqUhTcJ9/jWbnhmxzU2C5AsReTXFZuayWEQR/XMsMIgCiMHdnxOXbey 7Xhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679020413; 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=YxutGMPJva579mmTcYCtLi8ZBTi3DvGd1nN+fb8Tx6U=; b=1q7S2XSZdd8A3tPmazgqLTCrz0h2jeCgIsORnc4Vglmb5D1jbHTC3obdJaUu7nyDR4 Cw9xT+szb/662dSAdtPm+8aP0jF46od/pThTXPMeHFlzbSyX9fkvgIIijcr16HskrrQA zjLoezWv1OKDoQMkVqUAERQYQ9mUXmjKsWqay31g1thbPNcjB/0vrA2Q/Md27ef27yUp lCEhrhi46F0bGUaxOTFqEAZ+zX193q1IHn2b85R8w4v5HgQ8LAbzKbTDv4aXqkB/cYzW UGceQocfIAkLfz5Rt59iHF4YSqvDqZOys7BZ0diIcgHpbvzCqwRYAUPFAuQxwlPjVndq FhpQ== X-Gm-Message-State: AO0yUKVTkbADeGbX6RhKyd8oSGrJnllzEPQyx6bA+d6t13lJMXUvSg7j VVspVMKu9Q9e/GGcXvLbqRw= X-Received: by 2002:a5d:510d:0:b0:2c5:540b:886c with SMTP id s13-20020a5d510d000000b002c5540b886cmr1086733wrt.31.1679020413009; Thu, 16 Mar 2023 19:33:33 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id z15-20020a5d44cf000000b002ce9f0e4a8fsm782313wrr.84.2023.03.16.19.33.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:33:32 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v4 10/14] dt-bindings: net: dsa: qca8k: add LEDs definition example Date: Fri, 17 Mar 2023 03:31:21 +0100 Message-Id: <20230317023125.486-11-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317023125.486-1-ansuelsmth@gmail.com> References: <20230317023125.486-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760580605079745998?= X-GMAIL-MSGID: =?utf-8?q?1760580605079745998?= 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..2e9c14af0223 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 least 3 LEDs connected and can be declared + using the standard LEDs structure. properties: compatible: @@ -117,6 +119,7 @@ unevaluatedProperties: false examples: - | #include + #include mdio { #address-cells = <1>; @@ -226,6 +229,27 @@ examples: label = "lan1"; phy-mode = "internal"; phy-handle = <&internal_phy_port1>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + default-state = "keep"; + }; + + led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + default-state = "keep"; + }; + }; }; port@2 { From patchwork Fri Mar 17 02:31: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: 71041 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp106899wrt; Thu, 16 Mar 2023 19:35:24 -0700 (PDT) X-Google-Smtp-Source: AK7set/3gdaLVWtC6lBi7X73EqXsBLrJ7emhts1IXxQ+ZHJ68NqO7ocbNwVzZHie83gwpWDh3xe8 X-Received: by 2002:a17:903:110f:b0:1a0:6139:e9d6 with SMTP id n15-20020a170903110f00b001a06139e9d6mr6467465plh.53.1679020524481; Thu, 16 Mar 2023 19:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679020524; cv=none; d=google.com; s=arc-20160816; b=MXgzaQlJ0b128DSHHhOU/bUwxGYFsmXO7G6LrvCc/wJUCNT6OXBWkc+x+HlrlOh0d9 tuoRpfxEh65v0cMU2mGKcBnV3EHI2bPCEG+2Hm/f+tmtC0itPN0eHtblnxNSn52+Yo1f HFmBrwxQLUonG1xVObs5+0QNj6ZYeXpR7QvuZs5x5WDNyqM2sJtmRxcVjBEO/O6o4uXP rJTgw5qrCPY+JF2jsP0xrXIrYJfA1HcWQl3Tygzr5lSb0s2P+JLxxB11gDJaauJGwSWO MNspIJXIjSXB6iUGfJykxa+wk47PQkGzHROROvPWQRR6CdfUbaiSWSqVx2m7nE1fzGcZ orHg== 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=1BEVC8sIsquGblnM/ZQeznwHjebcySGomSTn/3JIOdrUqjLAAHb5D1IwV8t7s5gzCI RlymnBKR4ydriGh3DAsy6r8iRh068kFvjFZR9tcEc90xpq6lGMzKBnw06WBI0VtDEcMO AvzDXUO57qzRCBshYSw9K2eiOSGfwK90e7VA+KNhYgvYVkGVIgyagquge393YRG7vbfx b+Uo9pBktfrmNGGAW/aWrHFBPmY4yQjHqjfzh5bd7PyqkZ5/jweHRFI9LU5NT5p94XeX tO1ruvY4sPmrk1Nw6kmbT3YTZ0j0zmJsMG13rrnVbq9vW8X2r26GLT3ONXH5w426fHKt iNPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="MvAPnp/x"; 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 p8-20020a170902e74800b0019912578dc3si1222135plf.375.2023.03.16.19.35.11; Thu, 16 Mar 2023 19:35: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="MvAPnp/x"; 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 S230015AbjCQCeS (ORCPT + 99 others); Thu, 16 Mar 2023 22:34:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbjCQCd4 (ORCPT ); Thu, 16 Mar 2023 22:33:56 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FD84B5FD3; Thu, 16 Mar 2023 19:33:36 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id fm20-20020a05600c0c1400b003ead37e6588so4274481wmb.5; Thu, 16 Mar 2023 19:33:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679020414; 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=MvAPnp/x+3dMsvqIme9hGfx9GPOwYDjvy8ULFwF3i0oLJvBJU+A1zIKILf+YJ4XXHT Y8ZKl12i0S4zR5V/gxxmVWtEZclaGFU0a7rjZopfgg8s3ScN74UXXMi7aNKb1/RnASL1 VkYE2z+7jNDDGAPEpMEMMKO3N26Skm+QUWiEOXzXExbEF1HiCa/92f1OIAa/Y50pk2pM yjPclHyazOaxbhMeR0cpaNnmQirvDukmpaXkxbZ2XM5R6QuncXVRAxwiDsyjeaK6wppC krJGkwGWxn5SjhBpvWqHcoXE2S2gmmxlwUyYvTCSSkiG3lci42ojwgr0LmW1RMQzuKRb OMXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679020414; 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=oGQUgJbljQSz4GgcrpykIFXd62s3eZqcgRtSFoD6eB7GoHviDBh5uNoG9VPKDkNxle R0+7uYB0J4X0rYEqOhyO8p/LkCisVQs5Q/LAHa+CYEKAJAt07z6EbvxYqWY4O9ZW38Zk YyiFVE32V76Smhp4TuZwfYqXducsxMDgxAKU09IOHluJM7cJi2l83f9+o78DnXvo/r03 Ya6FnNA7z2ljxddgiQfdG3U8uQQAEmK5Dsljxz0uboWLZbORvmVUYzA/Siywv84cbRQ4 F3i6Y+Z1KTIR+DtkLN7+QfxjZ58I1017LGOM39YAd12jvDTXcYWZb4+2gj0X9MOG5y+L Oh8w== X-Gm-Message-State: AO0yUKXYZdjfin3vJtjGYdUgUAuh7zjbY+DMGZmvaCn1lKEa0eG0GQ/F ohY//njFOAm9iIoXyXFozl0= X-Received: by 2002:a05:600c:3514:b0:3e2:6c6:31a6 with SMTP id h20-20020a05600c351400b003e206c631a6mr22785631wmq.9.1679020414336; Thu, 16 Mar 2023 19:33:34 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id z15-20020a5d44cf000000b002ce9f0e4a8fsm782313wrr.84.2023.03.16.19.33.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:33:34 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Cc: Jonathan McDowell Subject: [net-next PATCH v4 11/14] arm: qcom: dt: Drop unevaluated properties in switch nodes for rb3011 Date: Fri, 17 Mar 2023 03:31:22 +0100 Message-Id: <20230317023125.486-12-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317023125.486-1-ansuelsmth@gmail.com> References: <20230317023125.486-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760580625148379585?= X-GMAIL-MSGID: =?utf-8?q?1760580625148379585?= IPQ8064 MikroTik RB3011UiAS-RM DT have currently unevaluted properties in the 2 switch nodes. The bindings #address-cells and #size-cells are redundant and cause warning for 'Unevaluated properties are not allowed'. Drop these bindings to mute these warning as they should not be there from the start. Cc: Jonathan McDowell Signed-off-by: Christian Marangi --- arch/arm/boot/dts/qcom-ipq8064-rb3011.dts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/arm/boot/dts/qcom-ipq8064-rb3011.dts b/arch/arm/boot/dts/qcom-ipq8064-rb3011.dts index f908889c4f95..47a5d1849c72 100644 --- a/arch/arm/boot/dts/qcom-ipq8064-rb3011.dts +++ b/arch/arm/boot/dts/qcom-ipq8064-rb3011.dts @@ -38,8 +38,6 @@ mdio0: mdio-0 { switch0: switch@10 { compatible = "qca,qca8337"; - #address-cells = <1>; - #size-cells = <0>; dsa,member = <0 0>; @@ -105,8 +103,6 @@ mdio1: mdio-1 { switch1: switch@14 { compatible = "qca,qca8337"; - #address-cells = <1>; - #size-cells = <0>; dsa,member = <1 0>; From patchwork Fri Mar 17 02:31: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: 71042 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp106969wrt; Thu, 16 Mar 2023 19:35:37 -0700 (PDT) X-Google-Smtp-Source: AK7set9oJs1C1Ygw7BWPw5xmPAOTqXZh2VGsrZx9IPzUUoQ1+Mbp/Ymr1maD4xusU7nnpTeyB5sr X-Received: by 2002:a17:902:f90f:b0:19f:1c64:c9d8 with SMTP id kw15-20020a170902f90f00b0019f1c64c9d8mr4614167plb.14.1679020537376; Thu, 16 Mar 2023 19:35:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679020537; cv=none; d=google.com; s=arc-20160816; b=HdsrGYzOttqZLNiwsrbucwn4URrcUGjuj+jJkIcP5m0OhpuJIS2u1uXpPyCwWX58e6 edQrOrzwKVC8bpQq9Yw3dx0p+w376NKhbjjBPQDbxat6zquTzg+vTgaOyxm+up2a9Kbn 1Ufo4y66MM0JzQnk/RSWiCpUKyfJ2AbY6/vYQLk+5+CEXfxMEPHFOjXmgKuJKWmYYwSt K6jWsuJcy8QM8sQXIlmzP3xx7uHFUH6/PwtdsdvEWecYj/3zrp7rYlgJZNEETS9DgNMz rqZQtogBl0POXL9S+gvXCHphCO8zcZysXHQaSJwRjPtRXTCLlmlrpy47+4o5GdhWxPXb 7RWg== 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=QOAWfGAMCrcOCyKF4ENXS27X3Y0fHDQEkg8BG0xdPVtO3b4HoyerbwcNOiUmToNYPR pv9b00mMWoH2b50LegVTT2ex1tVkF7ZFa0WvyuNacuGsFDzCCuBhGGR+xg22hkL2SNZG KUo8RBRAt6aHcnCBDGoPSJcDGJv9i0mRD9XhtBHCbvWeEW7CP4xKoIsWATHJ2BAc0aKL AlT/9ERrzZPfj+uY8lkWgMw2Jvuiak36vLD4iEDCUXNs5dmfYeVT9V/9If5WbASnkVwm 7tsWhv+pfS/dJ4cJ12G+hrteH22WLHSTVPCY1OGt1n+T3VwMiUGIsYQv3GZejn+zeRNb N9KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nITNr7nL; 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 u12-20020a63600c000000b0050301520947si985009pgb.437.2023.03.16.19.35.24; Thu, 16 Mar 2023 19:35: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=nITNr7nL; 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 S230169AbjCQCeV (ORCPT + 99 others); Thu, 16 Mar 2023 22:34:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230004AbjCQCd6 (ORCPT ); Thu, 16 Mar 2023 22:33:58 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6886E76049; Thu, 16 Mar 2023 19:33:37 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id p16so2459524wmq.5; Thu, 16 Mar 2023 19:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679020415; 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=nITNr7nLrqTYxWL4bn+CtPurpHoc8uOjmWFHoXcjWDzjRK4fS9Y4P23E3xF4gXbUfP KpVaQwvuhjx4mzn1d09NeYAzyrdEVO4uGFdpAYiV9YuaQwxNfvOiVk9KNbm795kd9r/B HiyZwJNLM+MITtsYOGYUrZtBLfCl9JdMss5hA2s6OmQO097WVFXXZRb8licVShLhKLyZ krqCgtkmLS8VQLjo+ZUI38OvmHdDtPXV5uTbB35gt1DPcaj8/u1Mg2Fd/+OX9pyTBmb5 ibT6P1xkuWKausYDgQ2gVxq3I+1D1US56ryQl1oGERS3yRzp73aCkad6tkeFz6qW5ZyC +lDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679020415; 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=YxoeMlN6E58cvW1s7SKKOytrSORK1OUz89L8N1zySMuPE4EyGpOFu98IhpXPtTnDyV iMJA3QiGeUs85XW1QaNiJGegwAjbZexcENHL8EGN+Lrq/3iO9FSEuB39YbPmrPP0xBMv PAjWZ6xGNcC+Y4eXg4e9oJ7pC4+T4aypZpfVbI8uZQcP2fiSa5oZX9b3JRZGPwbF09rb 14YuMN6+fTIauk9nEFjLcOK/VMGc6IxfKG7Zp11iYbMfp1zYBd/tYjsPhrluAEx/+GOS EVZcDnn/VKYzIijJAoW6SMX2lVT3nSqZ66kbRqsMzNg78wdkhJVJF6drhZVHnMwV96zn FIew== X-Gm-Message-State: AO0yUKVITQnGqmyalG5y7upsjMHOgoKI3sYu/X6XjtrXB0A9g/qBgVG8 vFqvbDtwL5kVzTxKKC3jYys= X-Received: by 2002:a05:600c:34c1:b0:3eb:383c:1876 with SMTP id d1-20020a05600c34c100b003eb383c1876mr23460133wmq.6.1679020415624; Thu, 16 Mar 2023 19:33:35 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id z15-20020a5d44cf000000b002ce9f0e4a8fsm782313wrr.84.2023.03.16.19.33.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:33:35 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Cc: Jonathan McDowell Subject: [net-next PATCH v4 12/14] arm: qcom: dt: Add Switch LED for each port for rb3011 Date: Fri, 17 Mar 2023 03:31:23 +0100 Message-Id: <20230317023125.486-13-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317023125.486-1-ansuelsmth@gmail.com> References: <20230317023125.486-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760580639305825483?= X-GMAIL-MSGID: =?utf-8?q?1760580639305825483?= 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 Fri Mar 17 02:31: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: 71043 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp107016wrt; Thu, 16 Mar 2023 19:35:45 -0700 (PDT) X-Google-Smtp-Source: AK7set9ze507fddL59TSAew06ecS5EQF7JuTcEx86yw4np+ASLO0cyoQrd03O4PMLyw/ehyU5A5x X-Received: by 2002:a17:902:c411:b0:1a0:7422:939a with SMTP id k17-20020a170902c41100b001a07422939amr8014552plk.4.1679020545063; Thu, 16 Mar 2023 19:35:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679020545; cv=none; d=google.com; s=arc-20160816; b=t32syIRYlzXD/sd0AC3CJMh5am3OMWLktUdUzPBDZmBu3Sj8dpcGKOJk8wgVsTCPjI h3899GWO26FxFNI/6at1jJVzEkUgosV7IbBs/frWDWBb/zdGcyTOsozkGMWXxU1daN9Y JLBlv01DMOgkX47keeKloE1sRo/W57Fo0n1PotlcLCzgCcxlJY1CMJZMK85adgdZHxRI f01RL6uHK7al/16KU9S8IzSqJSKk6wE2HUeWakHmmE1UpfgvxHclepO26YTRzJRQ9gUi b6eeoioGIfTlljqHV+bm8zF+/Ty0qC3yekxLMDUyEt8gVusw5VHLE8FYmoUfA5e7UMOw xhQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=NdFLu8rYGgfYob/UUJ7xHBPYmBqXvfPClb24ZxTT2Ls=; b=n9yDVVfc2EXw+bxJtYQwUcFoZ0R8snMbAGVIRrWSvk56W6Xci0djOLc1utcj9lY9I3 O1vKbqe3cb9gqbMNx8IRZ+vISQVUbjZ2j0wAXHmyviFZOllJ83S1VjzV2t76H4HWgeWQ ImjzD5Pdbt65OvGfCtgzPYY2sL2OosZyhSMjY7jHo2jg39cfIqiINbNKuZBdGC9FDMrV qbvNaONIkhiKjoFVDC2Y5WH0RdT5lBDfEYmbX76QItyu5ZGUuid/iVFvGv96UyNFhvCv etJLc/Bx7DGgcZIMyqSZrQz5H2R3W64ND5y7eY+CUyeCR9Wn6MS7SwTwE2HREUb7HTd5 cXfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DutLKUov; 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 y23-20020a170902b49700b0019e37273b47si974310plr.558.2023.03.16.19.35.31; Thu, 16 Mar 2023 19:35:45 -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=DutLKUov; 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 S230208AbjCQCeZ (ORCPT + 99 others); Thu, 16 Mar 2023 22:34:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230025AbjCQCeB (ORCPT ); Thu, 16 Mar 2023 22:34:01 -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 EF7B61732; Thu, 16 Mar 2023 19:33:37 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id o7so3191348wrg.5; Thu, 16 Mar 2023 19:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679020417; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=NdFLu8rYGgfYob/UUJ7xHBPYmBqXvfPClb24ZxTT2Ls=; b=DutLKUovGo5Smee1OxymH+55w+jweIRW6b8/LTpEqvWGEybiYS1/mq7Uhli8Ckl++x h3SNVQw0nglbYfDxSz1basFNpUIZKemuqyxkuGJQiK3vkVxCsbyt7VZcyFDeKiCUJ1Df k8H/tCpTwfqPf8ib877IwGVmDQbMx7hiQjimW5bMfaJF1Buna93ft10bQPtK59YzDmcs ONaiS7H/9xJGD3jKeWYfYJAHXKhb8foSZkTvfkZcOnwJ01LY+g+VAFqCbLtSZW0gfLRs +T5raXr2+YgW3O3I/i5zNXrpEU+AFmTmm3wj4VrngFKCG37BTJxlmq+cnkGPOfzuwogJ a5eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679020417; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NdFLu8rYGgfYob/UUJ7xHBPYmBqXvfPClb24ZxTT2Ls=; b=H7zWvxrEL+qLBPe7c8PkxndGHJWnoFNTOVEho/lIelsXEntJdLBrb8Mz+Z2IoF+Y1R ZIDdLdxhn80C4y6TctCOI6LyjYEVdb2RYFkK07U34D7H8zMwnpRxmcEQ2jgUyyGhld1p +w0niPsH0MdLDW36IVW6LTGZQ7K6dNHlyC2wK87PiYM4WIqYNcejfeJ/U8e8+Yqj6ZV/ z+slK7qU6zNyw8uWrQ622q868m29NHSm+wwDlx1qVKZSoAkeSuGOoNqj3aZuwZf5eJ78 hWGXCP+Grsyoyq8I2UkHBv8XEphznYJpP0tX6KBABACPJudty6DSOYqQYdf/LeJHZeCN h70Q== X-Gm-Message-State: AO0yUKW7h5Tka4Yklw/x8JX2uwvKgs/r3v3IfuFO4DsHmtym+bqsJk0j J3LWemZFGzpputqyS5pUGPM= X-Received: by 2002:adf:d845:0:b0:2cf:e132:bfbb with SMTP id k5-20020adfd845000000b002cfe132bfbbmr5896016wrl.38.1679020417006; Thu, 16 Mar 2023 19:33:37 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id z15-20020a5d44cf000000b002ce9f0e4a8fsm782313wrr.84.2023.03.16.19.33.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:33:36 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v4 13/14] dt-bindings: net: phy: Document support for LEDs node Date: Fri, 17 Mar 2023 03:31:24 +0100 Message-Id: <20230317023125.486-14-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317023125.486-1-ansuelsmth@gmail.com> References: <20230317023125.486-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760580647038401939?= X-GMAIL-MSGID: =?utf-8?q?1760580647038401939?= Document support for LEDs node in phy and add an example for it. PHY LED will have to match led pattern and should be treated as a generic led. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- .../devicetree/bindings/net/ethernet-phy.yaml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Documentation/devicetree/bindings/net/ethernet-phy.yaml b/Documentation/devicetree/bindings/net/ethernet-phy.yaml index 1327b81f15a2..84e15cee27c7 100644 --- a/Documentation/devicetree/bindings/net/ethernet-phy.yaml +++ b/Documentation/devicetree/bindings/net/ethernet-phy.yaml @@ -197,6 +197,22 @@ properties: PHY's that have configurable TX internal delays. If this property is present then the PHY applies the TX delay. + leds: + type: object + + properties: + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + patternProperties: + '^led(@[a-f0-9]+)?$': + $ref: /schemas/leds/common.yaml# + + additionalProperties: false + required: - reg @@ -204,6 +220,8 @@ additionalProperties: true examples: - | + #include + ethernet { #address-cells = <1>; #size-cells = <0>; @@ -219,5 +237,18 @@ examples: reset-gpios = <&gpio1 4 1>; reset-assert-us = <1000>; reset-deassert-us = <2000>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + default-state = "keep"; + }; + }; }; }; From patchwork Fri Mar 17 02:31: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: 71044 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp107141wrt; Thu, 16 Mar 2023 19:36:12 -0700 (PDT) X-Google-Smtp-Source: AK7set/mE5LtkhqfDKyXr2VirBJr/H9t193FneNlKkUJqjJO9LskvRl26ocV5RMvxB2NeSPxfCrI X-Received: by 2002:a05:6a20:1bdd:b0:cc:70e2:5b25 with SMTP id cv29-20020a056a201bdd00b000cc70e25b25mr5367236pzb.21.1679020572574; Thu, 16 Mar 2023 19:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679020572; cv=none; d=google.com; s=arc-20160816; b=iC7bJ7nmuXnWUhxBPPk4KfPcgcGGmEmc0b94MNlbpdr+MQp7gdWdlZtez8Pz8aHYC6 BZh01ZGpg8gJj8yI4lo6F4ATWxfj5AK2osCsi7ngbxxWh+9goCNX65Bqd3aw1Ea4fWog MxUf6INIRXf2DdQC2QlT4z6HT49z/9GO4DkAQabZsLDBSTHrRz2ZIUYZPUzSg83GiqB+ JiXpIJioto+72gzKytUf0iH23//40EAZP+YrK86Mw93+LcvZurRoVu1qUxHf+Frb0LHY srXEPwBwFDNALGSRJYhnCdMg50hpVR/JRN0WBy3ECpL7nGwJ3+7YnGQEWp7T2duMOnxC cIyg== 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=Dg52qaqWdRhrcxAlTtrMpQLOBp0YTBE6DSlJEyh7nJzW/2KOpYjNRoBhNEt4wVic95 coKwNKCRnBjYgxS/IwJvGPdv+PbY8n/S1Hu8BXBmNVi27HqIAJ+hBeQHrE+OhAnNDEFu HXr9G+3fce7I14lYCeQy9WNy9waA6JJ16aNJFu+M//MJqwfUv4qXrlHmtssZ/NU6ul6Y ZhtrcRj6JPzoxP/hGMOkU7QwcqgRFXIrNfrX5NbP1yaP1akfw99jNj4KPciiEfgAdfjv 0XWrdk/uz78Qvm/zCoYG/Wn63vTh6OyTZinZBjgCFsJg47Wk1vRTd56xpzTSrC6VlpfB vBog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="DiYT5S/j"; 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 7-20020a631447000000b00508cd5d9f6dsi955494pgu.290.2023.03.16.19.36.00; Thu, 16 Mar 2023 19:36:12 -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="DiYT5S/j"; 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 S230103AbjCQCe2 (ORCPT + 99 others); Thu, 16 Mar 2023 22:34:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230091AbjCQCeL (ORCPT ); Thu, 16 Mar 2023 22:34:11 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8EF48A4E; Thu, 16 Mar 2023 19:33:42 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id w11so1410295wmo.2; Thu, 16 Mar 2023 19:33:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679020418; 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=DiYT5S/jOvNwe4CzhjdiIkvIKBggeGR7CexVNd4rd/sjT5lAPS1XWF1W+7fLOFMLc9 +M+nVvH/VqGoT3HRVUevSaiDK++YKjOvPsz8umYJfLqED/NO2vBkV/scUd1luER6cra4 MU9TLGEoBzC2egkV45V3/dkoR/6reCXuIEI/4Onu6ISM86v2ODghCyVpzQR3QShPKWAL 9jZ7MIgNa9bnV7GstyBvBvcr169haI0sCUfFl73RZ7foJuE+TayH+Tf6hYDaMGLkB/kS fhVvp3xBGubVX6uhvop1IHbnljGIKuh1xuXwPSH1/oNVSjdbVXXZJzhlDpDrUqMIbqpC kXqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679020418; 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=rPGCMwC5lEyATn2XIj9TYWwccH0ijOOKbKu505DFQ/yntSXE6LIM+EsgjTXDIXWnox 9cLKLknfWu6BSGE2ITyTfOhv9M70nO/2ZvtwMRzfH9vIMtt3xV+KEZYpVQRw7MusGQMM ssK3BE95Wo+oBu6l6dEdmH4FBvVpGcLlC9scX4+3XFLpHY9qRL2QjNqdXI2rG6ZSRox2 Y0iW5oBHh17kNGyYokI3ow/r8/awDBnZEXsXuvVGT8/VlxGPqNO2PwngLQkxwgpoAnvK kZ/h+gPd4Kotz6NPaetljhabqCjm8XnFJ5HFWGkGVy6KVlkGr88N5SJxgiI7kPzRp2Rv 3btQ== X-Gm-Message-State: AO0yUKXldj1G0urmL+gT+amy9DmOIpf1b1/2Er6nlJS/QRdIop5mG1Vd 81TqJpwJiEqY863/WopY24o= X-Received: by 2002:a1c:7215:0:b0:3ed:5d41:f9a7 with SMTP id n21-20020a1c7215000000b003ed5d41f9a7mr3675091wmc.2.1679020418287; Thu, 16 Mar 2023 19:33:38 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id z15-20020a5d44cf000000b002ce9f0e4a8fsm782313wrr.84.2023.03.16.19.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 19:33:38 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Heiner Kallweit , Russell King , Gregory Clement , Sebastian Hesselbarth , Andy Gross , Bjorn Andersson , Konrad Dybcio , Christian Marangi , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org Subject: [net-next PATCH v4 14/14] arm: mvebu: dt: Add PHY LED support for 370-rd WAN port Date: Fri, 17 Mar 2023 03:31:25 +0100 Message-Id: <20230317023125.486-15-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317023125.486-1-ansuelsmth@gmail.com> References: <20230317023125.486-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760580675718731527?= X-GMAIL-MSGID: =?utf-8?q?1760580675718731527?= 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 {