U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Troy Mitchell" <troy.mitchell@linux.spacemit.com>
To: "Yixun Lan" <dlan@kernel.org>,
	"Troy Mitchell" <troy.mitchell@linux.spacemit.com>
Cc: "Junhui Liu" <junhui.liu@pigmoral.tech>,
	"Heiko Schocher" <hs@nabladev.com>, <u-boot-spacemit@groups.io>,
	<u-boot@lists.u-boot-project.org>,
	"Huan Zhou" <pericycle.cc@gmail.com>,
	"Guodong Xu" <guodong.xu@oss.qualcomm.com>,
	"Tom Rini" <trini@konsulko.com>,
	"Raymond Mao" <raymond.mao@riscstar.com>,
	"Lukasz Majewski" <lukma@denx.de>
Subject: Re: [PATCH v2 3/4] i2c: k1: enable both functional and bus clocks
Date: Tue, 18 Aug 2026 09:03:58 +0800	[thread overview]
Message-ID: <DKRNYNELFA7H.3838MH2QULHVX@linux.spacemit.com> (raw)
In-Reply-To: <20260817091812-GKC571540@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1702 bytes --]

On Mon Aug 17, 2026 at 5:18 PM +08, Yixun Lan wrote:
> hi Troy,
>
> On 16:56 Mon 17 Aug     , Troy Mitchell wrote:
>> > The K1 I2C controller requires both its functional clock and APB bus
>> > clock to operate. The device tree provides them as "func" and "bus", but
>> > the driver currently acquires and enables only the first clock.
>> >
>> > Acquire both clocks by name and enable them during probe. Use explicit
>> > named lookups instead of the bulk clock API to align with the K1 Linux
>> > driver and keep the roles of the two clocks clear if functional clock
>> > rate configuration is needed later.
>> 
>> [...]
>> 
>> > @@ -487,15 +487,21 @@ static int k1_i2c_probe(struct udevice *bus)
>> >  		return ret;
>> >  	}
>> >
>> > -	ret = clk_get_by_index(bus, 0, &priv->clk);
>> > +	ret = clk_get_by_name(bus, "func", &clk);
>> >  	if (ret)
>> >  		return ret;
>> >
>> > -	ret = clk_enable(&priv->clk);
>> > -	if (ret && ret != -ENOSYS && ret != -EOPNOTSUPP) {
>> > -		debug("%s: failed to enable clock\n", __func__);
>> > +	ret = clk_enable(&clk);
>> > +	if (ret)
>> > +		return ret;
>> > +
>> > +	ret = clk_get_by_name(bus, "bus", &clk);
>> > +	if (ret)
>> > +		return ret;
>> > +
>> > +	ret = clk_enable(&clk);
>> > +	if (ret)
>> >  		return ret;
>> > -	}
>> 
>> Once the functional clock has been enabled, failure to acquire or enable
>> the bus clock returns without disabling the functional clock.
>> 
> I'd not worry about this, as in uboot it isn't worth the effort to do the
> resouce reclamation, instead I'm more concerned about the error handling..
Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>


-- 
Troy Mitchell


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 248 bytes --]

  reply	other threads:[~2026-08-18 13:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-15  3:40 [PATCH v2 0/4] i2c/clk: spacemit: k1: fix I2C bus configuration and clock handling Junhui Liu
2026-08-15  3:40 ` [PATCH v2 1/4] i2c: k1: fix wrong bus speed setting Junhui Liu
2026-08-17  8:29   ` Yixun Lan
2026-08-17  9:12   ` Troy Mitchell
2026-08-17 14:25     ` Junhui Liu
2026-08-18  1:03       ` Troy Mitchell
2026-08-15  3:40 ` [PATCH v2 2/4] clk: spacemit: k1: add TWSI bus clocks to SPL Junhui Liu
2026-08-15  3:40 ` [PATCH v2 3/4] i2c: k1: enable both functional and bus clocks Junhui Liu
2026-08-17  4:50   ` Heiko Schocher via U-Boot
2026-08-17  8:31   ` Yixun Lan
2026-08-17  8:56   ` Troy Mitchell
2026-08-17  9:18     ` Yixun Lan
2026-08-18  1:03       ` Troy Mitchell [this message]
2026-08-18  6:21   ` Yao Zi
2026-08-18  6:26     ` Yao Zi
2026-08-15  3:40 ` [PATCH v2 4/4] clk: spacemit: k1: remove bus gate from TWSI functional clocks Junhui Liu
2026-08-17  8:55   ` Troy Mitchell
2026-08-18  6:53 ` [PATCH v2 0/4] i2c/clk: spacemit: k1: fix I2C bus configuration and clock handling Yao Zi
2026-08-24  8:21   ` Heiko Schocher
2026-08-24 14:21     ` Junhui Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DKRNYNELFA7H.3838MH2QULHVX@linux.spacemit.com \
    --to=troy.mitchell@linux.spacemit.com \
    --cc=dlan@kernel.org \
    --cc=guodong.xu@oss.qualcomm.com \
    --cc=hs@nabladev.com \
    --cc=junhui.liu@pigmoral.tech \
    --cc=lukma@denx.de \
    --cc=pericycle.cc@gmail.com \
    --cc=raymond.mao@riscstar.com \
    --cc=trini@konsulko.com \
    --cc=u-boot-spacemit@groups.io \
    --cc=u-boot@lists.u-boot-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox