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: 479418 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 668D6C636CA for ; Fri, 16 Jul 2021 22:17:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 44A0E61183 for ; Fri, 16 Jul 2021 22:17:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237493AbhGPWUr (ORCPT ); Fri, 16 Jul 2021 18:20:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233454AbhGPWUr (ORCPT ); Fri, 16 Jul 2021 18:20:47 -0400 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9F4CC061762 for ; Fri, 16 Jul 2021 15:17:50 -0700 (PDT) Received: by mail-ed1-x544.google.com with SMTP id l26so14828287eda.10 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=LMdqp2g3hSFW4QdK5W4NFFFRneVJw6pqUWpjg+owe7b5xI2F+0yPhAtQO9oWP4tUn2 8xb/kTf8ZRDZBIBH8MGN7HjEASE4O86+dc9UKp5ibHz8QwfNV9scD7ykzkZrgu3kQsje ZcCXj5evjs3xs2b1QFZEvkCODoRkRmf9tQXojMBGKhPplNeP66h6sco7LyzPbUGV6zuw GwA1I4My12vKYoYClc5J6j1ACt8Fkxl6da+gieqrGoWOOF3BVDzKgNyadA3uwBW/M0TF GnQkJRq/UULAXoEqTqT5BfU0uRCYmKyzSdvQAupPfZohh+LEjNd49nkAP4bu/sFem7Wq EPSA== X-Gm-Message-State: AOAM530ZLt8lp6g/KfvmCa97YcJthUzObTHmBS+NNnYB87+50rloQxQe LHPElHef8emFVokO8BvEMji4bg== 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: linux-gpio@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: 478605 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 32E20C636CB 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 1843961400 for ; Fri, 16 Jul 2021 22:17:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237481AbhGPWUt (ORCPT ); Fri, 16 Jul 2021 18:20:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237546AbhGPWUs (ORCPT ); Fri, 16 Jul 2021 18:20:48 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EDB7C061762 for ; Fri, 16 Jul 2021 15:17:52 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id l26so14828352eda.10 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=WbpXsZ0DOr8hU3mtMT4ymc6v7f8EOnV6CMs7Fj+YVgs/f5mtz/NhVY+8pFpiEb+0zi vlTjAQDPJUs/47x/OwxuRfAP+5u4Qu+71e4Ig2AQKOLCSI+EDfrNPik/QBJSPbCS9eGM UOgblsG0kOlVgARBq9F7esW205CQ1lQJLQrKtFP4jZGyfmC9p8g7jS6ElKCLivMHfziY uG1YxYeSjfOkVjEiH97lZFoFKYd1r+axlUn9WuOlM3Fibn+GcfERB7KmvnJ/1jmlCofD UywgcTf5eDx7p1ONDnnumv0jwvJHDII3wkASxnHxvkyb6DH3BNwxW6AglRgebW4vv9Ki ACQw== X-Gm-Message-State: AOAM5306YyAQrnEKmFeaZaASvrbS8SK3vKWdc4YEfv14UR6245OWFDqa FvyNu7HZx82j1LZig4C/csi4OZhEFmqK/vZGzqA= 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: linux-gpio@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