Skip to contentSkip to conversation

CLK: microchip: Add clkcfg driver for Microchip PolarFire SoC

PATCH Superseded [email protected] 3 participants 5 messages Dec 15, 2021

Subsystems (3)

v7 of 12 Superseded Latest is v12 →

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

v7 cover CLK: microchip: Add clkcfg driver for Microchip PolarFire SoC

From: Conor Dooley <[email protected]>

This patchset adds support for the Microchip PolarFire clkcfg hardware block.

Changes since v6:
* Dropped clock-output-names *as a required property*
* Dropped if(lock) check on spinlocks, added spinlocks to all read-modify-write register access
* Removed kfree()s on non-dynamically allocated variables
* Use devm_clk_get to get the reference clock
* Account for reserved clock when calculating the size of num_clks

Changes since v5:
* Dropped clock-output-names property

Major changes since v4:
* Adjusted license for microchip,mpfs-clock.h to match microchip,mpfs.yaml
* Corrected the number of clocks to 33 from 32

Major changes since v3:
* Patch reformatted so microchip,mpfs-clock.h is part of device-tree patch

Major changes since v2:
* In mpfs_cfg_clk_set_rate, return immediately if divider_get_val returns <0
* rebased to v5.12-rc1

Major changes since v1:
* Dependency on SOC_MICROCHIP_POLARFIRE
* All references to PFSOC/pfsoc changed to MPFS/mpfs
* Cleaned error handling in _probe
* Re-ordered code to place structs et al at top

Daire McNamara (2):
dt-bindings: clk: microchip: Add Microchip PolarFire host binding
clk: microchip: Add driver for Microchip PolarFire SoC

 .../bindings/clock/microchip,mpfs.yaml        |  61 +++
 drivers/clk/Kconfig                           |   1 +
 drivers/clk/Makefile                          |   2 +-
 drivers/clk/microchip/Kconfig                 |   7 +
 drivers/clk/microchip/Makefile                |   6 +-
 drivers/clk/microchip/clk-mpfs.c              | 447 ++++++++++++++++++
 .../dt-bindings/clock/microchip,mpfs-clock.h  |  45 ++
 7 files changed, 566 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/microchip,mpfs.yaml
 create mode 100644 drivers/clk/microchip/Kconfig
 create mode 100644 drivers/clk/microchip/clk-mpfs.c
 create mode 100644 include/dt-bindings/clock/microchip,mpfs-clock.h
Signature · 1 line
2.33.1
author maintainer
#1 lore raw

PATCH v7 1/2 dt-bindings: clk: microchip: Add Microchip PolarFire host binding

From: Daire McNamara <[email protected]>

Add device tree bindings for the Microchip PolarFire system clock controller

---
 .../bindings/clock/microchip,mpfs.yaml        | 61 +++++++++++++++++++
 .../dt-bindings/clock/microchip,mpfs-clock.h  | 45 ++++++++++++++
 2 files changed, 106 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/microchip,mpfs.yaml
 create mode 100644 include/dt-bindings/clock/microchip,mpfs-clock.h
Documentation/devicetree/bindings/clock/microchip,mpfs.yaml new file +61 -0
new file mode 100644
index 000000000000..d856c00ef0a3
@@ -0,0 +1,61 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/microchip,mpfs.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip PolarFire Clock Control Module Binding
+
+maintainers:
+  - Daire McNamara <[email protected]>
+
+description: |
+  Microchip PolarFire clock control (CLKCFG) is an integrated clock controller,
+  which gates and enables all peripheral clocks.
+
+  This device tree binding describes 33 gate clocks.  Clocks are referenced by
+  user nodes by the CLKCFG node phandle and the clock index in the group, from
+  0 to 32.
+
+properties:
+  compatible:
+    const: microchip,mpfs-clkcfg
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 1
+    description: |
+      The clock consumer should specify the desired clock by having the clock
+      ID in its "clocks" phandle cell. See include/dt-bindings/clock/microchip,mpfs-clock.h
+      for the full list of PolarFire clock IDs.
+
+  clock-output-names:
+    maxItems: 33
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+  # Clock Config node:
+  - |
+    #include <dt-bindings/clock/microchip,mpfs-clock.h>
+    soc {
+            #address-cells = <2>;
+            #size-cells = <2>;
+            clkcfg: clock-controller@20002000 {
+                compatible = "microchip,mpfs-clkcfg";
+                reg = <0x0 0x20002000 0x0 0x1000>;
+                clocks = <&ref>;
+                #clock-cells = <1>;
+        };
+    };
include/dt-bindings/clock/microchip,mpfs-clock.h new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
2.33.1
maintainer Reviewed-by on v7 1/2
#2 lore raw

