From patchwork Tue Mar 14 10:15:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 69717 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1855597wrd; Tue, 14 Mar 2023 09:27:40 -0700 (PDT) X-Google-Smtp-Source: AK7set9hm9olUN0e5iSoQ+jLvAMDwz47BjPud97oZnNvOhG3VciBJDM6dJBZh/8DKXlSpezpbGNh X-Received: by 2002:a05:6a20:9f98:b0:d5:73ad:87c2 with SMTP id mm24-20020a056a209f9800b000d573ad87c2mr2486901pzb.56.1678811260605; Tue, 14 Mar 2023 09:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678811260; cv=none; d=google.com; s=arc-20160816; b=JQm+MzePoiYqqgpTSjIpy2DTSbLoqtZFmjCxTd4ahq2asWL/Mxf/2gRZEyzMIDqNgS S0bJkqd9ksPzdpqf59ZIK5Xdo4oYXQK5MpR0qxfvt18XHfvEKF/U/a6xAVWsf81uxjXG c9SDV9ZU7ZDDw9PF/1kvEwPk4oenJRYKQSFL/jyxHY36om5Hl7PS4ghSG8n0gqv3XKkb iE1koKzpifiE5gGVAo8w+RX9QVX2Bjy9j06ZUcv8vN5swiueOrZPMyKyMDbfk7Jf3mOm xXYbky+tofRnhkdhBQXlVWFKSxDn5XjlskGIFK5Gy4+275CeCkTlKJFDXnmi5dMkjaFk 3JbQ== 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=fY0NJEYTdYHc97f5GTZliqaMtjqLj13NZJecxlK4X/8B9ZbXbNT5LEnohSbk5ldPLJ OsW+rT7pbsHkq6kisvv2bWlrlhRsghOig4Xbx7tYhLQBNYYe8EbAWmWPbYkT3JB8Oqnz TnN0SZnMF1GGx4Ntr9uBGsN6gWwunaKgeXKiBHzZLQqe26Kc/gyjFmJr+H6+gWre54pA i2P0YroT78W+m5LlYXwLZ95XCBfVwR2UtlUD4aMniJofyzTpDTskw3zmp4NUht5jcP1b OB7fraABJcWloy6AI02IJcP09l3EoQ2DDZuScEb44qbQA+OFfzv/24Ci+yDOFPwsnIi1 m3cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jhqmQLzk; 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 e21-20020a63d955000000b004786f5e24f9si2559767pgj.94.2023.03.14.09.27.27; Tue, 14 Mar 2023 09:27: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=jhqmQLzk; 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 S231161AbjCNQRs (ORCPT + 99 others); Tue, 14 Mar 2023 12:17:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230482AbjCNQRi (ORCPT ); Tue, 14 Mar 2023 12:17:38 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B51EB4823; Tue, 14 Mar 2023 09:17:23 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id p4so8688111wre.11; Tue, 14 Mar 2023 09:17:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678810642; 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=jhqmQLzk8XgfMOVo0VrOhrak6hNyCjDYqJS+nh2iMI5nCaiUabFM8PlWOcWdsjgkpx E+efhn43fHd8GZxwQHyz3ZPIalFZ6JFkzXuKxzR0AswbhUYjQdm5K75IAFWSgPoaOsRq RpS4cz3Y+hOyVXqwA6u4SDUzCbvxIM0XFWVxlCbrhlFBN8Fp5DwYcNOv89tJSg+PF5JX s7lLj6jyDwHz41QZXrf+tb6MJVGXMJIp8s414V0EJVvt9DvJZ8+RPT9OkHuK90EeOqT/ YZwkAaW5F1e6gMFDK2jRqiu1DStsVmub2e6ZvJpSCgLmMO0RUUzBVw3Th7Stlwa9oCcq zM+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678810642; 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=r6pzebKNIIGpVd6kCaEy+KK7Ca/DvfPyp7RuE1xziMe9MYT+N/j6gD5Xweuzfkm0WU h/0ADN3joVTSQdLcSfaH7SDZC11Ue4FhEa3RCjanWiQRMOYs+jxqn6K2n721qmcwGhDu N3WNXguAhz+jpvW9ACn4J7ZHpU1IhgATgxGWCOpDrCf+3DGcvie9mqBVWf6yb/WuSIfD w/2u/rW36ydSEoYpeEHau+Dzv7YfEpppX9BuKHJRpq4wfgDQeMiQ02T1eEulkX9/BBhm ziDGC0Jj78ZCvne/xHHBi29ktfvtPSC47sYPjYq8ymf/e3j3+iXSOZlVf5KGKqRhbySx 0GpQ== X-Gm-Message-State: AO0yUKV2hiEHJxi41KpUtuYtwajh/P9+QOG1md5NHPHi+NLh7SYrOTYt ISjHcw3eGsk9DGHNsr+Aqgk= X-Received: by 2002:adf:f78a:0:b0:2ce:a7f2:d0b with SMTP id q10-20020adff78a000000b002cea7f20d0bmr7119794wrp.64.1678810642217; Tue, 14 Mar 2023 09:17: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 a16-20020a5d4570000000b002c5539171d1sm2426821wrc.41.2023.03.14.09.17.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 09:17: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 v3 01/14] net: dsa: qca8k: move qca8k_port_to_phy() to header Date: Tue, 14 Mar 2023 11:15:03 +0100 Message-Id: <20230314101516.20427-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314101516.20427-1-ansuelsmth@gmail.com> References: <20230314101516.20427-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1760361196343122052?= X-GMAIL-MSGID: =?utf-8?q?1760361196343122052?= 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 Tue Mar 14 10:15:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 69723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1859393wrd; Tue, 14 Mar 2023 09:34:51 -0700 (PDT) X-Google-Smtp-Source: AK7set8CSmVJkVfXcJV+87M32gUJHbRGFKeKpolV8T+xRj9okG9Z+cLpv7161UL2agN4cyf0a7Aq X-Received: by 2002:a17:903:246:b0:19f:3097:cd7 with SMTP id j6-20020a170903024600b0019f30970cd7mr11650593plh.26.1678811691285; Tue, 14 Mar 2023 09:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678811691; cv=none; d=google.com; s=arc-20160816; b=pjpL8xp3AKkkTucLhD1CgRT0/+ezTy0+khyAbHmBEuFDgDlkCup6yyNfRl6LGWx8Sm xqg5FYkP9mjyblHswwW9602Kf6Liz5996gKGkqbWMpY0y908kk8mz3f8HrR0x29Fi/7j msinieuEC+ho2ERz3uMCg4Kly8JXJZUFBEHLKmqfcnc63OxMcuC6uHfQHbtwKrPWlMnH y33Ifdp+vEHCTqvC+XpN6Jt629IT6tBTMFqDh/pdLDkEyMQEtuY31jgwmp/AfmNYqa27 YZdHxGWwL1Tu9gSrppG95GkFkjm91ZKeEA3p95Bmux6ye7P0EODe5Pl+ES290JaodymU oNfg== 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=ego29y7R5MI4HXkIdfklzaGBqVnNPr9KjlXJvso0l8Q=; b=zO160Zuv8yaKn8xa80q/3NQAlHgS9CLehEb7h5h+Lql00tppa3TtHOzAQBlX+O+Yi3 MPgHOXch4fhWsbVsTB1SfTO3iZJ3+GKFcGttsJyEHIOrrWmptOut0N0kPbgu8zhknpXb H0sW7xc7wQuVwYLLFeHNMgt/DNVgmticgSo0cgMzgxIwzVZbvyhj9F1+krbkHOpH4plo H+Zc9jd2GrCd9cHgQmkuTchWfflQ9b+zl7mVTaDM/y3YxpC4rqLa+sLs4EDoEKqL9DPa cjnPCYbmCbOZajwwEYpzsCPClYvLA5m6kFjmbo7hQPgRpG/HRkuJaRjD7MfGrkPLfjT4 Kvpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CLVT802q; 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 b15-20020a170902e94f00b001a067e3b1edsi2147643pll.592.2023.03.14.09.34.38; Tue, 14 Mar 2023 09:34:51 -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=CLVT802q; 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 S231419AbjCNQSC (ORCPT + 99 others); Tue, 14 Mar 2023 12:18:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230475AbjCNQRo (ORCPT ); Tue, 14 Mar 2023 12:17:44 -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 7FBF987348; Tue, 14 Mar 2023 09:17:26 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id v16so14932065wrn.0; Tue, 14 Mar 2023 09:17:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678810644; 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=ego29y7R5MI4HXkIdfklzaGBqVnNPr9KjlXJvso0l8Q=; b=CLVT802qIIEjkILL5nj8I+5ijSb5/hzGcvbX5XlZIlzt4fPUkHniz62xGyEKk8APN5 4aoUU/FmfEeA5FvVIM2t5XHm1IKvC7MFxjtb+XBS5a6/uki2P/Jv2F9LaCR7eWDTAuoK ST53GyD+ponDh5agyEqiW90y4JsV37x6Li2acb8f1oHPQ7H/uzfhqdKUQB/PRKb5BR5I iaZMvteJKnUa0esgr19dR3U10Fe8O/6NWT733HXIIBZX8FmKZ7RVupIVtKKa/YtM1Y/h qnFN9Ml2g+7eLqBVf9tW0dvtxO4Mn+vCxcbuu7oxo/VEvpNR81UwU5sdTu1fhWZPnPhS +1fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678810644; 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=ego29y7R5MI4HXkIdfklzaGBqVnNPr9KjlXJvso0l8Q=; b=DypYZPtsTAqCZp3MF62lonf1YjQdw3o/KWnBkbP6pD3reBp9yr+13ytz1YNJjJXr9V 7xTk8BJNhaI4e6e8vr73s1tKGSWZgPOeGSiCO3v5AJNqgu7YQcVEuXyjk/PbIS8rT+cg 70ePwOEV/eFeNoO819lT8KQveGhsf5vuOSkAu6fQWV3xRDD1JIP6Qxd+S5qwwJX9l2et rLlKLyI78Jo5W2z5Ozm6QaAOggM0lvPHHH46+b61NlMqW81ZTJejuFnI4FVt/Z3rRBHT hxSP4S6jCcyM2ddbW5bDD9FnkzzVXEcbe7r1yy9/S8pMB5XxXO4h56ARzVwXf58Jl7sS A6rA== X-Gm-Message-State: AO0yUKW/aG4zagaFKv3FfXu581H6/UvzffvdRXDRAAXtkCRQrJEiATJR fwgYhcXH46zW6Flo9ULsqLs= X-Received: by 2002:adf:e884:0:b0:2cf:e496:93d9 with SMTP id d4-20020adfe884000000b002cfe49693d9mr4458429wrm.52.1678810643689; Tue, 14 Mar 2023 09:17: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 a16-20020a5d4570000000b002c5539171d1sm2426821wrc.41.2023.03.14.09.17.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 09:17: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 v3 02/14] net: dsa: qca8k: add LEDs basic support Date: Tue, 14 Mar 2023 11:15:04 +0100 Message-Id: <20230314101516.20427-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314101516.20427-1-ansuelsmth@gmail.com> References: <20230314101516.20427-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1760361647825658900?= X-GMAIL-MSGID: =?utf-8?q?1760361647825658900?= 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 | 7 ++ drivers/net/dsa/qca/Makefile | 1 + drivers/net/dsa/qca/qca8k-8xxx.c | 4 + drivers/net/dsa/qca/qca8k-leds.c | 191 +++++++++++++++++++++++++++++++ drivers/net/dsa/qca/qca8k.h | 69 +++++++++++ 5 files changed, 272 insertions(+) create mode 100644 drivers/net/dsa/qca/qca8k-leds.c diff --git a/drivers/net/dsa/qca/Kconfig b/drivers/net/dsa/qca/Kconfig index ba339747362c..9ed9d9cf80eb 100644 --- a/drivers/net/dsa/qca/Kconfig +++ b/drivers/net/dsa/qca/Kconfig @@ -15,3 +15,10 @@ config NET_DSA_QCA8K help This enables support for the Qualcomm Atheros QCA8K Ethernet switch chips. + +config NET_DSA_QCA8K_LEDS_SUPPORT + bool "Qualcomm Atheros QCA8K Ethernet switch family LEDs support" + depends on NET_DSA_QCA8K + help + This enabled support for LEDs present on the Qualcomm Atheros + QCA8K Ethernet switch chips. diff --git a/drivers/net/dsa/qca/Makefile b/drivers/net/dsa/qca/Makefile index 701f1d199e93..330ae389e489 100644 --- a/drivers/net/dsa/qca/Makefile +++ b/drivers/net/dsa/qca/Makefile @@ -2,3 +2,4 @@ obj-$(CONFIG_NET_DSA_AR9331) += ar9331.o obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o qca8k-y += qca8k-common.o qca8k-8xxx.o +obj-$(CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT) += qca8k-leds.o diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 8dfc5db84700..fe68ac7e4030 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -1727,6 +1727,10 @@ qca8k_setup(struct dsa_switch *ds) if (ret) return ret; + ret = qca8k_setup_led_ctrl(priv); + if (ret) + return ret; + qca8k_setup_pcs(priv, &priv->pcs_port_0, 0); qca8k_setup_pcs(priv, &priv->pcs_port_6, 6); diff --git a/drivers/net/dsa/qca/qca8k-leds.c b/drivers/net/dsa/qca/qca8k-leds.c new file mode 100644 index 000000000000..7e1e1cc123cd --- /dev/null +++ b/drivers/net/dsa/qca/qca8k-leds.c @@ -0,0 +1,191 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include + +#include "qca8k.h" + +static int +qca8k_get_enable_led_reg(int port_num, int led_num, struct qca8k_led_pattern_en *reg_info) +{ + switch (port_num) { + case 0: + reg_info->reg = QCA8K_LED_CTRL_REG(led_num); + reg_info->shift = QCA8K_LED_PHY0123_CONTROL_RULE_SHIFT; + break; + case 1: + case 2: + case 3: + /* Port 123 are controlled on a different reg */ + reg_info->reg = QCA8K_LED_CTRL_REG(3); + reg_info->shift = QCA8K_LED_PHY123_PATTERN_EN_SHIFT(port_num, led_num); + break; + case 4: + reg_info->reg = QCA8K_LED_CTRL_REG(led_num); + reg_info->shift = QCA8K_LED_PHY4_CONTROL_RULE_SHIFT; + break; + default: + return -EINVAL; + } + + return 0; +} + +static int +qca8k_led_brightness_set(struct qca8k_led *led, + enum led_brightness brightness) +{ + struct qca8k_led_pattern_en reg_info; + struct qca8k_priv *priv = led->priv; + u32 mask, val = QCA8K_LED_ALWAYS_OFF; + + qca8k_get_enable_led_reg(led->port_num, led->led_num, ®_info); + + if (brightness) + val = QCA8K_LED_ALWAYS_ON; + + if (led->port_num == 0 || led->port_num == 4) { + mask = QCA8K_LED_PATTERN_EN_MASK; + val <<= QCA8K_LED_PATTERN_EN_SHIFT; + } else { + mask = QCA8K_LED_PHY123_PATTERN_EN_MASK; + } + + return regmap_update_bits(priv->regmap, reg_info.reg, + mask << reg_info.shift, + val << reg_info.shift); +} + +static int +qca8k_cled_brightness_set_blocking(struct led_classdev *ldev, + enum led_brightness brightness) +{ + struct qca8k_led *led = container_of(ldev, struct qca8k_led, cdev); + + return qca8k_led_brightness_set(led, brightness); +} + +static enum led_brightness +qca8k_led_brightness_get(struct qca8k_led *led) +{ + struct qca8k_led_pattern_en reg_info; + struct qca8k_priv *priv = led->priv; + u32 val; + int ret; + + qca8k_get_enable_led_reg(led->port_num, led->led_num, ®_info); + + ret = regmap_read(priv->regmap, reg_info.reg, &val); + if (ret) + return 0; + + val >>= reg_info.shift; + + if (led->port_num == 0 || led->port_num == 4) { + val &= QCA8K_LED_PATTERN_EN_MASK; + val >>= QCA8K_LED_PATTERN_EN_SHIFT; + } else { + val &= QCA8K_LED_PHY123_PATTERN_EN_MASK; + } + + /* 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..25fab385f0f7 100644 --- a/drivers/net/dsa/qca/qca8k.h +++ b/drivers/net/dsa/qca/qca8k.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #define QCA8K_ETHERNET_MDIO_PRIORITY 7 @@ -85,6 +86,50 @@ #define QCA8K_MDIO_MASTER_DATA(x) FIELD_PREP(QCA8K_MDIO_MASTER_DATA_MASK, x) #define QCA8K_MDIO_MASTER_MAX_PORTS 5 #define QCA8K_MDIO_MASTER_MAX_REG 32 + +/* LED control register */ +#define QCA8K_LED_COUNT 15 +#define QCA8K_LED_PORT_COUNT 3 +#define QCA8K_LED_RULE_COUNT 6 +#define QCA8K_LED_RULE_MAX 11 + +#define QCA8K_LED_PHY123_PATTERN_EN_SHIFT(_phy, _led) ((((_phy) - 1) * 6) + 8 + (2 * (_led))) +#define QCA8K_LED_PHY123_PATTERN_EN_MASK GENMASK(1, 0) + +#define QCA8K_LED_PHY0123_CONTROL_RULE_SHIFT 0 +#define QCA8K_LED_PHY4_CONTROL_RULE_SHIFT 16 + +#define QCA8K_LED_CTRL_REG(_i) (0x050 + (_i) * 4) +#define QCA8K_LED_CTRL0_REG 0x50 +#define QCA8K_LED_CTRL1_REG 0x54 +#define QCA8K_LED_CTRL2_REG 0x58 +#define QCA8K_LED_CTRL3_REG 0x5C +#define QCA8K_LED_CTRL_SHIFT(_i) (((_i) % 2) * 16) +#define QCA8K_LED_CTRL_MASK GENMASK(15, 0) +#define QCA8K_LED_RULE_MASK GENMASK(13, 0) +#define QCA8K_LED_BLINK_FREQ_MASK GENMASK(1, 0) +#define QCA8K_LED_BLINK_FREQ_SHITF 0 +#define QCA8K_LED_BLINK_2HZ 0 +#define QCA8K_LED_BLINK_4HZ 1 +#define QCA8K_LED_BLINK_8HZ 2 +#define QCA8K_LED_BLINK_AUTO 3 +#define QCA8K_LED_LINKUP_OVER_MASK BIT(2) +#define QCA8K_LED_TX_BLINK_MASK BIT(4) +#define QCA8K_LED_RX_BLINK_MASK BIT(5) +#define QCA8K_LED_COL_BLINK_MASK BIT(7) +#define QCA8K_LED_LINK_10M_EN_MASK BIT(8) +#define QCA8K_LED_LINK_100M_EN_MASK BIT(9) +#define QCA8K_LED_LINK_1000M_EN_MASK BIT(10) +#define QCA8K_LED_POWER_ON_LIGHT_MASK BIT(11) +#define QCA8K_LED_HALF_DUPLEX_MASK BIT(12) +#define QCA8K_LED_FULL_DUPLEX_MASK BIT(13) +#define QCA8K_LED_PATTERN_EN_MASK GENMASK(15, 14) +#define QCA8K_LED_PATTERN_EN_SHIFT 14 +#define QCA8K_LED_ALWAYS_OFF 0 +#define QCA8K_LED_ALWAYS_BLINK_4HZ 1 +#define QCA8K_LED_ALWAYS_ON 2 +#define QCA8K_LED_RULE_CONTROLLED 3 + #define QCA8K_GOL_MAC_ADDR0 0x60 #define QCA8K_GOL_MAC_ADDR1 0x64 #define QCA8K_MAX_FRAME_SIZE 0x78 @@ -383,6 +428,19 @@ struct qca8k_pcs { int port; }; +struct qca8k_led_pattern_en { + u32 reg; + u8 shift; +}; + +struct qca8k_led { + u8 port_num; + u8 led_num; + u16 old_rule; + struct qca8k_priv *priv; + struct led_classdev cdev; +}; + struct qca8k_priv { u8 switch_id; u8 switch_revision; @@ -407,6 +465,7 @@ struct qca8k_priv { struct qca8k_pcs pcs_port_0; struct qca8k_pcs pcs_port_6; const struct qca8k_match_data *info; + struct qca8k_led ports_led[QCA8K_LED_COUNT]; }; struct qca8k_mib_desc { @@ -526,4 +585,14 @@ int qca8k_port_lag_join(struct dsa_switch *ds, int port, struct dsa_lag lag, int qca8k_port_lag_leave(struct dsa_switch *ds, int port, struct dsa_lag lag); +/* Leds Support function */ +#ifdef CONFIG_NET_DSA_QCA8K_LEDS_SUPPORT +int qca8k_setup_led_ctrl(struct qca8k_priv *priv); +#else +static inline int qca8k_setup_led_ctrl(struct qca8k_priv *priv) +{ + return 0; +} +#endif + #endif /* __QCA8K_H */ From patchwork Tue Mar 14 10:15:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 69720 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1858533wrd; Tue, 14 Mar 2023 09:33:18 -0700 (PDT) X-Google-Smtp-Source: AK7set/eTXy08OeZuy/VGyPAFuOr3yq2AyC2FHAQRZ+ddU1z7jZjCiyIgGw7OkreRRoJt6ukVADs X-Received: by 2002:a05:6a20:690e:b0:c7:651c:1bae with SMTP id q14-20020a056a20690e00b000c7651c1baemr30568811pzj.32.1678811598646; Tue, 14 Mar 2023 09:33:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678811598; cv=none; d=google.com; s=arc-20160816; b=Dk/mj6vrnss+7ZHu96kr09ZZk2Lravc4PvQ+rmnfWevZTMen5raO3UbE3T+EDLWmbg R9BFUG0CPe9PD7UEUEYxutqcdkjDC2bEHxPuvMo6wht+6XfTJe3qeMJ7d5NOp+rekYI3 H303+Ba3mGci1jXwNzwFFRopDODxqFNpyaN376PIgqL9Vd5RhgA7aKYv3LR9QE0ZFUZu cMmcx2a5Y2OmYHx/bzseqawXLVCaH5dfU8MYQVgANsuWMLu8kVb6lp2o20svDgjsOdwy QvTnCCs5A3R0XTzJY1xly1QYXbGyFFgLDjH5Q8DKw4AFTTmjTlkE72xw4fMFL+XSXwZr 3t6Q== 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=vBkEcvNWhfAeeyo/X+X9rMIXx/nIzS4f74zU0rzzLQA=; b=lNfI7K9Mv493nt6/lWIx1st8XQP2Y7q1IHiH00gt3rLU4ErC3n6KQQmz7+/BpuDJhC uHTxYx0utr6wnUi+2cPd9C5qP1UL1c2TT6oHM77nAnUTwg1Oc35LKklJObSSE+GoLI0v I6kPPIAQg1n/uDxSqLXmOSz0+El8x8lofAyso2tao+GFOfXdT6w/WDfm0U00C8MZsLas iQc0otM1OgRcPUaSHarNgfelOpovGDwZPpKoEOMP/DasmftM5GRmdizI1BeFhKrmMWQb 5RDwLAEefjpqsxI3guR7WtBWZTWOImuvj1RzkaEVe6v5fTgGesV2BjwbOscG80ue8A1e 4QAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XwtBhJd3; 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 b3-20020a62cf03000000b005a8d987d003si2595641pfg.55.2023.03.14.09.33.03; Tue, 14 Mar 2023 09:33:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XwtBhJd3; 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 S231185AbjCNQSH (ORCPT + 99 others); Tue, 14 Mar 2023 12:18:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230453AbjCNQRp (ORCPT ); Tue, 14 Mar 2023 12:17:45 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A5EDB4228; Tue, 14 Mar 2023 09:17:27 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id l12so6601220wrm.10; Tue, 14 Mar 2023 09:17:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678810645; 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=vBkEcvNWhfAeeyo/X+X9rMIXx/nIzS4f74zU0rzzLQA=; b=XwtBhJd3if9M6A2OTMozEfIevA56cKlK/3J24Es8Wx8pn21l24IRpLcZov5eApGPXg B6aaMDVCwSCITNdbxG9CU8hkYZDmt+h3wTx7CoR7yG4Rkl/JR2KvlX7ZJWfNl9NGU3YB sylASw/zC9HiwlC+o1r4dCh53uwHMXgqZTIfgcp0+WRNO31uj1bghz2S7HqM2jjod5fN +SZ+DDS7+aMIhgqOGb+RF8Rc0X49G8p8b1cCuywQtRQwcW0u9YGn7POMKlAhF9MwYqOr spgSLUkwkVu5xRh8774GBxaseYSVIszcwNar7/w2zkeOCbNE4EeRBhQibwgd4OS9On/p TM8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678810645; 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=vBkEcvNWhfAeeyo/X+X9rMIXx/nIzS4f74zU0rzzLQA=; b=n3DA7wdzqKvEUxk62xCWu/KxIp5OwfRuS3Naq4np/5sO29vycodG2ZnfAeemaQQahA LV6pBr4lcIL5BgZ3nfYyl8OrudJ/x7iRHbHWlRbcUiVbjjrfMdzozSjMi1CC3/NrFUAX ++0FcnptC9EQ464EGT5iCjZcS/PBKTqzqh9DMvBDHWivvCzPe73yENCsbOMFe3Uh7n26 CZZH7X/N4Ppi2+ZDqpz7IQPFkJm8cDKCvv8dI4ToZsUY/90zC74HNki5gP1r8fd1Nw1F XMs9m0QqNV+91IY8SMBLoyy3AN6WARBZm42wJFmmF/iG9/0yydnsJC6JSgyXb42RTH0h ScUQ== X-Gm-Message-State: AO0yUKX8G9CYvRxq7In3eqd1AvNzjKF7o8f8aEZi+Lsqev3WOcU/pL/c 6NdwWaP0AAzdL1VWMPy3NoWA02vsj7I= X-Received: by 2002:a5d:52cc:0:b0:2ca:2794:87e8 with SMTP id r12-20020a5d52cc000000b002ca279487e8mr24642900wrv.21.1678810645067; Tue, 14 Mar 2023 09:17: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 a16-20020a5d4570000000b002c5539171d1sm2426821wrc.41.2023.03.14.09.17.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 09:17: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 v3 03/14] net: dsa: qca8k: add LEDs blink_set() support Date: Tue, 14 Mar 2023 11:15:05 +0100 Message-Id: <20230314101516.20427-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314101516.20427-1-ansuelsmth@gmail.com> References: <20230314101516.20427-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1760361550799571095?= X-GMAIL-MSGID: =?utf-8?q?1760361550799571095?= 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 7e1e1cc123cd..8054f867c708 100644 --- a/drivers/net/dsa/qca/qca8k-leds.c +++ b/drivers/net/dsa/qca/qca8k-leds.c @@ -91,6 +91,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) { @@ -148,6 +185,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 Tue Mar 14 10:15:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 69716 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1854098wrd; Tue, 14 Mar 2023 09:24:30 -0700 (PDT) X-Google-Smtp-Source: AK7set9QSQTiTwokz2KLIlGsnhLLQ3LMxMLVLQPJzoeY4XnZqq6Ew9tg4s7qxxV26DUYwpvQNfuk X-Received: by 2002:a05:6a20:7d88:b0:cc:fa4b:3a6a with SMTP id v8-20020a056a207d8800b000ccfa4b3a6amr50159186pzj.58.1678811070306; Tue, 14 Mar 2023 09:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678811070; cv=none; d=google.com; s=arc-20160816; b=Th/qfK5mK3OnJiz+VCnjnMFdU7wp7PVtUbFhOCRC1NXr1S6ZkUAbXDCGndkt6B9FYv rZeRHoeSswUbT5qe7zFGPLNlRqEaKpw5yq4ByNTa+cbILU1aZSrfXcCBihZU+V7PGQFF CdoIlM5Jw6EaT5U5HBCdONmtK+pPyrhSisHr4uTzh8ewtcfJD6y1xLXsChtcfzkzFjoa d1m8GsL5T2Y2vRAXJeRE1Cby+rK/SS4TihpmHJOOHq8AJb/69IKGltWO1SogqNSNtm7c tIBofgxU7GT/tvg42wcvzLtlK01/1Y/gorTuMD7Zm6n4SUxENr3R98RCoawS8Akrzon0 mjZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=qIIOBe7NJABZRFq7ORmufJwFdwVU7XOjO161+6pddBo=; b=03aX/iJZPqqdeIO8SBioHvLbRe0TGqngIs1HOClNEJUaWNMs066WBEyW25M4blVU0h esrOM9hzaviE1VfKjBZ1OpyIdrROB16EFqhcAVJQuBHJPkvcyx8QNCX/eWCwsZFnXbBB OreZXfNyFcy01fg7fazt/RIb85iwCujwrvkQJcM/+qFpTSzq2oRow7pmg+K5jusYctP0 ZKHTrRUxLqXN1fSJ63ug5v2aBim6eBcXWMO9lT806YlZ2pwKCXJ84THsuuUTi4yDds4t URDLGEr7Kq/zNOzZtvXYXaWpTDEpGIJxWkmTqyxmYOkxLEW3IprinUkJ5vpSH3Il92J/ Rcsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dtpenmKp; 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 a72-20020a621a4b000000b00623e7faaf20si2451122pfa.192.2023.03.14.09.24.17; Tue, 14 Mar 2023 09:24:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dtpenmKp; 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 S231500AbjCNQSK (ORCPT + 99 others); Tue, 14 Mar 2023 12:18:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231162AbjCNQRt (ORCPT ); Tue, 14 Mar 2023 12:17:49 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43246ADC3D; Tue, 14 Mar 2023 09:17:28 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id r29so6854693wra.13; Tue, 14 Mar 2023 09:17:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678810646; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=qIIOBe7NJABZRFq7ORmufJwFdwVU7XOjO161+6pddBo=; b=dtpenmKpkZtXXEJD24OKazKV0u2bhC9Coau1CVgmS4zkPAcMGuGQh0jyoIGSEmTmDk mjxUtx7F70gQzYUadWYKyOnl/i9A3YaY4ptXygJD6Lxd3qXvSqPqCV6dEJTKfclPqc5T TC0WXLNodBfK7luBymPM3WHRFSidaZ8ZHYSEV6+mOp04swUyFkhsIVevmVTLhTCiXNN7 2xosGLjGQg55L5VxS054TaWbXKULS4lzdv7S14m4dpbkI7l8BEBxUiNSdtaOz9Dz6pgc Gwm/Tl4mKLnc3QLILtdlDGkK3A9NUCA4ioHi1lOUejPw6CyfG/nBCx9tVMizeD94oayC QAJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678810646; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qIIOBe7NJABZRFq7ORmufJwFdwVU7XOjO161+6pddBo=; b=PLihw7goEW1rRqh0IRAiFkzYwzypO45QNoW7hz0FepsHnHHQY2dGYCm1kxccDTxjIb SAN914gKLjEvfHI+5dpPy61a1LTjjESfHw9RU810HENGSO3kJ9HrNkEqIObQkB3hkpjf OZAk9ebb4h+JMTvFUMHTuDERn+F7+j0a65tM5a5E4YieM+LDZUhlgAUE/OXYXJa0joqU J97l/F2q0hwVrSUhD0127gIYmTPw56iMS9H/r19g07SKL8JqiCNFgmP28FLsuuxs87fx lxecgIEEcMKTjXk2O+5YseohtHh+6QgRr8gaUlvAU7KFosHcW/GEyqAYShbLRxMLvzCI KnOQ== X-Gm-Message-State: AO0yUKWHsnhieweUhBOFLlBRqngHz30dRpOd/508xCh9Ks194wmQXTr7 vBQlObZZ+nQV+/HozYnJHPE= X-Received: by 2002:adf:f44c:0:b0:2cf:6089:2408 with SMTP id f12-20020adff44c000000b002cf60892408mr6055723wrp.0.1678810646525; Tue, 14 Mar 2023 09:17: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 a16-20020a5d4570000000b002c5539171d1sm2426821wrc.41.2023.03.14.09.17.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 09:17: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 v3 04/14] net: phy: Add a binding for PHY LEDs Date: Tue, 14 Mar 2023 11:15:06 +0100 Message-Id: <20230314101516.20427-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314101516.20427-1-ansuelsmth@gmail.com> References: <20230314101516.20427-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1760360996658604778?= X-GMAIL-MSGID: =?utf-8?q?1760360996658604778?= From: Andrew Lunn Define common binding parsing for all PHY drivers with LEDs using phylib. Parse the DT as part of the phy_probe and add LEDs to the linux LED class infrastructure. For the moment, provide a dummy brightness function, which will later be replaced with a call into the PHY driver. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/phy_device.c | 89 ++++++++++++++++++++++++++++++++++++ include/linux/phy.h | 16 +++++++ 2 files changed, 105 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 9ba8f973f26f..8acade42615c 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -19,10 +19,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -658,6 +660,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, device_initialize(&mdiodev->dev); dev->state = PHY_DOWN; + INIT_LIST_HEAD(&dev->led_list); mutex_init(&dev->lock); INIT_DELAYED_WORK(&dev->state_queue, phy_state_machine); @@ -2964,6 +2967,85 @@ static bool phy_drv_supports_irq(struct phy_driver *phydrv) return phydrv->config_intr && phydrv->handle_interrupt; } +/* Dummy implementation until calls into PHY driver are added */ +static int phy_led_set_brightness(struct led_classdev *led_cdev, + enum led_brightness value) +{ + return 0; +} + +static int of_phy_led(struct phy_device *phydev, + struct device_node *led) +{ + struct device *dev = &phydev->mdio.dev; + struct led_init_data init_data = {}; + struct led_classdev *cdev; + struct phy_led *phyled; + int err; + + phyled = devm_kzalloc(dev, sizeof(*phyled), GFP_KERNEL); + if (!phyled) + return -ENOMEM; + + phyled->phydev = phydev; + cdev = &phyled->led_cdev; + INIT_LIST_HEAD(&phyled->led_list); + + err = of_property_read_u32(led, "reg", &phyled->index); + if (err) + return err; + + cdev->brightness_set_blocking = phy_led_set_brightness; + cdev->max_brightness = 1; + init_data.devicename = dev_name(&phydev->mdio.dev); + init_data.fwnode = of_fwnode_handle(led); + + err = devm_led_classdev_register_ext(dev, cdev, &init_data); + if (err) + return err; + + list_add(&phyled->led_list, &phydev->led_list); + + return 0; +} + +static int of_phy_leds(struct phy_device *phydev) +{ + struct device_node *node = phydev->mdio.dev.of_node; + struct device_node *leds, *led; + int err; + + if (!IS_ENABLED(CONFIG_OF_MDIO)) + return 0; + + if (!node) + return 0; + + leds = of_get_child_by_name(node, "leds"); + if (!leds) + return 0; + + for_each_available_child_of_node(leds, led) { + err = of_phy_led(phydev, led); + if (err) + return err; + } + + return 0; +} + +static void phy_leds_remove(struct phy_device *phydev) +{ + struct device *dev = &phydev->mdio.dev; + struct led_classdev *cdev; + struct phy_led *phyled; + + list_for_each_entry(phyled, &phydev->led_list, led_list) { + cdev = &phyled->led_cdev; + devm_led_classdev_unregister(dev, cdev); + } +} + /** * fwnode_mdio_find_device - Given a fwnode, find the mdio_device * @fwnode: pointer to the mdio_device's fwnode @@ -3142,6 +3224,11 @@ static int phy_probe(struct device *dev) /* Set the state to READY by default */ phydev->state = PHY_READY; + /* Get the LEDs from the device tree, and instantiate standard + * LEDs for them. + */ + of_phy_leds(phydev); + out: /* Assert the reset signal */ if (err) @@ -3156,6 +3243,8 @@ static int phy_remove(struct device *dev) { struct phy_device *phydev = to_phy_device(dev); + phy_leds_remove(phydev); + cancel_delayed_work_sync(&phydev->state_queue); mutex_lock(&phydev->lock); diff --git a/include/linux/phy.h b/include/linux/phy.h index fbeba4fee8d4..1b1efe120f0f 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -595,6 +596,7 @@ struct macsec_ops; * @phy_num_led_triggers: Number of triggers in @phy_led_triggers * @led_link_trigger: LED trigger for link up/down * @last_triggered: last LED trigger for link speed + * @led_list: list of PHY LED structures * @master_slave_set: User requested master/slave configuration * @master_slave_get: Current master/slave advertisement * @master_slave_state: Current master/slave configuration @@ -690,6 +692,7 @@ struct phy_device { struct phy_led_trigger *led_link_trigger; #endif + struct list_head led_list; /* * Interrupt number for this PHY @@ -825,6 +828,19 @@ struct phy_plca_status { bool pst; }; +/* phy_led: An LED driven by the PHY + * + * phydev: Pointer to the PHY this LED belongs to + * led_cdev: Standard LED class structure + * index: Number of the LED + */ +struct phy_led { + struct list_head led_list; + struct phy_device *phydev; + struct led_classdev led_cdev; + u32 index; +}; + /** * struct phy_driver - Driver structure for a particular PHY type * From patchwork Tue Mar 14 10:15:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 69724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1859441wrd; Tue, 14 Mar 2023 09:34:57 -0700 (PDT) X-Google-Smtp-Source: AK7set+5IPJ1S9sFZ5eJCBv4kifzTXUusI5J2/TGCKTnNOAkAX8dqmZbt7vrMSO5Ost3U7Y2nAUg X-Received: by 2002:a17:902:edc7:b0:19f:2b42:5d01 with SMTP id q7-20020a170902edc700b0019f2b425d01mr9149313plk.9.1678811697392; Tue, 14 Mar 2023 09:34:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678811697; cv=none; d=google.com; s=arc-20160816; b=h900sBs6gQHmCSG7Q8eDSQvkz2ClGjXP6ibkjWRJWLPvfjqB0JYatNEXn/c3vXaFSJ PzgPx4+04kUFwGV9KkURBllYIMDxaTHhwZyLSjPPpUlykX5nHDdLvXDQiakIepMNEFXw Z0xnVihrqTS/tYv0vJu0zKKKglVP+jDdAzJApyywvmczwQdSOVRJS99th6HHpvPuh19r o9tDHbx/+XxKqV0DiIWO8EplpVPTj4u1kWcPQ+3XqHi6OIdm1s/gEouvZaBdRjwa7DlY OLnSNTe5GPX+SW5g2D0jBF/Plb9ZZJ8nZ+gvjy3pRTkujm/yXnPPROlVqfyNrfnuVHv+ FmRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=tDRoLkLZ4ceS0IqWkmGrgNhXPijtgv6U26EGp7OciKo=; b=vKPeiUFT5SkOgN7rhznNG5g622jSBaNMQBSfJBVf4//KJvyUyI5ytRJAwnvxPA3Dds +2waEiLRAq9lTvfa5/091IWmr4Bp8SidtqWApwZLq+G8Of/1H3yT2cGgNX4XiSIP9/2/ aiyqDkGlD5dtELPCMxc+aYHiWvmQpXdd2Qv4zA7P32p/ZxROccT9b5nVs1f8dN23r4EQ gppwA1DA9INhuoRyyTaNscn6WetPoZv0omIID0GnWn/8GUx2GYx5AFCvZu+jp0tiz9r+ U8aq2XHrXdSpryzRuYUO+0sDqaAtsxcPORNvmFwXacqmeuZG2jmj7n0WAO/nCHcSxnrf SS9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="iGlg/uX2"; 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 e5-20020a17090301c500b0019cec83ecd5si2976375plh.66.2023.03.14.09.34.42; Tue, 14 Mar 2023 09:34:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="iGlg/uX2"; 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 S231578AbjCNQS2 (ORCPT + 99 others); Tue, 14 Mar 2023 12:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231298AbjCNQRw (ORCPT ); Tue, 14 Mar 2023 12:17:52 -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 39E32B06C0; Tue, 14 Mar 2023 09:17:30 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id l12so6601360wrm.10; Tue, 14 Mar 2023 09:17:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678810648; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=tDRoLkLZ4ceS0IqWkmGrgNhXPijtgv6U26EGp7OciKo=; b=iGlg/uX24MKMHHK8AAOSr2BKLyFS4HOhcBcxa70+pJ2Ns4LBP7fN/aw6CU6ziNhk3Y 1kCs/ku6xXcSaOWBrI5FI077EwMOIS5g/uSq3LkvSQFb8AUUBNGCoDZ5yktYYT4obod1 uoY5hfxsJ2j/Dd3AUBRWBvQxn3MHskR/ruhf9IJlb3egdAVrRgBP46QPJFioDbiTIvmt e47qovgD7t+azseA0kcaRRGzbMNdjjWge4Ic0/rERQOjYQFJ56c58l09LyduwtG5yKQk HSF38Vcwi8rkDlI0HyqL5yhf2hBL1mjR9Q1K/k0KCnwwAs2qb48SAR0GUmO7CtWTy+tX Lfyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678810648; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tDRoLkLZ4ceS0IqWkmGrgNhXPijtgv6U26EGp7OciKo=; b=Yd8e4W3z25m9x/DnBZVhqNXkh7a+c9vrvqmZB3W/eV6hDayL6yU+ZjCJA3AySueRI4 JXxcylWLfae7NubKKpYCwnCZACwVwozBRMNpWQerAOHLi2kV4PYWtaWM510cfmEjt9ZC ZqLRkaK8yee+i/qif9Pahwj2k7+qlSP2wKpGHg7ymofPx8cj886/39jQk/E+WL5GuhI/ Vx1jKSxGilhyqAZnWZz2/RefDaF5aYLkK9sPePRAREH/UHgwgbLdPmKJq0O4DJwvde5X XAeUg6+mo2v/juJn36pefnvlPu86ihf6Kk8lWUuZYQs0dguVmhOhRLN4+mUgnMLIgSgd GYzQ== X-Gm-Message-State: AO0yUKV0U+rIY41k1ml3VQtGnyFhuO4IOuwA/hBHlb5JQB4Kx/cuCiBq S/SuFPvV5zWfeDVs9xHa4Onitmgh754= X-Received: by 2002:adf:e302:0:b0:2c7:a67:615e with SMTP id b2-20020adfe302000000b002c70a67615emr28433954wrj.0.1678810648104; Tue, 14 Mar 2023 09:17:28 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id a16-20020a5d4570000000b002c5539171d1sm2426821wrc.41.2023.03.14.09.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 09:17: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 v3 05/14] net: phy: phy_device: Call into the PHY driver to set LED brightness. Date: Tue, 14 Mar 2023 11:15:07 +0100 Message-Id: <20230314101516.20427-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314101516.20427-1-ansuelsmth@gmail.com> References: <20230314101516.20427-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1760361654609164237?= X-GMAIL-MSGID: =?utf-8?q?1760361654609164237?= From: Andrew Lunn Linux LEDs can be software controlled via the brightness file in /sys. LED drivers need to implement a brightness_set function which the core will call. Implement an intermediary in phy_device, which will call into the phy driver if it implements the necessary function. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/phy_device.c | 14 +++++++++++--- include/linux/phy.h | 9 +++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 8acade42615c..e4df4fcb6b05 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2967,11 +2967,18 @@ static bool phy_drv_supports_irq(struct phy_driver *phydrv) return phydrv->config_intr && phydrv->handle_interrupt; } -/* Dummy implementation until calls into PHY driver are added */ static int phy_led_set_brightness(struct led_classdev *led_cdev, enum led_brightness value) { - return 0; + struct phy_led *phyled = to_phy_led(led_cdev); + struct phy_device *phydev = phyled->phydev; + int err; + + mutex_lock(&phydev->lock); + err = phydev->drv->led_brightness_set(phydev, phyled->index, value); + mutex_unlock(&phydev->lock); + + return err; } static int of_phy_led(struct phy_device *phydev, @@ -2995,7 +3002,8 @@ static int of_phy_led(struct phy_device *phydev, if (err) return err; - cdev->brightness_set_blocking = phy_led_set_brightness; + if (phydev->drv->led_brightness_set) + cdev->brightness_set_blocking = phy_led_set_brightness; cdev->max_brightness = 1; init_data.devicename = dev_name(&phydev->mdio.dev); init_data.fwnode = of_fwnode_handle(led); diff --git a/include/linux/phy.h b/include/linux/phy.h index 1b1efe120f0f..83d3ed7485e0 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -841,6 +841,8 @@ struct phy_led { u32 index; }; +#define to_phy_led(d) container_of(d, struct phy_led, led_cdev) + /** * struct phy_driver - Driver structure for a particular PHY type * @@ -1063,6 +1065,13 @@ struct phy_driver { /** @get_plca_status: Return the current PLCA status info */ int (*get_plca_status)(struct phy_device *dev, struct phy_plca_status *plca_st); + + /* Set a PHY LED brightness. Index indicates which of the PHYs + * led should be set. Value follows the standard LED class meaning, + * e.g. LED_OFF, LED_HALF, LED_FULL. + */ + int (*led_brightness_set)(struct phy_device *dev, + u32 index, enum led_brightness value); }; #define to_phy_driver(d) container_of(to_mdio_common_driver(d), \ struct phy_driver, mdiodrv) From patchwork Tue Mar 14 10:15:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 69721 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1858726wrd; Tue, 14 Mar 2023 09:33:34 -0700 (PDT) X-Google-Smtp-Source: AK7set9H47eyU6LtjKad/FhJca8wBVlxfyKSWn8W7p0eldLYqcUifuhcn3k/k4fmfJSjOVubTjuR X-Received: by 2002:a05:6a20:9390:b0:c6:ff46:c713 with SMTP id x16-20020a056a20939000b000c6ff46c713mr47996160pzh.57.1678811614356; Tue, 14 Mar 2023 09:33:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678811614; cv=none; d=google.com; s=arc-20160816; b=cKXcpwckuE6IhxSbvu/IUq59kqJnT8FIEnR/FzVnWVcqULk2/pfaXUjc7o/pKkpZaa /oT+fwg4lzDPC2XEdqH2CiFRRj70YBlNq8bku9LibyOPGOmMYYmSyzS2LRhuSDEODOdI 4to8kWC6Eej07tD6GS+qlePVmylU+EXdF8V7foHGqrOq2McmorquoKQsRSbLjO2/EDvw mZq3imhV3ezRRrGWPy2a48ow5x1W6el0VokrYhFYvdUUMWSKU1JYC5JFY6000i8oUhfS +ibRG//89Jorr5nZ1IO89DuVtNa3bBYycOufOdDqstVU43H8Y61nhMnfot8RVhLY/BaP bfEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=bhHnF/S3YeXHYbPEZLJBWZo9IBQDiim5+f+K7WIjxP8=; b=MzSo8QNVHC/lKSlN2e5mrKxuLcpy48J3CTEifop5KnRJ5xh24+vrx+f1gzXs5fmnIF 5yjlrrrcDm34a40CRJK6rsCYuW2yTfuj08J1+YNZkRZGDVIjTiOdcct/p3szKIv4vyWU nBuWIZl/PkDfaNDdfKWOWeRI+e9CJkBo4nwsLzqSkDBwMYljqjLienXuZ6g9kjD5CiN5 UyOtBqqGwQlpXqd5WHbGKGPT7oHO+0euH+PhLRS/hdsKLFVSVNy6a5dzoRpJ29x8r17/ Gb/LILXHEZE/owPmJ2ZlDfe9NsGrvJoxo2+K4Fc7LhDDXrNDqGzzflo+UkQqkpX924Es u13w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JmdJ4lQr; 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 t13-20020a63534d000000b004fbd5328bc0si2540279pgl.562.2023.03.14.09.33.18; Tue, 14 Mar 2023 09:33:34 -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=JmdJ4lQr; 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 S230169AbjCNQSc (ORCPT + 99 others); Tue, 14 Mar 2023 12:18:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231307AbjCNQR5 (ORCPT ); Tue, 14 Mar 2023 12:17:57 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76274B420C; Tue, 14 Mar 2023 09:17:31 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id l12so6601430wrm.10; Tue, 14 Mar 2023 09:17:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678810649; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=bhHnF/S3YeXHYbPEZLJBWZo9IBQDiim5+f+K7WIjxP8=; b=JmdJ4lQrygrnfTg1/V1GKTLeL8CWX8Zu6lbubK7rdIQjreE/Dp4eZbWLWBBKDvpwBX VWOgQX1AtKZo+KLZnFxfED145ItnuxaPcqoM7q8VJoRIEtf7jjQQnyh1llyBNU0UJCr6 tsupwDMlWO0I6Fdb49e8USmNzomdLM4agoMtidMPr+DE/3uTCJkBDc8FzbR3GwFCwd4v ytQYtjn1oBygv/ct7R1cF6F8ieM0E9ps/6BTaFHAds8i9lzkWf0tc58yY5XHOHbNXeGu 95FHR3+2tygioramplnAwDM1WVpOPv8a6GgGA6aRLTx1QrxJjzuFU/9+4mq37P3uaBQD d6pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678810649; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bhHnF/S3YeXHYbPEZLJBWZo9IBQDiim5+f+K7WIjxP8=; b=zOU4pxFhVqtnsdAAnt7pxxnxOzrmWbJLKTQfeu88FAvx19zL1ZXnuFqlQ7UgW+NpCc UQ3jFolxogurWxVieHILYKItT7ruYBeOh3PfHZVv7bP4VqpR/Fu9+myq0yEZmmUInunz +fsotQ6em1eG8e33OMDx80Heq9x3tip70UfIAbTb0znqY0m4tPA2gIoBOQUH9BXCIXqs Db3LOyN57qQvE2GjPnGPt0piBqIe3qF4ro2yLzNYr+iITkKpH7JxK2JU2wsyxOrDBFhR RiB+U6X92s6G5XVA/jgL9M2Kuk2mR07j31VTtFkfkO5vKiypuNpa2AblotyEsr6emrzn qsaA== X-Gm-Message-State: AO0yUKWK10mgKd2tbcDcoQ+GR8vkVekKo58xz/ujavtKsQXNmh6rRp13 /PM/Io3kISby5dR5RJ9SOSs= X-Received: by 2002:a5d:6602:0:b0:2cf:e3c7:5975 with SMTP id n2-20020a5d6602000000b002cfe3c75975mr4936237wru.34.1678810649509; Tue, 14 Mar 2023 09:17: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 a16-20020a5d4570000000b002c5539171d1sm2426821wrc.41.2023.03.14.09.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 09:17:29 -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 v3 06/14] net: phy: marvell: Add software control of the LEDs Date: Tue, 14 Mar 2023 11:15:08 +0100 Message-Id: <20230314101516.20427-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314101516.20427-1-ansuelsmth@gmail.com> References: <20230314101516.20427-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1760361567468956347?= X-GMAIL-MSGID: =?utf-8?q?1760361567468956347?= From: Andrew Lunn Add a brightness function, so the LEDs can be controlled from software using the standard Linux LED infrastructure. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/marvell.c | 45 ++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 0d706ee266af..e44a4a26346a 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -144,11 +144,13 @@ /* WOL Event Interrupt Enable */ #define MII_88E1318S_PHY_CSIER_WOL_EIE BIT(7) -/* LED Timer Control Register */ -#define MII_88E1318S_PHY_LED_TCR 0x12 -#define MII_88E1318S_PHY_LED_TCR_FORCE_INT BIT(15) -#define MII_88E1318S_PHY_LED_TCR_INTn_ENABLE BIT(7) -#define MII_88E1318S_PHY_LED_TCR_INT_ACTIVE_LOW BIT(11) +#define MII_88E1318S_PHY_LED_FUNC 0x10 +#define MII_88E1318S_PHY_LED_FUNC_OFF (0x8) +#define MII_88E1318S_PHY_LED_FUNC_ON (0x9) +#define MII_88E1318S_PHY_LED_TCR 0x12 +#define MII_88E1318S_PHY_LED_TCR_FORCE_INT BIT(15) +#define MII_88E1318S_PHY_LED_TCR_INTn_ENABLE BIT(7) +#define MII_88E1318S_PHY_LED_TCR_INT_ACTIVE_LOW BIT(11) /* Magic Packet MAC address registers */ #define MII_88E1318S_PHY_MAGIC_PACKET_WORD2 0x17 @@ -2832,6 +2834,34 @@ static int marvell_hwmon_probe(struct phy_device *phydev) } #endif +static int m88e1318_led_brightness_set(struct phy_device *phydev, + u32 index, enum led_brightness value) +{ + u16 reg; + + reg = phy_read_paged(phydev, MII_MARVELL_LED_PAGE, + MII_88E1318S_PHY_LED_FUNC); + if (reg < 0) + return reg; + + switch (index) { + case 0: + case 1: + case 2: + reg &= ~(0xf << (4 * index)); + if (value == LED_OFF) + reg |= MII_88E1318S_PHY_LED_FUNC_OFF << (4 * index); + else + reg |= MII_88E1318S_PHY_LED_FUNC_ON << (4 * index); + break; + default: + return -EINVAL; + } + + return phy_write_paged(phydev, MII_MARVELL_LED_PAGE, + MII_88E1318S_PHY_LED_FUNC, reg); +} + static int marvell_probe(struct phy_device *phydev) { struct marvell_priv *priv; @@ -3081,6 +3111,7 @@ static struct phy_driver marvell_drivers[] = { .get_sset_count = marvell_get_sset_count, .get_strings = marvell_get_strings, .get_stats = marvell_get_stats, + .led_brightness_set = m88e1318_led_brightness_set, }, { .phy_id = MARVELL_PHY_ID_88E1145, @@ -3187,6 +3218,7 @@ static struct phy_driver marvell_drivers[] = { .cable_test_start = marvell_vct7_cable_test_start, .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, .cable_test_get_status = marvell_vct7_cable_test_get_status, + .led_brightness_set = m88e1318_led_brightness_set, }, { .phy_id = MARVELL_PHY_ID_88E1540, @@ -3213,6 +3245,7 @@ static struct phy_driver marvell_drivers[] = { .cable_test_start = marvell_vct7_cable_test_start, .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, .cable_test_get_status = marvell_vct7_cable_test_get_status, + .led_brightness_set = m88e1318_led_brightness_set, }, { .phy_id = MARVELL_PHY_ID_88E1545, @@ -3239,6 +3272,7 @@ static struct phy_driver marvell_drivers[] = { .cable_test_start = marvell_vct7_cable_test_start, .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, .cable_test_get_status = marvell_vct7_cable_test_get_status, + .led_brightness_set = m88e1318_led_brightness_set, }, { .phy_id = MARVELL_PHY_ID_88E3016, @@ -3380,6 +3414,7 @@ static struct phy_driver marvell_drivers[] = { .get_stats = marvell_get_stats, .get_tunable = m88e1540_get_tunable, .set_tunable = m88e1540_set_tunable, + .led_brightness_set = m88e1318_led_brightness_set, }, }; From patchwork Tue Mar 14 10:15:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 69718 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1857743wrd; Tue, 14 Mar 2023 09:31:47 -0700 (PDT) X-Google-Smtp-Source: AK7set9YSYxZN5Jkb3/mAP6HJbNeQbt7mudS37+UcMNlfj65RbCu/yvtiDwXouc2L/OQC9d9Dmwk X-Received: by 2002:a05:6a21:6d9f:b0:cd:a334:a531 with SMTP id wl31-20020a056a216d9f00b000cda334a531mr47990277pzb.62.1678811507595; Tue, 14 Mar 2023 09:31:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678811507; cv=none; d=google.com; s=arc-20160816; b=QX9hJFsf1qDrJLDw95adTXU0WxN5mY2xq15wuqBeH3hUkhAV6ukGAF32SKLJkck7Uh mmCAHqn+97Zyd/f6lAwB606WJ3Ls9IrIUAvN/5ktuBPoezLO9kjDW0seNTwawSOIqutH 8ZOECdA1nePeHhNDZtVFV5QD96O2dQxjDuBsPvVZYXe2LA+v5GE56WubplZ2K2XcDRKi 851SKRCr9zpz4ZK6f+J0YlfWpIcelNvOYnul7Jsb2JJgAxaBYCzcQ38aQwV+jcmWaTUJ 63OQ4/ibc0lHfC1KoRwdnpeZrR9ITIcPF5y1/oQUMjTVn/cE4hfQ5pvhF2fzTYPqahgi wuqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=cWl8tt6nddXYjDq6pzISEdAAK++EcnsjtXcgJ1R08pw=; b=AWKZoc3YGXyhMg5m0fHINKxRP2ZymprAIRgccvtCdAkp8E2owvJzsixdUzprKMf16Z W7TG0cPtJXohYYOuBQK7mkaeg6XKT9TD9k5Maw4UIlu8uH78CpuAHdDm6OPgAqL+5BQU NK/4LDIW53q5Hbdp/CGAmGt5eOLIgl855ORJTw1wTGWB6lKdPzZY/L57Jm3+Y8R4X/SL Y049PvL4wQR8Qda4H+AAt7lonlyb3Frl9gtUkgJE2w3ozGdJSLmW6LMwxy191aBsCE1M kcmrhqL4A6IZM8keVmgdYZSkp5VR8VgsdeLESkU/3x+3n5SjuX1TQ1V6HHircEnHwf6w qL7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=frwVXNK7; 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 g15-20020a63110f000000b005037c23ffb4si2402814pgl.571.2023.03.14.09.31.34; Tue, 14 Mar 2023 09:31:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=frwVXNK7; 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 S231655AbjCNQSr (ORCPT + 99 others); Tue, 14 Mar 2023 12:18:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230523AbjCNQSA (ORCPT ); Tue, 14 Mar 2023 12:18:00 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5091CACE27; Tue, 14 Mar 2023 09:17:36 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id o7so5496941wrg.5; Tue, 14 Mar 2023 09:17:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678810651; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=cWl8tt6nddXYjDq6pzISEdAAK++EcnsjtXcgJ1R08pw=; b=frwVXNK7BvlIsgBhXHgTowPejdqKimT7IaqvOMFSkJUyihwIEAbG769U0YDB1n5tHV pec/8mkp9KDVjBeIV3t0gKysg05mTJAH909NCT/iAaq7IPpgnqrwpBt5I7qs21wb8EH7 gzjxvYCw3TjAQ4nkPe7eVGTVrF6QiIhwtQxST0iEs5mUFREItlaMbJdZe0p2bgzJtMuz EwtfOCoGV+W4G72HUQURjnTwPJ6nyOoOtKOVFlVE6QcKtnEs0j+hPf3s+3VKxQr72Uyf wCGULVk+bAGSH4kvAvSnka7/cmyLt422JuSJOKeSAeGk2XA6t6zaMfI7z7dDAzeFvEQ7 592Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678810651; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cWl8tt6nddXYjDq6pzISEdAAK++EcnsjtXcgJ1R08pw=; b=D+53U0yhqNzef1GoW+MZ+H/gUt+i/ojgsuijtzUI9SvdKMd0E6AQgOw6JFcZQ595nn YNwKbscU4Tk/lMF2EaxIMfGLZEaUBmhkSZjU2PFDIzGsBUXR+HeCNjJ3mcIqmHAJ4sZD 3UrFZ0y4gB3l05VkCF8Ke/rMbI34hGqG/oQGa6gx18mTzrKkzD3PzCxLeEC/h32h04Kh KFjoDrAcNgQtK4gGkulxVimCklkiG7f964CRd6g/dBY32Wx3ePZis916JRp+oHhKg6Z8 IIDxk49+OcsmOa1MAu3pGgURUTkwxPo306UTH3Gjjb093kwEittnP56qAqT2ydF+TQDv 87xw== X-Gm-Message-State: AO0yUKVnITJbM3Z+DKHV9/hvuYK84dg7sJ3NKOmEck9BhS20x/rVmZrf k6R19nWbqysd0ottesK34GP8YU1wTFI= X-Received: by 2002:a5d:4012:0:b0:2c5:532a:98c4 with SMTP id n18-20020a5d4012000000b002c5532a98c4mr10942379wrp.33.1678810650821; Tue, 14 Mar 2023 09:17: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 a16-20020a5d4570000000b002c5539171d1sm2426821wrc.41.2023.03.14.09.17.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 09:17: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 v3 07/14] net: phy: phy_device: Call into the PHY driver to set LED blinking. Date: Tue, 14 Mar 2023 11:15:09 +0100 Message-Id: <20230314101516.20427-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314101516.20427-1-ansuelsmth@gmail.com> References: <20230314101516.20427-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1760361455001423348?= X-GMAIL-MSGID: =?utf-8?q?1760361455001423348?= From: Andrew Lunn Linux LEDs can be requested to perform hardware accelerated blinking. Pass this to the PHY driver, if it implements the op. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/phy_device.c | 18 ++++++++++++++++++ include/linux/phy.h | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index e4df4fcb6b05..ae8ec721353d 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2981,6 +2981,22 @@ static int phy_led_set_brightness(struct led_classdev *led_cdev, return err; } +static int phy_led_blink_set(struct led_classdev *led_cdev, + unsigned long *delay_on, + unsigned long *delay_off) +{ + struct phy_led *phyled = to_phy_led(led_cdev); + struct phy_device *phydev = phyled->phydev; + int err; + + mutex_lock(&phydev->lock); + err = phydev->drv->led_blink_set(phydev, phyled->index, + delay_on, delay_off); + mutex_unlock(&phydev->lock); + + return err; +} + static int of_phy_led(struct phy_device *phydev, struct device_node *led) { @@ -3004,6 +3020,8 @@ static int of_phy_led(struct phy_device *phydev, if (phydev->drv->led_brightness_set) cdev->brightness_set_blocking = phy_led_set_brightness; + if (phydev->drv->led_blink_set) + cdev->blink_set = phy_led_blink_set; cdev->max_brightness = 1; init_data.devicename = dev_name(&phydev->mdio.dev); init_data.fwnode = of_fwnode_handle(led); diff --git a/include/linux/phy.h b/include/linux/phy.h index 83d3ed7485e0..b1ac3c8a97e6 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1072,6 +1072,14 @@ struct phy_driver { */ int (*led_brightness_set)(struct phy_device *dev, u32 index, enum led_brightness value); + /* Activate hardware accelerated blink, delays are in milliseconds + * and if both are zero then a sensible default should be chosen. + * The call should adjust the timings in that case and if it can't + * match the values specified exactly. + */ + int (*led_blink_set)(struct phy_device *dev, u32 index, + unsigned long *delay_on, + unsigned long *delay_off); }; #define to_phy_driver(d) container_of(to_mdio_common_driver(d), \ struct phy_driver, mdiodrv) From patchwork Tue Mar 14 10:15:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 69712 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1851550wrd; Tue, 14 Mar 2023 09:19:36 -0700 (PDT) X-Google-Smtp-Source: AK7set8dGbPwa1LXJX5ahSF+smWe3qM5crvHFt6qaYeqi7qIFeUh7iauTsRKf499wdEePaewe95a X-Received: by 2002:a17:90b:3b90:b0:234:b35b:f905 with SMTP id pc16-20020a17090b3b9000b00234b35bf905mr40860363pjb.2.1678810776330; Tue, 14 Mar 2023 09:19:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678810776; cv=none; d=google.com; s=arc-20160816; b=sMQza2kCx4hvOJ2pIohFDzlPN5SOwTmuoAahk1Y/HfcCz8RQ346UfHXouZYdVFh0V0 ZPyUBaYIxADYvjK35kmE+AfptIkd9MSXZzFisXE0E++b2pHv5wbAMpFqhP6oN9DhCGBG 8aNMJECeJO7xKI4Bd0MTD0Vpl6PmaBl1HXUXuQPqDghm9REUZmWmfRlyBlATHF2aHBsg sBoxtorwIs4qj0YPlTEw1DeCxtusZxb+uD0dOqBj8XSF9/HtpgbXq5uPCd8jZjKyER2S F96ehURsyh4GbTu601kLtvdrInfNmH2VJ7QxtQvqR3QHDInam7Vs/ZiL1elsI4XmjI3c BxQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=mcPDqv1MH0gdrEhrxsDvDnbiYWzw+6vrk0oNxbr+mS0=; b=OQt4xpsym32DbEjS9XCRyFu6yTfnyRVuJBEDZaBWmujeFvTE+mwkDesFLGqW2KRbaG FTpralW1YQRVH1GJDZUss2ihsw/llA2P5vFZt/tVA1JoRzN9i04Nbd70SdmIMTZ9RwAG BTw9fk4aP06xOjJQIn+Nw4ExNmTE3mgVdqdos9/9qeHqzH7TGQhY1Rj1m5IcovDtP6Aw D0DZh5Lg1am0CHKz1HBWxDKnhgE+kNRCe9emr+NdGXp1G8ePVq9YRzUjur3RQwf1Y/nF NUrH2W3nIvpA2RmEniAuqU1qUqK+LkDNTNK5nYT8BQ1efMVxKL1k432h/5XcmpxdYdAH C2Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="D1e2CH/f"; 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 i19-20020a17090acf9300b002367f75aa40si2596529pju.150.2023.03.14.09.19.19; Tue, 14 Mar 2023 09:19:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="D1e2CH/f"; 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 S230416AbjCNQSz (ORCPT + 99 others); Tue, 14 Mar 2023 12:18:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231363AbjCNQSB (ORCPT ); Tue, 14 Mar 2023 12:18:01 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67D1DACE2C; Tue, 14 Mar 2023 09:17:36 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id y14so2211381wrq.4; Tue, 14 Mar 2023 09:17:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678810652; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=mcPDqv1MH0gdrEhrxsDvDnbiYWzw+6vrk0oNxbr+mS0=; b=D1e2CH/f1ZCpmavJDAsroXoWcjiMQI/0VbpSHMMGtGkrnOo8btyw5KwJE2cPL4Zmuq uWvdBMTtHTuKWN//E1vyNY0kAavHh07YZYE3PTG1HwtD00TKJ8AyRenztNeuZUKGL1/n xMblzmMl5564QkdZfwgkBJ1yS5yq8vTwSrLeHBCjs6pwOG5u2PGzjgDcDig4SAkW22b+ +xrB+VNRwUXiXko8a2vzKqWFCiD3zGN/A1zXHeeQ1uGPcuyXayjq/gWX8d88Dksf9PcM RUIvcmL4VAjczpWHkAQJnxPXZR+LYIUkLDwA6NAkjy9v3HP/c4uI2mGkcJe1SNuUt5gI V7JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678810652; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mcPDqv1MH0gdrEhrxsDvDnbiYWzw+6vrk0oNxbr+mS0=; b=AhU4TODBMM8WbBJ6jtFycQ0yqTUON83/m5gfG8foVcsqXUqKXD+YhBJ/xjjEulCVpC yIOTPIOs79o0WnmX/3YZY6upByh2ULnVmSr4DMZs5HxYEwooAIiQmii9VXWUoVcxslg+ vxMs29WoAZ1DC0aQZhzw8gUA/E4HG9jZuQ8mDDEmSWNcMfCQwO6hDmh8hbGemZA0w3Sl sfVVesnkZk5A6omQcFlbZbeO0h3UigVWiJ0xp62Y/ugRZc+mrZkG8cSrAbKnwbGntvuC eee1NjeHj2RCPvDI/2ogD9beQTPBalarUrL4+NaW4m8eZWyP+2dljNnH48d7j4RBOuI+ xqXg== X-Gm-Message-State: AO0yUKUD1Ma6h0rHB4lH87iH/3j/nujkTC1L8z2txID8x7XoDp1O2L8K V89LKmBT92GiD7iE+23VFeQ= X-Received: by 2002:adf:eb46:0:b0:2cf:e8f4:d1ea with SMTP id u6-20020adfeb46000000b002cfe8f4d1eamr2530041wrn.29.1678810652188; Tue, 14 Mar 2023 09:17:32 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id a16-20020a5d4570000000b002c5539171d1sm2426821wrc.41.2023.03.14.09.17.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 09:17: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 v3 08/14] net: phy: marvell: Implement led_blink_set() Date: Tue, 14 Mar 2023 11:15:10 +0100 Message-Id: <20230314101516.20427-9-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314101516.20427-1-ansuelsmth@gmail.com> References: <20230314101516.20427-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1760360688331230862?= X-GMAIL-MSGID: =?utf-8?q?1760360688331230862?= From: Andrew Lunn The Marvell PHY can blink the LEDs, simple on/off. All LEDs blink at the same rate, and the reset default is 84ms per blink, which is around 12Hz. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- drivers/net/phy/marvell.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index e44a4a26346a..3252b15266e2 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -147,6 +147,8 @@ #define MII_88E1318S_PHY_LED_FUNC 0x10 #define MII_88E1318S_PHY_LED_FUNC_OFF (0x8) #define MII_88E1318S_PHY_LED_FUNC_ON (0x9) +#define MII_88E1318S_PHY_LED_FUNC_HI_Z (0xa) +#define MII_88E1318S_PHY_LED_FUNC_BLINK (0xb) #define MII_88E1318S_PHY_LED_TCR 0x12 #define MII_88E1318S_PHY_LED_TCR_FORCE_INT BIT(15) #define MII_88E1318S_PHY_LED_TCR_INTn_ENABLE BIT(7) @@ -2862,6 +2864,35 @@ static int m88e1318_led_brightness_set(struct phy_device *phydev, MII_88E1318S_PHY_LED_FUNC, reg); } +static int m88e1318_led_blink_set(struct phy_device *phydev, u32 index, + unsigned long *delay_on, + unsigned long *delay_off) +{ + u16 reg; + + reg = phy_read_paged(phydev, MII_MARVELL_LED_PAGE, + MII_88E1318S_PHY_LED_FUNC); + if (reg < 0) + return reg; + + switch (index) { + case 0: + case 1: + case 2: + reg &= ~(0xf << (4 * index)); + reg |= MII_88E1318S_PHY_LED_FUNC_BLINK << (4 * index); + /* Reset default is 84ms */ + *delay_on = 84 / 2; + *delay_off = 84 / 2; + break; + default: + return -EINVAL; + } + + return phy_write_paged(phydev, MII_MARVELL_LED_PAGE, + MII_88E1318S_PHY_LED_FUNC, reg); +} + static int marvell_probe(struct phy_device *phydev) { struct marvell_priv *priv; @@ -3112,6 +3143,7 @@ static struct phy_driver marvell_drivers[] = { .get_strings = marvell_get_strings, .get_stats = marvell_get_stats, .led_brightness_set = m88e1318_led_brightness_set, + .led_blink_set = m88e1318_led_blink_set, }, { .phy_id = MARVELL_PHY_ID_88E1145, @@ -3219,6 +3251,7 @@ static struct phy_driver marvell_drivers[] = { .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, .cable_test_get_status = marvell_vct7_cable_test_get_status, .led_brightness_set = m88e1318_led_brightness_set, + .led_blink_set = m88e1318_led_blink_set, }, { .phy_id = MARVELL_PHY_ID_88E1540, @@ -3246,6 +3279,7 @@ static struct phy_driver marvell_drivers[] = { .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, .cable_test_get_status = marvell_vct7_cable_test_get_status, .led_brightness_set = m88e1318_led_brightness_set, + .led_blink_set = m88e1318_led_blink_set, }, { .phy_id = MARVELL_PHY_ID_88E1545, @@ -3273,6 +3307,7 @@ static struct phy_driver marvell_drivers[] = { .cable_test_tdr_start = marvell_vct5_cable_test_tdr_start, .cable_test_get_status = marvell_vct7_cable_test_get_status, .led_brightness_set = m88e1318_led_brightness_set, + .led_blink_set = m88e1318_led_blink_set, }, { .phy_id = MARVELL_PHY_ID_88E3016, @@ -3415,6 +3450,7 @@ static struct phy_driver marvell_drivers[] = { .get_tunable = m88e1540_get_tunable, .set_tunable = m88e1540_set_tunable, .led_brightness_set = m88e1318_led_brightness_set, + .led_blink_set = m88e1318_led_blink_set, }, }; From patchwork Tue Mar 14 10:15:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 69713 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1851593wrd; Tue, 14 Mar 2023 09:19:40 -0700 (PDT) X-Google-Smtp-Source: AK7set/kvGm6k7/5qKMHFhcn9dJoqDBN6cSwuMtUPn7/SxrKdtiHx4NFk7MWJjLyy42JralZYKtb X-Received: by 2002:aa7:9901:0:b0:624:9bdc:f255 with SMTP id z1-20020aa79901000000b006249bdcf255mr5929627pff.21.1678810780096; Tue, 14 Mar 2023 09:19:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678810780; cv=none; d=google.com; s=arc-20160816; b=Xl0FPndxUL+aCI/gCgK5lzrmPSf3htQmdMzpw5YNOL9ehs/z712iBktG5HpXAgbMt6 prxNJjO0EXHcxCFfTvMC4TQY2uvPZSiX7AJtEI5IRKwHn0eCNK/Ts7ozcwpvTYj5GBs/ FQt1pBn5ESfEE2+tarYuVnuwtPda24LDdpOfBtP/5rD0jHXZb+Iq+ovirPfH3fKIjVwd sEwoHaCGSMQy6Lw7yVJ960Sor6ZIuwhiO1YGaiZX4oNuGtZ3UO/AeDVvy64RSbY5GzxB hhQDCj50EkKqL/mJXkGEnwAHCAC26X3ru+iete06TgSxM2cBm0GxJl9tkYeGEra07fDR 0P7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=WgoBUd5mOfOzbUIgE9ennXfu8Bk6ZG8n46SEtwJM8yA=; b=UrHg14Kfq9KBi0OooUJEhFX7yRqSWX6W9rLRtOWtdiR9bzBnC5/9+ksXUaO8PInuwx qY8O2UXs/2T8fmVZmXX8vFKmtu8bIlEUL7SomDICYeKhbFHKx7SFnoZZ+yO6mgXDN8G3 jiZvBQrJq3wtvumsPsHhS4u7hNBZFFUHsJLvJllQHJjzonvw/WH2d2d6U096CbOE+TqF W4IGlqlmvWudyZHqiZ0bdfgZEFMD2MIousSsntUXsIRhxdINqWyrG3IWW7YQ2eQj28aP 6IME3PR4rgg6abhv8lB2VyPrnbe2/HLG2K121zGbUVaaSHFqrwGxulBWVSfkv0QZkoo4 2AeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bvY9Kqcv; 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 u126-20020a627984000000b0061d8ab6228esi2597042pfc.87.2023.03.14.09.19.25; Tue, 14 Mar 2023 09:19: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=bvY9Kqcv; 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 S230482AbjCNQS5 (ORCPT + 99 others); Tue, 14 Mar 2023 12:18:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231397AbjCNQSB (ORCPT ); Tue, 14 Mar 2023 12:18:01 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDFCE9E305; Tue, 14 Mar 2023 09:17:36 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id x22so5274196wmj.3; Tue, 14 Mar 2023 09:17:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678810653; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=WgoBUd5mOfOzbUIgE9ennXfu8Bk6ZG8n46SEtwJM8yA=; b=bvY9KqcvkaLOBhSxbT82TpGiQgMgFeH7RsFtKi/a76dLxp0RM6C8/TigvQ6sDKAf9N neKgFywXoTNG/g9CistYrBxx4R/Zr3A5oJzinni2SudO/jr5h1dW3smkV1e8ytswgaxq ObDxc5dd5iGSwLfixP73ykkJ5tmh42hyzyqByhIDGkuTflAchuOB16E4BhqFW0vTD3TK GChwtkCvEzXq195/ICDuToGgMSZ2ndsALlbGIMPcjQ1txoaHQroaVUJK8zUqM6XKYoq6 YXL/gofueztsS4TRYeIEfgoyKytKQ0zCPsWW+zd/BBL5T/zwVjPBiD6z+0Wex9wPU1r0 CXvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678810653; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WgoBUd5mOfOzbUIgE9ennXfu8Bk6ZG8n46SEtwJM8yA=; b=38dLEEGuDlKUoOde/QErm1xItr5oVDizc8gVbLZtZpSgPdl2KMkwzB/+cw/Woa6MjI RnYR0LwR0otRK0LoxdlZ9b7IdTcbGPBsFFpI9AH7hVJCorRn9XPxoKZMPj4nuW9zOgF0 nv24JpG/PD3MPiiubAsnl2Of9uqxFfDknFVv6mHRsiaBzhdRa6/0fTmRyGU9L7fZ0Y+H UE3o+qdIOYj+6CQQIv5R8biq12ytvw6AWUxgZczBY750PUpcUWT01V/3Kn00Up7DwnXR ds/8f9maJ9NymGe27ADmMz+l2V0kFqqiEuILxJIq5cHzN8w/27mqvDZbqw/JUL9ftra+ g96g== X-Gm-Message-State: AO0yUKVdvx9dtz3tNYhgmoRNpwfq7N01PBlKv1lxsUSAmh4QQKq3wVKE JNYaIz+3VVpb3SbT8mYRg3o= X-Received: by 2002:a05:600c:4448:b0:3dc:1687:9ba2 with SMTP id v8-20020a05600c444800b003dc16879ba2mr14666001wmn.35.1678810653583; Tue, 14 Mar 2023 09:17: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 a16-20020a5d4570000000b002c5539171d1sm2426821wrc.41.2023.03.14.09.17.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 09:17:33 -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 v3 09/14] dt-bindings: net: dsa: dsa-port: Document support for LEDs node Date: Tue, 14 Mar 2023 11:15:11 +0100 Message-Id: <20230314101516.20427-10-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314101516.20427-1-ansuelsmth@gmail.com> References: <20230314101516.20427-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1760360692360946613?= X-GMAIL-MSGID: =?utf-8?q?1760360692360946613?= Document support for LEDs node in dsa port. Switch may support different LEDs that can be configured for different operation like blinking on traffic event or port link. Also add some Documentation to describe the difference of these nodes compared to PHY LEDs, since dsa-port LEDs are controllable by the switch regs and the possible intergated PHY doesn't have control on them. Signed-off-by: Christian Marangi --- .../devicetree/bindings/net/dsa/dsa-port.yaml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml index 480120469953..1bf4151e5155 100644 --- a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml +++ b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml @@ -59,6 +59,27 @@ properties: - rtl8_4t - seville + leds: + type: object + description: + Describes the LEDs associated by the Switch Port and controllable + in its MACs. These LEDs are not integrated in the PHY and PHY + doesn't have any control on them. Switch regs are used to control + these Switch Port LEDs. + + properties: + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + patternProperties: + '^led(@[a-f0-9]+)?$': + $ref: /schemas/leds/common.yaml# + + additionalProperties: false + # CPU and DSA ports must have phylink-compatible link descriptions if: oneOf: From patchwork Tue Mar 14 10:15: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: 69725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1859687wrd; Tue, 14 Mar 2023 09:35:24 -0700 (PDT) X-Google-Smtp-Source: AK7set8e3xmWzdLczUb0XPOIr6kQL149dvoEx6ZRIHKrYRBF/nkn6xG99iqovoTIxibRccQ4qYfa X-Received: by 2002:a17:90b:4b0c:b0:234:656d:235a with SMTP id lx12-20020a17090b4b0c00b00234656d235amr39070500pjb.43.1678811724418; Tue, 14 Mar 2023 09:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678811724; cv=none; d=google.com; s=arc-20160816; b=d1exwE3e5subr/63PgUdMG4W5oSI6uNXoQVdy9i2MprApaKOxDrP30a6WwdV2TMK7n 6pWInPGdg0F6yyO98guUDA7yKLRwTP6lfyBPAWcnSP39kVeXz41UDV65xvS2YxfHSQK2 lDjGY3NOIfmFLaPtbn/oNC4rNmN2eBjS8ZMumLleR3zle/1wYM3Xkxu2C0htpxu5GJjK JPWaqX0/6FCEj6Zl51qhQe8wcA5hz75/hNSSGBxp6wwIothlGbXw1kyd7U9nS0WBNjhP DXxih7FUgdtRvgVy1It+P5WjwWLR8lHHpQ2e08g7KKMdUWli2Js0UZQfnk+UH9TKxKUo SjHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=1wDcE5BTiRUWu5IpXdTXJGaa7mTD/67d24QZlEDxG4g=; b=d5oAhHdxYYUjnBRaKf7V9+gE1zPfF3ky1VxoKFjRDVIAtxRh39fgRDDsNk6DEhwWyI HiRIfmi7CQh9RkOyCsOC08Ic1+wXP600JPtX5IzppTLnLpv6zWh4y60zGN9/tQj9e2YT fAOu/DSMxP5PosrG3zRjIOHjb8faMUIWIrMr8ZsD8MZfe4COPXCmWZPANHmhi0nlTlol TzrDnFWa9OL6/fmuaEPULiDJ1rSgyn0lJeVp59osh9MC6ixqM0+8k83MjsRwHP7u10Nf eaSWLoLvdvyaASV96R/Y+D+94CMm00JcRLc3aKWsp+mvBmwhqFNVxub2fekJz/ZwMlix sE7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="LXKopah/"; 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 d4-20020a17090ae28400b00233ebd4c537si2759499pjz.22.2023.03.14.09.35.11; Tue, 14 Mar 2023 09: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="LXKopah/"; 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 S231765AbjCNQTN (ORCPT + 99 others); Tue, 14 Mar 2023 12:19:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231387AbjCNQSB (ORCPT ); Tue, 14 Mar 2023 12:18:01 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADE55ACE31; Tue, 14 Mar 2023 09:17:36 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id p4so8688761wre.11; Tue, 14 Mar 2023 09:17:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678810655; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=1wDcE5BTiRUWu5IpXdTXJGaa7mTD/67d24QZlEDxG4g=; b=LXKopah/Gf7/RWEpDVCAEg8KcTcd/6vUHT+j9K7zjvuJS+Y9V0VXs1Yxc9wKcMHXhl BB0LiPIIgVlqUSBjIL8gsZaGh9lm9NORfeuUUB48dyeMkKTa+ifpo4dJ/+9WioT99ggG j8z/UWwqq3qfzU527ACMJc0lnEV86RZ8dFj5OUMlB9dOYbfabxeOEFw+9nRRgD8JcP7p 0ME5PcOjMgas2KKv5AibDhC5iNYdMiTOn21Wjv6/iT+Uq08yJioWr7ZUVET+uCRCAtxE n/ItvWDM09v82MtQGaeTRVXC9PPPMSoJHd/JZEC/5TaMrKVcx4qDrNqagNIeXQqb8ckm amSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678810655; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1wDcE5BTiRUWu5IpXdTXJGaa7mTD/67d24QZlEDxG4g=; b=W0Qxs+K5omDfFZkqj5ZKx2kE0R96IZ4HezOi9j1nR+lHcS5HnxbhzFiNSD3Drg8xoh uwGoaS36Q4qXl/HvMRPZHpQ7oADnqD4+N0RNID3vAPto5zntePmdF9kYlVDIvLTIL1Iu 1HY2dsWIAflswlnibwtST209a5YDSqZI0oh6ibI+Y8FDBNeR7ot8q0eUphLm1xTo+I6Y 5HV/gqLpndpmkCVPFXemXmICBSHt5cgxBibFATJWi+KVwJdVqmQQ9E4vGcxVnBMzGylI XwA0P+URvmMynNWd2VZuxxFHSpC0XcMg8uTPzouI+OZs3WWupITrpbU0LwJoAfq7tqcm yVRQ== X-Gm-Message-State: AO0yUKWcLZCzrgQerVML1tDk5tGUIzOW3Psom1kk9CY521+Mx4RbNnWs ClxPOz95/gHXkVvQD33lAsg= X-Received: by 2002:a5d:530d:0:b0:2c5:510b:8f9c with SMTP id e13-20020a5d530d000000b002c5510b8f9cmr25423697wrv.52.1678810654984; Tue, 14 Mar 2023 09:17: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 a16-20020a5d4570000000b002c5539171d1sm2426821wrc.41.2023.03.14.09.17.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 09:17: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 Subject: [net-next PATCH v3 10/14] dt-bindings: net: dsa: qca8k: add LEDs definition example Date: Tue, 14 Mar 2023 11:15:12 +0100 Message-Id: <20230314101516.20427-11-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314101516.20427-1-ansuelsmth@gmail.com> References: <20230314101516.20427-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1760361682992653993?= X-GMAIL-MSGID: =?utf-8?q?1760361682992653993?= Add LEDs definition example for qca8k Switch Family to describe how they should be defined for a correct usage. Signed-off-by: Christian Marangi --- .../devicetree/bindings/net/dsa/qca8k.yaml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml index 389892592aac..866b3cc73216 100644 --- a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml +++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml @@ -18,6 +18,8 @@ description: PHY it is connected to. In this config, an internal mdio-bus is registered and the MDIO master is used for communication. Mixed external and internal mdio-bus configurations are not supported by the hardware. + Each phy have at least 3 LEDs connected and can be declared + using the standard LEDs structure. properties: compatible: @@ -117,6 +119,7 @@ unevaluatedProperties: false examples: - | #include + #include mdio { #address-cells = <1>; @@ -226,6 +229,27 @@ examples: label = "lan1"; phy-mode = "internal"; phy-handle = <&internal_phy_port1>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + default-state = "keep"; + }; + + led@1 { + reg = <1>; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + default-state = "keep"; + }; + }; }; port@2 { From patchwork Tue Mar 14 10:15: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: 69731 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1864735wrd; Tue, 14 Mar 2023 09:45:40 -0700 (PDT) X-Google-Smtp-Source: AK7set8l8mJTLQFoqJGVaR7fbctAL/qh5g1BWUKp+kmwfsXCl7e+8Eu5SC3LhZ+mKmGXDP+onJAs X-Received: by 2002:a17:903:283:b0:19f:2ae8:54b9 with SMTP id j3-20020a170903028300b0019f2ae854b9mr13579213plr.32.1678812339894; Tue, 14 Mar 2023 09:45:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678812339; cv=none; d=google.com; s=arc-20160816; b=CBWT2W6Yi2/WQKQI5FuV4+BwRfGVBHjBgE/4FOLQOzsVDHiX/0JY2qHbGQiaG2RUHx 0ot9eoFfnv2Qddq3OH3BcavM+Khoi8HolM9WstZM+VOjJuRNq6t7+Tk2SECQSsqR85oJ mnLif6sVU2zpKJXNu1erXsny6b93Mn0Z3Fk6H3LfAK4/sRC33PWR3dQo4r0iD3Qm8h7H qOfAEqy5h+OYNYoKAlTaPaW6tDO0N+sVkPSh3rzjiJbcFCNzxirk99bE/TR/nElO+KTz bkaUqLvj0+rHko2Xa+KUSK7IC5iYxFQFiIEigZOzDO+XEYnHfy0nBPXNb1Qji8pDGd+W sl7A== 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=rZ+n/NFTR7Byn2d9u9MYOApUV3r6MUMqRVm8Cc9NreDxhb9X7EXpFCsKkO6vETqH2A frmhsCuuX8OcYgx5R8BOuMcn1RQFd5gPP0vhQNUF9YMx/jhi9OhB3JCCGCDF/xb/LsTX DYCNj09e3qRdKud0bQoeq624elyTtNRNXRKujodptaVPzv1Ir7zonZwCLhAscONzKHQo wYp6lU8FCFjT6lkDc//cbIn8TGYPKnoosvbkoFsOhrvzqBIcI57kBO+WkHGpaAuJB6z8 iPit9QjveUVgOu6t/+FgkZuk2xXWEvxbSUgWTBSEE1wo5J0SdB/VqzdQOhaHZMPiEN4y C9FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fERp4iru; 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 jh4-20020a170903328400b0019f3c86271dsi2766052plb.561.2023.03.14.09.45.22; Tue, 14 Mar 2023 09:45: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=fERp4iru; 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 S230229AbjCNQTK (ORCPT + 99 others); Tue, 14 Mar 2023 12:19:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230505AbjCNQSC (ORCPT ); Tue, 14 Mar 2023 12:18:02 -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 5849BB0495; Tue, 14 Mar 2023 09:17:38 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id t15so14876016wrz.7; Tue, 14 Mar 2023 09:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678810656; 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=fERp4iruASNfxlqoL+2/uJaSk630G6zW0nonVIurn4lJbM7HvCO2FPDN8Ob+V1CMFx NFHbly9IqL8GUDuao2aY9Y3pEa11UIUNIVNWjKApIxBpmJDeola6BChjVoR4iBBrvm+h 3wnajXUD3V0UTaaK680PyCyMGERWSJhZ27ubjRMPiDvGBpzZu0Q3xempGHjP3C/Nkih9 k85bXltxGU8vURynM8WR5tAPLj2BSbi6qQJ3ZErR5YfxfTdBLG6zR6c3DTEjgNep6wkH PRiFDvmjqkDa2F2a8zbatHBaIChk/fx5cxfUcWEaEtymZJuiIDsSznlzQUE7JnzyytNt uxXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678810656; 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=GGNG/tbhNuUz6srqe77d9nCCI03g8hp1OQGF/ZyLB6VysxAI9scYhNM9ov87aXZA1h rLeTjQ4k33r1pMGHY3esZO5p17uxBvyN2IVsw38w/uStySdo6P06RlIKBpH3e6MhOtwl rUS2Q/ZIQ9ODKNAcH6f3xqULUKLsNjnKDh9iyPhVY8KVWO6407MXjsZHI+mZJc7daAw9 XFHcJOgYyClCudoSU5stb61Nz5ZSiqy3HYXTTw5Wg05xgE6ZgKnV9sQd8joNFGQUCPQX Teb4GHjh7RnSLlux4nSJziwa09kT108uErZ0WE/DSMoGwmcyAk0NZUDv7bJ6lpK03/8m E4ng== X-Gm-Message-State: AO0yUKXwfvTPiHJjMAC8q70p0wDkexpfNyVYpky4CfQt+0ZlIQ5aOadF qUR5mjSGIJRAbLqXlE4a/vk= X-Received: by 2002:a5d:6641:0:b0:2ce:a825:e0a1 with SMTP id f1-20020a5d6641000000b002cea825e0a1mr6915000wrw.14.1678810656579; Tue, 14 Mar 2023 09:17:36 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id a16-20020a5d4570000000b002c5539171d1sm2426821wrc.41.2023.03.14.09.17.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 09:17: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 Cc: Jonathan McDowell Subject: [net-next PATCH v3 11/14] arm: qcom: dt: Drop unevaluated properties in switch nodes for rb3011 Date: Tue, 14 Mar 2023 11:15:13 +0100 Message-Id: <20230314101516.20427-12-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314101516.20427-1-ansuelsmth@gmail.com> References: <20230314101516.20427-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1760362327951137740?= X-GMAIL-MSGID: =?utf-8?q?1760362327951137740?= 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 Tue Mar 14 10:15: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: 69714 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1851840wrd; Tue, 14 Mar 2023 09:20:08 -0700 (PDT) X-Google-Smtp-Source: AK7set+3mcSZFZ2hgfoVa9yd4OFYhPEU5n531K663xF6w0/YgJL7f69fTHEf1I46MZINZS87LocR X-Received: by 2002:a05:6a20:4c97:b0:d4:58b3:80e4 with SMTP id fq23-20020a056a204c9700b000d458b380e4mr5576776pzb.32.1678810808589; Tue, 14 Mar 2023 09:20:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678810808; cv=none; d=google.com; s=arc-20160816; b=ece6ETEimYSIxoMAO1u0lnShr/hifvTUraHhhnDy13PZSUnawRSiXEZyGRha4JXq6X uV26xxIEB5mAXm3LI733u9Uxp8dQ1T+POGg+9ydbmdkFBe30XE8W/bGQkE3I5vI1xsdV TBsLpWCMT7JwFcnQWCsndFpoHl5qSjLtKjjT5YvT1hzt3UKgAYsLZUPX8bgZsTYzn9r7 tF2WffIkiRkxVSknoABWf3SkR0NtWJ10pHqs5IzvPI+8iQChwp/qWXrBW1VQkMic50Li uk4hgLIBLTmDvo1F0MVqMB1y9Qtnyvqa/vsTTWNnjWo++qko5HkN4RsSkhR69DZzrj9G ivrA== 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=s0s94C+LVb+OGN47BtusvNxJgLlfTm1TaflA+Hk8KCI5tINqHKL34svCs+U0K3uvsG umb3eLNl3tEBCib1VQC6F9mmENrvvx3pbs8hq1fM9b81sJNfd5LObFHEYNOu9kLGgXwr bCiBpKWL3J6fiEcrGaB1CMUcRiETuKzmVXFgpvvbtk5j9U6qDjK9d1QveH6ql81EJVT9 EFOY1FdS5fQ5qLigH1XUvJEC6fqmT+EuZAChh2JvrWdhsdnBZqCeCB+p3RpfdyZWg7uA Z/zDURezIt+u+MbnrNlgs8Oyq/mxvCQDhQYk/CDzpEehBVoD6UC2gSMX4VihCAKdJoKq +few== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=K+mLMUl0; 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 g18-20020a633752000000b00508da300f1csi2540303pgn.18.2023.03.14.09.19.45; Tue, 14 Mar 2023 09:20:08 -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=K+mLMUl0; 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 S231722AbjCNQTB (ORCPT + 99 others); Tue, 14 Mar 2023 12:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231448AbjCNQSE (ORCPT ); Tue, 14 Mar 2023 12:18:04 -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 B33C4B2555; Tue, 14 Mar 2023 09:17:39 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id t15so14876087wrz.7; Tue, 14 Mar 2023 09:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678810658; 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=K+mLMUl0yoH5CirM02UvggJLlSVXwFmixzghnFZQfwQxlZ4QvmI7bl9d/svg/6pmMp aDULurfPwfxvXNqYpSlDfCQjFrO0nnzvnXcEDbw0SOX+3zQY1iHLYhUiaGhWhe234DEs Md5SPcTHRbnoBNCKsDwEjWmDRiMppyPqKNGCllPkhUe2SPOgOu5GUBulS+qQ0SBiMuI3 H2d8Y0bvzw4rBcWkaZBNxzGrkjXJTqui1j6xiG2AxvupTtdTE5v3+D9fzMoJvPwAhSCo Kkcf//mL9Lyc+oKVhfhrrc0YoNC5tqKFb8wNaz0XJYH4IE+LKXLfJWdTduA2rgY3V4hD a/Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678810658; 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=STOUgshWYrfSzQAT6iCjef7OIntOY+QQaBkik/PlsM65Jq6einqG/IEd8YGLk6B/7N Gcgq+WdnhZo06UZ6I0VsQ8i57lOrmsk5jFyyDGrJ9p7dnOF91wPqVV0aKQhug8LqK/i8 c+eEjdCR+sl7aizt1je17szzlgWApZ6n2a/jRPqDaIW62YvYynZy9oPFlIlcTaueTako PIIugcWoQdCPsNi37FGzlHZEFkdHN8UUNkcY8OkDwz8LZro/OTNSgmfUJVWXokpKEC2W Rcn8IJFhw9Hp9rKnSg2LyGrSKhEWz0GVRUKez9wFkUdAq7tbSAzQ600XE8oxZonxwmmv 2S/g== X-Gm-Message-State: AO0yUKV5lNSOeGl4rR1/cwVb2hMOCDcI/42kigaMv6eNtr9Zmom2wI7M gtihjQEKpqQaMy4BlkxM61M= X-Received: by 2002:a05:6000:12c9:b0:2cc:4dad:e484 with SMTP id l9-20020a05600012c900b002cc4dade484mr24744498wrx.42.1678810658079; Tue, 14 Mar 2023 09:17: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 a16-20020a5d4570000000b002c5539171d1sm2426821wrc.41.2023.03.14.09.17.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 09:17:37 -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 v3 12/14] arm: qcom: dt: Add Switch LED for each port for rb3011 Date: Tue, 14 Mar 2023 11:15:14 +0100 Message-Id: <20230314101516.20427-13-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314101516.20427-1-ansuelsmth@gmail.com> References: <20230314101516.20427-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1760360722650391885?= X-GMAIL-MSGID: =?utf-8?q?1760360722650391885?= 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 Tue Mar 14 10:15: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: 69719 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1857786wrd; Tue, 14 Mar 2023 09:31:52 -0700 (PDT) X-Google-Smtp-Source: AK7set/EobpQ5CgO4o7xGUL/uZr5zmBu9hk5rjkwCiTHQdzZEdMhyBA0FzJz1TzVsxwtD5Sj8Yqn X-Received: by 2002:a05:6a20:258a:b0:cc:d514:62cf with SMTP id k10-20020a056a20258a00b000ccd51462cfmr37552420pzd.43.1678811512126; Tue, 14 Mar 2023 09:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678811512; cv=none; d=google.com; s=arc-20160816; b=tQ/tnV6Uj6i40mWDOhKEH7Sym0laiURvaoRXFNmIf+8W8r68ll1kVjBq370zkxz1Cf R9BOvk6XticmUA+F6DhAvoRTdFjTt8cLJIs7VwzsRC61o9Rss6V4c/mgJQm+26osxD3n TPZi1fZAf8ROsfnXOiF+rAvFIRfxwIXqbtbjQyqTe4vYomVX+DDo2xvHtp6eQNqSOGH+ tFbhO2CT8V1mkR1vmDBINSEwyKOwvhDJPXsPrPJrK/X6BTG9p2LpgDMtu12WHLObMBKg 4i9pB/Nous2lQPGPjLwejyDDH2WWiI2F5Eju2ijYTEtjFZ2Wq3UrJho8WQD2C5lh81fK Xghw== 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=izO38nwMQsM5QFjWBbgheRmtzv1ZXz8rEYC4bAS9FVxGPknQ/1dLaiWUVGKlwCYvkH T0wzPC0y9iFSZH09gEPK25ICBxT7Uc2PHSd8e22DBcD2bwFUhPTY+rz81DWchMtxNpYT 7ecBBuTakALfcRX+IBMNR/dpiRmjHmPpnJYy8Ct6fU9+lpucfrf5AsQAq4sA5Sws4+du VJ48qdOJwIFYSVNVSTsrTi+U2YtfuhfcR+cC9PgdhCS+X2CCnongxO0hMy3dn4uRSSzQ p3msfGWiUyfqw40LFvoMR5++HKjxwFBE0J2X281m/tzTRfDEnQJ55FRdI6tVoFWpe+Zx I/jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JpZqQwUT; 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 j11-20020a634a4b000000b005091ced8a0csi2399125pgl.775.2023.03.14.09.31.16; Tue, 14 Mar 2023 09:31: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=JpZqQwUT; 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 S231437AbjCNQTH (ORCPT + 99 others); Tue, 14 Mar 2023 12:19:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231474AbjCNQSF (ORCPT ); Tue, 14 Mar 2023 12:18:05 -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 78674AD02C; Tue, 14 Mar 2023 09:17:41 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id r18so14896217wrx.1; Tue, 14 Mar 2023 09:17:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678810660; 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=JpZqQwUTPJ6+0dPKdp8pkWBnmAkBQRmDmeBLG1R5hScuNBgurXqhg6f9CS9tJM6dcf dbtEHCmoY7084ytJfNPyb3VNFwrqwO8JGzbzZVkaVTU+5K0KIL2W2KZi4oJhWaOKXyTV nysBTo0B5Nniouc6/cdENQyg7XmeF5tHrfiwcNmr2D3HoskORuAVYQFSHAlYqpxD0I1A mj1in4u/WLib6EWCjAjDkn/8WDPuTpggfA4YwQcGWCmrckfVXvh+oNp4fTzTfRO8AgLP pTG5CRyGfZLAKACSx6iWnn8/UPyofP5yWu5Qt+h2bYJbwQb48UqqDwF5tuZH155Yr/Qg 8VBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678810660; 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=bHRBI0F+RBpzpZE82La0CNfqVBX22arAPE9thCx74GLnwH5MfYz2fzyFC8zQF14hEz ZbmGBQHMSybaelZQFtxKA0Pe4WNz6bNyU9AFAdQqisMPdJf3VZjxApk0CoWb0ZauOopK REf2c5sYRANOFHP0XzMhvpfrqa2PJYl2uOKtw6hcDDJEpKDSqkmhXH0jBUjLL5lbOODt irW7m7cD5snsM8+2W3QHG+PIWooDp5A7TT27JxcseKrGUh2snsGk70LhIPVPk7P29640 asNTMBiP2bVtb66zMNq54vsCPLD3u8UbYFMREkBu1Sk6VVljM6lSEU0cPsL7nWd1Javi tZDw== X-Gm-Message-State: AO0yUKVHKr7+VYoG2GVKQkQ5qRX4p13Azn1U8IHJhFi7E5Hy8vOsS7NO BBZJeozOHUUVrtWvzIhy45A= X-Received: by 2002:a5d:48cb:0:b0:2cf:ea5d:f607 with SMTP id p11-20020a5d48cb000000b002cfea5df607mr1917592wrs.17.1678810659677; Tue, 14 Mar 2023 09:17:39 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id a16-20020a5d4570000000b002c5539171d1sm2426821wrc.41.2023.03.14.09.17.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 09:17:39 -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 v3 13/14] dt-bindings: net: phy: Document support for LEDs node Date: Tue, 14 Mar 2023 11:15:15 +0100 Message-Id: <20230314101516.20427-14-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314101516.20427-1-ansuelsmth@gmail.com> References: <20230314101516.20427-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1760361460214414907?= X-GMAIL-MSGID: =?utf-8?q?1760361460214414907?= 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 Tue Mar 14 10:15: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: 69715 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1852095wrd; Tue, 14 Mar 2023 09:20:35 -0700 (PDT) X-Google-Smtp-Source: AK7set+WLXh45XJt/av/NCc11u4UyIwzCmjkeq2v7JdlqSLgjJdCL/wU9l54w54qO647I6R5s359 X-Received: by 2002:a17:902:c40f:b0:19a:96ea:3850 with SMTP id k15-20020a170902c40f00b0019a96ea3850mr14735646plk.17.1678810835059; Tue, 14 Mar 2023 09:20:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678810835; cv=none; d=google.com; s=arc-20160816; b=Pzm+PKDSW3wgIjrR4gtox6WWL49mPaqp6ZuVP2md+SA/jpe66WxwlWg4aPxJgMaclT WKQENnLcHZP4+9ym8xLLT7S5WzfmkZeaUeZdH4bYJIK74AIDRnCBislGL6F7qPD+GSCz i4fZbWInoOgQeWq2Ew0MFLbkn/OonLndESjMZbYXLJxw1BwLA06zXRunJYlufYgeEUG8 fI/d4vF03wQj7kUoOK1MknpOpKi4q+NA6FuFoiKSROm+jb7SZhNPVj2AXKJ8lPYGoed6 SA1g0Pb4a3HbCMy1Yrjfzt8cKyRRZVWBXNAtGyhlv8TXaUq541wqCOHPmglXG+0Phrbi EgrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=hKTAoz/5c2gh8Y+1xcGszVL+VPGe5qIqtDhWxElzHg8=; b=BFrLm4yPpbPEvOMW6p3LXX5dSDK5AcsUIIJ1M+Uw5O77FzhL5DTU5VzZklit9DNR5W BhnsSTcQMe9yL/FYSbzzKQTu1JW9HhPktDeYXBDlgyrqebG5OH6MiNdcK2gtiM3CRouE /SMDzGL0TdjejATGHGQ6JLNFNbIKFyJg5RsMjbR7EhxWwKrTFxFX+cxRbEYYnnCAOdRc BfYsveOiLVfecTapoGxWULipCpqoVkbnyayOhjevb3WeBgWsXqbj+smdHBXTjpZbLQ9d mp8oeQwPiJLPUpW60ilnqoL09gMKJ2uxkyvHsg+MGh6tEDO0qLAS6q8nnh+AcdkEPzQU /grw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=A5QGX8g9; 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 c10-20020a170902724a00b0019ac0f52ad1si2749578pll.586.2023.03.14.09.20.01; Tue, 14 Mar 2023 09:20:35 -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=A5QGX8g9; 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 S230475AbjCNQTF (ORCPT + 99 others); Tue, 14 Mar 2023 12:19:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231162AbjCNQST (ORCPT ); Tue, 14 Mar 2023 12:18:19 -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 DC0ECB371D; Tue, 14 Mar 2023 09:17:42 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id r29so6855425wra.13; Tue, 14 Mar 2023 09:17:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678810661; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=hKTAoz/5c2gh8Y+1xcGszVL+VPGe5qIqtDhWxElzHg8=; b=A5QGX8g9qQHcZkkrcXMDsdj7A9cZmBMtVmbBwkVTk60r6OctUe5QoRW20dNyop4WVQ YtLS0ZcqTYuR1ABV7ZpJH3/Pdm8IgAfWdFzB/usawxLOF8dtCK0vHHBtjcdDQS1H+NnJ LO/6QnazNKOsKlnOcMIp4O/P23DYUaV6Dk43savUOfuwIcmoRffjGEhxlhgr6hqmT0DQ czXSPywGk5chD6etCr6asQ3uoITHJZo0Dv5mqdkE4eJgp4Y7n1kTInqlr2Ppisek9jAY MNxO3rHz/oqxF7VPoeL0iWi//D5S49ti4Vewd7XA3Xq24ivCGCT6gTnczzNmYiv/ToCo GW5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678810661; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hKTAoz/5c2gh8Y+1xcGszVL+VPGe5qIqtDhWxElzHg8=; b=ixn7F8YHpGDw0ZZWG0i2NlZ014c4rrlI8YOlaY3Ctndw6TFHkIQY1HxJo7FAUWvUpA Sp1NVmCJ1TcsRVTUyIbJ/oXZ5R6WyXsYtf9x6lz/bccKY552CO/z2AStNAXR4PYKyS0A JEBxDQTxpToX5/4XTf1GKFXz8/k43oKHDuDy/MNsawCIZVQH8UvncO6k+abkjWoavAib VRQhJvFP/Ig0ZCeJ8Wb9VnhC8xNSyKNNTMpwfwAyYuW9SP/mMAWgEXiu8eIWU0bgwP9Z TsorZCjjafKlRXaCiXJsAYDkXq7a3uhdSmWlo8pddDjYE82d1no/cJPOU4PqLfBLrH8H fGsg== X-Gm-Message-State: AO0yUKWTuAwIvF5Q3nUxUtcxuJ0yXuTbkK5uwVZdK6WEOQ4ALQtJDlWm Et5ezd1XTDw2OH8yPHcxLKs= X-Received: by 2002:adf:fe49:0:b0:2cf:e645:aa60 with SMTP id m9-20020adffe49000000b002cfe645aa60mr3923843wrs.19.1678810661174; Tue, 14 Mar 2023 09:17:41 -0700 (PDT) Received: from localhost.localdomain (93-34-89-197.ip49.fastwebnet.it. [93.34.89.197]) by smtp.googlemail.com with ESMTPSA id a16-20020a5d4570000000b002c5539171d1sm2426821wrc.41.2023.03.14.09.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 09:17:40 -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 v3 14/14] arm: mvebu: dt: Add PHY LED support for 370-rd WAN port Date: Tue, 14 Mar 2023 11:15:16 +0100 Message-Id: <20230314101516.20427-15-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314101516.20427-1-ansuelsmth@gmail.com> References: <20230314101516.20427-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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?1760360750117224034?= X-GMAIL-MSGID: =?utf-8?q?1760360750117224034?= From: Andrew Lunn The WAN port of the 370-RD has a Marvell PHY, with one LED on the front panel. List this LED in the device tree. Set the LED default state to "keep" to not change any blink rule set by default. Signed-off-by: Andrew Lunn Signed-off-by: Christian Marangi --- arch/arm/boot/dts/armada-370-rd.dts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm/boot/dts/armada-370-rd.dts b/arch/arm/boot/dts/armada-370-rd.dts index be005c9f42ef..ccd4699b219f 100644 --- a/arch/arm/boot/dts/armada-370-rd.dts +++ b/arch/arm/boot/dts/armada-370-rd.dts @@ -20,6 +20,7 @@ /dts-v1/; #include #include +#include #include #include "armada-370.dtsi" @@ -135,6 +136,19 @@ &mdio { pinctrl-names = "default"; phy0: ethernet-phy@0 { reg = <0>; + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + label = "WAN"; + color = ; + function = LED_FUNCTION_LAN; + function-enumerator = <1>; + default-state = "keep"; + }; + }; }; switch: switch@10 {