From patchwork Wed Jul 12 02:22:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 702535 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F41BEB64DC for ; Wed, 12 Jul 2023 02:23:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231124AbjGLCXK (ORCPT ); Tue, 11 Jul 2023 22:23:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbjGLCXJ (ORCPT ); Tue, 11 Jul 2023 22:23:09 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2120.outbound.protection.outlook.com [40.107.92.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B2D41720; Tue, 11 Jul 2023 19:23:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CsWpMlaO5plu57w7jR30RYb3iACWfYbWPmgFluZiv9M32Ip1hd8C+12eMxTkXtd6B/hep2CzGWHz29zJaJRPK8s9esQT5x/Y65HKxc1ma0Frb4O7+uCJwi4QmxlcfB7lvlBBuKyBk9x/FCNbwqd3rnhpYgxnohR+jENdYJo2hH/463OyvkRVjqBeWvQIFHZmdz7N6/OwBmpZgeFjcTnwzTvJLtSPAc+5gfr+FNUF1WgfZ6osAoAcivfBPHVXLgf1D5iog3UiEUzLXZLha+LZ/EYL17yfNNLhagkYpvO3PpLY3ENzMz0/njEMp4b/M2/SLk1chBufZbUJmNhHtygJCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aJXLNnetxioz9ii+SRrNEjBV5Cl9Pju8/4sl76cdMvE=; b=R9C+knr29vY7msbPGCXQZtGppZEeR1LVsjv71LpAUoG/RnwiTzXeRVi04JLogXbg4OETJzNxrXJ1Mlgf1ck4E+lGTGd4fKwl3+jsQK+hYN5fcF4GQsseZ4ZWlN2GrBUEFxku8Bw86vjSfpHEdunyH0htEBrd6PGdwR41QGiUnkZEjy915pnIRD5nPja4kJzLWWJlQ34nlL4i9XJwoZwFI20irMWPPnyP6cz/TdduUhcgdV0qX+MPJ9I4Yo/PxB5LXUGRjBDInxc6AcKRDZVW02wAEg/ETodG68XXNIwCwd89yC0fGCNtYrcUoy4EltQYuy1N8nDPi+BZEBxdnMLcYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aJXLNnetxioz9ii+SRrNEjBV5Cl9Pju8/4sl76cdMvE=; b=XT4WMkoYJLYLnoC/TgJu/Xs8j+VcMpQGm6ONuMNjeJa69C1MyUOAj97Pqd9XGjCWbyYT4NI8pHp2zCOEynpvJfsIbOi/7+kpzUx4qMIVFgIYQNyydxEj63Xk9iaAJ5/mN36AwdP/mrD4Jk48MAHV3aF4/+fq41DClCCn1dq805k= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by MN6PR10MB7467.namprd10.prod.outlook.com (2603:10b6:208:47f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Wed, 12 Jul 2023 02:23:03 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::f575:8f7d:c91:5078]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::f575:8f7d:c91:5078%6]) with mapi id 15.20.6565.026; Wed, 12 Jul 2023 02:23:02 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org Cc: Linus Walleij , UNGLinuxDriver@microchip.com, Daniel Machon , Steen Hegelund , Lars Povlsen , Christian Marangi , Andrew Lunn , Florian Fainelli , Vladimir Oltean Subject: [RFC RESEND v1 pinctrl-next 0/1] add blink and activity functions to SGPIO Date: Tue, 11 Jul 2023 19:22:49 -0700 Message-Id: <20230712022250.2319557-1-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: BY5PR16CA0034.namprd16.prod.outlook.com (2603:10b6:a03:1a0::47) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2351:EE_|MN6PR10MB7467:EE_ X-MS-Office365-Filtering-Correlation-Id: 06888a2c-e1be-45ad-c900-08db827eea73 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4SV9poL5eZlKygxUUX7A/PSIjBNckimP+GL8XSktI5M6yvNQ6i0Qz7lToUAJsLvUOpX5g6tfqWpTPIIrdJ1gIFeupu6fHrwwznsGxcx1JLsBbaDnnPfe36Zf5+Zmzk+0mC59hN2jq1WezlJeq5L2R5HnOP+/0IxLDG2NJEEC4xLvdfbD7nPk1TjVzptQ//8Lz/XL2FzvwXwJIrZ1EWrLSU8OnU+6ObmilWSbP0wGfwkJLWU9pDGxRqV6jjMf4sLNiVIU0zqO+i4McziN1At7vcE8xT5MLFTj7ucIzvCCyYvwKFQ8vRtb57ELDrsydxsMPBIsT6QUe410q4Sw2gOvC7clEeZSQFf9X3Sd2S/rk9R930/HxEJs92geakFGMRX8EXeVXkMRq7p6YjX1NeqbOf3Wx+4lUh3RHY/QZligwb6eWbHwPdGMt+iJJCtgYXq5e3sHwB8/2yZXvS1itYwAqQxyCSj8yBA15wO0yhERN9nRnAx2czP34JF0wlvGWdbEmtOOdBCyjOLleOrzR94UQbSSq/kTcIAppb6pGAQwKii+1jjifKhP2PINNA4KijMWTxyrR0cPffxXKuQCzjkLnw9ycF3vNFhGgkdVbORjQ/DKD8Xi/ydQv+iDuRRlNMQx X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2351.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(136003)(396003)(366004)(39840400004)(346002)(376002)(451199021)(38350700002)(54906003)(6666004)(6486002)(66899021)(52116002)(478600001)(7416002)(8936002)(36756003)(5660300002)(2906002)(86362001)(8676002)(44832011)(4326008)(316002)(66476007)(66556008)(66946007)(38100700002)(41300700001)(26005)(186003)(6506007)(1076003)(2616005)(83380400001)(6512007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IA4tsEegAVuWR0RWBoQp7GkQAoQcmhM6ODJdFQHPGypr93ftfGJTgVA1h/YGrHpSzDDGcLbavVIieS6a50Y1z07PG7Y0xVX2a1y9xMLU+ZXedBChVL+UaO9ujDmUjS2uM3TXaT4xLH14SPqRAqVKNRs3Pa3djLk0riuCDeYPJCH/SHngpDCJNN6fhNDyQr+FZX/KzKytHxd624uswUOorx4B++VYullfnnr0xGfu22diXMDrzi3HvS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qtWuHDwo8RvVLp9ngI2/D0b4zOp6lZs+KY2xcByYxJiaj7obLYsB/jJgFZU64WRngfWUYjRwXgiba7phChG3hlzU9TRL/RTI5cnw02tX1fTliBlmm9JYI09RKEyxQQS2kIP+sd8jtk0JZW8LpjAZVqaBe5tFh1IrZmqMWnLN7Yyd3IlewHyoEtZZd3fx9YBH+a2joJ8LCipXuUlSMELrjrtY5CEdPKnX9b1PKXb4WHVfTa6Ml0RF4ykgCbnPRyn8Ae2dPsUt3ZhguMQ/WfcUwKBHBT7n1X6gLwmg3BRQ== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06888a2c-e1be-45ad-c900-08db827eea73 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2023 02:23:01.6177 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +s5TA4wcAUIw9Y6qjKtyLQ1E4/PEDDdmCNS2p9lR472M5AYEc5+DPvAYjtJjnVBctMwFuJmhPfPVAHSt8A0YYelwWpTfv+3elFn4OYU3Tkk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR10MB7467 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Preface (new for resend): This is a resend of a patch I'd sent a couple years back. At that time, I was told to wait for hardware-offloaded LEDS. It looks like that time has finally come, so I've changed this from PATCH down to an RFC to make sure this is the right approach for the framework. Ocelot chips (VSC7511, VSC7512, VSC7513, VSC7514) have support for hardware-offloaded LEDs based on network activity. This is currenty managed by way of pinctrl-microchip-sgpio (and this current patch). The purpose of this resend is two-fold. First, to come up with an idea of how this pinctrl-microchip-sgpio module can fit in with the new hardware-offloaded netdev triggers Christian Marangi recently added. Is this something that should be in the pinctrl module itself? Or should there be a drivers/net/ethernet/mscc/ocelot_leds.c module that I should add? The second reason is maybe there's someone out there who might also be considering implementing this. This might be a good starting point if someone is eager to get coding. On my priority list, this is quite low so I'll get to it eventually, but maybe not even in this dev cycle. That's why I'm including the original patch. Any suggestions on how to approach this problem are welcome. (You can probably stop reading here) Original Header: Expose a debugfs / devicetree interface for Microsemi SGPIO controllers. By writing values of 2-5, the SGPIO pins can be configured for either automatic blinking or activity. The implementation is modeled after the code in /drivers/pinctrl/pinctrl-ocelot.c. I have only tested this with currently out-of-tree patches for the VSC7512 that I hope to get in soon. They are not needed for VSC7513 / VSC7514, SPARX5, or LUTON - but I don't have any hardware to test. Of note: the 7512 chip has a discrepancy between the datasheet and the registers. The datahseet claims 20Hz blink default frequency, the registers claim 5 Hz default frequency for BMODE_0. I override the OCELOT registers to correct for this. I don't know if that is needed for LUTON or SPARX, but having two blink modes at the same frequency isn't beneficial. As such, I make the blink modes match the 5Hz / 20Hz for the two modes. Tested with VSC7512 by way of: echo SGPIO_O_p1b0 {blink0,blink1,activity0,activity1} > /sys/kernel/debug/pinctrl/pinctrl-sgpio-pinctrl-sgpio-output/pinmux-select LEDs blink! Colin Foster (1): pinctrl: microchip-sgpio: add activity and blink functionality drivers/pinctrl/pinctrl-microchip-sgpio.c | 135 +++++++++++++++++++++- 1 file changed, 130 insertions(+), 5 deletions(-)