mbox series

[v3,0/3] pinctrl: tegra: Add Tegra234 pinmux driver

Message ID 20230530133654.1296480-1-thierry.reding@gmail.com
Headers show
Series pinctrl: tegra: Add Tegra234 pinmux driver | expand

Message

Thierry Reding May 30, 2023, 1:36 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

Hi,

this is an updated version of Prathamesh's v2 of the series, which can
be found here:

	https://patchwork.ozlabs.org/project/linux-tegra/list/?series=345256

The most prominent change is the split of the device tree bindings into
multiple files to make them more readable, as agreed upon with Krzysztof
during review.

Changes in v3:
- split up device tree bindings into multiple files for better
  readability
- do not permit underscore in pinmux node names
- use correct #address-cells and #size-cells for DT nodes
- fixup a typo in the gpio-ranges property name

Note that the driver patch applies on top of the function table fix that
I sent out earlier:

	http://patchwork.ozlabs.org/project/linux-tegra/list/?series=357206

Once accepted, patches 1 and 2 can go through the pinctrl tree and I can
pick up patch 3 into the Tegra tree. Alternatively I can also pick up
patch 1 into the Tegra tree to help with validation. We're not quite at
a point yet where the Tegra DTs fully validate, so it doesn't matter
much which way these get applied.

Thanks,
Thierry

Prathamesh Shete (3):
  dt-bindings: pinctrl: Document Tegra234 pin controllers
  pinctrl: tegra: Add Tegra234 pinmux driver
  arm64: tegra: Add Tegra234 pin controllers

 .../pinctrl/nvidia,tegra234-pinmux-aon.yaml   |   61 +
 .../nvidia,tegra234-pinmux-common.yaml        |   65 +
 .../pinctrl/nvidia,tegra234-pinmux.yaml       |  141 ++
 arch/arm64/boot/dts/nvidia/tegra234.dtsi      |   12 +
 drivers/pinctrl/tegra/Kconfig                 |    4 +
 drivers/pinctrl/tegra/Makefile                |    1 +
 drivers/pinctrl/tegra/pinctrl-tegra234.c      | 1969 +++++++++++++++++
 drivers/soc/tegra/Kconfig                     |    1 +
 8 files changed, 2254 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux-aon.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux-common.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux.yaml
 create mode 100644 drivers/pinctrl/tegra/pinctrl-tegra234.c

Comments

Andy Shevchenko June 2, 2023, 1:30 a.m. UTC | #1
Tue, May 30, 2023 at 03:36:53PM +0200, Thierry Reding kirjoitti:
> From: Prathamesh Shete <pshete@nvidia.com>
> 
> This change adds support for the two pin controllers found on Tegra234.

...

> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Pinctrl data for the NVIDIA Tegra234 pinmux
> + *
> + * Copyright (c) 2021-2023, NVIDIA CORPORATION.  All rights reserved.

> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.

The whole SPDX idea is to avoid including this duplication. Is this a
requirement of your company lawers?

> + */
> +
> +#include <linux/module.h>

Missing mod_devicetable.h

> +#include <linux/of.h>
> +#include <linux/of_device.h>

Do you need both for just of_device_get_match_data() call? Note, you may
replace it with device_get_match_data() and property.h and be completely
OF independent.

> +#include <linux/platform_device.h>
> +#include <linux/pinctrl/pinctrl.h>
> +#include <linux/pinctrl/pinmux.h>
> +#include "pinctrl-tegra.h"

...

> +#define PINGROUP(pg_name, f0, f1, f2, f3, r, bank, pupd, e_io_hv, e_lpbk, e_input, e_lpdr, e_pbias_buf,	\
> +			gpio_sfio_sel, schmitt_b)							\
> +	{								\
> +		.name = #pg_name,					\
> +		.pins = pg_name##_pins,					\
> +		.npins = ARRAY_SIZE(pg_name##_pins),			\

Can we use struct pingroup, please?

> +			.funcs = {					\
> +				TEGRA_MUX_##f0,				\
> +				TEGRA_MUX_##f1,				\
> +				TEGRA_MUX_##f2,				\
> +				TEGRA_MUX_##f3,				\
> +			},						\
> +		PIN_PINGROUP_ENTRY_Y(r, bank, pupd, e_io_hv, e_lpbk,	\
> +					e_input, e_lpdr, e_pbias_buf,	\
> +					gpio_sfio_sel, schmitt_b)	\
> +		drive_##pg_name,					\
> +	}

> +static int tegra234_pinctrl_probe(struct platform_device *pdev)
> +{
> +	const struct tegra_pinctrl_soc_data *soc = of_device_get_match_data(&pdev->dev);
> +
> +	return tegra_pinctrl_probe(pdev, soc);
> +}
> +
> +static const struct of_device_id tegra234_pinctrl_of_match[] = {
> +	{ .compatible = "nvidia,tegra234-pinmux", .data = &tegra234_pinctrl},
> +	{ .compatible = "nvidia,tegra234-pinmux-aon", .data = &tegra234_pinctrl_aon },
> +	{ },

No comma for the terminator entry.

> +};

...

> +static struct platform_driver tegra234_pinctrl_driver = {
> +	.driver = {
> +		.name = "tegra234-pinctrl",

> +		.owner = THIS_MODULE,

Approx. 15 years this is _not_ needed.

> +		.of_match_table = tegra234_pinctrl_of_match,
> +	},
> +	.probe = tegra234_pinctrl_probe,
> +};