Skip to contentSkip to conversation

clk: add driver for the SiFive FU540 PRCI and PLLs it controls

PATCH Applied Paul Walmsley 2 participants 5 messages Apr 30, 2019 – May 2, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v4 cover clk: add driver for the SiFive FU540 PRCI and PLLs it controls

clk: add driver for the SiFive FU540 PRCI and PLLs it controls

Add a driver for the SiFive FU540 PRCI IP block, which handles clock and some device reset control for the SiFive FU540 chip. Also add a driver- independent library for the Analog Bits Wide-Range PLL (WRPLL), used by the PRCI driver to monitor and control the WRPLL instances on the FU540 chip.

This fourth version incorporates changes requested by Stephen Boyd <[email protected]>. The DT bindings patch has been dropped since Stephen has already queued it.

This patch series is also available, with the binding documentation patch, at:

https://github.com/sifive/riscv-linux/tree/dev/paulw/prci-v5.1-rc7

Boot-tested on a SiFive HiFive Unleashed board, using BBL and the open-source FSBL with a mainline-focused DTB, using the following composite test branch:

https://github.com/sifive/riscv-linux/tree/dev/paulw/dts-v5.1-rc7-experimental

- Paul

Paul Walmsley (2):
clk: analogbits: add Wide-Range PLL library
clk: sifive: add a driver for the SiFive FU540 PRCI IP block

 MAINTAINERS                                   |   6 +
 drivers/clk/Kconfig                           |   3 +
 drivers/clk/Makefile                          |   2 +
 drivers/clk/analogbits/Kconfig                |   2 +
 drivers/clk/analogbits/Makefile               |   3 +
 drivers/clk/analogbits/wrpll-cln28hpc.c       | 364 ++++++++++
 drivers/clk/sifive/Kconfig                    |  18 +
 drivers/clk/sifive/Makefile                   |   1 +
 drivers/clk/sifive/fu540-prci.c               | 630 ++++++++++++++++++
 include/linux/clk/analogbits-wrpll-cln28hpc.h |  79 +++
 10 files changed, 1108 insertions(+)
 create mode 100644 drivers/clk/analogbits/Kconfig
 create mode 100644 drivers/clk/analogbits/Makefile
 create mode 100644 drivers/clk/analogbits/wrpll-cln28hpc.c
 create mode 100644 drivers/clk/sifive/Kconfig
 create mode 100644 drivers/clk/sifive/Makefile
 create mode 100644 drivers/clk/sifive/fu540-prci.c
 create mode 100644 include/linux/clk/analogbits-wrpll-cln28hpc.h
Signature · 1 line
2.20.1
#1 lore raw

PATCH v4 1/2 clk: analogbits: add Wide-Range PLL library

Add common library code for the Analog Bits Wide-Range PLL (WRPLL) IP block, as implemented in TSMC CLN28HPC.

There is no bus interface or register target associated with this PLL. This library is intended to be used by drivers for IP blocks that expose registers connected to the PLL configuration and status signals.

Based on code originally written by Wesley Terpstra <[email protected]>:
https://github.com/riscv/riscv-linux/commit/999529edf517ed75b56659d456d221b2ee56bb60

This version incorporates several changes requested by Stephen Boyd <[email protected]>.

Cc Wesley Terpstra <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Megan Wachs <[email protected]>
---
 MAINTAINERS                                   |   6 +
 drivers/clk/Kconfig                           |   2 +
 drivers/clk/Makefile                          |   1 +
 drivers/clk/analogbits/Kconfig                |   2 +
 drivers/clk/analogbits/Makefile               |   3 +
 drivers/clk/analogbits/wrpll-cln28hpc.c       | 364 ++++++++++++++++++
 include/linux/clk/analogbits-wrpll-cln28hpc.h |  79 ++++
 7 files changed, 457 insertions(+)
 create mode 100644 drivers/clk/analogbits/Kconfig
 create mode 100644 drivers/clk/analogbits/Makefile
 create mode 100644 drivers/clk/analogbits/wrpll-cln28hpc.c
 create mode 100644 include/linux/clk/analogbits-wrpll-cln28hpc.h