Re: [PATCH v7 1/2] dt-bindings: clk: microchip: Add Microchip PolarFire host binding

Quoted 5 lines · On Wed, 15 Dec 2021 08:30:01 +0000, [email protected] wrote:

From: Daire McNamara <[email protected]>

Add device tree bindings for the Microchip PolarFire system clock controller

Quoted 9 lines
---
 .../bindings/clock/microchip,mpfs.yaml        | 61 +++++++++++++++++++
 .../dt-bindings/clock/microchip,mpfs-clock.h  | 45 ++++++++++++++
 2 files changed, 106 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/microchip,mpfs.yaml
 create mode 100644 include/dt-bindings/clock/microchip,mpfs-clock.h
Reviewed-by on v7 1/2
#3 lore raw

Re: [PATCH v7 1/2] dt-bindings: clk: microchip: Add Microchip PolarFire host binding

In reply to [email protected]

Hi Conor,

Quoted 7 lines · On Wed, Dec 15, 2021 at 9:29 AM <[email protected]> wrote:

From: Daire McNamara <[email protected]>

Add device tree bindings for the Microchip PolarFire system clock controller

Thanks for the update!

Please add tags given to v6 (after fixing below):

Documentation/devicetree/bindings/clock/microchip,mpfs.yaml line 38

Quoted 5 lines
Documentation/devicetree/bindings/clock/microchip,mpfs.yaml new file +2 -0
 
+  clock-output-names:
+    maxItems: 33

Whoops, why has this re-appeared? Please drop it again.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#4 lore raw

PATCH v7 2/2 clk: microchip: Add driver for Microchip PolarFire SoC

In reply to [email protected]

From: Daire McNamara <[email protected]>

Add support for clock configuration on Microchip PolarFire SoC

---
 drivers/clk/Kconfig              |   1 +
 drivers/clk/Makefile             |   2 +-
 drivers/clk/microchip/Kconfig    |   7 +
 drivers/clk/microchip/Makefile   |   6 +-
 drivers/clk/microchip/clk-mpfs.c | 447 +++++++++++++++++++++++++++++++
 5 files changed, 460 insertions(+), 3 deletions(-)
 create mode 100644 drivers/clk/microchip/Kconfig
 create mode 100644 drivers/clk/microchip/clk-mpfs.c
drivers/clk/Kconfig +1 -0
index 1b992a554ff8..fe6c757e44fb 100644
@@ -409,6 +409,7 @@ source "drivers/clk/keystone/Kconfig"
 source "drivers/clk/mediatek/Kconfig"
 source "drivers/clk/meson/Kconfig"
 source "drivers/clk/mstar/Kconfig"
+source "drivers/clk/microchip/Kconfig"
 source "drivers/clk/mvebu/Kconfig"
 source "drivers/clk/pistachio/Kconfig"
 source "drivers/clk/qcom/Kconfig"
drivers/clk/Makefile +1 -1
index d8565ef01b34..d4e43d0431a3 100644
@@ -90,7 +90,7 @@ obj-$(CONFIG_ARCH_KEYSTONE)		+= keystone/
 obj-$(CONFIG_MACH_LOONGSON32)		+= loongson1/
 obj-y					+= mediatek/
 obj-$(CONFIG_ARCH_MESON)		+= meson/
-obj-$(CONFIG_MACH_PIC32)		+= microchip/
+obj-y					+= microchip/
 ifeq ($(CONFIG_COMMON_CLK), y)
 obj-$(CONFIG_ARCH_MMP)			+= mmp/
 endif
drivers/clk/microchip/Kconfig new file +7 -0
new file mode 100644
index 000000000000..f5edc7b3c07c
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+
+config MCHP_CLK_MPFS
+	bool "Clk driver for PolarFire SoC"
+	depends on (RISCV && SOC_MICROCHIP_POLARFIRE) || COMPILE_TEST
+	help
+	  Supports Clock Configuration for PolarFire SoC
drivers/clk/microchip/Makefile +4 -2
index f34b247e870f..0dce0b12eac4 100644
@@ -1,3 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_COMMON_CLK_PIC32) += clk-core.o
-obj-$(CONFIG_PIC32MZDA) += clk-pic32mzda.o
+
+obj-$(CONFIG_COMMON_CLK_PIC32)	+= clk-core.o
+obj-$(CONFIG_PIC32MZDA)		+= clk-pic32mzda.o
+obj-$(CONFIG_MCHP_CLK_MPFS)	+= clk-mpfs.o
drivers/clk/microchip/clk-mpfs.c new file +447 -0

447 lines not on this page · raw message

Signature · 1 line
2.33.1