Re: [PATCH 2/6] dt-bindings: gpio: Add Delta TN48M CPLD GPIO bindings

From: Rob Herring
Date: Thu May 06 2021 - 09:57:10 EST


On Fri, Apr 30, 2021 at 02:35:07PM +0200, Robert Marko wrote:
> CPLD inside of the Delta TN48M does not number GPIOs
> at all, so in order to ensure numbering lets use bindigs.

Looking at the code, I'd make the gpio number something like '(offset <<
8) | bit' rather than just making up an index.

We don't normally have defines for GPIO numbers either.

>
> Signed-off-by: Robert Marko <robert.marko@xxxxxxxxxx>
> ---
> include/dt-bindings/gpio/tn48m-gpio.h | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
> create mode 100644 include/dt-bindings/gpio/tn48m-gpio.h
>
> diff --git a/include/dt-bindings/gpio/tn48m-gpio.h b/include/dt-bindings/gpio/tn48m-gpio.h
> new file mode 100644
> index 000000000000..4ece4826d746
> --- /dev/null
> +++ b/include/dt-bindings/gpio/tn48m-gpio.h
> @@ -0,0 +1,26 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * GPIO definitions for Delta TN48M CPLD GPIO driver
> + *
> + * Copyright 2020 Sartura Ltd
> + *
> + * Author: Robert Marko <robert.marko@xxxxxxxxxx>
> + */
> +
> +#ifndef _DT_BINDINGS_TN48M_GPIO_H
> +#define _DT_BINDINGS_TN48M_GPIO_H
> +
> +#define SFP_TX_DISABLE_52 0
> +#define SFP_TX_DISABLE_51 1
> +#define SFP_TX_DISABLE_50 2
> +#define SFP_TX_DISABLE_49 3
> +#define SFP_PRESENT_52 4
> +#define SFP_PRESENT_51 5
> +#define SFP_PRESENT_50 6
> +#define SFP_PRESENT_49 7
> +#define SFP_LOS_52 8
> +#define SFP_LOS_51 9
> +#define SFP_LOS_50 10
> +#define SFP_LOS_49 11
> +
> +#endif /* _DT_BINDINGS_TN48M_GPIO_H */
> --
> 2.31.1
>