mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
Merge branches 'clk-mediatek', 'clk-sunplus', 'clk-loongson' and 'clk-socfpga' into clk-next
- Frequency Hopping (FHCTL) on MediaTek MT6795, MT8173, MT8192 and MT8195 SoCs - Converted most Mediatek clock drivers to struct platform_driver - MediaTek clock drivers can be built as modules - Mediatek MT8188 SoC clk drivers - Clock driver for Sunplus SP7021 SoC - Reimplement Loongson-1 clk driver with DT support - Clk driver support for Loongson-2 SoCs - Migrate socfpga clk driver to of_clk_add_hw_provider() * clk-mediatek: (84 commits) clk: mediatek: fhctl: Mark local variables static clk: mediatek: Use right match table, include mod_devicetable clk: mediatek: Add MT8188 adsp clock support clk: mediatek: Add MT8188 imp i2c wrapper clock support clk: mediatek: Add MT8188 wpesys clock support clk: mediatek: Add MT8188 vppsys1 clock support clk: mediatek: Add MT8188 vppsys0 clock support clk: mediatek: Add MT8188 vencsys clock support clk: mediatek: Add MT8188 vdosys1 clock support clk: mediatek: Add MT8188 vdosys0 clock support clk: mediatek: Add MT8188 vdecsys clock support clk: mediatek: Add MT8188 mfgcfg clock support clk: mediatek: Add MT8188 ipesys clock support clk: mediatek: Add MT8188 imgsys clock support clk: mediatek: Add MT8188 ccusys clock support clk: mediatek: Add MT8188 camsys clock support clk: mediatek: Add MT8188 infrastructure clock support clk: mediatek: Add MT8188 peripheral clock support clk: mediatek: Add MT8188 topckgen clock support clk: mediatek: Add MT8188 apmixedsys clock support ... * clk-sunplus: clk: Add Sunplus SP7021 clock driver * clk-loongson: clk: clk-loongson2: add clock controller driver support dt-bindings: clock: add loongson-2 boot clock index MAINTAINERS: remove obsolete file entry in MIPS/LOONGSON1 ARCHITECTURE MIPS: loongson32: Update the clock initialization clk: loongson1: Re-implement the clock driver clk: loongson1: Remove the outdated driver dt-bindings: clock: Add Loongson-1 clock * clk-socfpga: clk: socfpga: arria10: use of_clk_add_hw_provider and improve error handling clk: socfpga: use of_clk_add_hw_provider and improve error handling clk: socfpga: arria10: use of_clk_add_hw_provider and improve error handling clk: socfpga: use of_clk_add_hw_provider and improve error handling clk: socfpga: arria10: use of_clk_add_hw_provider and improve error handling clk: socfpga: use of_clk_add_hw_provider and improve error handling
This commit is contained in:
commit
6f7478e3bb
@ -0,0 +1,45 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/clock/loongson,ls1x-clk.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Loongson-1 Clock Controller
|
||||
|
||||
maintainers:
|
||||
- Keguang Zhang <keguang.zhang@gmail.com>
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- loongson,ls1b-clk
|
||||
- loongson,ls1c-clk
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
clocks:
|
||||
maxItems: 1
|
||||
|
||||
"#clock-cells":
|
||||
const: 1
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- clocks
|
||||
- "#clock-cells"
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
clkc: clock-controller@1fe78030 {
|
||||
compatible = "loongson,ls1b-clk";
|
||||
reg = <0x1fe78030 0x8>;
|
||||
|
||||
clocks = <&xtal>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
...
|
@ -16,7 +16,12 @@ description: |
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
const: mediatek,mt8186-fhctl
|
||||
enum:
|
||||
- mediatek,mt6795-fhctl
|
||||
- mediatek,mt8173-fhctl
|
||||
- mediatek,mt8186-fhctl
|
||||
- mediatek,mt8192-fhctl
|
||||
- mediatek,mt8195-fhctl
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
@ -0,0 +1,71 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/clock/mediatek,mt8188-clock.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: MediaTek Functional Clock Controller for MT8188
|
||||
|
||||
maintainers:
|
||||
- Garmin Chang <garmin.chang@mediatek.com>
|
||||
|
||||
description: |
|
||||
The clock architecture in MediaTek like below
|
||||
PLLs -->
|
||||
dividers -->
|
||||
muxes
|
||||
-->
|
||||
clock gate
|
||||
|
||||
The devices provide clock gate control in different IP blocks.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- mediatek,mt8188-adsp-audio26m
|
||||
- mediatek,mt8188-camsys
|
||||
- mediatek,mt8188-camsys-rawa
|
||||
- mediatek,mt8188-camsys-rawb
|
||||
- mediatek,mt8188-camsys-yuva
|
||||
- mediatek,mt8188-camsys-yuvb
|
||||
- mediatek,mt8188-ccusys
|
||||
- mediatek,mt8188-imgsys
|
||||
- mediatek,mt8188-imgsys-wpe1
|
||||
- mediatek,mt8188-imgsys-wpe2
|
||||
- mediatek,mt8188-imgsys-wpe3
|
||||
- mediatek,mt8188-imgsys1-dip-nr
|
||||
- mediatek,mt8188-imgsys1-dip-top
|
||||
- mediatek,mt8188-imp-iic-wrap-c
|
||||
- mediatek,mt8188-imp-iic-wrap-en
|
||||
- mediatek,mt8188-imp-iic-wrap-w
|
||||
- mediatek,mt8188-ipesys
|
||||
- mediatek,mt8188-mfgcfg
|
||||
- mediatek,mt8188-vdecsys
|
||||
- mediatek,mt8188-vdecsys-soc
|
||||
- mediatek,mt8188-vencsys
|
||||
- mediatek,mt8188-vppsys0
|
||||
- mediatek,mt8188-vppsys1
|
||||
- mediatek,mt8188-wpesys
|
||||
- mediatek,mt8188-wpesys-vpp0
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
'#clock-cells':
|
||||
const: 1
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- '#clock-cells'
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
clock-controller@11283000 {
|
||||
compatible = "mediatek,mt8188-imp-iic-wrap-c";
|
||||
reg = <0x11283000 0x1000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
@ -0,0 +1,55 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/clock/mediatek,mt8188-sys-clock.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: MediaTek System Clock Controller for MT8188
|
||||
|
||||
maintainers:
|
||||
- Garmin Chang <garmin.chang@mediatek.com>
|
||||
|
||||
description: |
|
||||
The clock architecture in MediaTek like below
|
||||
PLLs -->
|
||||
dividers -->
|
||||
muxes
|
||||
-->
|
||||
clock gate
|
||||
|
||||
The apmixedsys provides most of PLLs which generated from SoC 26m.
|
||||
The topckgen provides dividers and muxes which provide the clock source to other IP blocks.
|
||||
The infracfg_ao provides clock gate in peripheral and infrastructure IP blocks.
|
||||
The mcusys provides mux control to select the clock source in AP MCU.
|
||||
The device nodes also provide the system control capacity for configuration.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
items:
|
||||
- enum:
|
||||
- mediatek,mt8188-apmixedsys
|
||||
- mediatek,mt8188-infracfg-ao
|
||||
- mediatek,mt8188-pericfg-ao
|
||||
- mediatek,mt8188-topckgen
|
||||
- const: syscon
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
'#clock-cells':
|
||||
const: 1
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- '#clock-cells'
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
clock-controller@10000000 {
|
||||
compatible = "mediatek,mt8188-topckgen", "syscon";
|
||||
reg = <0x10000000 0x1000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
@ -2849,6 +2849,7 @@ F: Documentation/devicetree/bindings/reset/sunplus,reset.yaml
|
||||
F: arch/arm/boot/dts/sunplus-sp7021*.dts*
|
||||
F: arch/arm/configs/sp7021_*defconfig
|
||||
F: arch/arm/mach-sunplus/
|
||||
F: drivers/clk/clk-sp7021.c
|
||||
F: drivers/irqchip/irq-sp7021-intc.c
|
||||
F: drivers/reset/reset-sunplus.c
|
||||
F: include/dt-bindings/clock/sunplus,sp7021-clkc.h
|
||||
@ -12121,6 +12122,7 @@ M: Yinbo Zhu <zhuyinbo@loongson.cn>
|
||||
L: linux-clk@vger.kernel.org
|
||||
S: Maintained
|
||||
F: Documentation/devicetree/bindings/clock/loongson,ls2k-clk.yaml
|
||||
F: drivers/clk/clk-loongson2.c
|
||||
F: include/dt-bindings/clock/loongson,ls2k-clk.h
|
||||
|
||||
LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
|
||||
@ -14000,7 +14002,6 @@ L: linux-mips@vger.kernel.org
|
||||
S: Maintained
|
||||
F: arch/mips/include/asm/mach-loongson32/
|
||||
F: arch/mips/loongson32/
|
||||
F: drivers/*/*/*loongson1*
|
||||
F: drivers/*/*loongson1*
|
||||
|
||||
MIPS/LOONGSON2EF ARCHITECTURE
|
||||
|
@ -20,7 +20,6 @@ extern struct platform_device ls1x_gpio1_pdev;
|
||||
extern struct platform_device ls1x_rtc_pdev;
|
||||
extern struct platform_device ls1x_wdt_pdev;
|
||||
|
||||
void __init ls1x_clk_init(void);
|
||||
void __init ls1x_rtc_set_extclk(struct platform_device *pdev);
|
||||
void __init ls1x_serial_set_uartclk(struct platform_device *pdev);
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/of_clk.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/sizes.h>
|
||||
#include <asm/time.h>
|
||||
@ -211,7 +212,7 @@ void __init plat_time_init(void)
|
||||
struct clk *clk = NULL;
|
||||
|
||||
/* initialize LS1X clocks */
|
||||
ls1x_clk_init();
|
||||
of_clk_init(NULL);
|
||||
|
||||
#ifdef CONFIG_CEVT_CSRC_LS1X
|
||||
/* setup LS1X PWM timer */
|
||||
|
@ -325,6 +325,15 @@ config COMMON_CLK_LOCHNAGAR
|
||||
This driver supports the clocking features of the Cirrus Logic
|
||||
Lochnagar audio development board.
|
||||
|
||||
config COMMON_CLK_LOONGSON2
|
||||
bool "Clock driver for Loongson-2 SoC"
|
||||
depends on LOONGARCH || COMPILE_TEST
|
||||
help
|
||||
This driver provides support for clock controller on Loongson-2 SoC.
|
||||
The clock controller can generates and supplies clock to various
|
||||
peripherals within the SoC.
|
||||
Say Y here to support Loongson-2 SoC clock driver.
|
||||
|
||||
config COMMON_CLK_NXP
|
||||
def_bool COMMON_CLK && (ARCH_LPC18XX || ARCH_LPC32XX)
|
||||
select REGMAP_MMIO if ARCH_LPC32XX
|
||||
@ -445,6 +454,16 @@ config COMMON_CLK_K210
|
||||
help
|
||||
Support for the Canaan Kendryte K210 RISC-V SoC clocks.
|
||||
|
||||
config COMMON_CLK_SP7021
|
||||
tristate "Clock driver for Sunplus SP7021 SoC"
|
||||
depends on SOC_SP7021 || COMPILE_TEST
|
||||
default SOC_SP7021
|
||||
help
|
||||
This driver supports the Sunplus SP7021 SoC clocks.
|
||||
It implements SP7021 PLLs/gate.
|
||||
Not all features of the PLL are currently supported
|
||||
by the driver.
|
||||
|
||||
source "drivers/clk/actions/Kconfig"
|
||||
source "drivers/clk/analogbits/Kconfig"
|
||||
source "drivers/clk/baikal-t1/Kconfig"
|
||||
|
@ -43,6 +43,8 @@ obj-$(CONFIG_COMMON_CLK_K210) += clk-k210.o
|
||||
obj-$(CONFIG_LMK04832) += clk-lmk04832.o
|
||||
obj-$(CONFIG_COMMON_CLK_LAN966X) += clk-lan966x.o
|
||||
obj-$(CONFIG_COMMON_CLK_LOCHNAGAR) += clk-lochnagar.o
|
||||
obj-$(CONFIG_MACH_LOONGSON32) += clk-loongson1.o
|
||||
obj-$(CONFIG_COMMON_CLK_LOONGSON2) += clk-loongson2.o
|
||||
obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o
|
||||
obj-$(CONFIG_COMMON_CLK_MAX9485) += clk-max9485.o
|
||||
obj-$(CONFIG_ARCH_MILBEAUT_M10V) += clk-milbeaut.o
|
||||
@ -65,6 +67,7 @@ obj-$(CONFIG_COMMON_CLK_SI5351) += clk-si5351.o
|
||||
obj-$(CONFIG_COMMON_CLK_SI514) += clk-si514.o
|
||||
obj-$(CONFIG_COMMON_CLK_SI544) += clk-si544.o
|
||||
obj-$(CONFIG_COMMON_CLK_SI570) += clk-si570.o
|
||||
obj-$(CONFIG_COMMON_CLK_SP7021) += clk-sp7021.o
|
||||
obj-$(CONFIG_COMMON_CLK_STM32F) += clk-stm32f4.o
|
||||
obj-$(CONFIG_COMMON_CLK_STM32H7) += clk-stm32h7.o
|
||||
obj-$(CONFIG_COMMON_CLK_STM32MP157) += clk-stm32mp1.o
|
||||
@ -94,7 +97,6 @@ obj-y += imx/
|
||||
obj-y += ingenic/
|
||||
obj-$(CONFIG_ARCH_K3) += keystone/
|
||||
obj-$(CONFIG_ARCH_KEYSTONE) += keystone/
|
||||
obj-$(CONFIG_MACH_LOONGSON32) += loongson1/
|
||||
obj-y += mediatek/
|
||||
obj-$(CONFIG_ARCH_MESON) += meson/
|
||||
obj-y += microchip/
|
||||
|
303
drivers/clk/clk-loongson1.c
Normal file
303
drivers/clk/clk-loongson1.c
Normal file
@ -0,0 +1,303 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Clock driver for Loongson-1 SoC
|
||||
*
|
||||
* Copyright (C) 2012-2023 Keguang Zhang <keguang.zhang@gmail.com>
|
||||
*/
|
||||
|
||||
#include <linux/bits.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/container_of.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/printk.h>
|
||||
|
||||
#include <dt-bindings/clock/loongson,ls1x-clk.h>
|
||||
|
||||
/* Loongson 1 Clock Register Definitions */
|
||||
#define CLK_PLL_FREQ 0x0
|
||||
#define CLK_PLL_DIV 0x4
|
||||
|
||||
static DEFINE_SPINLOCK(ls1x_clk_div_lock);
|
||||
|
||||
struct ls1x_clk_pll_data {
|
||||
u32 fixed;
|
||||
u8 shift;
|
||||
u8 int_shift;
|
||||
u8 int_width;
|
||||
u8 frac_shift;
|
||||
u8 frac_width;
|
||||
};
|
||||
|
||||
struct ls1x_clk_div_data {
|
||||
u8 shift;
|
||||
u8 width;
|
||||
unsigned long flags;
|
||||
const struct clk_div_table *table;
|
||||
u8 bypass_shift;
|
||||
u8 bypass_inv;
|
||||
spinlock_t *lock; /* protect access to DIV registers */
|
||||
};
|
||||
|
||||
struct ls1x_clk {
|
||||
void __iomem *reg;
|
||||
unsigned int offset;
|
||||
struct clk_hw hw;
|
||||
const void *data;
|
||||
};
|
||||
|
||||
#define to_ls1x_clk(_hw) container_of(_hw, struct ls1x_clk, hw)
|
||||
|
||||
static inline unsigned long ls1x_pll_rate_part(unsigned int val,
|
||||
unsigned int shift,
|
||||
unsigned int width)
|
||||
{
|
||||
return (val & GENMASK(shift + width, shift)) >> shift;
|
||||
}
|
||||
|
||||
static unsigned long ls1x_pll_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct ls1x_clk *ls1x_clk = to_ls1x_clk(hw);
|
||||
const struct ls1x_clk_pll_data *d = ls1x_clk->data;
|
||||
u32 val, rate;
|
||||
|
||||
val = readl(ls1x_clk->reg);
|
||||
rate = d->fixed;
|
||||
rate += ls1x_pll_rate_part(val, d->int_shift, d->int_width);
|
||||
if (d->frac_width)
|
||||
rate += ls1x_pll_rate_part(val, d->frac_shift, d->frac_width);
|
||||
rate *= parent_rate;
|
||||
rate >>= d->shift;
|
||||
|
||||
return rate;
|
||||
}
|
||||
|
||||
static const struct clk_ops ls1x_pll_clk_ops = {
|
||||
.recalc_rate = ls1x_pll_recalc_rate,
|
||||
};
|
||||
|
||||
static unsigned long ls1x_divider_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct ls1x_clk *ls1x_clk = to_ls1x_clk(hw);
|
||||
const struct ls1x_clk_div_data *d = ls1x_clk->data;
|
||||
unsigned int val;
|
||||
|
||||
val = readl(ls1x_clk->reg) >> d->shift;
|
||||
val &= clk_div_mask(d->width);
|
||||
|
||||
return divider_recalc_rate(hw, parent_rate, val, d->table,
|
||||
d->flags, d->width);
|
||||
}
|
||||
|
||||
static long ls1x_divider_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *prate)
|
||||
{
|
||||
struct ls1x_clk *ls1x_clk = to_ls1x_clk(hw);
|
||||
const struct ls1x_clk_div_data *d = ls1x_clk->data;
|
||||
|
||||
return divider_round_rate(hw, rate, prate, d->table,
|
||||
d->width, d->flags);
|
||||
}
|
||||
|
||||
static int ls1x_divider_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct ls1x_clk *ls1x_clk = to_ls1x_clk(hw);
|
||||
const struct ls1x_clk_div_data *d = ls1x_clk->data;
|
||||
int val, div_val;
|
||||
unsigned long flags = 0;
|
||||
|
||||
div_val = divider_get_val(rate, parent_rate, d->table,
|
||||
d->width, d->flags);
|
||||
if (div_val < 0)
|
||||
return div_val;
|
||||
|
||||
spin_lock_irqsave(d->lock, flags);
|
||||
|
||||
/* Bypass the clock */
|
||||
val = readl(ls1x_clk->reg);
|
||||
if (d->bypass_inv)
|
||||
val &= ~BIT(d->bypass_shift);
|
||||
else
|
||||
val |= BIT(d->bypass_shift);
|
||||
writel(val, ls1x_clk->reg);
|
||||
|
||||
val = readl(ls1x_clk->reg);
|
||||
val &= ~(clk_div_mask(d->width) << d->shift);
|
||||
val |= (u32)div_val << d->shift;
|
||||
writel(val, ls1x_clk->reg);
|
||||
|
||||
/* Restore the clock */
|
||||
val = readl(ls1x_clk->reg);
|
||||
if (d->bypass_inv)
|
||||
val |= BIT(d->bypass_shift);
|
||||
else
|
||||
val &= ~BIT(d->bypass_shift);
|
||||
writel(val, ls1x_clk->reg);
|
||||
|
||||
spin_unlock_irqrestore(d->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clk_ops ls1x_clk_divider_ops = {
|
||||
.recalc_rate = ls1x_divider_recalc_rate,
|
||||
.round_rate = ls1x_divider_round_rate,
|
||||
.set_rate = ls1x_divider_set_rate,
|
||||
};
|
||||
|
||||
#define LS1X_CLK_PLL(_name, _offset, _fixed, _shift, \
|
||||
f_shift, f_width, i_shift, i_width) \
|
||||
struct ls1x_clk _name = { \
|
||||
.offset = (_offset), \
|
||||
.data = &(const struct ls1x_clk_pll_data) { \
|
||||
.fixed = (_fixed), \
|
||||
.shift = (_shift), \
|
||||
.int_shift = (i_shift), \
|
||||
.int_width = (i_width), \
|
||||
.frac_shift = (f_shift), \
|
||||
.frac_width = (f_width), \
|
||||
}, \
|
||||
.hw.init = &(const struct clk_init_data) { \
|
||||
.name = #_name, \
|
||||
.ops = &ls1x_pll_clk_ops, \
|
||||
.parent_data = &(const struct clk_parent_data) { \
|
||||
.fw_name = "xtal", \
|
||||
.name = "xtal", \
|
||||
.index = -1, \
|
||||
}, \
|
||||
.num_parents = 1, \
|
||||
}, \
|
||||
}
|
||||
|
||||
#define LS1X_CLK_DIV(_name, _pname, _offset, _shift, _width, \
|
||||
_table, _bypass_shift, _bypass_inv, _flags) \
|
||||
struct ls1x_clk _name = { \
|
||||
.offset = (_offset), \
|
||||
.data = &(const struct ls1x_clk_div_data){ \
|
||||
.shift = (_shift), \
|
||||
.width = (_width), \
|
||||
.table = (_table), \
|
||||
.flags = (_flags), \
|
||||
.bypass_shift = (_bypass_shift), \
|
||||
.bypass_inv = (_bypass_inv), \
|
||||
.lock = &ls1x_clk_div_lock, \
|
||||
}, \
|
||||
.hw.init = &(const struct clk_init_data) { \
|
||||
.name = #_name, \
|
||||
.ops = &ls1x_clk_divider_ops, \
|
||||
.parent_hws = (const struct clk_hw *[]) { _pname }, \
|
||||
.num_parents = 1, \
|
||||
.flags = CLK_GET_RATE_NOCACHE, \
|
||||
}, \
|
||||
}
|
||||
|
||||
static LS1X_CLK_PLL(ls1b_clk_pll, CLK_PLL_FREQ, 12, 1, 0, 5, 0, 0);
|
||||
static LS1X_CLK_DIV(ls1b_clk_cpu, &ls1b_clk_pll.hw, CLK_PLL_DIV,
|
||||
20, 4, NULL, 8, 0,
|
||||
CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ROUND_CLOSEST);
|
||||
static LS1X_CLK_DIV(ls1b_clk_dc, &ls1b_clk_pll.hw, CLK_PLL_DIV,
|
||||
26, 4, NULL, 12, 0, CLK_DIVIDER_ONE_BASED);
|
||||
static LS1X_CLK_DIV(ls1b_clk_ahb, &ls1b_clk_pll.hw, CLK_PLL_DIV,
|
||||
14, 4, NULL, 10, 0, CLK_DIVIDER_ONE_BASED);
|
||||
static CLK_FIXED_FACTOR(ls1b_clk_apb, "ls1b_clk_apb", "ls1b_clk_ahb", 2, 1,
|
||||
CLK_SET_RATE_PARENT);
|
||||
|
||||
static struct clk_hw_onecell_data ls1b_clk_hw_data = {
|
||||
.hws = {
|
||||
[LS1X_CLKID_PLL] = &ls1b_clk_pll.hw,
|
||||
[LS1X_CLKID_CPU] = &ls1b_clk_cpu.hw,
|
||||
[LS1X_CLKID_DC] = &ls1b_clk_dc.hw,
|
||||
[LS1X_CLKID_AHB] = &ls1b_clk_ahb.hw,
|
||||
[LS1X_CLKID_APB] = &ls1b_clk_apb.hw,
|
||||
},
|
||||
.num = CLK_NR_CLKS,
|
||||
};
|
||||
|
||||
static const struct clk_div_table ls1c_ahb_div_table[] = {
|
||||
[0] = { .val = 0, .div = 2 },
|
||||
[1] = { .val = 1, .div = 4 },
|
||||
[2] = { .val = 2, .div = 3 },
|
||||
[3] = { .val = 3, .div = 3 },
|
||||
[4] = { /* sentinel */ }
|
||||
};
|
||||
|
||||
static LS1X_CLK_PLL(ls1c_clk_pll, CLK_PLL_FREQ, 0, 2, 8, 8, 16, 8);
|
||||
static LS1X_CLK_DIV(ls1c_clk_cpu, &ls1c_clk_pll.hw, CLK_PLL_DIV,
|
||||
8, 7, NULL, 0, 1,
|
||||
CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ROUND_CLOSEST);
|
||||
static LS1X_CLK_DIV(ls1c_clk_dc, &ls1c_clk_pll.hw, CLK_PLL_DIV,
|
||||
24, 7, NULL, 4, 1, CLK_DIVIDER_ONE_BASED);
|
||||
static LS1X_CLK_DIV(ls1c_clk_ahb, &ls1c_clk_cpu.hw, CLK_PLL_FREQ,
|
||||
0, 2, ls1c_ahb_div_table, 0, 0, CLK_DIVIDER_ALLOW_ZERO);
|
||||
static CLK_FIXED_FACTOR(ls1c_clk_apb, "ls1c_clk_apb", "ls1c_clk_ahb", 1, 1,
|
||||
CLK_SET_RATE_PARENT);
|
||||
|
||||
static struct clk_hw_onecell_data ls1c_clk_hw_data = {
|
||||
.hws = {
|
||||
[LS1X_CLKID_PLL] = &ls1c_clk_pll.hw,
|
||||
[LS1X_CLKID_CPU] = &ls1c_clk_cpu.hw,
|
||||
[LS1X_CLKID_DC] = &ls1c_clk_dc.hw,
|
||||
[LS1X_CLKID_AHB] = &ls1c_clk_ahb.hw,
|
||||
[LS1X_CLKID_APB] = &ls1c_clk_apb.hw,
|
||||
},
|
||||
.num = CLK_NR_CLKS,
|
||||
};
|
||||
|
||||
static void __init ls1x_clk_init(struct device_node *np,
|
||||
struct clk_hw_onecell_data *hw_data)
|
||||
{
|
||||
struct ls1x_clk *ls1x_clk;
|
||||
void __iomem *reg;
|
||||
int i, ret;
|
||||
|
||||
reg = of_iomap(np, 0);
|
||||
if (!reg) {
|
||||
pr_err("Unable to map base for %pOF\n", np);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < hw_data->num; i++) {
|
||||
/* array might be sparse */
|
||||
if (!hw_data->hws[i])
|
||||
continue;
|
||||
|
||||
if (i != LS1X_CLKID_APB) {
|
||||
ls1x_clk = to_ls1x_clk(hw_data->hws[i]);
|
||||
ls1x_clk->reg = reg + ls1x_clk->offset;
|
||||
}
|
||||
|
||||
ret = of_clk_hw_register(np, hw_data->hws[i]);
|
||||
if (ret)
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, hw_data);
|
||||
if (!ret)
|
||||
return;
|
||||
|
||||
err:
|
||||
pr_err("Failed to register %pOF\n", np);
|
||||
|
||||
while (--i >= 0)
|
||||
clk_hw_unregister(hw_data->hws[i]);
|
||||
|
||||
iounmap(reg);
|
||||
}
|
||||
|
||||
static void __init ls1b_clk_init(struct device_node *np)
|
||||
{
|
||||
return ls1x_clk_init(np, &ls1b_clk_hw_data);
|
||||
}
|
||||
|
||||
static void __init ls1c_clk_init(struct device_node *np)
|
||||
{
|
||||
return ls1x_clk_init(np, &ls1c_clk_hw_data);
|
||||
}
|
||||
|
||||
CLK_OF_DECLARE(ls1b_clk, "loongson,ls1b-clk", ls1b_clk_init);
|
||||
CLK_OF_DECLARE(ls1c_clk, "loongson,ls1c-clk", ls1c_clk_init);
|
341
drivers/clk/clk-loongson2.c
Normal file
341
drivers/clk/clk-loongson2.c
Normal file
@ -0,0 +1,341 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Author: Yinbo Zhu <zhuyinbo@loongson.cn>
|
||||
* Copyright (C) 2022-2023 Loongson Technology Corporation Limited
|
||||
*/
|
||||
|
||||
#include <linux/err.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/io-64-nonatomic-lo-hi.h>
|
||||
#include <dt-bindings/clock/loongson,ls2k-clk.h>
|
||||
|
||||
#define LOONGSON2_PLL_MULT_SHIFT 32
|
||||
#define LOONGSON2_PLL_MULT_WIDTH 10
|
||||
#define LOONGSON2_PLL_DIV_SHIFT 26
|
||||
#define LOONGSON2_PLL_DIV_WIDTH 6
|
||||
#define LOONGSON2_APB_FREQSCALE_SHIFT 20
|
||||
#define LOONGSON2_APB_FREQSCALE_WIDTH 3
|
||||
#define LOONGSON2_USB_FREQSCALE_SHIFT 16
|
||||
#define LOONGSON2_USB_FREQSCALE_WIDTH 3
|
||||
#define LOONGSON2_SATA_FREQSCALE_SHIFT 12
|
||||
#define LOONGSON2_SATA_FREQSCALE_WIDTH 3
|
||||
#define LOONGSON2_BOOT_FREQSCALE_SHIFT 8
|
||||
#define LOONGSON2_BOOT_FREQSCALE_WIDTH 3
|
||||
|
||||
static void __iomem *loongson2_pll_base;
|
||||
|
||||
static const struct clk_parent_data pdata[] = {
|
||||
{ .fw_name = "ref_100m",},
|
||||
};
|
||||
|
||||
static struct clk_hw *loongson2_clk_register(struct device *dev,
|
||||
const char *name,
|
||||
const char *parent_name,
|
||||
const struct clk_ops *ops,
|
||||
unsigned long flags)
|
||||
{
|
||||
int ret;
|
||||
struct clk_hw *hw;
|
||||
struct clk_init_data init;
|
||||
|
||||
hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL);
|
||||
if (!hw)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
init.name = name;
|
||||
init.ops = ops;
|
||||
init.flags = flags;
|
||||
init.num_parents = 1;
|
||||
|
||||
if (!parent_name)
|
||||
init.parent_data = pdata;
|
||||
else
|
||||
init.parent_names = &parent_name;
|
||||
|
||||
hw->init = &init;
|
||||
|
||||
ret = devm_clk_hw_register(dev, hw);
|
||||
if (ret)
|
||||
hw = ERR_PTR(ret);
|
||||
|
||||
return hw;
|
||||
}
|
||||
|
||||
static unsigned long loongson2_calc_pll_rate(int offset, unsigned long rate)
|
||||
{
|
||||
u64 val;
|
||||
u32 mult, div;
|
||||
|
||||
val = readq(loongson2_pll_base + offset);
|
||||
|
||||
mult = (val >> LOONGSON2_PLL_MULT_SHIFT) &
|
||||
clk_div_mask(LOONGSON2_PLL_MULT_WIDTH);
|
||||
div = (val >> LOONGSON2_PLL_DIV_SHIFT) &
|
||||
clk_div_mask(LOONGSON2_PLL_DIV_WIDTH);
|
||||
|
||||
return div_u64((u64)rate * mult, div);
|
||||
}
|
||||
|
||||
static unsigned long loongson2_node_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
return loongson2_calc_pll_rate(0x0, parent_rate);
|
||||
}
|
||||
|
||||
static const struct clk_ops loongson2_node_clk_ops = {
|
||||
.recalc_rate = loongson2_node_recalc_rate,
|
||||
};
|
||||
|
||||
static unsigned long loongson2_ddr_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
return loongson2_calc_pll_rate(0x10, parent_rate);
|
||||
}
|
||||
|
||||
static const struct clk_ops loongson2_ddr_clk_ops = {
|
||||
.recalc_rate = loongson2_ddr_recalc_rate,
|
||||
};
|
||||
|
||||
static unsigned long loongson2_dc_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
return loongson2_calc_pll_rate(0x20, parent_rate);
|
||||
}
|
||||
|
||||
static const struct clk_ops loongson2_dc_clk_ops = {
|
||||
.recalc_rate = loongson2_dc_recalc_rate,
|
||||
};
|
||||
|
||||
static unsigned long loongson2_pix0_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
return loongson2_calc_pll_rate(0x30, parent_rate);
|
||||
}
|
||||
|
||||
static const struct clk_ops loongson2_pix0_clk_ops = {
|
||||
.recalc_rate = loongson2_pix0_recalc_rate,
|
||||
};
|
||||
|
||||
static unsigned long loongson2_pix1_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
return loongson2_calc_pll_rate(0x40, parent_rate);
|
||||
}
|
||||
|
||||
static const struct clk_ops loongson2_pix1_clk_ops = {
|
||||
.recalc_rate = loongson2_pix1_recalc_rate,
|
||||
};
|
||||
|
||||
static unsigned long loongson2_calc_rate(unsigned long rate,
|
||||
int shift, int width)
|
||||
{
|
||||
u64 val;
|
||||
u32 mult;
|
||||
|
||||
val = readq(loongson2_pll_base + 0x50);
|
||||
|
||||
mult = (val >> shift) & clk_div_mask(width);
|
||||
|
||||
return div_u64((u64)rate * (mult + 1), 8);
|
||||
}
|
||||
|
||||
static unsigned long loongson2_boot_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
return loongson2_calc_rate(parent_rate,
|
||||
LOONGSON2_BOOT_FREQSCALE_SHIFT,
|
||||
LOONGSON2_BOOT_FREQSCALE_WIDTH);
|
||||
}
|
||||
|
||||
static const struct clk_ops loongson2_boot_clk_ops = {
|
||||
.recalc_rate = loongson2_boot_recalc_rate,
|
||||
};
|
||||
|
||||
static unsigned long loongson2_apb_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
return loongson2_calc_rate(parent_rate,
|
||||
LOONGSON2_APB_FREQSCALE_SHIFT,
|
||||
LOONGSON2_APB_FREQSCALE_WIDTH);
|
||||
}
|
||||
|
||||
static const struct clk_ops loongson2_apb_clk_ops = {
|
||||
.recalc_rate = loongson2_apb_recalc_rate,
|
||||
};
|
||||
|
||||
static unsigned long loongson2_usb_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
return loongson2_calc_rate(parent_rate,
|
||||
LOONGSON2_USB_FREQSCALE_SHIFT,
|
||||
LOONGSON2_USB_FREQSCALE_WIDTH);
|
||||
}
|
||||
|
||||
static const struct clk_ops loongson2_usb_clk_ops = {
|
||||
.recalc_rate = loongson2_usb_recalc_rate,
|
||||
};
|
||||
|
||||
static unsigned long loongson2_sata_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
return loongson2_calc_rate(parent_rate,
|
||||
LOONGSON2_SATA_FREQSCALE_SHIFT,
|
||||
LOONGSON2_SATA_FREQSCALE_WIDTH);
|
||||
}
|
||||
|
||||
static const struct clk_ops loongson2_sata_clk_ops = {
|
||||
.recalc_rate = loongson2_sata_recalc_rate,
|
||||
};
|
||||
|
||||
static inline int loongson2_check_clk_hws(struct clk_hw *clks[], unsigned int count)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
if (IS_ERR(clks[i])) {
|
||||
pr_err("Loongson2 clk %u: register failed with %ld\n",
|
||||
i, PTR_ERR(clks[i]));
|
||||
return PTR_ERR(clks[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int loongson2_clk_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret;
|
||||
struct clk_hw **hws;
|
||||
struct clk_hw_onecell_data *clk_hw_data;
|
||||
spinlock_t loongson2_clk_lock;
|
||||
struct device *dev = &pdev->dev;
|
||||
|
||||
loongson2_pll_base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(loongson2_pll_base))
|
||||
return PTR_ERR(loongson2_pll_base);
|
||||
|
||||
clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, LOONGSON2_CLK_END),
|
||||
GFP_KERNEL);
|
||||
if (WARN_ON(!clk_hw_data))
|
||||
return -ENOMEM;
|
||||
|
||||
clk_hw_data->num = LOONGSON2_CLK_END;
|
||||
hws = clk_hw_data->hws;
|
||||
|
||||
hws[LOONGSON2_NODE_PLL] = loongson2_clk_register(dev, "node_pll",
|
||||
NULL,
|
||||
&loongson2_node_clk_ops, 0);
|
||||
|
||||
hws[LOONGSON2_DDR_PLL] = loongson2_clk_register(dev, "ddr_pll",
|
||||
NULL,
|
||||
&loongson2_ddr_clk_ops, 0);
|
||||
|
||||
hws[LOONGSON2_DC_PLL] = loongson2_clk_register(dev, "dc_pll",
|
||||
NULL,
|
||||
&loongson2_dc_clk_ops, 0);
|
||||
|
||||
hws[LOONGSON2_PIX0_PLL] = loongson2_clk_register(dev, "pix0_pll",
|
||||
NULL,
|
||||
&loongson2_pix0_clk_ops, 0);
|
||||
|
||||
hws[LOONGSON2_PIX1_PLL] = loongson2_clk_register(dev, "pix1_pll",
|
||||
NULL,
|
||||
&loongson2_pix1_clk_ops, 0);
|
||||
|
||||
hws[LOONGSON2_BOOT_CLK] = loongson2_clk_register(dev, "boot",
|
||||
NULL,
|
||||
&loongson2_boot_clk_ops, 0);
|
||||
|
||||
hws[LOONGSON2_NODE_CLK] = devm_clk_hw_register_divider(dev, "node",
|
||||
"node_pll", 0,
|
||||
loongson2_pll_base + 0x8, 0,
|
||||
6, CLK_DIVIDER_ONE_BASED,
|
||||
&loongson2_clk_lock);
|
||||
|
||||
/*
|
||||
* The hda clk divisor in the upper 32bits and the clk-prodiver
|
||||
* layer code doesn't support 64bit io operation thus a conversion
|
||||
* is required that subtract shift by 32 and add 4byte to the hda
|
||||
* address
|
||||
*/
|
||||
hws[LOONGSON2_HDA_CLK] = devm_clk_hw_register_divider(dev, "hda",
|
||||
"ddr_pll", 0,
|
||||
loongson2_pll_base + 0x22, 12,
|
||||
7, CLK_DIVIDER_ONE_BASED,
|
||||
&loongson2_clk_lock);
|
||||
|
||||
hws[LOONGSON2_GPU_CLK] = devm_clk_hw_register_divider(dev, "gpu",
|
||||
"ddr_pll", 0,
|
||||
loongson2_pll_base + 0x18, 22,
|
||||
6, CLK_DIVIDER_ONE_BASED,
|
||||
&loongson2_clk_lock);
|
||||
|
||||
hws[LOONGSON2_DDR_CLK] = devm_clk_hw_register_divider(dev, "ddr",
|
||||
"ddr_pll", 0,
|
||||
loongson2_pll_base + 0x18, 0,
|
||||
6, CLK_DIVIDER_ONE_BASED,
|
||||
&loongson2_clk_lock);
|
||||
|
||||
hws[LOONGSON2_GMAC_CLK] = devm_clk_hw_register_divider(dev, "gmac",
|
||||
"dc_pll", 0,
|
||||
loongson2_pll_base + 0x28, 22,
|
||||
6, CLK_DIVIDER_ONE_BASED,
|
||||
&loongson2_clk_lock);
|
||||
|
||||
hws[LOONGSON2_DC_CLK] = devm_clk_hw_register_divider(dev, "dc",
|
||||
"dc_pll", 0,
|
||||
loongson2_pll_base + 0x28, 0,
|
||||
6, CLK_DIVIDER_ONE_BASED,
|
||||
&loongson2_clk_lock);
|
||||
|
||||
hws[LOONGSON2_APB_CLK] = loongson2_clk_register(dev, "apb",
|
||||
"gmac",
|
||||
&loongson2_apb_clk_ops, 0);
|
||||
|
||||
hws[LOONGSON2_USB_CLK] = loongson2_clk_register(dev, "usb",
|
||||
"gmac",
|
||||
&loongson2_usb_clk_ops, 0);
|
||||
|
||||
hws[LOONGSON2_SATA_CLK] = loongson2_clk_register(dev, "sata",
|
||||
"gmac",
|
||||
&loongson2_sata_clk_ops, 0);
|
||||
|
||||
hws[LOONGSON2_PIX0_CLK] = clk_hw_register_divider(NULL, "pix0",
|
||||
"pix0_pll", 0,
|
||||
loongson2_pll_base + 0x38, 0, 6,
|
||||
CLK_DIVIDER_ONE_BASED,
|
||||
&loongson2_clk_lock);
|
||||
|
||||
hws[LOONGSON2_PIX1_CLK] = clk_hw_register_divider(NULL, "pix1",
|
||||
"pix1_pll", 0,
|
||||
loongson2_pll_base + 0x48, 0, 6,
|
||||
CLK_DIVIDER_ONE_BASED,
|
||||
&loongson2_clk_lock);
|
||||
|
||||
ret = loongson2_check_clk_hws(hws, LOONGSON2_CLK_END);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, clk_hw_data);
|
||||
}
|
||||
|
||||
static const struct of_device_id loongson2_clk_match_table[] = {
|
||||
{ .compatible = "loongson,ls2k-clk" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, loongson2_clk_match_table);
|
||||
|
||||
static struct platform_driver loongson2_clk_driver = {
|
||||
.probe = loongson2_clk_probe,
|
||||
.driver = {
|
||||
.name = "loongson2-clk",
|
||||
.of_match_table = loongson2_clk_match_table,
|
||||
},
|
||||
};
|
||||
module_platform_driver(loongson2_clk_driver);
|
||||
|
||||
MODULE_DESCRIPTION("Loongson2 clock driver");
|
||||
MODULE_LICENSE("GPL");
|
713
drivers/clk/clk-sp7021.c
Normal file
713
drivers/clk/clk-sp7021.c
Normal file
@ -0,0 +1,713 @@
|
||||
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
/*
|
||||
* Copyright (C) Sunplus Technology Co., Ltd.
|
||||
* All rights reserved.
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <dt-bindings/clock/sunplus,sp7021-clkc.h>
|
||||
|
||||
/* speical div_width values for PLLTV/PLLA */
|
||||
#define DIV_TV 33
|
||||
#define DIV_A 34
|
||||
|
||||
/* PLLTV parameters */
|
||||
enum {
|
||||
SEL_FRA,
|
||||
SDM_MOD,
|
||||
PH_SEL,
|
||||
NFRA,
|
||||
DIVR,
|
||||
DIVN,
|
||||
DIVM,
|
||||
P_MAX
|
||||
};
|
||||
|
||||
#define MASK_SEL_FRA GENMASK(1, 1)
|
||||
#define MASK_SDM_MOD GENMASK(2, 2)
|
||||
#define MASK_PH_SEL GENMASK(4, 4)
|
||||
#define MASK_NFRA GENMASK(12, 6)
|
||||
#define MASK_DIVR GENMASK(8, 7)
|
||||
#define MASK_DIVN GENMASK(7, 0)
|
||||
#define MASK_DIVM GENMASK(14, 8)
|
||||
|
||||
/* HIWORD_MASK FIELD_PREP */
|
||||
#define HWM_FIELD_PREP(mask, value) \
|
||||
({ \
|
||||
u32 _m = mask; \
|
||||
(_m << 16) | FIELD_PREP(_m, value); \
|
||||
})
|
||||
|
||||
struct sp_pll {
|
||||
struct clk_hw hw;
|
||||
void __iomem *reg;
|
||||
spinlock_t lock; /* lock for reg */
|
||||
int div_shift;
|
||||
int div_width;
|
||||
int pd_bit; /* power down bit idx */
|
||||
int bp_bit; /* bypass bit idx */
|
||||
unsigned long brate; /* base rate, TODO: replace brate with muldiv */
|
||||
u32 p[P_MAX]; /* for hold PLLTV/PLLA parameters */
|
||||
};
|
||||
|
||||
#define to_sp_pll(_hw) container_of(_hw, struct sp_pll, hw)
|
||||
|
||||
struct sp_clk_gate_info {
|
||||
u16 reg; /* reg_index_shift */
|
||||
u16 ext_parent; /* parent is extclk */
|
||||
};
|
||||
|
||||
static const struct sp_clk_gate_info sp_clk_gates[] = {
|
||||
{ 0x02 },
|
||||
{ 0x05 },
|
||||
{ 0x06 },
|
||||
{ 0x07 },
|
||||
{ 0x09 },
|
||||
{ 0x0b, 1 },
|
||||
{ 0x0f, 1 },
|
||||
{ 0x14 },
|
||||
{ 0x15 },
|
||||
{ 0x16 },
|
||||
{ 0x17 },
|
||||
{ 0x18, 1 },
|
||||
{ 0x19, 1 },
|
||||
{ 0x1a, 1 },
|
||||
{ 0x1b, 1 },
|
||||
{ 0x1c, 1 },
|
||||
{ 0x1d, 1 },
|
||||
{ 0x1e },
|
||||
{ 0x1f, 1 },
|
||||
{ 0x20 },
|
||||
{ 0x21 },
|
||||
{ 0x22 },
|
||||
{ 0x23 },
|
||||
{ 0x24 },
|
||||
{ 0x25 },
|
||||
{ 0x26 },
|
||||
{ 0x2a },
|
||||
{ 0x2b },
|
||||
{ 0x2d },
|
||||
{ 0x2e },
|
||||
{ 0x30 },
|
||||
{ 0x31 },
|
||||
{ 0x32 },
|
||||
{ 0x33 },
|
||||
{ 0x3d },
|
||||
{ 0x3e },
|
||||
{ 0x3f },
|
||||
{ 0x42 },
|
||||
{ 0x44 },
|
||||
{ 0x4b },
|
||||
{ 0x4c },
|
||||
{ 0x4d },
|
||||
{ 0x4e },
|
||||
{ 0x4f },
|
||||
{ 0x50 },
|
||||
{ 0x55 },
|
||||
{ 0x60 },
|
||||
{ 0x61 },
|
||||
{ 0x6a },
|
||||
{ 0x73 },
|
||||
{ 0x86 },
|
||||
{ 0x8a },
|
||||
{ 0x8b },
|
||||
{ 0x8d },
|
||||
{ 0x8e },
|
||||
{ 0x8f },
|
||||
{ 0x90 },
|
||||
{ 0x92 },
|
||||
{ 0x93 },
|
||||
{ 0x95 },
|
||||
{ 0x96 },
|
||||
{ 0x97 },
|
||||
{ 0x98 },
|
||||
{ 0x99 },
|
||||
};
|
||||
|
||||
#define _M 1000000UL
|
||||
#define F_27M (27 * _M)
|
||||
|
||||
/*********************************** PLL_TV **********************************/
|
||||
|
||||
/* TODO: set proper FVCO range */
|
||||
#define FVCO_MIN (100 * _M)
|
||||
#define FVCO_MAX (200 * _M)
|
||||
|
||||
#define F_MIN (FVCO_MIN / 8)
|
||||
#define F_MAX (FVCO_MAX)
|
||||
|
||||
static long plltv_integer_div(struct sp_pll *clk, unsigned long freq)
|
||||
{
|
||||
/* valid m values: 27M must be divisible by m */
|
||||
static const u32 m_table[] = {
|
||||
1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 25, 27, 30, 32
|
||||
};
|
||||
u32 m, n, r;
|
||||
unsigned long fvco, nf;
|
||||
long ret;
|
||||
|
||||
freq = clamp(freq, F_MIN, F_MAX);
|
||||
|
||||
/* DIVR 0~3 */
|
||||
for (r = 0; r <= 3; r++) {
|
||||
fvco = freq << r;
|
||||
if (fvco <= FVCO_MAX)
|
||||
break;
|
||||
}
|
||||
|
||||
/* DIVM */
|
||||
for (m = 0; m < ARRAY_SIZE(m_table); m++) {
|
||||
nf = fvco * m_table[m];
|
||||
n = nf / F_27M;
|
||||
if ((n * F_27M) == nf)
|
||||
break;
|
||||
}
|
||||
if (m >= ARRAY_SIZE(m_table)) {
|
||||
ret = -EINVAL;
|
||||
goto err_not_found;
|
||||
}
|
||||
|
||||
/* save parameters */
|
||||
clk->p[SEL_FRA] = 0;
|
||||
clk->p[DIVR] = r;
|
||||
clk->p[DIVN] = n;
|
||||
clk->p[DIVM] = m_table[m];
|
||||
|
||||
return freq;
|
||||
|
||||
err_not_found:
|
||||
pr_err("%s: %s freq:%lu not found a valid setting\n",
|
||||
__func__, clk_hw_get_name(&clk->hw), freq);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* parameters for PLLTV fractional divider */
|
||||
static const u32 pt[][5] = {
|
||||
/* conventional fractional */
|
||||
{
|
||||
1, /* factor */
|
||||
5, /* 5 * p0 (nint) */
|
||||
1, /* 1 * p0 */
|
||||
F_27M, /* F_27M / p0 */
|
||||
1, /* p0 / p2 */
|
||||
},
|
||||
/* phase rotation */
|
||||
{
|
||||
10, /* factor */
|
||||
54, /* 5.4 * p0 (nint) */
|
||||
2, /* 0.2 * p0 */
|
||||
F_27M / 10, /* F_27M / p0 */
|
||||
5, /* p0 / p2 */
|
||||
},
|
||||
};
|
||||
|
||||
static const u32 sdm_mod_vals[] = { 91, 55 };
|
||||
|
||||
static long plltv_fractional_div(struct sp_pll *clk, unsigned long freq)
|
||||
{
|
||||
u32 m, r;
|
||||
u32 nint, nfra;
|
||||
u32 df_quotient_min = 210000000;
|
||||
u32 df_remainder_min = 0;
|
||||
unsigned long fvco, nf, f, fout = 0;
|
||||
int sdm, ph;
|
||||
|
||||
freq = clamp(freq, F_MIN, F_MAX);
|
||||
|
||||
/* DIVR 0~3 */
|
||||
for (r = 0; r <= 3; r++) {
|
||||
fvco = freq << r;
|
||||
if (fvco <= FVCO_MAX)
|
||||
break;
|
||||
}
|
||||
f = F_27M >> r;
|
||||
|
||||
/* PH_SEL */
|
||||
for (ph = ARRAY_SIZE(pt) - 1; ph >= 0; ph--) {
|
||||
const u32 *pp = pt[ph];
|
||||
|
||||
/* SDM_MOD */
|
||||
for (sdm = 0; sdm < ARRAY_SIZE(sdm_mod_vals); sdm++) {
|
||||
u32 mod = sdm_mod_vals[sdm];
|
||||
|
||||
/* DIVM 1~32 */
|
||||
for (m = 1; m <= 32; m++) {
|
||||
u32 df; /* diff freq */
|
||||
u32 df_quotient, df_remainder;
|
||||
|
||||
nf = fvco * m;
|
||||
nint = nf / pp[3];
|
||||
|
||||
if (nint < pp[1])
|
||||
continue;
|
||||
if (nint > pp[1])
|
||||
break;
|
||||
|
||||
nfra = (((nf % pp[3]) * mod * pp[4]) + (F_27M / 2)) / F_27M;
|
||||
if (nfra) {
|
||||
u32 df0 = f * (nint + pp[2]) / pp[0];
|
||||
u32 df1 = f * (mod - nfra) / mod / pp[4];
|
||||
|
||||
df = df0 - df1;
|
||||
} else {
|
||||
df = f * (nint) / pp[0];
|
||||
}
|
||||
|
||||
df_quotient = df / m;
|
||||
df_remainder = ((df % m) * 1000) / m;
|
||||
|
||||
if (freq > df_quotient) {
|
||||
df_quotient = freq - df_quotient - 1;
|
||||
df_remainder = 1000 - df_remainder;
|
||||
} else {
|
||||
df_quotient = df_quotient - freq;
|
||||
}
|
||||
|
||||
if (df_quotient_min > df_quotient ||
|
||||
(df_quotient_min == df_quotient &&
|
||||
df_remainder_min > df_remainder)) {
|
||||
/* found a closer freq, save parameters */
|
||||
clk->p[SEL_FRA] = 1;
|
||||
clk->p[SDM_MOD] = sdm;
|
||||
clk->p[PH_SEL] = ph;
|
||||
clk->p[NFRA] = nfra;
|
||||
clk->p[DIVR] = r;
|
||||
clk->p[DIVM] = m;
|
||||
|
||||
fout = df / m;
|
||||
df_quotient_min = df_quotient;
|
||||
df_remainder_min = df_remainder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!fout) {
|
||||
pr_err("%s: %s freq:%lu not found a valid setting\n",
|
||||
__func__, clk_hw_get_name(&clk->hw), freq);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return fout;
|
||||
}
|
||||
|
||||
static long plltv_div(struct sp_pll *clk, unsigned long freq)
|
||||
{
|
||||
if (freq % 100)
|
||||
return plltv_fractional_div(clk, freq);
|
||||
|
||||
return plltv_integer_div(clk, freq);
|
||||
}
|
||||
|
||||
static int plltv_set_rate(struct sp_pll *clk)
|
||||
{
|
||||
unsigned long flags;
|
||||
u32 r0, r1, r2;
|
||||
|
||||
r0 = BIT(clk->bp_bit + 16);
|
||||
r0 |= HWM_FIELD_PREP(MASK_SEL_FRA, clk->p[SEL_FRA]);
|
||||
r0 |= HWM_FIELD_PREP(MASK_SDM_MOD, clk->p[SDM_MOD]);
|
||||
r0 |= HWM_FIELD_PREP(MASK_PH_SEL, clk->p[PH_SEL]);
|
||||
r0 |= HWM_FIELD_PREP(MASK_NFRA, clk->p[NFRA]);
|
||||
|
||||
r1 = HWM_FIELD_PREP(MASK_DIVR, clk->p[DIVR]);
|
||||
|
||||
r2 = HWM_FIELD_PREP(MASK_DIVN, clk->p[DIVN] - 1);
|
||||
r2 |= HWM_FIELD_PREP(MASK_DIVM, clk->p[DIVM] - 1);
|
||||
|
||||
spin_lock_irqsave(&clk->lock, flags);
|
||||
writel(r0, clk->reg);
|
||||
writel(r1, clk->reg + 4);
|
||||
writel(r2, clk->reg + 8);
|
||||
spin_unlock_irqrestore(&clk->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*********************************** PLL_A ***********************************/
|
||||
|
||||
/* from Q628_PLLs_REG_setting.xlsx */
|
||||
static const struct {
|
||||
u32 rate;
|
||||
u32 regs[5];
|
||||
} pa[] = {
|
||||
{
|
||||
.rate = 135475200,
|
||||
.regs = {
|
||||
0x4801,
|
||||
0x02df,
|
||||
0x248f,
|
||||
0x0211,
|
||||
0x33e9
|
||||
}
|
||||
},
|
||||
{
|
||||
.rate = 147456000,
|
||||
.regs = {
|
||||
0x4801,
|
||||
0x1adf,
|
||||
0x2490,
|
||||
0x0349,
|
||||
0x33e9
|
||||
}
|
||||
},
|
||||
{
|
||||
.rate = 196608000,
|
||||
.regs = {
|
||||
0x4801,
|
||||
0x42ef,
|
||||
0x2495,
|
||||
0x01c6,
|
||||
0x33e9
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
static int plla_set_rate(struct sp_pll *clk)
|
||||
{
|
||||
const u32 *pp = pa[clk->p[0]].regs;
|
||||
unsigned long flags;
|
||||
int i;
|
||||
|
||||
spin_lock_irqsave(&clk->lock, flags);
|
||||
for (i = 0; i < ARRAY_SIZE(pa->regs); i++)
|
||||
writel(0xffff0000 | pp[i], clk->reg + (i * 4));
|
||||
spin_unlock_irqrestore(&clk->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long plla_round_rate(struct sp_pll *clk, unsigned long rate)
|
||||
{
|
||||
int i = ARRAY_SIZE(pa);
|
||||
|
||||
while (--i) {
|
||||
if (rate >= pa[i].rate)
|
||||
break;
|
||||
}
|
||||
clk->p[0] = i;
|
||||
|
||||
return pa[i].rate;
|
||||
}
|
||||
|
||||
/********************************** SP_PLL ***********************************/
|
||||
|
||||
static long sp_pll_calc_div(struct sp_pll *clk, unsigned long rate)
|
||||
{
|
||||
u32 fbdiv;
|
||||
u32 max = 1 << clk->div_width;
|
||||
|
||||
fbdiv = DIV_ROUND_CLOSEST(rate, clk->brate);
|
||||
if (fbdiv > max)
|
||||
fbdiv = max;
|
||||
|
||||
return fbdiv;
|
||||
}
|
||||
|
||||
static long sp_pll_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *prate)
|
||||
{
|
||||
struct sp_pll *clk = to_sp_pll(hw);
|
||||
long ret;
|
||||
|
||||
if (rate == *prate) {
|
||||
ret = *prate; /* bypass */
|
||||
} else if (clk->div_width == DIV_A) {
|
||||
ret = plla_round_rate(clk, rate);
|
||||
} else if (clk->div_width == DIV_TV) {
|
||||
ret = plltv_div(clk, rate);
|
||||
if (ret < 0)
|
||||
ret = *prate;
|
||||
} else {
|
||||
ret = sp_pll_calc_div(clk, rate) * clk->brate;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static unsigned long sp_pll_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long prate)
|
||||
{
|
||||
struct sp_pll *clk = to_sp_pll(hw);
|
||||
u32 reg = readl(clk->reg);
|
||||
unsigned long ret;
|
||||
|
||||
if (reg & BIT(clk->bp_bit)) {
|
||||
ret = prate; /* bypass */
|
||||
} else if (clk->div_width == DIV_A) {
|
||||
ret = pa[clk->p[0]].rate;
|
||||
} else if (clk->div_width == DIV_TV) {
|
||||
u32 m, r, reg2;
|
||||
|
||||
r = FIELD_GET(MASK_DIVR, readl(clk->reg + 4));
|
||||
reg2 = readl(clk->reg + 8);
|
||||
m = FIELD_GET(MASK_DIVM, reg2) + 1;
|
||||
|
||||
if (reg & MASK_SEL_FRA) {
|
||||
/* fractional divider */
|
||||
u32 sdm = FIELD_GET(MASK_SDM_MOD, reg);
|
||||
u32 ph = FIELD_GET(MASK_PH_SEL, reg);
|
||||
u32 nfra = FIELD_GET(MASK_NFRA, reg);
|
||||
const u32 *pp = pt[ph];
|
||||
unsigned long r0, r1;
|
||||
|
||||
ret = prate >> r;
|
||||
r0 = ret * (pp[1] + pp[2]) / pp[0];
|
||||
r1 = ret * (sdm_mod_vals[sdm] - nfra) / sdm_mod_vals[sdm] / pp[4];
|
||||
ret = (r0 - r1) / m;
|
||||
} else {
|
||||
/* integer divider */
|
||||
u32 n = FIELD_GET(MASK_DIVN, reg2) + 1;
|
||||
|
||||
ret = (prate / m * n) >> r;
|
||||
}
|
||||
} else {
|
||||
u32 fbdiv = ((reg >> clk->div_shift) & ((1 << clk->div_width) - 1)) + 1;
|
||||
|
||||
ret = clk->brate * fbdiv;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sp_pll_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long prate)
|
||||
{
|
||||
struct sp_pll *clk = to_sp_pll(hw);
|
||||
unsigned long flags;
|
||||
u32 reg;
|
||||
|
||||
reg = BIT(clk->bp_bit + 16); /* HIWORD_MASK */
|
||||
|
||||
if (rate == prate) {
|
||||
reg |= BIT(clk->bp_bit); /* bypass */
|
||||
} else if (clk->div_width == DIV_A) {
|
||||
return plla_set_rate(clk);
|
||||
} else if (clk->div_width == DIV_TV) {
|
||||
return plltv_set_rate(clk);
|
||||
} else if (clk->div_width) {
|
||||
u32 fbdiv = sp_pll_calc_div(clk, rate);
|
||||
u32 mask = GENMASK(clk->div_shift + clk->div_width - 1, clk->div_shift);
|
||||
|
||||
reg |= mask << 16;
|
||||
reg |= ((fbdiv - 1) << clk->div_shift) & mask;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&clk->lock, flags);
|
||||
writel(reg, clk->reg);
|
||||
spin_unlock_irqrestore(&clk->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sp_pll_enable(struct clk_hw *hw)
|
||||
{
|
||||
struct sp_pll *clk = to_sp_pll(hw);
|
||||
|
||||
writel(BIT(clk->pd_bit + 16) | BIT(clk->pd_bit), clk->reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sp_pll_disable(struct clk_hw *hw)
|
||||
{
|
||||
struct sp_pll *clk = to_sp_pll(hw);
|
||||
|
||||
writel(BIT(clk->pd_bit + 16), clk->reg);
|
||||
}
|
||||
|
||||
static int sp_pll_is_enabled(struct clk_hw *hw)
|
||||
{
|
||||
struct sp_pll *clk = to_sp_pll(hw);
|
||||
|
||||
return readl(clk->reg) & BIT(clk->pd_bit);
|
||||
}
|
||||
|
||||
static const struct clk_ops sp_pll_ops = {
|
||||
.enable = sp_pll_enable,
|
||||
.disable = sp_pll_disable,
|
||||
.is_enabled = sp_pll_is_enabled,
|
||||
.round_rate = sp_pll_round_rate,
|
||||
.recalc_rate = sp_pll_recalc_rate,
|
||||
.set_rate = sp_pll_set_rate
|
||||
};
|
||||
|
||||
static const struct clk_ops sp_pll_sub_ops = {
|
||||
.enable = sp_pll_enable,
|
||||
.disable = sp_pll_disable,
|
||||
.is_enabled = sp_pll_is_enabled,
|
||||
.recalc_rate = sp_pll_recalc_rate,
|
||||
};
|
||||
|
||||
static struct clk_hw *sp_pll_register(struct device *dev, const char *name,
|
||||
const struct clk_parent_data *parent_data,
|
||||
void __iomem *reg, int pd_bit, int bp_bit,
|
||||
unsigned long brate, int shift, int width,
|
||||
unsigned long flags)
|
||||
{
|
||||
struct sp_pll *pll;
|
||||
struct clk_hw *hw;
|
||||
struct clk_init_data initd = {
|
||||
.name = name,
|
||||
.parent_data = parent_data,
|
||||
.ops = (bp_bit >= 0) ? &sp_pll_ops : &sp_pll_sub_ops,
|
||||
.num_parents = 1,
|
||||
.flags = flags,
|
||||
};
|
||||
int ret;
|
||||
|
||||
pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL);
|
||||
if (!pll)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
pll->hw.init = &initd;
|
||||
pll->reg = reg;
|
||||
pll->pd_bit = pd_bit;
|
||||
pll->bp_bit = bp_bit;
|
||||
pll->brate = brate;
|
||||
pll->div_shift = shift;
|
||||
pll->div_width = width;
|
||||
spin_lock_init(&pll->lock);
|
||||
|
||||
hw = &pll->hw;
|
||||
ret = devm_clk_hw_register(dev, hw);
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
return hw;
|
||||
}
|
||||
|
||||
#define PLLA_CTL (pll_base + 0x1c)
|
||||
#define PLLE_CTL (pll_base + 0x30)
|
||||
#define PLLF_CTL (pll_base + 0x34)
|
||||
#define PLLTV_CTL (pll_base + 0x38)
|
||||
|
||||
static int sp7021_clk_probe(struct platform_device *pdev)
|
||||
{
|
||||
static const u32 sp_clken[] = {
|
||||
0x67ef, 0x03ff, 0xff03, 0xfff0, 0x0004, /* G0.1~5 */
|
||||
0x0000, 0x8000, 0xffff, 0x0040, 0x0000, /* G0.6~10 */
|
||||
};
|
||||
static struct clk_parent_data pd_ext, pd_sys, pd_e;
|
||||
struct device *dev = &pdev->dev;
|
||||
void __iomem *clk_base, *pll_base, *sys_base;
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
struct clk_hw **hws;
|
||||
int i;
|
||||
|
||||
clk_base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (!clk_base)
|
||||
return -ENXIO;
|
||||
pll_base = devm_platform_ioremap_resource(pdev, 1);
|
||||
if (!pll_base)
|
||||
return -ENXIO;
|
||||
sys_base = devm_platform_ioremap_resource(pdev, 2);
|
||||
if (!sys_base)
|
||||
return -ENXIO;
|
||||
|
||||
/* enable default clks */
|
||||
for (i = 0; i < ARRAY_SIZE(sp_clken); i++)
|
||||
writel((sp_clken[i] << 16) | sp_clken[i], clk_base + i * 4);
|
||||
|
||||
clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, CLK_MAX),
|
||||
GFP_KERNEL);
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
hws = clk_data->hws;
|
||||
pd_ext.index = 0;
|
||||
|
||||
/* PLLs */
|
||||
hws[PLL_A] = sp_pll_register(dev, "plla", &pd_ext, PLLA_CTL,
|
||||
11, 12, 27000000, 0, DIV_A, 0);
|
||||
if (IS_ERR(hws[PLL_A]))
|
||||
return PTR_ERR(hws[PLL_A]);
|
||||
|
||||
hws[PLL_E] = sp_pll_register(dev, "plle", &pd_ext, PLLE_CTL,
|
||||
6, 2, 50000000, 0, 0, 0);
|
||||
if (IS_ERR(hws[PLL_E]))
|
||||
return PTR_ERR(hws[PLL_E]);
|
||||
pd_e.hw = hws[PLL_E];
|
||||
hws[PLL_E_2P5] = sp_pll_register(dev, "plle_2p5", &pd_e, PLLE_CTL,
|
||||
13, -1, 2500000, 0, 0, 0);
|
||||
if (IS_ERR(hws[PLL_E_2P5]))
|
||||
return PTR_ERR(hws[PLL_E_2P5]);
|
||||
hws[PLL_E_25] = sp_pll_register(dev, "plle_25", &pd_e, PLLE_CTL,
|
||||
12, -1, 25000000, 0, 0, 0);
|
||||
if (IS_ERR(hws[PLL_E_25]))
|
||||
return PTR_ERR(hws[PLL_E_25]);
|
||||
hws[PLL_E_112P5] = sp_pll_register(dev, "plle_112p5", &pd_e, PLLE_CTL,
|
||||
11, -1, 112500000, 0, 0, 0);
|
||||
if (IS_ERR(hws[PLL_E_112P5]))
|
||||
return PTR_ERR(hws[PLL_E_112P5]);
|
||||
|
||||
hws[PLL_F] = sp_pll_register(dev, "pllf", &pd_ext, PLLF_CTL,
|
||||
0, 10, 13500000, 1, 4, 0);
|
||||
if (IS_ERR(hws[PLL_F]))
|
||||
return PTR_ERR(hws[PLL_F]);
|
||||
|
||||
hws[PLL_TV] = sp_pll_register(dev, "plltv", &pd_ext, PLLTV_CTL,
|
||||
0, 15, 27000000, 0, DIV_TV, 0);
|
||||
if (IS_ERR(hws[PLL_TV]))
|
||||
return PTR_ERR(hws[PLL_TV]);
|
||||
hws[PLL_TV_A] = devm_clk_hw_register_divider(dev, "plltv_a", "plltv", 0,
|
||||
PLLTV_CTL + 4, 5, 1,
|
||||
CLK_DIVIDER_POWER_OF_TWO,
|
||||
&to_sp_pll(hws[PLL_TV])->lock);
|
||||
if (IS_ERR(hws[PLL_TV_A]))
|
||||
return PTR_ERR(hws[PLL_TV_A]);
|
||||
|
||||
/* system clock, should not be disabled */
|
||||
hws[PLL_SYS] = sp_pll_register(dev, "pllsys", &pd_ext, sys_base,
|
||||
10, 9, 13500000, 0, 4, CLK_IS_CRITICAL);
|
||||
if (IS_ERR(hws[PLL_SYS]))
|
||||
return PTR_ERR(hws[PLL_SYS]);
|
||||
pd_sys.hw = hws[PLL_SYS];
|
||||
|
||||
/* gates */
|
||||
for (i = 0; i < ARRAY_SIZE(sp_clk_gates); i++) {
|
||||
char name[10];
|
||||
u32 j = sp_clk_gates[i].reg;
|
||||
struct clk_parent_data *pd = sp_clk_gates[i].ext_parent ? &pd_ext : &pd_sys;
|
||||
|
||||
sprintf(name, "%02d_0x%02x", i, j);
|
||||
hws[i] = devm_clk_hw_register_gate_parent_data(dev, name, pd, 0,
|
||||
clk_base + (j >> 4) * 4,
|
||||
j & 0x0f,
|
||||
CLK_GATE_HIWORD_MASK,
|
||||
NULL);
|
||||
if (IS_ERR(hws[i]))
|
||||
return PTR_ERR(hws[i]);
|
||||
}
|
||||
|
||||
clk_data->num = CLK_MAX;
|
||||
|
||||
return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
static const struct of_device_id sp7021_clk_dt_ids[] = {
|
||||
{ .compatible = "sunplus,sp7021-clkc" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, sp7021_clk_dt_ids);
|
||||
|
||||
static struct platform_driver sp7021_clk_driver = {
|
||||
.probe = sp7021_clk_probe,
|
||||
.driver = {
|
||||
.name = "sp7021-clk",
|
||||
.of_match_table = sp7021_clk_dt_ids,
|
||||
},
|
||||
};
|
||||
module_platform_driver(sp7021_clk_driver);
|
||||
|
||||
MODULE_AUTHOR("Sunplus Technology");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_DESCRIPTION("Clock driver for Sunplus SP7021 SoC");
|
@ -1,4 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
obj-y += clk.o
|
||||
obj-$(CONFIG_LOONGSON1_LS1B) += clk-loongson1b.o
|
||||
obj-$(CONFIG_LOONGSON1_LS1C) += clk-loongson1c.o
|
@ -1,118 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (c) 2012-2016 Zhang, Keguang <keguang.zhang@gmail.com>
|
||||
*/
|
||||
|
||||
#include <linux/clkdev.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
#include <loongson1.h>
|
||||
#include "clk.h"
|
||||
|
||||
#define OSC (33 * 1000000)
|
||||
#define DIV_APB 2
|
||||
|
||||
static DEFINE_SPINLOCK(_lock);
|
||||
|
||||
static unsigned long ls1x_pll_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
u32 pll, rate;
|
||||
|
||||
pll = __raw_readl(LS1X_CLK_PLL_FREQ);
|
||||
rate = 12 + (pll & GENMASK(5, 0));
|
||||
rate *= OSC;
|
||||
rate >>= 1;
|
||||
|
||||
return rate;
|
||||
}
|
||||
|
||||
static const struct clk_ops ls1x_pll_clk_ops = {
|
||||
.recalc_rate = ls1x_pll_recalc_rate,
|
||||
};
|
||||
|
||||
static const char *const cpu_parents[] = { "cpu_clk_div", "osc_clk", };
|
||||
static const char *const ahb_parents[] = { "ahb_clk_div", "osc_clk", };
|
||||
static const char *const dc_parents[] = { "dc_clk_div", "osc_clk", };
|
||||
|
||||
void __init ls1x_clk_init(void)
|
||||
{
|
||||
struct clk_hw *hw;
|
||||
|
||||
hw = clk_hw_register_fixed_rate(NULL, "osc_clk", NULL, 0, OSC);
|
||||
clk_hw_register_clkdev(hw, "osc_clk", NULL);
|
||||
|
||||
/* clock derived from 33 MHz OSC clk */
|
||||
hw = clk_hw_register_pll(NULL, "pll_clk", "osc_clk",
|
||||
&ls1x_pll_clk_ops, 0);
|
||||
clk_hw_register_clkdev(hw, "pll_clk", NULL);
|
||||
|
||||
/* clock derived from PLL clk */
|
||||
/* _____
|
||||
* _______________________| |
|
||||
* OSC ___/ | MUX |___ CPU CLK
|
||||
* \___ PLL ___ CPU DIV ___| |
|
||||
* |_____|
|
||||
*/
|
||||
hw = clk_hw_register_divider(NULL, "cpu_clk_div", "pll_clk",
|
||||
CLK_GET_RATE_NOCACHE, LS1X_CLK_PLL_DIV,
|
||||
DIV_CPU_SHIFT, DIV_CPU_WIDTH,
|
||||
CLK_DIVIDER_ONE_BASED |
|
||||
CLK_DIVIDER_ROUND_CLOSEST, &_lock);
|
||||
clk_hw_register_clkdev(hw, "cpu_clk_div", NULL);
|
||||
hw = clk_hw_register_mux(NULL, "cpu_clk", cpu_parents,
|
||||
ARRAY_SIZE(cpu_parents),
|
||||
CLK_SET_RATE_NO_REPARENT, LS1X_CLK_PLL_DIV,
|
||||
BYPASS_CPU_SHIFT, BYPASS_CPU_WIDTH, 0, &_lock);
|
||||
clk_hw_register_clkdev(hw, "cpu_clk", NULL);
|
||||
|
||||
/* _____
|
||||
* _______________________| |
|
||||
* OSC ___/ | MUX |___ DC CLK
|
||||
* \___ PLL ___ DC DIV ___| |
|
||||
* |_____|
|
||||
*/
|
||||
hw = clk_hw_register_divider(NULL, "dc_clk_div", "pll_clk",
|
||||
0, LS1X_CLK_PLL_DIV, DIV_DC_SHIFT,
|
||||
DIV_DC_WIDTH, CLK_DIVIDER_ONE_BASED, &_lock);
|
||||
clk_hw_register_clkdev(hw, "dc_clk_div", NULL);
|
||||
hw = clk_hw_register_mux(NULL, "dc_clk", dc_parents,
|
||||
ARRAY_SIZE(dc_parents),
|
||||
CLK_SET_RATE_NO_REPARENT, LS1X_CLK_PLL_DIV,
|
||||
BYPASS_DC_SHIFT, BYPASS_DC_WIDTH, 0, &_lock);
|
||||
clk_hw_register_clkdev(hw, "dc_clk", NULL);
|
||||
|
||||
/* _____
|
||||
* _______________________| |
|
||||
* OSC ___/ | MUX |___ DDR CLK
|
||||
* \___ PLL ___ DDR DIV ___| |
|
||||
* |_____|
|
||||
*/
|
||||
hw = clk_hw_register_divider(NULL, "ahb_clk_div", "pll_clk",
|
||||
0, LS1X_CLK_PLL_DIV, DIV_DDR_SHIFT,
|
||||
DIV_DDR_WIDTH, CLK_DIVIDER_ONE_BASED,
|
||||
&_lock);
|
||||
clk_hw_register_clkdev(hw, "ahb_clk_div", NULL);
|
||||
hw = clk_hw_register_mux(NULL, "ahb_clk", ahb_parents,
|
||||
ARRAY_SIZE(ahb_parents),
|
||||
CLK_SET_RATE_NO_REPARENT, LS1X_CLK_PLL_DIV,
|
||||
BYPASS_DDR_SHIFT, BYPASS_DDR_WIDTH, 0, &_lock);
|
||||
clk_hw_register_clkdev(hw, "ahb_clk", NULL);
|
||||
clk_hw_register_clkdev(hw, "ls1x-dma", NULL);
|
||||
clk_hw_register_clkdev(hw, "stmmaceth", NULL);
|
||||
|
||||
/* clock derived from AHB clk */
|
||||
/* APB clk is always half of the AHB clk */
|
||||
hw = clk_hw_register_fixed_factor(NULL, "apb_clk", "ahb_clk", 0, 1,
|
||||
DIV_APB);
|
||||
clk_hw_register_clkdev(hw, "apb_clk", NULL);
|
||||
clk_hw_register_clkdev(hw, "ls1x-ac97", NULL);
|
||||
clk_hw_register_clkdev(hw, "ls1x-i2c", NULL);
|
||||
clk_hw_register_clkdev(hw, "ls1x-nand", NULL);
|
||||
clk_hw_register_clkdev(hw, "ls1x-pwmtimer", NULL);
|
||||
clk_hw_register_clkdev(hw, "ls1x-spi", NULL);
|
||||
clk_hw_register_clkdev(hw, "ls1x-wdt", NULL);
|
||||
clk_hw_register_clkdev(hw, "serial8250", NULL);
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (c) 2016 Yang Ling <gnaygnil@gmail.com>
|
||||
*/
|
||||
|
||||
#include <linux/clkdev.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <loongson1.h>
|
||||
#include "clk.h"
|
||||
|
||||
#define OSC (24 * 1000000)
|
||||
#define DIV_APB 1
|
||||
|
||||
static DEFINE_SPINLOCK(_lock);
|
||||
|
||||
static unsigned long ls1x_pll_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
u32 pll, rate;
|
||||
|
||||
pll = __raw_readl(LS1X_CLK_PLL_FREQ);
|
||||
rate = ((pll >> 8) & 0xff) + ((pll >> 16) & 0xff);
|
||||
rate *= OSC;
|
||||
rate >>= 2;
|
||||
|
||||
return rate;
|
||||
}
|
||||
|
||||
static const struct clk_ops ls1x_pll_clk_ops = {
|
||||
.recalc_rate = ls1x_pll_recalc_rate,
|
||||
};
|
||||
|
||||
static const struct clk_div_table ahb_div_table[] = {
|
||||
[0] = { .val = 0, .div = 2 },
|
||||
[1] = { .val = 1, .div = 4 },
|
||||
[2] = { .val = 2, .div = 3 },
|
||||
[3] = { .val = 3, .div = 3 },
|
||||
[4] = { /* sentinel */ }
|
||||
};
|
||||
|
||||
void __init ls1x_clk_init(void)
|
||||
{
|
||||
struct clk_hw *hw;
|
||||
|
||||
hw = clk_hw_register_fixed_rate(NULL, "osc_clk", NULL, 0, OSC);
|
||||
clk_hw_register_clkdev(hw, "osc_clk", NULL);
|
||||
|
||||
/* clock derived from 24 MHz OSC clk */
|
||||
hw = clk_hw_register_pll(NULL, "pll_clk", "osc_clk",
|
||||
&ls1x_pll_clk_ops, 0);
|
||||
clk_hw_register_clkdev(hw, "pll_clk", NULL);
|
||||
|
||||
hw = clk_hw_register_divider(NULL, "cpu_clk_div", "pll_clk",
|
||||
CLK_GET_RATE_NOCACHE, LS1X_CLK_PLL_DIV,
|
||||
DIV_CPU_SHIFT, DIV_CPU_WIDTH,
|
||||
CLK_DIVIDER_ONE_BASED |
|
||||
CLK_DIVIDER_ROUND_CLOSEST, &_lock);
|
||||
clk_hw_register_clkdev(hw, "cpu_clk_div", NULL);
|
||||
hw = clk_hw_register_fixed_factor(NULL, "cpu_clk", "cpu_clk_div",
|
||||
0, 1, 1);
|
||||
clk_hw_register_clkdev(hw, "cpu_clk", NULL);
|
||||
|
||||
hw = clk_hw_register_divider(NULL, "dc_clk_div", "pll_clk",
|
||||
0, LS1X_CLK_PLL_DIV, DIV_DC_SHIFT,
|
||||
DIV_DC_WIDTH, CLK_DIVIDER_ONE_BASED, &_lock);
|
||||
clk_hw_register_clkdev(hw, "dc_clk_div", NULL);
|
||||
hw = clk_hw_register_fixed_factor(NULL, "dc_clk", "dc_clk_div",
|
||||
0, 1, 1);
|
||||
clk_hw_register_clkdev(hw, "dc_clk", NULL);
|
||||
|
||||
hw = clk_hw_register_divider_table(NULL, "ahb_clk_div", "cpu_clk_div",
|
||||
0, LS1X_CLK_PLL_FREQ, DIV_DDR_SHIFT,
|
||||
DIV_DDR_WIDTH, CLK_DIVIDER_ALLOW_ZERO,
|
||||
ahb_div_table, &_lock);
|
||||
clk_hw_register_clkdev(hw, "ahb_clk_div", NULL);
|
||||
hw = clk_hw_register_fixed_factor(NULL, "ahb_clk", "ahb_clk_div",
|
||||
0, 1, 1);
|
||||
clk_hw_register_clkdev(hw, "ahb_clk", NULL);
|
||||
clk_hw_register_clkdev(hw, "ls1x-dma", NULL);
|
||||
clk_hw_register_clkdev(hw, "stmmaceth", NULL);
|
||||
|
||||
/* clock derived from AHB clk */
|
||||
hw = clk_hw_register_fixed_factor(NULL, "apb_clk", "ahb_clk", 0, 1,
|
||||
DIV_APB);
|
||||
clk_hw_register_clkdev(hw, "apb_clk", NULL);
|
||||
clk_hw_register_clkdev(hw, "ls1x-ac97", NULL);
|
||||
clk_hw_register_clkdev(hw, "ls1x-i2c", NULL);
|
||||
clk_hw_register_clkdev(hw, "ls1x-nand", NULL);
|
||||
clk_hw_register_clkdev(hw, "ls1x-pwmtimer", NULL);
|
||||
clk_hw_register_clkdev(hw, "ls1x-spi", NULL);
|
||||
clk_hw_register_clkdev(hw, "ls1x-wdt", NULL);
|
||||
clk_hw_register_clkdev(hw, "serial8250", NULL);
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (c) 2012-2016 Zhang, Keguang <keguang.zhang@gmail.com>
|
||||
*/
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "clk.h"
|
||||
|
||||
struct clk_hw *__init clk_hw_register_pll(struct device *dev,
|
||||
const char *name,
|
||||
const char *parent_name,
|
||||
const struct clk_ops *ops,
|
||||
unsigned long flags)
|
||||
{
|
||||
int ret;
|
||||
struct clk_hw *hw;
|
||||
struct clk_init_data init;
|
||||
|
||||
/* allocate the divider */
|
||||
hw = kzalloc(sizeof(*hw), GFP_KERNEL);
|
||||
if (!hw)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
init.name = name;
|
||||
init.ops = ops;
|
||||
init.flags = flags;
|
||||
init.parent_names = parent_name ? &parent_name : NULL;
|
||||
init.num_parents = parent_name ? 1 : 0;
|
||||
hw->init = &init;
|
||||
|
||||
/* register the clock */
|
||||
ret = clk_hw_register(dev, hw);
|
||||
if (ret) {
|
||||
kfree(hw);
|
||||
hw = ERR_PTR(ret);
|
||||
}
|
||||
|
||||
return hw;
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
* Copyright (c) 2012-2016 Zhang, Keguang <keguang.zhang@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef __LOONGSON1_CLK_H
|
||||
#define __LOONGSON1_CLK_H
|
||||
|
||||
struct clk_hw *clk_hw_register_pll(struct device *dev,
|
||||
const char *name,
|
||||
const char *parent_name,
|
||||
const struct clk_ops *ops,
|
||||
unsigned long flags);
|
||||
|
||||
#endif /* __LOONGSON1_CLK_H */
|
@ -75,7 +75,7 @@ config COMMON_CLK_MT2701_G3DSYS
|
||||
This driver supports MediaTek MT2701 g3dsys clocks.
|
||||
|
||||
config COMMON_CLK_MT2712
|
||||
bool "Clock driver for MediaTek MT2712"
|
||||
tristate "Clock driver for MediaTek MT2712"
|
||||
depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
default ARCH_MEDIATEK && ARM64
|
||||
@ -83,43 +83,43 @@ config COMMON_CLK_MT2712
|
||||
This driver supports MediaTek MT2712 basic clocks.
|
||||
|
||||
config COMMON_CLK_MT2712_BDPSYS
|
||||
bool "Clock driver for MediaTek MT2712 bdpsys"
|
||||
tristate "Clock driver for MediaTek MT2712 bdpsys"
|
||||
depends on COMMON_CLK_MT2712
|
||||
help
|
||||
This driver supports MediaTek MT2712 bdpsys clocks.
|
||||
|
||||
config COMMON_CLK_MT2712_IMGSYS
|
||||
bool "Clock driver for MediaTek MT2712 imgsys"
|
||||
tristate "Clock driver for MediaTek MT2712 imgsys"
|
||||
depends on COMMON_CLK_MT2712
|
||||
help
|
||||
This driver supports MediaTek MT2712 imgsys clocks.
|
||||
|
||||
config COMMON_CLK_MT2712_JPGDECSYS
|
||||
bool "Clock driver for MediaTek MT2712 jpgdecsys"
|
||||
tristate "Clock driver for MediaTek MT2712 jpgdecsys"
|
||||
depends on COMMON_CLK_MT2712
|
||||
help
|
||||
This driver supports MediaTek MT2712 jpgdecsys clocks.
|
||||
|
||||
config COMMON_CLK_MT2712_MFGCFG
|
||||
bool "Clock driver for MediaTek MT2712 mfgcfg"
|
||||
tristate "Clock driver for MediaTek MT2712 mfgcfg"
|
||||
depends on COMMON_CLK_MT2712
|
||||
help
|
||||
This driver supports MediaTek MT2712 mfgcfg clocks.
|
||||
|
||||
config COMMON_CLK_MT2712_MMSYS
|
||||
bool "Clock driver for MediaTek MT2712 mmsys"
|
||||
tristate "Clock driver for MediaTek MT2712 mmsys"
|
||||
depends on COMMON_CLK_MT2712
|
||||
help
|
||||
This driver supports MediaTek MT2712 mmsys clocks.
|
||||
|
||||
config COMMON_CLK_MT2712_VDECSYS
|
||||
bool "Clock driver for MediaTek MT2712 vdecsys"
|
||||
tristate "Clock driver for MediaTek MT2712 vdecsys"
|
||||
depends on COMMON_CLK_MT2712
|
||||
help
|
||||
This driver supports MediaTek MT2712 vdecsys clocks.
|
||||
|
||||
config COMMON_CLK_MT2712_VENCSYS
|
||||
bool "Clock driver for MediaTek MT2712 vencsys"
|
||||
tristate "Clock driver for MediaTek MT2712 vencsys"
|
||||
depends on COMMON_CLK_MT2712
|
||||
help
|
||||
This driver supports MediaTek MT2712 vencsys clocks.
|
||||
@ -133,79 +133,79 @@ config COMMON_CLK_MT6765
|
||||
This driver supports MediaTek MT6765 basic clocks.
|
||||
|
||||
config COMMON_CLK_MT6765_AUDIOSYS
|
||||
bool "Clock driver for MediaTek MT6765 audiosys"
|
||||
tristate "Clock driver for MediaTek MT6765 audiosys"
|
||||
depends on COMMON_CLK_MT6765
|
||||
help
|
||||
This driver supports MediaTek MT6765 audiosys clocks.
|
||||
|
||||
config COMMON_CLK_MT6765_CAMSYS
|
||||
bool "Clock driver for MediaTek MT6765 camsys"
|
||||
tristate "Clock driver for MediaTek MT6765 camsys"
|
||||
depends on COMMON_CLK_MT6765
|
||||
help
|
||||
This driver supports MediaTek MT6765 camsys clocks.
|
||||
|
||||
config COMMON_CLK_MT6765_GCESYS
|
||||
bool "Clock driver for MediaTek MT6765 gcesys"
|
||||
tristate "Clock driver for MediaTek MT6765 gcesys"
|
||||
depends on COMMON_CLK_MT6765
|
||||
help
|
||||
This driver supports MediaTek MT6765 gcesys clocks.
|
||||
|
||||
config COMMON_CLK_MT6765_MMSYS
|
||||
bool "Clock driver for MediaTek MT6765 mmsys"
|
||||
tristate "Clock driver for MediaTek MT6765 mmsys"
|
||||
depends on COMMON_CLK_MT6765
|
||||
help
|
||||
This driver supports MediaTek MT6765 mmsys clocks.
|
||||
|
||||
config COMMON_CLK_MT6765_IMGSYS
|
||||
bool "Clock driver for MediaTek MT6765 imgsys"
|
||||
tristate "Clock driver for MediaTek MT6765 imgsys"
|
||||
depends on COMMON_CLK_MT6765
|
||||
help
|
||||
This driver supports MediaTek MT6765 imgsys clocks.
|
||||
|
||||
config COMMON_CLK_MT6765_VCODECSYS
|
||||
bool "Clock driver for MediaTek MT6765 vcodecsys"
|
||||
tristate "Clock driver for MediaTek MT6765 vcodecsys"
|
||||
depends on COMMON_CLK_MT6765
|
||||
help
|
||||
This driver supports MediaTek MT6765 vcodecsys clocks.
|
||||
|
||||
config COMMON_CLK_MT6765_MFGSYS
|
||||
bool "Clock driver for MediaTek MT6765 mfgsys"
|
||||
tristate "Clock driver for MediaTek MT6765 mfgsys"
|
||||
depends on COMMON_CLK_MT6765
|
||||
help
|
||||
This driver supports MediaTek MT6765 mfgsys clocks.
|
||||
|
||||
config COMMON_CLK_MT6765_MIPI0ASYS
|
||||
bool "Clock driver for MediaTek MT6765 mipi0asys"
|
||||
tristate "Clock driver for MediaTek MT6765 mipi0asys"
|
||||
depends on COMMON_CLK_MT6765
|
||||
help
|
||||
This driver supports MediaTek MT6765 mipi0asys clocks.
|
||||
|
||||
config COMMON_CLK_MT6765_MIPI0BSYS
|
||||
bool "Clock driver for MediaTek MT6765 mipi0bsys"
|
||||
tristate "Clock driver for MediaTek MT6765 mipi0bsys"
|
||||
depends on COMMON_CLK_MT6765
|
||||
help
|
||||
This driver supports MediaTek MT6765 mipi0bsys clocks.
|
||||
|
||||
config COMMON_CLK_MT6765_MIPI1ASYS
|
||||
bool "Clock driver for MediaTek MT6765 mipi1asys"
|
||||
tristate "Clock driver for MediaTek MT6765 mipi1asys"
|
||||
depends on COMMON_CLK_MT6765
|
||||
help
|
||||
This driver supports MediaTek MT6765 mipi1asys clocks.
|
||||
|
||||
config COMMON_CLK_MT6765_MIPI1BSYS
|
||||
bool "Clock driver for MediaTek MT6765 mipi1bsys"
|
||||
tristate "Clock driver for MediaTek MT6765 mipi1bsys"
|
||||
depends on COMMON_CLK_MT6765
|
||||
help
|
||||
This driver supports MediaTek MT6765 mipi1bsys clocks.
|
||||
|
||||
config COMMON_CLK_MT6765_MIPI2ASYS
|
||||
bool "Clock driver for MediaTek MT6765 mipi2asys"
|
||||
tristate "Clock driver for MediaTek MT6765 mipi2asys"
|
||||
depends on COMMON_CLK_MT6765
|
||||
help
|
||||
This driver supports MediaTek MT6765 mipi2asys clocks.
|
||||
|
||||
config COMMON_CLK_MT6765_MIPI2BSYS
|
||||
bool "Clock driver for MediaTek MT6765 mipi2bsys"
|
||||
tristate "Clock driver for MediaTek MT6765 mipi2bsys"
|
||||
depends on COMMON_CLK_MT6765
|
||||
help
|
||||
This driver supports MediaTek MT6765 mipi2bsys clocks.
|
||||
@ -270,6 +270,7 @@ config COMMON_CLK_MT6795
|
||||
tristate "Clock driver for MediaTek MT6795"
|
||||
depends on ARCH_MEDIATEK || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
select COMMON_CLK_MEDIATEK_FHCTL
|
||||
default ARCH_MEDIATEK
|
||||
help
|
||||
This driver supports MediaTek MT6795 basic clocks and clocks
|
||||
@ -312,31 +313,31 @@ config COMMON_CLK_MT6797
|
||||
This driver supports MediaTek MT6797 basic clocks.
|
||||
|
||||
config COMMON_CLK_MT6797_MMSYS
|
||||
bool "Clock driver for MediaTek MT6797 mmsys"
|
||||
tristate "Clock driver for MediaTek MT6797 mmsys"
|
||||
depends on COMMON_CLK_MT6797
|
||||
help
|
||||
This driver supports MediaTek MT6797 mmsys clocks.
|
||||
|
||||
config COMMON_CLK_MT6797_IMGSYS
|
||||
bool "Clock driver for MediaTek MT6797 imgsys"
|
||||
tristate "Clock driver for MediaTek MT6797 imgsys"
|
||||
depends on COMMON_CLK_MT6797
|
||||
help
|
||||
This driver supports MediaTek MT6797 imgsys clocks.
|
||||
|
||||
config COMMON_CLK_MT6797_VDECSYS
|
||||
bool "Clock driver for MediaTek MT6797 vdecsys"
|
||||
tristate "Clock driver for MediaTek MT6797 vdecsys"
|
||||
depends on COMMON_CLK_MT6797
|
||||
help
|
||||
This driver supports MediaTek MT6797 vdecsys clocks.
|
||||
|
||||
config COMMON_CLK_MT6797_VENCSYS
|
||||
bool "Clock driver for MediaTek MT6797 vencsys"
|
||||
tristate "Clock driver for MediaTek MT6797 vencsys"
|
||||
depends on COMMON_CLK_MT6797
|
||||
help
|
||||
This driver supports MediaTek MT6797 vencsys clocks.
|
||||
|
||||
config COMMON_CLK_MT7622
|
||||
bool "Clock driver for MediaTek MT7622"
|
||||
tristate "Clock driver for MediaTek MT7622"
|
||||
depends on ARCH_MEDIATEK || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
default ARCH_MEDIATEK
|
||||
@ -345,21 +346,21 @@ config COMMON_CLK_MT7622
|
||||
required for various periperals found on MediaTek.
|
||||
|
||||
config COMMON_CLK_MT7622_ETHSYS
|
||||
bool "Clock driver for MediaTek MT7622 ETHSYS"
|
||||
tristate "Clock driver for MediaTek MT7622 ETHSYS"
|
||||
depends on COMMON_CLK_MT7622
|
||||
help
|
||||
This driver add support for clocks for Ethernet and SGMII
|
||||
required on MediaTek MT7622 SoC.
|
||||
|
||||
config COMMON_CLK_MT7622_HIFSYS
|
||||
bool "Clock driver for MediaTek MT7622 HIFSYS"
|
||||
tristate "Clock driver for MediaTek MT7622 HIFSYS"
|
||||
depends on COMMON_CLK_MT7622
|
||||
help
|
||||
This driver supports MediaTek MT7622 HIFSYS clocks providing
|
||||
to PCI-E and USB.
|
||||
|
||||
config COMMON_CLK_MT7622_AUDSYS
|
||||
bool "Clock driver for MediaTek MT7622 AUDSYS"
|
||||
tristate "Clock driver for MediaTek MT7622 AUDSYS"
|
||||
depends on COMMON_CLK_MT7622
|
||||
help
|
||||
This driver supports MediaTek MT7622 AUDSYS clocks providing
|
||||
@ -406,7 +407,7 @@ config COMMON_CLK_MT7981_ETHSYS
|
||||
required on MediaTek MT7981 SoC.
|
||||
|
||||
config COMMON_CLK_MT7986
|
||||
bool "Clock driver for MediaTek MT7986"
|
||||
tristate "Clock driver for MediaTek MT7986"
|
||||
depends on ARCH_MEDIATEK || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
default ARCH_MEDIATEK
|
||||
@ -415,7 +416,7 @@ config COMMON_CLK_MT7986
|
||||
required for various peripherals found on MediaTek.
|
||||
|
||||
config COMMON_CLK_MT7986_ETHSYS
|
||||
bool "Clock driver for MediaTek MT7986 ETHSYS"
|
||||
tristate "Clock driver for MediaTek MT7986 ETHSYS"
|
||||
depends on COMMON_CLK_MT7986
|
||||
default COMMON_CLK_MT7986
|
||||
help
|
||||
@ -423,7 +424,7 @@ config COMMON_CLK_MT7986_ETHSYS
|
||||
required on MediaTek MT7986 SoC.
|
||||
|
||||
config COMMON_CLK_MT8135
|
||||
bool "Clock driver for MediaTek MT8135"
|
||||
tristate "Clock driver for MediaTek MT8135"
|
||||
depends on (ARCH_MEDIATEK && ARM) || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
default ARCH_MEDIATEK && ARM
|
||||
@ -431,7 +432,7 @@ config COMMON_CLK_MT8135
|
||||
This driver supports MediaTek MT8135 clocks.
|
||||
|
||||
config COMMON_CLK_MT8167
|
||||
bool "Clock driver for MediaTek MT8167"
|
||||
tristate "Clock driver for MediaTek MT8167"
|
||||
depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
default ARCH_MEDIATEK
|
||||
@ -439,35 +440,35 @@ config COMMON_CLK_MT8167
|
||||
This driver supports MediaTek MT8167 basic clocks.
|
||||
|
||||
config COMMON_CLK_MT8167_AUDSYS
|
||||
bool "Clock driver for MediaTek MT8167 audsys"
|
||||
tristate "Clock driver for MediaTek MT8167 audsys"
|
||||
depends on COMMON_CLK_MT8167
|
||||
default COMMON_CLK_MT8167
|
||||
help
|
||||
This driver supports MediaTek MT8167 audsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8167_IMGSYS
|
||||
bool "Clock driver for MediaTek MT8167 imgsys"
|
||||
tristate "Clock driver for MediaTek MT8167 imgsys"
|
||||
depends on COMMON_CLK_MT8167
|
||||
default COMMON_CLK_MT8167
|
||||
help
|
||||
This driver supports MediaTek MT8167 imgsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8167_MFGCFG
|
||||
bool "Clock driver for MediaTek MT8167 mfgcfg"
|
||||
tristate "Clock driver for MediaTek MT8167 mfgcfg"
|
||||
depends on COMMON_CLK_MT8167
|
||||
default COMMON_CLK_MT8167
|
||||
help
|
||||
This driver supports MediaTek MT8167 mfgcfg clocks.
|
||||
|
||||
config COMMON_CLK_MT8167_MMSYS
|
||||
bool "Clock driver for MediaTek MT8167 mmsys"
|
||||
tristate "Clock driver for MediaTek MT8167 mmsys"
|
||||
depends on COMMON_CLK_MT8167
|
||||
default COMMON_CLK_MT8167
|
||||
help
|
||||
This driver supports MediaTek MT8167 mmsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8167_VDECSYS
|
||||
bool "Clock driver for MediaTek MT8167 vdecsys"
|
||||
tristate "Clock driver for MediaTek MT8167 vdecsys"
|
||||
depends on COMMON_CLK_MT8167
|
||||
default COMMON_CLK_MT8167
|
||||
help
|
||||
@ -477,6 +478,7 @@ config COMMON_CLK_MT8173
|
||||
tristate "Clock driver for MediaTek MT8173"
|
||||
depends on ARM64 || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
select COMMON_CLK_MEDIATEK_FHCTL
|
||||
default ARCH_MEDIATEK
|
||||
help
|
||||
This driver supports MediaTek MT8173 basic clocks and clocks
|
||||
@ -511,7 +513,7 @@ config COMMON_CLK_MT8173_VENCSYS
|
||||
This driver supports MediaTek MT8173 vencsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8183
|
||||
bool "Clock driver for MediaTek MT8183"
|
||||
tristate "Clock driver for MediaTek MT8183"
|
||||
depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
default ARCH_MEDIATEK && ARM64
|
||||
@ -519,84 +521,84 @@ config COMMON_CLK_MT8183
|
||||
This driver supports MediaTek MT8183 basic clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_AUDIOSYS
|
||||
bool "Clock driver for MediaTek MT8183 audiosys"
|
||||
tristate "Clock driver for MediaTek MT8183 audiosys"
|
||||
depends on COMMON_CLK_MT8183
|
||||
default COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 audiosys clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_CAMSYS
|
||||
bool "Clock driver for MediaTek MT8183 camsys"
|
||||
tristate "Clock driver for MediaTek MT8183 camsys"
|
||||
depends on COMMON_CLK_MT8183
|
||||
default COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 camsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_IMGSYS
|
||||
bool "Clock driver for MediaTek MT8183 imgsys"
|
||||
tristate "Clock driver for MediaTek MT8183 imgsys"
|
||||
depends on COMMON_CLK_MT8183
|
||||
default COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 imgsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_IPU_CORE0
|
||||
bool "Clock driver for MediaTek MT8183 ipu_core0"
|
||||
tristate "Clock driver for MediaTek MT8183 ipu_core0"
|
||||
depends on COMMON_CLK_MT8183
|
||||
default COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 ipu_core0 clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_IPU_CORE1
|
||||
bool "Clock driver for MediaTek MT8183 ipu_core1"
|
||||
tristate "Clock driver for MediaTek MT8183 ipu_core1"
|
||||
depends on COMMON_CLK_MT8183
|
||||
default COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 ipu_core1 clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_IPU_ADL
|
||||
bool "Clock driver for MediaTek MT8183 ipu_adl"
|
||||
tristate "Clock driver for MediaTek MT8183 ipu_adl"
|
||||
depends on COMMON_CLK_MT8183
|
||||
default COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 ipu_adl clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_IPU_CONN
|
||||
bool "Clock driver for MediaTek MT8183 ipu_conn"
|
||||
tristate "Clock driver for MediaTek MT8183 ipu_conn"
|
||||
depends on COMMON_CLK_MT8183
|
||||
default COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 ipu_conn clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_MFGCFG
|
||||
bool "Clock driver for MediaTek MT8183 mfgcfg"
|
||||
tristate "Clock driver for MediaTek MT8183 mfgcfg"
|
||||
depends on COMMON_CLK_MT8183
|
||||
default COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 mfgcfg clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_MMSYS
|
||||
bool "Clock driver for MediaTek MT8183 mmsys"
|
||||
tristate "Clock driver for MediaTek MT8183 mmsys"
|
||||
depends on COMMON_CLK_MT8183
|
||||
default COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 mmsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_VDECSYS
|
||||
bool "Clock driver for MediaTek MT8183 vdecsys"
|
||||
tristate "Clock driver for MediaTek MT8183 vdecsys"
|
||||
depends on COMMON_CLK_MT8183
|
||||
default COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 vdecsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_VENCSYS
|
||||
bool "Clock driver for MediaTek MT8183 vencsys"
|
||||
tristate "Clock driver for MediaTek MT8183 vencsys"
|
||||
depends on COMMON_CLK_MT8183
|
||||
default COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 vencsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8186
|
||||
bool "Clock driver for MediaTek MT8186"
|
||||
tristate "Clock driver for MediaTek MT8186"
|
||||
depends on ARM64 || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
select COMMON_CLK_MEDIATEK_FHCTL
|
||||
@ -604,82 +606,246 @@ config COMMON_CLK_MT8186
|
||||
help
|
||||
This driver supports MediaTek MT8186 clocks.
|
||||
|
||||
config COMMON_CLK_MT8192
|
||||
bool "Clock driver for MediaTek MT8192"
|
||||
config COMMON_CLK_MT8186_CAMSYS
|
||||
tristate "Clock driver for MediaTek MT8186 camsys"
|
||||
depends on COMMON_CLK_MT8186
|
||||
default COMMON_CLK_MT8186
|
||||
help
|
||||
This driver supports MediaTek MT8186 camsys and camsys_raw clocks.
|
||||
|
||||
config COMMON_CLK_MT8186_IMGSYS
|
||||
tristate "Clock driver for MediaTek MT8186 imgsys"
|
||||
depends on COMMON_CLK_MT8186
|
||||
default COMMON_CLK_MT8186
|
||||
help
|
||||
This driver supports MediaTek MT8186 imgsys and imgsys2 clocks.
|
||||
|
||||
config COMMON_CLK_MT8186_IPESYS
|
||||
tristate "Clock driver for MediaTek MT8186 ipesys"
|
||||
depends on COMMON_CLK_MT8186_IMGSYS
|
||||
default COMMON_CLK_MT8186_IMGSYS
|
||||
help
|
||||
This driver supports MediaTek MT8186 ipesys clocks.
|
||||
|
||||
config COMMON_CLK_MT8186_WPESYS
|
||||
tristate "Clock driver for MediaTek MT8186 wpesys"
|
||||
depends on COMMON_CLK_MT8186_IMGSYS
|
||||
default COMMON_CLK_MT8186_IMGSYS
|
||||
help
|
||||
This driver supports MediaTek MT8186 Warp Engine clocks.
|
||||
|
||||
config COMMON_CLK_MT8186_IMP_IIC_WRAP
|
||||
tristate "Clock driver for MediaTek MT8186 imp_iic_wrap"
|
||||
depends on COMMON_CLK_MT8186
|
||||
default COMMON_CLK_MT8186
|
||||
help
|
||||
This driver supports MediaTek MT8186 imp_iic_wrap clocks.
|
||||
|
||||
config COMMON_CLK_MT8186_MCUSYS
|
||||
tristate "Clock driver for MediaTek MT8186 mcusys"
|
||||
depends on COMMON_CLK_MT8186
|
||||
default COMMON_CLK_MT8186
|
||||
help
|
||||
This driver supports MediaTek MT8186 mcusys clocks.
|
||||
|
||||
config COMMON_CLK_MT8186_MDPSYS
|
||||
tristate "Clock driver for MediaTek MT8186 mdpsys"
|
||||
depends on COMMON_CLK_MT8186
|
||||
default COMMON_CLK_MT8186
|
||||
help
|
||||
This driver supports MediaTek MT8186 mdpsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8186_MFGCFG
|
||||
tristate "Clock driver for MediaTek MT8186 mfgcfg"
|
||||
depends on COMMON_CLK_MT8186
|
||||
default COMMON_CLK_MT8186
|
||||
help
|
||||
This driver supports MediaTek MT8186 mfgcfg clocks.
|
||||
|
||||
config COMMON_CLK_MT8186_MMSYS
|
||||
tristate "Clock driver for MediaTek MT8186 mmsys"
|
||||
depends on COMMON_CLK_MT8186
|
||||
default COMMON_CLK_MT8186
|
||||
help
|
||||
This driver supports MediaTek MT8186 mmsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8186_VDECSYS
|
||||
tristate "Clock driver for MediaTek MT8186 vdecsys"
|
||||
depends on COMMON_CLK_MT8186
|
||||
default COMMON_CLK_MT8186
|
||||
help
|
||||
This driver supports MediaTek MT8186 vdecsys and vdecsys_soc clocks.
|
||||
|
||||
config COMMON_CLK_MT8186_VENCSYS
|
||||
tristate "Clock driver for MediaTek MT8186 vencsys"
|
||||
depends on COMMON_CLK_MT8186
|
||||
default COMMON_CLK_MT8186
|
||||
help
|
||||
This driver supports MediaTek MT8186 vencsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8188
|
||||
tristate "Clock driver for MediaTek MT8188"
|
||||
depends on ARM64 || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
select COMMON_CLK_MEDIATEK_FHCTL
|
||||
default ARCH_MEDIATEK
|
||||
help
|
||||
This driver supports MediaTek MT8188 clocks.
|
||||
|
||||
config COMMON_CLK_MT8188_ADSP_AUDIO26M
|
||||
tristate "Clock driver for MediaTek MT8188 adsp audio26m"
|
||||
depends on COMMON_CLK_MT8188
|
||||
default COMMON_CLK_MT8188
|
||||
help
|
||||
This driver supports MediaTek MT8188 adsp audio26m clocks.
|
||||
|
||||
config COMMON_CLK_MT8188_CAMSYS
|
||||
tristate "Clock driver for MediaTek MT8188 camsys"
|
||||
depends on COMMON_CLK_MT8188_VPPSYS
|
||||
default COMMON_CLK_MT8188_VPPSYS
|
||||
help
|
||||
This driver supports MediaTek MT8188 camsys and camsys_raw clocks.
|
||||
|
||||
config COMMON_CLK_MT8188_IMGSYS
|
||||
tristate "Clock driver for MediaTek MT8188 imgsys"
|
||||
depends on COMMON_CLK_MT8188_VPPSYS
|
||||
default COMMON_CLK_MT8188_VPPSYS
|
||||
help
|
||||
This driver supports MediaTek MT8188 imgsys and imgsys2 clocks.
|
||||
|
||||
config COMMON_CLK_MT8188_IMP_IIC_WRAP
|
||||
tristate "Clock driver for MediaTek MT8188 imp_iic_wrap"
|
||||
depends on COMMON_CLK_MT8188
|
||||
default COMMON_CLK_MT8188
|
||||
help
|
||||
This driver supports MediaTek MT8188 I2C/I3C clocks.
|
||||
|
||||
config COMMON_CLK_MT8188_IPESYS
|
||||
tristate "Clock driver for MediaTek MT8188 ipesys"
|
||||
depends on COMMON_CLK_MT8188_IMGSYS
|
||||
default COMMON_CLK_MT8188_IMGSYS
|
||||
help
|
||||
This driver supports MediaTek MT8188 ipesys clocks.
|
||||
|
||||
config COMMON_CLK_MT8188_MFGCFG
|
||||
tristate "Clock driver for MediaTek MT8188 mfgcfg"
|
||||
depends on COMMON_CLK_MT8188
|
||||
default COMMON_CLK_MT8188
|
||||
help
|
||||
This driver supports MediaTek MT8188 mfgcfg clocks.
|
||||
|
||||
config COMMON_CLK_MT8188_VDECSYS
|
||||
tristate "Clock driver for MediaTek MT8188 vdecsys"
|
||||
depends on COMMON_CLK_MT8188_VPPSYS
|
||||
default COMMON_CLK_MT8188_VPPSYS
|
||||
help
|
||||
This driver supports MediaTek MT8188 vdecsys and vdecsys_soc clocks.
|
||||
|
||||
config COMMON_CLK_MT8188_VDOSYS
|
||||
tristate "Clock driver for MediaTek MT8188 vdosys"
|
||||
depends on COMMON_CLK_MT8188
|
||||
default COMMON_CLK_MT8188
|
||||
help
|
||||
This driver supports MediaTek MT8188 vdosys0/1 (multimedia) clocks.
|
||||
|
||||
config COMMON_CLK_MT8188_VENCSYS
|
||||
tristate "Clock driver for MediaTek MT8188 vencsys"
|
||||
depends on COMMON_CLK_MT8188_VPPSYS
|
||||
default COMMON_CLK_MT8188_VPPSYS
|
||||
help
|
||||
This driver supports MediaTek MT8188 vencsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8188_VPPSYS
|
||||
tristate "Clock driver for MediaTek MT8188 vppsys"
|
||||
depends on COMMON_CLK_MT8188
|
||||
default COMMON_CLK_MT8188
|
||||
help
|
||||
This driver supports MediaTek MT8188 vppsys0/1 clocks.
|
||||
|
||||
config COMMON_CLK_MT8188_WPESYS
|
||||
tristate "Clock driver for MediaTek MT8188 wpesys"
|
||||
depends on COMMON_CLK_MT8188_IMGSYS
|
||||
default COMMON_CLK_MT8188_IMGSYS
|
||||
help
|
||||
This driver supports MediaTek MT8188 Warp Engine clocks.
|
||||
|
||||
config COMMON_CLK_MT8192
|
||||
tristate "Clock driver for MediaTek MT8192"
|
||||
depends on ARM64 || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
select COMMON_CLK_MEDIATEK_FHCTL
|
||||
default ARM64
|
||||
help
|
||||
This driver supports MediaTek MT8192 basic clocks.
|
||||
|
||||
config COMMON_CLK_MT8192_AUDSYS
|
||||
bool "Clock driver for MediaTek MT8192 audsys"
|
||||
tristate "Clock driver for MediaTek MT8192 audsys"
|
||||
depends on COMMON_CLK_MT8192
|
||||
help
|
||||
This driver supports MediaTek MT8192 audsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8192_CAMSYS
|
||||
bool "Clock driver for MediaTek MT8192 camsys"
|
||||
tristate "Clock driver for MediaTek MT8192 camsys"
|
||||
depends on COMMON_CLK_MT8192
|
||||
help
|
||||
This driver supports MediaTek MT8192 camsys and camsys_raw clocks.
|
||||
|
||||
config COMMON_CLK_MT8192_IMGSYS
|
||||
bool "Clock driver for MediaTek MT8192 imgsys"
|
||||
tristate "Clock driver for MediaTek MT8192 imgsys"
|
||||
depends on COMMON_CLK_MT8192
|
||||
help
|
||||
This driver supports MediaTek MT8192 imgsys and imgsys2 clocks.
|
||||
|
||||
config COMMON_CLK_MT8192_IMP_IIC_WRAP
|
||||
bool "Clock driver for MediaTek MT8192 imp_iic_wrap"
|
||||
tristate "Clock driver for MediaTek MT8192 imp_iic_wrap"
|
||||
depends on COMMON_CLK_MT8192
|
||||
help
|
||||
This driver supports MediaTek MT8192 imp_iic_wrap clocks.
|
||||
|
||||
config COMMON_CLK_MT8192_IPESYS
|
||||
bool "Clock driver for MediaTek MT8192 ipesys"
|
||||
tristate "Clock driver for MediaTek MT8192 ipesys"
|
||||
depends on COMMON_CLK_MT8192
|
||||
help
|
||||
This driver supports MediaTek MT8192 ipesys clocks.
|
||||
|
||||
config COMMON_CLK_MT8192_MDPSYS
|
||||
bool "Clock driver for MediaTek MT8192 mdpsys"
|
||||
tristate "Clock driver for MediaTek MT8192 mdpsys"
|
||||
depends on COMMON_CLK_MT8192
|
||||
help
|
||||
This driver supports MediaTek MT8192 mdpsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8192_MFGCFG
|
||||
bool "Clock driver for MediaTek MT8192 mfgcfg"
|
||||
tristate "Clock driver for MediaTek MT8192 mfgcfg"
|
||||
depends on COMMON_CLK_MT8192
|
||||
help
|
||||
This driver supports MediaTek MT8192 mfgcfg clocks.
|
||||
|
||||
config COMMON_CLK_MT8192_MMSYS
|
||||
bool "Clock driver for MediaTek MT8192 mmsys"
|
||||
tristate "Clock driver for MediaTek MT8192 mmsys"
|
||||
depends on COMMON_CLK_MT8192
|
||||
help
|
||||
This driver supports MediaTek MT8192 mmsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8192_MSDC
|
||||
bool "Clock driver for MediaTek MT8192 msdc"
|
||||
tristate "Clock driver for MediaTek MT8192 msdc"
|
||||
depends on COMMON_CLK_MT8192
|
||||
help
|
||||
This driver supports MediaTek MT8192 msdc and msdc_top clocks.
|
||||
|
||||
config COMMON_CLK_MT8192_SCP_ADSP
|
||||
bool "Clock driver for MediaTek MT8192 scp_adsp"
|
||||
tristate "Clock driver for MediaTek MT8192 scp_adsp"
|
||||
depends on COMMON_CLK_MT8192
|
||||
help
|
||||
This driver supports MediaTek MT8192 scp_adsp clocks.
|
||||
|
||||
config COMMON_CLK_MT8192_VDECSYS
|
||||
bool "Clock driver for MediaTek MT8192 vdecsys"
|
||||
tristate "Clock driver for MediaTek MT8192 vdecsys"
|
||||
depends on COMMON_CLK_MT8192
|
||||
help
|
||||
This driver supports MediaTek MT8192 vdecsys and vdecsys_soc clocks.
|
||||
|
||||
config COMMON_CLK_MT8192_VENCSYS
|
||||
bool "Clock driver for MediaTek MT8192 vencsys"
|
||||
tristate "Clock driver for MediaTek MT8192 vencsys"
|
||||
depends on COMMON_CLK_MT8192
|
||||
help
|
||||
This driver supports MediaTek MT8192 vencsys clocks.
|
||||
@ -688,10 +854,111 @@ config COMMON_CLK_MT8195
|
||||
bool "Clock driver for MediaTek MT8195"
|
||||
depends on ARM64 || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
select COMMON_CLK_MEDIATEK_FHCTL
|
||||
default ARCH_MEDIATEK
|
||||
help
|
||||
This driver supports MediaTek MT8195 clocks.
|
||||
|
||||
config COMMON_CLK_MT8195_APUSYS
|
||||
tristate "Clock driver for MediaTek MT8195 apusys"
|
||||
depends on COMMON_CLK_MT8195
|
||||
default COMMON_CLK_MT8195
|
||||
help
|
||||
This driver supports MediaTek MT8195 AI Processor Unit System clocks.
|
||||
|
||||
config COMMON_CLK_MT8195_AUDSYS
|
||||
tristate "Clock driver for MediaTek MT8195 audsys"
|
||||
depends on COMMON_CLK_MT8195
|
||||
default COMMON_CLK_MT8195
|
||||
help
|
||||
This driver supports MediaTek MT8195 audsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8195_IMP_IIC_WRAP
|
||||
tristate "Clock driver for MediaTek MT8195 imp_iic_wrap"
|
||||
depends on COMMON_CLK_MT8195
|
||||
default COMMON_CLK_MT8195
|
||||
help
|
||||
This driver supports MediaTek MT8195 I2C/I3C clocks.
|
||||
|
||||
config COMMON_CLK_MT8195_MFGCFG
|
||||
tristate "Clock driver for MediaTek MT8195 mfgcfg"
|
||||
depends on COMMON_CLK_MT8195
|
||||
default COMMON_CLK_MT8195
|
||||
help
|
||||
This driver supports MediaTek MT8195 mfgcfg clocks.
|
||||
|
||||
config COMMON_CLK_MT8195_MSDC
|
||||
tristate "Clock driver for MediaTek MT8195 msdc"
|
||||
depends on COMMON_CLK_MT8195
|
||||
default COMMON_CLK_MT8195
|
||||
help
|
||||
This driver supports MediaTek MT8195 MMC and SD Controller's
|
||||
msdc and msdc_top clocks.
|
||||
|
||||
config COMMON_CLK_MT8195_SCP_ADSP
|
||||
tristate "Clock driver for MediaTek MT8195 scp_adsp"
|
||||
depends on COMMON_CLK_MT8195
|
||||
default COMMON_CLK_MT8195
|
||||
help
|
||||
This driver supports MediaTek MT8195 System Companion Processor
|
||||
Audio DSP clocks.
|
||||
|
||||
config COMMON_CLK_MT8195_VDOSYS
|
||||
tristate "Clock driver for MediaTek MT8195 vdosys"
|
||||
depends on COMMON_CLK_MT8195
|
||||
default COMMON_CLK_MT8195
|
||||
help
|
||||
This driver supports MediaTek MT8195 vdosys0/1 (multimedia) clocks.
|
||||
|
||||
config COMMON_CLK_MT8195_VPPSYS
|
||||
tristate "Clock driver for MediaTek MT8195 vppsys"
|
||||
depends on COMMON_CLK_MT8195
|
||||
default COMMON_CLK_MT8195
|
||||
help
|
||||
This driver supports MediaTek MT8195 vppsys0/1 clocks.
|
||||
|
||||
config COMMON_CLK_MT8195_CAMSYS
|
||||
tristate "Clock driver for MediaTek MT8195 camsys"
|
||||
depends on COMMON_CLK_MT8195_VPPSYS
|
||||
default COMMON_CLK_MT8195_VPPSYS
|
||||
help
|
||||
This driver supports MediaTek MT8195 camsys and camsys_raw clocks.
|
||||
|
||||
config COMMON_CLK_MT8195_IMGSYS
|
||||
tristate "Clock driver for MediaTek MT8195 imgsys"
|
||||
depends on COMMON_CLK_MT8195_VPPSYS
|
||||
default COMMON_CLK_MT8195_VPPSYS
|
||||
help
|
||||
This driver supports MediaTek MT8195 imgsys and imgsys2 clocks.
|
||||
|
||||
config COMMON_CLK_MT8195_IPESYS
|
||||
tristate "Clock driver for MediaTek MT8195 ipesys"
|
||||
depends on COMMON_CLK_MT8195_IMGSYS
|
||||
default COMMON_CLK_MT8195_IMGSYS
|
||||
help
|
||||
This driver supports MediaTek MT8195 ipesys clocks.
|
||||
|
||||
config COMMON_CLK_MT8195_WPESYS
|
||||
tristate "Clock driver for MediaTek MT8195 wpesys"
|
||||
depends on COMMON_CLK_MT8195_IMGSYS
|
||||
default COMMON_CLK_MT8195_IMGSYS
|
||||
help
|
||||
This driver supports MediaTek MT8195 Warp Engine clocks.
|
||||
|
||||
config COMMON_CLK_MT8195_VDECSYS
|
||||
tristate "Clock driver for MediaTek MT8195 vdecsys"
|
||||
depends on COMMON_CLK_MT8195_VPPSYS
|
||||
default COMMON_CLK_MT8195_VPPSYS
|
||||
help
|
||||
This driver supports MediaTek MT8195 vdecsys and vdecsys_soc clocks.
|
||||
|
||||
config COMMON_CLK_MT8195_VENCSYS
|
||||
tristate "Clock driver for MediaTek MT8195 vencsys"
|
||||
depends on COMMON_CLK_MT8195_VPPSYS
|
||||
default COMMON_CLK_MT8195_VPPSYS
|
||||
help
|
||||
This driver supports MediaTek MT8195 vencsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8365
|
||||
tristate "Clock driver for MediaTek MT8365"
|
||||
depends on ARCH_MEDIATEK || COMPILE_TEST
|
||||
@ -743,7 +1010,7 @@ config COMMON_CLK_MT8365_VENC
|
||||
This driver supports MediaTek MT8365 venc clocks.
|
||||
|
||||
config COMMON_CLK_MT8516
|
||||
bool "Clock driver for MediaTek MT8516"
|
||||
tristate "Clock driver for MediaTek MT8516"
|
||||
depends on ARCH_MEDIATEK || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
default ARCH_MEDIATEK
|
||||
@ -751,7 +1018,7 @@ config COMMON_CLK_MT8516
|
||||
This driver supports MediaTek MT8516 clocks.
|
||||
|
||||
config COMMON_CLK_MT8516_AUDSYS
|
||||
bool "Clock driver for MediaTek MT8516 audsys"
|
||||
tristate "Clock driver for MediaTek MT8516 audsys"
|
||||
depends on COMMON_CLK_MT8516
|
||||
help
|
||||
This driver supports MediaTek MT8516 audsys clocks.
|
||||
|
@ -38,7 +38,7 @@ obj-$(CONFIG_COMMON_CLK_MT2701_HIFSYS) += clk-mt2701-hif.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT2701_IMGSYS) += clk-mt2701-img.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT2701_MMSYS) += clk-mt2701-mm.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT2701_VDECSYS) += clk-mt2701-vdec.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT2712) += clk-mt2712.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT2712) += clk-mt2712-apmixedsys.o clk-mt2712.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT2712_BDPSYS) += clk-mt2712-bdp.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT2712_IMGSYS) += clk-mt2712-img.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT2712_JPGDECSYS) += clk-mt2712-jpgdec.o
|
||||
@ -46,7 +46,8 @@ obj-$(CONFIG_COMMON_CLK_MT2712_MFGCFG) += clk-mt2712-mfg.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT2712_MMSYS) += clk-mt2712-mm.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT2712_VDECSYS) += clk-mt2712-vdec.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT2712_VENCSYS) += clk-mt2712-venc.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT7622) += clk-mt7622.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT7622) += clk-mt7622-apmixedsys.o clk-mt7622.o \
|
||||
clk-mt7622-infracfg.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT7622_ETHSYS) += clk-mt7622-eth.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT7622_HIFSYS) += clk-mt7622-hif.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT7622_AUDSYS) += clk-mt7622-aud.o
|
||||
@ -61,8 +62,8 @@ obj-$(CONFIG_COMMON_CLK_MT7986) += clk-mt7986-apmixed.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT7986) += clk-mt7986-topckgen.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT7986) += clk-mt7986-infracfg.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT7986_ETHSYS) += clk-mt7986-eth.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8135) += clk-mt8135.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8167) += clk-mt8167.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8135) += clk-mt8135-apmixedsys.o clk-mt8135.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8167) += clk-mt8167-apmixedsys.o clk-mt8167.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8167_AUDSYS) += clk-mt8167-aud.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8167_IMGSYS) += clk-mt8167-img.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8167_MFGCFG) += clk-mt8167-mfgcfg.o
|
||||
@ -74,7 +75,7 @@ obj-$(CONFIG_COMMON_CLK_MT8173_IMGSYS) += clk-mt8173-img.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8173_MMSYS) += clk-mt8173-mm.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8173_VDECSYS) += clk-mt8173-vdecsys.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8173_VENCSYS) += clk-mt8173-vencsys.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8183) += clk-mt8183.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8183) += clk-mt8183-apmixedsys.o clk-mt8183.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8183_AUDIOSYS) += clk-mt8183-audio.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8183_CAMSYS) += clk-mt8183-cam.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8183_IMGSYS) += clk-mt8183-img.o
|
||||
@ -86,12 +87,33 @@ obj-$(CONFIG_COMMON_CLK_MT8183_MFGCFG) += clk-mt8183-mfgcfg.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8183_MMSYS) += clk-mt8183-mm.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8183_VDECSYS) += clk-mt8183-vdec.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8183_VENCSYS) += clk-mt8183-venc.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt8186-infra_ao.o \
|
||||
clk-mt8186-apmixedsys.o clk-mt8186-imp_iic_wrap.o \
|
||||
clk-mt8186-mfg.o clk-mt8186-mm.o clk-mt8186-wpe.o \
|
||||
clk-mt8186-img.o clk-mt8186-vdec.o clk-mt8186-venc.o \
|
||||
clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-apmixedsys.o clk-mt8186-topckgen.o \
|
||||
clk-mt8186-infra_ao.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8186_CAMSYS) += clk-mt8186-cam.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8186_IMGSYS) += clk-mt8186-img.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8186_IMP_IIC_WRAP) += clk-mt8186-imp_iic_wrap.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8186_IPESYS) += clk-mt8186-ipe.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8186_MCUSYS) += clk-mt8186-mcu.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8186_MDPSYS) += clk-mt8186-mdp.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8186_MFGCFG) += clk-mt8186-mfg.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8186_MMSYS) += clk-mt8186-mm.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8186_VDECSYS) += clk-mt8186-vdec.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8186_VENCSYS) += clk-mt8186-venc.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8186_WPESYS) += clk-mt8186-wpe.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o \
|
||||
clk-mt8188-peri_ao.o clk-mt8188-infra_ao.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8188_ADSP_AUDIO26M) += clk-mt8188-adsp_audio26m.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8188_CAMSYS) += clk-mt8188-cam.o clk-mt8188-ccu.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8188_IMGSYS) += clk-mt8188-img.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8188_IMP_IIC_WRAP) += clk-mt8188-imp_iic_wrap.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8188_IPESYS) += clk-mt8188-ipe.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8188_MFGCFG) += clk-mt8188-mfg.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8188_VDECSYS) += clk-mt8188-vdec.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8188_VDOSYS) += clk-mt8188-vdo0.o clk-mt8188-vdo1.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8188_VENCSYS) += clk-mt8188-venc.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8188_VPPSYS) += clk-mt8188-vpp0.o clk-mt8188-vpp1.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8188_WPESYS) += clk-mt8188-wpe.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192-apmixedsys.o clk-mt8192.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8192_IMGSYS) += clk-mt8192-img.o
|
||||
@ -105,19 +127,25 @@ obj-$(CONFIG_COMMON_CLK_MT8192_SCP_ADSP) += clk-mt8192-scp_adsp.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8192_VDECSYS) += clk-mt8192-vdec.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8192_VENCSYS) += clk-mt8192-venc.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8195) += clk-mt8195-apmixedsys.o clk-mt8195-topckgen.o \
|
||||
clk-mt8195-peri_ao.o clk-mt8195-infra_ao.o \
|
||||
clk-mt8195-cam.o clk-mt8195-ccu.o clk-mt8195-img.o \
|
||||
clk-mt8195-ipe.o clk-mt8195-mfg.o clk-mt8195-scp_adsp.o \
|
||||
clk-mt8195-vdec.o clk-mt8195-vdo0.o clk-mt8195-vdo1.o \
|
||||
clk-mt8195-venc.o clk-mt8195-vpp0.o clk-mt8195-vpp1.o \
|
||||
clk-mt8195-wpe.o clk-mt8195-imp_iic_wrap.o \
|
||||
clk-mt8195-apusys_pll.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365.o
|
||||
clk-mt8195-peri_ao.o clk-mt8195-infra_ao.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8195_APUSYS) += clk-mt8195-apusys_pll.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8195_CAMSYS) += clk-mt8195-cam.o clk-mt8195-ccu.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8195_IMGSYS) += clk-mt8195-img.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8195_IMP_IIC_WRAP) += clk-mt8195-imp_iic_wrap.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8195_IPESYS) += clk-mt8195-ipe.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8195_MFGCFG) += clk-mt8195-mfg.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8195_SCP_ADSP) += clk-mt8195-scp_adsp.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8195_VDECSYS) += clk-mt8195-vdec.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8195_VDOSYS) += clk-mt8195-vdo0.o clk-mt8195-vdo1.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8195_VENCSYS) += clk-mt8195-venc.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8195_VPPSYS) += clk-mt8195-vpp0.o clk-mt8195-vpp1.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8195_WPESYS) += clk-mt8195-wpe.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8365) += clk-mt8365-apmixedsys.o clk-mt8365.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8365_APU) += clk-mt8365-apu.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8365_CAM) += clk-mt8365-cam.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8365_MFG) += clk-mt8365-mfg.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8365_MMSYS) += clk-mt8365-mm.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8365_VDEC) += clk-mt8365-vdec.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8365_VENC) += clk-mt8365-venc.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8516) += clk-mt8516.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8516) += clk-mt8516-apmixedsys.o clk-mt8516.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8516_AUDSYS) += clk-mt8516-aud.o
|
||||
|
@ -14,7 +14,20 @@
|
||||
#define PERCENT_TO_DDSLMT(dds, percent_m10) \
|
||||
((((dds) * (percent_m10)) >> 5) / 100)
|
||||
|
||||
static const struct fhctl_offset fhctl_offset = {
|
||||
static const struct fhctl_offset fhctl_offset_v1 = {
|
||||
.offset_hp_en = 0x0,
|
||||
.offset_clk_con = 0x4,
|
||||
.offset_rst_con = 0x8,
|
||||
.offset_slope0 = 0xc,
|
||||
.offset_slope1 = 0x10,
|
||||
.offset_cfg = 0x0,
|
||||
.offset_updnlmt = 0x4,
|
||||
.offset_dds = 0x8,
|
||||
.offset_dvfs = 0xc,
|
||||
.offset_mon = 0x10,
|
||||
};
|
||||
|
||||
static const struct fhctl_offset fhctl_offset_v2 = {
|
||||
.offset_hp_en = 0x0,
|
||||
.offset_clk_con = 0x8,
|
||||
.offset_rst_con = 0xc,
|
||||
@ -27,9 +40,16 @@ static const struct fhctl_offset fhctl_offset = {
|
||||
.offset_mon = 0x10,
|
||||
};
|
||||
|
||||
const struct fhctl_offset *fhctl_get_offset_table(void)
|
||||
const struct fhctl_offset *fhctl_get_offset_table(enum fhctl_variant v)
|
||||
{
|
||||
return &fhctl_offset;
|
||||
switch (v) {
|
||||
case FHCTL_PLLFH_V1:
|
||||
return &fhctl_offset_v1;
|
||||
case FHCTL_PLLFH_V2:
|
||||
return &fhctl_offset_v2;
|
||||
default:
|
||||
return ERR_PTR(-EINVAL);
|
||||
};
|
||||
}
|
||||
|
||||
static void dump_hw(struct mtk_clk_pll *pll, struct fh_pll_regs *regs,
|
||||
|
@ -7,6 +7,13 @@
|
||||
#ifndef __CLK_FHCTL_H
|
||||
#define __CLK_FHCTL_H
|
||||
|
||||
#include "clk-pllfh.h"
|
||||
|
||||
enum fhctl_variant {
|
||||
FHCTL_PLLFH_V1,
|
||||
FHCTL_PLLFH_V2,
|
||||
};
|
||||
|
||||
struct fhctl_offset {
|
||||
u32 offset_hp_en;
|
||||
u32 offset_clk_con;
|
||||
@ -19,7 +26,7 @@ struct fhctl_offset {
|
||||
u32 offset_dvfs;
|
||||
u32 offset_mon;
|
||||
};
|
||||
const struct fhctl_offset *fhctl_get_offset_table(void);
|
||||
const struct fhctl_offset *fhctl_get_offset_table(enum fhctl_variant v);
|
||||
const struct fh_operation *fhctl_get_ops(void);
|
||||
void fhctl_hw_init(struct mtk_fh *fh);
|
||||
|
||||
|
@ -15,41 +15,17 @@
|
||||
|
||||
#include <dt-bindings/clock/mt2701-clk.h>
|
||||
|
||||
#define GATE_AUDIO0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &audio0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_AUDIO0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &audio0_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
#define GATE_AUDIO1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &audio1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_AUDIO1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &audio1_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
#define GATE_AUDIO2(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &audio2_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_AUDIO2(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &audio2_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
#define GATE_AUDIO3(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &audio3_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_AUDIO3(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &audio3_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
static const struct mtk_gate_regs audio0_cg_regs = {
|
||||
.set_ofs = 0x0,
|
||||
@ -148,6 +124,7 @@ static const struct of_device_id of_match_clk_mt2701_aud[] = {
|
||||
{ .compatible = "mediatek,mt2701-audsys", .data = &audio_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt2701_aud);
|
||||
|
||||
static int clk_mt2701_aud_probe(struct platform_device *pdev)
|
||||
{
|
||||
@ -187,5 +164,5 @@ static struct platform_driver clk_mt2701_aud_drv = {
|
||||
.of_match_table = of_match_clk_mt2701_aud,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt2701_aud_drv);
|
||||
module_platform_driver(clk_mt2701_aud_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -24,23 +24,11 @@ static const struct mtk_gate_regs bdp1_cg_regs = {
|
||||
.sta_ofs = 0x0110,
|
||||
};
|
||||
|
||||
#define GATE_BDP0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &bdp0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_BDP0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &bdp0_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
#define GATE_BDP1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &bdp1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_BDP1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &bdp1_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
static const struct mtk_gate bdp_clks[] = {
|
||||
GATE_BDP0(CLK_BDP_BRG_BA, "brg_baclk", "mm_sel", 0),
|
||||
@ -107,6 +95,7 @@ static const struct of_device_id of_match_clk_mt2701_bdp[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt2701_bdp);
|
||||
|
||||
static struct platform_driver clk_mt2701_bdp_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -116,5 +105,5 @@ static struct platform_driver clk_mt2701_bdp_drv = {
|
||||
.of_match_table = of_match_clk_mt2701_bdp,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt2701_bdp_drv);
|
||||
module_platform_driver(clk_mt2701_bdp_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -16,14 +16,8 @@ static const struct mtk_gate_regs eth_cg_regs = {
|
||||
.sta_ofs = 0x0030,
|
||||
};
|
||||
|
||||
#define GATE_ETH(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = ð_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_ETH(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, ð_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
static const struct mtk_gate eth_clks[] = {
|
||||
GATE_DUMMY(CLK_DUMMY, "eth_dummy"),
|
||||
@ -55,6 +49,7 @@ static const struct of_device_id of_match_clk_mt2701_eth[] = {
|
||||
{ .compatible = "mediatek,mt2701-ethsys", .data = ð_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt2701_eth);
|
||||
|
||||
static struct platform_driver clk_mt2701_eth_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -64,5 +59,5 @@ static struct platform_driver clk_mt2701_eth_drv = {
|
||||
.of_match_table = of_match_clk_mt2701_eth,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt2701_eth_drv);
|
||||
module_platform_driver(clk_mt2701_eth_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -16,14 +16,8 @@
|
||||
|
||||
#include <dt-bindings/clock/mt2701-clk.h>
|
||||
|
||||
#define GATE_G3D(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &g3d_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_G3D(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &g3d_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate_regs g3d_cg_regs = {
|
||||
.sta_ofs = 0x0,
|
||||
@ -54,6 +48,7 @@ static const struct of_device_id of_match_clk_mt2701_g3d[] = {
|
||||
{ .compatible = "mediatek,mt2701-g3dsys", .data = &g3d_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt2701_g3d);
|
||||
|
||||
static struct platform_driver clk_mt2701_g3d_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -63,5 +58,5 @@ static struct platform_driver clk_mt2701_g3d_drv = {
|
||||
.of_match_table = of_match_clk_mt2701_g3d,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt2701_g3d_drv);
|
||||
module_platform_driver(clk_mt2701_g3d_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -16,14 +16,8 @@ static const struct mtk_gate_regs hif_cg_regs = {
|
||||
.sta_ofs = 0x0030,
|
||||
};
|
||||
|
||||
#define GATE_HIF(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &hif_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_HIF(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &hif_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
static const struct mtk_gate hif_clks[] = {
|
||||
GATE_DUMMY(CLK_DUMMY, "hif_dummy"),
|
||||
@ -52,6 +46,7 @@ static const struct of_device_id of_match_clk_mt2701_hif[] = {
|
||||
{ .compatible = "mediatek,mt2701-hifsys", .data = &hif_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt2701_hif);
|
||||
|
||||
static struct platform_driver clk_mt2701_hif_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -61,5 +56,5 @@ static struct platform_driver clk_mt2701_hif_drv = {
|
||||
.of_match_table = of_match_clk_mt2701_hif,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt2701_hif_drv);
|
||||
module_platform_driver(clk_mt2701_hif_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -18,14 +18,8 @@ static const struct mtk_gate_regs img_cg_regs = {
|
||||
.sta_ofs = 0x0000,
|
||||
};
|
||||
|
||||
#define GATE_IMG(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &img_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_IMG(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &img_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate img_clks[] = {
|
||||
GATE_IMG(CLK_IMG_SMI_COMM, "img_smi_comm", "mm_sel", 0),
|
||||
@ -49,6 +43,7 @@ static const struct of_device_id of_match_clk_mt2701_img[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt2701_img);
|
||||
|
||||
static struct platform_driver clk_mt2701_img_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -58,5 +53,5 @@ static struct platform_driver clk_mt2701_img_drv = {
|
||||
.of_match_table = of_match_clk_mt2701_img,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt2701_img_drv);
|
||||
module_platform_driver(clk_mt2701_img_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -24,23 +24,11 @@ static const struct mtk_gate_regs disp1_cg_regs = {
|
||||
.sta_ofs = 0x0110,
|
||||
};
|
||||
|
||||
#define GATE_DISP0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &disp0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_DISP0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &disp0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_DISP1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &disp1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_DISP1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &disp1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate mm_clks[] = {
|
||||
GATE_DISP0(CLK_MM_SMI_COMMON, "mm_smi_comm", "mm_sel", 0),
|
||||
@ -79,32 +67,24 @@ static const struct mtk_gate mm_clks[] = {
|
||||
GATE_DISP1(CLK_MM_TVE_FMM, "mm_tve_fmm", "mm_sel", 14),
|
||||
};
|
||||
|
||||
static int clk_mt2701_mm_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *node = dev->parent->of_node;
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
static const struct mtk_clk_desc mm_desc = {
|
||||
.clks = mm_clks,
|
||||
.num_clks = ARRAY_SIZE(mm_clks),
|
||||
};
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MM_NR);
|
||||
|
||||
mtk_clk_register_gates(&pdev->dev, node, mm_clks,
|
||||
ARRAY_SIZE(mm_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
dev_err(&pdev->dev,
|
||||
"could not register clock provider: %s: %d\n",
|
||||
pdev->name, r);
|
||||
|
||||
return r;
|
||||
}
|
||||
static const struct platform_device_id clk_mt2701_mm_id_table[] = {
|
||||
{ .name = "clk-mt2701-mm", .driver_data = (kernel_ulong_t)&mm_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, clk_mt2701_mm_id_table);
|
||||
|
||||
static struct platform_driver clk_mt2701_mm_drv = {
|
||||
.probe = clk_mt2701_mm_probe,
|
||||
.probe = mtk_clk_pdev_probe,
|
||||
.remove = mtk_clk_pdev_remove,
|
||||
.driver = {
|
||||
.name = "clk-mt2701-mm",
|
||||
},
|
||||
.id_table = clk_mt2701_mm_id_table,
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt2701_mm_drv);
|
||||
module_platform_driver(clk_mt2701_mm_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -24,23 +24,11 @@ static const struct mtk_gate_regs vdec1_cg_regs = {
|
||||
.sta_ofs = 0x0008,
|
||||
};
|
||||
|
||||
#define GATE_VDEC0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &vdec0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_VDEC0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &vdec0_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
#define GATE_VDEC1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &vdec1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_VDEC1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &vdec1_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
static const struct mtk_gate vdec_clks[] = {
|
||||
GATE_VDEC0(CLK_VDEC_CKGEN, "vdec_cken", "vdec_sel", 0),
|
||||
@ -60,6 +48,7 @@ static const struct of_device_id of_match_clk_mt2701_vdec[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt2701_vdec);
|
||||
|
||||
static struct platform_driver clk_mt2701_vdec_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -69,5 +58,5 @@ static struct platform_driver clk_mt2701_vdec_drv = {
|
||||
.of_match_table = of_match_clk_mt2701_vdec,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt2701_vdec_drv);
|
||||
module_platform_driver(clk_mt2701_vdec_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -636,14 +636,8 @@ static const struct mtk_gate_regs top_aud_cg_regs = {
|
||||
.sta_ofs = 0x012C,
|
||||
};
|
||||
|
||||
#define GATE_TOP_AUD(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &top_aud_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_TOP_AUD(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &top_aud_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
static const struct mtk_gate top_clks[] = {
|
||||
GATE_TOP_AUD(CLK_TOP_AUD_48K_TIMING, "a1sys_hp_ck", "aud_mux1_div",
|
||||
@ -687,7 +681,7 @@ static int mtk_topckgen_init(struct platform_device *pdev)
|
||||
ARRAY_SIZE(top_muxes), base,
|
||||
&mt2701_clk_lock, clk_data);
|
||||
|
||||
mtk_clk_register_dividers(top_adj_divs, ARRAY_SIZE(top_adj_divs),
|
||||
mtk_clk_register_dividers(&pdev->dev, top_adj_divs, ARRAY_SIZE(top_adj_divs),
|
||||
base, &mt2701_clk_lock, clk_data);
|
||||
|
||||
mtk_clk_register_gates(&pdev->dev, node, top_clks,
|
||||
@ -702,14 +696,8 @@ static const struct mtk_gate_regs infra_cg_regs = {
|
||||
.sta_ofs = 0x0048,
|
||||
};
|
||||
|
||||
#define GATE_ICG(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &infra_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_ICG(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &infra_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate infra_clks[] = {
|
||||
GATE_ICG(CLK_INFRA_DBG, "dbgclk", "axi_sel", 0),
|
||||
@ -823,23 +811,11 @@ static const struct mtk_gate_regs peri1_cg_regs = {
|
||||
.sta_ofs = 0x001c,
|
||||
};
|
||||
|
||||
#define GATE_PERI0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &peri0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_PERI0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &peri0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_PERI1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &peri1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_PERI1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &peri1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate peri_clks[] = {
|
||||
GATE_PERI0(CLK_PERI_USB0_MCU, "usb0_mcu_ck", "axi_sel", 31),
|
||||
@ -1023,6 +999,7 @@ static const struct of_device_id of_match_clk_mt2701[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt2701);
|
||||
|
||||
static int clk_mt2701_probe(struct platform_device *pdev)
|
||||
{
|
||||
@ -1056,3 +1033,4 @@ static int __init clk_mt2701_init(void)
|
||||
}
|
||||
|
||||
arch_initcall(clk_mt2701_init);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
168
drivers/clk/mediatek/clk-mt2712-apmixedsys.c
Normal file
168
drivers/clk/mediatek/clk-mt2712-apmixedsys.c
Normal file
@ -0,0 +1,168 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017 MediaTek Inc.
|
||||
* Weiyi Lu <weiyi.lu@mediatek.com>
|
||||
* Copyright (c) 2023 Collabora Ltd.
|
||||
* AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
|
||||
*/
|
||||
#include <linux/clk.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-pll.h"
|
||||
#include "clk-mtk.h"
|
||||
|
||||
#include <dt-bindings/clock/mt2712-clk.h>
|
||||
|
||||
#define MT2712_PLL_FMAX (3000UL * MHZ)
|
||||
|
||||
#define CON0_MT2712_RST_BAR BIT(24)
|
||||
|
||||
#define PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
|
||||
_pd_reg, _pd_shift, _tuner_reg, _tuner_en_reg, \
|
||||
_tuner_en_bit, _pcw_reg, _pcw_shift, \
|
||||
_div_table) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.reg = _reg, \
|
||||
.pwr_reg = _pwr_reg, \
|
||||
.en_mask = _en_mask, \
|
||||
.flags = _flags, \
|
||||
.rst_bar_mask = CON0_MT2712_RST_BAR, \
|
||||
.fmax = MT2712_PLL_FMAX, \
|
||||
.pcwbits = _pcwbits, \
|
||||
.pd_reg = _pd_reg, \
|
||||
.pd_shift = _pd_shift, \
|
||||
.tuner_reg = _tuner_reg, \
|
||||
.tuner_en_reg = _tuner_en_reg, \
|
||||
.tuner_en_bit = _tuner_en_bit, \
|
||||
.pcw_reg = _pcw_reg, \
|
||||
.pcw_shift = _pcw_shift, \
|
||||
.div_table = _div_table, \
|
||||
}
|
||||
|
||||
#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
|
||||
_pd_reg, _pd_shift, _tuner_reg, _tuner_en_reg, \
|
||||
_tuner_en_bit, _pcw_reg, _pcw_shift) \
|
||||
PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, \
|
||||
_pcwbits, _pd_reg, _pd_shift, _tuner_reg, \
|
||||
_tuner_en_reg, _tuner_en_bit, _pcw_reg, \
|
||||
_pcw_shift, NULL)
|
||||
|
||||
static const struct mtk_pll_div_table armca35pll_div_table[] = {
|
||||
{ .div = 0, .freq = MT2712_PLL_FMAX },
|
||||
{ .div = 1, .freq = 1202500000 },
|
||||
{ .div = 2, .freq = 500500000 },
|
||||
{ .div = 3, .freq = 315250000 },
|
||||
{ .div = 4, .freq = 157625000 },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static const struct mtk_pll_div_table armca72pll_div_table[] = {
|
||||
{ .div = 0, .freq = MT2712_PLL_FMAX },
|
||||
{ .div = 1, .freq = 994500000 },
|
||||
{ .div = 2, .freq = 520000000 },
|
||||
{ .div = 3, .freq = 315250000 },
|
||||
{ .div = 4, .freq = 157625000 },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static const struct mtk_pll_div_table mmpll_div_table[] = {
|
||||
{ .div = 0, .freq = MT2712_PLL_FMAX },
|
||||
{ .div = 1, .freq = 1001000000 },
|
||||
{ .div = 2, .freq = 601250000 },
|
||||
{ .div = 3, .freq = 250250000 },
|
||||
{ .div = 4, .freq = 125125000 },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static const struct mtk_pll_data plls[] = {
|
||||
PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x0230, 0x023C, 0xf0000100,
|
||||
HAVE_RST_BAR, 31, 0x0230, 4, 0, 0, 0, 0x0234, 0),
|
||||
PLL(CLK_APMIXED_UNIVPLL, "univpll", 0x0240, 0x024C, 0xfe000100,
|
||||
HAVE_RST_BAR, 31, 0x0240, 4, 0, 0, 0, 0x0244, 0),
|
||||
PLL(CLK_APMIXED_VCODECPLL, "vcodecpll", 0x0320, 0x032C, 0xc0000100,
|
||||
0, 31, 0x0320, 4, 0, 0, 0, 0x0324, 0),
|
||||
PLL(CLK_APMIXED_VENCPLL, "vencpll", 0x0280, 0x028C, 0x00000100,
|
||||
0, 31, 0x0280, 4, 0, 0, 0, 0x0284, 0),
|
||||
PLL(CLK_APMIXED_APLL1, "apll1", 0x0330, 0x0340, 0x00000100,
|
||||
0, 31, 0x0330, 4, 0x0338, 0x0014, 0, 0x0334, 0),
|
||||
PLL(CLK_APMIXED_APLL2, "apll2", 0x0350, 0x0360, 0x00000100,
|
||||
0, 31, 0x0350, 4, 0x0358, 0x0014, 1, 0x0354, 0),
|
||||
PLL(CLK_APMIXED_LVDSPLL, "lvdspll", 0x0370, 0x037c, 0x00000100,
|
||||
0, 31, 0x0370, 4, 0, 0, 0, 0x0374, 0),
|
||||
PLL(CLK_APMIXED_LVDSPLL2, "lvdspll2", 0x0390, 0x039C, 0x00000100,
|
||||
0, 31, 0x0390, 4, 0, 0, 0, 0x0394, 0),
|
||||
PLL(CLK_APMIXED_MSDCPLL, "msdcpll", 0x0270, 0x027C, 0x00000100,
|
||||
0, 31, 0x0270, 4, 0, 0, 0, 0x0274, 0),
|
||||
PLL(CLK_APMIXED_MSDCPLL2, "msdcpll2", 0x0410, 0x041C, 0x00000100,
|
||||
0, 31, 0x0410, 4, 0, 0, 0, 0x0414, 0),
|
||||
PLL(CLK_APMIXED_TVDPLL, "tvdpll", 0x0290, 0x029C, 0xc0000100,
|
||||
0, 31, 0x0290, 4, 0, 0, 0, 0x0294, 0),
|
||||
PLL_B(CLK_APMIXED_MMPLL, "mmpll", 0x0250, 0x0260, 0x00000100,
|
||||
0, 31, 0x0250, 4, 0, 0, 0, 0x0254, 0, mmpll_div_table),
|
||||
PLL_B(CLK_APMIXED_ARMCA35PLL, "armca35pll", 0x0100, 0x0110, 0xf0000100,
|
||||
HAVE_RST_BAR, 31, 0x0100, 4, 0, 0, 0, 0x0104, 0, armca35pll_div_table),
|
||||
PLL_B(CLK_APMIXED_ARMCA72PLL, "armca72pll", 0x0210, 0x0220, 0x00000100,
|
||||
0, 31, 0x0210, 4, 0, 0, 0, 0x0214, 0, armca72pll_div_table),
|
||||
PLL(CLK_APMIXED_ETHERPLL, "etherpll", 0x0300, 0x030C, 0xc0000100,
|
||||
0, 31, 0x0300, 4, 0, 0, 0, 0x0304, 0),
|
||||
};
|
||||
|
||||
static int clk_mt2712_apmixed_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
r = mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
|
||||
if (r)
|
||||
goto free_clk_data;
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r) {
|
||||
dev_err(&pdev->dev, "Cannot register clock provider: %d\n", r);
|
||||
goto unregister_plls;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
unregister_plls:
|
||||
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
|
||||
free_clk_data:
|
||||
mtk_free_clk_data(clk_data);
|
||||
return r;
|
||||
}
|
||||
|
||||
static int clk_mt2712_apmixed_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
|
||||
|
||||
of_clk_del_provider(node);
|
||||
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
|
||||
mtk_free_clk_data(clk_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt2712_apmixed[] = {
|
||||
{ .compatible = "mediatek,mt2712-apmixedsys" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt2712_apmixed);
|
||||
|
||||
static struct platform_driver clk_mt2712_apmixed_drv = {
|
||||
.probe = clk_mt2712_apmixed_probe,
|
||||
.remove = clk_mt2712_apmixed_remove,
|
||||
.driver = {
|
||||
.name = "clk-mt2712-apmixed",
|
||||
.of_match_table = of_match_clk_mt2712_apmixed,
|
||||
},
|
||||
};
|
||||
module_platform_driver(clk_mt2712_apmixed_drv)
|
||||
MODULE_LICENSE("GPL");
|
@ -18,14 +18,8 @@ static const struct mtk_gate_regs bdp_cg_regs = {
|
||||
.sta_ofs = 0x100,
|
||||
};
|
||||
|
||||
#define GATE_BDP(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &bdp_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_BDP(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &bdp_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
static const struct mtk_gate bdp_clks[] = {
|
||||
GATE_BDP(CLK_BDP_BRIDGE_B, "bdp_bridge_b", "mm_sel", 0),
|
||||
@ -71,6 +65,7 @@ static const struct of_device_id of_match_clk_mt2712_bdp[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt2712_bdp);
|
||||
|
||||
static struct platform_driver clk_mt2712_bdp_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -80,5 +75,5 @@ static struct platform_driver clk_mt2712_bdp_drv = {
|
||||
.of_match_table = of_match_clk_mt2712_bdp,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt2712_bdp_drv);
|
||||
module_platform_driver(clk_mt2712_bdp_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -18,14 +18,8 @@ static const struct mtk_gate_regs img_cg_regs = {
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#define GATE_IMG(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &img_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_IMG(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &img_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
static const struct mtk_gate img_clks[] = {
|
||||
GATE_IMG(CLK_IMG_SMI_LARB2, "img_smi_larb2", "mm_sel", 0),
|
||||
@ -49,6 +43,7 @@ static const struct of_device_id of_match_clk_mt2712_img[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt2712_img);
|
||||
|
||||
static struct platform_driver clk_mt2712_img_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -58,5 +53,5 @@ static struct platform_driver clk_mt2712_img_drv = {
|
||||
.of_match_table = of_match_clk_mt2712_img,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt2712_img_drv);
|
||||
module_platform_driver(clk_mt2712_img_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -18,14 +18,8 @@ static const struct mtk_gate_regs jpgdec_cg_regs = {
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#define GATE_JPGDEC(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &jpgdec_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_JPGDEC(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &jpgdec_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
static const struct mtk_gate jpgdec_clks[] = {
|
||||
GATE_JPGDEC(CLK_JPGDEC_JPGDEC1, "jpgdec_jpgdec1", "jpgdec_sel", 0),
|
||||
@ -45,6 +39,7 @@ static const struct of_device_id of_match_clk_mt2712_jpgdec[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt2712_jpgdec);
|
||||
|
||||
static struct platform_driver clk_mt2712_jpgdec_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -54,5 +49,5 @@ static struct platform_driver clk_mt2712_jpgdec_drv = {
|
||||
.of_match_table = of_match_clk_mt2712_jpgdec,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt2712_jpgdec_drv);
|
||||
module_platform_driver(clk_mt2712_jpgdec_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -18,14 +18,8 @@ static const struct mtk_gate_regs mfg_cg_regs = {
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#define GATE_MFG(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &mfg_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_MFG(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate mfg_clks[] = {
|
||||
GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_sel", 0),
|
||||
@ -44,6 +38,7 @@ static const struct of_device_id of_match_clk_mt2712_mfg[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt2712_mfg);
|
||||
|
||||
static struct platform_driver clk_mt2712_mfg_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -53,5 +48,5 @@ static struct platform_driver clk_mt2712_mfg_drv = {
|
||||
.of_match_table = of_match_clk_mt2712_mfg,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt2712_mfg_drv);
|
||||
module_platform_driver(clk_mt2712_mfg_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -30,32 +30,14 @@ static const struct mtk_gate_regs mm2_cg_regs = {
|
||||
.sta_ofs = 0x220,
|
||||
};
|
||||
|
||||
#define GATE_MM0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &mm0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_MM0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &mm0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_MM1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &mm1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_MM1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &mm1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_MM2(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &mm2_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_MM2(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &mm2_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate mm_clks[] = {
|
||||
/* MM0 */
|
||||
@ -126,32 +108,24 @@ static const struct mtk_gate mm_clks[] = {
|
||||
GATE_MM2(CLK_MM_DSI3_DIGITAL, "mm_dsi3_digital", "dsi1_lntc", 6),
|
||||
};
|
||||
|
||||
static int clk_mt2712_mm_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *node = dev->parent->of_node;
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
static const struct mtk_clk_desc mm_desc = {
|
||||
.clks = mm_clks,
|
||||
.num_clks = ARRAY_SIZE(mm_clks),
|
||||
};
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(&pdev->dev, node, mm_clks,
|
||||
ARRAY_SIZE(mm_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
if (r != 0)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
|
||||
return r;
|
||||
}
|
||||
static const struct platform_device_id clk_mt2712_mm_id_table[] = {
|
||||
{ .name = "clk-mt2712-mm", .driver_data = (kernel_ulong_t)&mm_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, clk_mt2712_mm_id_table);
|
||||
|
||||
static struct platform_driver clk_mt2712_mm_drv = {
|
||||
.probe = clk_mt2712_mm_probe,
|
||||
.probe = mtk_clk_pdev_probe,
|
||||
.remove = mtk_clk_pdev_remove,
|
||||
.driver = {
|
||||
.name = "clk-mt2712-mm",
|
||||
},
|
||||
.id_table = clk_mt2712_mm_id_table,
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt2712_mm_drv);
|
||||
module_platform_driver(clk_mt2712_mm_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -24,23 +24,11 @@ static const struct mtk_gate_regs vdec1_cg_regs = {
|
||||
.sta_ofs = 0x8,
|
||||
};
|
||||
|
||||
#define GATE_VDEC0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &vdec0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_VDEC0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &vdec0_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
#define GATE_VDEC1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &vdec1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_VDEC1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &vdec1_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
static const struct mtk_gate vdec_clks[] = {
|
||||
/* VDEC0 */
|
||||
@ -63,6 +51,7 @@ static const struct of_device_id of_match_clk_mt2712_vdec[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt2712_vdec);
|
||||
|
||||
static struct platform_driver clk_mt2712_vdec_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -72,5 +61,5 @@ static struct platform_driver clk_mt2712_vdec_drv = {
|
||||
.of_match_table = of_match_clk_mt2712_vdec,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt2712_vdec_drv);
|
||||
module_platform_driver(clk_mt2712_vdec_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -18,14 +18,8 @@ static const struct mtk_gate_regs venc_cg_regs = {
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#define GATE_VENC(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &venc_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_VENC(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &venc_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
static const struct mtk_gate venc_clks[] = {
|
||||
GATE_VENC(CLK_VENC_SMI_COMMON_CON, "venc_smi", "mm_sel", 0),
|
||||
@ -46,6 +40,7 @@ static const struct of_device_id of_match_clk_mt2712_venc[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt2712_venc);
|
||||
|
||||
static struct platform_driver clk_mt2712_venc_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -55,5 +50,5 @@ static struct platform_driver clk_mt2712_venc_drv = {
|
||||
.of_match_table = of_match_clk_mt2712_venc,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt2712_venc_drv);
|
||||
module_platform_driver(clk_mt2712_venc_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -24,23 +24,11 @@ static const struct mtk_gate_regs audio1_cg_regs = {
|
||||
.sta_ofs = 0x4,
|
||||
};
|
||||
|
||||
#define GATE_AUDIO0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &audio0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_AUDIO0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &audio0_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
#define GATE_AUDIO1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &audio1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_AUDIO1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &audio1_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
static const struct mtk_gate audio_clks[] = {
|
||||
/* AUDIO0 */
|
||||
@ -77,6 +65,7 @@ static const struct of_device_id of_match_clk_mt6765_audio[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6765_audio);
|
||||
|
||||
static struct platform_driver clk_mt6765_audio_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -86,5 +75,5 @@ static struct platform_driver clk_mt6765_audio_drv = {
|
||||
.of_match_table = of_match_clk_mt6765_audio,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt6765_audio_drv);
|
||||
module_platform_driver(clk_mt6765_audio_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -18,14 +18,8 @@ static const struct mtk_gate_regs cam_cg_regs = {
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#define GATE_CAM(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &cam_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_CAM(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &cam_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate cam_clks[] = {
|
||||
GATE_CAM(CLK_CAM_LARB3, "cam_larb3", "mm_ck", 0),
|
||||
@ -52,6 +46,7 @@ static const struct of_device_id of_match_clk_mt6765_cam[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6765_cam);
|
||||
|
||||
static struct platform_driver clk_mt6765_cam_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -61,5 +56,5 @@ static struct platform_driver clk_mt6765_cam_drv = {
|
||||
.of_match_table = of_match_clk_mt6765_cam,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt6765_cam_drv);
|
||||
module_platform_driver(clk_mt6765_cam_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -18,14 +18,8 @@ static const struct mtk_gate_regs img_cg_regs = {
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#define GATE_IMG(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &img_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_IMG(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &img_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate img_clks[] = {
|
||||
GATE_IMG(CLK_IMG_LARB2, "img_larb2", "mm_ck", 0),
|
||||
@ -48,6 +42,7 @@ static const struct of_device_id of_match_clk_mt6765_img[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6765_img);
|
||||
|
||||
static struct platform_driver clk_mt6765_img_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -57,5 +52,5 @@ static struct platform_driver clk_mt6765_img_drv = {
|
||||
.of_match_table = of_match_clk_mt6765_img,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt6765_img_drv);
|
||||
module_platform_driver(clk_mt6765_img_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -18,14 +18,8 @@ static const struct mtk_gate_regs mipi0a_cg_regs = {
|
||||
.sta_ofs = 0x80,
|
||||
};
|
||||
|
||||
#define GATE_MIPI0A(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &mipi0a_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_MIPI0A(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &mipi0a_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
static const struct mtk_gate mipi0a_clks[] = {
|
||||
GATE_MIPI0A(CLK_MIPI0A_CSR_CSI_EN_0A,
|
||||
@ -45,6 +39,7 @@ static const struct of_device_id of_match_clk_mt6765_mipi0a[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6765_mipi0a);
|
||||
|
||||
static struct platform_driver clk_mt6765_mipi0a_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -54,5 +49,5 @@ static struct platform_driver clk_mt6765_mipi0a_drv = {
|
||||
.of_match_table = of_match_clk_mt6765_mipi0a,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt6765_mipi0a_drv);
|
||||
module_platform_driver(clk_mt6765_mipi0a_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -18,14 +18,8 @@ static const struct mtk_gate_regs mm_cg_regs = {
|
||||
.sta_ofs = 0x100,
|
||||
};
|
||||
|
||||
#define GATE_MM(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &mm_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_MM(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &mm_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate mm_clks[] = {
|
||||
/* MM */
|
||||
@ -74,6 +68,7 @@ static const struct of_device_id of_match_clk_mt6765_mm[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6765_mm);
|
||||
|
||||
static struct platform_driver clk_mt6765_mm_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -83,5 +78,5 @@ static struct platform_driver clk_mt6765_mm_drv = {
|
||||
.of_match_table = of_match_clk_mt6765_mm,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt6765_mm_drv);
|
||||
module_platform_driver(clk_mt6765_mm_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -18,14 +18,8 @@ static const struct mtk_gate_regs venc_cg_regs = {
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#define GATE_VENC(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &venc_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_VENC(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &venc_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
static const struct mtk_gate venc_clks[] = {
|
||||
GATE_VENC(CLK_VENC_SET0_LARB, "venc_set0_larb", "mm_ck", 0),
|
||||
@ -47,6 +41,7 @@ static const struct of_device_id of_match_clk_mt6765_vcodec[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6765_vcodec);
|
||||
|
||||
static struct platform_driver clk_mt6765_vcodec_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -56,5 +51,5 @@ static struct platform_driver clk_mt6765_vcodec_drv = {
|
||||
.of_match_table = of_match_clk_mt6765_vcodec,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt6765_vcodec_drv);
|
||||
module_platform_driver(clk_mt6765_vcodec_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -483,32 +483,14 @@ static const struct mtk_gate_regs top2_cg_regs = {
|
||||
.sta_ofs = 0x320,
|
||||
};
|
||||
|
||||
#define GATE_TOP0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &top0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_TOP0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &top0_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
#define GATE_TOP1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &top1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_TOP1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &top1_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
#define GATE_TOP2(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &top2_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_TOP2(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &top2_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
static const struct mtk_gate top_clks[] = {
|
||||
/* TOP0 */
|
||||
@ -559,41 +541,17 @@ static const struct mtk_gate_regs ifr5_cg_regs = {
|
||||
.sta_ofs = 0xc8,
|
||||
};
|
||||
|
||||
#define GATE_IFR2(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &ifr2_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_IFR2(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &ifr2_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_IFR3(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &ifr3_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_IFR3(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &ifr3_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_IFR4(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &ifr4_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_IFR4(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &ifr4_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_IFR5(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &ifr5_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_IFR5(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &ifr5_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate ifr_clks[] = {
|
||||
/* INFRA_TOPAXI */
|
||||
@ -674,14 +632,8 @@ static const struct mtk_gate_regs apmixed_cg_regs = {
|
||||
.sta_ofs = 0x14,
|
||||
};
|
||||
|
||||
#define GATE_APMIXED(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &apmixed_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_APMIXED(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &apmixed_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
static const struct mtk_gate apmixed_clks[] = {
|
||||
/* AUDIO0 */
|
||||
@ -888,6 +840,7 @@ static const struct of_device_id of_match_clk_mt6765[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6765);
|
||||
|
||||
static int clk_mt6765_probe(struct platform_device *pdev)
|
||||
{
|
||||
@ -921,3 +874,4 @@ static int __init clk_mt6765_init(void)
|
||||
}
|
||||
|
||||
arch_initcall(clk_mt6765_init);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -102,6 +102,7 @@ static const struct of_device_id of_match_clk_mt6779_aud[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6779_aud);
|
||||
|
||||
static struct platform_driver clk_mt6779_aud_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
|
@ -51,6 +51,7 @@ static const struct of_device_id of_match_clk_mt6779_cam[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6779_cam);
|
||||
|
||||
static struct platform_driver clk_mt6779_cam_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
|
@ -43,6 +43,7 @@ static const struct of_device_id of_match_clk_mt6779_img[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6779_img);
|
||||
|
||||
static struct platform_driver clk_mt6779_img_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
|
@ -45,6 +45,7 @@ static const struct of_device_id of_match_clk_mt6779_ipe[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6779_ipe);
|
||||
|
||||
static struct platform_driver clk_mt6779_ipe_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
|
@ -40,6 +40,7 @@ static const struct of_device_id of_match_clk_mt6779_mfg[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6779_mfg);
|
||||
|
||||
static struct platform_driver clk_mt6779_mfg_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
|
@ -85,25 +85,24 @@ static const struct mtk_gate mm_clks[] = {
|
||||
GATE_MM1(CLK_MM_DISP_OVL_FBDC, "mm_disp_ovl_fbdc", "mm_sel", 16),
|
||||
};
|
||||
|
||||
static int clk_mt6779_mm_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *node = dev->parent->of_node;
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
static const struct mtk_clk_desc mm_desc = {
|
||||
.clks = mm_clks,
|
||||
.num_clks = ARRAY_SIZE(mm_clks),
|
||||
};
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(&pdev->dev, node, mm_clks,
|
||||
ARRAY_SIZE(mm_clks), clk_data);
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
}
|
||||
static const struct platform_device_id clk_mt6779_mm_id_table[] = {
|
||||
{ .name = "clk-mt6779-mm", .driver_data = (kernel_ulong_t)&mm_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, clk_mt6779_mm_id_table);
|
||||
|
||||
static struct platform_driver clk_mt6779_mm_drv = {
|
||||
.probe = clk_mt6779_mm_probe,
|
||||
.probe = mtk_clk_pdev_probe,
|
||||
.remove = mtk_clk_pdev_remove,
|
||||
.driver = {
|
||||
.name = "clk-mt6779-mm",
|
||||
},
|
||||
.id_table = clk_mt6779_mm_id_table,
|
||||
};
|
||||
|
||||
module_platform_driver(clk_mt6779_mm_drv);
|
||||
|
@ -52,6 +52,7 @@ static const struct of_device_id of_match_clk_mt6779_vdec[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6779_vdec);
|
||||
|
||||
static struct platform_driver clk_mt6779_vdec_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
|
@ -43,6 +43,7 @@ static const struct of_device_id of_match_clk_mt6779_venc[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6779_venc);
|
||||
|
||||
static struct platform_driver clk_mt6779_venc_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
|
@ -1299,6 +1299,7 @@ static const struct of_device_id of_match_clk_mt6779_infra[] = {
|
||||
{ .compatible = "mediatek,mt6779-infracfg_ao", .data = &infra_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6779);
|
||||
|
||||
static struct platform_driver clk_mt6779_infra_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
|
@ -7,8 +7,10 @@
|
||||
#include <dt-bindings/clock/mediatek,mt6795-clk.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include "clk-fhctl.h"
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-pll.h"
|
||||
#include "clk-pllfh.h"
|
||||
|
||||
#define REG_REF2USB 0x8
|
||||
#define REG_AP_PLL_CON7 0x1c
|
||||
@ -58,6 +60,56 @@ static const struct mtk_pll_data plls[] = {
|
||||
PLL(CLK_APMIXED_APLL2, "apll2", 0x2b4, 0x2c4, 0, 0, 31, 0x2b4, 4, 0x2bc, 0x2b8, 0),
|
||||
};
|
||||
|
||||
enum fh_pll_id {
|
||||
FH_CA53PLL_LL,
|
||||
FH_CA53PLL_BL,
|
||||
FH_MAINPLL,
|
||||
FH_MPLL,
|
||||
FH_MSDCPLL,
|
||||
FH_MMPLL,
|
||||
FH_VENCPLL,
|
||||
FH_TVDPLL,
|
||||
FH_VCODECPLL,
|
||||
FH_NR_FH,
|
||||
};
|
||||
|
||||
#define _FH(_pllid, _fhid, _slope, _offset) { \
|
||||
.data = { \
|
||||
.pll_id = _pllid, \
|
||||
.fh_id = _fhid, \
|
||||
.fh_ver = FHCTL_PLLFH_V1, \
|
||||
.fhx_offset = _offset, \
|
||||
.dds_mask = GENMASK(21, 0), \
|
||||
.slope0_value = _slope, \
|
||||
.slope1_value = _slope, \
|
||||
.sfstrx_en = BIT(2), \
|
||||
.frddsx_en = BIT(1), \
|
||||
.fhctlx_en = BIT(0), \
|
||||
.tgl_org = BIT(31), \
|
||||
.dvfs_tri = BIT(31), \
|
||||
.pcwchg = BIT(31), \
|
||||
.dt_val = 0x0, \
|
||||
.df_val = 0x9, \
|
||||
.updnlmt_shft = 16, \
|
||||
.msk_frddsx_dys = GENMASK(23, 20), \
|
||||
.msk_frddsx_dts = GENMASK(19, 16), \
|
||||
}, \
|
||||
}
|
||||
|
||||
#define FH(_pllid, _fhid, _offset) _FH(_pllid, _fhid, 0x6003c97, _offset)
|
||||
#define FH_M(_pllid, _fhid, _offset) _FH(_pllid, _fhid, 0x6000140, _offset)
|
||||
|
||||
static struct mtk_pllfh_data pllfhs[] = {
|
||||
FH(CLK_APMIXED_ARMCA53PLL, FH_CA53PLL_BL, 0x38),
|
||||
FH(CLK_APMIXED_MAINPLL, FH_MAINPLL, 0x60),
|
||||
FH_M(CLK_APMIXED_MPLL, FH_MPLL, 0x74),
|
||||
FH(CLK_APMIXED_MSDCPLL, FH_MSDCPLL, 0x88),
|
||||
FH(CLK_APMIXED_MMPLL, FH_MMPLL, 0x9c),
|
||||
FH(CLK_APMIXED_VENCPLL, FH_VENCPLL, 0xb0),
|
||||
FH(CLK_APMIXED_TVDPLL, FH_TVDPLL, 0xc4),
|
||||
FH(CLK_APMIXED_VCODECPLL, FH_VCODECPLL, 0xd8),
|
||||
};
|
||||
|
||||
static void clk_mt6795_apmixed_setup_md1(void __iomem *base)
|
||||
{
|
||||
void __iomem *reg = base + REG_AP_PLL_CON7;
|
||||
@ -79,12 +131,14 @@ static const struct of_device_id of_match_clk_mt6795_apmixed[] = {
|
||||
{ .compatible = "mediatek,mt6795-apmixedsys" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6795_apmixed);
|
||||
|
||||
static int clk_mt6795_apmixed_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *node = dev->of_node;
|
||||
const u8 *fhctl_node = "mediatek,mt6795-fhctl";
|
||||
void __iomem *base;
|
||||
struct clk_hw *hw;
|
||||
int ret;
|
||||
@ -97,7 +151,9 @@ static int clk_mt6795_apmixed_probe(struct platform_device *pdev)
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
|
||||
fhctl_parse_dt(fhctl_node, pllfhs, ARRAY_SIZE(pllfhs));
|
||||
ret = mtk_clk_register_pllfhs(node, plls, ARRAY_SIZE(plls),
|
||||
pllfhs, ARRAY_SIZE(pllfhs), clk_data);
|
||||
if (ret)
|
||||
goto free_clk_data;
|
||||
|
||||
@ -124,7 +180,8 @@ static int clk_mt6795_apmixed_probe(struct platform_device *pdev)
|
||||
unregister_ref2usb:
|
||||
mtk_clk_unregister_ref2usb_tx(clk_data->hws[CLK_APMIXED_REF2USB_TX]);
|
||||
unregister_plls:
|
||||
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
|
||||
mtk_clk_unregister_pllfhs(plls, ARRAY_SIZE(plls), pllfhs,
|
||||
ARRAY_SIZE(pllfhs), clk_data);
|
||||
free_clk_data:
|
||||
mtk_free_clk_data(clk_data);
|
||||
return ret;
|
||||
@ -137,7 +194,8 @@ static int clk_mt6795_apmixed_remove(struct platform_device *pdev)
|
||||
|
||||
of_clk_del_provider(node);
|
||||
mtk_clk_unregister_ref2usb_tx(clk_data->hws[CLK_APMIXED_REF2USB_TX]);
|
||||
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
|
||||
mtk_clk_unregister_pllfhs(plls, ARRAY_SIZE(plls), pllfhs,
|
||||
ARRAY_SIZE(pllfhs), clk_data);
|
||||
mtk_free_clk_data(clk_data);
|
||||
|
||||
return 0;
|
||||
|
@ -81,6 +81,7 @@ static const struct of_device_id of_match_clk_mt6795_infracfg[] = {
|
||||
{ .compatible = "mediatek,mt6795-infracfg" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6795_infracfg);
|
||||
|
||||
static int clk_mt6795_infracfg_probe(struct platform_device *pdev)
|
||||
{
|
||||
|
@ -35,6 +35,7 @@ static const struct of_device_id of_match_clk_mt6795_mfg[] = {
|
||||
{ .compatible = "mediatek,mt6795-mfgcfg", .data = &mfg_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6795_mfg);
|
||||
|
||||
static struct platform_driver clk_mt6795_mfg_drv = {
|
||||
.driver = {
|
||||
|
@ -76,56 +76,24 @@ static const struct mtk_gate mm_gates[] = {
|
||||
GATE_MM1(CLK_MM_DPI_ENGINE, "mm_dpi_engine", "mm_sel", 9),
|
||||
};
|
||||
|
||||
static int clk_mt6795_mm_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *node = dev->parent->of_node;
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int ret;
|
||||
static const struct mtk_clk_desc mm_desc = {
|
||||
.clks = mm_gates,
|
||||
.num_clks = ARRAY_SIZE(mm_gates),
|
||||
};
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = mtk_clk_register_gates(&pdev->dev, node, mm_gates,
|
||||
ARRAY_SIZE(mm_gates), clk_data);
|
||||
if (ret)
|
||||
goto free_clk_data;
|
||||
|
||||
ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (ret)
|
||||
goto unregister_gates;
|
||||
|
||||
platform_set_drvdata(pdev, clk_data);
|
||||
|
||||
return 0;
|
||||
|
||||
unregister_gates:
|
||||
mtk_clk_unregister_gates(mm_gates, ARRAY_SIZE(mm_gates), clk_data);
|
||||
free_clk_data:
|
||||
mtk_free_clk_data(clk_data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int clk_mt6795_mm_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *node = dev->parent->of_node;
|
||||
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
|
||||
|
||||
of_clk_del_provider(node);
|
||||
mtk_clk_unregister_gates(mm_gates, ARRAY_SIZE(mm_gates), clk_data);
|
||||
mtk_free_clk_data(clk_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
static const struct platform_device_id clk_mt6795_mm_id_table[] = {
|
||||
{ .name = "clk-mt6795-mm", .driver_data = (kernel_ulong_t)&mm_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, clk_mt6795_mm_id_table);
|
||||
|
||||
static struct platform_driver clk_mt6795_mm_drv = {
|
||||
.driver = {
|
||||
.name = "clk-mt6795-mm",
|
||||
},
|
||||
.probe = clk_mt6795_mm_probe,
|
||||
.remove = clk_mt6795_mm_remove,
|
||||
.id_table = clk_mt6795_mm_id_table,
|
||||
.probe = mtk_clk_pdev_probe,
|
||||
.remove = mtk_clk_pdev_remove,
|
||||
};
|
||||
module_platform_driver(clk_mt6795_mm_drv);
|
||||
|
||||
|
@ -89,6 +89,7 @@ static const struct of_device_id of_match_clk_mt6795_pericfg[] = {
|
||||
{ .compatible = "mediatek,mt6795-pericfg" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6795_pericfg);
|
||||
|
||||
static int clk_mt6795_pericfg_probe(struct platform_device *pdev)
|
||||
{
|
||||
|
@ -539,6 +539,7 @@ static const struct of_device_id of_match_clk_mt6795_topckgen[] = {
|
||||
{ .compatible = "mediatek,mt6795-topckgen", .data = &topck_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6795_topckgen);
|
||||
|
||||
static struct platform_driver clk_mt6795_topckgen_drv = {
|
||||
.driver = {
|
||||
|
@ -40,6 +40,7 @@ static const struct of_device_id of_match_clk_mt6795_vdecsys[] = {
|
||||
{ .compatible = "mediatek,mt6795-vdecsys", .data = &vdec_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6795_vdecsys);
|
||||
|
||||
static struct platform_driver clk_mt6795_vdecsys_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
|
@ -35,6 +35,7 @@ static const struct of_device_id of_match_clk_mt6795_vencsys[] = {
|
||||
{ .compatible = "mediatek,mt6795-vencsys", .data = &venc_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6795_vencsys);
|
||||
|
||||
static struct platform_driver clk_mt6795_vencsys_drv = {
|
||||
.driver = {
|
||||
|
@ -16,14 +16,8 @@ static const struct mtk_gate_regs img_cg_regs = {
|
||||
.sta_ofs = 0x0000,
|
||||
};
|
||||
|
||||
#define GATE_IMG(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &img_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_IMG(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &img_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate img_clks[] = {
|
||||
GATE_IMG(CLK_IMG_FDVT, "img_fdvt", "mm_sel", 11),
|
||||
@ -45,6 +39,7 @@ static const struct of_device_id of_match_clk_mt6797_img[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6797_img);
|
||||
|
||||
static struct platform_driver clk_mt6797_img_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -54,5 +49,5 @@ static struct platform_driver clk_mt6797_img_drv = {
|
||||
.of_match_table = of_match_clk_mt6797_img,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt6797_img_drv);
|
||||
module_platform_driver(clk_mt6797_img_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -23,23 +23,11 @@ static const struct mtk_gate_regs mm1_cg_regs = {
|
||||
.sta_ofs = 0x0110,
|
||||
};
|
||||
|
||||
#define GATE_MM0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &mm0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_MM0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &mm0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_MM1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &mm1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_MM1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &mm1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate mm_clks[] = {
|
||||
GATE_MM0(CLK_MM_SMI_COMMON, "mm_smi_common", "mm_sel", 0),
|
||||
@ -92,32 +80,24 @@ static const struct mtk_gate mm_clks[] = {
|
||||
"clk26m", 3),
|
||||
};
|
||||
|
||||
static int clk_mt6797_mm_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *node = dev->parent->of_node;
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
static const struct mtk_clk_desc mm_desc = {
|
||||
.clks = mm_clks,
|
||||
.num_clks = ARRAY_SIZE(mm_clks),
|
||||
};
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MM_NR);
|
||||
|
||||
mtk_clk_register_gates(&pdev->dev, node, mm_clks,
|
||||
ARRAY_SIZE(mm_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
dev_err(&pdev->dev,
|
||||
"could not register clock provider: %s: %d\n",
|
||||
pdev->name, r);
|
||||
|
||||
return r;
|
||||
}
|
||||
static const struct platform_device_id clk_mt6797_mm_id_table[] = {
|
||||
{ .name = "clk-mt6797-mm", .driver_data = (kernel_ulong_t)&mm_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, clk_mt6797_mm_id_table);
|
||||
|
||||
static struct platform_driver clk_mt6797_mm_drv = {
|
||||
.probe = clk_mt6797_mm_probe,
|
||||
.probe = mtk_clk_pdev_probe,
|
||||
.remove = mtk_clk_pdev_remove,
|
||||
.driver = {
|
||||
.name = "clk-mt6797-mm",
|
||||
},
|
||||
.id_table = clk_mt6797_mm_id_table,
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt6797_mm_drv);
|
||||
module_platform_driver(clk_mt6797_mm_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -24,23 +24,11 @@ static const struct mtk_gate_regs vdec1_cg_regs = {
|
||||
.sta_ofs = 0x0008,
|
||||
};
|
||||
|
||||
#define GATE_VDEC0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &vdec0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_VDEC0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &vdec0_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
#define GATE_VDEC1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &vdec1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_VDEC1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &vdec1_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
static const struct mtk_gate vdec_clks[] = {
|
||||
GATE_VDEC0(CLK_VDEC_CKEN_ENG, "vdec_cken_eng", "vdec_sel", 8),
|
||||
@ -62,6 +50,7 @@ static const struct of_device_id of_match_clk_mt6797_vdec[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6797_vdec);
|
||||
|
||||
static struct platform_driver clk_mt6797_vdec_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -71,5 +60,5 @@ static struct platform_driver clk_mt6797_vdec_drv = {
|
||||
.of_match_table = of_match_clk_mt6797_vdec,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt6797_vdec_drv);
|
||||
module_platform_driver(clk_mt6797_vdec_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -18,14 +18,8 @@ static const struct mtk_gate_regs venc_cg_regs = {
|
||||
.sta_ofs = 0x0000,
|
||||
};
|
||||
|
||||
#define GATE_VENC(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &venc_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_VENC(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &venc_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
static const struct mtk_gate venc_clks[] = {
|
||||
GATE_VENC(CLK_VENC_0, "venc_0", "mm_sel", 0),
|
||||
@ -47,6 +41,7 @@ static const struct of_device_id of_match_clk_mt6797_venc[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6797_venc);
|
||||
|
||||
static struct platform_driver clk_mt6797_venc_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -56,5 +51,5 @@ static struct platform_driver clk_mt6797_venc_drv = {
|
||||
.of_match_table = of_match_clk_mt6797_venc,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt6797_venc_drv);
|
||||
module_platform_driver(clk_mt6797_venc_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -421,40 +421,22 @@ static const struct mtk_gate_regs infra2_cg_regs = {
|
||||
.sta_ofs = 0x00b0,
|
||||
};
|
||||
|
||||
#define GATE_ICG0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &infra0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_ICG0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &infra0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_ICG1(_id, _name, _parent, _shift) \
|
||||
GATE_ICG1_FLAGS(_id, _name, _parent, _shift, 0)
|
||||
#define GATE_ICG1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &infra1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_ICG1_FLAGS(_id, _name, _parent, _shift, _flags) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &infra1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
.flags = _flags, \
|
||||
}
|
||||
#define GATE_ICG1_FLAGS(_id, _name, _parent, _shift, _flags) \
|
||||
GATE_MTK_FLAGS(_id, _name, _parent, &infra1_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_setclr, _flags)
|
||||
|
||||
#define GATE_ICG2(_id, _name, _parent, _shift) \
|
||||
GATE_ICG2_FLAGS(_id, _name, _parent, _shift, 0)
|
||||
#define GATE_ICG2(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &infra2_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_ICG2_FLAGS(_id, _name, _parent, _shift, _flags) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &infra2_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
.flags = _flags, \
|
||||
}
|
||||
#define GATE_ICG2_FLAGS(_id, _name, _parent, _shift, _flags) \
|
||||
GATE_MTK_FLAGS(_id, _name, _parent, &infra2_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_setclr, _flags)
|
||||
|
||||
/*
|
||||
* Clock gates dramc and dramc_b are needed by the DRAM controller.
|
||||
@ -688,6 +670,7 @@ static const struct of_device_id of_match_clk_mt6797[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt6797);
|
||||
|
||||
static int clk_mt6797_probe(struct platform_device *pdev)
|
||||
{
|
||||
@ -721,3 +704,4 @@ static int __init clk_mt6797_init(void)
|
||||
}
|
||||
|
||||
arch_initcall(clk_mt6797_init);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
152
drivers/clk/mediatek/clk-mt7622-apmixedsys.c
Normal file
152
drivers/clk/mediatek/clk-mt7622-apmixedsys.c
Normal file
@ -0,0 +1,152 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017 MediaTek Inc.
|
||||
* Copyright (c) 2023 Collabora, Ltd.
|
||||
* AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
|
||||
*/
|
||||
|
||||
#include <dt-bindings/clock/mt7622-clk.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-gate.h"
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-pll.h"
|
||||
|
||||
#define MT7622_PLL_FMAX (2500UL * MHZ)
|
||||
#define CON0_MT7622_RST_BAR BIT(27)
|
||||
|
||||
#define PLL_xtal(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits,\
|
||||
_pd_reg, _pd_shift, _tuner_reg, _pcw_reg, \
|
||||
_pcw_shift, _div_table, _parent_name) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.reg = _reg, \
|
||||
.pwr_reg = _pwr_reg, \
|
||||
.en_mask = _en_mask, \
|
||||
.flags = _flags, \
|
||||
.rst_bar_mask = CON0_MT7622_RST_BAR, \
|
||||
.fmax = MT7622_PLL_FMAX, \
|
||||
.pcwbits = _pcwbits, \
|
||||
.pd_reg = _pd_reg, \
|
||||
.pd_shift = _pd_shift, \
|
||||
.tuner_reg = _tuner_reg, \
|
||||
.pcw_reg = _pcw_reg, \
|
||||
.pcw_shift = _pcw_shift, \
|
||||
.div_table = _div_table, \
|
||||
.parent_name = _parent_name, \
|
||||
}
|
||||
|
||||
#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
|
||||
_pd_reg, _pd_shift, _tuner_reg, _pcw_reg, \
|
||||
_pcw_shift) \
|
||||
PLL_xtal(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits,\
|
||||
_pd_reg, _pd_shift, _tuner_reg, _pcw_reg, _pcw_shift, \
|
||||
NULL, "clkxtal")
|
||||
|
||||
static const struct mtk_gate_regs apmixed_cg_regs = {
|
||||
.set_ofs = 0x8,
|
||||
.clr_ofs = 0x8,
|
||||
.sta_ofs = 0x8,
|
||||
};
|
||||
|
||||
#define GATE_APMIXED_AO(_id, _name, _parent, _shift) \
|
||||
GATE_MTK_FLAGS(_id, _name, _parent, &apmixed_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_no_setclr_inv, CLK_IS_CRITICAL)
|
||||
|
||||
static const struct mtk_pll_data plls[] = {
|
||||
PLL(CLK_APMIXED_ARMPLL, "armpll", 0x0200, 0x020C, 0,
|
||||
PLL_AO, 21, 0x0204, 24, 0, 0x0204, 0),
|
||||
PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x0210, 0x021C, 0,
|
||||
HAVE_RST_BAR, 21, 0x0214, 24, 0, 0x0214, 0),
|
||||
PLL(CLK_APMIXED_UNIV2PLL, "univ2pll", 0x0220, 0x022C, 0,
|
||||
HAVE_RST_BAR, 7, 0x0224, 24, 0, 0x0224, 14),
|
||||
PLL(CLK_APMIXED_ETH1PLL, "eth1pll", 0x0300, 0x0310, 0,
|
||||
0, 21, 0x0300, 1, 0, 0x0304, 0),
|
||||
PLL(CLK_APMIXED_ETH2PLL, "eth2pll", 0x0314, 0x0320, 0,
|
||||
0, 21, 0x0314, 1, 0, 0x0318, 0),
|
||||
PLL(CLK_APMIXED_AUD1PLL, "aud1pll", 0x0324, 0x0330, 0,
|
||||
0, 31, 0x0324, 1, 0, 0x0328, 0),
|
||||
PLL(CLK_APMIXED_AUD2PLL, "aud2pll", 0x0334, 0x0340, 0,
|
||||
0, 31, 0x0334, 1, 0, 0x0338, 0),
|
||||
PLL(CLK_APMIXED_TRGPLL, "trgpll", 0x0344, 0x0354, 0,
|
||||
0, 21, 0x0344, 1, 0, 0x0348, 0),
|
||||
PLL(CLK_APMIXED_SGMIPLL, "sgmipll", 0x0358, 0x0368, 0,
|
||||
0, 21, 0x0358, 1, 0, 0x035C, 0),
|
||||
};
|
||||
|
||||
static const struct mtk_gate apmixed_clks[] = {
|
||||
GATE_APMIXED_AO(CLK_APMIXED_MAIN_CORE_EN, "main_core_en", "mainpll", 5),
|
||||
};
|
||||
|
||||
static int clk_mt7622_apmixed_probe(struct platform_device *pdev)
|
||||
{
|
||||
void __iomem *base;
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
struct device *dev = &pdev->dev;
|
||||
int ret;
|
||||
|
||||
base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(base))
|
||||
return PTR_ERR(base);
|
||||
|
||||
clk_data = mtk_devm_alloc_clk_data(dev, CLK_APMIXED_NR_CLK);
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = mtk_clk_register_gates(&pdev->dev, node, apmixed_clks,
|
||||
ARRAY_SIZE(apmixed_clks), clk_data);
|
||||
if (ret)
|
||||
goto unregister_plls;
|
||||
|
||||
ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (ret)
|
||||
goto unregister_gates;
|
||||
|
||||
return 0;
|
||||
|
||||
unregister_gates:
|
||||
mtk_clk_unregister_gates(apmixed_clks, ARRAY_SIZE(apmixed_clks), clk_data);
|
||||
unregister_plls:
|
||||
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int clk_mt7622_apmixed_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
|
||||
|
||||
of_clk_del_provider(node);
|
||||
mtk_clk_unregister_gates(apmixed_clks, ARRAY_SIZE(apmixed_clks), clk_data);
|
||||
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
|
||||
mtk_free_clk_data(clk_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt7622_apmixed[] = {
|
||||
{ .compatible = "mediatek,mt7622-apmixedsys" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7622_apmixed);
|
||||
|
||||
static struct platform_driver clk_mt7622_apmixed_drv = {
|
||||
.probe = clk_mt7622_apmixed_probe,
|
||||
.remove = clk_mt7622_apmixed_remove,
|
||||
.driver = {
|
||||
.name = "clk-mt7622-apmixed",
|
||||
.of_match_table = of_match_clk_mt7622_apmixed,
|
||||
},
|
||||
};
|
||||
module_platform_driver(clk_mt7622_apmixed_drv)
|
||||
|
||||
MODULE_DESCRIPTION("MediaTek MT7622 apmixedsys clocks driver");
|
||||
MODULE_LICENSE("GPL");
|
@ -16,41 +16,17 @@
|
||||
|
||||
#include <dt-bindings/clock/mt7622-clk.h>
|
||||
|
||||
#define GATE_AUDIO0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &audio0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_AUDIO0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &audio0_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
#define GATE_AUDIO1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &audio1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_AUDIO1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &audio1_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
#define GATE_AUDIO2(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &audio2_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_AUDIO2(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &audio2_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
#define GATE_AUDIO3(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &audio3_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_AUDIO3(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &audio3_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
static const struct mtk_gate_regs audio0_cg_regs = {
|
||||
.set_ofs = 0x0,
|
||||
@ -169,6 +145,7 @@ static const struct of_device_id of_match_clk_mt7622_aud[] = {
|
||||
{ .compatible = "mediatek,mt7622-audsys", .data = &audio_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7622_aud);
|
||||
|
||||
static struct platform_driver clk_mt7622_aud_drv = {
|
||||
.probe = clk_mt7622_aud_probe,
|
||||
@ -178,5 +155,5 @@ static struct platform_driver clk_mt7622_aud_drv = {
|
||||
.of_match_table = of_match_clk_mt7622_aud,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt7622_aud_drv);
|
||||
module_platform_driver(clk_mt7622_aud_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -16,14 +16,8 @@
|
||||
|
||||
#include <dt-bindings/clock/mt7622-clk.h>
|
||||
|
||||
#define GATE_ETH(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = ð_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_ETH(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, ð_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
static const struct mtk_gate_regs eth_cg_regs = {
|
||||
.set_ofs = 0x30,
|
||||
@ -45,14 +39,8 @@ static const struct mtk_gate_regs sgmii_cg_regs = {
|
||||
.sta_ofs = 0xE4,
|
||||
};
|
||||
|
||||
#define GATE_SGMII(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &sgmii_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_SGMII(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &sgmii_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
static const struct mtk_gate sgmii_clks[] = {
|
||||
GATE_SGMII(CLK_SGMII_TX250M_EN, "sgmii_tx250m_en",
|
||||
@ -89,6 +77,7 @@ static const struct of_device_id of_match_clk_mt7622_eth[] = {
|
||||
{ .compatible = "mediatek,mt7622-sgmiisys", .data = &sgmii_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7622_eth);
|
||||
|
||||
static struct platform_driver clk_mt7622_eth_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -98,5 +87,5 @@ static struct platform_driver clk_mt7622_eth_drv = {
|
||||
.of_match_table = of_match_clk_mt7622_eth,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt7622_eth_drv);
|
||||
module_platform_driver(clk_mt7622_eth_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -16,23 +16,11 @@
|
||||
|
||||
#include <dt-bindings/clock/mt7622-clk.h>
|
||||
|
||||
#define GATE_PCIE(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &pcie_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_PCIE(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &pcie_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
#define GATE_SSUSB(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &ssusb_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_SSUSB(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &ssusb_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
static const struct mtk_gate_regs pcie_cg_regs = {
|
||||
.set_ofs = 0x30,
|
||||
@ -101,6 +89,7 @@ static const struct of_device_id of_match_clk_mt7622_hif[] = {
|
||||
{ .compatible = "mediatek,mt7622-ssusbsys", .data = &ssusb_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7622_hif);
|
||||
|
||||
static struct platform_driver clk_mt7622_hif_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -110,5 +99,5 @@ static struct platform_driver clk_mt7622_hif_drv = {
|
||||
.of_match_table = of_match_clk_mt7622_hif,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt7622_hif_drv);
|
||||
module_platform_driver(clk_mt7622_hif_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
128
drivers/clk/mediatek/clk-mt7622-infracfg.c
Normal file
128
drivers/clk/mediatek/clk-mt7622-infracfg.c
Normal file
@ -0,0 +1,128 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017 MediaTek Inc.
|
||||
* Copyright (c) 2023 Collabora, Ltd.
|
||||
* AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
|
||||
*/
|
||||
|
||||
#include <dt-bindings/clock/mt7622-clk.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-cpumux.h"
|
||||
#include "clk-gate.h"
|
||||
#include "clk-mtk.h"
|
||||
#include "reset.h"
|
||||
|
||||
#define GATE_INFRA(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &infra_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate_regs infra_cg_regs = {
|
||||
.set_ofs = 0x40,
|
||||
.clr_ofs = 0x44,
|
||||
.sta_ofs = 0x48,
|
||||
};
|
||||
|
||||
static const char * const infra_mux1_parents[] = {
|
||||
"clkxtal",
|
||||
"armpll",
|
||||
"main_core_en",
|
||||
"armpll"
|
||||
};
|
||||
|
||||
static const struct mtk_composite cpu_muxes[] = {
|
||||
MUX(CLK_INFRA_MUX1_SEL, "infra_mux1_sel", infra_mux1_parents, 0x000, 2, 2),
|
||||
};
|
||||
|
||||
static const struct mtk_gate infra_clks[] = {
|
||||
GATE_INFRA(CLK_INFRA_DBGCLK_PD, "infra_dbgclk_pd", "axi_sel", 0),
|
||||
GATE_INFRA(CLK_INFRA_TRNG, "trng_ck", "axi_sel", 2),
|
||||
GATE_INFRA(CLK_INFRA_AUDIO_PD, "infra_audio_pd", "aud_intbus_sel", 5),
|
||||
GATE_INFRA(CLK_INFRA_IRRX_PD, "infra_irrx_pd", "irrx_sel", 16),
|
||||
GATE_INFRA(CLK_INFRA_APXGPT_PD, "infra_apxgpt_pd", "f10m_ref_sel", 18),
|
||||
GATE_INFRA(CLK_INFRA_PMIC_PD, "infra_pmic_pd", "pmicspi_sel", 22),
|
||||
};
|
||||
|
||||
static u16 infrasys_rst_ofs[] = { 0x30 };
|
||||
|
||||
static const struct mtk_clk_rst_desc clk_rst_desc = {
|
||||
.version = MTK_RST_SIMPLE,
|
||||
.rst_bank_ofs = infrasys_rst_ofs,
|
||||
.rst_bank_nr = ARRAY_SIZE(infrasys_rst_ofs),
|
||||
};
|
||||
|
||||
static const struct of_device_id of_match_clk_mt7622_infracfg[] = {
|
||||
{ .compatible = "mediatek,mt7622-infracfg" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7622_infracfg);
|
||||
|
||||
static int clk_mt7622_infracfg_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
void __iomem *base;
|
||||
int ret;
|
||||
|
||||
base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(base))
|
||||
return PTR_ERR(base);
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = mtk_register_reset_controller_with_dev(&pdev->dev, &clk_rst_desc);
|
||||
if (ret)
|
||||
goto free_clk_data;
|
||||
|
||||
ret = mtk_clk_register_gates(&pdev->dev, node, infra_clks,
|
||||
ARRAY_SIZE(infra_clks), clk_data);
|
||||
if (ret)
|
||||
goto free_clk_data;
|
||||
|
||||
ret = mtk_clk_register_cpumuxes(&pdev->dev, node, cpu_muxes,
|
||||
ARRAY_SIZE(cpu_muxes), clk_data);
|
||||
if (ret)
|
||||
goto unregister_gates;
|
||||
|
||||
ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (ret)
|
||||
goto unregister_cpumuxes;
|
||||
|
||||
return 0;
|
||||
|
||||
unregister_cpumuxes:
|
||||
mtk_clk_unregister_cpumuxes(cpu_muxes, ARRAY_SIZE(cpu_muxes), clk_data);
|
||||
unregister_gates:
|
||||
mtk_clk_unregister_gates(infra_clks, ARRAY_SIZE(infra_clks), clk_data);
|
||||
free_clk_data:
|
||||
mtk_free_clk_data(clk_data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int clk_mt7622_infracfg_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
|
||||
|
||||
of_clk_del_provider(node);
|
||||
mtk_clk_unregister_cpumuxes(cpu_muxes, ARRAY_SIZE(cpu_muxes), clk_data);
|
||||
mtk_clk_unregister_gates(infra_clks, ARRAY_SIZE(infra_clks), clk_data);
|
||||
mtk_free_clk_data(clk_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver clk_mt7622_infracfg_drv = {
|
||||
.driver = {
|
||||
.name = "clk-mt7622-infracfg",
|
||||
.of_match_table = of_match_clk_mt7622_infracfg,
|
||||
},
|
||||
.probe = clk_mt7622_infracfg_probe,
|
||||
.remove = clk_mt7622_infracfg_remove,
|
||||
};
|
||||
module_platform_driver(clk_mt7622_infracfg_drv);
|
||||
|
||||
MODULE_DESCRIPTION("MediaTek MT7622 infracfg clocks driver");
|
||||
MODULE_LICENSE("GPL");
|
@ -14,105 +14,28 @@
|
||||
#include "clk-cpumux.h"
|
||||
#include "clk-gate.h"
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-pll.h"
|
||||
|
||||
#include <dt-bindings/clock/mt7622-clk.h>
|
||||
#include <linux/clk.h> /* for consumer */
|
||||
|
||||
#define MT7622_PLL_FMAX (2500UL * MHZ)
|
||||
#define CON0_MT7622_RST_BAR BIT(27)
|
||||
#define GATE_TOP0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &top0_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
#define PLL_xtal(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits,\
|
||||
_pd_reg, _pd_shift, _tuner_reg, _pcw_reg, \
|
||||
_pcw_shift, _div_table, _parent_name) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.reg = _reg, \
|
||||
.pwr_reg = _pwr_reg, \
|
||||
.en_mask = _en_mask, \
|
||||
.flags = _flags, \
|
||||
.rst_bar_mask = CON0_MT7622_RST_BAR, \
|
||||
.fmax = MT7622_PLL_FMAX, \
|
||||
.pcwbits = _pcwbits, \
|
||||
.pd_reg = _pd_reg, \
|
||||
.pd_shift = _pd_shift, \
|
||||
.tuner_reg = _tuner_reg, \
|
||||
.pcw_reg = _pcw_reg, \
|
||||
.pcw_shift = _pcw_shift, \
|
||||
.div_table = _div_table, \
|
||||
.parent_name = _parent_name, \
|
||||
}
|
||||
#define GATE_TOP1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &top1_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
|
||||
_pd_reg, _pd_shift, _tuner_reg, _pcw_reg, \
|
||||
_pcw_shift) \
|
||||
PLL_xtal(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits,\
|
||||
_pd_reg, _pd_shift, _tuner_reg, _pcw_reg, _pcw_shift, \
|
||||
NULL, "clkxtal")
|
||||
#define GATE_PERI0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &peri0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_APMIXED(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &apmixed_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_PERI0_AO(_id, _name, _parent, _shift) \
|
||||
GATE_MTK_FLAGS(_id, _name, _parent, &peri0_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_setclr, CLK_IS_CRITICAL)
|
||||
|
||||
#define GATE_INFRA(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &infra_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
|
||||
#define GATE_TOP0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &top0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
|
||||
#define GATE_TOP1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &top1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
|
||||
#define GATE_PERI0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &peri0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
|
||||
#define GATE_PERI1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &peri1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_PERI1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &peri1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static DEFINE_SPINLOCK(mt7622_clk_lock);
|
||||
|
||||
static const char * const infra_mux1_parents[] = {
|
||||
"clkxtal",
|
||||
"armpll",
|
||||
"main_core_en",
|
||||
"armpll"
|
||||
};
|
||||
|
||||
static const char * const axi_parents[] = {
|
||||
"clkxtal",
|
||||
"syspll1_d2",
|
||||
@ -292,18 +215,6 @@ static const char * const peribus_ck_parents[] = {
|
||||
"syspll1_d4"
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs apmixed_cg_regs = {
|
||||
.set_ofs = 0x8,
|
||||
.clr_ofs = 0x8,
|
||||
.sta_ofs = 0x8,
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs infra_cg_regs = {
|
||||
.set_ofs = 0x40,
|
||||
.clr_ofs = 0x44,
|
||||
.sta_ofs = 0x48,
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs top0_cg_regs = {
|
||||
.set_ofs = 0x120,
|
||||
.clr_ofs = 0x120,
|
||||
@ -328,40 +239,6 @@ static const struct mtk_gate_regs peri1_cg_regs = {
|
||||
.sta_ofs = 0x1C,
|
||||
};
|
||||
|
||||
static const struct mtk_pll_data plls[] = {
|
||||
PLL(CLK_APMIXED_ARMPLL, "armpll", 0x0200, 0x020C, 0,
|
||||
PLL_AO, 21, 0x0204, 24, 0, 0x0204, 0),
|
||||
PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x0210, 0x021C, 0,
|
||||
HAVE_RST_BAR, 21, 0x0214, 24, 0, 0x0214, 0),
|
||||
PLL(CLK_APMIXED_UNIV2PLL, "univ2pll", 0x0220, 0x022C, 0,
|
||||
HAVE_RST_BAR, 7, 0x0224, 24, 0, 0x0224, 14),
|
||||
PLL(CLK_APMIXED_ETH1PLL, "eth1pll", 0x0300, 0x0310, 0,
|
||||
0, 21, 0x0300, 1, 0, 0x0304, 0),
|
||||
PLL(CLK_APMIXED_ETH2PLL, "eth2pll", 0x0314, 0x0320, 0,
|
||||
0, 21, 0x0314, 1, 0, 0x0318, 0),
|
||||
PLL(CLK_APMIXED_AUD1PLL, "aud1pll", 0x0324, 0x0330, 0,
|
||||
0, 31, 0x0324, 1, 0, 0x0328, 0),
|
||||
PLL(CLK_APMIXED_AUD2PLL, "aud2pll", 0x0334, 0x0340, 0,
|
||||
0, 31, 0x0334, 1, 0, 0x0338, 0),
|
||||
PLL(CLK_APMIXED_TRGPLL, "trgpll", 0x0344, 0x0354, 0,
|
||||
0, 21, 0x0344, 1, 0, 0x0348, 0),
|
||||
PLL(CLK_APMIXED_SGMIPLL, "sgmipll", 0x0358, 0x0368, 0,
|
||||
0, 21, 0x0358, 1, 0, 0x035C, 0),
|
||||
};
|
||||
|
||||
static const struct mtk_gate apmixed_clks[] = {
|
||||
GATE_APMIXED(CLK_APMIXED_MAIN_CORE_EN, "main_core_en", "mainpll", 5),
|
||||
};
|
||||
|
||||
static const struct mtk_gate infra_clks[] = {
|
||||
GATE_INFRA(CLK_INFRA_DBGCLK_PD, "infra_dbgclk_pd", "axi_sel", 0),
|
||||
GATE_INFRA(CLK_INFRA_TRNG, "trng_ck", "axi_sel", 2),
|
||||
GATE_INFRA(CLK_INFRA_AUDIO_PD, "infra_audio_pd", "aud_intbus_sel", 5),
|
||||
GATE_INFRA(CLK_INFRA_IRRX_PD, "infra_irrx_pd", "irrx_sel", 16),
|
||||
GATE_INFRA(CLK_INFRA_APXGPT_PD, "infra_apxgpt_pd", "f10m_ref_sel", 18),
|
||||
GATE_INFRA(CLK_INFRA_PMIC_PD, "infra_pmic_pd", "pmicspi_sel", 22),
|
||||
};
|
||||
|
||||
static const struct mtk_fixed_clk top_fixed_clks[] = {
|
||||
FIXED_CLK(CLK_TOP_TO_U2_PHY, "to_u2_phy", "clkxtal",
|
||||
31250000),
|
||||
@ -485,7 +362,7 @@ static const struct mtk_gate peri_clks[] = {
|
||||
GATE_PERI0(CLK_PERI_AP_DMA_PD, "peri_ap_dma_pd", "axi_sel", 12),
|
||||
GATE_PERI0(CLK_PERI_MSDC30_0_PD, "peri_msdc30_0", "msdc30_0_sel", 13),
|
||||
GATE_PERI0(CLK_PERI_MSDC30_1_PD, "peri_msdc30_1", "msdc30_1_sel", 14),
|
||||
GATE_PERI0(CLK_PERI_UART0_PD, "peri_uart0_pd", "axi_sel", 17),
|
||||
GATE_PERI0_AO(CLK_PERI_UART0_PD, "peri_uart0_pd", "axi_sel", 17),
|
||||
GATE_PERI0(CLK_PERI_UART1_PD, "peri_uart1_pd", "axi_sel", 18),
|
||||
GATE_PERI0(CLK_PERI_UART2_PD, "peri_uart2_pd", "axi_sel", 19),
|
||||
GATE_PERI0(CLK_PERI_UART3_PD, "peri_uart3_pd", "axi_sel", 20),
|
||||
@ -506,19 +383,14 @@ static const struct mtk_gate peri_clks[] = {
|
||||
GATE_PERI1(CLK_PERI_IRTX_PD, "peri_irtx_pd", "irtx_sel", 2),
|
||||
};
|
||||
|
||||
static struct mtk_composite infra_muxes[] = {
|
||||
MUX(CLK_INFRA_MUX1_SEL, "infra_mux1_sel", infra_mux1_parents,
|
||||
0x000, 2, 2),
|
||||
};
|
||||
|
||||
static struct mtk_composite top_muxes[] = {
|
||||
/* CLK_CFG_0 */
|
||||
MUX_GATE(CLK_TOP_AXI_SEL, "axi_sel", axi_parents,
|
||||
0x040, 0, 3, 7),
|
||||
MUX_GATE(CLK_TOP_MEM_SEL, "mem_sel", mem_parents,
|
||||
0x040, 8, 1, 15),
|
||||
MUX_GATE(CLK_TOP_DDRPHYCFG_SEL, "ddrphycfg_sel", ddrphycfg_parents,
|
||||
0x040, 16, 1, 23),
|
||||
MUX_GATE_FLAGS(CLK_TOP_AXI_SEL, "axi_sel", axi_parents,
|
||||
0x040, 0, 3, 7, CLK_IS_CRITICAL),
|
||||
MUX_GATE_FLAGS(CLK_TOP_MEM_SEL, "mem_sel", mem_parents,
|
||||
0x040, 8, 1, 15, CLK_IS_CRITICAL),
|
||||
MUX_GATE_FLAGS(CLK_TOP_DDRPHYCFG_SEL, "ddrphycfg_sel", ddrphycfg_parents,
|
||||
0x040, 16, 1, 23, CLK_IS_CRITICAL),
|
||||
MUX_GATE(CLK_TOP_ETH_SEL, "eth_sel", eth_parents,
|
||||
0x040, 24, 3, 31),
|
||||
|
||||
@ -610,182 +482,53 @@ static struct mtk_composite peri_muxes[] = {
|
||||
MUX(CLK_PERIBUS_SEL, "peribus_ck_sel", peribus_ck_parents, 0x05C, 0, 1),
|
||||
};
|
||||
|
||||
static u16 infrasys_rst_ofs[] = { 0x30, };
|
||||
static u16 pericfg_rst_ofs[] = { 0x0, 0x4, };
|
||||
|
||||
static const struct mtk_clk_rst_desc clk_rst_desc[] = {
|
||||
/* infrasys */
|
||||
{
|
||||
.version = MTK_RST_SIMPLE,
|
||||
.rst_bank_ofs = infrasys_rst_ofs,
|
||||
.rst_bank_nr = ARRAY_SIZE(infrasys_rst_ofs),
|
||||
},
|
||||
/* pericfg */
|
||||
{
|
||||
.version = MTK_RST_SIMPLE,
|
||||
.rst_bank_ofs = pericfg_rst_ofs,
|
||||
.rst_bank_nr = ARRAY_SIZE(pericfg_rst_ofs),
|
||||
},
|
||||
static const struct mtk_clk_rst_desc clk_rst_desc = {
|
||||
.version = MTK_RST_SIMPLE,
|
||||
.rst_bank_ofs = pericfg_rst_ofs,
|
||||
.rst_bank_nr = ARRAY_SIZE(pericfg_rst_ofs),
|
||||
};
|
||||
|
||||
static int mtk_topckgen_init(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
void __iomem *base;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
static const struct mtk_clk_desc topck_desc = {
|
||||
.clks = top_clks,
|
||||
.num_clks = ARRAY_SIZE(top_clks),
|
||||
.fixed_clks = top_fixed_clks,
|
||||
.num_fixed_clks = ARRAY_SIZE(top_fixed_clks),
|
||||
.factor_clks = top_divs,
|
||||
.num_factor_clks = ARRAY_SIZE(top_divs),
|
||||
.composite_clks = top_muxes,
|
||||
.num_composite_clks = ARRAY_SIZE(top_muxes),
|
||||
.divider_clks = top_adj_divs,
|
||||
.num_divider_clks = ARRAY_SIZE(top_adj_divs),
|
||||
.clk_lock = &mt7622_clk_lock,
|
||||
};
|
||||
|
||||
base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(base))
|
||||
return PTR_ERR(base);
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
|
||||
|
||||
mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks),
|
||||
clk_data);
|
||||
|
||||
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs),
|
||||
clk_data);
|
||||
|
||||
mtk_clk_register_composites(&pdev->dev, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), base,
|
||||
&mt7622_clk_lock, clk_data);
|
||||
|
||||
mtk_clk_register_dividers(top_adj_divs, ARRAY_SIZE(top_adj_divs),
|
||||
base, &mt7622_clk_lock, clk_data);
|
||||
|
||||
mtk_clk_register_gates(&pdev->dev, node, top_clks,
|
||||
ARRAY_SIZE(top_clks), clk_data);
|
||||
|
||||
clk_prepare_enable(clk_data->hws[CLK_TOP_AXI_SEL]->clk);
|
||||
clk_prepare_enable(clk_data->hws[CLK_TOP_MEM_SEL]->clk);
|
||||
clk_prepare_enable(clk_data->hws[CLK_TOP_DDRPHYCFG_SEL]->clk);
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
static int mtk_infrasys_init(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(&pdev->dev, node, infra_clks,
|
||||
ARRAY_SIZE(infra_clks), clk_data);
|
||||
|
||||
mtk_clk_register_cpumuxes(&pdev->dev, node, infra_muxes,
|
||||
ARRAY_SIZE(infra_muxes), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get,
|
||||
clk_data);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
mtk_register_reset_controller_with_dev(&pdev->dev, &clk_rst_desc[0]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mtk_apmixedsys_init(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls),
|
||||
clk_data);
|
||||
|
||||
mtk_clk_register_gates(&pdev->dev, node, apmixed_clks,
|
||||
ARRAY_SIZE(apmixed_clks), clk_data);
|
||||
|
||||
clk_prepare_enable(clk_data->hws[CLK_APMIXED_ARMPLL]->clk);
|
||||
clk_prepare_enable(clk_data->hws[CLK_APMIXED_MAIN_CORE_EN]->clk);
|
||||
|
||||
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
static int mtk_pericfg_init(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
void __iomem *base;
|
||||
int r;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
|
||||
base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(base))
|
||||
return PTR_ERR(base);
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(&pdev->dev, node, peri_clks,
|
||||
ARRAY_SIZE(peri_clks), clk_data);
|
||||
|
||||
mtk_clk_register_composites(&pdev->dev, peri_muxes,
|
||||
ARRAY_SIZE(peri_muxes), base,
|
||||
&mt7622_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
clk_prepare_enable(clk_data->hws[CLK_PERI_UART0_PD]->clk);
|
||||
|
||||
mtk_register_reset_controller_with_dev(&pdev->dev, &clk_rst_desc[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
static const struct mtk_clk_desc peri_desc = {
|
||||
.clks = peri_clks,
|
||||
.num_clks = ARRAY_SIZE(peri_clks),
|
||||
.composite_clks = peri_muxes,
|
||||
.num_composite_clks = ARRAY_SIZE(peri_muxes),
|
||||
.rst_desc = &clk_rst_desc,
|
||||
.clk_lock = &mt7622_clk_lock,
|
||||
};
|
||||
|
||||
static const struct of_device_id of_match_clk_mt7622[] = {
|
||||
{
|
||||
.compatible = "mediatek,mt7622-apmixedsys",
|
||||
.data = mtk_apmixedsys_init,
|
||||
}, {
|
||||
.compatible = "mediatek,mt7622-infracfg",
|
||||
.data = mtk_infrasys_init,
|
||||
}, {
|
||||
.compatible = "mediatek,mt7622-topckgen",
|
||||
.data = mtk_topckgen_init,
|
||||
}, {
|
||||
.compatible = "mediatek,mt7622-pericfg",
|
||||
.data = mtk_pericfg_init,
|
||||
}, {
|
||||
/* sentinel */
|
||||
}
|
||||
{ .compatible = "mediatek,mt7622-topckgen", .data = &topck_desc },
|
||||
{ .compatible = "mediatek,mt7622-pericfg", .data = &peri_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static int clk_mt7622_probe(struct platform_device *pdev)
|
||||
{
|
||||
int (*clk_init)(struct platform_device *);
|
||||
int r;
|
||||
|
||||
clk_init = of_device_get_match_data(&pdev->dev);
|
||||
if (!clk_init)
|
||||
return -EINVAL;
|
||||
|
||||
r = clk_init(pdev);
|
||||
if (r)
|
||||
dev_err(&pdev->dev,
|
||||
"could not register clock provider: %s: %d\n",
|
||||
pdev->name, r);
|
||||
|
||||
return r;
|
||||
}
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7622);
|
||||
|
||||
static struct platform_driver clk_mt7622_drv = {
|
||||
.probe = clk_mt7622_probe,
|
||||
.driver = {
|
||||
.name = "clk-mt7622",
|
||||
.of_match_table = of_match_clk_mt7622,
|
||||
},
|
||||
.probe = mtk_clk_simple_probe,
|
||||
.remove = mtk_clk_simple_remove,
|
||||
};
|
||||
module_platform_driver(clk_mt7622_drv)
|
||||
|
||||
static int clk_mt7622_init(void)
|
||||
{
|
||||
return platform_driver_register(&clk_mt7622_drv);
|
||||
}
|
||||
|
||||
arch_initcall(clk_mt7622_init);
|
||||
MODULE_DESCRIPTION("MediaTek MT7622 clocks driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -16,14 +16,8 @@
|
||||
|
||||
#include <dt-bindings/clock/mt7629-clk.h>
|
||||
|
||||
#define GATE_ETH(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = ð_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_ETH(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, ð_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
static const struct mtk_gate_regs eth_cg_regs = {
|
||||
.set_ofs = 0x30,
|
||||
@ -45,14 +39,8 @@ static const struct mtk_gate_regs sgmii_cg_regs = {
|
||||
.sta_ofs = 0xE4,
|
||||
};
|
||||
|
||||
#define GATE_SGMII(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &sgmii_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_SGMII(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &sgmii_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
static const struct mtk_gate sgmii_clks[2][4] = {
|
||||
{
|
||||
@ -138,6 +126,7 @@ static const struct of_device_id of_match_clk_mt7629_eth[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7629_eth);
|
||||
|
||||
static int clk_mt7629_eth_probe(struct platform_device *pdev)
|
||||
{
|
||||
@ -166,3 +155,4 @@ static struct platform_driver clk_mt7629_eth_drv = {
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt7629_eth_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -16,23 +16,11 @@
|
||||
|
||||
#include <dt-bindings/clock/mt7629-clk.h>
|
||||
|
||||
#define GATE_PCIE(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &pcie_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_PCIE(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &pcie_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
#define GATE_SSUSB(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &ssusb_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_SSUSB(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &ssusb_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
static const struct mtk_gate_regs pcie_cg_regs = {
|
||||
.set_ofs = 0x30,
|
||||
@ -96,6 +84,7 @@ static const struct of_device_id of_match_clk_mt7629_hif[] = {
|
||||
{ .compatible = "mediatek,mt7629-ssusbsys", .data = &ssusb_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7629_hif);
|
||||
|
||||
static struct platform_driver clk_mt7629_hif_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -105,5 +94,5 @@ static struct platform_driver clk_mt7629_hif_drv = {
|
||||
.of_match_table = of_match_clk_mt7629_hif,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt7629_hif_drv);
|
||||
module_platform_driver(clk_mt7629_hif_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -50,41 +50,17 @@
|
||||
_pd_reg, _pd_shift, _tuner_reg, _pcw_reg, _pcw_shift, \
|
||||
NULL, "clk20m")
|
||||
|
||||
#define GATE_APMIXED(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &apmixed_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_APMIXED(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &apmixed_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
#define GATE_INFRA(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &infra_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_INFRA(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &infra_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_PERI0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &peri0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_PERI0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &peri0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_PERI1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &peri1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_PERI1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &peri1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static DEFINE_SPINLOCK(mt7629_clk_lock);
|
||||
|
||||
@ -684,6 +660,7 @@ static const struct of_device_id of_match_clk_mt7629[] = {
|
||||
/* sentinel */
|
||||
}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7629);
|
||||
|
||||
static int clk_mt7629_probe(struct platform_device *pdev)
|
||||
{
|
||||
@ -717,3 +694,4 @@ static int clk_mt7629_init(void)
|
||||
}
|
||||
|
||||
arch_initcall(clk_mt7629_init);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -66,6 +66,7 @@ static const struct of_device_id of_match_clk_mt7981_apmixed[] = {
|
||||
{ .compatible = "mediatek,mt7981-apmixedsys", },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7981_apmixed);
|
||||
|
||||
static int clk_mt7981_apmixed_probe(struct platform_device *pdev)
|
||||
{
|
||||
@ -100,3 +101,4 @@ static struct platform_driver clk_mt7981_apmixed_drv = {
|
||||
},
|
||||
};
|
||||
builtin_platform_driver(clk_mt7981_apmixed_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -105,6 +105,7 @@ static const struct of_device_id of_match_clk_mt7981_eth[] = {
|
||||
{ .compatible = "mediatek,mt7981-sgmiisys_1", .data = &sgmii1_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7981_eth);
|
||||
|
||||
static struct platform_driver clk_mt7981_eth_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -115,4 +116,4 @@ static struct platform_driver clk_mt7981_eth_drv = {
|
||||
},
|
||||
};
|
||||
module_platform_driver(clk_mt7981_eth_drv);
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -195,6 +195,7 @@ static const struct of_device_id of_match_clk_mt7981_infracfg[] = {
|
||||
{ .compatible = "mediatek,mt7981-infracfg", .data = &infracfg_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7981_infracfg);
|
||||
|
||||
static struct platform_driver clk_mt7981_infracfg_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -204,4 +205,5 @@ static struct platform_driver clk_mt7981_infracfg_drv = {
|
||||
.of_match_table = of_match_clk_mt7981_infracfg,
|
||||
},
|
||||
};
|
||||
builtin_platform_driver(clk_mt7981_infracfg_drv);
|
||||
module_platform_driver(clk_mt7981_infracfg_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -410,6 +410,7 @@ static const struct of_device_id of_match_clk_mt7981_topckgen[] = {
|
||||
{ .compatible = "mediatek,mt7981-topckgen", .data = &topck_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7981_topckgen);
|
||||
|
||||
static struct platform_driver clk_mt7981_topckgen_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -419,4 +420,5 @@ static struct platform_driver clk_mt7981_topckgen_drv = {
|
||||
.of_match_table = of_match_clk_mt7981_topckgen,
|
||||
},
|
||||
};
|
||||
builtin_platform_driver(clk_mt7981_topckgen_drv);
|
||||
module_platform_driver(clk_mt7981_topckgen_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -42,7 +42,7 @@
|
||||
"clkxtal")
|
||||
|
||||
static const struct mtk_pll_data plls[] = {
|
||||
PLL(CLK_APMIXED_ARMPLL, "armpll", 0x0200, 0x020C, 0x0, 0, 32,
|
||||
PLL(CLK_APMIXED_ARMPLL, "armpll", 0x0200, 0x020C, 0x0, PLL_AO, 32,
|
||||
0x0200, 4, 0, 0x0204, 0),
|
||||
PLL(CLK_APMIXED_NET2PLL, "net2pll", 0x0210, 0x021C, 0x0, 0, 32,
|
||||
0x0210, 4, 0, 0x0214, 0),
|
||||
@ -62,8 +62,9 @@ static const struct mtk_pll_data plls[] = {
|
||||
|
||||
static const struct of_device_id of_match_clk_mt7986_apmixed[] = {
|
||||
{ .compatible = "mediatek,mt7986-apmixedsys", },
|
||||
{}
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7986_apmixed);
|
||||
|
||||
static int clk_mt7986_apmixed_probe(struct platform_device *pdev)
|
||||
{
|
||||
@ -77,8 +78,6 @@ static int clk_mt7986_apmixed_probe(struct platform_device *pdev)
|
||||
|
||||
mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
|
||||
|
||||
clk_prepare_enable(clk_data->hws[CLK_APMIXED_ARMPLL]->clk);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r) {
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
@ -100,3 +99,4 @@ static struct platform_driver clk_mt7986_apmixed_drv = {
|
||||
},
|
||||
};
|
||||
builtin_platform_driver(clk_mt7986_apmixed_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -22,14 +22,10 @@ static const struct mtk_gate_regs sgmii0_cg_regs = {
|
||||
.sta_ofs = 0xe4,
|
||||
};
|
||||
|
||||
#define GATE_SGMII0(_id, _name, _parent, _shift) \
|
||||
{ \
|
||||
.id = _id, .name = _name, .parent_name = _parent, \
|
||||
.regs = &sgmii0_cg_regs, .shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_SGMII0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &sgmii0_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
static const struct mtk_gate sgmii0_clks[] __initconst = {
|
||||
static const struct mtk_gate sgmii0_clks[] = {
|
||||
GATE_SGMII0(CLK_SGMII0_TX250M_EN, "sgmii0_tx250m_en", "top_xtal", 2),
|
||||
GATE_SGMII0(CLK_SGMII0_RX250M_EN, "sgmii0_rx250m_en", "top_xtal", 3),
|
||||
GATE_SGMII0(CLK_SGMII0_CDR_REF, "sgmii0_cdr_ref", "top_xtal", 4),
|
||||
@ -42,14 +38,10 @@ static const struct mtk_gate_regs sgmii1_cg_regs = {
|
||||
.sta_ofs = 0xe4,
|
||||
};
|
||||
|
||||
#define GATE_SGMII1(_id, _name, _parent, _shift) \
|
||||
{ \
|
||||
.id = _id, .name = _name, .parent_name = _parent, \
|
||||
.regs = &sgmii1_cg_regs, .shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_SGMII1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &sgmii1_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
static const struct mtk_gate sgmii1_clks[] __initconst = {
|
||||
static const struct mtk_gate sgmii1_clks[] = {
|
||||
GATE_SGMII1(CLK_SGMII1_TX250M_EN, "sgmii1_tx250m_en", "top_xtal", 2),
|
||||
GATE_SGMII1(CLK_SGMII1_RX250M_EN, "sgmii1_rx250m_en", "top_xtal", 3),
|
||||
GATE_SGMII1(CLK_SGMII1_CDR_REF, "sgmii1_cdr_ref", "top_xtal", 4),
|
||||
@ -62,14 +54,10 @@ static const struct mtk_gate_regs eth_cg_regs = {
|
||||
.sta_ofs = 0x30,
|
||||
};
|
||||
|
||||
#define GATE_ETH(_id, _name, _parent, _shift) \
|
||||
{ \
|
||||
.id = _id, .name = _name, .parent_name = _parent, \
|
||||
.regs = ð_cg_regs, .shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr_inv, \
|
||||
}
|
||||
#define GATE_ETH(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, ð_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
static const struct mtk_gate eth_clks[] __initconst = {
|
||||
static const struct mtk_gate eth_clks[] = {
|
||||
GATE_ETH(CLK_ETH_FE_EN, "eth_fe_en", "netsys_2x_sel", 6),
|
||||
GATE_ETH(CLK_ETH_GP2_EN, "eth_gp2_en", "sgm_325m_sel", 7),
|
||||
GATE_ETH(CLK_ETH_GP1_EN, "eth_gp1_en", "sgm_325m_sel", 8),
|
||||
@ -77,56 +65,38 @@ static const struct mtk_gate eth_clks[] __initconst = {
|
||||
GATE_ETH(CLK_ETH_WOCPU0_EN, "eth_wocpu0_en", "netsys_mcu_sel", 15),
|
||||
};
|
||||
|
||||
static void __init mtk_sgmiisys_0_init(struct device_node *node)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
static const struct mtk_clk_desc eth_desc = {
|
||||
.clks = eth_clks,
|
||||
.num_clks = ARRAY_SIZE(eth_clks),
|
||||
};
|
||||
|
||||
clk_data = mtk_alloc_clk_data(ARRAY_SIZE(sgmii0_clks));
|
||||
static const struct mtk_clk_desc sgmii0_desc = {
|
||||
.clks = sgmii0_clks,
|
||||
.num_clks = ARRAY_SIZE(sgmii0_clks),
|
||||
};
|
||||
|
||||
mtk_clk_register_gates(NULL, node, sgmii0_clks,
|
||||
ARRAY_SIZE(sgmii0_clks), clk_data);
|
||||
static const struct mtk_clk_desc sgmii1_desc = {
|
||||
.clks = sgmii1_clks,
|
||||
.num_clks = ARRAY_SIZE(sgmii1_clks),
|
||||
};
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_sgmiisys_0, "mediatek,mt7986-sgmiisys_0",
|
||||
mtk_sgmiisys_0_init);
|
||||
static const struct of_device_id of_match_clk_mt7986_eth[] = {
|
||||
{ .compatible = "mediatek,mt7986-ethsys", .data = ð_desc },
|
||||
{ .compatible = "mediatek,mt7986-sgmiisys_0", .data = &sgmii0_desc },
|
||||
{ .compatible = "mediatek,mt7986-sgmiisys_1", .data = &sgmii1_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7986_eth);
|
||||
|
||||
static void __init mtk_sgmiisys_1_init(struct device_node *node)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
static struct platform_driver clk_mt7986_eth_drv = {
|
||||
.driver = {
|
||||
.name = "clk-mt7986-eth",
|
||||
.of_match_table = of_match_clk_mt7986_eth,
|
||||
},
|
||||
.probe = mtk_clk_simple_probe,
|
||||
.remove = mtk_clk_simple_remove,
|
||||
};
|
||||
module_platform_driver(clk_mt7986_eth_drv);
|
||||
|
||||
clk_data = mtk_alloc_clk_data(ARRAY_SIZE(sgmii1_clks));
|
||||
|
||||
mtk_clk_register_gates(NULL, node, sgmii1_clks,
|
||||
ARRAY_SIZE(sgmii1_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_sgmiisys_1, "mediatek,mt7986-sgmiisys_1",
|
||||
mtk_sgmiisys_1_init);
|
||||
|
||||
static void __init mtk_ethsys_init(struct device_node *node)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(ARRAY_SIZE(eth_clks));
|
||||
|
||||
mtk_clk_register_gates(NULL, node, eth_clks, ARRAY_SIZE(eth_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_ethsys, "mediatek,mt7986-ethsys", mtk_ethsys_init);
|
||||
MODULE_DESCRIPTION("MediaTek MT7986 Ethernet clocks driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -87,26 +87,14 @@ static const struct mtk_gate_regs infra2_cg_regs = {
|
||||
.sta_ofs = 0x68,
|
||||
};
|
||||
|
||||
#define GATE_INFRA0(_id, _name, _parent, _shift) \
|
||||
{ \
|
||||
.id = _id, .name = _name, .parent_name = _parent, \
|
||||
.regs = &infra0_cg_regs, .shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_INFRA0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &infra0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_INFRA1(_id, _name, _parent, _shift) \
|
||||
{ \
|
||||
.id = _id, .name = _name, .parent_name = _parent, \
|
||||
.regs = &infra1_cg_regs, .shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_INFRA1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &infra1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_INFRA2(_id, _name, _parent, _shift) \
|
||||
{ \
|
||||
.id = _id, .name = _name, .parent_name = _parent, \
|
||||
.regs = &infra2_cg_regs, .shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_INFRA2(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &infra2_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate infra_clks[] = {
|
||||
/* INFRA0 */
|
||||
@ -169,57 +157,31 @@ static const struct mtk_gate infra_clks[] = {
|
||||
GATE_INFRA2(CLK_INFRA_IPCIEB_CK, "infra_ipcieb", "sysaxi_sel", 15),
|
||||
};
|
||||
|
||||
static int clk_mt7986_infracfg_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
int r;
|
||||
void __iomem *base;
|
||||
int nr = ARRAY_SIZE(infra_divs) + ARRAY_SIZE(infra_muxes) +
|
||||
ARRAY_SIZE(infra_clks);
|
||||
|
||||
base = of_iomap(node, 0);
|
||||
if (!base) {
|
||||
pr_err("%s(): ioremap failed\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
clk_data = mtk_alloc_clk_data(nr);
|
||||
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data);
|
||||
mtk_clk_register_muxes(&pdev->dev, infra_muxes,
|
||||
ARRAY_SIZE(infra_muxes), node,
|
||||
&mt7986_clk_lock, clk_data);
|
||||
mtk_clk_register_gates(&pdev->dev, node, infra_clks,
|
||||
ARRAY_SIZE(infra_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r) {
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
goto free_infracfg_data;
|
||||
}
|
||||
return r;
|
||||
|
||||
free_infracfg_data:
|
||||
mtk_free_clk_data(clk_data);
|
||||
return r;
|
||||
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt7986_infracfg[] = {
|
||||
{ .compatible = "mediatek,mt7986-infracfg", },
|
||||
{}
|
||||
static const struct mtk_clk_desc infra_desc = {
|
||||
.clks = infra_clks,
|
||||
.num_clks = ARRAY_SIZE(infra_clks),
|
||||
.factor_clks = infra_divs,
|
||||
.num_factor_clks = ARRAY_SIZE(infra_divs),
|
||||
.mux_clks = infra_muxes,
|
||||
.num_mux_clks = ARRAY_SIZE(infra_muxes),
|
||||
.clk_lock = &mt7986_clk_lock,
|
||||
};
|
||||
|
||||
static const struct of_device_id of_match_clk_mt7986_infracfg[] = {
|
||||
{ .compatible = "mediatek,mt7986-infracfg", .data = &infra_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7986_infracfg);
|
||||
|
||||
static struct platform_driver clk_mt7986_infracfg_drv = {
|
||||
.probe = clk_mt7986_infracfg_probe,
|
||||
.driver = {
|
||||
.name = "clk-mt7986-infracfg",
|
||||
.of_match_table = of_match_clk_mt7986_infracfg,
|
||||
},
|
||||
.probe = mtk_clk_simple_probe,
|
||||
.remove = mtk_clk_simple_remove,
|
||||
};
|
||||
builtin_platform_driver(clk_mt7986_infracfg_drv);
|
||||
module_platform_driver(clk_mt7986_infracfg_drv);
|
||||
|
||||
MODULE_DESCRIPTION("MediaTek MT7986 infracfg clocks driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -304,6 +304,7 @@ static const struct of_device_id of_match_clk_mt7986_topckgen[] = {
|
||||
{ .compatible = "mediatek,mt7986-topckgen", .data = &topck_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt7986_topckgen);
|
||||
|
||||
static struct platform_driver clk_mt7986_topckgen_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
@ -313,4 +314,5 @@ static struct platform_driver clk_mt7986_topckgen_drv = {
|
||||
.of_match_table = of_match_clk_mt7986_topckgen,
|
||||
},
|
||||
};
|
||||
builtin_platform_driver(clk_mt7986_topckgen_drv);
|
||||
module_platform_driver(clk_mt7986_topckgen_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
105
drivers/clk/mediatek/clk-mt8135-apmixedsys.c
Normal file
105
drivers/clk/mediatek/clk-mt8135-apmixedsys.c
Normal file
@ -0,0 +1,105 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2014 MediaTek Inc.
|
||||
* James Liao <jamesjj.liao@mediatek.com>
|
||||
* Copyright (c) 2023 Collabora, Ltd.
|
||||
* AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
|
||||
*/
|
||||
|
||||
#include <dt-bindings/clock/mt8135-clk.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-pll.h"
|
||||
|
||||
#define MT8135_PLL_FMAX (2000 * MHZ)
|
||||
#define CON0_MT8135_RST_BAR BIT(27)
|
||||
|
||||
#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, _pd_reg, _pd_shift, _tuner_reg, _pcw_reg, _pcw_shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.reg = _reg, \
|
||||
.pwr_reg = _pwr_reg, \
|
||||
.en_mask = _en_mask, \
|
||||
.flags = _flags, \
|
||||
.rst_bar_mask = CON0_MT8135_RST_BAR, \
|
||||
.fmax = MT8135_PLL_FMAX, \
|
||||
.pcwbits = _pcwbits, \
|
||||
.pd_reg = _pd_reg, \
|
||||
.pd_shift = _pd_shift, \
|
||||
.tuner_reg = _tuner_reg, \
|
||||
.pcw_reg = _pcw_reg, \
|
||||
.pcw_shift = _pcw_shift, \
|
||||
}
|
||||
|
||||
static const struct mtk_pll_data plls[] = {
|
||||
PLL(CLK_APMIXED_ARMPLL1, "armpll1", 0x200, 0x218, 0x80000000, 0, 21, 0x204, 24, 0x0, 0x204, 0),
|
||||
PLL(CLK_APMIXED_ARMPLL2, "armpll2", 0x2cc, 0x2e4, 0x80000000, 0, 21, 0x2d0, 24, 0x0, 0x2d0, 0),
|
||||
PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x21c, 0x234, 0xf0000000, HAVE_RST_BAR, 21, 0x21c, 6, 0x0, 0x220, 0),
|
||||
PLL(CLK_APMIXED_UNIVPLL, "univpll", 0x238, 0x250, 0xf3000000, HAVE_RST_BAR, 7, 0x238, 6, 0x0, 0x238, 9),
|
||||
PLL(CLK_APMIXED_MMPLL, "mmpll", 0x254, 0x26c, 0xf0000000, HAVE_RST_BAR, 21, 0x254, 6, 0x0, 0x258, 0),
|
||||
PLL(CLK_APMIXED_MSDCPLL, "msdcpll", 0x278, 0x290, 0x80000000, 0, 21, 0x278, 6, 0x0, 0x27c, 0),
|
||||
PLL(CLK_APMIXED_TVDPLL, "tvdpll", 0x294, 0x2ac, 0x80000000, 0, 31, 0x294, 6, 0x0, 0x298, 0),
|
||||
PLL(CLK_APMIXED_LVDSPLL, "lvdspll", 0x2b0, 0x2c8, 0x80000000, 0, 21, 0x2b0, 6, 0x0, 0x2b4, 0),
|
||||
PLL(CLK_APMIXED_AUDPLL, "audpll", 0x2e8, 0x300, 0x80000000, 0, 31, 0x2e8, 6, 0x2f8, 0x2ec, 0),
|
||||
PLL(CLK_APMIXED_VDECPLL, "vdecpll", 0x304, 0x31c, 0x80000000, 0, 21, 0x2b0, 6, 0x0, 0x308, 0),
|
||||
};
|
||||
|
||||
static int clk_mt8135_apmixed_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
int ret;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (ret)
|
||||
goto unregister_plls;
|
||||
|
||||
return 0;
|
||||
|
||||
unregister_plls:
|
||||
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int clk_mt8135_apmixed_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
|
||||
|
||||
of_clk_del_provider(node);
|
||||
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
|
||||
mtk_free_clk_data(clk_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt8135_apmixed[] = {
|
||||
{ .compatible = "mediatek,mt8135-apmixedsys" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt8135_apmixed);
|
||||
|
||||
static struct platform_driver clk_mt8135_apmixed_drv = {
|
||||
.probe = clk_mt8135_apmixed_probe,
|
||||
.remove = clk_mt8135_apmixed_remove,
|
||||
.driver = {
|
||||
.name = "clk-mt8135-apmixed",
|
||||
.of_match_table = of_match_clk_mt8135_apmixed,
|
||||
},
|
||||
};
|
||||
module_platform_driver(clk_mt8135_apmixed_drv)
|
||||
|
||||
MODULE_DESCRIPTION("MediaTek MT8135 apmixedsys clocks driver");
|
||||
MODULE_LICENSE("GPL");
|
@ -5,8 +5,10 @@
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <dt-bindings/clock/mt8135-clk.h>
|
||||
@ -17,14 +19,13 @@
|
||||
|
||||
static DEFINE_SPINLOCK(mt8135_clk_lock);
|
||||
|
||||
static const struct mtk_fixed_factor root_clk_alias[] __initconst = {
|
||||
static const struct mtk_fixed_factor top_divs[] = {
|
||||
FACTOR(CLK_DUMMY, "top_divs_dummy", "clk_null", 1, 1),
|
||||
FACTOR(CLK_TOP_DSI0_LNTC_DSICLK, "dsi0_lntc_dsiclk", "clk_null", 1, 1),
|
||||
FACTOR(CLK_TOP_HDMITX_CLKDIG_CTS, "hdmitx_clkdig_cts", "clk_null", 1, 1),
|
||||
FACTOR(CLK_TOP_CLKPH_MCK, "clkph_mck", "clk_null", 1, 1),
|
||||
FACTOR(CLK_TOP_CPUM_TCK_IN, "cpum_tck_in", "clk_null", 1, 1),
|
||||
};
|
||||
|
||||
static const struct mtk_fixed_factor top_divs[] __initconst = {
|
||||
FACTOR(CLK_TOP_MAINPLL_806M, "mainpll_806m", "mainpll", 1, 2),
|
||||
FACTOR(CLK_TOP_MAINPLL_537P3M, "mainpll_537p3m", "mainpll", 1, 3),
|
||||
FACTOR(CLK_TOP_MAINPLL_322P4M, "mainpll_322p4m", "mainpll", 1, 5),
|
||||
@ -100,7 +101,7 @@ static const struct mtk_fixed_factor top_divs[] __initconst = {
|
||||
FACTOR(CLK_TOP_MEMPLL_MCK_D4, "mempll_mck_d4", "clkph_mck", 1, 4),
|
||||
};
|
||||
|
||||
static const char * const axi_parents[] __initconst = {
|
||||
static const char * const axi_parents[] = {
|
||||
"clk26m",
|
||||
"syspll_d3",
|
||||
"syspll_d4",
|
||||
@ -110,7 +111,7 @@ static const char * const axi_parents[] __initconst = {
|
||||
"syspll_d3p5"
|
||||
};
|
||||
|
||||
static const char * const smi_parents[] __initconst = {
|
||||
static const char * const smi_parents[] = {
|
||||
"clk26m",
|
||||
"clkph_mck",
|
||||
"syspll_d2p5",
|
||||
@ -128,7 +129,7 @@ static const char * const smi_parents[] __initconst = {
|
||||
"lvdspll"
|
||||
};
|
||||
|
||||
static const char * const mfg_parents[] __initconst = {
|
||||
static const char * const mfg_parents[] = {
|
||||
"clk26m",
|
||||
"univpll1_d4",
|
||||
"syspll_d2",
|
||||
@ -144,13 +145,13 @@ static const char * const mfg_parents[] __initconst = {
|
||||
"mmpll_d7"
|
||||
};
|
||||
|
||||
static const char * const irda_parents[] __initconst = {
|
||||
static const char * const irda_parents[] = {
|
||||
"clk26m",
|
||||
"univpll2_d8",
|
||||
"univpll1_d6"
|
||||
};
|
||||
|
||||
static const char * const cam_parents[] __initconst = {
|
||||
static const char * const cam_parents[] = {
|
||||
"clk26m",
|
||||
"syspll_d3",
|
||||
"syspll_d3p5",
|
||||
@ -161,13 +162,13 @@ static const char * const cam_parents[] __initconst = {
|
||||
"univpll1_d4"
|
||||
};
|
||||
|
||||
static const char * const aud_intbus_parents[] __initconst = {
|
||||
static const char * const aud_intbus_parents[] = {
|
||||
"clk26m",
|
||||
"syspll_d6",
|
||||
"univpll_d10"
|
||||
};
|
||||
|
||||
static const char * const jpg_parents[] __initconst = {
|
||||
static const char * const jpg_parents[] = {
|
||||
"clk26m",
|
||||
"syspll_d5",
|
||||
"syspll_d4",
|
||||
@ -177,7 +178,7 @@ static const char * const jpg_parents[] __initconst = {
|
||||
"univpll_d5"
|
||||
};
|
||||
|
||||
static const char * const disp_parents[] __initconst = {
|
||||
static const char * const disp_parents[] = {
|
||||
"clk26m",
|
||||
"syspll_d3p5",
|
||||
"syspll_d3",
|
||||
@ -188,7 +189,7 @@ static const char * const disp_parents[] __initconst = {
|
||||
"vdecpll"
|
||||
};
|
||||
|
||||
static const char * const msdc30_parents[] __initconst = {
|
||||
static const char * const msdc30_parents[] = {
|
||||
"clk26m",
|
||||
"syspll_d6",
|
||||
"syspll_d5",
|
||||
@ -197,13 +198,13 @@ static const char * const msdc30_parents[] __initconst = {
|
||||
"msdcpll"
|
||||
};
|
||||
|
||||
static const char * const usb20_parents[] __initconst = {
|
||||
static const char * const usb20_parents[] = {
|
||||
"clk26m",
|
||||
"univpll2_d6",
|
||||
"univpll1_d10"
|
||||
};
|
||||
|
||||
static const char * const venc_parents[] __initconst = {
|
||||
static const char * const venc_parents[] = {
|
||||
"clk26m",
|
||||
"syspll_d3",
|
||||
"syspll_d8",
|
||||
@ -214,7 +215,7 @@ static const char * const venc_parents[] __initconst = {
|
||||
"mmpll_d6"
|
||||
};
|
||||
|
||||
static const char * const spi_parents[] __initconst = {
|
||||
static const char * const spi_parents[] = {
|
||||
"clk26m",
|
||||
"syspll_d6",
|
||||
"syspll_d8",
|
||||
@ -223,17 +224,17 @@ static const char * const spi_parents[] __initconst = {
|
||||
"univpll1_d8"
|
||||
};
|
||||
|
||||
static const char * const uart_parents[] __initconst = {
|
||||
static const char * const uart_parents[] = {
|
||||
"clk26m",
|
||||
"univpll2_d8"
|
||||
};
|
||||
|
||||
static const char * const mem_parents[] __initconst = {
|
||||
static const char * const mem_parents[] = {
|
||||
"clk26m",
|
||||
"clkph_mck"
|
||||
};
|
||||
|
||||
static const char * const camtg_parents[] __initconst = {
|
||||
static const char * const camtg_parents[] = {
|
||||
"clk26m",
|
||||
"univpll_d26",
|
||||
"univpll1_d6",
|
||||
@ -241,12 +242,12 @@ static const char * const camtg_parents[] __initconst = {
|
||||
"syspll_d8"
|
||||
};
|
||||
|
||||
static const char * const audio_parents[] __initconst = {
|
||||
static const char * const audio_parents[] = {
|
||||
"clk26m",
|
||||
"syspll_d24"
|
||||
};
|
||||
|
||||
static const char * const fix_parents[] __initconst = {
|
||||
static const char * const fix_parents[] = {
|
||||
"rtc32k",
|
||||
"clk26m",
|
||||
"univpll_d5",
|
||||
@ -257,7 +258,7 @@ static const char * const fix_parents[] __initconst = {
|
||||
"univpll1_d8"
|
||||
};
|
||||
|
||||
static const char * const vdec_parents[] __initconst = {
|
||||
static const char * const vdec_parents[] = {
|
||||
"clk26m",
|
||||
"vdecpll",
|
||||
"clkph_mck",
|
||||
@ -276,13 +277,13 @@ static const char * const vdec_parents[] __initconst = {
|
||||
"lvdspll"
|
||||
};
|
||||
|
||||
static const char * const ddrphycfg_parents[] __initconst = {
|
||||
static const char * const ddrphycfg_parents[] = {
|
||||
"clk26m",
|
||||
"axi_sel",
|
||||
"syspll_d12"
|
||||
};
|
||||
|
||||
static const char * const dpilvds_parents[] __initconst = {
|
||||
static const char * const dpilvds_parents[] = {
|
||||
"clk26m",
|
||||
"lvdspll",
|
||||
"lvdspll_d2",
|
||||
@ -290,7 +291,7 @@ static const char * const dpilvds_parents[] __initconst = {
|
||||
"lvdspll_d8"
|
||||
};
|
||||
|
||||
static const char * const pmicspi_parents[] __initconst = {
|
||||
static const char * const pmicspi_parents[] = {
|
||||
"clk26m",
|
||||
"univpll2_d6",
|
||||
"syspll_d8",
|
||||
@ -301,14 +302,14 @@ static const char * const pmicspi_parents[] __initconst = {
|
||||
"syspll_d24"
|
||||
};
|
||||
|
||||
static const char * const smi_mfg_as_parents[] __initconst = {
|
||||
static const char * const smi_mfg_as_parents[] = {
|
||||
"clk26m",
|
||||
"smi_sel",
|
||||
"mfg_sel",
|
||||
"mem_sel"
|
||||
};
|
||||
|
||||
static const char * const gcpu_parents[] __initconst = {
|
||||
static const char * const gcpu_parents[] = {
|
||||
"clk26m",
|
||||
"syspll_d4",
|
||||
"univpll_d7",
|
||||
@ -316,14 +317,14 @@ static const char * const gcpu_parents[] __initconst = {
|
||||
"syspll_d6"
|
||||
};
|
||||
|
||||
static const char * const dpi1_parents[] __initconst = {
|
||||
static const char * const dpi1_parents[] = {
|
||||
"clk26m",
|
||||
"tvhdmi_h_ck",
|
||||
"tvhdmi_d2",
|
||||
"tvhdmi_d4"
|
||||
};
|
||||
|
||||
static const char * const cci_parents[] __initconst = {
|
||||
static const char * const cci_parents[] = {
|
||||
"clk26m",
|
||||
"mainpll_537p3m",
|
||||
"univpll_d3",
|
||||
@ -332,7 +333,7 @@ static const char * const cci_parents[] __initconst = {
|
||||
"syspll_d5"
|
||||
};
|
||||
|
||||
static const char * const apll_parents[] __initconst = {
|
||||
static const char * const apll_parents[] = {
|
||||
"clk26m",
|
||||
"apll_ck",
|
||||
"apll_d4",
|
||||
@ -341,14 +342,14 @@ static const char * const apll_parents[] __initconst = {
|
||||
"apll_d24"
|
||||
};
|
||||
|
||||
static const char * const hdmipll_parents[] __initconst = {
|
||||
static const char * const hdmipll_parents[] = {
|
||||
"clk26m",
|
||||
"hdmitx_clkdig_cts",
|
||||
"hdmitx_clkdig_d2",
|
||||
"hdmitx_clkdig_d3"
|
||||
};
|
||||
|
||||
static const struct mtk_composite top_muxes[] __initconst = {
|
||||
static const struct mtk_composite top_muxes[] = {
|
||||
/* CLK_CFG_0 */
|
||||
MUX_GATE(CLK_TOP_AXI_SEL, "axi_sel", axi_parents,
|
||||
0x0140, 0, 3, INVALID_MUX_GATE_BIT),
|
||||
@ -390,7 +391,7 @@ static const struct mtk_composite top_muxes[] __initconst = {
|
||||
MUX_GATE(CLK_TOP_GCPU_SEL, "gcpu_sel", gcpu_parents, 0x0164, 24, 3, 31),
|
||||
/* CLK_CFG_9 */
|
||||
MUX_GATE(CLK_TOP_DPI1_SEL, "dpi1_sel", dpi1_parents, 0x0168, 0, 2, 7),
|
||||
MUX_GATE(CLK_TOP_CCI_SEL, "cci_sel", cci_parents, 0x0168, 8, 3, 15),
|
||||
MUX_GATE_FLAGS(CLK_TOP_CCI_SEL, "cci_sel", cci_parents, 0x0168, 8, 3, 15, CLK_IS_CRITICAL),
|
||||
MUX_GATE(CLK_TOP_APLL_SEL, "apll_sel", apll_parents, 0x0168, 16, 3, 23),
|
||||
MUX_GATE(CLK_TOP_HDMIPLL_SEL, "hdmipll_sel", hdmipll_parents, 0x0168, 24, 2, 31),
|
||||
};
|
||||
@ -401,23 +402,22 @@ static const struct mtk_gate_regs infra_cg_regs = {
|
||||
.sta_ofs = 0x0048,
|
||||
};
|
||||
|
||||
#define GATE_ICG(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &infra_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_ICG(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &infra_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate infra_clks[] __initconst = {
|
||||
#define GATE_ICG_AO(_id, _name, _parent, _shift) \
|
||||
GATE_MTK_FLAGS(_id, _name, _parent, &infra_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_setclr, CLK_IS_CRITICAL)
|
||||
|
||||
static const struct mtk_gate infra_clks[] = {
|
||||
GATE_DUMMY(CLK_DUMMY, "infra_dummy"),
|
||||
GATE_ICG(CLK_INFRA_PMIC_WRAP, "pmic_wrap_ck", "axi_sel", 23),
|
||||
GATE_ICG(CLK_INFRA_PMICSPI, "pmicspi_ck", "pmicspi_sel", 22),
|
||||
GATE_ICG(CLK_INFRA_CCIF1_AP_CTRL, "ccif1_ap_ctrl", "axi_sel", 21),
|
||||
GATE_ICG(CLK_INFRA_CCIF0_AP_CTRL, "ccif0_ap_ctrl", "axi_sel", 20),
|
||||
GATE_ICG(CLK_INFRA_KP, "kp_ck", "axi_sel", 16),
|
||||
GATE_ICG(CLK_INFRA_CPUM, "cpum_ck", "cpum_tck_in", 15),
|
||||
GATE_ICG(CLK_INFRA_M4U, "m4u_ck", "mem_sel", 8),
|
||||
GATE_ICG_AO(CLK_INFRA_M4U, "m4u_ck", "mem_sel", 8),
|
||||
GATE_ICG(CLK_INFRA_MFGAXI, "mfgaxi_ck", "axi_sel", 7),
|
||||
GATE_ICG(CLK_INFRA_DEVAPC, "devapc_ck", "axi_sel", 6),
|
||||
GATE_ICG(CLK_INFRA_AUDIO, "audio_ck", "aud_intbus_sel", 5),
|
||||
@ -438,25 +438,14 @@ static const struct mtk_gate_regs peri1_cg_regs = {
|
||||
.sta_ofs = 0x001c,
|
||||
};
|
||||
|
||||
#define GATE_PERI0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &peri0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_PERI0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &peri0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_PERI1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &peri1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_PERI1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &peri1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate peri_gates[] __initconst = {
|
||||
static const struct mtk_gate peri_gates[] = {
|
||||
GATE_DUMMY(CLK_DUMMY, "peri_dummy"),
|
||||
/* PERI0 */
|
||||
GATE_PERI0(CLK_PERI_I2C5, "i2c5_ck", "axi_sel", 31),
|
||||
GATE_PERI0(CLK_PERI_I2C4, "i2c4_ck", "axi_sel", 30),
|
||||
@ -502,12 +491,12 @@ static const struct mtk_gate peri_gates[] __initconst = {
|
||||
GATE_PERI1(CLK_PERI_I2C6, "i2c6_ck", "axi_sel", 0),
|
||||
};
|
||||
|
||||
static const char * const uart_ck_sel_parents[] __initconst = {
|
||||
static const char * const uart_ck_sel_parents[] = {
|
||||
"clk26m",
|
||||
"uart_sel",
|
||||
};
|
||||
|
||||
static const struct mtk_composite peri_clks[] __initconst = {
|
||||
static const struct mtk_composite peri_clks[] = {
|
||||
MUX(CLK_PERI_UART0_SEL, "uart0_ck_sel", uart_ck_sel_parents, 0x40c, 0, 1),
|
||||
MUX(CLK_PERI_UART1_SEL, "uart1_ck_sel", uart_ck_sel_parents, 0x40c, 1, 1),
|
||||
MUX(CLK_PERI_UART2_SEL, "uart2_ck_sel", uart_ck_sel_parents, 0x40c, 2, 1),
|
||||
@ -532,127 +521,46 @@ static const struct mtk_clk_rst_desc clk_rst_desc[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static void __init mtk_topckgen_init(struct device_node *node)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
void __iomem *base;
|
||||
int r;
|
||||
|
||||
base = of_iomap(node, 0);
|
||||
if (!base) {
|
||||
pr_err("%s(): ioremap failed\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_TOP_NR_CLK);
|
||||
|
||||
mtk_clk_register_factors(root_clk_alias, ARRAY_SIZE(root_clk_alias), clk_data);
|
||||
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data);
|
||||
mtk_clk_register_composites(NULL, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), base,
|
||||
&mt8135_clk_lock, clk_data);
|
||||
|
||||
clk_prepare_enable(clk_data->hws[CLK_TOP_CCI_SEL]->clk);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_topckgen, "mediatek,mt8135-topckgen", mtk_topckgen_init);
|
||||
|
||||
static void __init mtk_infrasys_init(struct device_node *node)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_INFRA_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(NULL, node, infra_clks,
|
||||
ARRAY_SIZE(infra_clks), clk_data);
|
||||
|
||||
clk_prepare_enable(clk_data->hws[CLK_INFRA_M4U]->clk);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
|
||||
mtk_register_reset_controller(node, &clk_rst_desc[0]);
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_infrasys, "mediatek,mt8135-infracfg", mtk_infrasys_init);
|
||||
|
||||
static void __init mtk_pericfg_init(struct device_node *node)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
void __iomem *base;
|
||||
|
||||
base = of_iomap(node, 0);
|
||||
if (!base) {
|
||||
pr_err("%s(): ioremap failed\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_PERI_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(NULL, node, peri_gates,
|
||||
ARRAY_SIZE(peri_gates), clk_data);
|
||||
mtk_clk_register_composites(NULL, peri_clks,
|
||||
ARRAY_SIZE(peri_clks), base,
|
||||
&mt8135_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
|
||||
mtk_register_reset_controller(node, &clk_rst_desc[1]);
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_pericfg, "mediatek,mt8135-pericfg", mtk_pericfg_init);
|
||||
|
||||
#define MT8135_PLL_FMAX (2000 * MHZ)
|
||||
#define CON0_MT8135_RST_BAR BIT(27)
|
||||
|
||||
#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, _pd_reg, _pd_shift, _tuner_reg, _pcw_reg, _pcw_shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.reg = _reg, \
|
||||
.pwr_reg = _pwr_reg, \
|
||||
.en_mask = _en_mask, \
|
||||
.flags = _flags, \
|
||||
.rst_bar_mask = CON0_MT8135_RST_BAR, \
|
||||
.fmax = MT8135_PLL_FMAX, \
|
||||
.pcwbits = _pcwbits, \
|
||||
.pd_reg = _pd_reg, \
|
||||
.pd_shift = _pd_shift, \
|
||||
.tuner_reg = _tuner_reg, \
|
||||
.pcw_reg = _pcw_reg, \
|
||||
.pcw_shift = _pcw_shift, \
|
||||
}
|
||||
|
||||
static const struct mtk_pll_data plls[] = {
|
||||
PLL(CLK_APMIXED_ARMPLL1, "armpll1", 0x200, 0x218, 0x80000000, 0, 21, 0x204, 24, 0x0, 0x204, 0),
|
||||
PLL(CLK_APMIXED_ARMPLL2, "armpll2", 0x2cc, 0x2e4, 0x80000000, 0, 21, 0x2d0, 24, 0x0, 0x2d0, 0),
|
||||
PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x21c, 0x234, 0xf0000000, HAVE_RST_BAR, 21, 0x21c, 6, 0x0, 0x220, 0),
|
||||
PLL(CLK_APMIXED_UNIVPLL, "univpll", 0x238, 0x250, 0xf3000000, HAVE_RST_BAR, 7, 0x238, 6, 0x0, 0x238, 9),
|
||||
PLL(CLK_APMIXED_MMPLL, "mmpll", 0x254, 0x26c, 0xf0000000, HAVE_RST_BAR, 21, 0x254, 6, 0x0, 0x258, 0),
|
||||
PLL(CLK_APMIXED_MSDCPLL, "msdcpll", 0x278, 0x290, 0x80000000, 0, 21, 0x278, 6, 0x0, 0x27c, 0),
|
||||
PLL(CLK_APMIXED_TVDPLL, "tvdpll", 0x294, 0x2ac, 0x80000000, 0, 31, 0x294, 6, 0x0, 0x298, 0),
|
||||
PLL(CLK_APMIXED_LVDSPLL, "lvdspll", 0x2b0, 0x2c8, 0x80000000, 0, 21, 0x2b0, 6, 0x0, 0x2b4, 0),
|
||||
PLL(CLK_APMIXED_AUDPLL, "audpll", 0x2e8, 0x300, 0x80000000, 0, 31, 0x2e8, 6, 0x2f8, 0x2ec, 0),
|
||||
PLL(CLK_APMIXED_VDECPLL, "vdecpll", 0x304, 0x31c, 0x80000000, 0, 21, 0x2b0, 6, 0x0, 0x308, 0),
|
||||
static const struct mtk_clk_desc infra_desc = {
|
||||
.clks = infra_clks,
|
||||
.num_clks = ARRAY_SIZE(infra_clks),
|
||||
.rst_desc = &clk_rst_desc[0],
|
||||
};
|
||||
|
||||
static void __init mtk_apmixedsys_init(struct device_node *node)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
static const struct mtk_clk_desc peri_desc = {
|
||||
.clks = peri_gates,
|
||||
.num_clks = ARRAY_SIZE(peri_gates),
|
||||
.composite_clks = peri_clks,
|
||||
.num_composite_clks = ARRAY_SIZE(peri_clks),
|
||||
.clk_lock = &mt8135_clk_lock,
|
||||
.rst_desc = &clk_rst_desc[1],
|
||||
};
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK);
|
||||
if (!clk_data)
|
||||
return;
|
||||
static const struct mtk_clk_desc topck_desc = {
|
||||
.factor_clks = top_divs,
|
||||
.num_factor_clks = ARRAY_SIZE(top_divs),
|
||||
.composite_clks = top_muxes,
|
||||
.num_composite_clks = ARRAY_SIZE(top_muxes),
|
||||
.clk_lock = &mt8135_clk_lock,
|
||||
};
|
||||
|
||||
mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_apmixedsys, "mediatek,mt8135-apmixedsys",
|
||||
mtk_apmixedsys_init);
|
||||
static const struct of_device_id of_match_clk_mt8135[] = {
|
||||
{ .compatible = "mediatek,mt8135-infracfg", .data = &infra_desc },
|
||||
{ .compatible = "mediatek,mt8135-pericfg", .data = &peri_desc },
|
||||
{ .compatible = "mediatek,mt8135-topckgen", .data = &topck_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt8135);
|
||||
|
||||
static struct platform_driver clk_mt8135_drv = {
|
||||
.driver = {
|
||||
.name = "clk-mt8135",
|
||||
.of_match_table = of_match_clk_mt8135,
|
||||
},
|
||||
.probe = mtk_clk_simple_probe,
|
||||
.remove = mtk_clk_simple_remove,
|
||||
};
|
||||
module_platform_driver(clk_mt8135_drv);
|
||||
|
||||
MODULE_DESCRIPTION("MediaTek MT8135 clocks driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
145
drivers/clk/mediatek/clk-mt8167-apmixedsys.c
Normal file
145
drivers/clk/mediatek/clk-mt8167-apmixedsys.c
Normal file
@ -0,0 +1,145 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (c) 2020 MediaTek Inc.
|
||||
* Copyright (c) 2020 BayLibre, SAS
|
||||
* Copyright (c) 2023 Collabora, Ltd.
|
||||
*/
|
||||
|
||||
#include <dt-bindings/clock/mt8167-clk.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-pll.h"
|
||||
#include "clk-mtk.h"
|
||||
|
||||
static DEFINE_SPINLOCK(mt8167_apmixed_clk_lock);
|
||||
|
||||
#define MT8167_PLL_FMAX (2500UL * MHZ)
|
||||
|
||||
#define CON0_MT8167_RST_BAR BIT(27)
|
||||
|
||||
#define PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
|
||||
_pd_reg, _pd_shift, _tuner_reg, _pcw_reg, \
|
||||
_pcw_shift, _div_table) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.reg = _reg, \
|
||||
.pwr_reg = _pwr_reg, \
|
||||
.en_mask = _en_mask, \
|
||||
.flags = _flags, \
|
||||
.rst_bar_mask = CON0_MT8167_RST_BAR, \
|
||||
.fmax = MT8167_PLL_FMAX, \
|
||||
.pcwbits = _pcwbits, \
|
||||
.pd_reg = _pd_reg, \
|
||||
.pd_shift = _pd_shift, \
|
||||
.tuner_reg = _tuner_reg, \
|
||||
.pcw_reg = _pcw_reg, \
|
||||
.pcw_shift = _pcw_shift, \
|
||||
.div_table = _div_table, \
|
||||
}
|
||||
|
||||
#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
|
||||
_pd_reg, _pd_shift, _tuner_reg, _pcw_reg, \
|
||||
_pcw_shift) \
|
||||
PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
|
||||
_pd_reg, _pd_shift, _tuner_reg, _pcw_reg, _pcw_shift, \
|
||||
NULL)
|
||||
|
||||
static const struct mtk_pll_div_table mmpll_div_table[] = {
|
||||
{ .div = 0, .freq = MT8167_PLL_FMAX },
|
||||
{ .div = 1, .freq = 1000000000 },
|
||||
{ .div = 2, .freq = 604500000 },
|
||||
{ .div = 3, .freq = 253500000 },
|
||||
{ .div = 4, .freq = 126750000 },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static const struct mtk_pll_data plls[] = {
|
||||
PLL(CLK_APMIXED_ARMPLL, "armpll", 0x0100, 0x0110, 0, 0,
|
||||
21, 0x0104, 24, 0, 0x0104, 0),
|
||||
PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x0120, 0x0130, 0,
|
||||
HAVE_RST_BAR, 21, 0x0124, 24, 0, 0x0124, 0),
|
||||
PLL(CLK_APMIXED_UNIVPLL, "univpll", 0x0140, 0x0150, 0x30000000,
|
||||
HAVE_RST_BAR, 7, 0x0144, 24, 0, 0x0144, 0),
|
||||
PLL_B(CLK_APMIXED_MMPLL, "mmpll", 0x0160, 0x0170, 0, 0,
|
||||
21, 0x0164, 24, 0, 0x0164, 0, mmpll_div_table),
|
||||
PLL(CLK_APMIXED_APLL1, "apll1", 0x0180, 0x0190, 0, 0,
|
||||
31, 0x0180, 1, 0x0194, 0x0184, 0),
|
||||
PLL(CLK_APMIXED_APLL2, "apll2", 0x01A0, 0x01B0, 0, 0,
|
||||
31, 0x01A0, 1, 0x01B4, 0x01A4, 0),
|
||||
PLL(CLK_APMIXED_TVDPLL, "tvdpll", 0x01C0, 0x01D0, 0, 0,
|
||||
21, 0x01C4, 24, 0, 0x01C4, 0),
|
||||
PLL(CLK_APMIXED_LVDSPLL, "lvdspll", 0x01E0, 0x01F0, 0, 0,
|
||||
21, 0x01E4, 24, 0, 0x01E4, 0),
|
||||
};
|
||||
|
||||
#define DIV_ADJ_FLAG(_id, _name, _parent, _reg, _shift, _width, _flag) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.div_reg = _reg, \
|
||||
.div_shift = _shift, \
|
||||
.div_width = _width, \
|
||||
.clk_divider_flags = _flag, \
|
||||
}
|
||||
|
||||
static const struct mtk_clk_divider adj_divs[] = {
|
||||
DIV_ADJ_FLAG(CLK_APMIXED_HDMI_REF, "hdmi_ref", "tvdpll",
|
||||
0x1c4, 24, 3, CLK_DIVIDER_POWER_OF_TWO),
|
||||
};
|
||||
|
||||
static int clk_mt8167_apmixed_probe(struct platform_device *pdev)
|
||||
{
|
||||
void __iomem *base;
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
struct device *dev = &pdev->dev;
|
||||
int ret;
|
||||
|
||||
base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(base))
|
||||
return PTR_ERR(base);
|
||||
|
||||
clk_data = mtk_devm_alloc_clk_data(dev, MT8167_CLK_APMIXED_NR_CLK);
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = mtk_clk_register_dividers(dev, adj_divs, ARRAY_SIZE(adj_divs), base,
|
||||
&mt8167_apmixed_clk_lock, clk_data);
|
||||
if (ret)
|
||||
goto unregister_plls;
|
||||
|
||||
ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (ret)
|
||||
goto unregister_dividers;
|
||||
|
||||
return 0;
|
||||
|
||||
unregister_dividers:
|
||||
mtk_clk_unregister_dividers(adj_divs, ARRAY_SIZE(adj_divs), clk_data);
|
||||
unregister_plls:
|
||||
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt8167_apmixed[] = {
|
||||
{ .compatible = "mediatek,mt8167-apmixedsys" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt8167_apmixed);
|
||||
|
||||
static struct platform_driver clk_mt8167_apmixed_drv = {
|
||||
.probe = clk_mt8167_apmixed_probe,
|
||||
.driver = {
|
||||
.name = "clk-mt8167-apmixed",
|
||||
.of_match_table = of_match_clk_mt8167_apmixed,
|
||||
},
|
||||
};
|
||||
builtin_platform_driver(clk_mt8167_apmixed_drv)
|
||||
MODULE_LICENSE("GPL");
|
@ -23,16 +23,11 @@ static const struct mtk_gate_regs aud_cg_regs = {
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#define GATE_AUD(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &aud_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_AUD(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &aud_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
static const struct mtk_gate aud_clks[] __initconst = {
|
||||
|
||||
static const struct mtk_gate aud_clks[] = {
|
||||
GATE_AUD(CLK_AUD_AFE, "aud_afe", "clk26m_ck", 2),
|
||||
GATE_AUD(CLK_AUD_I2S, "aud_i2s", "i2s_infra_bck", 6),
|
||||
GATE_AUD(CLK_AUD_22M, "aud_22m", "rg_aud_engen1", 8),
|
||||
@ -48,19 +43,24 @@ static const struct mtk_gate aud_clks[] __initconst = {
|
||||
GATE_AUD(CLK_AUD_TML, "aud_tml", "aud_afe", 27),
|
||||
};
|
||||
|
||||
static void __init mtk_audsys_init(struct device_node *node)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
static const struct mtk_clk_desc aud_desc = {
|
||||
.clks = aud_clks,
|
||||
.num_clks = ARRAY_SIZE(aud_clks),
|
||||
};
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_AUD_NR_CLK);
|
||||
static const struct of_device_id of_match_clk_mt8167_audsys[] = {
|
||||
{ .compatible = "mediatek,mt8167-audsys", .data = &aud_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt8167_audsys);
|
||||
|
||||
mtk_clk_register_gates(NULL, node, aud_clks, ARRAY_SIZE(aud_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_audsys, "mediatek,mt8167-audsys", mtk_audsys_init);
|
||||
static struct platform_driver clk_mt8167_audsys_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
.remove = mtk_clk_simple_remove,
|
||||
.driver = {
|
||||
.name = "clk-mt8167-audsys",
|
||||
.of_match_table = of_match_clk_mt8167_audsys,
|
||||
},
|
||||
};
|
||||
module_platform_driver(clk_mt8167_audsys_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -23,16 +23,10 @@ static const struct mtk_gate_regs img_cg_regs = {
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#define GATE_IMG(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &img_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_IMG(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &img_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate img_clks[] __initconst = {
|
||||
static const struct mtk_gate img_clks[] = {
|
||||
GATE_IMG(CLK_IMG_LARB1_SMI, "img_larb1_smi", "smi_mm", 0),
|
||||
GATE_IMG(CLK_IMG_CAM_SMI, "img_cam_smi", "smi_mm", 5),
|
||||
GATE_IMG(CLK_IMG_CAM_CAM, "img_cam_cam", "smi_mm", 6),
|
||||
@ -41,20 +35,24 @@ static const struct mtk_gate img_clks[] __initconst = {
|
||||
GATE_IMG(CLK_IMG_VENC, "img_venc", "smi_mm", 9),
|
||||
};
|
||||
|
||||
static void __init mtk_imgsys_init(struct device_node *node)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
static const struct mtk_clk_desc img_desc = {
|
||||
.clks = img_clks,
|
||||
.num_clks = ARRAY_SIZE(img_clks),
|
||||
};
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_IMG_NR_CLK);
|
||||
static const struct of_device_id of_match_clk_mt8167_imgsys[] = {
|
||||
{ .compatible = "mediatek,mt8167-imgsys", .data = &img_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt8167_imgsys);
|
||||
|
||||
mtk_clk_register_gates(NULL, node, img_clks, ARRAY_SIZE(img_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_imgsys, "mediatek,mt8167-imgsys", mtk_imgsys_init);
|
||||
static struct platform_driver clk_mt8167_imgsys_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
.remove = mtk_clk_simple_remove,
|
||||
.driver = {
|
||||
.name = "clk-mt8167-imgsys",
|
||||
.of_match_table = of_match_clk_mt8167_imgsys,
|
||||
},
|
||||
};
|
||||
module_platform_driver(clk_mt8167_imgsys_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -23,36 +23,34 @@ static const struct mtk_gate_regs mfg_cg_regs = {
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#define GATE_MFG(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &mfg_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_MFG(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate mfg_clks[] __initconst = {
|
||||
static const struct mtk_gate mfg_clks[] = {
|
||||
GATE_MFG(CLK_MFG_BAXI, "mfg_baxi", "ahb_infra_sel", 0),
|
||||
GATE_MFG(CLK_MFG_BMEM, "mfg_bmem", "gfmux_emi1x_sel", 1),
|
||||
GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_mm", 2),
|
||||
GATE_MFG(CLK_MFG_B26M, "mfg_b26m", "clk26m_ck", 3),
|
||||
};
|
||||
|
||||
static void __init mtk_mfgcfg_init(struct device_node *node)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
static const struct mtk_clk_desc mfg_desc = {
|
||||
.clks = mfg_clks,
|
||||
.num_clks = ARRAY_SIZE(mfg_clks),
|
||||
};
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MFG_NR_CLK);
|
||||
static const struct of_device_id of_match_clk_mt8167_mfgcfg[] = {
|
||||
{ .compatible = "mediatek,mt8167-mfgcfg", .data = &mfg_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt8167_mfgcfg);
|
||||
|
||||
mtk_clk_register_gates(NULL, node, mfg_clks, ARRAY_SIZE(mfg_clks), clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_mfgcfg, "mediatek,mt8167-mfgcfg", mtk_mfgcfg_init);
|
||||
static struct platform_driver clk_mt8167_mfgcfg_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
.remove = mtk_clk_simple_remove,
|
||||
.driver = {
|
||||
.name = "clk-mt8167-mfgcfg",
|
||||
.of_match_table = of_match_clk_mt8167_mfgcfg,
|
||||
},
|
||||
};
|
||||
module_platform_driver(clk_mt8167_mfgcfg_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -29,23 +29,11 @@ static const struct mtk_gate_regs mm1_cg_regs = {
|
||||
.sta_ofs = 0x110,
|
||||
};
|
||||
|
||||
#define GATE_MM0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &mm0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_MM0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &mm0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_MM1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &mm1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_MM1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &mm1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate mm_clks[] = {
|
||||
/* MM0 */
|
||||
@ -86,47 +74,24 @@ static const struct mtk_gate mm_clks[] = {
|
||||
GATE_MM1(CLK_MM_HDMI_PLL, "mm_hdmi_pll", "hdmtx_dig_cts", 21),
|
||||
};
|
||||
|
||||
struct clk_mt8167_mm_driver_data {
|
||||
const struct mtk_gate *gates_clk;
|
||||
int gates_num;
|
||||
static const struct mtk_clk_desc mm_desc = {
|
||||
.clks = mm_clks,
|
||||
.num_clks = ARRAY_SIZE(mm_clks),
|
||||
};
|
||||
|
||||
static const struct clk_mt8167_mm_driver_data mt8167_mmsys_driver_data = {
|
||||
.gates_clk = mm_clks,
|
||||
.gates_num = ARRAY_SIZE(mm_clks),
|
||||
static const struct platform_device_id clk_mt8167_mm_id_table[] = {
|
||||
{ .name = "clk-mt8167-mm", .driver_data = (kernel_ulong_t)&mm_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, clk_mt8167_mm_id_table);
|
||||
|
||||
static int clk_mt8167_mm_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *node = dev->parent->of_node;
|
||||
const struct clk_mt8167_mm_driver_data *data;
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int ret;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
data = &mt8167_mmsys_driver_data;
|
||||
|
||||
ret = mtk_clk_register_gates(&pdev->dev, node, data->gates_clk,
|
||||
data->gates_num, clk_data);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver clk_mt8173_mm_drv = {
|
||||
static struct platform_driver clk_mt8167_mm_drv = {
|
||||
.probe = mtk_clk_pdev_probe,
|
||||
.remove = mtk_clk_pdev_remove,
|
||||
.driver = {
|
||||
.name = "clk-mt8167-mm",
|
||||
},
|
||||
.probe = clk_mt8167_mm_probe,
|
||||
.id_table = clk_mt8167_mm_id_table,
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt8173_mm_drv);
|
||||
module_platform_driver(clk_mt8167_mm_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -29,46 +29,37 @@ static const struct mtk_gate_regs vdec1_cg_regs = {
|
||||
.sta_ofs = 0x8,
|
||||
};
|
||||
|
||||
#define GATE_VDEC0_I(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &vdec0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_VDEC0_I(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &vdec0_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
#define GATE_VDEC1_I(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &vdec1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_VDEC1_I(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &vdec1_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
static const struct mtk_gate vdec_clks[] __initconst = {
|
||||
static const struct mtk_gate vdec_clks[] = {
|
||||
/* VDEC0 */
|
||||
GATE_VDEC0_I(CLK_VDEC_CKEN, "vdec_cken", "rg_vdec", 0),
|
||||
/* VDEC1 */
|
||||
GATE_VDEC1_I(CLK_VDEC_LARB1_CKEN, "vdec_larb1_cken", "smi_mm", 0),
|
||||
};
|
||||
|
||||
static void __init mtk_vdecsys_init(struct device_node *node)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
static const struct mtk_clk_desc vdec_desc = {
|
||||
.clks = vdec_clks,
|
||||
.num_clks = ARRAY_SIZE(vdec_clks),
|
||||
};
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_VDEC_NR_CLK);
|
||||
static const struct of_device_id of_match_clk_mt8167_vdec[] = {
|
||||
{ .compatible = "mediatek,mt8167-vdecsys", .data = &vdec_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt8167_vdec);
|
||||
|
||||
mtk_clk_register_gates(NULL, node, vdec_clks, ARRAY_SIZE(vdec_clks),
|
||||
clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_vdecsys, "mediatek,mt8167-vdecsys", mtk_vdecsys_init);
|
||||
static struct platform_driver clk_mt8167_vdec_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
.remove = mtk_clk_simple_remove,
|
||||
.driver = {
|
||||
.name = "clk-mt8167-vdecsys",
|
||||
.of_match_table = of_match_clk_mt8167_vdec,
|
||||
},
|
||||
};
|
||||
module_platform_driver(clk_mt8167_vdec_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -11,16 +11,16 @@
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-gate.h"
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-pll.h"
|
||||
|
||||
#include <dt-bindings/clock/mt8167-clk.h>
|
||||
|
||||
static DEFINE_SPINLOCK(mt8167_clk_lock);
|
||||
|
||||
static const struct mtk_fixed_clk fixed_clks[] __initconst = {
|
||||
static const struct mtk_fixed_clk fixed_clks[] = {
|
||||
FIXED_CLK(CLK_TOP_CLK_NULL, "clk_null", NULL, 0),
|
||||
FIXED_CLK(CLK_TOP_I2S_INFRA_BCK, "i2s_infra_bck", "clk_null", 26000000),
|
||||
FIXED_CLK(CLK_TOP_MEMPLL, "mempll", "clk26m", 800000000),
|
||||
@ -29,7 +29,7 @@ static const struct mtk_fixed_clk fixed_clks[] __initconst = {
|
||||
FIXED_CLK(CLK_TOP_LVDSTX_CLKDIG_CTS, "lvdstx_dig_cts", "clk26m", 52500000),
|
||||
};
|
||||
|
||||
static const struct mtk_fixed_factor top_divs[] __initconst = {
|
||||
static const struct mtk_fixed_factor top_divs[] = {
|
||||
FACTOR(CLK_TOP_DMPLL, "dmpll_ck", "mempll", 1, 1),
|
||||
FACTOR(CLK_TOP_MAINPLL_D2, "mainpll_d2", "mainpll", 1, 2),
|
||||
FACTOR(CLK_TOP_MAINPLL_D4, "mainpll_d4", "mainpll", 1, 4),
|
||||
@ -85,22 +85,22 @@ static const struct mtk_fixed_factor top_divs[] __initconst = {
|
||||
FACTOR(CLK_TOP_ETH_D2, "eth_d2_ck", "eth_sel", 1, 2),
|
||||
};
|
||||
|
||||
static const char * const uart0_parents[] __initconst = {
|
||||
static const char * const uart0_parents[] = {
|
||||
"clk26m_ck",
|
||||
"univpll_d24"
|
||||
};
|
||||
|
||||
static const char * const gfmux_emi1x_parents[] __initconst = {
|
||||
static const char * const gfmux_emi1x_parents[] = {
|
||||
"clk26m_ck",
|
||||
"dmpll_ck"
|
||||
};
|
||||
|
||||
static const char * const emi_ddrphy_parents[] __initconst = {
|
||||
static const char * const emi_ddrphy_parents[] = {
|
||||
"gfmux_emi1x_sel",
|
||||
"gfmux_emi1x_sel"
|
||||
};
|
||||
|
||||
static const char * const ahb_infra_parents[] __initconst = {
|
||||
static const char * const ahb_infra_parents[] = {
|
||||
"clk_null",
|
||||
"clk26m_ck",
|
||||
"mainpll_d11",
|
||||
@ -116,7 +116,7 @@ static const char * const ahb_infra_parents[] __initconst = {
|
||||
"mainpll_d10"
|
||||
};
|
||||
|
||||
static const char * const csw_mux_mfg_parents[] __initconst = {
|
||||
static const char * const csw_mux_mfg_parents[] = {
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"univpll_d3",
|
||||
@ -127,7 +127,7 @@ static const char * const csw_mux_mfg_parents[] __initconst = {
|
||||
"mmpll380m"
|
||||
};
|
||||
|
||||
static const char * const msdc0_parents[] __initconst = {
|
||||
static const char * const msdc0_parents[] = {
|
||||
"clk26m_ck",
|
||||
"univpll_d6",
|
||||
"mainpll_d8",
|
||||
@ -138,7 +138,7 @@ static const char * const msdc0_parents[] __initconst = {
|
||||
"mmpll_d2"
|
||||
};
|
||||
|
||||
static const char * const camtg_mm_parents[] __initconst = {
|
||||
static const char * const camtg_mm_parents[] = {
|
||||
"clk_null",
|
||||
"clk26m_ck",
|
||||
"usb_phy48m_ck",
|
||||
@ -146,17 +146,17 @@ static const char * const camtg_mm_parents[] __initconst = {
|
||||
"univpll_d6"
|
||||
};
|
||||
|
||||
static const char * const pwm_mm_parents[] __initconst = {
|
||||
static const char * const pwm_mm_parents[] = {
|
||||
"clk26m_ck",
|
||||
"univpll_d12"
|
||||
};
|
||||
|
||||
static const char * const uart1_parents[] __initconst = {
|
||||
static const char * const uart1_parents[] = {
|
||||
"clk26m_ck",
|
||||
"univpll_d24"
|
||||
};
|
||||
|
||||
static const char * const msdc1_parents[] __initconst = {
|
||||
static const char * const msdc1_parents[] = {
|
||||
"clk26m_ck",
|
||||
"univpll_d6",
|
||||
"mainpll_d8",
|
||||
@ -167,24 +167,24 @@ static const char * const msdc1_parents[] __initconst = {
|
||||
"mmpll_d2"
|
||||
};
|
||||
|
||||
static const char * const spm_52m_parents[] __initconst = {
|
||||
static const char * const spm_52m_parents[] = {
|
||||
"clk26m_ck",
|
||||
"univpll_d24"
|
||||
};
|
||||
|
||||
static const char * const pmicspi_parents[] __initconst = {
|
||||
static const char * const pmicspi_parents[] = {
|
||||
"univpll_d20",
|
||||
"usb_phy48m_ck",
|
||||
"univpll_d16",
|
||||
"clk26m_ck"
|
||||
};
|
||||
|
||||
static const char * const qaxi_aud26m_parents[] __initconst = {
|
||||
static const char * const qaxi_aud26m_parents[] = {
|
||||
"clk26m_ck",
|
||||
"ahb_infra_sel"
|
||||
};
|
||||
|
||||
static const char * const aud_intbus_parents[] __initconst = {
|
||||
static const char * const aud_intbus_parents[] = {
|
||||
"clk_null",
|
||||
"clk26m_ck",
|
||||
"mainpll_d22",
|
||||
@ -192,7 +192,7 @@ static const char * const aud_intbus_parents[] __initconst = {
|
||||
"mainpll_d11"
|
||||
};
|
||||
|
||||
static const char * const nfi2x_pad_parents[] __initconst = {
|
||||
static const char * const nfi2x_pad_parents[] = {
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
@ -280,12 +280,12 @@ static const char * const nfi2x_pad_parents[] __initconst = {
|
||||
"mainpll_d5"
|
||||
};
|
||||
|
||||
static const char * const nfi1x_pad_parents[] __initconst = {
|
||||
static const char * const nfi1x_pad_parents[] = {
|
||||
"ahb_infra_sel",
|
||||
"nfi1x_ck"
|
||||
};
|
||||
|
||||
static const char * const mfg_mm_parents[] __initconst = {
|
||||
static const char * const mfg_mm_parents[] = {
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
@ -325,12 +325,12 @@ static const char * const mfg_mm_parents[] __initconst = {
|
||||
"mainpll_d14"
|
||||
};
|
||||
|
||||
static const char * const ddrphycfg_parents[] __initconst = {
|
||||
static const char * const ddrphycfg_parents[] = {
|
||||
"clk26m_ck",
|
||||
"mainpll_d16"
|
||||
};
|
||||
|
||||
static const char * const smi_mm_parents[] __initconst = {
|
||||
static const char * const smi_mm_parents[] = {
|
||||
"clk26m_ck",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
@ -346,7 +346,7 @@ static const char * const smi_mm_parents[] __initconst = {
|
||||
"mainpll_d14"
|
||||
};
|
||||
|
||||
static const char * const usb_78m_parents[] __initconst = {
|
||||
static const char * const usb_78m_parents[] = {
|
||||
"clk_null",
|
||||
"clk26m_ck",
|
||||
"univpll_d16",
|
||||
@ -354,7 +354,7 @@ static const char * const usb_78m_parents[] __initconst = {
|
||||
"mainpll_d20"
|
||||
};
|
||||
|
||||
static const char * const scam_mm_parents[] __initconst = {
|
||||
static const char * const scam_mm_parents[] = {
|
||||
"clk_null",
|
||||
"clk26m_ck",
|
||||
"mainpll_d14",
|
||||
@ -362,7 +362,7 @@ static const char * const scam_mm_parents[] __initconst = {
|
||||
"mainpll_d12"
|
||||
};
|
||||
|
||||
static const char * const spinor_parents[] __initconst = {
|
||||
static const char * const spinor_parents[] = {
|
||||
"clk26m_d2",
|
||||
"clk26m_ck",
|
||||
"mainpll_d40",
|
||||
@ -373,7 +373,7 @@ static const char * const spinor_parents[] __initconst = {
|
||||
"univpll_d12"
|
||||
};
|
||||
|
||||
static const char * const msdc2_parents[] __initconst = {
|
||||
static const char * const msdc2_parents[] = {
|
||||
"clk26m_ck",
|
||||
"univpll_d6",
|
||||
"mainpll_d8",
|
||||
@ -384,7 +384,7 @@ static const char * const msdc2_parents[] __initconst = {
|
||||
"mmpll_d2"
|
||||
};
|
||||
|
||||
static const char * const eth_parents[] __initconst = {
|
||||
static const char * const eth_parents[] = {
|
||||
"clk26m_ck",
|
||||
"mainpll_d40",
|
||||
"univpll_d24",
|
||||
@ -392,7 +392,7 @@ static const char * const eth_parents[] __initconst = {
|
||||
"mainpll_d20"
|
||||
};
|
||||
|
||||
static const char * const vdec_mm_parents[] __initconst = {
|
||||
static const char * const vdec_mm_parents[] = {
|
||||
"clk26m_ck",
|
||||
"univpll_d4",
|
||||
"mainpll_d4",
|
||||
@ -401,7 +401,7 @@ static const char * const vdec_mm_parents[] __initconst = {
|
||||
"mainpll_d6"
|
||||
};
|
||||
|
||||
static const char * const dpi0_mm_parents[] __initconst = {
|
||||
static const char * const dpi0_mm_parents[] = {
|
||||
"clk26m_ck",
|
||||
"lvdspll_ck",
|
||||
"lvdspll_d2",
|
||||
@ -409,7 +409,7 @@ static const char * const dpi0_mm_parents[] __initconst = {
|
||||
"lvdspll_d8"
|
||||
};
|
||||
|
||||
static const char * const dpi1_mm_parents[] __initconst = {
|
||||
static const char * const dpi1_mm_parents[] = {
|
||||
"clk26m_ck",
|
||||
"tvdpll_d2",
|
||||
"tvdpll_d4",
|
||||
@ -417,85 +417,85 @@ static const char * const dpi1_mm_parents[] __initconst = {
|
||||
"tvdpll_d16"
|
||||
};
|
||||
|
||||
static const char * const axi_mfg_in_parents[] __initconst = {
|
||||
static const char * const axi_mfg_in_parents[] = {
|
||||
"clk26m_ck",
|
||||
"mainpll_d11",
|
||||
"univpll_d24",
|
||||
"mmpll380m"
|
||||
};
|
||||
|
||||
static const char * const slow_mfg_parents[] __initconst = {
|
||||
static const char * const slow_mfg_parents[] = {
|
||||
"clk26m_ck",
|
||||
"univpll_d12",
|
||||
"univpll_d24"
|
||||
};
|
||||
|
||||
static const char * const aud1_parents[] __initconst = {
|
||||
static const char * const aud1_parents[] = {
|
||||
"clk26m_ck",
|
||||
"apll1_ck"
|
||||
};
|
||||
|
||||
static const char * const aud2_parents[] __initconst = {
|
||||
static const char * const aud2_parents[] = {
|
||||
"clk26m_ck",
|
||||
"apll2_ck"
|
||||
};
|
||||
|
||||
static const char * const aud_engen1_parents[] __initconst = {
|
||||
static const char * const aud_engen1_parents[] = {
|
||||
"clk26m_ck",
|
||||
"rg_apll1_d2_en",
|
||||
"rg_apll1_d4_en",
|
||||
"rg_apll1_d8_en"
|
||||
};
|
||||
|
||||
static const char * const aud_engen2_parents[] __initconst = {
|
||||
static const char * const aud_engen2_parents[] = {
|
||||
"clk26m_ck",
|
||||
"rg_apll2_d2_en",
|
||||
"rg_apll2_d4_en",
|
||||
"rg_apll2_d8_en"
|
||||
};
|
||||
|
||||
static const char * const i2c_parents[] __initconst = {
|
||||
static const char * const i2c_parents[] = {
|
||||
"clk26m_ck",
|
||||
"univpll_d20",
|
||||
"univpll_d16",
|
||||
"univpll_d12"
|
||||
};
|
||||
|
||||
static const char * const aud_i2s0_m_parents[] __initconst = {
|
||||
static const char * const aud_i2s0_m_parents[] = {
|
||||
"rg_aud1",
|
||||
"rg_aud2"
|
||||
};
|
||||
|
||||
static const char * const pwm_parents[] __initconst = {
|
||||
static const char * const pwm_parents[] = {
|
||||
"clk26m_ck",
|
||||
"univpll_d12"
|
||||
};
|
||||
|
||||
static const char * const spi_parents[] __initconst = {
|
||||
static const char * const spi_parents[] = {
|
||||
"clk26m_ck",
|
||||
"univpll_d12",
|
||||
"univpll_d8",
|
||||
"univpll_d6"
|
||||
};
|
||||
|
||||
static const char * const aud_spdifin_parents[] __initconst = {
|
||||
static const char * const aud_spdifin_parents[] = {
|
||||
"clk26m_ck",
|
||||
"univpll_d2"
|
||||
};
|
||||
|
||||
static const char * const uart2_parents[] __initconst = {
|
||||
static const char * const uart2_parents[] = {
|
||||
"clk26m_ck",
|
||||
"univpll_d24"
|
||||
};
|
||||
|
||||
static const char * const bsi_parents[] __initconst = {
|
||||
static const char * const bsi_parents[] = {
|
||||
"clk26m_ck",
|
||||
"mainpll_d10",
|
||||
"mainpll_d12",
|
||||
"mainpll_d20"
|
||||
};
|
||||
|
||||
static const char * const dbg_atclk_parents[] __initconst = {
|
||||
static const char * const dbg_atclk_parents[] = {
|
||||
"clk_null",
|
||||
"clk26m_ck",
|
||||
"mainpll_d5",
|
||||
@ -503,7 +503,7 @@ static const char * const dbg_atclk_parents[] __initconst = {
|
||||
"univpll_d5"
|
||||
};
|
||||
|
||||
static const char * const csw_nfiecc_parents[] __initconst = {
|
||||
static const char * const csw_nfiecc_parents[] = {
|
||||
"clk_null",
|
||||
"mainpll_d7",
|
||||
"mainpll_d6",
|
||||
@ -511,7 +511,7 @@ static const char * const csw_nfiecc_parents[] __initconst = {
|
||||
"mainpll_d5"
|
||||
};
|
||||
|
||||
static const char * const nfiecc_parents[] __initconst = {
|
||||
static const char * const nfiecc_parents[] = {
|
||||
"clk_null",
|
||||
"nfi2x_pad_sel",
|
||||
"mainpll_d4",
|
||||
@ -625,24 +625,24 @@ static struct mtk_composite top_muxes[] __initdata = {
|
||||
0x07c, 13, 3),
|
||||
};
|
||||
|
||||
static const char * const ifr_mux1_parents[] __initconst = {
|
||||
static const char * const ifr_mux1_parents[] = {
|
||||
"clk26m_ck",
|
||||
"armpll",
|
||||
"univpll",
|
||||
"mainpll_d2"
|
||||
};
|
||||
|
||||
static const char * const ifr_eth_25m_parents[] __initconst = {
|
||||
static const char * const ifr_eth_25m_parents[] = {
|
||||
"eth_d2_ck",
|
||||
"rg_eth"
|
||||
};
|
||||
|
||||
static const char * const ifr_i2c0_parents[] __initconst = {
|
||||
static const char * const ifr_i2c0_parents[] = {
|
||||
"ahb_infra_d2",
|
||||
"rg_i2c"
|
||||
};
|
||||
|
||||
static const struct mtk_composite ifr_muxes[] __initconst = {
|
||||
static const struct mtk_composite ifr_muxes[] = {
|
||||
MUX(CLK_IFR_MUX1_SEL, "ifr_mux1_sel", ifr_mux1_parents, 0x000,
|
||||
2, 2),
|
||||
MUX(CLK_IFR_ETH_25M_SEL, "ifr_eth_25m_sel", ifr_eth_25m_parents, 0x080,
|
||||
@ -685,21 +685,6 @@ static const struct mtk_clk_divider top_adj_divs[] = {
|
||||
0x0078, 0, 8),
|
||||
};
|
||||
|
||||
#define DIV_ADJ_FLAG(_id, _name, _parent, _reg, _shift, _width, _flag) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.div_reg = _reg, \
|
||||
.div_shift = _shift, \
|
||||
.div_width = _width, \
|
||||
.clk_divider_flags = _flag, \
|
||||
}
|
||||
|
||||
static const struct mtk_clk_divider apmixed_adj_divs[] = {
|
||||
DIV_ADJ_FLAG(CLK_APMIXED_HDMI_REF, "hdmi_ref", "tvdpll",
|
||||
0x1c4, 24, 3, CLK_DIVIDER_POWER_OF_TWO),
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs top0_cg_regs = {
|
||||
.set_ofs = 0x50,
|
||||
.clr_ofs = 0x80,
|
||||
@ -736,79 +721,31 @@ static const struct mtk_gate_regs top5_cg_regs = {
|
||||
.sta_ofs = 0x44,
|
||||
};
|
||||
|
||||
#define GATE_TOP0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &top0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_TOP0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &top0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_TOP0_I(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &top0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_TOP0_I(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &top0_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
#define GATE_TOP1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &top1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_TOP1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &top1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_TOP2(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &top2_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_TOP2(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &top2_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_TOP2_I(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &top2_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_TOP2_I(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &top2_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
#define GATE_TOP3(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &top3_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_TOP3(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &top3_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_TOP4_I(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &top4_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr_inv, \
|
||||
}
|
||||
#define GATE_TOP4_I(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &top4_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
#define GATE_TOP5(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &top5_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_no_setclr, \
|
||||
}
|
||||
#define GATE_TOP5(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &top5_cg_regs, _shift, &mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
static const struct mtk_gate top_clks[] __initconst = {
|
||||
static const struct mtk_gate top_clks[] = {
|
||||
/* TOP0 */
|
||||
GATE_TOP0(CLK_TOP_PWM_MM, "pwm_mm", "pwm_mm_sel", 0),
|
||||
GATE_TOP0(CLK_TOP_CAM_MM, "cam_mm", "camtg_mm_sel", 1),
|
||||
@ -921,145 +858,40 @@ static const struct mtk_gate top_clks[] __initconst = {
|
||||
GATE_TOP5(CLK_TOP_APLL12_DIV6, "apll12_div6", "apll12_ck_div6", 8),
|
||||
};
|
||||
|
||||
static void __init mtk_topckgen_init(struct device_node *node)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
void __iomem *base;
|
||||
|
||||
base = of_iomap(node, 0);
|
||||
if (!base) {
|
||||
pr_err("%s(): ioremap failed\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
clk_data = mtk_alloc_clk_data(MT8167_CLK_TOP_NR_CLK);
|
||||
|
||||
mtk_clk_register_fixed_clks(fixed_clks, ARRAY_SIZE(fixed_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(NULL, node, top_clks, ARRAY_SIZE(top_clks), clk_data);
|
||||
|
||||
mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data);
|
||||
mtk_clk_register_composites(NULL, top_muxes,
|
||||
ARRAY_SIZE(top_muxes), base,
|
||||
&mt8167_clk_lock, clk_data);
|
||||
mtk_clk_register_dividers(top_adj_divs, ARRAY_SIZE(top_adj_divs),
|
||||
base, &mt8167_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_topckgen, "mediatek,mt8167-topckgen", mtk_topckgen_init);
|
||||
|
||||
static void __init mtk_infracfg_init(struct device_node *node)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int r;
|
||||
void __iomem *base;
|
||||
|
||||
base = of_iomap(node, 0);
|
||||
if (!base) {
|
||||
pr_err("%s(): ioremap failed\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_IFR_NR_CLK);
|
||||
|
||||
mtk_clk_register_composites(NULL, ifr_muxes,
|
||||
ARRAY_SIZE(ifr_muxes), base,
|
||||
&mt8167_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_infracfg, "mediatek,mt8167-infracfg", mtk_infracfg_init);
|
||||
|
||||
#define MT8167_PLL_FMAX (2500UL * MHZ)
|
||||
|
||||
#define CON0_MT8167_RST_BAR BIT(27)
|
||||
|
||||
#define PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
|
||||
_pd_reg, _pd_shift, _tuner_reg, _pcw_reg, \
|
||||
_pcw_shift, _div_table) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.reg = _reg, \
|
||||
.pwr_reg = _pwr_reg, \
|
||||
.en_mask = _en_mask, \
|
||||
.flags = _flags, \
|
||||
.rst_bar_mask = CON0_MT8167_RST_BAR, \
|
||||
.fmax = MT8167_PLL_FMAX, \
|
||||
.pcwbits = _pcwbits, \
|
||||
.pd_reg = _pd_reg, \
|
||||
.pd_shift = _pd_shift, \
|
||||
.tuner_reg = _tuner_reg, \
|
||||
.pcw_reg = _pcw_reg, \
|
||||
.pcw_shift = _pcw_shift, \
|
||||
.div_table = _div_table, \
|
||||
}
|
||||
|
||||
#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
|
||||
_pd_reg, _pd_shift, _tuner_reg, _pcw_reg, \
|
||||
_pcw_shift) \
|
||||
PLL_B(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, \
|
||||
_pd_reg, _pd_shift, _tuner_reg, _pcw_reg, _pcw_shift, \
|
||||
NULL)
|
||||
|
||||
static const struct mtk_pll_div_table mmpll_div_table[] = {
|
||||
{ .div = 0, .freq = MT8167_PLL_FMAX },
|
||||
{ .div = 1, .freq = 1000000000 },
|
||||
{ .div = 2, .freq = 604500000 },
|
||||
{ .div = 3, .freq = 253500000 },
|
||||
{ .div = 4, .freq = 126750000 },
|
||||
{ } /* sentinel */
|
||||
static const struct mtk_clk_desc topck_desc = {
|
||||
.clks = top_clks,
|
||||
.num_clks = ARRAY_SIZE(top_clks),
|
||||
.fixed_clks = fixed_clks,
|
||||
.num_fixed_clks = ARRAY_SIZE(fixed_clks),
|
||||
.factor_clks = top_divs,
|
||||
.num_factor_clks = ARRAY_SIZE(top_divs),
|
||||
.composite_clks = top_muxes,
|
||||
.num_composite_clks = ARRAY_SIZE(top_muxes),
|
||||
.divider_clks = top_adj_divs,
|
||||
.num_divider_clks = ARRAY_SIZE(top_adj_divs),
|
||||
.clk_lock = &mt8167_clk_lock,
|
||||
};
|
||||
|
||||
static const struct mtk_pll_data plls[] = {
|
||||
PLL(CLK_APMIXED_ARMPLL, "armpll", 0x0100, 0x0110, 0, 0,
|
||||
21, 0x0104, 24, 0, 0x0104, 0),
|
||||
PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x0120, 0x0130, 0,
|
||||
HAVE_RST_BAR, 21, 0x0124, 24, 0, 0x0124, 0),
|
||||
PLL(CLK_APMIXED_UNIVPLL, "univpll", 0x0140, 0x0150, 0x30000000,
|
||||
HAVE_RST_BAR, 7, 0x0144, 24, 0, 0x0144, 0),
|
||||
PLL_B(CLK_APMIXED_MMPLL, "mmpll", 0x0160, 0x0170, 0, 0,
|
||||
21, 0x0164, 24, 0, 0x0164, 0, mmpll_div_table),
|
||||
PLL(CLK_APMIXED_APLL1, "apll1", 0x0180, 0x0190, 0, 0,
|
||||
31, 0x0180, 1, 0x0194, 0x0184, 0),
|
||||
PLL(CLK_APMIXED_APLL2, "apll2", 0x01A0, 0x01B0, 0, 0,
|
||||
31, 0x01A0, 1, 0x01B4, 0x01A4, 0),
|
||||
PLL(CLK_APMIXED_TVDPLL, "tvdpll", 0x01C0, 0x01D0, 0, 0,
|
||||
21, 0x01C4, 24, 0, 0x01C4, 0),
|
||||
PLL(CLK_APMIXED_LVDSPLL, "lvdspll", 0x01E0, 0x01F0, 0, 0,
|
||||
21, 0x01E4, 24, 0, 0x01E4, 0),
|
||||
static const struct mtk_clk_desc infra_desc = {
|
||||
.composite_clks = ifr_muxes,
|
||||
.num_composite_clks = ARRAY_SIZE(ifr_muxes),
|
||||
.clk_lock = &mt8167_clk_lock,
|
||||
};
|
||||
|
||||
static void __init mtk_apmixedsys_init(struct device_node *node)
|
||||
{
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
void __iomem *base;
|
||||
int r;
|
||||
static const struct of_device_id of_match_clk_mt8167[] = {
|
||||
{ .compatible = "mediatek,mt8167-topckgen", .data = &topck_desc },
|
||||
{ .compatible = "mediatek,mt8167-infracfg", .data = &infra_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt8167);
|
||||
|
||||
base = of_iomap(node, 0);
|
||||
if (!base) {
|
||||
pr_err("%s(): ioremap failed\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
clk_data = mtk_alloc_clk_data(MT8167_CLK_APMIXED_NR_CLK);
|
||||
|
||||
mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
|
||||
mtk_clk_register_dividers(apmixed_adj_divs, ARRAY_SIZE(apmixed_adj_divs),
|
||||
base, &mt8167_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_apmixedsys, "mediatek,mt8167-apmixedsys",
|
||||
mtk_apmixedsys_init);
|
||||
static struct platform_driver clk_mt8167_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
.remove = mtk_clk_simple_remove,
|
||||
.driver = {
|
||||
.name = "clk-mt8167",
|
||||
.of_match_table = of_match_clk_mt8167,
|
||||
},
|
||||
};
|
||||
module_platform_driver(clk_mt8167_drv);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -9,8 +9,10 @@
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include "clk-fhctl.h"
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-pll.h"
|
||||
#include "clk-pllfh.h"
|
||||
|
||||
#define REGOFF_REF2USB 0x8
|
||||
#define REGOFF_HDMI_REF 0x40
|
||||
@ -77,13 +79,67 @@ static const struct mtk_pll_data plls[] = {
|
||||
PLL(CLK_APMIXED_MSDCPLL2, "msdcpll2", 0x2f0, 0x2fc, 0, 0, 21, 0x2f0, 4, 0x0, 0x2f4, 0),
|
||||
};
|
||||
|
||||
enum fh_pll_id {
|
||||
FH_ARMCA7PLL,
|
||||
FH_ARMCA15PLL,
|
||||
FH_MAINPLL,
|
||||
FH_MPLL,
|
||||
FH_MSDCPLL,
|
||||
FH_MMPLL,
|
||||
FH_VENCPLL,
|
||||
FH_TVDPLL,
|
||||
FH_VCODECPLL,
|
||||
FH_LVDSPLL,
|
||||
FH_MSDC2PLL,
|
||||
FH_NR_FH,
|
||||
};
|
||||
|
||||
#define FH(_pllid, _fhid, _offset) { \
|
||||
.data = { \
|
||||
.pll_id = _pllid, \
|
||||
.fh_id = _fhid, \
|
||||
.fh_ver = FHCTL_PLLFH_V1, \
|
||||
.fhx_offset = _offset, \
|
||||
.dds_mask = GENMASK(21, 0), \
|
||||
.slope0_value = 0x6003c97, \
|
||||
.slope1_value = 0x6003c97, \
|
||||
.sfstrx_en = BIT(2), \
|
||||
.frddsx_en = BIT(1), \
|
||||
.fhctlx_en = BIT(0), \
|
||||
.tgl_org = BIT(31), \
|
||||
.dvfs_tri = BIT(31), \
|
||||
.pcwchg = BIT(31), \
|
||||
.dt_val = 0x0, \
|
||||
.df_val = 0x9, \
|
||||
.updnlmt_shft = 16, \
|
||||
.msk_frddsx_dys = GENMASK(23, 20), \
|
||||
.msk_frddsx_dts = GENMASK(19, 16), \
|
||||
}, \
|
||||
}
|
||||
|
||||
static struct mtk_pllfh_data pllfhs[] = {
|
||||
FH(CLK_APMIXED_ARMCA7PLL, FH_ARMCA7PLL, 0x38),
|
||||
FH(CLK_APMIXED_ARMCA15PLL, FH_ARMCA15PLL, 0x4c),
|
||||
FH(CLK_APMIXED_MAINPLL, FH_MAINPLL, 0x60),
|
||||
FH(CLK_APMIXED_MPLL, FH_MPLL, 0x74),
|
||||
FH(CLK_APMIXED_MSDCPLL, FH_MSDCPLL, 0x88),
|
||||
FH(CLK_APMIXED_MMPLL, FH_MMPLL, 0x9c),
|
||||
FH(CLK_APMIXED_VENCPLL, FH_VENCPLL, 0xb0),
|
||||
FH(CLK_APMIXED_TVDPLL, FH_TVDPLL, 0xc4),
|
||||
FH(CLK_APMIXED_VCODECPLL, FH_VCODECPLL, 0xd8),
|
||||
FH(CLK_APMIXED_LVDSPLL, FH_LVDSPLL, 0xec),
|
||||
FH(CLK_APMIXED_MSDCPLL2, FH_MSDC2PLL, 0x100),
|
||||
};
|
||||
|
||||
static const struct of_device_id of_match_clk_mt8173_apmixed[] = {
|
||||
{ .compatible = "mediatek,mt8173-apmixedsys" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt8173_apmixed);
|
||||
|
||||
static int clk_mt8173_apmixed_probe(struct platform_device *pdev)
|
||||
{
|
||||
const u8 *fhctl_node = "mediatek,mt8173-fhctl";
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
void __iomem *base;
|
||||
@ -98,7 +154,9 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev)
|
||||
if (IS_ERR_OR_NULL(clk_data))
|
||||
return -ENOMEM;
|
||||
|
||||
r = mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
|
||||
fhctl_parse_dt(fhctl_node, pllfhs, ARRAY_SIZE(pllfhs));
|
||||
r = mtk_clk_register_pllfhs(node, plls, ARRAY_SIZE(plls),
|
||||
pllfhs, ARRAY_SIZE(pllfhs), clk_data);
|
||||
if (r)
|
||||
goto free_clk_data;
|
||||
|
||||
@ -124,7 +182,8 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev)
|
||||
unregister_ref2usb:
|
||||
mtk_clk_unregister_ref2usb_tx(clk_data->hws[CLK_APMIXED_REF2USB_TX]);
|
||||
unregister_plls:
|
||||
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
|
||||
mtk_clk_unregister_pllfhs(plls, ARRAY_SIZE(plls), pllfhs,
|
||||
ARRAY_SIZE(pllfhs), clk_data);
|
||||
free_clk_data:
|
||||
mtk_free_clk_data(clk_data);
|
||||
return r;
|
||||
@ -137,7 +196,8 @@ static int clk_mt8173_apmixed_remove(struct platform_device *pdev)
|
||||
|
||||
of_clk_del_provider(node);
|
||||
mtk_clk_unregister_ref2usb_tx(clk_data->hws[CLK_APMIXED_REF2USB_TX]);
|
||||
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
|
||||
mtk_clk_unregister_pllfhs(plls, ARRAY_SIZE(plls), pllfhs,
|
||||
ARRAY_SIZE(pllfhs), clk_data);
|
||||
mtk_free_clk_data(clk_data);
|
||||
|
||||
return 0;
|
||||
|
@ -40,6 +40,7 @@ static const struct of_device_id of_match_clk_mt8173_imgsys[] = {
|
||||
{ .compatible = "mediatek,mt8173-imgsys", .data = &img_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt8173_imgsys);
|
||||
|
||||
static struct platform_driver clk_mt8173_vdecsys_drv = {
|
||||
.probe = mtk_clk_simple_probe,
|
||||
|
@ -74,6 +74,7 @@ static const struct of_device_id of_match_clk_mt8173_infracfg[] = {
|
||||
{ .compatible = "mediatek,mt8173-infracfg" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt8173_infracfg);
|
||||
|
||||
static void clk_mt8173_infra_init_early(struct device_node *node)
|
||||
{
|
||||
|
@ -25,25 +25,14 @@ static const struct mtk_gate_regs mm1_cg_regs = {
|
||||
.sta_ofs = 0x0110,
|
||||
};
|
||||
|
||||
#define GATE_MM0(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &mm0_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_MM0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &mm0_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_MM1(_id, _name, _parent, _shift) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = &mm1_cg_regs, \
|
||||
.shift = _shift, \
|
||||
.ops = &mtk_clk_gate_ops_setclr, \
|
||||
}
|
||||
#define GATE_MM1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &mm1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate mt8173_mm_clks[] = {
|
||||
GATE_DUMMY(CLK_DUMMY, "mm_dummy"),
|
||||
/* MM0 */
|
||||
GATE_MM0(CLK_MM_SMI_COMMON, "mm_smi_common", "mm_sel", 0),
|
||||
GATE_MM0(CLK_MM_SMI_LARB0, "mm_smi_larb0", "mm_sel", 1),
|
||||
@ -100,65 +89,26 @@ static const struct mtk_gate mt8173_mm_clks[] = {
|
||||
GATE_MM1(CLK_MM_HDMI_HDCP24M, "mm_hdmi_hdcp24m", "hdcp_24m_sel", 20),
|
||||
};
|
||||
|
||||
struct clk_mt8173_mm_driver_data {
|
||||
const struct mtk_gate *gates_clk;
|
||||
int gates_num;
|
||||
static const struct mtk_clk_desc mm_desc = {
|
||||
.clks = mt8173_mm_clks,
|
||||
.num_clks = ARRAY_SIZE(mt8173_mm_clks),
|
||||
};
|
||||
|
||||
static const struct clk_mt8173_mm_driver_data mt8173_mmsys_driver_data = {
|
||||
.gates_clk = mt8173_mm_clks,
|
||||
.gates_num = ARRAY_SIZE(mt8173_mm_clks),
|
||||
static const struct platform_device_id clk_mt8173_mm_id_table[] = {
|
||||
{ .name = "clk-mt8173-mm", .driver_data = (kernel_ulong_t)&mm_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static int clk_mt8173_mm_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *node = dev->parent->of_node;
|
||||
const struct clk_mt8173_mm_driver_data *data;
|
||||
struct clk_hw_onecell_data *clk_data;
|
||||
int ret;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
data = &mt8173_mmsys_driver_data;
|
||||
|
||||
ret = mtk_clk_register_gates(&pdev->dev, node, data->gates_clk,
|
||||
data->gates_num, clk_data);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int clk_mt8173_mm_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *node = dev->parent->of_node;
|
||||
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
|
||||
const struct clk_mt8173_mm_driver_data *data = &mt8173_mmsys_driver_data;
|
||||
|
||||
of_clk_del_provider(node);
|
||||
mtk_clk_unregister_gates(data->gates_clk, data->gates_num, clk_data);
|
||||
mtk_free_clk_data(clk_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
MODULE_DEVICE_TABLE(platform, clk_mt8173_mm_id_table);
|
||||
|
||||
static struct platform_driver clk_mt8173_mm_drv = {
|
||||
.driver = {
|
||||
.name = "clk-mt8173-mm",
|
||||
},
|
||||
.probe = clk_mt8173_mm_probe,
|
||||
.remove = clk_mt8173_mm_remove,
|
||||
.id_table = clk_mt8173_mm_id_table,
|
||||
.probe = mtk_clk_pdev_probe,
|
||||
.remove = mtk_clk_pdev_remove,
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt8173_mm_drv);
|
||||
module_platform_driver(clk_mt8173_mm_drv);
|
||||
|
||||
MODULE_DESCRIPTION("MediaTek MT8173 MultiMedia clocks driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -107,6 +107,7 @@ static const struct of_device_id of_match_clk_mt8173_pericfg[] = {
|
||||
{ .compatible = "mediatek,mt8173-pericfg", .data = &peri_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt8173_pericfg);
|
||||
|
||||
static struct platform_driver clk_mt8173_pericfg_drv = {
|
||||
.driver = {
|
||||
|
@ -638,6 +638,7 @@ static const struct of_device_id of_match_clk_mt8173_topckgen[] = {
|
||||
{ .compatible = "mediatek,mt8173-topckgen", .data = &topck_desc },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_match_clk_mt8173_topckgen);
|
||||
|
||||
static struct platform_driver clk_mt8173_topckgen_drv = {
|
||||
.driver = {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user