All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: mvtwsi: Add support for DM clocks and resets
@ 2021-09-12 15:21 Samuel Holland
  2021-09-21  4:43 ` Heiko Schocher
  0 siblings, 1 reply; 3+ messages in thread
From: Samuel Holland @ 2021-09-12 15:21 UTC (permalink / raw)
  To: u-boot, Heiko Schocher; +Cc: Jagan Teki, Andre Przywara, Samuel Holland

The controller may need to have clocks/resets enabled for it to work.
Add support for this. Since the clocks/resets are optional on some
platforms (per the device tree binding), do not prevent probing the
controller if they are missing.

Signed-off-by: Samuel Holland <samuel@sholland.org>
---

 drivers/i2c/mvtwsi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
index d33e2c7c9d8..236bfb8d8e7 100644
--- a/drivers/i2c/mvtwsi.c
+++ b/drivers/i2c/mvtwsi.c
@@ -17,7 +17,9 @@
 #include <linux/bitops.h>
 #include <linux/compat.h>
 #if CONFIG_IS_ENABLED(DM_I2C)
+#include <clk.h>
 #include <dm.h>
+#include <reset.h>
 #endif
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -835,7 +837,18 @@ static int mvtwsi_i2c_bind(struct udevice *bus)
 static int mvtwsi_i2c_probe(struct udevice *bus)
 {
 	struct mvtwsi_i2c_dev *dev = dev_get_priv(bus);
+	struct reset_ctl reset;
+	struct clk clk;
 	uint actual_speed;
+	int ret;
+
+	ret = reset_get_by_index(bus, 0, &reset);
+	if (!ret)
+		reset_deassert(&reset);
+
+	ret = clk_get_by_index(bus, 0, &clk);
+	if (!ret)
+		clk_enable(&clk);
 
 	__twsi_i2c_init(dev->base, dev->speed, dev->slaveadd, &actual_speed);
 	dev->speed = actual_speed;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] i2c: mvtwsi: Add support for DM clocks and resets
  2021-09-12 15:21 [PATCH] i2c: mvtwsi: Add support for DM clocks and resets Samuel Holland
@ 2021-09-21  4:43 ` Heiko Schocher
  2021-09-28  6:30   ` Heiko Schocher
  0 siblings, 1 reply; 3+ messages in thread
From: Heiko Schocher @ 2021-09-21  4:43 UTC (permalink / raw)
  To: Samuel Holland, u-boot; +Cc: Jagan Teki, Andre Przywara

Hello Samuel,

On 12.09.21 17:21, Samuel Holland wrote:
> The controller may need to have clocks/resets enabled for it to work.
> Add support for this. Since the clocks/resets are optional on some
> platforms (per the device tree binding), do not prevent probing the
> controller if they are missing.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> 
>  drivers/i2c/mvtwsi.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)

Reviewed-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs@denx.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] i2c: mvtwsi: Add support for DM clocks and resets
  2021-09-21  4:43 ` Heiko Schocher
@ 2021-09-28  6:30   ` Heiko Schocher
  0 siblings, 0 replies; 3+ messages in thread
From: Heiko Schocher @ 2021-09-28  6:30 UTC (permalink / raw)
  To: Samuel Holland, u-boot; +Cc: Jagan Teki, Andre Przywara

Hello Samuel,

On 21.09.21 06:43, Heiko Schocher wrote:
> Hello Samuel,
> 
> On 12.09.21 17:21, Samuel Holland wrote:
>> The controller may need to have clocks/resets enabled for it to work.
>> Add support for this. Since the clocks/resets are optional on some
>> platforms (per the device tree binding), do not prevent probing the
>> controller if they are missing.
>>
>> Signed-off-by: Samuel Holland <samuel@sholland.org>
>> ---
>>
>>  drivers/i2c/mvtwsi.c | 13 +++++++++++++
>>  1 file changed, 13 insertions(+)
> 
> Reviewed-by: Heiko Schocher <hs@denx.de>

Applied to u-boot-i2c next

Thanks!

bye,
Heiko
> 
> bye,
> Heiko
> 

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs@denx.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-28  6:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-12 15:21 [PATCH] i2c: mvtwsi: Add support for DM clocks and resets Samuel Holland
2021-09-21  4:43 ` Heiko Schocher
2021-09-28  6:30   ` Heiko Schocher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.