linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
To: Robert Marko <robert.marko@sartura.hr>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	linux-gpio <linux-gpio@vger.kernel.org>,
	linux-devicetree <devicetree@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	luka.perkov@sartura.hr
Subject: Re: [PATCH 1/2] gpio: tn48m: Add support for Delta TN4810M CPLD
Date: Mon, 2 Aug 2021 14:10:36 +0200	[thread overview]
Message-ID: <CAMpxmJXy1L-OC7k+h6pOwFGNS8WntNSMjP1Kvu7tnCQvGNwnRw@mail.gmail.com> (raw)
In-Reply-To: <20210716221744.5445-1-robert.marko@sartura.hr>

On Sat, Jul 17, 2021 at 12:17 AM Robert Marko <robert.marko@sartura.hr> wrote:
>
> 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 <robert.marko@sartura.hr>
> ---
>  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);
> --
> 2.31.1
>

This looks good to me. I suppose the other patches are going in
through the MFD tree. I don't see anything that can fail here at
build-time - can you confirm that I can pick these patches up
separately for v5.15?

Bartosz

  parent reply	other threads:[~2021-08-02 12:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16 22:17 Robert Marko
2021-07-16 22:17 ` [PATCH 2/2] dt-bindings: gpio: tn48m: document TN4810M support Robert Marko
2021-09-22 10:16   ` Bartosz Golaszewski
2021-09-22 10:24     ` Robert Marko
2021-08-02 12:10 ` Bartosz Golaszewski [this message]
2021-08-02 12:12   ` [PATCH 1/2] gpio: tn48m: Add support for Delta TN4810M CPLD Bartosz Golaszewski
2021-08-03 19:24     ` Robert Marko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMpxmJXy1L-OC7k+h6pOwFGNS8WntNSMjP1Kvu7tnCQvGNwnRw@mail.gmail.com \
    --to=bgolaszewski@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luka.perkov@sartura.hr \
    --cc=robert.marko@sartura.hr \
    --cc=robh+dt@kernel.org \
    --subject='Re: [PATCH 1/2] gpio: tn48m: Add support for Delta TN4810M CPLD' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).