mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
Merge branch 'depends/clk-rk3368' into next/arm64
Merge in dependent stable branch with clk driver for RK3368, needed for the dt binding header files. * depends/clk-rk3368: clk: rockchip: add rk3368 clock controller clk: rockchip: add missing include guards clk: rockchip: add dt-binding header for rk3368 dt-bindings: add documentation of rk3668 clock controller clk: rockchip: define the inverters of rk3066/rk3188 and rk3288 clk: rockchip: fix issues in the mmc-phase clock clk: rockchip: add support for phase inverters clk: rockchip: add COMPOSITE_NOGATE_DIVTBL variant clk: rockchip: protect register macros against multipart values clk: rockchip: fix faulty vip parent name on rk3288 clk: rockchip: rk3288: add CLK_SET_RATE_PARENT to sclk_mac Signed-off-by: Olof Johansson <olof@lixom.net>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
* Rockchip RK3368 Clock and Reset Unit
|
||||
|
||||
The RK3368 clock controller generates and supplies clock to various
|
||||
controllers within the SoC and also implements a reset controller for SoC
|
||||
peripherals.
|
||||
|
||||
Required Properties:
|
||||
|
||||
- compatible: should be "rockchip,rk3368-cru"
|
||||
- reg: physical base address of the controller and length of memory mapped
|
||||
region.
|
||||
- #clock-cells: should be 1.
|
||||
- #reset-cells: should be 1.
|
||||
|
||||
Optional Properties:
|
||||
|
||||
- rockchip,grf: phandle to the syscon managing the "general register files"
|
||||
If missing, pll rates are not changeable, due to the missing pll lock status.
|
||||
|
||||
Each clock is assigned an identifier and client nodes can use this identifier
|
||||
to specify the clock which they consume. All available clocks are defined as
|
||||
preprocessor macros in the dt-bindings/clock/rk3368-cru.h headers and can be
|
||||
used in device tree sources. Similar macros exist for the reset sources in
|
||||
these files.
|
||||
|
||||
External clocks:
|
||||
|
||||
There are several clocks that are generated outside the SoC. It is expected
|
||||
that they are defined using standard clock bindings with following
|
||||
clock-output-names:
|
||||
- "xin24m" - crystal input - required,
|
||||
- "xin32k" - rtc clock - optional,
|
||||
- "ext_i2s" - external I2S clock - optional,
|
||||
- "ext_gmac" - external GMAC clock - optional
|
||||
- "ext_hsadc" - external HSADC clock - optional,
|
||||
- "ext_isp" - external ISP clock - optional,
|
||||
- "ext_jtag" - external JTAG clock - optional
|
||||
- "ext_vip" - external VIP clock - optional,
|
||||
- "usbotg_out" - output clock of the pll in the otg phy
|
||||
|
||||
Example: Clock controller node:
|
||||
|
||||
cru: clock-controller@ff760000 {
|
||||
compatible = "rockchip,rk3368-cru";
|
||||
reg = <0x0 0xff760000 0x0 0x1000>;
|
||||
rockchip,grf = <&grf>;
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
};
|
||||
|
||||
Example: UART controller node that consumes the clock generated by the clock
|
||||
controller:
|
||||
|
||||
uart0: serial@10124000 {
|
||||
compatible = "snps,dw-apb-uart";
|
||||
reg = <0x10124000 0x400>;
|
||||
interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <1>;
|
||||
clocks = <&cru SCLK_UART0>;
|
||||
};
|
||||
@@ -6,8 +6,10 @@ obj-y += clk-rockchip.o
|
||||
obj-y += clk.o
|
||||
obj-y += clk-pll.o
|
||||
obj-y += clk-cpu.o
|
||||
obj-y += clk-inverter.o
|
||||
obj-y += clk-mmc-phase.o
|
||||
obj-$(CONFIG_RESET_CONTROLLER) += softrst.o
|
||||
|
||||
obj-y += clk-rk3188.o
|
||||
obj-y += clk-rk3288.o
|
||||
obj-y += clk-rk3368.o
|
||||
|
||||
116
drivers/clk/rockchip/clk-inverter.c
Normal file
116
drivers/clk/rockchip/clk-inverter.c
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright 2015 Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/kernel.h>
|
||||
#include "clk.h"
|
||||
|
||||
struct rockchip_inv_clock {
|
||||
struct clk_hw hw;
|
||||
void __iomem *reg;
|
||||
int shift;
|
||||
int flags;
|
||||
spinlock_t *lock;
|
||||
};
|
||||
|
||||
#define to_inv_clock(_hw) container_of(_hw, struct rockchip_inv_clock, hw)
|
||||
|
||||
#define INVERTER_MASK 0x1
|
||||
|
||||
static int rockchip_inv_get_phase(struct clk_hw *hw)
|
||||
{
|
||||
struct rockchip_inv_clock *inv_clock = to_inv_clock(hw);
|
||||
u32 val;
|
||||
|
||||
val = readl(inv_clock->reg) >> inv_clock->shift;
|
||||
val &= INVERTER_MASK;
|
||||
return val ? 180 : 0;
|
||||
}
|
||||
|
||||
static int rockchip_inv_set_phase(struct clk_hw *hw, int degrees)
|
||||
{
|
||||
struct rockchip_inv_clock *inv_clock = to_inv_clock(hw);
|
||||
u32 val;
|
||||
|
||||
if (degrees % 180 == 0) {
|
||||
val = !!degrees;
|
||||
} else {
|
||||
pr_err("%s: unsupported phase %d for %s\n",
|
||||
__func__, degrees, __clk_get_name(hw->clk));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (inv_clock->flags & ROCKCHIP_INVERTER_HIWORD_MASK) {
|
||||
writel(HIWORD_UPDATE(val, INVERTER_MASK, inv_clock->shift),
|
||||
inv_clock->reg);
|
||||
} else {
|
||||
unsigned long flags;
|
||||
u32 reg;
|
||||
|
||||
spin_lock_irqsave(inv_clock->lock, flags);
|
||||
|
||||
reg = readl(inv_clock->reg);
|
||||
reg &= ~BIT(inv_clock->shift);
|
||||
reg |= val;
|
||||
writel(reg, inv_clock->reg);
|
||||
|
||||
spin_unlock_irqrestore(inv_clock->lock, flags);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clk_ops rockchip_inv_clk_ops = {
|
||||
.get_phase = rockchip_inv_get_phase,
|
||||
.set_phase = rockchip_inv_set_phase,
|
||||
};
|
||||
|
||||
struct clk *rockchip_clk_register_inverter(const char *name,
|
||||
const char *const *parent_names, u8 num_parents,
|
||||
void __iomem *reg, int shift, int flags,
|
||||
spinlock_t *lock)
|
||||
{
|
||||
struct clk_init_data init;
|
||||
struct rockchip_inv_clock *inv_clock;
|
||||
struct clk *clk;
|
||||
|
||||
inv_clock = kmalloc(sizeof(*inv_clock), GFP_KERNEL);
|
||||
if (!inv_clock)
|
||||
return NULL;
|
||||
|
||||
init.name = name;
|
||||
init.num_parents = num_parents;
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
init.parent_names = parent_names;
|
||||
init.ops = &rockchip_inv_clk_ops;
|
||||
|
||||
inv_clock->hw.init = &init;
|
||||
inv_clock->reg = reg;
|
||||
inv_clock->shift = shift;
|
||||
inv_clock->flags = flags;
|
||||
inv_clock->lock = lock;
|
||||
|
||||
clk = clk_register(NULL, &inv_clock->hw);
|
||||
if (IS_ERR(clk))
|
||||
goto err_free;
|
||||
|
||||
return clk;
|
||||
|
||||
err_free:
|
||||
kfree(inv_clock);
|
||||
return NULL;
|
||||
}
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/kernel.h>
|
||||
#include "clk.h"
|
||||
|
||||
struct rockchip_mmc_clock {
|
||||
@@ -131,6 +133,7 @@ struct clk *rockchip_clk_register_mmc(const char *name,
|
||||
if (!mmc_clock)
|
||||
return NULL;
|
||||
|
||||
init.name = name;
|
||||
init.num_parents = num_parents;
|
||||
init.parent_names = parent_names;
|
||||
init.ops = &rockchip_mmc_clk_ops;
|
||||
@@ -139,9 +142,6 @@ struct clk *rockchip_clk_register_mmc(const char *name,
|
||||
mmc_clock->reg = reg;
|
||||
mmc_clock->shift = shift;
|
||||
|
||||
if (name)
|
||||
init.name = name;
|
||||
|
||||
clk = clk_register(NULL, &mmc_clock->hw);
|
||||
if (IS_ERR(clk))
|
||||
goto err_free;
|
||||
|
||||
@@ -235,6 +235,7 @@ static struct rockchip_pll_clock rk3188_pll_clks[] __initdata = {
|
||||
#define MFLAGS CLK_MUX_HIWORD_MASK
|
||||
#define DFLAGS CLK_DIVIDER_HIWORD_MASK
|
||||
#define GFLAGS (CLK_GATE_HIWORD_MASK | CLK_GATE_SET_TO_DISABLE)
|
||||
#define IFLAGS ROCKCHIP_INVERTER_HIWORD_MASK
|
||||
|
||||
/* 2 ^ (val + 1) */
|
||||
static struct clk_div_table div_core_peri_t[] = {
|
||||
@@ -310,6 +311,8 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = {
|
||||
|
||||
GATE(0, "pclkin_cif0", "ext_cif0", 0,
|
||||
RK2928_CLKGATE_CON(3), 3, GFLAGS),
|
||||
INVERTER(0, "pclk_cif0", "pclkin_cif0",
|
||||
RK2928_CLKSEL_CON(30), 8, IFLAGS),
|
||||
|
||||
/*
|
||||
* the 480m are generated inside the usb block from these clocks,
|
||||
@@ -334,8 +337,10 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = {
|
||||
COMPOSITE_FRAC(0, "hsadc_frac", "hsadc_src", 0,
|
||||
RK2928_CLKSEL_CON(23), 0,
|
||||
RK2928_CLKGATE_CON(2), 7, GFLAGS),
|
||||
MUX(SCLK_HSADC, "sclk_hsadc", mux_sclk_hsadc_p, 0,
|
||||
MUX(0, "sclk_hsadc_out", mux_sclk_hsadc_p, 0,
|
||||
RK2928_CLKSEL_CON(22), 4, 2, MFLAGS),
|
||||
INVERTER(SCLK_HSADC, "sclk_hsadc", "sclk_hsadc_out",
|
||||
RK2928_CLKSEL_CON(22), 7, IFLAGS),
|
||||
|
||||
COMPOSITE_NOMUX(SCLK_SARADC, "sclk_saradc", "xin24m", 0,
|
||||
RK2928_CLKSEL_CON(24), 8, 8, DFLAGS,
|
||||
@@ -557,6 +562,8 @@ static struct rockchip_clk_branch rk3066a_clk_branches[] __initdata = {
|
||||
|
||||
GATE(0, "pclkin_cif1", "ext_cif1", 0,
|
||||
RK2928_CLKGATE_CON(3), 4, GFLAGS),
|
||||
INVERTER(0, "pclk_cif1", "pclkin_cif1",
|
||||
RK2928_CLKSEL_CON(30), 12, IFLAGS),
|
||||
|
||||
COMPOSITE(0, "aclk_gpu_src", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK2928_CLKSEL_CON(33), 8, 1, MFLAGS, 0, 5, DFLAGS,
|
||||
|
||||
@@ -189,7 +189,7 @@ PNAME(mux_uart1_p) = { "uart1_src", "uart1_frac", "xin24m" };
|
||||
PNAME(mux_uart2_p) = { "uart2_src", "uart2_frac", "xin24m" };
|
||||
PNAME(mux_uart3_p) = { "uart3_src", "uart3_frac", "xin24m" };
|
||||
PNAME(mux_uart4_p) = { "uart4_src", "uart4_frac", "xin24m" };
|
||||
PNAME(mux_cif_out_p) = { "cif_src", "xin24m" };
|
||||
PNAME(mux_vip_out_p) = { "vip_src", "xin24m" };
|
||||
PNAME(mux_mac_p) = { "mac_pll_src", "ext_gmac" };
|
||||
PNAME(mux_hsadcout_p) = { "hsadc_src", "ext_hsadc" };
|
||||
PNAME(mux_edp_24m_p) = { "ext_edp_24m", "xin24m" };
|
||||
@@ -223,6 +223,7 @@ static struct clk_div_table div_hclk_cpu_t[] = {
|
||||
#define MFLAGS CLK_MUX_HIWORD_MASK
|
||||
#define DFLAGS CLK_DIVIDER_HIWORD_MASK
|
||||
#define GFLAGS (CLK_GATE_HIWORD_MASK | CLK_GATE_SET_TO_DISABLE)
|
||||
#define IFLAGS ROCKCHIP_INVERTER_HIWORD_MASK
|
||||
|
||||
static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
/*
|
||||
@@ -434,7 +435,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
COMPOSITE_NODIV(0, "vip_src", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(26), 8, 1, MFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 7, GFLAGS),
|
||||
COMPOSITE_NOGATE(0, "sclk_vip_out", mux_cif_out_p, 0,
|
||||
COMPOSITE_NOGATE(0, "sclk_vip_out", mux_vip_out_p, 0,
|
||||
RK3288_CLKSEL_CON(26), 15, 1, MFLAGS, 9, 5, DFLAGS),
|
||||
|
||||
DIV(0, "pclk_pd_alive", "gpll", 0,
|
||||
@@ -578,7 +579,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
COMPOSITE(0, "mac_pll_src", mux_pll_src_npll_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(21), 0, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(2), 5, GFLAGS),
|
||||
MUX(SCLK_MAC, "mac_clk", mux_mac_p, 0,
|
||||
MUX(SCLK_MAC, "mac_clk", mux_mac_p, CLK_SET_RATE_PARENT,
|
||||
RK3288_CLKSEL_CON(21), 4, 1, MFLAGS),
|
||||
GATE(SCLK_MACREF_OUT, "sclk_macref_out", "mac_clk", 0,
|
||||
RK3288_CLKGATE_CON(5), 3, GFLAGS),
|
||||
@@ -592,8 +593,10 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
COMPOSITE(0, "hsadc_src", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(22), 0, 1, MFLAGS, 8, 8, DFLAGS,
|
||||
RK3288_CLKGATE_CON(2), 6, GFLAGS),
|
||||
MUX(SCLK_HSADC, "sclk_hsadc_out", mux_hsadcout_p, 0,
|
||||
MUX(0, "sclk_hsadc_out", mux_hsadcout_p, 0,
|
||||
RK3288_CLKSEL_CON(22), 4, 1, MFLAGS),
|
||||
INVERTER(SCLK_HSADC, "sclk_hsadc", "sclk_hsadc_out",
|
||||
RK3288_CLKSEL_CON(22), 7, IFLAGS),
|
||||
|
||||
GATE(0, "jtag", "ext_jtag", 0,
|
||||
RK3288_CLKGATE_CON(4), 14, GFLAGS),
|
||||
@@ -768,7 +771,9 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
*/
|
||||
|
||||
GATE(0, "pclk_vip_in", "ext_vip", 0, RK3288_CLKGATE_CON(16), 0, GFLAGS),
|
||||
INVERTER(0, "pclk_vip", "pclk_vip_in", RK3288_CLKSEL_CON(29), 4, IFLAGS),
|
||||
GATE(0, "pclk_isp_in", "ext_isp", 0, RK3288_CLKGATE_CON(16), 3, GFLAGS),
|
||||
INVERTER(0, "pclk_isp", "pclk_isp_in", RK3288_CLKSEL_CON(29), 3, IFLAGS),
|
||||
};
|
||||
|
||||
static const char *const rk3288_critical_clocks[] __initconst = {
|
||||
|
||||
881
drivers/clk/rockchip/clk-rk3368.c
Normal file
881
drivers/clk/rockchip/clk-rk3368.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -277,6 +277,13 @@ void __init rockchip_clk_register_branches(
|
||||
list->div_shift
|
||||
);
|
||||
break;
|
||||
case branch_inverter:
|
||||
clk = rockchip_clk_register_inverter(
|
||||
list->name, list->parent_names,
|
||||
list->num_parents,
|
||||
reg_base + list->muxdiv_offset,
|
||||
list->div_shift, list->div_flags, &clk_lock);
|
||||
break;
|
||||
}
|
||||
|
||||
/* none of the cases above matched */
|
||||
|
||||
@@ -31,22 +31,22 @@
|
||||
((val) << (shift) | (mask) << ((shift) + 16))
|
||||
|
||||
/* register positions shared by RK2928, RK3066 and RK3188 */
|
||||
#define RK2928_PLL_CON(x) (x * 0x4)
|
||||
#define RK2928_PLL_CON(x) ((x) * 0x4)
|
||||
#define RK2928_MODE_CON 0x40
|
||||
#define RK2928_CLKSEL_CON(x) (x * 0x4 + 0x44)
|
||||
#define RK2928_CLKGATE_CON(x) (x * 0x4 + 0xd0)
|
||||
#define RK2928_CLKSEL_CON(x) ((x) * 0x4 + 0x44)
|
||||
#define RK2928_CLKGATE_CON(x) ((x) * 0x4 + 0xd0)
|
||||
#define RK2928_GLB_SRST_FST 0x100
|
||||
#define RK2928_GLB_SRST_SND 0x104
|
||||
#define RK2928_SOFTRST_CON(x) (x * 0x4 + 0x110)
|
||||
#define RK2928_SOFTRST_CON(x) ((x) * 0x4 + 0x110)
|
||||
#define RK2928_MISC_CON 0x134
|
||||
|
||||
#define RK3288_PLL_CON(x) RK2928_PLL_CON(x)
|
||||
#define RK3288_MODE_CON 0x50
|
||||
#define RK3288_CLKSEL_CON(x) (x * 0x4 + 0x60)
|
||||
#define RK3288_CLKGATE_CON(x) (x * 0x4 + 0x160)
|
||||
#define RK3288_CLKSEL_CON(x) ((x) * 0x4 + 0x60)
|
||||
#define RK3288_CLKGATE_CON(x) ((x) * 0x4 + 0x160)
|
||||
#define RK3288_GLB_SRST_FST 0x1b0
|
||||
#define RK3288_GLB_SRST_SND 0x1b4
|
||||
#define RK3288_SOFTRST_CON(x) (x * 0x4 + 0x1b8)
|
||||
#define RK3288_SOFTRST_CON(x) ((x) * 0x4 + 0x1b8)
|
||||
#define RK3288_MISC_CON 0x1e8
|
||||
#define RK3288_SDMMC_CON0 0x200
|
||||
#define RK3288_SDMMC_CON1 0x204
|
||||
@@ -57,6 +57,22 @@
|
||||
#define RK3288_EMMC_CON0 0x218
|
||||
#define RK3288_EMMC_CON1 0x21c
|
||||
|
||||
#define RK3368_PLL_CON(x) RK2928_PLL_CON(x)
|
||||
#define RK3368_CLKSEL_CON(x) ((x) * 0x4 + 0x100)
|
||||
#define RK3368_CLKGATE_CON(x) ((x) * 0x4 + 0x200)
|
||||
#define RK3368_GLB_SRST_FST 0x280
|
||||
#define RK3368_GLB_SRST_SND 0x284
|
||||
#define RK3368_SOFTRST_CON(x) ((x) * 0x4 + 0x300)
|
||||
#define RK3368_MISC_CON 0x380
|
||||
#define RK3368_SDMMC_CON0 0x400
|
||||
#define RK3368_SDMMC_CON1 0x404
|
||||
#define RK3368_SDIO0_CON0 0x408
|
||||
#define RK3368_SDIO0_CON1 0x40c
|
||||
#define RK3368_SDIO1_CON0 0x410
|
||||
#define RK3368_SDIO1_CON1 0x414
|
||||
#define RK3368_EMMC_CON0 0x418
|
||||
#define RK3368_EMMC_CON1 0x41c
|
||||
|
||||
enum rockchip_pll_type {
|
||||
pll_rk3066,
|
||||
};
|
||||
@@ -67,7 +83,7 @@ enum rockchip_pll_type {
|
||||
.nr = _nr, \
|
||||
.nf = _nf, \
|
||||
.no = _no, \
|
||||
.bwadj = (_nf >> 1), \
|
||||
.bwadj = ((_nf) >> 1), \
|
||||
}
|
||||
|
||||
#define RK3066_PLL_RATE_BWADJ(_rate, _nr, _nf, _no, _bw) \
|
||||
@@ -182,6 +198,13 @@ struct clk *rockchip_clk_register_mmc(const char *name,
|
||||
const char *const *parent_names, u8 num_parents,
|
||||
void __iomem *reg, int shift);
|
||||
|
||||
#define ROCKCHIP_INVERTER_HIWORD_MASK BIT(0)
|
||||
|
||||
struct clk *rockchip_clk_register_inverter(const char *name,
|
||||
const char *const *parent_names, u8 num_parents,
|
||||
void __iomem *reg, int shift, int flags,
|
||||
spinlock_t *lock);
|
||||
|
||||
#define PNAME(x) static const char *const x[] __initconst
|
||||
|
||||
enum rockchip_clk_branch_type {
|
||||
@@ -191,6 +214,7 @@ enum rockchip_clk_branch_type {
|
||||
branch_fraction_divider,
|
||||
branch_gate,
|
||||
branch_mmc,
|
||||
branch_inverter,
|
||||
};
|
||||
|
||||
struct rockchip_clk_branch {
|
||||
@@ -308,6 +332,26 @@ struct rockchip_clk_branch {
|
||||
.gate_offset = -1, \
|
||||
}
|
||||
|
||||
#define COMPOSITE_NOGATE_DIVTBL(_id, cname, pnames, f, mo, ms, \
|
||||
mw, mf, ds, dw, df, dt) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_composite, \
|
||||
.name = cname, \
|
||||
.parent_names = pnames, \
|
||||
.num_parents = ARRAY_SIZE(pnames), \
|
||||
.flags = f, \
|
||||
.muxdiv_offset = mo, \
|
||||
.mux_shift = ms, \
|
||||
.mux_width = mw, \
|
||||
.mux_flags = mf, \
|
||||
.div_shift = ds, \
|
||||
.div_width = dw, \
|
||||
.div_flags = df, \
|
||||
.div_table = dt, \
|
||||
.gate_offset = -1, \
|
||||
}
|
||||
|
||||
#define COMPOSITE_FRAC(_id, cname, pname, f, mo, df, go, gs, gf)\
|
||||
{ \
|
||||
.id = _id, \
|
||||
@@ -394,6 +438,18 @@ struct rockchip_clk_branch {
|
||||
.div_shift = shift, \
|
||||
}
|
||||
|
||||
#define INVERTER(_id, cname, pname, io, is, if) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_inverter, \
|
||||
.name = cname, \
|
||||
.parent_names = (const char *[]){ pname }, \
|
||||
.num_parents = 1, \
|
||||
.muxdiv_offset = io, \
|
||||
.div_shift = is, \
|
||||
.div_flags = if, \
|
||||
}
|
||||
|
||||
void rockchip_clk_init(struct device_node *np, void __iomem *base,
|
||||
unsigned long nr_clks);
|
||||
struct regmap *rockchip_clk_get_grf(void);
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3066A_H
|
||||
#define _DT_BINDINGS_CLK_ROCKCHIP_RK3066A_H
|
||||
|
||||
#include <dt-bindings/clock/rk3188-cru-common.h>
|
||||
|
||||
/* soft-reset indices */
|
||||
@@ -33,3 +36,5 @@
|
||||
#define SRST_HDMI 96
|
||||
#define SRST_HDMI_APB 97
|
||||
#define SRST_CIF1 111
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3188_COMMON_H
|
||||
#define _DT_BINDINGS_CLK_ROCKCHIP_RK3188_COMMON_H
|
||||
|
||||
/* core clocks from */
|
||||
#define PLL_APLL 1
|
||||
#define PLL_DPLL 2
|
||||
@@ -248,3 +251,5 @@
|
||||
#define SRST_PTM1_ATB 141
|
||||
#define SRST_CTM 142
|
||||
#define SRST_TS 143
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3188_H
|
||||
#define _DT_BINDINGS_CLK_ROCKCHIP_RK3188_H
|
||||
|
||||
#include <dt-bindings/clock/rk3188-cru-common.h>
|
||||
|
||||
/* soft-reset indices */
|
||||
@@ -49,3 +52,5 @@
|
||||
#define SRST_GPU_BRIDGE 121
|
||||
#define SRST_CTI3 123
|
||||
#define SRST_CTI3_APB 124
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3288_H
|
||||
#define _DT_BINDINGS_CLK_ROCKCHIP_RK3288_H
|
||||
|
||||
/* core clocks */
|
||||
#define PLL_APLL 1
|
||||
#define PLL_DPLL 2
|
||||
@@ -376,3 +379,5 @@
|
||||
#define SRST_TSP_CLKIN0 189
|
||||
#define SRST_TSP_CLKIN1 190
|
||||
#define SRST_TSP_27M 191
|
||||
|
||||
#endif
|
||||
|
||||
384
include/dt-bindings/clock/rk3368-cru.h
Normal file
384
include/dt-bindings/clock/rk3368-cru.h
Normal file
@@ -0,0 +1,384 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3368_H
|
||||
#define _DT_BINDINGS_CLK_ROCKCHIP_RK3368_H
|
||||
|
||||
/* core clocks */
|
||||
#define PLL_APLLB 1
|
||||
#define PLL_APLLL 2
|
||||
#define PLL_DPLL 3
|
||||
#define PLL_CPLL 4
|
||||
#define PLL_GPLL 5
|
||||
#define PLL_NPLL 6
|
||||
#define ARMCLKB 7
|
||||
#define ARMCLKL 8
|
||||
|
||||
/* sclk gates (special clocks) */
|
||||
#define SCLK_GPU_CORE 64
|
||||
#define SCLK_SPI0 65
|
||||
#define SCLK_SPI1 66
|
||||
#define SCLK_SPI2 67
|
||||
#define SCLK_SDMMC 68
|
||||
#define SCLK_SDIO0 69
|
||||
#define SCLK_EMMC 71
|
||||
#define SCLK_TSADC 72
|
||||
#define SCLK_SARADC 73
|
||||
#define SCLK_NANDC0 75
|
||||
#define SCLK_UART0 77
|
||||
#define SCLK_UART1 78
|
||||
#define SCLK_UART2 79
|
||||
#define SCLK_UART3 80
|
||||
#define SCLK_UART4 81
|
||||
#define SCLK_I2S_8CH 82
|
||||
#define SCLK_SPDIF_8CH 83
|
||||
#define SCLK_I2S_2CH 84
|
||||
#define SCLK_TIMER0 85
|
||||
#define SCLK_TIMER1 86
|
||||
#define SCLK_TIMER2 87
|
||||
#define SCLK_TIMER3 88
|
||||
#define SCLK_TIMER4 89
|
||||
#define SCLK_TIMER5 90
|
||||
#define SCLK_TIMER6 91
|
||||
#define SCLK_OTGPHY0 93
|
||||
#define SCLK_OTG_ADP 96
|
||||
#define SCLK_HSICPHY480M 97
|
||||
#define SCLK_HSICPHY12M 98
|
||||
#define SCLK_MACREF 99
|
||||
#define SCLK_VOP0_PWM 100
|
||||
#define SCLK_MAC_RX 102
|
||||
#define SCLK_MAC_TX 103
|
||||
#define SCLK_EDP_24M 104
|
||||
#define SCLK_EDP 105
|
||||
#define SCLK_RGA 106
|
||||
#define SCLK_ISP 107
|
||||
#define SCLK_HDCP 108
|
||||
#define SCLK_HDMI_HDCP 109
|
||||
#define SCLK_HDMI_CEC 110
|
||||
#define SCLK_HEVC_CABAC 111
|
||||
#define SCLK_HEVC_CORE 112
|
||||
#define SCLK_I2S_8CH_OUT 113
|
||||
#define SCLK_SDMMC_DRV 114
|
||||
#define SCLK_SDIO0_DRV 115
|
||||
#define SCLK_EMMC_DRV 117
|
||||
#define SCLK_SDMMC_SAMPLE 118
|
||||
#define SCLK_SDIO0_SAMPLE 119
|
||||
#define SCLK_EMMC_SAMPLE 121
|
||||
#define SCLK_USBPHY480M 122
|
||||
#define SCLK_PVTM_CORE 123
|
||||
#define SCLK_PVTM_GPU 124
|
||||
#define SCLK_PVTM_PMU 125
|
||||
#define SCLK_SFC 126
|
||||
#define SCLK_MAC 127
|
||||
#define SCLK_MACREF_OUT 128
|
||||
|
||||
#define DCLK_VOP 190
|
||||
#define MCLK_CRYPTO 191
|
||||
|
||||
/* aclk gates */
|
||||
#define ACLK_GPU_MEM 192
|
||||
#define ACLK_GPU_CFG 193
|
||||
#define ACLK_DMAC_BUS 194
|
||||
#define ACLK_DMAC_PERI 195
|
||||
#define ACLK_PERI_MMU 196
|
||||
#define ACLK_GMAC 197
|
||||
#define ACLK_VOP 198
|
||||
#define ACLK_VOP_IEP 199
|
||||
#define ACLK_RGA 200
|
||||
#define ACLK_HDCP 201
|
||||
#define ACLK_IEP 202
|
||||
#define ACLK_VIO0_NOC 203
|
||||
#define ACLK_VIP 204
|
||||
#define ACLK_ISP 205
|
||||
#define ACLK_VIO1_NOC 206
|
||||
#define ACLK_VIDEO 208
|
||||
#define ACLK_BUS 209
|
||||
#define ACLK_PERI 210
|
||||
|
||||
/* pclk gates */
|
||||
#define PCLK_GPIO0 320
|
||||
#define PCLK_GPIO1 321
|
||||
#define PCLK_GPIO2 322
|
||||
#define PCLK_GPIO3 323
|
||||
#define PCLK_PMUGRF 324
|
||||
#define PCLK_MAILBOX 325
|
||||
#define PCLK_GRF 329
|
||||
#define PCLK_SGRF 330
|
||||
#define PCLK_PMU 331
|
||||
#define PCLK_I2C0 332
|
||||
#define PCLK_I2C1 333
|
||||
#define PCLK_I2C2 334
|
||||
#define PCLK_I2C3 335
|
||||
#define PCLK_I2C4 336
|
||||
#define PCLK_I2C5 337
|
||||
#define PCLK_SPI0 338
|
||||
#define PCLK_SPI1 339
|
||||
#define PCLK_SPI2 340
|
||||
#define PCLK_UART0 341
|
||||
#define PCLK_UART1 342
|
||||
#define PCLK_UART2 343
|
||||
#define PCLK_UART3 344
|
||||
#define PCLK_UART4 345
|
||||
#define PCLK_TSADC 346
|
||||
#define PCLK_SARADC 347
|
||||
#define PCLK_SIM 348
|
||||
#define PCLK_GMAC 349
|
||||
#define PCLK_PWM0 350
|
||||
#define PCLK_PWM1 351
|
||||
#define PCLK_TIMER0 353
|
||||
#define PCLK_TIMER1 354
|
||||
#define PCLK_EDP_CTRL 355
|
||||
#define PCLK_MIPI_DSI0 356
|
||||
#define PCLK_MIPI_CSI 358
|
||||
#define PCLK_HDCP 359
|
||||
#define PCLK_HDMI_CTRL 360
|
||||
#define PCLK_VIO_H2P 361
|
||||
#define PCLK_BUS 362
|
||||
#define PCLK_PERI 363
|
||||
#define PCLK_DDRUPCTL 364
|
||||
#define PCLK_DDRPHY 365
|
||||
#define PCLK_ISP 366
|
||||
#define PCLK_VIP 367
|
||||
#define PCLK_WDT 368
|
||||
|
||||
/* hclk gates */
|
||||
#define HCLK_SFC 448
|
||||
#define HCLK_OTG0 449
|
||||
#define HCLK_HOST0 450
|
||||
#define HCLK_HOST1 451
|
||||
#define HCLK_HSIC 452
|
||||
#define HCLK_NANDC0 453
|
||||
#define HCLK_TSP 455
|
||||
#define HCLK_SDMMC 456
|
||||
#define HCLK_SDIO0 457
|
||||
#define HCLK_EMMC 459
|
||||
#define HCLK_HSADC 460
|
||||
#define HCLK_CRYPTO 461
|
||||
#define HCLK_I2S_2CH 462
|
||||
#define HCLK_I2S_8CH 463
|
||||
#define HCLK_SPDIF 464
|
||||
#define HCLK_VOP 465
|
||||
#define HCLK_ROM 467
|
||||
#define HCLK_IEP 468
|
||||
#define HCLK_ISP 469
|
||||
#define HCLK_RGA 470
|
||||
#define HCLK_VIO_AHB_ARBI 471
|
||||
#define HCLK_VIO_NOC 472
|
||||
#define HCLK_VIP 473
|
||||
#define HCLK_VIO_H2P 474
|
||||
#define HCLK_VIO_HDCPMMU 475
|
||||
#define HCLK_VIDEO 476
|
||||
#define HCLK_BUS 477
|
||||
#define HCLK_PERI 478
|
||||
|
||||
#define CLK_NR_CLKS (HCLK_PERI + 1)
|
||||
|
||||
/* soft-reset indices */
|
||||
#define SRST_CORE_B0 0
|
||||
#define SRST_CORE_B1 1
|
||||
#define SRST_CORE_B2 2
|
||||
#define SRST_CORE_B3 3
|
||||
#define SRST_CORE_B0_PO 4
|
||||
#define SRST_CORE_B1_PO 5
|
||||
#define SRST_CORE_B2_PO 6
|
||||
#define SRST_CORE_B3_PO 7
|
||||
#define SRST_L2_B 8
|
||||
#define SRST_ADB_B 9
|
||||
#define SRST_PD_CORE_B_NIU 10
|
||||
#define SRST_PDBUS_STRSYS 11
|
||||
#define SRST_SOCDBG_B 14
|
||||
#define SRST_CORE_B_DBG 15
|
||||
|
||||
#define SRST_DMAC1 18
|
||||
#define SRST_INTMEM 19
|
||||
#define SRST_ROM 20
|
||||
#define SRST_SPDIF8CH 21
|
||||
#define SRST_I2S8CH 23
|
||||
#define SRST_MAILBOX 24
|
||||
#define SRST_I2S2CH 25
|
||||
#define SRST_EFUSE_256 26
|
||||
#define SRST_MCU_SYS 28
|
||||
#define SRST_MCU_PO 29
|
||||
#define SRST_MCU_NOC 30
|
||||
#define SRST_EFUSE 31
|
||||
|
||||
#define SRST_GPIO0 32
|
||||
#define SRST_GPIO1 33
|
||||
#define SRST_GPIO2 34
|
||||
#define SRST_GPIO3 35
|
||||
#define SRST_GPIO4 36
|
||||
#define SRST_PMUGRF 41
|
||||
#define SRST_I2C0 42
|
||||
#define SRST_I2C1 43
|
||||
#define SRST_I2C2 44
|
||||
#define SRST_I2C3 45
|
||||
#define SRST_I2C4 46
|
||||
#define SRST_I2C5 47
|
||||
|
||||
#define SRST_DWPWM 48
|
||||
#define SRST_MMC_PERI 49
|
||||
#define SRST_PERIPH_MMU 50
|
||||
#define SRST_GRF 55
|
||||
#define SRST_PMU 56
|
||||
#define SRST_PERIPH_AXI 57
|
||||
#define SRST_PERIPH_AHB 58
|
||||
#define SRST_PERIPH_APB 59
|
||||
#define SRST_PERIPH_NIU 60
|
||||
#define SRST_PDPERI_AHB_ARBI 61
|
||||
#define SRST_EMEM 62
|
||||
#define SRST_USB_PERI 63
|
||||
|
||||
#define SRST_DMAC2 64
|
||||
#define SRST_MAC 66
|
||||
#define SRST_GPS 67
|
||||
#define SRST_RKPWM 69
|
||||
#define SRST_USBHOST0 72
|
||||
#define SRST_HSIC 73
|
||||
#define SRST_HSIC_AUX 74
|
||||
#define SRST_HSIC_PHY 75
|
||||
#define SRST_HSADC 76
|
||||
#define SRST_NANDC0 77
|
||||
#define SRST_SFC 79
|
||||
|
||||
#define SRST_SPI0 83
|
||||
#define SRST_SPI1 84
|
||||
#define SRST_SPI2 85
|
||||
#define SRST_SARADC 87
|
||||
#define SRST_PDALIVE_NIU 88
|
||||
#define SRST_PDPMU_INTMEM 89
|
||||
#define SRST_PDPMU_NIU 90
|
||||
#define SRST_SGRF 91
|
||||
|
||||
#define SRST_VIO_ARBI 96
|
||||
#define SRST_RGA_NIU 97
|
||||
#define SRST_VIO0_NIU_AXI 98
|
||||
#define SRST_VIO_NIU_AHB 99
|
||||
#define SRST_LCDC0_AXI 100
|
||||
#define SRST_LCDC0_AHB 101
|
||||
#define SRST_LCDC0_DCLK 102
|
||||
#define SRST_VIP 104
|
||||
#define SRST_RGA_CORE 105
|
||||
#define SRST_IEP_AXI 106
|
||||
#define SRST_IEP_AHB 107
|
||||
#define SRST_RGA_AXI 108
|
||||
#define SRST_RGA_AHB 109
|
||||
#define SRST_ISP 110
|
||||
#define SRST_EDP_24M 111
|
||||
|
||||
#define SRST_VIDEO_AXI 112
|
||||
#define SRST_VIDEO_AHB 113
|
||||
#define SRST_MIPIDPHYTX 114
|
||||
#define SRST_MIPIDSI0 115
|
||||
#define SRST_MIPIDPHYRX 116
|
||||
#define SRST_MIPICSI 117
|
||||
#define SRST_GPU 120
|
||||
#define SRST_HDMI 121
|
||||
#define SRST_EDP 122
|
||||
#define SRST_PMU_PVTM 123
|
||||
#define SRST_CORE_PVTM 124
|
||||
#define SRST_GPU_PVTM 125
|
||||
#define SRST_GPU_SYS 126
|
||||
#define SRST_GPU_MEM_NIU 127
|
||||
|
||||
#define SRST_MMC0 128
|
||||
#define SRST_SDIO0 129
|
||||
#define SRST_EMMC 131
|
||||
#define SRST_USBOTG_AHB 132
|
||||
#define SRST_USBOTG_PHY 133
|
||||
#define SRST_USBOTG_CON 134
|
||||
#define SRST_USBHOST0_AHB 135
|
||||
#define SRST_USBHOST0_PHY 136
|
||||
#define SRST_USBHOST0_CON 137
|
||||
#define SRST_USBOTG_UTMI 138
|
||||
#define SRST_USBHOST1_UTMI 139
|
||||
#define SRST_USB_ADP 141
|
||||
|
||||
#define SRST_CORESIGHT 144
|
||||
#define SRST_PD_CORE_AHB_NOC 145
|
||||
#define SRST_PD_CORE_APB_NOC 146
|
||||
#define SRST_GIC 148
|
||||
#define SRST_LCDC_PWM0 149
|
||||
#define SRST_RGA_H2P_BRG 153
|
||||
#define SRST_VIDEO 154
|
||||
#define SRST_GPU_CFG_NIU 157
|
||||
#define SRST_TSADC 159
|
||||
|
||||
#define SRST_DDRPHY0 160
|
||||
#define SRST_DDRPHY0_APB 161
|
||||
#define SRST_DDRCTRL0 162
|
||||
#define SRST_DDRCTRL0_APB 163
|
||||
#define SRST_VIDEO_NIU 165
|
||||
#define SRST_VIDEO_NIU_AHB 167
|
||||
#define SRST_DDRMSCH0 170
|
||||
#define SRST_PDBUS_AHB 173
|
||||
#define SRST_CRYPTO 174
|
||||
|
||||
#define SRST_UART0 179
|
||||
#define SRST_UART1 180
|
||||
#define SRST_UART2 181
|
||||
#define SRST_UART3 182
|
||||
#define SRST_UART4 183
|
||||
#define SRST_SIMC 186
|
||||
#define SRST_TSP 188
|
||||
#define SRST_TSP_CLKIN0 189
|
||||
|
||||
#define SRST_CORE_L0 192
|
||||
#define SRST_CORE_L1 193
|
||||
#define SRST_CORE_L2 194
|
||||
#define SRST_CORE_L3 195
|
||||
#define SRST_CORE_L0_PO 195
|
||||
#define SRST_CORE_L1_PO 197
|
||||
#define SRST_CORE_L2_PO 198
|
||||
#define SRST_CORE_L3_PO 199
|
||||
#define SRST_L2_L 200
|
||||
#define SRST_ADB_L 201
|
||||
#define SRST_PD_CORE_L_NIU 202
|
||||
#define SRST_CCI_SYS 203
|
||||
#define SRST_CCI_DDR 204
|
||||
#define SRST_CCI 205
|
||||
#define SRST_SOCDBG_L 206
|
||||
#define SRST_CORE_L_DBG 207
|
||||
|
||||
#define SRST_CORE_B0_NC 208
|
||||
#define SRST_CORE_B0_PO_NC 209
|
||||
#define SRST_L2_B_NC 210
|
||||
#define SRST_ADB_B_NC 211
|
||||
#define SRST_PD_CORE_B_NIU_NC 212
|
||||
#define SRST_PDBUS_STRSYS_NC 213
|
||||
#define SRST_CORE_L0_NC 214
|
||||
#define SRST_CORE_L0_PO_NC 215
|
||||
#define SRST_L2_L_NC 216
|
||||
#define SRST_ADB_L_NC 217
|
||||
#define SRST_PD_CORE_L_NIU_NC 218
|
||||
#define SRST_CCI_SYS_NC 219
|
||||
#define SRST_CCI_DDR_NC 220
|
||||
#define SRST_CCI_NC 221
|
||||
#define SRST_TRACE_NC 222
|
||||
|
||||
#define SRST_TIMER00 224
|
||||
#define SRST_TIMER01 225
|
||||
#define SRST_TIMER02 226
|
||||
#define SRST_TIMER03 227
|
||||
#define SRST_TIMER04 228
|
||||
#define SRST_TIMER05 229
|
||||
#define SRST_TIMER10 230
|
||||
#define SRST_TIMER11 231
|
||||
#define SRST_TIMER12 232
|
||||
#define SRST_TIMER13 233
|
||||
#define SRST_TIMER14 234
|
||||
#define SRST_TIMER15 235
|
||||
#define SRST_TIMER0_APB 236
|
||||
#define SRST_TIMER1_APB 237
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user