Add NPCM8XX clock driver
Subsystems (4)
Tomer Maimon
maintainerv2 cover Add NPCM8XX clock driver
This patchset adds clock support for the Nuvoton Arbel NPCM8XX Board Management controller (BMC) SoC family.
The NPCM8xx clock controller is created using the auxiliary device framework and set up in the npcm reset driver since the NPCM8xx clock is using the same register region.
This patchset based on NPCM8xx clock controller V27
https://patchwork.kernel.org/project/linux-clk/cover/[email protected]/
This patchset was tested on the Arbel NPCM8XX evaluation board.
Changes since version 1:
- Align with NPCM8xx clock controller V27.
- Remove patches that are not in the clock patchset.
Tomer Maimon (3):
dt-bindings: reset: npcm: add clock properties
reset: npcm: register npcm8xx clock auxiliary bus device
clk: npcm8xx: add clock controller
.../bindings/reset/nuvoton,npcm750-reset.yaml | 18 + drivers/clk/Kconfig | 8 + drivers/clk/Makefile | 1 + drivers/clk/clk-npcm8xx.c | 430 ++++++++++++++++++ drivers/reset/Kconfig | 1 + drivers/reset/reset-npcm.c | 74 ++- include/soc/nuvoton/clock-npcm8xx.h | 16 + 7 files changed, 547 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/clk-npcm8xx.c create mode 100644 include/soc/nuvoton/clock-npcm8xx.h
Signature · 1 line
2.34.1
Tomer Maimon
maintainerPATCH v2 1/3 dt-bindings: reset: npcm: add clock properties
This commit adds a 25MHz reference clock and clock-cell properties to the NPCM reset document. The addition is necessitated by the integration of the NPCM8xx clock auxiliary bus device into the NPCM reset driver.
The inclusion of the NPCM8xx clock properties in the reset document is crucial as the reset block also serves as a clock provider for the NPCM8xx clock. This enhancement is intended to facilitate the use of the NPCM8xx clock driver.
--- .../bindings/reset/nuvoton,npcm750-reset.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
Documentation/devicetree/bindings/reset/nuvoton,npcm750-reset.yaml +18 -0
@@ -21,6 +21,13 @@ properties: '#reset-cells': const: 2 + '#clock-cells': + const: 1 + + clocks: + items: + - description: specify external 25MHz reference clock. + nuvoton,sysgcr: $ref: /schemas/types.yaml#/definitions/phandle description: a phandle to access GCR registers.
@@ -39,6 +46,17 @@ required: - '#reset-cells' - nuvoton,sysgcr +if: + properties: + compatible: + contains: + enum: + - nuvoton,npcm845-reset +then: + required: + - '#clock-cells' + - clocks + additionalProperties: false examples:
Signature · 1 line
2.34.1
Tomer Maimon
maintainerPATCH v2 2/3 reset: npcm: register npcm8xx clock auxiliary bus device
In reply to Tomer MaimonAdd NPCM8xx clock controller auxiliary bus device registration.
The NPCM8xx clock controller is registered as an aux device because the reset and the clock controller share the same register region.
--- drivers/reset/Kconfig | 1 + drivers/reset/reset-npcm.c | 74 ++++++++++++++++++++++++++++- include/soc/nuvoton/clock-npcm8xx.h | 16 +++++++ 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 include/soc/nuvoton/clock-npcm8xx.h
drivers/reset/Kconfig +1 -0
@@ -139,6 +139,7 @@ config RESET_MESON_AUDIO_ARB config RESET_NPCM bool "NPCM BMC Reset Driver" if COMPILE_TEST default ARCH_NPCM + select AUXILIARY_BUS help This enables the reset controller driver for Nuvoton NPCM BMC SoCs.
drivers/reset/reset-npcm.c +73 -1
115 lines not on this page · raw message
include/soc/nuvoton/clock-npcm8xx.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __SOC_NPCM8XX_CLOCK_H +#define __SOC_NPCM8XX_CLOCK_H + +#include <linux/auxiliary_bus.h> +#include <linux/container_of.h> + +struct npcm_clock_adev { +void __iomem *base; +struct auxiliary_device adev; +}; + +#define to_npcm_clock_adev (_adev) \ + container_of((_adev), struct npcm_clock_adev, adev) + +#endif
Signature · 1 line
2.34.1
Tomer Maimon
maintainerPATCH v2 3/3 clk: npcm8xx: add clock controller
In reply to Tomer MaimonAdd auxiliary driver to support Nuvoton Arbel BMC NPCM8XX contains an integrated clock controller which generates and supplies clocks to all modules within the BMC.
The NPCM8xx clock controller is created using the auxiliary device framework and set up in the npcm reset driver since the NPCM8xx clock is using the same register region.
--- drivers/clk/Kconfig | 8 + drivers/clk/Makefile | 1 + drivers/clk/clk-npcm8xx.c | 430 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 439 insertions(+) create mode 100644 drivers/clk/clk-npcm8xx.c
drivers/clk/Kconfig +8 -0
@@ -325,6 +325,14 @@ config COMMON_CLK_LOCHNAGAR This driver supports the clocking features of the Cirrus Logic Lochnagar audio development board. +config COMMON_CLK_NPCM8XX + tristate "Clock driver for the NPCM8XX SoC Family" + depends on ARCH_NPCM || COMPILE_TEST + help + This driver supports the clocks on the Nuvoton BMC NPCM8XX SoC Family, + all the clocks are initialized by the bootloader, so this driver + allows only reading of current settings directly from the hardware. + config COMMON_CLK_LOONGSON2 bool "Clock driver for Loongson-2 SoC" depends on LOONGARCH || COMPILE_TEST
drivers/clk/Makefile +1 -0
@@ -51,6 +51,7 @@ obj-$(CONFIG_ARCH_MILBEAUT_M10V) += clk-milbeaut.o obj-$(CONFIG_ARCH_MOXART) += clk-moxart.o obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o obj-$(CONFIG_ARCH_NPCM7XX) += clk-npcm7xx.o +obj-$(CONFIG_COMMON_CLK_NPCM8XX) += clk-npcm8xx.o obj-$(CONFIG_ARCH_NSPIRE) += clk-nspire.o obj-$(CONFIG_COMMON_CLK_PALMAS) += clk-palmas.o obj-$(CONFIG_CLK_LS1028A_PLLDIG) += clk-plldig.o
drivers/clk/clk-npcm8xx.c new file +430 -0
430 lines not on this page · raw message
Signature · 1 line
2.34.1
Andrew Jeffery
maintainerRe: [linux dev-6.6 v2 3/3] clk: npcm8xx: add clock controller
Quoted 10 lines · Tomer Maimon
Add auxiliary driver to support Nuvoton Arbel BMC NPCM8XX contains an integrated clock controller which generates and supplies clocks to all modules within the BMC.
The NPCM8xx clock controller is created using the auxiliary device framework and set up in the npcm reset driver since the NPCM8xx clock is using the same register region.
Signed-off-by Tomer Maimon <[email protected]>Tested-by Benjamin Fair <[email protected]>
Just a note that this patch generates a bunch of checkpatch warnings. Is this something you've considered? I ask because it's best to try remove all reasons for Stephen not to apply your series...
Andrew
Tomer Maimon
maintainerRe: [linux dev-6.6 v2 3/3] clk: npcm8xx: add clock controller
Hi Andrew,
Thanks for your comment, It sure is worth trying, I will send it to the clock maintainer once you get NPCM8xx clock V3 and confirm it.
it is weird, it looks like the format-patch creates these trailing whitespace errors, I don't see whitespace in the code, so I needed to fix it manually in the patch.
What can cause adding trailing whitespace when generating patches?
Thanks,
Tomer
Quoted 18 lines · Andrew Jeffery
Quoted 10 lines · Tomer Maimon
Add auxiliary driver to support Nuvoton Arbel BMC NPCM8XX contains an integrated clock controller which generates and supplies clocks to all modules within the BMC.
The NPCM8xx clock controller is created using the auxiliary device framework and set up in the npcm reset driver since the NPCM8xx clock is using the same register region.
Signed-off-by Tomer Maimon <[email protected]>Tested-by Benjamin Fair <[email protected]>Just a note that this patch generates a bunch of checkpatch warnings. Is this something you've considered? I ask because it's best to try remove all reasons for Stephen not to apply your series...
Andrew