MAINTAINERS +6 -0
index 5c38f21aee78..a8abcc960839 100644
@@ -960,6 +960,12 @@ F:	drivers/iio/adc/ltc2497*
 X:	drivers/iio/*/adjd*
 F:	drivers/staging/iio/*/ad*
 
+ANALOGBITS PLL LIBRARIES
+M:	Paul Walmsley <[email protected]>
+S:	Supported
+F:	drivers/clk/analogbits/*
+F:	include/linux/clk/analogbits*
+
 ANDES ARCHITECTURE
 M:	Greentime Hu <[email protected]>
 M:	Vincent Chen <[email protected]>
drivers/clk/Kconfig +2 -0
index e705aab9e38b..8a0e77f791ab 100644
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
 
 config CLKDEV_LOOKUP
 	bool
@@ -297,6 +298,7 @@ config COMMON_CLK_FIXED_MMIO
 	  Support for Memory Mapped IO Fixed clocks
 
 source "drivers/clk/actions/Kconfig"
+source "drivers/clk/analogbits/Kconfig"
 source "drivers/clk/bcm/Kconfig"
 source "drivers/clk/hisilicon/Kconfig"
 source "drivers/clk/imgtec/Kconfig"
drivers/clk/Makefile +1 -0
index 1db133652f0c..091ee1d8af65 100644
@@ -64,6 +64,7 @@ obj-$(CONFIG_COMMON_CLK_XGENE)		+= clk-xgene.o
 
 # please keep this section sorted lexicographically by directory path name
 obj-y					+= actions/
+obj-y					+= analogbits/
 obj-$(CONFIG_COMMON_CLK_AT91)		+= at91/
 obj-$(CONFIG_ARCH_ARTPEC)		+= axis/
 obj-$(CONFIG_ARC_PLAT_AXS10X)		+= axs10x/
drivers/clk/analogbits/Kconfig new file +2 -0
new file mode 100644
index 000000000000..b5fd60c7f136
@@ -0,0 +1,2 @@
+config CLK_ANALOGBITS_WRPLL_CLN28HPC
+	bool
drivers/clk/analogbits/Makefile new file +3 -0
new file mode 100644
index 000000000000..bf017447451e
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_CLK_ANALOGBITS_WRPLL_CLN28HPC)	+= wrpll-cln28hpc.o
drivers/clk/analogbits/wrpll-cln28hpc.c new file +364 -0

364 lines not on this page · raw message

include/linux/clk/analogbits-wrpll-cln28hpc.h new file +79 -0

79 lines not on this page · raw message

Signature · 1 line
2.20.1
maintainer Applied
#2 lore raw

Re: [PATCH v4 1/2] clk: analogbits: add Wide-Range PLL library

Quoting Paul Walmsley (2019-04-30 13:50:58)

Quoted 24 lines

Add common library code for the Analog Bits Wide-Range PLL (WRPLL) IP block, as implemented in TSMC CLN28HPC.

There is no bus interface or register target associated with this PLL. This library is intended to be used by drivers for IP blocks that expose registers connected to the PLL configuration and status signals.

Based on code originally written by Wesley Terpstra <[email protected]>:
https://github.com/riscv/riscv-linux/commit/999529edf517ed75b56659d456d221b2ee56bb60

This version incorporates several changes requested by Stephen Boyd <[email protected]>.

Cc Wesley Terpstra <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Megan Wachs <[email protected]>
Quoted 1 line

---

Applied to clk-next

#3 lore raw

PATCH v4 2/2 clk: sifive: add a driver for the SiFive FU540 PRCI IP block

In reply to Paul Walmsley

Add driver code for the SiFive FU540 PRCI IP block. This IP block handles reset and clock control for the SiFive FU540 device and implements SoC-level clock tree controls and dividers.

Based on code written by Wesley Terpstra <[email protected]>:
https://github.com/riscv/riscv-linux/commit/999529edf517ed75b56659d456d221b2ee56bb60

Boot and PLL rate change were tested on a SiFive HiFive Unleashed board.

This version includes several changes requested by Stephen Boyd <[email protected]>.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Albert Ou <[email protected]>
Cc Wesley W. Terpstra <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Megan Wachs <[email protected]>
---
 drivers/clk/Kconfig             |   1 +
 drivers/clk/Makefile            |   1 +
 drivers/clk/sifive/Kconfig      |  18 +
 drivers/clk/sifive/Makefile     |   1 +
 drivers/clk/sifive/fu540-prci.c | 630 ++++++++++++++++++++++++++++++++
 5 files changed, 651 insertions(+)
 create mode 100644 drivers/clk/sifive/Kconfig
 create mode 100644 drivers/clk/sifive/Makefile
 create mode 100644 drivers/clk/sifive/fu540-prci.c
drivers/clk/Kconfig +1 -0
index 8a0e77f791ab..420e80508ddc 100644
@@ -311,6 +311,7 @@ source "drivers/clk/mvebu/Kconfig"
 source "drivers/clk/qcom/Kconfig"
 source "drivers/clk/renesas/Kconfig"
 source "drivers/clk/samsung/Kconfig"
+source "drivers/clk/sifive/Kconfig"
 source "drivers/clk/sprd/Kconfig"
 source "drivers/clk/sunxi-ng/Kconfig"
 source "drivers/clk/tegra/Kconfig"
drivers/clk/Makefile +1 -0
index 091ee1d8af65..5173a5ae1069 100644
@@ -94,6 +94,7 @@ obj-$(CONFIG_COMMON_CLK_QCOM)		+= qcom/
 obj-y					+= renesas/
 obj-$(CONFIG_ARCH_ROCKCHIP)		+= rockchip/
 obj-$(CONFIG_COMMON_CLK_SAMSUNG)	+= samsung/
+obj-y					+= sifive/
 obj-$(CONFIG_ARCH_SIRF)			+= sirf/
 obj-$(CONFIG_ARCH_SOCFPGA)		+= socfpga/
 obj-$(CONFIG_PLAT_SPEAR)		+= spear/
drivers/clk/sifive/Kconfig new file +18 -0
new file mode 100644
index 000000000000..8db4a3eb4782
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: GPL-2.0
+
+menuconfig CLK_SIFIVE
+	bool "SiFive SoC driver support"
+	help
+	  SoC drivers for SiFive Linux-capable SoCs.
+
+if CLK_SIFIVE
+
+config CLK_SIFIVE_FU540_PRCI
+	bool "PRCI driver for SiFive FU540 SoCs"
+	select CLK_ANALOGBITS_WRPLL_CLN28HPC
+	help
+	  Supports the Power Reset Clock interface (PRCI) IP block found in
+	  FU540 SoCs.  If this kernel is meant to run on a SiFive FU540 SoC,
+	  enable this driver.
+
+endif
drivers/clk/sifive/Makefile new file +1 -0
new file mode 100644
index 000000000000..74d58a4c0756
@@ -0,0 +1 @@
+obj-$(CONFIG_CLK_SIFIVE_FU540_PRCI)	+= fu540-prci.o
drivers/clk/sifive/fu540-prci.c new file +630 -0

630 lines not on this page · raw message

Signature · 1 line
2.20.1
maintainer Applied
#4 lore raw

Re: [PATCH v4 2/2] clk: sifive: add a driver for the SiFive FU540 PRCI IP block

Quoting Paul Walmsley (2019-04-30 13:51:00)

Quoted 24 lines

Add driver code for the SiFive FU540 PRCI IP block. This IP block handles reset and clock control for the SiFive FU540 device and implements SoC-level clock tree controls and dividers.

Based on code written by Wesley Terpstra <[email protected]>:
https://github.com/riscv/riscv-linux/commit/999529edf517ed75b56659d456d221b2ee56bb60

Boot and PLL rate change were tested on a SiFive HiFive Unleashed board.

This version includes several changes requested by Stephen Boyd <[email protected]>.

Cc Michael Turquette <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Albert Ou <[email protected]>
Cc Wesley W. Terpstra <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Megan Wachs <[email protected]>
Quoted 1 line

---

Applied to clk-next