* [PATCH v2] i2c: sh_mobile: Switch R-Mobile A1/APE6 and SH-Mobile AG5 to new frequency calculation
@ 2024-01-31 16:09 Geert Uytterhoeven
2024-01-31 20:34 ` Wolfram Sang
2024-01-31 22:55 ` Andi Shyti
0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2024-01-31 16:09 UTC (permalink / raw)
To: Wolfram Sang, Andi Shyti
Cc: linux-renesas-soc, linux-i2c, linux-sh, Geert Uytterhoeven
Switch the R-Mobile A1, R-Mobile APE6, and SH-Mobile AG5 SoCs to the new
frequency calculation formula, to (a) avoid running the I2C bus too fast,
and (b) bring the low/high ratio closer to the recommended ratio 5/4.
As this makes fast_clock_dt_config and v2_freq_calc_dt_config identical,
merge them into a single fast_clock_dt_config.
Legacy SH users (sh7343, sh7366, and sh772[234]) are left alone, and
still use the old formula.
Measurement results on R-Mobile APE6 and SH-Mobile AG5 (fck=104 MHz,
clks_per_count=2):
100 kHz: 106 kHz LH=1.12 before, 99.6 kHz L/H=1.22 after
400 kHz: 384 kHz LH=1.67 before, 392 kHz L/H=1.27 after
Measurement results on R-Mobile A1 (fck=49.5 MHz, clks_per_count=1):
100 kHz: 106 kHz L/H=1.09 before, 99.6 kHz L/H=1.20 after
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v2:
- Merge fast_clock_dt_config and v2_freq_calc_dt_config,
- Document that legacy SH users are untouched.
---
drivers/i2c/busses/i2c-sh_mobile.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 5adbe62cf6212865..c65ac3d7eadc5b58 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -773,7 +773,7 @@ static int sh_mobile_i2c_r8a7740_workaround(struct sh_mobile_i2c_data *pd)
iic_wr(pd, ICCR, ICCR_TRS);
udelay(10);
- return sh_mobile_i2c_init(pd);
+ return sh_mobile_i2c_v2_init(pd);
}
static const struct sh_mobile_dt_config default_dt_config = {
@@ -782,11 +782,6 @@ static const struct sh_mobile_dt_config default_dt_config = {
};
static const struct sh_mobile_dt_config fast_clock_dt_config = {
- .clks_per_count = 2,
- .setup = sh_mobile_i2c_init,
-};
-
-static const struct sh_mobile_dt_config v2_freq_calc_dt_config = {
.clks_per_count = 2,
.setup = sh_mobile_i2c_v2_init,
};
@@ -799,17 +794,17 @@ static const struct sh_mobile_dt_config r8a7740_dt_config = {
static const struct of_device_id sh_mobile_i2c_dt_ids[] = {
{ .compatible = "renesas,iic-r8a73a4", .data = &fast_clock_dt_config },
{ .compatible = "renesas,iic-r8a7740", .data = &r8a7740_dt_config },
- { .compatible = "renesas,iic-r8a774c0", .data = &v2_freq_calc_dt_config },
- { .compatible = "renesas,iic-r8a7790", .data = &v2_freq_calc_dt_config },
- { .compatible = "renesas,iic-r8a7791", .data = &v2_freq_calc_dt_config },
- { .compatible = "renesas,iic-r8a7792", .data = &v2_freq_calc_dt_config },
- { .compatible = "renesas,iic-r8a7793", .data = &v2_freq_calc_dt_config },
- { .compatible = "renesas,iic-r8a7794", .data = &v2_freq_calc_dt_config },
- { .compatible = "renesas,iic-r8a7795", .data = &v2_freq_calc_dt_config },
- { .compatible = "renesas,iic-r8a77990", .data = &v2_freq_calc_dt_config },
+ { .compatible = "renesas,iic-r8a774c0", .data = &fast_clock_dt_config },
+ { .compatible = "renesas,iic-r8a7790", .data = &fast_clock_dt_config },
+ { .compatible = "renesas,iic-r8a7791", .data = &fast_clock_dt_config },
+ { .compatible = "renesas,iic-r8a7792", .data = &fast_clock_dt_config },
+ { .compatible = "renesas,iic-r8a7793", .data = &fast_clock_dt_config },
+ { .compatible = "renesas,iic-r8a7794", .data = &fast_clock_dt_config },
+ { .compatible = "renesas,iic-r8a7795", .data = &fast_clock_dt_config },
+ { .compatible = "renesas,iic-r8a77990", .data = &fast_clock_dt_config },
{ .compatible = "renesas,iic-sh73a0", .data = &fast_clock_dt_config },
- { .compatible = "renesas,rcar-gen2-iic", .data = &v2_freq_calc_dt_config },
- { .compatible = "renesas,rcar-gen3-iic", .data = &v2_freq_calc_dt_config },
+ { .compatible = "renesas,rcar-gen2-iic", .data = &fast_clock_dt_config },
+ { .compatible = "renesas,rcar-gen3-iic", .data = &fast_clock_dt_config },
{ .compatible = "renesas,rmobile-iic", .data = &default_dt_config },
{},
};
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] i2c: sh_mobile: Switch R-Mobile A1/APE6 and SH-Mobile AG5 to new frequency calculation
2024-01-31 16:09 [PATCH v2] i2c: sh_mobile: Switch R-Mobile A1/APE6 and SH-Mobile AG5 to new frequency calculation Geert Uytterhoeven
@ 2024-01-31 20:34 ` Wolfram Sang
2024-01-31 22:55 ` Andi Shyti
1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2024-01-31 20:34 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Andi Shyti, linux-renesas-soc, linux-i2c, linux-sh
[-- Attachment #1: Type: text/plain, Size: 1024 bytes --]
On Wed, Jan 31, 2024 at 05:09:30PM +0100, Geert Uytterhoeven wrote:
> Switch the R-Mobile A1, R-Mobile APE6, and SH-Mobile AG5 SoCs to the new
> frequency calculation formula, to (a) avoid running the I2C bus too fast,
> and (b) bring the low/high ratio closer to the recommended ratio 5/4.
>
> As this makes fast_clock_dt_config and v2_freq_calc_dt_config identical,
> merge them into a single fast_clock_dt_config.
>
> Legacy SH users (sh7343, sh7366, and sh772[234]) are left alone, and
> still use the old formula.
>
> Measurement results on R-Mobile APE6 and SH-Mobile AG5 (fck=104 MHz,
> clks_per_count=2):
> 100 kHz: 106 kHz LH=1.12 before, 99.6 kHz L/H=1.22 after
> 400 kHz: 384 kHz LH=1.67 before, 392 kHz L/H=1.27 after
>
> Measurement results on R-Mobile A1 (fck=49.5 MHz, clks_per_count=1):
> 100 kHz: 106 kHz L/H=1.09 before, 99.6 kHz L/H=1.20 after
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] i2c: sh_mobile: Switch R-Mobile A1/APE6 and SH-Mobile AG5 to new frequency calculation
2024-01-31 16:09 [PATCH v2] i2c: sh_mobile: Switch R-Mobile A1/APE6 and SH-Mobile AG5 to new frequency calculation Geert Uytterhoeven
2024-01-31 20:34 ` Wolfram Sang
@ 2024-01-31 22:55 ` Andi Shyti
1 sibling, 0 replies; 3+ messages in thread
From: Andi Shyti @ 2024-01-31 22:55 UTC (permalink / raw)
To: Wolfram Sang, Geert Uytterhoeven; +Cc: linux-renesas-soc, linux-i2c, linux-sh
Hi
On Wed, 31 Jan 2024 17:09:30 +0100, Geert Uytterhoeven wrote:
> Switch the R-Mobile A1, R-Mobile APE6, and SH-Mobile AG5 SoCs to the new
> frequency calculation formula, to (a) avoid running the I2C bus too fast,
> and (b) bring the low/high ratio closer to the recommended ratio 5/4.
>
> As this makes fast_clock_dt_config and v2_freq_calc_dt_config identical,
> merge them into a single fast_clock_dt_config.
>
> [...]
Applied to i2c/i2c-host on
git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git
Thank you,
Andi
Patches applied
===============
[1/1] i2c: sh_mobile: Switch R-Mobile A1/APE6 and SH-Mobile AG5 to new frequency calculation
commit: 5266be22421c9419ec239486c7f38bf997739fce
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-31 23:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-31 16:09 [PATCH v2] i2c: sh_mobile: Switch R-Mobile A1/APE6 and SH-Mobile AG5 to new frequency calculation Geert Uytterhoeven
2024-01-31 20:34 ` Wolfram Sang
2024-01-31 22:55 ` Andi Shyti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox