Merge branches 'clk-renesas', 'clk-qcom', 'clk-mtk', 'clk-milbeaut' and 'clk-imx' into clk-next
- Qualcomm QCS404 CDSP clk support - Qualcomm QCS404 Turing clk support - Mediatek MT8183 clock support - Mediatek MT8516 clock support - Milbeaut M10V clk controller support * clk-renesas: clk: renesas: rcar-gen3: Remove unused variable clk: renesas: rcar-gen3: Fix cpg_sd_clock_round_rate() return value clk: renesas: r8a77980: Fix RPC-IF module clock's parent clk: renesas: rcar-gen3: Rename DRIF clocks clk: renesas: rcar-gen3: Correct parent clock of Audio-DMAC clk: renesas: rcar-gen3: Correct parent clock of SYS-DMAC clk: renesas: rcar-gen3: Correct parent clock of HS-USB clk: renesas: rcar-gen3: Correct parent clock of EHCI/OHCI clk: renesas: r8a774c0: Add Z2 clock clk: renesas: r8a77990: Add Z2 clock clk: renesas: rcar-gen3: Support Z and Z2 clocks with high frequency parents math64: New DIV64_U64_ROUND_CLOSEST helper clk: renesas: rcar-gen3: Remove CLK_TYPE_GEN3_Z2 clk: renesas: rcar-gen3: Parameterise Z and Z2 clock offset clk: renesas: rcar-gen3: Parameterise Z and Z2 clock fixed divisor clk: renesas: r9a06g032: Add missing PCI USB clock clk: renesas: r7s9210: Always use readl() clk: renesas: rcar-gen3: Pass name/offset to cpg_sd_clk_register() * clk-qcom: clk: qcom: Skip halt checks on gcc_pcie_0_pipe_clk for 8998 clk: qcom: Add QCS404 TuringCC clk: qcom: branch: Add AON clock ops dt-bindings: clock: Introduce Qualcomm Turing Clock controller clk: qcom: gcc-qcs404: Add CDSP related clocks and resets * clk-mtk: clk: mediatek: add clock driver for MT8516 dt-bindings: mediatek: apmixedsys: add support for MT8516 dt-bindings: mediatek: infracfg: add support for MT8516 dt-bindings: mediatek: topckgen: add support for MT8516 clk: mediatek: Allow changing PLL rate when it is off clk: mediatek: Add MT8183 clock support clk: mediatek: Add configurable pcw_chg_reg to mtk_pll_data clk: mediatek: Add dt-bindings for MT8183 clocks dt-bindings: ARM: Mediatek: Document bindings for MT8183 clk: mediatek: Add configurable pcwibits and fmin to mtk_pll_data clk: mediatek: Add new clkmux register API clk: mediatek: Disable tuner_en before change PLL rate * clk-milbeaut: clock: milbeaut: Add Milbeaut M10V clock controller dt-bindings: clock: milbeaut: add Milbeaut clock description * clk-imx: clk: imx: correct pfdv2 gate_bit/vld_bit operations clk: imx: clk-pllv3: mark expected switch fall-throughs clk: imx8mq: Add dsi_ipg_div clk: imx: pllv4: add fractional-N pll support clk: imx: keep uart clock on during system boot clk: imx: correct i.MX7D AV PLL num/denom offset clk: imx6sll: Fix mispelling uart4_serial as serail clk: imx: pll14xx: drop unused variable clk: imx: rename clk-imx51-imx53.c to clk-imx5.c clk: imx5: Fix i.MX50 ESDHC clock registers clk: imx5: Fix i.MX50 mainbus clock registers clk: imx: Remove unused imx_get_clk_hw_fixed dt-bindings: clock: imx7ulp: remove SNVS clock clk: imx7ulp: remove snvs clock
This commit is contained in:
commit
2ed3b9103a
@ -14,6 +14,8 @@ Required Properties:
|
||||
- "mediatek,mt7629-apmixedsys"
|
||||
- "mediatek,mt8135-apmixedsys"
|
||||
- "mediatek,mt8173-apmixedsys"
|
||||
- "mediatek,mt8183-apmixedsys", "syscon"
|
||||
- "mediatek,mt8516-apmixedsys"
|
||||
- #clock-cells: Must be 1
|
||||
|
||||
The apmixedsys controller uses the common clk binding from
|
||||
|
@ -9,6 +9,7 @@ Required Properties:
|
||||
- "mediatek,mt2701-audsys", "syscon"
|
||||
- "mediatek,mt7622-audsys", "syscon"
|
||||
- "mediatek,mt7623-audsys", "mediatek,mt2701-audsys", "syscon"
|
||||
- "mediatek,mt8183-audiosys", "syscon"
|
||||
- #clock-cells: Must be 1
|
||||
|
||||
The AUDSYS controller uses the common clk binding from
|
||||
|
@ -0,0 +1,22 @@
|
||||
MediaTek CAMSYS controller
|
||||
============================
|
||||
|
||||
The MediaTek camsys controller provides various clocks to the system.
|
||||
|
||||
Required Properties:
|
||||
|
||||
- compatible: Should be one of:
|
||||
- "mediatek,mt8183-camsys", "syscon"
|
||||
- #clock-cells: Must be 1
|
||||
|
||||
The camsys controller uses the common clk binding from
|
||||
Documentation/devicetree/bindings/clock/clock-bindings.txt
|
||||
The available clocks are defined in dt-bindings/clock/mt*-clk.h.
|
||||
|
||||
Example:
|
||||
|
||||
camsys: camsys@1a000000 {
|
||||
compatible = "mediatek,mt8183-camsys", "syscon";
|
||||
reg = <0 0x1a000000 0 0x1000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
@ -11,6 +11,7 @@ Required Properties:
|
||||
- "mediatek,mt6797-imgsys", "syscon"
|
||||
- "mediatek,mt7623-imgsys", "mediatek,mt2701-imgsys", "syscon"
|
||||
- "mediatek,mt8173-imgsys", "syscon"
|
||||
- "mediatek,mt8183-imgsys", "syscon"
|
||||
- #clock-cells: Must be 1
|
||||
|
||||
The imgsys controller uses the common clk binding from
|
||||
|
@ -15,6 +15,8 @@ Required Properties:
|
||||
- "mediatek,mt7629-infracfg", "syscon"
|
||||
- "mediatek,mt8135-infracfg", "syscon"
|
||||
- "mediatek,mt8173-infracfg", "syscon"
|
||||
- "mediatek,mt8183-infracfg", "syscon"
|
||||
- "mediatek,mt8516-infracfg", "syscon"
|
||||
- #clock-cells: Must be 1
|
||||
- #reset-cells: Must be 1
|
||||
|
||||
|
@ -0,0 +1,43 @@
|
||||
Mediatek IPU controller
|
||||
============================
|
||||
|
||||
The Mediatek ipu controller provides various clocks to the system.
|
||||
|
||||
Required Properties:
|
||||
|
||||
- compatible: Should be one of:
|
||||
- "mediatek,mt8183-ipu_conn", "syscon"
|
||||
- "mediatek,mt8183-ipu_adl", "syscon"
|
||||
- "mediatek,mt8183-ipu_core0", "syscon"
|
||||
- "mediatek,mt8183-ipu_core1", "syscon"
|
||||
- #clock-cells: Must be 1
|
||||
|
||||
The ipu controller uses the common clk binding from
|
||||
Documentation/devicetree/bindings/clock/clock-bindings.txt
|
||||
The available clocks are defined in dt-bindings/clock/mt*-clk.h.
|
||||
|
||||
Example:
|
||||
|
||||
ipu_conn: syscon@19000000 {
|
||||
compatible = "mediatek,mt8183-ipu_conn", "syscon";
|
||||
reg = <0 0x19000000 0 0x1000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
ipu_adl: syscon@19010000 {
|
||||
compatible = "mediatek,mt8183-ipu_adl", "syscon";
|
||||
reg = <0 0x19010000 0 0x1000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
ipu_core0: syscon@19180000 {
|
||||
compatible = "mediatek,mt8183-ipu_core0", "syscon";
|
||||
reg = <0 0x19180000 0 0x1000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
ipu_core1: syscon@19280000 {
|
||||
compatible = "mediatek,mt8183-ipu_core1", "syscon";
|
||||
reg = <0 0x19280000 0 0x1000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
@ -7,6 +7,7 @@ Required Properties:
|
||||
|
||||
- compatible: Should be one of:
|
||||
- "mediatek,mt2712-mcucfg", "syscon"
|
||||
- "mediatek,mt8183-mcucfg", "syscon"
|
||||
- #clock-cells: Must be 1
|
||||
|
||||
The mcucfg controller uses the common clk binding from
|
||||
|
@ -7,6 +7,7 @@ Required Properties:
|
||||
|
||||
- compatible: Should be one of:
|
||||
- "mediatek,mt2712-mfgcfg", "syscon"
|
||||
- "mediatek,mt8183-mfgcfg", "syscon"
|
||||
- #clock-cells: Must be 1
|
||||
|
||||
The mfgcfg controller uses the common clk binding from
|
||||
|
@ -11,6 +11,7 @@ Required Properties:
|
||||
- "mediatek,mt6797-mmsys", "syscon"
|
||||
- "mediatek,mt7623-mmsys", "mediatek,mt2701-mmsys", "syscon"
|
||||
- "mediatek,mt8173-mmsys", "syscon"
|
||||
- "mediatek,mt8183-mmsys", "syscon"
|
||||
- #clock-cells: Must be 1
|
||||
|
||||
The mmsys controller uses the common clk binding from
|
||||
|
@ -14,6 +14,8 @@ Required Properties:
|
||||
- "mediatek,mt7629-topckgen"
|
||||
- "mediatek,mt8135-topckgen"
|
||||
- "mediatek,mt8173-topckgen"
|
||||
- "mediatek,mt8183-topckgen", "syscon"
|
||||
- "mediatek,mt8516-topckgen"
|
||||
- #clock-cells: Must be 1
|
||||
|
||||
The topckgen controller uses the common clk binding from
|
||||
|
@ -11,6 +11,7 @@ Required Properties:
|
||||
- "mediatek,mt6797-vdecsys", "syscon"
|
||||
- "mediatek,mt7623-vdecsys", "mediatek,mt2701-vdecsys", "syscon"
|
||||
- "mediatek,mt8173-vdecsys", "syscon"
|
||||
- "mediatek,mt8183-vdecsys", "syscon"
|
||||
- #clock-cells: Must be 1
|
||||
|
||||
The vdecsys controller uses the common clk binding from
|
||||
|
@ -9,6 +9,7 @@ Required Properties:
|
||||
- "mediatek,mt2712-vencsys", "syscon"
|
||||
- "mediatek,mt6797-vencsys", "syscon"
|
||||
- "mediatek,mt8173-vencsys", "syscon"
|
||||
- "mediatek,mt8183-vencsys", "syscon"
|
||||
- #clock-cells: Must be 1
|
||||
|
||||
The vencsys controller uses the common clk binding from
|
||||
|
73
Documentation/devicetree/bindings/clock/milbeaut-clock.yaml
Normal file
73
Documentation/devicetree/bindings/clock/milbeaut-clock.yaml
Normal file
@ -0,0 +1,73 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/bindings/clock/milbeaut-clock.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Milbeaut SoCs Clock Controller Binding
|
||||
|
||||
maintainers:
|
||||
- Taichi Sugaya <sugaya.taichi@socionext.com>
|
||||
|
||||
description: |
|
||||
Milbeaut SoCs Clock controller is an integrated clock controller, which
|
||||
generates and supplies to all modules.
|
||||
|
||||
This binding uses common clock bindings
|
||||
[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
oneOf:
|
||||
- items:
|
||||
- enum:
|
||||
- socionext,milbeaut-m10v-ccu
|
||||
clocks:
|
||||
maxItems: 1
|
||||
description: external clock
|
||||
|
||||
'#clock-cells':
|
||||
const: 1
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- clocks
|
||||
- '#clock-cells'
|
||||
|
||||
examples:
|
||||
# Clock controller node:
|
||||
- |
|
||||
m10v-clk-ctrl@1d021000 {
|
||||
compatible = "socionext,milbeaut-m10v-clk-ccu";
|
||||
reg = <0x1d021000 0x4000>;
|
||||
#clock-cells = <1>;
|
||||
clocks = <&clki40mhz>;
|
||||
};
|
||||
|
||||
# Required an external clock for Clock controller node:
|
||||
- |
|
||||
clocks {
|
||||
clki40mhz: clki40mhz {
|
||||
compatible = "fixed-clock";
|
||||
#clock-cells = <0>;
|
||||
clock-frequency = <40000000>;
|
||||
};
|
||||
/* other clocks */
|
||||
};
|
||||
|
||||
# The clock consumer shall specify the desired clock-output of the clock
|
||||
# controller as below by specifying output-id in its "clk" phandle cell.
|
||||
# 2: uart
|
||||
# 4: 32-bit timer
|
||||
# 7: UHS-I/II
|
||||
- |
|
||||
serial@1e700010 {
|
||||
compatible = "socionext,milbeaut-usio-uart";
|
||||
reg = <0x1e700010 0x10>;
|
||||
interrupts = <0 141 0x4>, <0 149 0x4>;
|
||||
interrupt-names = "rx", "tx";
|
||||
clocks = <&clk 2>;
|
||||
};
|
||||
|
||||
...
|
19
Documentation/devicetree/bindings/clock/qcom,turingcc.txt
Normal file
19
Documentation/devicetree/bindings/clock/qcom,turingcc.txt
Normal file
@ -0,0 +1,19 @@
|
||||
Qualcomm Turing Clock & Reset Controller Binding
|
||||
------------------------------------------------
|
||||
|
||||
Required properties :
|
||||
- compatible: shall contain "qcom,qcs404-turingcc".
|
||||
- reg: shall contain base register location and length.
|
||||
- clocks: ahb clock for the TuringCC
|
||||
- #clock-cells: from common clock binding, shall contain 1.
|
||||
- #reset-cells: from common reset binding, shall contain 1.
|
||||
|
||||
Example:
|
||||
turingcc: clock-controller@800000 {
|
||||
compatible = "qcom,qcs404-turingcc";
|
||||
reg = <0x00800000 0x30000>;
|
||||
clocks = <&gcc GCC_CDSP_CFG_AHB_CLK>;
|
||||
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
};
|
@ -34,6 +34,7 @@ obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o
|
||||
obj-$(CONFIG_CLK_HSDK) += clk-hsdk-pll.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
|
||||
obj-$(CONFIG_ARCH_MOXART) += clk-moxart.o
|
||||
obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o
|
||||
obj-$(CONFIG_ARCH_NPCM7XX) += clk-npcm7xx.o
|
||||
|
663
drivers/clk/clk-milbeaut.c
Normal file
663
drivers/clk/clk-milbeaut.c
Normal file
@ -0,0 +1,663 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (C) 2018 Socionext Inc.
|
||||
* Copyright (C) 2016 Linaro Ltd.
|
||||
*/
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/iopoll.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
#define M10V_CLKSEL1 0x0
|
||||
#define CLKSEL(n) (((n) - 1) * 4 + M10V_CLKSEL1)
|
||||
|
||||
#define M10V_PLL1 "pll1"
|
||||
#define M10V_PLL1DIV2 "pll1-2"
|
||||
#define M10V_PLL2 "pll2"
|
||||
#define M10V_PLL2DIV2 "pll2-2"
|
||||
#define M10V_PLL6 "pll6"
|
||||
#define M10V_PLL6DIV2 "pll6-2"
|
||||
#define M10V_PLL6DIV3 "pll6-3"
|
||||
#define M10V_PLL7 "pll7"
|
||||
#define M10V_PLL7DIV2 "pll7-2"
|
||||
#define M10V_PLL7DIV5 "pll7-5"
|
||||
#define M10V_PLL9 "pll9"
|
||||
#define M10V_PLL10 "pll10"
|
||||
#define M10V_PLL10DIV2 "pll10-2"
|
||||
#define M10V_PLL11 "pll11"
|
||||
|
||||
#define M10V_SPI_PARENT0 "spi-parent0"
|
||||
#define M10V_SPI_PARENT1 "spi-parent1"
|
||||
#define M10V_SPI_PARENT2 "spi-parent2"
|
||||
#define M10V_UHS1CLK2_PARENT0 "uhs1clk2-parent0"
|
||||
#define M10V_UHS1CLK2_PARENT1 "uhs1clk2-parent1"
|
||||
#define M10V_UHS1CLK2_PARENT2 "uhs1clk2-parent2"
|
||||
#define M10V_UHS1CLK1_PARENT0 "uhs1clk1-parent0"
|
||||
#define M10V_UHS1CLK1_PARENT1 "uhs1clk1-parent1"
|
||||
#define M10V_NFCLK_PARENT0 "nfclk-parent0"
|
||||
#define M10V_NFCLK_PARENT1 "nfclk-parent1"
|
||||
#define M10V_NFCLK_PARENT2 "nfclk-parent2"
|
||||
#define M10V_NFCLK_PARENT3 "nfclk-parent3"
|
||||
#define M10V_NFCLK_PARENT4 "nfclk-parent4"
|
||||
#define M10V_NFCLK_PARENT5 "nfclk-parent5"
|
||||
|
||||
#define M10V_DCHREQ 1
|
||||
#define M10V_UPOLL_RATE 1
|
||||
#define M10V_UTIMEOUT 250
|
||||
|
||||
#define M10V_EMMCCLK_ID 0
|
||||
#define M10V_ACLK_ID 1
|
||||
#define M10V_HCLK_ID 2
|
||||
#define M10V_PCLK_ID 3
|
||||
#define M10V_RCLK_ID 4
|
||||
#define M10V_SPICLK_ID 5
|
||||
#define M10V_NFCLK_ID 6
|
||||
#define M10V_UHS1CLK2_ID 7
|
||||
#define M10V_NUM_CLKS 8
|
||||
|
||||
#define to_m10v_div(_hw) container_of(_hw, struct m10v_clk_divider, hw)
|
||||
|
||||
static struct clk_hw_onecell_data *m10v_clk_data;
|
||||
|
||||
static DEFINE_SPINLOCK(m10v_crglock);
|
||||
|
||||
struct m10v_clk_div_factors {
|
||||
const char *name;
|
||||
const char *parent_name;
|
||||
u32 offset;
|
||||
u8 shift;
|
||||
u8 width;
|
||||
const struct clk_div_table *table;
|
||||
unsigned long div_flags;
|
||||
int onecell_idx;
|
||||
};
|
||||
|
||||
struct m10v_clk_div_fixed_data {
|
||||
const char *name;
|
||||
const char *parent_name;
|
||||
u8 div;
|
||||
u8 mult;
|
||||
int onecell_idx;
|
||||
};
|
||||
|
||||
struct m10v_clk_mux_factors {
|
||||
const char *name;
|
||||
const char * const *parent_names;
|
||||
u8 num_parents;
|
||||
u32 offset;
|
||||
u8 shift;
|
||||
u8 mask;
|
||||
u32 *table;
|
||||
unsigned long mux_flags;
|
||||
int onecell_idx;
|
||||
};
|
||||
|
||||
static const struct clk_div_table emmcclk_table[] = {
|
||||
{ .val = 0, .div = 8 },
|
||||
{ .val = 1, .div = 9 },
|
||||
{ .val = 2, .div = 10 },
|
||||
{ .val = 3, .div = 15 },
|
||||
{ .div = 0 },
|
||||
};
|
||||
|
||||
static const struct clk_div_table mclk400_table[] = {
|
||||
{ .val = 1, .div = 2 },
|
||||
{ .val = 3, .div = 4 },
|
||||
{ .div = 0 },
|
||||
};
|
||||
|
||||
static const struct clk_div_table mclk200_table[] = {
|
||||
{ .val = 3, .div = 4 },
|
||||
{ .val = 7, .div = 8 },
|
||||
{ .div = 0 },
|
||||
};
|
||||
|
||||
static const struct clk_div_table aclk400_table[] = {
|
||||
{ .val = 1, .div = 2 },
|
||||
{ .val = 3, .div = 4 },
|
||||
{ .div = 0 },
|
||||
};
|
||||
|
||||
static const struct clk_div_table aclk300_table[] = {
|
||||
{ .val = 0, .div = 2 },
|
||||
{ .val = 1, .div = 3 },
|
||||
{ .div = 0 },
|
||||
};
|
||||
|
||||
static const struct clk_div_table aclk_table[] = {
|
||||
{ .val = 3, .div = 4 },
|
||||
{ .val = 7, .div = 8 },
|
||||
{ .div = 0 },
|
||||
};
|
||||
|
||||
static const struct clk_div_table aclkexs_table[] = {
|
||||
{ .val = 3, .div = 4 },
|
||||
{ .val = 4, .div = 5 },
|
||||
{ .val = 5, .div = 6 },
|
||||
{ .val = 7, .div = 8 },
|
||||
{ .div = 0 },
|
||||
};
|
||||
|
||||
static const struct clk_div_table hclk_table[] = {
|
||||
{ .val = 7, .div = 8 },
|
||||
{ .val = 15, .div = 16 },
|
||||
{ .div = 0 },
|
||||
};
|
||||
|
||||
static const struct clk_div_table hclkbmh_table[] = {
|
||||
{ .val = 3, .div = 4 },
|
||||
{ .val = 7, .div = 8 },
|
||||
{ .div = 0 },
|
||||
};
|
||||
|
||||
static const struct clk_div_table pclk_table[] = {
|
||||
{ .val = 15, .div = 16 },
|
||||
{ .val = 31, .div = 32 },
|
||||
{ .div = 0 },
|
||||
};
|
||||
|
||||
static const struct clk_div_table rclk_table[] = {
|
||||
{ .val = 0, .div = 8 },
|
||||
{ .val = 1, .div = 16 },
|
||||
{ .val = 2, .div = 24 },
|
||||
{ .val = 3, .div = 32 },
|
||||
{ .div = 0 },
|
||||
};
|
||||
|
||||
static const struct clk_div_table uhs1clk0_table[] = {
|
||||
{ .val = 0, .div = 2 },
|
||||
{ .val = 1, .div = 3 },
|
||||
{ .val = 2, .div = 4 },
|
||||
{ .val = 3, .div = 8 },
|
||||
{ .val = 4, .div = 16 },
|
||||
{ .div = 0 },
|
||||
};
|
||||
|
||||
static const struct clk_div_table uhs2clk_table[] = {
|
||||
{ .val = 0, .div = 9 },
|
||||
{ .val = 1, .div = 10 },
|
||||
{ .val = 2, .div = 11 },
|
||||
{ .val = 3, .div = 12 },
|
||||
{ .val = 4, .div = 13 },
|
||||
{ .val = 5, .div = 14 },
|
||||
{ .val = 6, .div = 16 },
|
||||
{ .val = 7, .div = 18 },
|
||||
{ .div = 0 },
|
||||
};
|
||||
|
||||
static u32 spi_mux_table[] = {0, 1, 2};
|
||||
static const char * const spi_mux_names[] = {
|
||||
M10V_SPI_PARENT0, M10V_SPI_PARENT1, M10V_SPI_PARENT2
|
||||
};
|
||||
|
||||
static u32 uhs1clk2_mux_table[] = {2, 3, 4, 8};
|
||||
static const char * const uhs1clk2_mux_names[] = {
|
||||
M10V_UHS1CLK2_PARENT0, M10V_UHS1CLK2_PARENT1,
|
||||
M10V_UHS1CLK2_PARENT2, M10V_PLL6DIV2
|
||||
};
|
||||
|
||||
static u32 uhs1clk1_mux_table[] = {3, 4, 8};
|
||||
static const char * const uhs1clk1_mux_names[] = {
|
||||
M10V_UHS1CLK1_PARENT0, M10V_UHS1CLK1_PARENT1, M10V_PLL6DIV2
|
||||
};
|
||||
|
||||
static u32 nfclk_mux_table[] = {0, 1, 2, 3, 4, 8};
|
||||
static const char * const nfclk_mux_names[] = {
|
||||
M10V_NFCLK_PARENT0, M10V_NFCLK_PARENT1, M10V_NFCLK_PARENT2,
|
||||
M10V_NFCLK_PARENT3, M10V_NFCLK_PARENT4, M10V_NFCLK_PARENT5
|
||||
};
|
||||
|
||||
static const struct m10v_clk_div_fixed_data m10v_pll_fixed_data[] = {
|
||||
{M10V_PLL1, NULL, 1, 40, -1},
|
||||
{M10V_PLL2, NULL, 1, 30, -1},
|
||||
{M10V_PLL6, NULL, 1, 35, -1},
|
||||
{M10V_PLL7, NULL, 1, 40, -1},
|
||||
{M10V_PLL9, NULL, 1, 33, -1},
|
||||
{M10V_PLL10, NULL, 5, 108, -1},
|
||||
{M10V_PLL10DIV2, M10V_PLL10, 2, 1, -1},
|
||||
{M10V_PLL11, NULL, 2, 75, -1},
|
||||
};
|
||||
|
||||
static const struct m10v_clk_div_fixed_data m10v_div_fixed_data[] = {
|
||||
{"usb2", NULL, 2, 1, -1},
|
||||
{"pcisuppclk", NULL, 20, 1, -1},
|
||||
{M10V_PLL1DIV2, M10V_PLL1, 2, 1, -1},
|
||||
{M10V_PLL2DIV2, M10V_PLL2, 2, 1, -1},
|
||||
{M10V_PLL6DIV2, M10V_PLL6, 2, 1, -1},
|
||||
{M10V_PLL6DIV3, M10V_PLL6, 3, 1, -1},
|
||||
{M10V_PLL7DIV2, M10V_PLL7, 2, 1, -1},
|
||||
{M10V_PLL7DIV5, M10V_PLL7, 5, 1, -1},
|
||||
{"ca7wd", M10V_PLL2DIV2, 12, 1, -1},
|
||||
{"pclkca7wd", M10V_PLL1DIV2, 16, 1, -1},
|
||||
{M10V_SPI_PARENT0, M10V_PLL10DIV2, 2, 1, -1},
|
||||
{M10V_SPI_PARENT1, M10V_PLL10DIV2, 4, 1, -1},
|
||||
{M10V_SPI_PARENT2, M10V_PLL7DIV2, 8, 1, -1},
|
||||
{M10V_UHS1CLK2_PARENT0, M10V_PLL7, 4, 1, -1},
|
||||
{M10V_UHS1CLK2_PARENT1, M10V_PLL7, 8, 1, -1},
|
||||
{M10V_UHS1CLK2_PARENT2, M10V_PLL7, 16, 1, -1},
|
||||
{M10V_UHS1CLK1_PARENT0, M10V_PLL7, 8, 1, -1},
|
||||
{M10V_UHS1CLK1_PARENT1, M10V_PLL7, 16, 1, -1},
|
||||
{M10V_NFCLK_PARENT0, M10V_PLL7DIV2, 8, 1, -1},
|
||||
{M10V_NFCLK_PARENT1, M10V_PLL7DIV2, 10, 1, -1},
|
||||
{M10V_NFCLK_PARENT2, M10V_PLL7DIV2, 13, 1, -1},
|
||||
{M10V_NFCLK_PARENT3, M10V_PLL7DIV2, 16, 1, -1},
|
||||
{M10V_NFCLK_PARENT4, M10V_PLL7DIV2, 40, 1, -1},
|
||||
{M10V_NFCLK_PARENT5, M10V_PLL7DIV5, 10, 1, -1},
|
||||
};
|
||||
|
||||
static const struct m10v_clk_div_factors m10v_div_factor_data[] = {
|
||||
{"emmc", M10V_PLL11, CLKSEL(1), 28, 3, emmcclk_table, 0,
|
||||
M10V_EMMCCLK_ID},
|
||||
{"mclk400", M10V_PLL1DIV2, CLKSEL(10), 7, 3, mclk400_table, 0, -1},
|
||||
{"mclk200", M10V_PLL1DIV2, CLKSEL(10), 3, 4, mclk200_table, 0, -1},
|
||||
{"aclk400", M10V_PLL1DIV2, CLKSEL(10), 0, 3, aclk400_table, 0, -1},
|
||||
{"aclk300", M10V_PLL2DIV2, CLKSEL(12), 0, 2, aclk300_table, 0, -1},
|
||||
{"aclk", M10V_PLL1DIV2, CLKSEL(9), 20, 4, aclk_table, 0, M10V_ACLK_ID},
|
||||
{"aclkexs", M10V_PLL1DIV2, CLKSEL(9), 16, 4, aclkexs_table, 0, -1},
|
||||
{"hclk", M10V_PLL1DIV2, CLKSEL(9), 7, 5, hclk_table, 0, M10V_HCLK_ID},
|
||||
{"hclkbmh", M10V_PLL1DIV2, CLKSEL(9), 12, 4, hclkbmh_table, 0, -1},
|
||||
{"pclk", M10V_PLL1DIV2, CLKSEL(9), 0, 7, pclk_table, 0, M10V_PCLK_ID},
|
||||
{"uhs1clk0", M10V_PLL7, CLKSEL(1), 3, 5, uhs1clk0_table, 0, -1},
|
||||
{"uhs2clk", M10V_PLL6DIV3, CLKSEL(1), 18, 4, uhs2clk_table, 0, -1},
|
||||
};
|
||||
|
||||
static const struct m10v_clk_mux_factors m10v_mux_factor_data[] = {
|
||||
{"spi", spi_mux_names, ARRAY_SIZE(spi_mux_names),
|
||||
CLKSEL(8), 3, 7, spi_mux_table, 0, M10V_SPICLK_ID},
|
||||
{"uhs1clk2", uhs1clk2_mux_names, ARRAY_SIZE(uhs1clk2_mux_names),
|
||||
CLKSEL(1), 13, 31, uhs1clk2_mux_table, 0, M10V_UHS1CLK2_ID},
|
||||
{"uhs1clk1", uhs1clk1_mux_names, ARRAY_SIZE(uhs1clk1_mux_names),
|
||||
CLKSEL(1), 8, 31, uhs1clk1_mux_table, 0, -1},
|
||||
{"nfclk", nfclk_mux_names, ARRAY_SIZE(nfclk_mux_names),
|
||||
CLKSEL(1), 22, 127, nfclk_mux_table, 0, M10V_NFCLK_ID},
|
||||
};
|
||||
|
||||
static u8 m10v_mux_get_parent(struct clk_hw *hw)
|
||||
{
|
||||
struct clk_mux *mux = to_clk_mux(hw);
|
||||
u32 val;
|
||||
|
||||
val = readl(mux->reg) >> mux->shift;
|
||||
val &= mux->mask;
|
||||
|
||||
return clk_mux_val_to_index(hw, mux->table, mux->flags, val);
|
||||
}
|
||||
|
||||
static int m10v_mux_set_parent(struct clk_hw *hw, u8 index)
|
||||
{
|
||||
struct clk_mux *mux = to_clk_mux(hw);
|
||||
u32 val = clk_mux_index_to_val(mux->table, mux->flags, index);
|
||||
unsigned long flags = 0;
|
||||
u32 reg;
|
||||
u32 write_en = BIT(fls(mux->mask) - 1);
|
||||
|
||||
if (mux->lock)
|
||||
spin_lock_irqsave(mux->lock, flags);
|
||||
else
|
||||
__acquire(mux->lock);
|
||||
|
||||
reg = readl(mux->reg);
|
||||
reg &= ~(mux->mask << mux->shift);
|
||||
|
||||
val = (val | write_en) << mux->shift;
|
||||
reg |= val;
|
||||
writel(reg, mux->reg);
|
||||
|
||||
if (mux->lock)
|
||||
spin_unlock_irqrestore(mux->lock, flags);
|
||||
else
|
||||
__release(mux->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clk_ops m10v_mux_ops = {
|
||||
.get_parent = m10v_mux_get_parent,
|
||||
.set_parent = m10v_mux_set_parent,
|
||||
.determine_rate = __clk_mux_determine_rate,
|
||||
};
|
||||
|
||||
static struct clk_hw *m10v_clk_hw_register_mux(struct device *dev,
|
||||
const char *name, const char * const *parent_names,
|
||||
u8 num_parents, unsigned long flags, void __iomem *reg,
|
||||
u8 shift, u32 mask, u8 clk_mux_flags, u32 *table,
|
||||
spinlock_t *lock)
|
||||
{
|
||||
struct clk_mux *mux;
|
||||
struct clk_hw *hw;
|
||||
struct clk_init_data init;
|
||||
int ret;
|
||||
|
||||
mux = kzalloc(sizeof(*mux), GFP_KERNEL);
|
||||
if (!mux)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
init.name = name;
|
||||
init.ops = &m10v_mux_ops;
|
||||
init.flags = flags;
|
||||
init.parent_names = parent_names;
|
||||
init.num_parents = num_parents;
|
||||
|
||||
mux->reg = reg;
|
||||
mux->shift = shift;
|
||||
mux->mask = mask;
|
||||
mux->flags = clk_mux_flags;
|
||||
mux->lock = lock;
|
||||
mux->table = table;
|
||||
mux->hw.init = &init;
|
||||
|
||||
hw = &mux->hw;
|
||||
ret = clk_hw_register(dev, hw);
|
||||
if (ret) {
|
||||
kfree(mux);
|
||||
hw = ERR_PTR(ret);
|
||||
}
|
||||
|
||||
return hw;
|
||||
|
||||
}
|
||||
|
||||
struct m10v_clk_divider {
|
||||
struct clk_hw hw;
|
||||
void __iomem *reg;
|
||||
u8 shift;
|
||||
u8 width;
|
||||
u8 flags;
|
||||
const struct clk_div_table *table;
|
||||
spinlock_t *lock;
|
||||
void __iomem *write_valid_reg;
|
||||
};
|
||||
|
||||
static unsigned long m10v_clk_divider_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct m10v_clk_divider *divider = to_m10v_div(hw);
|
||||
unsigned int val;
|
||||
|
||||
val = readl(divider->reg) >> divider->shift;
|
||||
val &= clk_div_mask(divider->width);
|
||||
|
||||
return divider_recalc_rate(hw, parent_rate, val, divider->table,
|
||||
divider->flags, divider->width);
|
||||
}
|
||||
|
||||
static long m10v_clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *prate)
|
||||
{
|
||||
struct m10v_clk_divider *divider = to_m10v_div(hw);
|
||||
|
||||
/* if read only, just return current value */
|
||||
if (divider->flags & CLK_DIVIDER_READ_ONLY) {
|
||||
u32 val;
|
||||
|
||||
val = readl(divider->reg) >> divider->shift;
|
||||
val &= clk_div_mask(divider->width);
|
||||
|
||||
return divider_ro_round_rate(hw, rate, prate, divider->table,
|
||||
divider->width, divider->flags,
|
||||
val);
|
||||
}
|
||||
|
||||
return divider_round_rate(hw, rate, prate, divider->table,
|
||||
divider->width, divider->flags);
|
||||
}
|
||||
|
||||
static int m10v_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct m10v_clk_divider *divider = to_m10v_div(hw);
|
||||
int value;
|
||||
unsigned long flags = 0;
|
||||
u32 val;
|
||||
u32 write_en = BIT(divider->width - 1);
|
||||
|
||||
value = divider_get_val(rate, parent_rate, divider->table,
|
||||
divider->width, divider->flags);
|
||||
if (value < 0)
|
||||
return value;
|
||||
|
||||
if (divider->lock)
|
||||
spin_lock_irqsave(divider->lock, flags);
|
||||
else
|
||||
__acquire(divider->lock);
|
||||
|
||||
val = readl(divider->reg);
|
||||
val &= ~(clk_div_mask(divider->width) << divider->shift);
|
||||
|
||||
val |= ((u32)value | write_en) << divider->shift;
|
||||
writel(val, divider->reg);
|
||||
|
||||
if (divider->write_valid_reg) {
|
||||
writel(M10V_DCHREQ, divider->write_valid_reg);
|
||||
if (readl_poll_timeout(divider->write_valid_reg, val,
|
||||
!val, M10V_UPOLL_RATE, M10V_UTIMEOUT))
|
||||
pr_err("%s:%s couldn't stabilize\n",
|
||||
__func__, divider->hw.init->name);
|
||||
}
|
||||
|
||||
if (divider->lock)
|
||||
spin_unlock_irqrestore(divider->lock, flags);
|
||||
else
|
||||
__release(divider->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clk_ops m10v_clk_divider_ops = {
|
||||
.recalc_rate = m10v_clk_divider_recalc_rate,
|
||||
.round_rate = m10v_clk_divider_round_rate,
|
||||
.set_rate = m10v_clk_divider_set_rate,
|
||||
};
|
||||
|
||||
static struct clk_hw *m10v_clk_hw_register_divider(struct device *dev,
|
||||
const char *name, const char *parent_name, unsigned long flags,
|
||||
void __iomem *reg, u8 shift, u8 width,
|
||||
u8 clk_divider_flags, const struct clk_div_table *table,
|
||||
spinlock_t *lock, void __iomem *write_valid_reg)
|
||||
{
|
||||
struct m10v_clk_divider *div;
|
||||
struct clk_hw *hw;
|
||||
struct clk_init_data init;
|
||||
int ret;
|
||||
|
||||
div = kzalloc(sizeof(*div), GFP_KERNEL);
|
||||
if (!div)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
init.name = name;
|
||||
init.ops = &m10v_clk_divider_ops;
|
||||
init.flags = flags;
|
||||
init.parent_names = &parent_name;
|
||||
init.num_parents = 1;
|
||||
|
||||
div->reg = reg;
|
||||
div->shift = shift;
|
||||
div->width = width;
|
||||
div->flags = clk_divider_flags;
|
||||
div->lock = lock;
|
||||
div->hw.init = &init;
|
||||
div->table = table;
|
||||
div->write_valid_reg = write_valid_reg;
|
||||
|
||||
/* register the clock */
|
||||
hw = &div->hw;
|
||||
ret = clk_hw_register(dev, hw);
|
||||
if (ret) {
|
||||
kfree(div);
|
||||
hw = ERR_PTR(ret);
|
||||
}
|
||||
|
||||
return hw;
|
||||
}
|
||||
|
||||
static void m10v_reg_div_pre(const struct m10v_clk_div_factors *factors,
|
||||
struct clk_hw_onecell_data *clk_data,
|
||||
void __iomem *base)
|
||||
{
|
||||
struct clk_hw *hw;
|
||||
void __iomem *write_valid_reg;
|
||||
|
||||
/*
|
||||
* The registers on CLKSEL(9) or CLKSEL(10) need additional
|
||||
* writing to become valid.
|
||||
*/
|
||||
if ((factors->offset == CLKSEL(9)) || (factors->offset == CLKSEL(10)))
|
||||
write_valid_reg = base + CLKSEL(11);
|
||||
else
|
||||
write_valid_reg = NULL;
|
||||
|
||||
hw = m10v_clk_hw_register_divider(NULL, factors->name,
|
||||
factors->parent_name,
|
||||
CLK_SET_RATE_PARENT,
|
||||
base + factors->offset,
|
||||
factors->shift,
|
||||
factors->width, factors->div_flags,
|
||||
factors->table,
|
||||
&m10v_crglock, write_valid_reg);
|
||||
|
||||
if (factors->onecell_idx >= 0)
|
||||
clk_data->hws[factors->onecell_idx] = hw;
|
||||
}
|
||||
|
||||
static void m10v_reg_fixed_pre(const struct m10v_clk_div_fixed_data *factors,
|
||||
struct clk_hw_onecell_data *clk_data,
|
||||
const char *parent_name)
|
||||
{
|
||||
struct clk_hw *hw;
|
||||
const char *pn = factors->parent_name ?
|
||||
factors->parent_name : parent_name;
|
||||
|
||||
hw = clk_hw_register_fixed_factor(NULL, factors->name, pn, 0,
|
||||
factors->mult, factors->div);
|
||||
|
||||
if (factors->onecell_idx >= 0)
|
||||
clk_data->hws[factors->onecell_idx] = hw;
|
||||
}
|
||||
|
||||
static void m10v_reg_mux_pre(const struct m10v_clk_mux_factors *factors,
|
||||
struct clk_hw_onecell_data *clk_data,
|
||||
void __iomem *base)
|
||||
{
|
||||
struct clk_hw *hw;
|
||||
|
||||
hw = m10v_clk_hw_register_mux(NULL, factors->name,
|
||||
factors->parent_names,
|
||||
factors->num_parents,
|
||||
CLK_SET_RATE_PARENT,
|
||||
base + factors->offset, factors->shift,
|
||||
factors->mask, factors->mux_flags,
|
||||
factors->table, &m10v_crglock);
|
||||
|
||||
if (factors->onecell_idx >= 0)
|
||||
clk_data->hws[factors->onecell_idx] = hw;
|
||||
}
|
||||
|
||||
static int m10v_clk_probe(struct platform_device *pdev)
|
||||
{
|
||||
int id;
|
||||
struct resource *res;
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *np = dev->of_node;
|
||||
void __iomem *base;
|
||||
const char *parent_name;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
base = devm_ioremap_resource(dev, res);
|
||||
if (IS_ERR(base))
|
||||
return PTR_ERR(base);
|
||||
|
||||
parent_name = of_clk_get_parent_name(np, 0);
|
||||
|
||||
for (id = 0; id < ARRAY_SIZE(m10v_div_factor_data); ++id)
|
||||
m10v_reg_div_pre(&m10v_div_factor_data[id],
|
||||
m10v_clk_data, base);
|
||||
|
||||
for (id = 0; id < ARRAY_SIZE(m10v_div_fixed_data); ++id)
|
||||
m10v_reg_fixed_pre(&m10v_div_fixed_data[id],
|
||||
m10v_clk_data, parent_name);
|
||||
|
||||
for (id = 0; id < ARRAY_SIZE(m10v_mux_factor_data); ++id)
|
||||
m10v_reg_mux_pre(&m10v_mux_factor_data[id],
|
||||
m10v_clk_data, base);
|
||||
|
||||
for (id = 0; id < M10V_NUM_CLKS; id++) {
|
||||
if (IS_ERR(m10v_clk_data->hws[id]))
|
||||
return PTR_ERR(m10v_clk_data->hws[id]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id m10v_clk_dt_ids[] = {
|
||||
{ .compatible = "socionext,milbeaut-m10v-ccu", },
|
||||
{ }
|
||||
};
|
||||
|
||||
static struct platform_driver m10v_clk_driver = {
|
||||
.probe = m10v_clk_probe,
|
||||
.driver = {
|
||||
.name = "m10v-ccu",
|
||||
.of_match_table = m10v_clk_dt_ids,
|
||||
},
|
||||
};
|
||||
builtin_platform_driver(m10v_clk_driver);
|
||||
|
||||
static void __init m10v_cc_init(struct device_node *np)
|
||||
{
|
||||
int id;
|
||||
void __iomem *base;
|
||||
const char *parent_name;
|
||||
struct clk_hw *hw;
|
||||
|
||||
m10v_clk_data = kzalloc(struct_size(m10v_clk_data, hws,
|
||||
M10V_NUM_CLKS),
|
||||
GFP_KERNEL);
|
||||
|
||||
if (!m10v_clk_data)
|
||||
return;
|
||||
|
||||
base = of_iomap(np, 0);
|
||||
if (!base) {
|
||||
kfree(m10v_clk_data);
|
||||
return;
|
||||
}
|
||||
|
||||
parent_name = of_clk_get_parent_name(np, 0);
|
||||
if (!parent_name) {
|
||||
kfree(m10v_clk_data);
|
||||
iounmap(base);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* This way all clocks fetched before the platform device probes,
|
||||
* except those we assign here for early use, will be deferred.
|
||||
*/
|
||||
for (id = 0; id < M10V_NUM_CLKS; id++)
|
||||
m10v_clk_data->hws[id] = ERR_PTR(-EPROBE_DEFER);
|
||||
|
||||
/*
|
||||
* PLLs are set by bootloader so this driver registers them as the
|
||||
* fixed factor.
|
||||
*/
|
||||
for (id = 0; id < ARRAY_SIZE(m10v_pll_fixed_data); ++id)
|
||||
m10v_reg_fixed_pre(&m10v_pll_fixed_data[id],
|
||||
m10v_clk_data, parent_name);
|
||||
|
||||
/*
|
||||
* timer consumes "rclk" so it needs to register here.
|
||||
*/
|
||||
hw = m10v_clk_hw_register_divider(NULL, "rclk", M10V_PLL10DIV2, 0,
|
||||
base + CLKSEL(1), 0, 3, 0, rclk_table,
|
||||
&m10v_crglock, NULL);
|
||||
m10v_clk_data->hws[M10V_RCLK_ID] = hw;
|
||||
|
||||
m10v_clk_data->num = M10V_NUM_CLKS;
|
||||
of_clk_add_hw_provider(np, of_clk_hw_onecell_get, m10v_clk_data);
|
||||
}
|
||||
CLK_OF_DECLARE_DRIVER(m10v_cc, "socionext,milbeaut-m10v-ccu", m10v_cc_init);
|
@ -35,7 +35,7 @@ obj-$(CONFIG_SOC_IMX25) += clk-imx25.o
|
||||
obj-$(CONFIG_SOC_IMX27) += clk-imx27.o
|
||||
obj-$(CONFIG_SOC_IMX31) += clk-imx31.o
|
||||
obj-$(CONFIG_SOC_IMX35) += clk-imx35.o
|
||||
obj-$(CONFIG_SOC_IMX5) += clk-imx51-imx53.o
|
||||
obj-$(CONFIG_SOC_IMX5) += clk-imx5.o
|
||||
obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o
|
||||
obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o
|
||||
obj-$(CONFIG_SOC_IMX6SLL) += clk-imx6sll.o
|
||||
|
@ -164,10 +164,6 @@ static void __init mx5_clocks_common_init(void __iomem *ccm_base)
|
||||
clk[IMX5_CLK_CKIH1] = imx_obtain_fixed_clock("ckih1", 0);
|
||||
clk[IMX5_CLK_CKIH2] = imx_obtain_fixed_clock("ckih2", 0);
|
||||
|
||||
clk[IMX5_CLK_PERIPH_APM] = imx_clk_mux("periph_apm", MXC_CCM_CBCMR, 12, 2,
|
||||
periph_apm_sel, ARRAY_SIZE(periph_apm_sel));
|
||||
clk[IMX5_CLK_MAIN_BUS] = imx_clk_mux("main_bus", MXC_CCM_CBCDR, 25, 1,
|
||||
main_bus_sel, ARRAY_SIZE(main_bus_sel));
|
||||
clk[IMX5_CLK_PER_LP_APM] = imx_clk_mux("per_lp_apm", MXC_CCM_CBCMR, 1, 1,
|
||||
per_lp_apm_sel, ARRAY_SIZE(per_lp_apm_sel));
|
||||
clk[IMX5_CLK_PER_PRED1] = imx_clk_divider("per_pred1", "per_lp_apm", MXC_CCM_CBCDR, 6, 2);
|
||||
@ -191,16 +187,10 @@ static void __init mx5_clocks_common_init(void __iomem *ccm_base)
|
||||
clk[IMX5_CLK_UART_PRED] = imx_clk_divider("uart_pred", "uart_sel", MXC_CCM_CSCDR1, 3, 3);
|
||||
clk[IMX5_CLK_UART_ROOT] = imx_clk_divider("uart_root", "uart_pred", MXC_CCM_CSCDR1, 0, 3);
|
||||
|
||||
clk[IMX5_CLK_ESDHC_A_SEL] = imx_clk_mux("esdhc_a_sel", MXC_CCM_CSCMR1, 20, 2,
|
||||
standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
|
||||
clk[IMX5_CLK_ESDHC_B_SEL] = imx_clk_mux("esdhc_b_sel", MXC_CCM_CSCMR1, 16, 2,
|
||||
standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
|
||||
clk[IMX5_CLK_ESDHC_A_PRED] = imx_clk_divider("esdhc_a_pred", "esdhc_a_sel", MXC_CCM_CSCDR1, 16, 3);
|
||||
clk[IMX5_CLK_ESDHC_A_PODF] = imx_clk_divider("esdhc_a_podf", "esdhc_a_pred", MXC_CCM_CSCDR1, 11, 3);
|
||||
clk[IMX5_CLK_ESDHC_B_PRED] = imx_clk_divider("esdhc_b_pred", "esdhc_b_sel", MXC_CCM_CSCDR1, 22, 3);
|
||||
clk[IMX5_CLK_ESDHC_B_PODF] = imx_clk_divider("esdhc_b_podf", "esdhc_b_pred", MXC_CCM_CSCDR1, 19, 3);
|
||||
clk[IMX5_CLK_ESDHC_C_SEL] = imx_clk_mux("esdhc_c_sel", MXC_CCM_CSCMR1, 19, 1, esdhc_c_sel, ARRAY_SIZE(esdhc_c_sel));
|
||||
clk[IMX5_CLK_ESDHC_D_SEL] = imx_clk_mux("esdhc_d_sel", MXC_CCM_CSCMR1, 18, 1, esdhc_d_sel, ARRAY_SIZE(esdhc_d_sel));
|
||||
|
||||
clk[IMX5_CLK_EMI_SEL] = imx_clk_mux("emi_sel", MXC_CCM_CBCDR, 26, 1,
|
||||
emi_slow_sel, ARRAY_SIZE(emi_slow_sel));
|
||||
@ -311,10 +301,6 @@ static void __init mx5_clocks_common_init(void __iomem *ccm_base)
|
||||
clk_register_clkdev(clk[IMX5_CLK_CPU_PODF], NULL, "cpu0");
|
||||
clk_register_clkdev(clk[IMX5_CLK_GPC_DVFS], "gpc_dvfs", NULL);
|
||||
|
||||
/* Set SDHC parents to be PLL2 */
|
||||
clk_set_parent(clk[IMX5_CLK_ESDHC_A_SEL], clk[IMX5_CLK_PLL2_SW]);
|
||||
clk_set_parent(clk[IMX5_CLK_ESDHC_B_SEL], clk[IMX5_CLK_PLL2_SW]);
|
||||
|
||||
/* move usb phy clk to 24MHz */
|
||||
clk_set_parent(clk[IMX5_CLK_USB_PHY_SEL], clk[IMX5_CLK_OSC]);
|
||||
}
|
||||
@ -342,8 +328,21 @@ static void __init mx50_clocks_init(struct device_node *np)
|
||||
|
||||
mx5_clocks_common_init(ccm_base);
|
||||
|
||||
/*
|
||||
* This clock is called periph_clk in the i.MX50 Reference Manual, but
|
||||
* it comes closest in scope to the main_bus_clk of i.MX51 and i.MX53
|
||||
*/
|
||||
clk[IMX5_CLK_MAIN_BUS] = imx_clk_mux("main_bus", MXC_CCM_CBCDR, 25, 2,
|
||||
standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
|
||||
|
||||
clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 10, 1,
|
||||
lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
|
||||
clk[IMX5_CLK_ESDHC_A_SEL] = imx_clk_mux("esdhc_a_sel", MXC_CCM_CSCMR1, 21, 2,
|
||||
standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
|
||||
clk[IMX5_CLK_ESDHC_B_SEL] = imx_clk_mux("esdhc_b_sel", MXC_CCM_CSCMR1, 16, 2,
|
||||
standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
|
||||
clk[IMX5_CLK_ESDHC_C_SEL] = imx_clk_mux("esdhc_c_sel", MXC_CCM_CSCMR1, 20, 1, esdhc_c_sel, ARRAY_SIZE(esdhc_c_sel));
|
||||
clk[IMX5_CLK_ESDHC_D_SEL] = imx_clk_mux("esdhc_d_sel", MXC_CCM_CSCMR1, 19, 1, esdhc_d_sel, ARRAY_SIZE(esdhc_d_sel));
|
||||
clk[IMX5_CLK_ESDHC1_PER_GATE] = imx_clk_gate2("esdhc1_per_gate", "esdhc_a_podf", MXC_CCM_CCGR3, 2);
|
||||
clk[IMX5_CLK_ESDHC2_PER_GATE] = imx_clk_gate2("esdhc2_per_gate", "esdhc_c_sel", MXC_CCM_CCGR3, 6);
|
||||
clk[IMX5_CLK_ESDHC3_PER_GATE] = imx_clk_gate2("esdhc3_per_gate", "esdhc_b_podf", MXC_CCM_CCGR3, 10);
|
||||
@ -372,6 +371,10 @@ static void __init mx50_clocks_init(struct device_node *np)
|
||||
clk_data.clk_num = ARRAY_SIZE(clk);
|
||||
of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
|
||||
|
||||
/* Set SDHC parents to be PLL2 */
|
||||
clk_set_parent(clk[IMX5_CLK_ESDHC_A_SEL], clk[IMX5_CLK_PLL2_SW]);
|
||||
clk_set_parent(clk[IMX5_CLK_ESDHC_B_SEL], clk[IMX5_CLK_PLL2_SW]);
|
||||
|
||||
/* set SDHC root clock to 200MHZ*/
|
||||
clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 200000000);
|
||||
clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 200000000);
|
||||
@ -410,6 +413,10 @@ static void __init mx51_clocks_init(struct device_node *np)
|
||||
|
||||
mx5_clocks_common_init(ccm_base);
|
||||
|
||||
clk[IMX5_CLK_PERIPH_APM] = imx_clk_mux("periph_apm", MXC_CCM_CBCMR, 12, 2,
|
||||
periph_apm_sel, ARRAY_SIZE(periph_apm_sel));
|
||||
clk[IMX5_CLK_MAIN_BUS] = imx_clk_mux("main_bus", MXC_CCM_CBCDR, 25, 1,
|
||||
main_bus_sel, ARRAY_SIZE(main_bus_sel));
|
||||
clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 9, 1,
|
||||
lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
|
||||
clk[IMX5_CLK_IPU_DI0_SEL] = imx_clk_mux_flags("ipu_di0_sel", MXC_CCM_CSCMR2, 26, 3,
|
||||
@ -422,6 +429,12 @@ static void __init mx51_clocks_init(struct device_node *np)
|
||||
mx51_tve_sel, ARRAY_SIZE(mx51_tve_sel));
|
||||
clk[IMX5_CLK_TVE_GATE] = imx_clk_gate2("tve_gate", "tve_sel", MXC_CCM_CCGR2, 30);
|
||||
clk[IMX5_CLK_TVE_PRED] = imx_clk_divider("tve_pred", "pll3_sw", MXC_CCM_CDCDR, 28, 3);
|
||||
clk[IMX5_CLK_ESDHC_A_SEL] = imx_clk_mux("esdhc_a_sel", MXC_CCM_CSCMR1, 20, 2,
|
||||
standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
|
||||
clk[IMX5_CLK_ESDHC_B_SEL] = imx_clk_mux("esdhc_b_sel", MXC_CCM_CSCMR1, 16, 2,
|
||||
standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
|
||||
clk[IMX5_CLK_ESDHC_C_SEL] = imx_clk_mux("esdhc_c_sel", MXC_CCM_CSCMR1, 19, 1, esdhc_c_sel, ARRAY_SIZE(esdhc_c_sel));
|
||||
clk[IMX5_CLK_ESDHC_D_SEL] = imx_clk_mux("esdhc_d_sel", MXC_CCM_CSCMR1, 18, 1, esdhc_d_sel, ARRAY_SIZE(esdhc_d_sel));
|
||||
clk[IMX5_CLK_ESDHC1_PER_GATE] = imx_clk_gate2("esdhc1_per_gate", "esdhc_a_podf", MXC_CCM_CCGR3, 2);
|
||||
clk[IMX5_CLK_ESDHC2_PER_GATE] = imx_clk_gate2("esdhc2_per_gate", "esdhc_b_podf", MXC_CCM_CCGR3, 6);
|
||||
clk[IMX5_CLK_ESDHC3_PER_GATE] = imx_clk_gate2("esdhc3_per_gate", "esdhc_c_sel", MXC_CCM_CCGR3, 10);
|
||||
@ -452,6 +465,10 @@ static void __init mx51_clocks_init(struct device_node *np)
|
||||
/* set the usboh3 parent to pll2_sw */
|
||||
clk_set_parent(clk[IMX5_CLK_USBOH3_SEL], clk[IMX5_CLK_PLL2_SW]);
|
||||
|
||||
/* Set SDHC parents to be PLL2 */
|
||||
clk_set_parent(clk[IMX5_CLK_ESDHC_A_SEL], clk[IMX5_CLK_PLL2_SW]);
|
||||
clk_set_parent(clk[IMX5_CLK_ESDHC_B_SEL], clk[IMX5_CLK_PLL2_SW]);
|
||||
|
||||
/* set SDHC root clock to 166.25MHZ*/
|
||||
clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 166250000);
|
||||
clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 166250000);
|
||||
@ -506,6 +523,10 @@ static void __init mx53_clocks_init(struct device_node *np)
|
||||
|
||||
mx5_clocks_common_init(ccm_base);
|
||||
|
||||
clk[IMX5_CLK_PERIPH_APM] = imx_clk_mux("periph_apm", MXC_CCM_CBCMR, 12, 2,
|
||||
periph_apm_sel, ARRAY_SIZE(periph_apm_sel));
|
||||
clk[IMX5_CLK_MAIN_BUS] = imx_clk_mux("main_bus", MXC_CCM_CBCDR, 25, 1,
|
||||
main_bus_sel, ARRAY_SIZE(main_bus_sel));
|
||||
clk[IMX5_CLK_LP_APM] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 10, 1,
|
||||
lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
|
||||
clk[IMX5_CLK_LDB_DI1_DIV_3_5] = imx_clk_fixed_factor("ldb_di1_div_3_5", "ldb_di1_sel", 2, 7);
|
||||
@ -527,6 +548,12 @@ static void __init mx53_clocks_init(struct device_node *np)
|
||||
mx53_tve_ext_sel, ARRAY_SIZE(mx53_tve_ext_sel), CLK_SET_RATE_PARENT);
|
||||
clk[IMX5_CLK_TVE_GATE] = imx_clk_gate2("tve_gate", "tve_pred", MXC_CCM_CCGR2, 30);
|
||||
clk[IMX5_CLK_TVE_PRED] = imx_clk_divider("tve_pred", "tve_ext_sel", MXC_CCM_CDCDR, 28, 3);
|
||||
clk[IMX5_CLK_ESDHC_A_SEL] = imx_clk_mux("esdhc_a_sel", MXC_CCM_CSCMR1, 20, 2,
|
||||
standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
|
||||
clk[IMX5_CLK_ESDHC_B_SEL] = imx_clk_mux("esdhc_b_sel", MXC_CCM_CSCMR1, 16, 2,
|
||||
standard_pll_sel, ARRAY_SIZE(standard_pll_sel));
|
||||
clk[IMX5_CLK_ESDHC_C_SEL] = imx_clk_mux("esdhc_c_sel", MXC_CCM_CSCMR1, 19, 1, esdhc_c_sel, ARRAY_SIZE(esdhc_c_sel));
|
||||
clk[IMX5_CLK_ESDHC_D_SEL] = imx_clk_mux("esdhc_d_sel", MXC_CCM_CSCMR1, 18, 1, esdhc_d_sel, ARRAY_SIZE(esdhc_d_sel));
|
||||
clk[IMX5_CLK_ESDHC1_PER_GATE] = imx_clk_gate2("esdhc1_per_gate", "esdhc_a_podf", MXC_CCM_CCGR3, 2);
|
||||
clk[IMX5_CLK_ESDHC2_PER_GATE] = imx_clk_gate2("esdhc2_per_gate", "esdhc_c_sel", MXC_CCM_CCGR3, 6);
|
||||
clk[IMX5_CLK_ESDHC3_PER_GATE] = imx_clk_gate2("esdhc3_per_gate", "esdhc_b_podf", MXC_CCM_CCGR3, 10);
|
||||
@ -589,6 +616,10 @@ static void __init mx53_clocks_init(struct device_node *np)
|
||||
clk_data.clk_num = ARRAY_SIZE(clk);
|
||||
of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
|
||||
|
||||
/* Set SDHC parents to be PLL2 */
|
||||
clk_set_parent(clk[IMX5_CLK_ESDHC_A_SEL], clk[IMX5_CLK_PLL2_SW]);
|
||||
clk_set_parent(clk[IMX5_CLK_ESDHC_B_SEL], clk[IMX5_CLK_PLL2_SW]);
|
||||
|
||||
/* set SDHC root clock to 200MHZ*/
|
||||
clk_set_rate(clk[IMX5_CLK_ESDHC_A_PODF], 200000000);
|
||||
clk_set_rate(clk[IMX5_CLK_ESDHC_B_PODF], 200000000);
|
@ -76,6 +76,20 @@ static u32 share_count_ssi1;
|
||||
static u32 share_count_ssi2;
|
||||
static u32 share_count_ssi3;
|
||||
|
||||
static struct clk ** const uart_clks[] __initconst = {
|
||||
&clks[IMX6SLL_CLK_UART1_IPG],
|
||||
&clks[IMX6SLL_CLK_UART1_SERIAL],
|
||||
&clks[IMX6SLL_CLK_UART2_IPG],
|
||||
&clks[IMX6SLL_CLK_UART2_SERIAL],
|
||||
&clks[IMX6SLL_CLK_UART3_IPG],
|
||||
&clks[IMX6SLL_CLK_UART3_SERIAL],
|
||||
&clks[IMX6SLL_CLK_UART4_IPG],
|
||||
&clks[IMX6SLL_CLK_UART4_SERIAL],
|
||||
&clks[IMX6SLL_CLK_UART5_IPG],
|
||||
&clks[IMX6SLL_CLK_UART5_SERIAL],
|
||||
NULL
|
||||
};
|
||||
|
||||
static void __init imx6sll_clocks_init(struct device_node *ccm_node)
|
||||
{
|
||||
struct device_node *np;
|
||||
@ -268,7 +282,7 @@ static void __init imx6sll_clocks_init(struct device_node *ccm_node)
|
||||
clks[IMX6SLL_CLK_GPT_BUS] = imx_clk_gate2("gpt1_bus", "perclk", base + 0x6c, 20);
|
||||
clks[IMX6SLL_CLK_GPT_SERIAL] = imx_clk_gate2("gpt1_serial", "perclk", base + 0x6c, 22);
|
||||
clks[IMX6SLL_CLK_UART4_IPG] = imx_clk_gate2("uart4_ipg", "ipg", base + 0x6c, 24);
|
||||
clks[IMX6SLL_CLK_UART4_SERIAL] = imx_clk_gate2("uart4_serail", "uart_podf", base + 0x6c, 24);
|
||||
clks[IMX6SLL_CLK_UART4_SERIAL] = imx_clk_gate2("uart4_serial", "uart_podf", base + 0x6c, 24);
|
||||
clks[IMX6SLL_CLK_GPIO1] = imx_clk_gate2("gpio1", "ipg", base + 0x6c, 26);
|
||||
clks[IMX6SLL_CLK_GPIO5] = imx_clk_gate2("gpio5", "ipg", base + 0x6c, 30);
|
||||
|
||||
@ -334,6 +348,8 @@ static void __init imx6sll_clocks_init(struct device_node *ccm_node)
|
||||
clk_data.clk_num = ARRAY_SIZE(clks);
|
||||
of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
|
||||
|
||||
imx_register_uart_clocks(uart_clks);
|
||||
|
||||
/* Lower the AHB clock rate before changing the clock source. */
|
||||
clk_set_rate(clks[IMX6SLL_CLK_AHB], 99000000);
|
||||
|
||||
|
@ -417,8 +417,8 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node)
|
||||
clks[IMX7D_PLL_DRAM_MAIN] = imx_clk_pllv3(IMX_PLLV3_DDR_IMX7, "pll_dram_main", "osc", base + 0x70, 0x7f);
|
||||
clks[IMX7D_PLL_SYS_MAIN] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll_sys_main", "osc", base + 0xb0, 0x1);
|
||||
clks[IMX7D_PLL_ENET_MAIN] = imx_clk_pllv3(IMX_PLLV3_ENET_IMX7, "pll_enet_main", "osc", base + 0xe0, 0x0);
|
||||
clks[IMX7D_PLL_AUDIO_MAIN] = imx_clk_pllv3(IMX_PLLV3_AV, "pll_audio_main", "osc", base + 0xf0, 0x7f);
|
||||
clks[IMX7D_PLL_VIDEO_MAIN] = imx_clk_pllv3(IMX_PLLV3_AV, "pll_video_main", "osc", base + 0x130, 0x7f);
|
||||
clks[IMX7D_PLL_AUDIO_MAIN] = imx_clk_pllv3(IMX_PLLV3_AV_IMX7, "pll_audio_main", "osc", base + 0xf0, 0x7f);
|
||||
clks[IMX7D_PLL_VIDEO_MAIN] = imx_clk_pllv3(IMX_PLLV3_AV_IMX7, "pll_video_main", "osc", base + 0x130, 0x7f);
|
||||
|
||||
clks[IMX7D_PLL_ARM_MAIN_BYPASS] = imx_clk_mux_flags("pll_arm_main_bypass", base + 0x60, 16, 1, pll_arm_bypass_sel, ARRAY_SIZE(pll_arm_bypass_sel), CLK_SET_RATE_PARENT);
|
||||
clks[IMX7D_PLL_DRAM_MAIN_BYPASS] = imx_clk_mux_flags("pll_dram_main_bypass", base + 0x70, 16, 1, pll_dram_bypass_sel, ARRAY_SIZE(pll_dram_bypass_sel), CLK_SET_RATE_PARENT);
|
||||
|
@ -151,7 +151,6 @@ static void __init imx7ulp_clk_pcc2_init(struct device_node *np)
|
||||
clks[IMX7ULP_CLK_DMA1] = imx_clk_hw_gate("dma1", "nic1_clk", base + 0x20, 30);
|
||||
clks[IMX7ULP_CLK_RGPIO2P1] = imx_clk_hw_gate("rgpio2p1", "nic1_bus_clk", base + 0x3c, 30);
|
||||
clks[IMX7ULP_CLK_DMA_MUX1] = imx_clk_hw_gate("dma_mux1", "nic1_bus_clk", base + 0x84, 30);
|
||||
clks[IMX7ULP_CLK_SNVS] = imx_clk_hw_gate("snvs", "nic1_bus_clk", base + 0x8c, 30);
|
||||
clks[IMX7ULP_CLK_CAAM] = imx_clk_hw_gate("caam", "nic1_clk", base + 0x90, 30);
|
||||
clks[IMX7ULP_CLK_LPTPM4] = imx7ulp_clk_composite("lptpm4", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x94);
|
||||
clks[IMX7ULP_CLK_LPTPM5] = imx7ulp_clk_composite("lptpm5", periph_bus_sels, ARRAY_SIZE(periph_bus_sels), true, false, true, base + 0x98);
|
||||
|
@ -458,6 +458,7 @@ static int imx8mq_clocks_probe(struct platform_device *pdev)
|
||||
clks[IMX8MQ_CLK_DSI_DBI] = imx8m_clk_composite("dsi_dbi", imx8mq_dsi_dbi_sels, base + 0xbc00);
|
||||
clks[IMX8MQ_CLK_DSI_ESC] = imx8m_clk_composite("dsi_esc", imx8mq_dsi_esc_sels, base + 0xbc80);
|
||||
clks[IMX8MQ_CLK_DSI_AHB] = imx8m_clk_composite("dsi_ahb", imx8mq_dsi_ahb_sels, base + 0x9200);
|
||||
clks[IMX8MQ_CLK_DSI_IPG_DIV] = imx_clk_divider2("dsi_ipg_div", "dsi_ahb", base + 0x9280, 0, 6);
|
||||
clks[IMX8MQ_CLK_CSI1_CORE] = imx8m_clk_composite("csi1_core", imx8mq_csi1_core_sels, base + 0xbd00);
|
||||
clks[IMX8MQ_CLK_CSI1_PHY_REF] = imx8m_clk_composite("csi1_phy_ref", imx8mq_csi1_phy_sels, base + 0xbd80);
|
||||
clks[IMX8MQ_CLK_CSI1_ESC] = imx8m_clk_composite("csi1_esc", imx8mq_csi1_esc_sels, base + 0xbe00);
|
||||
|
@ -43,7 +43,7 @@ static int clk_pfdv2_wait(struct clk_pfdv2 *pfd)
|
||||
{
|
||||
u32 val;
|
||||
|
||||
return readl_poll_timeout(pfd->reg, val, val & pfd->vld_bit,
|
||||
return readl_poll_timeout(pfd->reg, val, val & (1 << pfd->vld_bit),
|
||||
0, LOCK_TIMEOUT_US);
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ static int clk_pfdv2_enable(struct clk_hw *hw)
|
||||
|
||||
spin_lock_irqsave(&pfd_lock, flags);
|
||||
val = readl_relaxed(pfd->reg);
|
||||
val &= ~pfd->gate_bit;
|
||||
val &= ~(1 << pfd->gate_bit);
|
||||
writel_relaxed(val, pfd->reg);
|
||||
spin_unlock_irqrestore(&pfd_lock, flags);
|
||||
|
||||
@ -70,7 +70,7 @@ static void clk_pfdv2_disable(struct clk_hw *hw)
|
||||
|
||||
spin_lock_irqsave(&pfd_lock, flags);
|
||||
val = readl_relaxed(pfd->reg);
|
||||
val |= pfd->gate_bit;
|
||||
val |= (1 << pfd->gate_bit);
|
||||
writel_relaxed(val, pfd->reg);
|
||||
spin_unlock_irqrestore(&pfd_lock, flags);
|
||||
}
|
||||
@ -123,7 +123,7 @@ static int clk_pfdv2_is_enabled(struct clk_hw *hw)
|
||||
{
|
||||
struct clk_pfdv2 *pfd = to_clk_pfdv2(hw);
|
||||
|
||||
if (readl_relaxed(pfd->reg) & pfd->gate_bit)
|
||||
if (readl_relaxed(pfd->reg) & (1 << pfd->gate_bit))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
@ -180,7 +180,7 @@ struct clk_hw *imx_clk_pfdv2(const char *name, const char *parent_name,
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
pfd->reg = reg;
|
||||
pfd->gate_bit = 1 << ((idx + 1) * 8 - 1);
|
||||
pfd->gate_bit = (idx + 1) * 8 - 1;
|
||||
pfd->vld_bit = pfd->gate_bit - 1;
|
||||
pfd->frac_off = idx * 8;
|
||||
|
||||
|
@ -74,10 +74,9 @@ static unsigned long clk_pll1416x_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_pll14xx *pll = to_clk_pll14xx(hw);
|
||||
u32 mdiv, pdiv, sdiv, pll_gnrl, pll_div;
|
||||
u32 mdiv, pdiv, sdiv, pll_div;
|
||||
u64 fvco = parent_rate;
|
||||
|
||||
pll_gnrl = readl_relaxed(pll->base);
|
||||
pll_div = readl_relaxed(pll->base + 4);
|
||||
mdiv = (pll_div & MDIV_MASK) >> MDIV_SHIFT;
|
||||
pdiv = (pll_div & PDIV_MASK) >> PDIV_SHIFT;
|
||||
@ -93,11 +92,10 @@ static unsigned long clk_pll1443x_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_pll14xx *pll = to_clk_pll14xx(hw);
|
||||
u32 mdiv, pdiv, sdiv, pll_gnrl, pll_div_ctl0, pll_div_ctl1;
|
||||
u32 mdiv, pdiv, sdiv, pll_div_ctl0, pll_div_ctl1;
|
||||
short int kdiv;
|
||||
u64 fvco = parent_rate;
|
||||
|
||||
pll_gnrl = readl_relaxed(pll->base);
|
||||
pll_div_ctl0 = readl_relaxed(pll->base + 4);
|
||||
pll_div_ctl1 = readl_relaxed(pll->base + 8);
|
||||
mdiv = (pll_div_ctl0 & MDIV_MASK) >> MDIV_SHIFT;
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#define PLL_NUM_OFFSET 0x10
|
||||
#define PLL_DENOM_OFFSET 0x20
|
||||
#define PLL_IMX7_NUM_OFFSET 0x20
|
||||
#define PLL_IMX7_DENOM_OFFSET 0x30
|
||||
|
||||
#define PLL_VF610_NUM_OFFSET 0x20
|
||||
#define PLL_VF610_DENOM_OFFSET 0x30
|
||||
@ -49,6 +51,8 @@ struct clk_pllv3 {
|
||||
u32 div_mask;
|
||||
u32 div_shift;
|
||||
unsigned long ref_clock;
|
||||
u32 num_offset;
|
||||
u32 denom_offset;
|
||||
};
|
||||
|
||||
#define to_clk_pllv3(_hw) container_of(_hw, struct clk_pllv3, hw)
|
||||
@ -219,8 +223,8 @@ static unsigned long clk_pllv3_av_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_pllv3 *pll = to_clk_pllv3(hw);
|
||||
u32 mfn = readl_relaxed(pll->base + PLL_NUM_OFFSET);
|
||||
u32 mfd = readl_relaxed(pll->base + PLL_DENOM_OFFSET);
|
||||
u32 mfn = readl_relaxed(pll->base + pll->num_offset);
|
||||
u32 mfd = readl_relaxed(pll->base + pll->denom_offset);
|
||||
u32 div = readl_relaxed(pll->base) & pll->div_mask;
|
||||
u64 temp64 = (u64)parent_rate;
|
||||
|
||||
@ -289,8 +293,8 @@ static int clk_pllv3_av_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
val &= ~pll->div_mask;
|
||||
val |= div;
|
||||
writel_relaxed(val, pll->base);
|
||||
writel_relaxed(mfn, pll->base + PLL_NUM_OFFSET);
|
||||
writel_relaxed(mfd, pll->base + PLL_DENOM_OFFSET);
|
||||
writel_relaxed(mfn, pll->base + pll->num_offset);
|
||||
writel_relaxed(mfd, pll->base + pll->denom_offset);
|
||||
|
||||
return clk_pllv3_wait_lock(pll);
|
||||
}
|
||||
@ -352,8 +356,8 @@ static unsigned long clk_pllv3_vf610_recalc_rate(struct clk_hw *hw,
|
||||
struct clk_pllv3 *pll = to_clk_pllv3(hw);
|
||||
struct clk_pllv3_vf610_mf mf;
|
||||
|
||||
mf.mfn = readl_relaxed(pll->base + PLL_VF610_NUM_OFFSET);
|
||||
mf.mfd = readl_relaxed(pll->base + PLL_VF610_DENOM_OFFSET);
|
||||
mf.mfn = readl_relaxed(pll->base + pll->num_offset);
|
||||
mf.mfd = readl_relaxed(pll->base + pll->denom_offset);
|
||||
mf.mfi = (readl_relaxed(pll->base) & pll->div_mask) ? 22 : 20;
|
||||
|
||||
return clk_pllv3_vf610_mf_to_rate(parent_rate, mf);
|
||||
@ -382,8 +386,8 @@ static int clk_pllv3_vf610_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
val |= pll->div_mask; /* set bit for mfi=22 */
|
||||
writel_relaxed(val, pll->base);
|
||||
|
||||
writel_relaxed(mf.mfn, pll->base + PLL_VF610_NUM_OFFSET);
|
||||
writel_relaxed(mf.mfd, pll->base + PLL_VF610_DENOM_OFFSET);
|
||||
writel_relaxed(mf.mfn, pll->base + pll->num_offset);
|
||||
writel_relaxed(mf.mfd, pll->base + pll->denom_offset);
|
||||
|
||||
return clk_pllv3_wait_lock(pll);
|
||||
}
|
||||
@ -426,6 +430,8 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
pll->power_bit = BM_PLL_POWER;
|
||||
pll->num_offset = PLL_NUM_OFFSET;
|
||||
pll->denom_offset = PLL_DENOM_OFFSET;
|
||||
|
||||
switch (type) {
|
||||
case IMX_PLLV3_SYS:
|
||||
@ -433,13 +439,20 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
|
||||
break;
|
||||
case IMX_PLLV3_SYS_VF610:
|
||||
ops = &clk_pllv3_vf610_ops;
|
||||
pll->num_offset = PLL_VF610_NUM_OFFSET;
|
||||
pll->denom_offset = PLL_VF610_DENOM_OFFSET;
|
||||
break;
|
||||
case IMX_PLLV3_USB_VF610:
|
||||
pll->div_shift = 1;
|
||||
/* fall through */
|
||||
case IMX_PLLV3_USB:
|
||||
ops = &clk_pllv3_ops;
|
||||
pll->powerup_set = true;
|
||||
break;
|
||||
case IMX_PLLV3_AV_IMX7:
|
||||
pll->num_offset = PLL_IMX7_NUM_OFFSET;
|
||||
pll->denom_offset = PLL_IMX7_DENOM_OFFSET;
|
||||
/* fall through */
|
||||
case IMX_PLLV3_AV:
|
||||
ops = &clk_pllv3_av_ops;
|
||||
break;
|
||||
@ -454,6 +467,8 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
|
||||
break;
|
||||
case IMX_PLLV3_DDR_IMX7:
|
||||
pll->power_bit = IMX7_DDR_PLL_POWER;
|
||||
pll->num_offset = PLL_IMX7_NUM_OFFSET;
|
||||
pll->denom_offset = PLL_IMX7_DENOM_OFFSET;
|
||||
ops = &clk_pllv3_av_ops;
|
||||
break;
|
||||
default:
|
||||
|
@ -30,6 +30,9 @@
|
||||
/* PLL Denominator Register (xPLLDENOM) */
|
||||
#define PLL_DENOM_OFFSET 0x14
|
||||
|
||||
#define MAX_MFD 0x3fffffff
|
||||
#define DEFAULT_MFD 1000000
|
||||
|
||||
struct clk_pllv4 {
|
||||
struct clk_hw hw;
|
||||
void __iomem *base;
|
||||
@ -64,13 +67,20 @@ static unsigned long clk_pllv4_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_pllv4 *pll = to_clk_pllv4(hw);
|
||||
u32 div;
|
||||
u32 mult, mfn, mfd;
|
||||
u64 temp64;
|
||||
|
||||
div = readl_relaxed(pll->base + PLL_CFG_OFFSET);
|
||||
div &= BM_PLL_MULT;
|
||||
div >>= BP_PLL_MULT;
|
||||
mult = readl_relaxed(pll->base + PLL_CFG_OFFSET);
|
||||
mult &= BM_PLL_MULT;
|
||||
mult >>= BP_PLL_MULT;
|
||||
|
||||
return parent_rate * div;
|
||||
mfn = readl_relaxed(pll->base + PLL_NUM_OFFSET);
|
||||
mfd = readl_relaxed(pll->base + PLL_DENOM_OFFSET);
|
||||
temp64 = parent_rate;
|
||||
temp64 *= mfn;
|
||||
do_div(temp64, mfd);
|
||||
|
||||
return (parent_rate * mult) + (u32)temp64;
|
||||
}
|
||||
|
||||
static long clk_pllv4_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
@ -78,14 +88,46 @@ static long clk_pllv4_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
{
|
||||
unsigned long parent_rate = *prate;
|
||||
unsigned long round_rate, i;
|
||||
u32 mfn, mfd = DEFAULT_MFD;
|
||||
bool found = false;
|
||||
u64 temp64;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(pllv4_mult_table); i++) {
|
||||
round_rate = parent_rate * pllv4_mult_table[i];
|
||||
if (rate >= round_rate)
|
||||
return round_rate;
|
||||
if (rate >= round_rate) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return round_rate;
|
||||
if (!found) {
|
||||
pr_warn("%s: unable to round rate %lu, parent rate %lu\n",
|
||||
clk_hw_get_name(hw), rate, parent_rate);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (parent_rate <= MAX_MFD)
|
||||
mfd = parent_rate;
|
||||
|
||||
temp64 = (u64)(rate - round_rate);
|
||||
temp64 *= mfd;
|
||||
do_div(temp64, parent_rate);
|
||||
mfn = temp64;
|
||||
|
||||
/*
|
||||
* NOTE: The value of numerator must always be configured to be
|
||||
* less than the value of the denominator. If we can't get a proper
|
||||
* pair of mfn/mfd, we simply return the round_rate without using
|
||||
* the frac part.
|
||||
*/
|
||||
if (mfn >= mfd)
|
||||
return round_rate;
|
||||
|
||||
temp64 = (u64)parent_rate;
|
||||
temp64 *= mfn;
|
||||
do_div(temp64, mfd);
|
||||
|
||||
return round_rate + (u32)temp64;
|
||||
}
|
||||
|
||||
static bool clk_pllv4_is_valid_mult(unsigned int mult)
|
||||
@ -105,18 +147,30 @@ static int clk_pllv4_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_pllv4 *pll = to_clk_pllv4(hw);
|
||||
u32 val, mult;
|
||||
u32 val, mult, mfn, mfd = DEFAULT_MFD;
|
||||
u64 temp64;
|
||||
|
||||
mult = rate / parent_rate;
|
||||
|
||||
if (!clk_pllv4_is_valid_mult(mult))
|
||||
return -EINVAL;
|
||||
|
||||
if (parent_rate <= MAX_MFD)
|
||||
mfd = parent_rate;
|
||||
|
||||
temp64 = (u64)(rate - mult * parent_rate);
|
||||
temp64 *= mfd;
|
||||
do_div(temp64, parent_rate);
|
||||
mfn = temp64;
|
||||
|
||||
val = readl_relaxed(pll->base + PLL_CFG_OFFSET);
|
||||
val &= ~BM_PLL_MULT;
|
||||
val |= mult << BP_PLL_MULT;
|
||||
writel_relaxed(val, pll->base + PLL_CFG_OFFSET);
|
||||
|
||||
writel_relaxed(mfn, pll->base + PLL_NUM_OFFSET);
|
||||
writel_relaxed(mfd, pll->base + PLL_DENOM_OFFSET);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,7 @@ enum imx_pllv3_type {
|
||||
IMX_PLLV3_ENET_IMX7,
|
||||
IMX_PLLV3_SYS_VF610,
|
||||
IMX_PLLV3_DDR_IMX7,
|
||||
IMX_PLLV3_AV_IMX7,
|
||||
};
|
||||
|
||||
struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
|
||||
@ -138,11 +139,6 @@ static inline struct clk_hw *imx_clk_hw_fixed(const char *name, int rate)
|
||||
return clk_hw_register_fixed_rate(NULL, name, NULL, 0, rate);
|
||||
}
|
||||
|
||||
static inline struct clk_hw *imx_get_clk_hw_fixed(const char *name, int rate)
|
||||
{
|
||||
return clk_hw_register_fixed_rate(NULL, name, NULL, 0, rate);
|
||||
}
|
||||
|
||||
static inline struct clk *imx_clk_mux_ldb(const char *name, void __iomem *reg,
|
||||
u8 shift, u8 width, const char * const *parents,
|
||||
int num_parents)
|
||||
|
@ -216,4 +216,87 @@ config COMMON_CLK_MT8173
|
||||
default ARCH_MEDIATEK
|
||||
---help---
|
||||
This driver supports MediaTek MT8173 clocks.
|
||||
|
||||
config COMMON_CLK_MT8183
|
||||
bool "Clock driver for MediaTek MT8183"
|
||||
depends on (ARCH_MEDIATEK && ARM64) || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
default ARCH_MEDIATEK && ARM64
|
||||
help
|
||||
This driver supports MediaTek MT8183 basic clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_AUDIOSYS
|
||||
bool "Clock driver for MediaTek MT8183 audiosys"
|
||||
depends on COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 audiosys clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_CAMSYS
|
||||
bool "Clock driver for MediaTek MT8183 camsys"
|
||||
depends on COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 camsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_IMGSYS
|
||||
bool "Clock driver for MediaTek MT8183 imgsys"
|
||||
depends on 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"
|
||||
depends on 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"
|
||||
depends on 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"
|
||||
depends on 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"
|
||||
depends on COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 ipu_conn clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_MFGCFG
|
||||
bool "Clock driver for MediaTek MT8183 mfgcfg"
|
||||
depends on COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 mfgcfg clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_MMSYS
|
||||
bool "Clock driver for MediaTek MT8183 mmsys"
|
||||
depends on COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 mmsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_VDECSYS
|
||||
bool "Clock driver for MediaTek MT8183 vdecsys"
|
||||
depends on COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 vdecsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8183_VENCSYS
|
||||
bool "Clock driver for MediaTek MT8183 vencsys"
|
||||
depends on COMMON_CLK_MT8183
|
||||
help
|
||||
This driver supports MediaTek MT8183 vencsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8516
|
||||
bool "Clock driver for MediaTek MT8516"
|
||||
depends on ARCH_MEDIATEK || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
default ARCH_MEDIATEK
|
||||
help
|
||||
This driver supports MediaTek MT8516 clocks.
|
||||
|
||||
endmenu
|
||||
|
@ -1,5 +1,6 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
obj-$(CONFIG_COMMON_CLK_MEDIATEK) += clk-mtk.o clk-pll.o clk-gate.o clk-apmixed.o clk-cpumux.o reset.o
|
||||
obj-$(CONFIG_COMMON_CLK_MEDIATEK) += clk-mtk.o clk-pll.o clk-gate.o clk-apmixed.o clk-cpumux.o reset.o clk-mux.o
|
||||
|
||||
obj-$(CONFIG_COMMON_CLK_MT6797) += clk-mt6797.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT6797_IMGSYS) += clk-mt6797-img.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT6797_MMSYS) += clk-mt6797-mm.o
|
||||
@ -31,3 +32,16 @@ obj-$(CONFIG_COMMON_CLK_MT7629_ETHSYS) += clk-mt7629-eth.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT7629_HIFSYS) += clk-mt7629-hif.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8135) += clk-mt8135.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8173) += clk-mt8173.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8183) += 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
|
||||
obj-$(CONFIG_COMMON_CLK_MT8183_IPU_CORE0) += clk-mt8183-ipu0.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8183_IPU_CORE1) += clk-mt8183-ipu1.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8183_IPU_ADL) += clk-mt8183-ipu_adl.o
|
||||
obj-$(CONFIG_COMMON_CLK_MT8183_IPU_CONN) += clk-mt8183-ipu_conn.o
|
||||
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_MT8516) += clk-mt8516.o
|
||||
|
@ -50,4 +50,18 @@ struct clk *mtk_clk_register_gate(
|
||||
const struct clk_ops *ops,
|
||||
unsigned long flags);
|
||||
|
||||
#define GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift, \
|
||||
_ops, _flags) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.regs = _regs, \
|
||||
.shift = _shift, \
|
||||
.ops = _ops, \
|
||||
.flags = _flags, \
|
||||
}
|
||||
|
||||
#define GATE_MTK(_id, _name, _parent, _regs, _shift, _ops) \
|
||||
GATE_MTK_FLAGS(_id, _name, _parent, _regs, _shift, _ops, 0)
|
||||
|
||||
#endif /* __DRV_CLK_GATE_H */
|
||||
|
105
drivers/clk/mediatek/clk-mt8183-audio.c
Normal file
105
drivers/clk/mediatek/clk-mt8183-audio.c
Normal file
@ -0,0 +1,105 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Copyright (c) 2018 MediaTek Inc.
|
||||
// Author: Weiyi Lu <weiyi.lu@mediatek.com>
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-gate.h"
|
||||
|
||||
#include <dt-bindings/clock/mt8183-clk.h>
|
||||
|
||||
static const struct mtk_gate_regs audio0_cg_regs = {
|
||||
.set_ofs = 0x0,
|
||||
.clr_ofs = 0x0,
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs audio1_cg_regs = {
|
||||
.set_ofs = 0x4,
|
||||
.clr_ofs = 0x4,
|
||||
.sta_ofs = 0x4,
|
||||
};
|
||||
|
||||
#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) \
|
||||
GATE_MTK(_id, _name, _parent, &audio1_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
static const struct mtk_gate audio_clks[] = {
|
||||
/* AUDIO0 */
|
||||
GATE_AUDIO0(CLK_AUDIO_AFE, "aud_afe", "audio_sel",
|
||||
2),
|
||||
GATE_AUDIO0(CLK_AUDIO_22M, "aud_22m", "aud_eng1_sel",
|
||||
8),
|
||||
GATE_AUDIO0(CLK_AUDIO_24M, "aud_24m", "aud_eng2_sel",
|
||||
9),
|
||||
GATE_AUDIO0(CLK_AUDIO_APLL2_TUNER, "aud_apll2_tuner", "aud_eng2_sel",
|
||||
18),
|
||||
GATE_AUDIO0(CLK_AUDIO_APLL_TUNER, "aud_apll_tuner", "aud_eng1_sel",
|
||||
19),
|
||||
GATE_AUDIO0(CLK_AUDIO_TDM, "aud_tdm", "apll12_divb",
|
||||
20),
|
||||
GATE_AUDIO0(CLK_AUDIO_ADC, "aud_adc", "audio_sel",
|
||||
24),
|
||||
GATE_AUDIO0(CLK_AUDIO_DAC, "aud_dac", "audio_sel",
|
||||
25),
|
||||
GATE_AUDIO0(CLK_AUDIO_DAC_PREDIS, "aud_dac_predis", "audio_sel",
|
||||
26),
|
||||
GATE_AUDIO0(CLK_AUDIO_TML, "aud_tml", "audio_sel",
|
||||
27),
|
||||
/* AUDIO1 */
|
||||
GATE_AUDIO1(CLK_AUDIO_I2S1, "aud_i2s1", "audio_sel",
|
||||
4),
|
||||
GATE_AUDIO1(CLK_AUDIO_I2S2, "aud_i2s2", "audio_sel",
|
||||
5),
|
||||
GATE_AUDIO1(CLK_AUDIO_I2S3, "aud_i2s3", "audio_sel",
|
||||
6),
|
||||
GATE_AUDIO1(CLK_AUDIO_I2S4, "aud_i2s4", "audio_sel",
|
||||
7),
|
||||
GATE_AUDIO1(CLK_AUDIO_PDN_ADDA6_ADC, "aud_pdn_adda6_adc", "audio_sel",
|
||||
20),
|
||||
};
|
||||
|
||||
static int clk_mt8183_audio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_onecell_data *clk_data;
|
||||
int r;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_AUDIO_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, audio_clks, ARRAY_SIZE(audio_clks),
|
||||
clk_data);
|
||||
|
||||
r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = devm_of_platform_populate(&pdev->dev);
|
||||
if (r)
|
||||
of_clk_del_provider(node);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt8183_audio[] = {
|
||||
{ .compatible = "mediatek,mt8183-audiosys", },
|
||||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver clk_mt8183_audio_drv = {
|
||||
.probe = clk_mt8183_audio_probe,
|
||||
.driver = {
|
||||
.name = "clk-mt8183-audio",
|
||||
.of_match_table = of_match_clk_mt8183_audio,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt8183_audio_drv);
|
63
drivers/clk/mediatek/clk-mt8183-cam.c
Normal file
63
drivers/clk/mediatek/clk-mt8183-cam.c
Normal file
@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Copyright (c) 2018 MediaTek Inc.
|
||||
// Author: Weiyi Lu <weiyi.lu@mediatek.com>
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-gate.h"
|
||||
|
||||
#include <dt-bindings/clock/mt8183-clk.h>
|
||||
|
||||
static const struct mtk_gate_regs cam_cg_regs = {
|
||||
.set_ofs = 0x4,
|
||||
.clr_ofs = 0x8,
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#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_LARB6, "cam_larb6", "cam_sel", 0),
|
||||
GATE_CAM(CLK_CAM_DFP_VAD, "cam_dfp_vad", "cam_sel", 1),
|
||||
GATE_CAM(CLK_CAM_LARB3, "cam_larb3", "cam_sel", 2),
|
||||
GATE_CAM(CLK_CAM_CAM, "cam_cam", "cam_sel", 6),
|
||||
GATE_CAM(CLK_CAM_CAMTG, "cam_camtg", "cam_sel", 7),
|
||||
GATE_CAM(CLK_CAM_SENINF, "cam_seninf", "cam_sel", 8),
|
||||
GATE_CAM(CLK_CAM_CAMSV0, "cam_camsv0", "cam_sel", 9),
|
||||
GATE_CAM(CLK_CAM_CAMSV1, "cam_camsv1", "cam_sel", 10),
|
||||
GATE_CAM(CLK_CAM_CAMSV2, "cam_camsv2", "cam_sel", 11),
|
||||
GATE_CAM(CLK_CAM_CCU, "cam_ccu", "cam_sel", 12),
|
||||
};
|
||||
|
||||
static int clk_mt8183_cam_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_CAM_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, cam_clks, ARRAY_SIZE(cam_clks),
|
||||
clk_data);
|
||||
|
||||
return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt8183_cam[] = {
|
||||
{ .compatible = "mediatek,mt8183-camsys", },
|
||||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver clk_mt8183_cam_drv = {
|
||||
.probe = clk_mt8183_cam_probe,
|
||||
.driver = {
|
||||
.name = "clk-mt8183-cam",
|
||||
.of_match_table = of_match_clk_mt8183_cam,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt8183_cam_drv);
|
63
drivers/clk/mediatek/clk-mt8183-img.c
Normal file
63
drivers/clk/mediatek/clk-mt8183-img.c
Normal file
@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Copyright (c) 2018 MediaTek Inc.
|
||||
// Author: Weiyi Lu <weiyi.lu@mediatek.com>
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-gate.h"
|
||||
|
||||
#include <dt-bindings/clock/mt8183-clk.h>
|
||||
|
||||
static const struct mtk_gate_regs img_cg_regs = {
|
||||
.set_ofs = 0x4,
|
||||
.clr_ofs = 0x8,
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#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_LARB5, "img_larb5", "img_sel", 0),
|
||||
GATE_IMG(CLK_IMG_LARB2, "img_larb2", "img_sel", 1),
|
||||
GATE_IMG(CLK_IMG_DIP, "img_dip", "img_sel", 2),
|
||||
GATE_IMG(CLK_IMG_FDVT, "img_fdvt", "img_sel", 3),
|
||||
GATE_IMG(CLK_IMG_DPE, "img_dpe", "img_sel", 4),
|
||||
GATE_IMG(CLK_IMG_RSC, "img_rsc", "img_sel", 5),
|
||||
GATE_IMG(CLK_IMG_MFB, "img_mfb", "img_sel", 6),
|
||||
GATE_IMG(CLK_IMG_WPE_A, "img_wpe_a", "img_sel", 7),
|
||||
GATE_IMG(CLK_IMG_WPE_B, "img_wpe_b", "img_sel", 8),
|
||||
GATE_IMG(CLK_IMG_OWE, "img_owe", "img_sel", 9),
|
||||
};
|
||||
|
||||
static int clk_mt8183_img_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_IMG_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, img_clks, ARRAY_SIZE(img_clks),
|
||||
clk_data);
|
||||
|
||||
return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt8183_img[] = {
|
||||
{ .compatible = "mediatek,mt8183-imgsys", },
|
||||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver clk_mt8183_img_drv = {
|
||||
.probe = clk_mt8183_img_probe,
|
||||
.driver = {
|
||||
.name = "clk-mt8183-img",
|
||||
.of_match_table = of_match_clk_mt8183_img,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt8183_img_drv);
|
56
drivers/clk/mediatek/clk-mt8183-ipu0.c
Normal file
56
drivers/clk/mediatek/clk-mt8183-ipu0.c
Normal file
@ -0,0 +1,56 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Copyright (c) 2018 MediaTek Inc.
|
||||
// Author: Weiyi Lu <weiyi.lu@mediatek.com>
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-gate.h"
|
||||
|
||||
#include <dt-bindings/clock/mt8183-clk.h>
|
||||
|
||||
static const struct mtk_gate_regs ipu_core0_cg_regs = {
|
||||
.set_ofs = 0x4,
|
||||
.clr_ofs = 0x8,
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#define GATE_IPU_CORE0(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &ipu_core0_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate ipu_core0_clks[] = {
|
||||
GATE_IPU_CORE0(CLK_IPU_CORE0_JTAG, "ipu_core0_jtag", "dsp_sel", 0),
|
||||
GATE_IPU_CORE0(CLK_IPU_CORE0_AXI, "ipu_core0_axi", "dsp_sel", 1),
|
||||
GATE_IPU_CORE0(CLK_IPU_CORE0_IPU, "ipu_core0_ipu", "dsp_sel", 2),
|
||||
};
|
||||
|
||||
static int clk_mt8183_ipu_core0_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_IPU_CORE0_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, ipu_core0_clks, ARRAY_SIZE(ipu_core0_clks),
|
||||
clk_data);
|
||||
|
||||
return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt8183_ipu_core0[] = {
|
||||
{ .compatible = "mediatek,mt8183-ipu_core0", },
|
||||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver clk_mt8183_ipu_core0_drv = {
|
||||
.probe = clk_mt8183_ipu_core0_probe,
|
||||
.driver = {
|
||||
.name = "clk-mt8183-ipu_core0",
|
||||
.of_match_table = of_match_clk_mt8183_ipu_core0,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt8183_ipu_core0_drv);
|
56
drivers/clk/mediatek/clk-mt8183-ipu1.c
Normal file
56
drivers/clk/mediatek/clk-mt8183-ipu1.c
Normal file
@ -0,0 +1,56 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Copyright (c) 2018 MediaTek Inc.
|
||||
// Author: Weiyi Lu <weiyi.lu@mediatek.com>
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-gate.h"
|
||||
|
||||
#include <dt-bindings/clock/mt8183-clk.h>
|
||||
|
||||
static const struct mtk_gate_regs ipu_core1_cg_regs = {
|
||||
.set_ofs = 0x4,
|
||||
.clr_ofs = 0x8,
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#define GATE_IPU_CORE1(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &ipu_core1_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate ipu_core1_clks[] = {
|
||||
GATE_IPU_CORE1(CLK_IPU_CORE1_JTAG, "ipu_core1_jtag", "dsp_sel", 0),
|
||||
GATE_IPU_CORE1(CLK_IPU_CORE1_AXI, "ipu_core1_axi", "dsp_sel", 1),
|
||||
GATE_IPU_CORE1(CLK_IPU_CORE1_IPU, "ipu_core1_ipu", "dsp_sel", 2),
|
||||
};
|
||||
|
||||
static int clk_mt8183_ipu_core1_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_IPU_CORE1_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, ipu_core1_clks, ARRAY_SIZE(ipu_core1_clks),
|
||||
clk_data);
|
||||
|
||||
return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt8183_ipu_core1[] = {
|
||||
{ .compatible = "mediatek,mt8183-ipu_core1", },
|
||||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver clk_mt8183_ipu_core1_drv = {
|
||||
.probe = clk_mt8183_ipu_core1_probe,
|
||||
.driver = {
|
||||
.name = "clk-mt8183-ipu_core1",
|
||||
.of_match_table = of_match_clk_mt8183_ipu_core1,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt8183_ipu_core1_drv);
|
54
drivers/clk/mediatek/clk-mt8183-ipu_adl.c
Normal file
54
drivers/clk/mediatek/clk-mt8183-ipu_adl.c
Normal file
@ -0,0 +1,54 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Copyright (c) 2018 MediaTek Inc.
|
||||
// Author: Weiyi Lu <weiyi.lu@mediatek.com>
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-gate.h"
|
||||
|
||||
#include <dt-bindings/clock/mt8183-clk.h>
|
||||
|
||||
static const struct mtk_gate_regs ipu_adl_cg_regs = {
|
||||
.set_ofs = 0x204,
|
||||
.clr_ofs = 0x204,
|
||||
.sta_ofs = 0x204,
|
||||
};
|
||||
|
||||
#define GATE_IPU_ADL_I(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &ipu_adl_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
static const struct mtk_gate ipu_adl_clks[] = {
|
||||
GATE_IPU_ADL_I(CLK_IPU_ADL_CABGEN, "ipu_adl_cabgen", "dsp_sel", 24),
|
||||
};
|
||||
|
||||
static int clk_mt8183_ipu_adl_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_IPU_ADL_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, ipu_adl_clks, ARRAY_SIZE(ipu_adl_clks),
|
||||
clk_data);
|
||||
|
||||
return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt8183_ipu_adl[] = {
|
||||
{ .compatible = "mediatek,mt8183-ipu_adl", },
|
||||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver clk_mt8183_ipu_adl_drv = {
|
||||
.probe = clk_mt8183_ipu_adl_probe,
|
||||
.driver = {
|
||||
.name = "clk-mt8183-ipu_adl",
|
||||
.of_match_table = of_match_clk_mt8183_ipu_adl,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt8183_ipu_adl_drv);
|
123
drivers/clk/mediatek/clk-mt8183-ipu_conn.c
Normal file
123
drivers/clk/mediatek/clk-mt8183-ipu_conn.c
Normal file
@ -0,0 +1,123 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Copyright (c) 2018 MediaTek Inc.
|
||||
// Author: Weiyi Lu <weiyi.lu@mediatek.com>
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-gate.h"
|
||||
|
||||
#include <dt-bindings/clock/mt8183-clk.h>
|
||||
|
||||
static const struct mtk_gate_regs ipu_conn_cg_regs = {
|
||||
.set_ofs = 0x4,
|
||||
.clr_ofs = 0x8,
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs ipu_conn_apb_cg_regs = {
|
||||
.set_ofs = 0x10,
|
||||
.clr_ofs = 0x10,
|
||||
.sta_ofs = 0x10,
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs ipu_conn_axi_cg_regs = {
|
||||
.set_ofs = 0x18,
|
||||
.clr_ofs = 0x18,
|
||||
.sta_ofs = 0x18,
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs ipu_conn_axi1_cg_regs = {
|
||||
.set_ofs = 0x1c,
|
||||
.clr_ofs = 0x1c,
|
||||
.sta_ofs = 0x1c,
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs ipu_conn_axi2_cg_regs = {
|
||||
.set_ofs = 0x20,
|
||||
.clr_ofs = 0x20,
|
||||
.sta_ofs = 0x20,
|
||||
};
|
||||
|
||||
#define GATE_IPU_CONN(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &ipu_conn_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_setclr)
|
||||
|
||||
#define GATE_IPU_CONN_APB(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &ipu_conn_apb_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_no_setclr)
|
||||
|
||||
#define GATE_IPU_CONN_AXI_I(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &ipu_conn_axi_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
#define GATE_IPU_CONN_AXI1_I(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &ipu_conn_axi1_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
#define GATE_IPU_CONN_AXI2_I(_id, _name, _parent, _shift) \
|
||||
GATE_MTK(_id, _name, _parent, &ipu_conn_axi2_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_no_setclr_inv)
|
||||
|
||||
static const struct mtk_gate ipu_conn_clks[] = {
|
||||
GATE_IPU_CONN(CLK_IPU_CONN_IPU,
|
||||
"ipu_conn_ipu", "dsp_sel", 0),
|
||||
GATE_IPU_CONN(CLK_IPU_CONN_AHB,
|
||||
"ipu_conn_ahb", "dsp_sel", 1),
|
||||
GATE_IPU_CONN(CLK_IPU_CONN_AXI,
|
||||
"ipu_conn_axi", "dsp_sel", 2),
|
||||
GATE_IPU_CONN(CLK_IPU_CONN_ISP,
|
||||
"ipu_conn_isp", "dsp_sel", 3),
|
||||
GATE_IPU_CONN(CLK_IPU_CONN_CAM_ADL,
|
||||
"ipu_conn_cam_adl", "dsp_sel", 4),
|
||||
GATE_IPU_CONN(CLK_IPU_CONN_IMG_ADL,
|
||||
"ipu_conn_img_adl", "dsp_sel", 5),
|
||||
GATE_IPU_CONN_APB(CLK_IPU_CONN_DAP_RX,
|
||||
"ipu_conn_dap_rx", "dsp1_sel", 0),
|
||||
GATE_IPU_CONN_APB(CLK_IPU_CONN_APB2AXI,
|
||||
"ipu_conn_apb2axi", "dsp1_sel", 3),
|
||||
GATE_IPU_CONN_APB(CLK_IPU_CONN_APB2AHB,
|
||||
"ipu_conn_apb2ahb", "dsp1_sel", 20),
|
||||
GATE_IPU_CONN_AXI_I(CLK_IPU_CONN_IPU_CAB1TO2,
|
||||
"ipu_conn_ipu_cab1to2", "dsp1_sel", 6),
|
||||
GATE_IPU_CONN_AXI_I(CLK_IPU_CONN_IPU1_CAB1TO2,
|
||||
"ipu_conn_ipu1_cab1to2", "dsp1_sel", 13),
|
||||
GATE_IPU_CONN_AXI_I(CLK_IPU_CONN_IPU2_CAB1TO2,
|
||||
"ipu_conn_ipu2_cab1to2", "dsp1_sel", 20),
|
||||
GATE_IPU_CONN_AXI1_I(CLK_IPU_CONN_CAB3TO3,
|
||||
"ipu_conn_cab3to3", "dsp1_sel", 0),
|
||||
GATE_IPU_CONN_AXI2_I(CLK_IPU_CONN_CAB2TO1,
|
||||
"ipu_conn_cab2to1", "dsp1_sel", 14),
|
||||
GATE_IPU_CONN_AXI2_I(CLK_IPU_CONN_CAB3TO1_SLICE,
|
||||
"ipu_conn_cab3to1_slice", "dsp1_sel", 17),
|
||||
};
|
||||
|
||||
static int clk_mt8183_ipu_conn_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_IPU_CONN_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, ipu_conn_clks, ARRAY_SIZE(ipu_conn_clks),
|
||||
clk_data);
|
||||
|
||||
return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt8183_ipu_conn[] = {
|
||||
{ .compatible = "mediatek,mt8183-ipu_conn", },
|
||||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver clk_mt8183_ipu_conn_drv = {
|
||||
.probe = clk_mt8183_ipu_conn_probe,
|
||||
.driver = {
|
||||
.name = "clk-mt8183-ipu_conn",
|
||||
.of_match_table = of_match_clk_mt8183_ipu_conn,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt8183_ipu_conn_drv);
|
54
drivers/clk/mediatek/clk-mt8183-mfgcfg.c
Normal file
54
drivers/clk/mediatek/clk-mt8183-mfgcfg.c
Normal file
@ -0,0 +1,54 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Copyright (c) 2018 MediaTek Inc.
|
||||
// Author: Weiyi Lu <weiyi.lu@mediatek.com>
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-gate.h"
|
||||
|
||||
#include <dt-bindings/clock/mt8183-clk.h>
|
||||
|
||||
static const struct mtk_gate_regs mfg_cg_regs = {
|
||||
.set_ofs = 0x4,
|
||||
.clr_ofs = 0x8,
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#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)
|
||||
};
|
||||
|
||||
static int clk_mt8183_mfg_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MFG_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, mfg_clks, ARRAY_SIZE(mfg_clks),
|
||||
clk_data);
|
||||
|
||||
return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt8183_mfg[] = {
|
||||
{ .compatible = "mediatek,mt8183-mfgcfg", },
|
||||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver clk_mt8183_mfg_drv = {
|
||||
.probe = clk_mt8183_mfg_probe,
|
||||
.driver = {
|
||||
.name = "clk-mt8183-mfg",
|
||||
.of_match_table = of_match_clk_mt8183_mfg,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt8183_mfg_drv);
|
111
drivers/clk/mediatek/clk-mt8183-mm.c
Normal file
111
drivers/clk/mediatek/clk-mt8183-mm.c
Normal file
@ -0,0 +1,111 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Copyright (c) 2018 MediaTek Inc.
|
||||
// Author: Weiyi Lu <weiyi.lu@mediatek.com>
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-gate.h"
|
||||
|
||||
#include <dt-bindings/clock/mt8183-clk.h>
|
||||
|
||||
static const struct mtk_gate_regs mm0_cg_regs = {
|
||||
.set_ofs = 0x104,
|
||||
.clr_ofs = 0x108,
|
||||
.sta_ofs = 0x100,
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs mm1_cg_regs = {
|
||||
.set_ofs = 0x114,
|
||||
.clr_ofs = 0x118,
|
||||
.sta_ofs = 0x110,
|
||||
};
|
||||
|
||||
#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) \
|
||||
GATE_MTK(_id, _name, _parent, &mm1_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_setclr)
|
||||
|
||||
static const struct mtk_gate mm_clks[] = {
|
||||
/* 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),
|
||||
GATE_MM0(CLK_MM_SMI_LARB1, "mm_smi_larb1", "mm_sel", 2),
|
||||
GATE_MM0(CLK_MM_GALS_COMM0, "mm_gals_comm0", "mm_sel", 3),
|
||||
GATE_MM0(CLK_MM_GALS_COMM1, "mm_gals_comm1", "mm_sel", 4),
|
||||
GATE_MM0(CLK_MM_GALS_CCU2MM, "mm_gals_ccu2mm", "mm_sel", 5),
|
||||
GATE_MM0(CLK_MM_GALS_IPU12MM, "mm_gals_ipu12mm", "mm_sel", 6),
|
||||
GATE_MM0(CLK_MM_GALS_IMG2MM, "mm_gals_img2mm", "mm_sel", 7),
|
||||
GATE_MM0(CLK_MM_GALS_CAM2MM, "mm_gals_cam2mm", "mm_sel", 8),
|
||||
GATE_MM0(CLK_MM_GALS_IPU2MM, "mm_gals_ipu2mm", "mm_sel", 9),
|
||||
GATE_MM0(CLK_MM_MDP_DL_TXCK, "mm_mdp_dl_txck", "mm_sel", 10),
|
||||
GATE_MM0(CLK_MM_IPU_DL_TXCK, "mm_ipu_dl_txck", "mm_sel", 11),
|
||||
GATE_MM0(CLK_MM_MDP_RDMA0, "mm_mdp_rdma0", "mm_sel", 12),
|
||||
GATE_MM0(CLK_MM_MDP_RDMA1, "mm_mdp_rdma1", "mm_sel", 13),
|
||||
GATE_MM0(CLK_MM_MDP_RSZ0, "mm_mdp_rsz0", "mm_sel", 14),
|
||||
GATE_MM0(CLK_MM_MDP_RSZ1, "mm_mdp_rsz1", "mm_sel", 15),
|
||||
GATE_MM0(CLK_MM_MDP_TDSHP, "mm_mdp_tdshp", "mm_sel", 16),
|
||||
GATE_MM0(CLK_MM_MDP_WROT0, "mm_mdp_wrot0", "mm_sel", 17),
|
||||
GATE_MM0(CLK_MM_MDP_WDMA0, "mm_mdp_wdma0", "mm_sel", 18),
|
||||
GATE_MM0(CLK_MM_FAKE_ENG, "mm_fake_eng", "mm_sel", 19),
|
||||
GATE_MM0(CLK_MM_DISP_OVL0, "mm_disp_ovl0", "mm_sel", 20),
|
||||
GATE_MM0(CLK_MM_DISP_OVL0_2L, "mm_disp_ovl0_2l", "mm_sel", 21),
|
||||
GATE_MM0(CLK_MM_DISP_OVL1_2L, "mm_disp_ovl1_2l", "mm_sel", 22),
|
||||
GATE_MM0(CLK_MM_DISP_RDMA0, "mm_disp_rdma0", "mm_sel", 23),
|
||||
GATE_MM0(CLK_MM_DISP_RDMA1, "mm_disp_rdma1", "mm_sel", 24),
|
||||
GATE_MM0(CLK_MM_DISP_WDMA0, "mm_disp_wdma0", "mm_sel", 25),
|
||||
GATE_MM0(CLK_MM_DISP_COLOR0, "mm_disp_color0", "mm_sel", 26),
|
||||
GATE_MM0(CLK_MM_DISP_CCORR0, "mm_disp_ccorr0", "mm_sel", 27),
|
||||
GATE_MM0(CLK_MM_DISP_AAL0, "mm_disp_aal0", "mm_sel", 28),
|
||||
GATE_MM0(CLK_MM_DISP_GAMMA0, "mm_disp_gamma0", "mm_sel", 29),
|
||||
GATE_MM0(CLK_MM_DISP_DITHER0, "mm_disp_dither0", "mm_sel", 30),
|
||||
GATE_MM0(CLK_MM_DISP_SPLIT, "mm_disp_split", "mm_sel", 31),
|
||||
/* MM1 */
|
||||
GATE_MM1(CLK_MM_DSI0_MM, "mm_dsi0_mm", "mm_sel", 0),
|
||||
GATE_MM1(CLK_MM_DSI0_IF, "mm_dsi0_if", "mm_sel", 1),
|
||||
GATE_MM1(CLK_MM_DPI_MM, "mm_dpi_mm", "mm_sel", 2),
|
||||
GATE_MM1(CLK_MM_DPI_IF, "mm_dpi_if", "dpi0_sel", 3),
|
||||
GATE_MM1(CLK_MM_FAKE_ENG2, "mm_fake_eng2", "mm_sel", 4),
|
||||
GATE_MM1(CLK_MM_MDP_DL_RX, "mm_mdp_dl_rx", "mm_sel", 5),
|
||||
GATE_MM1(CLK_MM_IPU_DL_RX, "mm_ipu_dl_rx", "mm_sel", 6),
|
||||
GATE_MM1(CLK_MM_26M, "mm_26m", "f_f26m_ck", 7),
|
||||
GATE_MM1(CLK_MM_MMSYS_R2Y, "mm_mmsys_r2y", "mm_sel", 8),
|
||||
GATE_MM1(CLK_MM_DISP_RSZ, "mm_disp_rsz", "mm_sel", 9),
|
||||
GATE_MM1(CLK_MM_MDP_AAL, "mm_mdp_aal", "mm_sel", 10),
|
||||
GATE_MM1(CLK_MM_MDP_CCORR, "mm_mdp_ccorr", "mm_sel", 11),
|
||||
GATE_MM1(CLK_MM_DBI_MM, "mm_dbi_mm", "mm_sel", 12),
|
||||
GATE_MM1(CLK_MM_DBI_IF, "mm_dbi_if", "dpi0_sel", 13),
|
||||
};
|
||||
|
||||
static int clk_mt8183_mm_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_MM_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, mm_clks, ARRAY_SIZE(mm_clks),
|
||||
clk_data);
|
||||
|
||||
return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt8183_mm[] = {
|
||||
{ .compatible = "mediatek,mt8183-mmsys", },
|
||||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver clk_mt8183_mm_drv = {
|
||||
.probe = clk_mt8183_mm_probe,
|
||||
.driver = {
|
||||
.name = "clk-mt8183-mm",
|
||||
.of_match_table = of_match_clk_mt8183_mm,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt8183_mm_drv);
|
67
drivers/clk/mediatek/clk-mt8183-vdec.c
Normal file
67
drivers/clk/mediatek/clk-mt8183-vdec.c
Normal file
@ -0,0 +1,67 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Copyright (c) 2018 MediaTek Inc.
|
||||
// Author: Weiyi Lu <weiyi.lu@mediatek.com>
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-gate.h"
|
||||
|
||||
#include <dt-bindings/clock/mt8183-clk.h>
|
||||
|
||||
static const struct mtk_gate_regs vdec0_cg_regs = {
|
||||
.set_ofs = 0x0,
|
||||
.clr_ofs = 0x4,
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs vdec1_cg_regs = {
|
||||
.set_ofs = 0x8,
|
||||
.clr_ofs = 0xc,
|
||||
.sta_ofs = 0x8,
|
||||
};
|
||||
|
||||
#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) \
|
||||
GATE_MTK(_id, _name, _parent, &vdec1_cg_regs, _shift, \
|
||||
&mtk_clk_gate_ops_setclr_inv)
|
||||
|
||||
static const struct mtk_gate vdec_clks[] = {
|
||||
/* VDEC0 */
|
||||
GATE_VDEC0_I(CLK_VDEC_VDEC, "vdec_vdec", "mm_sel", 0),
|
||||
/* VDEC1 */
|
||||
GATE_VDEC1_I(CLK_VDEC_LARB1, "vdec_larb1", "mm_sel", 0),
|
||||
};
|
||||
|
||||
static int clk_mt8183_vdec_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_VDEC_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, vdec_clks, ARRAY_SIZE(vdec_clks),
|
||||
clk_data);
|
||||
|
||||
return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt8183_vdec[] = {
|
||||
{ .compatible = "mediatek,mt8183-vdecsys", },
|
||||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver clk_mt8183_vdec_drv = {
|
||||
.probe = clk_mt8183_vdec_probe,
|
||||
.driver = {
|
||||
.name = "clk-mt8183-vdec",
|
||||
.of_match_table = of_match_clk_mt8183_vdec,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt8183_vdec_drv);
|
59
drivers/clk/mediatek/clk-mt8183-venc.c
Normal file
59
drivers/clk/mediatek/clk-mt8183-venc.c
Normal file
@ -0,0 +1,59 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
//
|
||||
// Copyright (c) 2018 MediaTek Inc.
|
||||
// Author: Weiyi Lu <weiyi.lu@mediatek.com>
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-gate.h"
|
||||
|
||||
#include <dt-bindings/clock/mt8183-clk.h>
|
||||
|
||||
static const struct mtk_gate_regs venc_cg_regs = {
|
||||
.set_ofs = 0x4,
|
||||
.clr_ofs = 0x8,
|
||||
.sta_ofs = 0x0,
|
||||
};
|
||||
|
||||
#define GATE_VENC_I(_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_I(CLK_VENC_LARB, "venc_larb",
|
||||
"mm_sel", 0),
|
||||
GATE_VENC_I(CLK_VENC_VENC, "venc_venc",
|
||||
"mm_sel", 4),
|
||||
GATE_VENC_I(CLK_VENC_JPGENC, "venc_jpgenc",
|
||||
"mm_sel", 8),
|
||||
};
|
||||
|
||||
static int clk_mt8183_venc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct clk_onecell_data *clk_data;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
|
||||
clk_data = mtk_alloc_clk_data(CLK_VENC_NR_CLK);
|
||||
|
||||
mtk_clk_register_gates(node, venc_clks, ARRAY_SIZE(venc_clks),
|
||||
clk_data);
|
||||
|
||||
return of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
static const struct of_device_id of_match_clk_mt8183_venc[] = {
|
||||
{ .compatible = "mediatek,mt8183-vencsys", },
|
||||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver clk_mt8183_venc_drv = {
|
||||
.probe = clk_mt8183_venc_probe,
|
||||
.driver = {
|
||||
.name = "clk-mt8183-venc",
|
||||
.of_match_table = of_match_clk_mt8183_venc,
|
||||
},
|
||||
};
|
||||
|
||||
builtin_platform_driver(clk_mt8183_venc_drv);
|
1284
drivers/clk/mediatek/clk-mt8183.c
Normal file
1284
drivers/clk/mediatek/clk-mt8183.c
Normal file
File diff suppressed because it is too large
Load Diff
815
drivers/clk/mediatek/clk-mt8516.c
Normal file
815
drivers/clk/mediatek/clk-mt8516.c
Normal file
@ -0,0 +1,815 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (c) 2019 MediaTek Inc.
|
||||
* Author: James Liao <jamesjj.liao@mediatek.com>
|
||||
* Fabien Parent <fparent@baylibre.com>
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-gate.h"
|
||||
|
||||
#include <dt-bindings/clock/mt8516-clk.h>
|
||||
|
||||
static DEFINE_SPINLOCK(mt8516_clk_lock);
|
||||
|
||||
static const struct mtk_fixed_clk fixed_clks[] __initconst = {
|
||||
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),
|
||||
};
|
||||
|
||||
static const struct mtk_fixed_factor top_divs[] __initconst = {
|
||||
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),
|
||||
FACTOR(CLK_TOP_MAINPLL_D8, "mainpll_d8", "mainpll", 1, 8),
|
||||
FACTOR(CLK_TOP_MAINPLL_D16, "mainpll_d16", "mainpll", 1, 16),
|
||||
FACTOR(CLK_TOP_MAINPLL_D11, "mainpll_d11", "mainpll", 1, 11),
|
||||
FACTOR(CLK_TOP_MAINPLL_D22, "mainpll_d22", "mainpll", 1, 22),
|
||||
FACTOR(CLK_TOP_MAINPLL_D3, "mainpll_d3", "mainpll", 1, 3),
|
||||
FACTOR(CLK_TOP_MAINPLL_D6, "mainpll_d6", "mainpll", 1, 6),
|
||||
FACTOR(CLK_TOP_MAINPLL_D12, "mainpll_d12", "mainpll", 1, 12),
|
||||
FACTOR(CLK_TOP_MAINPLL_D5, "mainpll_d5", "mainpll", 1, 5),
|
||||
FACTOR(CLK_TOP_MAINPLL_D10, "mainpll_d10", "mainpll", 1, 10),
|
||||
FACTOR(CLK_TOP_MAINPLL_D20, "mainpll_d20", "mainpll", 1, 20),
|
||||
FACTOR(CLK_TOP_MAINPLL_D40, "mainpll_d40", "mainpll", 1, 40),
|
||||
FACTOR(CLK_TOP_MAINPLL_D7, "mainpll_d7", "mainpll", 1, 7),
|
||||
FACTOR(CLK_TOP_MAINPLL_D14, "mainpll_d14", "mainpll", 1, 14),
|
||||
FACTOR(CLK_TOP_UNIVPLL_D2, "univpll_d2", "univpll", 1, 2),
|
||||
FACTOR(CLK_TOP_UNIVPLL_D4, "univpll_d4", "univpll", 1, 4),
|
||||
FACTOR(CLK_TOP_UNIVPLL_D8, "univpll_d8", "univpll", 1, 8),
|
||||
FACTOR(CLK_TOP_UNIVPLL_D16, "univpll_d16", "univpll", 1, 16),
|
||||
FACTOR(CLK_TOP_UNIVPLL_D3, "univpll_d3", "univpll", 1, 3),
|
||||
FACTOR(CLK_TOP_UNIVPLL_D6, "univpll_d6", "univpll", 1, 6),
|
||||
FACTOR(CLK_TOP_UNIVPLL_D12, "univpll_d12", "univpll", 1, 12),
|
||||
FACTOR(CLK_TOP_UNIVPLL_D24, "univpll_d24", "univpll", 1, 24),
|
||||
FACTOR(CLK_TOP_UNIVPLL_D5, "univpll_d5", "univpll", 1, 5),
|
||||
FACTOR(CLK_TOP_UNIVPLL_D20, "univpll_d20", "univpll", 1, 20),
|
||||
FACTOR(CLK_TOP_MMPLL380M, "mmpll380m", "mmpll", 1, 1),
|
||||
FACTOR(CLK_TOP_MMPLL_D2, "mmpll_d2", "mmpll", 1, 2),
|
||||
FACTOR(CLK_TOP_MMPLL_200M, "mmpll_200m", "mmpll", 1, 3),
|
||||
FACTOR(CLK_TOP_USB_PHY48M, "usb_phy48m_ck", "univpll", 1, 26),
|
||||
FACTOR(CLK_TOP_APLL1, "apll1_ck", "apll1", 1, 1),
|
||||
FACTOR(CLK_TOP_APLL1_D2, "apll1_d2", "apll1_ck", 1, 2),
|
||||
FACTOR(CLK_TOP_APLL1_D4, "apll1_d4", "rg_apll1_d2_en", 1, 2),
|
||||
FACTOR(CLK_TOP_APLL1_D8, "apll1_d8", "rg_apll1_d4_en", 1, 2),
|
||||
FACTOR(CLK_TOP_APLL2, "apll2_ck", "apll2", 1, 1),
|
||||
FACTOR(CLK_TOP_APLL2_D2, "apll2_d2", "apll2_ck", 1, 2),
|
||||
FACTOR(CLK_TOP_APLL2_D4, "apll2_d4", "rg_apll2_d2_en", 1, 2),
|
||||
FACTOR(CLK_TOP_APLL2_D8, "apll2_d8", "rg_apll2_d4_en", 1, 2),
|
||||
FACTOR(CLK_TOP_CLK26M, "clk26m_ck", "clk26m", 1, 1),
|
||||
FACTOR(CLK_TOP_CLK26M_D2, "clk26m_d2", "clk26m", 1, 2),
|
||||
FACTOR(CLK_TOP_AHB_INFRA_D2, "ahb_infra_d2", "ahb_infra_sel", 1, 2),
|
||||
FACTOR(CLK_TOP_NFI1X, "nfi1x_ck", "nfi2x_pad_sel", 1, 2),
|
||||
FACTOR(CLK_TOP_ETH_D2, "eth_d2_ck", "eth_sel", 1, 2),
|
||||
};
|
||||
|
||||
static const char * const uart0_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"univpll_d24"
|
||||
};
|
||||
|
||||
static const char * const ahb_infra_parents[] __initconst = {
|
||||
"clk_null",
|
||||
"clk26m_ck",
|
||||
"mainpll_d11",
|
||||
"clk_null",
|
||||
"mainpll_d12",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"mainpll_d10"
|
||||
};
|
||||
|
||||
static const char * const msdc0_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"univpll_d6",
|
||||
"mainpll_d8",
|
||||
"univpll_d8",
|
||||
"mainpll_d16",
|
||||
"mmpll_200m",
|
||||
"mainpll_d12",
|
||||
"mmpll_d2"
|
||||
};
|
||||
|
||||
static const char * const uart1_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"univpll_d24"
|
||||
};
|
||||
|
||||
static const char * const msdc1_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"univpll_d6",
|
||||
"mainpll_d8",
|
||||
"univpll_d8",
|
||||
"mainpll_d16",
|
||||
"mmpll_200m",
|
||||
"mainpll_d12",
|
||||
"mmpll_d2"
|
||||
};
|
||||
|
||||
static const char * const pmicspi_parents[] __initconst = {
|
||||
"univpll_d20",
|
||||
"usb_phy48m_ck",
|
||||
"univpll_d16",
|
||||
"clk26m_ck"
|
||||
};
|
||||
|
||||
static const char * const qaxi_aud26m_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"ahb_infra_sel"
|
||||
};
|
||||
|
||||
static const char * const aud_intbus_parents[] __initconst = {
|
||||
"clk_null",
|
||||
"clk26m_ck",
|
||||
"mainpll_d22",
|
||||
"clk_null",
|
||||
"mainpll_d11"
|
||||
};
|
||||
|
||||
static const char * const nfi2x_pad_parents[] __initconst = {
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk26m_ck",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"mainpll_d12",
|
||||
"mainpll_d8",
|
||||
"clk_null",
|
||||
"mainpll_d6",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"mainpll_d4",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"clk_null",
|
||||
"mainpll_d10",
|
||||
"mainpll_d7",
|
||||
"clk_null",
|
||||
"mainpll_d5"
|
||||
};
|
||||
|
||||
static const char * const nfi1x_pad_parents[] __initconst = {
|
||||
"ahb_infra_sel",
|
||||
"nfi1x_ck"
|
||||
};
|
||||
|
||||
static const char * const ddrphycfg_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"mainpll_d16"
|
||||
};
|
||||
|
||||
static const char * const usb_78m_parents[] __initconst = {
|
||||
"clk_null",
|
||||
"clk26m_ck",
|
||||
"univpll_d16",
|
||||
"clk_null",
|
||||
"mainpll_d20"
|
||||
};
|
||||
|
||||
static const char * const spinor_parents[] __initconst = {
|
||||
"clk26m_d2",
|
||||
"clk26m_ck",
|
||||
"mainpll_d40",
|
||||
"univpll_d24",
|
||||
"univpll_d20",
|
||||
"mainpll_d20",
|
||||
"mainpll_d16",
|
||||
"univpll_d12"
|
||||
};
|
||||
|
||||
static const char * const msdc2_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"univpll_d6",
|
||||
"mainpll_d8",
|
||||
"univpll_d8",
|
||||
"mainpll_d16",
|
||||
"mmpll_200m",
|
||||
"mainpll_d12",
|
||||
"mmpll_d2"
|
||||
};
|
||||
|
||||
static const char * const eth_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"mainpll_d40",
|
||||
"univpll_d24",
|
||||
"univpll_d20",
|
||||
"mainpll_d20"
|
||||
};
|
||||
|
||||
static const char * const aud1_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"apll1_ck"
|
||||
};
|
||||
|
||||
static const char * const aud2_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"apll2_ck"
|
||||
};
|
||||
|
||||
static const char * const aud_engen1_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"rg_apll1_d2_en",
|
||||
"rg_apll1_d4_en",
|
||||
"rg_apll1_d8_en"
|
||||
};
|
||||
|
||||
static const char * const aud_engen2_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"rg_apll2_d2_en",
|
||||
"rg_apll2_d4_en",
|
||||
"rg_apll2_d8_en"
|
||||
};
|
||||
|
||||
static const char * const i2c_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"univpll_d20",
|
||||
"univpll_d16",
|
||||
"univpll_d12"
|
||||
};
|
||||
|
||||
static const char * const aud_i2s0_m_parents[] __initconst = {
|
||||
"rg_aud1",
|
||||
"rg_aud2"
|
||||
};
|
||||
|
||||
static const char * const pwm_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"univpll_d12"
|
||||
};
|
||||
|
||||
static const char * const spi_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"univpll_d12",
|
||||
"univpll_d8",
|
||||
"univpll_d6"
|
||||
};
|
||||
|
||||
static const char * const aud_spdifin_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"univpll_d2"
|
||||
};
|
||||
|
||||
static const char * const uart2_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"univpll_d24"
|
||||
};
|
||||
|
||||
static const char * const bsi_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"mainpll_d10",
|
||||
"mainpll_d12",
|
||||
"mainpll_d20"
|
||||
};
|
||||
|
||||
static const char * const dbg_atclk_parents[] __initconst = {
|
||||
"clk_null",
|
||||
"clk26m_ck",
|
||||
"mainpll_d5",
|
||||
"clk_null",
|
||||
"univpll_d5"
|
||||
};
|
||||
|
||||
static const char * const csw_nfiecc_parents[] __initconst = {
|
||||
"clk_null",
|
||||
"mainpll_d7",
|
||||
"mainpll_d6",
|
||||
"clk_null",
|
||||
"mainpll_d5"
|
||||
};
|
||||
|
||||
static const char * const nfiecc_parents[] __initconst = {
|
||||
"clk_null",
|
||||
"nfi2x_pad_sel",
|
||||
"mainpll_d4",
|
||||
"clk_null",
|
||||
"csw_nfiecc_sel"
|
||||
};
|
||||
|
||||
static struct mtk_composite top_muxes[] __initdata = {
|
||||
/* CLK_MUX_SEL0 */
|
||||
MUX(CLK_TOP_UART0_SEL, "uart0_sel", uart0_parents,
|
||||
0x000, 0, 1),
|
||||
MUX(CLK_TOP_AHB_INFRA_SEL, "ahb_infra_sel", ahb_infra_parents,
|
||||
0x000, 4, 4),
|
||||
MUX(CLK_TOP_MSDC0_SEL, "msdc0_sel", msdc0_parents,
|
||||
0x000, 11, 3),
|
||||
MUX(CLK_TOP_UART1_SEL, "uart1_sel", uart1_parents,
|
||||
0x000, 19, 1),
|
||||
MUX(CLK_TOP_MSDC1_SEL, "msdc1_sel", msdc1_parents,
|
||||
0x000, 20, 3),
|
||||
MUX(CLK_TOP_PMICSPI_SEL, "pmicspi_sel", pmicspi_parents,
|
||||
0x000, 24, 2),
|
||||
MUX(CLK_TOP_QAXI_AUD26M_SEL, "qaxi_aud26m_sel", qaxi_aud26m_parents,
|
||||
0x000, 26, 1),
|
||||
MUX(CLK_TOP_AUD_INTBUS_SEL, "aud_intbus_sel", aud_intbus_parents,
|
||||
0x000, 27, 3),
|
||||
/* CLK_MUX_SEL1 */
|
||||
MUX(CLK_TOP_NFI2X_PAD_SEL, "nfi2x_pad_sel", nfi2x_pad_parents,
|
||||
0x004, 0, 7),
|
||||
MUX(CLK_TOP_NFI1X_PAD_SEL, "nfi1x_pad_sel", nfi1x_pad_parents,
|
||||
0x004, 7, 1),
|
||||
MUX(CLK_TOP_USB_78M_SEL, "usb_78m_sel", usb_78m_parents,
|
||||
0x004, 20, 3),
|
||||
/* CLK_MUX_SEL8 */
|
||||
MUX(CLK_TOP_SPINOR_SEL, "spinor_sel", spinor_parents,
|
||||
0x040, 0, 3),
|
||||
MUX(CLK_TOP_MSDC2_SEL, "msdc2_sel", msdc2_parents,
|
||||
0x040, 3, 3),
|
||||
MUX(CLK_TOP_ETH_SEL, "eth_sel", eth_parents,
|
||||
0x040, 6, 3),
|
||||
MUX(CLK_TOP_AUD1_SEL, "aud1_sel", aud1_parents,
|
||||
0x040, 22, 1),
|
||||
MUX(CLK_TOP_AUD2_SEL, "aud2_sel", aud2_parents,
|
||||
0x040, 23, 1),
|
||||
MUX(CLK_TOP_AUD_ENGEN1_SEL, "aud_engen1_sel", aud_engen1_parents,
|
||||
0x040, 24, 2),
|
||||
MUX(CLK_TOP_AUD_ENGEN2_SEL, "aud_engen2_sel", aud_engen2_parents,
|
||||
0x040, 26, 2),
|
||||
MUX(CLK_TOP_I2C_SEL, "i2c_sel", i2c_parents,
|
||||
0x040, 28, 2),
|
||||
/* CLK_SEL_9 */
|
||||
MUX(CLK_TOP_AUD_I2S0_M_SEL, "aud_i2s0_m_sel", aud_i2s0_m_parents,
|
||||
0x044, 12, 1),
|
||||
MUX(CLK_TOP_AUD_I2S1_M_SEL, "aud_i2s1_m_sel", aud_i2s0_m_parents,
|
||||
0x044, 13, 1),
|
||||
MUX(CLK_TOP_AUD_I2S2_M_SEL, "aud_i2s2_m_sel", aud_i2s0_m_parents,
|
||||
0x044, 14, 1),
|
||||
MUX(CLK_TOP_AUD_I2S3_M_SEL, "aud_i2s3_m_sel", aud_i2s0_m_parents,
|
||||
0x044, 15, 1),
|
||||
MUX(CLK_TOP_AUD_I2S4_M_SEL, "aud_i2s4_m_sel", aud_i2s0_m_parents,
|
||||
0x044, 16, 1),
|
||||
MUX(CLK_TOP_AUD_I2S5_M_SEL, "aud_i2s5_m_sel", aud_i2s0_m_parents,
|
||||
0x044, 17, 1),
|
||||
MUX(CLK_TOP_AUD_SPDIF_B_SEL, "aud_spdif_b_sel", aud_i2s0_m_parents,
|
||||
0x044, 18, 1),
|
||||
/* CLK_MUX_SEL13 */
|
||||
MUX(CLK_TOP_PWM_SEL, "pwm_sel", pwm_parents,
|
||||
0x07c, 0, 1),
|
||||
MUX(CLK_TOP_SPI_SEL, "spi_sel", spi_parents,
|
||||
0x07c, 1, 2),
|
||||
MUX(CLK_TOP_AUD_SPDIFIN_SEL, "aud_spdifin_sel", aud_spdifin_parents,
|
||||
0x07c, 3, 1),
|
||||
MUX(CLK_TOP_UART2_SEL, "uart2_sel", uart2_parents,
|
||||
0x07c, 4, 1),
|
||||
MUX(CLK_TOP_BSI_SEL, "bsi_sel", bsi_parents,
|
||||
0x07c, 5, 2),
|
||||
MUX(CLK_TOP_DBG_ATCLK_SEL, "dbg_atclk_sel", dbg_atclk_parents,
|
||||
0x07c, 7, 3),
|
||||
MUX(CLK_TOP_CSW_NFIECC_SEL, "csw_nfiecc_sel", csw_nfiecc_parents,
|
||||
0x07c, 10, 3),
|
||||
MUX(CLK_TOP_NFIECC_SEL, "nfiecc_sel", nfiecc_parents,
|
||||
0x07c, 13, 3),
|
||||
};
|
||||
|
||||
static const char * const ifr_mux1_parents[] __initconst = {
|
||||
"clk26m_ck",
|
||||
"armpll",
|
||||
"univpll",
|
||||
"mainpll_d2"
|
||||
};
|
||||
|
||||
static const char * const ifr_eth_25m_parents[] __initconst = {
|
||||
"eth_d2_ck",
|
||||
"rg_eth"
|
||||
};
|
||||
|
||||
static const char * const ifr_i2c0_parents[] __initconst = {
|
||||
"ahb_infra_d2",
|
||||
"rg_i2c"
|
||||
};
|
||||
|
||||
static const struct mtk_composite ifr_muxes[] __initconst = {
|
||||
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,
|
||||
0, 1),
|
||||
MUX(CLK_IFR_I2C0_SEL, "ifr_i2c0_sel", ifr_i2c0_parents, 0x080,
|
||||
1, 1),
|
||||
MUX(CLK_IFR_I2C1_SEL, "ifr_i2c1_sel", ifr_i2c0_parents, 0x080,
|
||||
2, 1),
|
||||
MUX(CLK_IFR_I2C2_SEL, "ifr_i2c2_sel", ifr_i2c0_parents, 0x080,
|
||||
3, 1),
|
||||
};
|
||||
|
||||
#define DIV_ADJ(_id, _name, _parent, _reg, _shift, _width) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.parent_name = _parent, \
|
||||
.div_reg = _reg, \
|
||||
.div_shift = _shift, \
|
||||
.div_width = _width, \
|
||||
}
|
||||
|
||||
static const struct mtk_clk_divider top_adj_divs[] = {
|
||||
DIV_ADJ(CLK_TOP_APLL12_CK_DIV0, "apll12_ck_div0", "aud_i2s0_m_sel",
|
||||
0x0048, 0, 8),
|
||||
DIV_ADJ(CLK_TOP_APLL12_CK_DIV1, "apll12_ck_div1", "aud_i2s1_m_sel",
|
||||
0x0048, 8, 8),
|
||||
DIV_ADJ(CLK_TOP_APLL12_CK_DIV2, "apll12_ck_div2", "aud_i2s2_m_sel",
|
||||
0x0048, 16, 8),
|
||||
DIV_ADJ(CLK_TOP_APLL12_CK_DIV3, "apll12_ck_div3", "aud_i2s3_m_sel",
|
||||
0x0048, 24, 8),
|
||||
DIV_ADJ(CLK_TOP_APLL12_CK_DIV4, "apll12_ck_div4", "aud_i2s4_m_sel",
|
||||
0x004c, 0, 8),
|
||||
DIV_ADJ(CLK_TOP_APLL12_CK_DIV4B, "apll12_ck_div4b", "apll12_div4",
|
||||
0x004c, 8, 8),
|
||||
DIV_ADJ(CLK_TOP_APLL12_CK_DIV5, "apll12_ck_div5", "aud_i2s5_m_sel",
|
||||
0x004c, 16, 8),
|
||||
DIV_ADJ(CLK_TOP_APLL12_CK_DIV5B, "apll12_ck_div5b", "apll12_div5",
|
||||
0x004c, 24, 8),
|
||||
DIV_ADJ(CLK_TOP_APLL12_CK_DIV6, "apll12_ck_div6", "aud_spdif_b_sel",
|
||||
0x0078, 0, 8),
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs top1_cg_regs = {
|
||||
.set_ofs = 0x54,
|
||||
.clr_ofs = 0x84,
|
||||
.sta_ofs = 0x24,
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs top2_cg_regs = {
|
||||
.set_ofs = 0x6c,
|
||||
.clr_ofs = 0x9c,
|
||||
.sta_ofs = 0x3c,
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs top3_cg_regs = {
|
||||
.set_ofs = 0xa0,
|
||||
.clr_ofs = 0xb0,
|
||||
.sta_ofs = 0x70,
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs top4_cg_regs = {
|
||||
.set_ofs = 0xa4,
|
||||
.clr_ofs = 0xb4,
|
||||
.sta_ofs = 0x74,
|
||||
};
|
||||
|
||||
static const struct mtk_gate_regs top5_cg_regs = {
|
||||
.set_ofs = 0x44,
|
||||
.clr_ofs = 0x44,
|
||||
.sta_ofs = 0x44,
|
||||
};
|
||||
|
||||
#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_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_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_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_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_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, \
|
||||
}
|
||||
|
||||
static const struct mtk_gate top_clks[] __initconst = {
|
||||
/* TOP1 */
|
||||
GATE_TOP1(CLK_TOP_THEM, "them", "ahb_infra_sel", 1),
|
||||
GATE_TOP1(CLK_TOP_APDMA, "apdma", "ahb_infra_sel", 2),
|
||||
GATE_TOP1(CLK_TOP_I2C0, "i2c0", "ifr_i2c0_sel", 3),
|
||||
GATE_TOP1(CLK_TOP_I2C1, "i2c1", "ifr_i2c1_sel", 4),
|
||||
GATE_TOP1(CLK_TOP_AUXADC1, "auxadc1", "ahb_infra_sel", 5),
|
||||
GATE_TOP1(CLK_TOP_NFI, "nfi", "nfi1x_pad_sel", 6),
|
||||
GATE_TOP1(CLK_TOP_NFIECC, "nfiecc", "rg_nfiecc", 7),
|
||||
GATE_TOP1(CLK_TOP_DEBUGSYS, "debugsys", "rg_dbg_atclk", 8),
|
||||
GATE_TOP1(CLK_TOP_PWM, "pwm", "ahb_infra_sel", 9),
|
||||
GATE_TOP1(CLK_TOP_UART0, "uart0", "uart0_sel", 10),
|
||||
GATE_TOP1(CLK_TOP_UART1, "uart1", "uart1_sel", 11),
|
||||
GATE_TOP1(CLK_TOP_BTIF, "btif", "ahb_infra_sel", 12),
|
||||
GATE_TOP1(CLK_TOP_USB, "usb", "usb_78m", 13),
|
||||
GATE_TOP1(CLK_TOP_FLASHIF_26M, "flashif_26m", "clk26m_ck", 14),
|
||||
GATE_TOP1(CLK_TOP_AUXADC2, "auxadc2", "ahb_infra_sel", 15),
|
||||
GATE_TOP1(CLK_TOP_I2C2, "i2c2", "ifr_i2c2_sel", 16),
|
||||
GATE_TOP1(CLK_TOP_MSDC0, "msdc0", "msdc0_sel", 17),
|
||||
GATE_TOP1(CLK_TOP_MSDC1, "msdc1", "msdc1_sel", 18),
|
||||
GATE_TOP1(CLK_TOP_NFI2X, "nfi2x", "nfi2x_pad_sel", 19),
|
||||
GATE_TOP1(CLK_TOP_PMICWRAP_AP, "pwrap_ap", "clk26m_ck", 20),
|
||||
GATE_TOP1(CLK_TOP_SEJ, "sej", "ahb_infra_sel", 21),
|
||||
GATE_TOP1(CLK_TOP_MEMSLP_DLYER, "memslp_dlyer", "clk26m_ck", 22),
|
||||
GATE_TOP1(CLK_TOP_SPI, "spi", "spi_sel", 23),
|
||||
GATE_TOP1(CLK_TOP_APXGPT, "apxgpt", "clk26m_ck", 24),
|
||||
GATE_TOP1(CLK_TOP_AUDIO, "audio", "clk26m_ck", 25),
|
||||
GATE_TOP1(CLK_TOP_PMICWRAP_MD, "pwrap_md", "clk26m_ck", 27),
|
||||
GATE_TOP1(CLK_TOP_PMICWRAP_CONN, "pwrap_conn", "clk26m_ck", 28),
|
||||
GATE_TOP1(CLK_TOP_PMICWRAP_26M, "pwrap_26m", "clk26m_ck", 29),
|
||||
GATE_TOP1(CLK_TOP_AUX_ADC, "aux_adc", "clk26m_ck", 30),
|
||||
GATE_TOP1(CLK_TOP_AUX_TP, "aux_tp", "clk26m_ck", 31),
|
||||
/* TOP2 */
|
||||
GATE_TOP2(CLK_TOP_MSDC2, "msdc2", "ahb_infra_sel", 0),
|
||||
GATE_TOP2(CLK_TOP_RBIST, "rbist", "univpll_d12", 1),
|
||||
GATE_TOP2(CLK_TOP_NFI_BUS, "nfi_bus", "ahb_infra_sel", 2),
|
||||
GATE_TOP2(CLK_TOP_GCE, "gce", "ahb_infra_sel", 4),
|
||||
GATE_TOP2(CLK_TOP_TRNG, "trng", "ahb_infra_sel", 5),
|
||||
GATE_TOP2(CLK_TOP_SEJ_13M, "sej_13m", "clk26m_ck", 6),
|
||||
GATE_TOP2(CLK_TOP_AES, "aes", "ahb_infra_sel", 7),
|
||||
GATE_TOP2(CLK_TOP_PWM_B, "pwm_b", "rg_pwm_infra", 8),
|
||||
GATE_TOP2(CLK_TOP_PWM1_FB, "pwm1_fb", "rg_pwm_infra", 9),
|
||||
GATE_TOP2(CLK_TOP_PWM2_FB, "pwm2_fb", "rg_pwm_infra", 10),
|
||||
GATE_TOP2(CLK_TOP_PWM3_FB, "pwm3_fb", "rg_pwm_infra", 11),
|
||||
GATE_TOP2(CLK_TOP_PWM4_FB, "pwm4_fb", "rg_pwm_infra", 12),
|
||||
GATE_TOP2(CLK_TOP_PWM5_FB, "pwm5_fb", "rg_pwm_infra", 13),
|
||||
GATE_TOP2(CLK_TOP_USB_1P, "usb_1p", "usb_78m", 14),
|
||||
GATE_TOP2(CLK_TOP_FLASHIF_FREERUN, "flashif_freerun", "ahb_infra_sel",
|
||||
15),
|
||||
GATE_TOP2(CLK_TOP_66M_ETH, "eth_66m", "ahb_infra_d2", 19),
|
||||
GATE_TOP2(CLK_TOP_133M_ETH, "eth_133m", "ahb_infra_sel", 20),
|
||||
GATE_TOP2(CLK_TOP_FETH_25M, "feth_25m", "ifr_eth_25m_sel", 21),
|
||||
GATE_TOP2(CLK_TOP_FETH_50M, "feth_50m", "rg_eth", 22),
|
||||
GATE_TOP2(CLK_TOP_FLASHIF_AXI, "flashif_axi", "ahb_infra_sel", 23),
|
||||
GATE_TOP2(CLK_TOP_USBIF, "usbif", "ahb_infra_sel", 24),
|
||||
GATE_TOP2(CLK_TOP_UART2, "uart2", "rg_uart2", 25),
|
||||
GATE_TOP2(CLK_TOP_BSI, "bsi", "ahb_infra_sel", 26),
|
||||
GATE_TOP2_I(CLK_TOP_MSDC0_INFRA, "msdc0_infra", "msdc0", 28),
|
||||
GATE_TOP2_I(CLK_TOP_MSDC1_INFRA, "msdc1_infra", "msdc1", 29),
|
||||
GATE_TOP2_I(CLK_TOP_MSDC2_INFRA, "msdc2_infra", "rg_msdc2", 30),
|
||||
GATE_TOP2(CLK_TOP_USB_78M, "usb_78m", "usb_78m_sel", 31),
|
||||
/* TOP3 */
|
||||
GATE_TOP3(CLK_TOP_RG_SPINOR, "rg_spinor", "spinor_sel", 0),
|
||||
GATE_TOP3(CLK_TOP_RG_MSDC2, "rg_msdc2", "msdc2_sel", 1),
|
||||
GATE_TOP3(CLK_TOP_RG_ETH, "rg_eth", "eth_sel", 2),
|
||||
GATE_TOP3(CLK_TOP_RG_AUD1, "rg_aud1", "aud1_sel", 8),
|
||||
GATE_TOP3(CLK_TOP_RG_AUD2, "rg_aud2", "aud2_sel", 9),
|
||||
GATE_TOP3(CLK_TOP_RG_AUD_ENGEN1, "rg_aud_engen1", "aud_engen1_sel", 10),
|
||||
GATE_TOP3(CLK_TOP_RG_AUD_ENGEN2, "rg_aud_engen2", "aud_engen2_sel", 11),
|
||||
GATE_TOP3(CLK_TOP_RG_I2C, "rg_i2c", "i2c_sel", 12),
|
||||
GATE_TOP3(CLK_TOP_RG_PWM_INFRA, "rg_pwm_infra", "pwm_sel", 13),
|
||||
GATE_TOP3(CLK_TOP_RG_AUD_SPDIF_IN, "rg_aud_spdif_in", "aud_spdifin_sel",
|
||||
14),
|
||||
GATE_TOP3(CLK_TOP_RG_UART2, "rg_uart2", "uart2_sel", 15),
|
||||
GATE_TOP3(CLK_TOP_RG_BSI, "rg_bsi", "bsi_sel", 16),
|
||||
GATE_TOP3(CLK_TOP_RG_DBG_ATCLK, "rg_dbg_atclk", "dbg_atclk_sel", 17),
|
||||
GATE_TOP3(CLK_TOP_RG_NFIECC, "rg_nfiecc", "nfiecc_sel", 18),
|
||||
/* TOP4 */
|
||||
GATE_TOP4_I(CLK_TOP_RG_APLL1_D2_EN, "rg_apll1_d2_en", "apll1_d2", 8),
|
||||
GATE_TOP4_I(CLK_TOP_RG_APLL1_D4_EN, "rg_apll1_d4_en", "apll1_d4", 9),
|
||||
GATE_TOP4_I(CLK_TOP_RG_APLL1_D8_EN, "rg_apll1_d8_en", "apll1_d8", 10),
|
||||
GATE_TOP4_I(CLK_TOP_RG_APLL2_D2_EN, "rg_apll2_d2_en", "apll2_d2", 11),
|
||||
GATE_TOP4_I(CLK_TOP_RG_APLL2_D4_EN, "rg_apll2_d4_en", "apll2_d4", 12),
|
||||
GATE_TOP4_I(CLK_TOP_RG_APLL2_D8_EN, "rg_apll2_d8_en", "apll2_d8", 13),
|
||||
/* TOP5 */
|
||||
GATE_TOP5(CLK_TOP_APLL12_DIV0, "apll12_div0", "apll12_ck_div0", 0),
|
||||
GATE_TOP5(CLK_TOP_APLL12_DIV1, "apll12_div1", "apll12_ck_div1", 1),
|
||||
GATE_TOP5(CLK_TOP_APLL12_DIV2, "apll12_div2", "apll12_ck_div2", 2),
|
||||
GATE_TOP5(CLK_TOP_APLL12_DIV3, "apll12_div3", "apll12_ck_div3", 3),
|
||||
GATE_TOP5(CLK_TOP_APLL12_DIV4, "apll12_div4", "apll12_ck_div4", 4),
|
||||
GATE_TOP5(CLK_TOP_APLL12_DIV4B, "apll12_div4b", "apll12_ck_div4b", 5),
|
||||
GATE_TOP5(CLK_TOP_APLL12_DIV5, "apll12_div5", "apll12_ck_div5", 6),
|
||||
GATE_TOP5(CLK_TOP_APLL12_DIV5B, "apll12_div5b", "apll12_ck_div5b", 7),
|
||||
GATE_TOP5(CLK_TOP_APLL12_DIV6, "apll12_div6", "apll12_ck_div6", 8),
|
||||
};
|
||||
|
||||
static void __init mtk_topckgen_init(struct device_node *node)
|
||||
{
|
||||
struct clk_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_TOP_NR_CLK);
|
||||
|
||||
mtk_clk_register_fixed_clks(fixed_clks, ARRAY_SIZE(fixed_clks),
|
||||
clk_data);
|
||||
mtk_clk_register_gates(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(top_muxes, ARRAY_SIZE(top_muxes), base,
|
||||
&mt8516_clk_lock, clk_data);
|
||||
mtk_clk_register_dividers(top_adj_divs, ARRAY_SIZE(top_adj_divs),
|
||||
base, &mt8516_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_topckgen, "mediatek,mt8516-topckgen", mtk_topckgen_init);
|
||||
|
||||
static void __init mtk_infracfg_init(struct device_node *node)
|
||||
{
|
||||
struct clk_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(ifr_muxes, ARRAY_SIZE(ifr_muxes), base,
|
||||
&mt8516_clk_lock, clk_data);
|
||||
|
||||
r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_infracfg, "mediatek,mt8516-infracfg", mtk_infracfg_init);
|
||||
|
||||
#define MT8516_PLL_FMAX (1502UL * MHZ)
|
||||
|
||||
#define CON0_MT8516_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_MT8516_RST_BAR, \
|
||||
.fmax = MT8516_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 = MT8516_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, 0x00000001, 0,
|
||||
21, 0x0104, 24, 0, 0x0104, 0),
|
||||
PLL(CLK_APMIXED_MAINPLL, "mainpll", 0x0120, 0x0130, 0x00000001,
|
||||
HAVE_RST_BAR, 21, 0x0124, 24, 0, 0x0124, 0),
|
||||
PLL(CLK_APMIXED_UNIVPLL, "univpll", 0x0140, 0x0150, 0x30000001,
|
||||
HAVE_RST_BAR, 7, 0x0144, 24, 0, 0x0144, 0),
|
||||
PLL_B(CLK_APMIXED_MMPLL, "mmpll", 0x0160, 0x0170, 0x00000001, 0,
|
||||
21, 0x0164, 24, 0, 0x0164, 0, mmpll_div_table),
|
||||
PLL(CLK_APMIXED_APLL1, "apll1", 0x0180, 0x0190, 0x00000001, 0,
|
||||
31, 0x0180, 1, 0x0194, 0x0184, 0),
|
||||
PLL(CLK_APMIXED_APLL2, "apll2", 0x01A0, 0x01B0, 0x00000001, 0,
|
||||
31, 0x01A0, 1, 0x01B4, 0x01A4, 0),
|
||||
};
|
||||
|
||||
static void __init mtk_apmixedsys_init(struct device_node *node)
|
||||
{
|
||||
struct clk_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_APMIXED_NR_CLK);
|
||||
|
||||
mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data);
|
||||
|
||||
r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
|
||||
if (r)
|
||||
pr_err("%s(): could not register clock provider: %d\n",
|
||||
__func__, r);
|
||||
|
||||
}
|
||||
CLK_OF_DECLARE(mtk_apmixedsys, "mediatek,mt8516-apmixedsys",
|
||||
mtk_apmixedsys_init);
|
@ -227,10 +227,13 @@ struct mtk_pll_data {
|
||||
unsigned int flags;
|
||||
const struct clk_ops *ops;
|
||||
u32 rst_bar_mask;
|
||||
unsigned long fmin;
|
||||
unsigned long fmax;
|
||||
int pcwbits;
|
||||
int pcwibits;
|
||||
uint32_t pcw_reg;
|
||||
int pcw_shift;
|
||||
uint32_t pcw_chg_reg;
|
||||
const struct mtk_pll_div_table *div_table;
|
||||
const char *parent_name;
|
||||
};
|
||||
|
223
drivers/clk/mediatek/clk-mux.c
Normal file
223
drivers/clk/mediatek/clk-mux.c
Normal file
@ -0,0 +1,223 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (c) 2018 MediaTek Inc.
|
||||
* Author: Owen Chen <owen.chen@mediatek.com>
|
||||
*/
|
||||
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
|
||||
#include "clk-mtk.h"
|
||||
#include "clk-mux.h"
|
||||
|
||||
static inline struct mtk_clk_mux *to_mtk_clk_mux(struct clk_hw *hw)
|
||||
{
|
||||
return container_of(hw, struct mtk_clk_mux, hw);
|
||||
}
|
||||
|
||||
static int mtk_clk_mux_enable(struct clk_hw *hw)
|
||||
{
|
||||
struct mtk_clk_mux *mux = to_mtk_clk_mux(hw);
|
||||
u32 mask = BIT(mux->data->gate_shift);
|
||||
|
||||
return regmap_update_bits(mux->regmap, mux->data->mux_ofs,
|
||||
mask, ~mask);
|
||||
}
|
||||
|
||||
static void mtk_clk_mux_disable(struct clk_hw *hw)
|
||||
{
|
||||
struct mtk_clk_mux *mux = to_mtk_clk_mux(hw);
|
||||
u32 mask = BIT(mux->data->gate_shift);
|
||||
|
||||
regmap_update_bits(mux->regmap, mux->data->mux_ofs, mask, mask);
|
||||
}
|
||||
|
||||
static int mtk_clk_mux_enable_setclr(struct clk_hw *hw)
|
||||
{
|
||||
struct mtk_clk_mux *mux = to_mtk_clk_mux(hw);
|
||||
|
||||
return regmap_write(mux->regmap, mux->data->clr_ofs,
|
||||
BIT(mux->data->gate_shift));
|
||||
}
|
||||
|
||||
static void mtk_clk_mux_disable_setclr(struct clk_hw *hw)
|
||||
{
|
||||
struct mtk_clk_mux *mux = to_mtk_clk_mux(hw);
|
||||
|
||||
regmap_write(mux->regmap, mux->data->set_ofs,
|
||||
BIT(mux->data->gate_shift));
|
||||
}
|
||||
|
||||
static int mtk_clk_mux_is_enabled(struct clk_hw *hw)
|
||||
{
|
||||
struct mtk_clk_mux *mux = to_mtk_clk_mux(hw);
|
||||
u32 val;
|
||||
|
||||
regmap_read(mux->regmap, mux->data->mux_ofs, &val);
|
||||
|
||||
return (val & BIT(mux->data->gate_shift)) == 0;
|
||||
}
|
||||
|
||||
static u8 mtk_clk_mux_get_parent(struct clk_hw *hw)
|
||||
{
|
||||
struct mtk_clk_mux *mux = to_mtk_clk_mux(hw);
|
||||
u32 mask = GENMASK(mux->data->mux_width - 1, 0);
|
||||
u32 val;
|
||||
|
||||
regmap_read(mux->regmap, mux->data->mux_ofs, &val);
|
||||
val = (val >> mux->data->mux_shift) & mask;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
static int mtk_clk_mux_set_parent_lock(struct clk_hw *hw, u8 index)
|
||||
{
|
||||
struct mtk_clk_mux *mux = to_mtk_clk_mux(hw);
|
||||
u32 mask = GENMASK(mux->data->mux_width - 1, 0);
|
||||
unsigned long flags = 0;
|
||||
|
||||
if (mux->lock)
|
||||
spin_lock_irqsave(mux->lock, flags);
|
||||
else
|
||||
__acquire(mux->lock);
|
||||
|
||||
regmap_update_bits(mux->regmap, mux->data->mux_ofs, mask,
|
||||
index << mux->data->mux_shift);
|
||||
|
||||
if (mux->lock)
|
||||
spin_unlock_irqrestore(mux->lock, flags);
|
||||
else
|
||||
__release(mux->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mtk_clk_mux_set_parent_setclr_lock(struct clk_hw *hw, u8 index)
|
||||
{
|
||||
struct mtk_clk_mux *mux = to_mtk_clk_mux(hw);
|
||||
u32 mask = GENMASK(mux->data->mux_width - 1, 0);
|
||||
u32 val, orig;
|
||||
unsigned long flags = 0;
|
||||
|
||||
if (mux->lock)
|
||||
spin_lock_irqsave(mux->lock, flags);
|
||||
else
|
||||
__acquire(mux->lock);
|
||||
|
||||
regmap_read(mux->regmap, mux->data->mux_ofs, &orig);
|
||||
val = (orig & ~(mask << mux->data->mux_shift))
|
||||
| (index << mux->data->mux_shift);
|
||||
|
||||
if (val != orig) {
|
||||
regmap_write(mux->regmap, mux->data->clr_ofs,
|
||||
mask << mux->data->mux_shift);
|
||||
regmap_write(mux->regmap, mux->data->set_ofs,
|
||||
index << mux->data->mux_shift);
|
||||
|
||||
if (mux->data->upd_shift >= 0)
|
||||
regmap_write(mux->regmap, mux->data->upd_ofs,
|
||||
BIT(mux->data->upd_shift));
|
||||
}
|
||||
|
||||
if (mux->lock)
|
||||
spin_unlock_irqrestore(mux->lock, flags);
|
||||
else
|
||||
__release(mux->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct clk_ops mtk_mux_ops = {
|
||||
.get_parent = mtk_clk_mux_get_parent,
|
||||
.set_parent = mtk_clk_mux_set_parent_lock,
|
||||
};
|
||||
|
||||
const struct clk_ops mtk_mux_clr_set_upd_ops = {
|
||||
.get_parent = mtk_clk_mux_get_parent,
|
||||
.set_parent = mtk_clk_mux_set_parent_setclr_lock,
|
||||
};
|
||||
|
||||
const struct clk_ops mtk_mux_gate_ops = {
|
||||
.enable = mtk_clk_mux_enable,
|
||||
.disable = mtk_clk_mux_disable,
|
||||
.is_enabled = mtk_clk_mux_is_enabled,
|
||||
.get_parent = mtk_clk_mux_get_parent,
|
||||
.set_parent = mtk_clk_mux_set_parent_lock,
|
||||
};
|
||||
|
||||
const struct clk_ops mtk_mux_gate_clr_set_upd_ops = {
|
||||
.enable = mtk_clk_mux_enable_setclr,
|
||||
.disable = mtk_clk_mux_disable_setclr,
|
||||
.is_enabled = mtk_clk_mux_is_enabled,
|
||||
.get_parent = mtk_clk_mux_get_parent,
|
||||
.set_parent = mtk_clk_mux_set_parent_setclr_lock,
|
||||
};
|
||||
|
||||
struct clk *mtk_clk_register_mux(const struct mtk_mux *mux,
|
||||
struct regmap *regmap,
|
||||
spinlock_t *lock)
|
||||
{
|
||||
struct mtk_clk_mux *clk_mux;
|
||||
struct clk_init_data init;
|
||||
struct clk *clk;
|
||||
|
||||
clk_mux = kzalloc(sizeof(*clk_mux), GFP_KERNEL);
|
||||
if (!clk_mux)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
init.name = mux->name;
|
||||
init.flags = mux->flags | CLK_SET_RATE_PARENT;
|
||||
init.parent_names = mux->parent_names;
|
||||
init.num_parents = mux->num_parents;
|
||||
init.ops = mux->ops;
|
||||
|
||||
clk_mux->regmap = regmap;
|
||||
clk_mux->data = mux;
|
||||
clk_mux->lock = lock;
|
||||
clk_mux->hw.init = &init;
|
||||
|
||||
clk = clk_register(NULL, &clk_mux->hw);
|
||||
if (IS_ERR(clk)) {
|
||||
kfree(clk_mux);
|
||||
return clk;
|
||||
}
|
||||
|
||||
return clk;
|
||||
}
|
||||
|
||||
int mtk_clk_register_muxes(const struct mtk_mux *muxes,
|
||||
int num, struct device_node *node,
|
||||
spinlock_t *lock,
|
||||
struct clk_onecell_data *clk_data)
|
||||
{
|
||||
struct regmap *regmap;
|
||||
struct clk *clk;
|
||||
int i;
|
||||
|
||||
regmap = syscon_node_to_regmap(node);
|
||||
if (IS_ERR(regmap)) {
|
||||
pr_err("Cannot find regmap for %pOF: %ld\n", node,
|
||||
PTR_ERR(regmap));
|
||||
return PTR_ERR(regmap);
|
||||
}
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
const struct mtk_mux *mux = &muxes[i];
|
||||
|
||||
if (IS_ERR_OR_NULL(clk_data->clks[mux->id])) {
|
||||
clk = mtk_clk_register_mux(mux, regmap, lock);
|
||||
|
||||
if (IS_ERR(clk)) {
|
||||
pr_err("Failed to register clk %s: %ld\n",
|
||||
mux->name, PTR_ERR(clk));
|
||||
continue;
|
||||
}
|
||||
|
||||
clk_data->clks[mux->id] = clk;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
89
drivers/clk/mediatek/clk-mux.h
Normal file
89
drivers/clk/mediatek/clk-mux.h
Normal file
@ -0,0 +1,89 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (c) 2018 MediaTek Inc.
|
||||
* Author: Owen Chen <owen.chen@mediatek.com>
|
||||
*/
|
||||
|
||||
#ifndef __DRV_CLK_MTK_MUX_H
|
||||
#define __DRV_CLK_MTK_MUX_H
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
|
||||
struct mtk_clk_mux {
|
||||
struct clk_hw hw;
|
||||
struct regmap *regmap;
|
||||
const struct mtk_mux *data;
|
||||
spinlock_t *lock;
|
||||
};
|
||||
|
||||
struct mtk_mux {
|
||||
int id;
|
||||
const char *name;
|
||||
const char * const *parent_names;
|
||||
unsigned int flags;
|
||||
|
||||
u32 mux_ofs;
|
||||
u32 set_ofs;
|
||||
u32 clr_ofs;
|
||||
u32 upd_ofs;
|
||||
|
||||
u8 mux_shift;
|
||||
u8 mux_width;
|
||||
u8 gate_shift;
|
||||
s8 upd_shift;
|
||||
|
||||
const struct clk_ops *ops;
|
||||
|
||||
signed char num_parents;
|
||||
};
|
||||
|
||||
extern const struct clk_ops mtk_mux_ops;
|
||||
extern const struct clk_ops mtk_mux_clr_set_upd_ops;
|
||||
extern const struct clk_ops mtk_mux_gate_ops;
|
||||
extern const struct clk_ops mtk_mux_gate_clr_set_upd_ops;
|
||||
|
||||
#define GATE_CLR_SET_UPD_FLAGS(_id, _name, _parents, _mux_ofs, \
|
||||
_mux_set_ofs, _mux_clr_ofs, _shift, _width, \
|
||||
_gate, _upd_ofs, _upd, _flags, _ops) { \
|
||||
.id = _id, \
|
||||
.name = _name, \
|
||||
.mux_ofs = _mux_ofs, \
|
||||
.set_ofs = _mux_set_ofs, \
|
||||
.clr_ofs = _mux_clr_ofs, \
|
||||
.upd_ofs = _upd_ofs, \
|
||||
.mux_shift = _shift, \
|
||||
.mux_width = _width, \
|
||||
.gate_shift = _gate, \
|
||||
.upd_shift = _upd, \
|
||||
.parent_names = _parents, \
|
||||
.num_parents = ARRAY_SIZE(_parents), \
|
||||
.flags = _flags, \
|
||||
.ops = &_ops, \
|
||||
}
|
||||
|
||||
#define MUX_GATE_CLR_SET_UPD_FLAGS(_id, _name, _parents, _mux_ofs, \
|
||||
_mux_set_ofs, _mux_clr_ofs, _shift, _width, \
|
||||
_gate, _upd_ofs, _upd, _flags) \
|
||||
GATE_CLR_SET_UPD_FLAGS(_id, _name, _parents, _mux_ofs, \
|
||||
_mux_set_ofs, _mux_clr_ofs, _shift, _width, \
|
||||
_gate, _upd_ofs, _upd, _flags, \
|
||||
mtk_mux_gate_clr_set_upd_ops)
|
||||
|
||||
#define MUX_GATE_CLR_SET_UPD(_id, _name, _parents, _mux_ofs, \
|
||||
_mux_set_ofs, _mux_clr_ofs, _shift, _width, \
|
||||
_gate, _upd_ofs, _upd) \
|
||||
MUX_GATE_CLR_SET_UPD_FLAGS(_id, _name, _parents, \
|
||||
_mux_ofs, _mux_set_ofs, _mux_clr_ofs, _shift, \
|
||||
_width, _gate, _upd_ofs, _upd, \
|
||||
CLK_SET_RATE_PARENT)
|
||||
|
||||
struct clk *mtk_clk_register_mux(const struct mtk_mux *mux,
|
||||
struct regmap *regmap,
|
||||
spinlock_t *lock);
|
||||
|
||||
int mtk_clk_register_muxes(const struct mtk_mux *muxes,
|
||||
int num, struct device_node *node,
|
||||
spinlock_t *lock,
|
||||
struct clk_onecell_data *clk_data);
|
||||
|
||||
#endif /* __DRV_CLK_MTK_MUX_H */
|
@ -27,11 +27,13 @@
|
||||
#define CON0_BASE_EN BIT(0)
|
||||
#define CON0_PWR_ON BIT(0)
|
||||
#define CON0_ISO_EN BIT(1)
|
||||
#define CON0_PCW_CHG BIT(31)
|
||||
#define PCW_CHG_MASK BIT(31)
|
||||
|
||||
#define AUDPLL_TUNER_EN BIT(31)
|
||||
|
||||
#define POSTDIV_MASK 0x7
|
||||
|
||||
/* default 7 bits integer, can be overridden with pcwibits. */
|
||||
#define INTEGER_BITS 7
|
||||
|
||||
/*
|
||||
@ -49,6 +51,7 @@ struct mtk_clk_pll {
|
||||
void __iomem *tuner_addr;
|
||||
void __iomem *tuner_en_addr;
|
||||
void __iomem *pcw_addr;
|
||||
void __iomem *pcw_chg_addr;
|
||||
const struct mtk_pll_data *data;
|
||||
};
|
||||
|
||||
@ -68,12 +71,15 @@ static unsigned long __mtk_pll_recalc_rate(struct mtk_clk_pll *pll, u32 fin,
|
||||
u32 pcw, int postdiv)
|
||||
{
|
||||
int pcwbits = pll->data->pcwbits;
|
||||
int pcwfbits;
|
||||
int pcwfbits = 0;
|
||||
int ibits;
|
||||
u64 vco;
|
||||
u8 c = 0;
|
||||
|
||||
/* The fractional part of the PLL divider. */
|
||||
pcwfbits = pcwbits > INTEGER_BITS ? pcwbits - INTEGER_BITS : 0;
|
||||
ibits = pll->data->pcwibits ? pll->data->pcwibits : INTEGER_BITS;
|
||||
if (pcwbits > ibits)
|
||||
pcwfbits = pcwbits - ibits;
|
||||
|
||||
vco = (u64)fin * pcw;
|
||||
|
||||
@ -88,13 +94,39 @@ static unsigned long __mtk_pll_recalc_rate(struct mtk_clk_pll *pll, u32 fin,
|
||||
return ((unsigned long)vco + postdiv - 1) / postdiv;
|
||||
}
|
||||
|
||||
static void __mtk_pll_tuner_enable(struct mtk_clk_pll *pll)
|
||||
{
|
||||
u32 r;
|
||||
|
||||
if (pll->tuner_en_addr) {
|
||||
r = readl(pll->tuner_en_addr) | BIT(pll->data->tuner_en_bit);
|
||||
writel(r, pll->tuner_en_addr);
|
||||
} else if (pll->tuner_addr) {
|
||||
r = readl(pll->tuner_addr) | AUDPLL_TUNER_EN;
|
||||
writel(r, pll->tuner_addr);
|
||||
}
|
||||
}
|
||||
|
||||
static void __mtk_pll_tuner_disable(struct mtk_clk_pll *pll)
|
||||
{
|
||||
u32 r;
|
||||
|
||||
if (pll->tuner_en_addr) {
|
||||
r = readl(pll->tuner_en_addr) & ~BIT(pll->data->tuner_en_bit);
|
||||
writel(r, pll->tuner_en_addr);
|
||||
} else if (pll->tuner_addr) {
|
||||
r = readl(pll->tuner_addr) & ~AUDPLL_TUNER_EN;
|
||||
writel(r, pll->tuner_addr);
|
||||
}
|
||||
}
|
||||
|
||||
static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw,
|
||||
int postdiv)
|
||||
{
|
||||
u32 con1, val;
|
||||
int pll_en;
|
||||
u32 chg, val;
|
||||
|
||||
pll_en = readl(pll->base_addr + REG_CON0) & CON0_BASE_EN;
|
||||
/* disable tuner */
|
||||
__mtk_pll_tuner_disable(pll);
|
||||
|
||||
/* set postdiv */
|
||||
val = readl(pll->pd_addr);
|
||||
@ -112,18 +144,15 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw,
|
||||
pll->data->pcw_shift);
|
||||
val |= pcw << pll->data->pcw_shift;
|
||||
writel(val, pll->pcw_addr);
|
||||
|
||||
con1 = readl(pll->base_addr + REG_CON1);
|
||||
|
||||
if (pll_en)
|
||||
con1 |= CON0_PCW_CHG;
|
||||
|
||||
writel(con1, pll->base_addr + REG_CON1);
|
||||
chg = readl(pll->pcw_chg_addr) | PCW_CHG_MASK;
|
||||
writel(chg, pll->pcw_chg_addr);
|
||||
if (pll->tuner_addr)
|
||||
writel(con1 + 1, pll->tuner_addr);
|
||||
writel(val + 1, pll->tuner_addr);
|
||||
|
||||
if (pll_en)
|
||||
udelay(20);
|
||||
/* restore tuner_en */
|
||||
__mtk_pll_tuner_enable(pll);
|
||||
|
||||
udelay(20);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -138,9 +167,10 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw,
|
||||
static void mtk_pll_calc_values(struct mtk_clk_pll *pll, u32 *pcw, u32 *postdiv,
|
||||
u32 freq, u32 fin)
|
||||
{
|
||||
unsigned long fmin = 1000 * MHZ;
|
||||
unsigned long fmin = pll->data->fmin ? pll->data->fmin : (1000 * MHZ);
|
||||
const struct mtk_pll_div_table *div_table = pll->data->div_table;
|
||||
u64 _pcw;
|
||||
int ibits;
|
||||
u32 val;
|
||||
|
||||
if (freq > pll->data->fmax)
|
||||
@ -164,7 +194,8 @@ static void mtk_pll_calc_values(struct mtk_clk_pll *pll, u32 *pcw, u32 *postdiv,
|
||||
}
|
||||
|
||||
/* _pcw = freq * postdiv / fin * 2^pcwfbits */
|
||||
_pcw = ((u64)freq << val) << (pll->data->pcwbits - INTEGER_BITS);
|
||||
ibits = pll->data->pcwibits ? pll->data->pcwibits : INTEGER_BITS;
|
||||
_pcw = ((u64)freq << val) << (pll->data->pcwbits - ibits);
|
||||
do_div(_pcw, fin);
|
||||
|
||||
*pcw = (u32)_pcw;
|
||||
@ -228,13 +259,7 @@ static int mtk_pll_prepare(struct clk_hw *hw)
|
||||
r |= pll->data->en_mask;
|
||||
writel(r, pll->base_addr + REG_CON0);
|
||||
|
||||
if (pll->tuner_en_addr) {
|
||||
r = readl(pll->tuner_en_addr) | BIT(pll->data->tuner_en_bit);
|
||||
writel(r, pll->tuner_en_addr);
|
||||
} else if (pll->tuner_addr) {
|
||||
r = readl(pll->tuner_addr) | AUDPLL_TUNER_EN;
|
||||
writel(r, pll->tuner_addr);
|
||||
}
|
||||
__mtk_pll_tuner_enable(pll);
|
||||
|
||||
udelay(20);
|
||||
|
||||
@ -258,13 +283,7 @@ static void mtk_pll_unprepare(struct clk_hw *hw)
|
||||
writel(r, pll->base_addr + REG_CON0);
|
||||
}
|
||||
|
||||
if (pll->tuner_en_addr) {
|
||||
r = readl(pll->tuner_en_addr) & ~BIT(pll->data->tuner_en_bit);
|
||||
writel(r, pll->tuner_en_addr);
|
||||
} else if (pll->tuner_addr) {
|
||||
r = readl(pll->tuner_addr) & ~AUDPLL_TUNER_EN;
|
||||
writel(r, pll->tuner_addr);
|
||||
}
|
||||
__mtk_pll_tuner_disable(pll);
|
||||
|
||||
r = readl(pll->base_addr + REG_CON0);
|
||||
r &= ~CON0_BASE_EN;
|
||||
@ -302,6 +321,10 @@ static struct clk *mtk_clk_register_pll(const struct mtk_pll_data *data,
|
||||
pll->pwr_addr = base + data->pwr_reg;
|
||||
pll->pd_addr = base + data->pd_reg;
|
||||
pll->pcw_addr = base + data->pcw_reg;
|
||||
if (data->pcw_chg_reg)
|
||||
pll->pcw_chg_addr = base + data->pcw_chg_reg;
|
||||
else
|
||||
pll->pcw_chg_addr = pll->base_addr + REG_CON1;
|
||||
if (data->tuner_reg)
|
||||
pll->tuner_addr = base + data->tuner_reg;
|
||||
if (data->tuner_en_reg)
|
||||
|
@ -243,6 +243,12 @@ config SDM_GCC_660
|
||||
Say Y if you want to use peripheral devices such as UART, SPI,
|
||||
i2C, USB, UFS, SDDC, PCIe, etc.
|
||||
|
||||
config QCS_TURING_404
|
||||
tristate "QCS404 Turing Clock Controller"
|
||||
help
|
||||
Support for the Turing Clock Controller on QCS404, provides clocks
|
||||
and resets for the Turing subsystem.
|
||||
|
||||
config SDM_GCC_845
|
||||
tristate "SDM845 Global Clock Controller"
|
||||
select QCOM_GDSC
|
||||
|
@ -42,6 +42,7 @@ obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o
|
||||
obj-$(CONFIG_QCOM_CLK_RPMH) += clk-rpmh.o
|
||||
obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o
|
||||
obj-$(CONFIG_QCS_GCC_404) += gcc-qcs404.o
|
||||
obj-$(CONFIG_QCS_TURING_404) += turingcc-qcs404.o
|
||||
obj-$(CONFIG_SDM_CAMCC_845) += camcc-sdm845.o
|
||||
obj-$(CONFIG_SDM_DISPCC_845) += dispcc-sdm845.o
|
||||
obj-$(CONFIG_SDM_GCC_660) += gcc-sdm660.o
|
||||
|
@ -146,6 +146,12 @@ const struct clk_ops clk_branch2_ops = {
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(clk_branch2_ops);
|
||||
|
||||
const struct clk_ops clk_branch2_aon_ops = {
|
||||
.enable = clk_branch2_enable,
|
||||
.is_enabled = clk_is_enabled_regmap,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(clk_branch2_aon_ops);
|
||||
|
||||
const struct clk_ops clk_branch_simple_ops = {
|
||||
.enable = clk_enable_regmap,
|
||||
.disable = clk_disable_regmap,
|
||||
|
@ -40,6 +40,7 @@ struct clk_branch {
|
||||
extern const struct clk_ops clk_branch_ops;
|
||||
extern const struct clk_ops clk_branch2_ops;
|
||||
extern const struct clk_ops clk_branch_simple_ops;
|
||||
extern const struct clk_ops clk_branch2_aon_ops;
|
||||
|
||||
#define to_clk_branch(_hw) \
|
||||
container_of(to_clk_regmap(_hw), struct clk_branch, clkr)
|
||||
|
@ -2161,7 +2161,7 @@ static struct clk_branch gcc_pcie_0_mstr_axi_clk = {
|
||||
|
||||
static struct clk_branch gcc_pcie_0_pipe_clk = {
|
||||
.halt_reg = 0x6b018,
|
||||
.halt_check = BRANCH_HALT,
|
||||
.halt_check = BRANCH_HALT_SKIP,
|
||||
.clkr = {
|
||||
.enable_reg = 0x6b018,
|
||||
.enable_mask = BIT(0),
|
||||
|
@ -260,6 +260,20 @@ static const char * const gcc_parent_names_15[] = {
|
||||
"core_bi_pll_test_se",
|
||||
};
|
||||
|
||||
static const struct parent_map gcc_parent_map_16[] = {
|
||||
{ P_XO, 0 },
|
||||
{ P_GPLL0_OUT_MAIN, 1 },
|
||||
{ P_GPLL0_OUT_AUX, 2 },
|
||||
{ P_CORE_BI_PLL_TEST_SE, 7 },
|
||||
};
|
||||
|
||||
static const char * const gcc_parent_names_16[] = {
|
||||
"cxo",
|
||||
"gpll0_out_main",
|
||||
"gpll0_out_aux",
|
||||
"core_bi_pll_test_se",
|
||||
};
|
||||
|
||||
static struct clk_fixed_factor cxo = {
|
||||
.mult = 1,
|
||||
.div = 1,
|
||||
@ -1194,6 +1208,28 @@ static struct clk_rcg2 vsync_clk_src = {
|
||||
},
|
||||
};
|
||||
|
||||
static const struct freq_tbl ftbl_cdsp_bimc_clk_src[] = {
|
||||
F(19200000, P_XO, 1, 0, 0),
|
||||
F(133333333, P_GPLL0_OUT_MAIN, 6, 0, 0),
|
||||
F(266666667, P_GPLL0_OUT_MAIN, 3, 0, 0),
|
||||
F(320000000, P_GPLL0_OUT_MAIN, 2.5, 0, 0),
|
||||
{ }
|
||||
};
|
||||
|
||||
static struct clk_rcg2 cdsp_bimc_clk_src = {
|
||||
.cmd_rcgr = 0x5e010,
|
||||
.mnd_width = 0,
|
||||
.hid_width = 5,
|
||||
.parent_map = gcc_parent_map_16,
|
||||
.freq_tbl = ftbl_cdsp_bimc_clk_src,
|
||||
.clkr.hw.init = &(struct clk_init_data) {
|
||||
.name = "cdsp_bimc_clk_src",
|
||||
.parent_names = gcc_parent_names_16,
|
||||
.num_parents = 4,
|
||||
.ops = &clk_rcg2_ops,
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch gcc_apss_ahb_clk = {
|
||||
.halt_reg = 0x4601c,
|
||||
.halt_check = BRANCH_HALT_VOTED,
|
||||
@ -1255,6 +1291,24 @@ static struct clk_branch gcc_bimc_gpu_clk = {
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch gcc_bimc_cdsp_clk = {
|
||||
.halt_reg = 0x31030,
|
||||
.halt_check = BRANCH_HALT,
|
||||
.clkr = {
|
||||
.enable_reg = 0x31030,
|
||||
.enable_mask = BIT(0),
|
||||
.hw.init = &(struct clk_init_data) {
|
||||
.name = "gcc_bimc_cdsp_clk",
|
||||
.parent_names = (const char *[]) {
|
||||
"cdsp_bimc_clk_src",
|
||||
},
|
||||
.num_parents = 1,
|
||||
.flags = CLK_SET_RATE_PARENT,
|
||||
.ops = &clk_branch2_ops,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch gcc_bimc_mdss_clk = {
|
||||
.halt_reg = 0x31038,
|
||||
.halt_check = BRANCH_HALT,
|
||||
@ -1792,6 +1846,24 @@ static struct clk_branch gcc_gfx_tbu_clk = {
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch gcc_cdsp_tbu_clk = {
|
||||
.halt_reg = 0x1203c,
|
||||
.halt_check = BRANCH_VOTED,
|
||||
.clkr = {
|
||||
.enable_reg = 0x13020,
|
||||
.enable_mask = BIT(9),
|
||||
.hw.init = &(struct clk_init_data) {
|
||||
.name = "gcc_cdsp_tbu_clk",
|
||||
.parent_names = (const char *[]) {
|
||||
"cdsp_bimc_clk_src",
|
||||
},
|
||||
.num_parents = 1,
|
||||
.flags = CLK_SET_RATE_PARENT,
|
||||
.ops = &clk_branch2_ops,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch gcc_gp1_clk = {
|
||||
.halt_reg = 0x8000,
|
||||
.halt_check = BRANCH_HALT,
|
||||
@ -2304,6 +2376,19 @@ static struct clk_branch gcc_sdcc1_ice_core_clk = {
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch gcc_cdsp_cfg_ahb_clk = {
|
||||
.halt_reg = 0x5e004,
|
||||
.halt_check = BRANCH_HALT,
|
||||
.clkr = {
|
||||
.enable_reg = 0x5e004,
|
||||
.enable_mask = BIT(0),
|
||||
.hw.init = &(struct clk_init_data) {
|
||||
.name = "gcc_cdsp_cfg_ahb_cbcr",
|
||||
.ops = &clk_branch2_ops,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch gcc_sdcc2_ahb_clk = {
|
||||
.halt_reg = 0x4301c,
|
||||
.halt_check = BRANCH_HALT,
|
||||
@ -2548,6 +2633,7 @@ static struct clk_regmap *gcc_qcs404_clocks[] = {
|
||||
[GCC_ESC0_CLK_SRC] = &esc0_clk_src.clkr,
|
||||
[GCC_APSS_AHB_CLK] = &gcc_apss_ahb_clk.clkr,
|
||||
[GCC_BIMC_GFX_CLK] = &gcc_bimc_gfx_clk.clkr,
|
||||
[GCC_BIMC_CDSP_CLK] = &gcc_bimc_cdsp_clk.clkr,
|
||||
[GCC_BIMC_MDSS_CLK] = &gcc_bimc_mdss_clk.clkr,
|
||||
[GCC_BLSP1_AHB_CLK] = &gcc_blsp1_ahb_clk.clkr,
|
||||
[GCC_BLSP1_QUP0_I2C_APPS_CLK] = &gcc_blsp1_qup0_i2c_apps_clk.clkr,
|
||||
@ -2605,6 +2691,7 @@ static struct clk_regmap *gcc_qcs404_clocks[] = {
|
||||
[GCC_SDCC1_AHB_CLK] = &gcc_sdcc1_ahb_clk.clkr,
|
||||
[GCC_SDCC1_APPS_CLK] = &gcc_sdcc1_apps_clk.clkr,
|
||||
[GCC_SDCC1_ICE_CORE_CLK] = &gcc_sdcc1_ice_core_clk.clkr,
|
||||
[GCC_CDSP_CFG_AHB_CLK] = &gcc_cdsp_cfg_ahb_clk.clkr,
|
||||
[GCC_SDCC2_AHB_CLK] = &gcc_sdcc2_ahb_clk.clkr,
|
||||
[GCC_SDCC2_APPS_CLK] = &gcc_sdcc2_apps_clk.clkr,
|
||||
[GCC_SYS_NOC_USB3_CLK] = &gcc_sys_noc_usb3_clk.clkr,
|
||||
@ -2645,6 +2732,7 @@ static struct clk_regmap *gcc_qcs404_clocks[] = {
|
||||
[GCC_USB3_PHY_AUX_CLK_SRC] = &usb3_phy_aux_clk_src.clkr,
|
||||
[GCC_USB_HS_SYSTEM_CLK_SRC] = &usb_hs_system_clk_src.clkr,
|
||||
[GCC_VSYNC_CLK_SRC] = &vsync_clk_src.clkr,
|
||||
[GCC_CDSP_BIMC_CLK_SRC] = &cdsp_bimc_clk_src.clkr,
|
||||
[GCC_USB_HS_INACTIVITY_TIMERS_CLK] =
|
||||
&gcc_usb_hs_inactivity_timers_clk.clkr,
|
||||
[GCC_BIMC_GPU_CLK] = &gcc_bimc_gpu_clk.clkr,
|
||||
@ -2653,6 +2741,7 @@ static struct clk_regmap *gcc_qcs404_clocks[] = {
|
||||
[GCC_GFX_TBU_CLK] = &gcc_gfx_tbu_clk.clkr,
|
||||
[GCC_SMMU_CFG_CLK] = &gcc_smmu_cfg_clk.clkr,
|
||||
[GCC_APSS_TCU_CLK] = &gcc_apss_tcu_clk.clkr,
|
||||
[GCC_CDSP_TBU_CLK] = &gcc_cdsp_tbu_clk.clkr,
|
||||
[GCC_CRYPTO_AHB_CLK] = &gcc_crypto_ahb_clk.clkr,
|
||||
[GCC_CRYPTO_AXI_CLK] = &gcc_crypto_axi_clk.clkr,
|
||||
[GCC_CRYPTO_CLK] = &gcc_crypto_clk.clkr,
|
||||
@ -2664,6 +2753,7 @@ static struct clk_regmap *gcc_qcs404_clocks[] = {
|
||||
|
||||
static const struct qcom_reset_map gcc_qcs404_resets[] = {
|
||||
[GCC_GENI_IR_BCR] = { 0x0F000 },
|
||||
[GCC_CDSP_RESTART] = { 0x18000 },
|
||||
[GCC_USB_HS_BCR] = { 0x41000 },
|
||||
[GCC_USB2_HS_PHY_ONLY_BCR] = { 0x41034 },
|
||||
[GCC_QUSB2_PHY_BCR] = { 0x4103c },
|
||||
|
170
drivers/clk/qcom/turingcc-qcs404.c
Normal file
170
drivers/clk/qcom/turingcc-qcs404.c
Normal file
@ -0,0 +1,170 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright (c) 2019, Linaro Ltd.
|
||||
*/
|
||||
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/pm_clock.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
#include <dt-bindings/clock/qcom,turingcc-qcs404.h>
|
||||
|
||||
#include "clk-regmap.h"
|
||||
#include "clk-branch.h"
|
||||
#include "common.h"
|
||||
#include "reset.h"
|
||||
|
||||
static struct clk_branch turing_wrapper_aon_cbcr = {
|
||||
.halt_reg = 0x5098,
|
||||
.halt_check = BRANCH_HALT,
|
||||
.clkr = {
|
||||
.enable_reg = 0x5098,
|
||||
.enable_mask = BIT(0),
|
||||
.hw.init = &(struct clk_init_data) {
|
||||
.name = "turing_wrapper_aon_clk",
|
||||
.ops = &clk_branch2_aon_ops,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch turing_q6ss_ahbm_aon_cbcr = {
|
||||
.halt_reg = 0x9000,
|
||||
.halt_check = BRANCH_HALT,
|
||||
.clkr = {
|
||||
.enable_reg = 0x9000,
|
||||
.enable_mask = BIT(0),
|
||||
.hw.init = &(struct clk_init_data) {
|
||||
.name = "turing_q6ss_ahbm_aon_cbcr",
|
||||
.ops = &clk_branch2_ops,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch turing_q6ss_q6_axim_clk = {
|
||||
.halt_reg = 0xb000,
|
||||
.halt_check = BRANCH_HALT,
|
||||
.clkr = {
|
||||
.enable_reg = 0xb000,
|
||||
.enable_mask = BIT(0),
|
||||
.hw.init = &(struct clk_init_data) {
|
||||
.name = "turing_q6ss_q6_axim_clk",
|
||||
.ops = &clk_branch2_aon_ops,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch turing_q6ss_ahbs_aon_cbcr = {
|
||||
.halt_reg = 0x10000,
|
||||
.halt_check = BRANCH_HALT,
|
||||
.clkr = {
|
||||
.enable_reg = 0x10000,
|
||||
.enable_mask = BIT(0),
|
||||
.hw.init = &(struct clk_init_data) {
|
||||
.name = "turing_q6ss_ahbs_aon_clk",
|
||||
.ops = &clk_branch2_aon_ops,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch turing_wrapper_qos_ahbs_aon_cbcr = {
|
||||
.halt_reg = 0x11014,
|
||||
.halt_check = BRANCH_HALT,
|
||||
.clkr = {
|
||||
.enable_reg = 0x11014,
|
||||
.enable_mask = BIT(0),
|
||||
.hw.init = &(struct clk_init_data) {
|
||||
.name = "turing_wrapper_qos_ahbs_aon_clk",
|
||||
.ops = &clk_branch2_aon_ops,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_regmap *turingcc_clocks[] = {
|
||||
[TURING_WRAPPER_AON_CLK] = &turing_wrapper_aon_cbcr.clkr,
|
||||
[TURING_Q6SS_AHBM_AON_CLK] = &turing_q6ss_ahbm_aon_cbcr.clkr,
|
||||
[TURING_Q6SS_Q6_AXIM_CLK] = &turing_q6ss_q6_axim_clk.clkr,
|
||||
[TURING_Q6SS_AHBS_AON_CLK] = &turing_q6ss_ahbs_aon_cbcr.clkr,
|
||||
[TURING_WRAPPER_QOS_AHBS_AON_CLK] = &turing_wrapper_qos_ahbs_aon_cbcr.clkr,
|
||||
};
|
||||
|
||||
static const struct regmap_config turingcc_regmap_config = {
|
||||
.reg_bits = 32,
|
||||
.reg_stride = 4,
|
||||
.val_bits = 32,
|
||||
.max_register = 0x30000,
|
||||
.fast_io = true,
|
||||
};
|
||||
|
||||
static const struct qcom_cc_desc turingcc_desc = {
|
||||
.config = &turingcc_regmap_config,
|
||||
.clks = turingcc_clocks,
|
||||
.num_clks = ARRAY_SIZE(turingcc_clocks),
|
||||
};
|
||||
|
||||
static int turingcc_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
ret = pm_clk_create(&pdev->dev);
|
||||
if (ret)
|
||||
goto disable_pm_runtime;
|
||||
|
||||
ret = pm_clk_add(&pdev->dev, NULL);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "failed to acquire iface clock\n");
|
||||
goto destroy_pm_clk;
|
||||
}
|
||||
|
||||
ret = qcom_cc_probe(pdev, &turingcc_desc);
|
||||
if (ret < 0)
|
||||
goto destroy_pm_clk;
|
||||
|
||||
return 0;
|
||||
|
||||
destroy_pm_clk:
|
||||
pm_clk_destroy(&pdev->dev);
|
||||
|
||||
disable_pm_runtime:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int turingcc_remove(struct platform_device *pdev)
|
||||
{
|
||||
pm_clk_destroy(&pdev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops turingcc_pm_ops = {
|
||||
SET_RUNTIME_PM_OPS(pm_clk_suspend, pm_clk_resume, NULL)
|
||||
};
|
||||
|
||||
static const struct of_device_id turingcc_match_table[] = {
|
||||
{ .compatible = "qcom,qcs404-turingcc" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, turingcc_match_table);
|
||||
|
||||
static struct platform_driver turingcc_driver = {
|
||||
.probe = turingcc_probe,
|
||||
.remove = turingcc_remove,
|
||||
.driver = {
|
||||
.name = "qcs404-turingcc",
|
||||
.of_match_table = turingcc_match_table,
|
||||
.pm = &turingcc_pm_ops,
|
||||
},
|
||||
};
|
||||
|
||||
module_platform_driver(turingcc_driver);
|
||||
|
||||
MODULE_DESCRIPTION("Qualcomm QCS404 Turing Clock Controller");
|
||||
MODULE_LICENSE("GPL v2");
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/io.h>
|
||||
#include <dt-bindings/clock/r7s9210-cpg-mssr.h>
|
||||
#include "renesas-cpg-mssr.h"
|
||||
|
||||
@ -119,7 +120,7 @@ static void __init r7s9210_update_clk_table(struct clk *extal_clk,
|
||||
if (clk_get_rate(extal_clk) > 12000000)
|
||||
cpg_mode = 1;
|
||||
|
||||
frqcr = clk_readl(base + CPG_FRQCR) & 0xFFF;
|
||||
frqcr = readl(base + CPG_FRQCR) & 0xFFF;
|
||||
if (frqcr == 0x012)
|
||||
index = 0;
|
||||
else if (frqcr == 0x112)
|
||||
|
@ -71,8 +71,8 @@ static const struct cpg_core_clk r8a774a1_core_clks[] __initconst = {
|
||||
DEF_GEN3_OSC(".r", CLK_RINT, CLK_EXTAL, 32),
|
||||
|
||||
/* Core Clock Outputs */
|
||||
DEF_BASE("z", R8A774A1_CLK_Z, CLK_TYPE_GEN3_Z, CLK_PLL0),
|
||||
DEF_BASE("z2", R8A774A1_CLK_Z2, CLK_TYPE_GEN3_Z2, CLK_PLL2),
|
||||
DEF_GEN3_Z("z", R8A774A1_CLK_Z, CLK_TYPE_GEN3_Z, CLK_PLL0, 2, 8),
|
||||
DEF_GEN3_Z("z2", R8A774A1_CLK_Z2, CLK_TYPE_GEN3_Z, CLK_PLL2, 2, 0),
|
||||
DEF_FIXED("ztr", R8A774A1_CLK_ZTR, CLK_PLL1_DIV2, 6, 1),
|
||||
DEF_FIXED("ztrd2", R8A774A1_CLK_ZTRD2, CLK_PLL1_DIV2, 12, 1),
|
||||
DEF_FIXED("zt", R8A774A1_CLK_ZT, CLK_PLL1_DIV2, 4, 1),
|
||||
@ -123,8 +123,8 @@ static const struct mssr_mod_clk r8a774a1_mod_clks[] __initconst = {
|
||||
DEF_MOD("msiof2", 209, R8A774A1_CLK_MSO),
|
||||
DEF_MOD("msiof1", 210, R8A774A1_CLK_MSO),
|
||||
DEF_MOD("msiof0", 211, R8A774A1_CLK_MSO),
|
||||
DEF_MOD("sys-dmac2", 217, R8A774A1_CLK_S0D3),
|
||||
DEF_MOD("sys-dmac1", 218, R8A774A1_CLK_S0D3),
|
||||
DEF_MOD("sys-dmac2", 217, R8A774A1_CLK_S3D1),
|
||||
DEF_MOD("sys-dmac1", 218, R8A774A1_CLK_S3D1),
|
||||
DEF_MOD("sys-dmac0", 219, R8A774A1_CLK_S0D3),
|
||||
DEF_MOD("cmt3", 300, R8A774A1_CLK_R),
|
||||
DEF_MOD("cmt2", 301, R8A774A1_CLK_R),
|
||||
@ -143,8 +143,8 @@ static const struct mssr_mod_clk r8a774a1_mod_clks[] __initconst = {
|
||||
DEF_MOD("rwdt", 402, R8A774A1_CLK_R),
|
||||
DEF_MOD("intc-ex", 407, R8A774A1_CLK_CP),
|
||||
DEF_MOD("intc-ap", 408, R8A774A1_CLK_S0D3),
|
||||
DEF_MOD("audmac1", 501, R8A774A1_CLK_S0D3),
|
||||
DEF_MOD("audmac0", 502, R8A774A1_CLK_S0D3),
|
||||
DEF_MOD("audmac1", 501, R8A774A1_CLK_S1D2),
|
||||
DEF_MOD("audmac0", 502, R8A774A1_CLK_S1D2),
|
||||
DEF_MOD("hscif4", 516, R8A774A1_CLK_S3D1),
|
||||
DEF_MOD("hscif3", 517, R8A774A1_CLK_S3D1),
|
||||
DEF_MOD("hscif2", 518, R8A774A1_CLK_S3D1),
|
||||
@ -165,9 +165,9 @@ static const struct mssr_mod_clk r8a774a1_mod_clks[] __initconst = {
|
||||
DEF_MOD("vspd0", 623, R8A774A1_CLK_S0D2),
|
||||
DEF_MOD("vspb", 626, R8A774A1_CLK_S0D1),
|
||||
DEF_MOD("vspi0", 631, R8A774A1_CLK_S0D1),
|
||||
DEF_MOD("ehci1", 702, R8A774A1_CLK_S3D4),
|
||||
DEF_MOD("ehci0", 703, R8A774A1_CLK_S3D4),
|
||||
DEF_MOD("hsusb", 704, R8A774A1_CLK_S3D4),
|
||||
DEF_MOD("ehci1", 702, R8A774A1_CLK_S3D2),
|
||||
DEF_MOD("ehci0", 703, R8A774A1_CLK_S3D2),
|
||||
DEF_MOD("hsusb", 704, R8A774A1_CLK_S3D2),
|
||||
DEF_MOD("csi20", 714, R8A774A1_CLK_CSI0),
|
||||
DEF_MOD("csi40", 716, R8A774A1_CLK_CSI0),
|
||||
DEF_MOD("du2", 722, R8A774A1_CLK_S2D1),
|
||||
|
@ -81,6 +81,7 @@ static const struct cpg_core_clk r8a774c0_core_clks[] __initconst = {
|
||||
/* Core Clock Outputs */
|
||||
DEF_FIXED("za2", R8A774C0_CLK_ZA2, CLK_PLL0D24, 1, 1),
|
||||
DEF_FIXED("za8", R8A774C0_CLK_ZA8, CLK_PLL0D8, 1, 1),
|
||||
DEF_GEN3_Z("z2", R8A774C0_CLK_Z2, CLK_TYPE_GEN3_Z, CLK_PLL0, 4, 8),
|
||||
DEF_FIXED("ztr", R8A774C0_CLK_ZTR, CLK_PLL1, 6, 1),
|
||||
DEF_FIXED("zt", R8A774C0_CLK_ZT, CLK_PLL1, 4, 1),
|
||||
DEF_FIXED("zx", R8A774C0_CLK_ZX, CLK_PLL1, 3, 1),
|
||||
@ -157,7 +158,7 @@ static const struct mssr_mod_clk r8a774c0_mod_clks[] __initconst = {
|
||||
DEF_MOD("intc-ex", 407, R8A774C0_CLK_CP),
|
||||
DEF_MOD("intc-ap", 408, R8A774C0_CLK_S0D3),
|
||||
|
||||
DEF_MOD("audmac0", 502, R8A774C0_CLK_S3D4),
|
||||
DEF_MOD("audmac0", 502, R8A774C0_CLK_S1D2),
|
||||
DEF_MOD("hscif4", 516, R8A774C0_CLK_S3D1C),
|
||||
DEF_MOD("hscif3", 517, R8A774C0_CLK_S3D1C),
|
||||
DEF_MOD("hscif2", 518, R8A774C0_CLK_S3D1C),
|
||||
@ -177,8 +178,8 @@ static const struct mssr_mod_clk r8a774c0_mod_clks[] __initconst = {
|
||||
DEF_MOD("vspb", 626, R8A774C0_CLK_S0D1),
|
||||
DEF_MOD("vspi0", 631, R8A774C0_CLK_S0D1),
|
||||
|
||||
DEF_MOD("ehci0", 703, R8A774C0_CLK_S3D4),
|
||||
DEF_MOD("hsusb", 704, R8A774C0_CLK_S3D4),
|
||||
DEF_MOD("ehci0", 703, R8A774C0_CLK_S3D2),
|
||||
DEF_MOD("hsusb", 704, R8A774C0_CLK_S3D2),
|
||||
DEF_MOD("csi40", 716, R8A774C0_CLK_CSI0),
|
||||
DEF_MOD("du1", 723, R8A774C0_CLK_S1D1),
|
||||
DEF_MOD("du0", 724, R8A774C0_CLK_S1D1),
|
||||
|
@ -3,6 +3,7 @@
|
||||
* r8a7795 Clock Pulse Generator / Module Standby and Software Reset
|
||||
*
|
||||
* Copyright (C) 2015 Glider bvba
|
||||
* Copyright (C) 2018-2019 Renesas Electronics Corp.
|
||||
*
|
||||
* Based on clk-rcar-gen3.c
|
||||
*
|
||||
@ -73,8 +74,8 @@ static struct cpg_core_clk r8a7795_core_clks[] __initdata = {
|
||||
DEF_GEN3_OSC(".r", CLK_RINT, CLK_EXTAL, 32),
|
||||
|
||||
/* Core Clock Outputs */
|
||||
DEF_BASE("z", R8A7795_CLK_Z, CLK_TYPE_GEN3_Z, CLK_PLL0),
|
||||
DEF_BASE("z2", R8A7795_CLK_Z2, CLK_TYPE_GEN3_Z2, CLK_PLL2),
|
||||
DEF_GEN3_Z("z", R8A7795_CLK_Z, CLK_TYPE_GEN3_Z, CLK_PLL0, 2, 8),
|
||||
DEF_GEN3_Z("z2", R8A7795_CLK_Z2, CLK_TYPE_GEN3_Z, CLK_PLL2, 2, 0),
|
||||
DEF_FIXED("ztr", R8A7795_CLK_ZTR, CLK_PLL1_DIV2, 6, 1),
|
||||
DEF_FIXED("ztrd2", R8A7795_CLK_ZTRD2, CLK_PLL1_DIV2, 12, 1),
|
||||
DEF_FIXED("zt", R8A7795_CLK_ZT, CLK_PLL1_DIV2, 4, 1),
|
||||
@ -129,8 +130,8 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = {
|
||||
DEF_MOD("msiof2", 209, R8A7795_CLK_MSO),
|
||||
DEF_MOD("msiof1", 210, R8A7795_CLK_MSO),
|
||||
DEF_MOD("msiof0", 211, R8A7795_CLK_MSO),
|
||||
DEF_MOD("sys-dmac2", 217, R8A7795_CLK_S0D3),
|
||||
DEF_MOD("sys-dmac1", 218, R8A7795_CLK_S0D3),
|
||||
DEF_MOD("sys-dmac2", 217, R8A7795_CLK_S3D1),
|
||||
DEF_MOD("sys-dmac1", 218, R8A7795_CLK_S3D1),
|
||||
DEF_MOD("sys-dmac0", 219, R8A7795_CLK_S0D3),
|
||||
DEF_MOD("sceg-pub", 229, R8A7795_CLK_CR),
|
||||
DEF_MOD("cmt3", 300, R8A7795_CLK_R),
|
||||
@ -153,16 +154,16 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = {
|
||||
DEF_MOD("rwdt", 402, R8A7795_CLK_R),
|
||||
DEF_MOD("intc-ex", 407, R8A7795_CLK_CP),
|
||||
DEF_MOD("intc-ap", 408, R8A7795_CLK_S0D3),
|
||||
DEF_MOD("audmac1", 501, R8A7795_CLK_S0D3),
|
||||
DEF_MOD("audmac0", 502, R8A7795_CLK_S0D3),
|
||||
DEF_MOD("drif7", 508, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("drif6", 509, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("drif5", 510, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("drif4", 511, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("drif3", 512, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("drif2", 513, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("drif1", 514, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("drif0", 515, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("audmac1", 501, R8A7795_CLK_S1D2),
|
||||
DEF_MOD("audmac0", 502, R8A7795_CLK_S1D2),
|
||||
DEF_MOD("drif31", 508, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("drif30", 509, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("drif21", 510, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("drif20", 511, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("drif11", 512, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("drif10", 513, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("drif01", 514, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("drif00", 515, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("hscif4", 516, R8A7795_CLK_S3D1),
|
||||
DEF_MOD("hscif3", 517, R8A7795_CLK_S3D1),
|
||||
DEF_MOD("hscif2", 518, R8A7795_CLK_S3D1),
|
||||
@ -194,12 +195,12 @@ static struct mssr_mod_clk r8a7795_mod_clks[] __initdata = {
|
||||
DEF_MOD("vspi2", 629, R8A7795_CLK_S2D1), /* ES1.x */
|
||||
DEF_MOD("vspi1", 630, R8A7795_CLK_S0D1),
|
||||
DEF_MOD("vspi0", 631, R8A7795_CLK_S0D1),
|
||||
DEF_MOD("ehci3", 700, R8A7795_CLK_S3D4),
|
||||
DEF_MOD("ehci2", 701, R8A7795_CLK_S3D4),
|
||||
DEF_MOD("ehci1", 702, R8A7795_CLK_S3D4),
|
||||
DEF_MOD("ehci0", 703, R8A7795_CLK_S3D4),
|
||||
DEF_MOD("hsusb", 704, R8A7795_CLK_S3D4),
|
||||
DEF_MOD("hsusb3", 705, R8A7795_CLK_S3D4),
|
||||
DEF_MOD("ehci3", 700, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("ehci2", 701, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("ehci1", 702, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("ehci0", 703, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("hsusb", 704, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("hsusb3", 705, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("csi21", 713, R8A7795_CLK_CSI0), /* ES1.x */
|
||||
DEF_MOD("csi20", 714, R8A7795_CLK_CSI0),
|
||||
DEF_MOD("csi41", 715, R8A7795_CLK_CSI0),
|
||||
|
@ -3,6 +3,7 @@
|
||||
* r8a7796 Clock Pulse Generator / Module Standby and Software Reset
|
||||
*
|
||||
* Copyright (C) 2016 Glider bvba
|
||||
* Copyright (C) 2018 Renesas Electronics Corp.
|
||||
*
|
||||
* Based on r8a7795-cpg-mssr.c
|
||||
*
|
||||
@ -73,8 +74,8 @@ static const struct cpg_core_clk r8a7796_core_clks[] __initconst = {
|
||||
DEF_GEN3_OSC(".r", CLK_RINT, CLK_EXTAL, 32),
|
||||
|
||||
/* Core Clock Outputs */
|
||||
DEF_BASE("z", R8A7796_CLK_Z, CLK_TYPE_GEN3_Z, CLK_PLL0),
|
||||
DEF_BASE("z2", R8A7796_CLK_Z2, CLK_TYPE_GEN3_Z2, CLK_PLL2),
|
||||
DEF_GEN3_Z("z", R8A7796_CLK_Z, CLK_TYPE_GEN3_Z, CLK_PLL0, 2, 8),
|
||||
DEF_GEN3_Z("z2", R8A7796_CLK_Z2, CLK_TYPE_GEN3_Z, CLK_PLL2, 2, 0),
|
||||
DEF_FIXED("ztr", R8A7796_CLK_ZTR, CLK_PLL1_DIV2, 6, 1),
|
||||
DEF_FIXED("ztrd2", R8A7796_CLK_ZTRD2, CLK_PLL1_DIV2, 12, 1),
|
||||
DEF_FIXED("zt", R8A7796_CLK_ZT, CLK_PLL1_DIV2, 4, 1),
|
||||
@ -126,8 +127,8 @@ static const struct mssr_mod_clk r8a7796_mod_clks[] __initconst = {
|
||||
DEF_MOD("msiof2", 209, R8A7796_CLK_MSO),
|
||||
DEF_MOD("msiof1", 210, R8A7796_CLK_MSO),
|
||||
DEF_MOD("msiof0", 211, R8A7796_CLK_MSO),
|
||||
DEF_MOD("sys-dmac2", 217, R8A7796_CLK_S0D3),
|
||||
DEF_MOD("sys-dmac1", 218, R8A7796_CLK_S0D3),
|
||||
DEF_MOD("sys-dmac2", 217, R8A7796_CLK_S3D1),
|
||||
DEF_MOD("sys-dmac1", 218, R8A7796_CLK_S3D1),
|
||||
DEF_MOD("sys-dmac0", 219, R8A7796_CLK_S0D3),
|
||||
DEF_MOD("cmt3", 300, R8A7796_CLK_R),
|
||||
DEF_MOD("cmt2", 301, R8A7796_CLK_R),
|
||||
@ -146,16 +147,16 @@ static const struct mssr_mod_clk r8a7796_mod_clks[] __initconst = {
|
||||
DEF_MOD("rwdt", 402, R8A7796_CLK_R),
|
||||
DEF_MOD("intc-ex", 407, R8A7796_CLK_CP),
|
||||
DEF_MOD("intc-ap", 408, R8A7796_CLK_S0D3),
|
||||
DEF_MOD("audmac1", 501, R8A7796_CLK_S0D3),
|
||||
DEF_MOD("audmac0", 502, R8A7796_CLK_S0D3),
|
||||
DEF_MOD("drif7", 508, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("drif6", 509, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("drif5", 510, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("drif4", 511, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("drif3", 512, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("drif2", 513, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("drif1", 514, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("drif0", 515, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("audmac1", 501, R8A7796_CLK_S1D2),
|
||||
DEF_MOD("audmac0", 502, R8A7796_CLK_S1D2),
|
||||
DEF_MOD("drif31", 508, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("drif30", 509, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("drif21", 510, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("drif20", 511, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("drif11", 512, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("drif10", 513, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("drif01", 514, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("drif00", 515, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("hscif4", 516, R8A7796_CLK_S3D1),
|
||||
DEF_MOD("hscif3", 517, R8A7796_CLK_S3D1),
|
||||
DEF_MOD("hscif2", 518, R8A7796_CLK_S3D1),
|
||||
@ -176,9 +177,9 @@ static const struct mssr_mod_clk r8a7796_mod_clks[] __initconst = {
|
||||
DEF_MOD("vspd0", 623, R8A7796_CLK_S0D2),
|
||||
DEF_MOD("vspb", 626, R8A7796_CLK_S0D1),
|
||||
DEF_MOD("vspi0", 631, R8A7796_CLK_S0D1),
|
||||
DEF_MOD("ehci1", 702, R8A7796_CLK_S3D4),
|
||||
DEF_MOD("ehci0", 703, R8A7796_CLK_S3D4),
|
||||
DEF_MOD("hsusb", 704, R8A7796_CLK_S3D4),
|
||||
DEF_MOD("ehci1", 702, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("ehci0", 703, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("hsusb", 704, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("csi20", 714, R8A7796_CLK_CSI0),
|
||||
DEF_MOD("csi40", 716, R8A7796_CLK_CSI0),
|
||||
DEF_MOD("du2", 722, R8A7796_CLK_S2D1),
|
||||
|
@ -3,6 +3,7 @@
|
||||
* r8a77965 Clock Pulse Generator / Module Standby and Software Reset
|
||||
*
|
||||
* Copyright (C) 2018 Jacopo Mondi <jacopo+renesas@jmondi.org>
|
||||
* Copyright (C) 2019 Renesas Electronics Corp.
|
||||
*
|
||||
* Based on r8a7795-cpg-mssr.c
|
||||
*
|
||||
@ -71,7 +72,7 @@ static const struct cpg_core_clk r8a77965_core_clks[] __initconst = {
|
||||
DEF_GEN3_OSC(".r", CLK_RINT, CLK_EXTAL, 32),
|
||||
|
||||
/* Core Clock Outputs */
|
||||
DEF_BASE("z", R8A77965_CLK_Z, CLK_TYPE_GEN3_Z, CLK_PLL0),
|
||||
DEF_GEN3_Z("z", R8A77965_CLK_Z, CLK_TYPE_GEN3_Z, CLK_PLL0, 2, 8),
|
||||
DEF_FIXED("ztr", R8A77965_CLK_ZTR, CLK_PLL1_DIV2, 6, 1),
|
||||
DEF_FIXED("ztrd2", R8A77965_CLK_ZTRD2, CLK_PLL1_DIV2, 12, 1),
|
||||
DEF_FIXED("zt", R8A77965_CLK_ZT, CLK_PLL1_DIV2, 4, 1),
|
||||
@ -123,8 +124,8 @@ static const struct mssr_mod_clk r8a77965_mod_clks[] __initconst = {
|
||||
DEF_MOD("msiof2", 209, R8A77965_CLK_MSO),
|
||||
DEF_MOD("msiof1", 210, R8A77965_CLK_MSO),
|
||||
DEF_MOD("msiof0", 211, R8A77965_CLK_MSO),
|
||||
DEF_MOD("sys-dmac2", 217, R8A77965_CLK_S0D3),
|
||||
DEF_MOD("sys-dmac1", 218, R8A77965_CLK_S0D3),
|
||||
DEF_MOD("sys-dmac2", 217, R8A77965_CLK_S3D1),
|
||||
DEF_MOD("sys-dmac1", 218, R8A77965_CLK_S3D1),
|
||||
DEF_MOD("sys-dmac0", 219, R8A77965_CLK_S0D3),
|
||||
|
||||
DEF_MOD("cmt3", 300, R8A77965_CLK_R),
|
||||
@ -146,16 +147,16 @@ static const struct mssr_mod_clk r8a77965_mod_clks[] __initconst = {
|
||||
DEF_MOD("intc-ex", 407, R8A77965_CLK_CP),
|
||||
DEF_MOD("intc-ap", 408, R8A77965_CLK_S0D3),
|
||||
|
||||
DEF_MOD("audmac1", 501, R8A77965_CLK_S0D3),
|
||||
DEF_MOD("audmac0", 502, R8A77965_CLK_S0D3),
|
||||
DEF_MOD("drif7", 508, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("drif6", 509, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("drif5", 510, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("drif4", 511, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("drif3", 512, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("drif2", 513, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("drif1", 514, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("drif0", 515, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("audmac1", 501, R8A77965_CLK_S1D2),
|
||||
DEF_MOD("audmac0", 502, R8A77965_CLK_S1D2),
|
||||
DEF_MOD("drif31", 508, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("drif30", 509, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("drif21", 510, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("drif20", 511, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("drif11", 512, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("drif10", 513, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("drif01", 514, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("drif00", 515, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("hscif4", 516, R8A77965_CLK_S3D1),
|
||||
DEF_MOD("hscif3", 517, R8A77965_CLK_S3D1),
|
||||
DEF_MOD("hscif2", 518, R8A77965_CLK_S3D1),
|
||||
@ -175,9 +176,9 @@ static const struct mssr_mod_clk r8a77965_mod_clks[] __initconst = {
|
||||
DEF_MOD("vspb", 626, R8A77965_CLK_S0D1),
|
||||
DEF_MOD("vspi0", 631, R8A77965_CLK_S0D1),
|
||||
|
||||
DEF_MOD("ehci1", 702, R8A77965_CLK_S3D4),
|
||||
DEF_MOD("ehci0", 703, R8A77965_CLK_S3D4),
|
||||
DEF_MOD("hsusb", 704, R8A77965_CLK_S3D4),
|
||||
DEF_MOD("ehci1", 702, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("ehci0", 703, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("hsusb", 704, R8A77965_CLK_S3D2),
|
||||
DEF_MOD("csi20", 714, R8A77965_CLK_CSI0),
|
||||
DEF_MOD("csi40", 716, R8A77965_CLK_CSI0),
|
||||
DEF_MOD("du3", 721, R8A77965_CLK_S2D1),
|
||||
|
@ -171,7 +171,7 @@ static const struct mssr_mod_clk r8a77980_mod_clks[] __initconst = {
|
||||
DEF_MOD("gpio1", 911, R8A77980_CLK_CP),
|
||||
DEF_MOD("gpio0", 912, R8A77980_CLK_CP),
|
||||
DEF_MOD("can-fd", 914, R8A77980_CLK_S3D2),
|
||||
DEF_MOD("rpc-if", 917, R8A77980_CLK_RPC),
|
||||
DEF_MOD("rpc-if", 917, R8A77980_CLK_RPCD2),
|
||||
DEF_MOD("i2c4", 927, R8A77980_CLK_S0D6),
|
||||
DEF_MOD("i2c3", 928, R8A77980_CLK_S0D6),
|
||||
DEF_MOD("i2c2", 929, R8A77980_CLK_S3D2),
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* r8a77990 Clock Pulse Generator / Module Standby and Software Reset
|
||||
*
|
||||
* Copyright (C) 2018 Renesas Electronics Corp.
|
||||
* Copyright (C) 2018-2019 Renesas Electronics Corp.
|
||||
*
|
||||
* Based on r8a7795-cpg-mssr.c
|
||||
*
|
||||
@ -81,6 +81,7 @@ static const struct cpg_core_clk r8a77990_core_clks[] __initconst = {
|
||||
/* Core Clock Outputs */
|
||||
DEF_FIXED("za2", R8A77990_CLK_ZA2, CLK_PLL0D24, 1, 1),
|
||||
DEF_FIXED("za8", R8A77990_CLK_ZA8, CLK_PLL0D8, 1, 1),
|
||||
DEF_GEN3_Z("z2", R8A77990_CLK_Z2, CLK_TYPE_GEN3_Z, CLK_PLL0, 4, 8),
|
||||
DEF_FIXED("ztr", R8A77990_CLK_ZTR, CLK_PLL1, 6, 1),
|
||||
DEF_FIXED("zt", R8A77990_CLK_ZT, CLK_PLL1, 4, 1),
|
||||
DEF_FIXED("zx", R8A77990_CLK_ZX, CLK_PLL1, 3, 1),
|
||||
@ -152,15 +153,15 @@ static const struct mssr_mod_clk r8a77990_mod_clks[] __initconst = {
|
||||
DEF_MOD("intc-ex", 407, R8A77990_CLK_CP),
|
||||
DEF_MOD("intc-ap", 408, R8A77990_CLK_S0D3),
|
||||
|
||||
DEF_MOD("audmac0", 502, R8A77990_CLK_S3D4),
|
||||
DEF_MOD("drif7", 508, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("drif6", 509, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("drif5", 510, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("drif4", 511, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("drif3", 512, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("drif2", 513, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("drif1", 514, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("drif0", 515, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("audmac0", 502, R8A77990_CLK_S1D2),
|
||||
DEF_MOD("drif31", 508, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("drif30", 509, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("drif21", 510, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("drif20", 511, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("drif11", 512, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("drif10", 513, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("drif01", 514, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("drif00", 515, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("hscif4", 516, R8A77990_CLK_S3D1C),
|
||||
DEF_MOD("hscif3", 517, R8A77990_CLK_S3D1C),
|
||||
DEF_MOD("hscif2", 518, R8A77990_CLK_S3D1C),
|
||||
@ -180,8 +181,8 @@ static const struct mssr_mod_clk r8a77990_mod_clks[] __initconst = {
|
||||
DEF_MOD("vspb", 626, R8A77990_CLK_S0D1),
|
||||
DEF_MOD("vspi0", 631, R8A77990_CLK_S0D1),
|
||||
|
||||
DEF_MOD("ehci0", 703, R8A77990_CLK_S3D4),
|
||||
DEF_MOD("hsusb", 704, R8A77990_CLK_S3D4),
|
||||
DEF_MOD("ehci0", 703, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("hsusb", 704, R8A77990_CLK_S3D2),
|
||||
DEF_MOD("csi40", 716, R8A77990_CLK_CSI0),
|
||||
DEF_MOD("du1", 723, R8A77990_CLK_S1D1),
|
||||
DEF_MOD("du0", 724, R8A77990_CLK_S1D1),
|
||||
|
@ -133,7 +133,7 @@ static const struct mssr_mod_clk r8a77995_mod_clks[] __initconst = {
|
||||
DEF_MOD("rwdt", 402, R8A77995_CLK_R),
|
||||
DEF_MOD("intc-ex", 407, R8A77995_CLK_CP),
|
||||
DEF_MOD("intc-ap", 408, R8A77995_CLK_S1D2),
|
||||
DEF_MOD("audmac0", 502, R8A77995_CLK_S3D1),
|
||||
DEF_MOD("audmac0", 502, R8A77995_CLK_S1D2),
|
||||
DEF_MOD("hscif3", 517, R8A77995_CLK_S3D1C),
|
||||
DEF_MOD("hscif0", 520, R8A77995_CLK_S3D1C),
|
||||
DEF_MOD("thermal", 522, R8A77995_CLK_CP),
|
||||
|
@ -170,6 +170,7 @@ static const struct r9a06g032_clkdesc r9a06g032_clocks[] __initconst = {
|
||||
D_GATE(CLK_P6_PG2, "clk_p6_pg2", DIV_P6_PG, 0x8a3, 0x8a4, 0x8a5, 0, 0xb61, 0, 0),
|
||||
D_GATE(CLK_P6_PG3, "clk_p6_pg3", DIV_P6_PG, 0x8a6, 0x8a7, 0x8a8, 0, 0xb62, 0, 0),
|
||||
D_GATE(CLK_P6_PG4, "clk_p6_pg4", DIV_P6_PG, 0x8a9, 0x8aa, 0x8ab, 0, 0xb63, 0, 0),
|
||||
D_GATE(CLK_PCI_USB, "clk_pci_usb", CLKOUT_D40, 0xe6, 0, 0, 0, 0, 0, 0),
|
||||
D_GATE(CLK_QSPI0, "clk_qspi0", DIV_QSPI0, 0x2a4, 0x2a5, 0, 0, 0, 0, 0),
|
||||
D_GATE(CLK_QSPI1, "clk_qspi1", DIV_QSPI1, 0x484, 0x485, 0, 0, 0, 0, 0),
|
||||
D_GATE(CLK_RGMII_REF, "clk_rgmii_ref", CLKOUT_D8, 0x340, 0, 0, 0, 0, 0, 0),
|
||||
|
@ -3,6 +3,7 @@
|
||||
* R-Car Gen3 Clock Pulse Generator
|
||||
*
|
||||
* Copyright (C) 2015-2018 Glider bvba
|
||||
* Copyright (C) 2019 Renesas Electronics Corp.
|
||||
*
|
||||
* Based on clk-rcar-gen3.c
|
||||
*
|
||||
@ -88,14 +89,13 @@ static void cpg_simple_notifier_register(struct raw_notifier_head *notifiers,
|
||||
#define CPG_FRQCRB 0x00000004
|
||||
#define CPG_FRQCRB_KICK BIT(31)
|
||||
#define CPG_FRQCRC 0x000000e0
|
||||
#define CPG_FRQCRC_ZFC_MASK GENMASK(12, 8)
|
||||
#define CPG_FRQCRC_Z2FC_MASK GENMASK(4, 0)
|
||||
|
||||
struct cpg_z_clk {
|
||||
struct clk_hw hw;
|
||||
void __iomem *reg;
|
||||
void __iomem *kick_reg;
|
||||
unsigned long mask;
|
||||
unsigned int fixed_div;
|
||||
};
|
||||
|
||||
#define to_z_clk(_hw) container_of(_hw, struct cpg_z_clk, hw)
|
||||
@ -110,17 +110,18 @@ static unsigned long cpg_z_clk_recalc_rate(struct clk_hw *hw,
|
||||
val = readl(zclk->reg) & zclk->mask;
|
||||
mult = 32 - (val >> __ffs(zclk->mask));
|
||||
|
||||
/* Factor of 2 is for fixed divider */
|
||||
return DIV_ROUND_CLOSEST_ULL((u64)parent_rate * mult, 32 * 2);
|
||||
return DIV_ROUND_CLOSEST_ULL((u64)parent_rate * mult,
|
||||
32 * zclk->fixed_div);
|
||||
}
|
||||
|
||||
static long cpg_z_clk_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *parent_rate)
|
||||
{
|
||||
/* Factor of 2 is for fixed divider */
|
||||
unsigned long prate = *parent_rate / 2;
|
||||
struct cpg_z_clk *zclk = to_z_clk(hw);
|
||||
unsigned long prate;
|
||||
unsigned int mult;
|
||||
|
||||
prate = *parent_rate / zclk->fixed_div;
|
||||
mult = div_u64(rate * 32ULL, prate);
|
||||
mult = clamp(mult, 1U, 32U);
|
||||
|
||||
@ -134,8 +135,8 @@ static int cpg_z_clk_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned int mult;
|
||||
unsigned int i;
|
||||
|
||||
/* Factor of 2 is for fixed divider */
|
||||
mult = DIV_ROUND_CLOSEST_ULL(rate * 32ULL * 2, parent_rate);
|
||||
mult = DIV64_U64_ROUND_CLOSEST(rate * 32ULL * zclk->fixed_div,
|
||||
parent_rate);
|
||||
mult = clamp(mult, 1U, 32U);
|
||||
|
||||
if (readl(zclk->kick_reg) & CPG_FRQCRB_KICK)
|
||||
@ -178,7 +179,8 @@ static const struct clk_ops cpg_z_clk_ops = {
|
||||
static struct clk * __init cpg_z_clk_register(const char *name,
|
||||
const char *parent_name,
|
||||
void __iomem *reg,
|
||||
unsigned long mask)
|
||||
unsigned int div,
|
||||
unsigned int offset)
|
||||
{
|
||||
struct clk_init_data init;
|
||||
struct cpg_z_clk *zclk;
|
||||
@ -197,7 +199,8 @@ static struct clk * __init cpg_z_clk_register(const char *name,
|
||||
zclk->reg = reg + CPG_FRQCRC;
|
||||
zclk->kick_reg = reg + CPG_FRQCRB;
|
||||
zclk->hw.init = &init;
|
||||
zclk->mask = mask;
|
||||
zclk->mask = GENMASK(offset + 4, offset);
|
||||
zclk->fixed_div = div; /* PLLVCO x 1/div x SYS-CPU divider */
|
||||
|
||||
clk = clk_register(NULL, &zclk->hw);
|
||||
if (IS_ERR(clk))
|
||||
@ -234,8 +237,6 @@ struct sd_clock {
|
||||
const struct sd_div_table *div_table;
|
||||
struct cpg_simple_notifier csn;
|
||||
unsigned int div_num;
|
||||
unsigned int div_min;
|
||||
unsigned int div_max;
|
||||
unsigned int cur_div_idx;
|
||||
};
|
||||
|
||||
@ -312,14 +313,20 @@ static unsigned int cpg_sd_clock_calc_div(struct sd_clock *clock,
|
||||
unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
unsigned int div;
|
||||
unsigned long calc_rate, diff, diff_min = ULONG_MAX;
|
||||
unsigned int i, best_div = 0;
|
||||
|
||||
if (!rate)
|
||||
rate = 1;
|
||||
for (i = 0; i < clock->div_num; i++) {
|
||||
calc_rate = DIV_ROUND_CLOSEST(parent_rate,
|
||||
clock->div_table[i].div);
|
||||
diff = calc_rate > rate ? calc_rate - rate : rate - calc_rate;
|
||||
if (diff < diff_min) {
|
||||
best_div = clock->div_table[i].div;
|
||||
diff_min = diff;
|
||||
}
|
||||
}
|
||||
|
||||
div = DIV_ROUND_CLOSEST(parent_rate, rate);
|
||||
|
||||
return clamp_t(unsigned int, div, clock->div_min, clock->div_max);
|
||||
return best_div;
|
||||
}
|
||||
|
||||
static long cpg_sd_clock_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
@ -369,27 +376,26 @@ static u32 cpg_quirks __initdata;
|
||||
#define RCKCR_CKSEL BIT(1) /* Manual RCLK parent selection */
|
||||
#define SD_SKIP_FIRST BIT(2) /* Skip first clock in SD table */
|
||||
|
||||
static struct clk * __init cpg_sd_clk_register(const struct cpg_core_clk *core,
|
||||
void __iomem *base, const char *parent_name,
|
||||
static struct clk * __init cpg_sd_clk_register(const char *name,
|
||||
void __iomem *base, unsigned int offset, const char *parent_name,
|
||||
struct raw_notifier_head *notifiers)
|
||||
{
|
||||
struct clk_init_data init;
|
||||
struct sd_clock *clock;
|
||||
struct clk *clk;
|
||||
unsigned int i;
|
||||
u32 val;
|
||||
|
||||
clock = kzalloc(sizeof(*clock), GFP_KERNEL);
|
||||
if (!clock)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
init.name = core->name;
|
||||
init.name = name;
|
||||
init.ops = &cpg_sd_clock_ops;
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
init.parent_names = &parent_name;
|
||||
init.num_parents = 1;
|
||||
|
||||
clock->csn.reg = base + core->offset;
|
||||
clock->csn.reg = base + offset;
|
||||
clock->hw.init = &init;
|
||||
clock->div_table = cpg_sd_div_table;
|
||||
clock->div_num = ARRAY_SIZE(cpg_sd_div_table);
|
||||
@ -403,13 +409,6 @@ static struct clk * __init cpg_sd_clk_register(const struct cpg_core_clk *core,
|
||||
val |= CPG_SD_STP_MASK | (clock->div_table[0].val & CPG_SD_FC_MASK);
|
||||
writel(val, clock->csn.reg);
|
||||
|
||||
clock->div_max = clock->div_table[0].div;
|
||||
clock->div_min = clock->div_max;
|
||||
for (i = 1; i < clock->div_num; i++) {
|
||||
clock->div_max = max(clock->div_max, clock->div_table[i].div);
|
||||
clock->div_min = min(clock->div_min, clock->div_table[i].div);
|
||||
}
|
||||
|
||||
clk = clk_register(NULL, &clock->hw);
|
||||
if (IS_ERR(clk))
|
||||
goto free_clock;
|
||||
@ -606,8 +605,8 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev,
|
||||
break;
|
||||
|
||||
case CLK_TYPE_GEN3_SD:
|
||||
return cpg_sd_clk_register(core, base, __clk_get_name(parent),
|
||||
notifiers);
|
||||
return cpg_sd_clk_register(core->name, base, core->offset,
|
||||
__clk_get_name(parent), notifiers);
|
||||
|
||||
case CLK_TYPE_GEN3_R:
|
||||
if (cpg_quirks & RCKCR_CKSEL) {
|
||||
@ -658,11 +657,7 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev,
|
||||
|
||||
case CLK_TYPE_GEN3_Z:
|
||||
return cpg_z_clk_register(core->name, __clk_get_name(parent),
|
||||
base, CPG_FRQCRC_ZFC_MASK);
|
||||
|
||||
case CLK_TYPE_GEN3_Z2:
|
||||
return cpg_z_clk_register(core->name, __clk_get_name(parent),
|
||||
base, CPG_FRQCRC_Z2FC_MASK);
|
||||
base, core->div, core->offset);
|
||||
|
||||
case CLK_TYPE_GEN3_OSC:
|
||||
/*
|
||||
|
@ -3,6 +3,7 @@
|
||||
* R-Car Gen3 Clock Pulse Generator
|
||||
*
|
||||
* Copyright (C) 2015-2018 Glider bvba
|
||||
* Copyright (C) 2018 Renesas Electronics Corp.
|
||||
*
|
||||
*/
|
||||
|
||||
@ -20,7 +21,6 @@ enum rcar_gen3_clk_types {
|
||||
CLK_TYPE_GEN3_R,
|
||||
CLK_TYPE_GEN3_MDSEL, /* Select parent/divider using mode pin */
|
||||
CLK_TYPE_GEN3_Z,
|
||||
CLK_TYPE_GEN3_Z2,
|
||||
CLK_TYPE_GEN3_OSC, /* OSC EXTAL predivider and fixed divider */
|
||||
CLK_TYPE_GEN3_RCKSEL, /* Select parent/divider using RCKCR.CKSEL */
|
||||
CLK_TYPE_GEN3_RPCSRC,
|
||||
@ -51,6 +51,9 @@ enum rcar_gen3_clk_types {
|
||||
DEF_BASE(_name, _id, CLK_TYPE_GEN3_RCKSEL, \
|
||||
(_parent0) << 16 | (_parent1), .div = (_div0) << 16 | (_div1))
|
||||
|
||||
#define DEF_GEN3_Z(_name, _id, _type, _parent, _div, _offset) \
|
||||
DEF_BASE(_name, _id, _type, _parent, .div = _div, .offset = _offset)
|
||||
|
||||
struct rcar_gen3_cpg_pll_config {
|
||||
u8 extal_div;
|
||||
u8 pll1_mult;
|
||||
|
@ -65,7 +65,6 @@
|
||||
#define IMX7ULP_CLK_FLEXBUS 2
|
||||
#define IMX7ULP_CLK_SEMA42_1 3
|
||||
#define IMX7ULP_CLK_DMA_MUX1 4
|
||||
#define IMX7ULP_CLK_SNVS 5
|
||||
#define IMX7ULP_CLK_CAAM 6
|
||||
#define IMX7ULP_CLK_LPTPM4 7
|
||||
#define IMX7ULP_CLK_LPTPM5 8
|
||||
|
422
include/dt-bindings/clock/mt8183-clk.h
Normal file
422
include/dt-bindings/clock/mt8183-clk.h
Normal file
@ -0,0 +1,422 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (c) 2018 MediaTek Inc.
|
||||
* Author: Weiyi Lu <weiyi.lu@mediatek.com>
|
||||
*/
|
||||
|
||||
#ifndef _DT_BINDINGS_CLK_MT8183_H
|
||||
#define _DT_BINDINGS_CLK_MT8183_H
|
||||
|
||||
/* APMIXED */
|
||||
#define CLK_APMIXED_ARMPLL_LL 0
|
||||
#define CLK_APMIXED_ARMPLL_L 1
|
||||
#define CLK_APMIXED_CCIPLL 2
|
||||
#define CLK_APMIXED_MAINPLL 3
|
||||
#define CLK_APMIXED_UNIV2PLL 4
|
||||
#define CLK_APMIXED_MSDCPLL 5
|
||||
#define CLK_APMIXED_MMPLL 6
|
||||
#define CLK_APMIXED_MFGPLL 7
|
||||
#define CLK_APMIXED_TVDPLL 8
|
||||
#define CLK_APMIXED_APLL1 9
|
||||
#define CLK_APMIXED_APLL2 10
|
||||
#define CLK_APMIXED_SSUSB_26M 11
|
||||
#define CLK_APMIXED_APPLL_26M 12
|
||||
#define CLK_APMIXED_MIPIC0_26M 13
|
||||
#define CLK_APMIXED_MDPLLGP_26M 14
|
||||
#define CLK_APMIXED_MMSYS_26M 15
|
||||
#define CLK_APMIXED_UFS_26M 16
|
||||
#define CLK_APMIXED_MIPIC1_26M 17
|
||||
#define CLK_APMIXED_MEMPLL_26M 18
|
||||
#define CLK_APMIXED_CLKSQ_LVPLL_26M 19
|
||||
#define CLK_APMIXED_MIPID0_26M 20
|
||||
#define CLK_APMIXED_MIPID1_26M 21
|
||||
#define CLK_APMIXED_NR_CLK 22
|
||||
|
||||
/* TOPCKGEN */
|
||||
#define CLK_TOP_MUX_AXI 0
|
||||
#define CLK_TOP_MUX_MM 1
|
||||
#define CLK_TOP_MUX_CAM 2
|
||||
#define CLK_TOP_MUX_MFG 3
|
||||
#define CLK_TOP_MUX_CAMTG 4
|
||||
#define CLK_TOP_MUX_UART 5
|
||||
#define CLK_TOP_MUX_SPI 6
|
||||
#define CLK_TOP_MUX_MSDC50_0_HCLK 7
|
||||
#define CLK_TOP_MUX_MSDC50_0 8
|
||||
#define CLK_TOP_MUX_MSDC30_1 9
|
||||
#define CLK_TOP_MUX_MSDC30_2 10
|
||||
#define CLK_TOP_MUX_AUDIO 11
|
||||
#define CLK_TOP_MUX_AUD_INTBUS 12
|
||||
#define CLK_TOP_MUX_FPWRAP_ULPOSC 13
|
||||
#define CLK_TOP_MUX_SCP 14
|
||||
#define CLK_TOP_MUX_ATB 15
|
||||
#define CLK_TOP_MUX_SSPM 16
|
||||
#define CLK_TOP_MUX_DPI0 17
|
||||
#define CLK_TOP_MUX_SCAM 18
|
||||
#define CLK_TOP_MUX_AUD_1 19
|
||||
#define CLK_TOP_MUX_AUD_2 20
|
||||
#define CLK_TOP_MUX_DISP_PWM 21
|
||||
#define CLK_TOP_MUX_SSUSB_TOP_XHCI 22
|
||||
#define CLK_TOP_MUX_USB_TOP 23
|
||||
#define CLK_TOP_MUX_SPM 24
|
||||
#define CLK_TOP_MUX_I2C 25
|
||||
#define CLK_TOP_MUX_F52M_MFG 26
|
||||
#define CLK_TOP_MUX_SENINF 27
|
||||
#define CLK_TOP_MUX_DXCC 28
|
||||
#define CLK_TOP_MUX_CAMTG2 29
|
||||
#define CLK_TOP_MUX_AUD_ENG1 30
|
||||
#define CLK_TOP_MUX_AUD_ENG2 31
|
||||
#define CLK_TOP_MUX_FAES_UFSFDE 32
|
||||
#define CLK_TOP_MUX_FUFS 33
|
||||
#define CLK_TOP_MUX_IMG 34
|
||||
#define CLK_TOP_MUX_DSP 35
|
||||
#define CLK_TOP_MUX_DSP1 36
|
||||
#define CLK_TOP_MUX_DSP2 37
|
||||
#define CLK_TOP_MUX_IPU_IF 38
|
||||
#define CLK_TOP_MUX_CAMTG3 39
|
||||
#define CLK_TOP_MUX_CAMTG4 40
|
||||
#define CLK_TOP_MUX_PMICSPI 41
|
||||
#define CLK_TOP_SYSPLL_CK 42
|
||||
#define CLK_TOP_SYSPLL_D2 43
|
||||
#define CLK_TOP_SYSPLL_D3 44
|
||||
#define CLK_TOP_SYSPLL_D5 45
|
||||
#define CLK_TOP_SYSPLL_D7 46
|
||||
#define CLK_TOP_SYSPLL_D2_D2 47
|
||||
#define CLK_TOP_SYSPLL_D2_D4 48
|
||||
#define CLK_TOP_SYSPLL_D2_D8 49
|
||||
#define CLK_TOP_SYSPLL_D2_D16 50
|
||||
#define CLK_TOP_SYSPLL_D3_D2 51
|
||||
#define CLK_TOP_SYSPLL_D3_D4 52
|
||||
#define CLK_TOP_SYSPLL_D3_D8 53
|
||||
#define CLK_TOP_SYSPLL_D5_D2 54
|
||||
#define CLK_TOP_SYSPLL_D5_D4 55
|
||||
#define CLK_TOP_SYSPLL_D7_D2 56
|
||||
#define CLK_TOP_SYSPLL_D7_D4 57
|
||||
#define CLK_TOP_UNIVPLL_CK 58
|
||||
#define CLK_TOP_UNIVPLL_D2 59
|
||||
#define CLK_TOP_UNIVPLL_D3 60
|
||||
#define CLK_TOP_UNIVPLL_D5 61
|
||||
#define CLK_TOP_UNIVPLL_D7 62
|
||||
#define CLK_TOP_UNIVPLL_D2_D2 63
|
||||
#define CLK_TOP_UNIVPLL_D2_D4 64
|
||||
#define CLK_TOP_UNIVPLL_D2_D8 65
|
||||
#define CLK_TOP_UNIVPLL_D3_D2 66
|
||||
#define CLK_TOP_UNIVPLL_D3_D4 67
|
||||
#define CLK_TOP_UNIVPLL_D3_D8 68
|
||||
#define CLK_TOP_UNIVPLL_D5_D2 69
|
||||
#define CLK_TOP_UNIVPLL_D5_D4 70
|
||||
#define CLK_TOP_UNIVPLL_D5_D8 71
|
||||
#define CLK_TOP_APLL1_CK 72
|
||||
#define CLK_TOP_APLL1_D2 73
|
||||
#define CLK_TOP_APLL1_D4 74
|
||||
#define CLK_TOP_APLL1_D8 75
|
||||
#define CLK_TOP_APLL2_CK 76
|
||||
#define CLK_TOP_APLL2_D2 77
|
||||
#define CLK_TOP_APLL2_D4 78
|
||||
#define CLK_TOP_APLL2_D8 79
|
||||
#define CLK_TOP_TVDPLL_CK 80
|
||||
#define CLK_TOP_TVDPLL_D2 81
|
||||
#define CLK_TOP_TVDPLL_D4 82
|
||||
#define CLK_TOP_TVDPLL_D8 83
|
||||
#define CLK_TOP_TVDPLL_D16 84
|
||||
#define CLK_TOP_MSDCPLL_CK 85
|
||||
#define CLK_TOP_MSDCPLL_D2 86
|
||||
#define CLK_TOP_MSDCPLL_D4 87
|
||||
#define CLK_TOP_MSDCPLL_D8 88
|
||||
#define CLK_TOP_MSDCPLL_D16 89
|
||||
#define CLK_TOP_AD_OSC_CK 90
|
||||
#define CLK_TOP_OSC_D2 91
|
||||
#define CLK_TOP_OSC_D4 92
|
||||
#define CLK_TOP_OSC_D8 93
|
||||
#define CLK_TOP_OSC_D16 94
|
||||
#define CLK_TOP_F26M_CK_D2 95
|
||||
#define CLK_TOP_MFGPLL_CK 96
|
||||
#define CLK_TOP_UNIVP_192M_CK 97
|
||||
#define CLK_TOP_UNIVP_192M_D2 98
|
||||
#define CLK_TOP_UNIVP_192M_D4 99
|
||||
#define CLK_TOP_UNIVP_192M_D8 100
|
||||
#define CLK_TOP_UNIVP_192M_D16 101
|
||||
#define CLK_TOP_UNIVP_192M_D32 102
|
||||
#define CLK_TOP_MMPLL_CK 103
|
||||
#define CLK_TOP_MMPLL_D4 104
|
||||
#define CLK_TOP_MMPLL_D4_D2 105
|
||||
#define CLK_TOP_MMPLL_D4_D4 106
|
||||
#define CLK_TOP_MMPLL_D5 107
|
||||
#define CLK_TOP_MMPLL_D5_D2 108
|
||||
#define CLK_TOP_MMPLL_D5_D4 109
|
||||
#define CLK_TOP_MMPLL_D6 110
|
||||
#define CLK_TOP_MMPLL_D7 111
|
||||
#define CLK_TOP_CLK26M 112
|
||||
#define CLK_TOP_CLK13M 113
|
||||
#define CLK_TOP_ULPOSC 114
|
||||
#define CLK_TOP_UNIVP_192M 115
|
||||
#define CLK_TOP_MUX_APLL_I2S0 116
|
||||
#define CLK_TOP_MUX_APLL_I2S1 117
|
||||
#define CLK_TOP_MUX_APLL_I2S2 118
|
||||
#define CLK_TOP_MUX_APLL_I2S3 119
|
||||
#define CLK_TOP_MUX_APLL_I2S4 120
|
||||
#define CLK_TOP_MUX_APLL_I2S5 121
|
||||
#define CLK_TOP_APLL12_DIV0 122
|
||||
#define CLK_TOP_APLL12_DIV1 123
|
||||
#define CLK_TOP_APLL12_DIV2 124
|
||||
#define CLK_TOP_APLL12_DIV3 125
|
||||
#define CLK_TOP_APLL12_DIV4 126
|
||||
#define CLK_TOP_APLL12_DIVB 127
|
||||
#define CLK_TOP_UNIVPLL 128
|
||||
#define CLK_TOP_ARMPLL_DIV_PLL1 129
|
||||
#define CLK_TOP_ARMPLL_DIV_PLL2 130
|
||||
#define CLK_TOP_UNIVPLL_D3_D16 131
|
||||
#define CLK_TOP_NR_CLK 132
|
||||
|
||||
/* CAMSYS */
|
||||
#define CLK_CAM_LARB6 0
|
||||
#define CLK_CAM_DFP_VAD 1
|
||||
#define CLK_CAM_CAM 2
|
||||
#define CLK_CAM_CAMTG 3
|
||||
#define CLK_CAM_SENINF 4
|
||||
#define CLK_CAM_CAMSV0 5
|
||||
#define CLK_CAM_CAMSV1 6
|
||||
#define CLK_CAM_CAMSV2 7
|
||||
#define CLK_CAM_CCU 8
|
||||
#define CLK_CAM_LARB3 9
|
||||
#define CLK_CAM_NR_CLK 10
|
||||
|
||||
/* INFRACFG_AO */
|
||||
#define CLK_INFRA_PMIC_TMR 0
|
||||
#define CLK_INFRA_PMIC_AP 1
|
||||
#define CLK_INFRA_PMIC_MD 2
|
||||
#define CLK_INFRA_PMIC_CONN 3
|
||||
#define CLK_INFRA_SCPSYS 4
|
||||
#define CLK_INFRA_SEJ 5
|
||||
#define CLK_INFRA_APXGPT 6
|
||||
#define CLK_INFRA_ICUSB 7
|
||||
#define CLK_INFRA_GCE 8
|
||||
#define CLK_INFRA_THERM 9
|
||||
#define CLK_INFRA_I2C0 10
|
||||
#define CLK_INFRA_I2C1 11
|
||||
#define CLK_INFRA_I2C2 12
|
||||
#define CLK_INFRA_I2C3 13
|
||||
#define CLK_INFRA_PWM_HCLK 14
|
||||
#define CLK_INFRA_PWM1 15
|
||||
#define CLK_INFRA_PWM2 16
|
||||
#define CLK_INFRA_PWM3 17
|
||||
#define CLK_INFRA_PWM4 18
|
||||
#define CLK_INFRA_PWM 19
|
||||
#define CLK_INFRA_UART0 20
|
||||
#define CLK_INFRA_UART1 21
|
||||
#define CLK_INFRA_UART2 22
|
||||
#define CLK_INFRA_UART3 23
|
||||
#define CLK_INFRA_GCE_26M 24
|
||||
#define CLK_INFRA_CQ_DMA_FPC 25
|
||||
#define CLK_INFRA_BTIF 26
|
||||
#define CLK_INFRA_SPI0 27
|
||||
#define CLK_INFRA_MSDC0 28
|
||||
#define CLK_INFRA_MSDC1 29
|
||||
#define CLK_INFRA_MSDC2 30
|
||||
#define CLK_INFRA_MSDC0_SCK 31
|
||||
#define CLK_INFRA_DVFSRC 32
|
||||
#define CLK_INFRA_GCPU 33
|
||||
#define CLK_INFRA_TRNG 34
|
||||
#define CLK_INFRA_AUXADC 35
|
||||
#define CLK_INFRA_CPUM 36
|
||||
#define CLK_INFRA_CCIF1_AP 37
|
||||
#define CLK_INFRA_CCIF1_MD 38
|
||||
#define CLK_INFRA_AUXADC_MD 39
|
||||
#define CLK_INFRA_MSDC1_SCK 40
|
||||
#define CLK_INFRA_MSDC2_SCK 41
|
||||
#define CLK_INFRA_AP_DMA 42
|
||||
#define CLK_INFRA_XIU 43
|
||||
#define CLK_INFRA_DEVICE_APC 44
|
||||
#define CLK_INFRA_CCIF_AP 45
|
||||
#define CLK_INFRA_DEBUGSYS 46
|
||||
#define CLK_INFRA_AUDIO 47
|
||||
#define CLK_INFRA_CCIF_MD 48
|
||||
#define CLK_INFRA_DXCC_SEC_CORE 49
|
||||
#define CLK_INFRA_DXCC_AO 50
|
||||
#define CLK_INFRA_DRAMC_F26M 51
|
||||
#define CLK_INFRA_IRTX 52
|
||||
#define CLK_INFRA_DISP_PWM 53
|
||||
#define CLK_INFRA_CLDMA_BCLK 54
|
||||
#define CLK_INFRA_AUDIO_26M_BCLK 55
|
||||
#define CLK_INFRA_SPI1 56
|
||||
#define CLK_INFRA_I2C4 57
|
||||
#define CLK_INFRA_MODEM_TEMP_SHARE 58
|
||||
#define CLK_INFRA_SPI2 59
|
||||
#define CLK_INFRA_SPI3 60
|
||||
#define CLK_INFRA_UNIPRO_SCK 61
|
||||
#define CLK_INFRA_UNIPRO_TICK 62
|
||||
#define CLK_INFRA_UFS_MP_SAP_BCLK 63
|
||||
#define CLK_INFRA_MD32_BCLK 64
|
||||
#define CLK_INFRA_SSPM 65
|
||||
#define CLK_INFRA_UNIPRO_MBIST 66
|
||||
#define CLK_INFRA_SSPM_BUS_HCLK 67
|
||||
#define CLK_INFRA_I2C5 68
|
||||
#define CLK_INFRA_I2C5_ARBITER 69
|
||||
#define CLK_INFRA_I2C5_IMM 70
|
||||
#define CLK_INFRA_I2C1_ARBITER 71
|
||||
#define CLK_INFRA_I2C1_IMM 72
|
||||
#define CLK_INFRA_I2C2_ARBITER 73
|
||||
#define CLK_INFRA_I2C2_IMM 74
|
||||
#define CLK_INFRA_SPI4 75
|
||||
#define CLK_INFRA_SPI5 76
|
||||
#define CLK_INFRA_CQ_DMA 77
|
||||
#define CLK_INFRA_UFS 78
|
||||
#define CLK_INFRA_AES_UFSFDE 79
|
||||
#define CLK_INFRA_UFS_TICK 80
|
||||
#define CLK_INFRA_MSDC0_SELF 81
|
||||
#define CLK_INFRA_MSDC1_SELF 82
|
||||
#define CLK_INFRA_MSDC2_SELF 83
|
||||
#define CLK_INFRA_SSPM_26M_SELF 84
|
||||
#define CLK_INFRA_SSPM_32K_SELF 85
|
||||
#define CLK_INFRA_UFS_AXI 86
|
||||
#define CLK_INFRA_I2C6 87
|
||||
#define CLK_INFRA_AP_MSDC0 88
|
||||
#define CLK_INFRA_MD_MSDC0 89
|
||||
#define CLK_INFRA_USB 90
|
||||
#define CLK_INFRA_DEVMPU_BCLK 91
|
||||
#define CLK_INFRA_CCIF2_AP 92
|
||||
#define CLK_INFRA_CCIF2_MD 93
|
||||
#define CLK_INFRA_CCIF3_AP 94
|
||||
#define CLK_INFRA_CCIF3_MD 95
|
||||
#define CLK_INFRA_SEJ_F13M 96
|
||||
#define CLK_INFRA_AES_BCLK 97
|
||||
#define CLK_INFRA_I2C7 98
|
||||
#define CLK_INFRA_I2C8 99
|
||||
#define CLK_INFRA_FBIST2FPC 100
|
||||
#define CLK_INFRA_NR_CLK 101
|
||||
|
||||
/* MFGCFG */
|
||||
#define CLK_MFG_BG3D 0
|
||||
#define CLK_MFG_NR_CLK 1
|
||||
|
||||
/* IMG */
|
||||
#define CLK_IMG_OWE 0
|
||||
#define CLK_IMG_WPE_B 1
|
||||
#define CLK_IMG_WPE_A 2
|
||||
#define CLK_IMG_MFB 3
|
||||
#define CLK_IMG_RSC 4
|
||||
#define CLK_IMG_DPE 5
|
||||
#define CLK_IMG_FDVT 6
|
||||
#define CLK_IMG_DIP 7
|
||||
#define CLK_IMG_LARB2 8
|
||||
#define CLK_IMG_LARB5 9
|
||||
#define CLK_IMG_NR_CLK 10
|
||||
|
||||
/* MMSYS_CONFIG */
|
||||
#define CLK_MM_SMI_COMMON 0
|
||||
#define CLK_MM_SMI_LARB0 1
|
||||
#define CLK_MM_SMI_LARB1 2
|
||||
#define CLK_MM_GALS_COMM0 3
|
||||
#define CLK_MM_GALS_COMM1 4
|
||||
#define CLK_MM_GALS_CCU2MM 5
|
||||
#define CLK_MM_GALS_IPU12MM 6
|
||||
#define CLK_MM_GALS_IMG2MM 7
|
||||
#define CLK_MM_GALS_CAM2MM 8
|
||||
#define CLK_MM_GALS_IPU2MM 9
|
||||
#define CLK_MM_MDP_DL_TXCK 10
|
||||
#define CLK_MM_IPU_DL_TXCK 11
|
||||
#define CLK_MM_MDP_RDMA0 12
|
||||
#define CLK_MM_MDP_RDMA1 13
|
||||
#define CLK_MM_MDP_RSZ0 14
|
||||
#define CLK_MM_MDP_RSZ1 15
|
||||
#define CLK_MM_MDP_TDSHP 16
|
||||
#define CLK_MM_MDP_WROT0 17
|
||||
#define CLK_MM_FAKE_ENG 18
|
||||
#define CLK_MM_DISP_OVL0 19
|
||||
#define CLK_MM_DISP_OVL0_2L 20
|
||||
#define CLK_MM_DISP_OVL1_2L 21
|
||||
#define CLK_MM_DISP_RDMA0 22
|
||||
#define CLK_MM_DISP_RDMA1 23
|
||||
#define CLK_MM_DISP_WDMA0 24
|
||||
#define CLK_MM_DISP_COLOR0 25
|
||||
#define CLK_MM_DISP_CCORR0 26
|
||||
#define CLK_MM_DISP_AAL0 27
|
||||
#define CLK_MM_DISP_GAMMA0 28
|
||||
#define CLK_MM_DISP_DITHER0 29
|
||||
#define CLK_MM_DISP_SPLIT 30
|
||||
#define CLK_MM_DSI0_MM 31
|
||||
#define CLK_MM_DSI0_IF 32
|
||||
#define CLK_MM_DPI_MM 33
|
||||
#define CLK_MM_DPI_IF 34
|
||||
#define CLK_MM_FAKE_ENG2 35
|
||||
#define CLK_MM_MDP_DL_RX 36
|
||||
#define CLK_MM_IPU_DL_RX 37
|
||||
#define CLK_MM_26M 38
|
||||
#define CLK_MM_MMSYS_R2Y 39
|
||||
#define CLK_MM_DISP_RSZ 40
|
||||
#define CLK_MM_MDP_WDMA0 41
|
||||
#define CLK_MM_MDP_AAL 42
|
||||
#define CLK_MM_MDP_CCORR 43
|
||||
#define CLK_MM_DBI_MM 44
|
||||
#define CLK_MM_DBI_IF 45
|
||||
#define CLK_MM_NR_CLK 46
|
||||
|
||||
/* VDEC_GCON */
|
||||
#define CLK_VDEC_VDEC 0
|
||||
#define CLK_VDEC_LARB1 1
|
||||
#define CLK_VDEC_NR_CLK 2
|
||||
|
||||
/* VENC_GCON */
|
||||
#define CLK_VENC_LARB 0
|
||||
#define CLK_VENC_VENC 1
|
||||
#define CLK_VENC_JPGENC 2
|
||||
#define CLK_VENC_NR_CLK 3
|
||||
|
||||
/* AUDIO */
|
||||
#define CLK_AUDIO_TML 0
|
||||
#define CLK_AUDIO_DAC_PREDIS 1
|
||||
#define CLK_AUDIO_DAC 2
|
||||
#define CLK_AUDIO_ADC 3
|
||||
#define CLK_AUDIO_APLL_TUNER 4
|
||||
#define CLK_AUDIO_APLL2_TUNER 5
|
||||
#define CLK_AUDIO_24M 6
|
||||
#define CLK_AUDIO_22M 7
|
||||
#define CLK_AUDIO_AFE 8
|
||||
#define CLK_AUDIO_I2S4 9
|
||||
#define CLK_AUDIO_I2S3 10
|
||||
#define CLK_AUDIO_I2S2 11
|
||||
#define CLK_AUDIO_I2S1 12
|
||||
#define CLK_AUDIO_PDN_ADDA6_ADC 13
|
||||
#define CLK_AUDIO_TDM 14
|
||||
#define CLK_AUDIO_NR_CLK 15
|
||||
|
||||
/* IPU_CONN */
|
||||
#define CLK_IPU_CONN_IPU 0
|
||||
#define CLK_IPU_CONN_AHB 1
|
||||
#define CLK_IPU_CONN_AXI 2
|
||||
#define CLK_IPU_CONN_ISP 3
|
||||
#define CLK_IPU_CONN_CAM_ADL 4
|
||||
#define CLK_IPU_CONN_IMG_ADL 5
|
||||
#define CLK_IPU_CONN_DAP_RX 6
|
||||
#define CLK_IPU_CONN_APB2AXI 7
|
||||
#define CLK_IPU_CONN_APB2AHB 8
|
||||
#define CLK_IPU_CONN_IPU_CAB1TO2 9
|
||||
#define CLK_IPU_CONN_IPU1_CAB1TO2 10
|
||||
#define CLK_IPU_CONN_IPU2_CAB1TO2 11
|
||||
#define CLK_IPU_CONN_CAB3TO3 12
|
||||
#define CLK_IPU_CONN_CAB2TO1 13
|
||||
#define CLK_IPU_CONN_CAB3TO1_SLICE 14
|
||||
#define CLK_IPU_CONN_NR_CLK 15
|
||||
|
||||
/* IPU_ADL */
|
||||
#define CLK_IPU_ADL_CABGEN 0
|
||||
#define CLK_IPU_ADL_NR_CLK 1
|
||||
|
||||
/* IPU_CORE0 */
|
||||
#define CLK_IPU_CORE0_JTAG 0
|
||||
#define CLK_IPU_CORE0_AXI 1
|
||||
#define CLK_IPU_CORE0_IPU 2
|
||||
#define CLK_IPU_CORE0_NR_CLK 3
|
||||
|
||||
/* IPU_CORE1 */
|
||||
#define CLK_IPU_CORE1_JTAG 0
|
||||
#define CLK_IPU_CORE1_AXI 1
|
||||
#define CLK_IPU_CORE1_IPU 2
|
||||
#define CLK_IPU_CORE1_NR_CLK 3
|
||||
|
||||
/* MCUCFG */
|
||||
#define CLK_MCU_MP0_SEL 0
|
||||
#define CLK_MCU_MP2_SEL 1
|
||||
#define CLK_MCU_BUS_SEL 2
|
||||
#define CLK_MCU_NR_CLK 3
|
||||
|
||||
#endif /* _DT_BINDINGS_CLK_MT8183_H */
|
211
include/dt-bindings/clock/mt8516-clk.h
Normal file
211
include/dt-bindings/clock/mt8516-clk.h
Normal file
@ -0,0 +1,211 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (c) 2019 MediaTek Inc.
|
||||
* Copyright (c) 2019 BayLibre, SAS.
|
||||
* Author: James Liao <jamesjj.liao@mediatek.com>
|
||||
*/
|
||||
|
||||
#ifndef _DT_BINDINGS_CLK_MT8516_H
|
||||
#define _DT_BINDINGS_CLK_MT8516_H
|
||||
|
||||
/* APMIXEDSYS */
|
||||
|
||||
#define CLK_APMIXED_ARMPLL 0
|
||||
#define CLK_APMIXED_MAINPLL 1
|
||||
#define CLK_APMIXED_UNIVPLL 2
|
||||
#define CLK_APMIXED_MMPLL 3
|
||||
#define CLK_APMIXED_APLL1 4
|
||||
#define CLK_APMIXED_APLL2 5
|
||||
#define CLK_APMIXED_NR_CLK 6
|
||||
|
||||
/* INFRACFG */
|
||||
|
||||
#define CLK_IFR_MUX1_SEL 0
|
||||
#define CLK_IFR_ETH_25M_SEL 1
|
||||
#define CLK_IFR_I2C0_SEL 2
|
||||
#define CLK_IFR_I2C1_SEL 3
|
||||
#define CLK_IFR_I2C2_SEL 4
|
||||
#define CLK_IFR_NR_CLK 5
|
||||
|
||||
/* TOPCKGEN */
|
||||
|
||||
#define CLK_TOP_CLK_NULL 0
|
||||
#define CLK_TOP_I2S_INFRA_BCK 1
|
||||
#define CLK_TOP_MEMPLL 2
|
||||
#define CLK_TOP_DMPLL 3
|
||||
#define CLK_TOP_MAINPLL_D2 4
|
||||
#define CLK_TOP_MAINPLL_D4 5
|
||||
#define CLK_TOP_MAINPLL_D8 6
|
||||
#define CLK_TOP_MAINPLL_D16 7
|
||||
#define CLK_TOP_MAINPLL_D11 8
|
||||
#define CLK_TOP_MAINPLL_D22 9
|
||||
#define CLK_TOP_MAINPLL_D3 10
|
||||
#define CLK_TOP_MAINPLL_D6 11
|
||||
#define CLK_TOP_MAINPLL_D12 12
|
||||
#define CLK_TOP_MAINPLL_D5 13
|
||||
#define CLK_TOP_MAINPLL_D10 14
|
||||
#define CLK_TOP_MAINPLL_D20 15
|
||||
#define CLK_TOP_MAINPLL_D40 16
|
||||
#define CLK_TOP_MAINPLL_D7 17
|
||||
#define CLK_TOP_MAINPLL_D14 18
|
||||
#define CLK_TOP_UNIVPLL_D2 19
|
||||
#define CLK_TOP_UNIVPLL_D4 20
|
||||
#define CLK_TOP_UNIVPLL_D8 21
|
||||
#define CLK_TOP_UNIVPLL_D16 22
|
||||
#define CLK_TOP_UNIVPLL_D3 23
|
||||
#define CLK_TOP_UNIVPLL_D6 24
|
||||
#define CLK_TOP_UNIVPLL_D12 25
|
||||
#define CLK_TOP_UNIVPLL_D24 26
|
||||
#define CLK_TOP_UNIVPLL_D5 27
|
||||
#define CLK_TOP_UNIVPLL_D20 28
|
||||
#define CLK_TOP_MMPLL380M 29
|
||||
#define CLK_TOP_MMPLL_D2 30
|
||||
#define CLK_TOP_MMPLL_200M 31
|
||||
#define CLK_TOP_USB_PHY48M 32
|
||||
#define CLK_TOP_APLL1 33
|
||||
#define CLK_TOP_APLL1_D2 34
|
||||
#define CLK_TOP_APLL1_D4 35
|
||||
#define CLK_TOP_APLL1_D8 36
|
||||
#define CLK_TOP_APLL2 37
|
||||
#define CLK_TOP_APLL2_D2 38
|
||||
#define CLK_TOP_APLL2_D4 39
|
||||
#define CLK_TOP_APLL2_D8 40
|
||||
#define CLK_TOP_CLK26M 41
|
||||
#define CLK_TOP_CLK26M_D2 42
|
||||
#define CLK_TOP_AHB_INFRA_D2 43
|
||||
#define CLK_TOP_NFI1X 44
|
||||
#define CLK_TOP_ETH_D2 45
|
||||
#define CLK_TOP_THEM 46
|
||||
#define CLK_TOP_APDMA 47
|
||||
#define CLK_TOP_I2C0 48
|
||||
#define CLK_TOP_I2C1 49
|
||||
#define CLK_TOP_AUXADC1 50
|
||||
#define CLK_TOP_NFI 51
|
||||
#define CLK_TOP_NFIECC 52
|
||||
#define CLK_TOP_DEBUGSYS 53
|
||||
#define CLK_TOP_PWM 54
|
||||
#define CLK_TOP_UART0 55
|
||||
#define CLK_TOP_UART1 56
|
||||
#define CLK_TOP_BTIF 57
|
||||
#define CLK_TOP_USB 58
|
||||
#define CLK_TOP_FLASHIF_26M 59
|
||||
#define CLK_TOP_AUXADC2 60
|
||||
#define CLK_TOP_I2C2 61
|
||||
#define CLK_TOP_MSDC0 62
|
||||
#define CLK_TOP_MSDC1 63
|
||||
#define CLK_TOP_NFI2X 64
|
||||
#define CLK_TOP_PMICWRAP_AP 65
|
||||
#define CLK_TOP_SEJ 66
|
||||
#define CLK_TOP_MEMSLP_DLYER 67
|
||||
#define CLK_TOP_SPI 68
|
||||
#define CLK_TOP_APXGPT 69
|
||||
#define CLK_TOP_AUDIO 70
|
||||
#define CLK_TOP_PMICWRAP_MD 71
|
||||
#define CLK_TOP_PMICWRAP_CONN 72
|
||||
#define CLK_TOP_PMICWRAP_26M 73
|
||||
#define CLK_TOP_AUX_ADC 74
|
||||
#define CLK_TOP_AUX_TP 75
|
||||
#define CLK_TOP_MSDC2 76
|
||||
#define CLK_TOP_RBIST 77
|
||||
#define CLK_TOP_NFI_BUS 78
|
||||
#define CLK_TOP_GCE 79
|
||||
#define CLK_TOP_TRNG 80
|
||||
#define CLK_TOP_SEJ_13M 81
|
||||
#define CLK_TOP_AES 82
|
||||
#define CLK_TOP_PWM_B 83
|
||||
#define CLK_TOP_PWM1_FB 84
|
||||
#define CLK_TOP_PWM2_FB 85
|
||||
#define CLK_TOP_PWM3_FB 86
|
||||
#define CLK_TOP_PWM4_FB 87
|
||||
#define CLK_TOP_PWM5_FB 88
|
||||
#define CLK_TOP_USB_1P 89
|
||||
#define CLK_TOP_FLASHIF_FREERUN 90
|
||||
#define CLK_TOP_66M_ETH 91
|
||||
#define CLK_TOP_133M_ETH 92
|
||||
#define CLK_TOP_FETH_25M 93
|
||||
#define CLK_TOP_FETH_50M 94
|
||||
#define CLK_TOP_FLASHIF_AXI 95
|
||||
#define CLK_TOP_USBIF 96
|
||||
#define CLK_TOP_UART2 97
|
||||
#define CLK_TOP_BSI 98
|
||||
#define CLK_TOP_RG_SPINOR 99
|
||||
#define CLK_TOP_RG_MSDC2 100
|
||||
#define CLK_TOP_RG_ETH 101
|
||||
#define CLK_TOP_RG_AUD1 102
|
||||
#define CLK_TOP_RG_AUD2 103
|
||||
#define CLK_TOP_RG_AUD_ENGEN1 104
|
||||
#define CLK_TOP_RG_AUD_ENGEN2 105
|
||||
#define CLK_TOP_RG_I2C 106
|
||||
#define CLK_TOP_RG_PWM_INFRA 107
|
||||
#define CLK_TOP_RG_AUD_SPDIF_IN 108
|
||||
#define CLK_TOP_RG_UART2 109
|
||||
#define CLK_TOP_RG_BSI 110
|
||||
#define CLK_TOP_RG_DBG_ATCLK 111
|
||||
#define CLK_TOP_RG_NFIECC 112
|
||||
#define CLK_TOP_RG_APLL1_D2_EN 113
|
||||
#define CLK_TOP_RG_APLL1_D4_EN 114
|
||||
#define CLK_TOP_RG_APLL1_D8_EN 115
|
||||
#define CLK_TOP_RG_APLL2_D2_EN 116
|
||||
#define CLK_TOP_RG_APLL2_D4_EN 117
|
||||
#define CLK_TOP_RG_APLL2_D8_EN 118
|
||||
#define CLK_TOP_APLL12_DIV0 119
|
||||
#define CLK_TOP_APLL12_DIV1 120
|
||||
#define CLK_TOP_APLL12_DIV2 121
|
||||
#define CLK_TOP_APLL12_DIV3 122
|
||||
#define CLK_TOP_APLL12_DIV4 123
|
||||
#define CLK_TOP_APLL12_DIV4B 124
|
||||
#define CLK_TOP_APLL12_DIV5 125
|
||||
#define CLK_TOP_APLL12_DIV5B 126
|
||||
#define CLK_TOP_APLL12_DIV6 127
|
||||
#define CLK_TOP_UART0_SEL 128
|
||||
#define CLK_TOP_EMI_DDRPHY_SEL 129
|
||||
#define CLK_TOP_AHB_INFRA_SEL 130
|
||||
#define CLK_TOP_MSDC0_SEL 131
|
||||
#define CLK_TOP_UART1_SEL 132
|
||||
#define CLK_TOP_MSDC1_SEL 133
|
||||
#define CLK_TOP_PMICSPI_SEL 134
|
||||
#define CLK_TOP_QAXI_AUD26M_SEL 135
|
||||
#define CLK_TOP_AUD_INTBUS_SEL 136
|
||||
#define CLK_TOP_NFI2X_PAD_SEL 137
|
||||
#define CLK_TOP_NFI1X_PAD_SEL 138
|
||||
#define CLK_TOP_DDRPHYCFG_SEL 139
|
||||
#define CLK_TOP_USB_78M_SEL 140
|
||||
#define CLK_TOP_SPINOR_SEL 141
|
||||
#define CLK_TOP_MSDC2_SEL 142
|
||||
#define CLK_TOP_ETH_SEL 143
|
||||
#define CLK_TOP_AUD1_SEL 144
|
||||
#define CLK_TOP_AUD2_SEL 145
|
||||
#define CLK_TOP_AUD_ENGEN1_SEL 146
|
||||
#define CLK_TOP_AUD_ENGEN2_SEL 147
|
||||
#define CLK_TOP_I2C_SEL 148
|
||||
#define CLK_TOP_AUD_I2S0_M_SEL 149
|
||||
#define CLK_TOP_AUD_I2S1_M_SEL 150
|
||||
#define CLK_TOP_AUD_I2S2_M_SEL 151
|
||||
#define CLK_TOP_AUD_I2S3_M_SEL 152
|
||||
#define CLK_TOP_AUD_I2S4_M_SEL 153
|
||||
#define CLK_TOP_AUD_I2S5_M_SEL 154
|
||||
#define CLK_TOP_AUD_SPDIF_B_SEL 155
|
||||
#define CLK_TOP_PWM_SEL 156
|
||||
#define CLK_TOP_SPI_SEL 157
|
||||
#define CLK_TOP_AUD_SPDIFIN_SEL 158
|
||||
#define CLK_TOP_UART2_SEL 159
|
||||
#define CLK_TOP_BSI_SEL 160
|
||||
#define CLK_TOP_DBG_ATCLK_SEL 161
|
||||
#define CLK_TOP_CSW_NFIECC_SEL 162
|
||||
#define CLK_TOP_NFIECC_SEL 163
|
||||
#define CLK_TOP_APLL12_CK_DIV0 164
|
||||
#define CLK_TOP_APLL12_CK_DIV1 165
|
||||
#define CLK_TOP_APLL12_CK_DIV2 166
|
||||
#define CLK_TOP_APLL12_CK_DIV3 167
|
||||
#define CLK_TOP_APLL12_CK_DIV4 168
|
||||
#define CLK_TOP_APLL12_CK_DIV4B 169
|
||||
#define CLK_TOP_APLL12_CK_DIV5 170
|
||||
#define CLK_TOP_APLL12_CK_DIV5B 171
|
||||
#define CLK_TOP_APLL12_CK_DIV6 172
|
||||
#define CLK_TOP_USB_78M 173
|
||||
#define CLK_TOP_MSDC0_INFRA 174
|
||||
#define CLK_TOP_MSDC1_INFRA 175
|
||||
#define CLK_TOP_MSDC2_INFRA 176
|
||||
#define CLK_TOP_NR_CLK 177
|
||||
|
||||
#endif /* _DT_BINDINGS_CLK_MT8516_H */
|
@ -146,6 +146,10 @@
|
||||
#define GCC_MDP_TBU_CLK 138
|
||||
#define GCC_QDSS_DAP_CLK 139
|
||||
#define GCC_DCC_XO_CLK 140
|
||||
#define GCC_CDSP_CFG_AHB_CLK 143
|
||||
#define GCC_BIMC_CDSP_CLK 144
|
||||
#define GCC_CDSP_TBU_CLK 145
|
||||
#define GCC_CDSP_BIMC_CLK_SRC 146
|
||||
|
||||
#define GCC_GENI_IR_BCR 0
|
||||
#define GCC_USB_HS_BCR 1
|
||||
@ -161,5 +165,6 @@
|
||||
#define GCC_PCIE_0_LINK_DOWN_BCR 11
|
||||
#define GCC_PCIEPHY_0_PHY_BCR 12
|
||||
#define GCC_EMAC_BCR 13
|
||||
#define GCC_CDSP_RESTART 14
|
||||
|
||||
#endif
|
||||
|
15
include/dt-bindings/clock/qcom,turingcc-qcs404.h
Normal file
15
include/dt-bindings/clock/qcom,turingcc-qcs404.h
Normal file
@ -0,0 +1,15 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (c) 2019, Linaro Ltd
|
||||
*/
|
||||
|
||||
#ifndef _DT_BINDINGS_CLK_TURING_QCS404_H
|
||||
#define _DT_BINDINGS_CLK_TURING_QCS404_H
|
||||
|
||||
#define TURING_Q6SS_Q6_AXIM_CLK 0
|
||||
#define TURING_Q6SS_AHBM_AON_CLK 1
|
||||
#define TURING_WRAPPER_AON_CLK 2
|
||||
#define TURING_Q6SS_AHBS_AON_CLK 3
|
||||
#define TURING_WRAPPER_QOS_AHBS_AON_CLK 4
|
||||
|
||||
#endif
|
@ -284,4 +284,17 @@ static inline u64 mul_u64_u32_div(u64 a, u32 mul, u32 divisor)
|
||||
#define DIV64_U64_ROUND_UP(ll, d) \
|
||||
({ u64 _tmp = (d); div64_u64((ll) + _tmp - 1, _tmp); })
|
||||
|
||||
/**
|
||||
* DIV64_U64_ROUND_CLOSEST - unsigned 64bit divide with 64bit divisor rounded to nearest integer
|
||||
* @dividend: unsigned 64bit dividend
|
||||
* @divisor: unsigned 64bit divisor
|
||||
*
|
||||
* Divide unsigned 64bit dividend by unsigned 64bit divisor
|
||||
* and round to closest integer.
|
||||
*
|
||||
* Return: dividend / divisor rounded to nearest integer
|
||||
*/
|
||||
#define DIV64_U64_ROUND_CLOSEST(dividend, divisor) \
|
||||
({ u64 _tmp = (divisor); div64_u64((dividend) + _tmp / 2, _tmp); })
|
||||
|
||||
#endif /* _LINUX_MATH64_H */
|
||||
|
Loading…
Reference in New Issue
Block a user