-
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-meson-v5.6-1' of https://github.com/BayLibre/clk-meson …
…into clk-amlogic Pull Amlogic clk driver updates from Jerome Brunet: - Add meson8b DDR clock controller - Add input clocks to meson8b controllers - Fix meson8b mali clock update using the glitch free mux - Fix pll driver division by zero init * tag 'clk-meson-v5.6-1' of https://github.com/BayLibre/clk-meson: clk: clarify that clk_set_rate() does updates from top to bottom clk: meson: meson8b: make the CCF use the glitch-free mali mux clk: meson: pll: Fix by 0 division in __pll_params_to_rate() clk: meson: g12a: fix missing uart2 in regmap table clk: meson: meson8b: use of_clk_hw_register to register the clocks clk: meson: meson8b: don't register the XTAL clock when provided via OF clk: meson: meson8b: change references to the XTAL clock to use [fw_]name clk: meson: meson8b: use clk_hw_set_parent in the CPU clock notifier clk: meson: add a driver for the Meson8/8b/8m2 DDR clock controller dt-bindings: clock: meson8b: add the clock inputs dt-bindings: clock: add the Amlogic Meson8 DDR clock controller binding
- Loading branch information
Showing
9 changed files
with
291 additions
and
56 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
Documentation/devicetree/bindings/clock/amlogic,meson8-ddr-clkc.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,50 @@ | ||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
%YAML 1.2 | ||
--- | ||
$id: http://devicetree.org/schemas/clock/amlogic,meson8-ddr-clkc.yaml# | ||
$schema: http://devicetree.org/meta-schemas/core.yaml# | ||
|
||
title: Amlogic DDR Clock Controller Device Tree Bindings | ||
|
||
maintainers: | ||
- Martin Blumenstingl <martin.blumenstingl@googlemail.com> | ||
|
||
properties: | ||
compatible: | ||
enum: | ||
- amlogic,meson8-ddr-clkc | ||
- amlogic,meson8b-ddr-clkc | ||
|
||
reg: | ||
maxItems: 1 | ||
|
||
clocks: | ||
maxItems: 1 | ||
|
||
clock-names: | ||
items: | ||
- const: xtal | ||
|
||
"#clock-cells": | ||
const: 1 | ||
|
||
required: | ||
- compatible | ||
- reg | ||
- clocks | ||
- clock-names | ||
- "#clock-cells" | ||
|
||
additionalProperties: false | ||
|
||
examples: | ||
- | | ||
ddr_clkc: clock-controller@400 { | ||
compatible = "amlogic,meson8-ddr-clkc"; | ||
reg = <0x400 0x20>; | ||
clocks = <&xtal>; | ||
clock-names = "xtal"; | ||
#clock-cells = <1>; | ||
}; | ||
... |
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,149 @@ | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
/* | ||
* Amlogic Meson8 DDR clock controller | ||
* | ||
* Copyright (C) 2019 Martin Blumenstingl <martin.blumenstingl@googlemail.com> | ||
*/ | ||
|
||
#include <dt-bindings/clock/meson8-ddr-clkc.h> | ||
|
||
#include <linux/clk-provider.h> | ||
#include <linux/platform_device.h> | ||
|
||
#include "clk-regmap.h" | ||
#include "clk-pll.h" | ||
|
||
#define AM_DDR_PLL_CNTL 0x00 | ||
#define AM_DDR_PLL_CNTL1 0x04 | ||
#define AM_DDR_PLL_CNTL2 0x08 | ||
#define AM_DDR_PLL_CNTL3 0x0c | ||
#define AM_DDR_PLL_CNTL4 0x10 | ||
#define AM_DDR_PLL_STS 0x14 | ||
#define DDR_CLK_CNTL 0x18 | ||
#define DDR_CLK_STS 0x1c | ||
|
||
static struct clk_regmap meson8_ddr_pll_dco = { | ||
.data = &(struct meson_clk_pll_data){ | ||
.en = { | ||
.reg_off = AM_DDR_PLL_CNTL, | ||
.shift = 30, | ||
.width = 1, | ||
}, | ||
.m = { | ||
.reg_off = AM_DDR_PLL_CNTL, | ||
.shift = 0, | ||
.width = 9, | ||
}, | ||
.n = { | ||
.reg_off = AM_DDR_PLL_CNTL, | ||
.shift = 9, | ||
.width = 5, | ||
}, | ||
.l = { | ||
.reg_off = AM_DDR_PLL_CNTL, | ||
.shift = 31, | ||
.width = 1, | ||
}, | ||
.rst = { | ||
.reg_off = AM_DDR_PLL_CNTL, | ||
.shift = 29, | ||
.width = 1, | ||
}, | ||
}, | ||
.hw.init = &(struct clk_init_data){ | ||
.name = "ddr_pll_dco", | ||
.ops = &meson_clk_pll_ro_ops, | ||
.parent_data = &(const struct clk_parent_data) { | ||
.fw_name = "xtal", | ||
}, | ||
.num_parents = 1, | ||
}, | ||
}; | ||
|
||
static struct clk_regmap meson8_ddr_pll = { | ||
.data = &(struct clk_regmap_div_data){ | ||
.offset = AM_DDR_PLL_CNTL, | ||
.shift = 16, | ||
.width = 2, | ||
.flags = CLK_DIVIDER_POWER_OF_TWO, | ||
}, | ||
.hw.init = &(struct clk_init_data){ | ||
.name = "ddr_pll", | ||
.ops = &clk_regmap_divider_ro_ops, | ||
.parent_hws = (const struct clk_hw *[]) { | ||
&meson8_ddr_pll_dco.hw | ||
}, | ||
.num_parents = 1, | ||
}, | ||
}; | ||
|
||
static struct clk_hw_onecell_data meson8_ddr_clk_hw_onecell_data = { | ||
.hws = { | ||
[DDR_CLKID_DDR_PLL_DCO] = &meson8_ddr_pll_dco.hw, | ||
[DDR_CLKID_DDR_PLL] = &meson8_ddr_pll.hw, | ||
}, | ||
.num = 2, | ||
}; | ||
|
||
static struct clk_regmap *const meson8_ddr_clk_regmaps[] = { | ||
&meson8_ddr_pll_dco, | ||
&meson8_ddr_pll, | ||
}; | ||
|
||
static const struct regmap_config meson8_ddr_clkc_regmap_config = { | ||
.reg_bits = 8, | ||
.val_bits = 32, | ||
.reg_stride = 4, | ||
.max_register = DDR_CLK_STS, | ||
}; | ||
|
||
static int meson8_ddr_clkc_probe(struct platform_device *pdev) | ||
{ | ||
struct regmap *regmap; | ||
void __iomem *base; | ||
struct clk_hw *hw; | ||
int ret, i; | ||
|
||
base = devm_platform_ioremap_resource(pdev, 0); | ||
if (IS_ERR(base)) | ||
return PTR_ERR(base); | ||
|
||
regmap = devm_regmap_init_mmio(&pdev->dev, base, | ||
&meson8_ddr_clkc_regmap_config); | ||
if (IS_ERR(regmap)) | ||
return PTR_ERR(regmap); | ||
|
||
/* Populate regmap */ | ||
for (i = 0; i < ARRAY_SIZE(meson8_ddr_clk_regmaps); i++) | ||
meson8_ddr_clk_regmaps[i]->map = regmap; | ||
|
||
/* Register all clks */ | ||
for (i = 0; i < meson8_ddr_clk_hw_onecell_data.num; i++) { | ||
hw = meson8_ddr_clk_hw_onecell_data.hws[i]; | ||
|
||
ret = devm_clk_hw_register(&pdev->dev, hw); | ||
if (ret) { | ||
dev_err(&pdev->dev, "Clock registration failed\n"); | ||
return ret; | ||
} | ||
} | ||
|
||
return devm_of_clk_add_hw_provider(&pdev->dev, of_clk_hw_onecell_get, | ||
&meson8_ddr_clk_hw_onecell_data); | ||
} | ||
|
||
static const struct of_device_id meson8_ddr_clkc_match_table[] = { | ||
{ .compatible = "amlogic,meson8-ddr-clkc" }, | ||
{ .compatible = "amlogic,meson8b-ddr-clkc" }, | ||
{ /* sentinel */ } | ||
}; | ||
|
||
static struct platform_driver meson8_ddr_clkc_driver = { | ||
.probe = meson8_ddr_clkc_probe, | ||
.driver = { | ||
.name = "meson8-ddr-clkc", | ||
.of_match_table = meson8_ddr_clkc_match_table, | ||
}, | ||
}; | ||
|
||
builtin_platform_driver(meson8_ddr_clkc_driver); |
Oops, something went wrong.