diff mbox series

[v4,2/4] timer: cadence: Add bind function to driver

Message ID 434ef195fbedea9f83672a12d1ace0da16e8832e.1634303847.git.michal.simek@xilinx.com
State Accepted
Commit dcbdd24259beaff903e7ffffde646a3c5bd756ac
Delegated to: Simon Glass
Headers show
Series [v4,1/4] dm: core: Bind another driver with the same compatible string | expand

Commit Message

Michal Simek Oct. 15, 2021, 1:17 p.m. UTC
When DT node has pwm-cells property it shouldn't be bind as timer driver
but as PWM driver. That's why make sure that this property is checked.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v4:
- Add reviewed-by tags

Changes in v3:
- New patch in series

 drivers/timer/cadence-ttc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Michal Simek March 30, 2022, 12:47 p.m. UTC | #1
pá 15. 10. 2021 v 15:17 odesílatel Michal Simek
<michal.simek@xilinx.com> napsal:
>
> When DT node has pwm-cells property it shouldn't be bind as timer driver
> but as PWM driver. That's why make sure that this property is checked.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Reviewed-by: Sean Anderson <sean.anderson@seco.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v4:
> - Add reviewed-by tags
>
> Changes in v3:
> - New patch in series
>
>  drivers/timer/cadence-ttc.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/drivers/timer/cadence-ttc.c b/drivers/timer/cadence-ttc.c
> index 2f95d45ecd7a..2eff45060ad6 100644
> --- a/drivers/timer/cadence-ttc.c
> +++ b/drivers/timer/cadence-ttc.c
> @@ -97,6 +97,17 @@ static int cadence_ttc_of_to_plat(struct udevice *dev)
>         return 0;
>  }
>
> +static int cadence_ttc_bind(struct udevice *dev)
> +{
> +       const char *cells;
> +
> +       cells = dev_read_prop(dev, "#pwm-cells", NULL);
> +       if (cells)
> +               return -ENODEV;
> +
> +       return 0;
> +}
> +
>  static const struct timer_ops cadence_ttc_ops = {
>         .get_count = cadence_ttc_get_count,
>  };
> @@ -114,4 +125,5 @@ U_BOOT_DRIVER(cadence_ttc) = {
>         .priv_auto      = sizeof(struct cadence_ttc_priv),
>         .probe = cadence_ttc_probe,
>         .ops = &cadence_ttc_ops,
> +       .bind = cadence_ttc_bind,
>  };
> --
> 2.33.1
>

Applied.
M
diff mbox series

Patch

diff --git a/drivers/timer/cadence-ttc.c b/drivers/timer/cadence-ttc.c
index 2f95d45ecd7a..2eff45060ad6 100644
--- a/drivers/timer/cadence-ttc.c
+++ b/drivers/timer/cadence-ttc.c
@@ -97,6 +97,17 @@  static int cadence_ttc_of_to_plat(struct udevice *dev)
 	return 0;
 }
 
+static int cadence_ttc_bind(struct udevice *dev)
+{
+	const char *cells;
+
+	cells = dev_read_prop(dev, "#pwm-cells", NULL);
+	if (cells)
+		return -ENODEV;
+
+	return 0;
+}
+
 static const struct timer_ops cadence_ttc_ops = {
 	.get_count = cadence_ttc_get_count,
 };
@@ -114,4 +125,5 @@  U_BOOT_DRIVER(cadence_ttc) = {
 	.priv_auto	= sizeof(struct cadence_ttc_priv),
 	.probe = cadence_ttc_probe,
 	.ops = &cadence_ttc_ops,
+	.bind = cadence_ttc_bind,
 };