From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD4271A9F8C; Sun, 19 Oct 2025 23:22:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.211.166.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760916176; cv=none; b=GfCZ3TX0LvE0xqW2BdDpOYUVvFFUiieDURFcDIQTwloW59u1OxY2JrEdJdetpMB9E4H0mGSwrfciGsv0RWxcoSOCnbhdvw97dg6kdnx+YUXdRlWr2KO7uQ9UDKTGRpVPqCAx4fPAjoNKRyNLPnUMf1Lw7xuJoe4SALeZvpxkZEk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760916176; c=relaxed/simple; bh=IMIoiBjFE/truxfip/fwAz0NVPd5hmlzs4OHCjpJ2MM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eUGKu6llEJoAXUY+r3rloB8UjuYAR16hx90abkJ7IakScCp/1yzfQfoXGspb8FxXK0W73t1MMLzeeSjdGml7EYyiGaxJfmnlpbCGV0GDtLHK6ODX7JaJFDS9cI/yxNHAMDUnAaqIO13eeHlSuuc9K1aze7jnlxBdLZJ4818P7RQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gentoo.org; spf=pass smtp.mailfrom=gentoo.org; arc=none smtp.client-ip=140.211.166.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gentoo.org Received: from localhost (unknown [116.232.147.23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange secp256r1 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dlan) by smtp.gentoo.org (Postfix) with ESMTPSA id B96F13415C7; Sun, 19 Oct 2025 23:22:53 +0000 (UTC) Date: Mon, 20 Oct 2025 07:22:43 +0800 From: Yixun Lan To: Troy Mitchell Cc: Andi Shyti , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, spacemit@lists.linux.dev Subject: Re: [PATCH v4] i2c: spacemit: configure ILCR for accurate SCL frequency Message-ID: <20251019232243-GYA1506524@gentoo.org> References: <20251017-k1-i2c-ilcr-v4-1-eed4903ecdb9@linux.spacemit.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251017-k1-i2c-ilcr-v4-1-eed4903ecdb9@linux.spacemit.com> On 15:27 Fri 17 Oct , Troy Mitchell wrote: > The SpacemiT I2C controller's SCL (Serial Clock Line) frequency for > master mode operations is determined by the ILCR (I2C Load Count Register). > Previously, the driver relied on the hardware's reset default > values for this register. > > The hardware's default ILCR values (SLV=0x156, FLV=0x5d) yield SCL > frequencies lower than intended. For example, with the default > 31.5 MHz input clock, these default settings result in an SCL > frequency of approximately 93 kHz (standard mode) when targeting 100 kHz, > and approximately 338 kHz (fast mode) when targeting 400 kHz. > These frequencies are below the 100 kHz/400 kHz nominal speeds. > > This patch integrates the SCL frequency management into > the Common Clock Framework (CCF). Specifically, the ILCR register, > which acts as a frequency divider for the SCL clock, is now registered > as a managed clock (scl_clk) within the CCF. > > This patch also cleans up unnecessary whitespace > in the included header files. > > Signed-off-by: Troy Mitchell Reviewed-by: Yixun Lan > --- > Changelog in v4: > - initialize clk_init_data with {} so that init.flags is implicitly set to 0 > - minor cleanup and style fixes for better readability > - remove unused spacemit_i2c_scl_clk_exclusive_put() cleanup callback > - replace clk_set_rate_exclusive()/clk_rate_exclusive_put() pair with clk_set_rate() > - simplify LCR LV field macros by using FIELD_GET/FIELD_MAX helpers > - Link to v3: https://lore.kernel.org/all/20250814-k1-i2c-ilcr-v3-1-317723e74bcd@linux.spacemit.com/ .. -- Yixun Lan (dlan)