More PolarFire SoC Fixes for 5.18
Subsystems (4)
Conor Dooley
maintainercover More PolarFire SoC Fixes for 5.18
Hey,
After the clock driver for the PolarFire SoC was accepted I started work on the onboard RTC & found out that the reference clock for the rtc was actually missing from the clock driver.
While restructuring the clock driver to add support for the rtc reference, I noticed that there were some problems with how the FIC clocks were being used. The FIC clocks are the cpu side inputs to the AXI fabric interconnections & are not the clocks for any peripherals.
This series fixes the problems I noticed:
- the fic clocks incorrectly had the AHB clock as their parents
- the last fic, named differently to the others, had not been set as a critical clock
- some peripherals on the fabric side were incorrectly using the cpu side fic clocks, resulting in incorrect rates.
I added fixes tags to these patches in the hope that they will make it into 5.18. I kept series separate from [0] as that fixes something that is broken, while these are only wrong.
Thanks,
Conor.
[0] https://lore.kernel.org/linux-riscv/[email protected]/T/#u
Conor Dooley (3):
clk: microchip: mpfs: fix parents for FIC clocks
clk: microchip: mpfs: mark CLK_ATHENA as critical
riscv: dts: microchip: fix usage of fic clocks on mpfs
.../dts/microchip/microchip-mpfs-fabric.dtsi | 16 ++++++++++++++-- .../riscv/boot/dts/microchip/microchip-mpfs.dtsi | 2 +- drivers/clk/microchip/clk-mpfs.c | 16 +++++++++------- 3 files changed, 24 insertions(+), 10 deletions(-)
Signature · 1 line
2.35.1
Conor Dooley
maintainerPATCH 1/3 clk: microchip: mpfs: fix parents for FIC clocks
The fabric interconnects are on the AXI bus not AHB. Update their parent clocks to fix this.
--- drivers/clk/microchip/clk-mpfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/microchip/clk-mpfs.c +5 -5
@@ -265,11 +265,11 @@ static struct mpfs_periph_hw_clock mpfs_periph_clks[] = {CLK_PERIPH (CLK_GPIO1 ,"clk_periph_gpio1" ,PARENT_CLK (AHB ),21 ,0 ),CLK_PERIPH (CLK_GPIO2 ,"clk_periph_gpio2" ,PARENT_CLK (AHB ),22 ,0 ),CLK_PERIPH (CLK_DDRC ,"clk_periph_ddrc" ,PARENT_CLK (AHB ),23 ,CLK_IS_CRITICAL ), -CLK_PERIPH (CLK_FIC0 ,"clk_periph_fic0" ,PARENT_CLK (AHB ),24 ,CLK_IS_CRITICAL ), -CLK_PERIPH (CLK_FIC1 ,"clk_periph_fic1" ,PARENT_CLK (AHB ),25 ,CLK_IS_CRITICAL ), -CLK_PERIPH (CLK_FIC2 ,"clk_periph_fic2" ,PARENT_CLK (AHB ),26 ,CLK_IS_CRITICAL ), -CLK_PERIPH (CLK_FIC3 ,"clk_periph_fic3" ,PARENT_CLK (AHB ),27 ,CLK_IS_CRITICAL ), -CLK_PERIPH (CLK_ATHENA ,"clk_periph_athena" ,PARENT_CLK (AHB ),28 ,0 ), +CLK_PERIPH (CLK_FIC0 ,"clk_periph_fic0" ,PARENT_CLK (AXI ),24 ,CLK_IS_CRITICAL ), +CLK_PERIPH (CLK_FIC1 ,"clk_periph_fic1" ,PARENT_CLK (AXI ),25 ,CLK_IS_CRITICAL ), +CLK_PERIPH (CLK_FIC2 ,"clk_periph_fic2" ,PARENT_CLK (AXI ),26 ,CLK_IS_CRITICAL ), +CLK_PERIPH (CLK_FIC3 ,"clk_periph_fic3" ,PARENT_CLK (AXI ),27 ,CLK_IS_CRITICAL ), +CLK_PERIPH (CLK_ATHENA ,"clk_periph_athena" ,PARENT_CLK (AXI ),28 ,0 ), CLK_PERIPH(CLK_CFM, "clk_periph_cfm", PARENT_CLK(AHB), 29, 0), };
Signature · 1 line
2.35.1
Conor Dooley
maintainerPATCH 2/3 clk: microchip: mpfs: mark CLK_ATHENA as critical
In reply to Conor DooleyCLK_ATHENA is another fabric interconnect and should be marked as critical as with FIC0-3, since disabling it will cause part of the fabric to go into reset.
--- drivers/clk/microchip/clk-mpfs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/clk/microchip/clk-mpfs.c +5 -3
@@ -237,8 +237,10 @@ static const struct clk_ops mpfs_periph_clk_ops = {* trap handler * - CLK_MMUART0: reserved by the hss * - CLK_DDRC: provides clock to the ddr subsystem -* - CLK_FICx: these provide clocks for sections of the fpga fabric, disabling them would -* cause the fabric to go into reset +* - CLK_FICx: these provide the processor side clocks to the "FIC" (Fabric InterConnect) +* clock domain crossers which provide the interface to the FPGA fabric. Disabling them +* causes the FPGA fabric to go into reset. +* - CLK_ATHENA: The athena clock is FIC4, which is reserved for the Athena TeraFire. */ static struct mpfs_periph_hw_clock mpfs_periph_clks[] = {
@@ -269,7 +271,7 @@ static struct mpfs_periph_hw_clock mpfs_periph_clks[] = {CLK_PERIPH (CLK_FIC1 ,"clk_periph_fic1" ,PARENT_CLK (AXI ),25 ,CLK_IS_CRITICAL ),CLK_PERIPH (CLK_FIC2 ,"clk_periph_fic2" ,PARENT_CLK (AXI ),26 ,CLK_IS_CRITICAL ),CLK_PERIPH (CLK_FIC3 ,"clk_periph_fic3" ,PARENT_CLK (AXI ),27 ,CLK_IS_CRITICAL ), -CLK_PERIPH (CLK_ATHENA ,"clk_periph_athena" ,PARENT_CLK (AXI ),28 ,0 ), +CLK_PERIPH (CLK_ATHENA ,"clk_periph_athena" ,PARENT_CLK (AXI ),28 ,CLK_IS_CRITICAL ), CLK_PERIPH(CLK_CFM, "clk_periph_cfm", PARENT_CLK(AHB), 29, 0), };
Signature · 1 line
2.35.1
Conor Dooley
maintainerPATCH 3/3 riscv: dts: microchip: fix usage of fic clocks on mpfs
In reply to Conor DooleyThe fic clocks passed to the pcie controller and other peripherals in the device tree are not the clocks they actually run on. The fics are actually clock domain crossers & the clock config blocks output is the mss/cpu side input to the interconnect. The peripherals are actually clocked by fixed frequency clocks embedded in the fpga fabric.
Fix the device tree so that these peripherals use the correct clocks. The fabric side FIC0 & FIC1 inputs both use the same 125 MHz, so only one clock is created for them.
--- .../dts/microchip/microchip-mpfs-fabric.dtsi | 16 ++++++++++++++-- .../riscv/boot/dts/microchip/microchip-mpfs.dtsi | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-)
arch/riscv/boot/dts/microchip/microchip-mpfs-fabric.dtsi +14 -2
@@ -7,7 +7,7 @@ core_pwm0: pwm@41000000 { reg = <0x0 0x41000000 0x0 0xF0>; microchip,sync-update-mask = /bits/ 32 <0>; #pwm-cells = <2>; - clocks = <&clkcfg CLK_FIC3>; + clocks = <&fabric_clk3>; status = "disabled"; };
@@ -16,10 +16,22 @@ i2c2: i2c@44000000 { reg = <0x0 0x44000000 0x0 0x1000>; #address-cells = <1>; #size-cells = <0>; - clocks = <&clkcfg CLK_FIC3>; + clocks = <&fabric_clk3>; interrupt-parent = <&plic>; interrupts = <122>; clock-frequency = <100000>; status = "disabled"; }; + + fabric_clk3: fabric-clk3 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <62500000>; + }; + + fabric_clk1: fabric-clk1 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <125000000>; + }; };
arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi +1 -1
@@ -424,7 +424,7 @@ pcie: pcie@2000000000 { <0 0 0 3 &pcie_intc 2>, <0 0 0 4 &pcie_intc 3>; interrupt-map-mask = <0 0 0 7>; - clocks = <&clkcfg CLK_FIC0>, <&clkcfg CLK_FIC1>, <&clkcfg CLK_FIC3>; + clocks = <&fabric_clk1>, <&fabric_clk1>, <&fabric_clk3>; clock-names = "fic0", "fic1", "fic3"; ranges = <0x3000000 0x0 0x8000000 0x20 0x8000000 0x0 0x80000000>; msi-parent = <&pcie>;
Signature · 1 line
2.35.1