Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp450825rdh; Thu, 23 Nov 2023 08:14:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHiWAcoO6JF4I5W2i1LvJUjLstEWlyyFKn9Q/OAzVSvxns4SbkrQsXHT/T0Td3gcOUm09vP X-Received: by 2002:a05:6808:13cc:b0:3ae:501e:a645 with SMTP id d12-20020a05680813cc00b003ae501ea645mr7132184oiw.50.1700756046990; Thu, 23 Nov 2023 08:14:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700756046; cv=none; d=google.com; s=arc-20160816; b=tSY0Wckfq6DEd5I0dBbel0oFtShgIrXpBms9cN30qNZ8yhAJeK8D4sfG8wU4bNrx9V /VGiRgiYUADI2KR4SFMK1/o6YpY9PFXY/T757qE+w+PmPCN+5cRiUUfSy8k8VubaHy3s 1l68EgiNxJmSLfdeEtylk7DvVI7H3uyCkVeTXEpOfRsZPm86paXjvd3pYz5GrFokJ81r Hz5n2f+tBMWy5Eb5cAhxKlfFLgCdTS+roa5YD7vBPTXr+xMnWAdQJzg1LsFhHlrbOmwN +PYVqlp3lF40vewCv50ghnCaYI6jYJNFHaG8bhlrmT+33n8rNM6GbEeBdhklYf7M+QbB +6AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dBjA4zTKyiFFHKGNIIV3o3WzlHqH9tPy3OMPPVwLuyA=; fh=ya+F2hAcyt4InIOyb9db5AWgH4mneOyZtP7moKYl6QM=; b=Q3UfeuLPK0m08fH1CAR7cPXjxNinF93+BXnRggT+M0+4vVHrxw1OIbSBTUHbCtf6a3 2ItckSsXtKNlgDQ4hR/uhk+mC6sK8NcS7i5xxf+6nqcrbLd9ijnkcc25K6T7W5mz17G0 fSCIueU8cT8ObEuFrzpKXvGO9CAGXNLe8wQDW6vnDx55QqrB2QdhLytk2kM5pSn3Aws1 cC6M2KW/vy8yfn7SKURzAzObweFliBru1yD9Lx1hoscK/JZhDXyRDhLFkg2MUaDovT1l p4kjcXDTG3aVGzvJspCxdKkmhVA68n7/izzKDmQq7w7AUlqcJU1H2j2IyGpduls9xnQx tEOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=5UBcdMKG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id y32-20020a631820000000b00578b487825asi1556369pgl.208.2023.11.23.08.14.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 08:14:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=5UBcdMKG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B00E081D7707; Thu, 23 Nov 2023 08:14:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229731AbjKWQNz (ORCPT + 99 others); Thu, 23 Nov 2023 11:13:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbjKWQNy (ORCPT ); Thu, 23 Nov 2023 11:13:54 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAE3FD64; Thu, 23 Nov 2023 08:14:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=dBjA4zTKyiFFHKGNIIV3o3WzlHqH9tPy3OMPPVwLuyA=; b=5UBcdMKG8/sm7BB+rID1GoAq/v PdbwNGBEJZ8P2rz/ThE5OTIgzsp1/1tKnk8W8x1X6kX+/uyI41fXQZ4tS0Wvfks+mXgkSQ+lk/8EJ aTyLG4AfP7Cqkdxi4AvuQVWFkhqnWAbCkD+6Oc0/ec3aBP5n8wNn8gzLfM6Jlep4g1a0=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1r6CKs-0010hr-Qn; Thu, 23 Nov 2023 17:13:50 +0100 Date: Thu, 23 Nov 2023 17:13:50 +0100 From: Andrew Lunn To: Linus Walleij Cc: Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Christian Marangi , Tim Harvey , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH RFC] net: dsa: mv88e6xxx: Support LED control Message-ID: References: <20231123-mv88e6xxx-leds-v1-1-3c379b3d23fb@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231123-mv88e6xxx-leds-v1-1-3c379b3d23fb@linaro.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 23 Nov 2023 08:14:05 -0800 (PST) > This DT config is not yet configuring everything: the netdev > default trigger is assigned by the hw acceleration callbacks are > not called, and there is no way to set the netdev sub-trigger > type from the device tree, such as if you want a gigabit link > indicator. This has to be done from userspace at this point. Yes, part of this is a known problem, and somewhere i have some code i was working on to fix some of these issues. What i would really like to see happen is that the DSA core handles the registration of the LEDs, similar to how phylib does. The DT binding should be identical for all DSA devices, so there is no need for each driver to do its own parsing. There are some WIP patches at https://github.com/lunn/linux.git leds-offload-support-reduced-auto-netdev which implement this. Feel free to make use of them. > +/* The following is a lookup table to check what rules we can support on a > + * certain LED given restrictions such as that some rules only work with fiber > + * (SFP) connections and some blink on activity by default. > + */ > +#define MV88E6XXX_PORTS_0_3 (BIT(0)|BIT(1)|BIT(2)|BIT(3)) > +#define MV88E6XXX_PORTS_4_5 (BIT(4)|BIT(5)) > +#define MV88E6XXX_PORT_4 BIT(4) > +#define MV88E6XXX_PORT_5 BIT(5) > + > +/* Entries are listed in selector order */ > +static const struct mv88e6xxx_led_hwconfig mv88e6xxx_led_hwconfigs[] = { You need to be careful with naming. These are probably specific to the 6352. Different switches probably have different capabilities. So it would be good to have the names reflect the switch family they are valid for. When we come to add support for other switch families, i wounder how tables like this scale. Is there some things which can be shared, if we break the table up? I need to check the data sheets. Andrew