Skip to content

Commit 7a7fd33

Browse files
geertuAndi Shyti
authored andcommitted
i2c: sh_mobile: Switch R-Mobile A1/APE6 and SH-Mobile AG5 to new frequency calculation
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 <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Signed-off-by: Andi Shyti <[email protected]>
1 parent c0fcc4d commit 7a7fd33

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

drivers/i2c/busses/i2c-sh_mobile.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ static int sh_mobile_i2c_r8a7740_workaround(struct sh_mobile_i2c_data *pd)
773773
iic_wr(pd, ICCR, ICCR_TRS);
774774
udelay(10);
775775

776-
return sh_mobile_i2c_init(pd);
776+
return sh_mobile_i2c_v2_init(pd);
777777
}
778778

779779
static const struct sh_mobile_dt_config default_dt_config = {
@@ -782,11 +782,6 @@ static const struct sh_mobile_dt_config default_dt_config = {
782782
};
783783

784784
static const struct sh_mobile_dt_config fast_clock_dt_config = {
785-
.clks_per_count = 2,
786-
.setup = sh_mobile_i2c_init,
787-
};
788-
789-
static const struct sh_mobile_dt_config v2_freq_calc_dt_config = {
790785
.clks_per_count = 2,
791786
.setup = sh_mobile_i2c_v2_init,
792787
};
@@ -799,17 +794,17 @@ static const struct sh_mobile_dt_config r8a7740_dt_config = {
799794
static const struct of_device_id sh_mobile_i2c_dt_ids[] = {
800795
{ .compatible = "renesas,iic-r8a73a4", .data = &fast_clock_dt_config },
801796
{ .compatible = "renesas,iic-r8a7740", .data = &r8a7740_dt_config },
802-
{ .compatible = "renesas,iic-r8a774c0", .data = &v2_freq_calc_dt_config },
803-
{ .compatible = "renesas,iic-r8a7790", .data = &v2_freq_calc_dt_config },
804-
{ .compatible = "renesas,iic-r8a7791", .data = &v2_freq_calc_dt_config },
805-
{ .compatible = "renesas,iic-r8a7792", .data = &v2_freq_calc_dt_config },
806-
{ .compatible = "renesas,iic-r8a7793", .data = &v2_freq_calc_dt_config },
807-
{ .compatible = "renesas,iic-r8a7794", .data = &v2_freq_calc_dt_config },
808-
{ .compatible = "renesas,iic-r8a7795", .data = &v2_freq_calc_dt_config },
809-
{ .compatible = "renesas,iic-r8a77990", .data = &v2_freq_calc_dt_config },
797+
{ .compatible = "renesas,iic-r8a774c0", .data = &fast_clock_dt_config },
798+
{ .compatible = "renesas,iic-r8a7790", .data = &fast_clock_dt_config },
799+
{ .compatible = "renesas,iic-r8a7791", .data = &fast_clock_dt_config },
800+
{ .compatible = "renesas,iic-r8a7792", .data = &fast_clock_dt_config },
801+
{ .compatible = "renesas,iic-r8a7793", .data = &fast_clock_dt_config },
802+
{ .compatible = "renesas,iic-r8a7794", .data = &fast_clock_dt_config },
803+
{ .compatible = "renesas,iic-r8a7795", .data = &fast_clock_dt_config },
804+
{ .compatible = "renesas,iic-r8a77990", .data = &fast_clock_dt_config },
810805
{ .compatible = "renesas,iic-sh73a0", .data = &fast_clock_dt_config },
811-
{ .compatible = "renesas,rcar-gen2-iic", .data = &v2_freq_calc_dt_config },
812-
{ .compatible = "renesas,rcar-gen3-iic", .data = &v2_freq_calc_dt_config },
806+
{ .compatible = "renesas,rcar-gen2-iic", .data = &fast_clock_dt_config },
807+
{ .compatible = "renesas,rcar-gen3-iic", .data = &fast_clock_dt_config },
813808
{ .compatible = "renesas,rmobile-iic", .data = &default_dt_config },
814809
{},
815810
};

0 commit comments

Comments
 (0)