Zong Li
5e916932df
clk: sifive: Move all stuff into SoCs header files from C files
...
Improve PRCI driver to reduce the complexity, we remove the SoCs C files
by putting all stuff in each SoCs header files, and include these
SoCs-specific header files in core of PRCI. It can also avoid the W=1
kernel build warnings about variable defined but not used
[-Wunused-const-variable=], like commit 487dc7bb6a ("clk: sifive:
fu540-prci: Declare static const variable 'prci_clk_fu540' where it's
used") does.
Signed-off-by: Zong Li <[email protected] >
Suggested-by: Lee Jones <[email protected] >
Reviewed-by: Lee Jones <[email protected] >
Acked-by: Palmer Dabbelt <[email protected] >
Link: https://lore.kernel.org/r/a3c7ec5c46c1d8be455d1c347db4855bb56cec53.1646388139.git.zong.li@sifive.com
Signed-off-by: Stephen Boyd <[email protected] >
2022-03-15 15:56:28 -07:00
Zong Li
24a4a29f75
clk: sifive: Add SoCs prefix in each SoCs-dependent data
...
This patch is prerequisite for moving SoCs C files into SoCs header
files. Currently, fu540-prci.c and fu740-prci.c use same names for
several macro definitions and variables, it would cause redefinition
error when we trying to include all stuff in sifive-prci.c. In this
patch, we also remove the temporary macro definitions which are
added by previous patch.
Signed-off-by: Zong Li <[email protected] >
Acked-by: Palmer Dabbelt <[email protected] >
Link: https://lore.kernel.org/r/7728ef662c59449ce954b1b62c6ad5241e07adfb.1646388139.git.zong.li@sifive.com
Signed-off-by: Stephen Boyd <[email protected] >
2022-03-15 15:56:28 -07:00
Zong Li
e83da8e2a1
clk: sifive: duplicate the macro definitions for the time being
...
This is a temporary patch in whole patch set. We are going to change the
macro name in dt-binding, in order to avoid breaking the driver build
and git bisect, add these macro definitions for the time being, and we
will remove them later.
Signed-off-by: Zong Li <[email protected] >
Link: https://lore.kernel.org/r/8cfd57f01cfb59adb716eb13ca0c8250c246dcb2.1646388139.git.zong.li@sifive.com
Signed-off-by: Stephen Boyd <[email protected] >
2022-03-15 15:56:28 -07:00
Yang Li
c37f1cdd1f
clk: sifive: Fix kernel-doc
...
Fix function name in sifive-prci.c kernel-doc comment
to remove a warning.
drivers/clk/sifive/sifive-prci.c:573: warning: expecting prototype for
sifive_prci_init(). Prototype was for sifive_prci_probe() instead
Reported-by: Abaci Robot <[email protected] >
Signed-off-by: Yang Li <[email protected] >
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Palmer Dabbelt <[email protected] >
Acked-by: Palmer Dabbelt <[email protected] >
Signed-off-by: Stephen Boyd <[email protected] >
2021-06-01 23:39:15 -07:00
Greentime Hu
e4d368e0b6
clk: sifive: Use reset-simple in prci driver for PCIe driver
...
We use reset-simple in this patch so that pcie driver can use
devm_reset_control_get() to get this reset data structure and use
reset_control_deassert() to deassert pcie_power_up_rst_n.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greentime Hu <[email protected] >
Signed-off-by: Lorenzo Pieralisi <[email protected] >
Reviewed-by: Philipp Zabel <[email protected] >
Acked-by: Stephen Boyd <[email protected] >
2021-05-04 12:26:09 +01:00
Greentime Hu
c61287bf17
clk: sifive: Add pcie_aux clock in prci driver for PCIe driver
...
We add pcie_aux clock in this patch so that pcie driver can use
clk_prepare_enable() and clk_disable_unprepare() to enable and disable
pcie_aux clock.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greentime Hu <[email protected] >
Signed-off-by: Lorenzo Pieralisi <[email protected] >
Acked-by: Stephen Boyd <[email protected] >
2021-05-04 12:26:09 +01:00
Lee Jones
487dc7bb6a
clk: sifive: fu540-prci: Declare static const variable 'prci_clk_fu540' where it's used
...
Fixes the following W=1 kernel build warning(s):
drivers/clk/sifive/fu540-prci.h:16:35: warning: ‘prci_clk_fu540’ defined but not used [-Wunused-const-variable=]
drivers/clk/sifive/fu540-prci.h:16:35: warning: ‘prci_clk_fu540’ defined but not used [-Wunused-const-variable=]
Cc: Michael Turquette <[email protected] >
Cc: Stephen Boyd <[email protected] >
Cc: Paul Walmsley <[email protected] >
Cc: Palmer Dabbelt <[email protected] >
Cc: Pragnesh Patel <[email protected] >
Cc: Zong Li <[email protected] >
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Lee Jones <[email protected] >
Link: https://lore.kernel.org/r/[email protected]
Acked-by: Palmer Dabbelt <[email protected] >
Signed-off-by: Stephen Boyd <[email protected] >
2021-02-11 11:56:06 -08:00
Pragnesh Patel
732374a0b4
clk: sifive: Add clock enable and disable ops
...
Add new functions "sifive_prci_clock_enable(), sifive_prci_clock_disable()
and sifive_clk_is_enabled()" to enable or disable the PRCI clock
Signed-off-by: Pragnesh Patel <[email protected] >
Tested-by: Zong Li <[email protected] >
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Stephen Boyd <[email protected] >
2020-12-16 12:23:13 -08:00
Zong Li
263ac39085
clk: sifive: Fix the wrong bit field shift
...
The clk enable bit should be 31 instead of 24.
Signed-off-by: Zong Li <[email protected] >
Reported-by: Pragnesh Patel <[email protected] >
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Stephen Boyd <[email protected] >
2020-12-16 12:23:12 -08:00
Zong Li
efc91ae43c
clk: sifive: Add a driver for the SiFive FU740 PRCI IP block
...
Add driver code for the SiFive FU740 PRCI IP block. This IP block
handles reset and clock control for the SiFive FU740 device and
implements SoC-level clock tree controls and dividers.
The link of unmatched as follow, and the U740-C000 manual would
be present in the same page as soon.
https://www.sifive.com/boards/hifive-unmatched
This driver contains bug fixes and contributions from
Henry Styles <[email protected] >
Erik Danie <[email protected] >
Pragnesh Patel <[email protected] >
Signed-off-by: Zong Li <[email protected] >
Reviewed-by: Pragnesh Patel <[email protected] >
Acked-by: Palmer Dabbelt <[email protected] >
Cc: Henry Styles <[email protected] >
Cc: Erik Danie <[email protected] >
Cc: Pragnesh Patel <[email protected] >
Link: https://lore.kernel.org/r/[email protected]
[[email protected] : Include header to silence sparse]
Signed-off-by: Stephen Boyd <[email protected] >
2020-12-16 12:22:59 -08:00
Zong Li
28108fc8a0
clk: sifive: Use common name for prci configuration
...
Use generic name CLK_SIFIVE_PRCI instead of CLK_SIFIVE_FU540_PRCI. This
patch is prepared for fu740 support.
Signed-off-by: Zong Li <[email protected] >
Reviewed-by: Palmer Dabbelt <[email protected] >
Acked-by: Palmer Dabbelt <[email protected] >
Reviewed-by: Pragnesh Patel <[email protected] >
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Stephen Boyd <[email protected] >
2020-12-16 12:22:59 -08:00
Zong Li
c816e1ddf2
clk: sifive: Extract prci core to common base
...
Extract common core of prci driver to an independent file, it could
allow other chips to reuse it. Separate SoCs-dependent code 'fu540'
from prci core, then we can easily add 'fu740' later.
Almost these changes are code movement. The different is adding the
private data for each SoC use, so it needs to get match data in probe
callback function, then use the data for initialization.
Signed-off-by: Zong Li <[email protected] >
Reviewed-by: Pragnesh Patel <[email protected] >
Acked-by: Palmer Dabbelt <[email protected] >
Link: https://lore.kernel.org/r/[email protected]
[[email protected] : Include header to silence sparse]
Signed-off-by: Stephen Boyd <[email protected] >
2020-12-16 12:22:39 -08:00
Vincent Chen
d0a5fdf4cc
clk: sifive: allocate sufficient memory for struct __prci_data
...
The (struct __prci_data).hw_clks.hws is an array with dynamic elements.
Using struct_size(pd, hw_clks.hws, ARRAY_SIZE(__prci_init_clocks))
instead of sizeof(*pd) to get the correct memory size of
struct __prci_data for sifive/fu540-prci. After applying this
modifications, the kernel runs smoothly with CONFIG_SLAB_FREELIST_RANDOM
enabled on the HiFive unleashed board.
Fixes: 30b8e27e3b ("clk: sifive: add a driver for the SiFive FU540 PRCI IP block")
Signed-off-by: Vincent Chen <[email protected] >
Signed-off-by: Palmer Dabbelt <[email protected] >
2020-06-25 15:04:13 -07:00
Linus Torvalds
20f9449656
Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
...
Pull clk driver fixes from Stephen Boyd:
- Don't expose the SiFive clk driver on non-RISCV architectures
- Fix some bits describing clks in the imx8mm driver
- Always call clk domain code in the TI driver so non-legacy platforms
work
* tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
clk: ti: clkctrl: Fix clkdm_clk handling
clk: imx: imx8mm: fix int pll clk gate
clk: sifive: restrict Kconfig scope for the FU540 PRCI driver
2019-05-30 16:33:37 -07:00
Paul Walmsley
f7df8c92b4
clk: sifive: restrict Kconfig scope for the FU540 PRCI driver
...
Restrict Kconfig scope for SiFive clock and reset IP block drivers
such that they won't appear on most configurations that are unlikely
to support them. This is based on a suggestion from Pavel Machek
<[email protected] >. Ideally this should be dependent on
CONFIG_ARCH_SIFIVE, but since that Kconfig directive does not yet
exist, add dependencies on RISCV or COMPILE_TEST for now.
Signed-off-by: Paul Walmsley <[email protected] >
Signed-off-by: Paul Walmsley <[email protected] >
Reported-by: Pavel Machek <[email protected] >
Cc: Michael Turquette <[email protected] >
Acked-by: Pavel Machek <[email protected] >
Signed-off-by: Stephen Boyd <[email protected] >
2019-05-21 11:34:45 -07:00
Thomas Gleixner
ec8f24b7fa
treewide: Add SPDX license identifier - Makefile/Kconfig
...
Add SPDX license identifiers to all Make/Kconfig files which:
- Have no license information of any form
These files fall under the project license, GPL v2 only. The resulting SPDX
license identifier is:
GPL-2.0-only
Signed-off-by: Thomas Gleixner <[email protected] >
Signed-off-by: Greg Kroah-Hartman <[email protected] >
2019-05-21 10:50:46 +02:00
Stephen Boyd
62e59c4e69
clk: Remove io.h from clk-provider.h
...
Now that we've gotten rid of clk_readl() we can remove io.h from the
clk-provider header and push out the io.h include to any code that isn't
already including the io.h header but using things like readl/writel,
etc.
Found with this grep:
git grep -l clk-provider.h | grep '.c$' | xargs git grep -L 'linux/io.h' | \
xargs git grep -l \
-e '\<__iowrite32_copy\>' --or \
-e '\<__ioread32_copy\>' --or \
-e '\<__iowrite64_copy\>' --or \
-e '\<ioremap_page_range\>' --or \
-e '\<ioremap_huge_init\>' --or \
-e '\<arch_ioremap_pud_supported\>' --or \
-e '\<arch_ioremap_pmd_supported\>' --or \
-e '\<devm_ioport_map\>' --or \
-e '\<devm_ioport_unmap\>' --or \
-e '\<IOMEM_ERR_PTR\>' --or \
-e '\<devm_ioremap\>' --or \
-e '\<devm_ioremap_nocache\>' --or \
-e '\<devm_ioremap_wc\>' --or \
-e '\<devm_iounmap\>' --or \
-e '\<devm_ioremap_release\>' --or \
-e '\<devm_memremap\>' --or \
-e '\<devm_memunmap\>' --or \
-e '\<__devm_memremap_pages\>' --or \
-e '\<pci_remap_cfgspace\>' --or \
-e '\<arch_has_dev_port\>' --or \
-e '\<arch_phys_wc_add\>' --or \
-e '\<arch_phys_wc_del\>' --or \
-e '\<memremap\>' --or \
-e '\<memunmap\>' --or \
-e '\<arch_io_reserve_memtype_wc\>' --or \
-e '\<arch_io_free_memtype_wc\>' --or \
-e '\<__io_aw\>' --or \
-e '\<__io_pbw\>' --or \
-e '\<__io_paw\>' --or \
-e '\<__io_pbr\>' --or \
-e '\<__io_par\>' --or \
-e '\<__raw_readb\>' --or \
-e '\<__raw_readw\>' --or \
-e '\<__raw_readl\>' --or \
-e '\<__raw_readq\>' --or \
-e '\<__raw_writeb\>' --or \
-e '\<__raw_writew\>' --or \
-e '\<__raw_writel\>' --or \
-e '\<__raw_writeq\>' --or \
-e '\<readb\>' --or \
-e '\<readw\>' --or \
-e '\<readl\>' --or \
-e '\<readq\>' --or \
-e '\<writeb\>' --or \
-e '\<writew\>' --or \
-e '\<writel\>' --or \
-e '\<writeq\>' --or \
-e '\<readb_relaxed\>' --or \
-e '\<readw_relaxed\>' --or \
-e '\<readl_relaxed\>' --or \
-e '\<readq_relaxed\>' --or \
-e '\<writeb_relaxed\>' --or \
-e '\<writew_relaxed\>' --or \
-e '\<writel_relaxed\>' --or \
-e '\<writeq_relaxed\>' --or \
-e '\<readsb\>' --or \
-e '\<readsw\>' --or \
-e '\<readsl\>' --or \
-e '\<readsq\>' --or \
-e '\<writesb\>' --or \
-e '\<writesw\>' --or \
-e '\<writesl\>' --or \
-e '\<writesq\>' --or \
-e '\<inb\>' --or \
-e '\<inw\>' --or \
-e '\<inl\>' --or \
-e '\<outb\>' --or \
-e '\<outw\>' --or \
-e '\<outl\>' --or \
-e '\<inb_p\>' --or \
-e '\<inw_p\>' --or \
-e '\<inl_p\>' --or \
-e '\<outb_p\>' --or \
-e '\<outw_p\>' --or \
-e '\<outl_p\>' --or \
-e '\<insb\>' --or \
-e '\<insw\>' --or \
-e '\<insl\>' --or \
-e '\<outsb\>' --or \
-e '\<outsw\>' --or \
-e '\<outsl\>' --or \
-e '\<insb_p\>' --or \
-e '\<insw_p\>' --or \
-e '\<insl_p\>' --or \
-e '\<outsb_p\>' --or \
-e '\<outsw_p\>' --or \
-e '\<outsl_p\>' --or \
-e '\<ioread8\>' --or \
-e '\<ioread16\>' --or \
-e '\<ioread32\>' --or \
-e '\<ioread64\>' --or \
-e '\<iowrite8\>' --or \
-e '\<iowrite16\>' --or \
-e '\<iowrite32\>' --or \
-e '\<iowrite64\>' --or \
-e '\<ioread16be\>' --or \
-e '\<ioread32be\>' --or \
-e '\<ioread64be\>' --or \
-e '\<iowrite16be\>' --or \
-e '\<iowrite32be\>' --or \
-e '\<iowrite64be\>' --or \
-e '\<ioread8_rep\>' --or \
-e '\<ioread16_rep\>' --or \
-e '\<ioread32_rep\>' --or \
-e '\<ioread64_rep\>' --or \
-e '\<iowrite8_rep\>' --or \
-e '\<iowrite16_rep\>' --or \
-e '\<iowrite32_rep\>' --or \
-e '\<iowrite64_rep\>' --or \
-e '\<__io_virt\>' --or \
-e '\<pci_iounmap\>' --or \
-e '\<virt_to_phys\>' --or \
-e '\<phys_to_virt\>' --or \
-e '\<ioremap_uc\>' --or \
-e '\<ioremap\>' --or \
-e '\<__ioremap\>' --or \
-e '\<iounmap\>' --or \
-e '\<ioremap\>' --or \
-e '\<ioremap_nocache\>' --or \
-e '\<ioremap_uc\>' --or \
-e '\<ioremap_wc\>' --or \
-e '\<ioremap_wc\>' --or \
-e '\<ioremap_wt\>' --or \
-e '\<ioport_map\>' --or \
-e '\<ioport_unmap\>' --or \
-e '\<ioport_map\>' --or \
-e '\<ioport_unmap\>' --or \
-e '\<xlate_dev_kmem_ptr\>' --or \
-e '\<xlate_dev_mem_ptr\>' --or \
-e '\<unxlate_dev_mem_ptr\>' --or \
-e '\<virt_to_bus\>' --or \
-e '\<bus_to_virt\>' --or \
-e '\<memset_io\>' --or \
-e '\<memcpy_fromio\>' --or \
-e '\<memcpy_toio\>'
I also reordered a couple includes when they weren't alphabetical and
removed clk.h from kona, replacing it with clk-provider.h because
that driver doesn't use clk consumer APIs.
Acked-by: Geert Uytterhoeven <[email protected] >
Cc: Chen-Yu Tsai <[email protected] >
Acked-by: Maxime Ripard <[email protected] >
Acked-by: Tero Kristo <[email protected] >
Acked-by: Sekhar Nori <[email protected] >
Cc: Krzysztof Kozlowski <[email protected] >
Acked-by: Mark Brown <[email protected] >
Cc: Chris Zankel <[email protected] >
Acked-by: Max Filippov <[email protected] >
Acked-by: John Crispin <[email protected] >
Acked-by: Heiko Stuebner <[email protected] >
Signed-off-by: Stephen Boyd <[email protected] >
2019-05-15 13:21:37 -07:00
Paul Walmsley
30b8e27e3b
clk: sifive: add a driver for the SiFive FU540 PRCI IP block
...
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] >.
Signed-off-by: Paul Walmsley <[email protected] >
Signed-off-by: Paul Walmsley <[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] >
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
[[email protected] : Fix some const and ARRAY_SIZE() issues, make makefile
only descend if CLK_SIFIVE=y]
Signed-off-by: Stephen Boyd <[email protected] >
2019-05-03 09:20:56 -07:00