[PW_SID:1091470] i2c: spacemit: improve clock handling and cleanups#1884
[PW_SID:1091470] i2c: spacemit: improve clock handling and cleanups#1884linux-riscv-bot wants to merge 3 commits into
Conversation
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. The actual hardware timing formulas are: - standard mode: SCL = FCLK / (2 * SLV + 8) - fast mode: SCL = FCLK / (2 * FLV + 10) These formulas are only valid when the IWCR (Wait Count Register) is programmed to 0x142A, a value specified by the I2C IP designer. The driver now initializes IWCR to this value during controller init. Reviewed-by: Yixun Lan <dlan@gentoo.org> Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The clock-frequency property is optional according to the DT binding. Do not emit a warning when the property is missing and fall back to the default frequency instead. Reviewed-by: Alex Elder <elder@riscstar.com> Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v7,1/2] i2c: spacemit: configure ILCR/IWCR for accurate SCL frequency" |
|
Patch 1: "[v7,1/2] i2c: spacemit: configure ILCR/IWCR for accurate SCL frequency" |
|
Patch 1: "[v7,1/2] i2c: spacemit: configure ILCR/IWCR for accurate SCL frequency" |
|
Patch 1: "[v7,1/2] i2c: spacemit: configure ILCR/IWCR for accurate SCL frequency" |
|
Patch 1: "[v7,1/2] i2c: spacemit: configure ILCR/IWCR for accurate SCL frequency" |
|
Patch 1: "[v7,1/2] i2c: spacemit: configure ILCR/IWCR for accurate SCL frequency" |
|
Patch 1: "[v7,1/2] i2c: spacemit: configure ILCR/IWCR for accurate SCL frequency" |
|
Patch 1: "[v7,1/2] i2c: spacemit: configure ILCR/IWCR for accurate SCL frequency" |
|
Patch 1: "[v7,1/2] i2c: spacemit: configure ILCR/IWCR for accurate SCL frequency" |
|
Patch 1: "[v7,1/2] i2c: spacemit: configure ILCR/IWCR for accurate SCL frequency" |
|
Patch 1: "[v7,1/2] i2c: spacemit: configure ILCR/IWCR for accurate SCL frequency" |
|
Patch 1: "[v7,1/2] i2c: spacemit: configure ILCR/IWCR for accurate SCL frequency" |
|
Patch 2: "[v7,2/2] i2c: spacemit: drop warning when clock-frequency property is absent" |
|
Patch 2: "[v7,2/2] i2c: spacemit: drop warning when clock-frequency property is absent" |
|
Patch 2: "[v7,2/2] i2c: spacemit: drop warning when clock-frequency property is absent" |
|
Patch 2: "[v7,2/2] i2c: spacemit: drop warning when clock-frequency property is absent" |
|
Patch 2: "[v7,2/2] i2c: spacemit: drop warning when clock-frequency property is absent" |
|
Patch 2: "[v7,2/2] i2c: spacemit: drop warning when clock-frequency property is absent" |
|
Patch 2: "[v7,2/2] i2c: spacemit: drop warning when clock-frequency property is absent" |
|
Patch 2: "[v7,2/2] i2c: spacemit: drop warning when clock-frequency property is absent" |
|
Patch 2: "[v7,2/2] i2c: spacemit: drop warning when clock-frequency property is absent" |
|
Patch 2: "[v7,2/2] i2c: spacemit: drop warning when clock-frequency property is absent" |
|
Patch 2: "[v7,2/2] i2c: spacemit: drop warning when clock-frequency property is absent" |
|
Patch 2: "[v7,2/2] i2c: spacemit: drop warning when clock-frequency property is absent" |
2d4fcdd to
cd9d421
Compare
PR for series 1091470 applied to workflow__riscv__fixes
Name: i2c: spacemit: improve clock handling and cleanups
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1091470
Version: 7