The clock framework changes for 3.17 are mostly additions of new clock
drivers and fixes/enhancements to existing clock drivers. There are also some non-critical fixes and improvements to the framework core. Changes to the clock framework core include: * improvements to printks on errors * flattening the previously hierarchal structure of per-clock entries in debugfs * allow per-clock debugfs entries that are specific to a particular clock driver * configure initial clock parent and/or initial clock rate from Device Tree * several feature enhancements to the composite clock type * misc fixes New clock drivers added include: * TI Palmas PMIC * Allwinner A23 SoC * Qualcomm APQ8084 and IPQ8064 SoCs * Rockchip rk3188, rk3066 and rk3288 SoCs * STMicroelectronics STiH407 SoC * Cirrus Logic CLPS711X SoC Many fixes, feature enhancements and further clock tree support for existing clock drivers also were merged, such as Samsung's "ARMCLK down" power saving feature for their Exynos4 & Exynos5 SoCs. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) iQIcBAABAgAGBQJT38lmAAoJEDqPOy9afJhJh9YQAKROq+lrKaf+YAk22E0GCF30 Q+KZ9EcePdxWvcDPKsMIf/wAIYdtGDoI6wgyw1tcSWeLKwwyHMfVdOCExWig2gwl /4LU2tACKe+Xa0HJnsbNwQGj2n4qMGOUsDeRRmK4rcbuHZhTP15IscmFCbL+sUia z3uaYf7ty3a1tSXBl3NY4EpYAXGiE+MMVBoU08ATYOOjvGcxNNfu50JSltGXarqv BFBjpv0oikN3RvbVyuUUvEF8m6AeNYhbqxI0IuNmoE+mAkgB2n221CK4Qv6a3oDb QJebzRdeprcak8HrK76Ik6Dd9itcs03u6G1qwLc30JH5wUHYcgqA5bvqDIx+2W0J Z7NPi3tFTry1aeXnZPk7DbWruzXLQkXkgRM4xHXsmezRnO7zDvuoDgUT0pIrS9+v +BRIyfPiBL9Lp1J17R0I1K76O7YnvyQhX+0CdZx0SOJNGPl+SIwTI4q+gQoDIZqP 0ubpuaH4v6gZiEol2HXKYN9ASWyRtX7PfiexQgmts1aewlPopWfuc7LdxhHQIv3B 3O/7jbhdhXsf7VaTvx7xkFEMxjY7IwEF4pN0F+ulwWj/rLK3vLCnTwxgv8IrNHit Dkzt4kVzLW/GSWa3irTnISvsg+bHkRc7aPuW/i0km7RYUuL2dcaJLEBPYuka/AdH 1xIMaGNpkA3HrS+8CQYf =48y9 -----END PGP SIGNATURE----- Merge tag 'clk-for-linus-3.17' of git://git.linaro.org/people/mike.turquette/linux Pull clock framework updates from Mike Turquette: "The clock framework changes for 3.17 are mostly additions of new clock drivers and fixes/enhancements to existing clock drivers. There are also some non-critical fixes and improvements to the framework core. Changes to the clock framework core include: - improvements to printks on errors - flattening the previously hierarchal structure of per-clock entries in debugfs - allow per-clock debugfs entries that are specific to a particular clock driver - configure initial clock parent and/or initial clock rate from Device Tree - several feature enhancements to the composite clock type - misc fixes New clock drivers added include: - TI Palmas PMIC - Allwinner A23 SoC - Qualcomm APQ8084 and IPQ8064 SoCs - Rockchip rk3188, rk3066 and rk3288 SoCs - STMicroelectronics STiH407 SoC - Cirrus Logic CLPS711X SoC Many fixes, feature enhancements and further clock tree support for existing clock drivers also were merged, such as Samsung's "ARMCLK down" power saving feature for their Exynos4 & Exynos5 SoCs" * tag 'clk-for-linus-3.17' of git://git.linaro.org/people/mike.turquette/linux: (86 commits) clk: Add missing of_clk_set_defaults export clk: checking wrong variable in __set_clk_parents() clk: Propagate any error return from debug_init() clk: clps711x: Add DT bindings documentation clk: Add CLPS711X clk driver clk: st: Use round to closest divider flag clk: st: Update frequency tables for fs660c32 and fs432c65 clk: st: STiH407: Support for clockgenA9 clk: st: STiH407: Support for clockgenD0/D2/D3 clk: st: STiH407: Support for clockgenC0 clk: st: Add quadfs reset handling clk: st: Add polarity bit indication clk: st: STiH407: Support for clockgenA0 clk: st: STiH407: Support for A9 MUX Clocks clk: st: STiH407: Support for Flexgen Clocks clk: st: Adds Flexgen clock binding clk: st: Remove uncessary (void *) cast clk: st: use static const for clkgen_pll_data tables clk: st: use static const for stm_fs tables clk: st: Update ST clock binding documentation ...
This commit is contained in:
commit
e4ca4308c0
|
@ -12,8 +12,38 @@ Properties:
|
|||
|
||||
- reg : offset and length of the register set.
|
||||
|
||||
- #clock-cells : must be <1>, since PMU requires once cell as clock specifier.
|
||||
The single specifier cell is used as index to list of clocks
|
||||
provided by PMU, which is currently:
|
||||
0 : SoC clock output (CLKOUT pin)
|
||||
|
||||
- clock-names : list of clock names for particular CLKOUT mux inputs in
|
||||
following format:
|
||||
"clkoutN", where N is a decimal number corresponding to
|
||||
CLKOUT mux control bits value for given input, e.g.
|
||||
"clkout0", "clkout7", "clkout15".
|
||||
|
||||
- clocks : list of phandles and specifiers to all input clocks listed in
|
||||
clock-names property.
|
||||
|
||||
Example :
|
||||
pmu_system_controller: system-controller@10040000 {
|
||||
compatible = "samsung,exynos5250-pmu", "syscon";
|
||||
reg = <0x10040000 0x5000>;
|
||||
#clock-cells = <1>;
|
||||
clock-names = "clkout0", "clkout1", "clkout2", "clkout3",
|
||||
"clkout4", "clkout8", "clkout9";
|
||||
clocks = <&clock CLK_OUT_DMC>, <&clock CLK_OUT_TOP>,
|
||||
<&clock CLK_OUT_LEFTBUS>, <&clock CLK_OUT_RIGHTBUS>,
|
||||
<&clock CLK_OUT_CPU>, <&clock CLK_XXTI>,
|
||||
<&clock CLK_XUSBXTI>;
|
||||
};
|
||||
|
||||
Example of clock consumer :
|
||||
|
||||
usb3503: usb3503@08 {
|
||||
/* ... */
|
||||
clock-names = "refclk";
|
||||
clocks = <&pmu_system_controller 0>;
|
||||
/* ... */
|
||||
};
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
* Palmas 32KHz clocks *
|
||||
|
||||
Palmas device has two clock output pins for 32KHz, KG and KG_AUDIO.
|
||||
|
||||
This binding uses the common clock binding ./clock-bindings.txt.
|
||||
|
||||
Required properties:
|
||||
- compatible : "ti,palmas-clk32kg" for clk32kg clock
|
||||
"ti,palmas-clk32kgaudio" for clk32kgaudio clock
|
||||
- #clock-cells : shall be set to 0.
|
||||
|
||||
Optional property:
|
||||
- ti,external-sleep-control: The external enable input pins controlled the
|
||||
enable/disable of clocks. The external enable input pins ENABLE1,
|
||||
ENABLE2 and NSLEEP. The valid values for the external pins are:
|
||||
PALMAS_EXT_CONTROL_PIN_ENABLE1 for ENABLE1 pin
|
||||
PALMAS_EXT_CONTROL_PIN_ENABLE2 for ENABLE2 pin
|
||||
PALMAS_EXT_CONTROL_PIN_NSLEEP for NSLEEP pin
|
||||
Option 0 or missing this property means the clock is enabled/disabled
|
||||
via register access and these pins do not have any control.
|
||||
The macros of external control pins for DTS is defined at
|
||||
dt-bindings/mfd/palmas.h
|
||||
|
||||
Example:
|
||||
#include <dt-bindings/mfd/palmas.h>
|
||||
...
|
||||
palmas: tps65913@58 {
|
||||
...
|
||||
clk32kg: palmas_clk32k@0 {
|
||||
compatible = "ti,palmas-clk32kg";
|
||||
#clock-cells = <0>;
|
||||
ti,external-sleep-control = <PALMAS_EXT_CONTROL_PIN_NSLEEP>;
|
||||
};
|
||||
...
|
||||
};
|
|
@ -131,3 +131,39 @@ clock signal, and a UART.
|
|||
("pll" and "pll-switched").
|
||||
* The UART has its baud clock connected the external oscillator and its
|
||||
register clock connected to the PLL clock (the "pll-switched" signal)
|
||||
|
||||
==Assigned clock parents and rates==
|
||||
|
||||
Some platforms may require initial configuration of default parent clocks
|
||||
and clock frequencies. Such a configuration can be specified in a device tree
|
||||
node through assigned-clocks, assigned-clock-parents and assigned-clock-rates
|
||||
properties. The assigned-clock-parents property should contain a list of parent
|
||||
clocks in form of phandle and clock specifier pairs, the assigned-clock-parents
|
||||
property the list of assigned clock frequency values - corresponding to clocks
|
||||
listed in the assigned-clocks property.
|
||||
|
||||
To skip setting parent or rate of a clock its corresponding entry should be
|
||||
set to 0, or can be omitted if it is not followed by any non-zero entry.
|
||||
|
||||
uart@a000 {
|
||||
compatible = "fsl,imx-uart";
|
||||
reg = <0xa000 0x1000>;
|
||||
...
|
||||
clocks = <&osc 0>, <&pll 1>;
|
||||
clock-names = "baud", "register";
|
||||
|
||||
assigned-clocks = <&clkcon 0>, <&pll 2>;
|
||||
assigned-clock-parents = <&pll 2>;
|
||||
assigned-clock-rates = <0>, <460800>;
|
||||
};
|
||||
|
||||
In this example the <&pll 2> clock is set as parent of clock <&clkcon 0> and
|
||||
the <&pll 2> clock is assigned a frequency value of 460800 Hz.
|
||||
|
||||
Configuring a clock's parent and rate through the device node that consumes
|
||||
the clock can be done only for clocks that have a single user. Specifying
|
||||
conflicting parent or rate configuration in multiple consumer nodes for
|
||||
a shared clock is forbidden.
|
||||
|
||||
Configuration of common clocks, which affect multiple consumer devices can
|
||||
be similarly specified in the clock provider node.
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
* Clock bindings for the Cirrus Logic CLPS711X CPUs
|
||||
|
||||
Required properties:
|
||||
- compatible : Shall contain "cirrus,clps711x-clk".
|
||||
- reg : Address of the internal register set.
|
||||
- startup-frequency: Factory set CPU startup frequency in HZ.
|
||||
- #clock-cells : Should be <1>.
|
||||
|
||||
The clock consumer should specify the desired clock by having the clock
|
||||
ID in its "clocks" phandle cell. See include/dt-bindings/clock/clps711x-clock.h
|
||||
for the full list of CLPS711X clock IDs.
|
||||
|
||||
Example:
|
||||
clks: clks@80000000 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "cirrus,ep7312-clk", "cirrus,clps711x-clk";
|
||||
reg = <0x80000000 0xc000>;
|
||||
startup-frequency = <73728000>;
|
||||
};
|
|
@ -5,6 +5,8 @@ Required properties :
|
|||
- compatible : shall contain only one of the following:
|
||||
|
||||
"qcom,gcc-apq8064"
|
||||
"qcom,gcc-apq8084"
|
||||
"qcom,gcc-ipq8064"
|
||||
"qcom,gcc-msm8660"
|
||||
"qcom,gcc-msm8960"
|
||||
"qcom,gcc-msm8974"
|
||||
|
|
|
@ -4,6 +4,8 @@ Qualcomm Multimedia Clock & Reset Controller Binding
|
|||
Required properties :
|
||||
- compatible : shall contain only one of the following:
|
||||
|
||||
"qcom,mmcc-apq8064"
|
||||
"qcom,mmcc-apq8084"
|
||||
"qcom,mmcc-msm8660"
|
||||
"qcom,mmcc-msm8960"
|
||||
"qcom,mmcc-msm8974"
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
* Rockchip RK3188/RK3066 Clock and Reset Unit
|
||||
|
||||
The RK3188/RK3066 clock controller generates and supplies clock to various
|
||||
controllers within the SoC and also implements a reset controller for SoC
|
||||
peripherals.
|
||||
|
||||
Required Properties:
|
||||
|
||||
- compatible: should be "rockchip,rk3188-cru", "rockchip,rk3188a-cru" or
|
||||
"rockchip,rk3066a-cru"
|
||||
- reg: physical base address of the controller and length of memory mapped
|
||||
region.
|
||||
- #clock-cells: should be 1.
|
||||
- #reset-cells: should be 1.
|
||||
|
||||
Optional Properties:
|
||||
|
||||
- rockchip,grf: phandle to the syscon managing the "general register files"
|
||||
If missing pll rates are not changable, due to the missing pll lock status.
|
||||
|
||||
Each clock is assigned an identifier and client nodes can use this identifier
|
||||
to specify the clock which they consume. All available clocks are defined as
|
||||
preprocessor macros in the dt-bindings/clock/rk3188-cru.h and
|
||||
dt-bindings/clock/rk3066-cru.h headers and can be used in device tree sources.
|
||||
Similar macros exist for the reset sources in these files.
|
||||
|
||||
External clocks:
|
||||
|
||||
There are several clocks that are generated outside the SoC. It is expected
|
||||
that they are defined using standard clock bindings with following
|
||||
clock-output-names:
|
||||
- "xin24m" - crystal input - required,
|
||||
- "xin32k" - rtc clock - optional,
|
||||
- "xin27m" - 27mhz crystal input on rk3066 - optional,
|
||||
- "ext_hsadc" - external HSADC clock - optional,
|
||||
- "ext_cif0" - external camera clock - optional,
|
||||
- "ext_rmii" - external RMII clock - optional,
|
||||
- "ext_jtag" - externalJTAG clock - optional
|
||||
|
||||
Example: Clock controller node:
|
||||
|
||||
cru: cru@20000000 {
|
||||
compatible = "rockchip,rk3188-cru";
|
||||
reg = <0x20000000 0x1000>;
|
||||
rockchip,grf = <&grf>;
|
||||
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
};
|
||||
|
||||
Example: UART controller node that consumes the clock generated by the clock
|
||||
controller:
|
||||
|
||||
uart0: serial@10124000 {
|
||||
compatible = "snps,dw-apb-uart";
|
||||
reg = <0x10124000 0x400>;
|
||||
interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <1>;
|
||||
clocks = <&cru SCLK_UART0>;
|
||||
};
|
|
@ -0,0 +1,61 @@
|
|||
* Rockchip RK3288 Clock and Reset Unit
|
||||
|
||||
The RK3288 clock controller generates and supplies clock to various
|
||||
controllers within the SoC and also implements a reset controller for SoC
|
||||
peripherals.
|
||||
|
||||
Required Properties:
|
||||
|
||||
- compatible: should be "rockchip,rk3288-cru"
|
||||
- reg: physical base address of the controller and length of memory mapped
|
||||
region.
|
||||
- #clock-cells: should be 1.
|
||||
- #reset-cells: should be 1.
|
||||
|
||||
Optional Properties:
|
||||
|
||||
- rockchip,grf: phandle to the syscon managing the "general register files"
|
||||
If missing pll rates are not changable, due to the missing pll lock status.
|
||||
|
||||
Each clock is assigned an identifier and client nodes can use this identifier
|
||||
to specify the clock which they consume. All available clocks are defined as
|
||||
preprocessor macros in the dt-bindings/clock/rk3288-cru.h headers and can be
|
||||
used in device tree sources. Similar macros exist for the reset sources in
|
||||
these files.
|
||||
|
||||
External clocks:
|
||||
|
||||
There are several clocks that are generated outside the SoC. It is expected
|
||||
that they are defined using standard clock bindings with following
|
||||
clock-output-names:
|
||||
- "xin24m" - crystal input - required,
|
||||
- "xin32k" - rtc clock - optional,
|
||||
- "ext_i2s" - external I2S clock - optional,
|
||||
- "ext_hsadc" - external HSADC clock - optional,
|
||||
- "ext_edp_24m" - external display port clock - optional,
|
||||
- "ext_vip" - external VIP clock - optional,
|
||||
- "ext_isp" - external ISP clock - optional,
|
||||
- "ext_jtag" - external JTAG clock - optional
|
||||
|
||||
Example: Clock controller node:
|
||||
|
||||
cru: cru@20000000 {
|
||||
compatible = "rockchip,rk3188-cru";
|
||||
reg = <0x20000000 0x1000>;
|
||||
rockchip,grf = <&grf>;
|
||||
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
};
|
||||
|
||||
Example: UART controller node that consumes the clock generated by the clock
|
||||
controller:
|
||||
|
||||
uart0: serial@10124000 {
|
||||
compatible = "snps,dw-apb-uart";
|
||||
reg = <0x10124000 0x400>;
|
||||
interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <1>;
|
||||
clocks = <&cru SCLK_UART0>;
|
||||
};
|
|
@ -6,6 +6,9 @@ This binding uses the common clock binding[1].
|
|||
|
||||
== Gate clocks ==
|
||||
|
||||
These bindings are deprecated!
|
||||
Please use the soc specific CRU bindings instead.
|
||||
|
||||
The gate registers form a continuos block which makes the dt node
|
||||
structure a matter of taste, as either all gates can be put into
|
||||
one gate clock spanning all registers or they can be divided into
|
||||
|
|
|
@ -24,26 +24,26 @@ Required properties:
|
|||
|
||||
Example:
|
||||
|
||||
clockgenA@fd345000 {
|
||||
clockgen-a@fd345000 {
|
||||
reg = <0xfd345000 0xb50>;
|
||||
|
||||
CLK_M_A1_DIV1: CLK_M_A1_DIV1 {
|
||||
clk_m_a1_div1: clk-m-a1-div1 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "st,clkgena-divmux-c32-odf1",
|
||||
"st,clkgena-divmux";
|
||||
|
||||
clocks = <&CLK_M_A1_OSC_PREDIV>,
|
||||
<&CLK_M_A1_PLL0 1>, /* PLL0 PHI1 */
|
||||
<&CLK_M_A1_PLL1 1>; /* PLL1 PHI1 */
|
||||
clocks = <&clk_m_a1_osc_prediv>,
|
||||
<&clk_m_a1_pll0 1>, /* PLL0 PHI1 */
|
||||
<&clk_m_a1_pll1 1>; /* PLL1 PHI1 */
|
||||
|
||||
clock-output-names = "CLK_M_RX_ICN_TS",
|
||||
"CLK_M_RX_ICN_VDP_0",
|
||||
"", /* Unused */
|
||||
"CLK_M_PRV_T1_BUS",
|
||||
"CLK_M_ICN_REG_12",
|
||||
"CLK_M_ICN_REG_10",
|
||||
"", /* Unused */
|
||||
"CLK_M_ICN_ST231";
|
||||
clock-output-names = "clk-m-rx-icn-ts",
|
||||
"clk-m-rx-icn-vdp-0",
|
||||
"", /* unused */
|
||||
"clk-m-prv-t1-bus",
|
||||
"clk-m-icn-reg-12",
|
||||
"clk-m-icn-reg-10",
|
||||
"", /* unused */
|
||||
"clk-m-icn-st231";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ Required properties:
|
|||
"st,stih416-clkgenf-vcc-sd", "st,clkgen-mux"
|
||||
"st,stih415-clkgen-a9-mux", "st,clkgen-mux"
|
||||
"st,stih416-clkgen-a9-mux", "st,clkgen-mux"
|
||||
|
||||
"st,stih407-clkgen-a9-mux", "st,clkgen-mux"
|
||||
|
||||
- #clock-cells : from common clock binding; shall be set to 0.
|
||||
|
||||
|
@ -27,10 +27,10 @@ Required properties:
|
|||
|
||||
Example:
|
||||
|
||||
CLK_M_HVA: CLK_M_HVA {
|
||||
clk_m_hva: clk-m-hva@fd690868 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "st,stih416-clkgenf-vcc-hva", "st,clkgen-mux";
|
||||
reg = <0xfd690868 4>;
|
||||
|
||||
clocks = <&CLOCKGEN_F 1>, <&CLK_M_A1_DIV0 3>;
|
||||
clocks = <&clockgen_f 1>, <&clk_m_a1_div0 3>;
|
||||
};
|
||||
|
|
|
@ -19,11 +19,14 @@ Required properties:
|
|||
"st,stih415-plls-c32-ddr", "st,clkgen-plls-c32"
|
||||
"st,stih416-plls-c32-a9", "st,clkgen-plls-c32"
|
||||
"st,stih416-plls-c32-ddr", "st,clkgen-plls-c32"
|
||||
"st,stih407-plls-c32-a0", "st,clkgen-plls-c32"
|
||||
"st,stih407-plls-c32-a9", "st,clkgen-plls-c32"
|
||||
"st,stih407-plls-c32-c0_0", "st,clkgen-plls-c32"
|
||||
"st,stih407-plls-c32-c0_1", "st,clkgen-plls-c32"
|
||||
|
||||
"st,stih415-gpu-pll-c32", "st,clkgengpu-pll-c32"
|
||||
"st,stih416-gpu-pll-c32", "st,clkgengpu-pll-c32"
|
||||
|
||||
|
||||
- #clock-cells : From common clock binding; shall be set to 1.
|
||||
|
||||
- clocks : From common clock binding
|
||||
|
@ -32,17 +35,17 @@ Required properties:
|
|||
|
||||
Example:
|
||||
|
||||
clockgenA@fee62000 {
|
||||
clockgen-a@fee62000 {
|
||||
reg = <0xfee62000 0xb48>;
|
||||
|
||||
CLK_S_A0_PLL: CLK_S_A0_PLL {
|
||||
clk_s_a0_pll: clk-s-a0-pll {
|
||||
#clock-cells = <1>;
|
||||
compatible = "st,clkgena-plls-c65";
|
||||
|
||||
clocks = <&CLK_SYSIN>;
|
||||
clocks = <&clk_sysin>;
|
||||
|
||||
clock-output-names = "CLK_S_A0_PLL0_HS",
|
||||
"CLK_S_A0_PLL0_LS",
|
||||
"CLK_S_A0_PLL1";
|
||||
clock-output-names = "clk-s-a0-pll0-hs",
|
||||
"clk-s-a0-pll0-ls",
|
||||
"clk-s-a0-pll1";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -20,17 +20,17 @@ Required properties:
|
|||
|
||||
Example:
|
||||
|
||||
clockgenA@fd345000 {
|
||||
clockgen-a@fd345000 {
|
||||
reg = <0xfd345000 0xb50>;
|
||||
|
||||
CLK_M_A2_OSC_PREDIV: CLK_M_A2_OSC_PREDIV {
|
||||
clk_m_a2_osc_prediv: clk-m-a2-osc-prediv {
|
||||
#clock-cells = <0>;
|
||||
compatible = "st,clkgena-prediv-c32",
|
||||
"st,clkgena-prediv";
|
||||
|
||||
clocks = <&CLK_SYSIN>;
|
||||
clocks = <&clk_sysin>;
|
||||
|
||||
clock-output-names = "CLK_M_A2_OSC_PREDIV";
|
||||
clock-output-names = "clk-m-a2-osc-prediv";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -32,22 +32,30 @@ Required properties:
|
|||
|
||||
Example:
|
||||
|
||||
CLOCKGEN_C_VCC: CLOCKGEN_C_VCC {
|
||||
clockgen_c_vcc: clockgen-c-vcc@0xfe8308ac {
|
||||
#clock-cells = <1>;
|
||||
compatible = "st,stih416-clkgenc", "st,clkgen-vcc";
|
||||
reg = <0xfe8308ac 12>;
|
||||
|
||||
clocks = <&CLK_S_VCC_HD>, <&CLOCKGEN_C 1>,
|
||||
<&CLK_S_TMDS_FROMPHY>, <&CLOCKGEN_C 2>;
|
||||
clocks = <&clk_s_vcc_hd>,
|
||||
<&clockgen_c 1>,
|
||||
<&clk_s_tmds_fromphy>,
|
||||
<&clockgen_c 2>;
|
||||
|
||||
clock-output-names =
|
||||
"CLK_S_PIX_HDMI", "CLK_S_PIX_DVO",
|
||||
"CLK_S_OUT_DVO", "CLK_S_PIX_HD",
|
||||
"CLK_S_HDDAC", "CLK_S_DENC",
|
||||
"CLK_S_SDDAC", "CLK_S_PIX_MAIN",
|
||||
"CLK_S_PIX_AUX", "CLK_S_STFE_FRC_0",
|
||||
"CLK_S_REF_MCRU", "CLK_S_SLAVE_MCRU",
|
||||
"CLK_S_TMDS_HDMI", "CLK_S_HDMI_REJECT_PLL",
|
||||
"CLK_S_THSENS";
|
||||
clock-output-names = "clk-s-pix-hdmi",
|
||||
"clk-s-pix-dvo",
|
||||
"clk-s-out-dvo",
|
||||
"clk-s-pix-hd",
|
||||
"clk-s-hddac",
|
||||
"clk-s-denc",
|
||||
"clk-s-sddac",
|
||||
"clk-s-pix-main",
|
||||
"clk-s-pix-aux",
|
||||
"clk-s-stfe-frc-0",
|
||||
"clk-s-ref-mcru",
|
||||
"clk-s-slave-mcru",
|
||||
"clk-s-tmds-hdmi",
|
||||
"clk-s-hdmi-reject-pll",
|
||||
"clk-s-thsens";
|
||||
};
|
||||
|
||||
|
|
|
@ -24,60 +24,77 @@ address is common of all subnode.
|
|||
quadfs_node {
|
||||
...
|
||||
};
|
||||
|
||||
mux_node {
|
||||
...
|
||||
};
|
||||
|
||||
vcc_node {
|
||||
...
|
||||
};
|
||||
|
||||
flexgen_node {
|
||||
...
|
||||
};
|
||||
...
|
||||
};
|
||||
|
||||
This binding uses the common clock binding[1].
|
||||
Each subnode should use the binding discribe in [2]..[4]
|
||||
Each subnode should use the binding discribe in [2]..[7]
|
||||
|
||||
[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
|
||||
[2] Documentation/devicetree/bindings/clock/st,quadfs.txt
|
||||
[3] Documentation/devicetree/bindings/clock/st,quadfs.txt
|
||||
[4] Documentation/devicetree/bindings/clock/st,quadfs.txt
|
||||
[2] Documentation/devicetree/bindings/clock/st,clkgen-divmux.txt
|
||||
[3] Documentation/devicetree/bindings/clock/st,clkgen-mux.txt
|
||||
[4] Documentation/devicetree/bindings/clock/st,clkgen-pll.txt
|
||||
[5] Documentation/devicetree/bindings/clock/st,clkgen-prediv.txt
|
||||
[6] Documentation/devicetree/bindings/clock/st,vcc.txt
|
||||
[7] Documentation/devicetree/bindings/clock/st,quadfs.txt
|
||||
[8] Documentation/devicetree/bindings/clock/st,flexgen.txt
|
||||
|
||||
|
||||
Required properties:
|
||||
- reg : A Base address and length of the register set.
|
||||
|
||||
Example:
|
||||
|
||||
clockgenA@fee62000 {
|
||||
clockgen-a@fee62000 {
|
||||
|
||||
reg = <0xfee62000 0xb48>;
|
||||
|
||||
CLK_S_A0_PLL: CLK_S_A0_PLL {
|
||||
clk_s_a0_pll: clk-s-a0-pll {
|
||||
#clock-cells = <1>;
|
||||
compatible = "st,clkgena-plls-c65";
|
||||
|
||||
clocks = <&CLK_SYSIN>;
|
||||
clocks = <&clk-sysin>;
|
||||
|
||||
clock-output-names = "CLK_S_A0_PLL0_HS",
|
||||
"CLK_S_A0_PLL0_LS",
|
||||
"CLK_S_A0_PLL1";
|
||||
clock-output-names = "clk-s-a0-pll0-hs",
|
||||
"clk-s-a0-pll0-ls",
|
||||
"clk-s-a0-pll1";
|
||||
};
|
||||
|
||||
CLK_S_A0_OSC_PREDIV: CLK_S_A0_OSC_PREDIV {
|
||||
clk_s_a0_osc_prediv: clk-s-a0-osc-prediv {
|
||||
#clock-cells = <0>;
|
||||
compatible = "st,clkgena-prediv-c65",
|
||||
"st,clkgena-prediv";
|
||||
|
||||
clocks = <&CLK_SYSIN>;
|
||||
clocks = <&clk_sysin>;
|
||||
|
||||
clock-output-names = "CLK_S_A0_OSC_PREDIV";
|
||||
clock-output-names = "clk-s-a0-osc-prediv";
|
||||
};
|
||||
|
||||
CLK_S_A0_HS: CLK_S_A0_HS {
|
||||
clk_s_a0_hs: clk-s-a0-hs {
|
||||
#clock-cells = <1>;
|
||||
compatible = "st,clkgena-divmux-c65-hs",
|
||||
"st,clkgena-divmux";
|
||||
|
||||
clocks = <&CLK_S_A0_OSC_PREDIV>,
|
||||
<&CLK_S_A0_PLL 0>, /* PLL0 HS */
|
||||
<&CLK_S_A0_PLL 2>; /* PLL1 */
|
||||
clocks = <&clk-s_a0_osc_prediv>,
|
||||
<&clk-s_a0_pll 0>, /* pll0 hs */
|
||||
<&clk-s_a0_pll 2>; /* pll1 */
|
||||
|
||||
clock-output-names = "CLK_S_FDMA_0",
|
||||
"CLK_S_FDMA_1",
|
||||
""; /* CLK_S_JIT_SENSE */
|
||||
/* Fourth output unused */
|
||||
clock-output-names = "clk-s-fdma-0",
|
||||
"clk-s-fdma-1",
|
||||
""; /* clk-s-jit-sense */
|
||||
/* fourth output unused */
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
Binding for a type of flexgen structure found on certain
|
||||
STMicroelectronics consumer electronics SoC devices
|
||||
|
||||
This structure includes:
|
||||
- a clock cross bar (represented by a mux element)
|
||||
- a pre and final dividers (represented by a divider and gate elements)
|
||||
|
||||
Flexgen structure is a part of Clockgen[1].
|
||||
|
||||
Please find an example below:
|
||||
|
||||
Clockgen block diagram
|
||||
-------------------------------------------------------------------
|
||||
| Flexgen stucture |
|
||||
| --------------------------------------------- |
|
||||
| | ------- -------- -------- | |
|
||||
clk_sysin | | | | | | | | |
|
||||
---|-----------------|-->| | | | | | | |
|
||||
| | | | | | | | | | |
|
||||
| | ------- | | | |Pre | |Final | | |
|
||||
| | |PLL0 | | | | |Dividers| |Dividers| | |
|
||||
| |->| | | | | | x32 | | x32 | | |
|
||||
| | | odf_0|----|-->| | | | | | | |
|
||||
| | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | |
|
||||
| | ------- | | | | | | | | |
|
||||
| | | | | | | | | | |
|
||||
| | ------- | | Clock | | | | | | |
|
||||
| | |PLL1 | | | | | | | | | |
|
||||
| |->| | | | Cross | | | | | | |
|
||||
| | | odf_0|----|-->| | | | | | CLK_DIV[31:0]
|
||||
| | | | | | Bar |====>| |====>| |===|=========>
|
||||
| | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | |
|
||||
| | | | | | | | | | | | |
|
||||
| | ------- | | | | | | | | |
|
||||
| | | | | | | | | | |
|
||||
| | ------- | | | | | | | | |
|
||||
| | |QUADFS | | | | | | | | | |
|
||||
| |->| ch0|----|-->| | | | | | | |
|
||||
| | | | | | | | | | | |
|
||||
| | ch1|----|-->| | | | | | | |
|
||||
| | | | | | | | | | | |
|
||||
| | ch2|----|-->| | | DIV | | DIV | | |
|
||||
| | | | | | | 1 to | | 1 to | | |
|
||||
| | ch3|----|-->| | | 1024 | | 64 | | |
|
||||
| ------- | | | | | | | | |
|
||||
| | ------- -------- -------- | |
|
||||
| -------------------------------------------- |
|
||||
| |
|
||||
-------------------------------------------------------------------
|
||||
|
||||
This binding uses the common clock binding[2].
|
||||
|
||||
[1] Documentation/devicetree/bindings/clock/st/st,clkgen.txt
|
||||
[2] Documentation/devicetree/bindings/clock/clock-bindings.txt
|
||||
|
||||
Required properties:
|
||||
- compatible : shall be:
|
||||
"st,flexgen"
|
||||
|
||||
- #clock-cells : from common clock binding; shall be set to 1 (multiple clock
|
||||
outputs).
|
||||
|
||||
- clocks : must be set to the parent's phandle. it's could be output clocks of
|
||||
a quadsfs or/and a pll or/and clk_sysin (up to 7 clocks)
|
||||
|
||||
- clock-output-names : List of strings used to name the clock outputs.
|
||||
|
||||
Example:
|
||||
|
||||
clk_s_c0_flexgen: clk-s-c0-flexgen {
|
||||
|
||||
#clock-cells = <1>;
|
||||
compatible = "st,flexgen";
|
||||
|
||||
clocks = <&clk_s_c0_pll0 0>,
|
||||
<&clk_s_c0_pll1 0>,
|
||||
<&clk_s_c0_quadfs 0>,
|
||||
<&clk_s_c0_quadfs 1>,
|
||||
<&clk_s_c0_quadfs 2>,
|
||||
<&clk_s_c0_quadfs 3>,
|
||||
<&clk_sysin>;
|
||||
|
||||
clock-output-names = "clk-icn-gpu",
|
||||
"clk-fdma",
|
||||
"clk-nand",
|
||||
"clk-hva",
|
||||
"clk-proc-stfe",
|
||||
"clk-proc-tp",
|
||||
"clk-rx-icn-dmu",
|
||||
"clk-rx-icn-hva",
|
||||
"clk-icn-cpu",
|
||||
"clk-tx-icn-dmu",
|
||||
"clk-mmc-0",
|
||||
"clk-mmc-1",
|
||||
"clk-jpegdec",
|
||||
"clk-ext2fa9",
|
||||
"clk-ic-bdisp-0",
|
||||
"clk-ic-bdisp-1",
|
||||
"clk-pp-dmu",
|
||||
"clk-vid-dmu",
|
||||
"clk-dss-lpc",
|
||||
"clk-st231-aud-0",
|
||||
"clk-st231-gp-1",
|
||||
"clk-st231-dmu",
|
||||
"clk-icn-lmi",
|
||||
"clk-tx-icn-disp-1",
|
||||
"clk-icn-sbc",
|
||||
"clk-stfe-frc2",
|
||||
"clk-eth-phy",
|
||||
"clk-eth-ref-phyclk",
|
||||
"clk-flash-promip",
|
||||
"clk-main-disp",
|
||||
"clk-aux-disp",
|
||||
"clk-compo-dvp";
|
||||
};
|
|
@ -15,6 +15,9 @@ Required properties:
|
|||
"st,stih416-quadfs432", "st,quadfs"
|
||||
"st,stih416-quadfs660-E", "st,quadfs"
|
||||
"st,stih416-quadfs660-F", "st,quadfs"
|
||||
"st,stih407-quadfs660-C", "st,quadfs"
|
||||
"st,stih407-quadfs660-D", "st,quadfs"
|
||||
|
||||
|
||||
- #clock-cells : from common clock binding; shall be set to 1.
|
||||
|
||||
|
@ -32,14 +35,14 @@ Required properties:
|
|||
|
||||
Example:
|
||||
|
||||
CLOCKGEN_E: CLOCKGEN_E {
|
||||
clockgen_e: clockgen-e@fd3208bc {
|
||||
#clock-cells = <1>;
|
||||
compatible = "st,stih416-quadfs660-E", "st,quadfs";
|
||||
reg = <0xfd3208bc 0xB0>;
|
||||
|
||||
clocks = <&CLK_SYSIN>;
|
||||
clock-output-names = "CLK_M_PIX_MDTP_0",
|
||||
"CLK_M_PIX_MDTP_1",
|
||||
"CLK_M_PIX_MDTP_2",
|
||||
"CLK_M_MPELPC";
|
||||
clocks = <&clk_sysin>;
|
||||
clock-output-names = "clk-m-pix-mdtp-0",
|
||||
"clk-m-pix-mdtp-1",
|
||||
"clk-m-pix-mdtp-2",
|
||||
"clk-m-mpelpc";
|
||||
};
|
||||
|
|
|
@ -9,11 +9,13 @@ Required properties:
|
|||
"allwinner,sun4i-a10-osc-clk" - for a gatable oscillator
|
||||
"allwinner,sun4i-a10-pll1-clk" - for the main PLL clock and PLL4
|
||||
"allwinner,sun6i-a31-pll1-clk" - for the main PLL clock on A31
|
||||
"allwinner,sun8i-a23-pll1-clk" - for the main PLL clock on A23
|
||||
"allwinner,sun4i-a10-pll5-clk" - for the PLL5 clock
|
||||
"allwinner,sun4i-a10-pll6-clk" - for the PLL6 clock
|
||||
"allwinner,sun6i-a31-pll6-clk" - for the PLL6 clock on A31
|
||||
"allwinner,sun4i-a10-cpu-clk" - for the CPU multiplexer clock
|
||||
"allwinner,sun4i-a10-axi-clk" - for the AXI clock
|
||||
"allwinner,sun8i-a23-axi-clk" - for the AXI clock on A23
|
||||
"allwinner,sun4i-a10-axi-gates-clk" - for the AXI gates
|
||||
"allwinner,sun4i-a10-ahb-clk" - for the AHB clock
|
||||
"allwinner,sun4i-a10-ahb-gates-clk" - for the AHB gates on A10
|
||||
|
@ -23,13 +25,16 @@ Required properties:
|
|||
"allwinner,sun6i-a31-ar100-clk" - for the AR100 on A31
|
||||
"allwinner,sun6i-a31-ahb1-mux-clk" - for the AHB1 multiplexer on A31
|
||||
"allwinner,sun6i-a31-ahb1-gates-clk" - for the AHB1 gates on A31
|
||||
"allwinner,sun8i-a23-ahb1-gates-clk" - for the AHB1 gates on A23
|
||||
"allwinner,sun4i-a10-apb0-clk" - for the APB0 clock
|
||||
"allwinner,sun6i-a31-apb0-clk" - for the APB0 clock on A31
|
||||
"allwinner,sun8i-a23-apb0-clk" - for the APB0 clock on A23
|
||||
"allwinner,sun4i-a10-apb0-gates-clk" - for the APB0 gates on A10
|
||||
"allwinner,sun5i-a13-apb0-gates-clk" - for the APB0 gates on A13
|
||||
"allwinner,sun5i-a10s-apb0-gates-clk" - for the APB0 gates on A10s
|
||||
"allwinner,sun6i-a31-apb0-gates-clk" - for the APB0 gates on A31
|
||||
"allwinner,sun7i-a20-apb0-gates-clk" - for the APB0 gates on A20
|
||||
"allwinner,sun8i-a23-apb0-gates-clk" - for the APB0 gates on A23
|
||||
"allwinner,sun4i-a10-apb1-clk" - for the APB1 clock
|
||||
"allwinner,sun4i-a10-apb1-mux-clk" - for the APB1 clock muxing
|
||||
"allwinner,sun4i-a10-apb1-gates-clk" - for the APB1 gates on A10
|
||||
|
@ -37,8 +42,10 @@ Required properties:
|
|||
"allwinner,sun5i-a10s-apb1-gates-clk" - for the APB1 gates on A10s
|
||||
"allwinner,sun6i-a31-apb1-gates-clk" - for the APB1 gates on A31
|
||||
"allwinner,sun7i-a20-apb1-gates-clk" - for the APB1 gates on A20
|
||||
"allwinner,sun8i-a23-apb1-gates-clk" - for the APB1 gates on A23
|
||||
"allwinner,sun6i-a31-apb2-div-clk" - for the APB2 gates on A31
|
||||
"allwinner,sun6i-a31-apb2-gates-clk" - for the APB2 gates on A31
|
||||
"allwinner,sun8i-a23-apb2-gates-clk" - for the APB2 gates on A23
|
||||
"allwinner,sun4i-a10-mod0-clk" - for the module 0 family of clocks
|
||||
"allwinner,sun7i-a20-out-clk" - for the external output clocks
|
||||
"allwinner,sun7i-a20-gmac-clk" - for the GMAC clock module on A20/A31
|
||||
|
|
|
@ -9057,6 +9057,13 @@ L: linux-pm@vger.kernel.org
|
|||
S: Supported
|
||||
F: drivers/thermal/ti-soc-thermal/
|
||||
|
||||
TI CLOCK DRIVER
|
||||
M: Tero Kristo <t-kristo@ti.com>
|
||||
L: linux-omap@vger.kernel.org
|
||||
S: Maintained
|
||||
F: drivers/clk/ti/
|
||||
F: include/linux/clk/ti.h
|
||||
|
||||
TI FLASH MEDIA INTERFACE DRIVER
|
||||
M: Alex Dubov <oakad@yahoo.com>
|
||||
S: Maintained
|
||||
|
|
|
@ -31,6 +31,16 @@
|
|||
pinctrl2 = &pinctrl_2;
|
||||
};
|
||||
|
||||
pmu_system_controller: system-controller@10020000 {
|
||||
clock-names = "clkout0", "clkout1", "clkout2", "clkout3",
|
||||
"clkout4", "clkout8", "clkout9";
|
||||
clocks = <&clock CLK_OUT_DMC>, <&clock CLK_OUT_TOP>,
|
||||
<&clock CLK_OUT_LEFTBUS>, <&clock CLK_OUT_RIGHTBUS>,
|
||||
<&clock CLK_OUT_CPU>, <&clock CLK_XXTI>,
|
||||
<&clock CLK_XUSBXTI>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
sysram@02020000 {
|
||||
compatible = "mmio-sram";
|
||||
reg = <0x02020000 0x20000>;
|
||||
|
|
|
@ -139,6 +139,13 @@
|
|||
|
||||
pmu_system_controller: system-controller@10020000 {
|
||||
compatible = "samsung,exynos4212-pmu", "syscon";
|
||||
clock-names = "clkout0", "clkout1", "clkout2", "clkout3",
|
||||
"clkout4", "clkout8", "clkout9";
|
||||
clocks = <&clock CLK_OUT_DMC>, <&clock CLK_OUT_TOP>,
|
||||
<&clock CLK_OUT_LEFTBUS>, <&clock CLK_OUT_RIGHTBUS>,
|
||||
<&clock CLK_OUT_CPU>, <&clock CLK_XXTI>,
|
||||
<&clock CLK_XUSBXTI>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
g2d@10800000 {
|
||||
|
|
|
@ -191,6 +191,9 @@
|
|||
pmu_system_controller: system-controller@10040000 {
|
||||
compatible = "samsung,exynos5250-pmu", "syscon";
|
||||
reg = <0x10040000 0x5000>;
|
||||
clock-names = "clkout16";
|
||||
clocks = <&clock CLK_FIN_PLL>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
sysreg_system_controller: syscon@10050000 {
|
||||
|
|
|
@ -727,6 +727,9 @@
|
|||
pmu_system_controller: system-controller@10040000 {
|
||||
compatible = "samsung,exynos5420-pmu", "syscon";
|
||||
reg = <0x10040000 0x5000>;
|
||||
clock-names = "clkout16";
|
||||
clocks = <&clock CLK_FIN_PLL>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
sysreg_system_controller: syscon@10050000 {
|
||||
|
|
|
@ -2,6 +2,7 @@ config ARCH_ROCKCHIP
|
|||
bool "Rockchip RK2928 and RK3xxx SOCs" if ARCH_MULTI_V7
|
||||
select PINCTRL
|
||||
select PINCTRL_ROCKCHIP
|
||||
select ARCH_HAS_RESET_CONTROLLER
|
||||
select ARCH_REQUIRE_GPIOLIB
|
||||
select ARM_GIC
|
||||
select CACHE_L2X0
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <linux/pm_runtime.h>
|
||||
#include <linux/idr.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/clk/clk-conf.h>
|
||||
|
||||
#include "base.h"
|
||||
#include "power/power.h"
|
||||
|
@ -499,6 +500,10 @@ static int platform_drv_probe(struct device *_dev)
|
|||
struct platform_device *dev = to_platform_device(_dev);
|
||||
int ret;
|
||||
|
||||
ret = of_clk_set_defaults(_dev->of_node, false);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
acpi_dev_pm_attach(_dev, true);
|
||||
|
||||
ret = drv->probe(dev);
|
||||
|
|
|
@ -102,6 +102,13 @@ config COMMON_CLK_KEYSTONE
|
|||
Supports clock drivers for Keystone based SOCs. These SOCs have local
|
||||
a power sleep control module that gate the clock to the IPs and PLLs.
|
||||
|
||||
config COMMON_CLK_PALMAS
|
||||
tristate "Clock driver for TI Palmas devices"
|
||||
depends on MFD_PALMAS
|
||||
---help---
|
||||
This driver supports TI Palmas devices 32KHz output KG and KG_AUDIO
|
||||
using common clock framework.
|
||||
|
||||
source "drivers/clk/qcom/Kconfig"
|
||||
|
||||
endmenu
|
||||
|
|
|
@ -9,12 +9,16 @@ obj-$(CONFIG_COMMON_CLK) += clk-gate.o
|
|||
obj-$(CONFIG_COMMON_CLK) += clk-mux.o
|
||||
obj-$(CONFIG_COMMON_CLK) += clk-composite.o
|
||||
obj-$(CONFIG_COMMON_CLK) += clk-fractional-divider.o
|
||||
ifeq ($(CONFIG_OF), y)
|
||||
obj-$(CONFIG_COMMON_CLK) += clk-conf.o
|
||||
endif
|
||||
|
||||
# hardware specific clock types
|
||||
# please keep this section sorted lexicographically by file/directory path name
|
||||
obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o
|
||||
obj-$(CONFIG_ARCH_AXXIA) += clk-axm5516.o
|
||||
obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o
|
||||
obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o
|
||||
obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o
|
||||
obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o
|
||||
obj-$(CONFIG_MACH_LOONGSON1) += clk-ls1x.o
|
||||
|
@ -22,6 +26,7 @@ obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o
|
|||
obj-$(CONFIG_ARCH_MOXART) += clk-moxart.o
|
||||
obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o
|
||||
obj-$(CONFIG_ARCH_NSPIRE) += clk-nspire.o
|
||||
obj-$(CONFIG_COMMON_CLK_PALMAS) += clk-palmas.o
|
||||
obj-$(CONFIG_CLK_PPC_CORENET) += clk-ppc-corenet.o
|
||||
obj-$(CONFIG_COMMON_CLK_S2MPS11) += clk-s2mps11.o
|
||||
obj-$(CONFIG_COMMON_CLK_SI5351) += clk-si5351.o
|
||||
|
|
|
@ -388,6 +388,7 @@ static unsigned long clk_main_recalc_rate(struct at91_pmc *pmc,
|
|||
if (parent_rate)
|
||||
return parent_rate;
|
||||
|
||||
pr_warn("Main crystal frequency not set, using approximate value\n");
|
||||
tmp = pmc_read(pmc, AT91_CKGR_MCFR);
|
||||
if (!(tmp & AT91_PMC_MAINRDY))
|
||||
return 0;
|
||||
|
|
|
@ -0,0 +1,192 @@
|
|||
/*
|
||||
* Cirrus Logic CLPS711X CLK driver
|
||||
*
|
||||
* Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/clkdev.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mfd/syscon/clps711x.h>
|
||||
|
||||
#include <dt-bindings/clock/clps711x-clock.h>
|
||||
|
||||
#define CLPS711X_SYSCON1 (0x0100)
|
||||
#define CLPS711X_SYSCON2 (0x1100)
|
||||
#define CLPS711X_SYSFLG2 (CLPS711X_SYSCON2 + SYSFLG_OFFSET)
|
||||
#define CLPS711X_PLLR (0xa5a8)
|
||||
|
||||
#define CLPS711X_EXT_FREQ (13000000)
|
||||
#define CLPS711X_OSC_FREQ (3686400)
|
||||
|
||||
static const struct clk_div_table spi_div_table[] = {
|
||||
{ .val = 0, .div = 32, },
|
||||
{ .val = 1, .div = 8, },
|
||||
{ .val = 2, .div = 2, },
|
||||
{ .val = 3, .div = 1, },
|
||||
};
|
||||
|
||||
static const struct clk_div_table timer_div_table[] = {
|
||||
{ .val = 0, .div = 256, },
|
||||
{ .val = 1, .div = 1, },
|
||||
};
|
||||
|
||||
struct clps711x_clk {
|
||||
struct clk_onecell_data clk_data;
|
||||
spinlock_t lock;
|
||||
struct clk *clks[CLPS711X_CLK_MAX];
|
||||
};
|
||||
|
||||
static struct clps711x_clk * __init _clps711x_clk_init(void __iomem *base,
|
||||
u32 fref)
|
||||
{
|
||||
u32 tmp, f_cpu, f_pll, f_bus, f_tim, f_pwm, f_spi;
|
||||
struct clps711x_clk *clps711x_clk;
|
||||
unsigned i;
|
||||
|
||||
if (!base)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
clps711x_clk = kzalloc(sizeof(*clps711x_clk), GFP_KERNEL);
|
||||
if (!clps711x_clk)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
spin_lock_init(&clps711x_clk->lock);
|
||||
|
||||
/* Read PLL multiplier value and sanity check */
|
||||
tmp = readl(base + CLPS711X_PLLR) >> 24;
|
||||
if (((tmp >= 10) && (tmp <= 50)) || !fref)
|
||||
f_pll = DIV_ROUND_UP(CLPS711X_OSC_FREQ * tmp, 2);
|
||||
else
|
||||
f_pll = fref;
|
||||
|
||||
tmp = readl(base + CLPS711X_SYSFLG2);
|
||||
if (tmp & SYSFLG2_CKMODE) {
|
||||
f_cpu = CLPS711X_EXT_FREQ;
|
||||
f_bus = CLPS711X_EXT_FREQ;
|
||||
f_spi = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 96);
|
||||
f_pll = 0;
|
||||
f_pwm = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 128);
|
||||
} else {
|
||||
f_cpu = f_pll;
|
||||
if (f_cpu > 36864000)
|
||||
f_bus = DIV_ROUND_UP(f_cpu, 2);
|
||||
else
|
||||
f_bus = 36864000 / 2;
|
||||
f_spi = DIV_ROUND_CLOSEST(f_cpu, 576);
|
||||
f_pwm = DIV_ROUND_CLOSEST(f_cpu, 768);
|
||||
}
|
||||
|
||||
if (tmp & SYSFLG2_CKMODE) {
|
||||
if (readl(base + CLPS711X_SYSCON2) & SYSCON2_OSTB)
|
||||
f_tim = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 26);
|
||||
else
|
||||
f_tim = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 24);
|
||||
} else
|
||||
f_tim = DIV_ROUND_CLOSEST(f_cpu, 144);
|
||||
|
||||
tmp = readl(base + CLPS711X_SYSCON1);
|
||||
/* Timer1 in free running mode.
|
||||
* Counter will wrap around to 0xffff when it underflows
|
||||
* and will continue to count down.
|
||||
*/
|
||||
tmp &= ~(SYSCON1_TC1M | SYSCON1_TC1S);
|
||||
/* Timer2 in prescale mode.
|
||||
* Value writen is automatically re-loaded when
|
||||
* the counter underflows.
|
||||
*/
|
||||
tmp |= SYSCON1_TC2M | SYSCON1_TC2S;
|
||||
writel(tmp, base + CLPS711X_SYSCON1);
|
||||
|
||||
clps711x_clk->clks[CLPS711X_CLK_DUMMY] =
|
||||
clk_register_fixed_rate(NULL, "dummy", NULL, CLK_IS_ROOT, 0);
|
||||
clps711x_clk->clks[CLPS711X_CLK_CPU] =
|
||||
clk_register_fixed_rate(NULL, "cpu", NULL, CLK_IS_ROOT, f_cpu);
|
||||
clps711x_clk->clks[CLPS711X_CLK_BUS] =
|
||||
clk_register_fixed_rate(NULL, "bus", NULL, CLK_IS_ROOT, f_bus);
|
||||
clps711x_clk->clks[CLPS711X_CLK_PLL] =
|
||||
clk_register_fixed_rate(NULL, "pll", NULL, CLK_IS_ROOT, f_pll);
|
||||
clps711x_clk->clks[CLPS711X_CLK_TIMERREF] =
|
||||
clk_register_fixed_rate(NULL, "timer_ref", NULL, CLK_IS_ROOT,
|
||||
f_tim);
|
||||
clps711x_clk->clks[CLPS711X_CLK_TIMER1] =
|
||||
clk_register_divider_table(NULL, "timer1", "timer_ref", 0,
|
||||
base + CLPS711X_SYSCON1, 5, 1, 0,
|
||||
timer_div_table, &clps711x_clk->lock);
|
||||
clps711x_clk->clks[CLPS711X_CLK_TIMER2] =
|
||||
clk_register_divider_table(NULL, "timer2", "timer_ref", 0,
|
||||
base + CLPS711X_SYSCON1, 7, 1, 0,
|
||||
timer_div_table, &clps711x_clk->lock);
|
||||
clps711x_clk->clks[CLPS711X_CLK_PWM] =
|
||||
clk_register_fixed_rate(NULL, "pwm", NULL, CLK_IS_ROOT, f_pwm);
|
||||
clps711x_clk->clks[CLPS711X_CLK_SPIREF] =
|
||||
clk_register_fixed_rate(NULL, "spi_ref", NULL, CLK_IS_ROOT,
|
||||
f_spi);
|
||||
clps711x_clk->clks[CLPS711X_CLK_SPI] =
|
||||
clk_register_divider_table(NULL, "spi", "spi_ref", 0,
|
||||
base + CLPS711X_SYSCON1, 16, 2, 0,
|
||||
spi_div_table, &clps711x_clk->lock);
|
||||
clps711x_clk->clks[CLPS711X_CLK_UART] =
|
||||
clk_register_fixed_factor(NULL, "uart", "bus", 0, 1, 10);
|
||||
clps711x_clk->clks[CLPS711X_CLK_TICK] =
|
||||
clk_register_fixed_rate(NULL, "tick", NULL, CLK_IS_ROOT, 64);
|
||||
|
||||
for (i = 0; i < CLPS711X_CLK_MAX; i++)
|
||||
if (IS_ERR(clps711x_clk->clks[i]))
|
||||
pr_err("clk %i: register failed with %ld\n",
|
||||
i, PTR_ERR(clps711x_clk->clks[i]));
|
||||
|
||||
return clps711x_clk;
|
||||
}
|
||||
|
||||
void __init clps711x_clk_init(void __iomem *base)
|
||||
{
|
||||
struct clps711x_clk *clps711x_clk;
|
||||
|
||||
clps711x_clk = _clps711x_clk_init(base, 73728000);
|
||||
|
||||
BUG_ON(IS_ERR(clps711x_clk));
|
||||
|
||||
/* Clocksource */
|
||||
clk_register_clkdev(clps711x_clk->clks[CLPS711X_CLK_TIMER1],
|
||||
NULL, "clps711x-timer.0");
|
||||
clk_register_clkdev(clps711x_clk->clks[CLPS711X_CLK_TIMER2],
|
||||
NULL, "clps711x-timer.1");
|
||||
|
||||
/* Drivers */
|
||||
clk_register_clkdev(clps711x_clk->clks[CLPS711X_CLK_PWM],
|
||||
NULL, "clps711x-pwm");
|
||||
clk_register_clkdev(clps711x_clk->clks[CLPS711X_CLK_UART],
|
||||
NULL, "clps711x-uart.0");
|
||||
clk_register_clkdev(clps711x_clk->clks[CLPS711X_CLK_UART],
|
||||
NULL, "clps711x-uart.1");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
static void __init clps711x_clk_init_dt(struct device_node *np)
|
||||
{
|
||||
void __iomem *base = of_iomap(np, 0);
|
||||
struct clps711x_clk *clps711x_clk;
|
||||
u32 fref = 0;
|
||||
|
||||
WARN_ON(of_property_read_u32(np, "startup-frequency", &fref));
|
||||
|
||||
clps711x_clk = _clps711x_clk_init(base, fref);
|
||||
BUG_ON(IS_ERR(clps711x_clk));
|
||||
|
||||
clps711x_clk->clk_data.clks = clps711x_clk->clks;
|
||||
clps711x_clk->clk_data.clk_num = CLPS711X_CLK_MAX;
|
||||
of_clk_add_provider(np, of_clk_src_onecell_get,
|
||||
&clps711x_clk->clk_data);
|
||||
}
|
||||
CLK_OF_DECLARE(clps711x, "cirrus,clps711x-clk", clps711x_clk_init_dt);
|
||||
#endif
|
|
@ -64,11 +64,56 @@ static long clk_composite_determine_rate(struct clk_hw *hw, unsigned long rate,
|
|||
const struct clk_ops *mux_ops = composite->mux_ops;
|
||||
struct clk_hw *rate_hw = composite->rate_hw;
|
||||
struct clk_hw *mux_hw = composite->mux_hw;
|
||||
struct clk *parent;
|
||||
unsigned long parent_rate;
|
||||
long tmp_rate, best_rate = 0;
|
||||
unsigned long rate_diff;
|
||||
unsigned long best_rate_diff = ULONG_MAX;
|
||||
int i;
|
||||
|
||||
if (rate_hw && rate_ops && rate_ops->determine_rate) {
|
||||
rate_hw->clk = hw->clk;
|
||||
return rate_ops->determine_rate(rate_hw, rate, best_parent_rate,
|
||||
best_parent_p);
|
||||
} else if (rate_hw && rate_ops && rate_ops->round_rate &&
|
||||
mux_hw && mux_ops && mux_ops->set_parent) {
|
||||
*best_parent_p = NULL;
|
||||
|
||||
if (__clk_get_flags(hw->clk) & CLK_SET_RATE_NO_REPARENT) {
|
||||
*best_parent_p = clk_get_parent(mux_hw->clk);
|
||||
*best_parent_rate = __clk_get_rate(*best_parent_p);
|
||||
|
||||
return rate_ops->round_rate(rate_hw, rate,
|
||||
best_parent_rate);
|
||||
}
|
||||
|
||||
for (i = 0; i < __clk_get_num_parents(mux_hw->clk); i++) {
|
||||
parent = clk_get_parent_by_index(mux_hw->clk, i);
|
||||
if (!parent)
|
||||
continue;
|
||||
|
||||
parent_rate = __clk_get_rate(parent);
|
||||
|
||||
tmp_rate = rate_ops->round_rate(rate_hw, rate,
|
||||
&parent_rate);
|
||||
if (tmp_rate < 0)
|
||||
continue;
|
||||
|
||||
rate_diff = abs(rate - tmp_rate);
|
||||
|
||||
if (!rate_diff || !*best_parent_p
|
||||
|| best_rate_diff > rate_diff) {
|
||||
*best_parent_p = parent;
|
||||
*best_parent_rate = parent_rate;
|
||||
best_rate_diff = rate_diff;
|
||||
best_rate = tmp_rate;
|
||||
}
|
||||
|
||||
if (!rate_diff)
|
||||
return rate;
|
||||
}
|
||||
|
||||
return best_rate;
|
||||
} else if (mux_hw && mux_ops && mux_ops->determine_rate) {
|
||||
mux_hw->clk = hw->clk;
|
||||
return mux_ops->determine_rate(mux_hw, rate, best_parent_rate,
|
||||
|
@ -162,7 +207,7 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
|
|||
clk_composite_ops = &composite->ops;
|
||||
|
||||
if (mux_hw && mux_ops) {
|
||||
if (!mux_ops->get_parent || !mux_ops->set_parent) {
|
||||
if (!mux_ops->get_parent) {
|
||||
clk = ERR_PTR(-EINVAL);
|
||||
goto err;
|
||||
}
|
||||
|
@ -170,7 +215,8 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
|
|||
composite->mux_hw = mux_hw;
|
||||
composite->mux_ops = mux_ops;
|
||||
clk_composite_ops->get_parent = clk_composite_get_parent;
|
||||
clk_composite_ops->set_parent = clk_composite_set_parent;
|
||||
if (mux_ops->set_parent)
|
||||
clk_composite_ops->set_parent = clk_composite_set_parent;
|
||||
if (mux_ops->determine_rate)
|
||||
clk_composite_ops->determine_rate = clk_composite_determine_rate;
|
||||
}
|
||||
|
@ -180,24 +226,27 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
|
|||
clk = ERR_PTR(-EINVAL);
|
||||
goto err;
|
||||
}
|
||||
clk_composite_ops->recalc_rate = clk_composite_recalc_rate;
|
||||
|
||||
/* .round_rate is a prerequisite for .set_rate */
|
||||
if (rate_ops->round_rate) {
|
||||
clk_composite_ops->round_rate = clk_composite_round_rate;
|
||||
if (rate_ops->set_rate) {
|
||||
clk_composite_ops->set_rate = clk_composite_set_rate;
|
||||
}
|
||||
} else {
|
||||
WARN(rate_ops->set_rate,
|
||||
"%s: missing round_rate op is required\n",
|
||||
__func__);
|
||||
if (rate_ops->determine_rate)
|
||||
clk_composite_ops->determine_rate =
|
||||
clk_composite_determine_rate;
|
||||
else if (rate_ops->round_rate)
|
||||
clk_composite_ops->round_rate =
|
||||
clk_composite_round_rate;
|
||||
|
||||
/* .set_rate requires either .round_rate or .determine_rate */
|
||||
if (rate_ops->set_rate) {
|
||||
if (rate_ops->determine_rate || rate_ops->round_rate)
|
||||
clk_composite_ops->set_rate =
|
||||
clk_composite_set_rate;
|
||||
else
|
||||
WARN(1, "%s: missing round_rate op is required\n",
|
||||
__func__);
|
||||
}
|
||||
|
||||
composite->rate_hw = rate_hw;
|
||||
composite->rate_ops = rate_ops;
|
||||
clk_composite_ops->recalc_rate = clk_composite_recalc_rate;
|
||||
if (rate_ops->determine_rate)
|
||||
clk_composite_ops->determine_rate = clk_composite_determine_rate;
|
||||
}
|
||||
|
||||
if (gate_hw && gate_ops) {
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* Copyright (C) 2014 Samsung Electronics Co., Ltd.
|
||||
* Sylwester Nawrocki <s.nawrocki@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/clk/clk-conf.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/printk.h>
|
||||
#include "clk.h"
|
||||
|
||||
static int __set_clk_parents(struct device_node *node, bool clk_supplier)
|
||||
{
|
||||
struct of_phandle_args clkspec;
|
||||
int index, rc, num_parents;
|
||||
struct clk *clk, *pclk;
|
||||
|
||||
num_parents = of_count_phandle_with_args(node, "assigned-clock-parents",
|
||||
"#clock-cells");
|
||||
if (num_parents == -EINVAL)
|
||||
pr_err("clk: invalid value of clock-parents property at %s\n",
|
||||
node->full_name);
|
||||
|
||||
for (index = 0; index < num_parents; index++) {
|
||||
rc = of_parse_phandle_with_args(node, "assigned-clock-parents",
|
||||
"#clock-cells", index, &clkspec);
|
||||
if (rc < 0) {
|
||||
/* skip empty (null) phandles */
|
||||
if (rc == -ENOENT)
|
||||
continue;
|
||||
else
|
||||
return rc;
|
||||
}
|
||||
if (clkspec.np == node && !clk_supplier)
|
||||
return 0;
|
||||
pclk = of_clk_get_by_clkspec(&clkspec);
|
||||
if (IS_ERR(pclk)) {
|
||||
pr_warn("clk: couldn't get parent clock %d for %s\n",
|
||||
index, node->full_name);
|
||||
return PTR_ERR(pclk);
|
||||
}
|
||||
|
||||
rc = of_parse_phandle_with_args(node, "assigned-clocks",
|
||||
"#clock-cells", index, &clkspec);
|
||||
if (rc < 0)
|
||||
goto err;
|
||||
if (clkspec.np == node && !clk_supplier) {
|
||||
rc = 0;
|
||||
goto err;
|
||||
}
|
||||
clk = of_clk_get_by_clkspec(&clkspec);
|
||||
if (IS_ERR(clk)) {
|
||||
pr_warn("clk: couldn't get parent clock %d for %s\n",
|
||||
index, node->full_name);
|
||||
rc = PTR_ERR(clk);
|
||||
goto err;
|
||||
}
|
||||
|
||||
rc = clk_set_parent(clk, pclk);
|
||||
if (rc < 0)
|
||||
pr_err("clk: failed to reparent %s to %s: %d\n",
|
||||
__clk_get_name(clk), __clk_get_name(pclk), rc);
|
||||
clk_put(clk);
|
||||
clk_put(pclk);
|
||||
}
|
||||
return 0;
|
||||
err:
|
||||
clk_put(pclk);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __set_clk_rates(struct device_node *node, bool clk_supplier)
|
||||
{
|
||||
struct of_phandle_args clkspec;
|
||||
struct property *prop;
|
||||
const __be32 *cur;
|
||||
int rc, index = 0;
|
||||
struct clk *clk;
|
||||
u32 rate;
|
||||
|
||||
of_property_for_each_u32(node, "assigned-clock-rates", prop, cur, rate) {
|
||||
if (rate) {
|
||||
rc = of_parse_phandle_with_args(node, "assigned-clocks",
|
||||
"#clock-cells", index, &clkspec);
|
||||
if (rc < 0) {
|
||||
/* skip empty (null) phandles */
|
||||
if (rc == -ENOENT)
|
||||
continue;
|
||||
else
|
||||
return rc;
|
||||
}
|
||||
if (clkspec.np == node && !clk_supplier)
|
||||
return 0;
|
||||
|
||||
clk = of_clk_get_by_clkspec(&clkspec);
|
||||
if (IS_ERR(clk)) {
|
||||
pr_warn("clk: couldn't get clock %d for %s\n",
|
||||
index, node->full_name);
|
||||
return PTR_ERR(clk);
|
||||
}
|
||||
|
||||
rc = clk_set_rate(clk, rate);
|
||||
if (rc < 0)
|
||||
pr_err("clk: couldn't set %s clock rate: %d\n",
|
||||
__clk_get_name(clk), rc);
|
||||
clk_put(clk);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* of_clk_set_defaults() - parse and set assigned clocks configuration
|
||||
* @node: device node to apply clock settings for
|
||||
* @clk_supplier: true if clocks supplied by @node should also be considered
|
||||
*
|
||||
* This function parses 'assigned-{clocks/clock-parents/clock-rates}' properties
|
||||
* and sets any specified clock parents and rates. The @clk_supplier argument
|
||||
* should be set to true if @node may be also a clock supplier of any clock
|
||||
* listed in its 'assigned-clocks' or 'assigned-clock-parents' properties.
|
||||
* If @clk_supplier is false the function exits returnning 0 as soon as it
|
||||
* determines the @node is also a supplier of any of the clocks.
|
||||
*/
|
||||
int of_clk_set_defaults(struct device_node *node, bool clk_supplier)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (!node)
|
||||
return 0;
|
||||
|
||||
rc = __set_clk_parents(node, clk_supplier);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
return __set_clk_rates(node, clk_supplier);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(of_clk_set_defaults);
|
|
@ -0,0 +1,307 @@
|
|||
/*
|
||||
* Clock driver for Palmas device.
|
||||
*
|
||||
* Copyright (c) 2013, NVIDIA Corporation.
|
||||
* Copyright (c) 2013-2014 Texas Instruments, Inc.
|
||||
*
|
||||
* Author: Laxman Dewangan <ldewangan@nvidia.com>
|
||||
* Peter Ujfalusi <peter.ujfalusi@ti.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation version 2.
|
||||
*
|
||||
* This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
|
||||
* whether express or implied; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clkdev.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/mfd/palmas.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#define PALMAS_CLOCK_DT_EXT_CONTROL_ENABLE1 1
|
||||
#define PALMAS_CLOCK_DT_EXT_CONTROL_ENABLE2 2
|
||||
#define PALMAS_CLOCK_DT_EXT_CONTROL_NSLEEP 3
|
||||
|
||||
struct palmas_clk32k_desc {
|
||||
const char *clk_name;
|
||||
unsigned int control_reg;
|
||||
unsigned int enable_mask;
|
||||
unsigned int sleep_mask;
|
||||
unsigned int sleep_reqstr_id;
|
||||
int delay;
|
||||
};
|
||||
|
||||
struct palmas_clock_info {
|
||||
struct device *dev;
|
||||
struct clk *clk;
|
||||
struct clk_hw hw;
|
||||
struct palmas *palmas;
|
||||
struct palmas_clk32k_desc *clk_desc;
|
||||
int ext_control_pin;
|
||||
};
|
||||
|
||||
static inline struct palmas_clock_info *to_palmas_clks_info(struct clk_hw *hw)
|
||||
{
|
||||
return container_of(hw, struct palmas_clock_info, hw);
|
||||
}
|
||||
|
||||
static unsigned long palmas_clks_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
return 32768;
|
||||
}
|
||||
|
||||
static int palmas_clks_prepare(struct clk_hw *hw)
|
||||
{
|
||||
struct palmas_clock_info *cinfo = to_palmas_clks_info(hw);
|
||||
int ret;
|
||||
|
||||
ret = palmas_update_bits(cinfo->palmas, PALMAS_RESOURCE_BASE,
|
||||
cinfo->clk_desc->control_reg,
|
||||
cinfo->clk_desc->enable_mask,
|
||||
cinfo->clk_desc->enable_mask);
|
||||
if (ret < 0)
|
||||
dev_err(cinfo->dev, "Reg 0x%02x update failed, %d\n",
|
||||
cinfo->clk_desc->control_reg, ret);
|
||||
else if (cinfo->clk_desc->delay)
|
||||
udelay(cinfo->clk_desc->delay);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void palmas_clks_unprepare(struct clk_hw *hw)
|
||||
{
|
||||
struct palmas_clock_info *cinfo = to_palmas_clks_info(hw);
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Clock can be disabled through external pin if it is externally
|
||||
* controlled.
|
||||
*/
|
||||
if (cinfo->ext_control_pin)
|
||||
return;
|
||||
|
||||
ret = palmas_update_bits(cinfo->palmas, PALMAS_RESOURCE_BASE,
|
||||
cinfo->clk_desc->control_reg,
|
||||
cinfo->clk_desc->enable_mask, 0);
|
||||
if (ret < 0)
|
||||
dev_err(cinfo->dev, "Reg 0x%02x update failed, %d\n",
|
||||
cinfo->clk_desc->control_reg, ret);
|
||||
}
|
||||
|
||||
static int palmas_clks_is_prepared(struct clk_hw *hw)
|
||||
{
|
||||
struct palmas_clock_info *cinfo = to_palmas_clks_info(hw);
|
||||
int ret;
|
||||
u32 val;
|
||||
|
||||
if (cinfo->ext_control_pin)
|
||||
return 1;
|
||||
|
||||
ret = palmas_read(cinfo->palmas, PALMAS_RESOURCE_BASE,
|
||||
cinfo->clk_desc->control_reg, &val);
|
||||
if (ret < 0) {
|
||||
dev_err(cinfo->dev, "Reg 0x%02x read failed, %d\n",
|
||||
cinfo->clk_desc->control_reg, ret);
|
||||
return ret;
|
||||
}
|
||||
return !!(val & cinfo->clk_desc->enable_mask);
|
||||
}
|
||||
|
||||
static struct clk_ops palmas_clks_ops = {
|
||||
.prepare = palmas_clks_prepare,
|
||||
.unprepare = palmas_clks_unprepare,
|
||||
.is_prepared = palmas_clks_is_prepared,
|
||||
.recalc_rate = palmas_clks_recalc_rate,
|
||||
};
|
||||
|
||||
struct palmas_clks_of_match_data {
|
||||
struct clk_init_data init;
|
||||
struct palmas_clk32k_desc desc;
|
||||
};
|
||||
|
||||
static struct palmas_clks_of_match_data palmas_of_clk32kg = {
|
||||
.init = {
|
||||
.name = "clk32kg",
|
||||
.ops = &palmas_clks_ops,
|
||||
.flags = CLK_IS_ROOT | CLK_IGNORE_UNUSED,
|
||||
},
|
||||
.desc = {
|
||||
.clk_name = "clk32kg",
|
||||
.control_reg = PALMAS_CLK32KG_CTRL,
|
||||
.enable_mask = PALMAS_CLK32KG_CTRL_MODE_ACTIVE,
|
||||
.sleep_mask = PALMAS_CLK32KG_CTRL_MODE_SLEEP,
|
||||
.sleep_reqstr_id = PALMAS_EXTERNAL_REQSTR_ID_CLK32KG,
|
||||
.delay = 200,
|
||||
},
|
||||
};
|
||||
|
||||
static struct palmas_clks_of_match_data palmas_of_clk32kgaudio = {
|
||||
.init = {
|
||||
.name = "clk32kgaudio",
|
||||
.ops = &palmas_clks_ops,
|
||||
.flags = CLK_IS_ROOT | CLK_IGNORE_UNUSED,
|
||||
},
|
||||
.desc = {
|
||||
.clk_name = "clk32kgaudio",
|
||||
.control_reg = PALMAS_CLK32KGAUDIO_CTRL,
|
||||
.enable_mask = PALMAS_CLK32KG_CTRL_MODE_ACTIVE,
|
||||
.sleep_mask = PALMAS_CLK32KG_CTRL_MODE_SLEEP,
|
||||
.sleep_reqstr_id = PALMAS_EXTERNAL_REQSTR_ID_CLK32KGAUDIO,
|
||||
.delay = 200,
|
||||
},
|
||||
};
|
||||
|
||||
static struct of_device_id palmas_clks_of_match[] = {
|
||||
{
|
||||
.compatible = "ti,palmas-clk32kg",
|
||||
.data = &palmas_of_clk32kg,
|
||||
},
|
||||
{
|
||||
.compatible = "ti,palmas-clk32kgaudio",
|
||||
.data = &palmas_of_clk32kgaudio,
|
||||
},
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, palmas_clks_of_match);
|
||||
|
||||
static void palmas_clks_get_clk_data(struct platform_device *pdev,
|
||||
struct palmas_clock_info *cinfo)
|
||||
{
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
unsigned int prop;
|
||||
int ret;
|
||||
|
||||
ret = of_property_read_u32(node, "ti,external-sleep-control",
|
||||
&prop);
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
switch (prop) {
|
||||
case PALMAS_CLOCK_DT_EXT_CONTROL_ENABLE1:
|
||||
prop = PALMAS_EXT_CONTROL_ENABLE1;
|
||||
break;
|
||||
case PALMAS_CLOCK_DT_EXT_CONTROL_ENABLE2:
|
||||
prop = PALMAS_EXT_CONTROL_ENABLE2;
|
||||
break;
|
||||
case PALMAS_CLOCK_DT_EXT_CONTROL_NSLEEP:
|
||||
prop = PALMAS_EXT_CONTROL_NSLEEP;
|
||||
break;
|
||||
default:
|
||||
dev_warn(&pdev->dev, "%s: Invalid ext control option: %u\n",
|
||||
node->name, prop);
|
||||
prop = 0;
|
||||
break;
|
||||
}
|
||||
cinfo->ext_control_pin = prop;
|
||||
}
|
||||
|
||||
static int palmas_clks_init_configure(struct palmas_clock_info *cinfo)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = palmas_update_bits(cinfo->palmas, PALMAS_RESOURCE_BASE,
|
||||
cinfo->clk_desc->control_reg,
|
||||
cinfo->clk_desc->sleep_mask, 0);
|
||||
if (ret < 0) {
|
||||
dev_err(cinfo->dev, "Reg 0x%02x update failed, %d\n",
|
||||
cinfo->clk_desc->control_reg, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (cinfo->ext_control_pin) {
|
||||
ret = clk_prepare(cinfo->clk);
|
||||
if (ret < 0) {
|
||||
dev_err(cinfo->dev, "Clock prep failed, %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = palmas_ext_control_req_config(cinfo->palmas,
|
||||
cinfo->clk_desc->sleep_reqstr_id,
|
||||
cinfo->ext_control_pin, true);
|
||||
if (ret < 0) {
|
||||
dev_err(cinfo->dev, "Ext config for %s failed, %d\n",
|
||||
cinfo->clk_desc->clk_name, ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
static int palmas_clks_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct palmas *palmas = dev_get_drvdata(pdev->dev.parent);
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
struct palmas_clks_of_match_data *match_data;
|
||||
const struct of_device_id *match;
|
||||
struct palmas_clock_info *cinfo;
|
||||
struct clk *clk;
|
||||
int ret;
|
||||
|
||||
match = of_match_device(palmas_clks_of_match, &pdev->dev);
|
||||
match_data = (struct palmas_clks_of_match_data *)match->data;
|
||||
|
||||
cinfo = devm_kzalloc(&pdev->dev, sizeof(*cinfo), GFP_KERNEL);
|
||||
if (!cinfo)
|
||||
return -ENOMEM;
|
||||
|
||||
palmas_clks_get_clk_data(pdev, cinfo);
|
||||
platform_set_drvdata(pdev, cinfo);
|
||||
|
||||
cinfo->dev = &pdev->dev;
|
||||
cinfo->palmas = palmas;
|
||||
|
||||
cinfo->clk_desc = &match_data->desc;
|
||||
cinfo->hw.init = &match_data->init;
|
||||
clk = devm_clk_register(&pdev->dev, &cinfo->hw);
|
||||
if (IS_ERR(clk)) {
|
||||
ret = PTR_ERR(clk);
|
||||
dev_err(&pdev->dev, "Fail to register clock %s, %d\n",
|
||||
match_data->desc.clk_name, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cinfo->clk = clk;
|
||||
ret = palmas_clks_init_configure(cinfo);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Clock config failed, %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = of_clk_add_provider(node, of_clk_src_simple_get, cinfo->clk);
|
||||
if (ret < 0)
|
||||
dev_err(&pdev->dev, "Fail to add clock driver, %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int palmas_clks_remove(struct platform_device *pdev)
|
||||
{
|
||||
of_clk_del_provider(pdev->dev.of_node);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver palmas_clks_driver = {
|
||||
.driver = {
|
||||
.name = "palmas-clk",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = palmas_clks_of_match,
|
||||
},
|
||||
.probe = palmas_clks_probe,
|
||||
.remove = palmas_clks_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(palmas_clks_driver);
|
||||
|
||||
MODULE_DESCRIPTION("Clock driver for Palmas Series Devices");
|
||||
MODULE_ALIAS("platform:palmas-clk");
|
||||
MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>");
|
||||
MODULE_LICENSE("GPL v2");
|
|
@ -291,7 +291,7 @@ static const struct of_device_id ppc_clk_ids[] __initconst = {
|
|||
{}
|
||||
};
|
||||
|
||||
static struct platform_driver ppc_corenet_clk_driver = {
|
||||
static struct platform_driver ppc_corenet_clk_driver __initdata = {
|
||||
.driver = {
|
||||
.name = "ppc_corenet_clock",
|
||||
.owner = THIS_MODULE,
|
||||
|
|
|
@ -46,7 +46,6 @@ struct s2mps11_clk {
|
|||
struct clk *clk;
|
||||
struct clk_lookup *lookup;
|
||||
u32 mask;
|
||||
bool enabled;
|
||||
unsigned int reg;
|
||||
};
|
||||
|
||||
|
@ -63,8 +62,6 @@ static int s2mps11_clk_prepare(struct clk_hw *hw)
|
|||
ret = regmap_update_bits(s2mps11->iodev->regmap_pmic,
|
||||
s2mps11->reg,
|
||||
s2mps11->mask, s2mps11->mask);
|
||||
if (!ret)
|
||||
s2mps11->enabled = true;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -76,32 +73,32 @@ static void s2mps11_clk_unprepare(struct clk_hw *hw)
|
|||
|
||||
ret = regmap_update_bits(s2mps11->iodev->regmap_pmic, s2mps11->reg,
|
||||
s2mps11->mask, ~s2mps11->mask);
|
||||
|
||||
if (!ret)
|
||||
s2mps11->enabled = false;
|
||||
}
|
||||
|
||||
static int s2mps11_clk_is_enabled(struct clk_hw *hw)
|
||||
static int s2mps11_clk_is_prepared(struct clk_hw *hw)
|
||||
{
|
||||
int ret;
|
||||
u32 val;
|
||||
struct s2mps11_clk *s2mps11 = to_s2mps11_clk(hw);
|
||||
|
||||
return s2mps11->enabled;
|
||||
ret = regmap_read(s2mps11->iodev->regmap_pmic,
|
||||
s2mps11->reg, &val);
|
||||
if (ret < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return val & s2mps11->mask;
|
||||
}
|
||||
|
||||
static unsigned long s2mps11_clk_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct s2mps11_clk *s2mps11 = to_s2mps11_clk(hw);
|
||||
if (s2mps11->enabled)
|
||||
return 32768;
|
||||
else
|
||||
return 0;
|
||||
return 32768;
|
||||
}
|
||||
|
||||
static struct clk_ops s2mps11_clk_ops = {
|
||||
.prepare = s2mps11_clk_prepare,
|
||||
.unprepare = s2mps11_clk_unprepare,
|
||||
.is_enabled = s2mps11_clk_is_enabled,
|
||||
.is_prepared = s2mps11_clk_is_prepared,
|
||||
.recalc_rate = s2mps11_clk_recalc_rate,
|
||||
};
|
||||
|
||||
|
@ -169,7 +166,6 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
|
|||
unsigned int s2mps11_reg;
|
||||
struct clk_init_data *clks_init;
|
||||
int i, ret = 0;
|
||||
u32 val;
|
||||
|
||||
s2mps11_clks = devm_kzalloc(&pdev->dev, sizeof(*s2mps11_clk) *
|
||||
S2MPS11_CLKS_NUM, GFP_KERNEL);
|
||||
|
@ -214,13 +210,6 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
|
|||
s2mps11_clk->mask = 1 << i;
|
||||
s2mps11_clk->reg = s2mps11_reg;
|
||||
|
||||
ret = regmap_read(s2mps11_clk->iodev->regmap_pmic,
|
||||
s2mps11_clk->reg, &val);
|
||||
if (ret < 0)
|
||||
goto err_reg;
|
||||
|
||||
s2mps11_clk->enabled = val & s2mps11_clk->mask;
|
||||
|
||||
s2mps11_clk->clk = devm_clk_register(&pdev->dev,
|
||||
&s2mps11_clk->hw);
|
||||
if (IS_ERR(s2mps11_clk->clk)) {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
*/
|
||||
|
||||
#include <linux/clk-private.h>
|
||||
#include <linux/clk/clk-conf.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
@ -98,9 +99,19 @@ static void clk_enable_unlock(unsigned long flags)
|
|||
#include <linux/debugfs.h>
|
||||
|
||||
static struct dentry *rootdir;
|
||||
static struct dentry *orphandir;
|
||||
static int inited = 0;
|
||||
|
||||
static struct hlist_head *all_lists[] = {
|
||||
&clk_root_list,
|
||||
&clk_orphan_list,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct hlist_head *orphan_list[] = {
|
||||
&clk_orphan_list,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static void clk_summary_show_one(struct seq_file *s, struct clk *c, int level)
|
||||
{
|
||||
if (!c)
|
||||
|
@ -130,17 +141,16 @@ static void clk_summary_show_subtree(struct seq_file *s, struct clk *c,
|
|||
static int clk_summary_show(struct seq_file *s, void *data)
|
||||
{
|
||||
struct clk *c;
|
||||
struct hlist_head **lists = (struct hlist_head **)s->private;
|
||||
|
||||
seq_puts(s, " clock enable_cnt prepare_cnt rate accuracy\n");
|
||||
seq_puts(s, "--------------------------------------------------------------------------------\n");
|
||||
|
||||
clk_prepare_lock();
|
||||
|
||||
hlist_for_each_entry(c, &clk_root_list, child_node)
|
||||
clk_summary_show_subtree(s, c, 0);
|
||||
|
||||
hlist_for_each_entry(c, &clk_orphan_list, child_node)
|
||||
clk_summary_show_subtree(s, c, 0);
|
||||
for (; *lists; lists++)
|
||||
hlist_for_each_entry(c, *lists, child_node)
|
||||
clk_summary_show_subtree(s, c, 0);
|
||||
|
||||
clk_prepare_unlock();
|
||||
|
||||
|
@ -193,21 +203,19 @@ static int clk_dump(struct seq_file *s, void *data)
|
|||
{
|
||||
struct clk *c;
|
||||
bool first_node = true;
|
||||
struct hlist_head **lists = (struct hlist_head **)s->private;
|
||||
|
||||
seq_printf(s, "{");
|
||||
|
||||
clk_prepare_lock();
|
||||
|
||||
hlist_for_each_entry(c, &clk_root_list, child_node) {
|
||||
if (!first_node)
|
||||
seq_printf(s, ",");
|
||||
first_node = false;
|
||||
clk_dump_subtree(s, c, 0);
|
||||
}
|
||||
|
||||
hlist_for_each_entry(c, &clk_orphan_list, child_node) {
|
||||
seq_printf(s, ",");
|
||||
clk_dump_subtree(s, c, 0);
|
||||
for (; *lists; lists++) {
|
||||
hlist_for_each_entry(c, *lists, child_node) {
|
||||
if (!first_node)
|
||||
seq_puts(s, ",");
|
||||
first_node = false;
|
||||
clk_dump_subtree(s, c, 0);
|
||||
}
|
||||
}
|
||||
|
||||
clk_prepare_unlock();
|
||||
|
@ -276,9 +284,11 @@ static int clk_debug_create_one(struct clk *clk, struct dentry *pdentry)
|
|||
if (!d)
|
||||
goto err_out;
|
||||
|
||||
if (clk->ops->debug_init)
|
||||
if (clk->ops->debug_init(clk->hw, clk->dentry))
|
||||
if (clk->ops->debug_init) {
|
||||
ret = clk->ops->debug_init(clk->hw, clk->dentry);
|
||||
if (ret)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
goto out;
|
||||
|
@ -305,7 +315,7 @@ static int clk_debug_create_subtree(struct clk *clk, struct dentry *pdentry)
|
|||
goto out;
|
||||
|
||||
hlist_for_each_entry(child, &clk->children, child_node)
|
||||
clk_debug_create_subtree(child, clk->dentry);
|
||||
clk_debug_create_subtree(child, pdentry);
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
|
@ -325,31 +335,12 @@ out:
|
|||
*/
|
||||
static int clk_debug_register(struct clk *clk)
|
||||
{
|
||||
struct clk *parent;
|
||||
struct dentry *pdentry;
|
||||
int ret = 0;
|
||||
|
||||
if (!inited)
|
||||
goto out;
|
||||
|
||||
parent = clk->parent;
|
||||
|
||||
/*
|
||||
* Check to see if a clk is a root clk. Also check that it is
|
||||
* safe to add this clk to debugfs
|
||||
*/
|
||||
if (!parent)
|
||||
if (clk->flags & CLK_IS_ROOT)
|
||||
pdentry = rootdir;
|
||||
else
|
||||
pdentry = orphandir;
|
||||
else
|
||||
if (parent->dentry)
|
||||
pdentry = parent->dentry;
|
||||
else
|
||||
goto out;
|
||||
|
||||
ret = clk_debug_create_subtree(clk, pdentry);
|
||||
ret = clk_debug_create_subtree(clk, rootdir);
|
||||
|
||||
out:
|
||||
return ret;
|
||||
|
@ -370,38 +361,17 @@ static void clk_debug_unregister(struct clk *clk)
|
|||
debugfs_remove_recursive(clk->dentry);
|
||||
}
|
||||
|
||||
/**
|
||||
* clk_debug_reparent - reparent clk node in the debugfs clk tree
|
||||
* @clk: the clk being reparented
|
||||
* @new_parent: the new clk parent, may be NULL
|
||||
*
|
||||
* Rename clk entry in the debugfs clk tree if debugfs has been
|
||||
* initialized. Otherwise it bails out early since the debugfs clk tree
|
||||
* will be created lazily by clk_debug_init as part of a late_initcall.
|
||||
*
|
||||
* Caller must hold prepare_lock.
|
||||
*/
|
||||
static void clk_debug_reparent(struct clk *clk, struct clk *new_parent)
|
||||
struct dentry *clk_debugfs_add_file(struct clk *clk, char *name, umode_t mode,
|
||||
void *data, const struct file_operations *fops)
|
||||
{
|
||||
struct dentry *d;
|
||||
struct dentry *new_parent_d;
|
||||
struct dentry *d = NULL;
|
||||
|
||||
if (!inited)
|
||||
return;
|
||||
if (clk->dentry)
|
||||
d = debugfs_create_file(name, mode, clk->dentry, data, fops);
|
||||
|
||||
if (new_parent)
|
||||
new_parent_d = new_parent->dentry;
|
||||
else
|
||||
new_parent_d = orphandir;
|
||||
|
||||
d = debugfs_rename(clk->dentry->d_parent, clk->dentry,
|
||||
new_parent_d, clk->name);
|
||||
if (d)
|
||||
clk->dentry = d;
|
||||
else
|
||||
pr_debug("%s: failed to rename debugfs entry for %s\n",
|
||||
__func__, clk->name);
|
||||
return d;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(clk_debugfs_add_file);
|
||||
|
||||
/**
|
||||
* clk_debug_init - lazily create the debugfs clk tree visualization
|
||||
|
@ -425,19 +395,24 @@ static int __init clk_debug_init(void)
|
|||
if (!rootdir)
|
||||
return -ENOMEM;
|
||||
|
||||
d = debugfs_create_file("clk_summary", S_IRUGO, rootdir, NULL,
|
||||
d = debugfs_create_file("clk_summary", S_IRUGO, rootdir, &all_lists,
|
||||
&clk_summary_fops);
|
||||
if (!d)
|
||||
return -ENOMEM;
|
||||
|
||||
d = debugfs_create_file("clk_dump", S_IRUGO, rootdir, NULL,
|
||||
d = debugfs_create_file("clk_dump", S_IRUGO, rootdir, &all_lists,
|
||||
&clk_dump_fops);
|
||||
if (!d)
|
||||
return -ENOMEM;
|
||||
|
||||
orphandir = debugfs_create_dir("orphans", rootdir);
|
||||
d = debugfs_create_file("clk_orphan_summary", S_IRUGO, rootdir,
|
||||
&orphan_list, &clk_summary_fops);
|
||||
if (!d)
|
||||
return -ENOMEM;
|
||||
|
||||
if (!orphandir)
|
||||
d = debugfs_create_file("clk_orphan_dump", S_IRUGO, rootdir,
|
||||
&orphan_list, &clk_dump_fops);
|
||||
if (!d)
|
||||
return -ENOMEM;
|
||||
|
||||
clk_prepare_lock();
|
||||
|
@ -446,7 +421,7 @@ static int __init clk_debug_init(void)
|
|||
clk_debug_create_subtree(clk, rootdir);
|
||||
|
||||
hlist_for_each_entry(clk, &clk_orphan_list, child_node)
|
||||
clk_debug_create_subtree(clk, orphandir);
|
||||
clk_debug_create_subtree(clk, rootdir);
|
||||
|
||||
inited = 1;
|
||||
|
||||
|
@ -1284,9 +1259,6 @@ static void __clk_set_parent_after(struct clk *clk, struct clk *parent,
|
|||
clk_disable(old_parent);
|
||||
__clk_unprepare(old_parent);
|
||||
}
|
||||
|
||||
/* update debugfs with new clk tree topology */
|
||||
clk_debug_reparent(clk, parent);
|
||||
}
|
||||
|
||||
static int __clk_set_parent(struct clk *clk, struct clk *parent, u8 p_index)
|
||||
|
@ -1683,7 +1655,6 @@ out:
|
|||
void __clk_reparent(struct clk *clk, struct clk *new_parent)
|
||||
{
|
||||
clk_reparent(clk, new_parent);
|
||||
clk_debug_reparent(clk, new_parent);
|
||||
__clk_recalc_accuracies(clk);
|
||||
__clk_recalc_rates(clk, POST_RATE_CHANGE);
|
||||
}
|
||||
|
@ -2414,6 +2385,7 @@ int of_clk_add_provider(struct device_node *np,
|
|||
void *data)
|
||||
{
|
||||
struct of_clk_provider *cp;
|
||||
int ret;
|
||||
|
||||
cp = kzalloc(sizeof(struct of_clk_provider), GFP_KERNEL);
|
||||
if (!cp)
|
||||
|
@ -2428,7 +2400,11 @@ int of_clk_add_provider(struct device_node *np,
|
|||
mutex_unlock(&of_clk_mutex);
|
||||
pr_debug("Added clock from %s\n", np->full_name);
|
||||
|
||||
return 0;
|
||||
ret = of_clk_set_defaults(np, true);
|
||||
if (ret < 0)
|
||||
of_clk_del_provider(np);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(of_clk_add_provider);
|
||||
|
||||
|
@ -2605,7 +2581,10 @@ void __init of_clk_init(const struct of_device_id *matches)
|
|||
list_for_each_entry_safe(clk_provider, next,
|
||||
&clk_provider_list, node) {
|
||||
if (force || parent_ready(clk_provider->np)) {
|
||||
|
||||
clk_provider->clk_init_cb(clk_provider->np);
|
||||
of_clk_set_defaults(clk_provider->np, true);
|
||||
|
||||
list_del(&clk_provider->node);
|
||||
kfree(clk_provider);
|
||||
is_init_done = true;
|
||||
|
@ -2620,7 +2599,6 @@ void __init of_clk_init(const struct of_device_id *matches)
|
|||
*/
|
||||
if (!is_init_done)
|
||||
force = true;
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -101,8 +101,9 @@ struct clk *of_clk_get_by_name(struct device_node *np, const char *name)
|
|||
if (!IS_ERR(clk))
|
||||
break;
|
||||
else if (name && index >= 0) {
|
||||
pr_err("ERROR: could not get clock %s:%s(%i)\n",
|
||||
np->full_name, name ? name : "", index);
|
||||
if (PTR_ERR(clk) != -EPROBE_DEFER)
|
||||
pr_err("ERROR: could not get clock %s:%s(%i)\n",
|
||||
np->full_name, name ? name : "", index);
|
||||
return clk;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,31 @@ config COMMON_CLK_QCOM
|
|||
select REGMAP_MMIO
|
||||
select RESET_CONTROLLER
|
||||
|
||||
config APQ_GCC_8084
|
||||
tristate "APQ8084 Global Clock Controller"
|
||||
depends on COMMON_CLK_QCOM
|
||||
help
|
||||
Support for the global clock controller on apq8084 devices.
|
||||
Say Y if you want to use peripheral devices such as UART, SPI,
|
||||
i2c, USB, SD/eMMC, SATA, PCIe, etc.
|
||||
|
||||
config APQ_MMCC_8084
|
||||
tristate "APQ8084 Multimedia Clock Controller"
|
||||
select APQ_GCC_8084
|
||||
depends on COMMON_CLK_QCOM
|
||||
help
|
||||
Support for the multimedia clock controller on apq8084 devices.
|
||||
Say Y if you want to support multimedia devices such as display,
|
||||
graphics, video encode/decode, camera, etc.
|
||||
|
||||
config IPQ_GCC_806X
|
||||
tristate "IPQ806x Global Clock Controller"
|
||||
depends on COMMON_CLK_QCOM
|
||||
help
|
||||
Support for the global clock controller on ipq806x devices.
|
||||
Say Y if you want to use peripheral devices such as UART, SPI,
|
||||
i2c, USB, SD/eMMC, etc.
|
||||
|
||||
config MSM_GCC_8660
|
||||
tristate "MSM8660 Global Clock Controller"
|
||||
depends on COMMON_CLK_QCOM
|
||||
|
|
|
@ -8,6 +8,9 @@ clk-qcom-y += clk-rcg2.o
|
|||
clk-qcom-y += clk-branch.o
|
||||
clk-qcom-y += reset.o
|
||||
|
||||
obj-$(CONFIG_APQ_GCC_8084) += gcc-apq8084.o
|
||||
obj-$(CONFIG_APQ_MMCC_8084) += mmcc-apq8084.o
|
||||
obj-$(CONFIG_IPQ_GCC_806X) += gcc-ipq806x.o
|
||||
obj-$(CONFIG_MSM_GCC_8660) += gcc-msm8660.o
|
||||
obj-$(CONFIG_MSM_GCC_8960) += gcc-msm8960.o
|
||||
obj-$(CONFIG_MSM_GCC_8974) += gcc-msm8974.o
|
||||
|
|
|
@ -166,7 +166,7 @@ const struct clk_ops clk_pll_vote_ops = {
|
|||
EXPORT_SYMBOL_GPL(clk_pll_vote_ops);
|
||||
|
||||
static void
|
||||
clk_pll_set_fsm_mode(struct clk_pll *pll, struct regmap *regmap)
|
||||
clk_pll_set_fsm_mode(struct clk_pll *pll, struct regmap *regmap, u8 lock_count)
|
||||
{
|
||||
u32 val;
|
||||
u32 mask;
|
||||
|
@ -175,7 +175,7 @@ clk_pll_set_fsm_mode(struct clk_pll *pll, struct regmap *regmap)
|
|||
regmap_update_bits(regmap, pll->mode_reg, PLL_VOTE_FSM_RESET, 0);
|
||||
|
||||
/* Program bias count and lock count */
|
||||
val = 1 << PLL_BIAS_COUNT_SHIFT;
|
||||
val = 1 << PLL_BIAS_COUNT_SHIFT | lock_count << PLL_LOCK_COUNT_SHIFT;
|
||||
mask = PLL_BIAS_COUNT_MASK << PLL_BIAS_COUNT_SHIFT;
|
||||
mask |= PLL_LOCK_COUNT_MASK << PLL_LOCK_COUNT_SHIFT;
|
||||
regmap_update_bits(regmap, pll->mode_reg, mask, val);
|
||||
|
@ -212,11 +212,20 @@ static void clk_pll_configure(struct clk_pll *pll, struct regmap *regmap,
|
|||
regmap_update_bits(regmap, pll->config_reg, mask, val);
|
||||
}
|
||||
|
||||
void clk_pll_configure_sr(struct clk_pll *pll, struct regmap *regmap,
|
||||
const struct pll_config *config, bool fsm_mode)
|
||||
{
|
||||
clk_pll_configure(pll, regmap, config);
|
||||
if (fsm_mode)
|
||||
clk_pll_set_fsm_mode(pll, regmap, 8);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(clk_pll_configure_sr);
|
||||
|
||||
void clk_pll_configure_sr_hpm_lp(struct clk_pll *pll, struct regmap *regmap,
|
||||
const struct pll_config *config, bool fsm_mode)
|
||||
{
|
||||
clk_pll_configure(pll, regmap, config);
|
||||
if (fsm_mode)
|
||||
clk_pll_set_fsm_mode(pll, regmap);
|
||||
clk_pll_set_fsm_mode(pll, regmap, 0);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(clk_pll_configure_sr_hpm_lp);
|
||||
|
|
|
@ -60,6 +60,8 @@ struct pll_config {
|
|||
u32 aux_output_mask;
|
||||
};
|
||||
|
||||
void clk_pll_configure_sr(struct clk_pll *pll, struct regmap *regmap,
|
||||
const struct pll_config *config, bool fsm_mode);
|
||||
void clk_pll_configure_sr_hpm_lp(struct clk_pll *pll, struct regmap *regmap,
|
||||
const struct pll_config *config, bool fsm_mode);
|
||||
|
||||
|
|
|
@ -417,20 +417,25 @@ static long clk_dyn_rcg_determine_rate(struct clk_hw *hw, unsigned long rate,
|
|||
return _freq_tbl_determine_rate(hw, rcg->freq_tbl, rate, p_rate, p);
|
||||
}
|
||||
|
||||
static int clk_rcg_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
static long clk_rcg_bypass_determine_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *p_rate, struct clk **p)
|
||||
{
|
||||
struct clk_rcg *rcg = to_clk_rcg(hw);
|
||||
const struct freq_tbl *f;
|
||||
const struct freq_tbl *f = rcg->freq_tbl;
|
||||
|
||||
*p = clk_get_parent_by_index(hw->clk, f->src);
|
||||
*p_rate = __clk_round_rate(*p, rate);
|
||||
|
||||
return *p_rate;
|
||||
}
|
||||
|
||||
static int __clk_rcg_set_rate(struct clk_rcg *rcg, const struct freq_tbl *f)
|
||||
{
|
||||
u32 ns, md, ctl;
|
||||
struct mn *mn = &rcg->mn;
|
||||
u32 mask = 0;
|
||||
unsigned int reset_reg;
|
||||
|
||||
f = find_freq(rcg->freq_tbl, rate);
|
||||
if (!f)
|
||||
return -EINVAL;
|
||||
|
||||
if (rcg->mn.reset_in_cc)
|
||||
reset_reg = rcg->clkr.enable_reg;
|
||||
else
|
||||
|
@ -466,6 +471,27 @@ static int clk_rcg_set_rate(struct clk_hw *hw, unsigned long rate,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int clk_rcg_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_rcg *rcg = to_clk_rcg(hw);
|
||||
const struct freq_tbl *f;
|
||||
|
||||
f = find_freq(rcg->freq_tbl, rate);
|
||||
if (!f)
|
||||
return -EINVAL;
|
||||
|
||||
return __clk_rcg_set_rate(rcg, f);
|
||||
}
|
||||
|
||||
static int clk_rcg_bypass_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_rcg *rcg = to_clk_rcg(hw);
|
||||
|
||||
return __clk_rcg_set_rate(rcg, rcg->freq_tbl);
|
||||
}
|
||||
|
||||
static int __clk_dyn_rcg_set_rate(struct clk_hw *hw, unsigned long rate)
|
||||
{
|
||||
struct clk_dyn_rcg *rcg = to_clk_dyn_rcg(hw);
|
||||
|
@ -503,6 +529,17 @@ const struct clk_ops clk_rcg_ops = {
|
|||
};
|
||||
EXPORT_SYMBOL_GPL(clk_rcg_ops);
|
||||
|
||||
const struct clk_ops clk_rcg_bypass_ops = {
|
||||
.enable = clk_enable_regmap,
|
||||
.disable = clk_disable_regmap,
|
||||
.get_parent = clk_rcg_get_parent,
|
||||
.set_parent = clk_rcg_set_parent,
|
||||
.recalc_rate = clk_rcg_recalc_rate,
|
||||
.determine_rate = clk_rcg_bypass_determine_rate,
|
||||
.set_rate = clk_rcg_bypass_set_rate,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(clk_rcg_bypass_ops);
|
||||
|
||||
const struct clk_ops clk_dyn_rcg_ops = {
|
||||
.enable = clk_enable_regmap,
|
||||
.is_enabled = clk_is_enabled_regmap,
|
||||
|
|
|
@ -95,6 +95,7 @@ struct clk_rcg {
|
|||
};
|
||||
|
||||
extern const struct clk_ops clk_rcg_ops;
|
||||
extern const struct clk_ops clk_rcg_bypass_ops;
|
||||
|
||||
#define to_clk_rcg(_hw) container_of(to_clk_regmap(_hw), struct clk_rcg, clkr)
|
||||
|
||||
|
|
|
@ -27,30 +27,35 @@ struct qcom_cc {
|
|||
struct clk *clks[];
|
||||
};
|
||||
|
||||
int qcom_cc_probe(struct platform_device *pdev, const struct qcom_cc_desc *desc)
|
||||
struct regmap *
|
||||
qcom_cc_map(struct platform_device *pdev, const struct qcom_cc_desc *desc)
|
||||
{
|
||||
void __iomem *base;
|
||||
struct resource *res;
|
||||
struct device *dev = &pdev->dev;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
base = devm_ioremap_resource(dev, res);
|
||||
if (IS_ERR(base))
|
||||
return ERR_CAST(base);
|
||||
|
||||
return devm_regmap_init_mmio(dev, base, desc->config);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(qcom_cc_map);
|
||||
|
||||
int qcom_cc_really_probe(struct platform_device *pdev,
|
||||
const struct qcom_cc_desc *desc, struct regmap *regmap)
|
||||
{
|
||||
int i, ret;
|
||||
struct device *dev = &pdev->dev;
|
||||
struct clk *clk;
|
||||
struct clk_onecell_data *data;
|
||||
struct clk **clks;
|
||||
struct regmap *regmap;
|
||||
struct qcom_reset_controller *reset;
|
||||
struct qcom_cc *cc;
|
||||
size_t num_clks = desc->num_clks;
|
||||
struct clk_regmap **rclks = desc->clks;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
base = devm_ioremap_resource(dev, res);
|
||||
if (IS_ERR(base))
|
||||
return PTR_ERR(base);
|
||||
|
||||
regmap = devm_regmap_init_mmio(dev, base, desc->config);
|
||||
if (IS_ERR(regmap))
|
||||
return PTR_ERR(regmap);
|
||||
|
||||
cc = devm_kzalloc(dev, sizeof(*cc) + sizeof(*clks) * num_clks,
|
||||
GFP_KERNEL);
|
||||
if (!cc)
|
||||
|
@ -91,6 +96,18 @@ int qcom_cc_probe(struct platform_device *pdev, const struct qcom_cc_desc *desc)
|
|||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(qcom_cc_really_probe);
|
||||
|
||||
int qcom_cc_probe(struct platform_device *pdev, const struct qcom_cc_desc *desc)
|
||||
{
|
||||
struct regmap *regmap;
|
||||
|
||||
regmap = qcom_cc_map(pdev, desc);
|
||||
if (IS_ERR(regmap))
|
||||
return PTR_ERR(regmap);
|
||||
|
||||
return qcom_cc_really_probe(pdev, desc, regmap);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(qcom_cc_probe);
|
||||
|
||||
void qcom_cc_remove(struct platform_device *pdev)
|
||||
|
|
|
@ -17,6 +17,7 @@ struct platform_device;
|
|||
struct regmap_config;
|
||||
struct clk_regmap;
|
||||
struct qcom_reset_map;
|
||||
struct regmap;
|
||||
|
||||
struct qcom_cc_desc {
|
||||
const struct regmap_config *config;
|
||||
|
@ -26,6 +27,11 @@ struct qcom_cc_desc {
|
|||
size_t num_resets;
|
||||
};
|
||||
|
||||
extern struct regmap *qcom_cc_map(struct platform_device *pdev,
|
||||
const struct qcom_cc_desc *desc);
|
||||
extern int qcom_cc_really_probe(struct platform_device *pdev,
|
||||
const struct qcom_cc_desc *desc,
|
||||
struct regmap *regmap);
|
||||
extern int qcom_cc_probe(struct platform_device *pdev,
|
||||
const struct qcom_cc_desc *desc);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -104,6 +104,7 @@ static struct clk_regmap pll14_vote = {
|
|||
|
||||
#define P_PXO 0
|
||||
#define P_PLL8 1
|
||||
#define P_PLL3 2
|
||||
#define P_CXO 2
|
||||
|
||||
static const u8 gcc_pxo_pll8_map[] = {
|
||||
|
@ -128,6 +129,18 @@ static const char *gcc_pxo_pll8_cxo[] = {
|
|||
"cxo",
|
||||
};
|
||||
|
||||
static const u8 gcc_pxo_pll8_pll3_map[] = {
|
||||
[P_PXO] = 0,
|
||||
[P_PLL8] = 3,
|
||||
[P_PLL3] = 6,
|
||||
};
|
||||
|
||||
static const char *gcc_pxo_pll8_pll3[] = {
|
||||
"pxo",
|
||||
"pll8_vote",
|
||||
"pll3",
|
||||
};
|
||||
|
||||
static struct freq_tbl clk_tbl_gsbi_uart[] = {
|
||||
{ 1843200, P_PLL8, 2, 6, 625 },
|
||||
{ 3686400, P_PLL8, 2, 12, 625 },
|
||||
|
@ -1928,6 +1941,104 @@ static struct clk_branch usb_hs1_xcvr_clk = {
|
|||
},
|
||||
};
|
||||
|
||||
static struct clk_rcg usb_hs3_xcvr_src = {
|
||||
.ns_reg = 0x370c,
|
||||
.md_reg = 0x3708,
|
||||
.mn = {
|
||||
.mnctr_en_bit = 8,
|
||||
.mnctr_reset_bit = 7,
|
||||
.mnctr_mode_shift = 5,
|
||||
.n_val_shift = 16,
|
||||
.m_val_shift = 16,
|
||||
.width = 8,
|
||||
},
|
||||
.p = {
|
||||
.pre_div_shift = 3,
|
||||
.pre_div_width = 2,
|
||||
},
|
||||
.s = {
|
||||
.src_sel_shift = 0,
|
||||
.parent_map = gcc_pxo_pll8_map,
|
||||
},
|
||||
.freq_tbl = clk_tbl_usb,
|
||||
.clkr = {
|
||||
.enable_reg = 0x370c,
|
||||
.enable_mask = BIT(11),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "usb_hs3_xcvr_src",
|
||||
.parent_names = gcc_pxo_pll8,
|
||||
.num_parents = 2,
|
||||
.ops = &clk_rcg_ops,
|
||||
.flags = CLK_SET_RATE_GATE,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
static struct clk_branch usb_hs3_xcvr_clk = {
|
||||
.halt_reg = 0x2fc8,
|
||||
.halt_bit = 30,
|
||||
.clkr = {
|
||||
.enable_reg = 0x370c,
|
||||
.enable_mask = BIT(9),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "usb_hs3_xcvr_clk",
|
||||
.parent_names = (const char *[]){ "usb_hs3_xcvr_src" },
|
||||
.num_parents = 1,
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_SET_RATE_PARENT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_rcg usb_hs4_xcvr_src = {
|
||||
.ns_reg = 0x372c,
|
||||
.md_reg = 0x3728,
|
||||
.mn = {
|
||||
.mnctr_en_bit = 8,
|
||||
.mnctr_reset_bit = 7,
|
||||
.mnctr_mode_shift = 5,
|
||||
.n_val_shift = 16,
|
||||
.m_val_shift = 16,
|
||||
.width = 8,
|
||||
},
|
||||
.p = {
|
||||
.pre_div_shift = 3,
|
||||
.pre_div_width = 2,
|
||||
},
|
||||
.s = {
|
||||
.src_sel_shift = 0,
|
||||
.parent_map = gcc_pxo_pll8_map,
|
||||
},
|
||||
.freq_tbl = clk_tbl_usb,
|
||||
.clkr = {
|
||||
.enable_reg = 0x372c,
|
||||
.enable_mask = BIT(11),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "usb_hs4_xcvr_src",
|
||||
.parent_names = gcc_pxo_pll8,
|
||||
.num_parents = 2,
|
||||
.ops = &clk_rcg_ops,
|
||||
.flags = CLK_SET_RATE_GATE,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
static struct clk_branch usb_hs4_xcvr_clk = {
|
||||
.halt_reg = 0x2fc8,
|
||||
.halt_bit = 2,
|
||||
.clkr = {
|
||||
.enable_reg = 0x372c,
|
||||
.enable_mask = BIT(9),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "usb_hs4_xcvr_clk",
|
||||
.parent_names = (const char *[]){ "usb_hs4_xcvr_src" },
|
||||
.num_parents = 1,
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_SET_RATE_PARENT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_rcg usb_hsic_xcvr_fs_src = {
|
||||
.ns_reg = 0x2928,
|
||||
.md_reg = 0x2924,
|
||||
|
@ -2456,6 +2567,34 @@ static struct clk_branch usb_hs1_h_clk = {
|
|||
},
|
||||
};
|
||||
|
||||
static struct clk_branch usb_hs3_h_clk = {
|
||||
.halt_reg = 0x2fc8,
|
||||
.halt_bit = 31,
|
||||
.clkr = {
|
||||
.enable_reg = 0x3700,
|
||||
.enable_mask = BIT(4),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "usb_hs3_h_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_IS_ROOT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch usb_hs4_h_clk = {
|
||||
.halt_reg = 0x2fc8,
|
||||
.halt_bit = 7,
|
||||
.clkr = {
|
||||
.enable_reg = 0x3720,
|
||||
.enable_mask = BIT(4),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "usb_hs4_h_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_IS_ROOT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch usb_hsic_h_clk = {
|
||||
.halt_reg = 0x2fcc,
|
||||
.halt_bit = 28,
|
||||
|
@ -2582,6 +2721,244 @@ static struct clk_branch adm0_pbus_clk = {
|
|||
},
|
||||
};
|
||||
|
||||
static struct freq_tbl clk_tbl_ce3[] = {
|
||||
{ 48000000, P_PLL8, 8 },
|
||||
{ 100000000, P_PLL3, 12 },
|
||||
{ 120000000, P_PLL3, 10 },
|
||||
{ }
|
||||
};
|
||||
|
||||
static struct clk_rcg ce3_src = {
|
||||
.ns_reg = 0x36c0,
|
||||
.p = {
|
||||
.pre_div_shift = 3,
|
||||
.pre_div_width = 4,
|
||||
},
|
||||
.s = {
|
||||
.src_sel_shift = 0,
|
||||
.parent_map = gcc_pxo_pll8_pll3_map,
|
||||
},
|
||||
.freq_tbl = clk_tbl_ce3,
|
||||
.clkr = {
|
||||
.enable_reg = 0x2c08,
|
||||
.enable_mask = BIT(7),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "ce3_src",
|
||||
.parent_names = gcc_pxo_pll8_pll3,
|
||||
.num_parents = 3,
|
||||
.ops = &clk_rcg_ops,
|
||||
.flags = CLK_SET_RATE_GATE,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch ce3_core_clk = {
|
||||
.halt_reg = 0x2fdc,
|
||||
.halt_bit = 5,
|
||||
.clkr = {
|
||||
.enable_reg = 0x36c4,
|
||||
.enable_mask = BIT(4),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "ce3_core_clk",
|
||||
.parent_names = (const char *[]){ "ce3_src" },
|
||||
.num_parents = 1,
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_SET_RATE_PARENT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch ce3_h_clk = {
|
||||
.halt_reg = 0x2fc4,
|
||||
.halt_bit = 16,
|
||||
.clkr = {
|
||||
.enable_reg = 0x36c4,
|
||||
.enable_mask = BIT(4),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "ce3_h_clk",
|
||||
.parent_names = (const char *[]){ "ce3_src" },
|
||||
.num_parents = 1,
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_SET_RATE_PARENT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static const struct freq_tbl clk_tbl_sata_ref[] = {
|
||||
{ 48000000, P_PLL8, 8, 0, 0 },
|
||||
{ 100000000, P_PLL3, 12, 0, 0 },
|
||||
{ }
|
||||
};
|
||||
|
||||
static struct clk_rcg sata_clk_src = {
|
||||
.ns_reg = 0x2c08,
|
||||
.p = {
|
||||
.pre_div_shift = 3,
|
||||
.pre_div_width = 4,
|
||||
},
|
||||
.s = {
|
||||
.src_sel_shift = 0,
|
||||
.parent_map = gcc_pxo_pll8_pll3_map,
|
||||
},
|
||||
.freq_tbl = clk_tbl_sata_ref,
|
||||
.clkr = {
|
||||
.enable_reg = 0x2c08,
|
||||
.enable_mask = BIT(7),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "sata_clk_src",
|
||||
.parent_names = gcc_pxo_pll8_pll3,
|
||||
.num_parents = 3,
|
||||
.ops = &clk_rcg_ops,
|
||||
.flags = CLK_SET_RATE_GATE,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch sata_rxoob_clk = {
|
||||
.halt_reg = 0x2fdc,
|
||||
.halt_bit = 26,
|
||||
.clkr = {
|
||||
.enable_reg = 0x2c0c,
|
||||
.enable_mask = BIT(4),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "sata_rxoob_clk",
|
||||
.parent_names = (const char *[]){ "sata_clk_src" },
|
||||
.num_parents = 1,
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_SET_RATE_PARENT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch sata_pmalive_clk = {
|
||||
.halt_reg = 0x2fdc,
|
||||
.halt_bit = 25,
|
||||
.clkr = {
|
||||
.enable_reg = 0x2c10,
|
||||
.enable_mask = BIT(4),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "sata_pmalive_clk",
|
||||
.parent_names = (const char *[]){ "sata_clk_src" },
|
||||
.num_parents = 1,
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_SET_RATE_PARENT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch sata_phy_ref_clk = {
|
||||
.halt_reg = 0x2fdc,
|
||||
.halt_bit = 24,
|
||||
.clkr = {
|
||||
.enable_reg = 0x2c14,
|
||||
.enable_mask = BIT(4),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "sata_phy_ref_clk",
|
||||
.parent_names = (const char *[]){ "pxo" },
|
||||
.num_parents = 1,
|
||||
.ops = &clk_branch_ops,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch sata_a_clk = {
|
||||
.halt_reg = 0x2fc0,
|
||||
.halt_bit = 12,
|
||||
.clkr = {
|
||||
.enable_reg = 0x2c20,
|
||||
.enable_mask = BIT(4),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "sata_a_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_IS_ROOT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch sata_h_clk = {
|
||||
.halt_reg = 0x2fdc,
|
||||
.halt_bit = 27,
|
||||
.clkr = {
|
||||
.enable_reg = 0x2c00,
|
||||
.enable_mask = BIT(4),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "sata_h_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_IS_ROOT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch sfab_sata_s_h_clk = {
|
||||
.halt_reg = 0x2fc4,
|
||||
.halt_bit = 14,
|
||||
.clkr = {
|
||||
.enable_reg = 0x2480,
|
||||
.enable_mask = BIT(4),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "sfab_sata_s_h_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_IS_ROOT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch sata_phy_cfg_clk = {
|
||||
.halt_reg = 0x2fcc,
|
||||
.halt_bit = 12,
|
||||
.clkr = {
|
||||
.enable_reg = 0x2c40,
|
||||
.enable_mask = BIT(4),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "sata_phy_cfg_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_IS_ROOT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch pcie_phy_ref_clk = {
|
||||
.halt_reg = 0x2fdc,
|
||||
.halt_bit = 29,
|
||||
.clkr = {
|
||||
.enable_reg = 0x22d0,
|
||||
.enable_mask = BIT(4),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "pcie_phy_ref_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_IS_ROOT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch pcie_h_clk = {
|
||||
.halt_reg = 0x2fd4,
|
||||
.halt_bit = 8,
|
||||
.clkr = {
|
||||
.enable_reg = 0x22cc,
|
||||
.enable_mask = BIT(4),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "pcie_h_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_IS_ROOT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch pcie_a_clk = {
|
||||
.halt_reg = 0x2fc0,
|
||||
.halt_bit = 13,
|
||||
.clkr = {
|
||||
.enable_reg = 0x22c0,
|
||||
.enable_mask = BIT(4),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "pcie_a_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_IS_ROOT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch pmic_arb0_h_clk = {
|
||||
.halt_reg = 0x2fd8,
|
||||
.halt_check = BRANCH_HALT_VOTED,
|
||||
|
@ -2869,13 +3246,205 @@ static const struct qcom_reset_map gcc_msm8960_resets[] = {
|
|||
};
|
||||
|
||||
static struct clk_regmap *gcc_apq8064_clks[] = {
|
||||
[PLL3] = &pll3.clkr,
|
||||
[PLL8] = &pll8.clkr,
|
||||
[PLL8_VOTE] = &pll8_vote,
|
||||
[PLL14] = &pll14.clkr,
|
||||
[PLL14_VOTE] = &pll14_vote,
|
||||
[GSBI1_UART_SRC] = &gsbi1_uart_src.clkr,
|
||||
[GSBI1_UART_CLK] = &gsbi1_uart_clk.clkr,
|
||||
[GSBI2_UART_SRC] = &gsbi2_uart_src.clkr,
|
||||
[GSBI2_UART_CLK] = &gsbi2_uart_clk.clkr,
|
||||
[GSBI3_UART_SRC] = &gsbi3_uart_src.clkr,
|
||||
[GSBI3_UART_CLK] = &gsbi3_uart_clk.clkr,
|
||||
[GSBI4_UART_SRC] = &gsbi4_uart_src.clkr,
|
||||
[GSBI4_UART_CLK] = &gsbi4_uart_clk.clkr,
|
||||
[GSBI5_UART_SRC] = &gsbi5_uart_src.clkr,
|
||||
[GSBI5_UART_CLK] = &gsbi5_uart_clk.clkr,
|
||||
[GSBI6_UART_SRC] = &gsbi6_uart_src.clkr,
|
||||
[GSBI6_UART_CLK] = &gsbi6_uart_clk.clkr,
|
||||
[GSBI7_UART_SRC] = &gsbi7_uart_src.clkr,
|
||||
[GSBI7_UART_CLK] = &gsbi7_uart_clk.clkr,
|
||||
[GSBI1_QUP_SRC] = &gsbi1_qup_src.clkr,
|
||||
[GSBI1_QUP_CLK] = &gsbi1_qup_clk.clkr,
|
||||
[GSBI2_QUP_SRC] = &gsbi2_qup_src.clkr,
|
||||
[GSBI2_QUP_CLK] = &gsbi2_qup_clk.clkr,
|
||||
[GSBI3_QUP_SRC] = &gsbi3_qup_src.clkr,
|
||||
[GSBI3_QUP_CLK] = &gsbi3_qup_clk.clkr,
|
||||
[GSBI4_QUP_SRC] = &gsbi4_qup_src.clkr,
|
||||
[GSBI4_QUP_CLK] = &gsbi4_qup_clk.clkr,
|
||||
[GSBI5_QUP_SRC] = &gsbi5_qup_src.clkr,
|
||||
[GSBI5_QUP_CLK] = &gsbi5_qup_clk.clkr,
|
||||
[GSBI6_QUP_SRC] = &gsbi6_qup_src.clkr,
|
||||
[GSBI6_QUP_CLK] = &gsbi6_qup_clk.clkr,
|
||||
[GSBI7_QUP_SRC] = &gsbi7_qup_src.clkr,
|
||||
[GSBI7_QUP_CLK] = &gsbi7_qup_clk.clkr,
|
||||
[GP0_SRC] = &gp0_src.clkr,
|
||||
[GP0_CLK] = &gp0_clk.clkr,
|
||||
[GP1_SRC] = &gp1_src.clkr,
|
||||
[GP1_CLK] = &gp1_clk.clkr,
|
||||
[GP2_SRC] = &gp2_src.clkr,
|
||||
[GP2_CLK] = &gp2_clk.clkr,
|
||||
[PMEM_A_CLK] = &pmem_clk.clkr,
|
||||
[PRNG_SRC] = &prng_src.clkr,
|
||||
[PRNG_CLK] = &prng_clk.clkr,
|
||||
[SDC1_SRC] = &sdc1_src.clkr,
|
||||
[SDC1_CLK] = &sdc1_clk.clkr,
|
||||
[SDC2_SRC] = &sdc2_src.clkr,
|
||||
[SDC2_CLK] = &sdc2_clk.clkr,
|
||||
[SDC3_SRC] = &sdc3_src.clkr,
|
||||
[SDC3_CLK] = &sdc3_clk.clkr,
|
||||
[SDC4_SRC] = &sdc4_src.clkr,
|
||||
[SDC4_CLK] = &sdc4_clk.clkr,
|
||||
[TSIF_REF_SRC] = &tsif_ref_src.clkr,
|
||||
[TSIF_REF_CLK] = &tsif_ref_clk.clkr,
|
||||
[USB_HS1_XCVR_SRC] = &usb_hs1_xcvr_src.clkr,
|
||||
[USB_HS1_XCVR_CLK] = &usb_hs1_xcvr_clk.clkr,
|
||||
[USB_HS3_XCVR_SRC] = &usb_hs3_xcvr_src.clkr,
|
||||
[USB_HS3_XCVR_CLK] = &usb_hs3_xcvr_clk.clkr,
|
||||
[USB_HS4_XCVR_SRC] = &usb_hs4_xcvr_src.clkr,
|
||||
[USB_HS4_XCVR_CLK] = &usb_hs4_xcvr_clk.clkr,
|
||||
[USB_HSIC_XCVR_FS_SRC] = &usb_hsic_xcvr_fs_src.clkr,
|
||||
[USB_HSIC_XCVR_FS_CLK] = &usb_hsic_xcvr_fs_clk.clkr,
|
||||
[USB_HSIC_SYSTEM_CLK] = &usb_hsic_system_clk.clkr,
|
||||
[USB_HSIC_HSIC_CLK] = &usb_hsic_hsic_clk.clkr,
|
||||
[USB_HSIC_HSIO_CAL_CLK] = &usb_hsic_hsio_cal_clk.clkr,
|
||||
[USB_FS1_XCVR_FS_SRC] = &usb_fs1_xcvr_fs_src.clkr,
|
||||
[USB_FS1_XCVR_FS_CLK] = &usb_fs1_xcvr_fs_clk.clkr,
|
||||
[USB_FS1_SYSTEM_CLK] = &usb_fs1_system_clk.clkr,
|
||||
[SATA_H_CLK] = &sata_h_clk.clkr,
|
||||
[SATA_CLK_SRC] = &sata_clk_src.clkr,
|
||||
[SATA_RXOOB_CLK] = &sata_rxoob_clk.clkr,
|
||||
[SATA_PMALIVE_CLK] = &sata_pmalive_clk.clkr,
|
||||
[SATA_PHY_REF_CLK] = &sata_phy_ref_clk.clkr,
|
||||
[SATA_PHY_CFG_CLK] = &sata_phy_cfg_clk.clkr,
|
||||
[SATA_A_CLK] = &sata_a_clk.clkr,
|
||||
[SFAB_SATA_S_H_CLK] = &sfab_sata_s_h_clk.clkr,
|
||||
[CE3_SRC] = &ce3_src.clkr,
|
||||
[CE3_CORE_CLK] = &ce3_core_clk.clkr,
|
||||
[CE3_H_CLK] = &ce3_h_clk.clkr,
|
||||
[DMA_BAM_H_CLK] = &dma_bam_h_clk.clkr,
|
||||
[GSBI1_H_CLK] = &gsbi1_h_clk.clkr,
|
||||
[GSBI2_H_CLK] = &gsbi2_h_clk.clkr,
|
||||
[GSBI3_H_CLK] = &gsbi3_h_clk.clkr,
|
||||
[GSBI4_H_CLK] = &gsbi4_h_clk.clkr,
|
||||
[GSBI5_H_CLK] = &gsbi5_h_clk.clkr,
|
||||
[GSBI6_H_CLK] = &gsbi6_h_clk.clkr,
|
||||
[GSBI7_H_CLK] = &gsbi7_h_clk.clkr,
|
||||
[TSIF_H_CLK] = &tsif_h_clk.clkr,
|
||||
[USB_FS1_H_CLK] = &usb_fs1_h_clk.clkr,
|
||||
[USB_HS1_H_CLK] = &usb_hs1_h_clk.clkr,
|
||||
[USB_HSIC_H_CLK] = &usb_hsic_h_clk.clkr,
|
||||
[USB_HS3_H_CLK] = &usb_hs3_h_clk.clkr,
|
||||
[USB_HS4_H_CLK] = &usb_hs4_h_clk.clkr,
|
||||
[SDC1_H_CLK] = &sdc1_h_clk.clkr,
|
||||
[SDC2_H_CLK] = &sdc2_h_clk.clkr,
|
||||
[SDC3_H_CLK] = &sdc3_h_clk.clkr,
|
||||
[SDC4_H_CLK] = &sdc4_h_clk.clkr,
|
||||
[ADM0_CLK] = &adm0_clk.clkr,
|
||||
[ADM0_PBUS_CLK] = &adm0_pbus_clk.clkr,
|
||||
[PCIE_A_CLK] = &pcie_a_clk.clkr,
|
||||
[PCIE_PHY_REF_CLK] = &pcie_phy_ref_clk.clkr,
|
||||
[PCIE_H_CLK] = &pcie_h_clk.clkr,
|
||||
[PMIC_ARB0_H_CLK] = &pmic_arb0_h_clk.clkr,
|
||||
[PMIC_ARB1_H_CLK] = &pmic_arb1_h_clk.clkr,
|
||||
[PMIC_SSBI2_CLK] = &pmic_ssbi2_clk.clkr,
|
||||
[RPM_MSG_RAM_H_CLK] = &rpm_msg_ram_h_clk.clkr,
|
||||
};
|
||||
|
||||
static const struct qcom_reset_map gcc_apq8064_resets[] = {
|
||||
[QDSS_STM_RESET] = { 0x2060, 6 },
|
||||
[AFAB_SMPSS_S_RESET] = { 0x20b8, 2 },
|
||||
[AFAB_SMPSS_M1_RESET] = { 0x20b8, 1 },
|
||||
[AFAB_SMPSS_M0_RESET] = { 0x20b8 },
|
||||
[AFAB_EBI1_CH0_RESET] = { 0x20c0, 7 },
|
||||
[AFAB_EBI1_CH1_RESET] = { 0x20c4, 7},
|
||||
[SFAB_ADM0_M0_RESET] = { 0x21e0, 7 },
|
||||
[SFAB_ADM0_M1_RESET] = { 0x21e4, 7 },
|
||||
[SFAB_ADM0_M2_RESET] = { 0x21e8, 7 },
|
||||
[ADM0_C2_RESET] = { 0x220c, 4},
|
||||
[ADM0_C1_RESET] = { 0x220c, 3},
|
||||
[ADM0_C0_RESET] = { 0x220c, 2},
|
||||
[ADM0_PBUS_RESET] = { 0x220c, 1 },
|
||||
[ADM0_RESET] = { 0x220c },
|
||||
[QDSS_CLKS_SW_RESET] = { 0x2260, 5 },
|
||||
[QDSS_POR_RESET] = { 0x2260, 4 },
|
||||
[QDSS_TSCTR_RESET] = { 0x2260, 3 },
|
||||
[QDSS_HRESET_RESET] = { 0x2260, 2 },
|
||||
[QDSS_AXI_RESET] = { 0x2260, 1 },
|
||||
[QDSS_DBG_RESET] = { 0x2260 },
|
||||
[SFAB_PCIE_M_RESET] = { 0x22d8, 1 },
|
||||
[SFAB_PCIE_S_RESET] = { 0x22d8 },
|
||||
[PCIE_EXT_PCI_RESET] = { 0x22dc, 6 },
|
||||
[PCIE_PHY_RESET] = { 0x22dc, 5 },
|
||||
[PCIE_PCI_RESET] = { 0x22dc, 4 },
|
||||
[PCIE_POR_RESET] = { 0x22dc, 3 },
|
||||
[PCIE_HCLK_RESET] = { 0x22dc, 2 },
|
||||
[PCIE_ACLK_RESET] = { 0x22dc },
|
||||
[SFAB_USB3_M_RESET] = { 0x2360, 7 },
|
||||
[SFAB_RIVA_M_RESET] = { 0x2380, 7 },
|
||||
[SFAB_LPASS_RESET] = { 0x23a0, 7 },
|
||||
[SFAB_AFAB_M_RESET] = { 0x23e0, 7 },
|
||||
[AFAB_SFAB_M0_RESET] = { 0x2420, 7 },
|
||||
[AFAB_SFAB_M1_RESET] = { 0x2424, 7 },
|
||||
[SFAB_SATA_S_RESET] = { 0x2480, 7 },
|
||||
[SFAB_DFAB_M_RESET] = { 0x2500, 7 },
|
||||
[DFAB_SFAB_M_RESET] = { 0x2520, 7 },
|
||||
[DFAB_SWAY0_RESET] = { 0x2540, 7 },
|
||||
[DFAB_SWAY1_RESET] = { 0x2544, 7 },
|
||||
[DFAB_ARB0_RESET] = { 0x2560, 7 },
|
||||
[DFAB_ARB1_RESET] = { 0x2564, 7 },
|
||||
[PPSS_PROC_RESET] = { 0x2594, 1 },
|
||||
[PPSS_RESET] = { 0x2594},
|
||||
[DMA_BAM_RESET] = { 0x25c0, 7 },
|
||||
[SPS_TIC_H_RESET] = { 0x2600, 7 },
|
||||
[SFAB_CFPB_M_RESET] = { 0x2680, 7 },
|
||||
[SFAB_CFPB_S_RESET] = { 0x26c0, 7 },
|
||||
[TSIF_H_RESET] = { 0x2700, 7 },
|
||||
[CE1_H_RESET] = { 0x2720, 7 },
|
||||
[CE1_CORE_RESET] = { 0x2724, 7 },
|
||||
[CE1_SLEEP_RESET] = { 0x2728, 7 },
|
||||
[CE2_H_RESET] = { 0x2740, 7 },
|
||||
[CE2_CORE_RESET] = { 0x2744, 7 },
|
||||
[SFAB_SFPB_M_RESET] = { 0x2780, 7 },
|
||||
[SFAB_SFPB_S_RESET] = { 0x27a0, 7 },
|
||||
[RPM_PROC_RESET] = { 0x27c0, 7 },
|
||||
[PMIC_SSBI2_RESET] = { 0x280c, 12 },
|
||||
[SDC1_RESET] = { 0x2830 },
|
||||
[SDC2_RESET] = { 0x2850 },
|
||||
[SDC3_RESET] = { 0x2870 },
|
||||
[SDC4_RESET] = { 0x2890 },
|
||||
[USB_HS1_RESET] = { 0x2910 },
|
||||
[USB_HSIC_RESET] = { 0x2934 },
|
||||
[USB_FS1_XCVR_RESET] = { 0x2974, 1 },
|
||||
[USB_FS1_RESET] = { 0x2974 },
|
||||
[GSBI1_RESET] = { 0x29dc },
|
||||
[GSBI2_RESET] = { 0x29fc },
|
||||
[GSBI3_RESET] = { 0x2a1c },
|
||||
[GSBI4_RESET] = { 0x2a3c },
|
||||
[GSBI5_RESET] = { 0x2a5c },
|
||||
[GSBI6_RESET] = { 0x2a7c },
|
||||
[GSBI7_RESET] = { 0x2a9c },
|
||||
[SPDM_RESET] = { 0x2b6c },
|
||||
[TLMM_H_RESET] = { 0x2ba0, 7 },
|
||||
[SATA_SFAB_M_RESET] = { 0x2c18 },
|
||||
[SATA_RESET] = { 0x2c1c },
|
||||
[GSS_SLP_RESET] = { 0x2c60, 7 },
|
||||
[GSS_RESET] = { 0x2c64 },
|
||||
[TSSC_RESET] = { 0x2ca0, 7 },
|
||||
[PDM_RESET] = { 0x2cc0, 12 },
|
||||
[MPM_H_RESET] = { 0x2da0, 7 },
|
||||
[MPM_RESET] = { 0x2da4 },
|
||||
[SFAB_SMPSS_S_RESET] = { 0x2e00, 7 },
|
||||
[PRNG_RESET] = { 0x2e80, 12 },
|
||||
[RIVA_RESET] = { 0x35e0 },
|
||||
[CE3_H_RESET] = { 0x36c4, 7 },
|
||||
[SFAB_CE3_M_RESET] = { 0x36c8, 1 },
|
||||
[SFAB_CE3_S_RESET] = { 0x36c8 },
|
||||
[CE3_RESET] = { 0x36cc, 7 },
|
||||
[CE3_SLEEP_RESET] = { 0x36d0, 7 },
|
||||
[USB_HS3_RESET] = { 0x3710 },
|
||||
[USB_HS4_RESET] = { 0x3730 },
|
||||
};
|
||||
|
||||
static const struct regmap_config gcc_msm8960_regmap_config = {
|
||||
|
@ -2886,6 +3455,14 @@ static const struct regmap_config gcc_msm8960_regmap_config = {
|
|||
.fast_io = true,
|
||||
};
|
||||
|
||||
static const struct regmap_config gcc_apq8064_regmap_config = {
|
||||
.reg_bits = 32,
|
||||
.reg_stride = 4,
|
||||
.val_bits = 32,
|
||||
.max_register = 0x3880,
|
||||
.fast_io = true,
|
||||
};
|
||||
|
||||
static const struct qcom_cc_desc gcc_msm8960_desc = {
|
||||
.config = &gcc_msm8960_regmap_config,
|
||||
.clks = gcc_msm8960_clks,
|
||||
|
@ -2895,11 +3472,11 @@ static const struct qcom_cc_desc gcc_msm8960_desc = {
|
|||
};
|
||||
|
||||
static const struct qcom_cc_desc gcc_apq8064_desc = {
|
||||
.config = &gcc_msm8960_regmap_config,
|
||||
.config = &gcc_apq8064_regmap_config,
|
||||
.clks = gcc_apq8064_clks,
|
||||
.num_clks = ARRAY_SIZE(gcc_apq8064_clks),
|
||||
.resets = gcc_msm8960_resets,
|
||||
.num_resets = ARRAY_SIZE(gcc_msm8960_resets),
|
||||
.resets = gcc_apq8064_resets,
|
||||
.num_resets = ARRAY_SIZE(gcc_apq8064_resets),
|
||||
};
|
||||
|
||||
static const struct of_device_id gcc_msm8960_match_table[] = {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -37,6 +37,9 @@
|
|||
#define P_PLL8 1
|
||||
#define P_PLL2 2
|
||||
#define P_PLL3 3
|
||||
#define P_PLL15 3
|
||||
|
||||
#define F_MN(f, s, _m, _n) { .freq = f, .src = s, .m = _m, .n = _n }
|
||||
|
||||
static u8 mmcc_pxo_pll8_pll2_map[] = {
|
||||
[P_PXO] = 0,
|
||||
|
@ -57,10 +60,24 @@ static u8 mmcc_pxo_pll8_pll2_pll3_map[] = {
|
|||
[P_PLL3] = 3,
|
||||
};
|
||||
|
||||
static const char *mmcc_pxo_pll8_pll2_pll15[] = {
|
||||
"pxo",
|
||||
"pll8_vote",
|
||||
"pll2",
|
||||
"pll15",
|
||||
};
|
||||
|
||||
static u8 mmcc_pxo_pll8_pll2_pll15_map[] = {
|
||||
[P_PXO] = 0,
|
||||
[P_PLL8] = 2,
|
||||
[P_PLL2] = 1,
|
||||
[P_PLL15] = 3,
|
||||
};
|
||||
|
||||
static const char *mmcc_pxo_pll8_pll2_pll3[] = {
|
||||
"pxo",
|
||||
"pll2",
|
||||
"pll8_vote",
|
||||
"pll2",
|
||||
"pll3",
|
||||
};
|
||||
|
||||
|
@ -80,6 +97,36 @@ static struct clk_pll pll2 = {
|
|||
},
|
||||
};
|
||||
|
||||
static struct clk_pll pll15 = {
|
||||
.l_reg = 0x33c,
|
||||
.m_reg = 0x340,
|
||||
.n_reg = 0x344,
|
||||
.config_reg = 0x348,
|
||||
.mode_reg = 0x338,
|
||||
.status_reg = 0x350,
|
||||
.status_bit = 16,
|
||||
.clkr.hw.init = &(struct clk_init_data){
|
||||
.name = "pll15",
|
||||
.parent_names = (const char *[]){ "pxo" },
|
||||
.num_parents = 1,
|
||||
.ops = &clk_pll_ops,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct pll_config pll15_config = {
|
||||
.l = 33,
|
||||
.m = 1,
|
||||
.n = 3,
|
||||
.vco_val = 0x2 << 16,
|
||||
.vco_mask = 0x3 << 16,
|
||||
.pre_div_val = 0x0,
|
||||
.pre_div_mask = BIT(19),
|
||||
.post_div_val = 0x0,
|
||||
.post_div_mask = 0x3 << 20,
|
||||
.mn_ena_mask = BIT(22),
|
||||
.main_output_mask = BIT(23),
|
||||
};
|
||||
|
||||
static struct freq_tbl clk_tbl_cam[] = {
|
||||
{ 6000000, P_PLL8, 4, 1, 16 },
|
||||
{ 8000000, P_PLL8, 4, 1, 12 },
|
||||
|
@ -710,18 +757,18 @@ static struct clk_branch csiphy2_timer_clk = {
|
|||
};
|
||||
|
||||
static struct freq_tbl clk_tbl_gfx2d[] = {
|
||||
{ 27000000, P_PXO, 1, 0 },
|
||||
{ 48000000, P_PLL8, 1, 8 },
|
||||
{ 54857000, P_PLL8, 1, 7 },
|
||||
{ 64000000, P_PLL8, 1, 6 },
|
||||
{ 76800000, P_PLL8, 1, 5 },
|
||||
{ 96000000, P_PLL8, 1, 4 },
|
||||
{ 128000000, P_PLL8, 1, 3 },
|
||||
{ 145455000, P_PLL2, 2, 11 },
|
||||
{ 160000000, P_PLL2, 1, 5 },
|
||||
{ 177778000, P_PLL2, 2, 9 },
|
||||
{ 200000000, P_PLL2, 1, 4 },
|
||||
{ 228571000, P_PLL2, 2, 7 },
|
||||
F_MN( 27000000, P_PXO, 1, 0),
|
||||
F_MN( 48000000, P_PLL8, 1, 8),
|
||||
F_MN( 54857000, P_PLL8, 1, 7),
|
||||
F_MN( 64000000, P_PLL8, 1, 6),
|
||||
F_MN( 76800000, P_PLL8, 1, 5),
|
||||
F_MN( 96000000, P_PLL8, 1, 4),
|
||||
F_MN(128000000, P_PLL8, 1, 3),
|
||||
F_MN(145455000, P_PLL2, 2, 11),
|
||||
F_MN(160000000, P_PLL2, 1, 5),
|
||||
F_MN(177778000, P_PLL2, 2, 9),
|
||||
F_MN(200000000, P_PLL2, 1, 4),
|
||||
F_MN(228571000, P_PLL2, 2, 7),
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -842,22 +889,43 @@ static struct clk_branch gfx2d1_clk = {
|
|||
};
|
||||
|
||||
static struct freq_tbl clk_tbl_gfx3d[] = {
|
||||
{ 27000000, P_PXO, 1, 0 },
|
||||
{ 48000000, P_PLL8, 1, 8 },
|
||||
{ 54857000, P_PLL8, 1, 7 },
|
||||
{ 64000000, P_PLL8, 1, 6 },
|
||||
{ 76800000, P_PLL8, 1, 5 },
|
||||
{ 96000000, P_PLL8, 1, 4 },
|
||||
{ 128000000, P_PLL8, 1, 3 },
|
||||
{ 145455000, P_PLL2, 2, 11 },
|
||||
{ 160000000, P_PLL2, 1, 5 },
|
||||
{ 177778000, P_PLL2, 2, 9 },
|
||||
{ 200000000, P_PLL2, 1, 4 },
|
||||
{ 228571000, P_PLL2, 2, 7 },
|
||||
{ 266667000, P_PLL2, 1, 3 },
|
||||
{ 300000000, P_PLL3, 1, 4 },
|
||||
{ 320000000, P_PLL2, 2, 5 },
|
||||
{ 400000000, P_PLL2, 1, 2 },
|
||||
F_MN( 27000000, P_PXO, 1, 0),
|
||||
F_MN( 48000000, P_PLL8, 1, 8),
|
||||
F_MN( 54857000, P_PLL8, 1, 7),
|
||||
F_MN( 64000000, P_PLL8, 1, 6),
|
||||
F_MN( 76800000, P_PLL8, 1, 5),
|
||||
F_MN( 96000000, P_PLL8, 1, 4),
|
||||
F_MN(128000000, P_PLL8, 1, 3),
|
||||
F_MN(145455000, P_PLL2, 2, 11),
|
||||
F_MN(160000000, P_PLL2, 1, 5),
|
||||
F_MN(177778000, P_PLL2, 2, 9),
|
||||
F_MN(200000000, P_PLL2, 1, 4),
|
||||
F_MN(228571000, P_PLL2, 2, 7),
|
||||
F_MN(266667000, P_PLL2, 1, 3),
|
||||
F_MN(300000000, P_PLL3, 1, 4),
|
||||
F_MN(320000000, P_PLL2, 2, 5),
|
||||
F_MN(400000000, P_PLL2, 1, 2),
|
||||
{ }
|
||||
};
|
||||
|
||||
static struct freq_tbl clk_tbl_gfx3d_8064[] = {
|
||||
F_MN( 27000000, P_PXO, 0, 0),
|
||||
F_MN( 48000000, P_PLL8, 1, 8),
|
||||
F_MN( 54857000, P_PLL8, 1, 7),
|
||||
F_MN( 64000000, P_PLL8, 1, 6),
|
||||
F_MN( 76800000, P_PLL8, 1, 5),
|
||||
F_MN( 96000000, P_PLL8, 1, 4),
|
||||
F_MN(128000000, P_PLL8, 1, 3),
|
||||
F_MN(145455000, P_PLL2, 2, 11),
|
||||
F_MN(160000000, P_PLL2, 1, 5),
|
||||
F_MN(177778000, P_PLL2, 2, 9),
|
||||
F_MN(192000000, P_PLL8, 1, 2),
|
||||
F_MN(200000000, P_PLL2, 1, 4),
|
||||
F_MN(228571000, P_PLL2, 2, 7),
|
||||
F_MN(266667000, P_PLL2, 1, 3),
|
||||
F_MN(320000000, P_PLL2, 2, 5),
|
||||
F_MN(400000000, P_PLL2, 1, 2),
|
||||
F_MN(450000000, P_PLL15, 1, 2),
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -897,12 +965,19 @@ static struct clk_dyn_rcg gfx3d_src = {
|
|||
.hw.init = &(struct clk_init_data){
|
||||
.name = "gfx3d_src",
|
||||
.parent_names = mmcc_pxo_pll8_pll2_pll3,
|
||||
.num_parents = 3,
|
||||
.num_parents = 4,
|
||||
.ops = &clk_dyn_rcg_ops,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static const struct clk_init_data gfx3d_8064_init = {
|
||||
.name = "gfx3d_src",
|
||||
.parent_names = mmcc_pxo_pll8_pll2_pll15,
|
||||
.num_parents = 4,
|
||||
.ops = &clk_dyn_rcg_ops,
|
||||
};
|
||||
|
||||
static struct clk_branch gfx3d_clk = {
|
||||
.halt_reg = 0x01c8,
|
||||
.halt_bit = 4,
|
||||
|
@ -919,6 +994,91 @@ static struct clk_branch gfx3d_clk = {
|
|||
},
|
||||
};
|
||||
|
||||
static struct freq_tbl clk_tbl_vcap[] = {
|
||||
F_MN( 27000000, P_PXO, 0, 0),
|
||||
F_MN( 54860000, P_PLL8, 1, 7),
|
||||
F_MN( 64000000, P_PLL8, 1, 6),
|
||||
F_MN( 76800000, P_PLL8, 1, 5),
|
||||
F_MN(128000000, P_PLL8, 1, 3),
|
||||
F_MN(160000000, P_PLL2, 1, 5),
|
||||
F_MN(200000000, P_PLL2, 1, 4),
|
||||
{ }
|
||||
};
|
||||
|
||||
static struct clk_dyn_rcg vcap_src = {
|
||||
.ns_reg = 0x021c,
|
||||
.md_reg[0] = 0x01ec,
|
||||
.md_reg[1] = 0x0218,
|
||||
.mn[0] = {
|
||||
.mnctr_en_bit = 8,
|
||||
.mnctr_reset_bit = 23,
|
||||
.mnctr_mode_shift = 9,
|
||||
.n_val_shift = 18,
|
||||
.m_val_shift = 4,
|
||||
.width = 4,
|
||||
},
|
||||
.mn[1] = {
|
||||
.mnctr_en_bit = 5,
|
||||
.mnctr_reset_bit = 22,
|
||||
.mnctr_mode_shift = 6,
|
||||
.n_val_shift = 14,
|
||||
.m_val_shift = 4,
|
||||
.width = 4,
|
||||
},
|
||||
.s[0] = {
|
||||
.src_sel_shift = 3,
|
||||
.parent_map = mmcc_pxo_pll8_pll2_map,
|
||||
},
|
||||
.s[1] = {
|
||||
.src_sel_shift = 0,
|
||||
.parent_map = mmcc_pxo_pll8_pll2_map,
|
||||
},
|
||||
.mux_sel_bit = 11,
|
||||
.freq_tbl = clk_tbl_vcap,
|
||||
.clkr = {
|
||||
.enable_reg = 0x0178,
|
||||
.enable_mask = BIT(2),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "vcap_src",
|
||||
.parent_names = mmcc_pxo_pll8_pll2,
|
||||
.num_parents = 3,
|
||||
.ops = &clk_dyn_rcg_ops,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch vcap_clk = {
|
||||
.halt_reg = 0x0240,
|
||||
.halt_bit = 15,
|
||||
.clkr = {
|
||||
.enable_reg = 0x0178,
|
||||
.enable_mask = BIT(0),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "vcap_clk",
|
||||
.parent_names = (const char *[]){ "vcap_src" },
|
||||
.num_parents = 1,
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_SET_RATE_PARENT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch vcap_npl_clk = {
|
||||
.halt_reg = 0x0240,
|
||||
.halt_bit = 25,
|
||||
.clkr = {
|
||||
.enable_reg = 0x0178,
|
||||
.enable_mask = BIT(13),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "vcap_npl_clk",
|
||||
.parent_names = (const char *[]){ "vcap_src" },
|
||||
.num_parents = 1,
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_SET_RATE_PARENT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct freq_tbl clk_tbl_ijpeg[] = {
|
||||
{ 27000000, P_PXO, 1, 0, 0 },
|
||||
{ 36570000, P_PLL8, 1, 2, 21 },
|
||||
|
@ -995,7 +1155,7 @@ static struct clk_rcg jpegd_src = {
|
|||
.ns_reg = 0x00ac,
|
||||
.p = {
|
||||
.pre_div_shift = 12,
|
||||
.pre_div_width = 2,
|
||||
.pre_div_width = 4,
|
||||
},
|
||||
.s = {
|
||||
.src_sel_shift = 0,
|
||||
|
@ -1115,7 +1275,7 @@ static struct clk_branch mdp_lut_clk = {
|
|||
.enable_reg = 0x016c,
|
||||
.enable_mask = BIT(0),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.parent_names = (const char *[]){ "mdp_clk" },
|
||||
.parent_names = (const char *[]){ "mdp_src" },
|
||||
.num_parents = 1,
|
||||
.name = "mdp_lut_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
|
@ -1218,12 +1378,7 @@ static const char *mmcc_pxo_hdmi[] = {
|
|||
};
|
||||
|
||||
static struct freq_tbl clk_tbl_tv[] = {
|
||||
{ 25200000, P_HDMI_PLL, 1, 0, 0 },
|
||||
{ 27000000, P_HDMI_PLL, 1, 0, 0 },
|
||||
{ 27030000, P_HDMI_PLL, 1, 0, 0 },
|
||||
{ 74250000, P_HDMI_PLL, 1, 0, 0 },
|
||||
{ 108000000, P_HDMI_PLL, 1, 0, 0 },
|
||||
{ 148500000, P_HDMI_PLL, 1, 0, 0 },
|
||||
{ .src = P_HDMI_PLL, .pre_div = 1 },
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -1254,7 +1409,7 @@ static struct clk_rcg tv_src = {
|
|||
.name = "tv_src",
|
||||
.parent_names = mmcc_pxo_hdmi,
|
||||
.num_parents = 2,
|
||||
.ops = &clk_rcg_ops,
|
||||
.ops = &clk_rcg_bypass_ops,
|
||||
.flags = CLK_SET_RATE_PARENT,
|
||||
},
|
||||
},
|
||||
|
@ -1326,6 +1481,38 @@ static struct clk_branch hdmi_tv_clk = {
|
|||
},
|
||||
};
|
||||
|
||||
static struct clk_branch rgb_tv_clk = {
|
||||
.halt_reg = 0x0240,
|
||||
.halt_bit = 27,
|
||||
.clkr = {
|
||||
.enable_reg = 0x0124,
|
||||
.enable_mask = BIT(14),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.parent_names = tv_src_name,
|
||||
.num_parents = 1,
|
||||
.name = "rgb_tv_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_SET_RATE_PARENT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch npl_tv_clk = {
|
||||
.halt_reg = 0x0240,
|
||||
.halt_bit = 26,
|
||||
.clkr = {
|
||||
.enable_reg = 0x0124,
|
||||
.enable_mask = BIT(16),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.parent_names = tv_src_name,
|
||||
.num_parents = 1,
|
||||
.name = "npl_tv_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_SET_RATE_PARENT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch hdmi_app_clk = {
|
||||
.halt_reg = 0x01cc,
|
||||
.halt_bit = 25,
|
||||
|
@ -1342,15 +1529,15 @@ static struct clk_branch hdmi_app_clk = {
|
|||
};
|
||||
|
||||
static struct freq_tbl clk_tbl_vcodec[] = {
|
||||
{ 27000000, P_PXO, 1, 0 },
|
||||
{ 32000000, P_PLL8, 1, 12 },
|
||||
{ 48000000, P_PLL8, 1, 8 },
|
||||
{ 54860000, P_PLL8, 1, 7 },
|
||||
{ 96000000, P_PLL8, 1, 4 },
|
||||
{ 133330000, P_PLL2, 1, 6 },
|
||||
{ 200000000, P_PLL2, 1, 4 },
|
||||
{ 228570000, P_PLL2, 2, 7 },
|
||||
{ 266670000, P_PLL2, 1, 3 },
|
||||
F_MN( 27000000, P_PXO, 1, 0),
|
||||
F_MN( 32000000, P_PLL8, 1, 12),
|
||||
F_MN( 48000000, P_PLL8, 1, 8),
|
||||
F_MN( 54860000, P_PLL8, 1, 7),
|
||||
F_MN( 96000000, P_PLL8, 1, 4),
|
||||
F_MN(133330000, P_PLL2, 1, 6),
|
||||
F_MN(200000000, P_PLL2, 1, 4),
|
||||
F_MN(228570000, P_PLL2, 2, 7),
|
||||
F_MN(266670000, P_PLL2, 1, 3),
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -1701,6 +1888,22 @@ static struct clk_branch rot_axi_clk = {
|
|||
},
|
||||
};
|
||||
|
||||
static struct clk_branch vcap_axi_clk = {
|
||||
.halt_reg = 0x0240,
|
||||
.halt_bit = 20,
|
||||
.hwcg_reg = 0x0244,
|
||||
.hwcg_bit = 11,
|
||||
.clkr = {
|
||||
.enable_reg = 0x0244,
|
||||
.enable_mask = BIT(12),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "vcap_axi_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_IS_ROOT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch vpe_axi_clk = {
|
||||
.hwcg_reg = 0x0020,
|
||||
.hwcg_bit = 27,
|
||||
|
@ -2003,6 +2206,20 @@ static struct clk_branch tv_enc_ahb_clk = {
|
|||
},
|
||||
};
|
||||
|
||||
static struct clk_branch vcap_ahb_clk = {
|
||||
.halt_reg = 0x0240,
|
||||
.halt_bit = 23,
|
||||
.clkr = {
|
||||
.enable_reg = 0x0248,
|
||||
.enable_mask = BIT(1),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "vcap_ahb_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
.flags = CLK_IS_ROOT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch vcodec_ahb_clk = {
|
||||
.hwcg_reg = 0x0038,
|
||||
.hwcg_bit = 26,
|
||||
|
@ -2215,6 +2432,175 @@ static const struct qcom_reset_map mmcc_msm8960_resets[] = {
|
|||
[CSI_RDI2_RESET] = { 0x0214 },
|
||||
};
|
||||
|
||||
static struct clk_regmap *mmcc_apq8064_clks[] = {
|
||||
[AMP_AHB_CLK] = &_ahb_clk.clkr,
|
||||
[DSI2_S_AHB_CLK] = &dsi2_s_ahb_clk.clkr,
|
||||
[JPEGD_AHB_CLK] = &jpegd_ahb_clk.clkr,
|
||||
[DSI_S_AHB_CLK] = &dsi_s_ahb_clk.clkr,
|
||||
[DSI2_M_AHB_CLK] = &dsi2_m_ahb_clk.clkr,
|
||||
[VPE_AHB_CLK] = &vpe_ahb_clk.clkr,
|
||||
[SMMU_AHB_CLK] = &smmu_ahb_clk.clkr,
|
||||
[HDMI_M_AHB_CLK] = &hdmi_m_ahb_clk.clkr,
|
||||
[VFE_AHB_CLK] = &vfe_ahb_clk.clkr,
|
||||
[ROT_AHB_CLK] = &rot_ahb_clk.clkr,
|
||||
[VCODEC_AHB_CLK] = &vcodec_ahb_clk.clkr,
|
||||
[MDP_AHB_CLK] = &mdp_ahb_clk.clkr,
|
||||
[DSI_M_AHB_CLK] = &dsi_m_ahb_clk.clkr,
|
||||
[CSI_AHB_CLK] = &csi_ahb_clk.clkr,
|
||||
[MMSS_IMEM_AHB_CLK] = &mmss_imem_ahb_clk.clkr,
|
||||
[IJPEG_AHB_CLK] = &ijpeg_ahb_clk.clkr,
|
||||
[HDMI_S_AHB_CLK] = &hdmi_s_ahb_clk.clkr,
|
||||
[GFX3D_AHB_CLK] = &gfx3d_ahb_clk.clkr,
|
||||
[JPEGD_AXI_CLK] = &jpegd_axi_clk.clkr,
|
||||
[GMEM_AXI_CLK] = &gmem_axi_clk.clkr,
|
||||
[MDP_AXI_CLK] = &mdp_axi_clk.clkr,
|
||||
[MMSS_IMEM_AXI_CLK] = &mmss_imem_axi_clk.clkr,
|
||||
[IJPEG_AXI_CLK] = &ijpeg_axi_clk.clkr,
|
||||
[GFX3D_AXI_CLK] = &gfx3d_axi_clk.clkr,
|
||||
[VCODEC_AXI_CLK] = &vcodec_axi_clk.clkr,
|
||||
[VFE_AXI_CLK] = &vfe_axi_clk.clkr,
|
||||
[VPE_AXI_CLK] = &vpe_axi_clk.clkr,
|
||||
[ROT_AXI_CLK] = &rot_axi_clk.clkr,
|
||||
[VCODEC_AXI_A_CLK] = &vcodec_axi_a_clk.clkr,
|
||||
[VCODEC_AXI_B_CLK] = &vcodec_axi_b_clk.clkr,
|
||||
[CSI0_SRC] = &csi0_src.clkr,
|
||||
[CSI0_CLK] = &csi0_clk.clkr,
|
||||
[CSI0_PHY_CLK] = &csi0_phy_clk.clkr,
|
||||
[CSI1_SRC] = &csi1_src.clkr,
|
||||
[CSI1_CLK] = &csi1_clk.clkr,
|
||||
[CSI1_PHY_CLK] = &csi1_phy_clk.clkr,
|
||||
[CSI2_SRC] = &csi2_src.clkr,
|
||||
[CSI2_CLK] = &csi2_clk.clkr,
|
||||
[CSI2_PHY_CLK] = &csi2_phy_clk.clkr,
|
||||
[CSI_PIX_CLK] = &csi_pix_clk.clkr,
|
||||
[CSI_RDI_CLK] = &csi_rdi_clk.clkr,
|
||||
[MDP_VSYNC_CLK] = &mdp_vsync_clk.clkr,
|
||||
[HDMI_APP_CLK] = &hdmi_app_clk.clkr,
|
||||
[CSI_PIX1_CLK] = &csi_pix1_clk.clkr,
|
||||
[CSI_RDI2_CLK] = &csi_rdi2_clk.clkr,
|
||||
[CSI_RDI1_CLK] = &csi_rdi1_clk.clkr,
|
||||
[GFX3D_SRC] = &gfx3d_src.clkr,
|
||||
[GFX3D_CLK] = &gfx3d_clk.clkr,
|
||||
[IJPEG_SRC] = &ijpeg_src.clkr,
|
||||
[IJPEG_CLK] = &ijpeg_clk.clkr,
|
||||
[JPEGD_SRC] = &jpegd_src.clkr,
|
||||
[JPEGD_CLK] = &jpegd_clk.clkr,
|
||||
[MDP_SRC] = &mdp_src.clkr,
|
||||
[MDP_CLK] = &mdp_clk.clkr,
|
||||
[MDP_LUT_CLK] = &mdp_lut_clk.clkr,
|
||||
[ROT_SRC] = &rot_src.clkr,
|
||||
[ROT_CLK] = &rot_clk.clkr,
|
||||
[TV_DAC_CLK] = &tv_dac_clk.clkr,
|
||||
[HDMI_TV_CLK] = &hdmi_tv_clk.clkr,
|
||||
[MDP_TV_CLK] = &mdp_tv_clk.clkr,
|
||||
[TV_SRC] = &tv_src.clkr,
|
||||
[VCODEC_SRC] = &vcodec_src.clkr,
|
||||
[VCODEC_CLK] = &vcodec_clk.clkr,
|
||||
[VFE_SRC] = &vfe_src.clkr,
|
||||
[VFE_CLK] = &vfe_clk.clkr,
|
||||
[VFE_CSI_CLK] = &vfe_csi_clk.clkr,
|
||||
[VPE_SRC] = &vpe_src.clkr,
|
||||
[VPE_CLK] = &vpe_clk.clkr,
|
||||
[CAMCLK0_SRC] = &camclk0_src.clkr,
|
||||
[CAMCLK0_CLK] = &camclk0_clk.clkr,
|
||||
[CAMCLK1_SRC] = &camclk1_src.clkr,
|
||||
[CAMCLK1_CLK] = &camclk1_clk.clkr,
|
||||
[CAMCLK2_SRC] = &camclk2_src.clkr,
|
||||
[CAMCLK2_CLK] = &camclk2_clk.clkr,
|
||||
[CSIPHYTIMER_SRC] = &csiphytimer_src.clkr,
|
||||
[CSIPHY2_TIMER_CLK] = &csiphy2_timer_clk.clkr,
|
||||
[CSIPHY1_TIMER_CLK] = &csiphy1_timer_clk.clkr,
|
||||
[CSIPHY0_TIMER_CLK] = &csiphy0_timer_clk.clkr,
|
||||
[PLL2] = &pll2.clkr,
|
||||
[RGB_TV_CLK] = &rgb_tv_clk.clkr,
|
||||
[NPL_TV_CLK] = &npl_tv_clk.clkr,
|
||||
[VCAP_AHB_CLK] = &vcap_ahb_clk.clkr,
|
||||
[VCAP_AXI_CLK] = &vcap_axi_clk.clkr,
|
||||
[VCAP_SRC] = &vcap_src.clkr,
|
||||
[VCAP_CLK] = &vcap_clk.clkr,
|
||||
[VCAP_NPL_CLK] = &vcap_npl_clk.clkr,
|
||||
[PLL15] = &pll15.clkr,
|
||||
};
|
||||
|
||||
static const struct qcom_reset_map mmcc_apq8064_resets[] = {
|
||||
[GFX3D_AXI_RESET] = { 0x0208, 17 },
|
||||
[VCAP_AXI_RESET] = { 0x0208, 16 },
|
||||
[VPE_AXI_RESET] = { 0x0208, 15 },
|
||||
[IJPEG_AXI_RESET] = { 0x0208, 14 },
|
||||
[MPD_AXI_RESET] = { 0x0208, 13 },
|
||||
[VFE_AXI_RESET] = { 0x0208, 9 },
|
||||
[SP_AXI_RESET] = { 0x0208, 8 },
|
||||
[VCODEC_AXI_RESET] = { 0x0208, 7 },
|
||||
[ROT_AXI_RESET] = { 0x0208, 6 },
|
||||
[VCODEC_AXI_A_RESET] = { 0x0208, 5 },
|
||||
[VCODEC_AXI_B_RESET] = { 0x0208, 4 },
|
||||
[FAB_S3_AXI_RESET] = { 0x0208, 3 },
|
||||
[FAB_S2_AXI_RESET] = { 0x0208, 2 },
|
||||
[FAB_S1_AXI_RESET] = { 0x0208, 1 },
|
||||
[FAB_S0_AXI_RESET] = { 0x0208 },
|
||||
[SMMU_GFX3D_ABH_RESET] = { 0x020c, 31 },
|
||||
[SMMU_VPE_AHB_RESET] = { 0x020c, 30 },
|
||||
[SMMU_VFE_AHB_RESET] = { 0x020c, 29 },
|
||||
[SMMU_ROT_AHB_RESET] = { 0x020c, 28 },
|
||||
[SMMU_VCODEC_B_AHB_RESET] = { 0x020c, 27 },
|
||||
[SMMU_VCODEC_A_AHB_RESET] = { 0x020c, 26 },
|
||||
[SMMU_MDP1_AHB_RESET] = { 0x020c, 25 },
|
||||
[SMMU_MDP0_AHB_RESET] = { 0x020c, 24 },
|
||||
[SMMU_JPEGD_AHB_RESET] = { 0x020c, 23 },
|
||||
[SMMU_IJPEG_AHB_RESET] = { 0x020c, 22 },
|
||||
[APU_AHB_RESET] = { 0x020c, 18 },
|
||||
[CSI_AHB_RESET] = { 0x020c, 17 },
|
||||
[TV_ENC_AHB_RESET] = { 0x020c, 15 },
|
||||
[VPE_AHB_RESET] = { 0x020c, 14 },
|
||||
[FABRIC_AHB_RESET] = { 0x020c, 13 },
|
||||
[GFX3D_AHB_RESET] = { 0x020c, 10 },
|
||||
[HDMI_AHB_RESET] = { 0x020c, 9 },
|
||||
[MSSS_IMEM_AHB_RESET] = { 0x020c, 8 },
|
||||
[IJPEG_AHB_RESET] = { 0x020c, 7 },
|
||||
[DSI_M_AHB_RESET] = { 0x020c, 6 },
|
||||
[DSI_S_AHB_RESET] = { 0x020c, 5 },
|
||||
[JPEGD_AHB_RESET] = { 0x020c, 4 },
|
||||
[MDP_AHB_RESET] = { 0x020c, 3 },
|
||||
[ROT_AHB_RESET] = { 0x020c, 2 },
|
||||
[VCODEC_AHB_RESET] = { 0x020c, 1 },
|
||||
[VFE_AHB_RESET] = { 0x020c, 0 },
|
||||
[SMMU_VCAP_AHB_RESET] = { 0x0200, 3 },
|
||||
[VCAP_AHB_RESET] = { 0x0200, 2 },
|
||||
[DSI2_M_AHB_RESET] = { 0x0200, 1 },
|
||||
[DSI2_S_AHB_RESET] = { 0x0200, 0 },
|
||||
[CSIPHY2_RESET] = { 0x0210, 31 },
|
||||
[CSI_PIX1_RESET] = { 0x0210, 30 },
|
||||
[CSIPHY0_RESET] = { 0x0210, 29 },
|
||||
[CSIPHY1_RESET] = { 0x0210, 28 },
|
||||
[CSI_RDI_RESET] = { 0x0210, 27 },
|
||||
[CSI_PIX_RESET] = { 0x0210, 26 },
|
||||
[DSI2_RESET] = { 0x0210, 25 },
|
||||
[VFE_CSI_RESET] = { 0x0210, 24 },
|
||||
[MDP_RESET] = { 0x0210, 21 },
|
||||
[AMP_RESET] = { 0x0210, 20 },
|
||||
[JPEGD_RESET] = { 0x0210, 19 },
|
||||
[CSI1_RESET] = { 0x0210, 18 },
|
||||
[VPE_RESET] = { 0x0210, 17 },
|
||||
[MMSS_FABRIC_RESET] = { 0x0210, 16 },
|
||||
[VFE_RESET] = { 0x0210, 15 },
|
||||
[GFX3D_RESET] = { 0x0210, 12 },
|
||||
[HDMI_RESET] = { 0x0210, 11 },
|
||||
[MMSS_IMEM_RESET] = { 0x0210, 10 },
|
||||
[IJPEG_RESET] = { 0x0210, 9 },
|
||||
[CSI0_RESET] = { 0x0210, 8 },
|
||||
[DSI_RESET] = { 0x0210, 7 },
|
||||
[VCODEC_RESET] = { 0x0210, 6 },
|
||||
[MDP_TV_RESET] = { 0x0210, 4 },
|
||||
[MDP_VSYNC_RESET] = { 0x0210, 3 },
|
||||
[ROT_RESET] = { 0x0210, 2 },
|
||||
[TV_HDMI_RESET] = { 0x0210, 1 },
|
||||
[VCAP_NPL_RESET] = { 0x0214, 4 },
|
||||
[VCAP_RESET] = { 0x0214, 3 },
|
||||
[CSI2_RESET] = { 0x0214, 2 },
|
||||
[CSI_RDI1_RESET] = { 0x0214, 1 },
|
||||
[CSI_RDI2_RESET] = { 0x0214 },
|
||||
};
|
||||
|
||||
static const struct regmap_config mmcc_msm8960_regmap_config = {
|
||||
.reg_bits = 32,
|
||||
.reg_stride = 4,
|
||||
|
@ -2223,6 +2609,14 @@ static const struct regmap_config mmcc_msm8960_regmap_config = {
|
|||
.fast_io = true,
|
||||
};
|
||||
|
||||
static const struct regmap_config mmcc_apq8064_regmap_config = {
|
||||
.reg_bits = 32,
|
||||
.reg_stride = 4,
|
||||
.val_bits = 32,
|
||||
.max_register = 0x350,
|
||||
.fast_io = true,
|
||||
};
|
||||
|
||||
static const struct qcom_cc_desc mmcc_msm8960_desc = {
|
||||
.config = &mmcc_msm8960_regmap_config,
|
||||
.clks = mmcc_msm8960_clks,
|
||||
|
@ -2231,15 +2625,47 @@ static const struct qcom_cc_desc mmcc_msm8960_desc = {
|
|||
.num_resets = ARRAY_SIZE(mmcc_msm8960_resets),
|
||||
};
|
||||
|
||||
static const struct qcom_cc_desc mmcc_apq8064_desc = {
|
||||
.config = &mmcc_apq8064_regmap_config,
|
||||
.clks = mmcc_apq8064_clks,
|
||||
.num_clks = ARRAY_SIZE(mmcc_apq8064_clks),
|
||||
.resets = mmcc_apq8064_resets,
|
||||
.num_resets = ARRAY_SIZE(mmcc_apq8064_resets),
|
||||
};
|
||||
|
||||
static const struct of_device_id mmcc_msm8960_match_table[] = {
|
||||
{ .compatible = "qcom,mmcc-msm8960" },
|
||||
{ .compatible = "qcom,mmcc-msm8960", .data = &mmcc_msm8960_desc },
|
||||
{ .compatible = "qcom,mmcc-apq8064", .data = &mmcc_apq8064_desc },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, mmcc_msm8960_match_table);
|
||||
|
||||
static int mmcc_msm8960_probe(struct platform_device *pdev)
|
||||
{
|
||||
return qcom_cc_probe(pdev, &mmcc_msm8960_desc);
|
||||
const struct of_device_id *match;
|
||||
struct regmap *regmap;
|
||||
bool is_8064;
|
||||
struct device *dev = &pdev->dev;
|
||||
|
||||
match = of_match_device(mmcc_msm8960_match_table, dev);
|
||||
if (!match)
|
||||
return -EINVAL;
|
||||
|
||||
is_8064 = of_device_is_compatible(dev->of_node, "qcom,mmcc-apq8064");
|
||||
if (is_8064) {
|
||||
gfx3d_src.freq_tbl = clk_tbl_gfx3d_8064;
|
||||
gfx3d_src.clkr.hw.init = &gfx3d_8064_init;
|
||||
gfx3d_src.s[0].parent_map = mmcc_pxo_pll8_pll2_pll15_map;
|
||||
gfx3d_src.s[1].parent_map = mmcc_pxo_pll8_pll2_pll15_map;
|
||||
}
|
||||
|
||||
regmap = qcom_cc_map(pdev, match->data);
|
||||
if (IS_ERR(regmap))
|
||||
return PTR_ERR(regmap);
|
||||
|
||||
clk_pll_configure_sr(&pll15, regmap, &pll15_config, false);
|
||||
|
||||
return qcom_cc_really_probe(pdev, match->data, regmap);
|
||||
}
|
||||
|
||||
static int mmcc_msm8960_remove(struct platform_device *pdev)
|
||||
|
|
|
@ -2547,18 +2547,16 @@ MODULE_DEVICE_TABLE(of, mmcc_msm8974_match_table);
|
|||
|
||||
static int mmcc_msm8974_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret;
|
||||
struct regmap *regmap;
|
||||
|
||||
ret = qcom_cc_probe(pdev, &mmcc_msm8974_desc);
|
||||
if (ret)
|
||||
return ret;
|
||||
regmap = qcom_cc_map(pdev, &mmcc_msm8974_desc);
|
||||
if (IS_ERR(regmap))
|
||||
return PTR_ERR(regmap);
|
||||
|
||||
regmap = dev_get_regmap(&pdev->dev, NULL);
|
||||
clk_pll_configure_sr_hpm_lp(&mmpll1, regmap, &mmpll1_config, true);
|
||||
clk_pll_configure_sr_hpm_lp(&mmpll3, regmap, &mmpll3_config, false);
|
||||
|
||||
return 0;
|
||||
return qcom_cc_really_probe(pdev, &mmcc_msm8974_desc, regmap);
|
||||
}
|
||||
|
||||
static int mmcc_msm8974_remove(struct platform_device *pdev)
|
||||
|
|
|
@ -3,3 +3,9 @@
|
|||
#
|
||||
|
||||
obj-y += clk-rockchip.o
|
||||
obj-y += clk.o
|
||||
obj-y += clk-pll.o
|
||||
obj-$(CONFIG_RESET_CONTROLLER) += softrst.o
|
||||
|
||||
obj-y += clk-rk3188.o
|
||||
obj-y += clk-rk3288.o
|
||||
|
|
|
@ -0,0 +1,431 @@
|
|||
/*
|
||||
* Copyright (c) 2014 MundoReader S.L.
|
||||
* Author: Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <asm/div64.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/regmap.h>
|
||||
#include "clk.h"
|
||||
|
||||
#define PLL_MODE_MASK 0x3
|
||||
#define PLL_MODE_SLOW 0x0
|
||||
#define PLL_MODE_NORM 0x1
|
||||
#define PLL_MODE_DEEP 0x2
|
||||
|
||||
struct rockchip_clk_pll {
|
||||
struct clk_hw hw;
|
||||
|
||||
struct clk_mux pll_mux;
|
||||
const struct clk_ops *pll_mux_ops;
|
||||
|
||||
struct notifier_block clk_nb;
|
||||
bool rate_change_remuxed;
|
||||
|
||||
void __iomem *reg_base;
|
||||
int lock_offset;
|
||||
unsigned int lock_shift;
|
||||
enum rockchip_pll_type type;
|
||||
const struct rockchip_pll_rate_table *rate_table;
|
||||
unsigned int rate_count;
|
||||
spinlock_t *lock;
|
||||
};
|
||||
|
||||
#define to_rockchip_clk_pll(_hw) container_of(_hw, struct rockchip_clk_pll, hw)
|
||||
#define to_rockchip_clk_pll_nb(nb) \
|
||||
container_of(nb, struct rockchip_clk_pll, clk_nb)
|
||||
|
||||
static const struct rockchip_pll_rate_table *rockchip_get_pll_settings(
|
||||
struct rockchip_clk_pll *pll, unsigned long rate)
|
||||
{
|
||||
const struct rockchip_pll_rate_table *rate_table = pll->rate_table;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pll->rate_count; i++) {
|
||||
if (rate == rate_table[i].rate)
|
||||
return &rate_table[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long rockchip_pll_round_rate(struct clk_hw *hw,
|
||||
unsigned long drate, unsigned long *prate)
|
||||
{
|
||||
struct rockchip_clk_pll *pll = to_rockchip_clk_pll(hw);
|
||||
const struct rockchip_pll_rate_table *rate_table = pll->rate_table;
|
||||
int i;
|
||||
|
||||
/* Assumming rate_table is in descending order */
|
||||
for (i = 0; i < pll->rate_count; i++) {
|
||||
if (drate >= rate_table[i].rate)
|
||||
return rate_table[i].rate;
|
||||
}
|
||||
|
||||
/* return minimum supported value */
|
||||
return rate_table[i - 1].rate;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for the pll to reach the locked state.
|
||||
* The calling set_rate function is responsible for making sure the
|
||||
* grf regmap is available.
|
||||
*/
|
||||
static int rockchip_pll_wait_lock(struct rockchip_clk_pll *pll)
|
||||
{
|
||||
struct regmap *grf = rockchip_clk_get_grf();
|
||||
unsigned int val;
|
||||
int delay = 24000000, ret;
|
||||
|
||||
while (delay > 0) {
|
||||
ret = regmap_read(grf, pll->lock_offset, &val);
|
||||
if (ret) {
|
||||
pr_err("%s: failed to read pll lock status: %d\n",
|
||||
__func__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (val & BIT(pll->lock_shift))
|
||||
return 0;
|
||||
delay--;
|
||||
}
|
||||
|
||||
pr_err("%s: timeout waiting for pll to lock\n", __func__);
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set pll mux when changing the pll rate.
|
||||
* This makes sure to move the pll mux away from the actual pll before
|
||||
* changing its rate and back to the original parent after the change.
|
||||
*/
|
||||
static int rockchip_pll_notifier_cb(struct notifier_block *nb,
|
||||
unsigned long event, void *data)
|
||||
{
|
||||
struct rockchip_clk_pll *pll = to_rockchip_clk_pll_nb(nb);
|
||||
struct clk_mux *pll_mux = &pll->pll_mux;
|
||||
const struct clk_ops *pll_mux_ops = pll->pll_mux_ops;
|
||||
int cur_parent;
|
||||
|
||||
switch (event) {
|
||||
case PRE_RATE_CHANGE:
|
||||
cur_parent = pll_mux_ops->get_parent(&pll_mux->hw);
|
||||
if (cur_parent == PLL_MODE_NORM) {
|
||||
pll_mux_ops->set_parent(&pll_mux->hw, PLL_MODE_SLOW);
|
||||
pll->rate_change_remuxed = 1;
|
||||
}
|
||||
break;
|
||||
case POST_RATE_CHANGE:
|
||||
if (pll->rate_change_remuxed) {
|
||||
pll_mux_ops->set_parent(&pll_mux->hw, PLL_MODE_NORM);
|
||||
pll->rate_change_remuxed = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* PLL used in RK3066, RK3188 and RK3288
|
||||
*/
|
||||
|
||||
#define RK3066_PLL_RESET_DELAY(nr) ((nr * 500) / 24 + 1)
|
||||
|
||||
#define RK3066_PLLCON(i) (i * 0x4)
|
||||
#define RK3066_PLLCON0_OD_MASK 0xf
|
||||
#define RK3066_PLLCON0_OD_SHIFT 0
|
||||
#define RK3066_PLLCON0_NR_MASK 0x3f
|
||||
#define RK3066_PLLCON0_NR_SHIFT 8
|
||||
#define RK3066_PLLCON1_NF_MASK 0x1fff
|
||||
#define RK3066_PLLCON1_NF_SHIFT 0
|
||||
#define RK3066_PLLCON2_BWADJ_MASK 0xfff
|
||||
#define RK3066_PLLCON2_BWADJ_SHIFT 0
|
||||
#define RK3066_PLLCON3_RESET (1 << 5)
|
||||
#define RK3066_PLLCON3_PWRDOWN (1 << 1)
|
||||
#define RK3066_PLLCON3_BYPASS (1 << 0)
|
||||
|
||||
static unsigned long rockchip_rk3066_pll_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long prate)
|
||||
{
|
||||
struct rockchip_clk_pll *pll = to_rockchip_clk_pll(hw);
|
||||
u64 nf, nr, no, rate64 = prate;
|
||||
u32 pllcon;
|
||||
|
||||
pllcon = readl_relaxed(pll->reg_base + RK3066_PLLCON(3));
|
||||
if (pllcon & RK3066_PLLCON3_BYPASS) {
|
||||
pr_debug("%s: pll %s is bypassed\n", __func__,
|
||||
__clk_get_name(hw->clk));
|
||||
return prate;
|
||||
}
|
||||
|
||||
pllcon = readl_relaxed(pll->reg_base + RK3066_PLLCON(1));
|
||||
nf = (pllcon >> RK3066_PLLCON1_NF_SHIFT) & RK3066_PLLCON1_NF_MASK;
|
||||
|
||||
pllcon = readl_relaxed(pll->reg_base + RK3066_PLLCON(0));
|
||||
nr = (pllcon >> RK3066_PLLCON0_NR_SHIFT) & RK3066_PLLCON0_NR_MASK;
|
||||
no = (pllcon >> RK3066_PLLCON0_OD_SHIFT) & RK3066_PLLCON0_OD_MASK;
|
||||
|
||||
rate64 *= (nf + 1);
|
||||
do_div(rate64, nr + 1);
|
||||
do_div(rate64, no + 1);
|
||||
|
||||
return (unsigned long)rate64;
|
||||
}
|
||||
|
||||
static int rockchip_rk3066_pll_set_rate(struct clk_hw *hw, unsigned long drate,
|
||||
unsigned long prate)
|
||||
{
|
||||
struct rockchip_clk_pll *pll = to_rockchip_clk_pll(hw);
|
||||
const struct rockchip_pll_rate_table *rate;
|
||||
unsigned long old_rate = rockchip_rk3066_pll_recalc_rate(hw, prate);
|
||||
struct regmap *grf = rockchip_clk_get_grf();
|
||||
int ret;
|
||||
|
||||
if (IS_ERR(grf)) {
|
||||
pr_debug("%s: grf regmap not available, aborting rate change\n",
|
||||
__func__);
|
||||
return PTR_ERR(grf);
|
||||
}
|
||||
|
||||
pr_debug("%s: changing %s from %lu to %lu with a parent rate of %lu\n",
|
||||
__func__, __clk_get_name(hw->clk), old_rate, drate, prate);
|
||||
|
||||
/* Get required rate settings from table */
|
||||
rate = rockchip_get_pll_settings(pll, drate);
|
||||
if (!rate) {
|
||||
pr_err("%s: Invalid rate : %lu for pll clk %s\n", __func__,
|
||||
drate, __clk_get_name(hw->clk));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
pr_debug("%s: rate settings for %lu (nr, no, nf): (%d, %d, %d)\n",
|
||||
__func__, rate->rate, rate->nr, rate->no, rate->nf);
|
||||
|
||||
/* enter reset mode */
|
||||
writel(HIWORD_UPDATE(RK3066_PLLCON3_RESET, RK3066_PLLCON3_RESET, 0),
|
||||
pll->reg_base + RK3066_PLLCON(3));
|
||||
|
||||
/* update pll values */
|
||||
writel(HIWORD_UPDATE(rate->nr - 1, RK3066_PLLCON0_NR_MASK,
|
||||
RK3066_PLLCON0_NR_SHIFT) |
|
||||
HIWORD_UPDATE(rate->no - 1, RK3066_PLLCON0_OD_MASK,
|
||||
RK3066_PLLCON0_OD_SHIFT),
|
||||
pll->reg_base + RK3066_PLLCON(0));
|
||||
|
||||
writel_relaxed(HIWORD_UPDATE(rate->nf - 1, RK3066_PLLCON1_NF_MASK,
|
||||
RK3066_PLLCON1_NF_SHIFT),
|
||||
pll->reg_base + RK3066_PLLCON(1));
|
||||
writel_relaxed(HIWORD_UPDATE(rate->bwadj, RK3066_PLLCON2_BWADJ_MASK,
|
||||
RK3066_PLLCON2_BWADJ_SHIFT),
|
||||
pll->reg_base + RK3066_PLLCON(2));
|
||||
|
||||
/* leave reset and wait the reset_delay */
|
||||
writel(HIWORD_UPDATE(0, RK3066_PLLCON3_RESET, 0),
|
||||
pll->reg_base + RK3066_PLLCON(3));
|
||||
udelay(RK3066_PLL_RESET_DELAY(rate->nr));
|
||||
|
||||
/* wait for the pll to lock */
|
||||
ret = rockchip_pll_wait_lock(pll);
|
||||
if (ret) {
|
||||
pr_warn("%s: pll did not lock, trying to restore old rate %lu\n",
|
||||
__func__, old_rate);
|
||||
rockchip_rk3066_pll_set_rate(hw, old_rate, prate);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rockchip_rk3066_pll_enable(struct clk_hw *hw)
|
||||
{
|
||||
struct rockchip_clk_pll *pll = to_rockchip_clk_pll(hw);
|
||||
|
||||
writel(HIWORD_UPDATE(0, RK3066_PLLCON3_PWRDOWN, 0),
|
||||
pll->reg_base + RK3066_PLLCON(3));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rockchip_rk3066_pll_disable(struct clk_hw *hw)
|
||||
{
|
||||
struct rockchip_clk_pll *pll = to_rockchip_clk_pll(hw);
|
||||
|
||||
writel(HIWORD_UPDATE(RK3066_PLLCON3_PWRDOWN,
|
||||
RK3066_PLLCON3_PWRDOWN, 0),
|
||||
pll->reg_base + RK3066_PLLCON(3));
|
||||
}
|
||||
|
||||
static int rockchip_rk3066_pll_is_enabled(struct clk_hw *hw)
|
||||
{
|
||||
struct rockchip_clk_pll *pll = to_rockchip_clk_pll(hw);
|
||||
u32 pllcon = readl(pll->reg_base + RK3066_PLLCON(3));
|
||||
|
||||
return !(pllcon & RK3066_PLLCON3_PWRDOWN);
|
||||
}
|
||||
|
||||
static const struct clk_ops rockchip_rk3066_pll_clk_norate_ops = {
|
||||
.recalc_rate = rockchip_rk3066_pll_recalc_rate,
|
||||
.enable = rockchip_rk3066_pll_enable,
|
||||
.disable = rockchip_rk3066_pll_disable,
|
||||
.is_enabled = rockchip_rk3066_pll_is_enabled,
|
||||
};
|
||||
|
||||
static const struct clk_ops rockchip_rk3066_pll_clk_ops = {
|
||||
.recalc_rate = rockchip_rk3066_pll_recalc_rate,
|
||||
.round_rate = rockchip_pll_round_rate,
|
||||
.set_rate = rockchip_rk3066_pll_set_rate,
|
||||
.enable = rockchip_rk3066_pll_enable,
|
||||
.disable = rockchip_rk3066_pll_disable,
|
||||
.is_enabled = rockchip_rk3066_pll_is_enabled,
|
||||
};
|
||||
|
||||
/*
|
||||
* Common registering of pll clocks
|
||||
*/
|
||||
|
||||
struct clk *rockchip_clk_register_pll(enum rockchip_pll_type pll_type,
|
||||
const char *name, const char **parent_names, u8 num_parents,
|
||||
void __iomem *base, int con_offset, int grf_lock_offset,
|
||||
int lock_shift, int mode_offset, int mode_shift,
|
||||
struct rockchip_pll_rate_table *rate_table,
|
||||
spinlock_t *lock)
|
||||
{
|
||||
const char *pll_parents[3];
|
||||
struct clk_init_data init;
|
||||
struct rockchip_clk_pll *pll;
|
||||
struct clk_mux *pll_mux;
|
||||
struct clk *pll_clk, *mux_clk;
|
||||
char pll_name[20];
|
||||
int ret;
|
||||
|
||||
if (num_parents != 2) {
|
||||
pr_err("%s: needs two parent clocks\n", __func__);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
/* name the actual pll */
|
||||
snprintf(pll_name, sizeof(pll_name), "pll_%s", name);
|
||||
|
||||
pll = kzalloc(sizeof(*pll), GFP_KERNEL);
|
||||
if (!pll)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
init.name = pll_name;
|
||||
|
||||
/* keep all plls untouched for now */
|
||||
init.flags = CLK_IGNORE_UNUSED;
|
||||
|
||||
init.parent_names = &parent_names[0];
|
||||
init.num_parents = 1;
|
||||
|
||||
if (rate_table) {
|
||||
int len;
|
||||
|
||||
/* find count of rates in rate_table */
|
||||
for (len = 0; rate_table[len].rate != 0; )
|
||||
len++;
|
||||
|
||||
pll->rate_count = len;
|
||||
pll->rate_table = kmemdup(rate_table,
|
||||
pll->rate_count *
|
||||
sizeof(struct rockchip_pll_rate_table),
|
||||
GFP_KERNEL);
|
||||
WARN(!pll->rate_table,
|
||||
"%s: could not allocate rate table for %s\n",
|
||||
__func__, name);
|
||||
}
|
||||
|
||||
switch (pll_type) {
|
||||
case pll_rk3066:
|
||||
if (!pll->rate_table)
|
||||
init.ops = &rockchip_rk3066_pll_clk_norate_ops;
|
||||
else
|
||||
init.ops = &rockchip_rk3066_pll_clk_ops;
|
||||
break;
|
||||
default:
|
||||
pr_warn("%s: Unknown pll type for pll clk %s\n",
|
||||
__func__, name);
|
||||
}
|
||||
|
||||
pll->hw.init = &init;
|
||||
pll->type = pll_type;
|
||||
pll->reg_base = base + con_offset;
|
||||
pll->lock_offset = grf_lock_offset;
|
||||
pll->lock_shift = lock_shift;
|
||||
pll->lock = lock;
|
||||
pll->clk_nb.notifier_call = rockchip_pll_notifier_cb;
|
||||
|
||||
pll_clk = clk_register(NULL, &pll->hw);
|
||||
if (IS_ERR(pll_clk)) {
|
||||
pr_err("%s: failed to register pll clock %s : %ld\n",
|
||||
__func__, name, PTR_ERR(pll_clk));
|
||||
mux_clk = pll_clk;
|
||||
goto err_pll;
|
||||
}
|
||||
|
||||
ret = clk_notifier_register(pll_clk, &pll->clk_nb);
|
||||
if (ret) {
|
||||
pr_err("%s: failed to register clock notifier for %s : %d\n",
|
||||
__func__, name, ret);
|
||||
mux_clk = ERR_PTR(ret);
|
||||
goto err_pll_notifier;
|
||||
}
|
||||
|
||||
/* create the mux on top of the real pll */
|
||||
pll->pll_mux_ops = &clk_mux_ops;
|
||||
pll_mux = &pll->pll_mux;
|
||||
|
||||
/* the actual muxing is xin24m, pll-output, xin32k */
|
||||
pll_parents[0] = parent_names[0];
|
||||
pll_parents[1] = pll_name;
|
||||
pll_parents[2] = parent_names[1];
|
||||
|
||||
init.name = name;
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
init.ops = pll->pll_mux_ops;
|
||||
init.parent_names = pll_parents;
|
||||
init.num_parents = ARRAY_SIZE(pll_parents);
|
||||
|
||||
pll_mux->reg = base + mode_offset;
|
||||
pll_mux->shift = mode_shift;
|
||||
pll_mux->mask = PLL_MODE_MASK;
|
||||
pll_mux->flags = 0;
|
||||
pll_mux->lock = lock;
|
||||
pll_mux->hw.init = &init;
|
||||
|
||||
if (pll_type == pll_rk3066)
|
||||
pll_mux->flags |= CLK_MUX_HIWORD_MASK;
|
||||
|
||||
mux_clk = clk_register(NULL, &pll_mux->hw);
|
||||
if (IS_ERR(mux_clk))
|
||||
goto err_mux;
|
||||
|
||||
return mux_clk;
|
||||
|
||||
err_mux:
|
||||
ret = clk_notifier_unregister(pll_clk, &pll->clk_nb);
|
||||
if (ret) {
|
||||
pr_err("%s: could not unregister clock notifier in error path : %d\n",
|
||||
__func__, ret);
|
||||
return mux_clk;
|
||||
}
|
||||
err_pll_notifier:
|
||||
clk_unregister(pll_clk);
|
||||
err_pll:
|
||||
kfree(pll);
|
||||
return mux_clk;
|
||||
}
|
|
@ -0,0 +1,672 @@
|
|||
/*
|
||||
* Copyright (c) 2014 MundoReader S.L.
|
||||
* Author: Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <dt-bindings/clock/rk3188-cru-common.h>
|
||||
#include "clk.h"
|
||||
|
||||
#define RK3188_GRF_SOC_STATUS 0xac
|
||||
|
||||
enum rk3188_plls {
|
||||
apll, cpll, dpll, gpll,
|
||||
};
|
||||
|
||||
struct rockchip_pll_rate_table rk3188_pll_rates[] = {
|
||||
RK3066_PLL_RATE(2208000000, 1, 92, 1),
|
||||
RK3066_PLL_RATE(2184000000, 1, 91, 1),
|
||||
RK3066_PLL_RATE(2160000000, 1, 90, 1),
|
||||
RK3066_PLL_RATE(2136000000, 1, 89, 1),
|
||||
RK3066_PLL_RATE(2112000000, 1, 88, 1),
|
||||
RK3066_PLL_RATE(2088000000, 1, 87, 1),
|
||||
RK3066_PLL_RATE(2064000000, 1, 86, 1),
|
||||
RK3066_PLL_RATE(2040000000, 1, 85, 1),
|
||||
RK3066_PLL_RATE(2016000000, 1, 84, 1),
|
||||
RK3066_PLL_RATE(1992000000, 1, 83, 1),
|
||||
RK3066_PLL_RATE(1968000000, 1, 82, 1),
|
||||
RK3066_PLL_RATE(1944000000, 1, 81, 1),
|
||||
RK3066_PLL_RATE(1920000000, 1, 80, 1),
|
||||
RK3066_PLL_RATE(1896000000, 1, 79, 1),
|
||||
RK3066_PLL_RATE(1872000000, 1, 78, 1),
|
||||
RK3066_PLL_RATE(1848000000, 1, 77, 1),
|
||||
RK3066_PLL_RATE(1824000000, 1, 76, 1),
|
||||
RK3066_PLL_RATE(1800000000, 1, 75, 1),
|
||||
RK3066_PLL_RATE(1776000000, 1, 74, 1),
|
||||
RK3066_PLL_RATE(1752000000, 1, 73, 1),
|
||||
RK3066_PLL_RATE(1728000000, 1, 72, 1),
|
||||
RK3066_PLL_RATE(1704000000, 1, 71, 1),
|
||||
RK3066_PLL_RATE(1680000000, 1, 70, 1),
|
||||
RK3066_PLL_RATE(1656000000, 1, 69, 1),
|
||||
RK3066_PLL_RATE(1632000000, 1, 68, 1),
|
||||
RK3066_PLL_RATE(1608000000, 1, 67, 1),
|
||||
RK3066_PLL_RATE(1560000000, 1, 65, 1),
|
||||
RK3066_PLL_RATE(1512000000, 1, 63, 1),
|
||||
RK3066_PLL_RATE(1488000000, 1, 62, 1),
|
||||
RK3066_PLL_RATE(1464000000, 1, 61, 1),
|
||||
RK3066_PLL_RATE(1440000000, 1, 60, 1),
|
||||
RK3066_PLL_RATE(1416000000, 1, 59, 1),
|
||||
RK3066_PLL_RATE(1392000000, 1, 58, 1),
|
||||
RK3066_PLL_RATE(1368000000, 1, 57, 1),
|
||||
RK3066_PLL_RATE(1344000000, 1, 56, 1),
|
||||
RK3066_PLL_RATE(1320000000, 1, 55, 1),
|
||||
RK3066_PLL_RATE(1296000000, 1, 54, 1),
|
||||
RK3066_PLL_RATE(1272000000, 1, 53, 1),
|
||||
RK3066_PLL_RATE(1248000000, 1, 52, 1),
|
||||
RK3066_PLL_RATE(1224000000, 1, 51, 1),
|
||||
RK3066_PLL_RATE(1200000000, 1, 50, 1),
|
||||
RK3066_PLL_RATE(1188000000, 2, 99, 1),
|
||||
RK3066_PLL_RATE(1176000000, 1, 49, 1),
|
||||
RK3066_PLL_RATE(1128000000, 1, 47, 1),
|
||||
RK3066_PLL_RATE(1104000000, 1, 46, 1),
|
||||
RK3066_PLL_RATE(1008000000, 1, 84, 2),
|
||||
RK3066_PLL_RATE( 912000000, 1, 76, 2),
|
||||
RK3066_PLL_RATE( 891000000, 8, 594, 2),
|
||||
RK3066_PLL_RATE( 888000000, 1, 74, 2),
|
||||
RK3066_PLL_RATE( 816000000, 1, 68, 2),
|
||||
RK3066_PLL_RATE( 798000000, 2, 133, 2),
|
||||
RK3066_PLL_RATE( 792000000, 1, 66, 2),
|
||||
RK3066_PLL_RATE( 768000000, 1, 64, 2),
|
||||
RK3066_PLL_RATE( 742500000, 8, 495, 2),
|
||||
RK3066_PLL_RATE( 696000000, 1, 58, 2),
|
||||
RK3066_PLL_RATE( 600000000, 1, 50, 2),
|
||||
RK3066_PLL_RATE( 594000000, 2, 198, 4),
|
||||
RK3066_PLL_RATE( 552000000, 1, 46, 2),
|
||||
RK3066_PLL_RATE( 504000000, 1, 84, 4),
|
||||
RK3066_PLL_RATE( 456000000, 1, 76, 4),
|
||||
RK3066_PLL_RATE( 408000000, 1, 68, 4),
|
||||
RK3066_PLL_RATE( 384000000, 2, 128, 4),
|
||||
RK3066_PLL_RATE( 360000000, 1, 60, 4),
|
||||
RK3066_PLL_RATE( 312000000, 1, 52, 4),
|
||||
RK3066_PLL_RATE( 300000000, 1, 50, 4),
|
||||
RK3066_PLL_RATE( 297000000, 2, 198, 8),
|
||||
RK3066_PLL_RATE( 252000000, 1, 84, 8),
|
||||
RK3066_PLL_RATE( 216000000, 1, 72, 8),
|
||||
RK3066_PLL_RATE( 148500000, 2, 99, 8),
|
||||
RK3066_PLL_RATE( 126000000, 1, 84, 16),
|
||||
RK3066_PLL_RATE( 48000000, 1, 64, 32),
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
PNAME(mux_pll_p) = { "xin24m", "xin32k" };
|
||||
PNAME(mux_armclk_p) = { "apll", "gpll_armclk" };
|
||||
PNAME(mux_ddrphy_p) = { "dpll", "gpll_ddr" };
|
||||
PNAME(mux_pll_src_gpll_cpll_p) = { "gpll", "cpll" };
|
||||
PNAME(mux_pll_src_cpll_gpll_p) = { "cpll", "gpll" };
|
||||
PNAME(mux_aclk_cpu_p) = { "apll", "gpll" };
|
||||
PNAME(mux_sclk_cif0_p) = { "cif0_pre", "xin24m" };
|
||||
PNAME(mux_sclk_i2s0_p) = { "i2s0_pre", "i2s0_frac", "xin12m" };
|
||||
PNAME(mux_sclk_spdif_p) = { "spdif_src", "spdif_frac", "xin12m" };
|
||||
PNAME(mux_sclk_uart0_p) = { "uart0_pre", "uart0_frac", "xin24m" };
|
||||
PNAME(mux_sclk_uart1_p) = { "uart1_pre", "uart1_frac", "xin24m" };
|
||||
PNAME(mux_sclk_uart2_p) = { "uart2_pre", "uart2_frac", "xin24m" };
|
||||
PNAME(mux_sclk_uart3_p) = { "uart3_pre", "uart3_frac", "xin24m" };
|
||||
PNAME(mux_sclk_hsadc_p) = { "hsadc_src", "hsadc_frac", "ext_hsadc" };
|
||||
PNAME(mux_mac_p) = { "gpll", "dpll" };
|
||||
PNAME(mux_sclk_macref_p) = { "mac_src", "ext_rmii" };
|
||||
|
||||
static struct rockchip_pll_clock rk3188_pll_clks[] __initdata = {
|
||||
[apll] = PLL(pll_rk3066, PLL_APLL, "apll", mux_pll_p, 0, RK2928_PLL_CON(0),
|
||||
RK2928_MODE_CON, 0, 6, rk3188_pll_rates),
|
||||
[dpll] = PLL(pll_rk3066, PLL_DPLL, "dpll", mux_pll_p, 0, RK2928_PLL_CON(4),
|
||||
RK2928_MODE_CON, 4, 5, NULL),
|
||||
[cpll] = PLL(pll_rk3066, PLL_CPLL, "cpll", mux_pll_p, 0, RK2928_PLL_CON(8),
|
||||
RK2928_MODE_CON, 8, 7, rk3188_pll_rates),
|
||||
[gpll] = PLL(pll_rk3066, PLL_GPLL, "gpll", mux_pll_p, 0, RK2928_PLL_CON(12),
|
||||
RK2928_MODE_CON, 12, 8, rk3188_pll_rates),
|
||||
};
|
||||
|
||||
#define MFLAGS CLK_MUX_HIWORD_MASK
|
||||
#define DFLAGS CLK_DIVIDER_HIWORD_MASK
|
||||
#define GFLAGS (CLK_GATE_HIWORD_MASK | CLK_GATE_SET_TO_DISABLE)
|
||||
|
||||
/* 2 ^ (val + 1) */
|
||||
static struct clk_div_table div_core_peri_t[] = {
|
||||
{ .val = 0, .div = 2 },
|
||||
{ .val = 1, .div = 4 },
|
||||
{ .val = 2, .div = 8 },
|
||||
{ .val = 3, .div = 16 },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
static struct rockchip_clk_branch common_clk_branches[] __initdata = {
|
||||
/*
|
||||
* Clock-Architecture Diagram 2
|
||||
*/
|
||||
|
||||
GATE(0, "gpll_armclk", "gpll", 0, RK2928_CLKGATE_CON(0), 1, GFLAGS),
|
||||
|
||||
/* these two are set by the cpuclk and should not be changed */
|
||||
COMPOSITE_NOMUX_DIVTBL(CORE_PERI, "core_peri", "armclk", 0,
|
||||
RK2928_CLKSEL_CON(0), 6, 2, DFLAGS | CLK_DIVIDER_READ_ONLY,
|
||||
div_core_peri_t, RK2928_CLKGATE_CON(0), 0, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "aclk_vepu", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK2928_CLKSEL_CON(32), 7, 1, MFLAGS, 0, 5, DFLAGS,
|
||||
RK2928_CLKGATE_CON(3), 9, GFLAGS),
|
||||
GATE(0, "hclk_vepu", "aclk_vepu", 0,
|
||||
RK2928_CLKGATE_CON(3), 10, GFLAGS),
|
||||
COMPOSITE(0, "aclk_vdpu", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK2928_CLKSEL_CON(32), 15, 1, MFLAGS, 8, 5, DFLAGS,
|
||||
RK2928_CLKGATE_CON(3), 11, GFLAGS),
|
||||
GATE(0, "hclk_vdpu", "aclk_vdpu", 0,
|
||||
RK2928_CLKGATE_CON(3), 12, GFLAGS),
|
||||
|
||||
GATE(0, "gpll_ddr", "gpll", 0,
|
||||
RK2928_CLKGATE_CON(1), 7, GFLAGS),
|
||||
COMPOSITE(0, "ddrphy", mux_ddrphy_p, 0,
|
||||
RK2928_CLKSEL_CON(26), 8, 1, MFLAGS, 0, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO,
|
||||
RK2928_CLKGATE_CON(0), 2, GFLAGS),
|
||||
|
||||
GATE(0, "aclk_cpu", "aclk_cpu_pre", 0,
|
||||
RK2928_CLKGATE_CON(0), 3, GFLAGS),
|
||||
|
||||
DIV(0, "pclk_cpu_pre", "aclk_cpu_pre", 0,
|
||||
RK2928_CLKSEL_CON(1), 12, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO),
|
||||
GATE(0, "atclk_cpu", "pclk_cpu_pre", 0,
|
||||
RK2928_CLKGATE_CON(0), 6, GFLAGS),
|
||||
GATE(0, "pclk_cpu", "pclk_cpu_pre", 0,
|
||||
RK2928_CLKGATE_CON(0), 5, GFLAGS),
|
||||
DIV(0, "hclk_cpu_pre", "aclk_cpu_pre", 0,
|
||||
RK2928_CLKSEL_CON(1), 8, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO),
|
||||
COMPOSITE_NOMUX(0, "hclk_ahb2apb", "hclk_cpu_pre", 0,
|
||||
RK2928_CLKSEL_CON(1), 14, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO,
|
||||
RK2928_CLKGATE_CON(4), 9, GFLAGS),
|
||||
GATE(0, "hclk_cpu", "hclk_cpu_pre", 0,
|
||||
RK2928_CLKGATE_CON(0), 4, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "aclk_lcdc0_pre", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK2928_CLKSEL_CON(31), 7, 1, MFLAGS, 0, 5, DFLAGS,
|
||||
RK2928_CLKGATE_CON(3), 0, GFLAGS),
|
||||
COMPOSITE(0, "aclk_lcdc1_pre", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK2928_CLKSEL_CON(31), 15, 1, MFLAGS, 8, 5, DFLAGS,
|
||||
RK2928_CLKGATE_CON(1), 4, GFLAGS),
|
||||
|
||||
GATE(0, "aclk_peri", "aclk_peri_pre", 0,
|
||||
RK2928_CLKGATE_CON(2), 1, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "hclk_peri", "aclk_peri_pre", 0,
|
||||
RK2928_CLKSEL_CON(10), 8, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO,
|
||||
RK2928_CLKGATE_CON(2), 2, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "pclk_peri", "aclk_peri_pre", 0,
|
||||
RK2928_CLKSEL_CON(10), 12, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO,
|
||||
RK2928_CLKGATE_CON(2), 3, GFLAGS),
|
||||
|
||||
MUX(0, "cif_src", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK2928_CLKSEL_CON(29), 0, 1, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "cif0_pre", "cif_src", 0,
|
||||
RK2928_CLKSEL_CON(29), 1, 5, DFLAGS,
|
||||
RK2928_CLKGATE_CON(3), 7, GFLAGS),
|
||||
MUX(SCLK_CIF0, "sclk_cif0", mux_sclk_cif0_p, 0,
|
||||
RK2928_CLKSEL_CON(29), 7, 1, MFLAGS),
|
||||
|
||||
GATE(0, "pclkin_cif0", "ext_cif0", 0,
|
||||
RK2928_CLKGATE_CON(3), 3, GFLAGS),
|
||||
|
||||
/*
|
||||
* the 480m are generated inside the usb block from these clocks,
|
||||
* but they are also a source for the hsicphy clock.
|
||||
*/
|
||||
GATE(SCLK_OTGPHY0, "sclk_otgphy0", "usb480m", 0,
|
||||
RK2928_CLKGATE_CON(1), 5, GFLAGS),
|
||||
GATE(SCLK_OTGPHY1, "sclk_otgphy1", "usb480m", 0,
|
||||
RK2928_CLKGATE_CON(1), 6, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "mac_src", mux_mac_p, 0,
|
||||
RK2928_CLKSEL_CON(21), 0, 1, MFLAGS, 8, 5, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 5, GFLAGS),
|
||||
MUX(SCLK_MAC, "sclk_macref", mux_sclk_macref_p, CLK_SET_RATE_PARENT,
|
||||
RK2928_CLKSEL_CON(21), 4, 1, MFLAGS),
|
||||
GATE(0, "sclk_mac_lbtest", "sclk_macref",
|
||||
RK2928_CLKGATE_CON(2), 12, 0, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "hsadc_src", mux_pll_src_gpll_cpll_p, 0,
|
||||
RK2928_CLKSEL_CON(22), 0, 1, MFLAGS, 8, 8, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 6, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "hsadc_frac", "hsadc_src",
|
||||
RK2928_CLKSEL_CON(23), 0,
|
||||
RK2928_CLKGATE_CON(2), 7, 0, GFLAGS),
|
||||
MUX(SCLK_HSADC, "sclk_hsadc", mux_sclk_hsadc_p, 0,
|
||||
RK2928_CLKSEL_CON(22), 4, 2, MFLAGS),
|
||||
|
||||
COMPOSITE_NOMUX(SCLK_SARADC, "sclk_saradc", "xin24m", 0,
|
||||
RK2928_CLKSEL_CON(24), 8, 8, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 8, GFLAGS),
|
||||
|
||||
/*
|
||||
* Clock-Architecture Diagram 4
|
||||
*/
|
||||
|
||||
GATE(SCLK_SMC, "sclk_smc", "hclk_peri",
|
||||
RK2928_CLKGATE_CON(2), 4, 0, GFLAGS),
|
||||
|
||||
COMPOSITE_NOMUX(SCLK_SPI0, "sclk_spi0", "pclk_peri", 0,
|
||||
RK2928_CLKSEL_CON(25), 0, 7, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 9, GFLAGS),
|
||||
COMPOSITE_NOMUX(SCLK_SPI1, "sclk_spi1", "pclk_peri", 0,
|
||||
RK2928_CLKSEL_CON(25), 8, 7, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 10, GFLAGS),
|
||||
|
||||
COMPOSITE_NOMUX(SCLK_SDMMC, "sclk_sdmmc", "hclk_peri", 0,
|
||||
RK2928_CLKSEL_CON(11), 0, 6, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 11, GFLAGS),
|
||||
COMPOSITE_NOMUX(SCLK_SDIO, "sclk_sdio", "hclk_peri", 0,
|
||||
RK2928_CLKSEL_CON(12), 0, 6, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 13, GFLAGS),
|
||||
COMPOSITE_NOMUX(SCLK_EMMC, "sclk_emmc", "hclk_peri", 0,
|
||||
RK2928_CLKSEL_CON(12), 8, 6, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 14, GFLAGS),
|
||||
|
||||
MUX(0, "uart_src", mux_pll_src_gpll_cpll_p, 0,
|
||||
RK2928_CLKSEL_CON(12), 15, 1, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "uart0_pre", "uart_src", 0,
|
||||
RK2928_CLKSEL_CON(13), 0, 7, DFLAGS,
|
||||
RK2928_CLKGATE_CON(1), 8, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "uart0_frac", "uart0_pre", 0,
|
||||
RK2928_CLKSEL_CON(17), 0,
|
||||
RK2928_CLKGATE_CON(1), 9, GFLAGS),
|
||||
MUX(SCLK_UART0, "sclk_uart0", mux_sclk_uart0_p, 0,
|
||||
RK2928_CLKSEL_CON(13), 8, 2, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "uart1_pre", "uart_src", 0,
|
||||
RK2928_CLKSEL_CON(14), 0, 7, DFLAGS,
|
||||
RK2928_CLKGATE_CON(1), 10, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "uart1_frac", "uart1_pre", 0,
|
||||
RK2928_CLKSEL_CON(18), 0,
|
||||
RK2928_CLKGATE_CON(1), 11, GFLAGS),
|
||||
MUX(SCLK_UART1, "sclk_uart1", mux_sclk_uart1_p, 0,
|
||||
RK2928_CLKSEL_CON(14), 8, 2, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "uart2_pre", "uart_src", 0,
|
||||
RK2928_CLKSEL_CON(15), 0, 7, DFLAGS,
|
||||
RK2928_CLKGATE_CON(1), 12, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "uart2_frac", "uart2_pre", 0,
|
||||
RK2928_CLKSEL_CON(19), 0,
|
||||
RK2928_CLKGATE_CON(1), 13, GFLAGS),
|
||||
MUX(SCLK_UART2, "sclk_uart2", mux_sclk_uart2_p, 0,
|
||||
RK2928_CLKSEL_CON(15), 8, 2, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "uart3_pre", "uart_src", 0,
|
||||
RK2928_CLKSEL_CON(16), 0, 7, DFLAGS,
|
||||
RK2928_CLKGATE_CON(1), 14, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "uart3_frac", "uart3_pre", 0,
|
||||
RK2928_CLKSEL_CON(20), 0,
|
||||
RK2928_CLKGATE_CON(1), 15, GFLAGS),
|
||||
MUX(SCLK_UART3, "sclk_uart3", mux_sclk_uart3_p, 0,
|
||||
RK2928_CLKSEL_CON(16), 8, 2, MFLAGS),
|
||||
|
||||
GATE(SCLK_JTAG, "jtag", "ext_jtag", 0, RK2928_CLKGATE_CON(1), 3, GFLAGS),
|
||||
|
||||
GATE(SCLK_TIMER0, "timer0", "xin24m", 0, RK2928_CLKGATE_CON(1), 0, GFLAGS),
|
||||
GATE(SCLK_TIMER1, "timer1", "xin24m", 0, RK2928_CLKGATE_CON(1), 1, GFLAGS),
|
||||
|
||||
/* clk_core_pre gates */
|
||||
GATE(0, "core_dbg", "armclk", 0, RK2928_CLKGATE_CON(9), 0, GFLAGS),
|
||||
|
||||
/* aclk_cpu gates */
|
||||
GATE(ACLK_DMA1, "aclk_dma1", "aclk_cpu", 0, RK2928_CLKGATE_CON(5), 0, GFLAGS),
|
||||
GATE(0, "aclk_intmem", "aclk_cpu", 0, RK2928_CLKGATE_CON(4), 12, GFLAGS),
|
||||
GATE(0, "aclk_strc_sys", "aclk_cpu", 0, RK2928_CLKGATE_CON(4), 10, GFLAGS),
|
||||
|
||||
/* hclk_cpu gates */
|
||||
GATE(HCLK_ROM, "hclk_rom", "hclk_cpu", 0, RK2928_CLKGATE_CON(5), 6, GFLAGS),
|
||||
GATE(HCLK_I2S0, "hclk_i2s0", "hclk_cpu", 0, RK2928_CLKGATE_CON(7), 2, GFLAGS),
|
||||
GATE(HCLK_SPDIF, "hclk_spdif", "hclk_cpu", 0, RK2928_CLKGATE_CON(7), 1, GFLAGS),
|
||||
GATE(0, "hclk_cpubus", "hclk_cpu", 0, RK2928_CLKGATE_CON(4), 8, GFLAGS),
|
||||
/* hclk_ahb2apb is part of a clk branch */
|
||||
GATE(0, "hclk_vio_bus", "hclk_cpu", 0, RK2928_CLKGATE_CON(6), 12, GFLAGS),
|
||||
GATE(HCLK_LCDC0, "hclk_lcdc0", "hclk_cpu", 0, RK2928_CLKGATE_CON(6), 1, GFLAGS),
|
||||
GATE(HCLK_LCDC1, "hclk_lcdc1", "aclk_cpu", 0, RK2928_CLKGATE_CON(6), 2, GFLAGS),
|
||||
GATE(HCLK_CIF0, "hclk_cif0", "hclk_cpu", 0, RK2928_CLKGATE_CON(6), 4, GFLAGS),
|
||||
GATE(HCLK_IPP, "hclk_ipp", "hclk_cpu", 0, RK2928_CLKGATE_CON(6), 9, GFLAGS),
|
||||
GATE(HCLK_RGA, "hclk_rga", "hclk_cpu", 0, RK2928_CLKGATE_CON(6), 10, GFLAGS),
|
||||
|
||||
/* hclk_peri gates */
|
||||
GATE(0, "hclk_peri_axi_matrix", "hclk_peri", 0, RK2928_CLKGATE_CON(4), 0, GFLAGS),
|
||||
GATE(0, "hclk_peri_ahb_arbi", "hclk_peri", 0, RK2928_CLKGATE_CON(4), 6, GFLAGS),
|
||||
GATE(0, "hclk_emem_peri", "hclk_peri", 0, RK2928_CLKGATE_CON(4), 7, GFLAGS),
|
||||
GATE(HCLK_EMAC, "hclk_emac", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 0, GFLAGS),
|
||||
GATE(HCLK_NANDC0, "hclk_nandc0", "hclk_peri", 0, RK2928_CLKGATE_CON(5), 9, GFLAGS),
|
||||
GATE(0, "hclk_usb_peri", "hclk_peri", 0, RK2928_CLKGATE_CON(4), 5, GFLAGS),
|
||||
GATE(HCLK_OTG0, "hclk_usbotg0", "hclk_peri", 0, RK2928_CLKGATE_CON(5), 13, GFLAGS),
|
||||
GATE(HCLK_HSADC, "hclk_hsadc", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 5, GFLAGS),
|
||||
GATE(HCLK_PIDF, "hclk_pidfilter", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 6, GFLAGS),
|
||||
GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 0, RK2928_CLKGATE_CON(5), 10, GFLAGS),
|
||||
GATE(HCLK_SDIO, "hclk_sdio", "hclk_peri", 0, RK2928_CLKGATE_CON(5), 11, GFLAGS),
|
||||
GATE(HCLK_EMMC, "hclk_emmc", "hclk_peri", 0, RK2928_CLKGATE_CON(5), 12, GFLAGS),
|
||||
|
||||
/* aclk_lcdc0_pre gates */
|
||||
GATE(0, "aclk_vio0", "aclk_lcdc0_pre", 0, RK2928_CLKGATE_CON(6), 13, GFLAGS),
|
||||
GATE(ACLK_LCDC0, "aclk_lcdc0", "aclk_vio0", 0, RK2928_CLKGATE_CON(6), 0, GFLAGS),
|
||||
GATE(ACLK_CIF0, "aclk_cif0", "aclk_vio0", 0, RK2928_CLKGATE_CON(6), 5, GFLAGS),
|
||||
GATE(ACLK_IPP, "aclk_ipp", "aclk_vio0", 0, RK2928_CLKGATE_CON(6), 8, GFLAGS),
|
||||
|
||||
/* aclk_lcdc1_pre gates */
|
||||
GATE(0, "aclk_vio1", "aclk_lcdc1_pre", 0, RK2928_CLKGATE_CON(9), 5, GFLAGS),
|
||||
GATE(ACLK_LCDC1, "aclk_lcdc1", "aclk_vio1", 0, RK2928_CLKGATE_CON(6), 3, GFLAGS),
|
||||
GATE(ACLK_RGA, "aclk_rga", "aclk_vio1", 0, RK2928_CLKGATE_CON(6), 11, GFLAGS),
|
||||
|
||||
/* atclk_cpu gates */
|
||||
GATE(0, "atclk", "atclk_cpu", 0, RK2928_CLKGATE_CON(9), 3, GFLAGS),
|
||||
GATE(0, "trace", "atclk_cpu", 0, RK2928_CLKGATE_CON(9), 2, GFLAGS),
|
||||
|
||||
/* pclk_cpu gates */
|
||||
GATE(PCLK_PWM01, "pclk_pwm01", "pclk_cpu", 0, RK2928_CLKGATE_CON(7), 10, GFLAGS),
|
||||
GATE(PCLK_TIMER0, "pclk_timer0", "pclk_cpu", 0, RK2928_CLKGATE_CON(7), 7, GFLAGS),
|
||||
GATE(PCLK_I2C0, "pclk_i2c0", "pclk_cpu", 0, RK2928_CLKGATE_CON(8), 4, GFLAGS),
|
||||
GATE(PCLK_I2C1, "pclk_i2c1", "pclk_cpu", 0, RK2928_CLKGATE_CON(8), 5, GFLAGS),
|
||||
GATE(PCLK_GPIO0, "pclk_gpio0", "pclk_cpu", 0, RK2928_CLKGATE_CON(8), 9, GFLAGS),
|
||||
GATE(PCLK_GPIO1, "pclk_gpio1", "pclk_cpu", 0, RK2928_CLKGATE_CON(8), 10, GFLAGS),
|
||||
GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_cpu", 0, RK2928_CLKGATE_CON(8), 11, GFLAGS),
|
||||
GATE(PCLK_EFUSE, "pclk_efuse", "pclk_cpu", 0, RK2928_CLKGATE_CON(5), 2, GFLAGS),
|
||||
GATE(PCLK_TZPC, "pclk_tzpc", "pclk_cpu", 0, RK2928_CLKGATE_CON(5), 3, GFLAGS),
|
||||
GATE(0, "pclk_ddrupctl", "pclk_cpu", 0, RK2928_CLKGATE_CON(5), 7, GFLAGS),
|
||||
GATE(0, "pclk_ddrpubl", "pclk_cpu", 0, RK2928_CLKGATE_CON(9), 6, GFLAGS),
|
||||
GATE(0, "pclk_dbg", "pclk_cpu", 0, RK2928_CLKGATE_CON(9), 1, GFLAGS),
|
||||
GATE(PCLK_GRF, "pclk_grf", "pclk_cpu", 0, RK2928_CLKGATE_CON(5), 4, GFLAGS),
|
||||
GATE(PCLK_PMU, "pclk_pmu", "pclk_cpu", 0, RK2928_CLKGATE_CON(5), 5, GFLAGS),
|
||||
|
||||
/* aclk_peri */
|
||||
GATE(ACLK_DMA2, "aclk_dma2", "aclk_peri", 0, RK2928_CLKGATE_CON(5), 1, GFLAGS),
|
||||
GATE(ACLK_SMC, "aclk_smc", "aclk_peri", 0, RK2928_CLKGATE_CON(5), 8, GFLAGS),
|
||||
GATE(0, "aclk_peri_niu", "aclk_peri", 0, RK2928_CLKGATE_CON(4), 4, GFLAGS),
|
||||
GATE(0, "aclk_cpu_peri", "aclk_peri", 0, RK2928_CLKGATE_CON(4), 2, GFLAGS),
|
||||
GATE(0, "aclk_peri_axi_matrix", "aclk_peri", 0, RK2928_CLKGATE_CON(4), 3, GFLAGS),
|
||||
|
||||
/* pclk_peri gates */
|
||||
GATE(0, "pclk_peri_axi_matrix", "pclk_peri", 0, RK2928_CLKGATE_CON(4), 1, GFLAGS),
|
||||
GATE(PCLK_PWM23, "pclk_pwm23", "pclk_peri", 0, RK2928_CLKGATE_CON(7), 11, GFLAGS),
|
||||
GATE(PCLK_WDT, "pclk_wdt", "pclk_peri", 0, RK2928_CLKGATE_CON(7), 15, GFLAGS),
|
||||
GATE(PCLK_SPI0, "pclk_spi0", "pclk_peri", 0, RK2928_CLKGATE_CON(7), 12, GFLAGS),
|
||||
GATE(PCLK_SPI1, "pclk_spi1", "pclk_peri", 0, RK2928_CLKGATE_CON(7), 13, GFLAGS),
|
||||
GATE(PCLK_UART2, "pclk_uart2", "pclk_peri", 0, RK2928_CLKGATE_CON(8), 2, GFLAGS),
|
||||
GATE(PCLK_UART3, "pclk_uart3", "pclk_peri", 0, RK2928_CLKGATE_CON(8), 3, GFLAGS),
|
||||
GATE(PCLK_I2C2, "pclk_i2c2", "pclk_peri", 0, RK2928_CLKGATE_CON(8), 6, GFLAGS),
|
||||
GATE(PCLK_I2C3, "pclk_i2c3", "pclk_peri", 0, RK2928_CLKGATE_CON(8), 7, GFLAGS),
|
||||
GATE(PCLK_I2C4, "pclk_i2c4", "pclk_peri", 0, RK2928_CLKGATE_CON(8), 8, GFLAGS),
|
||||
GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_peri", 0, RK2928_CLKGATE_CON(8), 12, GFLAGS),
|
||||
GATE(PCLK_SARADC, "pclk_saradc", "pclk_peri", 0, RK2928_CLKGATE_CON(7), 14, GFLAGS),
|
||||
};
|
||||
|
||||
PNAME(mux_rk3066_lcdc0_p) = { "dclk_lcdc0_src", "xin27m" };
|
||||
PNAME(mux_rk3066_lcdc1_p) = { "dclk_lcdc1_src", "xin27m" };
|
||||
PNAME(mux_sclk_cif1_p) = { "cif1_pre", "xin24m" };
|
||||
PNAME(mux_sclk_i2s1_p) = { "i2s1_pre", "i2s1_frac", "xin12m" };
|
||||
PNAME(mux_sclk_i2s2_p) = { "i2s2_pre", "i2s2_frac", "xin12m" };
|
||||
|
||||
static struct clk_div_table div_aclk_cpu_t[] = {
|
||||
{ .val = 0, .div = 1 },
|
||||
{ .val = 1, .div = 2 },
|
||||
{ .val = 2, .div = 3 },
|
||||
{ .val = 3, .div = 4 },
|
||||
{ .val = 4, .div = 8 },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
static struct rockchip_clk_branch rk3066a_clk_branches[] __initdata = {
|
||||
COMPOSITE_NOGATE(0, "armclk", mux_armclk_p, 0,
|
||||
RK2928_CLKSEL_CON(0), 8, 1, MFLAGS, 0, 5, DFLAGS),
|
||||
DIVTBL(0, "aclk_cpu_pre", "armclk", 0,
|
||||
RK2928_CLKSEL_CON(1), 0, 3, DFLAGS, div_aclk_cpu_t),
|
||||
|
||||
GATE(CORE_L2C, "core_l2c", "aclk_cpu", 0,
|
||||
RK2928_CLKGATE_CON(9), 4, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "aclk_peri_pre", mux_pll_src_gpll_cpll_p, 0,
|
||||
RK2928_CLKSEL_CON(10), 15, 1, MFLAGS, 0, 5, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 0, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "dclk_lcdc0_src", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK2928_CLKSEL_CON(27), 0, 1, MFLAGS, 8, 8, DFLAGS,
|
||||
RK2928_CLKGATE_CON(3), 1, GFLAGS),
|
||||
MUX(DCLK_LCDC0, "dclk_lcdc0", mux_rk3066_lcdc0_p, 0,
|
||||
RK2928_CLKSEL_CON(27), 4, 1, MFLAGS),
|
||||
COMPOSITE(0, "dclk_lcdc1_src", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK2928_CLKSEL_CON(28), 0, 1, MFLAGS, 8, 8, DFLAGS,
|
||||
RK2928_CLKGATE_CON(3), 2, GFLAGS),
|
||||
MUX(DCLK_LCDC1, "dclk_lcdc1", mux_rk3066_lcdc1_p, 0,
|
||||
RK2928_CLKSEL_CON(28), 4, 1, MFLAGS),
|
||||
|
||||
COMPOSITE_NOMUX(0, "cif1_pre", "cif_src", 0,
|
||||
RK2928_CLKSEL_CON(29), 8, 5, DFLAGS,
|
||||
RK2928_CLKGATE_CON(3), 8, GFLAGS),
|
||||
MUX(SCLK_CIF1, "sclk_cif1", mux_sclk_cif1_p, 0,
|
||||
RK2928_CLKSEL_CON(29), 15, 1, MFLAGS),
|
||||
|
||||
GATE(0, "pclkin_cif1", "ext_cif1", 0,
|
||||
RK2928_CLKGATE_CON(3), 4, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "aclk_gpu_src", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK2928_CLKSEL_CON(33), 8, 1, MFLAGS, 0, 5, DFLAGS,
|
||||
RK2928_CLKGATE_CON(3), 13, GFLAGS),
|
||||
GATE(ACLK_GPU, "aclk_gpu", "aclk_gpu_src", 0,
|
||||
RK2928_CLKGATE_CON(5), 15, GFLAGS),
|
||||
|
||||
GATE(SCLK_TIMER2, "timer2", "xin24m", 0,
|
||||
RK2928_CLKGATE_CON(3), 2, GFLAGS),
|
||||
|
||||
COMPOSITE_NOMUX(0, "sclk_tsadc", "xin24m", 0,
|
||||
RK2928_CLKSEL_CON(34), 0, 16, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 15, GFLAGS),
|
||||
|
||||
MUX(0, "i2s_src", mux_pll_src_gpll_cpll_p, 0,
|
||||
RK2928_CLKSEL_CON(2), 15, 1, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "i2s0_pre", "i2s_src", 0,
|
||||
RK2928_CLKSEL_CON(2), 0, 7, DFLAGS,
|
||||
RK2928_CLKGATE_CON(0), 7, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "i2s0_frac", "i2s0_pre", 0,
|
||||
RK2928_CLKSEL_CON(6), 0,
|
||||
RK2928_CLKGATE_CON(0), 8, GFLAGS),
|
||||
MUX(SCLK_I2S0, "sclk_i2s0", mux_sclk_i2s0_p, 0,
|
||||
RK2928_CLKSEL_CON(2), 8, 2, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "i2s1_pre", "i2s_src", 0,
|
||||
RK2928_CLKSEL_CON(3), 0, 7, DFLAGS,
|
||||
RK2928_CLKGATE_CON(0), 9, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "i2s1_frac", "i2s1_pre", 0,
|
||||
RK2928_CLKSEL_CON(7), 0,
|
||||
RK2928_CLKGATE_CON(0), 10, GFLAGS),
|
||||
MUX(SCLK_I2S1, "sclk_i2s1", mux_sclk_i2s1_p, 0,
|
||||
RK2928_CLKSEL_CON(3), 8, 2, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "i2s2_pre", "i2s_src", 0,
|
||||
RK2928_CLKSEL_CON(4), 0, 7, DFLAGS,
|
||||
RK2928_CLKGATE_CON(0), 11, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "i2s2_frac", "i2s2_pre", 0,
|
||||
RK2928_CLKSEL_CON(8), 0,
|
||||
RK2928_CLKGATE_CON(0), 12, GFLAGS),
|
||||
MUX(SCLK_I2S2, "sclk_i2s2", mux_sclk_i2s2_p, 0,
|
||||
RK2928_CLKSEL_CON(4), 8, 2, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "spdif_pre", "i2s_src", 0,
|
||||
RK2928_CLKSEL_CON(5), 0, 7, DFLAGS,
|
||||
RK2928_CLKGATE_CON(0), 13, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "spdif_frac", "spdif_pll", 0,
|
||||
RK2928_CLKSEL_CON(9), 0,
|
||||
RK2928_CLKGATE_CON(0), 14, GFLAGS),
|
||||
MUX(SCLK_SPDIF, "sclk_spdif", mux_sclk_spdif_p, 0,
|
||||
RK2928_CLKSEL_CON(5), 8, 2, MFLAGS),
|
||||
|
||||
GATE(HCLK_I2S1, "hclk_i2s1", "hclk_cpu", 0, RK2928_CLKGATE_CON(7), 3, GFLAGS),
|
||||
GATE(HCLK_I2S2, "hclk_i2s2", "hclk_cpu", 0, RK2928_CLKGATE_CON(7), 4, GFLAGS),
|
||||
GATE(0, "hclk_cif1", "hclk_cpu", 0, RK2928_CLKGATE_CON(6), 6, GFLAGS),
|
||||
GATE(0, "hclk_hdmi", "hclk_cpu", 0, RK2928_CLKGATE_CON(4), 14, GFLAGS),
|
||||
|
||||
GATE(HCLK_OTG1, "hclk_usbotg1", "hclk_peri", 0, RK2928_CLKGATE_CON(5), 14, GFLAGS),
|
||||
|
||||
GATE(0, "aclk_cif1", "aclk_vio1", 0, RK2928_CLKGATE_CON(6), 7, GFLAGS),
|
||||
|
||||
GATE(PCLK_TIMER1, "pclk_timer1", "pclk_cpu", 0, RK2928_CLKGATE_CON(7), 8, GFLAGS),
|
||||
GATE(PCLK_TIMER2, "pclk_timer2", "pclk_cpu", 0, RK2928_CLKGATE_CON(7), 9, GFLAGS),
|
||||
GATE(PCLK_GPIO6, "pclk_gpio6", "pclk_cpu", 0, RK2928_CLKGATE_CON(8), 15, GFLAGS),
|
||||
GATE(PCLK_UART0, "pclk_uart0", "pclk_cpu", 0, RK2928_CLKGATE_CON(8), 0, GFLAGS),
|
||||
GATE(PCLK_UART1, "pclk_uart1", "pclk_cpu", 0, RK2928_CLKGATE_CON(8), 1, GFLAGS),
|
||||
|
||||
GATE(PCLK_GPIO4, "pclk_gpio4", "pclk_peri", 0, RK2928_CLKGATE_CON(8), 13, GFLAGS),
|
||||
GATE(PCLK_TSADC, "pclk_tsadc", "pclk_peri", 0, RK2928_CLKGATE_CON(4), 13, GFLAGS),
|
||||
};
|
||||
|
||||
static struct clk_div_table div_rk3188_aclk_core_t[] = {
|
||||
{ .val = 0, .div = 1 },
|
||||
{ .val = 1, .div = 2 },
|
||||
{ .val = 2, .div = 3 },
|
||||
{ .val = 3, .div = 4 },
|
||||
{ .val = 4, .div = 8 },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
PNAME(mux_hsicphy_p) = { "sclk_otgphy0", "sclk_otgphy1",
|
||||
"gpll", "cpll" };
|
||||
|
||||
static struct rockchip_clk_branch rk3188_clk_branches[] __initdata = {
|
||||
COMPOSITE_NOGATE(0, "armclk", mux_armclk_p, 0,
|
||||
RK2928_CLKSEL_CON(0), 8, 1, MFLAGS, 9, 5, DFLAGS),
|
||||
COMPOSITE_NOMUX_DIVTBL(0, "aclk_core", "armclk", 0,
|
||||
RK2928_CLKSEL_CON(1), 3, 3, DFLAGS | CLK_DIVIDER_READ_ONLY,
|
||||
div_rk3188_aclk_core_t, RK2928_CLKGATE_CON(0), 7, GFLAGS),
|
||||
|
||||
/* do not source aclk_cpu_pre from the apll, to keep complexity down */
|
||||
COMPOSITE_NOGATE(0, "aclk_cpu_pre", mux_aclk_cpu_p, CLK_SET_RATE_NO_REPARENT,
|
||||
RK2928_CLKSEL_CON(0), 5, 1, MFLAGS, 0, 5, DFLAGS),
|
||||
|
||||
GATE(CORE_L2C, "core_l2c", "armclk", 0,
|
||||
RK2928_CLKGATE_CON(9), 4, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "aclk_peri_pre", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK2928_CLKSEL_CON(10), 15, 1, MFLAGS, 0, 5, DFLAGS,
|
||||
RK2928_CLKGATE_CON(2), 0, GFLAGS),
|
||||
|
||||
COMPOSITE(DCLK_LCDC0, "dclk_lcdc0", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK2928_CLKSEL_CON(27), 0, 1, MFLAGS, 8, 8, DFLAGS,
|
||||
RK2928_CLKGATE_CON(3), 1, GFLAGS),
|
||||
COMPOSITE(DCLK_LCDC1, "dclk_lcdc1", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK2928_CLKSEL_CON(28), 0, 1, MFLAGS, 8, 8, DFLAGS,
|
||||
RK2928_CLKGATE_CON(3), 2, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "aclk_gpu_src", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK2928_CLKSEL_CON(34), 7, 1, MFLAGS, 0, 5, DFLAGS,
|
||||
RK2928_CLKGATE_CON(3), 15, GFLAGS),
|
||||
GATE(ACLK_GPU, "aclk_gpu", "aclk_gpu_src", 0,
|
||||
RK2928_CLKGATE_CON(9), 7, GFLAGS),
|
||||
|
||||
GATE(SCLK_TIMER2, "timer2", "xin24m", 0, RK2928_CLKGATE_CON(3), 4, GFLAGS),
|
||||
GATE(SCLK_TIMER3, "timer3", "xin24m", 0, RK2928_CLKGATE_CON(1), 2, GFLAGS),
|
||||
GATE(SCLK_TIMER4, "timer4", "xin24m", 0, RK2928_CLKGATE_CON(3), 5, GFLAGS),
|
||||
GATE(SCLK_TIMER5, "timer5", "xin24m", 0, RK2928_CLKGATE_CON(3), 8, GFLAGS),
|
||||
GATE(SCLK_TIMER6, "timer6", "xin24m", 0, RK2928_CLKGATE_CON(3), 14, GFLAGS),
|
||||
|
||||
COMPOSITE_NODIV(0, "sclk_hsicphy_480m", mux_hsicphy_p, 0,
|
||||
RK2928_CLKSEL_CON(30), 0, 2, DFLAGS,
|
||||
RK2928_CLKGATE_CON(3), 6, GFLAGS),
|
||||
DIV(0, "sclk_hsicphy_12m", "sclk_hsicphy_480m", 0,
|
||||
RK2928_CLKGATE_CON(11), 8, 6, DFLAGS),
|
||||
|
||||
MUX(0, "i2s_src", mux_pll_src_gpll_cpll_p, 0,
|
||||
RK2928_CLKSEL_CON(2), 15, 1, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "i2s0_pre", "i2s_src", 0,
|
||||
RK2928_CLKSEL_CON(3), 0, 7, DFLAGS,
|
||||
RK2928_CLKGATE_CON(0), 9, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "i2s0_frac", "i2s0_pre", 0,
|
||||
RK2928_CLKSEL_CON(7), 0,
|
||||
RK2928_CLKGATE_CON(0), 10, GFLAGS),
|
||||
MUX(SCLK_I2S0, "sclk_i2s0", mux_sclk_i2s0_p, 0,
|
||||
RK2928_CLKSEL_CON(3), 8, 2, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "spdif_pre", "i2s_src", 0,
|
||||
RK2928_CLKSEL_CON(5), 0, 7, DFLAGS,
|
||||
RK2928_CLKGATE_CON(13), 13, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "spdif_frac", "spdif_pll", 0,
|
||||
RK2928_CLKSEL_CON(9), 0,
|
||||
RK2928_CLKGATE_CON(0), 14, GFLAGS),
|
||||
MUX(SCLK_SPDIF, "sclk_spdif", mux_sclk_spdif_p, 0,
|
||||
RK2928_CLKSEL_CON(5), 8, 2, MFLAGS),
|
||||
|
||||
GATE(0, "hclk_imem0", "hclk_cpu", 0, RK2928_CLKGATE_CON(4), 14, GFLAGS),
|
||||
GATE(0, "hclk_imem1", "hclk_cpu", 0, RK2928_CLKGATE_CON(4), 15, GFLAGS),
|
||||
|
||||
GATE(HCLK_OTG1, "hclk_usbotg1", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 3, GFLAGS),
|
||||
GATE(HCLK_HSIC, "hclk_hsic", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 4, GFLAGS),
|
||||
|
||||
GATE(PCLK_TIMER3, "pclk_timer3", "pclk_cpu", 0, RK2928_CLKGATE_CON(7), 9, GFLAGS),
|
||||
|
||||
GATE(PCLK_UART0, "pclk_uart0", "hclk_ahb2apb", 0, RK2928_CLKGATE_CON(8), 0, GFLAGS),
|
||||
GATE(PCLK_UART1, "pclk_uart1", "hclk_ahb2apb", 0, RK2928_CLKGATE_CON(8), 1, GFLAGS),
|
||||
|
||||
GATE(ACLK_GPS, "aclk_gps", "aclk_peri", 0, RK2928_CLKGATE_CON(8), 13, GFLAGS),
|
||||
};
|
||||
|
||||
static void __init rk3188_common_clk_init(struct device_node *np)
|
||||
{
|
||||
void __iomem *reg_base;
|
||||
struct clk *clk;
|
||||
|
||||
reg_base = of_iomap(np, 0);
|
||||
if (!reg_base) {
|
||||
pr_err("%s: could not map cru region\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
|
||||
|
||||
/* xin12m is created by an cru-internal divider */
|
||||
clk = clk_register_fixed_factor(NULL, "xin12m", "xin24m", 0, 1, 2);
|
||||
if (IS_ERR(clk))
|
||||
pr_warn("%s: could not register clock xin12m: %ld\n",
|
||||
__func__, PTR_ERR(clk));
|
||||
|
||||
clk = clk_register_fixed_factor(NULL, "usb480m", "xin24m", 0, 20, 1);
|
||||
if (IS_ERR(clk))
|
||||
pr_warn("%s: could not register clock usb480m: %ld\n",
|
||||
__func__, PTR_ERR(clk));
|
||||
|
||||
rockchip_clk_register_plls(rk3188_pll_clks,
|
||||
ARRAY_SIZE(rk3188_pll_clks),
|
||||
RK3188_GRF_SOC_STATUS);
|
||||
rockchip_clk_register_branches(common_clk_branches,
|
||||
ARRAY_SIZE(common_clk_branches));
|
||||
|
||||
rockchip_register_softrst(np, 9, reg_base + RK2928_SOFTRST_CON(0),
|
||||
ROCKCHIP_SOFTRST_HIWORD_MASK);
|
||||
}
|
||||
|
||||
static void __init rk3066a_clk_init(struct device_node *np)
|
||||
{
|
||||
rk3188_common_clk_init(np);
|
||||
rockchip_clk_register_branches(rk3066a_clk_branches,
|
||||
ARRAY_SIZE(rk3066a_clk_branches));
|
||||
}
|
||||
CLK_OF_DECLARE(rk3066a_cru, "rockchip,rk3066a-cru", rk3066a_clk_init);
|
||||
|
||||
static void __init rk3188a_clk_init(struct device_node *np)
|
||||
{
|
||||
rk3188_common_clk_init(np);
|
||||
rockchip_clk_register_branches(rk3188_clk_branches,
|
||||
ARRAY_SIZE(rk3188_clk_branches));
|
||||
}
|
||||
CLK_OF_DECLARE(rk3188a_cru, "rockchip,rk3188a-cru", rk3188a_clk_init);
|
||||
|
||||
static void __init rk3188_clk_init(struct device_node *np)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(rk3188_pll_clks); i++) {
|
||||
struct rockchip_pll_clock *pll = &rk3188_pll_clks[i];
|
||||
struct rockchip_pll_rate_table *rate;
|
||||
|
||||
if (!pll->rate_table)
|
||||
continue;
|
||||
|
||||
rate = pll->rate_table;
|
||||
while (rate->rate > 0) {
|
||||
rate->bwadj = 0;
|
||||
rate++;
|
||||
}
|
||||
}
|
||||
|
||||
rk3188a_clk_init(np);
|
||||
}
|
||||
CLK_OF_DECLARE(rk3188_cru, "rockchip,rk3188-cru", rk3188_clk_init);
|
|
@ -0,0 +1,717 @@
|
|||
/*
|
||||
* Copyright (c) 2014 MundoReader S.L.
|
||||
* Author: Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <dt-bindings/clock/rk3288-cru.h>
|
||||
#include "clk.h"
|
||||
|
||||
#define RK3288_GRF_SOC_CON(x) (0x244 + x * 4)
|
||||
#define RK3288_GRF_SOC_STATUS 0x280
|
||||
|
||||
enum rk3288_plls {
|
||||
apll, dpll, cpll, gpll, npll,
|
||||
};
|
||||
|
||||
struct rockchip_pll_rate_table rk3288_pll_rates[] = {
|
||||
RK3066_PLL_RATE(2208000000, 1, 92, 1),
|
||||
RK3066_PLL_RATE(2184000000, 1, 91, 1),
|
||||
RK3066_PLL_RATE(2160000000, 1, 90, 1),
|
||||
RK3066_PLL_RATE(2136000000, 1, 89, 1),
|
||||
RK3066_PLL_RATE(2112000000, 1, 88, 1),
|
||||
RK3066_PLL_RATE(2088000000, 1, 87, 1),
|
||||
RK3066_PLL_RATE(2064000000, 1, 86, 1),
|
||||
RK3066_PLL_RATE(2040000000, 1, 85, 1),
|
||||
RK3066_PLL_RATE(2016000000, 1, 84, 1),
|
||||
RK3066_PLL_RATE(1992000000, 1, 83, 1),
|
||||
RK3066_PLL_RATE(1968000000, 1, 82, 1),
|
||||
RK3066_PLL_RATE(1944000000, 1, 81, 1),
|
||||
RK3066_PLL_RATE(1920000000, 1, 80, 1),
|
||||
RK3066_PLL_RATE(1896000000, 1, 79, 1),
|
||||
RK3066_PLL_RATE(1872000000, 1, 78, 1),
|
||||
RK3066_PLL_RATE(1848000000, 1, 77, 1),
|
||||
RK3066_PLL_RATE(1824000000, 1, 76, 1),
|
||||
RK3066_PLL_RATE(1800000000, 1, 75, 1),
|
||||
RK3066_PLL_RATE(1776000000, 1, 74, 1),
|
||||
RK3066_PLL_RATE(1752000000, 1, 73, 1),
|
||||
RK3066_PLL_RATE(1728000000, 1, 72, 1),
|
||||
RK3066_PLL_RATE(1704000000, 1, 71, 1),
|
||||
RK3066_PLL_RATE(1680000000, 1, 70, 1),
|
||||
RK3066_PLL_RATE(1656000000, 1, 69, 1),
|
||||
RK3066_PLL_RATE(1632000000, 1, 68, 1),
|
||||
RK3066_PLL_RATE(1608000000, 1, 67, 1),
|
||||
RK3066_PLL_RATE(1560000000, 1, 65, 1),
|
||||
RK3066_PLL_RATE(1512000000, 1, 63, 1),
|
||||
RK3066_PLL_RATE(1488000000, 1, 62, 1),
|
||||
RK3066_PLL_RATE(1464000000, 1, 61, 1),
|
||||
RK3066_PLL_RATE(1440000000, 1, 60, 1),
|
||||
RK3066_PLL_RATE(1416000000, 1, 59, 1),
|
||||
RK3066_PLL_RATE(1392000000, 1, 58, 1),
|
||||
RK3066_PLL_RATE(1368000000, 1, 57, 1),
|
||||
RK3066_PLL_RATE(1344000000, 1, 56, 1),
|
||||
RK3066_PLL_RATE(1320000000, 1, 55, 1),
|
||||
RK3066_PLL_RATE(1296000000, 1, 54, 1),
|
||||
RK3066_PLL_RATE(1272000000, 1, 53, 1),
|
||||
RK3066_PLL_RATE(1248000000, 1, 52, 1),
|
||||
RK3066_PLL_RATE(1224000000, 1, 51, 1),
|
||||
RK3066_PLL_RATE(1200000000, 1, 50, 1),
|
||||
RK3066_PLL_RATE(1188000000, 2, 99, 1),
|
||||
RK3066_PLL_RATE(1176000000, 1, 49, 1),
|
||||
RK3066_PLL_RATE(1128000000, 1, 47, 1),
|
||||
RK3066_PLL_RATE(1104000000, 1, 46, 1),
|
||||
RK3066_PLL_RATE(1008000000, 1, 84, 2),
|
||||
RK3066_PLL_RATE( 912000000, 1, 76, 2),
|
||||
RK3066_PLL_RATE( 891000000, 8, 594, 2),
|
||||
RK3066_PLL_RATE( 888000000, 1, 74, 2),
|
||||
RK3066_PLL_RATE( 816000000, 1, 68, 2),
|
||||
RK3066_PLL_RATE( 798000000, 2, 133, 2),
|
||||
RK3066_PLL_RATE( 792000000, 1, 66, 2),
|
||||
RK3066_PLL_RATE( 768000000, 1, 64, 2),
|
||||
RK3066_PLL_RATE( 742500000, 8, 495, 2),
|
||||
RK3066_PLL_RATE( 696000000, 1, 58, 2),
|
||||
RK3066_PLL_RATE( 600000000, 1, 50, 2),
|
||||
RK3066_PLL_RATE( 594000000, 2, 198, 4),
|
||||
RK3066_PLL_RATE( 552000000, 1, 46, 2),
|
||||
RK3066_PLL_RATE( 504000000, 1, 84, 4),
|
||||
RK3066_PLL_RATE( 456000000, 1, 76, 4),
|
||||
RK3066_PLL_RATE( 408000000, 1, 68, 4),
|
||||
RK3066_PLL_RATE( 384000000, 2, 128, 4),
|
||||
RK3066_PLL_RATE( 360000000, 1, 60, 4),
|
||||
RK3066_PLL_RATE( 312000000, 1, 52, 4),
|
||||
RK3066_PLL_RATE( 300000000, 1, 50, 4),
|
||||
RK3066_PLL_RATE( 297000000, 2, 198, 8),
|
||||
RK3066_PLL_RATE( 252000000, 1, 84, 8),
|
||||
RK3066_PLL_RATE( 216000000, 1, 72, 8),
|
||||
RK3066_PLL_RATE( 148500000, 2, 99, 8),
|
||||
RK3066_PLL_RATE( 126000000, 1, 84, 16),
|
||||
RK3066_PLL_RATE( 48000000, 1, 64, 32),
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
PNAME(mux_pll_p) = { "xin24m", "xin32k" };
|
||||
PNAME(mux_armclk_p) = { "apll_core", "gpll_core" };
|
||||
PNAME(mux_ddrphy_p) = { "dpll_ddr", "gpll_ddr" };
|
||||
PNAME(mux_aclk_cpu_src_p) = { "cpll_aclk_cpu", "gpll_aclk_cpu" };
|
||||
|
||||
PNAME(mux_pll_src_cpll_gpll_p) = { "cpll", "gpll" };
|
||||
PNAME(mux_pll_src_npll_cpll_gpll_p) = { "npll", "cpll", "gpll" };
|
||||
PNAME(mux_pll_src_cpll_gpll_npll_p) = { "cpll", "gpll", "npll" };
|
||||
PNAME(mux_pll_src_cpll_gpll_usb480m_p) = { "cpll", "gpll", "usb480m" };
|
||||
|
||||
PNAME(mux_mmc_src_p) = { "cpll", "gpll", "xin24m", "xin24m" };
|
||||
PNAME(mux_i2s_pre_p) = { "i2s_src", "i2s_frac", "ext_i2s", "xin12m" };
|
||||
PNAME(mux_i2s_clkout_p) = { "i2s_pre", "xin12m" };
|
||||
PNAME(mux_spdif_p) = { "spdif_pre", "spdif_frac", "xin12m" };
|
||||
PNAME(mux_spdif_8ch_p) = { "spdif_8ch_pre", "spdif_8ch_frac", "xin12m" };
|
||||
PNAME(mux_uart0_pll_p) = { "cpll", "gpll", "usbphy_480m_src", "npll" };
|
||||
PNAME(mux_uart0_p) = { "uart0_src", "uart0_frac", "xin24m" };
|
||||
PNAME(mux_uart1_p) = { "uart1_src", "uart1_frac", "xin24m" };
|
||||
PNAME(mux_uart2_p) = { "uart2_src", "uart2_frac", "xin24m" };
|
||||
PNAME(mux_uart3_p) = { "uart3_src", "uart3_frac", "xin24m" };
|
||||
PNAME(mux_uart4_p) = { "uart4_src", "uart4_frac", "xin24m" };
|
||||
PNAME(mux_cif_out_p) = { "cif_src", "xin24m" };
|
||||
PNAME(mux_macref_p) = { "mac_src", "ext_gmac" };
|
||||
PNAME(mux_hsadcout_p) = { "hsadc_src", "ext_hsadc" };
|
||||
PNAME(mux_edp_24m_p) = { "ext_edp_24m", "xin24m" };
|
||||
PNAME(mux_tspout_p) = { "cpll", "gpll", "npll", "xin27m" };
|
||||
|
||||
PNAME(mux_usbphy480m_p) = { "sclk_otgphy0", "sclk_otgphy1",
|
||||
"sclk_otgphy2" };
|
||||
PNAME(mux_hsicphy480m_p) = { "cpll", "gpll", "usbphy480m_src" };
|
||||
PNAME(mux_hsicphy12m_p) = { "hsicphy12m_xin12m", "hsicphy12m_usbphy" };
|
||||
|
||||
static struct rockchip_pll_clock rk3288_pll_clks[] __initdata = {
|
||||
[apll] = PLL(pll_rk3066, PLL_APLL, "apll", mux_pll_p, 0, RK3288_PLL_CON(0),
|
||||
RK3288_MODE_CON, 0, 6, rk3288_pll_rates),
|
||||
[dpll] = PLL(pll_rk3066, PLL_DPLL, "dpll", mux_pll_p, 0, RK3288_PLL_CON(4),
|
||||
RK3288_MODE_CON, 4, 5, NULL),
|
||||
[cpll] = PLL(pll_rk3066, PLL_CPLL, "cpll", mux_pll_p, 0, RK3288_PLL_CON(8),
|
||||
RK3288_MODE_CON, 8, 7, rk3288_pll_rates),
|
||||
[gpll] = PLL(pll_rk3066, PLL_GPLL, "gpll", mux_pll_p, 0, RK3288_PLL_CON(12),
|
||||
RK3288_MODE_CON, 12, 8, rk3288_pll_rates),
|
||||
[npll] = PLL(pll_rk3066, PLL_NPLL, "npll", mux_pll_p, 0, RK3288_PLL_CON(16),
|
||||
RK3288_MODE_CON, 14, 9, NULL),
|
||||
};
|
||||
|
||||
static struct clk_div_table div_hclk_cpu_t[] = {
|
||||
{ .val = 0, .div = 1 },
|
||||
{ .val = 1, .div = 2 },
|
||||
{ .val = 3, .div = 4 },
|
||||
{ /* sentinel */},
|
||||
};
|
||||
|
||||
#define MFLAGS CLK_MUX_HIWORD_MASK
|
||||
#define DFLAGS CLK_DIVIDER_HIWORD_MASK
|
||||
#define GFLAGS (CLK_GATE_HIWORD_MASK | CLK_GATE_SET_TO_DISABLE)
|
||||
|
||||
static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
/*
|
||||
* Clock-Architecture Diagram 1
|
||||
*/
|
||||
|
||||
GATE(0, "apll_core", "apll", 0,
|
||||
RK3288_CLKGATE_CON(0), 1, GFLAGS),
|
||||
GATE(0, "gpll_core", "gpll", 0,
|
||||
RK3288_CLKGATE_CON(0), 2, GFLAGS),
|
||||
COMPOSITE_NOGATE(0, "armclk", mux_armclk_p, 0,
|
||||
RK3288_CLKSEL_CON(0), 15, 1, MFLAGS, 8, 5, DFLAGS),
|
||||
|
||||
COMPOSITE_NOMUX(0, "armcore0", "armclk", 0,
|
||||
RK3288_CLKSEL_CON(36), 0, 3, DFLAGS,
|
||||
RK3288_CLKGATE_CON(12), 0, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "armcore1", "armclk", 0,
|
||||
RK3288_CLKSEL_CON(36), 4, 3, DFLAGS,
|
||||
RK3288_CLKGATE_CON(12), 1, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "armcore2", "armclk", 0,
|
||||
RK3288_CLKSEL_CON(36), 8, 3, DFLAGS,
|
||||
RK3288_CLKGATE_CON(12), 2, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "armcore3", "armclk", 0,
|
||||
RK3288_CLKSEL_CON(36), 12, 3, DFLAGS,
|
||||
RK3288_CLKGATE_CON(12), 3, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "l2ram", "armclk", 0,
|
||||
RK3288_CLKSEL_CON(37), 0, 3, DFLAGS,
|
||||
RK3288_CLKGATE_CON(12), 4, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "aclk_core_m0", "armclk", 0,
|
||||
RK3288_CLKSEL_CON(0), 0, 4, DFLAGS,
|
||||
RK3288_CLKGATE_CON(12), 5, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "aclk_core_mp", "armclk", 0,
|
||||
RK3288_CLKSEL_CON(0), 4, 4, DFLAGS,
|
||||
RK3288_CLKGATE_CON(12), 6, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "atclk", "armclk", 0,
|
||||
RK3288_CLKSEL_CON(37), 4, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(12), 7, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "pclk_dbg_pre", "armclk", 0,
|
||||
RK3288_CLKSEL_CON(37), 9, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(12), 8, GFLAGS),
|
||||
GATE(0, "pclk_dbg", "pclk_dbg_pre", 0,
|
||||
RK3288_CLKGATE_CON(12), 9, GFLAGS),
|
||||
GATE(0, "cs_dbg", "pclk_dbg_pre", 0,
|
||||
RK3288_CLKGATE_CON(12), 10, GFLAGS),
|
||||
GATE(0, "pclk_core_niu", "pclk_dbg_pre", 0,
|
||||
RK3288_CLKGATE_CON(12), 11, GFLAGS),
|
||||
|
||||
GATE(0, "dpll_ddr", "dpll", 0,
|
||||
RK3288_CLKGATE_CON(0), 8, GFLAGS),
|
||||
GATE(0, "gpll_ddr", "gpll", 0,
|
||||
RK3288_CLKGATE_CON(0), 9, GFLAGS),
|
||||
COMPOSITE_NOGATE(0, "ddrphy", mux_ddrphy_p, 0,
|
||||
RK3288_CLKSEL_CON(26), 2, 1, MFLAGS, 0, 2,
|
||||
DFLAGS | CLK_DIVIDER_POWER_OF_TWO),
|
||||
|
||||
GATE(0, "gpll_aclk_cpu", "gpll", 0,
|
||||
RK3288_CLKGATE_CON(0), 10, GFLAGS),
|
||||
GATE(0, "cpll_aclk_cpu", "cpll", 0,
|
||||
RK3288_CLKGATE_CON(0), 11, GFLAGS),
|
||||
COMPOSITE_NOGATE(0, "aclk_cpu_src", mux_aclk_cpu_src_p, 0,
|
||||
RK3288_CLKSEL_CON(1), 15, 1, MFLAGS, 3, 5, DFLAGS),
|
||||
DIV(0, "aclk_cpu_pre", "aclk_cpu_src", 0,
|
||||
RK3288_CLKSEL_CON(1), 0, 3, DFLAGS),
|
||||
GATE(0, "aclk_cpu", "aclk_cpu_pre", 0,
|
||||
RK3288_CLKGATE_CON(0), 3, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "pclk_cpu", "aclk_cpu_pre", 0,
|
||||
RK3288_CLKSEL_CON(1), 12, 3, DFLAGS,
|
||||
RK3288_CLKGATE_CON(0), 5, GFLAGS),
|
||||
COMPOSITE_NOMUX_DIVTBL(0, "hclk_cpu", "aclk_cpu_pre", 0,
|
||||
RK3288_CLKSEL_CON(1), 8, 2, DFLAGS, div_hclk_cpu_t,
|
||||
RK3288_CLKGATE_CON(0), 4, GFLAGS),
|
||||
GATE(0, "c2c_host", "aclk_cpu_src", 0,
|
||||
RK3288_CLKGATE_CON(13), 8, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "crypto", "aclk_cpu_pre", 0,
|
||||
RK3288_CLKSEL_CON(26), 6, 2, DFLAGS,
|
||||
RK3288_CLKGATE_CON(5), 4, GFLAGS),
|
||||
GATE(0, "aclk_bus_2pmu", "aclk_cpu_pre", 0,
|
||||
RK3288_CLKGATE_CON(0), 7, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "i2s_src", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(4), 15, 1, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3288_CLKGATE_CON(4), 1, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "i2s_frac", "i2s_src", 0,
|
||||
RK3288_CLKSEL_CON(8), 0,
|
||||
RK3288_CLKGATE_CON(4), 2, GFLAGS),
|
||||
MUX(0, "i2s_pre", mux_i2s_pre_p, 0,
|
||||
RK3288_CLKSEL_CON(4), 8, 2, MFLAGS),
|
||||
COMPOSITE_NODIV(0, "i2s0_clkout", mux_i2s_clkout_p, 0,
|
||||
RK3288_CLKSEL_CON(4), 12, 1, MFLAGS,
|
||||
RK3288_CLKGATE_CON(4), 0, GFLAGS),
|
||||
GATE(SCLK_I2S0, "sclk_i2s0", "i2s_pre", 0,
|
||||
RK3288_CLKGATE_CON(4), 3, GFLAGS),
|
||||
|
||||
MUX(0, "spdif_src", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(5), 15, 1, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "spdif_pre", "spdif_src", 0,
|
||||
RK3288_CLKSEL_CON(5), 0, 7, DFLAGS,
|
||||
RK3288_CLKGATE_CON(4), 4, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "spdif_frac", "spdif_src", 0,
|
||||
RK3288_CLKSEL_CON(9), 0,
|
||||
RK3288_CLKGATE_CON(4), 5, GFLAGS),
|
||||
COMPOSITE_NODIV(SCLK_SPDIF, "sclk_spdif", mux_spdif_p, 0,
|
||||
RK3288_CLKSEL_CON(5), 8, 2, MFLAGS,
|
||||
RK3288_CLKGATE_CON(4), 6, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "spdif_8ch_pre", "spdif_src", 0,
|
||||
RK3288_CLKSEL_CON(40), 0, 7, DFLAGS,
|
||||
RK3288_CLKGATE_CON(4), 7, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "spdif_8ch_frac", "spdif_8ch_src", 0,
|
||||
RK3288_CLKSEL_CON(41), 0,
|
||||
RK3288_CLKGATE_CON(4), 8, GFLAGS),
|
||||
COMPOSITE_NODIV(SCLK_SPDIF8CH, "sclk_spdif_8ch", mux_spdif_8ch_p, 0,
|
||||
RK3288_CLKSEL_CON(40), 8, 2, MFLAGS,
|
||||
RK3288_CLKGATE_CON(4), 9, GFLAGS),
|
||||
|
||||
GATE(0, "sclk_acc_efuse", "xin24m", 0,
|
||||
RK3288_CLKGATE_CON(0), 12, GFLAGS),
|
||||
|
||||
GATE(SCLK_TIMER0, "sclk_timer0", "xin24m", 0,
|
||||
RK3288_CLKGATE_CON(1), 0, GFLAGS),
|
||||
GATE(SCLK_TIMER1, "sclk_timer1", "xin24m", 0,
|
||||
RK3288_CLKGATE_CON(1), 1, GFLAGS),
|
||||
GATE(SCLK_TIMER2, "sclk_timer2", "xin24m", 0,
|
||||
RK3288_CLKGATE_CON(1), 2, GFLAGS),
|
||||
GATE(SCLK_TIMER3, "sclk_timer3", "xin24m", 0,
|
||||
RK3288_CLKGATE_CON(1), 3, GFLAGS),
|
||||
GATE(SCLK_TIMER4, "sclk_timer4", "xin24m", 0,
|
||||
RK3288_CLKGATE_CON(1), 4, GFLAGS),
|
||||
GATE(SCLK_TIMER5, "sclk_timer5", "xin24m", 0,
|
||||
RK3288_CLKGATE_CON(1), 5, GFLAGS),
|
||||
|
||||
/*
|
||||
* Clock-Architecture Diagram 2
|
||||
*/
|
||||
|
||||
COMPOSITE(0, "aclk_vepu", mux_pll_src_cpll_gpll_usb480m_p, 0,
|
||||
RK3288_CLKSEL_CON(32), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 9, GFLAGS),
|
||||
COMPOSITE(0, "aclk_vdpu", mux_pll_src_cpll_gpll_usb480m_p, 0,
|
||||
RK3288_CLKSEL_CON(32), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 11, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "aclk_vio0", mux_pll_src_cpll_gpll_usb480m_p, 0,
|
||||
RK3288_CLKSEL_CON(31), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 0, GFLAGS),
|
||||
DIV(0, "hclk_vio", "aclk_vio0", 0,
|
||||
RK3288_CLKSEL_CON(28), 8, 5, DFLAGS),
|
||||
COMPOSITE(0, "aclk_vio1", mux_pll_src_cpll_gpll_usb480m_p, 0,
|
||||
RK3288_CLKSEL_CON(31), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 2, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "aclk_rga_pre", mux_pll_src_cpll_gpll_usb480m_p, 0,
|
||||
RK3288_CLKSEL_CON(30), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 5, GFLAGS),
|
||||
COMPOSITE(0, "sclk_rga", mux_pll_src_cpll_gpll_usb480m_p, 0,
|
||||
RK3288_CLKSEL_CON(30), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 4, GFLAGS),
|
||||
|
||||
COMPOSITE(DCLK_VOP0, "dclk_vop0", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
RK3288_CLKSEL_CON(27), 0, 2, MFLAGS, 8, 8, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 1, GFLAGS),
|
||||
COMPOSITE(DCLK_VOP1, "dclk_vop1", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
RK3288_CLKSEL_CON(29), 6, 2, MFLAGS, 8, 8, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 3, GFLAGS),
|
||||
|
||||
COMPOSITE_NODIV(0, "sclk_edp_24m", mux_edp_24m_p, 0,
|
||||
RK3288_CLKSEL_CON(28), 15, 1, MFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 12, GFLAGS),
|
||||
COMPOSITE(0, "sclk_edp", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
RK3288_CLKSEL_CON(28), 6, 2, MFLAGS, 0, 6, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 13, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "sclk_isp", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
RK3288_CLKSEL_CON(6), 6, 2, MFLAGS, 0, 6, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 14, GFLAGS),
|
||||
COMPOSITE(0, "sclk_isp_jpe", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
RK3288_CLKSEL_CON(6), 14, 2, MFLAGS, 8, 6, DFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 15, GFLAGS),
|
||||
|
||||
GATE(0, "sclk_hdmi_hdcp", "xin24m", 0,
|
||||
RK3288_CLKGATE_CON(5), 12, GFLAGS),
|
||||
GATE(0, "sclk_hdmi_cec", "xin32k", 0,
|
||||
RK3288_CLKGATE_CON(5), 11, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "aclk_hevc", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
RK3288_CLKSEL_CON(39), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(13), 13, GFLAGS),
|
||||
DIV(0, "hclk_hevc", "aclk_hevc", 0,
|
||||
RK3288_CLKSEL_CON(40), 12, 2, DFLAGS),
|
||||
|
||||
COMPOSITE(0, "sclk_hevc_cabac", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
RK3288_CLKSEL_CON(42), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(13), 14, GFLAGS),
|
||||
COMPOSITE(0, "sclk_hevc_core", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
RK3288_CLKSEL_CON(42), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(13), 15, GFLAGS),
|
||||
|
||||
COMPOSITE_NODIV(0, "vip_src", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(26), 8, 1, MFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 7, GFLAGS),
|
||||
COMPOSITE_NOGATE(0, "sclk_vip_out", mux_cif_out_p, 0,
|
||||
RK3288_CLKSEL_CON(26), 15, 1, MFLAGS, 9, 5, DFLAGS),
|
||||
|
||||
DIV(0, "pclk_pd_alive", "gpll", 0,
|
||||
RK3288_CLKSEL_CON(33), 8, 5, DFLAGS),
|
||||
COMPOSITE_NOMUX(0, "pclk_pd_pmu", "gpll", 0,
|
||||
RK3288_CLKSEL_CON(33), 0, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(5), 8, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_GPU, "sclk_gpu", mux_pll_src_cpll_gpll_usb480m_p, 0,
|
||||
RK3288_CLKSEL_CON(34), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(5), 7, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "aclk_peri_src", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(10), 15, 1, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(2), 0, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "pclk_peri", "aclk_peri_src", 0,
|
||||
RK3288_CLKSEL_CON(10), 12, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO,
|
||||
RK3288_CLKGATE_CON(2), 3, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "hclk_peri", "aclk_peri_src", 0,
|
||||
RK3288_CLKSEL_CON(10), 8, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO,
|
||||
RK3288_CLKGATE_CON(2), 2, GFLAGS),
|
||||
GATE(0, "aclk_peri", "aclk_peri_src", 0,
|
||||
RK3288_CLKGATE_CON(2), 1, GFLAGS),
|
||||
|
||||
/*
|
||||
* Clock-Architecture Diagram 3
|
||||
*/
|
||||
|
||||
COMPOSITE(SCLK_SPI0, "sclk_spi0", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(25), 7, 1, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3288_CLKGATE_CON(2), 9, GFLAGS),
|
||||
COMPOSITE(SCLK_SPI1, "sclk_spi1", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(25), 15, 1, MFLAGS, 8, 7, DFLAGS,
|
||||
RK3288_CLKGATE_CON(2), 10, GFLAGS),
|
||||
COMPOSITE(SCLK_SPI2, "sclk_spi2", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(39), 7, 1, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3288_CLKGATE_CON(2), 11, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_SDMMC, "sclk_sdmmc", mux_mmc_src_p, 0,
|
||||
RK3288_CLKSEL_CON(11), 6, 2, MFLAGS, 0, 6, DFLAGS,
|
||||
RK3288_CLKGATE_CON(13), 0, GFLAGS),
|
||||
COMPOSITE(SCLK_SDIO0, "sclk_sdio0", mux_mmc_src_p, 0,
|
||||
RK3288_CLKSEL_CON(12), 6, 2, MFLAGS, 0, 6, DFLAGS,
|
||||
RK3288_CLKGATE_CON(13), 1, GFLAGS),
|
||||
COMPOSITE(SCLK_SDIO1, "sclk_sdio1", mux_mmc_src_p, 0,
|
||||
RK3288_CLKSEL_CON(34), 14, 2, MFLAGS, 8, 6, DFLAGS,
|
||||
RK3288_CLKGATE_CON(13), 2, GFLAGS),
|
||||
COMPOSITE(SCLK_EMMC, "sclk_emmc", mux_mmc_src_p, 0,
|
||||
RK3288_CLKSEL_CON(12), 14, 2, MFLAGS, 8, 6, DFLAGS,
|
||||
RK3288_CLKGATE_CON(13), 3, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "sclk_tspout", mux_tspout_p, 0,
|
||||
RK3288_CLKSEL_CON(35), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(4), 11, GFLAGS),
|
||||
COMPOSITE(0, "sclk_tsp", mux_pll_src_cpll_gpll_npll_p, 0,
|
||||
RK3288_CLKSEL_CON(35), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(4), 10, GFLAGS),
|
||||
|
||||
GATE(SCLK_OTGPHY0, "sclk_otgphy0", "usb480m", 0,
|
||||
RK3288_CLKGATE_CON(13), 4, GFLAGS),
|
||||
GATE(SCLK_OTGPHY1, "sclk_otgphy1", "usb480m", 0,
|
||||
RK3288_CLKGATE_CON(13), 5, GFLAGS),
|
||||
GATE(SCLK_OTGPHY2, "sclk_otgphy2", "usb480m", 0,
|
||||
RK3288_CLKGATE_CON(13), 6, GFLAGS),
|
||||
GATE(SCLK_OTG_ADP, "sclk_otg_adp", "xin32k", 0,
|
||||
RK3288_CLKGATE_CON(13), 7, GFLAGS),
|
||||
|
||||
COMPOSITE_NOMUX(SCLK_TSADC, "sclk_tsadc", "xin32k", 0,
|
||||
RK3288_CLKSEL_CON(2), 0, 6, DFLAGS,
|
||||
RK3288_CLKGATE_CON(2), 7, GFLAGS),
|
||||
|
||||
COMPOSITE_NOMUX(SCLK_SARADC, "sclk_saradc", "xin24m", 0,
|
||||
RK3288_CLKSEL_CON(24), 8, 8, DFLAGS,
|
||||
RK3288_CLKGATE_CON(2), 8, GFLAGS),
|
||||
|
||||
GATE(SCLK_PS2C, "sclk_ps2c", "xin24m", 0,
|
||||
RK3288_CLKGATE_CON(5), 13, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_NANDC0, "sclk_nandc0", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(38), 7, 1, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(5), 5, GFLAGS),
|
||||
COMPOSITE(SCLK_NANDC1, "sclk_nandc1", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(38), 15, 1, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(5), 6, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "uart0_src", mux_uart0_pll_p, 0,
|
||||
RK3288_CLKSEL_CON(13), 13, 2, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3288_CLKGATE_CON(1), 8, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "uart0_frac", "uart0_src", 0,
|
||||
RK3288_CLKSEL_CON(17), 0,
|
||||
RK3288_CLKGATE_CON(1), 9, GFLAGS),
|
||||
MUX(SCLK_UART0, "sclk_uart0", mux_uart0_p, 0,
|
||||
RK3288_CLKSEL_CON(13), 8, 2, MFLAGS),
|
||||
MUX(0, "uart_src", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(13), 15, 1, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "uart1_src", "uart_src", 0,
|
||||
RK3288_CLKSEL_CON(14), 0, 7, DFLAGS,
|
||||
RK3288_CLKGATE_CON(1), 10, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "uart1_frac", "uart1_src", 0,
|
||||
RK3288_CLKSEL_CON(18), 0,
|
||||
RK3288_CLKGATE_CON(1), 11, GFLAGS),
|
||||
MUX(SCLK_UART1, "sclk_uart1", mux_uart1_p, 0,
|
||||
RK3288_CLKSEL_CON(14), 8, 2, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "uart2_src", "uart_src", 0,
|
||||
RK3288_CLKSEL_CON(15), 0, 7, DFLAGS,
|
||||
RK3288_CLKGATE_CON(1), 12, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "uart2_frac", "uart2_src", 0,
|
||||
RK3288_CLKSEL_CON(19), 0,
|
||||
RK3288_CLKGATE_CON(1), 13, GFLAGS),
|
||||
MUX(SCLK_UART2, "sclk_uart2", mux_uart2_p, 0,
|
||||
RK3288_CLKSEL_CON(15), 8, 2, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "uart3_src", "uart_src", 0,
|
||||
RK3288_CLKSEL_CON(16), 0, 7, DFLAGS,
|
||||
RK3288_CLKGATE_CON(1), 14, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "uart3_frac", "uart3_src", 0,
|
||||
RK3288_CLKSEL_CON(20), 0,
|
||||
RK3288_CLKGATE_CON(1), 15, GFLAGS),
|
||||
MUX(SCLK_UART3, "sclk_uart3", mux_uart3_p, 0,
|
||||
RK3288_CLKSEL_CON(16), 8, 2, MFLAGS),
|
||||
COMPOSITE_NOMUX(0, "uart4_src", "uart_src", 0,
|
||||
RK3288_CLKSEL_CON(3), 0, 7, DFLAGS,
|
||||
RK3288_CLKGATE_CON(2), 12, GFLAGS),
|
||||
COMPOSITE_FRAC(0, "uart4_frac", "uart4_src", 0,
|
||||
RK3288_CLKSEL_CON(7), 0,
|
||||
RK3288_CLKGATE_CON(2), 13, GFLAGS),
|
||||
MUX(SCLK_UART4, "sclk_uart4", mux_uart4_p, 0,
|
||||
RK3288_CLKSEL_CON(3), 8, 2, MFLAGS),
|
||||
|
||||
COMPOSITE(0, "mac_src", mux_pll_src_npll_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(21), 0, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3288_CLKGATE_CON(2), 5, GFLAGS),
|
||||
MUX(0, "macref", mux_macref_p, 0,
|
||||
RK3288_CLKSEL_CON(21), 4, 1, MFLAGS),
|
||||
GATE(0, "sclk_macref_out", "macref", 0,
|
||||
RK3288_CLKGATE_CON(5), 3, GFLAGS),
|
||||
GATE(SCLK_MACREF, "sclk_macref", "macref", 0,
|
||||
RK3288_CLKGATE_CON(5), 2, GFLAGS),
|
||||
GATE(SCLK_MAC_RX, "sclk_mac_rx", "macref", 0,
|
||||
RK3288_CLKGATE_CON(5), 0, GFLAGS),
|
||||
GATE(SCLK_MAC_TX, "sclk_mac_tx", "macref", 0,
|
||||
RK3288_CLKGATE_CON(5), 1, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "hsadc_src", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(22), 0, 1, MFLAGS, 8, 8, DFLAGS,
|
||||
RK3288_CLKGATE_CON(2), 6, GFLAGS),
|
||||
MUX(SCLK_HSADC, "sclk_hsadc_out", mux_hsadcout_p, 0,
|
||||
RK3288_CLKSEL_CON(22), 4, 1, MFLAGS),
|
||||
|
||||
GATE(0, "jtag", "ext_jtag", 0,
|
||||
RK3288_CLKGATE_CON(4), 14, GFLAGS),
|
||||
|
||||
COMPOSITE_NODIV(0, "usbphy480m_src", mux_usbphy480m_p, 0,
|
||||
RK3288_CLKSEL_CON(13), 11, 2, MFLAGS,
|
||||
RK3288_CLKGATE_CON(5), 15, GFLAGS),
|
||||
COMPOSITE_NODIV(SCLK_HSICPHY480M, "sclk_hsicphy480m", mux_hsicphy480m_p, 0,
|
||||
RK3288_CLKSEL_CON(29), 0, 2, MFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 6, GFLAGS),
|
||||
GATE(0, "hsicphy12m_xin12m", "xin12m", 0,
|
||||
RK3288_CLKGATE_CON(13), 9, GFLAGS),
|
||||
DIV(0, "hsicphy12m_usbphy", "sclk_hsicphy480m", 0,
|
||||
RK3288_CLKSEL_CON(11), 8, 6, DFLAGS),
|
||||
MUX(SCLK_HSICPHY12M, "sclk_hsicphy12m", mux_hsicphy12m_p, 0,
|
||||
RK3288_CLKSEL_CON(22), 4, 1, MFLAGS),
|
||||
|
||||
/*
|
||||
* Clock-Architecture Diagram 4
|
||||
*/
|
||||
|
||||
/* aclk_cpu gates */
|
||||
GATE(0, "sclk_intmem0", "aclk_cpu", 0, RK3288_CLKGATE_CON(10), 5, GFLAGS),
|
||||
GATE(0, "sclk_intmem1", "aclk_cpu", 0, RK3288_CLKGATE_CON(10), 6, GFLAGS),
|
||||
GATE(0, "sclk_intmem2", "aclk_cpu", 0, RK3288_CLKGATE_CON(10), 7, GFLAGS),
|
||||
GATE(ACLK_DMAC1, "aclk_dmac1", "aclk_cpu", 0, RK3288_CLKGATE_CON(10), 12, GFLAGS),
|
||||
GATE(0, "aclk_strc_sys", "aclk_cpu", 0, RK3288_CLKGATE_CON(10), 13, GFLAGS),
|
||||
GATE(0, "aclk_intmem", "aclk_cpu", 0, RK3288_CLKGATE_CON(10), 4, GFLAGS),
|
||||
GATE(ACLK_CRYPTO, "aclk_crypto", "aclk_cpu", 0, RK3288_CLKGATE_CON(11), 6, GFLAGS),
|
||||
GATE(0, "aclk_ccp", "aclk_cpu", 0, RK3288_CLKGATE_CON(11), 8, GFLAGS),
|
||||
|
||||
/* hclk_cpu gates */
|
||||
GATE(HCLK_CRYPTO, "hclk_crypto", "hclk_cpu", 0, RK3288_CLKGATE_CON(11), 7, GFLAGS),
|
||||
GATE(HCLK_I2S0, "hclk_i2s0", "hclk_cpu", 0, RK3288_CLKGATE_CON(10), 8, GFLAGS),
|
||||
GATE(HCLK_ROM, "hclk_rom", "hclk_cpu", 0, RK3288_CLKGATE_CON(10), 9, GFLAGS),
|
||||
GATE(HCLK_SPDIF, "hclk_spdif", "hclk_cpu", 0, RK3288_CLKGATE_CON(10), 10, GFLAGS),
|
||||
GATE(HCLK_SPDIF8CH, "hclk_spdif_8ch", "hclk_cpu", 0, RK3288_CLKGATE_CON(10), 11, GFLAGS),
|
||||
|
||||
/* pclk_cpu gates */
|
||||
GATE(PCLK_PWM, "pclk_pwm", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 0, GFLAGS),
|
||||
GATE(PCLK_TIMER, "pclk_timer", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 1, GFLAGS),
|
||||
GATE(PCLK_I2C0, "pclk_i2c0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 2, GFLAGS),
|
||||
GATE(PCLK_I2C1, "pclk_i2c1", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 3, GFLAGS),
|
||||
GATE(0, "pclk_ddrupctl0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 14, GFLAGS),
|
||||
GATE(0, "pclk_publ0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 15, GFLAGS),
|
||||
GATE(0, "pclk_ddrupctl1", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 0, GFLAGS),
|
||||
GATE(0, "pclk_publ1", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 1, GFLAGS),
|
||||
GATE(0, "pclk_efuse_1024", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 2, GFLAGS),
|
||||
GATE(PCLK_TZPC, "pclk_tzpc", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 3, GFLAGS),
|
||||
GATE(PCLK_UART2, "pclk_uart2", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 9, GFLAGS),
|
||||
GATE(0, "pclk_efuse_256", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 10, GFLAGS),
|
||||
GATE(PCLK_RKPWM, "pclk_rkpwm", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 11, GFLAGS),
|
||||
|
||||
/* ddrctrl [DDR Controller PHY clock] gates */
|
||||
GATE(0, "nclk_ddrupctl0", "ddrphy", 0, RK3288_CLKGATE_CON(11), 4, GFLAGS),
|
||||
GATE(0, "nclk_ddrupctl1", "ddrphy", 0, RK3288_CLKGATE_CON(11), 5, GFLAGS),
|
||||
|
||||
/* ddrphy gates */
|
||||
GATE(0, "sclk_ddrphy0", "ddrphy", 0, RK3288_CLKGATE_CON(4), 12, GFLAGS),
|
||||
GATE(0, "sclk_ddrphy1", "ddrphy", 0, RK3288_CLKGATE_CON(4), 13, GFLAGS),
|
||||
|
||||
/* aclk_peri gates */
|
||||
GATE(0, "aclk_peri_axi_matrix", "aclk_peri", 0, RK3288_CLKGATE_CON(6), 2, GFLAGS),
|
||||
GATE(ACLK_DMAC2, "aclk_dmac2", "aclk_peri", 0, RK3288_CLKGATE_CON(6), 3, GFLAGS),
|
||||
GATE(0, "aclk_peri_niu", "aclk_peri", 0, RK3288_CLKGATE_CON(7), 11, GFLAGS),
|
||||
GATE(ACLK_MMU, "aclk_mmu", "aclk_peri", 0, RK3288_CLKGATE_CON(8), 12, GFLAGS),
|
||||
GATE(ACLK_GMAC, "aclk_gmac", "aclk_peri", 0, RK3288_CLKGATE_CON(8), 0, GFLAGS),
|
||||
GATE(HCLK_GPS, "hclk_gps", "aclk_peri", 0, RK3288_CLKGATE_CON(8), 2, GFLAGS),
|
||||
|
||||
/* hclk_peri gates */
|
||||
GATE(0, "hclk_peri_matrix", "hclk_peri", 0, RK3288_CLKGATE_CON(6), 0, GFLAGS),
|
||||
GATE(HCLK_OTG0, "hclk_otg0", "hclk_peri", 0, RK3288_CLKGATE_CON(7), 4, GFLAGS),
|
||||
GATE(HCLK_USBHOST0, "hclk_host0", "hclk_peri", 0, RK3288_CLKGATE_CON(7), 6, GFLAGS),
|
||||
GATE(HCLK_USBHOST1, "hclk_host1", "hclk_peri", 0, RK3288_CLKGATE_CON(7), 7, GFLAGS),
|
||||
GATE(HCLK_HSIC, "hclk_hsic", "hclk_peri", 0, RK3288_CLKGATE_CON(7), 8, GFLAGS),
|
||||
GATE(0, "hclk_usb_peri", "hclk_peri", 0, RK3288_CLKGATE_CON(7), 9, GFLAGS),
|
||||
GATE(0, "hclk_peri_ahb_arbi", "hclk_peri", 0, RK3288_CLKGATE_CON(7), 10, GFLAGS),
|
||||
GATE(0, "hclk_emem", "hclk_peri", 0, RK3288_CLKGATE_CON(7), 12, GFLAGS),
|
||||
GATE(0, "hclk_mem", "hclk_peri", 0, RK3288_CLKGATE_CON(7), 13, GFLAGS),
|
||||
GATE(HCLK_NANDC0, "hclk_nandc0", "hclk_peri", 0, RK3288_CLKGATE_CON(7), 14, GFLAGS),
|
||||
GATE(HCLK_NANDC1, "hclk_nandc1", "hclk_peri", 0, RK3288_CLKGATE_CON(7), 15, GFLAGS),
|
||||
GATE(HCLK_TSP, "hclk_tsp", "hclk_peri", 0, RK3288_CLKGATE_CON(8), 8, GFLAGS),
|
||||
GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 0, RK3288_CLKGATE_CON(8), 3, GFLAGS),
|
||||
GATE(HCLK_SDIO0, "hclk_sdio0", "hclk_peri", 0, RK3288_CLKGATE_CON(8), 4, GFLAGS),
|
||||
GATE(HCLK_SDIO1, "hclk_sdio1", "hclk_peri", 0, RK3288_CLKGATE_CON(8), 5, GFLAGS),
|
||||
GATE(HCLK_EMMC, "hclk_emmc", "hclk_peri", 0, RK3288_CLKGATE_CON(8), 6, GFLAGS),
|
||||
GATE(HCLK_HSADC, "hclk_hsadc", "hclk_peri", 0, RK3288_CLKGATE_CON(8), 7, GFLAGS),
|
||||
GATE(0, "pmu_hclk_otg0", "hclk_peri", 0, RK3288_CLKGATE_CON(7), 5, GFLAGS),
|
||||
|
||||
/* pclk_peri gates */
|
||||
GATE(0, "pclk_peri_matrix", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 1, GFLAGS),
|
||||
GATE(PCLK_SPI0, "pclk_spi0", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 4, GFLAGS),
|
||||
GATE(PCLK_SPI1, "pclk_spi1", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 5, GFLAGS),
|
||||
GATE(PCLK_SPI2, "pclk_spi2", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 6, GFLAGS),
|
||||
GATE(PCLK_PS2C, "pclk_ps2c", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 7, GFLAGS),
|
||||
GATE(PCLK_UART0, "pclk_uart0", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 8, GFLAGS),
|
||||
GATE(PCLK_UART1, "pclk_uart1", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 9, GFLAGS),
|
||||
GATE(PCLK_I2C4, "pclk_i2c4", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 15, GFLAGS),
|
||||
GATE(PCLK_UART3, "pclk_uart3", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 11, GFLAGS),
|
||||
GATE(PCLK_UART4, "pclk_uart4", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 12, GFLAGS),
|
||||
GATE(PCLK_I2C2, "pclk_i2c2", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 13, GFLAGS),
|
||||
GATE(PCLK_I2C3, "pclk_i2c3", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 14, GFLAGS),
|
||||
GATE(PCLK_SARADC, "pclk_saradc", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 1, GFLAGS),
|
||||
GATE(PCLK_TSADC, "pclk_tsadc", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 2, GFLAGS),
|
||||
GATE(PCLK_SIM, "pclk_sim", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 3, GFLAGS),
|
||||
GATE(PCLK_I2C5, "pclk_i2c5", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 0, GFLAGS),
|
||||
GATE(PCLK_GMAC, "pclk_gmac", "pclk_peri", 0, RK3288_CLKGATE_CON(8), 1, GFLAGS),
|
||||
|
||||
GATE(SCLK_LCDC_PWM0, "sclk_lcdc_pwm0", "xin24m", 0, RK3288_CLKGATE_CON(13), 10, GFLAGS),
|
||||
GATE(SCLK_LCDC_PWM1, "sclk_lcdc_pwm1", "xin24m", 0, RK3288_CLKGATE_CON(13), 11, GFLAGS),
|
||||
GATE(0, "sclk_pvtm_core", "xin24m", 0, RK3288_CLKGATE_CON(5), 9, GFLAGS),
|
||||
GATE(0, "sclk_pvtm_gpu", "xin24m", 0, RK3288_CLKGATE_CON(5), 10, GFLAGS),
|
||||
GATE(0, "sclk_mipidsi_24m", "xin24m", 0, RK3288_CLKGATE_CON(5), 15, GFLAGS),
|
||||
|
||||
/* sclk_gpu gates */
|
||||
GATE(ACLK_GPU, "aclk_gpu", "sclk_gpu", 0, RK3288_CLKGATE_CON(18), 0, GFLAGS),
|
||||
|
||||
/* pclk_pd_alive gates */
|
||||
GATE(PCLK_GPIO8, "pclk_gpio8", "pclk_pd_alive", 0, RK3288_CLKGATE_CON(14), 8, GFLAGS),
|
||||
GATE(PCLK_GPIO7, "pclk_gpio7", "pclk_pd_alive", 0, RK3288_CLKGATE_CON(14), 7, GFLAGS),
|
||||
GATE(PCLK_GPIO1, "pclk_gpio1", "pclk_pd_alive", 0, RK3288_CLKGATE_CON(14), 1, GFLAGS),
|
||||
GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_pd_alive", 0, RK3288_CLKGATE_CON(14), 2, GFLAGS),
|
||||
GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_pd_alive", 0, RK3288_CLKGATE_CON(14), 3, GFLAGS),
|
||||
GATE(PCLK_GPIO4, "pclk_gpio4", "pclk_pd_alive", 0, RK3288_CLKGATE_CON(14), 4, GFLAGS),
|
||||
GATE(PCLK_GPIO5, "pclk_gpio5", "pclk_pd_alive", 0, RK3288_CLKGATE_CON(14), 5, GFLAGS),
|
||||
GATE(PCLK_GPIO6, "pclk_gpio6", "pclk_pd_alive", 0, RK3288_CLKGATE_CON(14), 6, GFLAGS),
|
||||
GATE(PCLK_GRF, "pclk_grf", "pclk_pd_alive", 0, RK3288_CLKGATE_CON(14), 11, GFLAGS),
|
||||
GATE(0, "pclk_alive_niu", "pclk_pd_alive", 0, RK3288_CLKGATE_CON(14), 12, GFLAGS),
|
||||
|
||||
/* pclk_pd_pmu gates */
|
||||
GATE(PCLK_PMU, "pclk_pmu", "pclk_pd_pmu", 0, RK3288_CLKGATE_CON(17), 0, GFLAGS),
|
||||
GATE(0, "pclk_intmem1", "pclk_pd_pmu", 0, RK3288_CLKGATE_CON(17), 1, GFLAGS),
|
||||
GATE(0, "pclk_pmu_niu", "pclk_pd_pmu", 0, RK3288_CLKGATE_CON(17), 2, GFLAGS),
|
||||
GATE(PCLK_SGRF, "pclk_sgrf", "pclk_pd_pmu", 0, RK3288_CLKGATE_CON(17), 3, GFLAGS),
|
||||
GATE(PCLK_GPIO0, "pclk_gpio0", "pclk_pd_pmu", 0, RK3288_CLKGATE_CON(17), 4, GFLAGS),
|
||||
|
||||
/* hclk_vio gates */
|
||||
GATE(HCLK_RGA, "hclk_rga", "hclk_vio", 0, RK3288_CLKGATE_CON(15), 1, GFLAGS),
|
||||
GATE(HCLK_VOP0, "hclk_vop0", "hclk_vio", 0, RK3288_CLKGATE_CON(15), 6, GFLAGS),
|
||||
GATE(HCLK_VOP1, "hclk_vop1", "hclk_vio", 0, RK3288_CLKGATE_CON(15), 8, GFLAGS),
|
||||
GATE(0, "hclk_vio_ahb_arbi", "hclk_vio", 0, RK3288_CLKGATE_CON(15), 9, GFLAGS),
|
||||
GATE(0, "hclk_vio_niu", "hclk_vio", 0, RK3288_CLKGATE_CON(15), 10, GFLAGS),
|
||||
GATE(0, "hclk_vip", "hclk_vio", 0, RK3288_CLKGATE_CON(15), 15, GFLAGS),
|
||||
GATE(HCLK_IEP, "hclk_iep", "hclk_vio", 0, RK3288_CLKGATE_CON(15), 3, GFLAGS),
|
||||
GATE(HCLK_ISP, "hclk_isp", "hclk_vio", 0, RK3288_CLKGATE_CON(16), 1, GFLAGS),
|
||||
GATE(0, "hclk_vio2_h2p", "hclk_vio", 0, RK3288_CLKGATE_CON(16), 10, GFLAGS),
|
||||
GATE(0, "pclk_mipi_dsi0", "hclk_vio", 0, RK3288_CLKGATE_CON(16), 4, GFLAGS),
|
||||
GATE(0, "pclk_mipi_dsi1", "hclk_vio", 0, RK3288_CLKGATE_CON(16), 5, GFLAGS),
|
||||
GATE(0, "pclk_mipi_csi", "hclk_vio", 0, RK3288_CLKGATE_CON(16), 6, GFLAGS),
|
||||
GATE(0, "pclk_lvds_phy", "hclk_vio", 0, RK3288_CLKGATE_CON(16), 7, GFLAGS),
|
||||
GATE(0, "pclk_edp_ctrl", "hclk_vio", 0, RK3288_CLKGATE_CON(16), 8, GFLAGS),
|
||||
GATE(0, "pclk_hdmi_ctrl", "hclk_vio", 0, RK3288_CLKGATE_CON(16), 9, GFLAGS),
|
||||
GATE(0, "pclk_vio2_h2p", "hclk_vio", 0, RK3288_CLKGATE_CON(16), 11, GFLAGS),
|
||||
|
||||
/* aclk_vio0 gates */
|
||||
GATE(ACLK_VOP0, "aclk_vop0", "aclk_vio0", 0, RK3288_CLKGATE_CON(15), 5, GFLAGS),
|
||||
GATE(0, "aclk_iep", "aclk_vio0", 0, RK3288_CLKGATE_CON(15), 2, GFLAGS),
|
||||
GATE(0, "aclk_vio0_niu", "aclk_vio0", 0, RK3288_CLKGATE_CON(15), 11, GFLAGS),
|
||||
GATE(0, "aclk_vip", "aclk_vio0", 0, RK3288_CLKGATE_CON(15), 14, GFLAGS),
|
||||
|
||||
/* aclk_vio1 gates */
|
||||
GATE(ACLK_VOP1, "aclk_vop1", "aclk_vio1", 0, RK3288_CLKGATE_CON(15), 7, GFLAGS),
|
||||
GATE(0, "aclk_isp", "aclk_vio1", 0, RK3288_CLKGATE_CON(16), 2, GFLAGS),
|
||||
GATE(0, "aclk_vio1_niu", "aclk_vio1", 0, RK3288_CLKGATE_CON(15), 12, GFLAGS),
|
||||
|
||||
/* aclk_rga_pre gates */
|
||||
GATE(ACLK_RGA, "aclk_rga", "aclk_rga_pre", 0, RK3288_CLKGATE_CON(15), 0, GFLAGS),
|
||||
GATE(0, "aclk_rga_niu", "aclk_rga_pre", 0, RK3288_CLKGATE_CON(15), 13, GFLAGS),
|
||||
|
||||
/*
|
||||
* Other ungrouped clocks.
|
||||
*/
|
||||
|
||||
GATE(0, "pclk_vip_in", "ext_vip", 0, RK3288_CLKGATE_CON(16), 0, GFLAGS),
|
||||
GATE(0, "pclk_isp_in", "ext_isp", 0, RK3288_CLKGATE_CON(16), 3, GFLAGS),
|
||||
};
|
||||
|
||||
static void __init rk3288_clk_init(struct device_node *np)
|
||||
{
|
||||
void __iomem *reg_base;
|
||||
struct clk *clk;
|
||||
|
||||
reg_base = of_iomap(np, 0);
|
||||
if (!reg_base) {
|
||||
pr_err("%s: could not map cru region\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
|
||||
|
||||
/* xin12m is created by an cru-internal divider */
|
||||
clk = clk_register_fixed_factor(NULL, "xin12m", "xin24m", 0, 1, 2);
|
||||
if (IS_ERR(clk))
|
||||
pr_warn("%s: could not register clock xin12m: %ld\n",
|
||||
__func__, PTR_ERR(clk));
|
||||
|
||||
|
||||
clk = clk_register_fixed_factor(NULL, "usb480m", "xin24m", 0, 20, 1);
|
||||
if (IS_ERR(clk))
|
||||
pr_warn("%s: could not register clock usb480m: %ld\n",
|
||||
__func__, PTR_ERR(clk));
|
||||
|
||||
rockchip_clk_register_plls(rk3288_pll_clks,
|
||||
ARRAY_SIZE(rk3288_pll_clks),
|
||||
RK3288_GRF_SOC_STATUS);
|
||||
rockchip_clk_register_branches(rk3288_clk_branches,
|
||||
ARRAY_SIZE(rk3288_clk_branches));
|
||||
|
||||
rockchip_register_softrst(np, 9, reg_base + RK3288_SOFTRST_CON(0),
|
||||
ROCKCHIP_SOFTRST_HIWORD_MASK);
|
||||
}
|
||||
CLK_OF_DECLARE(rk3288_cru, "rockchip,rk3288-cru", rk3288_clk_init);
|
|
@ -0,0 +1,244 @@
|
|||
/*
|
||||
* Copyright (c) 2014 MundoReader S.L.
|
||||
* Author: Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* based on
|
||||
*
|
||||
* samsung/clk.c
|
||||
* Copyright (c) 2013 Samsung Electronics Co., Ltd.
|
||||
* Copyright (c) 2013 Linaro Ltd.
|
||||
* Author: Thomas Abraham <thomas.ab@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/regmap.h>
|
||||
#include "clk.h"
|
||||
|
||||
/**
|
||||
* Register a clock branch.
|
||||
* Most clock branches have a form like
|
||||
*
|
||||
* src1 --|--\
|
||||
* |M |--[GATE]-[DIV]-
|
||||
* src2 --|--/
|
||||
*
|
||||
* sometimes without one of those components.
|
||||
*/
|
||||
struct clk *rockchip_clk_register_branch(const char *name,
|
||||
const char **parent_names, u8 num_parents, void __iomem *base,
|
||||
int muxdiv_offset, u8 mux_shift, u8 mux_width, u8 mux_flags,
|
||||
u8 div_shift, u8 div_width, u8 div_flags,
|
||||
struct clk_div_table *div_table, int gate_offset,
|
||||
u8 gate_shift, u8 gate_flags, unsigned long flags,
|
||||
spinlock_t *lock)
|
||||
{
|
||||
struct clk *clk;
|
||||
struct clk_mux *mux = NULL;
|
||||
struct clk_gate *gate = NULL;
|
||||
struct clk_divider *div = NULL;
|
||||
const struct clk_ops *mux_ops = NULL, *div_ops = NULL,
|
||||
*gate_ops = NULL;
|
||||
|
||||
if (num_parents > 1) {
|
||||
mux = kzalloc(sizeof(*mux), GFP_KERNEL);
|
||||
if (!mux)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
mux->reg = base + muxdiv_offset;
|
||||
mux->shift = mux_shift;
|
||||
mux->mask = BIT(mux_width) - 1;
|
||||
mux->flags = mux_flags;
|
||||
mux->lock = lock;
|
||||
mux_ops = (mux_flags & CLK_MUX_READ_ONLY) ? &clk_mux_ro_ops
|
||||
: &clk_mux_ops;
|
||||
}
|
||||
|
||||
if (gate_offset >= 0) {
|
||||
gate = kzalloc(sizeof(*gate), GFP_KERNEL);
|
||||
if (!gate)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
gate->flags = gate_flags;
|
||||
gate->reg = base + gate_offset;
|
||||
gate->bit_idx = gate_shift;
|
||||
gate->lock = lock;
|
||||
gate_ops = &clk_gate_ops;
|
||||
}
|
||||
|
||||
if (div_width > 0) {
|
||||
div = kzalloc(sizeof(*div), GFP_KERNEL);
|
||||
if (!div)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
div->flags = div_flags;
|
||||
div->reg = base + muxdiv_offset;
|
||||
div->shift = div_shift;
|
||||
div->width = div_width;
|
||||
div->lock = lock;
|
||||
div->table = div_table;
|
||||
div_ops = (div_flags & CLK_DIVIDER_READ_ONLY)
|
||||
? &clk_divider_ro_ops
|
||||
: &clk_divider_ops;
|
||||
}
|
||||
|
||||
clk = clk_register_composite(NULL, name, parent_names, num_parents,
|
||||
mux ? &mux->hw : NULL, mux_ops,
|
||||
div ? &div->hw : NULL, div_ops,
|
||||
gate ? &gate->hw : NULL, gate_ops,
|
||||
flags);
|
||||
|
||||
return clk;
|
||||
}
|
||||
|
||||
static DEFINE_SPINLOCK(clk_lock);
|
||||
static struct clk **clk_table;
|
||||
static void __iomem *reg_base;
|
||||
static struct clk_onecell_data clk_data;
|
||||
static struct device_node *cru_node;
|
||||
static struct regmap *grf;
|
||||
|
||||
void __init rockchip_clk_init(struct device_node *np, void __iomem *base,
|
||||
unsigned long nr_clks)
|
||||
{
|
||||
reg_base = base;
|
||||
cru_node = np;
|
||||
grf = ERR_PTR(-EPROBE_DEFER);
|
||||
|
||||
clk_table = kcalloc(nr_clks, sizeof(struct clk *), GFP_KERNEL);
|
||||
if (!clk_table)
|
||||
pr_err("%s: could not allocate clock lookup table\n", __func__);
|
||||
|
||||
clk_data.clks = clk_table;
|
||||
clk_data.clk_num = nr_clks;
|
||||
of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
|
||||
}
|
||||
|
||||
struct regmap *rockchip_clk_get_grf(void)
|
||||
{
|
||||
if (IS_ERR(grf))
|
||||
grf = syscon_regmap_lookup_by_phandle(cru_node, "rockchip,grf");
|
||||
return grf;
|
||||
}
|
||||
|
||||
void rockchip_clk_add_lookup(struct clk *clk, unsigned int id)
|
||||
{
|
||||
if (clk_table && id)
|
||||
clk_table[id] = clk;
|
||||
}
|
||||
|
||||
void __init rockchip_clk_register_plls(struct rockchip_pll_clock *list,
|
||||
unsigned int nr_pll, int grf_lock_offset)
|
||||
{
|
||||
struct clk *clk;
|
||||
int idx;
|
||||
|
||||
for (idx = 0; idx < nr_pll; idx++, list++) {
|
||||
clk = rockchip_clk_register_pll(list->type, list->name,
|
||||
list->parent_names, list->num_parents,
|
||||
reg_base, list->con_offset, grf_lock_offset,
|
||||
list->lock_shift, list->mode_offset,
|
||||
list->mode_shift, list->rate_table, &clk_lock);
|
||||
if (IS_ERR(clk)) {
|
||||
pr_err("%s: failed to register clock %s\n", __func__,
|
||||
list->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
rockchip_clk_add_lookup(clk, list->id);
|
||||
}
|
||||
}
|
||||
|
||||
void __init rockchip_clk_register_branches(
|
||||
struct rockchip_clk_branch *list,
|
||||
unsigned int nr_clk)
|
||||
{
|
||||
struct clk *clk = NULL;
|
||||
unsigned int idx;
|
||||
unsigned long flags;
|
||||
|
||||
for (idx = 0; idx < nr_clk; idx++, list++) {
|
||||
flags = list->flags;
|
||||
|
||||
/* catch simple muxes */
|
||||
switch (list->branch_type) {
|
||||
case branch_mux:
|
||||
clk = clk_register_mux(NULL, list->name,
|
||||
list->parent_names, list->num_parents,
|
||||
flags, reg_base + list->muxdiv_offset,
|
||||
list->mux_shift, list->mux_width,
|
||||
list->mux_flags, &clk_lock);
|
||||
break;
|
||||
case branch_divider:
|
||||
if (list->div_table)
|
||||
clk = clk_register_divider_table(NULL,
|
||||
list->name, list->parent_names[0],
|
||||
flags, reg_base + list->muxdiv_offset,
|
||||
list->div_shift, list->div_width,
|
||||
list->div_flags, list->div_table,
|
||||
&clk_lock);
|
||||
else
|
||||
clk = clk_register_divider(NULL, list->name,
|
||||
list->parent_names[0], flags,
|
||||
reg_base + list->muxdiv_offset,
|
||||
list->div_shift, list->div_width,
|
||||
list->div_flags, &clk_lock);
|
||||
break;
|
||||
case branch_fraction_divider:
|
||||
/* unimplemented */
|
||||
continue;
|
||||
break;
|
||||
case branch_gate:
|
||||
flags |= CLK_SET_RATE_PARENT;
|
||||
|
||||
/* keep all gates untouched for now */
|
||||
flags |= CLK_IGNORE_UNUSED;
|
||||
|
||||
clk = clk_register_gate(NULL, list->name,
|
||||
list->parent_names[0], flags,
|
||||
reg_base + list->gate_offset,
|
||||
list->gate_shift, list->gate_flags, &clk_lock);
|
||||
break;
|
||||
case branch_composite:
|
||||
/* keep all gates untouched for now */
|
||||
flags |= CLK_IGNORE_UNUSED;
|
||||
|
||||
clk = rockchip_clk_register_branch(list->name,
|
||||
list->parent_names, list->num_parents,
|
||||
reg_base, list->muxdiv_offset, list->mux_shift,
|
||||
list->mux_width, list->mux_flags,
|
||||
list->div_shift, list->div_width,
|
||||
list->div_flags, list->div_table,
|
||||
list->gate_offset, list->gate_shift,
|
||||
list->gate_flags, flags, &clk_lock);
|
||||
break;
|
||||
}
|
||||
|
||||
/* none of the cases above matched */
|
||||
if (!clk) {
|
||||
pr_err("%s: unknown clock type %d\n",
|
||||
__func__, list->branch_type);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (IS_ERR(clk)) {
|
||||
pr_err("%s: failed to register clock %s: %ld\n",
|
||||
__func__, list->name, PTR_ERR(clk));
|
||||
continue;
|
||||
}
|
||||
|
||||
rockchip_clk_add_lookup(clk, list->id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,347 @@
|
|||
/*
|
||||
* Copyright (c) 2014 MundoReader S.L.
|
||||
* Author: Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* based on
|
||||
*
|
||||
* samsung/clk.h
|
||||
* Copyright (c) 2013 Samsung Electronics Co., Ltd.
|
||||
* Copyright (c) 2013 Linaro Ltd.
|
||||
* Author: Thomas Abraham <thomas.ab@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef CLK_ROCKCHIP_CLK_H
|
||||
#define CLK_ROCKCHIP_CLK_H
|
||||
|
||||
#include <linux/io.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clk-provider.h>
|
||||
|
||||
#define HIWORD_UPDATE(val, mask, shift) \
|
||||
((val) << (shift) | (mask) << ((shift) + 16))
|
||||
|
||||
/* register positions shared by RK2928, RK3066 and RK3188 */
|
||||
#define RK2928_PLL_CON(x) (x * 0x4)
|
||||
#define RK2928_MODE_CON 0x40
|
||||
#define RK2928_CLKSEL_CON(x) (x * 0x4 + 0x44)
|
||||
#define RK2928_CLKGATE_CON(x) (x * 0x4 + 0xd0)
|
||||
#define RK2928_GLB_SRST_FST 0x100
|
||||
#define RK2928_GLB_SRST_SND 0x104
|
||||
#define RK2928_SOFTRST_CON(x) (x * 0x4 + 0x110)
|
||||
#define RK2928_MISC_CON 0x134
|
||||
|
||||
#define RK3288_PLL_CON(x) RK2928_PLL_CON(x)
|
||||
#define RK3288_MODE_CON 0x50
|
||||
#define RK3288_CLKSEL_CON(x) (x * 0x4 + 0x60)
|
||||
#define RK3288_CLKGATE_CON(x) (x * 0x4 + 0x160)
|
||||
#define RK3288_GLB_SRST_FST 0x1b0
|
||||
#define RK3288_GLB_SRST_SND 0x1b4
|
||||
#define RK3288_SOFTRST_CON(x) (x * 0x4 + 0x1b8)
|
||||
#define RK3288_MISC_CON 0x1e8
|
||||
|
||||
enum rockchip_pll_type {
|
||||
pll_rk3066,
|
||||
};
|
||||
|
||||
#define RK3066_PLL_RATE(_rate, _nr, _nf, _no) \
|
||||
{ \
|
||||
.rate = _rate##U, \
|
||||
.nr = _nr, \
|
||||
.nf = _nf, \
|
||||
.no = _no, \
|
||||
.bwadj = (_nf >> 1), \
|
||||
}
|
||||
|
||||
struct rockchip_pll_rate_table {
|
||||
unsigned long rate;
|
||||
unsigned int nr;
|
||||
unsigned int nf;
|
||||
unsigned int no;
|
||||
unsigned int bwadj;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct rockchip_pll_clock: information about pll clock
|
||||
* @id: platform specific id of the clock.
|
||||
* @name: name of this pll clock.
|
||||
* @parent_name: name of the parent clock.
|
||||
* @flags: optional flags for basic clock.
|
||||
* @con_offset: offset of the register for configuring the PLL.
|
||||
* @mode_offset: offset of the register for configuring the PLL-mode.
|
||||
* @mode_shift: offset inside the mode-register for the mode of this pll.
|
||||
* @lock_shift: offset inside the lock register for the lock status.
|
||||
* @type: Type of PLL to be registered.
|
||||
* @rate_table: Table of usable pll rates
|
||||
*/
|
||||
struct rockchip_pll_clock {
|
||||
unsigned int id;
|
||||
const char *name;
|
||||
const char **parent_names;
|
||||
u8 num_parents;
|
||||
unsigned long flags;
|
||||
int con_offset;
|
||||
int mode_offset;
|
||||
int mode_shift;
|
||||
int lock_shift;
|
||||
enum rockchip_pll_type type;
|
||||
struct rockchip_pll_rate_table *rate_table;
|
||||
};
|
||||
|
||||
#define PLL(_type, _id, _name, _pnames, _flags, _con, _mode, _mshift, \
|
||||
_lshift, _rtable) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
.type = _type, \
|
||||
.name = _name, \
|
||||
.parent_names = _pnames, \
|
||||
.num_parents = ARRAY_SIZE(_pnames), \
|
||||
.flags = CLK_GET_RATE_NOCACHE | _flags, \
|
||||
.con_offset = _con, \
|
||||
.mode_offset = _mode, \
|
||||
.mode_shift = _mshift, \
|
||||
.lock_shift = _lshift, \
|
||||
.rate_table = _rtable, \
|
||||
}
|
||||
|
||||
struct clk *rockchip_clk_register_pll(enum rockchip_pll_type pll_type,
|
||||
const char *name, const char **parent_names, u8 num_parents,
|
||||
void __iomem *base, int con_offset, int grf_lock_offset,
|
||||
int lock_shift, int reg_mode, int mode_shift,
|
||||
struct rockchip_pll_rate_table *rate_table,
|
||||
spinlock_t *lock);
|
||||
|
||||
#define PNAME(x) static const char *x[] __initconst
|
||||
|
||||
enum rockchip_clk_branch_type {
|
||||
branch_composite,
|
||||
branch_mux,
|
||||
branch_divider,
|
||||
branch_fraction_divider,
|
||||
branch_gate,
|
||||
};
|
||||
|
||||
struct rockchip_clk_branch {
|
||||
unsigned int id;
|
||||
enum rockchip_clk_branch_type branch_type;
|
||||
const char *name;
|
||||
const char **parent_names;
|
||||
u8 num_parents;
|
||||
unsigned long flags;
|
||||
int muxdiv_offset;
|
||||
u8 mux_shift;
|
||||
u8 mux_width;
|
||||
u8 mux_flags;
|
||||
u8 div_shift;
|
||||
u8 div_width;
|
||||
u8 div_flags;
|
||||
struct clk_div_table *div_table;
|
||||
int gate_offset;
|
||||
u8 gate_shift;
|
||||
u8 gate_flags;
|
||||
};
|
||||
|
||||
#define COMPOSITE(_id, cname, pnames, f, mo, ms, mw, mf, ds, dw,\
|
||||
df, go, gs, gf) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_composite, \
|
||||
.name = cname, \
|
||||
.parent_names = pnames, \
|
||||
.num_parents = ARRAY_SIZE(pnames), \
|
||||
.flags = f, \
|
||||
.muxdiv_offset = mo, \
|
||||
.mux_shift = ms, \
|
||||
.mux_width = mw, \
|
||||
.mux_flags = mf, \
|
||||
.div_shift = ds, \
|
||||
.div_width = dw, \
|
||||
.div_flags = df, \
|
||||
.gate_offset = go, \
|
||||
.gate_shift = gs, \
|
||||
.gate_flags = gf, \
|
||||
}
|
||||
|
||||
#define COMPOSITE_NOMUX(_id, cname, pname, f, mo, ds, dw, df, \
|
||||
go, gs, gf) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_composite, \
|
||||
.name = cname, \
|
||||
.parent_names = (const char *[]){ pname }, \
|
||||
.num_parents = 1, \
|
||||
.flags = f, \
|
||||
.muxdiv_offset = mo, \
|
||||
.div_shift = ds, \
|
||||
.div_width = dw, \
|
||||
.div_flags = df, \
|
||||
.gate_offset = go, \
|
||||
.gate_shift = gs, \
|
||||
.gate_flags = gf, \
|
||||
}
|
||||
|
||||
#define COMPOSITE_NOMUX_DIVTBL(_id, cname, pname, f, mo, ds, dw,\
|
||||
df, dt, go, gs, gf) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_composite, \
|
||||
.name = cname, \
|
||||
.parent_names = (const char *[]){ pname }, \
|
||||
.num_parents = 1, \
|
||||
.flags = f, \
|
||||
.muxdiv_offset = mo, \
|
||||
.div_shift = ds, \
|
||||
.div_width = dw, \
|
||||
.div_flags = df, \
|
||||
.div_table = dt, \
|
||||
.gate_offset = go, \
|
||||
.gate_shift = gs, \
|
||||
.gate_flags = gf, \
|
||||
}
|
||||
|
||||
#define COMPOSITE_NODIV(_id, cname, pnames, f, mo, ms, mw, mf, \
|
||||
go, gs, gf) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_composite, \
|
||||
.name = cname, \
|
||||
.parent_names = pnames, \
|
||||
.num_parents = ARRAY_SIZE(pnames), \
|
||||
.flags = f, \
|
||||
.muxdiv_offset = mo, \
|
||||
.mux_shift = ms, \
|
||||
.mux_width = mw, \
|
||||
.mux_flags = mf, \
|
||||
.gate_offset = go, \
|
||||
.gate_shift = gs, \
|
||||
.gate_flags = gf, \
|
||||
}
|
||||
|
||||
#define COMPOSITE_NOGATE(_id, cname, pnames, f, mo, ms, mw, mf, \
|
||||
ds, dw, df) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_composite, \
|
||||
.name = cname, \
|
||||
.parent_names = pnames, \
|
||||
.num_parents = ARRAY_SIZE(pnames), \
|
||||
.flags = f, \
|
||||
.muxdiv_offset = mo, \
|
||||
.mux_shift = ms, \
|
||||
.mux_width = mw, \
|
||||
.mux_flags = mf, \
|
||||
.div_shift = ds, \
|
||||
.div_width = dw, \
|
||||
.div_flags = df, \
|
||||
.gate_offset = -1, \
|
||||
}
|
||||
|
||||
#define COMPOSITE_FRAC(_id, cname, pname, f, mo, df, go, gs, gf)\
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_fraction_divider, \
|
||||
.name = cname, \
|
||||
.parent_names = (const char *[]){ pname }, \
|
||||
.num_parents = 1, \
|
||||
.flags = f, \
|
||||
.muxdiv_offset = mo, \
|
||||
.div_shift = 16, \
|
||||
.div_width = 16, \
|
||||
.div_flags = df, \
|
||||
.gate_offset = go, \
|
||||
.gate_shift = gs, \
|
||||
.gate_flags = gf, \
|
||||
}
|
||||
|
||||
#define MUX(_id, cname, pnames, f, o, s, w, mf) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_mux, \
|
||||
.name = cname, \
|
||||
.parent_names = pnames, \
|
||||
.num_parents = ARRAY_SIZE(pnames), \
|
||||
.flags = f, \
|
||||
.muxdiv_offset = o, \
|
||||
.mux_shift = s, \
|
||||
.mux_width = w, \
|
||||
.mux_flags = mf, \
|
||||
.gate_offset = -1, \
|
||||
}
|
||||
|
||||
#define DIV(_id, cname, pname, f, o, s, w, df) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_divider, \
|
||||
.name = cname, \
|
||||
.parent_names = (const char *[]){ pname }, \
|
||||
.num_parents = 1, \
|
||||
.flags = f, \
|
||||
.muxdiv_offset = o, \
|
||||
.div_shift = s, \
|
||||
.div_width = w, \
|
||||
.div_flags = df, \
|
||||
.gate_offset = -1, \
|
||||
}
|
||||
|
||||
#define DIVTBL(_id, cname, pname, f, o, s, w, df, dt) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_divider, \
|
||||
.name = cname, \
|
||||
.parent_names = (const char *[]){ pname }, \
|
||||
.num_parents = 1, \
|
||||
.flags = f, \
|
||||
.muxdiv_offset = o, \
|
||||
.div_shift = s, \
|
||||
.div_width = w, \
|
||||
.div_flags = df, \
|
||||
.div_table = dt, \
|
||||
}
|
||||
|
||||
#define GATE(_id, cname, pname, f, o, b, gf) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_gate, \
|
||||
.name = cname, \
|
||||
.parent_names = (const char *[]){ pname }, \
|
||||
.num_parents = 1, \
|
||||
.flags = f, \
|
||||
.gate_offset = o, \
|
||||
.gate_shift = b, \
|
||||
.gate_flags = gf, \
|
||||
}
|
||||
|
||||
|
||||
void rockchip_clk_init(struct device_node *np, void __iomem *base,
|
||||
unsigned long nr_clks);
|
||||
struct regmap *rockchip_clk_get_grf(void);
|
||||
void rockchip_clk_add_lookup(struct clk *clk, unsigned int id);
|
||||
void rockchip_clk_register_branches(struct rockchip_clk_branch *clk_list,
|
||||
unsigned int nr_clk);
|
||||
void rockchip_clk_register_plls(struct rockchip_pll_clock *pll_list,
|
||||
unsigned int nr_pll, int grf_lock_offset);
|
||||
|
||||
#define ROCKCHIP_SOFTRST_HIWORD_MASK BIT(0)
|
||||
|
||||
#ifdef CONFIG_RESET_CONTROLLER
|
||||
void rockchip_register_softrst(struct device_node *np,
|
||||
unsigned int num_regs,
|
||||
void __iomem *base, u8 flags);
|
||||
#else
|
||||
static inline void rockchip_register_softrst(struct device_node *np,
|
||||
unsigned int num_regs,
|
||||
void __iomem *base, u8 flags)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* Copyright (c) 2014 MundoReader S.L.
|
||||
* Author: Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/reset-controller.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include "clk.h"
|
||||
|
||||
struct rockchip_softrst {
|
||||
struct reset_controller_dev rcdev;
|
||||
void __iomem *reg_base;
|
||||
int num_regs;
|
||||
int num_per_reg;
|
||||
u8 flags;
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
||||
static int rockchip_softrst_assert(struct reset_controller_dev *rcdev,
|
||||
unsigned long id)
|
||||
{
|
||||
struct rockchip_softrst *softrst = container_of(rcdev,
|
||||
struct rockchip_softrst,
|
||||
rcdev);
|
||||
int bank = id / softrst->num_per_reg;
|
||||
int offset = id % softrst->num_per_reg;
|
||||
|
||||
if (softrst->flags & ROCKCHIP_SOFTRST_HIWORD_MASK) {
|
||||
writel(BIT(offset) | (BIT(offset) << 16),
|
||||
softrst->reg_base + (bank * 4));
|
||||
} else {
|
||||
unsigned long flags;
|
||||
u32 reg;
|
||||
|
||||
spin_lock_irqsave(&softrst->lock, flags);
|
||||
|
||||
reg = readl(softrst->reg_base + (bank * 4));
|
||||
writel(reg | BIT(offset), softrst->reg_base + (bank * 4));
|
||||
|
||||
spin_unlock_irqrestore(&softrst->lock, flags);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rockchip_softrst_deassert(struct reset_controller_dev *rcdev,
|
||||
unsigned long id)
|
||||
{
|
||||
struct rockchip_softrst *softrst = container_of(rcdev,
|
||||
struct rockchip_softrst,
|
||||
rcdev);
|
||||
int bank = id / softrst->num_per_reg;
|
||||
int offset = id % softrst->num_per_reg;
|
||||
|
||||
if (softrst->flags & ROCKCHIP_SOFTRST_HIWORD_MASK) {
|
||||
writel((BIT(offset) << 16), softrst->reg_base + (bank * 4));
|
||||
} else {
|
||||
unsigned long flags;
|
||||
u32 reg;
|
||||
|
||||
spin_lock_irqsave(&softrst->lock, flags);
|
||||
|
||||
reg = readl(softrst->reg_base + (bank * 4));
|
||||
writel(reg & ~BIT(offset), softrst->reg_base + (bank * 4));
|
||||
|
||||
spin_unlock_irqrestore(&softrst->lock, flags);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct reset_control_ops rockchip_softrst_ops = {
|
||||
.assert = rockchip_softrst_assert,
|
||||
.deassert = rockchip_softrst_deassert,
|
||||
};
|
||||
|
||||
void __init rockchip_register_softrst(struct device_node *np,
|
||||
unsigned int num_regs,
|
||||
void __iomem *base, u8 flags)
|
||||
{
|
||||
struct rockchip_softrst *softrst;
|
||||
int ret;
|
||||
|
||||
softrst = kzalloc(sizeof(*softrst), GFP_KERNEL);
|
||||
if (!softrst)
|
||||
return;
|
||||
|
||||
spin_lock_init(&softrst->lock);
|
||||
|
||||
softrst->reg_base = base;
|
||||
softrst->flags = flags;
|
||||
softrst->num_regs = num_regs;
|
||||
softrst->num_per_reg = (flags & ROCKCHIP_SOFTRST_HIWORD_MASK) ? 16
|
||||
: 32;
|
||||
|
||||
softrst->rcdev.owner = THIS_MODULE;
|
||||
softrst->rcdev.nr_resets = num_regs * softrst->num_per_reg;
|
||||
softrst->rcdev.ops = &rockchip_softrst_ops;
|
||||
softrst->rcdev.of_node = np;
|
||||
ret = reset_controller_register(&softrst->rcdev);
|
||||
if (ret) {
|
||||
pr_err("%s: could not register reset controller, %d\n",
|
||||
__func__, ret);
|
||||
kfree(softrst);
|
||||
}
|
||||
};
|
|
@ -11,6 +11,7 @@ obj-$(CONFIG_SOC_EXYNOS5410) += clk-exynos5410.o
|
|||
obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o
|
||||
obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o
|
||||
obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o
|
||||
obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-clkout.o
|
||||
obj-$(CONFIG_S3C2410_COMMON_CLK)+= clk-s3c2410.o
|
||||
obj-$(CONFIG_S3C2410_COMMON_DCLK)+= clk-s3c2410-dclk.o
|
||||
obj-$(CONFIG_S3C2412_COMMON_CLK)+= clk-s3c2412.o
|
||||
|
|
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
|
||||
* Author: Tomasz Figa <t.figa@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Clock driver for Exynos clock output
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clkdev.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/syscore_ops.h>
|
||||
|
||||
#define EXYNOS_CLKOUT_NR_CLKS 1
|
||||
#define EXYNOS_CLKOUT_PARENTS 32
|
||||
|
||||
#define EXYNOS_PMU_DEBUG_REG 0xa00
|
||||
#define EXYNOS_CLKOUT_DISABLE_SHIFT 0
|
||||
#define EXYNOS_CLKOUT_MUX_SHIFT 8
|
||||
#define EXYNOS4_CLKOUT_MUX_MASK 0xf
|
||||
#define EXYNOS5_CLKOUT_MUX_MASK 0x1f
|
||||
|
||||
struct exynos_clkout {
|
||||
struct clk_gate gate;
|
||||
struct clk_mux mux;
|
||||
spinlock_t slock;
|
||||
struct clk_onecell_data data;
|
||||
struct clk *clk_table[EXYNOS_CLKOUT_NR_CLKS];
|
||||
void __iomem *reg;
|
||||
u32 pmu_debug_save;
|
||||
};
|
||||
|
||||
static struct exynos_clkout *clkout;
|
||||
|
||||
static int exynos_clkout_suspend(void)
|
||||
{
|
||||
clkout->pmu_debug_save = readl(clkout->reg + EXYNOS_PMU_DEBUG_REG);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void exynos_clkout_resume(void)
|
||||
{
|
||||
writel(clkout->pmu_debug_save, clkout->reg + EXYNOS_PMU_DEBUG_REG);
|
||||
}
|
||||
|
||||
static struct syscore_ops exynos_clkout_syscore_ops = {
|
||||
.suspend = exynos_clkout_suspend,
|
||||
.resume = exynos_clkout_resume,
|
||||
};
|
||||
|
||||
static void __init exynos_clkout_init(struct device_node *node, u32 mux_mask)
|
||||
{
|
||||
const char *parent_names[EXYNOS_CLKOUT_PARENTS];
|
||||
struct clk *parents[EXYNOS_CLKOUT_PARENTS];
|
||||
int parent_count;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
clkout = kzalloc(sizeof(*clkout), GFP_KERNEL);
|
||||
if (!clkout)
|
||||
return;
|
||||
|
||||
spin_lock_init(&clkout->slock);
|
||||
|
||||
parent_count = 0;
|
||||
for (i = 0; i < EXYNOS_CLKOUT_PARENTS; ++i) {
|
||||
char name[] = "clkoutXX";
|
||||
|
||||
snprintf(name, sizeof(name), "clkout%d", i);
|
||||
parents[i] = of_clk_get_by_name(node, name);
|
||||
if (IS_ERR(parents[i])) {
|
||||
parent_names[i] = "none";
|
||||
continue;
|
||||
}
|
||||
|
||||
parent_names[i] = __clk_get_name(parents[i]);
|
||||
parent_count = i + 1;
|
||||
}
|
||||
|
||||
if (!parent_count)
|
||||
goto free_clkout;
|
||||
|
||||
clkout->reg = of_iomap(node, 0);
|
||||
if (!clkout->reg)
|
||||
goto clks_put;
|
||||
|
||||
clkout->gate.reg = clkout->reg + EXYNOS_PMU_DEBUG_REG;
|
||||
clkout->gate.bit_idx = EXYNOS_CLKOUT_DISABLE_SHIFT;
|
||||
clkout->gate.flags = CLK_GATE_SET_TO_DISABLE;
|
||||
clkout->gate.lock = &clkout->slock;
|
||||
|
||||
clkout->mux.reg = clkout->reg + EXYNOS_PMU_DEBUG_REG;
|
||||
clkout->mux.mask = mux_mask;
|
||||
clkout->mux.shift = EXYNOS_CLKOUT_MUX_SHIFT;
|
||||
clkout->mux.lock = &clkout->slock;
|
||||
|
||||
clkout->clk_table[0] = clk_register_composite(NULL, "clkout",
|
||||
parent_names, parent_count, &clkout->mux.hw,
|
||||
&clk_mux_ops, NULL, NULL, &clkout->gate.hw,
|
||||
&clk_gate_ops, CLK_SET_RATE_PARENT
|
||||
| CLK_SET_RATE_NO_REPARENT);
|
||||
if (IS_ERR(clkout->clk_table[0]))
|
||||
goto err_unmap;
|
||||
|
||||
clkout->data.clks = clkout->clk_table;
|
||||
clkout->data.clk_num = EXYNOS_CLKOUT_NR_CLKS;
|
||||
ret = of_clk_add_provider(node, of_clk_src_onecell_get, &clkout->data);
|
||||
if (ret)
|
||||
goto err_clk_unreg;
|
||||
|
||||
register_syscore_ops(&exynos_clkout_syscore_ops);
|
||||
|
||||
return;
|
||||
|
||||
err_clk_unreg:
|
||||
clk_unregister(clkout->clk_table[0]);
|
||||
err_unmap:
|
||||
iounmap(clkout->reg);
|
||||
clks_put:
|
||||
for (i = 0; i < EXYNOS_CLKOUT_PARENTS; ++i)
|
||||
if (!IS_ERR(parents[i]))
|
||||
clk_put(parents[i]);
|
||||
free_clkout:
|
||||
kfree(clkout);
|
||||
|
||||
pr_err("%s: failed to register clkout clock\n", __func__);
|
||||
}
|
||||
|
||||
static void __init exynos4_clkout_init(struct device_node *node)
|
||||
{
|
||||
exynos_clkout_init(node, EXYNOS4_CLKOUT_MUX_MASK);
|
||||
}
|
||||
CLK_OF_DECLARE(exynos4210_clkout, "samsung,exynos4210-pmu",
|
||||
exynos4_clkout_init);
|
||||
CLK_OF_DECLARE(exynos4212_clkout, "samsung,exynos4212-pmu",
|
||||
exynos4_clkout_init);
|
||||
CLK_OF_DECLARE(exynos4412_clkout, "samsung,exynos4412-pmu",
|
||||
exynos4_clkout_init);
|
||||
|
||||
static void __init exynos5_clkout_init(struct device_node *node)
|
||||
{
|
||||
exynos_clkout_init(node, EXYNOS5_CLKOUT_MUX_MASK);
|
||||
}
|
||||
CLK_OF_DECLARE(exynos5250_clkout, "samsung,exynos5250-pmu",
|
||||
exynos5_clkout_init);
|
||||
CLK_OF_DECLARE(exynos5420_clkout, "samsung,exynos5420-pmu",
|
||||
exynos5_clkout_init);
|
|
@ -87,6 +87,22 @@
|
|||
#define SRC_CPU 0x14200
|
||||
#define DIV_CPU0 0x14500
|
||||
#define DIV_CPU1 0x14504
|
||||
#define PWR_CTRL1 0x15020
|
||||
#define PWR_CTRL2 0x15024
|
||||
|
||||
/* Below definitions are used for PWR_CTRL settings */
|
||||
#define PWR_CTRL1_CORE2_DOWN_RATIO(x) (((x) & 0x7) << 28)
|
||||
#define PWR_CTRL1_CORE1_DOWN_RATIO(x) (((x) & 0x7) << 16)
|
||||
#define PWR_CTRL1_DIV2_DOWN_EN (1 << 9)
|
||||
#define PWR_CTRL1_DIV1_DOWN_EN (1 << 8)
|
||||
#define PWR_CTRL1_USE_CORE3_WFE (1 << 7)
|
||||
#define PWR_CTRL1_USE_CORE2_WFE (1 << 6)
|
||||
#define PWR_CTRL1_USE_CORE1_WFE (1 << 5)
|
||||
#define PWR_CTRL1_USE_CORE0_WFE (1 << 4)
|
||||
#define PWR_CTRL1_USE_CORE3_WFI (1 << 3)
|
||||
#define PWR_CTRL1_USE_CORE2_WFI (1 << 2)
|
||||
#define PWR_CTRL1_USE_CORE1_WFI (1 << 1)
|
||||
#define PWR_CTRL1_USE_CORE0_WFI (1 << 0)
|
||||
|
||||
/* list of PLLs to be registered */
|
||||
enum exynos3250_plls {
|
||||
|
@ -168,6 +184,8 @@ static unsigned long exynos3250_cmu_clk_regs[] __initdata = {
|
|||
SRC_CPU,
|
||||
DIV_CPU0,
|
||||
DIV_CPU1,
|
||||
PWR_CTRL1,
|
||||
PWR_CTRL2,
|
||||
};
|
||||
|
||||
static int exynos3250_clk_suspend(void)
|
||||
|
@ -748,6 +766,27 @@ static struct samsung_pll_clock exynos3250_plls[nr_plls] __initdata = {
|
|||
UPLL_LOCK, UPLL_CON0, NULL),
|
||||
};
|
||||
|
||||
static void __init exynos3_core_down_clock(void)
|
||||
{
|
||||
unsigned int tmp;
|
||||
|
||||
/*
|
||||
* Enable arm clock down (in idle) and set arm divider
|
||||
* ratios in WFI/WFE state.
|
||||
*/
|
||||
tmp = (PWR_CTRL1_CORE2_DOWN_RATIO(7) | PWR_CTRL1_CORE1_DOWN_RATIO(7) |
|
||||
PWR_CTRL1_DIV2_DOWN_EN | PWR_CTRL1_DIV1_DOWN_EN |
|
||||
PWR_CTRL1_USE_CORE1_WFE | PWR_CTRL1_USE_CORE0_WFE |
|
||||
PWR_CTRL1_USE_CORE1_WFI | PWR_CTRL1_USE_CORE0_WFI);
|
||||
__raw_writel(tmp, reg_base + PWR_CTRL1);
|
||||
|
||||
/*
|
||||
* Disable the clock up feature on Exynos4x12, in case it was
|
||||
* enabled by bootloader.
|
||||
*/
|
||||
__raw_writel(0x0, reg_base + PWR_CTRL2);
|
||||
}
|
||||
|
||||
static void __init exynos3250_cmu_init(struct device_node *np)
|
||||
{
|
||||
struct samsung_clk_provider *ctx;
|
||||
|
@ -775,6 +814,10 @@ static void __init exynos3250_cmu_init(struct device_node *np)
|
|||
samsung_clk_register_div(ctx, div_clks, ARRAY_SIZE(div_clks));
|
||||
samsung_clk_register_gate(ctx, gate_clks, ARRAY_SIZE(gate_clks));
|
||||
|
||||
exynos3_core_down_clock();
|
||||
|
||||
exynos3250_clk_sleep_init();
|
||||
|
||||
samsung_clk_of_add_provider(np, ctx);
|
||||
}
|
||||
CLK_OF_DECLARE(exynos3250_cmu, "samsung,exynos3250-cmu", exynos3250_cmu_init);
|
||||
|
|
|
@ -25,10 +25,12 @@
|
|||
#define DIV_LEFTBUS 0x4500
|
||||
#define GATE_IP_LEFTBUS 0x4800
|
||||
#define E4X12_GATE_IP_IMAGE 0x4930
|
||||
#define CLKOUT_CMU_LEFTBUS 0x4a00
|
||||
#define SRC_RIGHTBUS 0x8200
|
||||
#define DIV_RIGHTBUS 0x8500
|
||||
#define GATE_IP_RIGHTBUS 0x8800
|
||||
#define E4X12_GATE_IP_PERIR 0x8960
|
||||
#define CLKOUT_CMU_RIGHTBUS 0x8a00
|
||||
#define EPLL_LOCK 0xc010
|
||||
#define VPLL_LOCK 0xc020
|
||||
#define EPLL_CON0 0xc110
|
||||
|
@ -98,6 +100,7 @@
|
|||
#define GATE_IP_PERIL 0xc950
|
||||
#define E4210_GATE_IP_PERIR 0xc960
|
||||
#define GATE_BLOCK 0xc970
|
||||
#define CLKOUT_CMU_TOP 0xca00
|
||||
#define E4X12_MPLL_LOCK 0x10008
|
||||
#define E4X12_MPLL_CON0 0x10108
|
||||
#define SRC_DMC 0x10200
|
||||
|
@ -105,6 +108,7 @@
|
|||
#define DIV_DMC0 0x10500
|
||||
#define DIV_DMC1 0x10504
|
||||
#define GATE_IP_DMC 0x10900
|
||||
#define CLKOUT_CMU_DMC 0x10a00
|
||||
#define APLL_LOCK 0x14000
|
||||
#define E4210_MPLL_LOCK 0x14008
|
||||
#define APLL_CON0 0x14100
|
||||
|
@ -114,11 +118,28 @@
|
|||
#define DIV_CPU1 0x14504
|
||||
#define GATE_SCLK_CPU 0x14800
|
||||
#define GATE_IP_CPU 0x14900
|
||||
#define CLKOUT_CMU_CPU 0x14a00
|
||||
#define PWR_CTRL1 0x15020
|
||||
#define E4X12_PWR_CTRL2 0x15024
|
||||
#define E4X12_DIV_ISP0 0x18300
|
||||
#define E4X12_DIV_ISP1 0x18304
|
||||
#define E4X12_GATE_ISP0 0x18800
|
||||
#define E4X12_GATE_ISP1 0x18804
|
||||
|
||||
/* Below definitions are used for PWR_CTRL settings */
|
||||
#define PWR_CTRL1_CORE2_DOWN_RATIO(x) (((x) & 0x7) << 28)
|
||||
#define PWR_CTRL1_CORE1_DOWN_RATIO(x) (((x) & 0x7) << 16)
|
||||
#define PWR_CTRL1_DIV2_DOWN_EN (1 << 9)
|
||||
#define PWR_CTRL1_DIV1_DOWN_EN (1 << 8)
|
||||
#define PWR_CTRL1_USE_CORE3_WFE (1 << 7)
|
||||
#define PWR_CTRL1_USE_CORE2_WFE (1 << 6)
|
||||
#define PWR_CTRL1_USE_CORE1_WFE (1 << 5)
|
||||
#define PWR_CTRL1_USE_CORE0_WFE (1 << 4)
|
||||
#define PWR_CTRL1_USE_CORE3_WFI (1 << 3)
|
||||
#define PWR_CTRL1_USE_CORE2_WFI (1 << 2)
|
||||
#define PWR_CTRL1_USE_CORE1_WFI (1 << 1)
|
||||
#define PWR_CTRL1_USE_CORE0_WFI (1 << 0)
|
||||
|
||||
/* the exynos4 soc type */
|
||||
enum exynos4_soc {
|
||||
EXYNOS4210,
|
||||
|
@ -155,6 +176,7 @@ static unsigned long exynos4210_clk_save[] __initdata = {
|
|||
E4210_GATE_IP_LCD1,
|
||||
E4210_GATE_IP_PERIR,
|
||||
E4210_MPLL_CON0,
|
||||
PWR_CTRL1,
|
||||
};
|
||||
|
||||
static unsigned long exynos4x12_clk_save[] __initdata = {
|
||||
|
@ -164,6 +186,8 @@ static unsigned long exynos4x12_clk_save[] __initdata = {
|
|||
E4X12_DIV_ISP,
|
||||
E4X12_DIV_CAM1,
|
||||
E4X12_MPLL_CON0,
|
||||
PWR_CTRL1,
|
||||
E4X12_PWR_CTRL2,
|
||||
};
|
||||
|
||||
static unsigned long exynos4_clk_pll_regs[] __initdata = {
|
||||
|
@ -242,6 +266,11 @@ static unsigned long exynos4_clk_regs[] __initdata = {
|
|||
DIV_CPU1,
|
||||
GATE_SCLK_CPU,
|
||||
GATE_IP_CPU,
|
||||
CLKOUT_CMU_LEFTBUS,
|
||||
CLKOUT_CMU_RIGHTBUS,
|
||||
CLKOUT_CMU_TOP,
|
||||
CLKOUT_CMU_DMC,
|
||||
CLKOUT_CMU_CPU,
|
||||
};
|
||||
|
||||
static const struct samsung_clk_reg_dump src_mask_suspend[] = {
|
||||
|
@ -397,10 +426,32 @@ PNAME(mout_audio2_p4210) = { "cdclk2", "none", "sclk_hdmi24m",
|
|||
"sclk_epll", "sclk_vpll", };
|
||||
PNAME(mout_mixer_p4210) = { "sclk_dac", "sclk_hdmi", };
|
||||
PNAME(mout_dac_p4210) = { "sclk_vpll", "sclk_hdmiphy", };
|
||||
PNAME(mout_pwi_p4210) = { "xxti", "xusbxti", "sclk_hdmi24m", "sclk_usbphy0",
|
||||
"sclk_usbphy1", "sclk_hdmiphy", "none",
|
||||
"sclk_epll", "sclk_vpll" };
|
||||
PNAME(clkout_left_p4210) = { "sclk_mpll_div_2", "sclk_apll_div_2",
|
||||
"div_gdl", "div_gpl" };
|
||||
PNAME(clkout_right_p4210) = { "sclk_mpll_div_2", "sclk_apll_div_2",
|
||||
"div_gdr", "div_gpr" };
|
||||
PNAME(clkout_top_p4210) = { "fout_epll", "fout_vpll", "sclk_hdmi24m",
|
||||
"sclk_usbphy0", "sclk_usbphy1", "sclk_hdmiphy",
|
||||
"cdclk0", "cdclk1", "cdclk2", "spdif_extclk",
|
||||
"aclk160", "aclk133", "aclk200", "aclk100",
|
||||
"sclk_mfc", "sclk_g3d", "sclk_g2d",
|
||||
"cam_a_pclk", "cam_b_pclk", "s_rxbyteclkhs0_2l",
|
||||
"s_rxbyteclkhs0_4l" };
|
||||
PNAME(clkout_dmc_p4210) = { "div_dmcd", "div_dmcp", "div_acp_pclk", "div_dmc",
|
||||
"div_dphy", "none", "div_pwi" };
|
||||
PNAME(clkout_cpu_p4210) = { "fout_apll_div_2", "none", "fout_mpll_div_2",
|
||||
"none", "arm_clk_div_2", "div_corem0",
|
||||
"div_corem1", "div_corem0", "div_atb",
|
||||
"div_periph", "div_pclk_dbg", "div_hpm" };
|
||||
|
||||
/* Exynos 4x12-specific parent groups */
|
||||
PNAME(mout_mpll_user_p4x12) = { "fin_pll", "sclk_mpll", };
|
||||
PNAME(mout_core_p4x12) = { "mout_apll", "mout_mpll_user_c", };
|
||||
PNAME(mout_gdl_p4x12) = { "mout_mpll_user_l", "sclk_apll", };
|
||||
PNAME(mout_gdr_p4x12) = { "mout_mpll_user_r", "sclk_apll", };
|
||||
PNAME(sclk_ampll_p4x12) = { "mout_mpll_user_t", "sclk_apll", };
|
||||
PNAME(group1_p4x12) = { "xxti", "xusbxti", "sclk_hdmi24m", "sclk_usbphy0",
|
||||
"none", "sclk_hdmiphy", "mout_mpll_user_t",
|
||||
|
@ -418,6 +469,32 @@ PNAME(aclk_p4412) = { "mout_mpll_user_t", "sclk_apll", };
|
|||
PNAME(mout_user_aclk400_mcuisp_p4x12) = {"fin_pll", "div_aclk400_mcuisp", };
|
||||
PNAME(mout_user_aclk200_p4x12) = {"fin_pll", "div_aclk200", };
|
||||
PNAME(mout_user_aclk266_gps_p4x12) = {"fin_pll", "div_aclk266_gps", };
|
||||
PNAME(mout_pwi_p4x12) = { "xxti", "xusbxti", "sclk_hdmi24m", "sclk_usbphy0",
|
||||
"none", "sclk_hdmiphy", "sclk_mpll",
|
||||
"sclk_epll", "sclk_vpll" };
|
||||
PNAME(clkout_left_p4x12) = { "sclk_mpll_user_l_div_2", "sclk_apll_div_2",
|
||||
"div_gdl", "div_gpl" };
|
||||
PNAME(clkout_right_p4x12) = { "sclk_mpll_user_r_div_2", "sclk_apll_div_2",
|
||||
"div_gdr", "div_gpr" };
|
||||
PNAME(clkout_top_p4x12) = { "fout_epll", "fout_vpll", "sclk_hdmi24m",
|
||||
"sclk_usbphy0", "none", "sclk_hdmiphy",
|
||||
"cdclk0", "cdclk1", "cdclk2", "spdif_extclk",
|
||||
"aclk160", "aclk133", "aclk200", "aclk100",
|
||||
"sclk_mfc", "sclk_g3d", "aclk400_mcuisp",
|
||||
"cam_a_pclk", "cam_b_pclk", "s_rxbyteclkhs0_2l",
|
||||
"s_rxbyteclkhs0_4l", "rx_half_byte_clk_csis0",
|
||||
"rx_half_byte_clk_csis1", "div_jpeg",
|
||||
"sclk_pwm_isp", "sclk_spi0_isp",
|
||||
"sclk_spi1_isp", "sclk_uart_isp",
|
||||
"sclk_mipihsi", "sclk_hdmi", "sclk_fimd0",
|
||||
"sclk_pcm0" };
|
||||
PNAME(clkout_dmc_p4x12) = { "div_dmcd", "div_dmcp", "aclk_acp", "div_acp_pclk",
|
||||
"div_dmc", "div_dphy", "fout_mpll_div_2",
|
||||
"div_pwi", "none", "div_c2c", "div_c2c_aclk" };
|
||||
PNAME(clkout_cpu_p4x12) = { "fout_apll_div_2", "none", "none", "none",
|
||||
"arm_clk_div_2", "div_corem0", "div_corem1",
|
||||
"div_cores", "div_atb", "div_periph",
|
||||
"div_pclk_dbg", "div_hpm" };
|
||||
|
||||
/* fixed rate clocks generated outside the soc */
|
||||
static struct samsung_fixed_rate_clock exynos4_fixed_rate_ext_clks[] __initdata = {
|
||||
|
@ -436,6 +513,24 @@ static struct samsung_fixed_rate_clock exynos4210_fixed_rate_clks[] __initdata =
|
|||
FRATE(0, "sclk_usbphy1", NULL, CLK_IS_ROOT, 48000000),
|
||||
};
|
||||
|
||||
static struct samsung_fixed_factor_clock exynos4_fixed_factor_clks[] __initdata = {
|
||||
FFACTOR(0, "sclk_apll_div_2", "sclk_apll", 1, 2, 0),
|
||||
FFACTOR(0, "fout_mpll_div_2", "fout_mpll", 1, 2, 0),
|
||||
FFACTOR(0, "fout_apll_div_2", "fout_apll", 1, 2, 0),
|
||||
FFACTOR(0, "arm_clk_div_2", "arm_clk", 1, 2, 0),
|
||||
};
|
||||
|
||||
static struct samsung_fixed_factor_clock exynos4210_fixed_factor_clks[] __initdata = {
|
||||
FFACTOR(0, "sclk_mpll_div_2", "sclk_mpll", 1, 2, 0),
|
||||
};
|
||||
|
||||
static struct samsung_fixed_factor_clock exynos4x12_fixed_factor_clks[] __initdata = {
|
||||
FFACTOR(0, "sclk_mpll_user_l_div_2", "mout_mpll_user_l", 1, 2, 0),
|
||||
FFACTOR(0, "sclk_mpll_user_r_div_2", "mout_mpll_user_r", 1, 2, 0),
|
||||
FFACTOR(0, "sclk_mpll_user_t_div_2", "mout_mpll_user_t", 1, 2, 0),
|
||||
FFACTOR(0, "sclk_mpll_user_c_div_2", "mout_mpll_user_c", 1, 2, 0),
|
||||
};
|
||||
|
||||
/* list of mux clocks supported in all exynos4 soc's */
|
||||
static struct samsung_mux_clock exynos4_mux_clks[] __initdata = {
|
||||
MUX_FA(CLK_MOUT_APLL, "mout_apll", mout_apll_p, SRC_CPU, 0, 1,
|
||||
|
@ -451,6 +546,9 @@ static struct samsung_mux_clock exynos4_mux_clks[] __initdata = {
|
|||
MUX(0, "mout_onenand1", mout_onenand1_p, SRC_TOP0, 0, 1),
|
||||
MUX(CLK_SCLK_EPLL, "sclk_epll", mout_epll_p, SRC_TOP0, 4, 1),
|
||||
MUX(0, "mout_onenand", mout_onenand_p, SRC_TOP0, 28, 1),
|
||||
|
||||
MUX(0, "mout_dmc_bus", sclk_ampll_p4210, SRC_DMC, 4, 1),
|
||||
MUX(0, "mout_dphy", sclk_ampll_p4210, SRC_DMC, 8, 1),
|
||||
};
|
||||
|
||||
/* list of mux clocks supported in exynos4210 soc */
|
||||
|
@ -459,6 +557,14 @@ static struct samsung_mux_clock exynos4210_mux_early[] __initdata = {
|
|||
};
|
||||
|
||||
static struct samsung_mux_clock exynos4210_mux_clks[] __initdata = {
|
||||
MUX(0, "mout_gdl", sclk_ampll_p4210, SRC_LEFTBUS, 0, 1),
|
||||
MUX(0, "mout_clkout_leftbus", clkout_left_p4210,
|
||||
CLKOUT_CMU_LEFTBUS, 0, 5),
|
||||
|
||||
MUX(0, "mout_gdr", sclk_ampll_p4210, SRC_RIGHTBUS, 0, 1),
|
||||
MUX(0, "mout_clkout_rightbus", clkout_right_p4210,
|
||||
CLKOUT_CMU_RIGHTBUS, 0, 5),
|
||||
|
||||
MUX(0, "mout_aclk200", sclk_ampll_p4210, SRC_TOP0, 12, 1),
|
||||
MUX(0, "mout_aclk100", sclk_ampll_p4210, SRC_TOP0, 16, 1),
|
||||
MUX(0, "mout_aclk160", sclk_ampll_p4210, SRC_TOP0, 20, 1),
|
||||
|
@ -472,6 +578,7 @@ static struct samsung_mux_clock exynos4210_mux_clks[] __initdata = {
|
|||
MUX(0, "mout_mipi1", group1_p4210, E4210_SRC_LCD1, 12, 4),
|
||||
MUX(CLK_SCLK_MPLL, "sclk_mpll", mout_mpll_p, SRC_CPU, 8, 1),
|
||||
MUX(CLK_MOUT_CORE, "mout_core", mout_core_p4210, SRC_CPU, 16, 1),
|
||||
MUX(0, "mout_hpm", mout_core_p4210, SRC_CPU, 20, 1),
|
||||
MUX(CLK_SCLK_VPLL, "sclk_vpll", sclk_vpll_p4210, SRC_TOP0, 8, 1),
|
||||
MUX(CLK_MOUT_FIMC0, "mout_fimc0", group1_p4210, SRC_CAM, 0, 4),
|
||||
MUX(CLK_MOUT_FIMC1, "mout_fimc1", group1_p4210, SRC_CAM, 4, 4),
|
||||
|
@ -503,12 +610,30 @@ static struct samsung_mux_clock exynos4210_mux_clks[] __initdata = {
|
|||
MUX(0, "mout_spi0", group1_p4210, SRC_PERIL1, 16, 4),
|
||||
MUX(0, "mout_spi1", group1_p4210, SRC_PERIL1, 20, 4),
|
||||
MUX(0, "mout_spi2", group1_p4210, SRC_PERIL1, 24, 4),
|
||||
MUX(0, "mout_clkout_top", clkout_top_p4210, CLKOUT_CMU_TOP, 0, 5),
|
||||
|
||||
MUX(0, "mout_pwi", mout_pwi_p4210, SRC_DMC, 16, 4),
|
||||
MUX(0, "mout_clkout_dmc", clkout_dmc_p4210, CLKOUT_CMU_DMC, 0, 5),
|
||||
|
||||
MUX(0, "mout_clkout_cpu", clkout_cpu_p4210, CLKOUT_CMU_CPU, 0, 5),
|
||||
};
|
||||
|
||||
/* list of mux clocks supported in exynos4x12 soc */
|
||||
static struct samsung_mux_clock exynos4x12_mux_clks[] __initdata = {
|
||||
MUX(0, "mout_mpll_user_l", mout_mpll_p, SRC_LEFTBUS, 4, 1),
|
||||
MUX(0, "mout_gdl", mout_gdl_p4x12, SRC_LEFTBUS, 0, 1),
|
||||
MUX(0, "mout_clkout_leftbus", clkout_left_p4x12,
|
||||
CLKOUT_CMU_LEFTBUS, 0, 5),
|
||||
|
||||
MUX(0, "mout_mpll_user_r", mout_mpll_p, SRC_RIGHTBUS, 4, 1),
|
||||
MUX(0, "mout_gdr", mout_gdr_p4x12, SRC_RIGHTBUS, 0, 1),
|
||||
MUX(0, "mout_clkout_rightbus", clkout_right_p4x12,
|
||||
CLKOUT_CMU_RIGHTBUS, 0, 5),
|
||||
|
||||
MUX(CLK_MOUT_MPLL_USER_C, "mout_mpll_user_c", mout_mpll_user_p4x12,
|
||||
SRC_CPU, 24, 1),
|
||||
MUX(0, "mout_clkout_cpu", clkout_cpu_p4x12, CLKOUT_CMU_CPU, 0, 5),
|
||||
|
||||
MUX(0, "mout_aclk266_gps", aclk_p4412, SRC_TOP1, 4, 1),
|
||||
MUX(0, "mout_aclk400_mcuisp", aclk_p4412, SRC_TOP1, 8, 1),
|
||||
MUX(CLK_MOUT_MPLL_USER_T, "mout_mpll_user_t", mout_mpll_user_p4x12,
|
||||
|
@ -531,6 +656,7 @@ static struct samsung_mux_clock exynos4x12_mux_clks[] __initdata = {
|
|||
MUX(CLK_SCLK_MPLL, "sclk_mpll", mout_mpll_p, SRC_DMC, 12, 1),
|
||||
MUX(CLK_SCLK_VPLL, "sclk_vpll", mout_vpll_p, SRC_TOP0, 8, 1),
|
||||
MUX(CLK_MOUT_CORE, "mout_core", mout_core_p4x12, SRC_CPU, 16, 1),
|
||||
MUX(0, "mout_hpm", mout_core_p4x12, SRC_CPU, 20, 1),
|
||||
MUX(CLK_MOUT_FIMC0, "mout_fimc0", group1_p4x12, SRC_CAM, 0, 4),
|
||||
MUX(CLK_MOUT_FIMC1, "mout_fimc1", group1_p4x12, SRC_CAM, 4, 4),
|
||||
MUX(CLK_MOUT_FIMC2, "mout_fimc2", group1_p4x12, SRC_CAM, 8, 4),
|
||||
|
@ -565,15 +691,39 @@ static struct samsung_mux_clock exynos4x12_mux_clks[] __initdata = {
|
|||
MUX(0, "mout_spi0_isp", group1_p4x12, E4X12_SRC_ISP, 4, 4),
|
||||
MUX(0, "mout_spi1_isp", group1_p4x12, E4X12_SRC_ISP, 8, 4),
|
||||
MUX(0, "mout_uart_isp", group1_p4x12, E4X12_SRC_ISP, 12, 4),
|
||||
MUX(0, "mout_clkout_top", clkout_top_p4x12, CLKOUT_CMU_TOP, 0, 5),
|
||||
|
||||
MUX(0, "mout_c2c", sclk_ampll_p4210, SRC_DMC, 0, 1),
|
||||
MUX(0, "mout_pwi", mout_pwi_p4x12, SRC_DMC, 16, 4),
|
||||
MUX(0, "mout_g2d0", sclk_ampll_p4210, SRC_DMC, 20, 1),
|
||||
MUX(0, "mout_g2d1", sclk_evpll_p, SRC_DMC, 24, 1),
|
||||
MUX(0, "mout_g2d", mout_g2d_p, SRC_DMC, 28, 1),
|
||||
MUX(0, "mout_clkout_dmc", clkout_dmc_p4x12, CLKOUT_CMU_DMC, 0, 5),
|
||||
};
|
||||
|
||||
/* list of divider clocks supported in all exynos4 soc's */
|
||||
static struct samsung_div_clock exynos4_div_clks[] __initdata = {
|
||||
DIV(0, "div_gdl", "mout_gdl", DIV_LEFTBUS, 0, 3),
|
||||
DIV(0, "div_gpl", "div_gdl", DIV_LEFTBUS, 4, 3),
|
||||
DIV(0, "div_clkout_leftbus", "mout_clkout_leftbus",
|
||||
CLKOUT_CMU_LEFTBUS, 8, 6),
|
||||
|
||||
DIV(0, "div_gdr", "mout_gdr", DIV_RIGHTBUS, 0, 3),
|
||||
DIV(0, "div_gpr", "div_gdr", DIV_RIGHTBUS, 4, 3),
|
||||
DIV(0, "div_clkout_rightbus", "mout_clkout_rightbus",
|
||||
CLKOUT_CMU_RIGHTBUS, 8, 6),
|
||||
|
||||
DIV(0, "div_core", "mout_core", DIV_CPU0, 0, 3),
|
||||
DIV(0, "div_corem0", "div_core2", DIV_CPU0, 4, 3),
|
||||
DIV(0, "div_corem1", "div_core2", DIV_CPU0, 8, 3),
|
||||
DIV(0, "div_periph", "div_core2", DIV_CPU0, 12, 3),
|
||||
DIV(0, "div_atb", "mout_core", DIV_CPU0, 16, 3),
|
||||
DIV(0, "div_pclk_dbg", "div_atb", DIV_CPU0, 20, 3),
|
||||
DIV(0, "div_core2", "div_core", DIV_CPU0, 28, 3),
|
||||
DIV(0, "div_copy", "mout_hpm", DIV_CPU1, 0, 3),
|
||||
DIV(0, "div_hpm", "div_copy", DIV_CPU1, 4, 3),
|
||||
DIV(0, "div_clkout_cpu", "mout_clkout_cpu", CLKOUT_CMU_CPU, 8, 6),
|
||||
|
||||
DIV(0, "div_fimc0", "mout_fimc0", DIV_CAM, 0, 4),
|
||||
DIV(0, "div_fimc1", "mout_fimc1", DIV_CAM, 4, 4),
|
||||
DIV(0, "div_fimc2", "mout_fimc2", DIV_CAM, 8, 4),
|
||||
|
@ -631,6 +781,16 @@ static struct samsung_div_clock exynos4_div_clks[] __initdata = {
|
|||
CLK_SET_RATE_PARENT, 0),
|
||||
DIV_F(0, "div_mmc_pre3", "div_mmc3", DIV_FSYS2, 24, 8,
|
||||
CLK_SET_RATE_PARENT, 0),
|
||||
DIV(0, "div_clkout_top", "mout_clkout_top", CLKOUT_CMU_TOP, 8, 6),
|
||||
|
||||
DIV(0, "div_acp", "mout_dmc_bus", DIV_DMC0, 0, 3),
|
||||
DIV(0, "div_acp_pclk", "div_acp", DIV_DMC0, 4, 3),
|
||||
DIV(0, "div_dphy", "mout_dphy", DIV_DMC0, 8, 3),
|
||||
DIV(0, "div_dmc", "mout_dmc_bus", DIV_DMC0, 12, 3),
|
||||
DIV(0, "div_dmcd", "div_dmc", DIV_DMC0, 16, 3),
|
||||
DIV(0, "div_dmcp", "div_dmcd", DIV_DMC0, 20, 3),
|
||||
DIV(0, "div_pwi", "mout_pwi", DIV_DMC1, 8, 4),
|
||||
DIV(0, "div_clkout_dmc", "mout_clkout_dmc", CLKOUT_CMU_DMC, 8, 6),
|
||||
};
|
||||
|
||||
/* list of divider clocks supported in exynos4210 soc */
|
||||
|
@ -671,6 +831,8 @@ static struct samsung_div_clock exynos4x12_div_clks[] __initdata = {
|
|||
DIV_F(CLK_DIV_MCUISP1, "div_mcuisp1", "div_mcuisp0", E4X12_DIV_ISP1,
|
||||
8, 3, CLK_GET_RATE_NOCACHE, 0),
|
||||
DIV(CLK_SCLK_FIMG2D, "sclk_fimg2d", "mout_g2d", DIV_DMC1, 0, 4),
|
||||
DIV(0, "div_c2c", "mout_c2c", DIV_DMC1, 4, 3),
|
||||
DIV(0, "div_c2c_aclk", "div_c2c", DIV_DMC1, 12, 3),
|
||||
};
|
||||
|
||||
/* list of gate clocks supported in all exynos4 soc's */
|
||||
|
@ -680,6 +842,8 @@ static struct samsung_gate_clock exynos4_gate_clks[] __initdata = {
|
|||
* the device name and clock alias names specified below for some
|
||||
* of the clocks can be removed.
|
||||
*/
|
||||
GATE(CLK_PPMULEFT, "ppmuleft", "aclk200", GATE_IP_LEFTBUS, 1, 0, 0),
|
||||
GATE(CLK_PPMURIGHT, "ppmuright", "aclk200", GATE_IP_RIGHTBUS, 1, 0, 0),
|
||||
GATE(CLK_SCLK_HDMI, "sclk_hdmi", "mout_hdmi", SRC_MASK_TV, 0, 0, 0),
|
||||
GATE(CLK_SCLK_SPDIF, "sclk_spdif", "mout_spdif", SRC_MASK_PERIL1, 8, 0,
|
||||
0),
|
||||
|
@ -695,11 +859,13 @@ static struct samsung_gate_clock exynos4_gate_clks[] __initdata = {
|
|||
GATE(CLK_SROMC, "sromc", "aclk133", GATE_IP_FSYS, 11, 0, 0),
|
||||
GATE(CLK_SCLK_G3D, "sclk_g3d", "div_g3d", GATE_IP_G3D, 0,
|
||||
CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_PPMUG3D, "ppmug3d", "aclk200", GATE_IP_G3D, 1, 0, 0),
|
||||
GATE(CLK_USB_DEVICE, "usb_device", "aclk133", GATE_IP_FSYS, 13, 0, 0),
|
||||
GATE(CLK_ONENAND, "onenand", "aclk133", GATE_IP_FSYS, 15, 0, 0),
|
||||
GATE(CLK_NFCON, "nfcon", "aclk133", GATE_IP_FSYS, 16, 0, 0),
|
||||
GATE(CLK_GPS, "gps", "aclk133", GATE_IP_GPS, 0, 0, 0),
|
||||
GATE(CLK_SMMU_GPS, "smmu_gps", "aclk133", GATE_IP_GPS, 1, 0, 0),
|
||||
GATE(CLK_PPMUGPS, "ppmugps", "aclk200", GATE_IP_GPS, 2, 0, 0),
|
||||
GATE(CLK_SLIMBUS, "slimbus", "aclk100", GATE_IP_PERIL, 25, 0, 0),
|
||||
GATE(CLK_SCLK_CAM0, "sclk_cam0", "div_cam0", GATE_SCLK_CAM, 4,
|
||||
CLK_SET_RATE_PARENT, 0),
|
||||
|
@ -781,19 +947,24 @@ static struct samsung_gate_clock exynos4_gate_clks[] __initdata = {
|
|||
0, 0),
|
||||
GATE(CLK_SMMU_JPEG, "smmu_jpeg", "aclk160", GATE_IP_CAM, 11,
|
||||
0, 0),
|
||||
GATE(CLK_PPMUCAMIF, "ppmucamif", "aclk160", GATE_IP_CAM, 16, 0, 0),
|
||||
GATE(CLK_PIXELASYNCM0, "pxl_async0", "aclk160", GATE_IP_CAM, 17, 0, 0),
|
||||
GATE(CLK_PIXELASYNCM1, "pxl_async1", "aclk160", GATE_IP_CAM, 18, 0, 0),
|
||||
GATE(CLK_SMMU_TV, "smmu_tv", "aclk160", GATE_IP_TV, 4,
|
||||
0, 0),
|
||||
GATE(CLK_PPMUTV, "ppmutv", "aclk160", GATE_IP_TV, 5, 0, 0),
|
||||
GATE(CLK_MFC, "mfc", "aclk100", GATE_IP_MFC, 0, 0, 0),
|
||||
GATE(CLK_SMMU_MFCL, "smmu_mfcl", "aclk100", GATE_IP_MFC, 1,
|
||||
0, 0),
|
||||
GATE(CLK_SMMU_MFCR, "smmu_mfcr", "aclk100", GATE_IP_MFC, 2,
|
||||
0, 0),
|
||||
GATE(CLK_PPMUMFC_L, "ppmumfc_l", "aclk100", GATE_IP_MFC, 3, 0, 0),
|
||||
GATE(CLK_PPMUMFC_R, "ppmumfc_r", "aclk100", GATE_IP_MFC, 4, 0, 0),
|
||||
GATE(CLK_FIMD0, "fimd0", "aclk160", GATE_IP_LCD0, 0,
|
||||
0, 0),
|
||||
GATE(CLK_SMMU_FIMD0, "smmu_fimd0", "aclk160", GATE_IP_LCD0, 4,
|
||||
0, 0),
|
||||
GATE(CLK_PPMULCD0, "ppmulcd0", "aclk160", GATE_IP_LCD0, 5, 0, 0),
|
||||
GATE(CLK_PDMA0, "pdma0", "aclk133", GATE_IP_FSYS, 0,
|
||||
0, 0),
|
||||
GATE(CLK_PDMA1, "pdma1", "aclk133", GATE_IP_FSYS, 1,
|
||||
|
@ -806,6 +977,7 @@ static struct samsung_gate_clock exynos4_gate_clks[] __initdata = {
|
|||
0, 0),
|
||||
GATE(CLK_SDMMC3, "sdmmc3", "aclk133", GATE_IP_FSYS, 8,
|
||||
0, 0),
|
||||
GATE(CLK_PPMUFILE, "ppmufile", "aclk133", GATE_IP_FSYS, 17, 0, 0),
|
||||
GATE(CLK_UART0, "uart0", "aclk100", GATE_IP_PERIL, 0,
|
||||
0, 0),
|
||||
GATE(CLK_UART1, "uart1", "aclk100", GATE_IP_PERIL, 1,
|
||||
|
@ -852,6 +1024,21 @@ static struct samsung_gate_clock exynos4_gate_clks[] __initdata = {
|
|||
0, 0),
|
||||
GATE(CLK_AC97, "ac97", "aclk100", GATE_IP_PERIL, 27,
|
||||
0, 0),
|
||||
GATE(CLK_PPMUDMC0, "ppmudmc0", "aclk133", GATE_IP_DMC, 8, 0, 0),
|
||||
GATE(CLK_PPMUDMC1, "ppmudmc1", "aclk133", GATE_IP_DMC, 9, 0, 0),
|
||||
GATE(CLK_PPMUCPU, "ppmucpu", "aclk133", GATE_IP_DMC, 10, 0, 0),
|
||||
GATE(CLK_PPMUACP, "ppmuacp", "aclk133", GATE_IP_DMC, 16, 0, 0),
|
||||
|
||||
GATE(CLK_OUT_LEFTBUS, "clkout_leftbus", "div_clkout_leftbus",
|
||||
CLKOUT_CMU_LEFTBUS, 16, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_OUT_RIGHTBUS, "clkout_rightbus", "div_clkout_rightbus",
|
||||
CLKOUT_CMU_RIGHTBUS, 16, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_OUT_TOP, "clkout_top", "div_clkout_top",
|
||||
CLKOUT_CMU_TOP, 16, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_OUT_DMC, "clkout_dmc", "div_clkout_dmc",
|
||||
CLKOUT_CMU_DMC, 16, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_OUT_CPU, "clkout_cpu", "div_clkout_cpu",
|
||||
CLKOUT_CMU_CPU, 16, CLK_SET_RATE_PARENT, 0),
|
||||
};
|
||||
|
||||
/* list of gate clocks supported in exynos4210 soc */
|
||||
|
@ -863,6 +1050,9 @@ static struct samsung_gate_clock exynos4210_gate_clks[] __initdata = {
|
|||
GATE(CLK_SMMU_G2D, "smmu_g2d", "aclk200", E4210_GATE_IP_IMAGE, 3, 0, 0),
|
||||
GATE(CLK_SMMU_MDMA, "smmu_mdma", "aclk200", E4210_GATE_IP_IMAGE, 5, 0,
|
||||
0),
|
||||
GATE(CLK_PPMUIMAGE, "ppmuimage", "aclk200", E4210_GATE_IP_IMAGE, 9, 0,
|
||||
0),
|
||||
GATE(CLK_PPMULCD1, "ppmulcd1", "aclk160", E4210_GATE_IP_LCD1, 5, 0, 0),
|
||||
GATE(CLK_PCIE_PHY, "pcie_phy", "aclk133", GATE_IP_FSYS, 2, 0, 0),
|
||||
GATE(CLK_SATA_PHY, "sata_phy", "aclk133", GATE_IP_FSYS, 3, 0, 0),
|
||||
GATE(CLK_SATA, "sata", "aclk133", GATE_IP_FSYS, 10, 0, 0),
|
||||
|
@ -906,6 +1096,8 @@ static struct samsung_gate_clock exynos4x12_gate_clks[] __initdata = {
|
|||
GATE(CLK_MDMA, "mdma", "aclk200", E4X12_GATE_IP_IMAGE, 2, 0, 0),
|
||||
GATE(CLK_SMMU_MDMA, "smmu_mdma", "aclk200", E4X12_GATE_IP_IMAGE, 5, 0,
|
||||
0),
|
||||
GATE(CLK_PPMUIMAGE, "ppmuimage", "aclk200", E4X12_GATE_IP_IMAGE, 9, 0,
|
||||
0),
|
||||
GATE(CLK_MIPI_HSI, "mipi_hsi", "aclk133", GATE_IP_FSYS, 10, 0, 0),
|
||||
GATE(CLK_CHIPID, "chipid", "aclk100", E4X12_GATE_IP_PERIR, 0, 0, 0),
|
||||
GATE(CLK_SYSREG, "sysreg", "aclk100", E4X12_GATE_IP_PERIR, 1,
|
||||
|
@ -1062,7 +1254,7 @@ static void __init exynos4_clk_register_finpll(struct samsung_clk_provider *ctx)
|
|||
|
||||
}
|
||||
|
||||
static struct of_device_id ext_clk_match[] __initdata = {
|
||||
static const struct of_device_id ext_clk_match[] __initconst = {
|
||||
{ .compatible = "samsung,clock-xxti", .data = (void *)0, },
|
||||
{ .compatible = "samsung,clock-xusbxti", .data = (void *)1, },
|
||||
{},
|
||||
|
@ -1164,6 +1356,32 @@ static struct samsung_pll_clock exynos4x12_plls[nr_plls] __initdata = {
|
|||
VPLL_LOCK, VPLL_CON0, NULL),
|
||||
};
|
||||
|
||||
static void __init exynos4_core_down_clock(enum exynos4_soc soc)
|
||||
{
|
||||
unsigned int tmp;
|
||||
|
||||
/*
|
||||
* Enable arm clock down (in idle) and set arm divider
|
||||
* ratios in WFI/WFE state.
|
||||
*/
|
||||
tmp = (PWR_CTRL1_CORE2_DOWN_RATIO(7) | PWR_CTRL1_CORE1_DOWN_RATIO(7) |
|
||||
PWR_CTRL1_DIV2_DOWN_EN | PWR_CTRL1_DIV1_DOWN_EN |
|
||||
PWR_CTRL1_USE_CORE1_WFE | PWR_CTRL1_USE_CORE0_WFE |
|
||||
PWR_CTRL1_USE_CORE1_WFI | PWR_CTRL1_USE_CORE0_WFI);
|
||||
/* On Exynos4412 enable it also on core 2 and 3 */
|
||||
if (num_possible_cpus() == 4)
|
||||
tmp |= PWR_CTRL1_USE_CORE3_WFE | PWR_CTRL1_USE_CORE2_WFE |
|
||||
PWR_CTRL1_USE_CORE3_WFI | PWR_CTRL1_USE_CORE2_WFI;
|
||||
__raw_writel(tmp, reg_base + PWR_CTRL1);
|
||||
|
||||
/*
|
||||
* Disable the clock up feature on Exynos4x12, in case it was
|
||||
* enabled by bootloader.
|
||||
*/
|
||||
if (exynos4_soc == EXYNOS4X12)
|
||||
__raw_writel(0x0, reg_base + E4X12_PWR_CTRL2);
|
||||
}
|
||||
|
||||
/* register exynos4 clocks */
|
||||
static void __init exynos4_clk_init(struct device_node *np,
|
||||
enum exynos4_soc soc)
|
||||
|
@ -1224,6 +1442,8 @@ static void __init exynos4_clk_init(struct device_node *np,
|
|||
ARRAY_SIZE(exynos4_div_clks));
|
||||
samsung_clk_register_gate(ctx, exynos4_gate_clks,
|
||||
ARRAY_SIZE(exynos4_gate_clks));
|
||||
samsung_clk_register_fixed_factor(ctx, exynos4_fixed_factor_clks,
|
||||
ARRAY_SIZE(exynos4_fixed_factor_clks));
|
||||
|
||||
if (exynos4_soc == EXYNOS4210) {
|
||||
samsung_clk_register_fixed_rate(ctx, exynos4210_fixed_rate_clks,
|
||||
|
@ -1236,6 +1456,9 @@ static void __init exynos4_clk_init(struct device_node *np,
|
|||
ARRAY_SIZE(exynos4210_gate_clks));
|
||||
samsung_clk_register_alias(ctx, exynos4210_aliases,
|
||||
ARRAY_SIZE(exynos4210_aliases));
|
||||
samsung_clk_register_fixed_factor(ctx,
|
||||
exynos4210_fixed_factor_clks,
|
||||
ARRAY_SIZE(exynos4210_fixed_factor_clks));
|
||||
} else {
|
||||
samsung_clk_register_mux(ctx, exynos4x12_mux_clks,
|
||||
ARRAY_SIZE(exynos4x12_mux_clks));
|
||||
|
@ -1245,13 +1468,19 @@ static void __init exynos4_clk_init(struct device_node *np,
|
|||
ARRAY_SIZE(exynos4x12_gate_clks));
|
||||
samsung_clk_register_alias(ctx, exynos4x12_aliases,
|
||||
ARRAY_SIZE(exynos4x12_aliases));
|
||||
samsung_clk_register_fixed_factor(ctx,
|
||||
exynos4x12_fixed_factor_clks,
|
||||
ARRAY_SIZE(exynos4x12_fixed_factor_clks));
|
||||
}
|
||||
|
||||
samsung_clk_register_alias(ctx, exynos4_aliases,
|
||||
ARRAY_SIZE(exynos4_aliases));
|
||||
|
||||
exynos4_core_down_clock(soc);
|
||||
exynos4_clk_sleep_init();
|
||||
|
||||
samsung_clk_of_add_provider(np, ctx);
|
||||
|
||||
pr_info("%s clocks: sclk_apll = %ld, sclk_mpll = %ld\n"
|
||||
"\tsclk_epll = %ld, sclk_vpll = %ld, arm_clk = %ld\n",
|
||||
exynos4_soc == EXYNOS4210 ? "Exynos4210" : "Exynos4x12",
|
||||
|
|
|
@ -748,7 +748,7 @@ static struct samsung_pll_clock exynos5250_plls[nr_plls] __initdata = {
|
|||
VPLL_LOCK, VPLL_CON0, NULL),
|
||||
};
|
||||
|
||||
static struct of_device_id ext_clk_match[] __initdata = {
|
||||
static const struct of_device_id ext_clk_match[] __initconst = {
|
||||
{ .compatible = "samsung,clock-xxti", .data = (void *)0, },
|
||||
{ },
|
||||
};
|
||||
|
@ -820,6 +820,8 @@ static void __init exynos5250_clk_init(struct device_node *np)
|
|||
|
||||
exynos5250_clk_sleep_init();
|
||||
|
||||
samsung_clk_of_add_provider(np, ctx);
|
||||
|
||||
pr_info("Exynos5250: clock setup completed, armclk=%ld\n",
|
||||
_get_rate("div_arm2"));
|
||||
}
|
||||
|
|
|
@ -206,6 +206,8 @@ void __init exynos5260_cmu_register_one(struct device_node *np,
|
|||
if (cmu->clk_regs)
|
||||
exynos5260_clk_sleep_init(reg_base, cmu->clk_regs,
|
||||
cmu->nr_clk_regs);
|
||||
|
||||
samsung_clk_of_add_provider(np, ctx);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -204,6 +204,8 @@ static void __init exynos5410_clk_init(struct device_node *np)
|
|||
samsung_clk_register_gate(ctx, exynos5410_gate_clks,
|
||||
ARRAY_SIZE(exynos5410_gate_clks));
|
||||
|
||||
samsung_clk_of_add_provider(np, ctx);
|
||||
|
||||
pr_debug("Exynos5410: clock setup completed.\n");
|
||||
}
|
||||
CLK_OF_DECLARE(exynos5410_clk, "samsung,exynos5410-clock", exynos5410_clk_init);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#define GATE_BUS_CPU 0x700
|
||||
#define GATE_SCLK_CPU 0x800
|
||||
#define CLKOUT_CMU_CPU 0xa00
|
||||
#define SRC_MASK_CPERI 0x4300
|
||||
#define GATE_IP_G2D 0x8800
|
||||
#define CPLL_LOCK 0x10020
|
||||
#define DPLL_LOCK 0x10030
|
||||
|
@ -70,6 +71,8 @@
|
|||
#define SRC_TOP11 0x10284
|
||||
#define SRC_TOP12 0x10288
|
||||
#define SRC_TOP13 0x1028c /* 5800 specific */
|
||||
#define SRC_MASK_TOP0 0x10300
|
||||
#define SRC_MASK_TOP1 0x10304
|
||||
#define SRC_MASK_TOP2 0x10308
|
||||
#define SRC_MASK_TOP7 0x1031c
|
||||
#define SRC_MASK_DISP10 0x1032c
|
||||
|
@ -77,6 +80,7 @@
|
|||
#define SRC_MASK_FSYS 0x10340
|
||||
#define SRC_MASK_PERIC0 0x10350
|
||||
#define SRC_MASK_PERIC1 0x10354
|
||||
#define SRC_MASK_ISP 0x10370
|
||||
#define DIV_TOP0 0x10500
|
||||
#define DIV_TOP1 0x10504
|
||||
#define DIV_TOP2 0x10508
|
||||
|
@ -98,6 +102,7 @@
|
|||
#define DIV2_RATIO0 0x10590
|
||||
#define DIV4_RATIO 0x105a0
|
||||
#define GATE_BUS_TOP 0x10700
|
||||
#define GATE_BUS_DISP1 0x10728
|
||||
#define GATE_BUS_GEN 0x1073c
|
||||
#define GATE_BUS_FSYS0 0x10740
|
||||
#define GATE_BUS_FSYS2 0x10748
|
||||
|
@ -190,6 +195,10 @@ static unsigned long exynos5x_clk_regs[] __initdata = {
|
|||
SRC_MASK_FSYS,
|
||||
SRC_MASK_PERIC0,
|
||||
SRC_MASK_PERIC1,
|
||||
SRC_MASK_TOP0,
|
||||
SRC_MASK_TOP1,
|
||||
SRC_MASK_MAU,
|
||||
SRC_MASK_ISP,
|
||||
SRC_ISP,
|
||||
DIV_TOP0,
|
||||
DIV_TOP1,
|
||||
|
@ -208,6 +217,7 @@ static unsigned long exynos5x_clk_regs[] __initdata = {
|
|||
SCLK_DIV_ISP1,
|
||||
DIV2_RATIO0,
|
||||
DIV4_RATIO,
|
||||
GATE_BUS_DISP1,
|
||||
GATE_BUS_TOP,
|
||||
GATE_BUS_GEN,
|
||||
GATE_BUS_FSYS0,
|
||||
|
@ -249,6 +259,22 @@ static unsigned long exynos5800_clk_regs[] __initdata = {
|
|||
GATE_IP_CAM,
|
||||
};
|
||||
|
||||
static const struct samsung_clk_reg_dump exynos5420_set_clksrc[] = {
|
||||
{ .offset = SRC_MASK_CPERI, .value = 0xffffffff, },
|
||||
{ .offset = SRC_MASK_TOP0, .value = 0x11111111, },
|
||||
{ .offset = SRC_MASK_TOP1, .value = 0x11101111, },
|
||||
{ .offset = SRC_MASK_TOP2, .value = 0x11111110, },
|
||||
{ .offset = SRC_MASK_TOP7, .value = 0x00111100, },
|
||||
{ .offset = SRC_MASK_DISP10, .value = 0x11111110, },
|
||||
{ .offset = SRC_MASK_MAU, .value = 0x10000000, },
|
||||
{ .offset = SRC_MASK_FSYS, .value = 0x11111110, },
|
||||
{ .offset = SRC_MASK_PERIC0, .value = 0x11111110, },
|
||||
{ .offset = SRC_MASK_PERIC1, .value = 0x11111100, },
|
||||
{ .offset = SRC_MASK_ISP, .value = 0x11111000, },
|
||||
{ .offset = GATE_BUS_DISP1, .value = 0xffffffff, },
|
||||
{ .offset = GATE_IP_PERIC, .value = 0xffffffff, },
|
||||
};
|
||||
|
||||
static int exynos5420_clk_suspend(void)
|
||||
{
|
||||
samsung_clk_save(reg_base, exynos5x_save,
|
||||
|
@ -258,6 +284,9 @@ static int exynos5420_clk_suspend(void)
|
|||
samsung_clk_save(reg_base, exynos5800_save,
|
||||
ARRAY_SIZE(exynos5800_clk_regs));
|
||||
|
||||
samsung_clk_restore(reg_base, exynos5420_set_clksrc,
|
||||
ARRAY_SIZE(exynos5420_set_clksrc));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1169,6 +1198,28 @@ static struct samsung_gate_clock exynos5x_gate_clks[] __initdata = {
|
|||
GATE(CLK_G3D, "g3d", "mout_user_aclk_g3d", GATE_IP_G3D, 9, 0, 0),
|
||||
};
|
||||
|
||||
static const struct samsung_pll_rate_table exynos5420_pll2550x_24mhz_tbl[] = {
|
||||
PLL_35XX_RATE(2000000000, 250, 3, 0),
|
||||
PLL_35XX_RATE(1900000000, 475, 6, 0),
|
||||
PLL_35XX_RATE(1800000000, 225, 3, 0),
|
||||
PLL_35XX_RATE(1700000000, 425, 6, 0),
|
||||
PLL_35XX_RATE(1600000000, 200, 3, 0),
|
||||
PLL_35XX_RATE(1500000000, 250, 4, 0),
|
||||
PLL_35XX_RATE(1400000000, 175, 3, 0),
|
||||
PLL_35XX_RATE(1300000000, 325, 6, 0),
|
||||
PLL_35XX_RATE(1200000000, 200, 2, 1),
|
||||
PLL_35XX_RATE(1100000000, 275, 3, 1),
|
||||
PLL_35XX_RATE(1000000000, 250, 3, 1),
|
||||
PLL_35XX_RATE(900000000, 150, 2, 1),
|
||||
PLL_35XX_RATE(800000000, 200, 3, 1),
|
||||
PLL_35XX_RATE(700000000, 175, 3, 1),
|
||||
PLL_35XX_RATE(600000000, 200, 2, 2),
|
||||
PLL_35XX_RATE(500000000, 250, 3, 2),
|
||||
PLL_35XX_RATE(400000000, 200, 3, 2),
|
||||
PLL_35XX_RATE(300000000, 200, 2, 3),
|
||||
PLL_35XX_RATE(200000000, 200, 3, 3),
|
||||
};
|
||||
|
||||
static struct samsung_pll_clock exynos5x_plls[nr_plls] __initdata = {
|
||||
[apll] = PLL(pll_2550, CLK_FOUT_APLL, "fout_apll", "fin_pll", APLL_LOCK,
|
||||
APLL_CON0, NULL),
|
||||
|
@ -1194,7 +1245,7 @@ static struct samsung_pll_clock exynos5x_plls[nr_plls] __initdata = {
|
|||
KPLL_CON0, NULL),
|
||||
};
|
||||
|
||||
static struct of_device_id ext_clk_match[] __initdata = {
|
||||
static const struct of_device_id ext_clk_match[] __initconst = {
|
||||
{ .compatible = "samsung,exynos5420-oscclk", .data = (void *)0, },
|
||||
{ },
|
||||
};
|
||||
|
@ -1222,6 +1273,12 @@ static void __init exynos5x_clk_init(struct device_node *np,
|
|||
samsung_clk_of_register_fixed_ext(ctx, exynos5x_fixed_rate_ext_clks,
|
||||
ARRAY_SIZE(exynos5x_fixed_rate_ext_clks),
|
||||
ext_clk_match);
|
||||
|
||||
if (_get_rate("fin_pll") == 24 * MHZ) {
|
||||
exynos5x_plls[apll].rate_table = exynos5420_pll2550x_24mhz_tbl;
|
||||
exynos5x_plls[kpll].rate_table = exynos5420_pll2550x_24mhz_tbl;
|
||||
}
|
||||
|
||||
samsung_clk_register_pll(ctx, exynos5x_plls, ARRAY_SIZE(exynos5x_plls),
|
||||
reg_base);
|
||||
samsung_clk_register_fixed_rate(ctx, exynos5x_fixed_rate_clks,
|
||||
|
@ -1253,6 +1310,8 @@ static void __init exynos5x_clk_init(struct device_node *np,
|
|||
}
|
||||
|
||||
exynos5420_clk_sleep_init();
|
||||
|
||||
samsung_clk_of_add_provider(np, ctx);
|
||||
}
|
||||
|
||||
static void __init exynos5420_clk_init(struct device_node *np)
|
||||
|
|
|
@ -84,7 +84,7 @@ static struct samsung_gate_clock exynos5440_gate_clks[] __initdata = {
|
|||
GATE(CLK_CS250_O, "cs250_o", "cs250", CLKEN_OV_VAL, 19, 0, 0),
|
||||
};
|
||||
|
||||
static struct of_device_id ext_clk_match[] __initdata = {
|
||||
static const struct of_device_id ext_clk_match[] __initconst = {
|
||||
{ .compatible = "samsung,clock-xtal", .data = (void *)0, },
|
||||
{},
|
||||
};
|
||||
|
@ -123,6 +123,8 @@ static void __init exynos5440_clk_init(struct device_node *np)
|
|||
samsung_clk_register_gate(ctx, exynos5440_gate_clks,
|
||||
ARRAY_SIZE(exynos5440_gate_clks));
|
||||
|
||||
samsung_clk_of_add_provider(np, ctx);
|
||||
|
||||
pr_info("Exynos5440: arm_clk = %ldHz\n", _get_rate("arm_clk"));
|
||||
pr_info("exynos5440 clock initialization complete\n");
|
||||
}
|
||||
|
|
|
@ -466,6 +466,8 @@ void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f,
|
|||
}
|
||||
|
||||
s3c2410_clk_sleep_init();
|
||||
|
||||
samsung_clk_of_add_provider(np, ctx);
|
||||
}
|
||||
|
||||
static void __init s3c2410_clk_init(struct device_node *np)
|
||||
|
|
|
@ -265,6 +265,8 @@ void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f,
|
|||
ARRAY_SIZE(s3c2412_aliases));
|
||||
|
||||
s3c2412_clk_sleep_init();
|
||||
|
||||
samsung_clk_of_add_provider(np, ctx);
|
||||
}
|
||||
|
||||
static void __init s3c2412_clk_init(struct device_node *np)
|
||||
|
|
|
@ -445,6 +445,8 @@ void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f,
|
|||
}
|
||||
|
||||
s3c2443_clk_sleep_init();
|
||||
|
||||
samsung_clk_of_add_provider(np, ctx);
|
||||
}
|
||||
|
||||
static void __init s3c2416_clk_init(struct device_node *np)
|
||||
|
|
|
@ -518,6 +518,8 @@ void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
|
|||
ARRAY_SIZE(s3c64xx_clock_aliases));
|
||||
s3c64xx_clk_sleep_init();
|
||||
|
||||
samsung_clk_of_add_provider(np, ctx);
|
||||
|
||||
pr_info("%s clocks: apll = %lu, mpll = %lu\n"
|
||||
"\tepll = %lu, arm_clk = %lu\n",
|
||||
is_s3c6400 ? "S3C6400" : "S3C6410",
|
||||
|
|
|
@ -53,7 +53,6 @@ struct samsung_clk_provider *__init samsung_clk_init(struct device_node *np,
|
|||
{
|
||||
struct samsung_clk_provider *ctx;
|
||||
struct clk **clk_table;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
ctx = kzalloc(sizeof(struct samsung_clk_provider), GFP_KERNEL);
|
||||
|
@ -72,17 +71,19 @@ struct samsung_clk_provider *__init samsung_clk_init(struct device_node *np,
|
|||
ctx->clk_data.clk_num = nr_clks;
|
||||
spin_lock_init(&ctx->lock);
|
||||
|
||||
if (!np)
|
||||
return ctx;
|
||||
|
||||
ret = of_clk_add_provider(np, of_clk_src_onecell_get,
|
||||
&ctx->clk_data);
|
||||
if (ret)
|
||||
panic("could not register clock provide\n");
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
void __init samsung_clk_of_add_provider(struct device_node *np,
|
||||
struct samsung_clk_provider *ctx)
|
||||
{
|
||||
if (np) {
|
||||
if (of_clk_add_provider(np, of_clk_src_onecell_get,
|
||||
&ctx->clk_data))
|
||||
panic("could not register clk provider\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* add a clock instance to the clock lookup table used for dt based lookup */
|
||||
void samsung_clk_add_lookup(struct samsung_clk_provider *ctx, struct clk *clk,
|
||||
unsigned int id)
|
||||
|
@ -284,7 +285,7 @@ void __init samsung_clk_register_gate(struct samsung_clk_provider *ctx,
|
|||
void __init samsung_clk_of_register_fixed_ext(struct samsung_clk_provider *ctx,
|
||||
struct samsung_fixed_rate_clock *fixed_rate_clk,
|
||||
unsigned int nr_fixed_rate_clk,
|
||||
struct of_device_id *clk_matches)
|
||||
const struct of_device_id *clk_matches)
|
||||
{
|
||||
const struct of_device_id *match;
|
||||
struct device_node *clk_np;
|
||||
|
|
|
@ -327,11 +327,13 @@ struct samsung_pll_clock {
|
|||
extern struct samsung_clk_provider *__init samsung_clk_init(
|
||||
struct device_node *np, void __iomem *base,
|
||||
unsigned long nr_clks);
|
||||
extern void __init samsung_clk_of_add_provider(struct device_node *np,
|
||||
struct samsung_clk_provider *ctx);
|
||||
extern void __init samsung_clk_of_register_fixed_ext(
|
||||
struct samsung_clk_provider *ctx,
|
||||
struct samsung_fixed_rate_clock *fixed_rate_clk,
|
||||
unsigned int nr_fixed_rate_clk,
|
||||
struct of_device_id *clk_matches);
|
||||
const struct of_device_id *clk_matches);
|
||||
|
||||
extern void samsung_clk_add_lookup(struct samsung_clk_provider *ctx,
|
||||
struct clk *clk, unsigned int id);
|
||||
|
|
|
@ -742,19 +742,19 @@ void __init spear1310_clk_init(void __iomem *misc_base, void __iomem *ras_base)
|
|||
clk = clk_register_gate(NULL, "pcie_sata_0_clk", "ahb_clk", 0,
|
||||
SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_0_CLK_ENB,
|
||||
0, &_lock);
|
||||
clk_register_clkdev(clk, NULL, "dw_pcie.0");
|
||||
clk_register_clkdev(clk, NULL, "b1000000.pcie");
|
||||
clk_register_clkdev(clk, NULL, "b1000000.ahci");
|
||||
|
||||
clk = clk_register_gate(NULL, "pcie_sata_1_clk", "ahb_clk", 0,
|
||||
SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_1_CLK_ENB,
|
||||
0, &_lock);
|
||||
clk_register_clkdev(clk, NULL, "dw_pcie.1");
|
||||
clk_register_clkdev(clk, NULL, "b1800000.pcie");
|
||||
clk_register_clkdev(clk, NULL, "b1800000.ahci");
|
||||
|
||||
clk = clk_register_gate(NULL, "pcie_sata_2_clk", "ahb_clk", 0,
|
||||
SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_PCIE_SATA_2_CLK_ENB,
|
||||
0, &_lock);
|
||||
clk_register_clkdev(clk, NULL, "dw_pcie.2");
|
||||
clk_register_clkdev(clk, NULL, "b4000000.pcie");
|
||||
clk_register_clkdev(clk, NULL, "b4000000.ahci");
|
||||
|
||||
clk = clk_register_gate(NULL, "sysram0_clk", "ahb_clk", 0,
|
||||
|
|
|
@ -839,7 +839,7 @@ void __init spear1340_clk_init(void __iomem *misc_base)
|
|||
clk = clk_register_gate(NULL, "pcie_sata_clk", "ahb_clk", 0,
|
||||
SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_PCIE_SATA_CLK_ENB,
|
||||
0, &_lock);
|
||||
clk_register_clkdev(clk, NULL, "dw_pcie");
|
||||
clk_register_clkdev(clk, NULL, "b1000000.pcie");
|
||||
clk_register_clkdev(clk, NULL, "b1000000.ahci");
|
||||
|
||||
clk = clk_register_gate(NULL, "sysram0_clk", "ahb_clk", 0,
|
||||
|
|
|
@ -1 +1 @@
|
|||
obj-y += clkgen-mux.o clkgen-pll.o clkgen-fsyn.o
|
||||
obj-y += clkgen-mux.o clkgen-pll.o clkgen-fsyn.o clk-flexgen.o
|
||||
|
|
|
@ -0,0 +1,331 @@
|
|||
/*
|
||||
* clk-flexgen.c
|
||||
*
|
||||
* Copyright (C) ST-Microelectronics SA 2013
|
||||
* Author: Maxime Coquelin <maxime.coquelin@st.com> for ST-Microelectronics.
|
||||
* License terms: GNU General Public License (GPL), version 2 */
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
|
||||
struct flexgen {
|
||||
struct clk_hw hw;
|
||||
|
||||
/* Crossbar */
|
||||
struct clk_mux mux;
|
||||
/* Pre-divisor's gate */
|
||||
struct clk_gate pgate;
|
||||
/* Pre-divisor */
|
||||
struct clk_divider pdiv;
|
||||
/* Final divisor's gate */
|
||||
struct clk_gate fgate;
|
||||
/* Final divisor */
|
||||
struct clk_divider fdiv;
|
||||
};
|
||||
|
||||
#define to_flexgen(_hw) container_of(_hw, struct flexgen, hw)
|
||||
|
||||
static int flexgen_enable(struct clk_hw *hw)
|
||||
{
|
||||
struct flexgen *flexgen = to_flexgen(hw);
|
||||
struct clk_hw *pgate_hw = &flexgen->pgate.hw;
|
||||
struct clk_hw *fgate_hw = &flexgen->fgate.hw;
|
||||
|
||||
pgate_hw->clk = hw->clk;
|
||||
fgate_hw->clk = hw->clk;
|
||||
|
||||
clk_gate_ops.enable(pgate_hw);
|
||||
|
||||
clk_gate_ops.enable(fgate_hw);
|
||||
|
||||
pr_debug("%s: flexgen output enabled\n", __clk_get_name(hw->clk));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void flexgen_disable(struct clk_hw *hw)
|
||||
{
|
||||
struct flexgen *flexgen = to_flexgen(hw);
|
||||
struct clk_hw *fgate_hw = &flexgen->fgate.hw;
|
||||
|
||||
/* disable only the final gate */
|
||||
fgate_hw->clk = hw->clk;
|
||||
|
||||
clk_gate_ops.disable(fgate_hw);
|
||||
|
||||
pr_debug("%s: flexgen output disabled\n", __clk_get_name(hw->clk));
|
||||
}
|
||||
|
||||
static int flexgen_is_enabled(struct clk_hw *hw)
|
||||
{
|
||||
struct flexgen *flexgen = to_flexgen(hw);
|
||||
struct clk_hw *fgate_hw = &flexgen->fgate.hw;
|
||||
|
||||
fgate_hw->clk = hw->clk;
|
||||
|
||||
if (!clk_gate_ops.is_enabled(fgate_hw))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static u8 flexgen_get_parent(struct clk_hw *hw)
|
||||
{
|
||||
struct flexgen *flexgen = to_flexgen(hw);
|
||||
struct clk_hw *mux_hw = &flexgen->mux.hw;
|
||||
|
||||
mux_hw->clk = hw->clk;
|
||||
|
||||
return clk_mux_ops.get_parent(mux_hw);
|
||||
}
|
||||
|
||||
static int flexgen_set_parent(struct clk_hw *hw, u8 index)
|
||||
{
|
||||
struct flexgen *flexgen = to_flexgen(hw);
|
||||
struct clk_hw *mux_hw = &flexgen->mux.hw;
|
||||
|
||||
mux_hw->clk = hw->clk;
|
||||
|
||||
return clk_mux_ops.set_parent(mux_hw, index);
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
clk_best_div(unsigned long parent_rate, unsigned long rate)
|
||||
{
|
||||
return parent_rate / rate + ((rate > (2*(parent_rate % rate))) ? 0 : 1);
|
||||
}
|
||||
|
||||
static long flexgen_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *prate)
|
||||
{
|
||||
unsigned long div;
|
||||
|
||||
/* Round div according to exact prate and wished rate */
|
||||
div = clk_best_div(*prate, rate);
|
||||
|
||||
if (__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT) {
|
||||
*prate = rate * div;
|
||||
return rate;
|
||||
}
|
||||
|
||||
return *prate / div;
|
||||
}
|
||||
|
||||
unsigned long flexgen_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct flexgen *flexgen = to_flexgen(hw);
|
||||
struct clk_hw *pdiv_hw = &flexgen->pdiv.hw;
|
||||
struct clk_hw *fdiv_hw = &flexgen->fdiv.hw;
|
||||
unsigned long mid_rate;
|
||||
|
||||
pdiv_hw->clk = hw->clk;
|
||||
fdiv_hw->clk = hw->clk;
|
||||
|
||||
mid_rate = clk_divider_ops.recalc_rate(pdiv_hw, parent_rate);
|
||||
|
||||
return clk_divider_ops.recalc_rate(fdiv_hw, mid_rate);
|
||||
}
|
||||
|
||||
static int flexgen_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct flexgen *flexgen = to_flexgen(hw);
|
||||
struct clk_hw *pdiv_hw = &flexgen->pdiv.hw;
|
||||
struct clk_hw *fdiv_hw = &flexgen->fdiv.hw;
|
||||
unsigned long primary_div = 0;
|
||||
int ret = 0;
|
||||
|
||||
pdiv_hw->clk = hw->clk;
|
||||
fdiv_hw->clk = hw->clk;
|
||||
|
||||
primary_div = clk_best_div(parent_rate, rate);
|
||||
|
||||
clk_divider_ops.set_rate(fdiv_hw, parent_rate, parent_rate);
|
||||
ret = clk_divider_ops.set_rate(pdiv_hw, rate, rate * primary_div);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct clk_ops flexgen_ops = {
|
||||
.enable = flexgen_enable,
|
||||
.disable = flexgen_disable,
|
||||
.is_enabled = flexgen_is_enabled,
|
||||
.get_parent = flexgen_get_parent,
|
||||
.set_parent = flexgen_set_parent,
|
||||
.round_rate = flexgen_round_rate,
|
||||
.recalc_rate = flexgen_recalc_rate,
|
||||
.set_rate = flexgen_set_rate,
|
||||
};
|
||||
|
||||
struct clk *clk_register_flexgen(const char *name,
|
||||
const char **parent_names, u8 num_parents,
|
||||
void __iomem *reg, spinlock_t *lock, u32 idx,
|
||||
unsigned long flexgen_flags) {
|
||||
struct flexgen *fgxbar;
|
||||
struct clk *clk;
|
||||
struct clk_init_data init;
|
||||
u32 xbar_shift;
|
||||
void __iomem *xbar_reg, *fdiv_reg;
|
||||
|
||||
fgxbar = kzalloc(sizeof(struct flexgen), GFP_KERNEL);
|
||||
if (!fgxbar)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
init.name = name;
|
||||
init.ops = &flexgen_ops;
|
||||
init.flags = CLK_IS_BASIC | flexgen_flags;
|
||||
init.parent_names = parent_names;
|
||||
init.num_parents = num_parents;
|
||||
|
||||
xbar_reg = reg + 0x18 + (idx & ~0x3);
|
||||
xbar_shift = (idx % 4) * 0x8;
|
||||
fdiv_reg = reg + 0x164 + idx * 4;
|
||||
|
||||
/* Crossbar element config */
|
||||
fgxbar->mux.lock = lock;
|
||||
fgxbar->mux.mask = BIT(6) - 1;
|
||||
fgxbar->mux.reg = xbar_reg;
|
||||
fgxbar->mux.shift = xbar_shift;
|
||||
fgxbar->mux.table = NULL;
|
||||
|
||||
|
||||
/* Pre-divider's gate config (in xbar register)*/
|
||||
fgxbar->pgate.lock = lock;
|
||||
fgxbar->pgate.reg = xbar_reg;
|
||||
fgxbar->pgate.bit_idx = xbar_shift + 6;
|
||||
|
||||
/* Pre-divider config */
|
||||
fgxbar->pdiv.lock = lock;
|
||||
fgxbar->pdiv.reg = reg + 0x58 + idx * 4;
|
||||
fgxbar->pdiv.width = 10;
|
||||
|
||||
/* Final divider's gate config */
|
||||
fgxbar->fgate.lock = lock;
|
||||
fgxbar->fgate.reg = fdiv_reg;
|
||||
fgxbar->fgate.bit_idx = 6;
|
||||
|
||||
/* Final divider config */
|
||||
fgxbar->fdiv.lock = lock;
|
||||
fgxbar->fdiv.reg = fdiv_reg;
|
||||
fgxbar->fdiv.width = 6;
|
||||
|
||||
fgxbar->hw.init = &init;
|
||||
|
||||
clk = clk_register(NULL, &fgxbar->hw);
|
||||
if (IS_ERR(clk))
|
||||
kfree(fgxbar);
|
||||
else
|
||||
pr_debug("%s: parent %s rate %u\n",
|
||||
__clk_get_name(clk),
|
||||
__clk_get_name(clk_get_parent(clk)),
|
||||
(unsigned int)clk_get_rate(clk));
|
||||
return clk;
|
||||
}
|
||||
|
||||
static const char ** __init flexgen_get_parents(struct device_node *np,
|
||||
int *num_parents)
|
||||
{
|
||||
const char **parents;
|
||||
int nparents, i;
|
||||
|
||||
nparents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
|
||||
if (WARN_ON(nparents <= 0))
|
||||
return NULL;
|
||||
|
||||
parents = kcalloc(nparents, sizeof(const char *), GFP_KERNEL);
|
||||
if (!parents)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < nparents; i++)
|
||||
parents[i] = of_clk_get_parent_name(np, i);
|
||||
|
||||
*num_parents = nparents;
|
||||
return parents;
|
||||
}
|
||||
|
||||
void __init st_of_flexgen_setup(struct device_node *np)
|
||||
{
|
||||
struct device_node *pnode;
|
||||
void __iomem *reg;
|
||||
struct clk_onecell_data *clk_data;
|
||||
const char **parents;
|
||||
int num_parents, i;
|
||||
spinlock_t *rlock = NULL;
|
||||
unsigned long flex_flags = 0;
|
||||
|
||||
pnode = of_get_parent(np);
|
||||
if (!pnode)
|
||||
return;
|
||||
|
||||
reg = of_iomap(pnode, 0);
|
||||
if (!reg)
|
||||
return;
|
||||
|
||||
parents = flexgen_get_parents(np, &num_parents);
|
||||
if (!parents)
|
||||
return;
|
||||
|
||||
clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL);
|
||||
if (!clk_data)
|
||||
goto err;
|
||||
|
||||
clk_data->clk_num = of_property_count_strings(np ,
|
||||
"clock-output-names");
|
||||
if (clk_data->clk_num <= 0) {
|
||||
pr_err("%s: Failed to get number of output clocks (%d)",
|
||||
__func__, clk_data->clk_num);
|
||||
goto err;
|
||||
}
|
||||
|
||||
clk_data->clks = kcalloc(clk_data->clk_num, sizeof(struct clk *),
|
||||
GFP_KERNEL);
|
||||
if (!clk_data->clks)
|
||||
goto err;
|
||||
|
||||
rlock = kzalloc(sizeof(spinlock_t), GFP_KERNEL);
|
||||
if (!rlock)
|
||||
goto err;
|
||||
|
||||
for (i = 0; i < clk_data->clk_num; i++) {
|
||||
struct clk *clk;
|
||||
const char *clk_name;
|
||||
|
||||
if (of_property_read_string_index(np, "clock-output-names",
|
||||
i, &clk_name)) {
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we read an empty clock name then the output is unused
|
||||
*/
|
||||
if (*clk_name == '\0')
|
||||
continue;
|
||||
|
||||
clk = clk_register_flexgen(clk_name, parents, num_parents,
|
||||
reg, rlock, i, flex_flags);
|
||||
|
||||
if (IS_ERR(clk))
|
||||
goto err;
|
||||
|
||||
clk_data->clks[i] = clk;
|
||||
}
|
||||
|
||||
kfree(parents);
|
||||
of_clk_add_provider(np, of_clk_src_onecell_get, clk_data);
|
||||
|
||||
return;
|
||||
|
||||
err:
|
||||
if (clk_data)
|
||||
kfree(clk_data->clks);
|
||||
kfree(clk_data);
|
||||
kfree(parents);
|
||||
kfree(rlock);
|
||||
}
|
||||
CLK_OF_DECLARE(flexgen, "st,flexgen", st_of_flexgen_setup);
|
|
@ -41,7 +41,7 @@ struct stm_fs {
|
|||
unsigned long nsdiv;
|
||||
};
|
||||
|
||||
static struct stm_fs fs216c65_rtbl[] = {
|
||||
static const struct stm_fs fs216c65_rtbl[] = {
|
||||
{ .mdiv = 0x1f, .pe = 0x0, .sdiv = 0x7, .nsdiv = 0 }, /* 312.5 Khz */
|
||||
{ .mdiv = 0x17, .pe = 0x25ed, .sdiv = 0x1, .nsdiv = 0 }, /* 27 MHz */
|
||||
{ .mdiv = 0x1a, .pe = 0x7b36, .sdiv = 0x2, .nsdiv = 1 }, /* 36.87 MHz */
|
||||
|
@ -49,31 +49,86 @@ static struct stm_fs fs216c65_rtbl[] = {
|
|||
{ .mdiv = 0x11, .pe = 0x1c72, .sdiv = 0x1, .nsdiv = 1 }, /* 108 MHz */
|
||||
};
|
||||
|
||||
static struct stm_fs fs432c65_rtbl[] = {
|
||||
{ .mdiv = 0x1f, .pe = 0x0, .sdiv = 0x7, .nsdiv = 0 }, /* 625 Khz */
|
||||
{ .mdiv = 0x11, .pe = 0x1c72, .sdiv = 0x2, .nsdiv = 1 }, /* 108 MHz */
|
||||
{ .mdiv = 0x19, .pe = 0x121a, .sdiv = 0x0, .nsdiv = 1 }, /* 297 MHz */
|
||||
static const struct stm_fs fs432c65_rtbl[] = {
|
||||
{ .mdiv = 0x1f, .pe = 0x0, .sdiv = 0x7, .nsdiv = 0 }, /* 625 Khz */
|
||||
{ .mdiv = 0x13, .pe = 0x777c, .sdiv = 0x4, .nsdiv = 1 }, /* 25.175 MHz */
|
||||
{ .mdiv = 0x19, .pe = 0x4d35, .sdiv = 0x2, .nsdiv = 0 }, /* 25.200 MHz */
|
||||
{ .mdiv = 0x11, .pe = 0x1c72, .sdiv = 0x4, .nsdiv = 1 }, /* 27.000 MHz */
|
||||
{ .mdiv = 0x17, .pe = 0x28f5, .sdiv = 0x2, .nsdiv = 0 }, /* 27.027 MHz */
|
||||
{ .mdiv = 0x16, .pe = 0x3359, .sdiv = 0x2, .nsdiv = 0 }, /* 28.320 MHz */
|
||||
{ .mdiv = 0x1f, .pe = 0x2083, .sdiv = 0x3, .nsdiv = 1 }, /* 30.240 MHz */
|
||||
{ .mdiv = 0x1e, .pe = 0x430d, .sdiv = 0x3, .nsdiv = 1 }, /* 31.500 MHz */
|
||||
{ .mdiv = 0x17, .pe = 0x0, .sdiv = 0x3, .nsdiv = 1 }, /* 40.000 MHz */
|
||||
{ .mdiv = 0x19, .pe = 0x121a, .sdiv = 0x1, .nsdiv = 0 }, /* 49.500 MHz */
|
||||
{ .mdiv = 0x13, .pe = 0x6667, .sdiv = 0x3, .nsdiv = 1 }, /* 50.000 MHz */
|
||||
{ .mdiv = 0x10, .pe = 0x1ee6, .sdiv = 0x3, .nsdiv = 1 }, /* 57.284 MHz */
|
||||
{ .mdiv = 0x1d, .pe = 0x3b14, .sdiv = 0x2, .nsdiv = 1 }, /* 65.000 MHz */
|
||||
{ .mdiv = 0x12, .pe = 0x7c65, .sdiv = 0x1, .nsdiv = 0 }, /* 71.000 MHz */
|
||||
{ .mdiv = 0x19, .pe = 0xecd, .sdiv = 0x2, .nsdiv = 1 }, /* 74.176 MHz */
|
||||
{ .mdiv = 0x19, .pe = 0x121a, .sdiv = 0x2, .nsdiv = 1 }, /* 74.250 MHz */
|
||||
{ .mdiv = 0x19, .pe = 0x3334, .sdiv = 0x2, .nsdiv = 1 }, /* 75.000 MHz */
|
||||
{ .mdiv = 0x18, .pe = 0x5138, .sdiv = 0x2, .nsdiv = 1 }, /* 78.800 MHz */
|
||||
{ .mdiv = 0x1d, .pe = 0x77d, .sdiv = 0x0, .nsdiv = 0 }, /* 85.500 MHz */
|
||||
{ .mdiv = 0x1c, .pe = 0x13d5, .sdiv = 0x0, .nsdiv = 0 }, /* 88.750 MHz */
|
||||
{ .mdiv = 0x11, .pe = 0x1c72, .sdiv = 0x2, .nsdiv = 1 }, /* 108.000 MHz */
|
||||
{ .mdiv = 0x17, .pe = 0x28f5, .sdiv = 0x0, .nsdiv = 0 }, /* 108.108 MHz */
|
||||
{ .mdiv = 0x10, .pe = 0x6e26, .sdiv = 0x2, .nsdiv = 1 }, /* 118.963 MHz */
|
||||
{ .mdiv = 0x15, .pe = 0x3e63, .sdiv = 0x0, .nsdiv = 0 }, /* 119.000 MHz */
|
||||
{ .mdiv = 0x1c, .pe = 0x471d, .sdiv = 0x1, .nsdiv = 1 }, /* 135.000 MHz */
|
||||
{ .mdiv = 0x19, .pe = 0xecd, .sdiv = 0x1, .nsdiv = 1 }, /* 148.352 MHz */
|
||||
{ .mdiv = 0x19, .pe = 0x121a, .sdiv = 0x1, .nsdiv = 1 }, /* 148.500 MHz */
|
||||
{ .mdiv = 0x19, .pe = 0x121a, .sdiv = 0x0, .nsdiv = 1 }, /* 297 MHz */
|
||||
};
|
||||
|
||||
static struct stm_fs fs660c32_rtbl[] = {
|
||||
{ .mdiv = 0x01, .pe = 0x2aaa, .sdiv = 0x8, .nsdiv = 0 }, /* 600 KHz */
|
||||
{ .mdiv = 0x02, .pe = 0x3d33, .sdiv = 0x0, .nsdiv = 0 }, /* 148.5 Mhz */
|
||||
{ .mdiv = 0x13, .pe = 0x5bcc, .sdiv = 0x0, .nsdiv = 1 }, /* 297 Mhz */
|
||||
{ .mdiv = 0x0e, .pe = 0x1025, .sdiv = 0x0, .nsdiv = 1 }, /* 333 Mhz */
|
||||
{ .mdiv = 0x0b, .pe = 0x715f, .sdiv = 0x0, .nsdiv = 1 }, /* 350 Mhz */
|
||||
static const struct stm_fs fs660c32_rtbl[] = {
|
||||
{ .mdiv = 0x14, .pe = 0x376b, .sdiv = 0x4, .nsdiv = 1 }, /* 25.175 MHz */
|
||||
{ .mdiv = 0x14, .pe = 0x30c3, .sdiv = 0x4, .nsdiv = 1 }, /* 25.200 MHz */
|
||||
{ .mdiv = 0x10, .pe = 0x71c7, .sdiv = 0x4, .nsdiv = 1 }, /* 27.000 MHz */
|
||||
{ .mdiv = 0x00, .pe = 0x47af, .sdiv = 0x3, .nsdiv = 0 }, /* 27.027 MHz */
|
||||
{ .mdiv = 0x0e, .pe = 0x4e1a, .sdiv = 0x4, .nsdiv = 1 }, /* 28.320 MHz */
|
||||
{ .mdiv = 0x0b, .pe = 0x534d, .sdiv = 0x4, .nsdiv = 1 }, /* 30.240 MHz */
|
||||
{ .mdiv = 0x17, .pe = 0x6fbf, .sdiv = 0x2, .nsdiv = 0 }, /* 31.500 MHz */
|
||||
{ .mdiv = 0x01, .pe = 0x0, .sdiv = 0x4, .nsdiv = 1 }, /* 40.000 MHz */
|
||||
{ .mdiv = 0x15, .pe = 0x2aab, .sdiv = 0x3, .nsdiv = 1 }, /* 49.500 MHz */
|
||||
{ .mdiv = 0x14, .pe = 0x6666, .sdiv = 0x3, .nsdiv = 1 }, /* 50.000 MHz */
|
||||
{ .mdiv = 0x1d, .pe = 0x395f, .sdiv = 0x1, .nsdiv = 0 }, /* 57.284 MHz */
|
||||
{ .mdiv = 0x08, .pe = 0x4ec5, .sdiv = 0x3, .nsdiv = 1 }, /* 65.000 MHz */
|
||||
{ .mdiv = 0x05, .pe = 0x1770, .sdiv = 0x3, .nsdiv = 1 }, /* 71.000 MHz */
|
||||
{ .mdiv = 0x03, .pe = 0x4ba7, .sdiv = 0x3, .nsdiv = 1 }, /* 74.176 MHz */
|
||||
{ .mdiv = 0x0f, .pe = 0x3426, .sdiv = 0x1, .nsdiv = 0 }, /* 74.250 MHz */
|
||||
{ .mdiv = 0x0e, .pe = 0x7777, .sdiv = 0x1, .nsdiv = 0 }, /* 75.000 MHz */
|
||||
{ .mdiv = 0x01, .pe = 0x4053, .sdiv = 0x3, .nsdiv = 1 }, /* 78.800 MHz */
|
||||
{ .mdiv = 0x09, .pe = 0x15b5, .sdiv = 0x1, .nsdiv = 0 }, /* 85.500 MHz */
|
||||
{ .mdiv = 0x1b, .pe = 0x3f19, .sdiv = 0x2, .nsdiv = 1 }, /* 88.750 MHz */
|
||||
{ .mdiv = 0x10, .pe = 0x71c7, .sdiv = 0x2, .nsdiv = 1 }, /* 108.000 MHz */
|
||||
{ .mdiv = 0x00, .pe = 0x47af, .sdiv = 0x1, .nsdiv = 0 }, /* 108.108 MHz */
|
||||
{ .mdiv = 0x0c, .pe = 0x3118, .sdiv = 0x2, .nsdiv = 1 }, /* 118.963 MHz */
|
||||
{ .mdiv = 0x0c, .pe = 0x2f54, .sdiv = 0x2, .nsdiv = 1 }, /* 119.000 MHz */
|
||||
{ .mdiv = 0x07, .pe = 0xe39, .sdiv = 0x2, .nsdiv = 1 }, /* 135.000 MHz */
|
||||
{ .mdiv = 0x03, .pe = 0x4ba7, .sdiv = 0x2, .nsdiv = 1 }, /* 148.352 MHz */
|
||||
{ .mdiv = 0x0f, .pe = 0x3426, .sdiv = 0x0, .nsdiv = 0 }, /* 148.500 MHz */
|
||||
{ .mdiv = 0x03, .pe = 0x4ba7, .sdiv = 0x1, .nsdiv = 1 }, /* 296.704 MHz */
|
||||
{ .mdiv = 0x03, .pe = 0x471c, .sdiv = 0x1, .nsdiv = 1 }, /* 297.000 MHz */
|
||||
{ .mdiv = 0x00, .pe = 0x295f, .sdiv = 0x1, .nsdiv = 1 }, /* 326.700 MHz */
|
||||
{ .mdiv = 0x1f, .pe = 0x3633, .sdiv = 0x0, .nsdiv = 1 }, /* 333.000 MHz */
|
||||
{ .mdiv = 0x1c, .pe = 0x0, .sdiv = 0x0, .nsdiv = 1 }, /* 352.000 Mhz */
|
||||
};
|
||||
|
||||
struct clkgen_quadfs_data {
|
||||
bool reset_present;
|
||||
bool bwfilter_present;
|
||||
bool lockstatus_present;
|
||||
bool powerup_polarity;
|
||||
bool standby_polarity;
|
||||
bool nsdiv_present;
|
||||
bool nrst_present;
|
||||
struct clkgen_field ndiv;
|
||||
struct clkgen_field ref_bw;
|
||||
struct clkgen_field nreset;
|
||||
struct clkgen_field npda;
|
||||
struct clkgen_field lock_status;
|
||||
|
||||
struct clkgen_field nrst[QUADFS_MAX_CHAN];
|
||||
struct clkgen_field nsb[QUADFS_MAX_CHAN];
|
||||
struct clkgen_field en[QUADFS_MAX_CHAN];
|
||||
struct clkgen_field mdiv[QUADFS_MAX_CHAN];
|
||||
|
@ -82,9 +137,9 @@ struct clkgen_quadfs_data {
|
|||
struct clkgen_field nsdiv[QUADFS_MAX_CHAN];
|
||||
|
||||
const struct clk_ops *pll_ops;
|
||||
struct stm_fs *rtbl;
|
||||
const struct stm_fs *rtbl;
|
||||
u8 rtbl_cnt;
|
||||
int (*get_rate)(unsigned long , struct stm_fs *,
|
||||
int (*get_rate)(unsigned long , const struct stm_fs *,
|
||||
unsigned long *);
|
||||
};
|
||||
|
||||
|
@ -94,11 +149,11 @@ static const struct clk_ops st_quadfs_fs216c65_ops;
|
|||
static const struct clk_ops st_quadfs_fs432c65_ops;
|
||||
static const struct clk_ops st_quadfs_fs660c32_ops;
|
||||
|
||||
static int clk_fs216c65_get_rate(unsigned long, struct stm_fs *,
|
||||
static int clk_fs216c65_get_rate(unsigned long, const struct stm_fs *,
|
||||
unsigned long *);
|
||||
static int clk_fs432c65_get_rate(unsigned long, struct stm_fs *,
|
||||
static int clk_fs432c65_get_rate(unsigned long, const struct stm_fs *,
|
||||
unsigned long *);
|
||||
static int clk_fs660c32_dig_get_rate(unsigned long, struct stm_fs *,
|
||||
static int clk_fs660c32_dig_get_rate(unsigned long, const struct stm_fs *,
|
||||
unsigned long *);
|
||||
/*
|
||||
* Values for all of the standalone instances of this clock
|
||||
|
@ -106,7 +161,7 @@ static int clk_fs660c32_dig_get_rate(unsigned long, struct stm_fs *,
|
|||
* that the individual channel standby control bits (nsb) are in the
|
||||
* first register along with the PLL control bits.
|
||||
*/
|
||||
static struct clkgen_quadfs_data st_fs216c65_416 = {
|
||||
static const struct clkgen_quadfs_data st_fs216c65_416 = {
|
||||
/* 416 specific */
|
||||
.npda = CLKGEN_FIELD(0x0, 0x1, 14),
|
||||
.nsb = { CLKGEN_FIELD(0x0, 0x1, 10),
|
||||
|
@ -143,7 +198,7 @@ static struct clkgen_quadfs_data st_fs216c65_416 = {
|
|||
.get_rate = clk_fs216c65_get_rate,
|
||||
};
|
||||
|
||||
static struct clkgen_quadfs_data st_fs432c65_416 = {
|
||||
static const struct clkgen_quadfs_data st_fs432c65_416 = {
|
||||
.npda = CLKGEN_FIELD(0x0, 0x1, 14),
|
||||
.nsb = { CLKGEN_FIELD(0x0, 0x1, 10),
|
||||
CLKGEN_FIELD(0x0, 0x1, 11),
|
||||
|
@ -179,7 +234,7 @@ static struct clkgen_quadfs_data st_fs432c65_416 = {
|
|||
.get_rate = clk_fs432c65_get_rate,
|
||||
};
|
||||
|
||||
static struct clkgen_quadfs_data st_fs660c32_E_416 = {
|
||||
static const struct clkgen_quadfs_data st_fs660c32_E_416 = {
|
||||
.npda = CLKGEN_FIELD(0x0, 0x1, 14),
|
||||
.nsb = { CLKGEN_FIELD(0x0, 0x1, 10),
|
||||
CLKGEN_FIELD(0x0, 0x1, 11),
|
||||
|
@ -215,7 +270,7 @@ static struct clkgen_quadfs_data st_fs660c32_E_416 = {
|
|||
.get_rate = clk_fs660c32_dig_get_rate,
|
||||
};
|
||||
|
||||
static struct clkgen_quadfs_data st_fs660c32_F_416 = {
|
||||
static const struct clkgen_quadfs_data st_fs660c32_F_416 = {
|
||||
.npda = CLKGEN_FIELD(0x0, 0x1, 14),
|
||||
.nsb = { CLKGEN_FIELD(0x0, 0x1, 10),
|
||||
CLKGEN_FIELD(0x0, 0x1, 11),
|
||||
|
@ -251,6 +306,91 @@ static struct clkgen_quadfs_data st_fs660c32_F_416 = {
|
|||
.get_rate = clk_fs660c32_dig_get_rate,
|
||||
};
|
||||
|
||||
static const struct clkgen_quadfs_data st_fs660c32_C_407 = {
|
||||
.nrst_present = true,
|
||||
.nrst = { CLKGEN_FIELD(0x2f0, 0x1, 0),
|
||||
CLKGEN_FIELD(0x2f0, 0x1, 1),
|
||||
CLKGEN_FIELD(0x2f0, 0x1, 2),
|
||||
CLKGEN_FIELD(0x2f0, 0x1, 3) },
|
||||
.npda = CLKGEN_FIELD(0x2f0, 0x1, 12),
|
||||
.nsb = { CLKGEN_FIELD(0x2f0, 0x1, 8),
|
||||
CLKGEN_FIELD(0x2f0, 0x1, 9),
|
||||
CLKGEN_FIELD(0x2f0, 0x1, 10),
|
||||
CLKGEN_FIELD(0x2f0, 0x1, 11) },
|
||||
.nsdiv_present = true,
|
||||
.nsdiv = { CLKGEN_FIELD(0x304, 0x1, 24),
|
||||
CLKGEN_FIELD(0x308, 0x1, 24),
|
||||
CLKGEN_FIELD(0x30c, 0x1, 24),
|
||||
CLKGEN_FIELD(0x310, 0x1, 24) },
|
||||
.mdiv = { CLKGEN_FIELD(0x304, 0x1f, 15),
|
||||
CLKGEN_FIELD(0x308, 0x1f, 15),
|
||||
CLKGEN_FIELD(0x30c, 0x1f, 15),
|
||||
CLKGEN_FIELD(0x310, 0x1f, 15) },
|
||||
.en = { CLKGEN_FIELD(0x2fc, 0x1, 0),
|
||||
CLKGEN_FIELD(0x2fc, 0x1, 1),
|
||||
CLKGEN_FIELD(0x2fc, 0x1, 2),
|
||||
CLKGEN_FIELD(0x2fc, 0x1, 3) },
|
||||
.ndiv = CLKGEN_FIELD(0x2f4, 0x7, 16),
|
||||
.pe = { CLKGEN_FIELD(0x304, 0x7fff, 0),
|
||||
CLKGEN_FIELD(0x308, 0x7fff, 0),
|
||||
CLKGEN_FIELD(0x30c, 0x7fff, 0),
|
||||
CLKGEN_FIELD(0x310, 0x7fff, 0) },
|
||||
.sdiv = { CLKGEN_FIELD(0x304, 0xf, 20),
|
||||
CLKGEN_FIELD(0x308, 0xf, 20),
|
||||
CLKGEN_FIELD(0x30c, 0xf, 20),
|
||||
CLKGEN_FIELD(0x310, 0xf, 20) },
|
||||
.lockstatus_present = true,
|
||||
.lock_status = CLKGEN_FIELD(0x2A0, 0x1, 24),
|
||||
.powerup_polarity = 1,
|
||||
.standby_polarity = 1,
|
||||
.pll_ops = &st_quadfs_pll_c32_ops,
|
||||
.rtbl = fs660c32_rtbl,
|
||||
.rtbl_cnt = ARRAY_SIZE(fs660c32_rtbl),
|
||||
.get_rate = clk_fs660c32_dig_get_rate,
|
||||
};
|
||||
|
||||
static const struct clkgen_quadfs_data st_fs660c32_D_407 = {
|
||||
.nrst_present = true,
|
||||
.nrst = { CLKGEN_FIELD(0x2a0, 0x1, 0),
|
||||
CLKGEN_FIELD(0x2a0, 0x1, 1),
|
||||
CLKGEN_FIELD(0x2a0, 0x1, 2),
|
||||
CLKGEN_FIELD(0x2a0, 0x1, 3) },
|
||||
.ndiv = CLKGEN_FIELD(0x2a4, 0x7, 16),
|
||||
.pe = { CLKGEN_FIELD(0x2b4, 0x7fff, 0),
|
||||
CLKGEN_FIELD(0x2b8, 0x7fff, 0),
|
||||
CLKGEN_FIELD(0x2bc, 0x7fff, 0),
|
||||
CLKGEN_FIELD(0x2c0, 0x7fff, 0) },
|
||||
.sdiv = { CLKGEN_FIELD(0x2b4, 0xf, 20),
|
||||
CLKGEN_FIELD(0x2b8, 0xf, 20),
|
||||
CLKGEN_FIELD(0x2bc, 0xf, 20),
|
||||
CLKGEN_FIELD(0x2c0, 0xf, 20) },
|
||||
.npda = CLKGEN_FIELD(0x2a0, 0x1, 12),
|
||||
.nsb = { CLKGEN_FIELD(0x2a0, 0x1, 8),
|
||||
CLKGEN_FIELD(0x2a0, 0x1, 9),
|
||||
CLKGEN_FIELD(0x2a0, 0x1, 10),
|
||||
CLKGEN_FIELD(0x2a0, 0x1, 11) },
|
||||
.nsdiv_present = true,
|
||||
.nsdiv = { CLKGEN_FIELD(0x2b4, 0x1, 24),
|
||||
CLKGEN_FIELD(0x2b8, 0x1, 24),
|
||||
CLKGEN_FIELD(0x2bc, 0x1, 24),
|
||||
CLKGEN_FIELD(0x2c0, 0x1, 24) },
|
||||
.mdiv = { CLKGEN_FIELD(0x2b4, 0x1f, 15),
|
||||
CLKGEN_FIELD(0x2b8, 0x1f, 15),
|
||||
CLKGEN_FIELD(0x2bc, 0x1f, 15),
|
||||
CLKGEN_FIELD(0x2c0, 0x1f, 15) },
|
||||
.en = { CLKGEN_FIELD(0x2ac, 0x1, 0),
|
||||
CLKGEN_FIELD(0x2ac, 0x1, 1),
|
||||
CLKGEN_FIELD(0x2ac, 0x1, 2),
|
||||
CLKGEN_FIELD(0x2ac, 0x1, 3) },
|
||||
.lockstatus_present = true,
|
||||
.lock_status = CLKGEN_FIELD(0x2A0, 0x1, 24),
|
||||
.powerup_polarity = 1,
|
||||
.standby_polarity = 1,
|
||||
.pll_ops = &st_quadfs_pll_c32_ops,
|
||||
.rtbl = fs660c32_rtbl,
|
||||
.rtbl_cnt = ARRAY_SIZE(fs660c32_rtbl),
|
||||
.get_rate = clk_fs660c32_dig_get_rate,};
|
||||
|
||||
/**
|
||||
* DOC: A Frequency Synthesizer that multiples its input clock by a fixed factor
|
||||
*
|
||||
|
@ -308,7 +448,7 @@ static int quadfs_pll_enable(struct clk_hw *hw)
|
|||
/*
|
||||
* Power up the PLL
|
||||
*/
|
||||
CLKGEN_WRITE(pll, npda, 1);
|
||||
CLKGEN_WRITE(pll, npda, !pll->data->powerup_polarity);
|
||||
|
||||
if (pll->lock)
|
||||
spin_unlock_irqrestore(pll->lock, flags);
|
||||
|
@ -335,7 +475,7 @@ static void quadfs_pll_disable(struct clk_hw *hw)
|
|||
* Powerdown the PLL and then put block into soft reset if we have
|
||||
* reset control.
|
||||
*/
|
||||
CLKGEN_WRITE(pll, npda, 0);
|
||||
CLKGEN_WRITE(pll, npda, pll->data->powerup_polarity);
|
||||
|
||||
if (pll->data->reset_present)
|
||||
CLKGEN_WRITE(pll, nreset, 0);
|
||||
|
@ -611,7 +751,10 @@ static int quadfs_fsynth_enable(struct clk_hw *hw)
|
|||
if (fs->lock)
|
||||
spin_lock_irqsave(fs->lock, flags);
|
||||
|
||||
CLKGEN_WRITE(fs, nsb[fs->chan], 1);
|
||||
CLKGEN_WRITE(fs, nsb[fs->chan], !fs->data->standby_polarity);
|
||||
|
||||
if (fs->data->nrst_present)
|
||||
CLKGEN_WRITE(fs, nrst[fs->chan], 0);
|
||||
|
||||
if (fs->lock)
|
||||
spin_unlock_irqrestore(fs->lock, flags);
|
||||
|
@ -631,7 +774,7 @@ static void quadfs_fsynth_disable(struct clk_hw *hw)
|
|||
if (fs->lock)
|
||||
spin_lock_irqsave(fs->lock, flags);
|
||||
|
||||
CLKGEN_WRITE(fs, nsb[fs->chan], 0);
|
||||
CLKGEN_WRITE(fs, nsb[fs->chan], !fs->data->standby_polarity);
|
||||
|
||||
if (fs->lock)
|
||||
spin_unlock_irqrestore(fs->lock, flags);
|
||||
|
@ -645,12 +788,12 @@ static int quadfs_fsynth_is_enabled(struct clk_hw *hw)
|
|||
pr_debug("%s: %s enable bit = 0x%x\n",
|
||||
__func__, __clk_get_name(hw->clk), nsb);
|
||||
|
||||
return !!nsb;
|
||||
return fs->data->standby_polarity ? !nsb : !!nsb;
|
||||
}
|
||||
|
||||
#define P15 (uint64_t)(1 << 15)
|
||||
|
||||
static int clk_fs216c65_get_rate(unsigned long input, struct stm_fs *fs,
|
||||
static int clk_fs216c65_get_rate(unsigned long input, const struct stm_fs *fs,
|
||||
unsigned long *rate)
|
||||
{
|
||||
uint64_t res;
|
||||
|
@ -670,7 +813,7 @@ static int clk_fs216c65_get_rate(unsigned long input, struct stm_fs *fs,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int clk_fs432c65_get_rate(unsigned long input, struct stm_fs *fs,
|
||||
static int clk_fs432c65_get_rate(unsigned long input, const struct stm_fs *fs,
|
||||
unsigned long *rate)
|
||||
{
|
||||
uint64_t res;
|
||||
|
@ -693,7 +836,7 @@ static int clk_fs432c65_get_rate(unsigned long input, struct stm_fs *fs,
|
|||
#define P20 (uint64_t)(1 << 20)
|
||||
|
||||
static int clk_fs660c32_dig_get_rate(unsigned long input,
|
||||
struct stm_fs *fs, unsigned long *rate)
|
||||
const struct stm_fs *fs, unsigned long *rate)
|
||||
{
|
||||
unsigned long s = (1 << fs->sdiv);
|
||||
unsigned long ns;
|
||||
|
@ -749,7 +892,7 @@ static long quadfs_find_best_rate(struct clk_hw *hw, unsigned long drate,
|
|||
{
|
||||
struct st_clk_quadfs_fsynth *fs = to_quadfs_fsynth(hw);
|
||||
int (*clk_fs_get_rate)(unsigned long ,
|
||||
struct stm_fs *, unsigned long *);
|
||||
const struct stm_fs *, unsigned long *);
|
||||
struct stm_fs prev_params;
|
||||
unsigned long prev_rate, rate = 0;
|
||||
unsigned long diff_rate, prev_diff_rate = ~0;
|
||||
|
@ -793,7 +936,7 @@ static unsigned long quadfs_recalc_rate(struct clk_hw *hw,
|
|||
unsigned long rate = 0;
|
||||
struct stm_fs params;
|
||||
int (*clk_fs_get_rate)(unsigned long ,
|
||||
struct stm_fs *, unsigned long *);
|
||||
const struct stm_fs *, unsigned long *);
|
||||
|
||||
clk_fs_get_rate = fs->data->get_rate;
|
||||
|
||||
|
@ -917,19 +1060,31 @@ static struct clk * __init st_clk_register_quadfs_fsynth(
|
|||
static struct of_device_id quadfs_of_match[] = {
|
||||
{
|
||||
.compatible = "st,stih416-quadfs216",
|
||||
.data = (void *)&st_fs216c65_416
|
||||
.data = &st_fs216c65_416
|
||||
},
|
||||
{
|
||||
.compatible = "st,stih416-quadfs432",
|
||||
.data = (void *)&st_fs432c65_416
|
||||
.data = &st_fs432c65_416
|
||||
},
|
||||
{
|
||||
.compatible = "st,stih416-quadfs660-E",
|
||||
.data = (void *)&st_fs660c32_E_416
|
||||
.data = &st_fs660c32_E_416
|
||||
},
|
||||
{
|
||||
.compatible = "st,stih416-quadfs660-F",
|
||||
.data = (void *)&st_fs660c32_F_416
|
||||
.data = &st_fs660c32_F_416
|
||||
},
|
||||
{
|
||||
.compatible = "st,stih407-quadfs660-C",
|
||||
.data = &st_fs660c32_C_407
|
||||
},
|
||||
{
|
||||
.compatible = "st,stih407-quadfs660-D",
|
||||
.data = &st_fs660c32_D_407
|
||||
},
|
||||
{
|
||||
.compatible = "st,stih407-quadfs660-D",
|
||||
.data = (void *)&st_fs660c32_D_407
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
|
|
@ -580,6 +580,11 @@ static struct clkgen_mux_data stih416_a9_mux_data = {
|
|||
.shift = 0,
|
||||
.width = 2,
|
||||
};
|
||||
static struct clkgen_mux_data stih407_a9_mux_data = {
|
||||
.offset = 0x1a4,
|
||||
.shift = 1,
|
||||
.width = 2,
|
||||
};
|
||||
|
||||
static struct of_device_id mux_of_match[] = {
|
||||
{
|
||||
|
@ -610,6 +615,10 @@ static struct of_device_id mux_of_match[] = {
|
|||
.compatible = "st,stih416-clkgen-a9-mux",
|
||||
.data = &stih416_a9_mux_data,
|
||||
},
|
||||
{
|
||||
.compatible = "st,stih407-clkgen-a9-mux",
|
||||
.data = &stih407_a9_mux_data,
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -765,7 +774,8 @@ void __init st_of_clkgen_vcc_setup(struct device_node *np)
|
|||
div->reg = reg + VCC_DIV_OFFSET;
|
||||
div->shift = 2 * i;
|
||||
div->width = 2;
|
||||
div->flags = CLK_DIVIDER_POWER_OF_TWO;
|
||||
div->flags = CLK_DIVIDER_POWER_OF_TWO |
|
||||
CLK_DIVIDER_ROUND_CLOSEST;
|
||||
|
||||
mux->reg = reg + VCC_MUX_OFFSET;
|
||||
mux->shift = 2 * i;
|
||||
|
|
|
@ -59,7 +59,7 @@ static const struct clk_ops st_pll800c65_ops;
|
|||
static const struct clk_ops stm_pll3200c32_ops;
|
||||
static const struct clk_ops st_pll1200c32_ops;
|
||||
|
||||
static struct clkgen_pll_data st_pll1600c65_ax = {
|
||||
static const struct clkgen_pll_data st_pll1600c65_ax = {
|
||||
.pdn_status = CLKGEN_FIELD(0x0, 0x1, 19),
|
||||
.locked_status = CLKGEN_FIELD(0x0, 0x1, 31),
|
||||
.mdiv = CLKGEN_FIELD(0x0, C65_MDIV_PLL1600_MASK, 0),
|
||||
|
@ -67,7 +67,7 @@ static struct clkgen_pll_data st_pll1600c65_ax = {
|
|||
.ops = &st_pll1600c65_ops
|
||||
};
|
||||
|
||||
static struct clkgen_pll_data st_pll800c65_ax = {
|
||||
static const struct clkgen_pll_data st_pll800c65_ax = {
|
||||
.pdn_status = CLKGEN_FIELD(0x0, 0x1, 19),
|
||||
.locked_status = CLKGEN_FIELD(0x0, 0x1, 31),
|
||||
.mdiv = CLKGEN_FIELD(0x0, C65_MDIV_PLL800_MASK, 0),
|
||||
|
@ -76,7 +76,7 @@ static struct clkgen_pll_data st_pll800c65_ax = {
|
|||
.ops = &st_pll800c65_ops
|
||||
};
|
||||
|
||||
static struct clkgen_pll_data st_pll3200c32_a1x_0 = {
|
||||
static const struct clkgen_pll_data st_pll3200c32_a1x_0 = {
|
||||
.pdn_status = CLKGEN_FIELD(0x0, 0x1, 31),
|
||||
.locked_status = CLKGEN_FIELD(0x4, 0x1, 31),
|
||||
.ndiv = CLKGEN_FIELD(0x0, C32_NDIV_MASK, 0x0),
|
||||
|
@ -93,7 +93,7 @@ static struct clkgen_pll_data st_pll3200c32_a1x_0 = {
|
|||
.ops = &stm_pll3200c32_ops,
|
||||
};
|
||||
|
||||
static struct clkgen_pll_data st_pll3200c32_a1x_1 = {
|
||||
static const struct clkgen_pll_data st_pll3200c32_a1x_1 = {
|
||||
.pdn_status = CLKGEN_FIELD(0xC, 0x1, 31),
|
||||
.locked_status = CLKGEN_FIELD(0x10, 0x1, 31),
|
||||
.ndiv = CLKGEN_FIELD(0xC, C32_NDIV_MASK, 0x0),
|
||||
|
@ -111,7 +111,7 @@ static struct clkgen_pll_data st_pll3200c32_a1x_1 = {
|
|||
};
|
||||
|
||||
/* 415 specific */
|
||||
static struct clkgen_pll_data st_pll3200c32_a9_415 = {
|
||||
static const struct clkgen_pll_data st_pll3200c32_a9_415 = {
|
||||
.pdn_status = CLKGEN_FIELD(0x0, 0x1, 0),
|
||||
.locked_status = CLKGEN_FIELD(0x6C, 0x1, 0),
|
||||
.ndiv = CLKGEN_FIELD(0x0, C32_NDIV_MASK, 9),
|
||||
|
@ -122,7 +122,7 @@ static struct clkgen_pll_data st_pll3200c32_a9_415 = {
|
|||
.ops = &stm_pll3200c32_ops,
|
||||
};
|
||||
|
||||
static struct clkgen_pll_data st_pll3200c32_ddr_415 = {
|
||||
static const struct clkgen_pll_data st_pll3200c32_ddr_415 = {
|
||||
.pdn_status = CLKGEN_FIELD(0x0, 0x1, 0),
|
||||
.locked_status = CLKGEN_FIELD(0x100, 0x1, 0),
|
||||
.ndiv = CLKGEN_FIELD(0x8, C32_NDIV_MASK, 0),
|
||||
|
@ -135,7 +135,7 @@ static struct clkgen_pll_data st_pll3200c32_ddr_415 = {
|
|||
.ops = &stm_pll3200c32_ops,
|
||||
};
|
||||
|
||||
static struct clkgen_pll_data st_pll1200c32_gpu_415 = {
|
||||
static const struct clkgen_pll_data st_pll1200c32_gpu_415 = {
|
||||
.pdn_status = CLKGEN_FIELD(0x144, 0x1, 3),
|
||||
.locked_status = CLKGEN_FIELD(0x168, 0x1, 0),
|
||||
.ldf = CLKGEN_FIELD(0x0, C32_LDF_MASK, 3),
|
||||
|
@ -146,7 +146,7 @@ static struct clkgen_pll_data st_pll1200c32_gpu_415 = {
|
|||
};
|
||||
|
||||
/* 416 specific */
|
||||
static struct clkgen_pll_data st_pll3200c32_a9_416 = {
|
||||
static const struct clkgen_pll_data st_pll3200c32_a9_416 = {
|
||||
.pdn_status = CLKGEN_FIELD(0x0, 0x1, 0),
|
||||
.locked_status = CLKGEN_FIELD(0x6C, 0x1, 0),
|
||||
.ndiv = CLKGEN_FIELD(0x8, C32_NDIV_MASK, 0),
|
||||
|
@ -157,7 +157,7 @@ static struct clkgen_pll_data st_pll3200c32_a9_416 = {
|
|||
.ops = &stm_pll3200c32_ops,
|
||||
};
|
||||
|
||||
static struct clkgen_pll_data st_pll3200c32_ddr_416 = {
|
||||
static const struct clkgen_pll_data st_pll3200c32_ddr_416 = {
|
||||
.pdn_status = CLKGEN_FIELD(0x0, 0x1, 0),
|
||||
.locked_status = CLKGEN_FIELD(0x10C, 0x1, 0),
|
||||
.ndiv = CLKGEN_FIELD(0x8, C32_NDIV_MASK, 0),
|
||||
|
@ -170,7 +170,7 @@ static struct clkgen_pll_data st_pll3200c32_ddr_416 = {
|
|||
.ops = &stm_pll3200c32_ops,
|
||||
};
|
||||
|
||||
static struct clkgen_pll_data st_pll1200c32_gpu_416 = {
|
||||
static const struct clkgen_pll_data st_pll1200c32_gpu_416 = {
|
||||
.pdn_status = CLKGEN_FIELD(0x8E4, 0x1, 3),
|
||||
.locked_status = CLKGEN_FIELD(0x90C, 0x1, 0),
|
||||
.ldf = CLKGEN_FIELD(0x0, C32_LDF_MASK, 3),
|
||||
|
@ -180,6 +180,54 @@ static struct clkgen_pll_data st_pll1200c32_gpu_416 = {
|
|||
.ops = &st_pll1200c32_ops,
|
||||
};
|
||||
|
||||
static const struct clkgen_pll_data st_pll3200c32_407_a0 = {
|
||||
/* 407 A0 */
|
||||
.pdn_status = CLKGEN_FIELD(0x2a0, 0x1, 8),
|
||||
.locked_status = CLKGEN_FIELD(0x2a0, 0x1, 24),
|
||||
.ndiv = CLKGEN_FIELD(0x2a4, C32_NDIV_MASK, 16),
|
||||
.idf = CLKGEN_FIELD(0x2a4, C32_IDF_MASK, 0x0),
|
||||
.num_odfs = 1,
|
||||
.odf = { CLKGEN_FIELD(0x2b4, C32_ODF_MASK, 0) },
|
||||
.odf_gate = { CLKGEN_FIELD(0x2b4, 0x1, 6) },
|
||||
.ops = &stm_pll3200c32_ops,
|
||||
};
|
||||
|
||||
static const struct clkgen_pll_data st_pll3200c32_407_c0_0 = {
|
||||
/* 407 C0 PLL0 */
|
||||
.pdn_status = CLKGEN_FIELD(0x2a0, 0x1, 8),
|
||||
.locked_status = CLKGEN_FIELD(0x2a0, 0x1, 24),
|
||||
.ndiv = CLKGEN_FIELD(0x2a4, C32_NDIV_MASK, 16),
|
||||
.idf = CLKGEN_FIELD(0x2a4, C32_IDF_MASK, 0x0),
|
||||
.num_odfs = 1,
|
||||
.odf = { CLKGEN_FIELD(0x2b4, C32_ODF_MASK, 0) },
|
||||
.odf_gate = { CLKGEN_FIELD(0x2b4, 0x1, 6) },
|
||||
.ops = &stm_pll3200c32_ops,
|
||||
};
|
||||
|
||||
static const struct clkgen_pll_data st_pll3200c32_407_c0_1 = {
|
||||
/* 407 C0 PLL1 */
|
||||
.pdn_status = CLKGEN_FIELD(0x2c8, 0x1, 8),
|
||||
.locked_status = CLKGEN_FIELD(0x2c8, 0x1, 24),
|
||||
.ndiv = CLKGEN_FIELD(0x2cc, C32_NDIV_MASK, 16),
|
||||
.idf = CLKGEN_FIELD(0x2cc, C32_IDF_MASK, 0x0),
|
||||
.num_odfs = 1,
|
||||
.odf = { CLKGEN_FIELD(0x2dc, C32_ODF_MASK, 0) },
|
||||
.odf_gate = { CLKGEN_FIELD(0x2dc, 0x1, 6) },
|
||||
.ops = &stm_pll3200c32_ops,
|
||||
};
|
||||
|
||||
static const struct clkgen_pll_data st_pll3200c32_407_a9 = {
|
||||
/* 407 A9 */
|
||||
.pdn_status = CLKGEN_FIELD(0x1a8, 0x1, 0),
|
||||
.locked_status = CLKGEN_FIELD(0x87c, 0x1, 0),
|
||||
.ndiv = CLKGEN_FIELD(0x1b0, C32_NDIV_MASK, 0),
|
||||
.idf = CLKGEN_FIELD(0x1a8, C32_IDF_MASK, 25),
|
||||
.num_odfs = 1,
|
||||
.odf = { CLKGEN_FIELD(0x1b0, C32_ODF_MASK, 8) },
|
||||
.odf_gate = { CLKGEN_FIELD(0x1ac, 0x1, 28) },
|
||||
.ops = &stm_pll3200c32_ops,
|
||||
};
|
||||
|
||||
/**
|
||||
* DOC: Clock Generated by PLL, rate set and enabled by bootloader
|
||||
*
|
||||
|
@ -450,9 +498,8 @@ static void __init clkgena_c65_pll_setup(struct device_node *np)
|
|||
* PLL0 HS (high speed) output
|
||||
*/
|
||||
clk_data->clks[0] = clkgen_pll_register(parent_name,
|
||||
&st_pll1600c65_ax,
|
||||
reg + CLKGENAx_PLL0_OFFSET,
|
||||
clk_name);
|
||||
(struct clkgen_pll_data *) &st_pll1600c65_ax,
|
||||
reg + CLKGENAx_PLL0_OFFSET, clk_name);
|
||||
|
||||
if (IS_ERR(clk_data->clks[0]))
|
||||
goto err;
|
||||
|
@ -480,9 +527,8 @@ static void __init clkgena_c65_pll_setup(struct device_node *np)
|
|||
* PLL1 output
|
||||
*/
|
||||
clk_data->clks[2] = clkgen_pll_register(parent_name,
|
||||
&st_pll800c65_ax,
|
||||
reg + CLKGENAx_PLL1_OFFSET,
|
||||
clk_name);
|
||||
(struct clkgen_pll_data *) &st_pll800c65_ax,
|
||||
reg + CLKGENAx_PLL1_OFFSET, clk_name);
|
||||
|
||||
if (IS_ERR(clk_data->clks[2]))
|
||||
goto err;
|
||||
|
@ -572,6 +618,22 @@ static struct of_device_id c32_pll_of_match[] = {
|
|||
.compatible = "st,stih416-plls-c32-ddr",
|
||||
.data = &st_pll3200c32_ddr_416,
|
||||
},
|
||||
{
|
||||
.compatible = "st,stih407-plls-c32-a0",
|
||||
.data = &st_pll3200c32_407_a0,
|
||||
},
|
||||
{
|
||||
.compatible = "st,stih407-plls-c32-c0_0",
|
||||
.data = &st_pll3200c32_407_c0_0,
|
||||
},
|
||||
{
|
||||
.compatible = "st,stih407-plls-c32-c0_1",
|
||||
.data = &st_pll3200c32_407_c0_1,
|
||||
},
|
||||
{
|
||||
.compatible = "st,stih407-plls-c32-a9",
|
||||
.data = &st_pll3200c32_407_a9,
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
|
@ -6,4 +6,6 @@ obj-y += clk-sunxi.o clk-factors.o
|
|||
obj-y += clk-a10-hosc.o
|
||||
obj-y += clk-a20-gmac.o
|
||||
|
||||
obj-$(CONFIG_MFD_SUN6I_PRCM) += clk-sun6i-ar100.o clk-sun6i-apb0.o clk-sun6i-apb0-gates.o
|
||||
obj-$(CONFIG_MFD_SUN6I_PRCM) += \
|
||||
clk-sun6i-ar100.o clk-sun6i-apb0.o clk-sun6i-apb0-gates.o \
|
||||
clk-sun8i-apb0.o
|
||||
|
|
|
@ -60,7 +60,7 @@ static void __init sun7i_a20_gmac_clk_setup(struct device_node *node)
|
|||
struct clk_gate *gate;
|
||||
const char *clk_name = node->name;
|
||||
const char *parents[SUN7I_A20_GMAC_PARENTS];
|
||||
void *reg;
|
||||
void __iomem *reg;
|
||||
|
||||
if (of_property_read_string(node, "clock-output-names", &clk_name))
|
||||
return;
|
||||
|
|
|
@ -62,7 +62,7 @@ static unsigned long clk_factors_recalc_rate(struct clk_hw *hw,
|
|||
p = FACTOR_GET(config->pshift, config->pwidth, reg);
|
||||
|
||||
/* Calculate the rate */
|
||||
rate = (parent_rate * n * (k + 1) >> p) / (m + 1);
|
||||
rate = (parent_rate * (n + config->n_start) * (k + 1) >> p) / (m + 1);
|
||||
|
||||
return rate;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ struct clk_factors_config {
|
|||
u8 mwidth;
|
||||
u8 pshift;
|
||||
u8 pwidth;
|
||||
u8 n_start;
|
||||
};
|
||||
|
||||
struct clk_factors {
|
||||
|
|
|
@ -9,23 +9,53 @@
|
|||
*/
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/clkdev.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#define SUN6I_APB0_GATES_MAX_SIZE 32
|
||||
|
||||
struct gates_data {
|
||||
DECLARE_BITMAP(mask, SUN6I_APB0_GATES_MAX_SIZE);
|
||||
};
|
||||
|
||||
static const struct gates_data sun6i_a31_apb0_gates __initconst = {
|
||||
.mask = {0x7F},
|
||||
};
|
||||
|
||||
static const struct gates_data sun8i_a23_apb0_gates __initconst = {
|
||||
.mask = {0x5D},
|
||||
};
|
||||
|
||||
static const struct of_device_id sun6i_a31_apb0_gates_clk_dt_ids[] = {
|
||||
{ .compatible = "allwinner,sun6i-a31-apb0-gates-clk", .data = &sun6i_a31_apb0_gates },
|
||||
{ .compatible = "allwinner,sun8i-a23-apb0-gates-clk", .data = &sun8i_a23_apb0_gates },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static int sun6i_a31_apb0_gates_clk_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
struct clk_onecell_data *clk_data;
|
||||
const struct of_device_id *device;
|
||||
const struct gates_data *data;
|
||||
const char *clk_parent;
|
||||
const char *clk_name;
|
||||
struct resource *r;
|
||||
void __iomem *reg;
|
||||
int gate_id;
|
||||
int ngates;
|
||||
int i;
|
||||
int j = 0;
|
||||
|
||||
if (!np)
|
||||
return -ENODEV;
|
||||
|
||||
device = of_match_device(sun6i_a31_apb0_gates_clk_dt_ids, &pdev->dev);
|
||||
if (!device)
|
||||
return -ENODEV;
|
||||
data = device->data;
|
||||
|
||||
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
reg = devm_ioremap_resource(&pdev->dev, r);
|
||||
|
@ -36,54 +66,36 @@ static int sun6i_a31_apb0_gates_clk_probe(struct platform_device *pdev)
|
|||
if (!clk_parent)
|
||||
return -EINVAL;
|
||||
|
||||
ngates = of_property_count_strings(np, "clock-output-names");
|
||||
if (ngates < 0)
|
||||
return ngates;
|
||||
|
||||
if (!ngates || ngates > SUN6I_APB0_GATES_MAX_SIZE)
|
||||
return -EINVAL;
|
||||
|
||||
clk_data = devm_kzalloc(&pdev->dev, sizeof(struct clk_onecell_data),
|
||||
GFP_KERNEL);
|
||||
if (!clk_data)
|
||||
return -ENOMEM;
|
||||
|
||||
clk_data->clks = devm_kzalloc(&pdev->dev,
|
||||
SUN6I_APB0_GATES_MAX_SIZE *
|
||||
sizeof(struct clk *),
|
||||
GFP_KERNEL);
|
||||
/* Worst-case size approximation and memory allocation */
|
||||
ngates = find_last_bit(data->mask, SUN6I_APB0_GATES_MAX_SIZE);
|
||||
clk_data->clks = devm_kcalloc(&pdev->dev, (ngates + 1),
|
||||
sizeof(struct clk *), GFP_KERNEL);
|
||||
if (!clk_data->clks)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < ngates; i++) {
|
||||
for_each_set_bit(i, data->mask, SUN6I_APB0_GATES_MAX_SIZE) {
|
||||
of_property_read_string_index(np, "clock-output-names",
|
||||
i, &clk_name);
|
||||
j, &clk_name);
|
||||
|
||||
gate_id = i;
|
||||
of_property_read_u32_index(np, "clock-indices", i, &gate_id);
|
||||
clk_data->clks[i] = clk_register_gate(&pdev->dev, clk_name,
|
||||
clk_parent, 0, reg, i,
|
||||
0, NULL);
|
||||
WARN_ON(IS_ERR(clk_data->clks[i]));
|
||||
clk_register_clkdev(clk_data->clks[i], clk_name, NULL);
|
||||
|
||||
WARN_ON(gate_id >= SUN6I_APB0_GATES_MAX_SIZE);
|
||||
if (gate_id >= SUN6I_APB0_GATES_MAX_SIZE)
|
||||
continue;
|
||||
|
||||
clk_data->clks[gate_id] = clk_register_gate(&pdev->dev,
|
||||
clk_name,
|
||||
clk_parent, 0,
|
||||
reg, gate_id,
|
||||
0, NULL);
|
||||
WARN_ON(IS_ERR(clk_data->clks[gate_id]));
|
||||
j++;
|
||||
}
|
||||
|
||||
clk_data->clk_num = ngates;
|
||||
clk_data->clk_num = ngates + 1;
|
||||
|
||||
return of_clk_add_provider(np, of_clk_src_onecell_get, clk_data);
|
||||
}
|
||||
|
||||
const struct of_device_id sun6i_a31_apb0_gates_clk_dt_ids[] = {
|
||||
{ .compatible = "allwinner,sun6i-a31-apb0-gates-clk" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static struct platform_driver sun6i_a31_apb0_gates_clk_driver = {
|
||||
.driver = {
|
||||
.name = "sun6i-a31-apb0-gates-clk",
|
||||
|
|
|
@ -57,7 +57,7 @@ static int sun6i_a31_apb0_clk_probe(struct platform_device *pdev)
|
|||
return of_clk_add_provider(np, of_clk_src_simple_get, clk);
|
||||
}
|
||||
|
||||
const struct of_device_id sun6i_a31_apb0_clk_dt_ids[] = {
|
||||
static const struct of_device_id sun6i_a31_apb0_clk_dt_ids[] = {
|
||||
{ .compatible = "allwinner,sun6i-a31-apb0-clk" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
|
|
@ -160,7 +160,7 @@ static int ar100_set_rate(struct clk_hw *hw, unsigned long rate,
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct clk_ops ar100_ops = {
|
||||
static struct clk_ops ar100_ops = {
|
||||
.recalc_rate = ar100_recalc_rate,
|
||||
.determine_rate = ar100_determine_rate,
|
||||
.set_parent = ar100_set_parent,
|
||||
|
@ -213,7 +213,7 @@ static int sun6i_a31_ar100_clk_probe(struct platform_device *pdev)
|
|||
return of_clk_add_provider(np, of_clk_src_simple_get, clk);
|
||||
}
|
||||
|
||||
const struct of_device_id sun6i_a31_ar100_clk_dt_ids[] = {
|
||||
static const struct of_device_id sun6i_a31_ar100_clk_dt_ids[] = {
|
||||
{ .compatible = "allwinner,sun6i-a31-ar100-clk" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright (C) 2014 Chen-Yu Tsai
|
||||
* Author: Chen-Yu Tsai <wens@csie.org>
|
||||
*
|
||||
* Allwinner A23 APB0 clock driver
|
||||
*
|
||||
* License Terms: GNU General Public License v2
|
||||
*
|
||||
* Based on clk-sun6i-apb0.c
|
||||
* Allwinner A31 APB0 clock driver
|
||||
*
|
||||
* Copyright (C) 2014 Free Electrons
|
||||
* Author: Boris BREZILLON <boris.brezillon@free-electrons.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
static int sun8i_a23_apb0_clk_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
const char *clk_name = np->name;
|
||||
const char *clk_parent;
|
||||
struct resource *r;
|
||||
void __iomem *reg;
|
||||
struct clk *clk;
|
||||
|
||||
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
reg = devm_ioremap_resource(&pdev->dev, r);
|
||||
if (IS_ERR(reg))
|
||||
return PTR_ERR(reg);
|
||||
|
||||
clk_parent = of_clk_get_parent_name(np, 0);
|
||||
if (!clk_parent)
|
||||
return -EINVAL;
|
||||
|
||||
of_property_read_string(np, "clock-output-names", &clk_name);
|
||||
|
||||
/* The A23 APB0 clock is a standard 2 bit wide divider clock */
|
||||
clk = clk_register_divider(&pdev->dev, clk_name, clk_parent, 0, reg,
|
||||
0, 2, CLK_DIVIDER_POWER_OF_TWO, NULL);
|
||||
if (IS_ERR(clk))
|
||||
return PTR_ERR(clk);
|
||||
|
||||
return of_clk_add_provider(np, of_clk_src_simple_get, clk);
|
||||
}
|
||||
|
||||
static const struct of_device_id sun8i_a23_apb0_clk_dt_ids[] = {
|
||||
{ .compatible = "allwinner,sun8i-a23-apb0-clk" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static struct platform_driver sun8i_a23_apb0_clk_driver = {
|
||||
.driver = {
|
||||
.name = "sun8i-a23-apb0-clk",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = sun8i_a23_apb0_clk_dt_ids,
|
||||
},
|
||||
.probe = sun8i_a23_apb0_clk_probe,
|
||||
};
|
||||
module_platform_driver(sun8i_a23_apb0_clk_driver);
|
||||
|
||||
MODULE_AUTHOR("Chen-Yu Tsai <wens@csie.org>");
|
||||
MODULE_DESCRIPTION("Allwinner A23 APB0 clock Driver");
|
||||
MODULE_LICENSE("GPL v2");
|
|
@ -163,6 +163,54 @@ static void sun6i_a31_get_pll1_factors(u32 *freq, u32 parent_rate,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sun8i_a23_get_pll1_factors() - calculates n, k, m, p factors for PLL1
|
||||
* PLL1 rate is calculated as follows
|
||||
* rate = (parent_rate * (n + 1) * (k + 1) >> p) / (m + 1);
|
||||
* parent_rate is always 24Mhz
|
||||
*/
|
||||
|
||||
static void sun8i_a23_get_pll1_factors(u32 *freq, u32 parent_rate,
|
||||
u8 *n, u8 *k, u8 *m, u8 *p)
|
||||
{
|
||||
u8 div;
|
||||
|
||||
/* Normalize value to a 6M multiple */
|
||||
div = *freq / 6000000;
|
||||
*freq = 6000000 * div;
|
||||
|
||||
/* we were called to round the frequency, we can now return */
|
||||
if (n == NULL)
|
||||
return;
|
||||
|
||||
/* m is always zero for pll1 */
|
||||
*m = 0;
|
||||
|
||||
/* k is 1 only on these cases */
|
||||
if (*freq >= 768000000 || *freq == 42000000 || *freq == 54000000)
|
||||
*k = 1;
|
||||
else
|
||||
*k = 0;
|
||||
|
||||
/* p will be 2 for divs under 20 and odd divs under 32 */
|
||||
if (div < 20 || (div < 32 && (div & 1)))
|
||||
*p = 2;
|
||||
|
||||
/* p will be 1 for even divs under 32, divs under 40 and odd pairs
|
||||
* of divs between 40-62 */
|
||||
else if (div < 40 || (div < 64 && (div & 2)))
|
||||
*p = 1;
|
||||
|
||||
/* any other entries have p = 0 */
|
||||
else
|
||||
*p = 0;
|
||||
|
||||
/* calculate a suitable n based on k and p */
|
||||
div <<= *p;
|
||||
div /= (*k + 1);
|
||||
*n = div / 4 - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* sun4i_get_pll5_factors() - calculates n, k factors for PLL5
|
||||
* PLL5 rate is calculated as follows
|
||||
|
@ -422,6 +470,18 @@ static struct clk_factors_config sun6i_a31_pll1_config = {
|
|||
.mwidth = 2,
|
||||
};
|
||||
|
||||
static struct clk_factors_config sun8i_a23_pll1_config = {
|
||||
.nshift = 8,
|
||||
.nwidth = 5,
|
||||
.kshift = 4,
|
||||
.kwidth = 2,
|
||||
.mshift = 0,
|
||||
.mwidth = 2,
|
||||
.pshift = 16,
|
||||
.pwidth = 2,
|
||||
.n_start = 1,
|
||||
};
|
||||
|
||||
static struct clk_factors_config sun4i_pll5_config = {
|
||||
.nshift = 8,
|
||||
.nwidth = 5,
|
||||
|
@ -471,6 +531,12 @@ static const struct factors_data sun6i_a31_pll1_data __initconst = {
|
|||
.getter = sun6i_a31_get_pll1_factors,
|
||||
};
|
||||
|
||||
static const struct factors_data sun8i_a23_pll1_data __initconst = {
|
||||
.enable = 31,
|
||||
.table = &sun8i_a23_pll1_config,
|
||||
.getter = sun8i_a23_get_pll1_factors,
|
||||
};
|
||||
|
||||
static const struct factors_data sun7i_a20_pll4_data __initconst = {
|
||||
.enable = 31,
|
||||
.table = &sun4i_pll5_config,
|
||||
|
@ -527,7 +593,7 @@ static struct clk * __init sunxi_factors_clk_setup(struct device_node *node,
|
|||
struct clk_hw *mux_hw = NULL;
|
||||
const char *clk_name = node->name;
|
||||
const char *parents[SUNXI_MAX_PARENTS];
|
||||
void *reg;
|
||||
void __iomem *reg;
|
||||
int i = 0;
|
||||
|
||||
reg = of_iomap(node, 0);
|
||||
|
@ -632,7 +698,7 @@ static void __init sunxi_mux_clk_setup(struct device_node *node,
|
|||
struct clk *clk;
|
||||
const char *clk_name = node->name;
|
||||
const char *parents[SUNXI_MAX_PARENTS];
|
||||
void *reg;
|
||||
void __iomem *reg;
|
||||
int i = 0;
|
||||
|
||||
reg = of_iomap(node, 0);
|
||||
|
@ -664,6 +730,7 @@ struct div_data {
|
|||
u8 shift;
|
||||
u8 pow;
|
||||
u8 width;
|
||||
const struct clk_div_table *table;
|
||||
};
|
||||
|
||||
static const struct div_data sun4i_axi_data __initconst = {
|
||||
|
@ -672,6 +739,23 @@ static const struct div_data sun4i_axi_data __initconst = {
|
|||
.width = 2,
|
||||
};
|
||||
|
||||
static const struct clk_div_table sun8i_a23_axi_table[] __initconst = {
|
||||
{ .val = 0, .div = 1 },
|
||||
{ .val = 1, .div = 2 },
|
||||
{ .val = 2, .div = 3 },
|
||||
{ .val = 3, .div = 4 },
|
||||
{ .val = 4, .div = 4 },
|
||||
{ .val = 5, .div = 4 },
|
||||
{ .val = 6, .div = 4 },
|
||||
{ .val = 7, .div = 4 },
|
||||
{ } /* sentinel */
|
||||
};
|
||||
|
||||
static const struct div_data sun8i_a23_axi_data __initconst = {
|
||||
.width = 3,
|
||||
.table = sun8i_a23_axi_table,
|
||||
};
|
||||
|
||||
static const struct div_data sun4i_ahb_data __initconst = {
|
||||
.shift = 4,
|
||||
.pow = 1,
|
||||
|
@ -696,7 +780,7 @@ static void __init sunxi_divider_clk_setup(struct device_node *node,
|
|||
struct clk *clk;
|
||||
const char *clk_name = node->name;
|
||||
const char *clk_parent;
|
||||
void *reg;
|
||||
void __iomem *reg;
|
||||
|
||||
reg = of_iomap(node, 0);
|
||||
|
||||
|
@ -704,10 +788,10 @@ static void __init sunxi_divider_clk_setup(struct device_node *node,
|
|||
|
||||
of_property_read_string(node, "clock-output-names", &clk_name);
|
||||
|
||||
clk = clk_register_divider(NULL, clk_name, clk_parent, 0,
|
||||
reg, data->shift, data->width,
|
||||
data->pow ? CLK_DIVIDER_POWER_OF_TWO : 0,
|
||||
&clk_lock);
|
||||
clk = clk_register_divider_table(NULL, clk_name, clk_parent, 0,
|
||||
reg, data->shift, data->width,
|
||||
data->pow ? CLK_DIVIDER_POWER_OF_TWO : 0,
|
||||
data->table, &clk_lock);
|
||||
if (clk) {
|
||||
of_clk_add_provider(node, of_clk_src_simple_get, clk);
|
||||
clk_register_clkdev(clk, clk_name, NULL);
|
||||
|
@ -804,6 +888,10 @@ static const struct gates_data sun7i_a20_ahb_gates_data __initconst = {
|
|||
.mask = { 0x12f77fff, 0x16ff3f },
|
||||
};
|
||||
|
||||
static const struct gates_data sun8i_a23_ahb1_gates_data __initconst = {
|
||||
.mask = {0x25386742, 0x2505111},
|
||||
};
|
||||
|
||||
static const struct gates_data sun4i_apb0_gates_data __initconst = {
|
||||
.mask = {0x4EF},
|
||||
};
|
||||
|
@ -836,6 +924,10 @@ static const struct gates_data sun6i_a31_apb1_gates_data __initconst = {
|
|||
.mask = {0x3031},
|
||||
};
|
||||
|
||||
static const struct gates_data sun8i_a23_apb1_gates_data __initconst = {
|
||||
.mask = {0x3021},
|
||||
};
|
||||
|
||||
static const struct gates_data sun6i_a31_apb2_gates_data __initconst = {
|
||||
.mask = {0x3F000F},
|
||||
};
|
||||
|
@ -844,6 +936,10 @@ static const struct gates_data sun7i_a20_apb1_gates_data __initconst = {
|
|||
.mask = { 0xff80ff },
|
||||
};
|
||||
|
||||
static const struct gates_data sun8i_a23_apb2_gates_data __initconst = {
|
||||
.mask = {0x1F0007},
|
||||
};
|
||||
|
||||
static const struct gates_data sun4i_a10_usb_gates_data __initconst = {
|
||||
.mask = {0x1C0},
|
||||
.reset_mask = 0x07,
|
||||
|
@ -866,11 +962,10 @@ static void __init sunxi_gates_clk_setup(struct device_node *node,
|
|||
struct gates_reset_data *reset_data;
|
||||
const char *clk_parent;
|
||||
const char *clk_name;
|
||||
void *reg;
|
||||
void __iomem *reg;
|
||||
int qty;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int ignore;
|
||||
|
||||
reg = of_iomap(node, 0);
|
||||
|
||||
|
@ -891,14 +986,12 @@ static void __init sunxi_gates_clk_setup(struct device_node *node,
|
|||
of_property_read_string_index(node, "clock-output-names",
|
||||
j, &clk_name);
|
||||
|
||||
/* No driver claims this clock, but it should remain gated */
|
||||
ignore = !strcmp("ahb_sdram", clk_name) ? CLK_IGNORE_UNUSED : 0;
|
||||
|
||||
clk_data->clks[i] = clk_register_gate(NULL, clk_name,
|
||||
clk_parent, ignore,
|
||||
clk_parent, 0,
|
||||
reg + 4 * (i/32), i % 32,
|
||||
0, &clk_lock);
|
||||
WARN_ON(IS_ERR(clk_data->clks[i]));
|
||||
clk_register_clkdev(clk_data->clks[i], clk_name, NULL);
|
||||
|
||||
j++;
|
||||
}
|
||||
|
@ -991,7 +1084,7 @@ static void __init sunxi_divs_clk_setup(struct device_node *node,
|
|||
struct clk_gate *gate = NULL;
|
||||
struct clk_fixed_factor *fix_factor;
|
||||
struct clk_divider *divider;
|
||||
void *reg;
|
||||
void __iomem *reg;
|
||||
int i = 0;
|
||||
int flags, clkflags;
|
||||
|
||||
|
@ -1102,6 +1195,7 @@ free_clkdata:
|
|||
static const struct of_device_id clk_factors_match[] __initconst = {
|
||||
{.compatible = "allwinner,sun4i-a10-pll1-clk", .data = &sun4i_pll1_data,},
|
||||
{.compatible = "allwinner,sun6i-a31-pll1-clk", .data = &sun6i_a31_pll1_data,},
|
||||
{.compatible = "allwinner,sun8i-a23-pll1-clk", .data = &sun8i_a23_pll1_data,},
|
||||
{.compatible = "allwinner,sun7i-a20-pll4-clk", .data = &sun7i_a20_pll4_data,},
|
||||
{.compatible = "allwinner,sun6i-a31-pll6-clk", .data = &sun6i_a31_pll6_data,},
|
||||
{.compatible = "allwinner,sun4i-a10-apb1-clk", .data = &sun4i_apb1_data,},
|
||||
|
@ -1113,6 +1207,7 @@ static const struct of_device_id clk_factors_match[] __initconst = {
|
|||
/* Matches for divider clocks */
|
||||
static const struct of_device_id clk_div_match[] __initconst = {
|
||||
{.compatible = "allwinner,sun4i-a10-axi-clk", .data = &sun4i_axi_data,},
|
||||
{.compatible = "allwinner,sun8i-a23-axi-clk", .data = &sun8i_a23_axi_data,},
|
||||
{.compatible = "allwinner,sun4i-a10-ahb-clk", .data = &sun4i_ahb_data,},
|
||||
{.compatible = "allwinner,sun4i-a10-apb0-clk", .data = &sun4i_apb0_data,},
|
||||
{.compatible = "allwinner,sun6i-a31-apb2-div-clk", .data = &sun6i_a31_apb2_div_data,},
|
||||
|
@ -1142,6 +1237,7 @@ static const struct of_device_id clk_gates_match[] __initconst = {
|
|||
{.compatible = "allwinner,sun5i-a13-ahb-gates-clk", .data = &sun5i_a13_ahb_gates_data,},
|
||||
{.compatible = "allwinner,sun6i-a31-ahb1-gates-clk", .data = &sun6i_a31_ahb1_gates_data,},
|
||||
{.compatible = "allwinner,sun7i-a20-ahb-gates-clk", .data = &sun7i_a20_ahb_gates_data,},
|
||||
{.compatible = "allwinner,sun8i-a23-ahb1-gates-clk", .data = &sun8i_a23_ahb1_gates_data,},
|
||||
{.compatible = "allwinner,sun4i-a10-apb0-gates-clk", .data = &sun4i_apb0_gates_data,},
|
||||
{.compatible = "allwinner,sun5i-a10s-apb0-gates-clk", .data = &sun5i_a10s_apb0_gates_data,},
|
||||
{.compatible = "allwinner,sun5i-a13-apb0-gates-clk", .data = &sun5i_a13_apb0_gates_data,},
|
||||
|
@ -1151,7 +1247,9 @@ static const struct of_device_id clk_gates_match[] __initconst = {
|
|||
{.compatible = "allwinner,sun5i-a13-apb1-gates-clk", .data = &sun5i_a13_apb1_gates_data,},
|
||||
{.compatible = "allwinner,sun6i-a31-apb1-gates-clk", .data = &sun6i_a31_apb1_gates_data,},
|
||||
{.compatible = "allwinner,sun7i-a20-apb1-gates-clk", .data = &sun7i_a20_apb1_gates_data,},
|
||||
{.compatible = "allwinner,sun8i-a23-apb1-gates-clk", .data = &sun8i_a23_apb1_gates_data,},
|
||||
{.compatible = "allwinner,sun6i-a31-apb2-gates-clk", .data = &sun6i_a31_apb2_gates_data,},
|
||||
{.compatible = "allwinner,sun8i-a23-apb2-gates-clk", .data = &sun8i_a23_apb2_gates_data,},
|
||||
{.compatible = "allwinner,sun4i-a10-usb-clk", .data = &sun4i_a10_usb_gates_data,},
|
||||
{.compatible = "allwinner,sun5i-a13-usb-clk", .data = &sun5i_a13_usb_gates_data,},
|
||||
{.compatible = "allwinner,sun6i-a31-usb-clk", .data = &sun6i_a31_usb_gates_data,},
|
||||
|
@ -1202,6 +1300,7 @@ static void __init sunxi_init_clocks(const char *clocks[], int nclocks)
|
|||
|
||||
static const char *sun4i_a10_critical_clocks[] __initdata = {
|
||||
"pll5_ddr",
|
||||
"ahb_sdram",
|
||||
};
|
||||
|
||||
static void __init sun4i_a10_init_clocks(struct device_node *node)
|
||||
|
@ -1214,6 +1313,7 @@ CLK_OF_DECLARE(sun4i_a10_clk_init, "allwinner,sun4i-a10", sun4i_a10_init_clocks)
|
|||
static const char *sun5i_critical_clocks[] __initdata = {
|
||||
"mbus",
|
||||
"pll5_ddr",
|
||||
"ahb_sdram",
|
||||
};
|
||||
|
||||
static void __init sun5i_init_clocks(struct device_node *node)
|
||||
|
@ -1236,3 +1336,4 @@ static void __init sun6i_init_clocks(struct device_node *node)
|
|||
ARRAY_SIZE(sun6i_critical_clocks));
|
||||
}
|
||||
CLK_OF_DECLARE(sun6i_a31_clk_init, "allwinner,sun6i-a31", sun6i_init_clocks);
|
||||
CLK_OF_DECLARE(sun8i_a23_clk_init, "allwinner,sun8i-a23", sun6i_init_clocks);
|
||||
|
|
|
@ -110,6 +110,12 @@
|
|||
#define XUSBIO_PLL_CFG0_SEQ_ENABLE BIT(24)
|
||||
#define XUSBIO_PLL_CFG0_SEQ_START_STATE BIT(25)
|
||||
|
||||
#define SATA_PLL_CFG0 0x490
|
||||
#define SATA_PLL_CFG0_PADPLL_RESET_SWCTL BIT(0)
|
||||
#define SATA_PLL_CFG0_PADPLL_USE_LOCKDET BIT(2)
|
||||
#define SATA_PLL_CFG0_SEQ_ENABLE BIT(24)
|
||||
#define SATA_PLL_CFG0_SEQ_START_STATE BIT(25)
|
||||
|
||||
#define PLLE_MISC_PLLE_PTS BIT(8)
|
||||
#define PLLE_MISC_IDDQ_SW_VALUE BIT(13)
|
||||
#define PLLE_MISC_IDDQ_SW_CTRL BIT(14)
|
||||
|
@ -1361,6 +1367,19 @@ static int clk_plle_tegra114_enable(struct clk_hw *hw)
|
|||
val |= XUSBIO_PLL_CFG0_SEQ_ENABLE;
|
||||
pll_writel(val, XUSBIO_PLL_CFG0, pll);
|
||||
|
||||
/* Enable hw control of SATA pll */
|
||||
val = pll_readl(SATA_PLL_CFG0, pll);
|
||||
val &= ~SATA_PLL_CFG0_PADPLL_RESET_SWCTL;
|
||||
val |= SATA_PLL_CFG0_PADPLL_USE_LOCKDET;
|
||||
val |= SATA_PLL_CFG0_SEQ_START_STATE;
|
||||
pll_writel(val, SATA_PLL_CFG0, pll);
|
||||
|
||||
udelay(1);
|
||||
|
||||
val = pll_readl(SATA_PLL_CFG0, pll);
|
||||
val |= SATA_PLL_CFG0_SEQ_ENABLE;
|
||||
pll_writel(val, SATA_PLL_CFG0, pll);
|
||||
|
||||
out:
|
||||
if (pll->lock)
|
||||
spin_unlock_irqrestore(pll->lock, flags);
|
||||
|
|
|
@ -469,7 +469,7 @@ static struct tegra_periph_init_data periph_clks[] = {
|
|||
MUX("sata", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SATA, 124, TEGRA_PERIPH_ON_APB, tegra_clk_sata),
|
||||
MUX("adx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX1, 180, TEGRA_PERIPH_ON_APB, tegra_clk_adx1),
|
||||
MUX("amx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX1, 185, TEGRA_PERIPH_ON_APB, tegra_clk_amx1),
|
||||
MUX("vi_sensor2", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR2, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor2),
|
||||
MUX("vi_sensor2", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR2, 165, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor2),
|
||||
MUX8("sdmmc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC1, 14, 0, tegra_clk_sdmmc1_8),
|
||||
MUX8("sdmmc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC2, 9, 0, tegra_clk_sdmmc2_8),
|
||||
MUX8("sdmmc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC3, 69, 0, tegra_clk_sdmmc3_8),
|
||||
|
@ -487,7 +487,7 @@ static struct tegra_periph_init_data periph_clks[] = {
|
|||
MUX8("extern2", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN2, 121, 0, tegra_clk_extern2),
|
||||
MUX8("extern3", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN3, 122, 0, tegra_clk_extern3),
|
||||
MUX8("soc_therm", mux_pllm_pllc_pllp_plla, CLK_SOURCE_SOC_THERM, 78, TEGRA_PERIPH_ON_APB, tegra_clk_soc_therm),
|
||||
MUX8("vi_sensor", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor_8),
|
||||
MUX8("vi_sensor", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR, 164, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor_8),
|
||||
MUX8("isp", mux_pllm_pllc_pllp_plla_clkm_pllc4, CLK_SOURCE_ISP, 23, TEGRA_PERIPH_ON_APB, tegra_clk_isp_8),
|
||||
MUX8("entropy", mux_pllp_clkm1, CLK_SOURCE_ENTROPY, 149, 0, tegra_clk_entropy),
|
||||
MUX8("hdmi_audio", mux_pllp3_pllc_clkm, CLK_SOURCE_HDMI_AUDIO, 176, TEGRA_PERIPH_NO_RESET, tegra_clk_hdmi_audio),
|
||||
|
|
|
@ -151,6 +151,13 @@
|
|||
/* Tegra CPU clock and reset control regs */
|
||||
#define CLK_RST_CONTROLLER_CPU_CMPLX_STATUS 0x470
|
||||
|
||||
#define MUX8(_name, _parents, _offset, \
|
||||
_clk_num, _gate_flags, _clk_id) \
|
||||
TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
|
||||
29, MASK(3), 0, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP,\
|
||||
_clk_num, _gate_flags, _clk_id, _parents##_idx, 0,\
|
||||
NULL)
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static struct cpu_clk_suspend_context {
|
||||
u32 clk_csite_src;
|
||||
|
@ -777,7 +784,6 @@ static struct tegra_clk tegra114_clks[tegra_clk_max] __initdata = {
|
|||
[tegra_clk_spdif_in] = { .dt_id = TEGRA114_CLK_SPDIF_IN, .present = true },
|
||||
[tegra_clk_spdif_out] = { .dt_id = TEGRA114_CLK_SPDIF_OUT, .present = true },
|
||||
[tegra_clk_vi_8] = { .dt_id = TEGRA114_CLK_VI, .present = true },
|
||||
[tegra_clk_vi_sensor_8] = { .dt_id = TEGRA114_CLK_VI_SENSOR, .present = true },
|
||||
[tegra_clk_fuse] = { .dt_id = TEGRA114_CLK_FUSE, .present = true },
|
||||
[tegra_clk_fuse_burn] = { .dt_id = TEGRA114_CLK_FUSE_BURN, .present = true },
|
||||
[tegra_clk_clk_32k] = { .dt_id = TEGRA114_CLK_CLK_32K, .present = true },
|
||||
|
@ -923,6 +929,13 @@ static struct tegra_devclk devclks[] __initdata = {
|
|||
{ .dev_id = "timer", .dt_id = TEGRA114_CLK_TIMER },
|
||||
};
|
||||
|
||||
static const char *mux_pllm_pllc2_c_c3_pllp_plla[] = {
|
||||
"pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0"
|
||||
};
|
||||
static u32 mux_pllm_pllc2_c_c3_pllp_plla_idx[] = {
|
||||
[0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6,
|
||||
};
|
||||
|
||||
static struct clk **clks;
|
||||
|
||||
static unsigned long osc_freq;
|
||||
|
@ -1178,10 +1191,18 @@ static void __init tegra114_pll_init(void __iomem *clk_base,
|
|||
clks[TEGRA114_CLK_PLL_E_OUT0] = clk;
|
||||
}
|
||||
|
||||
#define CLK_SOURCE_VI_SENSOR 0x1a8
|
||||
|
||||
static struct tegra_periph_init_data tegra_periph_clk_list[] = {
|
||||
MUX8("vi_sensor", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR, 20, TEGRA_PERIPH_NO_RESET, TEGRA114_CLK_VI_SENSOR),
|
||||
};
|
||||
|
||||
static __init void tegra114_periph_clk_init(void __iomem *clk_base,
|
||||
void __iomem *pmc_base)
|
||||
{
|
||||
struct clk *clk;
|
||||
struct tegra_periph_init_data *data;
|
||||
int i;
|
||||
|
||||
/* xusb_ss_div2 */
|
||||
clk = clk_register_fixed_factor(NULL, "xusb_ss_div2", "xusb_ss_src", 0,
|
||||
|
@ -1209,6 +1230,14 @@ static __init void tegra114_periph_clk_init(void __iomem *clk_base,
|
|||
clk_base + CLK_SOURCE_EMC,
|
||||
29, 3, 0, NULL);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(tegra_periph_clk_list); i++) {
|
||||
data = &tegra_periph_clk_list[i];
|
||||
clk = tegra_clk_register_periph(data->name,
|
||||
data->p.parent_names, data->num_parents,
|
||||
&data->periph, clk_base, data->offset, data->flags);
|
||||
clks[data->clk_id] = clk;
|
||||
}
|
||||
|
||||
tegra_periph_clk_init(clk_base, pmc_base, tegra114_clks,
|
||||
&pll_p_params);
|
||||
}
|
||||
|
|
|
@ -869,7 +869,7 @@ static struct tegra_clk tegra124_clks[tegra_clk_max] __initdata = {
|
|||
[tegra_clk_spdif_in] = { .dt_id = TEGRA124_CLK_SPDIF_IN, .present = true },
|
||||
[tegra_clk_spdif_out] = { .dt_id = TEGRA124_CLK_SPDIF_OUT, .present = true },
|
||||
[tegra_clk_vi_9] = { .dt_id = TEGRA124_CLK_VI, .present = true },
|
||||
[tegra_clk_vi_sensor] = { .dt_id = TEGRA124_CLK_VI_SENSOR, .present = true },
|
||||
[tegra_clk_vi_sensor_8] = { .dt_id = TEGRA124_CLK_VI_SENSOR, .present = true },
|
||||
[tegra_clk_fuse] = { .dt_id = TEGRA124_CLK_FUSE, .present = true },
|
||||
[tegra_clk_fuse_burn] = { .dt_id = TEGRA124_CLK_FUSE_BURN, .present = true },
|
||||
[tegra_clk_clk_32k] = { .dt_id = TEGRA124_CLK_CLK_32K, .present = true },
|
||||
|
@ -1369,6 +1369,14 @@ static struct tegra_clk_init_table init_table[] __initdata = {
|
|||
{TEGRA124_CLK_XUSB_HS_SRC, TEGRA124_CLK_PLL_U_60M, 60000000, 0},
|
||||
{TEGRA124_CLK_XUSB_FALCON_SRC, TEGRA124_CLK_PLL_RE_OUT, 224000000, 0},
|
||||
{TEGRA124_CLK_XUSB_HOST_SRC, TEGRA124_CLK_PLL_RE_OUT, 112000000, 0},
|
||||
{TEGRA124_CLK_SATA, TEGRA124_CLK_PLL_P, 104000000, 0},
|
||||
{TEGRA124_CLK_SATA_OOB, TEGRA124_CLK_PLL_P, 204000000, 0},
|
||||
{TEGRA124_CLK_EMC, TEGRA124_CLK_CLK_MAX, 0, 1},
|
||||
{TEGRA124_CLK_CCLK_G, TEGRA124_CLK_CLK_MAX, 0, 1},
|
||||
{TEGRA124_CLK_MSELECT, TEGRA124_CLK_CLK_MAX, 0, 1},
|
||||
{TEGRA124_CLK_CSITE, TEGRA124_CLK_CLK_MAX, 0, 1},
|
||||
{TEGRA124_CLK_TSENSOR, TEGRA124_CLK_CLK_M, 400000, 0},
|
||||
{TEGRA124_CLK_SOC_THERM, TEGRA124_CLK_PLL_P, 51000000, 0},
|
||||
/* This MUST be the last entry. */
|
||||
{TEGRA124_CLK_CLK_MAX, TEGRA124_CLK_CLK_MAX, 0, 0},
|
||||
};
|
||||
|
|
|
@ -277,6 +277,12 @@ void __init tegra_register_devclks(struct tegra_devclk *dev_clks, int num)
|
|||
for (i = 0; i < num; i++, dev_clks++)
|
||||
clk_register_clkdev(clks[dev_clks->dt_id], dev_clks->con_id,
|
||||
dev_clks->dev_id);
|
||||
|
||||
for (i = 0; i < clk_num; i++) {
|
||||
if (!IS_ERR_OR_NULL(clks[i]))
|
||||
clk_register_clkdev(clks[i], __clk_get_name(clks[i]),
|
||||
"tegra-clk-debug");
|
||||
}
|
||||
}
|
||||
|
||||
struct clk ** __init tegra_lookup_dt_id(int clk_id,
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#define DRA7_DPLL_ABE_DEFFREQ 180633600
|
||||
#define DRA7_DPLL_GMAC_DEFFREQ 1000000000
|
||||
#define DRA7_DPLL_USB_DEFFREQ 960000000
|
||||
|
||||
|
||||
static struct ti_dt_clk dra7xx_clks[] = {
|
||||
|
@ -332,5 +333,15 @@ int __init dra7xx_dt_clk_init(void)
|
|||
if (rc)
|
||||
pr_err("%s: failed to configure GMAC DPLL!\n", __func__);
|
||||
|
||||
dpll_ck = clk_get_sys(NULL, "dpll_usb_ck");
|
||||
rc = clk_set_rate(dpll_ck, DRA7_DPLL_USB_DEFFREQ);
|
||||
if (rc)
|
||||
pr_err("%s: failed to configure USB DPLL!\n", __func__);
|
||||
|
||||
dpll_ck = clk_get_sys(NULL, "dpll_usb_m2_ck");
|
||||
rc = clk_set_rate(dpll_ck, DRA7_DPLL_USB_DEFFREQ/2);
|
||||
if (rc)
|
||||
pr_err("%s: failed to set USB_DPLL M2 OUT\n", __func__);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/clk/clk-conf.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/hardirq.h>
|
||||
#include <linux/irqflags.h>
|
||||
|
@ -274,6 +275,10 @@ static int i2c_device_probe(struct device *dev)
|
|||
client->flags & I2C_CLIENT_WAKE);
|
||||
dev_dbg(dev, "probe\n");
|
||||
|
||||
status = of_clk_set_defaults(dev->of_node, false);
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
acpi_dev_pm_attach(&client->dev, true);
|
||||
status = driver->probe(client, i2c_match_id(driver->id_table, client));
|
||||
if (status)
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <linux/mutex.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/clk/clk-conf.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/spi/spi.h>
|
||||
|
@ -259,6 +260,10 @@ static int spi_drv_probe(struct device *dev)
|
|||
const struct spi_driver *sdrv = to_spi_driver(dev->driver);
|
||||
int ret;
|
||||
|
||||
ret = of_clk_set_defaults(dev->of_node, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
acpi_dev_pm_attach(dev, true);
|
||||
ret = sdrv->probe(to_spi_device(dev));
|
||||
if (ret)
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __DT_BINDINGS_CLOCK_CLPS711X_H
|
||||
#define __DT_BINDINGS_CLOCK_CLPS711X_H
|
||||
|
||||
#define CLPS711X_CLK_DUMMY 0
|
||||
#define CLPS711X_CLK_CPU 1
|
||||
#define CLPS711X_CLK_BUS 2
|
||||
#define CLPS711X_CLK_PLL 3
|
||||
#define CLPS711X_CLK_TIMERREF 4
|
||||
#define CLPS711X_CLK_TIMER1 5
|
||||
#define CLPS711X_CLK_TIMER2 6
|
||||
#define CLPS711X_CLK_PWM 7
|
||||
#define CLPS711X_CLK_SPIREF 8
|
||||
#define CLPS711X_CLK_SPI 9
|
||||
#define CLPS711X_CLK_UART 10
|
||||
#define CLPS711X_CLK_TICK 11
|
||||
#define CLPS711X_CLK_MAX 12
|
||||
|
||||
#endif
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Samsung Electronics Co., Ltd.
|
||||
* Author: Andrzej Haja <a.hajda@samsung.com>
|
||||
* Author: Andrzej Hajda <a.hajda@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
|
@ -34,6 +34,11 @@
|
|||
#define CLK_MOUT_CORE 19
|
||||
#define CLK_MOUT_APLL 20
|
||||
#define CLK_SCLK_HDMIPHY 22
|
||||
#define CLK_OUT_DMC 23
|
||||
#define CLK_OUT_TOP 24
|
||||
#define CLK_OUT_LEFTBUS 25
|
||||
#define CLK_OUT_RIGHTBUS 26
|
||||
#define CLK_OUT_CPU 27
|
||||
|
||||
/* gate for special clocks (sclk) */
|
||||
#define CLK_SCLK_FIMC0 128
|
||||
|
@ -230,6 +235,24 @@
|
|||
#define CLK_MOUT_G3D 394
|
||||
#define CLK_ACLK400_MCUISP 395 /* Exynos4x12 only */
|
||||
|
||||
/* gate clocks - ppmu */
|
||||
#define CLK_PPMULEFT 400
|
||||
#define CLK_PPMURIGHT 401
|
||||
#define CLK_PPMUCAMIF 402
|
||||
#define CLK_PPMUTV 403
|
||||
#define CLK_PPMUMFC_L 404
|
||||
#define CLK_PPMUMFC_R 405
|
||||
#define CLK_PPMUG3D 406
|
||||
#define CLK_PPMUIMAGE 407
|
||||
#define CLK_PPMULCD0 408
|
||||
#define CLK_PPMULCD1 409 /* Exynos4210 only */
|
||||
#define CLK_PPMUFILE 410
|
||||
#define CLK_PPMUGPS 411
|
||||
#define CLK_PPMUDMC0 412
|
||||
#define CLK_PPMUDMC1 413
|
||||
#define CLK_PPMUCPU 414
|
||||
#define CLK_PPMUACP 415
|
||||
|
||||
/* div clocks */
|
||||
#define CLK_DIV_ISP0 450 /* Exynos4x12 only */
|
||||
#define CLK_DIV_ISP1 451 /* Exynos4x12 only */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Samsung Electronics Co., Ltd.
|
||||
* Author: Andrzej Haja <a.hajda@samsung.com>
|
||||
* Author: Andrzej Hajda <a.hajda@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Samsung Electronics Co., Ltd.
|
||||
* Author: Andrzej Haja <a.hajda@samsung.com>
|
||||
* Author: Andrzej Hajda <a.hajda@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue