Unverified Commit c6ca7616 authored by Damien Le Moal's avatar Damien Le Moal Committed by Palmer Dabbelt
Browse files

clk: Add RISC-V Canaan Kendryte K210 clock driver



Add a clock provider driver for the Canaan Kendryte K210 RISC-V SoC.
This new driver with the compatible string "canaan,k210-clk" implements
support for the full clock structure of the K210 SoC. Since it is
required for the correct operation of the SoC, this driver is
selected by default for compilation when the SOC_CANAAN option is
selected.

With this change, the k210-sysctl driver is turned into a simple
platform driver which enables its power bus clock and triggers
populating its child nodes. The sysctl driver retains the SOC early
initialization code, but the implementation now relies on the new
function k210_clk_early_init() provided by the new clk-k210 driver.

The clock structure implemented and many of the coding ideas for the
driver come from the work by Sean Anderson on the K210 support for the
U-Boot project.

Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: default avatarStephen Boyd <sboyd@kernel.org>
Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
parent 4bb87563
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -368,6 +368,13 @@ config COMMON_CLK_FIXED_MMIO
	help
	  Support for Memory Mapped IO Fixed clocks

config COMMON_CLK_K210
	bool "Clock driver for the Canaan Kendryte K210 SoC"
	depends on OF && RISCV && SOC_CANAAN
	default SOC_CANAAN
	help
	  Support for the Canaan Kendryte K210 RISC-V SoC clocks.

source "drivers/clk/actions/Kconfig"
source "drivers/clk/analogbits/Kconfig"
source "drivers/clk/baikal-t1/Kconfig"
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ obj-$(CONFIG_COMMON_CLK_ASPEED) += clk-aspeed.o
obj-$(CONFIG_MACH_ASPEED_G6)		+= clk-ast2600.o
obj-$(CONFIG_ARCH_HIGHBANK)		+= clk-highbank.o
obj-$(CONFIG_CLK_HSDK)			+= clk-hsdk-pll.o
obj-$(CONFIG_COMMON_CLK_K210)		+= clk-k210.o
obj-$(CONFIG_COMMON_CLK_LOCHNAGAR)	+= clk-lochnagar.o
obj-$(CONFIG_COMMON_CLK_MAX77686)	+= clk-max77686.o
obj-$(CONFIG_COMMON_CLK_MAX9485)	+= clk-max9485.o

drivers/clk/clk-k210.c

0 → 100644
+1007 −0

File added.

Preview size limit exceeded, changes collapsed.

+8 −10
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0

if SOC_CANAAN

config K210_SYSCTL
config SOC_K210_SYSCTL
	bool "Canaan Kendryte K210 SoC system controller"
	default y
	depends on RISCV
	depends on RISCV && SOC_CANAAN && OF
	default SOC_CANAAN
        select PM
        select SIMPLE_PM_BUS
        select SYSCON
        select MFD_SYSCON
	help
	  Enables controlling the K210 various clocks and to enable
	  general purpose use of the extra 2MB of SRAM normally
	  reserved for the AI engine.

endif
	  Canaan Kendryte K210 SoC system controller driver.
+1 −1
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0

obj-$(CONFIG_K210_SYSCTL)	+= k210-sysctl.o
obj-$(CONFIG_SOC_K210_SYSCTL)	+= k210-sysctl.o
Loading