-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'clk-v5.17-samsung' of https://git.kernel.org/pub/scm/linux…
…/kernel/git/snawrocki/clk into clk-samsung Pull Samsung clk driver updates from Sylwester Nawrocki: - removal of all remaining uses of __clk_lookup() in drivers/clk/samsung - refactoring of the CPU clocks registration to use common interface - an update of the Exynos850 driver (support for more clock domains) required by the E850-96 development board - initial clock driver for the Exynos7885 SoC (Samsung Galaxy A8) * tag 'clk-v5.17-samsung' of https://git.kernel.org/pub/scm/linux/kernel/git/snawrocki/clk: clk: samsung: Add initial Exynos7885 clock driver clk: samsung: clk-pll: Add support for pll1417x clk: samsung: Make exynos850_register_cmu shared dt-bindings: clock: Document Exynos7885 CMU bindings dt-bindings: clock: Add bindings definitions for Exynos7885 CMU clk: samsung: exynos850: Add missing sysreg clocks dt-bindings: clock: Add bindings for Exynos850 sysreg clocks clk: samsung: exynos850: Register clocks early clk: samsung: exynos850: Keep some crucial clocks running clk: samsung: exynos850: Implement CMU_CMGP domain dt-bindings: clock: Add bindings for Exynos850 CMU_CMGP clk: samsung: exynos850: Implement CMU_APM domain dt-bindings: clock: Add bindings for Exynos850 CMU_APM clk: samsung: Update CPU clk registration clk: samsung: Remove meaningless __init and extern from header files clk: samsung: remove __clk_lookup() usage dt-bindings: clock: samsung: add IDs for some core clocks
- Loading branch information
Showing
24 changed files
with
1,503 additions
and
185 deletions.
There are no files selected for viewing
166 changes: 166 additions & 0 deletions
166
Documentation/devicetree/bindings/clock/samsung,exynos7885-clock.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
%YAML 1.2 | ||
--- | ||
$id: http://devicetree.org/schemas/clock/samsung,exynos7885-clock.yaml# | ||
$schema: http://devicetree.org/meta-schemas/core.yaml# | ||
|
||
title: Samsung Exynos7885 SoC clock controller | ||
|
||
maintainers: | ||
- Dávid Virág <virag.david003@gmail.com> | ||
- Chanwoo Choi <cw00.choi@samsung.com> | ||
- Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> | ||
- Sylwester Nawrocki <s.nawrocki@samsung.com> | ||
- Tomasz Figa <tomasz.figa@gmail.com> | ||
|
||
description: | | ||
Exynos7885 clock controller is comprised of several CMU units, generating | ||
clocks for different domains. Those CMU units are modeled as separate device | ||
tree nodes, and might depend on each other. The root clock in that root tree | ||
is an external clock: OSCCLK (26 MHz). This external clock must be defined | ||
as a fixed-rate clock in dts. | ||
CMU_TOP is a top-level CMU, where all base clocks are prepared using PLLs and | ||
dividers; all other leaf clocks (other CMUs) are usually derived from CMU_TOP. | ||
Each clock is assigned an identifier and client nodes can use this identifier | ||
to specify the clock which they consume. All clocks available for usage | ||
in clock consumer nodes are defined as preprocessor macros in | ||
'dt-bindings/clock/exynos7885.h' header. | ||
properties: | ||
compatible: | ||
enum: | ||
- samsung,exynos7885-cmu-top | ||
- samsung,exynos7885-cmu-core | ||
- samsung,exynos7885-cmu-peri | ||
|
||
clocks: | ||
minItems: 1 | ||
maxItems: 10 | ||
|
||
clock-names: | ||
minItems: 1 | ||
maxItems: 10 | ||
|
||
"#clock-cells": | ||
const: 1 | ||
|
||
reg: | ||
maxItems: 1 | ||
|
||
allOf: | ||
- if: | ||
properties: | ||
compatible: | ||
contains: | ||
const: samsung,exynos7885-cmu-top | ||
|
||
then: | ||
properties: | ||
clocks: | ||
items: | ||
- description: External reference clock (26 MHz) | ||
|
||
clock-names: | ||
items: | ||
- const: oscclk | ||
|
||
- if: | ||
properties: | ||
compatible: | ||
contains: | ||
const: samsung,exynos7885-cmu-core | ||
|
||
then: | ||
properties: | ||
clocks: | ||
items: | ||
- description: External reference clock (26 MHz) | ||
- description: CMU_CORE bus clock (from CMU_TOP) | ||
- description: CCI clock (from CMU_TOP) | ||
- description: G3D clock (from CMU_TOP) | ||
|
||
clock-names: | ||
items: | ||
- const: oscclk | ||
- const: dout_core_bus | ||
- const: dout_core_cci | ||
- const: dout_core_g3d | ||
|
||
- if: | ||
properties: | ||
compatible: | ||
contains: | ||
const: samsung,exynos7885-cmu-peri | ||
|
||
then: | ||
properties: | ||
clocks: | ||
items: | ||
- description: External reference clock (26 MHz) | ||
- description: CMU_PERI bus clock (from CMU_TOP) | ||
- description: SPI0 clock (from CMU_TOP) | ||
- description: SPI1 clock (from CMU_TOP) | ||
- description: UART0 clock (from CMU_TOP) | ||
- description: UART1 clock (from CMU_TOP) | ||
- description: UART2 clock (from CMU_TOP) | ||
- description: USI0 clock (from CMU_TOP) | ||
- description: USI1 clock (from CMU_TOP) | ||
- description: USI2 clock (from CMU_TOP) | ||
|
||
clock-names: | ||
items: | ||
- const: oscclk | ||
- const: dout_peri_bus | ||
- const: dout_peri_spi0 | ||
- const: dout_peri_spi1 | ||
- const: dout_peri_uart0 | ||
- const: dout_peri_uart1 | ||
- const: dout_peri_uart2 | ||
- const: dout_peri_usi0 | ||
- const: dout_peri_usi1 | ||
- const: dout_peri_usi2 | ||
|
||
required: | ||
- compatible | ||
- "#clock-cells" | ||
- clocks | ||
- clock-names | ||
- reg | ||
|
||
additionalProperties: false | ||
|
||
examples: | ||
# Clock controller node for CMU_PERI | ||
- | | ||
#include <dt-bindings/clock/exynos7885.h> | ||
cmu_peri: clock-controller@10010000 { | ||
compatible = "samsung,exynos7885-cmu-peri"; | ||
reg = <0x10010000 0x8000>; | ||
#clock-cells = <1>; | ||
clocks = <&oscclk>, | ||
<&cmu_top CLK_DOUT_PERI_BUS>, | ||
<&cmu_top CLK_DOUT_PERI_SPI0>, | ||
<&cmu_top CLK_DOUT_PERI_SPI1>, | ||
<&cmu_top CLK_DOUT_PERI_UART0>, | ||
<&cmu_top CLK_DOUT_PERI_UART1>, | ||
<&cmu_top CLK_DOUT_PERI_UART2>, | ||
<&cmu_top CLK_DOUT_PERI_USI0>, | ||
<&cmu_top CLK_DOUT_PERI_USI1>, | ||
<&cmu_top CLK_DOUT_PERI_USI2>; | ||
clock-names = "oscclk", | ||
"dout_peri_bus", | ||
"dout_peri_spi0", | ||
"dout_peri_spi1", | ||
"dout_peri_uart0", | ||
"dout_peri_uart1", | ||
"dout_peri_uart2", | ||
"dout_peri_usi0", | ||
"dout_peri_usi1", | ||
"dout_peri_usi2"; | ||
}; | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* Copyright (C) 2021 Linaro Ltd. | ||
* Copyright (C) 2021 Dávid Virág <virag.david003@gmail.com> | ||
* Author: Sam Protsenko <semen.protsenko@linaro.org> | ||
* Author: Dávid Virág <virag.david003@gmail.com> | ||
* | ||
* This file contains shared functions used by some arm64 Exynos SoCs, | ||
* such as Exynos7885 or Exynos850 to register and init CMUs. | ||
*/ | ||
#include <linux/clk.h> | ||
#include <linux/of_address.h> | ||
|
||
#include "clk-exynos-arm64.h" | ||
|
||
/* Gate register bits */ | ||
#define GATE_MANUAL BIT(20) | ||
#define GATE_ENABLE_HWACG BIT(28) | ||
|
||
/* Gate register offsets range */ | ||
#define GATE_OFF_START 0x2000 | ||
#define GATE_OFF_END 0x2fff | ||
|
||
/** | ||
* exynos_arm64_init_clocks - Set clocks initial configuration | ||
* @np: CMU device tree node with "reg" property (CMU addr) | ||
* @reg_offs: Register offsets array for clocks to init | ||
* @reg_offs_len: Number of register offsets in reg_offs array | ||
* | ||
* Set manual control mode for all gate clocks. | ||
*/ | ||
static void __init exynos_arm64_init_clocks(struct device_node *np, | ||
const unsigned long *reg_offs, size_t reg_offs_len) | ||
{ | ||
void __iomem *reg_base; | ||
size_t i; | ||
|
||
reg_base = of_iomap(np, 0); | ||
if (!reg_base) | ||
panic("%s: failed to map registers\n", __func__); | ||
|
||
for (i = 0; i < reg_offs_len; ++i) { | ||
void __iomem *reg = reg_base + reg_offs[i]; | ||
u32 val; | ||
|
||
/* Modify only gate clock registers */ | ||
if (reg_offs[i] < GATE_OFF_START || reg_offs[i] > GATE_OFF_END) | ||
continue; | ||
|
||
val = readl(reg); | ||
val |= GATE_MANUAL; | ||
val &= ~GATE_ENABLE_HWACG; | ||
writel(val, reg); | ||
} | ||
|
||
iounmap(reg_base); | ||
} | ||
|
||
/** | ||
* exynos_arm64_register_cmu - Register specified Exynos CMU domain | ||
* @dev: Device object; may be NULL if this function is not being | ||
* called from platform driver probe function | ||
* @np: CMU device tree node | ||
* @cmu: CMU data | ||
* | ||
* Register specified CMU domain, which includes next steps: | ||
* | ||
* 1. Enable parent clock of @cmu CMU | ||
* 2. Set initial registers configuration for @cmu CMU clocks | ||
* 3. Register @cmu CMU clocks using Samsung clock framework API | ||
*/ | ||
void __init exynos_arm64_register_cmu(struct device *dev, | ||
struct device_node *np, const struct samsung_cmu_info *cmu) | ||
{ | ||
/* Keep CMU parent clock running (needed for CMU registers access) */ | ||
if (cmu->clk_name) { | ||
struct clk *parent_clk; | ||
|
||
if (dev) | ||
parent_clk = clk_get(dev, cmu->clk_name); | ||
else | ||
parent_clk = of_clk_get_by_name(np, cmu->clk_name); | ||
|
||
if (IS_ERR(parent_clk)) { | ||
pr_err("%s: could not find bus clock %s; err = %ld\n", | ||
__func__, cmu->clk_name, PTR_ERR(parent_clk)); | ||
} else { | ||
clk_prepare_enable(parent_clk); | ||
} | ||
} | ||
|
||
exynos_arm64_init_clocks(np, cmu->clk_regs, cmu->nr_clk_regs); | ||
samsung_cmu_register_one(np, cmu); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
/* | ||
* Copyright (C) 2021 Linaro Ltd. | ||
* Copyright (C) 2021 Dávid Virág <virag.david003@gmail.com> | ||
* Author: Sam Protsenko <semen.protsenko@linaro.org> | ||
* Author: Dávid Virág <virag.david003@gmail.com> | ||
* | ||
* This file contains shared functions used by some arm64 Exynos SoCs, | ||
* such as Exynos7885 or Exynos850 to register and init CMUs. | ||
*/ | ||
|
||
#ifndef __CLK_EXYNOS_ARM64_H | ||
#define __CLK_EXYNOS_ARM64_H | ||
|
||
#include "clk.h" | ||
|
||
void exynos_arm64_register_cmu(struct device *dev, | ||
struct device_node *np, const struct samsung_cmu_info *cmu); | ||
|
||
#endif /* __CLK_EXYNOS_ARM64_H */ |
Oops, something went wrong.