Skip to contentSkip to conversation

i2c: imx_lpi2c: Fix misuse the IS_ENABLED for DM clock

PATCH In review Peng Fan (OSS) 2 participants 2 messages Apr 6, 2023 – Apr 11, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: imx_lpi2c: Fix misuse the IS_ENABLED for DM clock

From: Ye Li <[email protected]>

The IS_ENABLED, which does not consider SPL build, should be replaced by CONFIG_IS_ENABLED.
For the case that we only enable DM CLK for u-boot but not in SPL, the IS_ENABLED(CONFIG_CLK) still returns true, then cause clock failure.

---
 drivers/i2c/imx_lpi2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/imx_lpi2c.c +2 -2
index 92c500327b4..ad9293c92e1 100644
@@ -282,7 +282,7 @@ static int bus_i2c_set_bus_speed(struct udevice *bus, int speed)
 	bool mode;
 	int i;
 
-	if (IS_ENABLED(CONFIG_CLK)) {
+	if (CONFIG_IS_ENABLED(CLK)) {
 		clock_rate = clk_get_rate(&i2c_bus->per_clk);
 		if (clock_rate <= 0) {
 			dev_err(bus, "Failed to get i2c clk: %d\n", clock_rate);
@@ -462,7 +462,7 @@ static int imx_lpi2c_probe(struct udevice *bus)
 		return ret;
 	}
 
-	if (IS_ENABLED(CONFIG_CLK)) {
+	if (CONFIG_IS_ENABLED(CLK)) {
 		ret = clk_get_by_name(bus, "per", &i2c_bus->per_clk);
 		if (ret) {
 			dev_err(bus, "Failed to get per clk\n");
Signature · 1 line
2.36.0
#1 lore raw

Hello Peng,

Quoted 7 lines · Peng Fan (OSS)

From: Ye Li <[email protected]>

The IS_ENABLED, which does not consider SPL build, should be replaced by CONFIG_IS_ENABLED.
For the case that we only enable DM CLK for u-boot but not in SPL, the IS_ENABLED(CONFIG_CLK) still returns true, then cause clock failure.

Quoted 6 lines
---
 drivers/i2c/imx_lpi2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]