From patchwork Fri Jul 16 22:17:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 478518 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDAC0C12002 for ; Fri, 16 Jul 2021 22:17:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A6B6F613F1 for ; Fri, 16 Jul 2021 22:17:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236973AbhGPWUq (ORCPT ); Fri, 16 Jul 2021 18:20:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233454AbhGPWUq (ORCPT ); Fri, 16 Jul 2021 18:20:46 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E84D1C061760 for ; Fri, 16 Jul 2021 15:17:50 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id k27so14855328edk.9 for ; Fri, 16 Jul 2021 15:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura-hr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0zmnEwB1TtIKAG1YOLLif2erRI6Bwj7HWT6BiJYO/Mc=; b=gsLeM8r98ER7oZNdNs58cF9sKrIM//L7j2huZvBHLeRAdDT/qSs/jhl0hWL0Umt3eT G+HWJ4fhLmT/rRPQg6PuEhs4kyDBZRkmcRrlXpRhWqBQqV9PN3s0wDU7A3kXw5X7DOkB 37XE5Sc2vrK6UR8oEn7/tiPMWmYureHYJcdfVbtgRebCABh3U3AUZ7pAEl8gpzG52zNA RgGZ66fCaCwntvjcT6ETMY+fshyEbW07xuxpu5OdffTfM4ikIrvP2I8Luy322YbSDxJb hKnDJpKQJOb5bazSbTI8DCXzoRHtrpMf6vJqpZOSvLJG4W1DvmSXt1PkMDILDGWG3svA /29g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0zmnEwB1TtIKAG1YOLLif2erRI6Bwj7HWT6BiJYO/Mc=; b=oDvpfLKhq7P/UfbsSs0snc2h+5ns10h7K5GYN4qYLzeSNjA1y1hRN5iE2okx0tuLgB i5DEXUSkNLPcbbXOyxNQ+N28MChMBVsk6EdQCyz0IqW139EDyJf/7jBw7nbt7THzSPxG 02Xt/Zn9grojeVOtwBNyEDMQrw0+l19g+KAmTQemT0cAnvmS4yEDJB+DQX4NQNvfKrtu irh/PU11UHzvMXJuneC125ofvzjgIXt3rB3cL/9c0sh4uT/knAOpCJotKXSsAX8IMIsB FwOV02neYzlyX/ff051HocNrLUEBlg9BCYG+kgeatVESDU4YQGlWdZHxjM60upUejKNG Aarg== X-Gm-Message-State: AOAM533sr3zSLDDyFj6utUny3TbzHuc7bMBFJxEApXNxcGLTIwt8b66a YcPlhzEC9lpt4rjcV7JJqx3+ag== X-Google-Smtp-Source: ABdhPJz9jrPDOrGYB1Okan8upTdnPr+gsyBRyAaMiC1g7PU6vJsVBLk/JFGbErB4MBKjBJceTbz9DA== X-Received: by 2002:aa7:d809:: with SMTP id v9mr17822433edq.146.1626473869562; Fri, 16 Jul 2021 15:17:49 -0700 (PDT) Received: from localhost.localdomain (dh207-98-239.xnet.hr. [88.207.98.239]) by smtp.googlemail.com with ESMTPSA id f22sm4242634edr.16.2021.07.16.15.17.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jul 2021 15:17:49 -0700 (PDT) From: Robert Marko To: linus.walleij@linaro.org, bgolaszewski@baylibre.com, robh+dt@kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: luka.perkov@sartura.hr, Robert Marko Subject: [PATCH 1/2] gpio: tn48m: Add support for Delta TN4810M CPLD Date: Sat, 17 Jul 2021 00:17:43 +0200 Message-Id: <20210716221744.5445-1-robert.marko@sartura.hr> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Delta TN4810M uses a similar CPLD GPIO expander like the TN48M, but it has pins for 48 SFP+ ports, making a total of 192 pins. It also provides the TX fault pins which the TN48M does not. Only TX disable pins like on the TN48M are output ones. Thankfully, regmap GPIO allows for the driver to be easily extended to support the TN4810M. Note that this patch depends on the following series: https://patchwork.ozlabs.org/project/linux-gpio/list/?series=247538 Signed-off-by: Robert Marko --- drivers/gpio/gpio-tn48m.c | 56 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-tn48m.c b/drivers/gpio/gpio-tn48m.c index b12a6b4bc4b3..e429e7ade941 100644 --- a/drivers/gpio/gpio-tn48m.c +++ b/drivers/gpio/gpio-tn48m.c @@ -19,6 +19,10 @@ enum tn48m_gpio_type { TN48M_SFP_TX_DISABLE = 1, TN48M_SFP_PRESENT, TN48M_SFP_LOS, + TN4810M_SFP_TX_DISABLE, + TN4810M_SFP_TX_FAULT, + TN4810M_SFP_PRESENT, + TN4810M_SFP_LOS, }; static int tn48m_gpio_probe(struct platform_device *pdev) @@ -46,17 +50,36 @@ static int tn48m_gpio_probe(struct platform_device *pdev) config.regmap = regmap; config.parent = &pdev->dev; - config.ngpio = 4; + config.ngpio_per_reg = 8; switch (type) { case TN48M_SFP_TX_DISABLE: config.reg_set_base = base; + config.ngpio = 4; break; case TN48M_SFP_PRESENT: config.reg_dat_base = base; + config.ngpio = 4; break; case TN48M_SFP_LOS: config.reg_dat_base = base; + config.ngpio = 4; + break; + case TN4810M_SFP_TX_DISABLE: + config.reg_set_base = base; + config.ngpio = 48; + break; + case TN4810M_SFP_TX_FAULT: + config.reg_dat_base = base; + config.ngpio = 48; + break; + case TN4810M_SFP_PRESENT: + config.reg_dat_base = base; + config.ngpio = 48; + break; + case TN4810M_SFP_LOS: + config.reg_dat_base = base; + config.ngpio = 48; break; default: dev_err(&pdev->dev, "unknown type %d\n", type); @@ -67,9 +90,34 @@ static int tn48m_gpio_probe(struct platform_device *pdev) } static const struct of_device_id tn48m_gpio_of_match[] = { - { .compatible = "delta,tn48m-gpio-sfp-tx-disable", .data = (void *)TN48M_SFP_TX_DISABLE }, - { .compatible = "delta,tn48m-gpio-sfp-present", .data = (void *)TN48M_SFP_PRESENT }, - { .compatible = "delta,tn48m-gpio-sfp-los", .data = (void *)TN48M_SFP_LOS }, + { + .compatible = "delta,tn48m-gpio-sfp-tx-disable", + .data = (void *)TN48M_SFP_TX_DISABLE + }, + { + .compatible = "delta,tn48m-gpio-sfp-present", + .data = (void *)TN48M_SFP_PRESENT + }, + { + .compatible = "delta,tn48m-gpio-sfp-los", + .data = (void *)TN48M_SFP_LOS + }, + { + .compatible = "delta,tn4810m-gpio-sfp-tx-disable", + .data = (void *)TN4810M_SFP_TX_DISABLE + }, + { + .compatible = "delta,tn4810m-gpio-sfp-tx-fault", + .data = (void *)TN4810M_SFP_TX_FAULT + }, + { + .compatible = "delta,tn4810m-gpio-sfp-present", + .data = (void *)TN4810M_SFP_PRESENT + }, + { + .compatible = "delta,tn4810m-gpio-sfp-los", + .data = (void *)TN4810M_SFP_LOS + }, { } }; MODULE_DEVICE_TABLE(of, tn48m_gpio_of_match); From patchwork Fri Jul 16 22:17:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 479380 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0552C12002 for ; Fri, 16 Jul 2021 22:17:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B6C7A613DF for ; Fri, 16 Jul 2021 22:17:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237618AbhGPWUu (ORCPT ); Fri, 16 Jul 2021 18:20:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237577AbhGPWUs (ORCPT ); Fri, 16 Jul 2021 18:20:48 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E0A7C06175F for ; Fri, 16 Jul 2021 15:17:52 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id l1so14807739edr.11 for ; Fri, 16 Jul 2021 15:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura-hr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dm6ejJdRZDZlW/WyYTU8xmsjcdEmtRJOpLiC3zeIiIw=; b=FAy2r80ZKuhx/oEbG8GQJGgjsdA8xD4521tzi//j53N2HFzgcbewEq8378tlfULuG2 /Y1SNhkg5i073oRr2H74aFCMMQ7eQQvDUV5gvNTcKnEXIu11sOrF7I8Fhzns3bIDXBac 565WxfqItqBoKO7rbPhkuKo+SVs64e0OFIiA/hP+xAmIiO5ucPO1wdMzJNVUYzyk8mnP 3QdFSOWQqK2zRL0Pru4kNRA7hSvg1qKa3E8GqrsO47RF/qxqXGO3dPPjX/jUMExJBaO3 l+mO0cFCoTU0awv2klx6QHFdq2QbgfKoZ+OQmWvia4f+6GllYatuqsVJGBcf18L6KPsW Q7GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dm6ejJdRZDZlW/WyYTU8xmsjcdEmtRJOpLiC3zeIiIw=; b=o+FqGIMvBY3lSitHBftcITsqDSvplaUzstCAbbdbYy5/uD0P9w3OPaT79su+5eMBoh tGNVv7ftVsy+CwJc6jP62Bnrm7jt0xqIIh9lhkp83tL6FFjYEsxjm5wl2k6eSNWREqt/ uGpYJMCEmZbm2eLaDu+kBmOj7xFSKjQcEoV3dYgmywRSobselLep0K/XnZt8E4+GPVwx pqNiJmh/kmKH8GTxi4uMKGPSo0h+rggyYZHW3Tmq7NQRYgzCOM6bHsTinErifTOHjjce RHs+nWe0hsFdAQiB12UprbLKyzGoUDKScbS/S6uSoS7RpYbU4DjhmUEuwNGIdedBsfRV 2MLA== X-Gm-Message-State: AOAM530ksP9xQGCg6i1sDHFthC0Vd8+4u/vo9y5PmOq+0/Iqp8B1JpUl aTBl7REB/Eoi37AjCJW/OsEHbg== X-Google-Smtp-Source: ABdhPJwpH0+MNHgerJ9Bnms1z6WdDO8V2eqxQq+GOk5dbXtaTHI9VcRbfawAfJ3Po/FR8jnTVJmm4w== X-Received: by 2002:aa7:d991:: with SMTP id u17mr17380344eds.240.1626473871216; Fri, 16 Jul 2021 15:17:51 -0700 (PDT) Received: from localhost.localdomain (dh207-98-239.xnet.hr. [88.207.98.239]) by smtp.googlemail.com with ESMTPSA id f22sm4242634edr.16.2021.07.16.15.17.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jul 2021 15:17:50 -0700 (PDT) From: Robert Marko To: linus.walleij@linaro.org, bgolaszewski@baylibre.com, robh+dt@kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: luka.perkov@sartura.hr, Robert Marko Subject: [PATCH 2/2] dt-bindings: gpio: tn48m: document TN4810M support Date: Sat, 17 Jul 2021 00:17:44 +0200 Message-Id: <20210716221744.5445-2-robert.marko@sartura.hr> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210716221744.5445-1-robert.marko@sartura.hr> References: <20210716221744.5445-1-robert.marko@sartura.hr> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Delta TN4810M expands the existing TN48M drivers, so lets document the new compatibles. Note that this patch depends on the following series: https://patchwork.ozlabs.org/project/linux-gpio/list/?series=247538 Signed-off-by: Robert Marko --- Documentation/devicetree/bindings/gpio/delta,tn48m-gpio.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/gpio/delta,tn48m-gpio.yaml b/Documentation/devicetree/bindings/gpio/delta,tn48m-gpio.yaml index aca646aecb12..d729c5dbed65 100644 --- a/Documentation/devicetree/bindings/gpio/delta,tn48m-gpio.yaml +++ b/Documentation/devicetree/bindings/gpio/delta,tn48m-gpio.yaml @@ -24,6 +24,10 @@ properties: - delta,tn48m-gpio-sfp-tx-disable - delta,tn48m-gpio-sfp-present - delta,tn48m-gpio-sfp-los + - delta,tn4810m-gpio-sfp-tx-disable + - delta,tn4810m-gpio-sfp-tx-fault + - delta,tn4810m-gpio-sfp-present + - delta,tn4810m-gpio-sfp-los reg: maxItems: 1