mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-17 17:53:56 +08:00
The usual collection of new drivers, non-critical fixes, and updates
to existing clk drivers. The bulk of the work is on Allwinner and Rockchip SoCs, but there's also an Intel Atom driver in here too. New Drivers: - Tegra BPMP firmware - Hisilicon hi3660 SoCs - Rockchip rk3328 SoCs - Intel Atom PMC - STM32F746 - IDT VersaClock 5P49V5923 and 5P49V5933 - Marvell mv98dx3236 SoCs - Allwinner V3s SoCs Removed Drivers: - Samsung Exynos4415 SoCs Updates: - Migrate ABx500 to OF - Qualcomm IPQ4019 CPU clks and general PLL support - Qualcomm MSM8974 RPM - Rockchip non-critical fixes and clk id additions - Samsung Exynos4412 CPUs - Socionext UniPhier NAND and eMMC support - ZTE zx296718 i2s and other audio clks - Renesas CAN and MSIOF clks for R-Car M3-W - Renesas resets for R-Car Gen2 and Gen3 and RZ/G1 - TI CDCE913, CDCE937, and CDCE949 clk generators - Marvell Armada ap806 CPU frequencies - STM32F4* I2S/SAI support - Broadcom BCM2835 DSI support - Allwinner sun5i and A80 conversion to new style clk bindings -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABCAAGBQJYsLxxAAoJEK0CiJfG5JUl0p0P/AiBaYvrmHBx3H9jdC3iQxd2 7luFN3OqpykmZc3xx2xO3WaZ96kwwxiMu8sj3+VQo6oCkEuOY2ru6uPiDOcF4P3+ 8ku2taoWlESDbVLebVTNJoRXBaBLaV+9BCN7AKvXpVw+/UkJI5hgr0yMdh4tgtvu K08tTMkDNDbA33KXuJo8/chQFqi2W6XBXk22YMkqqA8jx0F4EM759LcgUlD1YfBS HKkgSOgsW3Zwhl27ZEAJMthcmS4+wFaEgFBeipg/hxTLI3aQtmDtRfXwg0wkbBx2 8sVz9SyBwkjOT9+41kve+Je94NK3blnJEjbxPASveMwyhdX1TlDQCPfrXya/1zxz N1By1NpA6iEYwi4hy+OtBYlcsBHztAM/+eljDY2kEDvfiKjMa44GYmgBu4n8pq+n 75NJxws6ZkzPs5/QsLT3hvTaL1SNX6PaEW8HabDXO40ccZc4CYvFZVOXMAnKaXzZ 31hj8EvQ5x6hci+SPYyVu6j3ipOxN96VcZqEJ+hWyyuZEMK6Up1o/0lGZFgwa0UD SIl7RiTFKO6ko+8hYlk1g0DGtEyWDsdso1Bw4zaHwMngM/CwjJVzpK5T2t1fJyEh lN5MdhcOi0nsiRWdRxOwOlHDLf93qSo87mvseU1MCEXYN1aqTV3VxSm1YU8ZgQVk sAjpsJqj45enfDa9BmIt =o8o/ -----END PGP SIGNATURE----- Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux Pull clk updates from Stephen Boyd: "The usual collection of new drivers, non-critical fixes, and updates to existing clk drivers. The bulk of the work is on Allwinner and Rockchip SoCs, but there's also an Intel Atom driver in here too. New Drivers: - Tegra BPMP firmware - Hisilicon hi3660 SoCs - Rockchip rk3328 SoCs - Intel Atom PMC - STM32F746 - IDT VersaClock 5P49V5923 and 5P49V5933 - Marvell mv98dx3236 SoCs - Allwinner V3s SoCs Removed Drivers: - Samsung Exynos4415 SoCs Updates: - Migrate ABx500 to OF - Qualcomm IPQ4019 CPU clks and general PLL support - Qualcomm MSM8974 RPM - Rockchip non-critical fixes and clk id additions - Samsung Exynos4412 CPUs - Socionext UniPhier NAND and eMMC support - ZTE zx296718 i2s and other audio clks - Renesas CAN and MSIOF clks for R-Car M3-W - Renesas resets for R-Car Gen2 and Gen3 and RZ/G1 - TI CDCE913, CDCE937, and CDCE949 clk generators - Marvell Armada ap806 CPU frequencies - STM32F4* I2S/SAI support - Broadcom BCM2835 DSI support - Allwinner sun5i and A80 conversion to new style clk bindings" * tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: (130 commits) clk: renesas: mstp: ensure register writes complete clk: qcom: Do not drop device node twice clk: mvebu: adjust clock handling for the CP110 system controller clk: mvebu: Expand mv98dx3236-core-clock support clk: zte: add i2s clocks for zx296718 clk: sunxi-ng: sun9i-a80: Fix wrong pointer passed to PTR_ERR() clk: sunxi-ng: select SUNXI_CCU_MULT for sun5i clk: sunxi-ng: Check kzalloc() for errors and cleanup error path clk: tegra: Add BPMP clock driver clk: uniphier: add eMMC clock for LD11 and LD20 SoCs clk: uniphier: add NAND clock for all UniPhier SoCs ARM: dts: sun9i: Switch to new clock bindings clk: sunxi-ng: Add A80 Display Engine CCU clk: sunxi-ng: Add A80 USB CCU clk: sunxi-ng: Add A80 CCU clk: sunxi-ng: Support separately grouped PLL lock status register clk: sunxi-ng: mux: Get closest parent rate possible with CLK_SET_RATE_PARENT clk: sunxi-ng: mux: honor CLK_SET_RATE_NO_REPARENT flag clk: sunxi-ng: mux: Fix determine_rate for mux clocks with pre-dividers clk: qcom: SDHCI enablement on Nexus 5X / 6P ...
This commit is contained in:
commit
5d8a00eee2
@ -16,7 +16,20 @@ Required properties:
|
||||
- #clock-cells: Should be <1>. The permitted clock-specifier values can be
|
||||
found in include/dt-bindings/clock/bcm2835.h
|
||||
- reg: Specifies base physical address and size of the registers
|
||||
- clocks: The external oscillator clock phandle
|
||||
- clocks: phandles to the parent clocks used as input to the module, in
|
||||
the following order:
|
||||
|
||||
- External oscillator
|
||||
- DSI0 byte clock
|
||||
- DSI0 DDR2 clock
|
||||
- DSI0 DDR clock
|
||||
- DSI1 byte clock
|
||||
- DSI1 DDR2 clock
|
||||
- DSI1 DDR clock
|
||||
|
||||
Only external oscillator is required. The DSI clocks may
|
||||
not be present, in which case their children will be
|
||||
unusable.
|
||||
|
||||
Example:
|
||||
|
||||
|
@ -1,38 +0,0 @@
|
||||
* Samsung Exynos4415 Clock Controller
|
||||
|
||||
The Exynos4415 clock controller generates and supplies clock to various
|
||||
consumer devices within the Exynos4415 SoC.
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible: should be one of the following:
|
||||
- "samsung,exynos4415-cmu" - for the main system clocks controller
|
||||
(CMU_LEFTBUS, CMU_RIGHTBUS, CMU_TOP, CMU_CPU clock domains).
|
||||
- "samsung,exynos4415-cmu-dmc" - for the Exynos4415 SoC DRAM Memory
|
||||
Controller (DMC) domain clock controller.
|
||||
|
||||
- reg: physical base address of the controller and length of memory mapped
|
||||
region.
|
||||
|
||||
- #clock-cells: should be 1.
|
||||
|
||||
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
|
||||
dt-bindings/clock/exynos4415.h header and can be used in device
|
||||
tree sources.
|
||||
|
||||
Example 1: An example of a clock controller node is listed below.
|
||||
|
||||
cmu: clock-controller@10030000 {
|
||||
compatible = "samsung,exynos4415-cmu";
|
||||
reg = <0x10030000 0x18000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
cmu-dmc: clock-controller@105C0000 {
|
||||
compatible = "samsung,exynos4415-cmu-dmc";
|
||||
reg = <0x105C0000 0x3000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
42
Documentation/devicetree/bindings/clock/hi3660-clock.txt
Normal file
42
Documentation/devicetree/bindings/clock/hi3660-clock.txt
Normal file
@ -0,0 +1,42 @@
|
||||
* Hisilicon Hi3660 Clock Controller
|
||||
|
||||
The Hi3660 clock controller generates and supplies clock to various
|
||||
controllers within the Hi3660 SoC.
|
||||
|
||||
Required Properties:
|
||||
|
||||
- compatible: the compatible should be one of the following strings to
|
||||
indicate the clock controller functionality.
|
||||
|
||||
- "hisilicon,hi3660-crgctrl"
|
||||
- "hisilicon,hi3660-pctrl"
|
||||
- "hisilicon,hi3660-pmuctrl"
|
||||
- "hisilicon,hi3660-sctrl"
|
||||
- "hisilicon,hi3660-iomcu"
|
||||
|
||||
- reg: physical base address of the controller and length of memory mapped
|
||||
region.
|
||||
|
||||
- #clock-cells: should be 1.
|
||||
|
||||
Each clock is assigned an identifier and client nodes use this identifier
|
||||
to specify the clock which they consume.
|
||||
|
||||
All these identifier could be found in <dt-bindings/clock/hi3660-clock.h>.
|
||||
|
||||
Examples:
|
||||
crg_ctrl: clock-controller@fff35000 {
|
||||
compatible = "hisilicon,hi3660-crgctrl", "syscon";
|
||||
reg = <0x0 0xfff35000 0x0 0x1000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
uart0: serial@fdf02000 {
|
||||
compatible = "arm,pl011", "arm,primecell";
|
||||
reg = <0x0 0xfdf02000 0x0 0x1000>;
|
||||
interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&crg_ctrl HI3660_CLK_MUX_UART0>,
|
||||
<&crg_ctrl HI3660_PCLK>;
|
||||
clock-names = "uartclk", "apb_pclk";
|
||||
status = "disabled";
|
||||
};
|
65
Documentation/devicetree/bindings/clock/idt,versaclock5.txt
Normal file
65
Documentation/devicetree/bindings/clock/idt,versaclock5.txt
Normal file
@ -0,0 +1,65 @@
|
||||
Binding for IDT VersaClock5 programmable i2c clock generator.
|
||||
|
||||
The IDT VersaClock5 are programmable i2c clock generators providing
|
||||
from 3 to 12 output clocks.
|
||||
|
||||
==I2C device node==
|
||||
|
||||
Required properties:
|
||||
- compatible: shall be one of "idt,5p49v5923" , "idt,5p49v5933".
|
||||
- reg: i2c device address, shall be 0x68 or 0x6a.
|
||||
- #clock-cells: from common clock binding; shall be set to 1.
|
||||
- clocks: from common clock binding; list of parent clock handles,
|
||||
- 5p49v5923: (required) either or both of XTAL or CLKIN
|
||||
reference clock.
|
||||
- 5p49v5933: (optional) property not present (internal
|
||||
Xtal used) or CLKIN reference
|
||||
clock.
|
||||
- clock-names: from common clock binding; clock input names, can be
|
||||
- 5p49v5923: (required) either or both of "xin", "clkin".
|
||||
- 5p49v5933: (optional) property not present or "clkin".
|
||||
|
||||
==Mapping between clock specifier and physical pins==
|
||||
|
||||
When referencing the provided clock in the DT using phandle and
|
||||
clock specifier, the following mapping applies:
|
||||
|
||||
5P49V5923:
|
||||
0 -- OUT0_SEL_I2CB
|
||||
1 -- OUT1
|
||||
2 -- OUT2
|
||||
|
||||
5P49V5933:
|
||||
0 -- OUT0_SEL_I2CB
|
||||
1 -- OUT1
|
||||
2 -- OUT4
|
||||
|
||||
==Example==
|
||||
|
||||
/* 25MHz reference crystal */
|
||||
ref25: ref25m {
|
||||
compatible = "fixed-clock";
|
||||
#clock-cells = <0>;
|
||||
clock-frequency = <25000000>;
|
||||
};
|
||||
|
||||
i2c-master-node {
|
||||
|
||||
/* IDT 5P49V5923 i2c clock generator */
|
||||
vc5: clock-generator@6a {
|
||||
compatible = "idt,5p49v5923";
|
||||
reg = <0x6a>;
|
||||
#clock-cells = <1>;
|
||||
|
||||
/* Connect XIN input to 25MHz reference */
|
||||
clocks = <&ref25m>;
|
||||
clock-names = "xin";
|
||||
};
|
||||
};
|
||||
|
||||
/* Consumer referencing the 5P49V5923 pin OUT1 */
|
||||
consumer {
|
||||
...
|
||||
clocks = <&vc5 1>;
|
||||
...
|
||||
}
|
@ -7,6 +7,7 @@ Required properties:
|
||||
- compatible : must be "marvell,armada-370-corediv-clock",
|
||||
"marvell,armada-375-corediv-clock",
|
||||
"marvell,armada-380-corediv-clock",
|
||||
"marvell,mv98dx3236-corediv-clock",
|
||||
|
||||
- reg : must be the register address of Core Divider control register
|
||||
- #clock-cells : from common clock binding; shall be set to 1
|
||||
|
@ -3,6 +3,7 @@ Device Tree Clock bindings for cpu clock of Marvell EBU platforms
|
||||
Required properties:
|
||||
- compatible : shall be one of the following:
|
||||
"marvell,armada-xp-cpu-clock" - cpu clocks for Armada XP
|
||||
"marvell,mv98dx3236-cpu-clock" - cpu clocks for 98DX3236 SoC
|
||||
- reg : Address and length of the clock complex register set, followed
|
||||
by address and length of the PMU DFS registers
|
||||
- #clock-cells : should be set to 1.
|
||||
|
@ -11,6 +11,7 @@ Required properties :
|
||||
compatible "qcom,rpmcc" should be also included.
|
||||
|
||||
"qcom,rpmcc-msm8916", "qcom,rpmcc"
|
||||
"qcom,rpmcc-msm8974", "qcom,rpmcc"
|
||||
"qcom,rpmcc-apq8064", "qcom,rpmcc"
|
||||
|
||||
- #clock-cells : shall contain 1
|
||||
|
@ -42,6 +42,10 @@ Required Properties:
|
||||
Domain bindings in
|
||||
Documentation/devicetree/bindings/power/power_domain.txt.
|
||||
|
||||
- #reset-cells: Must be 1
|
||||
- The single reset specifier cell must be the module number, as defined
|
||||
in the datasheet.
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
@ -55,6 +59,7 @@ Examples
|
||||
clock-names = "extal", "extalr";
|
||||
#clock-cells = <2>;
|
||||
#power-domain-cells = <0>;
|
||||
#reset-cells = <1>;
|
||||
};
|
||||
|
||||
|
||||
@ -69,5 +74,6 @@ Examples
|
||||
dmas = <&dmac1 0x13>, <&dmac1 0x12>;
|
||||
dma-names = "tx", "rx";
|
||||
power-domains = <&cpg>;
|
||||
resets = <&cpg 310>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
@ -0,0 +1,57 @@
|
||||
* Rockchip RK3328 Clock and Reset Unit
|
||||
|
||||
The RK3328 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,rk3328-cru"
|
||||
- reg: physical base address of the controller and length of memory mapped
|
||||
region.
|
||||
- #clock-cells: should be 1.
|
||||
- #reset-cells: should be 1.
|
||||
|
||||
Optional Properties:
|
||||
|
||||
- rockchip,grf: phandle to the syscon managing the "general register files"
|
||||
If missing pll rates are not changeable, due to the missing pll lock status.
|
||||
|
||||
Each clock is assigned an identifier and client nodes can use this identifier
|
||||
to specify the clock which they consume. All available clocks are defined as
|
||||
preprocessor macros in the dt-bindings/clock/rk3328-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,
|
||||
- "clkin_i2s" - external I2S clock - optional,
|
||||
- "gmac_clkin" - external GMAC clock - optional
|
||||
- "phy_50m_out" - output clock of the pll in the mac phy
|
||||
|
||||
Example: Clock controller node:
|
||||
|
||||
cru: clock-controller@ff440000 {
|
||||
compatible = "rockchip,rk3328-cru";
|
||||
reg = <0x0 0xff440000 0x0 0x1000>;
|
||||
rockchip,grf = <&grf>;
|
||||
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
};
|
||||
|
||||
Example: UART controller node that consumes the clock generated by the clock
|
||||
controller:
|
||||
|
||||
uart0: serial@ff120000 {
|
||||
compatible = "snps,dw-apb-uart";
|
||||
reg = <0xff120000 0x100>;
|
||||
interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
clocks = <&cru SCLK_UART0>;
|
||||
};
|
@ -13,6 +13,12 @@ Required Properties:
|
||||
- #clock-cells: should be 1.
|
||||
- #reset-cells: should be 1.
|
||||
|
||||
Optional Properties:
|
||||
|
||||
- rockchip,grf: phandle to the syscon managing the "general register files".
|
||||
It is used for GRF muxes, if missing any muxes present in the GRF will not
|
||||
be available.
|
||||
|
||||
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/rk3399-cru.h headers and can be
|
||||
|
@ -10,6 +10,7 @@ Required properties:
|
||||
- compatible: Should be:
|
||||
"st,stm32f42xx-rcc"
|
||||
"st,stm32f469-rcc"
|
||||
"st,stm32f746-rcc"
|
||||
- reg: should be register base and length as documented in the
|
||||
datasheet
|
||||
- #reset-cells: 1, see below
|
||||
@ -84,6 +85,25 @@ The secondary index is bound with the following magic numbers:
|
||||
12 CLK_I2SQ_PDIV (post divisor of pll i2s q divisor)
|
||||
13 CLK_SAIQ_PDIV (post divisor of pll sai q divisor)
|
||||
|
||||
14 CLK_HSI (Internal ocscillator clock)
|
||||
15 CLK_SYSCLK (System Clock)
|
||||
16 CLK_HDMI_CEC (HDMI-CEC clock)
|
||||
17 CLK_SPDIF (SPDIF-Rx clock)
|
||||
18 CLK_USART1 (U(s)arts clocks)
|
||||
19 CLK_USART2
|
||||
20 CLK_USART3
|
||||
21 CLK_UART4
|
||||
22 CLK_UART5
|
||||
23 CLK_USART6
|
||||
24 CLK_UART7
|
||||
25 CLK_UART8
|
||||
26 CLK_I2C1 (I2S clocks)
|
||||
27 CLK_I2C2
|
||||
28 CLK_I2C3
|
||||
29 CLK_I2C4
|
||||
30 CLK_LPTIMER (LPTimer1 clock)
|
||||
)
|
||||
|
||||
Example:
|
||||
|
||||
/* Misc clock, FCLK */
|
||||
|
@ -0,0 +1,20 @@
|
||||
Clock bindings for ST-Ericsson ABx500 clocks
|
||||
|
||||
Required properties :
|
||||
- compatible : shall contain the following:
|
||||
"stericsson,ab8500-clk"
|
||||
- #clock-cells should be <1>
|
||||
|
||||
The ABx500 clocks need to be placed as a subnode of an AB8500
|
||||
device node, see mfd/ab8500.txt
|
||||
|
||||
All available clocks are defined as preprocessor macros in
|
||||
dt-bindings/clock/ste-ab8500.h header and can be used in device
|
||||
tree sources.
|
||||
|
||||
Example:
|
||||
|
||||
clock-controller {
|
||||
compatible = "stericsson,ab8500-clk";
|
||||
#clock-cells = <1>;
|
||||
};
|
28
Documentation/devicetree/bindings/clock/sun9i-de.txt
Normal file
28
Documentation/devicetree/bindings/clock/sun9i-de.txt
Normal file
@ -0,0 +1,28 @@
|
||||
Allwinner A80 Display Engine Clock Control Binding
|
||||
--------------------------------------------------
|
||||
|
||||
Required properties :
|
||||
- compatible: must contain one of the following compatibles:
|
||||
- "allwinner,sun9i-a80-de-clks"
|
||||
|
||||
- reg: Must contain the registers base address and length
|
||||
- clocks: phandle to the clocks feeding the display engine subsystem.
|
||||
Three are needed:
|
||||
- "mod": the display engine module clock
|
||||
- "dram": the DRAM bus clock for the system
|
||||
- "bus": the bus clock for the whole display engine subsystem
|
||||
- clock-names: Must contain the clock names described just above
|
||||
- resets: phandle to the reset control for the display engine subsystem.
|
||||
- #clock-cells : must contain 1
|
||||
- #reset-cells : must contain 1
|
||||
|
||||
Example:
|
||||
de_clocks: clock@3000000 {
|
||||
compatible = "allwinner,sun9i-a80-de-clks";
|
||||
reg = <0x03000000 0x30>;
|
||||
clocks = <&ccu CLK_DE>, <&ccu CLK_SDRAM>, <&ccu CLK_BUS_DE>;
|
||||
clock-names = "mod", "dram", "bus";
|
||||
resets = <&ccu RST_BUS_DE>;
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
};
|
24
Documentation/devicetree/bindings/clock/sun9i-usb.txt
Normal file
24
Documentation/devicetree/bindings/clock/sun9i-usb.txt
Normal file
@ -0,0 +1,24 @@
|
||||
Allwinner A80 USB Clock Control Binding
|
||||
---------------------------------------
|
||||
|
||||
Required properties :
|
||||
- compatible: must contain one of the following compatibles:
|
||||
- "allwinner,sun9i-a80-usb-clocks"
|
||||
|
||||
- reg: Must contain the registers base address and length
|
||||
- clocks: phandle to the clocks feeding the USB subsystem. Two are needed:
|
||||
- "bus": the bus clock for the whole USB subsystem
|
||||
- "hosc": the high frequency oscillator (usually at 24MHz)
|
||||
- clock-names: Must contain the clock names described just above
|
||||
- #clock-cells : must contain 1
|
||||
- #reset-cells : must contain 1
|
||||
|
||||
Example:
|
||||
usb_clocks: clock@a08000 {
|
||||
compatible = "allwinner,sun9i-a80-usb-clks";
|
||||
reg = <0x00a08000 0x8>;
|
||||
clocks = <&ccu CLK_BUS_USB>, <&osc24M>;
|
||||
clock-names = "bus", "hosc";
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
};
|
@ -7,6 +7,8 @@ Required properties :
|
||||
- "allwinner,sun8i-a23-ccu"
|
||||
- "allwinner,sun8i-a33-ccu"
|
||||
- "allwinner,sun8i-h3-ccu"
|
||||
- "allwinner,sun8i-v3s-ccu"
|
||||
- "allwinner,sun9i-a80-ccu"
|
||||
- "allwinner,sun50i-a64-ccu"
|
||||
|
||||
- reg: Must contain the registers base address and length
|
||||
|
@ -1,15 +1,22 @@
|
||||
Binding for TO CDCE925 programmable I2C clock synthesizers.
|
||||
Binding for TI CDCE913/925/937/949 programmable I2C clock synthesizers.
|
||||
|
||||
Reference
|
||||
This binding uses the common clock binding[1].
|
||||
|
||||
[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
|
||||
[2] http://www.ti.com/product/cdce925
|
||||
[2] http://www.ti.com/product/cdce913
|
||||
[3] http://www.ti.com/product/cdce925
|
||||
[4] http://www.ti.com/product/cdce937
|
||||
[5] http://www.ti.com/product/cdce949
|
||||
|
||||
The driver provides clock sources for each output Y1 through Y5.
|
||||
|
||||
Required properties:
|
||||
- compatible: Shall be "ti,cdce925"
|
||||
- compatible: Shall be one of the following:
|
||||
- "ti,cdce913": 1-PLL, 3 Outputs
|
||||
- "ti,cdce925": 2-PLL, 5 Outputs
|
||||
- "ti,cdce937": 3-PLL, 7 Outputs
|
||||
- "ti,cdce949": 4-PLL, 9 Outputs
|
||||
- reg: I2C device address.
|
||||
- clocks: Points to a fixed parent clock that provides the input frequency.
|
||||
- #clock-cells: From common clock bindings: Shall be 1.
|
||||
@ -18,7 +25,7 @@ Optional properties:
|
||||
- xtal-load-pf: Crystal load-capacitor value to fine-tune performance on a
|
||||
board, or to compensate for external influences.
|
||||
|
||||
For both PLL1 and PLL2 an optional child node can be used to specify spread
|
||||
For all PLL1, PLL2, ... an optional child node can be used to specify spread
|
||||
spectrum clocking parameters for a board.
|
||||
- spread-spectrum: SSC mode as defined in the data sheet.
|
||||
- spread-spectrum-center: Use "centered" mode instead of "max" mode. When
|
||||
|
@ -13,6 +13,9 @@ Required properties:
|
||||
"zte,zx296718-lsp1crm":
|
||||
zx296718 device level clock selection and gating
|
||||
|
||||
"zte,zx296718-audiocrm":
|
||||
zx296718 audio clock selection, divider and gating
|
||||
|
||||
- reg: Address and length of the register set
|
||||
|
||||
The clock consumer should specify the desired clock by having the clock
|
||||
|
@ -6270,6 +6270,11 @@ S: Maintained
|
||||
F: drivers/mfd/lpc_ich.c
|
||||
F: drivers/gpio/gpio-ich.c
|
||||
|
||||
IDT VersaClock 5 CLOCK DRIVER
|
||||
M: Marek Vasut <marek.vasut@gmail.com>
|
||||
S: Maintained
|
||||
F: drivers/clk/clk-versaclock5.c
|
||||
|
||||
IDE SUBSYSTEM
|
||||
M: "David S. Miller" <davem@davemloft.net>
|
||||
L: linux-ide@vger.kernel.org
|
||||
|
@ -65,8 +65,9 @@
|
||||
compatible = "allwinner,simple-framebuffer",
|
||||
"simple-framebuffer";
|
||||
allwinner,pipeline = "de_be0-lcd0-hdmi";
|
||||
clocks = <&pll3>, <&pll5 1>, <&ahb_gates 36>,
|
||||
<&ahb_gates 43>, <&ahb_gates 44>;
|
||||
clocks = <&ccu CLK_AHB_LCD>, <&ccu CLK_AHB_HDMI>,
|
||||
<&ccu CLK_AHB_DE_BE>, <&ccu CLK_DRAM_DE_BE>,
|
||||
<&ccu CLK_DE_BE>, <&ccu CLK_HDMI>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -74,8 +75,8 @@
|
||||
compatible = "allwinner,simple-framebuffer",
|
||||
"simple-framebuffer";
|
||||
allwinner,pipeline = "de_be0-lcd0";
|
||||
clocks = <&pll3>, <&pll5 1>, <&ahb_gates 36>,
|
||||
<&ahb_gates 44>;
|
||||
clocks = <&ccu CLK_AHB_LCD>, <&ccu CLK_AHB_DE_BE>, <&ccu CLK_DE_BE>,
|
||||
<&ccu CLK_TCON_CH0>, <&ccu CLK_DRAM_DE_BE>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -83,77 +84,19 @@
|
||||
compatible = "allwinner,simple-framebuffer",
|
||||
"simple-framebuffer";
|
||||
allwinner,pipeline = "de_be0-lcd0-tve0";
|
||||
clocks = <&pll3>, <&pll5 1>, <&ahb_gates 34>,
|
||||
<&ahb_gates 36>, <&ahb_gates 44>;
|
||||
clocks = <&ccu CLK_AHB_TVE>, <&ccu CLK_AHB_LCD>,
|
||||
<&ccu CLK_AHB_DE_BE>, <&ccu CLK_DE_BE>,
|
||||
<&ccu CLK_TCON_CH1>, <&ccu CLK_DRAM_DE_BE>;
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
|
||||
clocks {
|
||||
ahb_gates: clk@01c20060 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun5i-a10s-ahb-gates-clk";
|
||||
reg = <0x01c20060 0x8>;
|
||||
clocks = <&ahb>;
|
||||
clock-indices = <0>, <1>,
|
||||
<2>, <5>, <6>,
|
||||
<7>, <8>, <9>,
|
||||
<10>, <13>,
|
||||
<14>, <17>, <18>,
|
||||
<20>, <21>, <22>,
|
||||
<26>, <28>, <32>,
|
||||
<34>, <36>, <40>,
|
||||
<43>, <44>,
|
||||
<46>, <51>,
|
||||
<52>;
|
||||
clock-output-names = "ahb_usbotg", "ahb_ehci",
|
||||
"ahb_ohci", "ahb_ss", "ahb_dma",
|
||||
"ahb_bist", "ahb_mmc0", "ahb_mmc1",
|
||||
"ahb_mmc2", "ahb_nand",
|
||||
"ahb_sdram", "ahb_emac", "ahb_ts",
|
||||
"ahb_spi0", "ahb_spi1", "ahb_spi2",
|
||||
"ahb_gps", "ahb_stimer", "ahb_ve",
|
||||
"ahb_tve", "ahb_lcd", "ahb_csi",
|
||||
"ahb_hdmi", "ahb_de_be",
|
||||
"ahb_de_fe", "ahb_iep",
|
||||
"ahb_mali400";
|
||||
};
|
||||
|
||||
apb0_gates: clk@01c20068 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun5i-a10s-apb0-gates-clk";
|
||||
reg = <0x01c20068 0x4>;
|
||||
clocks = <&apb0>;
|
||||
clock-indices = <0>, <3>,
|
||||
<5>, <6>,
|
||||
<10>;
|
||||
clock-output-names = "apb0_codec", "apb0_iis",
|
||||
"apb0_pio", "apb0_ir",
|
||||
"apb0_keypad";
|
||||
};
|
||||
|
||||
apb1_gates: clk@01c2006c {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun5i-a10s-apb1-gates-clk";
|
||||
reg = <0x01c2006c 0x4>;
|
||||
clocks = <&apb1>;
|
||||
clock-indices = <0>, <1>,
|
||||
<2>, <16>,
|
||||
<17>, <18>,
|
||||
<19>;
|
||||
clock-output-names = "apb1_i2c0", "apb1_i2c1",
|
||||
"apb1_i2c2", "apb1_uart0",
|
||||
"apb1_uart1", "apb1_uart2",
|
||||
"apb1_uart3";
|
||||
};
|
||||
};
|
||||
|
||||
soc@01c00000 {
|
||||
emac: ethernet@01c0b000 {
|
||||
compatible = "allwinner,sun4i-a10-emac";
|
||||
reg = <0x01c0b000 0x1000>;
|
||||
interrupts = <55>;
|
||||
clocks = <&ahb_gates 17>;
|
||||
clocks = <&ccu CLK_AHB_EMAC>;
|
||||
allwinner,sram = <&emac_sram 1>;
|
||||
status = "disabled";
|
||||
};
|
||||
@ -169,7 +112,7 @@
|
||||
pwm: pwm@01c20e00 {
|
||||
compatible = "allwinner,sun5i-a10s-pwm";
|
||||
reg = <0x01c20e00 0xc>;
|
||||
clocks = <&osc24M>;
|
||||
clocks = <&ccu CLK_HOSC>;
|
||||
#pwm-cells = <3>;
|
||||
status = "disabled";
|
||||
};
|
||||
@ -180,7 +123,7 @@
|
||||
interrupts = <1>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
clocks = <&apb1_gates 16>;
|
||||
clocks = <&ccu CLK_APB1_UART0>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -190,12 +133,16 @@
|
||||
interrupts = <3>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
clocks = <&apb1_gates 18>;
|
||||
clocks = <&ccu CLK_APB1_UART2>;
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&ccu {
|
||||
compatible = "allwinner,sun5i-a10s-ccu";
|
||||
};
|
||||
|
||||
&pio {
|
||||
compatible = "allwinner,sun5i-a10s-pinctrl";
|
||||
|
||||
|
@ -61,8 +61,8 @@
|
||||
compatible = "allwinner,simple-framebuffer",
|
||||
"simple-framebuffer";
|
||||
allwinner,pipeline = "de_be0-lcd0";
|
||||
clocks = <&ahb_gates 36>, <&ahb_gates 44>, <&de_be_clk>,
|
||||
<&tcon_ch0_clk>, <&dram_gates 26>;
|
||||
clocks = <&ccu CLK_AHB_LCD>, <&ccu CLK_AHB_DE_BE>, <&ccu CLK_DE_BE>,
|
||||
<&ccu CLK_TCON_CH0>, <&ccu CLK_DRAM_DE_BE>;
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
@ -99,114 +99,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
clocks {
|
||||
ahb_gates: clk@01c20060 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun5i-a13-ahb-gates-clk";
|
||||
reg = <0x01c20060 0x8>;
|
||||
clocks = <&ahb>;
|
||||
clock-indices = <0>, <1>,
|
||||
<2>, <5>, <6>,
|
||||
<7>, <8>, <9>,
|
||||
<10>, <13>,
|
||||
<14>, <20>,
|
||||
<21>, <22>,
|
||||
<28>, <32>, <34>,
|
||||
<36>, <40>, <44>,
|
||||
<46>, <51>,
|
||||
<52>;
|
||||
clock-output-names = "ahb_usbotg", "ahb_ehci",
|
||||
"ahb_ohci", "ahb_ss", "ahb_dma",
|
||||
"ahb_bist", "ahb_mmc0", "ahb_mmc1",
|
||||
"ahb_mmc2", "ahb_nand",
|
||||
"ahb_sdram", "ahb_spi0",
|
||||
"ahb_spi1", "ahb_spi2",
|
||||
"ahb_stimer", "ahb_ve", "ahb_tve",
|
||||
"ahb_lcd", "ahb_csi", "ahb_de_be",
|
||||
"ahb_de_fe", "ahb_iep",
|
||||
"ahb_mali400";
|
||||
};
|
||||
|
||||
apb0_gates: clk@01c20068 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun5i-a13-apb0-gates-clk";
|
||||
reg = <0x01c20068 0x4>;
|
||||
clocks = <&apb0>;
|
||||
clock-indices = <0>, <5>,
|
||||
<6>;
|
||||
clock-output-names = "apb0_codec", "apb0_pio",
|
||||
"apb0_ir";
|
||||
};
|
||||
|
||||
apb1_gates: clk@01c2006c {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun5i-a13-apb1-gates-clk";
|
||||
reg = <0x01c2006c 0x4>;
|
||||
clocks = <&apb1>;
|
||||
clock-indices = <0>, <1>,
|
||||
<2>, <17>,
|
||||
<19>;
|
||||
clock-output-names = "apb1_i2c0", "apb1_i2c1",
|
||||
"apb1_i2c2", "apb1_uart1",
|
||||
"apb1_uart3";
|
||||
};
|
||||
|
||||
dram_gates: clk@01c20100 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun5i-a13-dram-gates-clk",
|
||||
"allwinner,sun4i-a10-gates-clk";
|
||||
reg = <0x01c20100 0x4>;
|
||||
clocks = <&pll5 0>;
|
||||
clock-indices = <0>,
|
||||
<1>,
|
||||
<25>,
|
||||
<26>,
|
||||
<29>,
|
||||
<31>;
|
||||
clock-output-names = "dram_ve",
|
||||
"dram_csi",
|
||||
"dram_de_fe",
|
||||
"dram_de_be",
|
||||
"dram_ace",
|
||||
"dram_iep";
|
||||
};
|
||||
|
||||
de_be_clk: clk@01c20104 {
|
||||
#clock-cells = <0>;
|
||||
#reset-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-display-clk";
|
||||
reg = <0x01c20104 0x4>;
|
||||
clocks = <&pll3>, <&pll7>, <&pll5 1>;
|
||||
clock-output-names = "de-be";
|
||||
};
|
||||
|
||||
de_fe_clk: clk@01c2010c {
|
||||
#clock-cells = <0>;
|
||||
#reset-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-display-clk";
|
||||
reg = <0x01c2010c 0x4>;
|
||||
clocks = <&pll3>, <&pll7>, <&pll5 1>;
|
||||
clock-output-names = "de-fe";
|
||||
};
|
||||
|
||||
tcon_ch0_clk: clk@01c20118 {
|
||||
#clock-cells = <0>;
|
||||
#reset-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-tcon-ch0-clk";
|
||||
reg = <0x01c20118 0x4>;
|
||||
clocks = <&pll3>, <&pll7>, <&pll3x2>, <&pll7x2>;
|
||||
clock-output-names = "tcon-ch0-sclk";
|
||||
};
|
||||
|
||||
tcon_ch1_clk: clk@01c2012c {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-tcon-ch1-clk";
|
||||
reg = <0x01c2012c 0x4>;
|
||||
clocks = <&pll3>, <&pll7>, <&pll3x2>, <&pll7x2>;
|
||||
clock-output-names = "tcon-ch1-sclk";
|
||||
};
|
||||
};
|
||||
|
||||
display-engine {
|
||||
compatible = "allwinner,sun5i-a13-display-engine";
|
||||
allwinner,pipelines = <&fe0>;
|
||||
@ -217,11 +109,11 @@
|
||||
compatible = "allwinner,sun5i-a13-tcon";
|
||||
reg = <0x01c0c000 0x1000>;
|
||||
interrupts = <44>;
|
||||
resets = <&tcon_ch0_clk 1>;
|
||||
resets = <&ccu RST_LCD>;
|
||||
reset-names = "lcd";
|
||||
clocks = <&ahb_gates 36>,
|
||||
<&tcon_ch0_clk>,
|
||||
<&tcon_ch1_clk>;
|
||||
clocks = <&ccu CLK_AHB_LCD>,
|
||||
<&ccu CLK_TCON_CH0>,
|
||||
<&ccu CLK_TCON_CH1>;
|
||||
clock-names = "ahb",
|
||||
"tcon-ch0",
|
||||
"tcon-ch1";
|
||||
@ -254,7 +146,7 @@
|
||||
pwm: pwm@01c20e00 {
|
||||
compatible = "allwinner,sun5i-a13-pwm";
|
||||
reg = <0x01c20e00 0xc>;
|
||||
clocks = <&osc24M>;
|
||||
clocks = <&ccu CLK_HOSC>;
|
||||
#pwm-cells = <3>;
|
||||
status = "disabled";
|
||||
};
|
||||
@ -263,11 +155,11 @@
|
||||
compatible = "allwinner,sun5i-a13-display-frontend";
|
||||
reg = <0x01e00000 0x20000>;
|
||||
interrupts = <47>;
|
||||
clocks = <&ahb_gates 46>, <&de_fe_clk>,
|
||||
<&dram_gates 25>;
|
||||
clocks = <&ccu CLK_DE_FE>, <&ccu CLK_DE_FE>,
|
||||
<&ccu CLK_DRAM_DE_FE>;
|
||||
clock-names = "ahb", "mod",
|
||||
"ram";
|
||||
resets = <&de_fe_clk>;
|
||||
resets = <&ccu RST_DE_FE>;
|
||||
status = "disabled";
|
||||
|
||||
ports {
|
||||
@ -290,14 +182,14 @@
|
||||
be0: display-backend@01e60000 {
|
||||
compatible = "allwinner,sun5i-a13-display-backend";
|
||||
reg = <0x01e60000 0x10000>;
|
||||
clocks = <&ahb_gates 44>, <&de_be_clk>,
|
||||
<&dram_gates 26>;
|
||||
clocks = <&ccu CLK_AHB_DE_BE>, <&ccu CLK_DE_BE>,
|
||||
<&ccu CLK_DRAM_DE_BE>;
|
||||
clock-names = "ahb", "mod",
|
||||
"ram";
|
||||
resets = <&de_be_clk>;
|
||||
resets = <&ccu RST_DE_BE>;
|
||||
status = "disabled";
|
||||
|
||||
assigned-clocks = <&de_be_clk>;
|
||||
assigned-clocks = <&ccu CLK_DE_BE>;
|
||||
assigned-clock-rates = <300000000>;
|
||||
|
||||
ports {
|
||||
@ -330,6 +222,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
&ccu {
|
||||
compatible = "allwinner,sun5i-a13-ccu";
|
||||
};
|
||||
|
||||
&cpu0 {
|
||||
clock-latency = <244144>; /* 8 32k periods */
|
||||
operating-points = <
|
||||
|
@ -42,9 +42,10 @@
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <dt-bindings/clock/sun4i-a10-pll2.h>
|
||||
#include <dt-bindings/clock/sun5i-ccu.h>
|
||||
#include <dt-bindings/dma/sun4i-a10.h>
|
||||
#include <dt-bindings/pinctrl/sun4i-a10.h>
|
||||
#include <dt-bindings/reset/sun5i-ccu.h>
|
||||
|
||||
/ {
|
||||
interrupt-parent = <&intc>;
|
||||
@ -59,7 +60,7 @@
|
||||
device_type = "cpu";
|
||||
compatible = "arm,cortex-a8";
|
||||
reg = <0x0>;
|
||||
clocks = <&cpu>;
|
||||
clocks = <&ccu CLK_CPU>;
|
||||
};
|
||||
};
|
||||
|
||||
@ -68,419 +69,19 @@
|
||||
#size-cells = <1>;
|
||||
ranges;
|
||||
|
||||
/*
|
||||
* This is a dummy clock, to be used as placeholder on
|
||||
* other mux clocks when a specific parent clock is not
|
||||
* yet implemented. It should be dropped when the driver
|
||||
* is complete.
|
||||
*/
|
||||
dummy: dummy {
|
||||
#clock-cells = <0>;
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <0>;
|
||||
};
|
||||
|
||||
osc24M: clk@01c20050 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-osc-clk";
|
||||
reg = <0x01c20050 0x4>;
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <24000000>;
|
||||
clock-output-names = "osc24M";
|
||||
};
|
||||
|
||||
osc3M: osc3M-clk {
|
||||
compatible = "fixed-factor-clock";
|
||||
#clock-cells = <0>;
|
||||
clock-div = <8>;
|
||||
clock-mult = <1>;
|
||||
clocks = <&osc24M>;
|
||||
clock-output-names = "osc3M";
|
||||
};
|
||||
|
||||
osc32k: clk@0 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <32768>;
|
||||
clock-output-names = "osc32k";
|
||||
};
|
||||
|
||||
pll1: clk@01c20000 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-pll1-clk";
|
||||
reg = <0x01c20000 0x4>;
|
||||
clocks = <&osc24M>;
|
||||
clock-output-names = "pll1";
|
||||
};
|
||||
|
||||
pll2: clk@01c20008 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun5i-a13-pll2-clk";
|
||||
reg = <0x01c20008 0x8>;
|
||||
clocks = <&osc24M>;
|
||||
clock-output-names = "pll2-1x", "pll2-2x",
|
||||
"pll2-4x", "pll2-8x";
|
||||
};
|
||||
|
||||
pll3: clk@01c20010 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-pll3-clk";
|
||||
reg = <0x01c20010 0x4>;
|
||||
clocks = <&osc3M>;
|
||||
clock-output-names = "pll3";
|
||||
};
|
||||
|
||||
pll3x2: pll3x2-clk {
|
||||
compatible = "allwinner,sun4i-a10-pll3-2x-clk";
|
||||
#clock-cells = <0>;
|
||||
clock-div = <1>;
|
||||
clock-mult = <2>;
|
||||
clocks = <&pll3>;
|
||||
clock-output-names = "pll3-2x";
|
||||
};
|
||||
|
||||
pll4: clk@01c20018 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-pll1-clk";
|
||||
reg = <0x01c20018 0x4>;
|
||||
clocks = <&osc24M>;
|
||||
clock-output-names = "pll4";
|
||||
};
|
||||
|
||||
pll5: clk@01c20020 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-pll5-clk";
|
||||
reg = <0x01c20020 0x4>;
|
||||
clocks = <&osc24M>;
|
||||
clock-output-names = "pll5_ddr", "pll5_other";
|
||||
};
|
||||
|
||||
pll6: clk@01c20028 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-pll6-clk";
|
||||
reg = <0x01c20028 0x4>;
|
||||
clocks = <&osc24M>;
|
||||
clock-output-names = "pll6_sata", "pll6_other", "pll6";
|
||||
};
|
||||
|
||||
pll7: clk@01c20030 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-pll3-clk";
|
||||
reg = <0x01c20030 0x4>;
|
||||
clocks = <&osc3M>;
|
||||
clock-output-names = "pll7";
|
||||
};
|
||||
|
||||
pll7x2: pll7x2-clk {
|
||||
compatible = "allwinner,sun4i-a10-pll3-2x-clk";
|
||||
#clock-cells = <0>;
|
||||
clock-div = <1>;
|
||||
clock-mult = <2>;
|
||||
clocks = <&pll7>;
|
||||
clock-output-names = "pll7-2x";
|
||||
};
|
||||
|
||||
/* dummy is 200M */
|
||||
cpu: cpu@01c20054 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-cpu-clk";
|
||||
reg = <0x01c20054 0x4>;
|
||||
clocks = <&osc32k>, <&osc24M>, <&pll1>, <&dummy>;
|
||||
clock-output-names = "cpu";
|
||||
};
|
||||
|
||||
axi: axi@01c20054 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-axi-clk";
|
||||
reg = <0x01c20054 0x4>;
|
||||
clocks = <&cpu>;
|
||||
clock-output-names = "axi";
|
||||
};
|
||||
|
||||
ahb: ahb@01c20054 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun5i-a13-ahb-clk";
|
||||
reg = <0x01c20054 0x4>;
|
||||
clocks = <&axi>, <&cpu>, <&pll6 1>;
|
||||
clock-output-names = "ahb";
|
||||
/*
|
||||
* Use PLL6 as parent, instead of CPU/AXI
|
||||
* which has rate changes due to cpufreq
|
||||
*/
|
||||
assigned-clocks = <&ahb>;
|
||||
assigned-clock-parents = <&pll6 1>;
|
||||
};
|
||||
|
||||
apb0: apb0@01c20054 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-apb0-clk";
|
||||
reg = <0x01c20054 0x4>;
|
||||
clocks = <&ahb>;
|
||||
clock-output-names = "apb0";
|
||||
};
|
||||
|
||||
apb1: clk@01c20058 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-apb1-clk";
|
||||
reg = <0x01c20058 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
|
||||
clock-output-names = "apb1";
|
||||
};
|
||||
|
||||
axi_gates: clk@01c2005c {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-gates-clk";
|
||||
reg = <0x01c2005c 0x4>;
|
||||
clocks = <&axi>;
|
||||
clock-indices = <0>;
|
||||
clock-output-names = "axi_dram";
|
||||
};
|
||||
|
||||
ahb_gates: clk@01c20060 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun5i-a13-ahb-gates-clk";
|
||||
reg = <0x01c20060 0x8>;
|
||||
clocks = <&ahb>;
|
||||
clock-indices = <0>, <1>,
|
||||
<2>, <5>, <6>,
|
||||
<7>, <8>, <9>,
|
||||
<10>, <13>,
|
||||
<14>, <17>, <20>,
|
||||
<21>, <22>,
|
||||
<28>, <32>, <34>,
|
||||
<36>, <40>, <44>,
|
||||
<46>, <51>,
|
||||
<52>;
|
||||
clock-output-names = "ahb_usbotg", "ahb_ehci",
|
||||
"ahb_ohci", "ahb_ss", "ahb_dma",
|
||||
"ahb_bist", "ahb_mmc0", "ahb_mmc1",
|
||||
"ahb_mmc2", "ahb_nand",
|
||||
"ahb_sdram", "ahb_emac", "ahb_spi0",
|
||||
"ahb_spi1", "ahb_spi2",
|
||||
"ahb_hstimer", "ahb_ve", "ahb_tve",
|
||||
"ahb_lcd", "ahb_csi", "ahb_de_be",
|
||||
"ahb_de_fe", "ahb_iep",
|
||||
"ahb_mali400";
|
||||
};
|
||||
|
||||
apb0_gates: clk@01c20068 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-gates-clk";
|
||||
reg = <0x01c20068 0x4>;
|
||||
clocks = <&apb0>;
|
||||
clock-indices = <0>, <3>,
|
||||
<5>, <6>;
|
||||
clock-output-names = "apb0_codec", "apb0_i2s0",
|
||||
"apb0_pio", "apb0_ir";
|
||||
};
|
||||
|
||||
apb1_gates: clk@01c2006c {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-gates-clk";
|
||||
reg = <0x01c2006c 0x4>;
|
||||
clocks = <&apb1>;
|
||||
clock-indices = <0>, <1>,
|
||||
<2>, <17>,
|
||||
<18>, <19>;
|
||||
clock-output-names = "apb1_i2c0", "apb1_i2c1",
|
||||
"apb1_i2c2", "apb1_uart1",
|
||||
"apb1_uart2", "apb1_uart3";
|
||||
};
|
||||
|
||||
nand_clk: clk@01c20080 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c20080 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "nand";
|
||||
};
|
||||
|
||||
ms_clk: clk@01c20084 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c20084 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "ms";
|
||||
};
|
||||
|
||||
mmc0_clk: clk@01c20088 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-mmc-clk";
|
||||
reg = <0x01c20088 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "mmc0",
|
||||
"mmc0_output",
|
||||
"mmc0_sample";
|
||||
};
|
||||
|
||||
mmc1_clk: clk@01c2008c {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-mmc-clk";
|
||||
reg = <0x01c2008c 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "mmc1",
|
||||
"mmc1_output",
|
||||
"mmc1_sample";
|
||||
};
|
||||
|
||||
mmc2_clk: clk@01c20090 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-mmc-clk";
|
||||
reg = <0x01c20090 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "mmc2",
|
||||
"mmc2_output",
|
||||
"mmc2_sample";
|
||||
};
|
||||
|
||||
ts_clk: clk@01c20098 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c20098 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "ts";
|
||||
};
|
||||
|
||||
ss_clk: clk@01c2009c {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c2009c 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "ss";
|
||||
};
|
||||
|
||||
spi0_clk: clk@01c200a0 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c200a0 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "spi0";
|
||||
};
|
||||
|
||||
spi1_clk: clk@01c200a4 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c200a4 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "spi1";
|
||||
};
|
||||
|
||||
spi2_clk: clk@01c200a8 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c200a8 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "spi2";
|
||||
};
|
||||
|
||||
ir0_clk: clk@01c200b0 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c200b0 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "ir0";
|
||||
};
|
||||
|
||||
i2s0_clk: clk@01c200b8 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod1-clk";
|
||||
reg = <0x01c200b8 0x4>;
|
||||
clocks = <&pll2 SUN4I_A10_PLL2_8X>,
|
||||
<&pll2 SUN4I_A10_PLL2_4X>,
|
||||
<&pll2 SUN4I_A10_PLL2_2X>,
|
||||
<&pll2 SUN4I_A10_PLL2_1X>;
|
||||
clock-output-names = "i2s0";
|
||||
};
|
||||
|
||||
spdif_clk: clk@01c200c0 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod1-clk";
|
||||
reg = <0x01c200c0 0x4>;
|
||||
clocks = <&pll2 SUN4I_A10_PLL2_8X>,
|
||||
<&pll2 SUN4I_A10_PLL2_4X>,
|
||||
<&pll2 SUN4I_A10_PLL2_2X>,
|
||||
<&pll2 SUN4I_A10_PLL2_1X>;
|
||||
clock-output-names = "spdif";
|
||||
};
|
||||
|
||||
usb_clk: clk@01c200cc {
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
compatible = "allwinner,sun5i-a13-usb-clk";
|
||||
reg = <0x01c200cc 0x4>;
|
||||
clocks = <&pll6 1>;
|
||||
clock-output-names = "usb_ohci0", "usb_phy";
|
||||
};
|
||||
|
||||
dram_gates: clk@01c20100 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "nextthing,gr8-dram-gates-clk",
|
||||
"allwinner,sun4i-a10-gates-clk";
|
||||
reg = <0x01c20100 0x4>;
|
||||
clocks = <&pll5 0>;
|
||||
clock-indices = <0>,
|
||||
<1>,
|
||||
<25>,
|
||||
<26>,
|
||||
<29>,
|
||||
<31>;
|
||||
clock-output-names = "dram_ve",
|
||||
"dram_csi",
|
||||
"dram_de_fe",
|
||||
"dram_de_be",
|
||||
"dram_ace",
|
||||
"dram_iep";
|
||||
};
|
||||
|
||||
de_be_clk: clk@01c20104 {
|
||||
#clock-cells = <0>;
|
||||
#reset-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-display-clk";
|
||||
reg = <0x01c20104 0x4>;
|
||||
clocks = <&pll3>, <&pll7>, <&pll5 1>;
|
||||
clock-output-names = "de-be";
|
||||
};
|
||||
|
||||
de_fe_clk: clk@01c2010c {
|
||||
#clock-cells = <0>;
|
||||
#reset-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-display-clk";
|
||||
reg = <0x01c2010c 0x4>;
|
||||
clocks = <&pll3>, <&pll7>, <&pll5 1>;
|
||||
clock-output-names = "de-fe";
|
||||
};
|
||||
|
||||
tcon_ch0_clk: clk@01c20118 {
|
||||
#clock-cells = <0>;
|
||||
#reset-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-tcon-ch0-clk";
|
||||
reg = <0x01c20118 0x4>;
|
||||
clocks = <&pll3>, <&pll7>, <&pll3x2>, <&pll7x2>;
|
||||
clock-output-names = "tcon-ch0-sclk";
|
||||
};
|
||||
|
||||
tcon_ch1_clk: clk@01c2012c {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-tcon-ch1-clk";
|
||||
reg = <0x01c2012c 0x4>;
|
||||
clocks = <&pll3>, <&pll7>, <&pll3x2>, <&pll7x2>;
|
||||
clock-output-names = "tcon-ch1-sclk";
|
||||
};
|
||||
|
||||
codec_clk: clk@01c20140 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-codec-clk";
|
||||
reg = <0x01c20140 0x4>;
|
||||
clocks = <&pll2 SUN4I_A10_PLL2_1X>;
|
||||
clock-output-names = "codec";
|
||||
};
|
||||
|
||||
mbus_clk: clk@01c2015c {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun5i-a13-mbus-clk";
|
||||
reg = <0x01c2015c 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "mbus";
|
||||
};
|
||||
};
|
||||
|
||||
display-engine {
|
||||
@ -528,7 +129,7 @@
|
||||
compatible = "allwinner,sun4i-a10-dma";
|
||||
reg = <0x01c02000 0x1000>;
|
||||
interrupts = <27>;
|
||||
clocks = <&ahb_gates 6>;
|
||||
clocks = <&ccu CLK_AHB_DMA>;
|
||||
#dma-cells = <2>;
|
||||
};
|
||||
|
||||
@ -536,7 +137,7 @@
|
||||
compatible = "allwinner,sun4i-a10-nand";
|
||||
reg = <0x01c03000 0x1000>;
|
||||
interrupts = <37>;
|
||||
clocks = <&ahb_gates 13>, <&nand_clk>;
|
||||
clocks = <&ccu CLK_AHB_NAND>, <&ccu CLK_NAND>;
|
||||
clock-names = "ahb", "mod";
|
||||
dmas = <&dma SUN4I_DMA_DEDICATED 3>;
|
||||
dma-names = "rxtx";
|
||||
@ -549,7 +150,7 @@
|
||||
compatible = "allwinner,sun4i-a10-spi";
|
||||
reg = <0x01c05000 0x1000>;
|
||||
interrupts = <10>;
|
||||
clocks = <&ahb_gates 20>, <&spi0_clk>;
|
||||
clocks = <&ccu CLK_AHB_SPI0>, <&ccu CLK_SPI0>;
|
||||
clock-names = "ahb", "mod";
|
||||
dmas = <&dma SUN4I_DMA_DEDICATED 27>,
|
||||
<&dma SUN4I_DMA_DEDICATED 26>;
|
||||
@ -563,7 +164,7 @@
|
||||
compatible = "allwinner,sun4i-a10-spi";
|
||||
reg = <0x01c06000 0x1000>;
|
||||
interrupts = <11>;
|
||||
clocks = <&ahb_gates 21>, <&spi1_clk>;
|
||||
clocks = <&ccu CLK_AHB_SPI1>, <&ccu CLK_SPI1>;
|
||||
clock-names = "ahb", "mod";
|
||||
dmas = <&dma SUN4I_DMA_DEDICATED 9>,
|
||||
<&dma SUN4I_DMA_DEDICATED 8>;
|
||||
@ -576,8 +177,8 @@
|
||||
tve0: tv-encoder@01c0a000 {
|
||||
compatible = "allwinner,sun4i-a10-tv-encoder";
|
||||
reg = <0x01c0a000 0x1000>;
|
||||
clocks = <&ahb_gates 34>;
|
||||
resets = <&tcon_ch0_clk 0>;
|
||||
clocks = <&ccu CLK_AHB_TVE>;
|
||||
resets = <&ccu RST_TVE>;
|
||||
status = "disabled";
|
||||
|
||||
port {
|
||||
@ -595,11 +196,11 @@
|
||||
compatible = "allwinner,sun5i-a13-tcon";
|
||||
reg = <0x01c0c000 0x1000>;
|
||||
interrupts = <44>;
|
||||
resets = <&tcon_ch0_clk 1>;
|
||||
resets = <&ccu RST_LCD>;
|
||||
reset-names = "lcd";
|
||||
clocks = <&ahb_gates 36>,
|
||||
<&tcon_ch0_clk>,
|
||||
<&tcon_ch1_clk>;
|
||||
clocks = <&ccu CLK_AHB_LCD>,
|
||||
<&ccu CLK_TCON_CH0>,
|
||||
<&ccu CLK_TCON_CH1>;
|
||||
clock-names = "ahb",
|
||||
"tcon-ch0",
|
||||
"tcon-ch1";
|
||||
@ -637,14 +238,8 @@
|
||||
mmc0: mmc@01c0f000 {
|
||||
compatible = "allwinner,sun5i-a13-mmc";
|
||||
reg = <0x01c0f000 0x1000>;
|
||||
clocks = <&ahb_gates 8>,
|
||||
<&mmc0_clk 0>,
|
||||
<&mmc0_clk 1>,
|
||||
<&mmc0_clk 2>;
|
||||
clock-names = "ahb",
|
||||
"mmc",
|
||||
"output",
|
||||
"sample";
|
||||
clocks = <&ccu CLK_AHB_MMC0>, <&ccu CLK_MMC0>;
|
||||
clock-names = "ahb", "mmc";
|
||||
interrupts = <32>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
@ -654,14 +249,8 @@
|
||||
mmc1: mmc@01c10000 {
|
||||
compatible = "allwinner,sun5i-a13-mmc";
|
||||
reg = <0x01c10000 0x1000>;
|
||||
clocks = <&ahb_gates 9>,
|
||||
<&mmc1_clk 0>,
|
||||
<&mmc1_clk 1>,
|
||||
<&mmc1_clk 2>;
|
||||
clock-names = "ahb",
|
||||
"mmc",
|
||||
"output",
|
||||
"sample";
|
||||
clocks = <&ccu CLK_AHB_MMC1>, <&ccu CLK_MMC1>;
|
||||
clock-names = "ahb", "mmc";
|
||||
interrupts = <33>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
@ -671,14 +260,8 @@
|
||||
mmc2: mmc@01c11000 {
|
||||
compatible = "allwinner,sun5i-a13-mmc";
|
||||
reg = <0x01c11000 0x1000>;
|
||||
clocks = <&ahb_gates 10>,
|
||||
<&mmc2_clk 0>,
|
||||
<&mmc2_clk 1>,
|
||||
<&mmc2_clk 2>;
|
||||
clock-names = "ahb",
|
||||
"mmc",
|
||||
"output",
|
||||
"sample";
|
||||
clocks = <&ccu CLK_AHB_MMC2>, <&ccu CLK_MMC2>;
|
||||
clock-names = "ahb", "mmc";
|
||||
interrupts = <34>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
@ -688,7 +271,7 @@
|
||||
usb_otg: usb@01c13000 {
|
||||
compatible = "allwinner,sun4i-a10-musb";
|
||||
reg = <0x01c13000 0x0400>;
|
||||
clocks = <&ahb_gates 0>;
|
||||
clocks = <&ccu CLK_AHB_OTG>;
|
||||
interrupts = <38>;
|
||||
interrupt-names = "mc";
|
||||
phys = <&usbphy 0>;
|
||||
@ -705,9 +288,9 @@
|
||||
compatible = "allwinner,sun5i-a13-usb-phy";
|
||||
reg = <0x01c13400 0x10 0x01c14800 0x4>;
|
||||
reg-names = "phy_ctrl", "pmu1";
|
||||
clocks = <&usb_clk 8>;
|
||||
clocks = <&ccu CLK_USB_PHY0>;
|
||||
clock-names = "usb_phy";
|
||||
resets = <&usb_clk 0>, <&usb_clk 1>;
|
||||
resets = <&ccu RST_USB_PHY0>, <&ccu RST_USB_PHY1>;
|
||||
reset-names = "usb0_reset", "usb1_reset";
|
||||
status = "disabled";
|
||||
};
|
||||
@ -716,7 +299,7 @@
|
||||
compatible = "allwinner,sun5i-a13-ehci", "generic-ehci";
|
||||
reg = <0x01c14000 0x100>;
|
||||
interrupts = <39>;
|
||||
clocks = <&ahb_gates 1>;
|
||||
clocks = <&ccu CLK_AHB_EHCI>;
|
||||
phys = <&usbphy 1>;
|
||||
phy-names = "usb";
|
||||
status = "disabled";
|
||||
@ -726,7 +309,7 @@
|
||||
compatible = "allwinner,sun5i-a13-ohci", "generic-ohci";
|
||||
reg = <0x01c14400 0x100>;
|
||||
interrupts = <40>;
|
||||
clocks = <&usb_clk 6>, <&ahb_gates 2>;
|
||||
clocks = <&ccu CLK_USB_OHCI>, <&ccu CLK_AHB_OHCI>;
|
||||
phys = <&usbphy 1>;
|
||||
phy-names = "usb";
|
||||
status = "disabled";
|
||||
@ -736,7 +319,7 @@
|
||||
compatible = "allwinner,sun4i-a10-spi";
|
||||
reg = <0x01c17000 0x1000>;
|
||||
interrupts = <12>;
|
||||
clocks = <&ahb_gates 22>, <&spi2_clk>;
|
||||
clocks = <&ccu CLK_AHB_SPI2>, <&ccu CLK_SPI2>;
|
||||
clock-names = "ahb", "mod";
|
||||
dmas = <&dma SUN4I_DMA_DEDICATED 29>,
|
||||
<&dma SUN4I_DMA_DEDICATED 28>;
|
||||
@ -746,6 +329,15 @@
|
||||
#size-cells = <0>;
|
||||
};
|
||||
|
||||
ccu: clock@01c20000 {
|
||||
compatible = "nextthing,gr8-ccu";
|
||||
reg = <0x01c20000 0x400>;
|
||||
clocks = <&osc24M>, <&osc32k>;
|
||||
clock-names = "hosc", "losc";
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
};
|
||||
|
||||
intc: interrupt-controller@01c20400 {
|
||||
compatible = "allwinner,sun4i-a10-ic";
|
||||
reg = <0x01c20400 0x400>;
|
||||
@ -757,7 +349,7 @@
|
||||
compatible = "nextthing,gr8-pinctrl";
|
||||
reg = <0x01c20800 0x400>;
|
||||
interrupts = <28>;
|
||||
clocks = <&apb0_gates 5>;
|
||||
clocks = <&ccu CLK_APB0_PIO>;
|
||||
gpio-controller;
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <3>;
|
||||
@ -876,7 +468,7 @@
|
||||
pwm: pwm@01c20e00 {
|
||||
compatible = "allwinner,sun5i-a10s-pwm";
|
||||
reg = <0x01c20e00 0xc>;
|
||||
clocks = <&osc24M>;
|
||||
clocks = <&ccu CLK_HOSC>;
|
||||
#pwm-cells = <3>;
|
||||
status = "disabled";
|
||||
};
|
||||
@ -885,7 +477,7 @@
|
||||
compatible = "allwinner,sun4i-a10-timer";
|
||||
reg = <0x01c20c00 0x90>;
|
||||
interrupts = <22>;
|
||||
clocks = <&osc24M>;
|
||||
clocks = <&ccu CLK_HOSC>;
|
||||
};
|
||||
|
||||
wdt: watchdog@01c20c90 {
|
||||
@ -898,7 +490,7 @@
|
||||
compatible = "allwinner,sun4i-a10-spdif";
|
||||
reg = <0x01c21000 0x400>;
|
||||
interrupts = <13>;
|
||||
clocks = <&apb0_gates 1>, <&spdif_clk>;
|
||||
clocks = <&ccu CLK_APB0_SPDIF>, <&ccu CLK_SPDIF>;
|
||||
clock-names = "apb", "spdif";
|
||||
dmas = <&dma SUN4I_DMA_NORMAL 2>,
|
||||
<&dma SUN4I_DMA_NORMAL 2>;
|
||||
@ -908,7 +500,7 @@
|
||||
|
||||
ir0: ir@01c21800 {
|
||||
compatible = "allwinner,sun4i-a10-ir";
|
||||
clocks = <&apb0_gates 6>, <&ir0_clk>;
|
||||
clocks = <&ccu CLK_APB0_IR>, <&ccu CLK_IR>;
|
||||
clock-names = "apb", "ir";
|
||||
interrupts = <5>;
|
||||
reg = <0x01c21800 0x40>;
|
||||
@ -920,7 +512,7 @@
|
||||
compatible = "allwinner,sun4i-a10-i2s";
|
||||
reg = <0x01c22400 0x400>;
|
||||
interrupts = <16>;
|
||||
clocks = <&apb0_gates 3>, <&i2s0_clk>;
|
||||
clocks = <&ccu CLK_APB0_I2S>, <&ccu CLK_I2S>;
|
||||
clock-names = "apb", "mod";
|
||||
dmas = <&dma SUN4I_DMA_NORMAL 3>,
|
||||
<&dma SUN4I_DMA_NORMAL 3>;
|
||||
@ -940,7 +532,7 @@
|
||||
compatible = "allwinner,sun4i-a10-codec";
|
||||
reg = <0x01c22c00 0x40>;
|
||||
interrupts = <30>;
|
||||
clocks = <&apb0_gates 0>, <&codec_clk>;
|
||||
clocks = <&ccu CLK_APB0_CODEC>, <&ccu CLK_CODEC>;
|
||||
clock-names = "apb", "codec";
|
||||
dmas = <&dma SUN4I_DMA_NORMAL 19>,
|
||||
<&dma SUN4I_DMA_NORMAL 19>;
|
||||
@ -961,7 +553,7 @@
|
||||
interrupts = <2>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
clocks = <&apb1_gates 17>;
|
||||
clocks = <&ccu CLK_APB1_UART1>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -971,7 +563,7 @@
|
||||
interrupts = <3>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
clocks = <&apb1_gates 18>;
|
||||
clocks = <&ccu CLK_APB1_UART2>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -981,7 +573,7 @@
|
||||
interrupts = <4>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
clocks = <&apb1_gates 19>;
|
||||
clocks = <&ccu CLK_APB1_UART3>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -989,7 +581,7 @@
|
||||
compatible = "allwinner,sun4i-a10-i2c";
|
||||
reg = <0x01c2ac00 0x400>;
|
||||
interrupts = <7>;
|
||||
clocks = <&apb1_gates 0>;
|
||||
clocks = <&ccu CLK_APB1_I2C0>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
@ -999,7 +591,7 @@
|
||||
compatible = "allwinner,sun4i-a10-i2c";
|
||||
reg = <0x01c2b000 0x400>;
|
||||
interrupts = <8>;
|
||||
clocks = <&apb1_gates 1>;
|
||||
clocks = <&ccu CLK_APB1_I2C1>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
@ -1009,7 +601,7 @@
|
||||
compatible = "allwinner,sun4i-a10-i2c";
|
||||
reg = <0x01c2b400 0x400>;
|
||||
interrupts = <9>;
|
||||
clocks = <&apb1_gates 2>;
|
||||
clocks = <&ccu CLK_APB1_I2C2>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
@ -1019,18 +611,18 @@
|
||||
compatible = "allwinner,sun5i-a13-hstimer";
|
||||
reg = <0x01c60000 0x1000>;
|
||||
interrupts = <82>, <83>;
|
||||
clocks = <&ahb_gates 28>;
|
||||
clocks = <&ccu CLK_AHB_HSTIMER>;
|
||||
};
|
||||
|
||||
fe0: display-frontend@01e00000 {
|
||||
compatible = "allwinner,sun5i-a13-display-frontend";
|
||||
reg = <0x01e00000 0x20000>;
|
||||
interrupts = <47>;
|
||||
clocks = <&ahb_gates 46>, <&de_fe_clk>,
|
||||
<&dram_gates 25>;
|
||||
clocks = <&ccu CLK_AHB_DE_FE>, <&ccu CLK_DE_FE>,
|
||||
<&ccu CLK_DRAM_DE_FE>;
|
||||
clock-names = "ahb", "mod",
|
||||
"ram";
|
||||
resets = <&de_fe_clk>;
|
||||
resets = <&ccu RST_DE_FE>;
|
||||
status = "disabled";
|
||||
|
||||
ports {
|
||||
@ -1053,14 +645,14 @@
|
||||
be0: display-backend@01e60000 {
|
||||
compatible = "allwinner,sun5i-a13-display-backend";
|
||||
reg = <0x01e60000 0x10000>;
|
||||
clocks = <&ahb_gates 44>, <&de_be_clk>,
|
||||
<&dram_gates 26>;
|
||||
clocks = <&ccu CLK_AHB_DE_BE>, <&ccu CLK_DE_BE>,
|
||||
<&ccu CLK_DRAM_DE_BE>;
|
||||
clock-names = "ahb", "mod",
|
||||
"ram";
|
||||
resets = <&de_be_clk>;
|
||||
resets = <&ccu RST_DE_BE>;
|
||||
status = "disabled";
|
||||
|
||||
assigned-clocks = <&de_be_clk>;
|
||||
assigned-clocks = <&ccu CLK_DE_BE>;
|
||||
assigned-clock-rates = <300000000>;
|
||||
|
||||
ports {
|
||||
|
@ -51,9 +51,9 @@
|
||||
compatible = "allwinner,simple-framebuffer",
|
||||
"simple-framebuffer";
|
||||
allwinner,pipeline = "de_be0-lcd0-tve0";
|
||||
clocks = <&ahb_gates 34>, <&ahb_gates 36>,
|
||||
<&ahb_gates 44>, <&de_be_clk>,
|
||||
<&tcon_ch1_clk>, <&dram_gates 26>;
|
||||
clocks = <&ccu CLK_AHB_TVE>, <&ccu CLK_AHB_LCD>,
|
||||
<&ccu CLK_AHB_DE_BE>, <&ccu CLK_DE_BE>,
|
||||
<&ccu CLK_TCON_CH1>, <&ccu CLK_DRAM_DE_BE>;
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
@ -62,8 +62,8 @@
|
||||
tve0: tv-encoder@01c0a000 {
|
||||
compatible = "allwinner,sun4i-a10-tv-encoder";
|
||||
reg = <0x01c0a000 0x1000>;
|
||||
clocks = <&ahb_gates 34>;
|
||||
resets = <&tcon_ch0_clk 0>;
|
||||
clocks = <&ccu CLK_AHB_TVE>;
|
||||
resets = <&ccu RST_TVE>;
|
||||
status = "disabled";
|
||||
|
||||
port {
|
||||
|
@ -44,9 +44,10 @@
|
||||
|
||||
#include "skeleton.dtsi"
|
||||
|
||||
#include <dt-bindings/clock/sun4i-a10-pll2.h>
|
||||
#include <dt-bindings/clock/sun5i-ccu.h>
|
||||
#include <dt-bindings/dma/sun4i-a10.h>
|
||||
#include <dt-bindings/pinctrl/sun4i-a10.h>
|
||||
#include <dt-bindings/reset/sun5i-ccu.h>
|
||||
|
||||
/ {
|
||||
interrupt-parent = <&intc>;
|
||||
@ -59,7 +60,7 @@
|
||||
device_type = "cpu";
|
||||
compatible = "arm,cortex-a8";
|
||||
reg = <0x0>;
|
||||
clocks = <&cpu>;
|
||||
clocks = <&ccu CLK_CPU>;
|
||||
};
|
||||
};
|
||||
|
||||
@ -68,291 +69,19 @@
|
||||
#size-cells = <1>;
|
||||
ranges;
|
||||
|
||||
/*
|
||||
* This is a dummy clock, to be used as placeholder on
|
||||
* other mux clocks when a specific parent clock is not
|
||||
* yet implemented. It should be dropped when the driver
|
||||
* is complete.
|
||||
*/
|
||||
dummy: dummy {
|
||||
#clock-cells = <0>;
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <0>;
|
||||
};
|
||||
|
||||
osc24M: clk@01c20050 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-osc-clk";
|
||||
reg = <0x01c20050 0x4>;
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <24000000>;
|
||||
clock-output-names = "osc24M";
|
||||
};
|
||||
|
||||
osc3M: osc3M_clk {
|
||||
compatible = "fixed-factor-clock";
|
||||
#clock-cells = <0>;
|
||||
clock-div = <8>;
|
||||
clock-mult = <1>;
|
||||
clocks = <&osc24M>;
|
||||
clock-output-names = "osc3M";
|
||||
};
|
||||
|
||||
osc32k: clk@0 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <32768>;
|
||||
clock-output-names = "osc32k";
|
||||
};
|
||||
|
||||
pll1: clk@01c20000 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-pll1-clk";
|
||||
reg = <0x01c20000 0x4>;
|
||||
clocks = <&osc24M>;
|
||||
clock-output-names = "pll1";
|
||||
};
|
||||
|
||||
pll2: clk@01c20008 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun5i-a13-pll2-clk";
|
||||
reg = <0x01c20008 0x8>;
|
||||
clocks = <&osc24M>;
|
||||
clock-output-names = "pll2-1x", "pll2-2x",
|
||||
"pll2-4x", "pll2-8x";
|
||||
};
|
||||
|
||||
pll3: clk@01c20010 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-pll3-clk";
|
||||
reg = <0x01c20010 0x4>;
|
||||
clocks = <&osc3M>;
|
||||
clock-output-names = "pll3";
|
||||
};
|
||||
|
||||
pll3x2: pll3x2_clk {
|
||||
compatible = "allwinner,sun4i-a10-pll3-2x-clk", "fixed-factor-clock";
|
||||
#clock-cells = <0>;
|
||||
clock-div = <1>;
|
||||
clock-mult = <2>;
|
||||
clocks = <&pll3>;
|
||||
clock-output-names = "pll3-2x";
|
||||
};
|
||||
|
||||
pll4: clk@01c20018 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-pll1-clk";
|
||||
reg = <0x01c20018 0x4>;
|
||||
clocks = <&osc24M>;
|
||||
clock-output-names = "pll4";
|
||||
};
|
||||
|
||||
pll5: clk@01c20020 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-pll5-clk";
|
||||
reg = <0x01c20020 0x4>;
|
||||
clocks = <&osc24M>;
|
||||
clock-output-names = "pll5_ddr", "pll5_other";
|
||||
};
|
||||
|
||||
pll6: clk@01c20028 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-pll6-clk";
|
||||
reg = <0x01c20028 0x4>;
|
||||
clocks = <&osc24M>;
|
||||
clock-output-names = "pll6_sata", "pll6_other", "pll6";
|
||||
};
|
||||
|
||||
pll7: clk@01c20030 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-pll3-clk";
|
||||
reg = <0x01c20030 0x4>;
|
||||
clocks = <&osc3M>;
|
||||
clock-output-names = "pll7";
|
||||
};
|
||||
|
||||
pll7x2: pll7x2_clk {
|
||||
compatible = "fixed-factor-clock";
|
||||
#clock-cells = <0>;
|
||||
clock-div = <1>;
|
||||
clock-mult = <2>;
|
||||
clocks = <&pll7>;
|
||||
clock-output-names = "pll7-2x";
|
||||
};
|
||||
|
||||
/* dummy is 200M */
|
||||
cpu: cpu@01c20054 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-cpu-clk";
|
||||
reg = <0x01c20054 0x4>;
|
||||
clocks = <&osc32k>, <&osc24M>, <&pll1>, <&dummy>;
|
||||
clock-output-names = "cpu";
|
||||
};
|
||||
|
||||
axi: axi@01c20054 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-axi-clk";
|
||||
reg = <0x01c20054 0x4>;
|
||||
clocks = <&cpu>;
|
||||
clock-output-names = "axi";
|
||||
};
|
||||
|
||||
ahb: ahb@01c20054 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun5i-a13-ahb-clk";
|
||||
reg = <0x01c20054 0x4>;
|
||||
clocks = <&axi>, <&cpu>, <&pll6 1>;
|
||||
clock-output-names = "ahb";
|
||||
/*
|
||||
* Use PLL6 as parent, instead of CPU/AXI
|
||||
* which has rate changes due to cpufreq
|
||||
*/
|
||||
assigned-clocks = <&ahb>;
|
||||
assigned-clock-parents = <&pll6 1>;
|
||||
};
|
||||
|
||||
apb0: apb0@01c20054 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-apb0-clk";
|
||||
reg = <0x01c20054 0x4>;
|
||||
clocks = <&ahb>;
|
||||
clock-output-names = "apb0";
|
||||
};
|
||||
|
||||
apb1: clk@01c20058 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-apb1-clk";
|
||||
reg = <0x01c20058 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
|
||||
clock-output-names = "apb1";
|
||||
};
|
||||
|
||||
axi_gates: clk@01c2005c {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-axi-gates-clk";
|
||||
reg = <0x01c2005c 0x4>;
|
||||
clocks = <&axi>;
|
||||
clock-indices = <0>;
|
||||
clock-output-names = "axi_dram";
|
||||
};
|
||||
|
||||
nand_clk: clk@01c20080 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c20080 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "nand";
|
||||
};
|
||||
|
||||
ms_clk: clk@01c20084 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c20084 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "ms";
|
||||
};
|
||||
|
||||
mmc0_clk: clk@01c20088 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-mmc-clk";
|
||||
reg = <0x01c20088 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "mmc0",
|
||||
"mmc0_output",
|
||||
"mmc0_sample";
|
||||
};
|
||||
|
||||
mmc1_clk: clk@01c2008c {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-mmc-clk";
|
||||
reg = <0x01c2008c 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "mmc1",
|
||||
"mmc1_output",
|
||||
"mmc1_sample";
|
||||
};
|
||||
|
||||
mmc2_clk: clk@01c20090 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun4i-a10-mmc-clk";
|
||||
reg = <0x01c20090 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "mmc2",
|
||||
"mmc2_output",
|
||||
"mmc2_sample";
|
||||
};
|
||||
|
||||
ts_clk: clk@01c20098 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c20098 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "ts";
|
||||
};
|
||||
|
||||
ss_clk: clk@01c2009c {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c2009c 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "ss";
|
||||
};
|
||||
|
||||
spi0_clk: clk@01c200a0 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c200a0 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "spi0";
|
||||
};
|
||||
|
||||
spi1_clk: clk@01c200a4 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c200a4 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "spi1";
|
||||
};
|
||||
|
||||
spi2_clk: clk@01c200a8 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c200a8 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "spi2";
|
||||
};
|
||||
|
||||
ir0_clk: clk@01c200b0 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-mod0-clk";
|
||||
reg = <0x01c200b0 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "ir0";
|
||||
};
|
||||
|
||||
usb_clk: clk@01c200cc {
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
compatible = "allwinner,sun5i-a13-usb-clk";
|
||||
reg = <0x01c200cc 0x4>;
|
||||
clocks = <&pll6 1>;
|
||||
clock-output-names = "usb_ohci0", "usb_phy";
|
||||
};
|
||||
|
||||
codec_clk: clk@01c20140 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun4i-a10-codec-clk";
|
||||
reg = <0x01c20140 0x4>;
|
||||
clocks = <&pll2 SUN4I_A10_PLL2_1X>;
|
||||
clock-output-names = "codec";
|
||||
};
|
||||
|
||||
mbus_clk: clk@01c2015c {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun5i-a13-mbus-clk";
|
||||
reg = <0x01c2015c 0x4>;
|
||||
clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
|
||||
clock-output-names = "mbus";
|
||||
};
|
||||
};
|
||||
|
||||
soc@01c00000 {
|
||||
@ -395,7 +124,7 @@
|
||||
compatible = "allwinner,sun4i-a10-dma";
|
||||
reg = <0x01c02000 0x1000>;
|
||||
interrupts = <27>;
|
||||
clocks = <&ahb_gates 6>;
|
||||
clocks = <&ccu CLK_AHB_DMA>;
|
||||
#dma-cells = <2>;
|
||||
};
|
||||
|
||||
@ -403,7 +132,7 @@
|
||||
compatible = "allwinner,sun4i-a10-spi";
|
||||
reg = <0x01c05000 0x1000>;
|
||||
interrupts = <10>;
|
||||
clocks = <&ahb_gates 20>, <&spi0_clk>;
|
||||
clocks = <&ccu CLK_AHB_SPI0>, <&ccu CLK_SPI0>;
|
||||
clock-names = "ahb", "mod";
|
||||
dmas = <&dma SUN4I_DMA_DEDICATED 27>,
|
||||
<&dma SUN4I_DMA_DEDICATED 26>;
|
||||
@ -417,7 +146,7 @@
|
||||
compatible = "allwinner,sun4i-a10-spi";
|
||||
reg = <0x01c06000 0x1000>;
|
||||
interrupts = <11>;
|
||||
clocks = <&ahb_gates 21>, <&spi1_clk>;
|
||||
clocks = <&ccu CLK_AHB_SPI1>, <&ccu CLK_SPI1>;
|
||||
clock-names = "ahb", "mod";
|
||||
dmas = <&dma SUN4I_DMA_DEDICATED 9>,
|
||||
<&dma SUN4I_DMA_DEDICATED 8>;
|
||||
@ -430,14 +159,8 @@
|
||||
mmc0: mmc@01c0f000 {
|
||||
compatible = "allwinner,sun5i-a13-mmc";
|
||||
reg = <0x01c0f000 0x1000>;
|
||||
clocks = <&ahb_gates 8>,
|
||||
<&mmc0_clk 0>,
|
||||
<&mmc0_clk 1>,
|
||||
<&mmc0_clk 2>;
|
||||
clock-names = "ahb",
|
||||
"mmc",
|
||||
"output",
|
||||
"sample";
|
||||
clocks = <&ccu CLK_AHB_MMC0>, <&ccu CLK_MMC0>;
|
||||
clock-names = "ahb", "mmc";
|
||||
interrupts = <32>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
@ -447,14 +170,8 @@
|
||||
mmc1: mmc@01c10000 {
|
||||
compatible = "allwinner,sun5i-a13-mmc";
|
||||
reg = <0x01c10000 0x1000>;
|
||||
clocks = <&ahb_gates 9>,
|
||||
<&mmc1_clk 0>,
|
||||
<&mmc1_clk 1>,
|
||||
<&mmc1_clk 2>;
|
||||
clock-names = "ahb",
|
||||
"mmc",
|
||||
"output",
|
||||
"sample";
|
||||
clocks = <&ccu CLK_AHB_MMC1>, <&ccu CLK_MMC1>;
|
||||
clock-names = "ahb", "mmc";
|
||||
interrupts = <33>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
@ -464,14 +181,8 @@
|
||||
mmc2: mmc@01c11000 {
|
||||
compatible = "allwinner,sun5i-a13-mmc";
|
||||
reg = <0x01c11000 0x1000>;
|
||||
clocks = <&ahb_gates 10>,
|
||||
<&mmc2_clk 0>,
|
||||
<&mmc2_clk 1>,
|
||||
<&mmc2_clk 2>;
|
||||
clock-names = "ahb",
|
||||
"mmc",
|
||||
"output",
|
||||
"sample";
|
||||
clocks = <&ccu CLK_AHB_MMC2>, <&ccu CLK_MMC2>;
|
||||
clock-names = "ahb", "mmc";
|
||||
interrupts = <34>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
@ -481,7 +192,7 @@
|
||||
usb_otg: usb@01c13000 {
|
||||
compatible = "allwinner,sun4i-a10-musb";
|
||||
reg = <0x01c13000 0x0400>;
|
||||
clocks = <&ahb_gates 0>;
|
||||
clocks = <&ccu CLK_AHB_OTG>;
|
||||
interrupts = <38>;
|
||||
interrupt-names = "mc";
|
||||
phys = <&usbphy 0>;
|
||||
@ -496,9 +207,9 @@
|
||||
compatible = "allwinner,sun5i-a13-usb-phy";
|
||||
reg = <0x01c13400 0x10 0x01c14800 0x4>;
|
||||
reg-names = "phy_ctrl", "pmu1";
|
||||
clocks = <&usb_clk 8>;
|
||||
clocks = <&ccu CLK_USB_PHY0>;
|
||||
clock-names = "usb_phy";
|
||||
resets = <&usb_clk 0>, <&usb_clk 1>;
|
||||
resets = <&ccu RST_USB_PHY0>, <&ccu RST_USB_PHY1>;
|
||||
reset-names = "usb0_reset", "usb1_reset";
|
||||
status = "disabled";
|
||||
};
|
||||
@ -507,7 +218,7 @@
|
||||
compatible = "allwinner,sun5i-a13-ehci", "generic-ehci";
|
||||
reg = <0x01c14000 0x100>;
|
||||
interrupts = <39>;
|
||||
clocks = <&ahb_gates 1>;
|
||||
clocks = <&ccu CLK_AHB_EHCI>;
|
||||
phys = <&usbphy 1>;
|
||||
phy-names = "usb";
|
||||
status = "disabled";
|
||||
@ -517,7 +228,7 @@
|
||||
compatible = "allwinner,sun5i-a13-ohci", "generic-ohci";
|
||||
reg = <0x01c14400 0x100>;
|
||||
interrupts = <40>;
|
||||
clocks = <&usb_clk 6>, <&ahb_gates 2>;
|
||||
clocks = <&ccu CLK_USB_OHCI>, <&ccu CLK_AHB_OHCI>;
|
||||
phys = <&usbphy 1>;
|
||||
phy-names = "usb";
|
||||
status = "disabled";
|
||||
@ -527,7 +238,7 @@
|
||||
compatible = "allwinner,sun4i-a10-spi";
|
||||
reg = <0x01c17000 0x1000>;
|
||||
interrupts = <12>;
|
||||
clocks = <&ahb_gates 22>, <&spi2_clk>;
|
||||
clocks = <&ccu CLK_AHB_SPI2>, <&ccu CLK_SPI2>;
|
||||
clock-names = "ahb", "mod";
|
||||
dmas = <&dma SUN4I_DMA_DEDICATED 29>,
|
||||
<&dma SUN4I_DMA_DEDICATED 28>;
|
||||
@ -537,6 +248,14 @@
|
||||
#size-cells = <0>;
|
||||
};
|
||||
|
||||
ccu: clock@01c20000 {
|
||||
reg = <0x01c20000 0x400>;
|
||||
clocks = <&osc24M>, <&osc32k>;
|
||||
clock-names = "hosc", "losc";
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
};
|
||||
|
||||
intc: interrupt-controller@01c20400 {
|
||||
compatible = "allwinner,sun4i-a10-ic";
|
||||
reg = <0x01c20400 0x400>;
|
||||
@ -547,7 +266,7 @@
|
||||
pio: pinctrl@01c20800 {
|
||||
reg = <0x01c20800 0x400>;
|
||||
interrupts = <28>;
|
||||
clocks = <&apb0_gates 5>, <&osc24M>, <&osc32k>;
|
||||
clocks = <&ccu CLK_APB0_PIO>, <&osc24M>, <&osc32k>;
|
||||
clock-names = "apb", "hosc", "losc";
|
||||
gpio-controller;
|
||||
interrupt-controller;
|
||||
@ -632,7 +351,7 @@
|
||||
compatible = "allwinner,sun4i-a10-timer";
|
||||
reg = <0x01c20c00 0x90>;
|
||||
interrupts = <22>;
|
||||
clocks = <&osc24M>;
|
||||
clocks = <&ccu CLK_HOSC>;
|
||||
};
|
||||
|
||||
wdt: watchdog@01c20c90 {
|
||||
@ -652,7 +371,7 @@
|
||||
compatible = "allwinner,sun4i-a10-codec";
|
||||
reg = <0x01c22c00 0x40>;
|
||||
interrupts = <30>;
|
||||
clocks = <&apb0_gates 0>, <&codec_clk>;
|
||||
clocks = <&ccu CLK_APB0_CODEC>, <&ccu CLK_CODEC>;
|
||||
clock-names = "apb", "codec";
|
||||
dmas = <&dma SUN4I_DMA_NORMAL 19>,
|
||||
<&dma SUN4I_DMA_NORMAL 19>;
|
||||
@ -678,7 +397,7 @@
|
||||
interrupts = <2>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
clocks = <&apb1_gates 17>;
|
||||
clocks = <&ccu CLK_APB1_UART1>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -688,7 +407,7 @@
|
||||
interrupts = <4>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
clocks = <&apb1_gates 19>;
|
||||
clocks = <&ccu CLK_APB1_UART3>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -696,7 +415,7 @@
|
||||
compatible = "allwinner,sun4i-a10-i2c";
|
||||
reg = <0x01c2ac00 0x400>;
|
||||
interrupts = <7>;
|
||||
clocks = <&apb1_gates 0>;
|
||||
clocks = <&ccu CLK_APB1_I2C0>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
@ -706,7 +425,7 @@
|
||||
compatible = "allwinner,sun4i-a10-i2c";
|
||||
reg = <0x01c2b000 0x400>;
|
||||
interrupts = <8>;
|
||||
clocks = <&apb1_gates 1>;
|
||||
clocks = <&ccu CLK_APB1_I2C1>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
@ -716,7 +435,7 @@
|
||||
compatible = "allwinner,sun4i-a10-i2c";
|
||||
reg = <0x01c2b400 0x400>;
|
||||
interrupts = <9>;
|
||||
clocks = <&apb1_gates 2>;
|
||||
clocks = <&ccu CLK_APB1_I2C2>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
@ -726,7 +445,7 @@
|
||||
compatible = "allwinner,sun5i-a13-hstimer";
|
||||
reg = <0x01c60000 0x1000>;
|
||||
interrupts = <82>, <83>;
|
||||
clocks = <&ahb_gates 28>;
|
||||
clocks = <&ccu CLK_AHB_HSTIMER>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -48,6 +48,13 @@
|
||||
|
||||
#include <dt-bindings/pinctrl/sun4i-a10.h>
|
||||
|
||||
#include <dt-bindings/clock/sun9i-a80-ccu.h>
|
||||
#include <dt-bindings/clock/sun9i-a80-de.h>
|
||||
#include <dt-bindings/clock/sun9i-a80-usb.h>
|
||||
#include <dt-bindings/reset/sun9i-a80-ccu.h>
|
||||
#include <dt-bindings/reset/sun9i-a80-de.h>
|
||||
#include <dt-bindings/reset/sun9i-a80-usb.h>
|
||||
|
||||
/ {
|
||||
interrupt-parent = <&gic>;
|
||||
|
||||
@ -159,228 +166,13 @@
|
||||
clock-output-names = "osc32k";
|
||||
};
|
||||
|
||||
usb_mod_clk: clk@00a08000 {
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
compatible = "allwinner,sun9i-a80-usb-mod-clk";
|
||||
reg = <0x00a08000 0x4>;
|
||||
clocks = <&ahb1_gates 1>;
|
||||
clock-output-names = "usb0_ahb", "usb_ohci0",
|
||||
"usb1_ahb", "usb_ohci1",
|
||||
"usb2_ahb", "usb_ohci2";
|
||||
};
|
||||
|
||||
usb_phy_clk: clk@00a08004 {
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
compatible = "allwinner,sun9i-a80-usb-phy-clk";
|
||||
reg = <0x00a08004 0x4>;
|
||||
clocks = <&ahb1_gates 1>;
|
||||
clock-output-names = "usb_phy0", "usb_hsic1_480M",
|
||||
"usb_phy1", "usb_hsic2_480M",
|
||||
"usb_phy2", "usb_hsic_12M";
|
||||
};
|
||||
|
||||
pll3: clk@06000008 {
|
||||
/* placeholder until implemented */
|
||||
#clock-cells = <0>;
|
||||
compatible = "fixed-clock";
|
||||
clock-rate = <0>;
|
||||
clock-output-names = "pll3";
|
||||
};
|
||||
|
||||
pll4: clk@0600000c {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun9i-a80-pll4-clk";
|
||||
reg = <0x0600000c 0x4>;
|
||||
clocks = <&osc24M>;
|
||||
clock-output-names = "pll4";
|
||||
};
|
||||
|
||||
pll12: clk@0600002c {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun9i-a80-pll4-clk";
|
||||
reg = <0x0600002c 0x4>;
|
||||
clocks = <&osc24M>;
|
||||
clock-output-names = "pll12";
|
||||
};
|
||||
|
||||
gt_clk: clk@0600005c {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun9i-a80-gt-clk";
|
||||
reg = <0x0600005c 0x4>;
|
||||
clocks = <&osc24M>, <&pll4>, <&pll12>, <&pll12>;
|
||||
clock-output-names = "gt";
|
||||
};
|
||||
|
||||
ahb0: clk@06000060 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun9i-a80-ahb-clk";
|
||||
reg = <0x06000060 0x4>;
|
||||
clocks = <>_clk>, <&pll4>, <&pll12>, <&pll12>;
|
||||
clock-output-names = "ahb0";
|
||||
};
|
||||
|
||||
ahb1: clk@06000064 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun9i-a80-ahb-clk";
|
||||
reg = <0x06000064 0x4>;
|
||||
clocks = <>_clk>, <&pll4>, <&pll12>, <&pll12>;
|
||||
clock-output-names = "ahb1";
|
||||
};
|
||||
|
||||
ahb2: clk@06000068 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun9i-a80-ahb-clk";
|
||||
reg = <0x06000068 0x4>;
|
||||
clocks = <>_clk>, <&pll4>, <&pll12>, <&pll12>;
|
||||
clock-output-names = "ahb2";
|
||||
};
|
||||
|
||||
apb0: clk@06000070 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun9i-a80-apb0-clk";
|
||||
reg = <0x06000070 0x4>;
|
||||
clocks = <&osc24M>, <&pll4>;
|
||||
clock-output-names = "apb0";
|
||||
};
|
||||
|
||||
apb1: clk@06000074 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun9i-a80-apb1-clk";
|
||||
reg = <0x06000074 0x4>;
|
||||
clocks = <&osc24M>, <&pll4>;
|
||||
clock-output-names = "apb1";
|
||||
};
|
||||
|
||||
cci400_clk: clk@06000078 {
|
||||
#clock-cells = <0>;
|
||||
compatible = "allwinner,sun9i-a80-gt-clk";
|
||||
reg = <0x06000078 0x4>;
|
||||
clocks = <&osc24M>, <&pll4>, <&pll12>, <&pll12>;
|
||||
clock-output-names = "cci400";
|
||||
};
|
||||
|
||||
mmc0_clk: clk@06000410 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun9i-a80-mmc-clk";
|
||||
reg = <0x06000410 0x4>;
|
||||
clocks = <&osc24M>, <&pll4>;
|
||||
clock-output-names = "mmc0", "mmc0_output",
|
||||
"mmc0_sample";
|
||||
};
|
||||
|
||||
mmc1_clk: clk@06000414 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun9i-a80-mmc-clk";
|
||||
reg = <0x06000414 0x4>;
|
||||
clocks = <&osc24M>, <&pll4>;
|
||||
clock-output-names = "mmc1", "mmc1_output",
|
||||
"mmc1_sample";
|
||||
};
|
||||
|
||||
mmc2_clk: clk@06000418 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun9i-a80-mmc-clk";
|
||||
reg = <0x06000418 0x4>;
|
||||
clocks = <&osc24M>, <&pll4>;
|
||||
clock-output-names = "mmc2", "mmc2_output",
|
||||
"mmc2_sample";
|
||||
};
|
||||
|
||||
mmc3_clk: clk@0600041c {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun9i-a80-mmc-clk";
|
||||
reg = <0x0600041c 0x4>;
|
||||
clocks = <&osc24M>, <&pll4>;
|
||||
clock-output-names = "mmc3", "mmc3_output",
|
||||
"mmc3_sample";
|
||||
};
|
||||
|
||||
ahb0_gates: clk@06000580 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun9i-a80-ahb0-gates-clk";
|
||||
reg = <0x06000580 0x4>;
|
||||
clocks = <&ahb0>;
|
||||
clock-indices = <0>, <1>, <3>,
|
||||
<5>, <8>, <12>,
|
||||
<13>, <14>,
|
||||
<15>, <16>, <18>,
|
||||
<20>, <21>, <22>,
|
||||
<23>;
|
||||
clock-output-names = "ahb0_fd", "ahb0_ve", "ahb0_gpu",
|
||||
"ahb0_ss", "ahb0_sd", "ahb0_nand1",
|
||||
"ahb0_nand0", "ahb0_sdram",
|
||||
"ahb0_mipi_hsi", "ahb0_sata", "ahb0_ts",
|
||||
"ahb0_spi0", "ahb0_spi1", "ahb0_spi2",
|
||||
"ahb0_spi3";
|
||||
};
|
||||
|
||||
ahb1_gates: clk@06000584 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun9i-a80-ahb1-gates-clk";
|
||||
reg = <0x06000584 0x4>;
|
||||
clocks = <&ahb1>;
|
||||
clock-indices = <0>, <1>,
|
||||
<17>, <21>,
|
||||
<22>, <23>,
|
||||
<24>;
|
||||
clock-output-names = "ahb1_usbotg", "ahb1_usbhci",
|
||||
"ahb1_gmac", "ahb1_msgbox",
|
||||
"ahb1_spinlock", "ahb1_hstimer",
|
||||
"ahb1_dma";
|
||||
};
|
||||
|
||||
ahb2_gates: clk@06000588 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun9i-a80-ahb2-gates-clk";
|
||||
reg = <0x06000588 0x4>;
|
||||
clocks = <&ahb2>;
|
||||
clock-indices = <0>, <1>,
|
||||
<2>, <4>, <5>,
|
||||
<7>, <8>, <11>;
|
||||
clock-output-names = "ahb2_lcd0", "ahb2_lcd1",
|
||||
"ahb2_edp", "ahb2_csi", "ahb2_hdmi",
|
||||
"ahb2_de", "ahb2_mp", "ahb2_mipi_dsi";
|
||||
};
|
||||
|
||||
apb0_gates: clk@06000590 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun9i-a80-apb0-gates-clk";
|
||||
reg = <0x06000590 0x4>;
|
||||
clocks = <&apb0>;
|
||||
clock-indices = <1>, <5>,
|
||||
<11>, <12>, <13>,
|
||||
<15>, <17>, <18>,
|
||||
<19>;
|
||||
clock-output-names = "apb0_spdif", "apb0_pio",
|
||||
"apb0_ac97", "apb0_i2s0", "apb0_i2s1",
|
||||
"apb0_lradc", "apb0_gpadc", "apb0_twd",
|
||||
"apb0_cirtx";
|
||||
};
|
||||
|
||||
apb1_gates: clk@06000594 {
|
||||
#clock-cells = <1>;
|
||||
compatible = "allwinner,sun9i-a80-apb1-gates-clk";
|
||||
reg = <0x06000594 0x4>;
|
||||
clocks = <&apb1>;
|
||||
clock-indices = <0>, <1>,
|
||||
<2>, <3>, <4>,
|
||||
<16>, <17>,
|
||||
<18>, <19>,
|
||||
<20>, <21>;
|
||||
clock-output-names = "apb1_i2c0", "apb1_i2c1",
|
||||
"apb1_i2c2", "apb1_i2c3", "apb1_i2c4",
|
||||
"apb1_uart0", "apb1_uart1",
|
||||
"apb1_uart2", "apb1_uart3",
|
||||
"apb1_uart4", "apb1_uart5";
|
||||
};
|
||||
|
||||
cpus_clk: clk@08001410 {
|
||||
compatible = "allwinner,sun9i-a80-cpus-clk";
|
||||
reg = <0x08001410 0x4>;
|
||||
#clock-cells = <0>;
|
||||
clocks = <&osc32k>, <&osc24M>, <&pll4>, <&pll3>;
|
||||
clocks = <&osc32k>, <&osc24M>,
|
||||
<&ccu CLK_PLL_PERIPH0>,
|
||||
<&ccu CLK_PLL_AUDIO>;
|
||||
clock-output-names = "cpus";
|
||||
};
|
||||
|
||||
@ -453,8 +245,8 @@
|
||||
compatible = "allwinner,sun9i-a80-ehci", "generic-ehci";
|
||||
reg = <0x00a00000 0x100>;
|
||||
interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&usb_mod_clk 1>;
|
||||
resets = <&usb_mod_clk 17>;
|
||||
clocks = <&usb_clocks CLK_BUS_HCI0>;
|
||||
resets = <&usb_clocks RST_USB0_HCI>;
|
||||
phys = <&usbphy1>;
|
||||
phy-names = "usb";
|
||||
status = "disabled";
|
||||
@ -464,8 +256,9 @@
|
||||
compatible = "allwinner,sun9i-a80-ohci", "generic-ohci";
|
||||
reg = <0x00a00400 0x100>;
|
||||
interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&usb_mod_clk 1>, <&usb_mod_clk 2>;
|
||||
resets = <&usb_mod_clk 17>;
|
||||
clocks = <&usb_clocks CLK_BUS_HCI0>,
|
||||
<&usb_clocks CLK_USB_OHCI0>;
|
||||
resets = <&usb_clocks RST_USB0_HCI>;
|
||||
phys = <&usbphy1>;
|
||||
phy-names = "usb";
|
||||
status = "disabled";
|
||||
@ -474,9 +267,9 @@
|
||||
usbphy1: phy@00a00800 {
|
||||
compatible = "allwinner,sun9i-a80-usb-phy";
|
||||
reg = <0x00a00800 0x4>;
|
||||
clocks = <&usb_phy_clk 1>;
|
||||
clocks = <&usb_clocks CLK_USB0_PHY>;
|
||||
clock-names = "phy";
|
||||
resets = <&usb_phy_clk 17>;
|
||||
resets = <&usb_clocks RST_USB0_PHY>;
|
||||
reset-names = "phy";
|
||||
status = "disabled";
|
||||
#phy-cells = <0>;
|
||||
@ -486,8 +279,8 @@
|
||||
compatible = "allwinner,sun9i-a80-ehci", "generic-ehci";
|
||||
reg = <0x00a01000 0x100>;
|
||||
interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&usb_mod_clk 3>;
|
||||
resets = <&usb_mod_clk 18>;
|
||||
clocks = <&usb_clocks CLK_BUS_HCI1>;
|
||||
resets = <&usb_clocks RST_USB1_HCI>;
|
||||
phys = <&usbphy2>;
|
||||
phy-names = "usb";
|
||||
status = "disabled";
|
||||
@ -496,11 +289,16 @@
|
||||
usbphy2: phy@00a01800 {
|
||||
compatible = "allwinner,sun9i-a80-usb-phy";
|
||||
reg = <0x00a01800 0x4>;
|
||||
clocks = <&usb_phy_clk 2>, <&usb_phy_clk 10>,
|
||||
<&usb_phy_clk 3>;
|
||||
clock-names = "hsic_480M", "hsic_12M", "phy";
|
||||
resets = <&usb_phy_clk 18>, <&usb_phy_clk 19>;
|
||||
reset-names = "hsic", "phy";
|
||||
clocks = <&usb_clocks CLK_USB1_HSIC>,
|
||||
<&usb_clocks CLK_USB_HSIC>,
|
||||
<&usb_clocks CLK_USB1_PHY>;
|
||||
clock-names = "hsic_480M",
|
||||
"hsic_12M",
|
||||
"phy";
|
||||
resets = <&usb_clocks RST_USB1_HSIC>,
|
||||
<&usb_clocks RST_USB1_PHY>;
|
||||
reset-names = "hsic",
|
||||
"phy";
|
||||
status = "disabled";
|
||||
#phy-cells = <0>;
|
||||
/* usb1 is always used with HSIC */
|
||||
@ -511,8 +309,8 @@
|
||||
compatible = "allwinner,sun9i-a80-ehci", "generic-ehci";
|
||||
reg = <0x00a02000 0x100>;
|
||||
interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&usb_mod_clk 5>;
|
||||
resets = <&usb_mod_clk 19>;
|
||||
clocks = <&usb_clocks CLK_BUS_HCI2>;
|
||||
resets = <&usb_clocks RST_USB2_HCI>;
|
||||
phys = <&usbphy3>;
|
||||
phy-names = "usb";
|
||||
status = "disabled";
|
||||
@ -522,8 +320,9 @@
|
||||
compatible = "allwinner,sun9i-a80-ohci", "generic-ohci";
|
||||
reg = <0x00a02400 0x100>;
|
||||
interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&usb_mod_clk 5>, <&usb_mod_clk 6>;
|
||||
resets = <&usb_mod_clk 19>;
|
||||
clocks = <&usb_clocks CLK_BUS_HCI2>,
|
||||
<&usb_clocks CLK_USB_OHCI2>;
|
||||
resets = <&usb_clocks RST_USB2_HCI>;
|
||||
phys = <&usbphy3>;
|
||||
phy-names = "usb";
|
||||
status = "disabled";
|
||||
@ -532,20 +331,35 @@
|
||||
usbphy3: phy@00a02800 {
|
||||
compatible = "allwinner,sun9i-a80-usb-phy";
|
||||
reg = <0x00a02800 0x4>;
|
||||
clocks = <&usb_phy_clk 4>, <&usb_phy_clk 10>,
|
||||
<&usb_phy_clk 5>;
|
||||
clock-names = "hsic_480M", "hsic_12M", "phy";
|
||||
resets = <&usb_phy_clk 20>, <&usb_phy_clk 21>;
|
||||
reset-names = "hsic", "phy";
|
||||
clocks = <&usb_clocks CLK_USB2_HSIC>,
|
||||
<&usb_clocks CLK_USB_HSIC>,
|
||||
<&usb_clocks CLK_USB2_PHY>;
|
||||
clock-names = "hsic_480M",
|
||||
"hsic_12M",
|
||||
"phy";
|
||||
resets = <&usb_clocks RST_USB2_HSIC>,
|
||||
<&usb_clocks RST_USB2_PHY>;
|
||||
reset-names = "hsic",
|
||||
"phy";
|
||||
status = "disabled";
|
||||
#phy-cells = <0>;
|
||||
};
|
||||
|
||||
usb_clocks: clock@00a08000 {
|
||||
compatible = "allwinner,sun9i-a80-usb-clks";
|
||||
reg = <0x00a08000 0x8>;
|
||||
clocks = <&ccu CLK_BUS_USB>, <&osc24M>;
|
||||
clock-names = "bus", "hosc";
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
};
|
||||
|
||||
mmc0: mmc@01c0f000 {
|
||||
compatible = "allwinner,sun9i-a80-mmc";
|
||||
reg = <0x01c0f000 0x1000>;
|
||||
clocks = <&mmc_config_clk 0>, <&mmc0_clk 0>,
|
||||
<&mmc0_clk 1>, <&mmc0_clk 2>;
|
||||
clocks = <&mmc_config_clk 0>, <&ccu CLK_MMC0>,
|
||||
<&ccu CLK_MMC0_OUTPUT>,
|
||||
<&ccu CLK_MMC0_SAMPLE>;
|
||||
clock-names = "ahb", "mmc", "output", "sample";
|
||||
resets = <&mmc_config_clk 0>;
|
||||
reset-names = "ahb";
|
||||
@ -558,8 +372,9 @@
|
||||
mmc1: mmc@01c10000 {
|
||||
compatible = "allwinner,sun9i-a80-mmc";
|
||||
reg = <0x01c10000 0x1000>;
|
||||
clocks = <&mmc_config_clk 1>, <&mmc1_clk 0>,
|
||||
<&mmc1_clk 1>, <&mmc1_clk 2>;
|
||||
clocks = <&mmc_config_clk 1>, <&ccu CLK_MMC1>,
|
||||
<&ccu CLK_MMC1_OUTPUT>,
|
||||
<&ccu CLK_MMC1_SAMPLE>;
|
||||
clock-names = "ahb", "mmc", "output", "sample";
|
||||
resets = <&mmc_config_clk 1>;
|
||||
reset-names = "ahb";
|
||||
@ -572,8 +387,9 @@
|
||||
mmc2: mmc@01c11000 {
|
||||
compatible = "allwinner,sun9i-a80-mmc";
|
||||
reg = <0x01c11000 0x1000>;
|
||||
clocks = <&mmc_config_clk 2>, <&mmc2_clk 0>,
|
||||
<&mmc2_clk 1>, <&mmc2_clk 2>;
|
||||
clocks = <&mmc_config_clk 2>, <&ccu CLK_MMC2>,
|
||||
<&ccu CLK_MMC2_OUTPUT>,
|
||||
<&ccu CLK_MMC2_SAMPLE>;
|
||||
clock-names = "ahb", "mmc", "output", "sample";
|
||||
resets = <&mmc_config_clk 2>;
|
||||
reset-names = "ahb";
|
||||
@ -586,8 +402,9 @@
|
||||
mmc3: mmc@01c12000 {
|
||||
compatible = "allwinner,sun9i-a80-mmc";
|
||||
reg = <0x01c12000 0x1000>;
|
||||
clocks = <&mmc_config_clk 3>, <&mmc3_clk 0>,
|
||||
<&mmc3_clk 1>, <&mmc3_clk 2>;
|
||||
clocks = <&mmc_config_clk 3>, <&ccu CLK_MMC3>,
|
||||
<&ccu CLK_MMC3_OUTPUT>,
|
||||
<&ccu CLK_MMC3_SAMPLE>;
|
||||
clock-names = "ahb", "mmc", "output", "sample";
|
||||
resets = <&mmc_config_clk 3>;
|
||||
reset-names = "ahb";
|
||||
@ -600,9 +417,9 @@
|
||||
mmc_config_clk: clk@01c13000 {
|
||||
compatible = "allwinner,sun9i-a80-mmc-config-clk";
|
||||
reg = <0x01c13000 0x10>;
|
||||
clocks = <&ahb0_gates 8>;
|
||||
clocks = <&ccu CLK_BUS_MMC>;
|
||||
clock-names = "ahb";
|
||||
resets = <&ahb0_resets 8>;
|
||||
resets = <&ccu RST_BUS_MMC>;
|
||||
reset-names = "ahb";
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
@ -621,34 +438,27 @@
|
||||
interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
|
||||
};
|
||||
|
||||
ahb0_resets: reset@060005a0 {
|
||||
de_clocks: clock@03000000 {
|
||||
compatible = "allwinner,sun9i-a80-de-clks";
|
||||
reg = <0x03000000 0x30>;
|
||||
clocks = <&ccu CLK_DE>,
|
||||
<&ccu CLK_SDRAM>,
|
||||
<&ccu CLK_BUS_DE>;
|
||||
clock-names = "mod",
|
||||
"dram",
|
||||
"bus";
|
||||
resets = <&ccu RST_BUS_DE>;
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
compatible = "allwinner,sun6i-a31-clock-reset";
|
||||
reg = <0x060005a0 0x4>;
|
||||
};
|
||||
|
||||
ahb1_resets: reset@060005a4 {
|
||||
ccu: clock@06000000 {
|
||||
compatible = "allwinner,sun9i-a80-ccu";
|
||||
reg = <0x06000000 0x800>;
|
||||
clocks = <&osc24M>, <&osc32k>;
|
||||
clock-names = "hosc", "losc";
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
compatible = "allwinner,sun6i-a31-clock-reset";
|
||||
reg = <0x060005a4 0x4>;
|
||||
};
|
||||
|
||||
ahb2_resets: reset@060005a8 {
|
||||
#reset-cells = <1>;
|
||||
compatible = "allwinner,sun6i-a31-clock-reset";
|
||||
reg = <0x060005a8 0x4>;
|
||||
};
|
||||
|
||||
apb0_resets: reset@060005b0 {
|
||||
#reset-cells = <1>;
|
||||
compatible = "allwinner,sun6i-a31-clock-reset";
|
||||
reg = <0x060005b0 0x4>;
|
||||
};
|
||||
|
||||
apb1_resets: reset@060005b4 {
|
||||
#reset-cells = <1>;
|
||||
compatible = "allwinner,sun6i-a31-clock-reset";
|
||||
reg = <0x060005b4 0x4>;
|
||||
};
|
||||
|
||||
timer@06000c00 {
|
||||
@ -678,7 +488,7 @@
|
||||
<GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&apb0_gates 5>, <&osc24M>, <&osc32k>;
|
||||
clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
|
||||
clock-names = "apb", "hosc", "losc";
|
||||
gpio-controller;
|
||||
interrupt-controller;
|
||||
@ -734,8 +544,8 @@
|
||||
interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
clocks = <&apb1_gates 16>;
|
||||
resets = <&apb1_resets 16>;
|
||||
clocks = <&ccu CLK_BUS_UART0>;
|
||||
resets = <&ccu RST_BUS_UART0>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -745,8 +555,8 @@
|
||||
interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
clocks = <&apb1_gates 17>;
|
||||
resets = <&apb1_resets 17>;
|
||||
clocks = <&ccu CLK_BUS_UART1>;
|
||||
resets = <&ccu RST_BUS_UART1>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -756,8 +566,8 @@
|
||||
interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
clocks = <&apb1_gates 18>;
|
||||
resets = <&apb1_resets 18>;
|
||||
clocks = <&ccu CLK_BUS_UART2>;
|
||||
resets = <&ccu RST_BUS_UART2>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -767,8 +577,8 @@
|
||||
interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
clocks = <&apb1_gates 19>;
|
||||
resets = <&apb1_resets 19>;
|
||||
clocks = <&ccu CLK_BUS_UART3>;
|
||||
resets = <&ccu RST_BUS_UART3>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -778,8 +588,8 @@
|
||||
interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
clocks = <&apb1_gates 20>;
|
||||
resets = <&apb1_resets 20>;
|
||||
clocks = <&ccu CLK_BUS_UART4>;
|
||||
resets = <&ccu RST_BUS_UART4>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -789,8 +599,8 @@
|
||||
interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
clocks = <&apb1_gates 21>;
|
||||
resets = <&apb1_resets 21>;
|
||||
clocks = <&ccu CLK_BUS_UART5>;
|
||||
resets = <&ccu RST_BUS_UART5>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -798,8 +608,8 @@
|
||||
compatible = "allwinner,sun6i-a31-i2c";
|
||||
reg = <0x07002800 0x400>;
|
||||
interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&apb1_gates 0>;
|
||||
resets = <&apb1_resets 0>;
|
||||
clocks = <&ccu CLK_BUS_I2C0>;
|
||||
resets = <&ccu RST_BUS_I2C0>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
@ -809,8 +619,8 @@
|
||||
compatible = "allwinner,sun6i-a31-i2c";
|
||||
reg = <0x07002c00 0x400>;
|
||||
interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&apb1_gates 1>;
|
||||
resets = <&apb1_resets 1>;
|
||||
clocks = <&ccu CLK_BUS_I2C1>;
|
||||
resets = <&ccu RST_BUS_I2C1>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
@ -820,8 +630,8 @@
|
||||
compatible = "allwinner,sun6i-a31-i2c";
|
||||
reg = <0x07003000 0x400>;
|
||||
interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&apb1_gates 2>;
|
||||
resets = <&apb1_resets 2>;
|
||||
clocks = <&ccu CLK_BUS_I2C2>;
|
||||
resets = <&ccu RST_BUS_I2C2>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
@ -831,8 +641,8 @@
|
||||
compatible = "allwinner,sun6i-a31-i2c";
|
||||
reg = <0x07003400 0x400>;
|
||||
interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&apb1_gates 3>;
|
||||
resets = <&apb1_resets 3>;
|
||||
clocks = <&ccu CLK_BUS_I2C3>;
|
||||
resets = <&ccu RST_BUS_I2C3>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
@ -842,8 +652,8 @@
|
||||
compatible = "allwinner,sun6i-a31-i2c";
|
||||
reg = <0x07003800 0x400>;
|
||||
interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&apb1_gates 4>;
|
||||
resets = <&apb1_resets 4>;
|
||||
clocks = <&ccu CLK_BUS_I2C4>;
|
||||
resets = <&ccu RST_BUS_I2C4>;
|
||||
status = "disabled";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
@ -2787,10 +2787,6 @@ config X86_DMA_REMAP
|
||||
bool
|
||||
depends on STA2X11
|
||||
|
||||
config PMC_ATOM
|
||||
def_bool y
|
||||
depends on PCI
|
||||
|
||||
source "net/Kconfig"
|
||||
|
||||
source "drivers/Kconfig"
|
||||
|
@ -1,2 +1 @@
|
||||
obj-$(CONFIG_PMC_ATOM) += pmc_atom.o
|
||||
obj-$(CONFIG_PUNIT_ATOM_DEBUG) += punit_atom_debug.o
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/platform_data/clk-lpss.h>
|
||||
#include <linux/platform_data/x86/pmc_atom.h>
|
||||
#include <linux/pm_domain.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/delay.h>
|
||||
@ -31,7 +32,6 @@ ACPI_MODULE_NAME("acpi_lpss");
|
||||
#include <asm/cpu_device_id.h>
|
||||
#include <asm/intel-family.h>
|
||||
#include <asm/iosf_mbi.h>
|
||||
#include <asm/pmc_atom.h>
|
||||
|
||||
#define LPSS_ADDR(desc) ((unsigned long)&desc)
|
||||
|
||||
|
@ -95,16 +95,17 @@ config COMMON_CLK_CDCE706
|
||||
This driver supports TI CDCE706 programmable 3-PLL clock synthesizer.
|
||||
|
||||
config COMMON_CLK_CDCE925
|
||||
tristate "Clock driver for TI CDCE925 devices"
|
||||
tristate "Clock driver for TI CDCE913/925/937/949 devices"
|
||||
depends on I2C
|
||||
depends on OF
|
||||
select REGMAP_I2C
|
||||
help
|
||||
---help---
|
||||
This driver supports the TI CDCE925 programmable clock synthesizer.
|
||||
The chip contains two PLLs with spread-spectrum clocking support and
|
||||
five output dividers. The driver only supports the following setup,
|
||||
and uses a fixed setting for the output muxes.
|
||||
This driver supports the TI CDCE913/925/937/949 programmable clock
|
||||
synthesizer. Each chip has different number of PLLs and outputs.
|
||||
For example, the CDCE925 contains two PLLs with spread-spectrum
|
||||
clocking support and five output dividers. The driver only supports
|
||||
the following setup, and uses a fixed setting for the output muxes.
|
||||
Y1 is derived from the input clock
|
||||
Y2 and Y3 derive from PLL1
|
||||
Y4 and Y5 derive from PLL2
|
||||
@ -198,6 +199,16 @@ config COMMON_CLK_OXNAS
|
||||
---help---
|
||||
Support for the OXNAS SoC Family clocks.
|
||||
|
||||
config COMMON_CLK_VC5
|
||||
tristate "Clock driver for IDT VersaClock5 devices"
|
||||
depends on I2C
|
||||
depends on OF
|
||||
select REGMAP_I2C
|
||||
help
|
||||
---help---
|
||||
This driver supports the IDT VersaClock5 programmable clock
|
||||
generator.
|
||||
|
||||
source "drivers/clk/bcm/Kconfig"
|
||||
source "drivers/clk/hisilicon/Kconfig"
|
||||
source "drivers/clk/mediatek/Kconfig"
|
||||
|
@ -46,6 +46,7 @@ obj-$(CONFIG_ARCH_TANGO) += clk-tango4.o
|
||||
obj-$(CONFIG_CLK_TWL6040) += clk-twl6040.o
|
||||
obj-$(CONFIG_ARCH_U300) += clk-u300.o
|
||||
obj-$(CONFIG_ARCH_VT8500) += clk-vt8500.o
|
||||
obj-$(CONFIG_COMMON_CLK_VC5) += clk-versaclock5.o
|
||||
obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o
|
||||
obj-$(CONFIG_COMMON_CLK_XGENE) += clk-xgene.o
|
||||
|
||||
@ -87,6 +88,8 @@ obj-y += ti/
|
||||
obj-$(CONFIG_CLK_UNIPHIER) += uniphier/
|
||||
obj-$(CONFIG_ARCH_U8500) += ux500/
|
||||
obj-$(CONFIG_COMMON_CLK_VERSATILE) += versatile/
|
||||
ifeq ($(CONFIG_COMMON_CLK), y)
|
||||
obj-$(CONFIG_X86) += x86/
|
||||
endif
|
||||
obj-$(CONFIG_ARCH_ZX) += zte/
|
||||
obj-$(CONFIG_ARCH_ZYNQ) += zynq/
|
||||
|
@ -182,6 +182,7 @@ static int i2s_pll_clk_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(pll_clk->base))
|
||||
return PTR_ERR(pll_clk->base);
|
||||
|
||||
memset(&init, 0, sizeof(init));
|
||||
clk_name = node->name;
|
||||
init.name = clk_name;
|
||||
init.ops = &i2s_pll_ops;
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clk/bcm2835.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
@ -98,7 +99,8 @@
|
||||
#define CM_SMIDIV 0x0b4
|
||||
/* no definition for 0x0b8 and 0x0bc */
|
||||
#define CM_TCNTCTL 0x0c0
|
||||
#define CM_TCNTDIV 0x0c4
|
||||
# define CM_TCNT_SRC1_SHIFT 12
|
||||
#define CM_TCNTCNT 0x0c4
|
||||
#define CM_TECCTL 0x0c8
|
||||
#define CM_TECDIV 0x0cc
|
||||
#define CM_TD0CTL 0x0d0
|
||||
@ -297,11 +299,32 @@
|
||||
#define LOCK_TIMEOUT_NS 100000000
|
||||
#define BCM2835_MAX_FB_RATE 1750000000u
|
||||
|
||||
/*
|
||||
* Names of clocks used within the driver that need to be replaced
|
||||
* with an external parent's name. This array is in the order that
|
||||
* the clocks node in the DT references external clocks.
|
||||
*/
|
||||
static const char *const cprman_parent_names[] = {
|
||||
"xosc",
|
||||
"dsi0_byte",
|
||||
"dsi0_ddr2",
|
||||
"dsi0_ddr",
|
||||
"dsi1_byte",
|
||||
"dsi1_ddr2",
|
||||
"dsi1_ddr",
|
||||
};
|
||||
|
||||
struct bcm2835_cprman {
|
||||
struct device *dev;
|
||||
void __iomem *regs;
|
||||
spinlock_t regs_lock; /* spinlock for all clocks */
|
||||
const char *osc_name;
|
||||
|
||||
/*
|
||||
* Real names of cprman clock parents looked up through
|
||||
* of_clk_get_parent_name(), which will be used in the
|
||||
* parent_names[] arrays for clock registration.
|
||||
*/
|
||||
const char *real_parent_names[ARRAY_SIZE(cprman_parent_names)];
|
||||
|
||||
/* Must be last */
|
||||
struct clk_hw_onecell_data onecell;
|
||||
@ -317,6 +340,61 @@ static inline u32 cprman_read(struct bcm2835_cprman *cprman, u32 reg)
|
||||
return readl(cprman->regs + reg);
|
||||
}
|
||||
|
||||
/* Does a cycle of measuring a clock through the TCNT clock, which may
|
||||
* source from many other clocks in the system.
|
||||
*/
|
||||
static unsigned long bcm2835_measure_tcnt_mux(struct bcm2835_cprman *cprman,
|
||||
u32 tcnt_mux)
|
||||
{
|
||||
u32 osccount = 19200; /* 1ms */
|
||||
u32 count;
|
||||
ktime_t timeout;
|
||||
|
||||
spin_lock(&cprman->regs_lock);
|
||||
|
||||
cprman_write(cprman, CM_TCNTCTL, CM_KILL);
|
||||
|
||||
cprman_write(cprman, CM_TCNTCTL,
|
||||
(tcnt_mux & CM_SRC_MASK) |
|
||||
(tcnt_mux >> CM_SRC_BITS) << CM_TCNT_SRC1_SHIFT);
|
||||
|
||||
cprman_write(cprman, CM_OSCCOUNT, osccount);
|
||||
|
||||
/* do a kind delay at the start */
|
||||
mdelay(1);
|
||||
|
||||
/* Finish off whatever is left of OSCCOUNT */
|
||||
timeout = ktime_add_ns(ktime_get(), LOCK_TIMEOUT_NS);
|
||||
while (cprman_read(cprman, CM_OSCCOUNT)) {
|
||||
if (ktime_after(ktime_get(), timeout)) {
|
||||
dev_err(cprman->dev, "timeout waiting for OSCCOUNT\n");
|
||||
count = 0;
|
||||
goto out;
|
||||
}
|
||||
cpu_relax();
|
||||
}
|
||||
|
||||
/* Wait for BUSY to clear. */
|
||||
timeout = ktime_add_ns(ktime_get(), LOCK_TIMEOUT_NS);
|
||||
while (cprman_read(cprman, CM_TCNTCTL) & CM_BUSY) {
|
||||
if (ktime_after(ktime_get(), timeout)) {
|
||||
dev_err(cprman->dev, "timeout waiting for !BUSY\n");
|
||||
count = 0;
|
||||
goto out;
|
||||
}
|
||||
cpu_relax();
|
||||
}
|
||||
|
||||
count = cprman_read(cprman, CM_TCNTCNT);
|
||||
|
||||
cprman_write(cprman, CM_TCNTCTL, 0);
|
||||
|
||||
out:
|
||||
spin_unlock(&cprman->regs_lock);
|
||||
|
||||
return count * 1000;
|
||||
}
|
||||
|
||||
static int bcm2835_debugfs_regset(struct bcm2835_cprman *cprman, u32 base,
|
||||
struct debugfs_reg32 *regs, size_t nregs,
|
||||
struct dentry *dentry)
|
||||
@ -428,6 +506,7 @@ struct bcm2835_pll_divider_data {
|
||||
u32 load_mask;
|
||||
u32 hold_mask;
|
||||
u32 fixed_divider;
|
||||
u32 flags;
|
||||
};
|
||||
|
||||
struct bcm2835_clock_data {
|
||||
@ -451,6 +530,8 @@ struct bcm2835_clock_data {
|
||||
|
||||
bool is_vpu_clock;
|
||||
bool is_mash_clock;
|
||||
|
||||
u32 tcnt_mux;
|
||||
};
|
||||
|
||||
struct bcm2835_gate_data {
|
||||
@ -906,6 +987,9 @@ static long bcm2835_clock_rate_from_divisor(struct bcm2835_clock *clock,
|
||||
const struct bcm2835_clock_data *data = clock->data;
|
||||
u64 temp;
|
||||
|
||||
if (data->int_bits == 0 && data->frac_bits == 0)
|
||||
return parent_rate;
|
||||
|
||||
/*
|
||||
* The divisor is a 12.12 fixed point field, but only some of
|
||||
* the bits are populated in any given clock.
|
||||
@ -929,7 +1013,12 @@ static unsigned long bcm2835_clock_get_rate(struct clk_hw *hw,
|
||||
struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
|
||||
struct bcm2835_cprman *cprman = clock->cprman;
|
||||
const struct bcm2835_clock_data *data = clock->data;
|
||||
u32 div = cprman_read(cprman, data->div_reg);
|
||||
u32 div;
|
||||
|
||||
if (data->int_bits == 0 && data->frac_bits == 0)
|
||||
return parent_rate;
|
||||
|
||||
div = cprman_read(cprman, data->div_reg);
|
||||
|
||||
return bcm2835_clock_rate_from_divisor(clock, parent_rate, div);
|
||||
}
|
||||
@ -978,6 +1067,17 @@ static int bcm2835_clock_on(struct clk_hw *hw)
|
||||
CM_GATE);
|
||||
spin_unlock(&cprman->regs_lock);
|
||||
|
||||
/* Debug code to measure the clock once it's turned on to see
|
||||
* if it's ticking at the rate we expect.
|
||||
*/
|
||||
if (data->tcnt_mux && false) {
|
||||
dev_info(cprman->dev,
|
||||
"clk %s: rate %ld, measure %ld\n",
|
||||
data->name,
|
||||
clk_hw_get_rate(hw),
|
||||
bcm2835_measure_tcnt_mux(cprman, data->tcnt_mux));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1208,7 +1308,7 @@ static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman,
|
||||
memset(&init, 0, sizeof(init));
|
||||
|
||||
/* All of the PLLs derive from the external oscillator. */
|
||||
init.parent_names = &cprman->osc_name;
|
||||
init.parent_names = &cprman->real_parent_names[0];
|
||||
init.num_parents = 1;
|
||||
init.name = data->name;
|
||||
init.ops = &bcm2835_pll_clk_ops;
|
||||
@ -1252,7 +1352,7 @@ bcm2835_register_pll_divider(struct bcm2835_cprman *cprman,
|
||||
init.num_parents = 1;
|
||||
init.name = divider_name;
|
||||
init.ops = &bcm2835_pll_divider_clk_ops;
|
||||
init.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED;
|
||||
init.flags = data->flags | CLK_IGNORE_UNUSED;
|
||||
|
||||
divider = devm_kzalloc(cprman->dev, sizeof(*divider), GFP_KERNEL);
|
||||
if (!divider)
|
||||
@ -1294,18 +1394,22 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman,
|
||||
struct bcm2835_clock *clock;
|
||||
struct clk_init_data init;
|
||||
const char *parents[1 << CM_SRC_BITS];
|
||||
size_t i;
|
||||
size_t i, j;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Replace our "xosc" references with the oscillator's
|
||||
* actual name.
|
||||
* Replace our strings referencing parent clocks with the
|
||||
* actual clock-output-name of the parent.
|
||||
*/
|
||||
for (i = 0; i < data->num_mux_parents; i++) {
|
||||
if (strcmp(data->parents[i], "xosc") == 0)
|
||||
parents[i] = cprman->osc_name;
|
||||
else
|
||||
parents[i] = data->parents[i];
|
||||
|
||||
for (j = 0; j < ARRAY_SIZE(cprman_parent_names); j++) {
|
||||
if (strcmp(parents[i], cprman_parent_names[j]) == 0) {
|
||||
parents[i] = cprman->real_parent_names[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
memset(&init, 0, sizeof(init));
|
||||
@ -1431,6 +1535,47 @@ static const char *const bcm2835_clock_vpu_parents[] = {
|
||||
.parents = bcm2835_clock_vpu_parents, \
|
||||
__VA_ARGS__)
|
||||
|
||||
/*
|
||||
* DSI parent clocks. The DSI byte/DDR/DDR2 clocks come from the DSI
|
||||
* analog PHY. The _inv variants are generated internally to cprman,
|
||||
* but we don't use them so they aren't hooked up.
|
||||
*/
|
||||
static const char *const bcm2835_clock_dsi0_parents[] = {
|
||||
"gnd",
|
||||
"xosc",
|
||||
"testdebug0",
|
||||
"testdebug1",
|
||||
"dsi0_ddr",
|
||||
"dsi0_ddr_inv",
|
||||
"dsi0_ddr2",
|
||||
"dsi0_ddr2_inv",
|
||||
"dsi0_byte",
|
||||
"dsi0_byte_inv",
|
||||
};
|
||||
|
||||
static const char *const bcm2835_clock_dsi1_parents[] = {
|
||||
"gnd",
|
||||
"xosc",
|
||||
"testdebug0",
|
||||
"testdebug1",
|
||||
"dsi1_ddr",
|
||||
"dsi1_ddr_inv",
|
||||
"dsi1_ddr2",
|
||||
"dsi1_ddr2_inv",
|
||||
"dsi1_byte",
|
||||
"dsi1_byte_inv",
|
||||
};
|
||||
|
||||
#define REGISTER_DSI0_CLK(...) REGISTER_CLK( \
|
||||
.num_mux_parents = ARRAY_SIZE(bcm2835_clock_dsi0_parents), \
|
||||
.parents = bcm2835_clock_dsi0_parents, \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define REGISTER_DSI1_CLK(...) REGISTER_CLK( \
|
||||
.num_mux_parents = ARRAY_SIZE(bcm2835_clock_dsi1_parents), \
|
||||
.parents = bcm2835_clock_dsi1_parents, \
|
||||
__VA_ARGS__)
|
||||
|
||||
/*
|
||||
* the real definition of all the pll, pll_dividers and clocks
|
||||
* these make use of the above REGISTER_* macros
|
||||
@ -1466,7 +1611,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.a2w_reg = A2W_PLLA_CORE,
|
||||
.load_mask = CM_PLLA_LOADCORE,
|
||||
.hold_mask = CM_PLLA_HOLDCORE,
|
||||
.fixed_divider = 1),
|
||||
.fixed_divider = 1,
|
||||
.flags = CLK_SET_RATE_PARENT),
|
||||
[BCM2835_PLLA_PER] = REGISTER_PLL_DIV(
|
||||
.name = "plla_per",
|
||||
.source_pll = "plla",
|
||||
@ -1474,7 +1620,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.a2w_reg = A2W_PLLA_PER,
|
||||
.load_mask = CM_PLLA_LOADPER,
|
||||
.hold_mask = CM_PLLA_HOLDPER,
|
||||
.fixed_divider = 1),
|
||||
.fixed_divider = 1,
|
||||
.flags = CLK_SET_RATE_PARENT),
|
||||
[BCM2835_PLLA_DSI0] = REGISTER_PLL_DIV(
|
||||
.name = "plla_dsi0",
|
||||
.source_pll = "plla",
|
||||
@ -1490,7 +1637,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.a2w_reg = A2W_PLLA_CCP2,
|
||||
.load_mask = CM_PLLA_LOADCCP2,
|
||||
.hold_mask = CM_PLLA_HOLDCCP2,
|
||||
.fixed_divider = 1),
|
||||
.fixed_divider = 1,
|
||||
.flags = CLK_SET_RATE_PARENT),
|
||||
|
||||
/* PLLB is used for the ARM's clock. */
|
||||
[BCM2835_PLLB] = REGISTER_PLL(
|
||||
@ -1514,7 +1662,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.a2w_reg = A2W_PLLB_ARM,
|
||||
.load_mask = CM_PLLB_LOADARM,
|
||||
.hold_mask = CM_PLLB_HOLDARM,
|
||||
.fixed_divider = 1),
|
||||
.fixed_divider = 1,
|
||||
.flags = CLK_SET_RATE_PARENT),
|
||||
|
||||
/*
|
||||
* PLLC is the core PLL, used to drive the core VPU clock.
|
||||
@ -1543,7 +1692,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.a2w_reg = A2W_PLLC_CORE0,
|
||||
.load_mask = CM_PLLC_LOADCORE0,
|
||||
.hold_mask = CM_PLLC_HOLDCORE0,
|
||||
.fixed_divider = 1),
|
||||
.fixed_divider = 1,
|
||||
.flags = CLK_SET_RATE_PARENT),
|
||||
[BCM2835_PLLC_CORE1] = REGISTER_PLL_DIV(
|
||||
.name = "pllc_core1",
|
||||
.source_pll = "pllc",
|
||||
@ -1551,7 +1701,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.a2w_reg = A2W_PLLC_CORE1,
|
||||
.load_mask = CM_PLLC_LOADCORE1,
|
||||
.hold_mask = CM_PLLC_HOLDCORE1,
|
||||
.fixed_divider = 1),
|
||||
.fixed_divider = 1,
|
||||
.flags = CLK_SET_RATE_PARENT),
|
||||
[BCM2835_PLLC_CORE2] = REGISTER_PLL_DIV(
|
||||
.name = "pllc_core2",
|
||||
.source_pll = "pllc",
|
||||
@ -1559,7 +1710,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.a2w_reg = A2W_PLLC_CORE2,
|
||||
.load_mask = CM_PLLC_LOADCORE2,
|
||||
.hold_mask = CM_PLLC_HOLDCORE2,
|
||||
.fixed_divider = 1),
|
||||
.fixed_divider = 1,
|
||||
.flags = CLK_SET_RATE_PARENT),
|
||||
[BCM2835_PLLC_PER] = REGISTER_PLL_DIV(
|
||||
.name = "pllc_per",
|
||||
.source_pll = "pllc",
|
||||
@ -1567,7 +1719,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.a2w_reg = A2W_PLLC_PER,
|
||||
.load_mask = CM_PLLC_LOADPER,
|
||||
.hold_mask = CM_PLLC_HOLDPER,
|
||||
.fixed_divider = 1),
|
||||
.fixed_divider = 1,
|
||||
.flags = CLK_SET_RATE_PARENT),
|
||||
|
||||
/*
|
||||
* PLLD is the display PLL, used to drive DSI display panels.
|
||||
@ -1596,7 +1749,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.a2w_reg = A2W_PLLD_CORE,
|
||||
.load_mask = CM_PLLD_LOADCORE,
|
||||
.hold_mask = CM_PLLD_HOLDCORE,
|
||||
.fixed_divider = 1),
|
||||
.fixed_divider = 1,
|
||||
.flags = CLK_SET_RATE_PARENT),
|
||||
[BCM2835_PLLD_PER] = REGISTER_PLL_DIV(
|
||||
.name = "plld_per",
|
||||
.source_pll = "plld",
|
||||
@ -1604,7 +1758,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.a2w_reg = A2W_PLLD_PER,
|
||||
.load_mask = CM_PLLD_LOADPER,
|
||||
.hold_mask = CM_PLLD_HOLDPER,
|
||||
.fixed_divider = 1),
|
||||
.fixed_divider = 1,
|
||||
.flags = CLK_SET_RATE_PARENT),
|
||||
[BCM2835_PLLD_DSI0] = REGISTER_PLL_DIV(
|
||||
.name = "plld_dsi0",
|
||||
.source_pll = "plld",
|
||||
@ -1649,7 +1804,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.a2w_reg = A2W_PLLH_RCAL,
|
||||
.load_mask = CM_PLLH_LOADRCAL,
|
||||
.hold_mask = 0,
|
||||
.fixed_divider = 10),
|
||||
.fixed_divider = 10,
|
||||
.flags = CLK_SET_RATE_PARENT),
|
||||
[BCM2835_PLLH_AUX] = REGISTER_PLL_DIV(
|
||||
.name = "pllh_aux",
|
||||
.source_pll = "pllh",
|
||||
@ -1657,7 +1813,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.a2w_reg = A2W_PLLH_AUX,
|
||||
.load_mask = CM_PLLH_LOADAUX,
|
||||
.hold_mask = 0,
|
||||
.fixed_divider = 1),
|
||||
.fixed_divider = 1,
|
||||
.flags = CLK_SET_RATE_PARENT),
|
||||
[BCM2835_PLLH_PIX] = REGISTER_PLL_DIV(
|
||||
.name = "pllh_pix",
|
||||
.source_pll = "pllh",
|
||||
@ -1665,7 +1822,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.a2w_reg = A2W_PLLH_PIX,
|
||||
.load_mask = CM_PLLH_LOADPIX,
|
||||
.hold_mask = 0,
|
||||
.fixed_divider = 10),
|
||||
.fixed_divider = 10,
|
||||
.flags = CLK_SET_RATE_PARENT),
|
||||
|
||||
/* the clocks */
|
||||
|
||||
@ -1677,7 +1835,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.ctl_reg = CM_OTPCTL,
|
||||
.div_reg = CM_OTPDIV,
|
||||
.int_bits = 4,
|
||||
.frac_bits = 0),
|
||||
.frac_bits = 0,
|
||||
.tcnt_mux = 6),
|
||||
/*
|
||||
* Used for a 1Mhz clock for the system clocksource, and also used
|
||||
* bythe watchdog timer and the camera pulse generator.
|
||||
@ -1711,13 +1870,15 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.ctl_reg = CM_H264CTL,
|
||||
.div_reg = CM_H264DIV,
|
||||
.int_bits = 4,
|
||||
.frac_bits = 8),
|
||||
.frac_bits = 8,
|
||||
.tcnt_mux = 1),
|
||||
[BCM2835_CLOCK_ISP] = REGISTER_VPU_CLK(
|
||||
.name = "isp",
|
||||
.ctl_reg = CM_ISPCTL,
|
||||
.div_reg = CM_ISPDIV,
|
||||
.int_bits = 4,
|
||||
.frac_bits = 8),
|
||||
.frac_bits = 8,
|
||||
.tcnt_mux = 2),
|
||||
|
||||
/*
|
||||
* Secondary SDRAM clock. Used for low-voltage modes when the PLL
|
||||
@ -1728,13 +1889,15 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.ctl_reg = CM_SDCCTL,
|
||||
.div_reg = CM_SDCDIV,
|
||||
.int_bits = 6,
|
||||
.frac_bits = 0),
|
||||
.frac_bits = 0,
|
||||
.tcnt_mux = 3),
|
||||
[BCM2835_CLOCK_V3D] = REGISTER_VPU_CLK(
|
||||
.name = "v3d",
|
||||
.ctl_reg = CM_V3DCTL,
|
||||
.div_reg = CM_V3DDIV,
|
||||
.int_bits = 4,
|
||||
.frac_bits = 8),
|
||||
.frac_bits = 8,
|
||||
.tcnt_mux = 4),
|
||||
/*
|
||||
* VPU clock. This doesn't have an enable bit, since it drives
|
||||
* the bus for everything else, and is special so it doesn't need
|
||||
@ -1748,7 +1911,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.int_bits = 12,
|
||||
.frac_bits = 8,
|
||||
.flags = CLK_IS_CRITICAL,
|
||||
.is_vpu_clock = true),
|
||||
.is_vpu_clock = true,
|
||||
.tcnt_mux = 5),
|
||||
|
||||
/* clocks with per parent mux */
|
||||
[BCM2835_CLOCK_AVEO] = REGISTER_PER_CLK(
|
||||
@ -1756,19 +1920,22 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.ctl_reg = CM_AVEOCTL,
|
||||
.div_reg = CM_AVEODIV,
|
||||
.int_bits = 4,
|
||||
.frac_bits = 0),
|
||||
.frac_bits = 0,
|
||||
.tcnt_mux = 38),
|
||||
[BCM2835_CLOCK_CAM0] = REGISTER_PER_CLK(
|
||||
.name = "cam0",
|
||||
.ctl_reg = CM_CAM0CTL,
|
||||
.div_reg = CM_CAM0DIV,
|
||||
.int_bits = 4,
|
||||
.frac_bits = 8),
|
||||
.frac_bits = 8,
|
||||
.tcnt_mux = 14),
|
||||
[BCM2835_CLOCK_CAM1] = REGISTER_PER_CLK(
|
||||
.name = "cam1",
|
||||
.ctl_reg = CM_CAM1CTL,
|
||||
.div_reg = CM_CAM1DIV,
|
||||
.int_bits = 4,
|
||||
.frac_bits = 8),
|
||||
.frac_bits = 8,
|
||||
.tcnt_mux = 15),
|
||||
[BCM2835_CLOCK_DFT] = REGISTER_PER_CLK(
|
||||
.name = "dft",
|
||||
.ctl_reg = CM_DFTCTL,
|
||||
@ -1780,7 +1947,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.ctl_reg = CM_DPICTL,
|
||||
.div_reg = CM_DPIDIV,
|
||||
.int_bits = 4,
|
||||
.frac_bits = 8),
|
||||
.frac_bits = 8,
|
||||
.tcnt_mux = 17),
|
||||
|
||||
/* Arasan EMMC clock */
|
||||
[BCM2835_CLOCK_EMMC] = REGISTER_PER_CLK(
|
||||
@ -1788,7 +1956,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.ctl_reg = CM_EMMCCTL,
|
||||
.div_reg = CM_EMMCDIV,
|
||||
.int_bits = 4,
|
||||
.frac_bits = 8),
|
||||
.frac_bits = 8,
|
||||
.tcnt_mux = 39),
|
||||
|
||||
/* General purpose (GPIO) clocks */
|
||||
[BCM2835_CLOCK_GP0] = REGISTER_PER_CLK(
|
||||
@ -1797,7 +1966,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.div_reg = CM_GP0DIV,
|
||||
.int_bits = 12,
|
||||
.frac_bits = 12,
|
||||
.is_mash_clock = true),
|
||||
.is_mash_clock = true,
|
||||
.tcnt_mux = 20),
|
||||
[BCM2835_CLOCK_GP1] = REGISTER_PER_CLK(
|
||||
.name = "gp1",
|
||||
.ctl_reg = CM_GP1CTL,
|
||||
@ -1805,7 +1975,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.int_bits = 12,
|
||||
.frac_bits = 12,
|
||||
.flags = CLK_IS_CRITICAL,
|
||||
.is_mash_clock = true),
|
||||
.is_mash_clock = true,
|
||||
.tcnt_mux = 21),
|
||||
[BCM2835_CLOCK_GP2] = REGISTER_PER_CLK(
|
||||
.name = "gp2",
|
||||
.ctl_reg = CM_GP2CTL,
|
||||
@ -1820,40 +1991,46 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.ctl_reg = CM_HSMCTL,
|
||||
.div_reg = CM_HSMDIV,
|
||||
.int_bits = 4,
|
||||
.frac_bits = 8),
|
||||
.frac_bits = 8,
|
||||
.tcnt_mux = 22),
|
||||
[BCM2835_CLOCK_PCM] = REGISTER_PER_CLK(
|
||||
.name = "pcm",
|
||||
.ctl_reg = CM_PCMCTL,
|
||||
.div_reg = CM_PCMDIV,
|
||||
.int_bits = 12,
|
||||
.frac_bits = 12,
|
||||
.is_mash_clock = true),
|
||||
.is_mash_clock = true,
|
||||
.tcnt_mux = 23),
|
||||
[BCM2835_CLOCK_PWM] = REGISTER_PER_CLK(
|
||||
.name = "pwm",
|
||||
.ctl_reg = CM_PWMCTL,
|
||||
.div_reg = CM_PWMDIV,
|
||||
.int_bits = 12,
|
||||
.frac_bits = 12,
|
||||
.is_mash_clock = true),
|
||||
.is_mash_clock = true,
|
||||
.tcnt_mux = 24),
|
||||
[BCM2835_CLOCK_SLIM] = REGISTER_PER_CLK(
|
||||
.name = "slim",
|
||||
.ctl_reg = CM_SLIMCTL,
|
||||
.div_reg = CM_SLIMDIV,
|
||||
.int_bits = 12,
|
||||
.frac_bits = 12,
|
||||
.is_mash_clock = true),
|
||||
.is_mash_clock = true,
|
||||
.tcnt_mux = 25),
|
||||
[BCM2835_CLOCK_SMI] = REGISTER_PER_CLK(
|
||||
.name = "smi",
|
||||
.ctl_reg = CM_SMICTL,
|
||||
.div_reg = CM_SMIDIV,
|
||||
.int_bits = 4,
|
||||
.frac_bits = 8),
|
||||
.frac_bits = 8,
|
||||
.tcnt_mux = 27),
|
||||
[BCM2835_CLOCK_UART] = REGISTER_PER_CLK(
|
||||
.name = "uart",
|
||||
.ctl_reg = CM_UARTCTL,
|
||||
.div_reg = CM_UARTDIV,
|
||||
.int_bits = 10,
|
||||
.frac_bits = 12),
|
||||
.frac_bits = 12,
|
||||
.tcnt_mux = 28),
|
||||
|
||||
/* TV encoder clock. Only operating frequency is 108Mhz. */
|
||||
[BCM2835_CLOCK_VEC] = REGISTER_PER_CLK(
|
||||
@ -1866,7 +2043,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
* Allow rate change propagation only on PLLH_AUX which is
|
||||
* assigned index 7 in the parent array.
|
||||
*/
|
||||
.set_rate_parent = BIT(7)),
|
||||
.set_rate_parent = BIT(7),
|
||||
.tcnt_mux = 29),
|
||||
|
||||
/* dsi clocks */
|
||||
[BCM2835_CLOCK_DSI0E] = REGISTER_PER_CLK(
|
||||
@ -1874,13 +2052,29 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
|
||||
.ctl_reg = CM_DSI0ECTL,
|
||||
.div_reg = CM_DSI0EDIV,
|
||||
.int_bits = 4,
|
||||
.frac_bits = 8),
|
||||
.frac_bits = 8,
|
||||
.tcnt_mux = 18),
|
||||
[BCM2835_CLOCK_DSI1E] = REGISTER_PER_CLK(
|
||||
.name = "dsi1e",
|
||||
.ctl_reg = CM_DSI1ECTL,
|
||||
.div_reg = CM_DSI1EDIV,
|
||||
.int_bits = 4,
|
||||
.frac_bits = 8),
|
||||
.frac_bits = 8,
|
||||
.tcnt_mux = 19),
|
||||
[BCM2835_CLOCK_DSI0P] = REGISTER_DSI0_CLK(
|
||||
.name = "dsi0p",
|
||||
.ctl_reg = CM_DSI0PCTL,
|
||||
.div_reg = CM_DSI0PDIV,
|
||||
.int_bits = 0,
|
||||
.frac_bits = 0,
|
||||
.tcnt_mux = 12),
|
||||
[BCM2835_CLOCK_DSI1P] = REGISTER_DSI1_CLK(
|
||||
.name = "dsi1p",
|
||||
.ctl_reg = CM_DSI1PCTL,
|
||||
.div_reg = CM_DSI1PDIV,
|
||||
.int_bits = 0,
|
||||
.frac_bits = 0,
|
||||
.tcnt_mux = 13),
|
||||
|
||||
/* the gates */
|
||||
|
||||
@ -1939,8 +2133,19 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(cprman->regs))
|
||||
return PTR_ERR(cprman->regs);
|
||||
|
||||
cprman->osc_name = of_clk_get_parent_name(dev->of_node, 0);
|
||||
if (!cprman->osc_name)
|
||||
memcpy(cprman->real_parent_names, cprman_parent_names,
|
||||
sizeof(cprman_parent_names));
|
||||
of_clk_parent_fill(dev->of_node, cprman->real_parent_names,
|
||||
ARRAY_SIZE(cprman_parent_names));
|
||||
|
||||
/*
|
||||
* Make sure the external oscillator has been registered.
|
||||
*
|
||||
* The other (DSI) clocks are not present on older device
|
||||
* trees, which we still need to support for backwards
|
||||
* compatibility.
|
||||
*/
|
||||
if (!cprman->real_parent_names[0])
|
||||
return -ENODEV;
|
||||
|
||||
platform_set_drvdata(pdev, cprman);
|
||||
|
@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Driver for TI Dual PLL CDCE925 clock synthesizer
|
||||
* Driver for TI Multi PLL CDCE913/925/937/949 clock synthesizer
|
||||
*
|
||||
* This driver always connects the Y1 to the input clock, Y2/Y3 to PLL1
|
||||
* and Y4/Y5 to PLL2. PLL frequency is set on a first-come-first-serve
|
||||
* This driver always connects the Y1 to the input clock, Y2/Y3 to PLL1,
|
||||
* Y4/Y5 to PLL2, and so on. PLL frequency is set on a first-come-first-serve
|
||||
* basis. Clients can directly request any frequency that the chip can
|
||||
* deliver using the standard clk framework. In addition, the device can
|
||||
* be configured and activated via the devicetree.
|
||||
@ -19,11 +19,32 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/gcd.h>
|
||||
|
||||
/* The chip has 2 PLLs which can be routed through dividers to 5 outputs.
|
||||
/* Each chip has different number of PLLs and outputs, for example:
|
||||
* The CECE925 has 2 PLLs which can be routed through dividers to 5 outputs.
|
||||
* Model this as 2 PLL clocks which are parents to the outputs.
|
||||
*/
|
||||
#define NUMBER_OF_PLLS 2
|
||||
#define NUMBER_OF_OUTPUTS 5
|
||||
|
||||
enum {
|
||||
CDCE913,
|
||||
CDCE925,
|
||||
CDCE937,
|
||||
CDCE949,
|
||||
};
|
||||
|
||||
struct clk_cdce925_chip_info {
|
||||
int num_plls;
|
||||
int num_outputs;
|
||||
};
|
||||
|
||||
static const struct clk_cdce925_chip_info clk_cdce925_chip_info_tbl[] = {
|
||||
[CDCE913] = { .num_plls = 1, .num_outputs = 3 },
|
||||
[CDCE925] = { .num_plls = 2, .num_outputs = 5 },
|
||||
[CDCE937] = { .num_plls = 3, .num_outputs = 7 },
|
||||
[CDCE949] = { .num_plls = 4, .num_outputs = 9 },
|
||||
};
|
||||
|
||||
#define MAX_NUMBER_OF_PLLS 4
|
||||
#define MAX_NUMBER_OF_OUTPUTS 9
|
||||
|
||||
#define CDCE925_REG_GLOBAL1 0x01
|
||||
#define CDCE925_REG_Y1SPIPDIVH 0x02
|
||||
@ -43,7 +64,7 @@ struct clk_cdce925_output {
|
||||
struct clk_hw hw;
|
||||
struct clk_cdce925_chip *chip;
|
||||
u8 index;
|
||||
u16 pdiv; /* 1..127 for Y2-Y5; 1..1023 for Y1 */
|
||||
u16 pdiv; /* 1..127 for Y2-Y9; 1..1023 for Y1 */
|
||||
};
|
||||
#define to_clk_cdce925_output(_hw) \
|
||||
container_of(_hw, struct clk_cdce925_output, hw)
|
||||
@ -60,8 +81,9 @@ struct clk_cdce925_pll {
|
||||
struct clk_cdce925_chip {
|
||||
struct regmap *regmap;
|
||||
struct i2c_client *i2c_client;
|
||||
struct clk_cdce925_pll pll[NUMBER_OF_PLLS];
|
||||
struct clk_cdce925_output clk[NUMBER_OF_OUTPUTS];
|
||||
const struct clk_cdce925_chip_info *chip_info;
|
||||
struct clk_cdce925_pll pll[MAX_NUMBER_OF_PLLS];
|
||||
struct clk_cdce925_output clk[MAX_NUMBER_OF_OUTPUTS];
|
||||
};
|
||||
|
||||
/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
|
||||
@ -284,6 +306,18 @@ static void cdce925_clk_set_pdiv(struct clk_cdce925_output *data, u16 pdiv)
|
||||
case 4:
|
||||
regmap_update_bits(data->chip->regmap, 0x27, 0x7F, pdiv);
|
||||
break;
|
||||
case 5:
|
||||
regmap_update_bits(data->chip->regmap, 0x36, 0x7F, pdiv);
|
||||
break;
|
||||
case 6:
|
||||
regmap_update_bits(data->chip->regmap, 0x37, 0x7F, pdiv);
|
||||
break;
|
||||
case 7:
|
||||
regmap_update_bits(data->chip->regmap, 0x46, 0x7F, pdiv);
|
||||
break;
|
||||
case 8:
|
||||
regmap_update_bits(data->chip->regmap, 0x47, 0x7F, pdiv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -302,6 +336,14 @@ static void cdce925_clk_activate(struct clk_cdce925_output *data)
|
||||
case 4:
|
||||
regmap_update_bits(data->chip->regmap, 0x24, 0x03, 0x03);
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
regmap_update_bits(data->chip->regmap, 0x34, 0x03, 0x03);
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
regmap_update_bits(data->chip->regmap, 0x44, 0x03, 0x03);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -474,15 +516,6 @@ static const struct clk_ops cdce925_clk_y1_ops = {
|
||||
.set_rate = cdce925_clk_y1_set_rate,
|
||||
};
|
||||
|
||||
|
||||
static struct regmap_config cdce925_regmap_config = {
|
||||
.name = "configuration0",
|
||||
.reg_bits = 8,
|
||||
.val_bits = 8,
|
||||
.cache_type = REGCACHE_RBTREE,
|
||||
.max_register = 0x2F,
|
||||
};
|
||||
|
||||
#define CDCE925_I2C_COMMAND_BLOCK_TRANSFER 0x00
|
||||
#define CDCE925_I2C_COMMAND_BYTE_TRANSFER 0x80
|
||||
|
||||
@ -582,13 +615,19 @@ static int cdce925_probe(struct i2c_client *client,
|
||||
struct clk_cdce925_chip *data;
|
||||
struct device_node *node = client->dev.of_node;
|
||||
const char *parent_name;
|
||||
const char *pll_clk_name[NUMBER_OF_PLLS] = {NULL,};
|
||||
const char *pll_clk_name[MAX_NUMBER_OF_PLLS] = {NULL,};
|
||||
struct clk_init_data init;
|
||||
u32 value;
|
||||
int i;
|
||||
int err;
|
||||
struct device_node *np_output;
|
||||
char child_name[6];
|
||||
struct regmap_config config = {
|
||||
.name = "configuration0",
|
||||
.reg_bits = 8,
|
||||
.val_bits = 8,
|
||||
.cache_type = REGCACHE_RBTREE,
|
||||
};
|
||||
|
||||
dev_dbg(&client->dev, "%s\n", __func__);
|
||||
data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
|
||||
@ -596,8 +635,11 @@ static int cdce925_probe(struct i2c_client *client,
|
||||
return -ENOMEM;
|
||||
|
||||
data->i2c_client = client;
|
||||
data->chip_info = &clk_cdce925_chip_info_tbl[id->driver_data];
|
||||
config.max_register = CDCE925_OFFSET_PLL +
|
||||
data->chip_info->num_plls * 0x10 - 1;
|
||||
data->regmap = devm_regmap_init(&client->dev, ®map_cdce925_bus,
|
||||
&client->dev, &cdce925_regmap_config);
|
||||
&client->dev, &config);
|
||||
if (IS_ERR(data->regmap)) {
|
||||
dev_err(&client->dev, "failed to allocate register map\n");
|
||||
return PTR_ERR(data->regmap);
|
||||
@ -626,7 +668,7 @@ static int cdce925_probe(struct i2c_client *client,
|
||||
init.num_parents = parent_name ? 1 : 0;
|
||||
|
||||
/* Register PLL clocks */
|
||||
for (i = 0; i < NUMBER_OF_PLLS; ++i) {
|
||||
for (i = 0; i < data->chip_info->num_plls; ++i) {
|
||||
pll_clk_name[i] = kasprintf(GFP_KERNEL, "%s.pll%d",
|
||||
client->dev.of_node->name, i);
|
||||
init.name = pll_clk_name[i];
|
||||
@ -684,7 +726,7 @@ static int cdce925_probe(struct i2c_client *client,
|
||||
init.ops = &cdce925_clk_ops;
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
init.num_parents = 1;
|
||||
for (i = 1; i < NUMBER_OF_OUTPUTS; ++i) {
|
||||
for (i = 1; i < data->chip_info->num_outputs; ++i) {
|
||||
init.name = kasprintf(GFP_KERNEL, "%s.Y%d",
|
||||
client->dev.of_node->name, i+1);
|
||||
data->clk[i].chip = data;
|
||||
@ -702,6 +744,16 @@ static int cdce925_probe(struct i2c_client *client,
|
||||
/* Mux Y4/5 to PLL2 */
|
||||
init.parent_names = &pll_clk_name[1];
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
/* Mux Y6/7 to PLL3 */
|
||||
init.parent_names = &pll_clk_name[2];
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
/* Mux Y8/9 to PLL4 */
|
||||
init.parent_names = &pll_clk_name[3];
|
||||
break;
|
||||
}
|
||||
err = devm_clk_hw_register(&client->dev, &data->clk[i].hw);
|
||||
kfree(init.name); /* clock framework made a copy of the name */
|
||||
@ -720,7 +772,7 @@ static int cdce925_probe(struct i2c_client *client,
|
||||
err = 0;
|
||||
|
||||
error:
|
||||
for (i = 0; i < NUMBER_OF_PLLS; ++i)
|
||||
for (i = 0; i < data->chip_info->num_plls; ++i)
|
||||
/* clock framework made a copy of the name */
|
||||
kfree(pll_clk_name[i]);
|
||||
|
||||
@ -728,13 +780,19 @@ error:
|
||||
}
|
||||
|
||||
static const struct i2c_device_id cdce925_id[] = {
|
||||
{ "cdce925", 0 },
|
||||
{ "cdce913", CDCE913 },
|
||||
{ "cdce925", CDCE925 },
|
||||
{ "cdce937", CDCE937 },
|
||||
{ "cdce949", CDCE949 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, cdce925_id);
|
||||
|
||||
static const struct of_device_id clk_cdce925_of_match[] = {
|
||||
{ .compatible = "ti,cdce913" },
|
||||
{ .compatible = "ti,cdce925" },
|
||||
{ .compatible = "ti,cdce937" },
|
||||
{ .compatible = "ti,cdce949" },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, clk_cdce925_of_match);
|
||||
@ -750,5 +808,5 @@ static struct i2c_driver cdce925_driver = {
|
||||
module_i2c_driver(cdce925_driver);
|
||||
|
||||
MODULE_AUTHOR("Mike Looijmans <mike.looijmans@topic.nl>");
|
||||
MODULE_DESCRIPTION("cdce925 driver");
|
||||
MODULE_DESCRIPTION("TI CDCE913/925/937/949 driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -40,6 +40,7 @@ static int __set_clk_parents(struct device_node *node, bool clk_supplier)
|
||||
return 0;
|
||||
pclk = of_clk_get_from_provider(&clkspec);
|
||||
if (IS_ERR(pclk)) {
|
||||
if (PTR_ERR(pclk) != -EPROBE_DEFER)
|
||||
pr_warn("clk: couldn't get parent clock %d for %s\n",
|
||||
index, node->full_name);
|
||||
return PTR_ERR(pclk);
|
||||
@ -55,6 +56,7 @@ static int __set_clk_parents(struct device_node *node, bool clk_supplier)
|
||||
}
|
||||
clk = of_clk_get_from_provider(&clkspec);
|
||||
if (IS_ERR(clk)) {
|
||||
if (PTR_ERR(clk) != -EPROBE_DEFER)
|
||||
pr_warn("clk: couldn't get assigned clock %d for %s\n",
|
||||
index, node->full_name);
|
||||
rc = PTR_ERR(clk);
|
||||
@ -99,6 +101,7 @@ static int __set_clk_rates(struct device_node *node, bool clk_supplier)
|
||||
|
||||
clk = of_clk_get_from_provider(&clkspec);
|
||||
if (IS_ERR(clk)) {
|
||||
if (PTR_ERR(clk) != -EPROBE_DEFER)
|
||||
pr_warn("clk: couldn't get clock %d for %s\n",
|
||||
index, node->full_name);
|
||||
return PTR_ERR(clk);
|
||||
|
@ -59,6 +59,10 @@ struct cs2000_priv {
|
||||
struct i2c_client *client;
|
||||
struct clk *clk_in;
|
||||
struct clk *ref_clk;
|
||||
|
||||
/* suspend/resume */
|
||||
unsigned long saved_rate;
|
||||
unsigned long saved_parent_rate;
|
||||
};
|
||||
|
||||
static const struct of_device_id cs2000_of_match[] = {
|
||||
@ -286,6 +290,9 @@ static int __cs2000_set_rate(struct cs2000_priv *priv, int ch,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
priv->saved_rate = rate;
|
||||
priv->saved_parent_rate = parent_rate;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -489,9 +496,24 @@ probe_err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cs2000_resume(struct device *dev)
|
||||
{
|
||||
struct cs2000_priv *priv = dev_get_drvdata(dev);
|
||||
int ch = 0; /* it uses ch0 only at this point */
|
||||
|
||||
return __cs2000_set_rate(priv, ch,
|
||||
priv->saved_rate,
|
||||
priv->saved_parent_rate);
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops cs2000_pm_ops = {
|
||||
.resume_early = cs2000_resume,
|
||||
};
|
||||
|
||||
static struct i2c_driver cs2000_driver = {
|
||||
.driver = {
|
||||
.name = "cs2000-cp",
|
||||
.pm = &cs2000_pm_ops,
|
||||
.of_match_table = cs2000_of_match,
|
||||
},
|
||||
.probe = cs2000_probe,
|
||||
|
@ -290,13 +290,15 @@ static int scpi_clocks_probe(struct platform_device *pdev)
|
||||
of_node_put(child);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
/* Add the virtual cpufreq device */
|
||||
|
||||
if (match->data != &scpi_dvfs_ops)
|
||||
continue;
|
||||
/* Add the virtual cpufreq device if it's DVFS clock provider */
|
||||
cpufreq_dev = platform_device_register_simple("scpi-cpufreq",
|
||||
-1, NULL, 0);
|
||||
if (IS_ERR(cpufreq_dev))
|
||||
pr_warn("unable to register cpufreq device");
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,14 @@
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
|
||||
/*
|
||||
* Include list of clocks wich are not derived from system clock (SYSCLOCK)
|
||||
* The index of these clocks is the secondary index of DT bindings
|
||||
*
|
||||
*/
|
||||
#include <dt-bindings/clock/stm32fx-clock.h>
|
||||
|
||||
#define STM32F4_RCC_CR 0x00
|
||||
#define STM32F4_RCC_PLLCFGR 0x04
|
||||
#define STM32F4_RCC_CFGR 0x08
|
||||
#define STM32F4_RCC_AHB1ENR 0x30
|
||||
@ -37,6 +45,15 @@
|
||||
#define STM32F4_RCC_APB2ENR 0x44
|
||||
#define STM32F4_RCC_BDCR 0x70
|
||||
#define STM32F4_RCC_CSR 0x74
|
||||
#define STM32F4_RCC_PLLI2SCFGR 0x84
|
||||
#define STM32F4_RCC_PLLSAICFGR 0x88
|
||||
#define STM32F4_RCC_DCKCFGR 0x8c
|
||||
#define STM32F7_RCC_DCKCFGR2 0x90
|
||||
|
||||
#define NONE -1
|
||||
#define NO_IDX NONE
|
||||
#define NO_MUX NONE
|
||||
#define NO_GATE NONE
|
||||
|
||||
struct stm32f4_gate_data {
|
||||
u8 offset;
|
||||
@ -195,7 +212,7 @@ static const struct stm32f4_gate_data stm32f469_gates[] __initconst = {
|
||||
{ STM32F4_RCC_APB2ENR, 8, "adc1", "apb2_div" },
|
||||
{ STM32F4_RCC_APB2ENR, 9, "adc2", "apb2_div" },
|
||||
{ STM32F4_RCC_APB2ENR, 10, "adc3", "apb2_div" },
|
||||
{ STM32F4_RCC_APB2ENR, 11, "sdio", "pll48" },
|
||||
{ STM32F4_RCC_APB2ENR, 11, "sdio", "sdmux" },
|
||||
{ STM32F4_RCC_APB2ENR, 12, "spi1", "apb2_div" },
|
||||
{ STM32F4_RCC_APB2ENR, 13, "spi4", "apb2_div" },
|
||||
{ STM32F4_RCC_APB2ENR, 14, "syscfg", "apb2_div" },
|
||||
@ -208,7 +225,79 @@ static const struct stm32f4_gate_data stm32f469_gates[] __initconst = {
|
||||
{ STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" },
|
||||
};
|
||||
|
||||
enum { SYSTICK, FCLK, CLK_LSI, CLK_LSE, CLK_HSE_RTC, CLK_RTC, END_PRIMARY_CLK };
|
||||
static const struct stm32f4_gate_data stm32f746_gates[] __initconst = {
|
||||
{ STM32F4_RCC_AHB1ENR, 0, "gpioa", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 1, "gpiob", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 2, "gpioc", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 3, "gpiod", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 4, "gpioe", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 5, "gpiof", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 6, "gpiog", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 7, "gpioh", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 8, "gpioi", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 9, "gpioj", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 10, "gpiok", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 12, "crc", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 18, "bkpsra", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 20, "dtcmram", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 21, "dma1", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 22, "dma2", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 23, "dma2d", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 25, "ethmac", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 26, "ethmactx", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 27, "ethmacrx", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 28, "ethmacptp", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 29, "otghs", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB1ENR, 30, "otghsulpi", "ahb_div" },
|
||||
|
||||
{ STM32F4_RCC_AHB2ENR, 0, "dcmi", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB2ENR, 4, "cryp", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB2ENR, 5, "hash", "ahb_div" },
|
||||
{ STM32F4_RCC_AHB2ENR, 6, "rng", "pll48" },
|
||||
{ STM32F4_RCC_AHB2ENR, 7, "otgfs", "pll48" },
|
||||
|
||||
{ STM32F4_RCC_AHB3ENR, 0, "fmc", "ahb_div",
|
||||
CLK_IGNORE_UNUSED },
|
||||
{ STM32F4_RCC_AHB3ENR, 1, "qspi", "ahb_div",
|
||||
CLK_IGNORE_UNUSED },
|
||||
|
||||
{ STM32F4_RCC_APB1ENR, 0, "tim2", "apb1_mul" },
|
||||
{ STM32F4_RCC_APB1ENR, 1, "tim3", "apb1_mul" },
|
||||
{ STM32F4_RCC_APB1ENR, 2, "tim4", "apb1_mul" },
|
||||
{ STM32F4_RCC_APB1ENR, 3, "tim5", "apb1_mul" },
|
||||
{ STM32F4_RCC_APB1ENR, 4, "tim6", "apb1_mul" },
|
||||
{ STM32F4_RCC_APB1ENR, 5, "tim7", "apb1_mul" },
|
||||
{ STM32F4_RCC_APB1ENR, 6, "tim12", "apb1_mul" },
|
||||
{ STM32F4_RCC_APB1ENR, 7, "tim13", "apb1_mul" },
|
||||
{ STM32F4_RCC_APB1ENR, 8, "tim14", "apb1_mul" },
|
||||
{ STM32F4_RCC_APB1ENR, 11, "wwdg", "apb1_div" },
|
||||
{ STM32F4_RCC_APB1ENR, 14, "spi2", "apb1_div" },
|
||||
{ STM32F4_RCC_APB1ENR, 15, "spi3", "apb1_div" },
|
||||
{ STM32F4_RCC_APB1ENR, 16, "spdifrx", "apb1_div" },
|
||||
{ STM32F4_RCC_APB1ENR, 25, "can1", "apb1_div" },
|
||||
{ STM32F4_RCC_APB1ENR, 26, "can2", "apb1_div" },
|
||||
{ STM32F4_RCC_APB1ENR, 27, "cec", "apb1_div" },
|
||||
{ STM32F4_RCC_APB1ENR, 28, "pwr", "apb1_div" },
|
||||
{ STM32F4_RCC_APB1ENR, 29, "dac", "apb1_div" },
|
||||
|
||||
{ STM32F4_RCC_APB2ENR, 0, "tim1", "apb2_mul" },
|
||||
{ STM32F4_RCC_APB2ENR, 1, "tim8", "apb2_mul" },
|
||||
{ STM32F4_RCC_APB2ENR, 8, "adc1", "apb2_div" },
|
||||
{ STM32F4_RCC_APB2ENR, 9, "adc2", "apb2_div" },
|
||||
{ STM32F4_RCC_APB2ENR, 10, "adc3", "apb2_div" },
|
||||
{ STM32F4_RCC_APB2ENR, 11, "sdmmc", "sdmux" },
|
||||
{ STM32F4_RCC_APB2ENR, 12, "spi1", "apb2_div" },
|
||||
{ STM32F4_RCC_APB2ENR, 13, "spi4", "apb2_div" },
|
||||
{ STM32F4_RCC_APB2ENR, 14, "syscfg", "apb2_div" },
|
||||
{ STM32F4_RCC_APB2ENR, 16, "tim9", "apb2_mul" },
|
||||
{ STM32F4_RCC_APB2ENR, 17, "tim10", "apb2_mul" },
|
||||
{ STM32F4_RCC_APB2ENR, 18, "tim11", "apb2_mul" },
|
||||
{ STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" },
|
||||
{ STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" },
|
||||
{ STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" },
|
||||
{ STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" },
|
||||
{ STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" },
|
||||
};
|
||||
|
||||
/*
|
||||
* This bitmask tells us which bit offsets (0..192) on STM32F4[23]xxx
|
||||
@ -224,6 +313,10 @@ static const u64 stm32f46xx_gate_map[MAX_GATE_MAP] = { 0x000000f17ef417ffull,
|
||||
0x0000000000000003ull,
|
||||
0x0c777f33f6fec9ffull };
|
||||
|
||||
static const u64 stm32f746_gate_map[MAX_GATE_MAP] = { 0x000000f17ef417ffull,
|
||||
0x0000000000000003ull,
|
||||
0x04f77f033e01c9ffull };
|
||||
|
||||
static const u64 *stm32f4_gate_map;
|
||||
|
||||
static struct clk_hw **clks;
|
||||
@ -233,6 +326,8 @@ static void __iomem *base;
|
||||
|
||||
static struct regmap *pdrm;
|
||||
|
||||
static int stm32fx_end_primary_clk;
|
||||
|
||||
/*
|
||||
* "Multiplier" device for APBx clocks.
|
||||
*
|
||||
@ -324,23 +419,342 @@ static struct clk *clk_register_apb_mul(struct device *dev, const char *name,
|
||||
return clk;
|
||||
}
|
||||
|
||||
/*
|
||||
* Decode current PLL state and (statically) model the state we inherit from
|
||||
* the bootloader.
|
||||
*/
|
||||
static void stm32f4_rcc_register_pll(const char *hse_clk, const char *hsi_clk)
|
||||
enum {
|
||||
PLL,
|
||||
PLL_I2S,
|
||||
PLL_SAI,
|
||||
};
|
||||
|
||||
static const struct clk_div_table pll_divp_table[] = {
|
||||
{ 0, 2 }, { 1, 4 }, { 2, 6 }, { 3, 8 }, { 0 }
|
||||
};
|
||||
|
||||
static const struct clk_div_table pll_divr_table[] = {
|
||||
{ 2, 2 }, { 3, 3 }, { 4, 4 }, { 5, 5 }, { 6, 6 }, { 7, 7 }, { 0 }
|
||||
};
|
||||
|
||||
struct stm32f4_pll {
|
||||
spinlock_t *lock;
|
||||
struct clk_gate gate;
|
||||
u8 offset;
|
||||
u8 bit_rdy_idx;
|
||||
u8 status;
|
||||
u8 n_start;
|
||||
};
|
||||
|
||||
#define to_stm32f4_pll(_gate) container_of(_gate, struct stm32f4_pll, gate)
|
||||
|
||||
struct stm32f4_pll_post_div_data {
|
||||
int idx;
|
||||
u8 pll_num;
|
||||
const char *name;
|
||||
const char *parent;
|
||||
u8 flag;
|
||||
u8 offset;
|
||||
u8 shift;
|
||||
u8 width;
|
||||
u8 flag_div;
|
||||
const struct clk_div_table *div_table;
|
||||
};
|
||||
|
||||
struct stm32f4_vco_data {
|
||||
const char *vco_name;
|
||||
u8 offset;
|
||||
u8 bit_idx;
|
||||
u8 bit_rdy_idx;
|
||||
};
|
||||
|
||||
static const struct stm32f4_vco_data vco_data[] = {
|
||||
{ "vco", STM32F4_RCC_PLLCFGR, 24, 25 },
|
||||
{ "vco-i2s", STM32F4_RCC_PLLI2SCFGR, 26, 27 },
|
||||
{ "vco-sai", STM32F4_RCC_PLLSAICFGR, 28, 29 },
|
||||
};
|
||||
|
||||
|
||||
static const struct clk_div_table post_divr_table[] = {
|
||||
{ 0, 2 }, { 1, 4 }, { 2, 8 }, { 3, 16 }, { 0 }
|
||||
};
|
||||
|
||||
#define MAX_POST_DIV 3
|
||||
static const struct stm32f4_pll_post_div_data post_div_data[MAX_POST_DIV] = {
|
||||
{ CLK_I2SQ_PDIV, PLL_I2S, "plli2s-q-div", "plli2s-q",
|
||||
CLK_SET_RATE_PARENT, STM32F4_RCC_DCKCFGR, 0, 5, 0, NULL},
|
||||
|
||||
{ CLK_SAIQ_PDIV, PLL_SAI, "pllsai-q-div", "pllsai-q",
|
||||
CLK_SET_RATE_PARENT, STM32F4_RCC_DCKCFGR, 8, 5, 0, NULL },
|
||||
|
||||
{ NO_IDX, PLL_SAI, "pllsai-r-div", "pllsai-r", CLK_SET_RATE_PARENT,
|
||||
STM32F4_RCC_DCKCFGR, 16, 2, 0, post_divr_table },
|
||||
};
|
||||
|
||||
struct stm32f4_div_data {
|
||||
u8 shift;
|
||||
u8 width;
|
||||
u8 flag_div;
|
||||
const struct clk_div_table *div_table;
|
||||
};
|
||||
|
||||
#define MAX_PLL_DIV 3
|
||||
static const struct stm32f4_div_data div_data[MAX_PLL_DIV] = {
|
||||
{ 16, 2, 0, pll_divp_table },
|
||||
{ 24, 4, CLK_DIVIDER_ONE_BASED, NULL },
|
||||
{ 28, 3, 0, pll_divr_table },
|
||||
};
|
||||
|
||||
struct stm32f4_pll_data {
|
||||
u8 pll_num;
|
||||
u8 n_start;
|
||||
const char *div_name[MAX_PLL_DIV];
|
||||
};
|
||||
|
||||
static const struct stm32f4_pll_data stm32f429_pll[MAX_PLL_DIV] = {
|
||||
{ PLL, 192, { "pll", "pll48", NULL } },
|
||||
{ PLL_I2S, 192, { NULL, "plli2s-q", "plli2s-r" } },
|
||||
{ PLL_SAI, 49, { NULL, "pllsai-q", "pllsai-r" } },
|
||||
};
|
||||
|
||||
static const struct stm32f4_pll_data stm32f469_pll[MAX_PLL_DIV] = {
|
||||
{ PLL, 50, { "pll", "pll-q", NULL } },
|
||||
{ PLL_I2S, 50, { "plli2s-p", "plli2s-q", "plli2s-r" } },
|
||||
{ PLL_SAI, 50, { "pllsai-p", "pllsai-q", "pllsai-r" } },
|
||||
};
|
||||
|
||||
static int stm32f4_pll_is_enabled(struct clk_hw *hw)
|
||||
{
|
||||
unsigned long pllcfgr = readl(base + STM32F4_RCC_PLLCFGR);
|
||||
return clk_gate_ops.is_enabled(hw);
|
||||
}
|
||||
|
||||
unsigned long pllm = pllcfgr & 0x3f;
|
||||
unsigned long plln = (pllcfgr >> 6) & 0x1ff;
|
||||
unsigned long pllp = BIT(((pllcfgr >> 16) & 3) + 1);
|
||||
const char *pllsrc = pllcfgr & BIT(22) ? hse_clk : hsi_clk;
|
||||
unsigned long pllq = (pllcfgr >> 24) & 0xf;
|
||||
static int stm32f4_pll_enable(struct clk_hw *hw)
|
||||
{
|
||||
struct clk_gate *gate = to_clk_gate(hw);
|
||||
struct stm32f4_pll *pll = to_stm32f4_pll(gate);
|
||||
int ret = 0;
|
||||
unsigned long reg;
|
||||
|
||||
clk_register_fixed_factor(NULL, "vco", pllsrc, 0, plln, pllm);
|
||||
clk_register_fixed_factor(NULL, "pll", "vco", 0, 1, pllp);
|
||||
clk_register_fixed_factor(NULL, "pll48", "vco", 0, 1, pllq);
|
||||
ret = clk_gate_ops.enable(hw);
|
||||
|
||||
ret = readl_relaxed_poll_timeout_atomic(base + STM32F4_RCC_CR, reg,
|
||||
reg & (1 << pll->bit_rdy_idx), 0, 10000);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void stm32f4_pll_disable(struct clk_hw *hw)
|
||||
{
|
||||
clk_gate_ops.disable(hw);
|
||||
}
|
||||
|
||||
static unsigned long stm32f4_pll_recalc(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_gate *gate = to_clk_gate(hw);
|
||||
struct stm32f4_pll *pll = to_stm32f4_pll(gate);
|
||||
unsigned long n;
|
||||
|
||||
n = (readl(base + pll->offset) >> 6) & 0x1ff;
|
||||
|
||||
return parent_rate * n;
|
||||
}
|
||||
|
||||
static long stm32f4_pll_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *prate)
|
||||
{
|
||||
struct clk_gate *gate = to_clk_gate(hw);
|
||||
struct stm32f4_pll *pll = to_stm32f4_pll(gate);
|
||||
unsigned long n;
|
||||
|
||||
n = rate / *prate;
|
||||
|
||||
if (n < pll->n_start)
|
||||
n = pll->n_start;
|
||||
else if (n > 432)
|
||||
n = 432;
|
||||
|
||||
return *prate * n;
|
||||
}
|
||||
|
||||
static int stm32f4_pll_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_gate *gate = to_clk_gate(hw);
|
||||
struct stm32f4_pll *pll = to_stm32f4_pll(gate);
|
||||
|
||||
unsigned long n;
|
||||
unsigned long val;
|
||||
int pll_state;
|
||||
|
||||
pll_state = stm32f4_pll_is_enabled(hw);
|
||||
|
||||
if (pll_state)
|
||||
stm32f4_pll_disable(hw);
|
||||
|
||||
n = rate / parent_rate;
|
||||
|
||||
val = readl(base + pll->offset) & ~(0x1ff << 6);
|
||||
|
||||
writel(val | ((n & 0x1ff) << 6), base + pll->offset);
|
||||
|
||||
if (pll_state)
|
||||
stm32f4_pll_enable(hw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clk_ops stm32f4_pll_gate_ops = {
|
||||
.enable = stm32f4_pll_enable,
|
||||
.disable = stm32f4_pll_disable,
|
||||
.is_enabled = stm32f4_pll_is_enabled,
|
||||
.recalc_rate = stm32f4_pll_recalc,
|
||||
.round_rate = stm32f4_pll_round_rate,
|
||||
.set_rate = stm32f4_pll_set_rate,
|
||||
};
|
||||
|
||||
struct stm32f4_pll_div {
|
||||
struct clk_divider div;
|
||||
struct clk_hw *hw_pll;
|
||||
};
|
||||
|
||||
#define to_pll_div_clk(_div) container_of(_div, struct stm32f4_pll_div, div)
|
||||
|
||||
static unsigned long stm32f4_pll_div_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
return clk_divider_ops.recalc_rate(hw, parent_rate);
|
||||
}
|
||||
|
||||
static long stm32f4_pll_div_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *prate)
|
||||
{
|
||||
return clk_divider_ops.round_rate(hw, rate, prate);
|
||||
}
|
||||
|
||||
static int stm32f4_pll_div_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
int pll_state, ret;
|
||||
|
||||
struct clk_divider *div = to_clk_divider(hw);
|
||||
struct stm32f4_pll_div *pll_div = to_pll_div_clk(div);
|
||||
|
||||
pll_state = stm32f4_pll_is_enabled(pll_div->hw_pll);
|
||||
|
||||
if (pll_state)
|
||||
stm32f4_pll_disable(pll_div->hw_pll);
|
||||
|
||||
ret = clk_divider_ops.set_rate(hw, rate, parent_rate);
|
||||
|
||||
if (pll_state)
|
||||
stm32f4_pll_enable(pll_div->hw_pll);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct clk_ops stm32f4_pll_div_ops = {
|
||||
.recalc_rate = stm32f4_pll_div_recalc_rate,
|
||||
.round_rate = stm32f4_pll_div_round_rate,
|
||||
.set_rate = stm32f4_pll_div_set_rate,
|
||||
};
|
||||
|
||||
static struct clk_hw *clk_register_pll_div(const char *name,
|
||||
const char *parent_name, unsigned long flags,
|
||||
void __iomem *reg, u8 shift, u8 width,
|
||||
u8 clk_divider_flags, const struct clk_div_table *table,
|
||||
struct clk_hw *pll_hw, spinlock_t *lock)
|
||||
{
|
||||
struct stm32f4_pll_div *pll_div;
|
||||
struct clk_hw *hw;
|
||||
struct clk_init_data init;
|
||||
int ret;
|
||||
|
||||
/* allocate the divider */
|
||||
pll_div = kzalloc(sizeof(*pll_div), GFP_KERNEL);
|
||||
if (!pll_div)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
init.name = name;
|
||||
init.ops = &stm32f4_pll_div_ops;
|
||||
init.flags = flags;
|
||||
init.parent_names = (parent_name ? &parent_name : NULL);
|
||||
init.num_parents = (parent_name ? 1 : 0);
|
||||
|
||||
/* struct clk_divider assignments */
|
||||
pll_div->div.reg = reg;
|
||||
pll_div->div.shift = shift;
|
||||
pll_div->div.width = width;
|
||||
pll_div->div.flags = clk_divider_flags;
|
||||
pll_div->div.lock = lock;
|
||||
pll_div->div.table = table;
|
||||
pll_div->div.hw.init = &init;
|
||||
|
||||
pll_div->hw_pll = pll_hw;
|
||||
|
||||
/* register the clock */
|
||||
hw = &pll_div->div.hw;
|
||||
ret = clk_hw_register(NULL, hw);
|
||||
if (ret) {
|
||||
kfree(pll_div);
|
||||
hw = ERR_PTR(ret);
|
||||
}
|
||||
|
||||
return hw;
|
||||
}
|
||||
|
||||
static struct clk_hw *stm32f4_rcc_register_pll(const char *pllsrc,
|
||||
const struct stm32f4_pll_data *data, spinlock_t *lock)
|
||||
{
|
||||
struct stm32f4_pll *pll;
|
||||
struct clk_init_data init = { NULL };
|
||||
void __iomem *reg;
|
||||
struct clk_hw *pll_hw;
|
||||
int ret;
|
||||
int i;
|
||||
const struct stm32f4_vco_data *vco;
|
||||
|
||||
|
||||
pll = kzalloc(sizeof(*pll), GFP_KERNEL);
|
||||
if (!pll)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
vco = &vco_data[data->pll_num];
|
||||
|
||||
init.name = vco->vco_name;
|
||||
init.ops = &stm32f4_pll_gate_ops;
|
||||
init.flags = CLK_SET_RATE_GATE;
|
||||
init.parent_names = &pllsrc;
|
||||
init.num_parents = 1;
|
||||
|
||||
pll->gate.lock = lock;
|
||||
pll->gate.reg = base + STM32F4_RCC_CR;
|
||||
pll->gate.bit_idx = vco->bit_idx;
|
||||
pll->gate.hw.init = &init;
|
||||
|
||||
pll->offset = vco->offset;
|
||||
pll->n_start = data->n_start;
|
||||
pll->bit_rdy_idx = vco->bit_rdy_idx;
|
||||
pll->status = (readl(base + STM32F4_RCC_CR) >> vco->bit_idx) & 0x1;
|
||||
|
||||
reg = base + pll->offset;
|
||||
|
||||
pll_hw = &pll->gate.hw;
|
||||
ret = clk_hw_register(NULL, pll_hw);
|
||||
if (ret) {
|
||||
kfree(pll);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_PLL_DIV; i++)
|
||||
if (data->div_name[i])
|
||||
clk_register_pll_div(data->div_name[i],
|
||||
vco->vco_name,
|
||||
0,
|
||||
reg,
|
||||
div_data[i].shift,
|
||||
div_data[i].width,
|
||||
div_data[i].flag_div,
|
||||
div_data[i].div_table,
|
||||
pll_hw,
|
||||
lock);
|
||||
return pll_hw;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -352,7 +766,7 @@ static int stm32f4_rcc_lookup_clk_idx(u8 primary, u8 secondary)
|
||||
u64 table[MAX_GATE_MAP];
|
||||
|
||||
if (primary == 1) {
|
||||
if (WARN_ON(secondary >= END_PRIMARY_CLK))
|
||||
if (WARN_ON(secondary >= stm32fx_end_primary_clk))
|
||||
return -EINVAL;
|
||||
return secondary;
|
||||
}
|
||||
@ -369,7 +783,7 @@ static int stm32f4_rcc_lookup_clk_idx(u8 primary, u8 secondary)
|
||||
table[BIT_ULL_WORD(secondary)] &=
|
||||
GENMASK_ULL(secondary % BITS_PER_LONG_LONG, 0);
|
||||
|
||||
return END_PRIMARY_CLK - 1 + hweight64(table[0]) +
|
||||
return stm32fx_end_primary_clk - 1 + hweight64(table[0]) +
|
||||
(BIT_ULL_WORD(secondary) >= 1 ? hweight64(table[1]) : 0) +
|
||||
(BIT_ULL_WORD(secondary) >= 2 ? hweight64(table[2]) : 0);
|
||||
}
|
||||
@ -611,22 +1025,291 @@ static const char *rtc_parents[4] = {
|
||||
"no-clock", "lse", "lsi", "hse-rtc"
|
||||
};
|
||||
|
||||
static const char *lcd_parent[1] = { "pllsai-r-div" };
|
||||
|
||||
static const char *i2s_parents[2] = { "plli2s-r", NULL };
|
||||
|
||||
static const char *sai_parents[4] = { "pllsai-q-div", "plli2s-q-div", NULL,
|
||||
"no-clock" };
|
||||
|
||||
static const char *pll48_parents[2] = { "pll-q", "pllsai-p" };
|
||||
|
||||
static const char *sdmux_parents[2] = { "pll48", "sys" };
|
||||
|
||||
static const char *hdmi_parents[2] = { "lse", "hsi_div488" };
|
||||
|
||||
static const char *spdif_parent[1] = { "plli2s-p" };
|
||||
|
||||
static const char *lptim_parent[4] = { "apb1_mul", "lsi", "hsi", "lse" };
|
||||
|
||||
static const char *uart_parents1[4] = { "apb2_div", "sys", "hsi", "lse" };
|
||||
static const char *uart_parents2[4] = { "apb1_div", "sys", "hsi", "lse" };
|
||||
|
||||
static const char *i2c_parents[4] = { "apb1_div", "sys", "hsi", "no-clock" };
|
||||
|
||||
struct stm32_aux_clk {
|
||||
int idx;
|
||||
const char *name;
|
||||
const char * const *parent_names;
|
||||
int num_parents;
|
||||
int offset_mux;
|
||||
u8 shift;
|
||||
u8 mask;
|
||||
int offset_gate;
|
||||
u8 bit_idx;
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
struct stm32f4_clk_data {
|
||||
const struct stm32f4_gate_data *gates_data;
|
||||
const u64 *gates_map;
|
||||
int gates_num;
|
||||
const struct stm32f4_pll_data *pll_data;
|
||||
const struct stm32_aux_clk *aux_clk;
|
||||
int aux_clk_num;
|
||||
int end_primary;
|
||||
};
|
||||
|
||||
static const struct stm32_aux_clk stm32f429_aux_clk[] = {
|
||||
{
|
||||
CLK_LCD, "lcd-tft", lcd_parent, ARRAY_SIZE(lcd_parent),
|
||||
NO_MUX, 0, 0,
|
||||
STM32F4_RCC_APB2ENR, 26,
|
||||
CLK_SET_RATE_PARENT
|
||||
},
|
||||
{
|
||||
CLK_I2S, "i2s", i2s_parents, ARRAY_SIZE(i2s_parents),
|
||||
STM32F4_RCC_CFGR, 23, 1,
|
||||
NO_GATE, 0,
|
||||
CLK_SET_RATE_PARENT
|
||||
},
|
||||
{
|
||||
CLK_SAI1, "sai1-a", sai_parents, ARRAY_SIZE(sai_parents),
|
||||
STM32F4_RCC_DCKCFGR, 20, 3,
|
||||
STM32F4_RCC_APB2ENR, 22,
|
||||
CLK_SET_RATE_PARENT
|
||||
},
|
||||
{
|
||||
CLK_SAI2, "sai1-b", sai_parents, ARRAY_SIZE(sai_parents),
|
||||
STM32F4_RCC_DCKCFGR, 22, 3,
|
||||
STM32F4_RCC_APB2ENR, 22,
|
||||
CLK_SET_RATE_PARENT
|
||||
},
|
||||
};
|
||||
|
||||
static const struct stm32_aux_clk stm32f469_aux_clk[] = {
|
||||
{
|
||||
CLK_LCD, "lcd-tft", lcd_parent, ARRAY_SIZE(lcd_parent),
|
||||
NO_MUX, 0, 0,
|
||||
STM32F4_RCC_APB2ENR, 26,
|
||||
CLK_SET_RATE_PARENT
|
||||
},
|
||||
{
|
||||
CLK_I2S, "i2s", i2s_parents, ARRAY_SIZE(i2s_parents),
|
||||
STM32F4_RCC_CFGR, 23, 1,
|
||||
NO_GATE, 0,
|
||||
CLK_SET_RATE_PARENT
|
||||
},
|
||||
{
|
||||
CLK_SAI1, "sai1-a", sai_parents, ARRAY_SIZE(sai_parents),
|
||||
STM32F4_RCC_DCKCFGR, 20, 3,
|
||||
STM32F4_RCC_APB2ENR, 22,
|
||||
CLK_SET_RATE_PARENT
|
||||
},
|
||||
{
|
||||
CLK_SAI2, "sai1-b", sai_parents, ARRAY_SIZE(sai_parents),
|
||||
STM32F4_RCC_DCKCFGR, 22, 3,
|
||||
STM32F4_RCC_APB2ENR, 22,
|
||||
CLK_SET_RATE_PARENT
|
||||
},
|
||||
{
|
||||
NO_IDX, "pll48", pll48_parents, ARRAY_SIZE(pll48_parents),
|
||||
STM32F4_RCC_DCKCFGR, 27, 1,
|
||||
NO_GATE, 0,
|
||||
0
|
||||
},
|
||||
{
|
||||
NO_IDX, "sdmux", sdmux_parents, ARRAY_SIZE(sdmux_parents),
|
||||
STM32F4_RCC_DCKCFGR, 28, 1,
|
||||
NO_GATE, 0,
|
||||
0
|
||||
},
|
||||
};
|
||||
|
||||
static const struct stm32_aux_clk stm32f746_aux_clk[] = {
|
||||
{
|
||||
CLK_LCD, "lcd-tft", lcd_parent, ARRAY_SIZE(lcd_parent),
|
||||
NO_MUX, 0, 0,
|
||||
STM32F4_RCC_APB2ENR, 26,
|
||||
CLK_SET_RATE_PARENT
|
||||
},
|
||||
{
|
||||
CLK_I2S, "i2s", i2s_parents, ARRAY_SIZE(i2s_parents),
|
||||
STM32F4_RCC_CFGR, 23, 1,
|
||||
NO_GATE, 0,
|
||||
CLK_SET_RATE_PARENT
|
||||
},
|
||||
{
|
||||
CLK_SAI1, "sai1_clk", sai_parents, ARRAY_SIZE(sai_parents),
|
||||
STM32F4_RCC_DCKCFGR, 20, 3,
|
||||
STM32F4_RCC_APB2ENR, 22,
|
||||
CLK_SET_RATE_PARENT
|
||||
},
|
||||
{
|
||||
CLK_SAI2, "sai2_clk", sai_parents, ARRAY_SIZE(sai_parents),
|
||||
STM32F4_RCC_DCKCFGR, 22, 3,
|
||||
STM32F4_RCC_APB2ENR, 23,
|
||||
CLK_SET_RATE_PARENT
|
||||
},
|
||||
{
|
||||
NO_IDX, "pll48", pll48_parents, ARRAY_SIZE(pll48_parents),
|
||||
STM32F7_RCC_DCKCFGR2, 27, 1,
|
||||
NO_GATE, 0,
|
||||
0
|
||||
},
|
||||
{
|
||||
NO_IDX, "sdmux", sdmux_parents, ARRAY_SIZE(sdmux_parents),
|
||||
STM32F7_RCC_DCKCFGR2, 28, 1,
|
||||
NO_GATE, 0,
|
||||
0
|
||||
},
|
||||
{
|
||||
CLK_HDMI_CEC, "hdmi-cec",
|
||||
hdmi_parents, ARRAY_SIZE(hdmi_parents),
|
||||
STM32F7_RCC_DCKCFGR2, 26, 1,
|
||||
NO_GATE, 0,
|
||||
0
|
||||
},
|
||||
{
|
||||
CLK_SPDIF, "spdif-rx",
|
||||
spdif_parent, ARRAY_SIZE(spdif_parent),
|
||||
STM32F7_RCC_DCKCFGR2, 22, 3,
|
||||
STM32F4_RCC_APB2ENR, 23,
|
||||
CLK_SET_RATE_PARENT
|
||||
},
|
||||
{
|
||||
CLK_USART1, "usart1",
|
||||
uart_parents1, ARRAY_SIZE(uart_parents1),
|
||||
STM32F7_RCC_DCKCFGR2, 0, 3,
|
||||
STM32F4_RCC_APB2ENR, 4,
|
||||
CLK_SET_RATE_PARENT,
|
||||
},
|
||||
{
|
||||
CLK_USART2, "usart2",
|
||||
uart_parents2, ARRAY_SIZE(uart_parents1),
|
||||
STM32F7_RCC_DCKCFGR2, 2, 3,
|
||||
STM32F4_RCC_APB1ENR, 17,
|
||||
CLK_SET_RATE_PARENT,
|
||||
},
|
||||
{
|
||||
CLK_USART3, "usart3",
|
||||
uart_parents2, ARRAY_SIZE(uart_parents1),
|
||||
STM32F7_RCC_DCKCFGR2, 4, 3,
|
||||
STM32F4_RCC_APB1ENR, 18,
|
||||
CLK_SET_RATE_PARENT,
|
||||
},
|
||||
{
|
||||
CLK_UART4, "uart4",
|
||||
uart_parents2, ARRAY_SIZE(uart_parents1),
|
||||
STM32F7_RCC_DCKCFGR2, 6, 3,
|
||||
STM32F4_RCC_APB1ENR, 19,
|
||||
CLK_SET_RATE_PARENT,
|
||||
},
|
||||
{
|
||||
CLK_UART5, "uart5",
|
||||
uart_parents2, ARRAY_SIZE(uart_parents1),
|
||||
STM32F7_RCC_DCKCFGR2, 8, 3,
|
||||
STM32F4_RCC_APB1ENR, 20,
|
||||
CLK_SET_RATE_PARENT,
|
||||
},
|
||||
{
|
||||
CLK_USART6, "usart6",
|
||||
uart_parents1, ARRAY_SIZE(uart_parents1),
|
||||
STM32F7_RCC_DCKCFGR2, 10, 3,
|
||||
STM32F4_RCC_APB2ENR, 5,
|
||||
CLK_SET_RATE_PARENT,
|
||||
},
|
||||
|
||||
{
|
||||
CLK_UART7, "uart7",
|
||||
uart_parents2, ARRAY_SIZE(uart_parents1),
|
||||
STM32F7_RCC_DCKCFGR2, 12, 3,
|
||||
STM32F4_RCC_APB1ENR, 30,
|
||||
CLK_SET_RATE_PARENT,
|
||||
},
|
||||
{
|
||||
CLK_UART8, "uart8",
|
||||
uart_parents2, ARRAY_SIZE(uart_parents1),
|
||||
STM32F7_RCC_DCKCFGR2, 14, 3,
|
||||
STM32F4_RCC_APB1ENR, 31,
|
||||
CLK_SET_RATE_PARENT,
|
||||
},
|
||||
{
|
||||
CLK_I2C1, "i2c1",
|
||||
i2c_parents, ARRAY_SIZE(i2c_parents),
|
||||
STM32F7_RCC_DCKCFGR2, 16, 3,
|
||||
STM32F4_RCC_APB1ENR, 21,
|
||||
CLK_SET_RATE_PARENT,
|
||||
},
|
||||
{
|
||||
CLK_I2C2, "i2c2",
|
||||
i2c_parents, ARRAY_SIZE(i2c_parents),
|
||||
STM32F7_RCC_DCKCFGR2, 18, 3,
|
||||
STM32F4_RCC_APB1ENR, 22,
|
||||
CLK_SET_RATE_PARENT,
|
||||
},
|
||||
{
|
||||
CLK_I2C3, "i2c3",
|
||||
i2c_parents, ARRAY_SIZE(i2c_parents),
|
||||
STM32F7_RCC_DCKCFGR2, 20, 3,
|
||||
STM32F4_RCC_APB1ENR, 23,
|
||||
CLK_SET_RATE_PARENT,
|
||||
},
|
||||
{
|
||||
CLK_I2C4, "i2c4",
|
||||
i2c_parents, ARRAY_SIZE(i2c_parents),
|
||||
STM32F7_RCC_DCKCFGR2, 22, 3,
|
||||
STM32F4_RCC_APB1ENR, 24,
|
||||
CLK_SET_RATE_PARENT,
|
||||
},
|
||||
|
||||
{
|
||||
CLK_LPTIMER, "lptim1",
|
||||
lptim_parent, ARRAY_SIZE(lptim_parent),
|
||||
STM32F7_RCC_DCKCFGR2, 24, 3,
|
||||
STM32F4_RCC_APB1ENR, 9,
|
||||
CLK_SET_RATE_PARENT
|
||||
},
|
||||
};
|
||||
|
||||
static const struct stm32f4_clk_data stm32f429_clk_data = {
|
||||
.end_primary = END_PRIMARY_CLK,
|
||||
.gates_data = stm32f429_gates,
|
||||
.gates_map = stm32f42xx_gate_map,
|
||||
.gates_num = ARRAY_SIZE(stm32f429_gates),
|
||||
.pll_data = stm32f429_pll,
|
||||
.aux_clk = stm32f429_aux_clk,
|
||||
.aux_clk_num = ARRAY_SIZE(stm32f429_aux_clk),
|
||||
};
|
||||
|
||||
static const struct stm32f4_clk_data stm32f469_clk_data = {
|
||||
.end_primary = END_PRIMARY_CLK,
|
||||
.gates_data = stm32f469_gates,
|
||||
.gates_map = stm32f46xx_gate_map,
|
||||
.gates_num = ARRAY_SIZE(stm32f469_gates),
|
||||
.pll_data = stm32f469_pll,
|
||||
.aux_clk = stm32f469_aux_clk,
|
||||
.aux_clk_num = ARRAY_SIZE(stm32f469_aux_clk),
|
||||
};
|
||||
|
||||
static const struct stm32f4_clk_data stm32f746_clk_data = {
|
||||
.end_primary = END_PRIMARY_CLK_F7,
|
||||
.gates_data = stm32f746_gates,
|
||||
.gates_map = stm32f746_gate_map,
|
||||
.gates_num = ARRAY_SIZE(stm32f746_gates),
|
||||
.pll_data = stm32f469_pll,
|
||||
.aux_clk = stm32f746_aux_clk,
|
||||
.aux_clk_num = ARRAY_SIZE(stm32f746_aux_clk),
|
||||
};
|
||||
|
||||
static const struct of_device_id stm32f4_of_match[] = {
|
||||
@ -638,15 +1321,84 @@ static const struct of_device_id stm32f4_of_match[] = {
|
||||
.compatible = "st,stm32f469-rcc",
|
||||
.data = &stm32f469_clk_data
|
||||
},
|
||||
{
|
||||
.compatible = "st,stm32f746-rcc",
|
||||
.data = &stm32f746_clk_data
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct clk_hw *stm32_register_aux_clk(const char *name,
|
||||
const char * const *parent_names, int num_parents,
|
||||
int offset_mux, u8 shift, u8 mask,
|
||||
int offset_gate, u8 bit_idx,
|
||||
unsigned long flags, spinlock_t *lock)
|
||||
{
|
||||
struct clk_hw *hw;
|
||||
struct clk_gate *gate = NULL;
|
||||
struct clk_mux *mux = NULL;
|
||||
struct clk_hw *mux_hw = NULL, *gate_hw = NULL;
|
||||
const struct clk_ops *mux_ops = NULL, *gate_ops = NULL;
|
||||
|
||||
if (offset_gate != NO_GATE) {
|
||||
gate = kzalloc(sizeof(*gate), GFP_KERNEL);
|
||||
if (!gate) {
|
||||
hw = ERR_PTR(-EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
gate->reg = base + offset_gate;
|
||||
gate->bit_idx = bit_idx;
|
||||
gate->flags = 0;
|
||||
gate->lock = lock;
|
||||
gate_hw = &gate->hw;
|
||||
gate_ops = &clk_gate_ops;
|
||||
}
|
||||
|
||||
if (offset_mux != NO_MUX) {
|
||||
mux = kzalloc(sizeof(*mux), GFP_KERNEL);
|
||||
if (!mux) {
|
||||
hw = ERR_PTR(-EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
mux->reg = base + offset_mux;
|
||||
mux->shift = shift;
|
||||
mux->mask = mask;
|
||||
mux->flags = 0;
|
||||
mux_hw = &mux->hw;
|
||||
mux_ops = &clk_mux_ops;
|
||||
}
|
||||
|
||||
if (mux_hw == NULL && gate_hw == NULL) {
|
||||
hw = ERR_PTR(-EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hw = clk_hw_register_composite(NULL, name, parent_names, num_parents,
|
||||
mux_hw, mux_ops,
|
||||
NULL, NULL,
|
||||
gate_hw, gate_ops,
|
||||
flags);
|
||||
|
||||
fail:
|
||||
if (IS_ERR(hw)) {
|
||||
kfree(gate);
|
||||
kfree(mux);
|
||||
}
|
||||
|
||||
return hw;
|
||||
}
|
||||
|
||||
static void __init stm32f4_rcc_init(struct device_node *np)
|
||||
{
|
||||
const char *hse_clk;
|
||||
const char *hse_clk, *i2s_in_clk;
|
||||
int n;
|
||||
const struct of_device_id *match;
|
||||
const struct stm32f4_clk_data *data;
|
||||
unsigned long pllcfgr;
|
||||
const char *pllsrc;
|
||||
unsigned long pllm;
|
||||
|
||||
base = of_iomap(np, 0);
|
||||
if (!base) {
|
||||
@ -666,7 +1418,9 @@ static void __init stm32f4_rcc_init(struct device_node *np)
|
||||
|
||||
data = match->data;
|
||||
|
||||
clks = kmalloc_array(data->gates_num + END_PRIMARY_CLK,
|
||||
stm32fx_end_primary_clk = data->end_primary;
|
||||
|
||||
clks = kmalloc_array(data->gates_num + stm32fx_end_primary_clk,
|
||||
sizeof(*clks), GFP_KERNEL);
|
||||
if (!clks)
|
||||
goto fail;
|
||||
@ -675,12 +1429,54 @@ static void __init stm32f4_rcc_init(struct device_node *np)
|
||||
|
||||
hse_clk = of_clk_get_parent_name(np, 0);
|
||||
|
||||
clk_register_fixed_rate_with_accuracy(NULL, "hsi", NULL, 0,
|
||||
16000000, 160000);
|
||||
stm32f4_rcc_register_pll(hse_clk, "hsi");
|
||||
i2s_in_clk = of_clk_get_parent_name(np, 1);
|
||||
|
||||
i2s_parents[1] = i2s_in_clk;
|
||||
sai_parents[2] = i2s_in_clk;
|
||||
|
||||
clks[CLK_HSI] = clk_hw_register_fixed_rate_with_accuracy(NULL, "hsi",
|
||||
NULL, 0, 16000000, 160000);
|
||||
|
||||
pllcfgr = readl(base + STM32F4_RCC_PLLCFGR);
|
||||
pllsrc = pllcfgr & BIT(22) ? hse_clk : "hsi";
|
||||
pllm = pllcfgr & 0x3f;
|
||||
|
||||
clk_hw_register_fixed_factor(NULL, "vco_in", pllsrc,
|
||||
0, 1, pllm);
|
||||
|
||||
stm32f4_rcc_register_pll("vco_in", &data->pll_data[0],
|
||||
&stm32f4_clk_lock);
|
||||
|
||||
clks[PLL_VCO_I2S] = stm32f4_rcc_register_pll("vco_in",
|
||||
&data->pll_data[1], &stm32f4_clk_lock);
|
||||
|
||||
clks[PLL_VCO_SAI] = stm32f4_rcc_register_pll("vco_in",
|
||||
&data->pll_data[2], &stm32f4_clk_lock);
|
||||
|
||||
for (n = 0; n < MAX_POST_DIV; n++) {
|
||||
const struct stm32f4_pll_post_div_data *post_div;
|
||||
struct clk_hw *hw;
|
||||
|
||||
post_div = &post_div_data[n];
|
||||
|
||||
hw = clk_register_pll_div(post_div->name,
|
||||
post_div->parent,
|
||||
post_div->flag,
|
||||
base + post_div->offset,
|
||||
post_div->shift,
|
||||
post_div->width,
|
||||
post_div->flag_div,
|
||||
post_div->div_table,
|
||||
clks[post_div->pll_num],
|
||||
&stm32f4_clk_lock);
|
||||
|
||||
if (post_div->idx != NO_IDX)
|
||||
clks[post_div->idx] = hw;
|
||||
}
|
||||
|
||||
sys_parents[1] = hse_clk;
|
||||
clk_register_mux_table(
|
||||
|
||||
clks[CLK_SYSCLK] = clk_hw_register_mux_table(
|
||||
NULL, "sys", sys_parents, ARRAY_SIZE(sys_parents), 0,
|
||||
base + STM32F4_RCC_CFGR, 0, 3, 0, NULL, &stm32f4_clk_lock);
|
||||
|
||||
@ -762,6 +1558,33 @@ static void __init stm32f4_rcc_init(struct device_node *np)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (n = 0; n < data->aux_clk_num; n++) {
|
||||
const struct stm32_aux_clk *aux_clk;
|
||||
struct clk_hw *hw;
|
||||
|
||||
aux_clk = &data->aux_clk[n];
|
||||
|
||||
hw = stm32_register_aux_clk(aux_clk->name,
|
||||
aux_clk->parent_names, aux_clk->num_parents,
|
||||
aux_clk->offset_mux, aux_clk->shift,
|
||||
aux_clk->mask, aux_clk->offset_gate,
|
||||
aux_clk->bit_idx, aux_clk->flags,
|
||||
&stm32f4_clk_lock);
|
||||
|
||||
if (IS_ERR(hw)) {
|
||||
pr_warn("Unable to register %s clk\n", aux_clk->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (aux_clk->idx != NO_IDX)
|
||||
clks[aux_clk->idx] = hw;
|
||||
}
|
||||
|
||||
if (of_device_is_compatible(np, "st,stm32f746-rcc"))
|
||||
|
||||
clk_hw_register_fixed_factor(NULL, "hsi_div488", "hsi", 0,
|
||||
1, 488);
|
||||
|
||||
of_clk_add_hw_provider(np, stm32f4_rcc_lookup_clk, NULL);
|
||||
return;
|
||||
fail:
|
||||
@ -770,3 +1593,4 @@ fail:
|
||||
}
|
||||
CLK_OF_DECLARE_DRIVER(stm32f42xx_rcc, "st,stm32f42xx-rcc", stm32f4_rcc_init);
|
||||
CLK_OF_DECLARE_DRIVER(stm32f46xx_rcc, "st,stm32f469-rcc", stm32f4_rcc_init);
|
||||
CLK_OF_DECLARE_DRIVER(stm32f746_rcc, "st,stm32f746-rcc", stm32f4_rcc_init);
|
||||
|
791
drivers/clk/clk-versaclock5.c
Normal file
791
drivers/clk/clk-versaclock5.c
Normal file
@ -0,0 +1,791 @@
|
||||
/*
|
||||
* Driver for IDT Versaclock 5
|
||||
*
|
||||
* Copyright (C) 2017 Marek Vasut <marek.vasut@gmail.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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Possible optimizations:
|
||||
* - Use spread spectrum
|
||||
* - Use integer divider in FOD if applicable
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/rational.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
/* VersaClock5 registers */
|
||||
#define VC5_OTP_CONTROL 0x00
|
||||
|
||||
/* Factory-reserved register block */
|
||||
#define VC5_RSVD_DEVICE_ID 0x01
|
||||
#define VC5_RSVD_ADC_GAIN_7_0 0x02
|
||||
#define VC5_RSVD_ADC_GAIN_15_8 0x03
|
||||
#define VC5_RSVD_ADC_OFFSET_7_0 0x04
|
||||
#define VC5_RSVD_ADC_OFFSET_15_8 0x05
|
||||
#define VC5_RSVD_TEMPY 0x06
|
||||
#define VC5_RSVD_OFFSET_TBIN 0x07
|
||||
#define VC5_RSVD_GAIN 0x08
|
||||
#define VC5_RSVD_TEST_NP 0x09
|
||||
#define VC5_RSVD_UNUSED 0x0a
|
||||
#define VC5_RSVD_BANDGAP_TRIM_UP 0x0b
|
||||
#define VC5_RSVD_BANDGAP_TRIM_DN 0x0c
|
||||
#define VC5_RSVD_CLK_R_12_CLK_AMP_4 0x0d
|
||||
#define VC5_RSVD_CLK_R_34_CLK_AMP_4 0x0e
|
||||
#define VC5_RSVD_CLK_AMP_123 0x0f
|
||||
|
||||
/* Configuration register block */
|
||||
#define VC5_PRIM_SRC_SHDN 0x10
|
||||
#define VC5_PRIM_SRC_SHDN_EN_XTAL BIT(7)
|
||||
#define VC5_PRIM_SRC_SHDN_EN_CLKIN BIT(6)
|
||||
#define VC5_PRIM_SRC_SHDN_SP BIT(1)
|
||||
#define VC5_PRIM_SRC_SHDN_EN_GBL_SHDN BIT(0)
|
||||
|
||||
#define VC5_VCO_BAND 0x11
|
||||
#define VC5_XTAL_X1_LOAD_CAP 0x12
|
||||
#define VC5_XTAL_X2_LOAD_CAP 0x13
|
||||
#define VC5_REF_DIVIDER 0x15
|
||||
#define VC5_REF_DIVIDER_SEL_PREDIV2 BIT(7)
|
||||
#define VC5_REF_DIVIDER_REF_DIV(n) ((n) & 0x3f)
|
||||
|
||||
#define VC5_VCO_CTRL_AND_PREDIV 0x16
|
||||
#define VC5_VCO_CTRL_AND_PREDIV_BYPASS_PREDIV BIT(7)
|
||||
|
||||
#define VC5_FEEDBACK_INT_DIV 0x17
|
||||
#define VC5_FEEDBACK_INT_DIV_BITS 0x18
|
||||
#define VC5_FEEDBACK_FRAC_DIV(n) (0x19 + (n))
|
||||
#define VC5_RC_CONTROL0 0x1e
|
||||
#define VC5_RC_CONTROL1 0x1f
|
||||
/* Register 0x20 is factory reserved */
|
||||
|
||||
/* Output divider control for divider 1,2,3,4 */
|
||||
#define VC5_OUT_DIV_CONTROL(idx) (0x21 + ((idx) * 0x10))
|
||||
#define VC5_OUT_DIV_CONTROL_RESET BIT(7)
|
||||
#define VC5_OUT_DIV_CONTROL_SELB_NORM BIT(3)
|
||||
#define VC5_OUT_DIV_CONTROL_SEL_EXT BIT(2)
|
||||
#define VC5_OUT_DIV_CONTROL_INT_MODE BIT(1)
|
||||
#define VC5_OUT_DIV_CONTROL_EN_FOD BIT(0)
|
||||
|
||||
#define VC5_OUT_DIV_FRAC(idx, n) (0x22 + ((idx) * 0x10) + (n))
|
||||
#define VC5_OUT_DIV_FRAC4_OD_SCEE BIT(1)
|
||||
|
||||
#define VC5_OUT_DIV_STEP_SPREAD(idx, n) (0x26 + ((idx) * 0x10) + (n))
|
||||
#define VC5_OUT_DIV_SPREAD_MOD(idx, n) (0x29 + ((idx) * 0x10) + (n))
|
||||
#define VC5_OUT_DIV_SKEW_INT(idx, n) (0x2b + ((idx) * 0x10) + (n))
|
||||
#define VC5_OUT_DIV_INT(idx, n) (0x2d + ((idx) * 0x10) + (n))
|
||||
#define VC5_OUT_DIV_SKEW_FRAC(idx) (0x2f + ((idx) * 0x10))
|
||||
/* Registers 0x30, 0x40, 0x50 are factory reserved */
|
||||
|
||||
/* Clock control register for clock 1,2 */
|
||||
#define VC5_CLK_OUTPUT_CFG(idx, n) (0x60 + ((idx) * 0x2) + (n))
|
||||
#define VC5_CLK_OUTPUT_CFG1_EN_CLKBUF BIT(0)
|
||||
|
||||
#define VC5_CLK_OE_SHDN 0x68
|
||||
#define VC5_CLK_OS_SHDN 0x69
|
||||
|
||||
#define VC5_GLOBAL_REGISTER 0x76
|
||||
#define VC5_GLOBAL_REGISTER_GLOBAL_RESET BIT(5)
|
||||
|
||||
/* PLL/VCO runs between 2.5 GHz and 3.0 GHz */
|
||||
#define VC5_PLL_VCO_MIN 2500000000UL
|
||||
#define VC5_PLL_VCO_MAX 3000000000UL
|
||||
|
||||
/* VC5 Input mux settings */
|
||||
#define VC5_MUX_IN_XIN BIT(0)
|
||||
#define VC5_MUX_IN_CLKIN BIT(1)
|
||||
|
||||
/* Supported IDT VC5 models. */
|
||||
enum vc5_model {
|
||||
IDT_VC5_5P49V5923,
|
||||
IDT_VC5_5P49V5933,
|
||||
};
|
||||
|
||||
struct vc5_driver_data;
|
||||
|
||||
struct vc5_hw_data {
|
||||
struct clk_hw hw;
|
||||
struct vc5_driver_data *vc5;
|
||||
u32 div_int;
|
||||
u32 div_frc;
|
||||
unsigned int num;
|
||||
};
|
||||
|
||||
struct vc5_driver_data {
|
||||
struct i2c_client *client;
|
||||
struct regmap *regmap;
|
||||
enum vc5_model model;
|
||||
|
||||
struct clk *pin_xin;
|
||||
struct clk *pin_clkin;
|
||||
unsigned char clk_mux_ins;
|
||||
struct clk_hw clk_mux;
|
||||
struct vc5_hw_data clk_pll;
|
||||
struct vc5_hw_data clk_fod[2];
|
||||
struct vc5_hw_data clk_out[3];
|
||||
};
|
||||
|
||||
static const char * const vc5_mux_names[] = {
|
||||
"mux"
|
||||
};
|
||||
|
||||
static const char * const vc5_pll_names[] = {
|
||||
"pll"
|
||||
};
|
||||
|
||||
static const char * const vc5_fod_names[] = {
|
||||
"fod0", "fod1", "fod2", "fod3",
|
||||
};
|
||||
|
||||
static const char * const vc5_clk_out_names[] = {
|
||||
"out0_sel_i2cb", "out1", "out2", "out3", "out4",
|
||||
};
|
||||
|
||||
/*
|
||||
* VersaClock5 i2c regmap
|
||||
*/
|
||||
static bool vc5_regmap_is_writeable(struct device *dev, unsigned int reg)
|
||||
{
|
||||
/* Factory reserved regs, make them read-only */
|
||||
if (reg <= 0xf)
|
||||
return false;
|
||||
|
||||
/* Factory reserved regs, make them read-only */
|
||||
if (reg == 0x14 || reg == 0x1c || reg == 0x1d)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static const struct regmap_config vc5_regmap_config = {
|
||||
.reg_bits = 8,
|
||||
.val_bits = 8,
|
||||
.cache_type = REGCACHE_RBTREE,
|
||||
.max_register = 0x76,
|
||||
.writeable_reg = vc5_regmap_is_writeable,
|
||||
};
|
||||
|
||||
/*
|
||||
* VersaClock5 input multiplexer between XTAL and CLKIN divider
|
||||
*/
|
||||
static unsigned char vc5_mux_get_parent(struct clk_hw *hw)
|
||||
{
|
||||
struct vc5_driver_data *vc5 =
|
||||
container_of(hw, struct vc5_driver_data, clk_mux);
|
||||
const u8 mask = VC5_PRIM_SRC_SHDN_EN_XTAL | VC5_PRIM_SRC_SHDN_EN_CLKIN;
|
||||
unsigned int src;
|
||||
|
||||
regmap_read(vc5->regmap, VC5_PRIM_SRC_SHDN, &src);
|
||||
src &= mask;
|
||||
|
||||
if (src == VC5_PRIM_SRC_SHDN_EN_XTAL)
|
||||
return 0;
|
||||
|
||||
if (src == VC5_PRIM_SRC_SHDN_EN_CLKIN)
|
||||
return 1;
|
||||
|
||||
dev_warn(&vc5->client->dev,
|
||||
"Invalid clock input configuration (%02x)\n", src);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vc5_mux_set_parent(struct clk_hw *hw, u8 index)
|
||||
{
|
||||
struct vc5_driver_data *vc5 =
|
||||
container_of(hw, struct vc5_driver_data, clk_mux);
|
||||
const u8 mask = VC5_PRIM_SRC_SHDN_EN_XTAL | VC5_PRIM_SRC_SHDN_EN_CLKIN;
|
||||
u8 src;
|
||||
|
||||
if ((index > 1) || !vc5->clk_mux_ins)
|
||||
return -EINVAL;
|
||||
|
||||
if (vc5->clk_mux_ins == (VC5_MUX_IN_CLKIN | VC5_MUX_IN_XIN)) {
|
||||
if (index == 0)
|
||||
src = VC5_PRIM_SRC_SHDN_EN_XTAL;
|
||||
if (index == 1)
|
||||
src = VC5_PRIM_SRC_SHDN_EN_CLKIN;
|
||||
} else {
|
||||
if (index != 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (vc5->clk_mux_ins == VC5_MUX_IN_XIN)
|
||||
src = VC5_PRIM_SRC_SHDN_EN_XTAL;
|
||||
if (vc5->clk_mux_ins == VC5_MUX_IN_CLKIN)
|
||||
src = VC5_PRIM_SRC_SHDN_EN_CLKIN;
|
||||
}
|
||||
|
||||
return regmap_update_bits(vc5->regmap, VC5_PRIM_SRC_SHDN, mask, src);
|
||||
}
|
||||
|
||||
static unsigned long vc5_mux_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct vc5_driver_data *vc5 =
|
||||
container_of(hw, struct vc5_driver_data, clk_mux);
|
||||
unsigned int prediv, div;
|
||||
|
||||
regmap_read(vc5->regmap, VC5_VCO_CTRL_AND_PREDIV, &prediv);
|
||||
|
||||
/* The bypass_prediv is set, PLL fed from Ref_in directly. */
|
||||
if (prediv & VC5_VCO_CTRL_AND_PREDIV_BYPASS_PREDIV)
|
||||
return parent_rate;
|
||||
|
||||
regmap_read(vc5->regmap, VC5_REF_DIVIDER, &div);
|
||||
|
||||
/* The Sel_prediv2 is set, PLL fed from prediv2 (Ref_in / 2) */
|
||||
if (div & VC5_REF_DIVIDER_SEL_PREDIV2)
|
||||
return parent_rate / 2;
|
||||
else
|
||||
return parent_rate / VC5_REF_DIVIDER_REF_DIV(div);
|
||||
}
|
||||
|
||||
static long vc5_mux_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *parent_rate)
|
||||
{
|
||||
unsigned long idiv;
|
||||
|
||||
/* PLL cannot operate with input clock above 50 MHz. */
|
||||
if (rate > 50000000)
|
||||
return -EINVAL;
|
||||
|
||||
/* CLKIN within range of PLL input, feed directly to PLL. */
|
||||
if (*parent_rate <= 50000000)
|
||||
return *parent_rate;
|
||||
|
||||
idiv = DIV_ROUND_UP(*parent_rate, rate);
|
||||
if (idiv > 127)
|
||||
return -EINVAL;
|
||||
|
||||
return *parent_rate / idiv;
|
||||
}
|
||||
|
||||
static int vc5_mux_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct vc5_driver_data *vc5 =
|
||||
container_of(hw, struct vc5_driver_data, clk_mux);
|
||||
unsigned long idiv;
|
||||
u8 div;
|
||||
|
||||
/* CLKIN within range of PLL input, feed directly to PLL. */
|
||||
if (parent_rate <= 50000000) {
|
||||
regmap_update_bits(vc5->regmap, VC5_VCO_CTRL_AND_PREDIV,
|
||||
VC5_VCO_CTRL_AND_PREDIV_BYPASS_PREDIV,
|
||||
VC5_VCO_CTRL_AND_PREDIV_BYPASS_PREDIV);
|
||||
regmap_update_bits(vc5->regmap, VC5_REF_DIVIDER, 0xff, 0x00);
|
||||
return 0;
|
||||
}
|
||||
|
||||
idiv = DIV_ROUND_UP(parent_rate, rate);
|
||||
|
||||
/* We have dedicated div-2 predivider. */
|
||||
if (idiv == 2)
|
||||
div = VC5_REF_DIVIDER_SEL_PREDIV2;
|
||||
else
|
||||
div = VC5_REF_DIVIDER_REF_DIV(idiv);
|
||||
|
||||
regmap_update_bits(vc5->regmap, VC5_REF_DIVIDER, 0xff, div);
|
||||
regmap_update_bits(vc5->regmap, VC5_VCO_CTRL_AND_PREDIV,
|
||||
VC5_VCO_CTRL_AND_PREDIV_BYPASS_PREDIV, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clk_ops vc5_mux_ops = {
|
||||
.set_parent = vc5_mux_set_parent,
|
||||
.get_parent = vc5_mux_get_parent,
|
||||
.recalc_rate = vc5_mux_recalc_rate,
|
||||
.round_rate = vc5_mux_round_rate,
|
||||
.set_rate = vc5_mux_set_rate,
|
||||
};
|
||||
|
||||
/*
|
||||
* VersaClock5 PLL/VCO
|
||||
*/
|
||||
static unsigned long vc5_pll_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct vc5_hw_data *hwdata = container_of(hw, struct vc5_hw_data, hw);
|
||||
struct vc5_driver_data *vc5 = hwdata->vc5;
|
||||
u32 div_int, div_frc;
|
||||
u8 fb[5];
|
||||
|
||||
regmap_bulk_read(vc5->regmap, VC5_FEEDBACK_INT_DIV, fb, 5);
|
||||
|
||||
div_int = (fb[0] << 4) | (fb[1] >> 4);
|
||||
div_frc = (fb[2] << 16) | (fb[3] << 8) | fb[4];
|
||||
|
||||
/* The PLL divider has 12 integer bits and 24 fractional bits */
|
||||
return (parent_rate * div_int) + ((parent_rate * div_frc) >> 24);
|
||||
}
|
||||
|
||||
static long vc5_pll_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *parent_rate)
|
||||
{
|
||||
struct vc5_hw_data *hwdata = container_of(hw, struct vc5_hw_data, hw);
|
||||
u32 div_int;
|
||||
u64 div_frc;
|
||||
|
||||
if (rate < VC5_PLL_VCO_MIN)
|
||||
rate = VC5_PLL_VCO_MIN;
|
||||
if (rate > VC5_PLL_VCO_MAX)
|
||||
rate = VC5_PLL_VCO_MAX;
|
||||
|
||||
/* Determine integer part, which is 12 bit wide */
|
||||
div_int = rate / *parent_rate;
|
||||
if (div_int > 0xfff)
|
||||
rate = *parent_rate * 0xfff;
|
||||
|
||||
/* Determine best fractional part, which is 24 bit wide */
|
||||
div_frc = rate % *parent_rate;
|
||||
div_frc *= BIT(24) - 1;
|
||||
do_div(div_frc, *parent_rate);
|
||||
|
||||
hwdata->div_int = div_int;
|
||||
hwdata->div_frc = (u32)div_frc;
|
||||
|
||||
return (*parent_rate * div_int) + ((*parent_rate * div_frc) >> 24);
|
||||
}
|
||||
|
||||
static int vc5_pll_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct vc5_hw_data *hwdata = container_of(hw, struct vc5_hw_data, hw);
|
||||
struct vc5_driver_data *vc5 = hwdata->vc5;
|
||||
u8 fb[5];
|
||||
|
||||
fb[0] = hwdata->div_int >> 4;
|
||||
fb[1] = hwdata->div_int << 4;
|
||||
fb[2] = hwdata->div_frc >> 16;
|
||||
fb[3] = hwdata->div_frc >> 8;
|
||||
fb[4] = hwdata->div_frc;
|
||||
|
||||
return regmap_bulk_write(vc5->regmap, VC5_FEEDBACK_INT_DIV, fb, 5);
|
||||
}
|
||||
|
||||
static const struct clk_ops vc5_pll_ops = {
|
||||
.recalc_rate = vc5_pll_recalc_rate,
|
||||
.round_rate = vc5_pll_round_rate,
|
||||
.set_rate = vc5_pll_set_rate,
|
||||
};
|
||||
|
||||
static unsigned long vc5_fod_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct vc5_hw_data *hwdata = container_of(hw, struct vc5_hw_data, hw);
|
||||
struct vc5_driver_data *vc5 = hwdata->vc5;
|
||||
/* VCO frequency is divided by two before entering FOD */
|
||||
u32 f_in = parent_rate / 2;
|
||||
u32 div_int, div_frc;
|
||||
u8 od_int[2];
|
||||
u8 od_frc[4];
|
||||
|
||||
regmap_bulk_read(vc5->regmap, VC5_OUT_DIV_INT(hwdata->num, 0),
|
||||
od_int, 2);
|
||||
regmap_bulk_read(vc5->regmap, VC5_OUT_DIV_FRAC(hwdata->num, 0),
|
||||
od_frc, 4);
|
||||
|
||||
div_int = (od_int[0] << 4) | (od_int[1] >> 4);
|
||||
div_frc = (od_frc[0] << 22) | (od_frc[1] << 14) |
|
||||
(od_frc[2] << 6) | (od_frc[3] >> 2);
|
||||
|
||||
/* The PLL divider has 12 integer bits and 30 fractional bits */
|
||||
return div64_u64((u64)f_in << 24ULL, ((u64)div_int << 24ULL) + div_frc);
|
||||
}
|
||||
|
||||
static long vc5_fod_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *parent_rate)
|
||||
{
|
||||
struct vc5_hw_data *hwdata = container_of(hw, struct vc5_hw_data, hw);
|
||||
/* VCO frequency is divided by two before entering FOD */
|
||||
u32 f_in = *parent_rate / 2;
|
||||
u32 div_int;
|
||||
u64 div_frc;
|
||||
|
||||
/* Determine integer part, which is 12 bit wide */
|
||||
div_int = f_in / rate;
|
||||
/*
|
||||
* WARNING: The clock chip does not output signal if the integer part
|
||||
* of the divider is 0xfff and fractional part is non-zero.
|
||||
* Clamp the divider at 0xffe to keep the code simple.
|
||||
*/
|
||||
if (div_int > 0xffe) {
|
||||
div_int = 0xffe;
|
||||
rate = f_in / div_int;
|
||||
}
|
||||
|
||||
/* Determine best fractional part, which is 30 bit wide */
|
||||
div_frc = f_in % rate;
|
||||
div_frc <<= 24;
|
||||
do_div(div_frc, rate);
|
||||
|
||||
hwdata->div_int = div_int;
|
||||
hwdata->div_frc = (u32)div_frc;
|
||||
|
||||
return div64_u64((u64)f_in << 24ULL, ((u64)div_int << 24ULL) + div_frc);
|
||||
}
|
||||
|
||||
static int vc5_fod_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct vc5_hw_data *hwdata = container_of(hw, struct vc5_hw_data, hw);
|
||||
struct vc5_driver_data *vc5 = hwdata->vc5;
|
||||
u8 data[14] = {
|
||||
hwdata->div_frc >> 22, hwdata->div_frc >> 14,
|
||||
hwdata->div_frc >> 6, hwdata->div_frc << 2,
|
||||
0, 0, 0, 0, 0,
|
||||
0, 0,
|
||||
hwdata->div_int >> 4, hwdata->div_int << 4,
|
||||
0
|
||||
};
|
||||
|
||||
regmap_bulk_write(vc5->regmap, VC5_OUT_DIV_FRAC(hwdata->num, 0),
|
||||
data, 14);
|
||||
|
||||
/*
|
||||
* Toggle magic bit in undocumented register for unknown reason.
|
||||
* This is what the IDT timing commander tool does and the chip
|
||||
* datasheet somewhat implies this is needed, but the register
|
||||
* and the bit is not documented.
|
||||
*/
|
||||
regmap_update_bits(vc5->regmap, VC5_GLOBAL_REGISTER,
|
||||
VC5_GLOBAL_REGISTER_GLOBAL_RESET, 0);
|
||||
regmap_update_bits(vc5->regmap, VC5_GLOBAL_REGISTER,
|
||||
VC5_GLOBAL_REGISTER_GLOBAL_RESET,
|
||||
VC5_GLOBAL_REGISTER_GLOBAL_RESET);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clk_ops vc5_fod_ops = {
|
||||
.recalc_rate = vc5_fod_recalc_rate,
|
||||
.round_rate = vc5_fod_round_rate,
|
||||
.set_rate = vc5_fod_set_rate,
|
||||
};
|
||||
|
||||
static int vc5_clk_out_prepare(struct clk_hw *hw)
|
||||
{
|
||||
struct vc5_hw_data *hwdata = container_of(hw, struct vc5_hw_data, hw);
|
||||
struct vc5_driver_data *vc5 = hwdata->vc5;
|
||||
|
||||
/* Enable the clock buffer */
|
||||
regmap_update_bits(vc5->regmap, VC5_CLK_OUTPUT_CFG(hwdata->num, 1),
|
||||
VC5_CLK_OUTPUT_CFG1_EN_CLKBUF,
|
||||
VC5_CLK_OUTPUT_CFG1_EN_CLKBUF);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void vc5_clk_out_unprepare(struct clk_hw *hw)
|
||||
{
|
||||
struct vc5_hw_data *hwdata = container_of(hw, struct vc5_hw_data, hw);
|
||||
struct vc5_driver_data *vc5 = hwdata->vc5;
|
||||
|
||||
/* Enable the clock buffer */
|
||||
regmap_update_bits(vc5->regmap, VC5_CLK_OUTPUT_CFG(hwdata->num, 1),
|
||||
VC5_CLK_OUTPUT_CFG1_EN_CLKBUF, 0);
|
||||
}
|
||||
|
||||
static unsigned char vc5_clk_out_get_parent(struct clk_hw *hw)
|
||||
{
|
||||
struct vc5_hw_data *hwdata = container_of(hw, struct vc5_hw_data, hw);
|
||||
struct vc5_driver_data *vc5 = hwdata->vc5;
|
||||
const u8 mask = VC5_OUT_DIV_CONTROL_SELB_NORM |
|
||||
VC5_OUT_DIV_CONTROL_SEL_EXT |
|
||||
VC5_OUT_DIV_CONTROL_EN_FOD;
|
||||
const u8 fodclkmask = VC5_OUT_DIV_CONTROL_SELB_NORM |
|
||||
VC5_OUT_DIV_CONTROL_EN_FOD;
|
||||
const u8 extclk = VC5_OUT_DIV_CONTROL_SELB_NORM |
|
||||
VC5_OUT_DIV_CONTROL_SEL_EXT;
|
||||
unsigned int src;
|
||||
|
||||
regmap_read(vc5->regmap, VC5_OUT_DIV_CONTROL(hwdata->num), &src);
|
||||
src &= mask;
|
||||
|
||||
if ((src & fodclkmask) == VC5_OUT_DIV_CONTROL_EN_FOD)
|
||||
return 0;
|
||||
|
||||
if (src == extclk)
|
||||
return 1;
|
||||
|
||||
dev_warn(&vc5->client->dev,
|
||||
"Invalid clock output configuration (%02x)\n", src);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vc5_clk_out_set_parent(struct clk_hw *hw, u8 index)
|
||||
{
|
||||
struct vc5_hw_data *hwdata = container_of(hw, struct vc5_hw_data, hw);
|
||||
struct vc5_driver_data *vc5 = hwdata->vc5;
|
||||
const u8 mask = VC5_OUT_DIV_CONTROL_RESET |
|
||||
VC5_OUT_DIV_CONTROL_SELB_NORM |
|
||||
VC5_OUT_DIV_CONTROL_SEL_EXT |
|
||||
VC5_OUT_DIV_CONTROL_EN_FOD;
|
||||
const u8 extclk = VC5_OUT_DIV_CONTROL_SELB_NORM |
|
||||
VC5_OUT_DIV_CONTROL_SEL_EXT;
|
||||
u8 src = VC5_OUT_DIV_CONTROL_RESET;
|
||||
|
||||
if (index == 0)
|
||||
src |= VC5_OUT_DIV_CONTROL_EN_FOD;
|
||||
else
|
||||
src |= extclk;
|
||||
|
||||
return regmap_update_bits(vc5->regmap, VC5_OUT_DIV_CONTROL(hwdata->num),
|
||||
mask, src);
|
||||
}
|
||||
|
||||
static const struct clk_ops vc5_clk_out_ops = {
|
||||
.prepare = vc5_clk_out_prepare,
|
||||
.unprepare = vc5_clk_out_unprepare,
|
||||
.set_parent = vc5_clk_out_set_parent,
|
||||
.get_parent = vc5_clk_out_get_parent,
|
||||
};
|
||||
|
||||
static struct clk_hw *vc5_of_clk_get(struct of_phandle_args *clkspec,
|
||||
void *data)
|
||||
{
|
||||
struct vc5_driver_data *vc5 = data;
|
||||
unsigned int idx = clkspec->args[0];
|
||||
|
||||
if (idx > 2)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
return &vc5->clk_out[idx].hw;
|
||||
}
|
||||
|
||||
static int vc5_map_index_to_output(const enum vc5_model model,
|
||||
const unsigned int n)
|
||||
{
|
||||
switch (model) {
|
||||
case IDT_VC5_5P49V5933:
|
||||
return (n == 0) ? 0 : 3;
|
||||
case IDT_VC5_5P49V5923:
|
||||
default:
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct of_device_id clk_vc5_of_match[];
|
||||
|
||||
static int vc5_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
const struct of_device_id *of_id =
|
||||
of_match_device(clk_vc5_of_match, &client->dev);
|
||||
struct vc5_driver_data *vc5;
|
||||
struct clk_init_data init;
|
||||
const char *parent_names[2];
|
||||
unsigned int n, idx;
|
||||
int ret;
|
||||
|
||||
vc5 = devm_kzalloc(&client->dev, sizeof(*vc5), GFP_KERNEL);
|
||||
if (vc5 == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
i2c_set_clientdata(client, vc5);
|
||||
vc5->client = client;
|
||||
vc5->model = (enum vc5_model)of_id->data;
|
||||
|
||||
vc5->pin_xin = devm_clk_get(&client->dev, "xin");
|
||||
if (PTR_ERR(vc5->pin_xin) == -EPROBE_DEFER)
|
||||
return -EPROBE_DEFER;
|
||||
|
||||
vc5->pin_clkin = devm_clk_get(&client->dev, "clkin");
|
||||
if (PTR_ERR(vc5->pin_clkin) == -EPROBE_DEFER)
|
||||
return -EPROBE_DEFER;
|
||||
|
||||
vc5->regmap = devm_regmap_init_i2c(client, &vc5_regmap_config);
|
||||
if (IS_ERR(vc5->regmap)) {
|
||||
dev_err(&client->dev, "failed to allocate register map\n");
|
||||
return PTR_ERR(vc5->regmap);
|
||||
}
|
||||
|
||||
/* Register clock input mux */
|
||||
memset(&init, 0, sizeof(init));
|
||||
|
||||
if (!IS_ERR(vc5->pin_xin)) {
|
||||
vc5->clk_mux_ins |= VC5_MUX_IN_XIN;
|
||||
parent_names[init.num_parents++] = __clk_get_name(vc5->pin_xin);
|
||||
} else if (vc5->model == IDT_VC5_5P49V5933) {
|
||||
/* IDT VC5 5P49V5933 has built-in oscilator. */
|
||||
vc5->pin_xin = clk_register_fixed_rate(&client->dev,
|
||||
"internal-xtal", NULL,
|
||||
0, 25000000);
|
||||
if (IS_ERR(vc5->pin_xin))
|
||||
return PTR_ERR(vc5->pin_xin);
|
||||
vc5->clk_mux_ins |= VC5_MUX_IN_XIN;
|
||||
parent_names[init.num_parents++] = __clk_get_name(vc5->pin_xin);
|
||||
}
|
||||
|
||||
if (!IS_ERR(vc5->pin_clkin)) {
|
||||
vc5->clk_mux_ins |= VC5_MUX_IN_CLKIN;
|
||||
parent_names[init.num_parents++] =
|
||||
__clk_get_name(vc5->pin_clkin);
|
||||
}
|
||||
|
||||
if (!init.num_parents) {
|
||||
dev_err(&client->dev, "no input clock specified!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
init.name = vc5_mux_names[0];
|
||||
init.ops = &vc5_mux_ops;
|
||||
init.flags = 0;
|
||||
init.parent_names = parent_names;
|
||||
vc5->clk_mux.init = &init;
|
||||
ret = devm_clk_hw_register(&client->dev, &vc5->clk_mux);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "unable to register %s\n", init.name);
|
||||
goto err_clk;
|
||||
}
|
||||
|
||||
/* Register PLL */
|
||||
memset(&init, 0, sizeof(init));
|
||||
init.name = vc5_pll_names[0];
|
||||
init.ops = &vc5_pll_ops;
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
init.parent_names = vc5_mux_names;
|
||||
init.num_parents = 1;
|
||||
vc5->clk_pll.num = 0;
|
||||
vc5->clk_pll.vc5 = vc5;
|
||||
vc5->clk_pll.hw.init = &init;
|
||||
ret = devm_clk_hw_register(&client->dev, &vc5->clk_pll.hw);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "unable to register %s\n", init.name);
|
||||
goto err_clk;
|
||||
}
|
||||
|
||||
/* Register FODs */
|
||||
for (n = 0; n < 2; n++) {
|
||||
idx = vc5_map_index_to_output(vc5->model, n);
|
||||
memset(&init, 0, sizeof(init));
|
||||
init.name = vc5_fod_names[idx];
|
||||
init.ops = &vc5_fod_ops;
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
init.parent_names = vc5_pll_names;
|
||||
init.num_parents = 1;
|
||||
vc5->clk_fod[n].num = idx;
|
||||
vc5->clk_fod[n].vc5 = vc5;
|
||||
vc5->clk_fod[n].hw.init = &init;
|
||||
ret = devm_clk_hw_register(&client->dev, &vc5->clk_fod[n].hw);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "unable to register %s\n",
|
||||
init.name);
|
||||
goto err_clk;
|
||||
}
|
||||
}
|
||||
|
||||
/* Register MUX-connected OUT0_I2C_SELB output */
|
||||
memset(&init, 0, sizeof(init));
|
||||
init.name = vc5_clk_out_names[0];
|
||||
init.ops = &vc5_clk_out_ops;
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
init.parent_names = vc5_mux_names;
|
||||
init.num_parents = 1;
|
||||
vc5->clk_out[0].num = idx;
|
||||
vc5->clk_out[0].vc5 = vc5;
|
||||
vc5->clk_out[0].hw.init = &init;
|
||||
ret = devm_clk_hw_register(&client->dev, &vc5->clk_out[0].hw);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "unable to register %s\n",
|
||||
init.name);
|
||||
goto err_clk;
|
||||
}
|
||||
|
||||
/* Register FOD-connected OUTx outputs */
|
||||
for (n = 1; n < 3; n++) {
|
||||
idx = vc5_map_index_to_output(vc5->model, n - 1);
|
||||
parent_names[0] = vc5_fod_names[idx];
|
||||
if (n == 1)
|
||||
parent_names[1] = vc5_mux_names[0];
|
||||
else
|
||||
parent_names[1] = vc5_clk_out_names[n - 1];
|
||||
|
||||
memset(&init, 0, sizeof(init));
|
||||
init.name = vc5_clk_out_names[idx + 1];
|
||||
init.ops = &vc5_clk_out_ops;
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
init.parent_names = parent_names;
|
||||
init.num_parents = 2;
|
||||
vc5->clk_out[n].num = idx;
|
||||
vc5->clk_out[n].vc5 = vc5;
|
||||
vc5->clk_out[n].hw.init = &init;
|
||||
ret = devm_clk_hw_register(&client->dev,
|
||||
&vc5->clk_out[n].hw);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "unable to register %s\n",
|
||||
init.name);
|
||||
goto err_clk;
|
||||
}
|
||||
}
|
||||
|
||||
ret = of_clk_add_hw_provider(client->dev.of_node, vc5_of_clk_get, vc5);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "unable to add clk provider\n");
|
||||
goto err_clk;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_clk:
|
||||
if (vc5->model == IDT_VC5_5P49V5933)
|
||||
clk_unregister_fixed_rate(vc5->pin_xin);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int vc5_remove(struct i2c_client *client)
|
||||
{
|
||||
struct vc5_driver_data *vc5 = i2c_get_clientdata(client);
|
||||
|
||||
of_clk_del_provider(client->dev.of_node);
|
||||
|
||||
if (vc5->model == IDT_VC5_5P49V5933)
|
||||
clk_unregister_fixed_rate(vc5->pin_xin);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id vc5_id[] = {
|
||||
{ "5p49v5923", .driver_data = IDT_VC5_5P49V5923 },
|
||||
{ "5p49v5933", .driver_data = IDT_VC5_5P49V5933 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, vc5_id);
|
||||
|
||||
static const struct of_device_id clk_vc5_of_match[] = {
|
||||
{ .compatible = "idt,5p49v5923", .data = (void *)IDT_VC5_5P49V5923 },
|
||||
{ .compatible = "idt,5p49v5933", .data = (void *)IDT_VC5_5P49V5933 },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, clk_vc5_of_match);
|
||||
|
||||
static struct i2c_driver vc5_driver = {
|
||||
.driver = {
|
||||
.name = "vc5",
|
||||
.of_match_table = clk_vc5_of_match,
|
||||
},
|
||||
.probe = vc5_probe,
|
||||
.remove = vc5_remove,
|
||||
.id_table = vc5_id,
|
||||
};
|
||||
module_i2c_driver(vc5_driver);
|
||||
|
||||
MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>");
|
||||
MODULE_DESCRIPTION("IDT VersaClock 5 driver");
|
||||
MODULE_LICENSE("GPL");
|
@ -97,7 +97,8 @@ static int wm831x_fll_prepare(struct clk_hw *hw)
|
||||
if (ret != 0)
|
||||
dev_crit(wm831x->dev, "Failed to enable FLL: %d\n", ret);
|
||||
|
||||
usleep_range(2000, 2000);
|
||||
/* wait 2-3 ms for new frequency taking effect */
|
||||
usleep_range(2000, 3000);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -14,6 +14,13 @@ config COMMON_CLK_HI3519
|
||||
help
|
||||
Build the clock driver for hi3519.
|
||||
|
||||
config COMMON_CLK_HI3660
|
||||
bool "Hi3660 Clock Driver"
|
||||
depends on ARCH_HISI || COMPILE_TEST
|
||||
default ARCH_HISI
|
||||
help
|
||||
Build the clock driver for hi3660.
|
||||
|
||||
config COMMON_CLK_HI3798CV200
|
||||
tristate "Hi3798CV200 Clock Driver"
|
||||
depends on ARCH_HISI || COMPILE_TEST
|
||||
|
@ -9,6 +9,7 @@ obj-$(CONFIG_ARCH_HIP04) += clk-hip04.o
|
||||
obj-$(CONFIG_ARCH_HIX5HD2) += clk-hix5hd2.o
|
||||
obj-$(CONFIG_COMMON_CLK_HI3516CV300) += crg-hi3516cv300.o
|
||||
obj-$(CONFIG_COMMON_CLK_HI3519) += clk-hi3519.o
|
||||
obj-$(CONFIG_COMMON_CLK_HI3660) += clk-hi3660.o
|
||||
obj-$(CONFIG_COMMON_CLK_HI3798CV200) += crg-hi3798cv200.o
|
||||
obj-$(CONFIG_COMMON_CLK_HI6220) += clk-hi6220.o
|
||||
obj-$(CONFIG_RESET_HISI) += reset.o
|
||||
|
567
drivers/clk/hisilicon/clk-hi3660.c
Normal file
567
drivers/clk/hisilicon/clk-hi3660.c
Normal file
@ -0,0 +1,567 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2017 Linaro Ltd.
|
||||
* Copyright (c) 2016-2017 HiSilicon Technologies Co., Ltd.
|
||||
*
|
||||
* 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 <dt-bindings/clock/hi3660-clock.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include "clk.h"
|
||||
|
||||
static const struct hisi_fixed_rate_clock hi3660_fixed_rate_clks[] = {
|
||||
{ HI3660_CLKIN_SYS, "clkin_sys", NULL, 0, 19200000, },
|
||||
{ HI3660_CLKIN_REF, "clkin_ref", NULL, 0, 32764, },
|
||||
{ HI3660_CLK_FLL_SRC, "clk_fll_src", NULL, 0, 128000000, },
|
||||
{ HI3660_CLK_PPLL0, "clk_ppll0", NULL, 0, 1600000000, },
|
||||
{ HI3660_CLK_PPLL1, "clk_ppll1", NULL, 0, 1866000000, },
|
||||
{ HI3660_CLK_PPLL2, "clk_ppll2", NULL, 0, 960000000, },
|
||||
{ HI3660_CLK_PPLL3, "clk_ppll3", NULL, 0, 1290000000, },
|
||||
{ HI3660_CLK_SCPLL, "clk_scpll", NULL, 0, 245760000, },
|
||||
{ HI3660_PCLK, "pclk", NULL, 0, 20000000, },
|
||||
{ HI3660_CLK_UART0_DBG, "clk_uart0_dbg", NULL, 0, 19200000, },
|
||||
{ HI3660_CLK_UART6, "clk_uart6", NULL, 0, 19200000, },
|
||||
{ HI3660_OSC32K, "osc32k", NULL, 0, 32764, },
|
||||
{ HI3660_OSC19M, "osc19m", NULL, 0, 19200000, },
|
||||
{ HI3660_CLK_480M, "clk_480m", NULL, 0, 480000000, },
|
||||
{ HI3660_CLK_INV, "clk_inv", NULL, 0, 10000000, },
|
||||
};
|
||||
|
||||
/* crgctrl */
|
||||
static const struct hisi_fixed_factor_clock hi3660_crg_fixed_factor_clks[] = {
|
||||
{ HI3660_FACTOR_UART3, "clk_factor_uart3", "iomcu_peri0", 1, 8, 0, },
|
||||
{ HI3660_CLK_FACTOR_MMC, "clk_factor_mmc", "clkin_sys", 1, 6, 0, },
|
||||
{ HI3660_CLK_GATE_I2C0, "clk_gate_i2c0", "clk_i2c0_iomcu", 1, 4, 0, },
|
||||
{ HI3660_CLK_GATE_I2C1, "clk_gate_i2c1", "clk_i2c1_iomcu", 1, 4, 0, },
|
||||
{ HI3660_CLK_GATE_I2C2, "clk_gate_i2c2", "clk_i2c2_iomcu", 1, 4, 0, },
|
||||
{ HI3660_CLK_GATE_I2C6, "clk_gate_i2c6", "clk_i2c6_iomcu", 1, 4, 0, },
|
||||
{ HI3660_CLK_DIV_SYSBUS, "clk_div_sysbus", "clk_mux_sysbus", 1, 7, 0, },
|
||||
{ HI3660_CLK_DIV_320M, "clk_div_320m", "clk_320m_pll_gt", 1, 5, 0, },
|
||||
{ HI3660_CLK_DIV_A53, "clk_div_a53hpm", "clk_a53hpm_andgt", 1, 2, 0, },
|
||||
{ HI3660_CLK_GATE_SPI0, "clk_gate_spi0", "clk_ppll0", 1, 8, 0, },
|
||||
{ HI3660_CLK_GATE_SPI2, "clk_gate_spi2", "clk_ppll0", 1, 8, 0, },
|
||||
{ HI3660_PCIEPHY_REF, "clk_pciephy_ref", "clk_div_pciephy", 1, 1, 0, },
|
||||
{ HI3660_CLK_ABB_USB, "clk_abb_usb", "clk_gate_usb_tcxo_en", 1, 1, 0 },
|
||||
};
|
||||
|
||||
static const struct hisi_gate_clock hi3660_crgctrl_gate_sep_clks[] = {
|
||||
{ HI3660_HCLK_GATE_SDIO0, "hclk_gate_sdio0", "clk_div_sysbus",
|
||||
CLK_SET_RATE_PARENT, 0x0, 21, 0, },
|
||||
{ HI3660_HCLK_GATE_SD, "hclk_gate_sd", "clk_div_sysbus",
|
||||
CLK_SET_RATE_PARENT, 0x0, 30, 0, },
|
||||
{ HI3660_CLK_GATE_AOMM, "clk_gate_aomm", "clk_div_aomm",
|
||||
CLK_SET_RATE_PARENT, 0x0, 31, 0, },
|
||||
{ HI3660_PCLK_GPIO0, "pclk_gpio0", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 0, 0, },
|
||||
{ HI3660_PCLK_GPIO1, "pclk_gpio1", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 1, 0, },
|
||||
{ HI3660_PCLK_GPIO2, "pclk_gpio2", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 2, 0, },
|
||||
{ HI3660_PCLK_GPIO3, "pclk_gpio3", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 3, 0, },
|
||||
{ HI3660_PCLK_GPIO4, "pclk_gpio4", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 4, 0, },
|
||||
{ HI3660_PCLK_GPIO5, "pclk_gpio5", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 5, 0, },
|
||||
{ HI3660_PCLK_GPIO6, "pclk_gpio6", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 6, 0, },
|
||||
{ HI3660_PCLK_GPIO7, "pclk_gpio7", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 7, 0, },
|
||||
{ HI3660_PCLK_GPIO8, "pclk_gpio8", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 8, 0, },
|
||||
{ HI3660_PCLK_GPIO9, "pclk_gpio9", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 9, 0, },
|
||||
{ HI3660_PCLK_GPIO10, "pclk_gpio10", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 10, 0, },
|
||||
{ HI3660_PCLK_GPIO11, "pclk_gpio11", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 11, 0, },
|
||||
{ HI3660_PCLK_GPIO12, "pclk_gpio12", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 12, 0, },
|
||||
{ HI3660_PCLK_GPIO13, "pclk_gpio13", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 13, 0, },
|
||||
{ HI3660_PCLK_GPIO14, "pclk_gpio14", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 14, 0, },
|
||||
{ HI3660_PCLK_GPIO15, "pclk_gpio15", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 15, 0, },
|
||||
{ HI3660_PCLK_GPIO16, "pclk_gpio16", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 16, 0, },
|
||||
{ HI3660_PCLK_GPIO17, "pclk_gpio17", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 17, 0, },
|
||||
{ HI3660_PCLK_GPIO18, "pclk_gpio18", "clk_div_ioperi",
|
||||
CLK_SET_RATE_PARENT, 0x10, 18, 0, },
|
||||
{ HI3660_PCLK_GPIO19, "pclk_gpio19", "clk_div_ioperi",
|
||||
CLK_SET_RATE_PARENT, 0x10, 19, 0, },
|
||||
{ HI3660_PCLK_GPIO20, "pclk_gpio20", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 20, 0, },
|
||||
{ HI3660_PCLK_GPIO21, "pclk_gpio21", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x10, 21, 0, },
|
||||
{ HI3660_CLK_GATE_SPI3, "clk_gate_spi3", "clk_div_ioperi",
|
||||
CLK_SET_RATE_PARENT, 0x10, 30, 0, },
|
||||
{ HI3660_CLK_GATE_I2C7, "clk_gate_i2c7", "clk_mux_i2c",
|
||||
CLK_SET_RATE_PARENT, 0x10, 31, 0, },
|
||||
{ HI3660_CLK_GATE_I2C3, "clk_gate_i2c3", "clk_mux_i2c",
|
||||
CLK_SET_RATE_PARENT, 0x20, 7, 0, },
|
||||
{ HI3660_CLK_GATE_SPI1, "clk_gate_spi1", "clk_mux_spi",
|
||||
CLK_SET_RATE_PARENT, 0x20, 9, 0, },
|
||||
{ HI3660_CLK_GATE_UART1, "clk_gate_uart1", "clk_mux_uarth",
|
||||
CLK_SET_RATE_PARENT, 0x20, 11, 0, },
|
||||
{ HI3660_CLK_GATE_UART2, "clk_gate_uart2", "clk_mux_uart1",
|
||||
CLK_SET_RATE_PARENT, 0x20, 12, 0, },
|
||||
{ HI3660_CLK_GATE_UART4, "clk_gate_uart4", "clk_mux_uarth",
|
||||
CLK_SET_RATE_PARENT, 0x20, 14, 0, },
|
||||
{ HI3660_CLK_GATE_UART5, "clk_gate_uart5", "clk_mux_uart1",
|
||||
CLK_SET_RATE_PARENT, 0x20, 15, 0, },
|
||||
{ HI3660_CLK_GATE_I2C4, "clk_gate_i2c4", "clk_mux_i2c",
|
||||
CLK_SET_RATE_PARENT, 0x20, 27, 0, },
|
||||
{ HI3660_CLK_GATE_DMAC, "clk_gate_dmac", "clk_div_sysbus",
|
||||
CLK_SET_RATE_PARENT, 0x30, 1, 0, },
|
||||
{ HI3660_PCLK_GATE_DSS, "pclk_gate_dss", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x30, 12, 0, },
|
||||
{ HI3660_ACLK_GATE_DSS, "aclk_gate_dss", "clk_gate_vivobus",
|
||||
CLK_SET_RATE_PARENT, 0x30, 13, 0, },
|
||||
{ HI3660_CLK_GATE_LDI1, "clk_gate_ldi1", "clk_div_ldi1",
|
||||
CLK_SET_RATE_PARENT, 0x30, 14, 0, },
|
||||
{ HI3660_CLK_GATE_LDI0, "clk_gate_ldi0", "clk_div_ldi0",
|
||||
CLK_SET_RATE_PARENT, 0x30, 15, 0, },
|
||||
{ HI3660_CLK_GATE_VIVOBUS, "clk_gate_vivobus", "clk_div_vivobus",
|
||||
CLK_SET_RATE_PARENT, 0x30, 16, 0, },
|
||||
{ HI3660_CLK_GATE_EDC0, "clk_gate_edc0", "clk_div_edc0",
|
||||
CLK_SET_RATE_PARENT, 0x30, 17, 0, },
|
||||
{ HI3660_CLK_GATE_TXDPHY0_CFG, "clk_gate_txdphy0_cfg", "clkin_sys",
|
||||
CLK_SET_RATE_PARENT, 0x30, 28, 0, },
|
||||
{ HI3660_CLK_GATE_TXDPHY0_REF, "clk_gate_txdphy0_ref", "clkin_sys",
|
||||
CLK_SET_RATE_PARENT, 0x30, 29, 0, },
|
||||
{ HI3660_CLK_GATE_TXDPHY1_CFG, "clk_gate_txdphy1_cfg", "clkin_sys",
|
||||
CLK_SET_RATE_PARENT, 0x30, 30, 0, },
|
||||
{ HI3660_CLK_GATE_TXDPHY1_REF, "clk_gate_txdphy1_ref", "clkin_sys",
|
||||
CLK_SET_RATE_PARENT, 0x30, 31, 0, },
|
||||
{ HI3660_ACLK_GATE_USB3OTG, "aclk_gate_usb3otg", "clk_div_mmc0bus",
|
||||
CLK_SET_RATE_PARENT, 0x40, 1, 0, },
|
||||
{ HI3660_CLK_GATE_SPI4, "clk_gate_spi4", "clk_mux_spi",
|
||||
CLK_SET_RATE_PARENT, 0x40, 4, 0, },
|
||||
{ HI3660_CLK_GATE_SD, "clk_gate_sd", "clk_mux_sd_sys",
|
||||
CLK_SET_RATE_PARENT, 0x40, 17, 0, },
|
||||
{ HI3660_CLK_GATE_SDIO0, "clk_gate_sdio0", "clk_mux_sdio_sys",
|
||||
CLK_SET_RATE_PARENT, 0x40, 19, 0, },
|
||||
{ HI3660_CLK_GATE_UFS_SUBSYS, "clk_gate_ufs_subsys", "clk_div_sysbus",
|
||||
CLK_SET_RATE_PARENT, 0x50, 21, 0, },
|
||||
{ HI3660_PCLK_GATE_DSI0, "pclk_gate_dsi0", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x50, 28, 0, },
|
||||
{ HI3660_PCLK_GATE_DSI1, "pclk_gate_dsi1", "clk_div_cfgbus",
|
||||
CLK_SET_RATE_PARENT, 0x50, 29, 0, },
|
||||
{ HI3660_ACLK_GATE_PCIE, "aclk_gate_pcie", "clk_div_mmc1bus",
|
||||
CLK_SET_RATE_PARENT, 0x420, 5, 0, },
|
||||
{ HI3660_PCLK_GATE_PCIE_SYS, "pclk_gate_pcie_sys", "clk_div_mmc1bus",
|
||||
CLK_SET_RATE_PARENT, 0x420, 7, 0, },
|
||||
{ HI3660_CLK_GATE_PCIEAUX, "clk_gate_pcieaux", "clkin_sys",
|
||||
CLK_SET_RATE_PARENT, 0x420, 8, 0, },
|
||||
{ HI3660_PCLK_GATE_PCIE_PHY, "pclk_gate_pcie_phy", "clk_div_mmc1bus",
|
||||
CLK_SET_RATE_PARENT, 0x420, 9, 0, },
|
||||
};
|
||||
|
||||
static const struct hisi_gate_clock hi3660_crgctrl_gate_clks[] = {
|
||||
{ HI3660_CLK_ANDGT_LDI0, "clk_andgt_ldi0", "clk_mux_ldi0",
|
||||
CLK_SET_RATE_PARENT, 0xf0, 6, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_ANDGT_LDI1, "clk_andgt_ldi1", "clk_mux_ldi1",
|
||||
CLK_SET_RATE_PARENT, 0xf0, 7, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_ANDGT_EDC0, "clk_andgt_edc0", "clk_mux_edc0",
|
||||
CLK_SET_RATE_PARENT, 0xf0, 8, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_GATE_UFSPHY_GT, "clk_gate_ufsphy_gt", "clk_div_ufsperi",
|
||||
CLK_SET_RATE_PARENT, 0xf4, 1, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_ANDGT_MMC, "clk_andgt_mmc", "clk_mux_mmc_pll",
|
||||
CLK_SET_RATE_PARENT, 0xf4, 2, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_ANDGT_SD, "clk_andgt_sd", "clk_mux_sd_pll",
|
||||
CLK_SET_RATE_PARENT, 0xf4, 3, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_A53HPM_ANDGT, "clk_a53hpm_andgt", "clk_mux_a53hpm",
|
||||
CLK_SET_RATE_PARENT, 0xf4, 7, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_ANDGT_SDIO, "clk_andgt_sdio", "clk_mux_sdio_pll",
|
||||
CLK_SET_RATE_PARENT, 0xf4, 8, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_ANDGT_UART0, "clk_andgt_uart0", "clk_div_320m",
|
||||
CLK_SET_RATE_PARENT, 0xf4, 9, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_ANDGT_UART1, "clk_andgt_uart1", "clk_div_320m",
|
||||
CLK_SET_RATE_PARENT, 0xf4, 10, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_ANDGT_UARTH, "clk_andgt_uarth", "clk_div_320m",
|
||||
CLK_SET_RATE_PARENT, 0xf4, 11, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_ANDGT_SPI, "clk_andgt_spi", "clk_div_320m",
|
||||
CLK_SET_RATE_PARENT, 0xf4, 13, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_VIVOBUS_ANDGT, "clk_vivobus_andgt", "clk_mux_vivobus",
|
||||
CLK_SET_RATE_PARENT, 0xf8, 1, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_AOMM_ANDGT, "clk_aomm_andgt", "clk_ppll2",
|
||||
CLK_SET_RATE_PARENT, 0xf8, 3, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_320M_PLL_GT, "clk_320m_pll_gt", "clk_mux_320m",
|
||||
CLK_SET_RATE_PARENT, 0xf8, 10, 0, },
|
||||
{ HI3660_AUTODIV_EMMC0BUS, "autodiv_emmc0bus", "autodiv_sysbus",
|
||||
CLK_SET_RATE_PARENT, 0x404, 1, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_AUTODIV_SYSBUS, "autodiv_sysbus", "clk_div_sysbus",
|
||||
CLK_SET_RATE_PARENT, 0x404, 5, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_GATE_UFSPHY_CFG, "clk_gate_ufsphy_cfg",
|
||||
"clk_div_ufsphy_cfg", CLK_SET_RATE_PARENT, 0x420, 12, 0, },
|
||||
{ HI3660_CLK_GATE_UFSIO_REF, "clk_gate_ufsio_ref",
|
||||
"clk_gate_ufs_tcxo_en", CLK_SET_RATE_PARENT, 0x420, 14, 0, },
|
||||
};
|
||||
|
||||
static const char *const
|
||||
clk_mux_sdio_sys_p[] = {"clk_factor_mmc", "clk_div_sdio",};
|
||||
static const char *const
|
||||
clk_mux_sd_sys_p[] = {"clk_factor_mmc", "clk_div_sd",};
|
||||
static const char *const
|
||||
clk_mux_pll_p[] = {"clk_ppll0", "clk_ppll1", "clk_ppll2", "clk_ppll2",};
|
||||
static const char *const
|
||||
clk_mux_pll0123_p[] = {"clk_ppll0", "clk_ppll1", "clk_ppll2", "clk_ppll3",};
|
||||
static const char *const
|
||||
clk_mux_edc0_p[] = {"clk_inv", "clk_ppll0", "clk_ppll1", "clk_inv",
|
||||
"clk_ppll2", "clk_inv", "clk_inv", "clk_inv",
|
||||
"clk_ppll3", "clk_inv", "clk_inv", "clk_inv",
|
||||
"clk_inv", "clk_inv", "clk_inv", "clk_inv",};
|
||||
static const char *const
|
||||
clk_mux_ldi0_p[] = {"clk_inv", "clk_ppll0", "clk_ppll2", "clk_inv",
|
||||
"clk_ppll1", "clk_inv", "clk_inv", "clk_inv",
|
||||
"clk_ppll3", "clk_inv", "clk_inv", "clk_inv",
|
||||
"clk_inv", "clk_inv", "clk_inv", "clk_inv",};
|
||||
static const char *const
|
||||
clk_mux_uart0_p[] = {"clkin_sys", "clk_div_uart0",};
|
||||
static const char *const
|
||||
clk_mux_uart1_p[] = {"clkin_sys", "clk_div_uart1",};
|
||||
static const char *const
|
||||
clk_mux_uarth_p[] = {"clkin_sys", "clk_div_uarth",};
|
||||
static const char *const
|
||||
clk_mux_pll02p[] = {"clk_ppll0", "clk_ppll2",};
|
||||
static const char *const
|
||||
clk_mux_ioperi_p[] = {"clk_div_320m", "clk_div_a53hpm",};
|
||||
static const char *const
|
||||
clk_mux_spi_p[] = {"clkin_sys", "clk_div_spi",};
|
||||
static const char *const
|
||||
clk_mux_i2c_p[] = {"clkin_sys", "clk_div_i2c",};
|
||||
|
||||
static const struct hisi_mux_clock hi3660_crgctrl_mux_clks[] = {
|
||||
{ HI3660_CLK_MUX_SYSBUS, "clk_mux_sysbus", clk_mux_sdio_sys_p,
|
||||
ARRAY_SIZE(clk_mux_sdio_sys_p), CLK_SET_RATE_PARENT, 0xac, 0, 1,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_UART0, "clk_mux_uart0", clk_mux_uart0_p,
|
||||
ARRAY_SIZE(clk_mux_uart0_p), CLK_SET_RATE_PARENT, 0xac, 2, 1,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_UART1, "clk_mux_uart1", clk_mux_uart1_p,
|
||||
ARRAY_SIZE(clk_mux_uart1_p), CLK_SET_RATE_PARENT, 0xac, 3, 1,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_UARTH, "clk_mux_uarth", clk_mux_uarth_p,
|
||||
ARRAY_SIZE(clk_mux_uarth_p), CLK_SET_RATE_PARENT, 0xac, 4, 1,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_SPI, "clk_mux_spi", clk_mux_spi_p,
|
||||
ARRAY_SIZE(clk_mux_spi_p), CLK_SET_RATE_PARENT, 0xac, 8, 1,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_I2C, "clk_mux_i2c", clk_mux_i2c_p,
|
||||
ARRAY_SIZE(clk_mux_i2c_p), CLK_SET_RATE_PARENT, 0xac, 13, 1,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_MMC_PLL, "clk_mux_mmc_pll", clk_mux_pll02p,
|
||||
ARRAY_SIZE(clk_mux_pll02p), CLK_SET_RATE_PARENT, 0xb4, 0, 1,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_LDI1, "clk_mux_ldi1", clk_mux_ldi0_p,
|
||||
ARRAY_SIZE(clk_mux_ldi0_p), CLK_SET_RATE_PARENT, 0xb4, 8, 4,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_LDI0, "clk_mux_ldi0", clk_mux_ldi0_p,
|
||||
ARRAY_SIZE(clk_mux_ldi0_p), CLK_SET_RATE_PARENT, 0xb4, 12, 4,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_SD_PLL, "clk_mux_sd_pll", clk_mux_pll_p,
|
||||
ARRAY_SIZE(clk_mux_pll_p), CLK_SET_RATE_PARENT, 0xb8, 4, 2,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_SD_SYS, "clk_mux_sd_sys", clk_mux_sd_sys_p,
|
||||
ARRAY_SIZE(clk_mux_sd_sys_p), CLK_SET_RATE_PARENT, 0xb8, 6, 1,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_EDC0, "clk_mux_edc0", clk_mux_edc0_p,
|
||||
ARRAY_SIZE(clk_mux_edc0_p), CLK_SET_RATE_PARENT, 0xbc, 6, 4,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_SDIO_SYS, "clk_mux_sdio_sys", clk_mux_sdio_sys_p,
|
||||
ARRAY_SIZE(clk_mux_sdio_sys_p), CLK_SET_RATE_PARENT, 0xc0, 6, 1,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_SDIO_PLL, "clk_mux_sdio_pll", clk_mux_pll_p,
|
||||
ARRAY_SIZE(clk_mux_pll_p), CLK_SET_RATE_PARENT, 0xc0, 4, 2,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_VIVOBUS, "clk_mux_vivobus", clk_mux_pll0123_p,
|
||||
ARRAY_SIZE(clk_mux_pll0123_p), CLK_SET_RATE_PARENT, 0xd0, 12, 2,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_A53HPM, "clk_mux_a53hpm", clk_mux_pll02p,
|
||||
ARRAY_SIZE(clk_mux_pll02p), CLK_SET_RATE_PARENT, 0xd4, 9, 1,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_320M, "clk_mux_320m", clk_mux_pll02p,
|
||||
ARRAY_SIZE(clk_mux_pll02p), CLK_SET_RATE_PARENT, 0x100, 0, 1,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MUX_IOPERI, "clk_mux_ioperi", clk_mux_ioperi_p,
|
||||
ARRAY_SIZE(clk_mux_ioperi_p), CLK_SET_RATE_PARENT, 0x108, 10, 1,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
};
|
||||
|
||||
static const struct hisi_divider_clock hi3660_crgctrl_divider_clks[] = {
|
||||
{ HI3660_CLK_DIV_UART0, "clk_div_uart0", "clk_andgt_uart0",
|
||||
CLK_SET_RATE_PARENT, 0xb0, 4, 4, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_UART1, "clk_div_uart1", "clk_andgt_uart1",
|
||||
CLK_SET_RATE_PARENT, 0xb0, 8, 4, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_UARTH, "clk_div_uarth", "clk_andgt_uarth",
|
||||
CLK_SET_RATE_PARENT, 0xb0, 12, 4, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_MMC, "clk_div_mmc", "clk_andgt_mmc",
|
||||
CLK_SET_RATE_PARENT, 0xb4, 3, 4, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_SD, "clk_div_sd", "clk_andgt_sd",
|
||||
CLK_SET_RATE_PARENT, 0xb8, 0, 4, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_EDC0, "clk_div_edc0", "clk_andgt_edc0",
|
||||
CLK_SET_RATE_PARENT, 0xbc, 0, 6, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_LDI0, "clk_div_ldi0", "clk_andgt_ldi0",
|
||||
CLK_SET_RATE_PARENT, 0xbc, 10, 6, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_SDIO, "clk_div_sdio", "clk_andgt_sdio",
|
||||
CLK_SET_RATE_PARENT, 0xc0, 0, 4, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_LDI1, "clk_div_ldi1", "clk_andgt_ldi1",
|
||||
CLK_SET_RATE_PARENT, 0xc0, 8, 6, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_SPI, "clk_div_spi", "clk_andgt_spi",
|
||||
CLK_SET_RATE_PARENT, 0xc4, 12, 4, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_VIVOBUS, "clk_div_vivobus", "clk_vivobus_andgt",
|
||||
CLK_SET_RATE_PARENT, 0xd0, 7, 5, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_I2C, "clk_div_i2c", "clk_div_320m",
|
||||
CLK_SET_RATE_PARENT, 0xe8, 4, 4, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_UFSPHY, "clk_div_ufsphy_cfg", "clk_gate_ufsphy_gt",
|
||||
CLK_SET_RATE_PARENT, 0xe8, 9, 2, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_CFGBUS, "clk_div_cfgbus", "clk_div_sysbus",
|
||||
CLK_SET_RATE_PARENT, 0xec, 0, 2, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_MMC0BUS, "clk_div_mmc0bus", "autodiv_emmc0bus",
|
||||
CLK_SET_RATE_PARENT, 0xec, 2, 1, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_MMC1BUS, "clk_div_mmc1bus", "clk_div_sysbus",
|
||||
CLK_SET_RATE_PARENT, 0xec, 3, 1, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_UFSPERI, "clk_div_ufsperi", "clk_gate_ufs_subsys",
|
||||
CLK_SET_RATE_PARENT, 0xec, 14, 1, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_AOMM, "clk_div_aomm", "clk_aomm_andgt",
|
||||
CLK_SET_RATE_PARENT, 0x100, 7, 4, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_IOPERI, "clk_div_ioperi", "clk_mux_ioperi",
|
||||
CLK_SET_RATE_PARENT, 0x108, 11, 4, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
};
|
||||
|
||||
/* clk_pmuctrl */
|
||||
/* pmu register need shift 2 bits */
|
||||
static const struct hisi_gate_clock hi3660_pmu_gate_clks[] = {
|
||||
{ HI3660_GATE_ABB_192, "clk_gate_abb_192", "clkin_sys",
|
||||
CLK_SET_RATE_PARENT, (0x10a << 2), 3, 0, },
|
||||
};
|
||||
|
||||
/* clk_pctrl */
|
||||
static const struct hisi_gate_clock hi3660_pctrl_gate_clks[] = {
|
||||
{ HI3660_GATE_UFS_TCXO_EN, "clk_gate_ufs_tcxo_en",
|
||||
"clk_gate_abb_192", CLK_SET_RATE_PARENT, 0x10, 0,
|
||||
CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_GATE_USB_TCXO_EN, "clk_gate_usb_tcxo_en", "clk_gate_abb_192",
|
||||
CLK_SET_RATE_PARENT, 0x10, 1, CLK_GATE_HIWORD_MASK, },
|
||||
};
|
||||
|
||||
/* clk_sctrl */
|
||||
static const struct hisi_gate_clock hi3660_sctrl_gate_sep_clks[] = {
|
||||
{ HI3660_PCLK_AO_GPIO0, "pclk_ao_gpio0", "clk_div_aobus",
|
||||
CLK_SET_RATE_PARENT, 0x160, 11, 0, },
|
||||
{ HI3660_PCLK_AO_GPIO1, "pclk_ao_gpio1", "clk_div_aobus",
|
||||
CLK_SET_RATE_PARENT, 0x160, 12, 0, },
|
||||
{ HI3660_PCLK_AO_GPIO2, "pclk_ao_gpio2", "clk_div_aobus",
|
||||
CLK_SET_RATE_PARENT, 0x160, 13, 0, },
|
||||
{ HI3660_PCLK_AO_GPIO3, "pclk_ao_gpio3", "clk_div_aobus",
|
||||
CLK_SET_RATE_PARENT, 0x160, 14, 0, },
|
||||
{ HI3660_PCLK_AO_GPIO4, "pclk_ao_gpio4", "clk_div_aobus",
|
||||
CLK_SET_RATE_PARENT, 0x160, 21, 0, },
|
||||
{ HI3660_PCLK_AO_GPIO5, "pclk_ao_gpio5", "clk_div_aobus",
|
||||
CLK_SET_RATE_PARENT, 0x160, 22, 0, },
|
||||
{ HI3660_PCLK_AO_GPIO6, "pclk_ao_gpio6", "clk_div_aobus",
|
||||
CLK_SET_RATE_PARENT, 0x160, 25, 0, },
|
||||
{ HI3660_PCLK_GATE_MMBUF, "pclk_gate_mmbuf", "pclk_div_mmbuf",
|
||||
CLK_SET_RATE_PARENT, 0x170, 23, 0, },
|
||||
{ HI3660_CLK_GATE_DSS_AXI_MM, "clk_gate_dss_axi_mm", "aclk_mux_mmbuf",
|
||||
CLK_SET_RATE_PARENT, 0x170, 24, 0, },
|
||||
};
|
||||
|
||||
static const struct hisi_gate_clock hi3660_sctrl_gate_clks[] = {
|
||||
{ HI3660_PCLK_MMBUF_ANDGT, "pclk_mmbuf_andgt", "clk_sw_mmbuf",
|
||||
CLK_SET_RATE_PARENT, 0x258, 7, CLK_GATE_HIWORD_MASK, },
|
||||
{ HI3660_CLK_MMBUF_PLL_ANDGT, "clk_mmbuf_pll_andgt", "clk_ppll0",
|
||||
CLK_SET_RATE_PARENT, 0x260, 11, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_FLL_MMBUF_ANDGT, "clk_fll_mmbuf_andgt", "clk_fll_src",
|
||||
CLK_SET_RATE_PARENT, 0x260, 12, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_SYS_MMBUF_ANDGT, "clk_sys_mmbuf_andgt", "clkin_sys",
|
||||
CLK_SET_RATE_PARENT, 0x260, 13, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_GATE_PCIEPHY_GT, "clk_gate_pciephy_gt", "clk_ppll0",
|
||||
CLK_SET_RATE_PARENT, 0x268, 11, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
};
|
||||
|
||||
static const char *const
|
||||
aclk_mux_mmbuf_p[] = {"aclk_div_mmbuf", "clk_gate_aomm",};
|
||||
static const char *const
|
||||
clk_sw_mmbuf_p[] = {"clk_sys_mmbuf_andgt", "clk_fll_mmbuf_andgt",
|
||||
"aclk_mux_mmbuf", "aclk_mux_mmbuf"};
|
||||
|
||||
static const struct hisi_mux_clock hi3660_sctrl_mux_clks[] = {
|
||||
{ HI3660_ACLK_MUX_MMBUF, "aclk_mux_mmbuf", aclk_mux_mmbuf_p,
|
||||
ARRAY_SIZE(aclk_mux_mmbuf_p), CLK_SET_RATE_PARENT, 0x250, 12, 1,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
{ HI3660_CLK_SW_MMBUF, "clk_sw_mmbuf", clk_sw_mmbuf_p,
|
||||
ARRAY_SIZE(clk_sw_mmbuf_p), CLK_SET_RATE_PARENT, 0x258, 8, 2,
|
||||
CLK_MUX_HIWORD_MASK, },
|
||||
};
|
||||
|
||||
static const struct hisi_divider_clock hi3660_sctrl_divider_clks[] = {
|
||||
{ HI3660_CLK_DIV_AOBUS, "clk_div_aobus", "clk_ppll0",
|
||||
CLK_SET_RATE_PARENT, 0x254, 0, 6, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_PCLK_DIV_MMBUF, "pclk_div_mmbuf", "pclk_mmbuf_andgt",
|
||||
CLK_SET_RATE_PARENT, 0x258, 10, 2, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_ACLK_DIV_MMBUF, "aclk_div_mmbuf", "clk_mmbuf_pll_andgt",
|
||||
CLK_SET_RATE_PARENT, 0x258, 12, 4, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
{ HI3660_CLK_DIV_PCIEPHY, "clk_div_pciephy", "clk_gate_pciephy_gt",
|
||||
CLK_SET_RATE_PARENT, 0x268, 12, 4, CLK_DIVIDER_HIWORD_MASK, 0, },
|
||||
};
|
||||
|
||||
/* clk_iomcu */
|
||||
static const struct hisi_gate_clock hi3660_iomcu_gate_sep_clks[] = {
|
||||
{ HI3660_CLK_I2C0_IOMCU, "clk_i2c0_iomcu", "clk_fll_src",
|
||||
CLK_SET_RATE_PARENT, 0x10, 3, 0, },
|
||||
{ HI3660_CLK_I2C1_IOMCU, "clk_i2c1_iomcu", "clk_fll_src",
|
||||
CLK_SET_RATE_PARENT, 0x10, 4, 0, },
|
||||
{ HI3660_CLK_I2C2_IOMCU, "clk_i2c2_iomcu", "clk_fll_src",
|
||||
CLK_SET_RATE_PARENT, 0x10, 5, 0, },
|
||||
{ HI3660_CLK_I2C6_IOMCU, "clk_i2c6_iomcu", "clk_fll_src",
|
||||
CLK_SET_RATE_PARENT, 0x10, 27, 0, },
|
||||
{ HI3660_CLK_IOMCU_PERI0, "iomcu_peri0", "clk_ppll0",
|
||||
CLK_SET_RATE_PARENT, 0x90, 0, 0, },
|
||||
};
|
||||
|
||||
static void hi3660_clk_iomcu_init(struct device_node *np)
|
||||
{
|
||||
struct hisi_clock_data *clk_data;
|
||||
int nr = ARRAY_SIZE(hi3660_iomcu_gate_sep_clks);
|
||||
|
||||
clk_data = hisi_clk_init(np, nr);
|
||||
if (!clk_data)
|
||||
return;
|
||||
|
||||
hisi_clk_register_gate_sep(hi3660_iomcu_gate_sep_clks,
|
||||
ARRAY_SIZE(hi3660_iomcu_gate_sep_clks),
|
||||
clk_data);
|
||||
}
|
||||
|
||||
static void hi3660_clk_pmuctrl_init(struct device_node *np)
|
||||
{
|
||||
struct hisi_clock_data *clk_data;
|
||||
int nr = ARRAY_SIZE(hi3660_pmu_gate_clks);
|
||||
|
||||
clk_data = hisi_clk_init(np, nr);
|
||||
if (!clk_data)
|
||||
return;
|
||||
|
||||
hisi_clk_register_gate(hi3660_pmu_gate_clks,
|
||||
ARRAY_SIZE(hi3660_pmu_gate_clks), clk_data);
|
||||
}
|
||||
|
||||
static void hi3660_clk_pctrl_init(struct device_node *np)
|
||||
{
|
||||
struct hisi_clock_data *clk_data;
|
||||
int nr = ARRAY_SIZE(hi3660_pctrl_gate_clks);
|
||||
|
||||
clk_data = hisi_clk_init(np, nr);
|
||||
if (!clk_data)
|
||||
return;
|
||||
hisi_clk_register_gate(hi3660_pctrl_gate_clks,
|
||||
ARRAY_SIZE(hi3660_pctrl_gate_clks), clk_data);
|
||||
}
|
||||
|
||||
static void hi3660_clk_sctrl_init(struct device_node *np)
|
||||
{
|
||||
struct hisi_clock_data *clk_data;
|
||||
int nr = ARRAY_SIZE(hi3660_sctrl_gate_clks) +
|
||||
ARRAY_SIZE(hi3660_sctrl_gate_sep_clks) +
|
||||
ARRAY_SIZE(hi3660_sctrl_mux_clks) +
|
||||
ARRAY_SIZE(hi3660_sctrl_divider_clks);
|
||||
|
||||
clk_data = hisi_clk_init(np, nr);
|
||||
if (!clk_data)
|
||||
return;
|
||||
hisi_clk_register_gate(hi3660_sctrl_gate_clks,
|
||||
ARRAY_SIZE(hi3660_sctrl_gate_clks), clk_data);
|
||||
hisi_clk_register_gate_sep(hi3660_sctrl_gate_sep_clks,
|
||||
ARRAY_SIZE(hi3660_sctrl_gate_sep_clks),
|
||||
clk_data);
|
||||
hisi_clk_register_mux(hi3660_sctrl_mux_clks,
|
||||
ARRAY_SIZE(hi3660_sctrl_mux_clks), clk_data);
|
||||
hisi_clk_register_divider(hi3660_sctrl_divider_clks,
|
||||
ARRAY_SIZE(hi3660_sctrl_divider_clks),
|
||||
clk_data);
|
||||
}
|
||||
|
||||
static void hi3660_clk_crgctrl_init(struct device_node *np)
|
||||
{
|
||||
struct hisi_clock_data *clk_data;
|
||||
int nr = ARRAY_SIZE(hi3660_fixed_rate_clks) +
|
||||
ARRAY_SIZE(hi3660_crgctrl_gate_sep_clks) +
|
||||
ARRAY_SIZE(hi3660_crgctrl_gate_clks) +
|
||||
ARRAY_SIZE(hi3660_crgctrl_mux_clks) +
|
||||
ARRAY_SIZE(hi3660_crg_fixed_factor_clks) +
|
||||
ARRAY_SIZE(hi3660_crgctrl_divider_clks);
|
||||
|
||||
clk_data = hisi_clk_init(np, nr);
|
||||
if (!clk_data)
|
||||
return;
|
||||
|
||||
hisi_clk_register_fixed_rate(hi3660_fixed_rate_clks,
|
||||
ARRAY_SIZE(hi3660_fixed_rate_clks),
|
||||
clk_data);
|
||||
hisi_clk_register_gate_sep(hi3660_crgctrl_gate_sep_clks,
|
||||
ARRAY_SIZE(hi3660_crgctrl_gate_sep_clks),
|
||||
clk_data);
|
||||
hisi_clk_register_gate(hi3660_crgctrl_gate_clks,
|
||||
ARRAY_SIZE(hi3660_crgctrl_gate_clks),
|
||||
clk_data);
|
||||
hisi_clk_register_mux(hi3660_crgctrl_mux_clks,
|
||||
ARRAY_SIZE(hi3660_crgctrl_mux_clks),
|
||||
clk_data);
|
||||
hisi_clk_register_fixed_factor(hi3660_crg_fixed_factor_clks,
|
||||
ARRAY_SIZE(hi3660_crg_fixed_factor_clks),
|
||||
clk_data);
|
||||
hisi_clk_register_divider(hi3660_crgctrl_divider_clks,
|
||||
ARRAY_SIZE(hi3660_crgctrl_divider_clks),
|
||||
clk_data);
|
||||
}
|
||||
|
||||
static const struct of_device_id hi3660_clk_match_table[] = {
|
||||
{ .compatible = "hisilicon,hi3660-crgctrl",
|
||||
.data = hi3660_clk_crgctrl_init },
|
||||
{ .compatible = "hisilicon,hi3660-pctrl",
|
||||
.data = hi3660_clk_pctrl_init },
|
||||
{ .compatible = "hisilicon,hi3660-pmuctrl",
|
||||
.data = hi3660_clk_pmuctrl_init },
|
||||
{ .compatible = "hisilicon,hi3660-sctrl",
|
||||
.data = hi3660_clk_sctrl_init },
|
||||
{ .compatible = "hisilicon,hi3660-iomcu",
|
||||
.data = hi3660_clk_iomcu_init },
|
||||
{ }
|
||||
};
|
||||
|
||||
static int hi3660_clk_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
void (*init_func)(struct device_node *np);
|
||||
|
||||
init_func = of_device_get_match_data(dev);
|
||||
if (!init_func)
|
||||
return -ENODEV;
|
||||
|
||||
init_func(np);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver hi3660_clk_driver = {
|
||||
.probe = hi3660_clk_probe,
|
||||
.driver = {
|
||||
.name = "hi3660-clk",
|
||||
.of_match_table = hi3660_clk_match_table,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init hi3660_clk_init(void)
|
||||
{
|
||||
return platform_driver_register(&hi3660_clk_driver);
|
||||
}
|
||||
core_initcall(hi3660_clk_init);
|
@ -120,6 +120,7 @@ struct clk *hisi_register_clkgate_sep(struct device *dev, const char *name,
|
||||
sclk->bit_idx = bit_idx;
|
||||
sclk->flags = clk_gate_flags;
|
||||
sclk->hw.init = &init;
|
||||
sclk->lock = lock;
|
||||
|
||||
clk = clk_register(dev, &sclk->hw);
|
||||
if (IS_ERR(clk))
|
||||
|
@ -592,6 +592,10 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
|
||||
|
||||
imx6q_mmdc_ch1_mask_handshake(base);
|
||||
|
||||
if (clk_on_imx6qp()) {
|
||||
clk[IMX6QDL_CLK_LDB_DI0_SEL] = imx_clk_mux_flags("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels), CLK_SET_RATE_PARENT);
|
||||
clk[IMX6QDL_CLK_LDB_DI1_SEL] = imx_clk_mux_flags("ldb_di1_sel", base + 0x2c, 12, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels), CLK_SET_RATE_PARENT);
|
||||
} else {
|
||||
/*
|
||||
* The LDB_DI0/1_SEL muxes are registered read-only due to a hardware
|
||||
* bug. Set the muxes to the requested values before registering the
|
||||
@ -601,6 +605,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
|
||||
|
||||
clk[IMX6QDL_CLK_LDB_DI0_SEL] = imx_clk_mux_ldb("ldb_di0_sel", base + 0x2c, 9, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels));
|
||||
clk[IMX6QDL_CLK_LDB_DI1_SEL] = imx_clk_mux_ldb("ldb_di1_sel", base + 0x2c, 12, 3, ldb_di_sels, ARRAY_SIZE(ldb_di_sels));
|
||||
}
|
||||
clk[IMX6QDL_CLK_IPU1_DI0_PRE_SEL] = imx_clk_mux_flags("ipu1_di0_pre_sel", base + 0x34, 6, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT);
|
||||
clk[IMX6QDL_CLK_IPU1_DI1_PRE_SEL] = imx_clk_mux_flags("ipu1_di1_pre_sel", base + 0x34, 15, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT);
|
||||
clk[IMX6QDL_CLK_IPU2_DI0_PRE_SEL] = imx_clk_mux_flags("ipu2_di0_pre_sel", base + 0x38, 6, 3, ipu_di_pre_sels, ARRAY_SIZE(ipu_di_pre_sels), CLK_SET_RATE_PARENT);
|
||||
|
@ -803,6 +803,7 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node)
|
||||
clks[IMX7D_DRAM_PHYM_ROOT_CLK] = imx_clk_gate4("dram_phym_root_clk", "dram_phym_cg", base + 0x4130, 0);
|
||||
clks[IMX7D_DRAM_PHYM_ALT_ROOT_CLK] = imx_clk_gate4("dram_phym_alt_root_clk", "dram_phym_alt_post_div", base + 0x4130, 0);
|
||||
clks[IMX7D_DRAM_ALT_ROOT_CLK] = imx_clk_gate4("dram_alt_root_clk", "dram_alt_post_div", base + 0x4130, 0);
|
||||
clks[IMX7D_OCOTP_CLK] = imx_clk_gate4("ocotp_clk", "ipg_root_clk", base + 0x4230, 0);
|
||||
clks[IMX7D_USB_HSIC_ROOT_CLK] = imx_clk_gate4("usb_hsic_root_clk", "usb_hsic_post_div", base + 0x4420, 0);
|
||||
clks[IMX7D_SDMA_CORE_CLK] = imx_clk_gate4("sdma_root_clk", "ahb_root_clk", base + 0x4480, 0);
|
||||
clks[IMX7D_PCIE_CTRL_ROOT_CLK] = imx_clk_gate4("pcie_ctrl_root_clk", "pcie_ctrl_post_div", base + 0x4600, 0);
|
||||
|
@ -21,6 +21,9 @@
|
||||
#define PLL_NUM_OFFSET 0x10
|
||||
#define PLL_DENOM_OFFSET 0x20
|
||||
|
||||
#define PLL_VF610_NUM_OFFSET 0x20
|
||||
#define PLL_VF610_DENOM_OFFSET 0x30
|
||||
|
||||
#define BM_PLL_POWER (0x1 << 12)
|
||||
#define BM_PLL_LOCK (0x1 << 31)
|
||||
#define IMX7_ENET_PLL_POWER (0x1 << 5)
|
||||
@ -300,6 +303,99 @@ static const struct clk_ops clk_pllv3_av_ops = {
|
||||
.set_rate = clk_pllv3_av_set_rate,
|
||||
};
|
||||
|
||||
struct clk_pllv3_vf610_mf {
|
||||
u32 mfi; /* integer part, can be 20 or 22 */
|
||||
u32 mfn; /* numerator, 30-bit value */
|
||||
u32 mfd; /* denominator, 30-bit value, must be less than mfn */
|
||||
};
|
||||
|
||||
static unsigned long clk_pllv3_vf610_mf_to_rate(unsigned long parent_rate,
|
||||
struct clk_pllv3_vf610_mf mf)
|
||||
{
|
||||
u64 temp64;
|
||||
|
||||
temp64 = parent_rate;
|
||||
temp64 *= mf.mfn;
|
||||
do_div(temp64, mf.mfd);
|
||||
|
||||
return (parent_rate * mf.mfi) + temp64;
|
||||
}
|
||||
|
||||
static struct clk_pllv3_vf610_mf clk_pllv3_vf610_rate_to_mf(
|
||||
unsigned long parent_rate, unsigned long rate)
|
||||
{
|
||||
struct clk_pllv3_vf610_mf mf;
|
||||
u64 temp64;
|
||||
|
||||
mf.mfi = (rate >= 22 * parent_rate) ? 22 : 20;
|
||||
mf.mfd = 0x3fffffff; /* use max supported value for best accuracy */
|
||||
|
||||
if (rate <= parent_rate * mf.mfi)
|
||||
mf.mfn = 0;
|
||||
else if (rate >= parent_rate * (mf.mfi + 1))
|
||||
mf.mfn = mf.mfd - 1;
|
||||
else {
|
||||
/* rate = parent_rate * (mfi + mfn/mfd) */
|
||||
temp64 = rate - parent_rate * mf.mfi;
|
||||
temp64 *= mf.mfd;
|
||||
do_div(temp64, parent_rate);
|
||||
mf.mfn = temp64;
|
||||
}
|
||||
|
||||
return mf;
|
||||
}
|
||||
|
||||
static unsigned long clk_pllv3_vf610_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_pllv3 *pll = to_clk_pllv3(hw);
|
||||
struct clk_pllv3_vf610_mf mf;
|
||||
|
||||
mf.mfn = readl_relaxed(pll->base + PLL_VF610_NUM_OFFSET);
|
||||
mf.mfd = readl_relaxed(pll->base + PLL_VF610_DENOM_OFFSET);
|
||||
mf.mfi = (readl_relaxed(pll->base) & pll->div_mask) ? 22 : 20;
|
||||
|
||||
return clk_pllv3_vf610_mf_to_rate(parent_rate, mf);
|
||||
}
|
||||
|
||||
static long clk_pllv3_vf610_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *prate)
|
||||
{
|
||||
struct clk_pllv3_vf610_mf mf = clk_pllv3_vf610_rate_to_mf(*prate, rate);
|
||||
|
||||
return clk_pllv3_vf610_mf_to_rate(*prate, mf);
|
||||
}
|
||||
|
||||
static int clk_pllv3_vf610_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_pllv3 *pll = to_clk_pllv3(hw);
|
||||
struct clk_pllv3_vf610_mf mf =
|
||||
clk_pllv3_vf610_rate_to_mf(parent_rate, rate);
|
||||
u32 val;
|
||||
|
||||
val = readl_relaxed(pll->base);
|
||||
if (mf.mfi == 20)
|
||||
val &= ~pll->div_mask; /* clear bit for mfi=20 */
|
||||
else
|
||||
val |= pll->div_mask; /* set bit for mfi=22 */
|
||||
writel_relaxed(val, pll->base);
|
||||
|
||||
writel_relaxed(mf.mfn, pll->base + PLL_VF610_NUM_OFFSET);
|
||||
writel_relaxed(mf.mfd, pll->base + PLL_VF610_DENOM_OFFSET);
|
||||
|
||||
return clk_pllv3_wait_lock(pll);
|
||||
}
|
||||
|
||||
static const struct clk_ops clk_pllv3_vf610_ops = {
|
||||
.prepare = clk_pllv3_prepare,
|
||||
.unprepare = clk_pllv3_unprepare,
|
||||
.is_prepared = clk_pllv3_is_prepared,
|
||||
.recalc_rate = clk_pllv3_vf610_recalc_rate,
|
||||
.round_rate = clk_pllv3_vf610_round_rate,
|
||||
.set_rate = clk_pllv3_vf610_set_rate,
|
||||
};
|
||||
|
||||
static unsigned long clk_pllv3_enet_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
@ -334,6 +430,9 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
|
||||
case IMX_PLLV3_SYS:
|
||||
ops = &clk_pllv3_sys_ops;
|
||||
break;
|
||||
case IMX_PLLV3_SYS_VF610:
|
||||
ops = &clk_pllv3_vf610_ops;
|
||||
break;
|
||||
case IMX_PLLV3_USB_VF610:
|
||||
pll->div_shift = 1;
|
||||
case IMX_PLLV3_USB:
|
||||
|
@ -219,8 +219,8 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
|
||||
clk[VF610_CLK_PLL6_BYPASS_SRC] = imx_clk_mux("pll6_bypass_src", PLL6_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
|
||||
clk[VF610_CLK_PLL7_BYPASS_SRC] = imx_clk_mux("pll7_bypass_src", PLL7_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
|
||||
|
||||
clk[VF610_CLK_PLL1] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll1", "pll1_bypass_src", PLL1_CTRL, 0x1);
|
||||
clk[VF610_CLK_PLL2] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2", "pll2_bypass_src", PLL2_CTRL, 0x1);
|
||||
clk[VF610_CLK_PLL1] = imx_clk_pllv3(IMX_PLLV3_SYS_VF610, "pll1", "pll1_bypass_src", PLL1_CTRL, 0x1);
|
||||
clk[VF610_CLK_PLL2] = imx_clk_pllv3(IMX_PLLV3_SYS_VF610, "pll2", "pll2_bypass_src", PLL2_CTRL, 0x1);
|
||||
clk[VF610_CLK_PLL3] = imx_clk_pllv3(IMX_PLLV3_USB_VF610, "pll3", "pll3_bypass_src", PLL3_CTRL, 0x2);
|
||||
clk[VF610_CLK_PLL4] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4", "pll4_bypass_src", PLL4_CTRL, 0x7f);
|
||||
clk[VF610_CLK_PLL5] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll5", "pll5_bypass_src", PLL5_CTRL, 0x3);
|
||||
|
@ -34,6 +34,7 @@ enum imx_pllv3_type {
|
||||
IMX_PLLV3_AV,
|
||||
IMX_PLLV3_ENET,
|
||||
IMX_PLLV3_ENET_IMX7,
|
||||
IMX_PLLV3_SYS_VF610,
|
||||
};
|
||||
|
||||
struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
|
||||
|
@ -8,52 +8,53 @@ config COMMON_CLK_MEDIATEK
|
||||
|
||||
config COMMON_CLK_MT2701
|
||||
bool "Clock driver for Mediatek MT2701"
|
||||
depends on (ARCH_MEDIATEK && ARM) || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
default ARCH_MEDIATEK
|
||||
default ARCH_MEDIATEK && ARM
|
||||
---help---
|
||||
This driver supports Mediatek MT2701 basic clocks.
|
||||
|
||||
config COMMON_CLK_MT2701_MMSYS
|
||||
bool "Clock driver for Mediatek MT2701 mmsys"
|
||||
select COMMON_CLK_MT2701
|
||||
depends on COMMON_CLK_MT2701
|
||||
---help---
|
||||
This driver supports Mediatek MT2701 mmsys clocks.
|
||||
|
||||
config COMMON_CLK_MT2701_IMGSYS
|
||||
bool "Clock driver for Mediatek MT2701 imgsys"
|
||||
select COMMON_CLK_MT2701
|
||||
depends on COMMON_CLK_MT2701
|
||||
---help---
|
||||
This driver supports Mediatek MT2701 imgsys clocks.
|
||||
|
||||
config COMMON_CLK_MT2701_VDECSYS
|
||||
bool "Clock driver for Mediatek MT2701 vdecsys"
|
||||
select COMMON_CLK_MT2701
|
||||
depends on COMMON_CLK_MT2701
|
||||
---help---
|
||||
This driver supports Mediatek MT2701 vdecsys clocks.
|
||||
|
||||
config COMMON_CLK_MT2701_HIFSYS
|
||||
bool "Clock driver for Mediatek MT2701 hifsys"
|
||||
select COMMON_CLK_MT2701
|
||||
depends on COMMON_CLK_MT2701
|
||||
---help---
|
||||
This driver supports Mediatek MT2701 hifsys clocks.
|
||||
|
||||
config COMMON_CLK_MT2701_ETHSYS
|
||||
bool "Clock driver for Mediatek MT2701 ethsys"
|
||||
select COMMON_CLK_MT2701
|
||||
depends on COMMON_CLK_MT2701
|
||||
---help---
|
||||
This driver supports Mediatek MT2701 ethsys clocks.
|
||||
|
||||
config COMMON_CLK_MT2701_BDPSYS
|
||||
bool "Clock driver for Mediatek MT2701 bdpsys"
|
||||
select COMMON_CLK_MT2701
|
||||
depends on COMMON_CLK_MT2701
|
||||
---help---
|
||||
This driver supports Mediatek MT2701 bdpsys clocks.
|
||||
|
||||
config COMMON_CLK_MT8135
|
||||
bool "Clock driver for Mediatek MT8135"
|
||||
depends on ARCH_MEDIATEK || COMPILE_TEST
|
||||
depends on (ARCH_MEDIATEK && ARM) || COMPILE_TEST
|
||||
select COMMON_CLK_MEDIATEK
|
||||
default ARCH_MEDIATEK
|
||||
default ARCH_MEDIATEK && ARM
|
||||
---help---
|
||||
This driver supports Mediatek MT8135 clocks.
|
||||
|
||||
|
@ -607,7 +607,6 @@ static int meson8b_clkc_probe(struct platform_device *pdev)
|
||||
/* Populate the base address for the MPEG clks */
|
||||
meson8b_mpeg_clk_sel.reg = clk_base + (u32)meson8b_mpeg_clk_sel.reg;
|
||||
meson8b_mpeg_clk_div.reg = clk_base + (u32)meson8b_mpeg_clk_div.reg;
|
||||
meson8b_clk81.reg = clk_base + (u32)meson8b_clk81.reg;
|
||||
|
||||
/* Populate base address for gates */
|
||||
for (i = 0; i < ARRAY_SIZE(meson8b_clk_gates); i++)
|
||||
|
@ -9,7 +9,7 @@ obj-$(CONFIG_ARMADA_39X_CLK) += armada-39x.o
|
||||
obj-$(CONFIG_ARMADA_37XX_CLK) += armada-37xx-xtal.o
|
||||
obj-$(CONFIG_ARMADA_37XX_CLK) += armada-37xx-tbg.o
|
||||
obj-$(CONFIG_ARMADA_37XX_CLK) += armada-37xx-periph.o
|
||||
obj-$(CONFIG_ARMADA_XP_CLK) += armada-xp.o
|
||||
obj-$(CONFIG_ARMADA_XP_CLK) += armada-xp.o mv98dx3236.o
|
||||
obj-$(CONFIG_ARMADA_AP806_SYSCON) += ap806-system-controller.o
|
||||
obj-$(CONFIG_ARMADA_CP110_SYSCON) += cp110-system-controller.o
|
||||
obj-$(CONFIG_DOVE_CLK) += dove.o dove-divider.o
|
||||
|
@ -55,21 +55,39 @@ static int ap806_syscon_clk_probe(struct platform_device *pdev)
|
||||
|
||||
freq_mode = reg & AP806_SAR_CLKFREQ_MODE_MASK;
|
||||
switch (freq_mode) {
|
||||
case 0x0 ... 0x5:
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
cpuclk_freq = 2000;
|
||||
break;
|
||||
case 0x6 ... 0xB:
|
||||
case 0x6:
|
||||
case 0x7:
|
||||
cpuclk_freq = 1800;
|
||||
break;
|
||||
case 0xC ... 0x11:
|
||||
case 0x4:
|
||||
case 0xB:
|
||||
case 0xD:
|
||||
cpuclk_freq = 1600;
|
||||
break;
|
||||
case 0x12 ... 0x16:
|
||||
case 0x1a:
|
||||
cpuclk_freq = 1400;
|
||||
break;
|
||||
case 0x17 ... 0x19:
|
||||
case 0x14:
|
||||
case 0x17:
|
||||
cpuclk_freq = 1300;
|
||||
break;
|
||||
case 0x19:
|
||||
cpuclk_freq = 1200;
|
||||
break;
|
||||
case 0x13:
|
||||
case 0x1d:
|
||||
cpuclk_freq = 1000;
|
||||
break;
|
||||
case 0x1c:
|
||||
cpuclk_freq = 800;
|
||||
break;
|
||||
case 0x1b:
|
||||
cpuclk_freq = 600;
|
||||
break;
|
||||
default:
|
||||
dev_err(&pdev->dev, "invalid SAR value\n");
|
||||
return -EINVAL;
|
||||
|
@ -52,6 +52,12 @@ static u32 __init axp_get_tclk_freq(void __iomem *sar)
|
||||
return 250000000;
|
||||
}
|
||||
|
||||
/* MV98DX3236 TCLK frequency is fixed to 200MHz */
|
||||
static u32 __init mv98dx3236_get_tclk_freq(void __iomem *sar)
|
||||
{
|
||||
return 200000000;
|
||||
}
|
||||
|
||||
static const u32 axp_cpu_freqs[] __initconst = {
|
||||
1000000000,
|
||||
1066000000,
|
||||
@ -89,6 +95,12 @@ static u32 __init axp_get_cpu_freq(void __iomem *sar)
|
||||
return cpu_freq;
|
||||
}
|
||||
|
||||
/* MV98DX3236 CLK frequency is fixed to 800MHz */
|
||||
static u32 __init mv98dx3236_get_cpu_freq(void __iomem *sar)
|
||||
{
|
||||
return 800000000;
|
||||
}
|
||||
|
||||
static const int axp_nbclk_ratios[32][2] __initconst = {
|
||||
{0, 1}, {1, 2}, {2, 2}, {2, 2},
|
||||
{1, 2}, {1, 2}, {1, 1}, {2, 3},
|
||||
@ -158,6 +170,11 @@ static const struct coreclk_soc_desc axp_coreclks = {
|
||||
.num_ratios = ARRAY_SIZE(axp_coreclk_ratios),
|
||||
};
|
||||
|
||||
static const struct coreclk_soc_desc mv98dx3236_coreclks = {
|
||||
.get_tclk_freq = mv98dx3236_get_tclk_freq,
|
||||
.get_cpu_freq = mv98dx3236_get_cpu_freq,
|
||||
};
|
||||
|
||||
/*
|
||||
* Clock Gating Control
|
||||
*/
|
||||
@ -195,6 +212,15 @@ static const struct clk_gating_soc_desc axp_gating_desc[] __initconst = {
|
||||
{ }
|
||||
};
|
||||
|
||||
static const struct clk_gating_soc_desc mv98dx3236_gating_desc[] __initconst = {
|
||||
{ "ge1", NULL, 3, 0 },
|
||||
{ "ge0", NULL, 4, 0 },
|
||||
{ "pex00", NULL, 5, 0 },
|
||||
{ "sdio", NULL, 17, 0 },
|
||||
{ "xor0", NULL, 22, 0 },
|
||||
{ }
|
||||
};
|
||||
|
||||
static void __init axp_clk_init(struct device_node *np)
|
||||
{
|
||||
struct device_node *cgnp =
|
||||
|
@ -71,6 +71,10 @@ static const struct clk_corediv_desc mvebu_corediv_desc[] = {
|
||||
{ .mask = 0x3f, .offset = 8, .fieldbit = 1 }, /* NAND clock */
|
||||
};
|
||||
|
||||
static const struct clk_corediv_desc mv98dx3236_corediv_desc[] = {
|
||||
{ .mask = 0x0f, .offset = 6, .fieldbit = 26 }, /* NAND clock */
|
||||
};
|
||||
|
||||
#define to_corediv_clk(p) container_of(p, struct clk_corediv, hw)
|
||||
|
||||
static int clk_corediv_is_enabled(struct clk_hw *hwclk)
|
||||
@ -232,6 +236,18 @@ static const struct clk_corediv_soc_desc armada375_corediv_soc = {
|
||||
.ratio_offset = 0x4,
|
||||
};
|
||||
|
||||
static const struct clk_corediv_soc_desc mv98dx3236_corediv_soc = {
|
||||
.descs = mv98dx3236_corediv_desc,
|
||||
.ndescs = ARRAY_SIZE(mv98dx3236_corediv_desc),
|
||||
.ops = {
|
||||
.recalc_rate = clk_corediv_recalc_rate,
|
||||
.round_rate = clk_corediv_round_rate,
|
||||
.set_rate = clk_corediv_set_rate,
|
||||
},
|
||||
.ratio_reload = BIT(10),
|
||||
.ratio_offset = 0x8,
|
||||
};
|
||||
|
||||
static void __init
|
||||
mvebu_corediv_clk_init(struct device_node *node,
|
||||
const struct clk_corediv_soc_desc *soc_desc)
|
||||
@ -313,3 +329,10 @@ static void __init armada380_corediv_clk_init(struct device_node *node)
|
||||
}
|
||||
CLK_OF_DECLARE(armada380_corediv_clk, "marvell,armada-380-corediv-clock",
|
||||
armada380_corediv_clk_init);
|
||||
|
||||
static void __init mv98dx3236_corediv_clk_init(struct device_node *node)
|
||||
{
|
||||
return mvebu_corediv_clk_init(node, &mv98dx3236_corediv_soc);
|
||||
}
|
||||
CLK_OF_DECLARE(mv98dx3236_corediv_clk, "marvell,mv98dx3236-corediv-clock",
|
||||
mv98dx3236_corediv_clk_init);
|
||||
|
@ -245,3 +245,11 @@ cpuclk_out:
|
||||
|
||||
CLK_OF_DECLARE(armada_xp_cpu_clock, "marvell,armada-xp-cpu-clock",
|
||||
of_cpu_clk_setup);
|
||||
|
||||
static void __init of_mv98dx3236_cpu_clk_setup(struct device_node *node)
|
||||
{
|
||||
of_clk_add_provider(node, of_clk_src_simple_get, NULL);
|
||||
}
|
||||
|
||||
CLK_OF_DECLARE(mv98dx3236_cpu_clock, "marvell,mv98dx3236-cpu-clock",
|
||||
of_mv98dx3236_cpu_clk_setup);
|
||||
|
@ -64,8 +64,11 @@ enum {
|
||||
#define CP110_GATE_NAND 2
|
||||
#define CP110_GATE_PPV2 3
|
||||
#define CP110_GATE_SDIO 4
|
||||
#define CP110_GATE_MG 5
|
||||
#define CP110_GATE_MG_CORE 6
|
||||
#define CP110_GATE_XOR1 7
|
||||
#define CP110_GATE_XOR0 8
|
||||
#define CP110_GATE_GOP_DP 9
|
||||
#define CP110_GATE_PCIE_X1_0 11
|
||||
#define CP110_GATE_PCIE_X1_1 12
|
||||
#define CP110_GATE_PCIE_X4 13
|
||||
@ -73,7 +76,7 @@ enum {
|
||||
#define CP110_GATE_SATA 15
|
||||
#define CP110_GATE_SATA_USB 16
|
||||
#define CP110_GATE_MAIN 17
|
||||
#define CP110_GATE_SDMMC 18
|
||||
#define CP110_GATE_SDMMC_GOP 18
|
||||
#define CP110_GATE_SLOW_IO 21
|
||||
#define CP110_GATE_USB3H0 22
|
||||
#define CP110_GATE_USB3H1 23
|
||||
@ -296,6 +299,11 @@ static int cp110_syscon_clk_probe(struct platform_device *pdev)
|
||||
"gate-clock-output-names",
|
||||
CP110_GATE_MAIN, &parent);
|
||||
break;
|
||||
case CP110_GATE_MG:
|
||||
of_property_read_string_index(np,
|
||||
"gate-clock-output-names",
|
||||
CP110_GATE_MG_CORE, &parent);
|
||||
break;
|
||||
case CP110_GATE_NAND:
|
||||
parent = nand_name;
|
||||
break;
|
||||
@ -303,9 +311,10 @@ static int cp110_syscon_clk_probe(struct platform_device *pdev)
|
||||
parent = ppv2_name;
|
||||
break;
|
||||
case CP110_GATE_SDIO:
|
||||
case CP110_GATE_GOP_DP:
|
||||
of_property_read_string_index(np,
|
||||
"gate-clock-output-names",
|
||||
CP110_GATE_SDMMC, &parent);
|
||||
CP110_GATE_SDMMC_GOP, &parent);
|
||||
break;
|
||||
case CP110_GATE_XOR1:
|
||||
case CP110_GATE_XOR0:
|
||||
|
180
drivers/clk/mvebu/mv98dx3236.c
Normal file
180
drivers/clk/mvebu/mv98dx3236.c
Normal file
@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Marvell MV98DX3236 SoC clocks
|
||||
*
|
||||
* Copyright (C) 2012 Marvell
|
||||
*
|
||||
* Gregory CLEMENT <gregory.clement@free-electrons.com>
|
||||
* Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
|
||||
* Andrew Lunn <andrew@lunn.ch>
|
||||
*
|
||||
* This file is licensed under the terms of the GNU General Public
|
||||
* License version 2. This program is licensed "as is" without any
|
||||
* warranty of any kind, whether express or implied.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/of.h>
|
||||
#include "common.h"
|
||||
|
||||
|
||||
/*
|
||||
* For 98DX4251 Sample At Reset the CPU, DDR and Main PLL clocks are all
|
||||
* defined at the same time
|
||||
*
|
||||
* SAR1[20:18] : CPU frequency DDR frequency MPLL frequency
|
||||
* 0 = 400 MHz 400 MHz 800 MHz
|
||||
* 2 = 667 MHz 667 MHz 2000 MHz
|
||||
* 3 = 800 MHz 800 MHz 1600 MHz
|
||||
* others reserved.
|
||||
*
|
||||
* For 98DX3236 Sample At Reset the CPU, DDR and Main PLL clocks are all
|
||||
* defined at the same time
|
||||
*
|
||||
* SAR1[20:18] : CPU frequency DDR frequency MPLL frequency
|
||||
* 1 = 667 MHz 667 MHz 2000 MHz
|
||||
* 2 = 400 MHz 400 MHz 400 MHz
|
||||
* 3 = 800 MHz 800 MHz 800 MHz
|
||||
* 5 = 800 MHz 400 MHz 800 MHz
|
||||
* others reserved.
|
||||
*/
|
||||
|
||||
#define SAR1_MV98DX3236_CPU_DDR_MPLL_FREQ_OPT 18
|
||||
#define SAR1_MV98DX3236_CPU_DDR_MPLL_FREQ_OPT_MASK 0x7
|
||||
|
||||
static u32 __init mv98dx3236_get_tclk_freq(void __iomem *sar)
|
||||
{
|
||||
/* Tclk = 200MHz, no SaR dependency */
|
||||
return 200000000;
|
||||
}
|
||||
|
||||
static const u32 mv98dx3236_cpu_frequencies[] __initconst = {
|
||||
0,
|
||||
667000000,
|
||||
400000000,
|
||||
800000000,
|
||||
0,
|
||||
800000000,
|
||||
0, 0,
|
||||
};
|
||||
|
||||
static const u32 mv98dx4251_cpu_frequencies[] __initconst = {
|
||||
400000000,
|
||||
0,
|
||||
667000000,
|
||||
800000000,
|
||||
0, 0, 0, 0,
|
||||
};
|
||||
|
||||
static u32 __init mv98dx3236_get_cpu_freq(void __iomem *sar)
|
||||
{
|
||||
u32 cpu_freq = 0;
|
||||
u8 cpu_freq_select = 0;
|
||||
|
||||
cpu_freq_select = ((readl(sar) >> SAR1_MV98DX3236_CPU_DDR_MPLL_FREQ_OPT) &
|
||||
SAR1_MV98DX3236_CPU_DDR_MPLL_FREQ_OPT_MASK);
|
||||
|
||||
if (of_machine_is_compatible("marvell,armadaxp-98dx4251"))
|
||||
cpu_freq = mv98dx4251_cpu_frequencies[cpu_freq_select];
|
||||
else if (of_machine_is_compatible("marvell,armadaxp-98dx3236"))
|
||||
cpu_freq = mv98dx3236_cpu_frequencies[cpu_freq_select];
|
||||
|
||||
if (!cpu_freq)
|
||||
pr_err("CPU freq select unsupported %d\n", cpu_freq_select);
|
||||
|
||||
return cpu_freq;
|
||||
}
|
||||
|
||||
enum {
|
||||
MV98DX3236_CPU_TO_DDR,
|
||||
MV98DX3236_CPU_TO_MPLL
|
||||
};
|
||||
|
||||
static const struct coreclk_ratio mv98dx3236_core_ratios[] __initconst = {
|
||||
{ .id = MV98DX3236_CPU_TO_DDR, .name = "ddrclk" },
|
||||
{ .id = MV98DX3236_CPU_TO_MPLL, .name = "mpll" },
|
||||
};
|
||||
|
||||
static const int __initconst mv98dx3236_cpu_mpll_ratios[8][2] = {
|
||||
{0, 1}, {3, 1}, {1, 1}, {1, 1},
|
||||
{0, 1}, {1, 1}, {0, 1}, {0, 1},
|
||||
};
|
||||
|
||||
static const int __initconst mv98dx3236_cpu_ddr_ratios[8][2] = {
|
||||
{0, 1}, {1, 1}, {1, 1}, {1, 1},
|
||||
{0, 1}, {1, 2}, {0, 1}, {0, 1},
|
||||
};
|
||||
|
||||
static const int __initconst mv98dx4251_cpu_mpll_ratios[8][2] = {
|
||||
{2, 1}, {0, 1}, {3, 1}, {2, 1},
|
||||
{0, 1}, {0, 1}, {0, 1}, {0, 1},
|
||||
};
|
||||
|
||||
static const int __initconst mv98dx4251_cpu_ddr_ratios[8][2] = {
|
||||
{1, 1}, {0, 1}, {1, 1}, {1, 1},
|
||||
{0, 1}, {0, 1}, {0, 1}, {0, 1},
|
||||
};
|
||||
|
||||
static void __init mv98dx3236_get_clk_ratio(
|
||||
void __iomem *sar, int id, int *mult, int *div)
|
||||
{
|
||||
u32 opt = ((readl(sar) >> SAR1_MV98DX3236_CPU_DDR_MPLL_FREQ_OPT) &
|
||||
SAR1_MV98DX3236_CPU_DDR_MPLL_FREQ_OPT_MASK);
|
||||
|
||||
switch (id) {
|
||||
case MV98DX3236_CPU_TO_DDR:
|
||||
if (of_machine_is_compatible("marvell,armadaxp-98dx4251")) {
|
||||
*mult = mv98dx4251_cpu_ddr_ratios[opt][0];
|
||||
*div = mv98dx4251_cpu_ddr_ratios[opt][1];
|
||||
} else if (of_machine_is_compatible("marvell,armadaxp-98dx3236")) {
|
||||
*mult = mv98dx3236_cpu_ddr_ratios[opt][0];
|
||||
*div = mv98dx3236_cpu_ddr_ratios[opt][1];
|
||||
}
|
||||
break;
|
||||
case MV98DX3236_CPU_TO_MPLL:
|
||||
if (of_machine_is_compatible("marvell,armadaxp-98dx4251")) {
|
||||
*mult = mv98dx4251_cpu_mpll_ratios[opt][0];
|
||||
*div = mv98dx4251_cpu_mpll_ratios[opt][1];
|
||||
} else if (of_machine_is_compatible("marvell,armadaxp-98dx3236")) {
|
||||
*mult = mv98dx3236_cpu_mpll_ratios[opt][0];
|
||||
*div = mv98dx3236_cpu_mpll_ratios[opt][1];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct coreclk_soc_desc mv98dx3236_core_clocks = {
|
||||
.get_tclk_freq = mv98dx3236_get_tclk_freq,
|
||||
.get_cpu_freq = mv98dx3236_get_cpu_freq,
|
||||
.get_clk_ratio = mv98dx3236_get_clk_ratio,
|
||||
.ratios = mv98dx3236_core_ratios,
|
||||
.num_ratios = ARRAY_SIZE(mv98dx3236_core_ratios),
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Clock Gating Control
|
||||
*/
|
||||
|
||||
static const struct clk_gating_soc_desc mv98dx3236_gating_desc[] __initconst = {
|
||||
{ "ge1", NULL, 3, 0 },
|
||||
{ "ge0", NULL, 4, 0 },
|
||||
{ "pex00", NULL, 5, 0 },
|
||||
{ "sdio", NULL, 17, 0 },
|
||||
{ "usb0", NULL, 18, 0 },
|
||||
{ "xor0", NULL, 22, 0 },
|
||||
{ }
|
||||
};
|
||||
|
||||
static void __init mv98dx3236_clk_init(struct device_node *np)
|
||||
{
|
||||
struct device_node *cgnp =
|
||||
of_find_compatible_node(NULL, NULL, "marvell,mv98dx3236-gating-clock");
|
||||
|
||||
mvebu_coreclk_setup(np, &mv98dx3236_core_clocks);
|
||||
|
||||
if (cgnp)
|
||||
mvebu_clk_gating_setup(cgnp, mv98dx3236_gating_desc);
|
||||
}
|
||||
CLK_OF_DECLARE(mv98dx3236_clk, "marvell,mv98dx3236-core-clock", mv98dx3236_clk_init);
|
@ -462,8 +462,79 @@ static const struct rpm_smd_clk_desc rpm_clk_msm8916 = {
|
||||
.num_clks = ARRAY_SIZE(msm8916_clks),
|
||||
};
|
||||
|
||||
/* msm8974 */
|
||||
DEFINE_CLK_SMD_RPM(msm8974, pnoc_clk, pnoc_a_clk, QCOM_SMD_RPM_BUS_CLK, 0);
|
||||
DEFINE_CLK_SMD_RPM(msm8974, snoc_clk, snoc_a_clk, QCOM_SMD_RPM_BUS_CLK, 1);
|
||||
DEFINE_CLK_SMD_RPM(msm8974, cnoc_clk, cnoc_a_clk, QCOM_SMD_RPM_BUS_CLK, 2);
|
||||
DEFINE_CLK_SMD_RPM(msm8974, mmssnoc_ahb_clk, mmssnoc_ahb_a_clk, QCOM_SMD_RPM_BUS_CLK, 3);
|
||||
DEFINE_CLK_SMD_RPM(msm8974, bimc_clk, bimc_a_clk, QCOM_SMD_RPM_MEM_CLK, 0);
|
||||
DEFINE_CLK_SMD_RPM(msm8974, gfx3d_clk_src, gfx3d_a_clk_src, QCOM_SMD_RPM_MEM_CLK, 1);
|
||||
DEFINE_CLK_SMD_RPM(msm8974, ocmemgx_clk, ocmemgx_a_clk, QCOM_SMD_RPM_MEM_CLK, 2);
|
||||
DEFINE_CLK_SMD_RPM_QDSS(msm8974, qdss_clk, qdss_a_clk, QCOM_SMD_RPM_MISC_CLK, 1);
|
||||
DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, cxo_d0, cxo_d0_a, 1);
|
||||
DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, cxo_d1, cxo_d1_a, 2);
|
||||
DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, cxo_a0, cxo_a0_a, 4);
|
||||
DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, cxo_a1, cxo_a1_a, 5);
|
||||
DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, cxo_a2, cxo_a2_a, 6);
|
||||
DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, diff_clk, diff_a_clk, 7);
|
||||
DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, div_clk1, div_a_clk1, 11);
|
||||
DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8974, div_clk2, div_a_clk2, 12);
|
||||
DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8974, cxo_d0_pin, cxo_d0_a_pin, 1);
|
||||
DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8974, cxo_d1_pin, cxo_d1_a_pin, 2);
|
||||
DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8974, cxo_a0_pin, cxo_a0_a_pin, 4);
|
||||
DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8974, cxo_a1_pin, cxo_a1_a_pin, 5);
|
||||
DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8974, cxo_a2_pin, cxo_a2_a_pin, 6);
|
||||
|
||||
static struct clk_smd_rpm *msm8974_clks[] = {
|
||||
[RPM_SMD_PNOC_CLK] = &msm8974_pnoc_clk,
|
||||
[RPM_SMD_PNOC_A_CLK] = &msm8974_pnoc_a_clk,
|
||||
[RPM_SMD_SNOC_CLK] = &msm8974_snoc_clk,
|
||||
[RPM_SMD_SNOC_A_CLK] = &msm8974_snoc_a_clk,
|
||||
[RPM_SMD_CNOC_CLK] = &msm8974_cnoc_clk,
|
||||
[RPM_SMD_CNOC_A_CLK] = &msm8974_cnoc_a_clk,
|
||||
[RPM_SMD_MMSSNOC_AHB_CLK] = &msm8974_mmssnoc_ahb_clk,
|
||||
[RPM_SMD_MMSSNOC_AHB_A_CLK] = &msm8974_mmssnoc_ahb_a_clk,
|
||||
[RPM_SMD_BIMC_CLK] = &msm8974_bimc_clk,
|
||||
[RPM_SMD_BIMC_A_CLK] = &msm8974_bimc_a_clk,
|
||||
[RPM_SMD_OCMEMGX_CLK] = &msm8974_ocmemgx_clk,
|
||||
[RPM_SMD_OCMEMGX_A_CLK] = &msm8974_ocmemgx_a_clk,
|
||||
[RPM_SMD_QDSS_CLK] = &msm8974_qdss_clk,
|
||||
[RPM_SMD_QDSS_A_CLK] = &msm8974_qdss_a_clk,
|
||||
[RPM_SMD_CXO_D0] = &msm8974_cxo_d0,
|
||||
[RPM_SMD_CXO_D0_A] = &msm8974_cxo_d0_a,
|
||||
[RPM_SMD_CXO_D1] = &msm8974_cxo_d1,
|
||||
[RPM_SMD_CXO_D1_A] = &msm8974_cxo_d1_a,
|
||||
[RPM_SMD_CXO_A0] = &msm8974_cxo_a0,
|
||||
[RPM_SMD_CXO_A0_A] = &msm8974_cxo_a0_a,
|
||||
[RPM_SMD_CXO_A1] = &msm8974_cxo_a1,
|
||||
[RPM_SMD_CXO_A1_A] = &msm8974_cxo_a1_a,
|
||||
[RPM_SMD_CXO_A2] = &msm8974_cxo_a2,
|
||||
[RPM_SMD_CXO_A2_A] = &msm8974_cxo_a2_a,
|
||||
[RPM_SMD_DIFF_CLK] = &msm8974_diff_clk,
|
||||
[RPM_SMD_DIFF_A_CLK] = &msm8974_diff_a_clk,
|
||||
[RPM_SMD_DIV_CLK1] = &msm8974_div_clk1,
|
||||
[RPM_SMD_DIV_A_CLK1] = &msm8974_div_a_clk1,
|
||||
[RPM_SMD_DIV_CLK2] = &msm8974_div_clk2,
|
||||
[RPM_SMD_DIV_A_CLK2] = &msm8974_div_a_clk2,
|
||||
[RPM_SMD_CXO_D0_PIN] = &msm8974_cxo_d0_pin,
|
||||
[RPM_SMD_CXO_D0_A_PIN] = &msm8974_cxo_d0_a_pin,
|
||||
[RPM_SMD_CXO_D1_PIN] = &msm8974_cxo_d1_pin,
|
||||
[RPM_SMD_CXO_D1_A_PIN] = &msm8974_cxo_d1_a_pin,
|
||||
[RPM_SMD_CXO_A0_PIN] = &msm8974_cxo_a0_pin,
|
||||
[RPM_SMD_CXO_A0_A_PIN] = &msm8974_cxo_a0_a_pin,
|
||||
[RPM_SMD_CXO_A1_PIN] = &msm8974_cxo_a1_pin,
|
||||
[RPM_SMD_CXO_A1_A_PIN] = &msm8974_cxo_a1_a_pin,
|
||||
[RPM_SMD_CXO_A2_PIN] = &msm8974_cxo_a2_pin,
|
||||
[RPM_SMD_CXO_A2_A_PIN] = &msm8974_cxo_a2_a_pin,
|
||||
};
|
||||
|
||||
static const struct rpm_smd_clk_desc rpm_clk_msm8974 = {
|
||||
.clks = msm8974_clks,
|
||||
.num_clks = ARRAY_SIZE(msm8974_clks),
|
||||
};
|
||||
static const struct of_device_id rpm_smd_clk_match_table[] = {
|
||||
{ .compatible = "qcom,rpmcc-msm8916", .data = &rpm_clk_msm8916 },
|
||||
{ .compatible = "qcom,rpmcc-msm8974", .data = &rpm_clk_msm8974 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, rpm_smd_clk_match_table);
|
||||
|
@ -145,7 +145,6 @@ static int _qcom_cc_register_board_clk(struct device *dev, const char *path,
|
||||
clocks_node = of_find_node_by_path("/clocks");
|
||||
if (clocks_node)
|
||||
node = of_find_node_by_name(clocks_node, path);
|
||||
of_node_put(clocks_node);
|
||||
|
||||
if (!node) {
|
||||
fixed = devm_kzalloc(dev, sizeof(*fixed), GFP_KERNEL);
|
||||
|
@ -20,6 +20,9 @@
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/reset-controller.h>
|
||||
#include <linux/math64.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/clk.h>
|
||||
|
||||
#include <dt-bindings/clock/qcom,gcc-ipq4019.h>
|
||||
|
||||
@ -28,6 +31,13 @@
|
||||
#include "clk-rcg.h"
|
||||
#include "clk-branch.h"
|
||||
#include "reset.h"
|
||||
#include "clk-regmap-divider.h"
|
||||
|
||||
#define to_clk_regmap_div(_hw) container_of(to_clk_regmap(_hw),\
|
||||
struct clk_regmap_div, clkr)
|
||||
|
||||
#define to_clk_fepll(_hw) container_of(to_clk_regmap_div(_hw),\
|
||||
struct clk_fepll, cdiv)
|
||||
|
||||
enum {
|
||||
P_XO,
|
||||
@ -40,6 +50,41 @@ enum {
|
||||
P_DDRPLLAPSS,
|
||||
};
|
||||
|
||||
/*
|
||||
* struct clk_fepll_vco - vco feedback divider corresponds for FEPLL clocks
|
||||
* @fdbkdiv_shift: lowest bit for FDBKDIV
|
||||
* @fdbkdiv_width: number of bits in FDBKDIV
|
||||
* @refclkdiv_shift: lowest bit for REFCLKDIV
|
||||
* @refclkdiv_width: number of bits in REFCLKDIV
|
||||
* @reg: PLL_DIV register address
|
||||
*/
|
||||
struct clk_fepll_vco {
|
||||
u32 fdbkdiv_shift;
|
||||
u32 fdbkdiv_width;
|
||||
u32 refclkdiv_shift;
|
||||
u32 refclkdiv_width;
|
||||
u32 reg;
|
||||
};
|
||||
|
||||
/*
|
||||
* struct clk_fepll - clk divider corresponds to FEPLL clocks
|
||||
* @fixed_div: fixed divider value if divider is fixed
|
||||
* @parent_map: map from software's parent index to hardware's src_sel field
|
||||
* @cdiv: divider values for PLL_DIV
|
||||
* @pll_vco: vco feedback divider
|
||||
* @div_table: mapping for actual divider value to register divider value
|
||||
* in case of non fixed divider
|
||||
* @freq_tbl: frequency table
|
||||
*/
|
||||
struct clk_fepll {
|
||||
u32 fixed_div;
|
||||
const u8 *parent_map;
|
||||
struct clk_regmap_div cdiv;
|
||||
const struct clk_fepll_vco *pll_vco;
|
||||
const struct clk_div_table *div_table;
|
||||
const struct freq_tbl *freq_tbl;
|
||||
};
|
||||
|
||||
static struct parent_map gcc_xo_200_500_map[] = {
|
||||
{ P_XO, 0 },
|
||||
{ P_FEPLL200, 1 },
|
||||
@ -80,7 +125,7 @@ static struct parent_map gcc_xo_sdcc1_500_map[] = {
|
||||
|
||||
static const char * const gcc_xo_sdcc1_500[] = {
|
||||
"xo",
|
||||
"ddrpll",
|
||||
"ddrpllsdcc",
|
||||
"fepll500",
|
||||
};
|
||||
|
||||
@ -121,6 +166,12 @@ static struct parent_map gcc_xo_ddr_500_200_map[] = {
|
||||
{ P_DDRPLLAPSS, 1 },
|
||||
};
|
||||
|
||||
/*
|
||||
* Contains index for safe clock during APSS freq change.
|
||||
* fepll500 is being used as safe clock so initialize it
|
||||
* with its index in parents list gcc_xo_ddr_500_200.
|
||||
*/
|
||||
static const int gcc_ipq4019_cpu_safe_parent = 2;
|
||||
static const char * const gcc_xo_ddr_500_200[] = {
|
||||
"xo",
|
||||
"fepll200",
|
||||
@ -505,7 +556,7 @@ static const struct freq_tbl ftbl_gcc_sdcc1_apps_clk[] = {
|
||||
F(25000000, P_FEPLL500, 1, 1, 20),
|
||||
F(50000000, P_FEPLL500, 1, 1, 10),
|
||||
F(100000000, P_FEPLL500, 1, 1, 5),
|
||||
F(193000000, P_DDRPLL, 1, 0, 0),
|
||||
F(192000000, P_DDRPLL, 1, 0, 0),
|
||||
{ }
|
||||
};
|
||||
|
||||
@ -526,8 +577,18 @@ static struct clk_rcg2 sdcc1_apps_clk_src = {
|
||||
static const struct freq_tbl ftbl_gcc_apps_clk[] = {
|
||||
F(48000000, P_XO, 1, 0, 0),
|
||||
F(200000000, P_FEPLL200, 1, 0, 0),
|
||||
F(384000000, P_DDRPLLAPSS, 1, 0, 0),
|
||||
F(413000000, P_DDRPLLAPSS, 1, 0, 0),
|
||||
F(448000000, P_DDRPLLAPSS, 1, 0, 0),
|
||||
F(488000000, P_DDRPLLAPSS, 1, 0, 0),
|
||||
F(500000000, P_FEPLL500, 1, 0, 0),
|
||||
F(626000000, P_DDRPLLAPSS, 1, 0, 0),
|
||||
F(512000000, P_DDRPLLAPSS, 1, 0, 0),
|
||||
F(537000000, P_DDRPLLAPSS, 1, 0, 0),
|
||||
F(565000000, P_DDRPLLAPSS, 1, 0, 0),
|
||||
F(597000000, P_DDRPLLAPSS, 1, 0, 0),
|
||||
F(632000000, P_DDRPLLAPSS, 1, 0, 0),
|
||||
F(672000000, P_DDRPLLAPSS, 1, 0, 0),
|
||||
F(716000000, P_DDRPLLAPSS, 1, 0, 0),
|
||||
{ }
|
||||
};
|
||||
|
||||
@ -541,6 +602,7 @@ static struct clk_rcg2 apps_clk_src = {
|
||||
.parent_names = gcc_xo_ddr_500_200,
|
||||
.num_parents = 4,
|
||||
.ops = &clk_rcg2_ops,
|
||||
.flags = CLK_SET_RATE_PARENT,
|
||||
},
|
||||
};
|
||||
|
||||
@ -1154,6 +1216,364 @@ static struct clk_branch gcc_wcss5g_rtc_clk = {
|
||||
},
|
||||
};
|
||||
|
||||
/* Calculates the VCO rate for FEPLL. */
|
||||
static u64 clk_fepll_vco_calc_rate(struct clk_fepll *pll_div,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
const struct clk_fepll_vco *pll_vco = pll_div->pll_vco;
|
||||
u32 fdbkdiv, refclkdiv, cdiv;
|
||||
u64 vco;
|
||||
|
||||
regmap_read(pll_div->cdiv.clkr.regmap, pll_vco->reg, &cdiv);
|
||||
refclkdiv = (cdiv >> pll_vco->refclkdiv_shift) &
|
||||
(BIT(pll_vco->refclkdiv_width) - 1);
|
||||
fdbkdiv = (cdiv >> pll_vco->fdbkdiv_shift) &
|
||||
(BIT(pll_vco->fdbkdiv_width) - 1);
|
||||
|
||||
vco = parent_rate / refclkdiv;
|
||||
vco *= 2;
|
||||
vco *= fdbkdiv;
|
||||
|
||||
return vco;
|
||||
}
|
||||
|
||||
static const struct clk_fepll_vco gcc_apss_ddrpll_vco = {
|
||||
.fdbkdiv_shift = 16,
|
||||
.fdbkdiv_width = 8,
|
||||
.refclkdiv_shift = 24,
|
||||
.refclkdiv_width = 5,
|
||||
.reg = 0x2e020,
|
||||
};
|
||||
|
||||
static const struct clk_fepll_vco gcc_fepll_vco = {
|
||||
.fdbkdiv_shift = 16,
|
||||
.fdbkdiv_width = 8,
|
||||
.refclkdiv_shift = 24,
|
||||
.refclkdiv_width = 5,
|
||||
.reg = 0x2f020,
|
||||
};
|
||||
|
||||
/*
|
||||
* Round rate function for APSS CPU PLL Clock divider.
|
||||
* It looks up the frequency table and returns the next higher frequency
|
||||
* supported in hardware.
|
||||
*/
|
||||
static long clk_cpu_div_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long *p_rate)
|
||||
{
|
||||
struct clk_fepll *pll = to_clk_fepll(hw);
|
||||
struct clk_hw *p_hw;
|
||||
const struct freq_tbl *f;
|
||||
|
||||
f = qcom_find_freq(pll->freq_tbl, rate);
|
||||
if (!f)
|
||||
return -EINVAL;
|
||||
|
||||
p_hw = clk_hw_get_parent_by_index(hw, f->src);
|
||||
*p_rate = clk_hw_get_rate(p_hw);
|
||||
|
||||
return f->freq;
|
||||
};
|
||||
|
||||
/*
|
||||
* Clock set rate function for APSS CPU PLL Clock divider.
|
||||
* It looks up the frequency table and updates the PLL divider to corresponding
|
||||
* divider value.
|
||||
*/
|
||||
static int clk_cpu_div_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_fepll *pll = to_clk_fepll(hw);
|
||||
const struct freq_tbl *f;
|
||||
u32 mask;
|
||||
int ret;
|
||||
|
||||
f = qcom_find_freq(pll->freq_tbl, rate);
|
||||
if (!f)
|
||||
return -EINVAL;
|
||||
|
||||
mask = (BIT(pll->cdiv.width) - 1) << pll->cdiv.shift;
|
||||
ret = regmap_update_bits(pll->cdiv.clkr.regmap,
|
||||
pll->cdiv.reg, mask,
|
||||
f->pre_div << pll->cdiv.shift);
|
||||
/*
|
||||
* There is no status bit which can be checked for successful CPU
|
||||
* divider update operation so using delay for the same.
|
||||
*/
|
||||
udelay(1);
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
/*
|
||||
* Clock frequency calculation function for APSS CPU PLL Clock divider.
|
||||
* This clock divider is nonlinear so this function calculates the actual
|
||||
* divider and returns the output frequency by dividing VCO Frequency
|
||||
* with this actual divider value.
|
||||
*/
|
||||
static unsigned long
|
||||
clk_cpu_div_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_fepll *pll = to_clk_fepll(hw);
|
||||
u32 cdiv, pre_div;
|
||||
u64 rate;
|
||||
|
||||
regmap_read(pll->cdiv.clkr.regmap, pll->cdiv.reg, &cdiv);
|
||||
cdiv = (cdiv >> pll->cdiv.shift) & (BIT(pll->cdiv.width) - 1);
|
||||
|
||||
/*
|
||||
* Some dividers have value in 0.5 fraction so multiply both VCO
|
||||
* frequency(parent_rate) and pre_div with 2 to make integer
|
||||
* calculation.
|
||||
*/
|
||||
if (cdiv > 10)
|
||||
pre_div = (cdiv + 1) * 2;
|
||||
else
|
||||
pre_div = cdiv + 12;
|
||||
|
||||
rate = clk_fepll_vco_calc_rate(pll, parent_rate) * 2;
|
||||
do_div(rate, pre_div);
|
||||
|
||||
return rate;
|
||||
};
|
||||
|
||||
static const struct clk_ops clk_regmap_cpu_div_ops = {
|
||||
.round_rate = clk_cpu_div_round_rate,
|
||||
.set_rate = clk_cpu_div_set_rate,
|
||||
.recalc_rate = clk_cpu_div_recalc_rate,
|
||||
};
|
||||
|
||||
static const struct freq_tbl ftbl_apss_ddr_pll[] = {
|
||||
{ 384000000, P_XO, 0xd, 0, 0 },
|
||||
{ 413000000, P_XO, 0xc, 0, 0 },
|
||||
{ 448000000, P_XO, 0xb, 0, 0 },
|
||||
{ 488000000, P_XO, 0xa, 0, 0 },
|
||||
{ 512000000, P_XO, 0x9, 0, 0 },
|
||||
{ 537000000, P_XO, 0x8, 0, 0 },
|
||||
{ 565000000, P_XO, 0x7, 0, 0 },
|
||||
{ 597000000, P_XO, 0x6, 0, 0 },
|
||||
{ 632000000, P_XO, 0x5, 0, 0 },
|
||||
{ 672000000, P_XO, 0x4, 0, 0 },
|
||||
{ 716000000, P_XO, 0x3, 0, 0 },
|
||||
{ 768000000, P_XO, 0x2, 0, 0 },
|
||||
{ 823000000, P_XO, 0x1, 0, 0 },
|
||||
{ 896000000, P_XO, 0x0, 0, 0 },
|
||||
{ }
|
||||
};
|
||||
|
||||
static struct clk_fepll gcc_apss_cpu_plldiv_clk = {
|
||||
.cdiv.reg = 0x2e020,
|
||||
.cdiv.shift = 4,
|
||||
.cdiv.width = 4,
|
||||
.cdiv.clkr = {
|
||||
.enable_reg = 0x2e000,
|
||||
.enable_mask = BIT(0),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "ddrpllapss",
|
||||
.parent_names = (const char *[]){
|
||||
"xo",
|
||||
},
|
||||
.num_parents = 1,
|
||||
.ops = &clk_regmap_cpu_div_ops,
|
||||
},
|
||||
},
|
||||
.freq_tbl = ftbl_apss_ddr_pll,
|
||||
.pll_vco = &gcc_apss_ddrpll_vco,
|
||||
};
|
||||
|
||||
/* Calculates the rate for PLL divider.
|
||||
* If the divider value is not fixed then it gets the actual divider value
|
||||
* from divider table. Then, it calculate the clock rate by dividing the
|
||||
* parent rate with actual divider value.
|
||||
*/
|
||||
static unsigned long
|
||||
clk_regmap_clk_div_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct clk_fepll *pll = to_clk_fepll(hw);
|
||||
u32 cdiv, pre_div = 1;
|
||||
u64 rate;
|
||||
const struct clk_div_table *clkt;
|
||||
|
||||
if (pll->fixed_div) {
|
||||
pre_div = pll->fixed_div;
|
||||
} else {
|
||||
regmap_read(pll->cdiv.clkr.regmap, pll->cdiv.reg, &cdiv);
|
||||
cdiv = (cdiv >> pll->cdiv.shift) & (BIT(pll->cdiv.width) - 1);
|
||||
|
||||
for (clkt = pll->div_table; clkt->div; clkt++) {
|
||||
if (clkt->val == cdiv)
|
||||
pre_div = clkt->div;
|
||||
}
|
||||
}
|
||||
|
||||
rate = clk_fepll_vco_calc_rate(pll, parent_rate);
|
||||
do_div(rate, pre_div);
|
||||
|
||||
return rate;
|
||||
};
|
||||
|
||||
static const struct clk_ops clk_fepll_div_ops = {
|
||||
.recalc_rate = clk_regmap_clk_div_recalc_rate,
|
||||
};
|
||||
|
||||
static struct clk_fepll gcc_apss_sdcc_clk = {
|
||||
.fixed_div = 28,
|
||||
.cdiv.clkr = {
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "ddrpllsdcc",
|
||||
.parent_names = (const char *[]){
|
||||
"xo",
|
||||
},
|
||||
.num_parents = 1,
|
||||
.ops = &clk_fepll_div_ops,
|
||||
},
|
||||
},
|
||||
.pll_vco = &gcc_apss_ddrpll_vco,
|
||||
};
|
||||
|
||||
static struct clk_fepll gcc_fepll125_clk = {
|
||||
.fixed_div = 32,
|
||||
.cdiv.clkr = {
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "fepll125",
|
||||
.parent_names = (const char *[]){
|
||||
"xo",
|
||||
},
|
||||
.num_parents = 1,
|
||||
.ops = &clk_fepll_div_ops,
|
||||
},
|
||||
},
|
||||
.pll_vco = &gcc_fepll_vco,
|
||||
};
|
||||
|
||||
static struct clk_fepll gcc_fepll125dly_clk = {
|
||||
.fixed_div = 32,
|
||||
.cdiv.clkr = {
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "fepll125dly",
|
||||
.parent_names = (const char *[]){
|
||||
"xo",
|
||||
},
|
||||
.num_parents = 1,
|
||||
.ops = &clk_fepll_div_ops,
|
||||
},
|
||||
},
|
||||
.pll_vco = &gcc_fepll_vco,
|
||||
};
|
||||
|
||||
static struct clk_fepll gcc_fepll200_clk = {
|
||||
.fixed_div = 20,
|
||||
.cdiv.clkr = {
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "fepll200",
|
||||
.parent_names = (const char *[]){
|
||||
"xo",
|
||||
},
|
||||
.num_parents = 1,
|
||||
.ops = &clk_fepll_div_ops,
|
||||
},
|
||||
},
|
||||
.pll_vco = &gcc_fepll_vco,
|
||||
};
|
||||
|
||||
static struct clk_fepll gcc_fepll500_clk = {
|
||||
.fixed_div = 8,
|
||||
.cdiv.clkr = {
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "fepll500",
|
||||
.parent_names = (const char *[]){
|
||||
"xo",
|
||||
},
|
||||
.num_parents = 1,
|
||||
.ops = &clk_fepll_div_ops,
|
||||
},
|
||||
},
|
||||
.pll_vco = &gcc_fepll_vco,
|
||||
};
|
||||
|
||||
static const struct clk_div_table fepllwcss_clk_div_table[] = {
|
||||
{ 0, 15 },
|
||||
{ 1, 16 },
|
||||
{ 2, 18 },
|
||||
{ 3, 20 },
|
||||
{ },
|
||||
};
|
||||
|
||||
static struct clk_fepll gcc_fepllwcss2g_clk = {
|
||||
.cdiv.reg = 0x2f020,
|
||||
.cdiv.shift = 8,
|
||||
.cdiv.width = 2,
|
||||
.cdiv.clkr = {
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "fepllwcss2g",
|
||||
.parent_names = (const char *[]){
|
||||
"xo",
|
||||
},
|
||||
.num_parents = 1,
|
||||
.ops = &clk_fepll_div_ops,
|
||||
},
|
||||
},
|
||||
.div_table = fepllwcss_clk_div_table,
|
||||
.pll_vco = &gcc_fepll_vco,
|
||||
};
|
||||
|
||||
static struct clk_fepll gcc_fepllwcss5g_clk = {
|
||||
.cdiv.reg = 0x2f020,
|
||||
.cdiv.shift = 12,
|
||||
.cdiv.width = 2,
|
||||
.cdiv.clkr = {
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "fepllwcss5g",
|
||||
.parent_names = (const char *[]){
|
||||
"xo",
|
||||
},
|
||||
.num_parents = 1,
|
||||
.ops = &clk_fepll_div_ops,
|
||||
},
|
||||
},
|
||||
.div_table = fepllwcss_clk_div_table,
|
||||
.pll_vco = &gcc_fepll_vco,
|
||||
};
|
||||
|
||||
static const struct freq_tbl ftbl_gcc_pcnoc_ahb_clk[] = {
|
||||
F(48000000, P_XO, 1, 0, 0),
|
||||
F(100000000, P_FEPLL200, 2, 0, 0),
|
||||
{ }
|
||||
};
|
||||
|
||||
static struct clk_rcg2 gcc_pcnoc_ahb_clk_src = {
|
||||
.cmd_rcgr = 0x21024,
|
||||
.hid_width = 5,
|
||||
.parent_map = gcc_xo_200_500_map,
|
||||
.freq_tbl = ftbl_gcc_pcnoc_ahb_clk,
|
||||
.clkr.hw.init = &(struct clk_init_data){
|
||||
.name = "gcc_pcnoc_ahb_clk_src",
|
||||
.parent_names = gcc_xo_200_500,
|
||||
.num_parents = 3,
|
||||
.ops = &clk_rcg2_ops,
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch pcnoc_clk_src = {
|
||||
.halt_reg = 0x21030,
|
||||
.clkr = {
|
||||
.enable_reg = 0x21030,
|
||||
.enable_mask = BIT(0),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "pcnoc_clk_src",
|
||||
.parent_names = (const char *[]){
|
||||
"gcc_pcnoc_ahb_clk_src",
|
||||
},
|
||||
.num_parents = 1,
|
||||
.ops = &clk_branch2_ops,
|
||||
.flags = CLK_SET_RATE_PARENT |
|
||||
CLK_IS_CRITICAL,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_regmap *gcc_ipq4019_clocks[] = {
|
||||
[AUDIO_CLK_SRC] = &audio_clk_src.clkr,
|
||||
[BLSP1_QUP1_I2C_APPS_CLK_SRC] = &blsp1_qup1_i2c_apps_clk_src.clkr,
|
||||
@ -1214,6 +1634,16 @@ static struct clk_regmap *gcc_ipq4019_clocks[] = {
|
||||
[GCC_WCSS5G_CLK] = &gcc_wcss5g_clk.clkr,
|
||||
[GCC_WCSS5G_REF_CLK] = &gcc_wcss5g_ref_clk.clkr,
|
||||
[GCC_WCSS5G_RTC_CLK] = &gcc_wcss5g_rtc_clk.clkr,
|
||||
[GCC_SDCC_PLLDIV_CLK] = &gcc_apss_sdcc_clk.cdiv.clkr,
|
||||
[GCC_FEPLL125_CLK] = &gcc_fepll125_clk.cdiv.clkr,
|
||||
[GCC_FEPLL125DLY_CLK] = &gcc_fepll125dly_clk.cdiv.clkr,
|
||||
[GCC_FEPLL200_CLK] = &gcc_fepll200_clk.cdiv.clkr,
|
||||
[GCC_FEPLL500_CLK] = &gcc_fepll500_clk.cdiv.clkr,
|
||||
[GCC_FEPLL_WCSS2G_CLK] = &gcc_fepllwcss2g_clk.cdiv.clkr,
|
||||
[GCC_FEPLL_WCSS5G_CLK] = &gcc_fepllwcss5g_clk.cdiv.clkr,
|
||||
[GCC_APSS_CPU_PLLDIV_CLK] = &gcc_apss_cpu_plldiv_clk.cdiv.clkr,
|
||||
[GCC_PCNOC_AHB_CLK_SRC] = &gcc_pcnoc_ahb_clk_src.clkr,
|
||||
[GCC_PCNOC_AHB_CLK] = &pcnoc_clk_src.clkr,
|
||||
};
|
||||
|
||||
static const struct qcom_reset_map gcc_ipq4019_resets[] = {
|
||||
@ -1294,7 +1724,7 @@ static const struct regmap_config gcc_ipq4019_regmap_config = {
|
||||
.reg_bits = 32,
|
||||
.reg_stride = 4,
|
||||
.val_bits = 32,
|
||||
.max_register = 0x2dfff,
|
||||
.max_register = 0x2ffff,
|
||||
.fast_io = true,
|
||||
};
|
||||
|
||||
@ -1312,23 +1742,44 @@ static const struct of_device_id gcc_ipq4019_match_table[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, gcc_ipq4019_match_table);
|
||||
|
||||
static int
|
||||
gcc_ipq4019_cpu_clk_notifier_fn(struct notifier_block *nb,
|
||||
unsigned long action, void *data)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
if (action == PRE_RATE_CHANGE)
|
||||
err = clk_rcg2_ops.set_parent(&apps_clk_src.clkr.hw,
|
||||
gcc_ipq4019_cpu_safe_parent);
|
||||
|
||||
return notifier_from_errno(err);
|
||||
}
|
||||
|
||||
static struct notifier_block gcc_ipq4019_cpu_clk_notifier = {
|
||||
.notifier_call = gcc_ipq4019_cpu_clk_notifier_fn,
|
||||
};
|
||||
|
||||
static int gcc_ipq4019_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
int err;
|
||||
|
||||
clk_register_fixed_rate(dev, "fepll125", "xo", 0, 200000000);
|
||||
clk_register_fixed_rate(dev, "fepll125dly", "xo", 0, 200000000);
|
||||
clk_register_fixed_rate(dev, "fepllwcss2g", "xo", 0, 200000000);
|
||||
clk_register_fixed_rate(dev, "fepllwcss5g", "xo", 0, 200000000);
|
||||
clk_register_fixed_rate(dev, "fepll200", "xo", 0, 200000000);
|
||||
clk_register_fixed_rate(dev, "fepll500", "xo", 0, 200000000);
|
||||
clk_register_fixed_rate(dev, "ddrpllapss", "xo", 0, 666000000);
|
||||
err = qcom_cc_probe(pdev, &gcc_ipq4019_desc);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return qcom_cc_probe(pdev, &gcc_ipq4019_desc);
|
||||
return clk_notifier_register(apps_clk_src.clkr.hw.clk,
|
||||
&gcc_ipq4019_cpu_clk_notifier);
|
||||
}
|
||||
|
||||
static int gcc_ipq4019_remove(struct platform_device *pdev)
|
||||
{
|
||||
return clk_notifier_unregister(apps_clk_src.clkr.hw.clk,
|
||||
&gcc_ipq4019_cpu_clk_notifier);
|
||||
}
|
||||
|
||||
static struct platform_driver gcc_ipq4019_driver = {
|
||||
.probe = gcc_ipq4019_probe,
|
||||
.remove = gcc_ipq4019_remove,
|
||||
.driver = {
|
||||
.name = "qcom,gcc-ipq4019",
|
||||
.of_match_table = gcc_ipq4019_match_table,
|
||||
|
@ -1563,6 +1563,34 @@ static struct clk_branch rpm_msg_ram_h_clk = {
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch ebi2_clk = {
|
||||
.hwcg_reg = 0x2664,
|
||||
.hwcg_bit = 6,
|
||||
.halt_reg = 0x2fcc,
|
||||
.halt_bit = 24,
|
||||
.clkr = {
|
||||
.enable_reg = 0x2664,
|
||||
.enable_mask = BIT(6) | BIT(4),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "ebi2_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch ebi2_aon_clk = {
|
||||
.halt_reg = 0x2fcc,
|
||||
.halt_bit = 23,
|
||||
.clkr = {
|
||||
.enable_reg = 0x2664,
|
||||
.enable_mask = BIT(8),
|
||||
.hw.init = &(struct clk_init_data){
|
||||
.name = "ebi2_aon_clk",
|
||||
.ops = &clk_branch_ops,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_hw *gcc_mdm9615_hws[] = {
|
||||
&cxo.hw,
|
||||
};
|
||||
@ -1637,6 +1665,8 @@ static struct clk_regmap *gcc_mdm9615_clks[] = {
|
||||
[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,
|
||||
[EBI2_CLK] = &ebi2_clk.clkr,
|
||||
[EBI2_AON_CLK] = &ebi2_aon_clk.clkr,
|
||||
};
|
||||
|
||||
static const struct qcom_reset_map gcc_mdm9615_resets[] = {
|
||||
|
@ -1888,6 +1888,23 @@ static struct clk_branch gcc_sdcc1_apps_clk = {
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch gcc_sdcc1_ahb_clk = {
|
||||
.halt_reg = 0x04c8,
|
||||
.clkr = {
|
||||
.enable_reg = 0x04c8,
|
||||
.enable_mask = BIT(0),
|
||||
.hw.init = &(struct clk_init_data)
|
||||
{
|
||||
.name = "gcc_sdcc1_ahb_clk",
|
||||
.parent_names = (const char *[]){
|
||||
"periph_noc_clk_src",
|
||||
},
|
||||
.num_parents = 1,
|
||||
.ops = &clk_branch2_ops,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_branch gcc_sdcc2_apps_clk = {
|
||||
.halt_reg = 0x0504,
|
||||
.clkr = {
|
||||
@ -2231,6 +2248,7 @@ static struct clk_regmap *gcc_msm8994_clocks[] = {
|
||||
[GCC_SDCC2_APPS_CLK] = &gcc_sdcc2_apps_clk.clkr,
|
||||
[GCC_SDCC3_APPS_CLK] = &gcc_sdcc3_apps_clk.clkr,
|
||||
[GCC_SDCC4_APPS_CLK] = &gcc_sdcc4_apps_clk.clkr,
|
||||
[GCC_SDCC1_AHB_CLK] = &gcc_sdcc1_ahb_clk.clkr,
|
||||
[GCC_SYS_NOC_UFS_AXI_CLK] = &gcc_sys_noc_ufs_axi_clk.clkr,
|
||||
[GCC_SYS_NOC_USB3_AXI_CLK] = &gcc_sys_noc_usb3_axi_clk.clkr,
|
||||
[GCC_TSIF_REF_CLK] = &gcc_tsif_ref_clk.clkr,
|
||||
|
@ -3448,6 +3448,7 @@ static const struct qcom_reset_map gcc_msm8996_resets[] = {
|
||||
[GCC_MSMPU_BCR] = { 0x8d000 },
|
||||
[GCC_MSS_Q6_BCR] = { 0x8e000 },
|
||||
[GCC_QREFS_VBG_CAL_BCR] = { 0x88020 },
|
||||
[GCC_MSS_RESTART] = { 0x8f008 },
|
||||
};
|
||||
|
||||
static const struct regmap_config gcc_msm8996_regmap_config = {
|
||||
|
@ -63,11 +63,26 @@ static int gdsc_hwctrl(struct gdsc *sc, bool en)
|
||||
return regmap_update_bits(sc->regmap, sc->gdscr, HW_CONTROL_MASK, val);
|
||||
}
|
||||
|
||||
static int gdsc_poll_status(struct gdsc *sc, unsigned int reg, bool en)
|
||||
{
|
||||
ktime_t start;
|
||||
|
||||
start = ktime_get();
|
||||
do {
|
||||
if (gdsc_is_enabled(sc, reg) == en)
|
||||
return 0;
|
||||
} while (ktime_us_delta(ktime_get(), start) < TIMEOUT_US);
|
||||
|
||||
if (gdsc_is_enabled(sc, reg) == en)
|
||||
return 0;
|
||||
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
static int gdsc_toggle_logic(struct gdsc *sc, bool en)
|
||||
{
|
||||
int ret;
|
||||
u32 val = en ? 0 : SW_COLLAPSE_MASK;
|
||||
ktime_t start;
|
||||
unsigned int status_reg = sc->gdscr;
|
||||
|
||||
ret = regmap_update_bits(sc->regmap, sc->gdscr, SW_COLLAPSE_MASK, val);
|
||||
@ -100,16 +115,7 @@ static int gdsc_toggle_logic(struct gdsc *sc, bool en)
|
||||
udelay(1);
|
||||
}
|
||||
|
||||
start = ktime_get();
|
||||
do {
|
||||
if (gdsc_is_enabled(sc, status_reg) == en)
|
||||
return 0;
|
||||
} while (ktime_us_delta(ktime_get(), start) < TIMEOUT_US);
|
||||
|
||||
if (gdsc_is_enabled(sc, status_reg) == en)
|
||||
return 0;
|
||||
|
||||
return -ETIMEDOUT;
|
||||
return gdsc_poll_status(sc, status_reg, en);
|
||||
}
|
||||
|
||||
static inline int gdsc_deassert_reset(struct gdsc *sc)
|
||||
@ -188,8 +194,20 @@ static int gdsc_enable(struct generic_pm_domain *domain)
|
||||
udelay(1);
|
||||
|
||||
/* Turn on HW trigger mode if supported */
|
||||
if (sc->flags & HW_CTRL)
|
||||
return gdsc_hwctrl(sc, true);
|
||||
if (sc->flags & HW_CTRL) {
|
||||
ret = gdsc_hwctrl(sc, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
/*
|
||||
* Wait for the GDSC to go through a power down and
|
||||
* up cycle. In case a firmware ends up polling status
|
||||
* bits for the gdsc, it might read an 'on' status before
|
||||
* the GDSC can finish the power cycle.
|
||||
* We wait 1us before returning to ensure the firmware
|
||||
* can't immediately poll the status bits.
|
||||
*/
|
||||
udelay(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -204,9 +222,23 @@ static int gdsc_disable(struct generic_pm_domain *domain)
|
||||
|
||||
/* Turn off HW trigger mode if supported */
|
||||
if (sc->flags & HW_CTRL) {
|
||||
unsigned int reg;
|
||||
|
||||
ret = gdsc_hwctrl(sc, false);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
/*
|
||||
* Wait for the GDSC to go through a power down and
|
||||
* up cycle. In case we end up polling status
|
||||
* bits for the gdsc before the power cycle is completed
|
||||
* it might read an 'on' status wrongly.
|
||||
*/
|
||||
udelay(1);
|
||||
|
||||
reg = sc->gds_hw_ctrl ? sc->gds_hw_ctrl : sc->gdscr;
|
||||
ret = gdsc_poll_status(sc, reg, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (sc->pwrsts & PWRSTS_OFF)
|
||||
|
@ -91,6 +91,12 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
|
||||
value |= bitmask;
|
||||
cpg_mstp_write(group, value, group->smstpcr);
|
||||
|
||||
if (!group->mstpsr) {
|
||||
/* dummy read to ensure write has completed */
|
||||
cpg_mstp_read(group, group->smstpcr);
|
||||
barrier_data(group->smstpcr);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&group->lock, flags);
|
||||
|
||||
if (!enable || !group->mstpsr)
|
||||
@ -141,9 +147,9 @@ static const struct clk_ops cpg_mstp_clock_ops = {
|
||||
.is_enabled = cpg_mstp_clock_is_enabled,
|
||||
};
|
||||
|
||||
static struct clk * __init
|
||||
cpg_mstp_clock_register(const char *name, const char *parent_name,
|
||||
unsigned int index, struct mstp_clock_group *group)
|
||||
static struct clk * __init cpg_mstp_clock_register(const char *name,
|
||||
const char *parent_name, unsigned int index,
|
||||
struct mstp_clock_group *group)
|
||||
{
|
||||
struct clk_init_data init;
|
||||
struct mstp_clock *clock;
|
||||
@ -158,6 +164,11 @@ cpg_mstp_clock_register(const char *name, const char *parent_name,
|
||||
init.name = name;
|
||||
init.ops = &cpg_mstp_clock_ops;
|
||||
init.flags = CLK_IS_BASIC | CLK_SET_RATE_PARENT;
|
||||
/* INTC-SYS is the module clock of the GIC, and must not be disabled */
|
||||
if (!strcmp(name, "intc-sys")) {
|
||||
pr_debug("MSTP %s setting CLK_IS_CRITICAL\n", name);
|
||||
init.flags |= CLK_IS_CRITICAL;
|
||||
}
|
||||
init.parent_names = &parent_name;
|
||||
init.num_parents = 1;
|
||||
|
||||
|
@ -221,6 +221,7 @@ static const struct mssr_mod_clk r8a7795_mod_clks[] __initconst = {
|
||||
DEF_MOD("can-if0", 916, R8A7795_CLK_S3D4),
|
||||
DEF_MOD("i2c6", 918, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("i2c5", 919, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("i2c-dvfs", 926, R8A7795_CLK_CP),
|
||||
DEF_MOD("i2c4", 927, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("i2c3", 928, R8A7795_CLK_S3D2),
|
||||
DEF_MOD("i2c2", 929, R8A7795_CLK_S3D2),
|
||||
|
@ -103,7 +103,9 @@ static const struct cpg_core_clk r8a7796_core_clks[] __initconst = {
|
||||
DEF_FIXED("cl", R8A7796_CLK_CL, CLK_PLL1_DIV2, 48, 1),
|
||||
DEF_FIXED("cp", R8A7796_CLK_CP, CLK_EXTAL, 2, 1),
|
||||
|
||||
DEF_DIV6P1("canfd", R8A7796_CLK_CANFD, CLK_PLL1_DIV4, 0x244),
|
||||
DEF_DIV6P1("csi0", R8A7796_CLK_CSI0, CLK_PLL1_DIV4, 0x00c),
|
||||
DEF_DIV6P1("mso", R8A7796_CLK_MSO, CLK_PLL1_DIV4, 0x014),
|
||||
|
||||
DEF_DIV6_RO("osc", R8A7796_CLK_OSC, CLK_EXTAL, CPG_RCKCR, 8),
|
||||
DEF_DIV6_RO("r_int", CLK_RINT, CLK_EXTAL, CPG_RCKCR, 32),
|
||||
@ -117,6 +119,10 @@ static const struct mssr_mod_clk r8a7796_mod_clks[] __initconst = {
|
||||
DEF_MOD("scif3", 204, R8A7796_CLK_S3D4),
|
||||
DEF_MOD("scif1", 206, R8A7796_CLK_S3D4),
|
||||
DEF_MOD("scif0", 207, R8A7796_CLK_S3D4),
|
||||
DEF_MOD("msiof3", 208, R8A7796_CLK_MSO),
|
||||
DEF_MOD("msiof2", 209, R8A7796_CLK_MSO),
|
||||
DEF_MOD("msiof1", 210, R8A7796_CLK_MSO),
|
||||
DEF_MOD("msiof0", 211, R8A7796_CLK_MSO),
|
||||
DEF_MOD("sys-dmac2", 217, R8A7796_CLK_S0D3),
|
||||
DEF_MOD("sys-dmac1", 218, R8A7796_CLK_S0D3),
|
||||
DEF_MOD("sys-dmac0", 219, R8A7796_CLK_S0D3),
|
||||
@ -181,8 +187,12 @@ static const struct mssr_mod_clk r8a7796_mod_clks[] __initconst = {
|
||||
DEF_MOD("gpio2", 910, R8A7796_CLK_S3D4),
|
||||
DEF_MOD("gpio1", 911, R8A7796_CLK_S3D4),
|
||||
DEF_MOD("gpio0", 912, R8A7796_CLK_S3D4),
|
||||
DEF_MOD("can-fd", 914, R8A7796_CLK_S3D2),
|
||||
DEF_MOD("can-if1", 915, R8A7796_CLK_S3D4),
|
||||
DEF_MOD("can-if0", 916, R8A7796_CLK_S3D4),
|
||||
DEF_MOD("i2c6", 918, R8A7796_CLK_S0D6),
|
||||
DEF_MOD("i2c5", 919, R8A7796_CLK_S0D6),
|
||||
DEF_MOD("i2c-dvfs", 926, R8A7796_CLK_CP),
|
||||
DEF_MOD("i2c4", 927, R8A7796_CLK_S0D6),
|
||||
DEF_MOD("i2c3", 928, R8A7796_CLK_S0D6),
|
||||
DEF_MOD("i2c2", 929, R8A7796_CLK_S3D2),
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/clk/renesas.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
@ -25,6 +26,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_clock.h>
|
||||
#include <linux/pm_domain.h>
|
||||
#include <linux/reset-controller.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <dt-bindings/clock/renesas-cpg-mssr.h>
|
||||
@ -43,7 +45,7 @@
|
||||
* Module Standby and Software Reset register offets.
|
||||
*
|
||||
* If the registers exist, these are valid for SH-Mobile, R-Mobile,
|
||||
* R-Car Gen 2, and R-Car Gen 3.
|
||||
* R-Car Gen2, R-Car Gen3, and RZ/G1.
|
||||
* These are NOT valid for R-Car Gen1 and RZ/A1!
|
||||
*/
|
||||
|
||||
@ -96,18 +98,22 @@ static const u16 srcr[] = {
|
||||
/**
|
||||
* Clock Pulse Generator / Module Standby and Software Reset Private Data
|
||||
*
|
||||
* @rcdev: Optional reset controller entity
|
||||
* @dev: CPG/MSSR device
|
||||
* @base: CPG/MSSR register block base address
|
||||
* @mstp_lock: protects writes to SMSTPCR
|
||||
* @rmw_lock: protects RMW register accesses
|
||||
* @clks: Array containing all Core and Module Clocks
|
||||
* @num_core_clks: Number of Core Clocks in clks[]
|
||||
* @num_mod_clks: Number of Module Clocks in clks[]
|
||||
* @last_dt_core_clk: ID of the last Core Clock exported to DT
|
||||
*/
|
||||
struct cpg_mssr_priv {
|
||||
#ifdef CONFIG_RESET_CONTROLLER
|
||||
struct reset_controller_dev rcdev;
|
||||
#endif
|
||||
struct device *dev;
|
||||
void __iomem *base;
|
||||
spinlock_t mstp_lock;
|
||||
spinlock_t rmw_lock;
|
||||
|
||||
struct clk **clks;
|
||||
unsigned int num_core_clks;
|
||||
@ -144,7 +150,7 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
|
||||
|
||||
dev_dbg(dev, "MSTP %u%02u/%pC %s\n", reg, bit, hw->clk,
|
||||
enable ? "ON" : "OFF");
|
||||
spin_lock_irqsave(&priv->mstp_lock, flags);
|
||||
spin_lock_irqsave(&priv->rmw_lock, flags);
|
||||
|
||||
value = readl(priv->base + SMSTPCR(reg));
|
||||
if (enable)
|
||||
@ -153,7 +159,7 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
|
||||
value |= bitmask;
|
||||
writel(value, priv->base + SMSTPCR(reg));
|
||||
|
||||
spin_unlock_irqrestore(&priv->mstp_lock, flags);
|
||||
spin_unlock_irqrestore(&priv->rmw_lock, flags);
|
||||
|
||||
if (!enable)
|
||||
return 0;
|
||||
@ -346,17 +352,10 @@ static void __init cpg_mssr_register_mod_clk(const struct mssr_mod_clk *mod,
|
||||
init.flags = CLK_IS_BASIC | CLK_SET_RATE_PARENT;
|
||||
for (i = 0; i < info->num_crit_mod_clks; i++)
|
||||
if (id == info->crit_mod_clks[i]) {
|
||||
#ifdef CLK_ENABLE_HAND_OFF
|
||||
dev_dbg(dev, "MSTP %s setting CLK_ENABLE_HAND_OFF\n",
|
||||
dev_dbg(dev, "MSTP %s setting CLK_IS_CRITICAL\n",
|
||||
mod->name);
|
||||
init.flags |= CLK_ENABLE_HAND_OFF;
|
||||
init.flags |= CLK_IS_CRITICAL;
|
||||
break;
|
||||
#else
|
||||
dev_dbg(dev, "Ignoring MSTP %s to prevent disabling\n",
|
||||
mod->name);
|
||||
kfree(clock);
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
parent_name = __clk_get_name(parent);
|
||||
@ -501,6 +500,122 @@ static int __init cpg_mssr_add_clk_domain(struct device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RESET_CONTROLLER
|
||||
|
||||
#define rcdev_to_priv(x) container_of(x, struct cpg_mssr_priv, rcdev)
|
||||
|
||||
static int cpg_mssr_reset(struct reset_controller_dev *rcdev,
|
||||
unsigned long id)
|
||||
{
|
||||
struct cpg_mssr_priv *priv = rcdev_to_priv(rcdev);
|
||||
unsigned int reg = id / 32;
|
||||
unsigned int bit = id % 32;
|
||||
u32 bitmask = BIT(bit);
|
||||
unsigned long flags;
|
||||
u32 value;
|
||||
|
||||
dev_dbg(priv->dev, "reset %u%02u\n", reg, bit);
|
||||
|
||||
/* Reset module */
|
||||
spin_lock_irqsave(&priv->rmw_lock, flags);
|
||||
value = readl(priv->base + SRCR(reg));
|
||||
value |= bitmask;
|
||||
writel(value, priv->base + SRCR(reg));
|
||||
spin_unlock_irqrestore(&priv->rmw_lock, flags);
|
||||
|
||||
/* Wait for at least one cycle of the RCLK clock (@ ca. 32 kHz) */
|
||||
udelay(35);
|
||||
|
||||
/* Release module from reset state */
|
||||
writel(bitmask, priv->base + SRSTCLR(reg));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpg_mssr_assert(struct reset_controller_dev *rcdev, unsigned long id)
|
||||
{
|
||||
struct cpg_mssr_priv *priv = rcdev_to_priv(rcdev);
|
||||
unsigned int reg = id / 32;
|
||||
unsigned int bit = id % 32;
|
||||
u32 bitmask = BIT(bit);
|
||||
unsigned long flags;
|
||||
u32 value;
|
||||
|
||||
dev_dbg(priv->dev, "assert %u%02u\n", reg, bit);
|
||||
|
||||
spin_lock_irqsave(&priv->rmw_lock, flags);
|
||||
value = readl(priv->base + SRCR(reg));
|
||||
value |= bitmask;
|
||||
writel(value, priv->base + SRCR(reg));
|
||||
spin_unlock_irqrestore(&priv->rmw_lock, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpg_mssr_deassert(struct reset_controller_dev *rcdev,
|
||||
unsigned long id)
|
||||
{
|
||||
struct cpg_mssr_priv *priv = rcdev_to_priv(rcdev);
|
||||
unsigned int reg = id / 32;
|
||||
unsigned int bit = id % 32;
|
||||
u32 bitmask = BIT(bit);
|
||||
|
||||
dev_dbg(priv->dev, "deassert %u%02u\n", reg, bit);
|
||||
|
||||
writel(bitmask, priv->base + SRSTCLR(reg));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpg_mssr_status(struct reset_controller_dev *rcdev,
|
||||
unsigned long id)
|
||||
{
|
||||
struct cpg_mssr_priv *priv = rcdev_to_priv(rcdev);
|
||||
unsigned int reg = id / 32;
|
||||
unsigned int bit = id % 32;
|
||||
u32 bitmask = BIT(bit);
|
||||
|
||||
return !!(readl(priv->base + SRCR(reg)) & bitmask);
|
||||
}
|
||||
|
||||
static const struct reset_control_ops cpg_mssr_reset_ops = {
|
||||
.reset = cpg_mssr_reset,
|
||||
.assert = cpg_mssr_assert,
|
||||
.deassert = cpg_mssr_deassert,
|
||||
.status = cpg_mssr_status,
|
||||
};
|
||||
|
||||
static int cpg_mssr_reset_xlate(struct reset_controller_dev *rcdev,
|
||||
const struct of_phandle_args *reset_spec)
|
||||
{
|
||||
struct cpg_mssr_priv *priv = rcdev_to_priv(rcdev);
|
||||
unsigned int unpacked = reset_spec->args[0];
|
||||
unsigned int idx = MOD_CLK_PACK(unpacked);
|
||||
|
||||
if (unpacked % 100 > 31 || idx >= rcdev->nr_resets) {
|
||||
dev_err(priv->dev, "Invalid reset index %u\n", unpacked);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
static int cpg_mssr_reset_controller_register(struct cpg_mssr_priv *priv)
|
||||
{
|
||||
priv->rcdev.ops = &cpg_mssr_reset_ops;
|
||||
priv->rcdev.of_node = priv->dev->of_node;
|
||||
priv->rcdev.of_reset_n_cells = 1;
|
||||
priv->rcdev.of_xlate = cpg_mssr_reset_xlate;
|
||||
priv->rcdev.nr_resets = priv->num_mod_clks;
|
||||
return devm_reset_controller_register(priv->dev, &priv->rcdev);
|
||||
}
|
||||
|
||||
#else /* !CONFIG_RESET_CONTROLLER */
|
||||
static inline int cpg_mssr_reset_controller_register(struct cpg_mssr_priv *priv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* !CONFIG_RESET_CONTROLLER */
|
||||
|
||||
|
||||
static const struct of_device_id cpg_mssr_match[] = {
|
||||
#ifdef CONFIG_ARCH_R8A7743
|
||||
{
|
||||
@ -557,7 +672,7 @@ static int __init cpg_mssr_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
|
||||
priv->dev = dev;
|
||||
spin_lock_init(&priv->mstp_lock);
|
||||
spin_lock_init(&priv->rmw_lock);
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
priv->base = devm_ioremap_resource(dev, res);
|
||||
@ -598,6 +713,10 @@ static int __init cpg_mssr_probe(struct platform_device *pdev)
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
error = cpg_mssr_reset_controller_register(priv);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ obj-y += clk-pll.o
|
||||
obj-y += clk-cpu.o
|
||||
obj-y += clk-inverter.o
|
||||
obj-y += clk-mmc-phase.o
|
||||
obj-y += clk-muxgrf.o
|
||||
obj-y += clk-ddr.o
|
||||
obj-$(CONFIG_RESET_CONTROLLER) += softrst.o
|
||||
|
||||
@ -16,5 +17,6 @@ obj-y += clk-rk3036.o
|
||||
obj-y += clk-rk3188.o
|
||||
obj-y += clk-rk3228.o
|
||||
obj-y += clk-rk3288.o
|
||||
obj-y += clk-rk3328.o
|
||||
obj-y += clk-rk3368.o
|
||||
obj-y += clk-rk3399.o
|
||||
|
102
drivers/clk/rockchip/clk-muxgrf.c
Normal file
102
drivers/clk/rockchip/clk-muxgrf.c
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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/bitops.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include "clk.h"
|
||||
|
||||
struct rockchip_muxgrf_clock {
|
||||
struct clk_hw hw;
|
||||
struct regmap *regmap;
|
||||
u32 reg;
|
||||
u32 shift;
|
||||
u32 width;
|
||||
int flags;
|
||||
};
|
||||
|
||||
#define to_muxgrf_clock(_hw) container_of(_hw, struct rockchip_muxgrf_clock, hw)
|
||||
|
||||
static u8 rockchip_muxgrf_get_parent(struct clk_hw *hw)
|
||||
{
|
||||
struct rockchip_muxgrf_clock *mux = to_muxgrf_clock(hw);
|
||||
unsigned int mask = GENMASK(mux->width - 1, 0);
|
||||
unsigned int val;
|
||||
|
||||
regmap_read(mux->regmap, mux->reg, &val);
|
||||
|
||||
val >>= mux->shift;
|
||||
val &= mask;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
static int rockchip_muxgrf_set_parent(struct clk_hw *hw, u8 index)
|
||||
{
|
||||
struct rockchip_muxgrf_clock *mux = to_muxgrf_clock(hw);
|
||||
unsigned int mask = GENMASK(mux->width + mux->shift - 1, mux->shift);
|
||||
unsigned int val;
|
||||
|
||||
val = index;
|
||||
val <<= mux->shift;
|
||||
|
||||
if (mux->flags & CLK_MUX_HIWORD_MASK)
|
||||
return regmap_write(mux->regmap, mux->reg, val | (mask << 16));
|
||||
else
|
||||
return regmap_update_bits(mux->regmap, mux->reg, mask, val);
|
||||
}
|
||||
|
||||
static const struct clk_ops rockchip_muxgrf_clk_ops = {
|
||||
.get_parent = rockchip_muxgrf_get_parent,
|
||||
.set_parent = rockchip_muxgrf_set_parent,
|
||||
.determine_rate = __clk_mux_determine_rate,
|
||||
};
|
||||
|
||||
struct clk *rockchip_clk_register_muxgrf(const char *name,
|
||||
const char *const *parent_names, u8 num_parents,
|
||||
int flags, struct regmap *regmap, int reg,
|
||||
int shift, int width, int mux_flags)
|
||||
{
|
||||
struct rockchip_muxgrf_clock *muxgrf_clock;
|
||||
struct clk_init_data init;
|
||||
struct clk *clk;
|
||||
|
||||
if (IS_ERR(regmap)) {
|
||||
pr_err("%s: regmap not available\n", __func__);
|
||||
return ERR_PTR(-ENOTSUPP);
|
||||
}
|
||||
|
||||
muxgrf_clock = kmalloc(sizeof(*muxgrf_clock), GFP_KERNEL);
|
||||
if (!muxgrf_clock)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
init.name = name;
|
||||
init.flags = flags;
|
||||
init.num_parents = num_parents;
|
||||
init.parent_names = parent_names;
|
||||
init.ops = &rockchip_muxgrf_clk_ops;
|
||||
|
||||
muxgrf_clock->hw.init = &init;
|
||||
muxgrf_clock->regmap = regmap;
|
||||
muxgrf_clock->reg = reg;
|
||||
muxgrf_clock->shift = shift;
|
||||
muxgrf_clock->width = width;
|
||||
muxgrf_clock->flags = mux_flags;
|
||||
|
||||
clk = clk_register(NULL, &muxgrf_clock->hw);
|
||||
if (IS_ERR(clk))
|
||||
kfree(muxgrf_clock);
|
||||
|
||||
return clk;
|
||||
}
|
@ -29,6 +29,7 @@
|
||||
#define PLL_MODE_SLOW 0x0
|
||||
#define PLL_MODE_NORM 0x1
|
||||
#define PLL_MODE_DEEP 0x2
|
||||
#define PLL_RK3328_MODE_MASK 0x1
|
||||
|
||||
struct rockchip_clk_pll {
|
||||
struct clk_hw hw;
|
||||
@ -848,7 +849,8 @@ struct clk *rockchip_clk_register_pll(struct rockchip_clk_provider *ctx,
|
||||
struct clk *pll_clk, *mux_clk;
|
||||
char pll_name[20];
|
||||
|
||||
if (num_parents != 2) {
|
||||
if ((pll_type != pll_rk3328 && num_parents != 2) ||
|
||||
(pll_type == pll_rk3328 && num_parents != 1)) {
|
||||
pr_err("%s: needs two parent clocks\n", __func__);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
@ -865,6 +867,9 @@ struct clk *rockchip_clk_register_pll(struct rockchip_clk_provider *ctx,
|
||||
pll_mux = &pll->pll_mux;
|
||||
pll_mux->reg = ctx->reg_base + mode_offset;
|
||||
pll_mux->shift = mode_shift;
|
||||
if (pll_type == pll_rk3328)
|
||||
pll_mux->mask = PLL_RK3328_MODE_MASK;
|
||||
else
|
||||
pll_mux->mask = PLL_MODE_MASK;
|
||||
pll_mux->flags = 0;
|
||||
pll_mux->lock = &ctx->lock;
|
||||
@ -872,6 +877,7 @@ struct clk *rockchip_clk_register_pll(struct rockchip_clk_provider *ctx,
|
||||
|
||||
if (pll_type == pll_rk3036 ||
|
||||
pll_type == pll_rk3066 ||
|
||||
pll_type == pll_rk3328 ||
|
||||
pll_type == pll_rk3399)
|
||||
pll_mux->flags |= CLK_MUX_HIWORD_MASK;
|
||||
|
||||
@ -884,6 +890,9 @@ struct clk *rockchip_clk_register_pll(struct rockchip_clk_provider *ctx,
|
||||
init.flags = CLK_SET_RATE_PARENT;
|
||||
init.ops = pll->pll_mux_ops;
|
||||
init.parent_names = pll_parents;
|
||||
if (pll_type == pll_rk3328)
|
||||
init.num_parents = 2;
|
||||
else
|
||||
init.num_parents = ARRAY_SIZE(pll_parents);
|
||||
|
||||
mux_clk = clk_register(NULL, &pll_mux->hw);
|
||||
@ -918,6 +927,7 @@ struct clk *rockchip_clk_register_pll(struct rockchip_clk_provider *ctx,
|
||||
|
||||
switch (pll_type) {
|
||||
case pll_rk3036:
|
||||
case pll_rk3328:
|
||||
if (!pll->rate_table || IS_ERR(ctx->grf))
|
||||
init.ops = &rockchip_rk3036_pll_clk_norate_ops;
|
||||
else
|
||||
|
@ -507,8 +507,8 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = {
|
||||
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(PCLK_DDRUPCTL, "pclk_ddrupctl", "pclk_cpu", 0, RK2928_CLKGATE_CON(5), 7, GFLAGS),
|
||||
GATE(PCLK_PUBL, "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", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 4, GFLAGS),
|
||||
GATE(PCLK_PMU, "pclk_pmu", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(5), 5, GFLAGS),
|
||||
|
@ -198,6 +198,7 @@ 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_aclk_vcodec_pre_p) = { "aclk_vepu", "aclk_vdpu" };
|
||||
PNAME(mux_usbphy480m_p) = { "sclk_otgphy1_480m", "sclk_otgphy2_480m",
|
||||
"sclk_otgphy0_480m" };
|
||||
PNAME(mux_hsicphy480m_p) = { "cpll", "gpll", "usbphy480m_src" };
|
||||
@ -398,14 +399,12 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
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),
|
||||
/*
|
||||
* We use aclk_vdpu by default GRF_SOC_CON0[7] setting in system,
|
||||
* so we ignore the mux and make clocks nodes as following,
|
||||
*/
|
||||
GATE(ACLK_VCODEC, "aclk_vcodec", "aclk_vdpu", 0,
|
||||
MUXGRF(0, "aclk_vcodec_pre", mux_aclk_vcodec_pre_p, 0,
|
||||
RK3288_GRF_SOC_CON(0), 7, 1, MFLAGS),
|
||||
GATE(ACLK_VCODEC, "aclk_vcodec", "aclk_vcodec_pre", 0,
|
||||
RK3288_CLKGATE_CON(9), 0, GFLAGS),
|
||||
|
||||
FACTOR_GATE(0, "hclk_vcodec_pre", "aclk_vdpu", 0, 1, 4,
|
||||
FACTOR_GATE(0, "hclk_vcodec_pre", "aclk_vcodec_pre", 0, 1, 4,
|
||||
RK3288_CLKGATE_CON(3), 10, GFLAGS),
|
||||
|
||||
GATE(HCLK_VCODEC, "hclk_vcodec", "hclk_vcodec_pre", 0,
|
||||
@ -469,7 +468,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
COMPOSITE_NODIV(0, "vip_src", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK3288_CLKSEL_CON(26), 8, 1, MFLAGS,
|
||||
RK3288_CLKGATE_CON(3), 7, GFLAGS),
|
||||
COMPOSITE_NOGATE(0, "sclk_vip_out", mux_vip_out_p, 0,
|
||||
COMPOSITE_NOGATE(SCLK_VIP_OUT, "sclk_vip_out", mux_vip_out_p, 0,
|
||||
RK3288_CLKSEL_CON(26), 15, 1, MFLAGS, 9, 5, DFLAGS),
|
||||
|
||||
DIV(0, "pclk_pd_alive", "gpll", 0,
|
||||
@ -690,7 +689,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
/* aclk_peri gates */
|
||||
GATE(0, "aclk_peri_axi_matrix", "aclk_peri", CLK_IGNORE_UNUSED, 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", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(7), 11, GFLAGS),
|
||||
GATE(0, "aclk_peri_niu", "aclk_peri", 0, RK3288_CLKGATE_CON(7), 11, GFLAGS),
|
||||
GATE(ACLK_MMU, "aclk_mmu", "aclk_peri", CLK_IGNORE_UNUSED, 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),
|
||||
@ -753,12 +752,12 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
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", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(14), 11, GFLAGS),
|
||||
GATE(0, "pclk_alive_niu", "pclk_pd_alive", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(14), 12, 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", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(17), 0, GFLAGS),
|
||||
GATE(0, "pclk_intmem1", "pclk_pd_pmu", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(17), 1, GFLAGS),
|
||||
GATE(0, "pclk_pmu_niu", "pclk_pd_pmu", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(17), 2, GFLAGS),
|
||||
GATE(0, "pclk_pmu_niu", "pclk_pd_pmu", 0, RK3288_CLKGATE_CON(17), 2, GFLAGS),
|
||||
GATE(PCLK_SGRF, "pclk_sgrf", "pclk_pd_pmu", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(17), 3, GFLAGS),
|
||||
GATE(PCLK_GPIO0, "pclk_gpio0", "pclk_pd_pmu", 0, RK3288_CLKGATE_CON(17), 4, GFLAGS),
|
||||
|
||||
@ -767,7 +766,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
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(HCLK_VIO_AHB_ARBI, "hclk_vio_ahb_arbi", "hclk_vio", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(15), 9, GFLAGS),
|
||||
GATE(HCLK_VIO_NIU, "hclk_vio_niu", "hclk_vio", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(15), 10, GFLAGS),
|
||||
GATE(HCLK_VIO_NIU, "hclk_vio_niu", "hclk_vio", 0, RK3288_CLKGATE_CON(15), 10, GFLAGS),
|
||||
GATE(HCLK_VIP, "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),
|
||||
@ -783,17 +782,17 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
/* aclk_vio0 gates */
|
||||
GATE(ACLK_VOP0, "aclk_vop0", "aclk_vio0", 0, RK3288_CLKGATE_CON(15), 5, GFLAGS),
|
||||
GATE(ACLK_IEP, "aclk_iep", "aclk_vio0", 0, RK3288_CLKGATE_CON(15), 2, GFLAGS),
|
||||
GATE(ACLK_VIO0_NIU, "aclk_vio0_niu", "aclk_vio0", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(15), 11, GFLAGS),
|
||||
GATE(ACLK_VIO0_NIU, "aclk_vio0_niu", "aclk_vio0", 0, RK3288_CLKGATE_CON(15), 11, GFLAGS),
|
||||
GATE(ACLK_VIP, "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(ACLK_ISP, "aclk_isp", "aclk_vio1", 0, RK3288_CLKGATE_CON(16), 2, GFLAGS),
|
||||
GATE(ACLK_VIO1_NIU, "aclk_vio1_niu", "aclk_vio1", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(15), 12, GFLAGS),
|
||||
GATE(ACLK_VIO1_NIU, "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(ACLK_RGA_NIU, "aclk_rga_niu", "aclk_rga_pre", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(15), 13, GFLAGS),
|
||||
GATE(ACLK_RGA_NIU, "aclk_rga_niu", "aclk_rga_pre", 0, RK3288_CLKGATE_CON(15), 13, GFLAGS),
|
||||
|
||||
/*
|
||||
* Other ungrouped clocks.
|
||||
@ -801,15 +800,22 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
|
||||
|
||||
GATE(0, "pclk_vip_in", "ext_vip", 0, RK3288_CLKGATE_CON(16), 0, GFLAGS),
|
||||
INVERTER(0, "pclk_vip", "pclk_vip_in", RK3288_CLKSEL_CON(29), 4, IFLAGS),
|
||||
GATE(0, "pclk_isp_in", "ext_isp", 0, RK3288_CLKGATE_CON(16), 3, GFLAGS),
|
||||
GATE(PCLK_ISP_IN, "pclk_isp_in", "ext_isp", 0, RK3288_CLKGATE_CON(16), 3, GFLAGS),
|
||||
INVERTER(0, "pclk_isp", "pclk_isp_in", RK3288_CLKSEL_CON(29), 3, IFLAGS),
|
||||
};
|
||||
|
||||
static const char *const rk3288_critical_clocks[] __initconst = {
|
||||
"aclk_cpu",
|
||||
"aclk_peri",
|
||||
"aclk_peri_niu",
|
||||
"aclk_vio0_niu",
|
||||
"aclk_vio1_niu",
|
||||
"aclk_rga_niu",
|
||||
"hclk_peri",
|
||||
"hclk_vio_niu",
|
||||
"pclk_alive_niu",
|
||||
"pclk_pd_pmu",
|
||||
"pclk_pmu_niu",
|
||||
};
|
||||
|
||||
static void __iomem *rk3288_cru_base;
|
||||
|
895
drivers/clk/rockchip/clk-rk3328.c
Normal file
895
drivers/clk/rockchip/clk-rk3328.c
Normal file
@ -0,0 +1,895 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Rockchip Electronics Co. Ltd.
|
||||
* Author: Elaine <zhangqing@rock-chips.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/clk-provider.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/syscore_ops.h>
|
||||
#include <dt-bindings/clock/rk3328-cru.h>
|
||||
#include "clk.h"
|
||||
|
||||
#define RK3328_GRF_SOC_STATUS0 0x480
|
||||
#define RK3328_GRF_MAC_CON1 0x904
|
||||
#define RK3328_GRF_MAC_CON2 0x908
|
||||
|
||||
enum rk3328_plls {
|
||||
apll, dpll, cpll, gpll, npll,
|
||||
};
|
||||
|
||||
static struct rockchip_pll_rate_table rk3328_pll_rates[] = {
|
||||
/* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */
|
||||
RK3036_PLL_RATE(1608000000, 1, 67, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1584000000, 1, 66, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1560000000, 1, 65, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1536000000, 1, 64, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1512000000, 1, 63, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1488000000, 1, 62, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1464000000, 1, 61, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1440000000, 1, 60, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1416000000, 1, 59, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1392000000, 1, 58, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1368000000, 1, 57, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1344000000, 1, 56, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1320000000, 1, 55, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1296000000, 1, 54, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1272000000, 1, 53, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1248000000, 1, 52, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1200000000, 1, 50, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1188000000, 2, 99, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1104000000, 1, 46, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1100000000, 12, 550, 1, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1008000000, 1, 84, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(1000000000, 6, 500, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(984000000, 1, 82, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(960000000, 1, 80, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(936000000, 1, 78, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(912000000, 1, 76, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(900000000, 4, 300, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(888000000, 1, 74, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(864000000, 1, 72, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(840000000, 1, 70, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(816000000, 1, 68, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(800000000, 6, 400, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(700000000, 6, 350, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(696000000, 1, 58, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(600000000, 1, 75, 3, 1, 1, 0),
|
||||
RK3036_PLL_RATE(594000000, 2, 99, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(504000000, 1, 63, 3, 1, 1, 0),
|
||||
RK3036_PLL_RATE(500000000, 6, 250, 2, 1, 1, 0),
|
||||
RK3036_PLL_RATE(408000000, 1, 68, 2, 2, 1, 0),
|
||||
RK3036_PLL_RATE(312000000, 1, 52, 2, 2, 1, 0),
|
||||
RK3036_PLL_RATE(216000000, 1, 72, 4, 2, 1, 0),
|
||||
RK3036_PLL_RATE(96000000, 1, 64, 4, 4, 1, 0),
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
static struct rockchip_pll_rate_table rk3328_pll_frac_rates[] = {
|
||||
/* _mhz, _refdiv, _fbdiv, _postdiv1, _postdiv2, _dsmpd, _frac */
|
||||
RK3036_PLL_RATE(1016064000, 3, 127, 1, 1, 0, 134217),
|
||||
/* vco = 1016064000 */
|
||||
RK3036_PLL_RATE(983040000, 24, 983, 1, 1, 0, 671088),
|
||||
/* vco = 983040000 */
|
||||
RK3036_PLL_RATE(491520000, 24, 983, 2, 1, 0, 671088),
|
||||
/* vco = 983040000 */
|
||||
RK3036_PLL_RATE(61440000, 6, 215, 7, 2, 0, 671088),
|
||||
/* vco = 860156000 */
|
||||
RK3036_PLL_RATE(56448000, 12, 451, 4, 4, 0, 9797894),
|
||||
/* vco = 903168000 */
|
||||
RK3036_PLL_RATE(40960000, 12, 409, 4, 5, 0, 10066329),
|
||||
/* vco = 819200000 */
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
#define RK3328_DIV_ACLKM_MASK 0x7
|
||||
#define RK3328_DIV_ACLKM_SHIFT 4
|
||||
#define RK3328_DIV_PCLK_DBG_MASK 0xf
|
||||
#define RK3328_DIV_PCLK_DBG_SHIFT 0
|
||||
|
||||
#define RK3328_CLKSEL1(_aclk_core, _pclk_dbg) \
|
||||
{ \
|
||||
.reg = RK3328_CLKSEL_CON(1), \
|
||||
.val = HIWORD_UPDATE(_aclk_core, RK3328_DIV_ACLKM_MASK, \
|
||||
RK3328_DIV_ACLKM_SHIFT) | \
|
||||
HIWORD_UPDATE(_pclk_dbg, RK3328_DIV_PCLK_DBG_MASK, \
|
||||
RK3328_DIV_PCLK_DBG_SHIFT), \
|
||||
}
|
||||
|
||||
#define RK3328_CPUCLK_RATE(_prate, _aclk_core, _pclk_dbg) \
|
||||
{ \
|
||||
.prate = _prate, \
|
||||
.divs = { \
|
||||
RK3328_CLKSEL1(_aclk_core, _pclk_dbg), \
|
||||
}, \
|
||||
}
|
||||
|
||||
static struct rockchip_cpuclk_rate_table rk3328_cpuclk_rates[] __initdata = {
|
||||
RK3328_CPUCLK_RATE(1800000000, 1, 7),
|
||||
RK3328_CPUCLK_RATE(1704000000, 1, 7),
|
||||
RK3328_CPUCLK_RATE(1608000000, 1, 7),
|
||||
RK3328_CPUCLK_RATE(1512000000, 1, 7),
|
||||
RK3328_CPUCLK_RATE(1488000000, 1, 5),
|
||||
RK3328_CPUCLK_RATE(1416000000, 1, 5),
|
||||
RK3328_CPUCLK_RATE(1392000000, 1, 5),
|
||||
RK3328_CPUCLK_RATE(1296000000, 1, 5),
|
||||
RK3328_CPUCLK_RATE(1200000000, 1, 5),
|
||||
RK3328_CPUCLK_RATE(1104000000, 1, 5),
|
||||
RK3328_CPUCLK_RATE(1008000000, 1, 5),
|
||||
RK3328_CPUCLK_RATE(912000000, 1, 5),
|
||||
RK3328_CPUCLK_RATE(816000000, 1, 3),
|
||||
RK3328_CPUCLK_RATE(696000000, 1, 3),
|
||||
RK3328_CPUCLK_RATE(600000000, 1, 3),
|
||||
RK3328_CPUCLK_RATE(408000000, 1, 1),
|
||||
RK3328_CPUCLK_RATE(312000000, 1, 1),
|
||||
RK3328_CPUCLK_RATE(216000000, 1, 1),
|
||||
RK3328_CPUCLK_RATE(96000000, 1, 1),
|
||||
};
|
||||
|
||||
static const struct rockchip_cpuclk_reg_data rk3328_cpuclk_data = {
|
||||
.core_reg = RK3328_CLKSEL_CON(0),
|
||||
.div_core_shift = 0,
|
||||
.div_core_mask = 0x1f,
|
||||
.mux_core_alt = 1,
|
||||
.mux_core_main = 3,
|
||||
.mux_core_shift = 6,
|
||||
.mux_core_mask = 0x3,
|
||||
};
|
||||
|
||||
PNAME(mux_pll_p) = { "xin24m" };
|
||||
|
||||
PNAME(mux_2plls_p) = { "cpll", "gpll" };
|
||||
PNAME(mux_gpll_cpll_p) = { "gpll", "cpll" };
|
||||
PNAME(mux_cpll_gpll_apll_p) = { "cpll", "gpll", "apll" };
|
||||
PNAME(mux_2plls_xin24m_p) = { "cpll", "gpll", "xin24m" };
|
||||
PNAME(mux_2plls_hdmiphy_p) = { "cpll", "gpll",
|
||||
"dummy_hdmiphy" };
|
||||
PNAME(mux_4plls_p) = { "cpll", "gpll",
|
||||
"dummy_hdmiphy",
|
||||
"usb480m" };
|
||||
PNAME(mux_2plls_u480m_p) = { "cpll", "gpll",
|
||||
"usb480m" };
|
||||
PNAME(mux_2plls_24m_u480m_p) = { "cpll", "gpll",
|
||||
"xin24m", "usb480m" };
|
||||
|
||||
PNAME(mux_ddrphy_p) = { "dpll", "apll", "cpll" };
|
||||
PNAME(mux_armclk_p) = { "apll_core",
|
||||
"gpll_core",
|
||||
"dpll_core",
|
||||
"npll_core"};
|
||||
PNAME(mux_hdmiphy_p) = { "hdmi_phy", "xin24m" };
|
||||
PNAME(mux_usb480m_p) = { "usb480m_phy",
|
||||
"xin24m" };
|
||||
|
||||
PNAME(mux_i2s0_p) = { "clk_i2s0_div",
|
||||
"clk_i2s0_frac",
|
||||
"xin12m",
|
||||
"xin12m" };
|
||||
PNAME(mux_i2s1_p) = { "clk_i2s1_div",
|
||||
"clk_i2s1_frac",
|
||||
"clkin_i2s1",
|
||||
"xin12m" };
|
||||
PNAME(mux_i2s2_p) = { "clk_i2s2_div",
|
||||
"clk_i2s2_frac",
|
||||
"clkin_i2s2",
|
||||
"xin12m" };
|
||||
PNAME(mux_i2s1out_p) = { "clk_i2s1", "xin12m"};
|
||||
PNAME(mux_i2s2out_p) = { "clk_i2s2", "xin12m" };
|
||||
PNAME(mux_spdif_p) = { "clk_spdif_div",
|
||||
"clk_spdif_frac",
|
||||
"xin12m",
|
||||
"xin12m" };
|
||||
PNAME(mux_uart0_p) = { "clk_uart0_div",
|
||||
"clk_uart0_frac",
|
||||
"xin24m" };
|
||||
PNAME(mux_uart1_p) = { "clk_uart1_div",
|
||||
"clk_uart1_frac",
|
||||
"xin24m" };
|
||||
PNAME(mux_uart2_p) = { "clk_uart2_div",
|
||||
"clk_uart2_frac",
|
||||
"xin24m" };
|
||||
|
||||
PNAME(mux_sclk_cif_p) = { "clk_cif_src",
|
||||
"xin24m" };
|
||||
PNAME(mux_dclk_lcdc_p) = { "hdmiphy",
|
||||
"dclk_lcdc_src" };
|
||||
PNAME(mux_aclk_peri_pre_p) = { "cpll_peri",
|
||||
"gpll_peri",
|
||||
"hdmiphy_peri" };
|
||||
PNAME(mux_ref_usb3otg_src_p) = { "xin24m",
|
||||
"clk_usb3otg_ref" };
|
||||
PNAME(mux_xin24m_32k_p) = { "xin24m",
|
||||
"clk_rtc32k" };
|
||||
PNAME(mux_mac2io_src_p) = { "clk_mac2io_src",
|
||||
"gmac_clkin" };
|
||||
PNAME(mux_mac2phy_src_p) = { "clk_mac2phy_src",
|
||||
"phy_50m_out" };
|
||||
|
||||
static struct rockchip_pll_clock rk3328_pll_clks[] __initdata = {
|
||||
[apll] = PLL(pll_rk3328, PLL_APLL, "apll", mux_pll_p,
|
||||
0, RK3328_PLL_CON(0),
|
||||
RK3328_MODE_CON, 0, 4, 0, rk3328_pll_frac_rates),
|
||||
[dpll] = PLL(pll_rk3328, PLL_DPLL, "dpll", mux_pll_p,
|
||||
0, RK3328_PLL_CON(8),
|
||||
RK3328_MODE_CON, 4, 3, 0, NULL),
|
||||
[cpll] = PLL(pll_rk3328, PLL_CPLL, "cpll", mux_pll_p,
|
||||
0, RK3328_PLL_CON(16),
|
||||
RK3328_MODE_CON, 8, 2, 0, rk3328_pll_rates),
|
||||
[gpll] = PLL(pll_rk3328, PLL_GPLL, "gpll", mux_pll_p,
|
||||
0, RK3328_PLL_CON(24),
|
||||
RK3328_MODE_CON, 12, 1, 0, rk3328_pll_frac_rates),
|
||||
[npll] = PLL(pll_rk3328, PLL_NPLL, "npll", mux_pll_p,
|
||||
0, RK3328_PLL_CON(40),
|
||||
RK3328_MODE_CON, 1, 0, 0, rk3328_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)
|
||||
|
||||
static struct rockchip_clk_branch rk3328_i2s0_fracmux __initdata =
|
||||
MUX(0, "i2s0_pre", mux_i2s0_p, CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(6), 8, 2, MFLAGS);
|
||||
|
||||
static struct rockchip_clk_branch rk3328_i2s1_fracmux __initdata =
|
||||
MUX(0, "i2s1_pre", mux_i2s1_p, CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(8), 8, 2, MFLAGS);
|
||||
|
||||
static struct rockchip_clk_branch rk3328_i2s2_fracmux __initdata =
|
||||
MUX(0, "i2s2_pre", mux_i2s2_p, CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(10), 8, 2, MFLAGS);
|
||||
|
||||
static struct rockchip_clk_branch rk3328_spdif_fracmux __initdata =
|
||||
MUX(SCLK_SPDIF, "sclk_spdif", mux_spdif_p, CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(12), 8, 2, MFLAGS);
|
||||
|
||||
static struct rockchip_clk_branch rk3328_uart0_fracmux __initdata =
|
||||
MUX(SCLK_UART0, "sclk_uart0", mux_uart0_p, CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(14), 8, 2, MFLAGS);
|
||||
|
||||
static struct rockchip_clk_branch rk3328_uart1_fracmux __initdata =
|
||||
MUX(SCLK_UART1, "sclk_uart1", mux_uart1_p, CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(16), 8, 2, MFLAGS);
|
||||
|
||||
static struct rockchip_clk_branch rk3328_uart2_fracmux __initdata =
|
||||
MUX(SCLK_UART2, "sclk_uart2", mux_uart2_p, CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(18), 8, 2, MFLAGS);
|
||||
|
||||
static struct rockchip_clk_branch rk3328_clk_branches[] __initdata = {
|
||||
/*
|
||||
* Clock-Architecture Diagram 1
|
||||
*/
|
||||
|
||||
DIV(0, "clk_24m", "xin24m", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKSEL_CON(2), 8, 5, DFLAGS),
|
||||
COMPOSITE(SCLK_RTC32K, "clk_rtc32k", mux_2plls_xin24m_p, 0,
|
||||
RK3328_CLKSEL_CON(38), 14, 2, MFLAGS, 0, 14, DFLAGS,
|
||||
RK3328_CLKGATE_CON(0), 11, GFLAGS),
|
||||
|
||||
/* PD_MISC */
|
||||
MUX(HDMIPHY, "hdmiphy", mux_hdmiphy_p, CLK_SET_RATE_PARENT,
|
||||
RK3328_MISC_CON, 13, 1, MFLAGS),
|
||||
MUX(USB480M, "usb480m", mux_usb480m_p, CLK_SET_RATE_PARENT,
|
||||
RK3328_MISC_CON, 15, 1, MFLAGS),
|
||||
|
||||
/*
|
||||
* Clock-Architecture Diagram 2
|
||||
*/
|
||||
|
||||
/* PD_CORE */
|
||||
GATE(0, "apll_core", "apll", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(0), 0, GFLAGS),
|
||||
GATE(0, "gpll_core", "gpll", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(0), 2, GFLAGS),
|
||||
GATE(0, "dpll_core", "dpll", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(0), 1, GFLAGS),
|
||||
GATE(0, "npll_core", "npll", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(0), 12, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "pclk_dbg", "armclk", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKSEL_CON(1), 0, 4, DFLAGS | CLK_DIVIDER_READ_ONLY,
|
||||
RK3328_CLKGATE_CON(7), 0, GFLAGS),
|
||||
COMPOSITE_NOMUX(0, "aclk_core", "armclk", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKSEL_CON(1), 4, 3, DFLAGS | CLK_DIVIDER_READ_ONLY,
|
||||
RK3328_CLKGATE_CON(7), 1, GFLAGS),
|
||||
GATE(0, "aclk_core_niu", "aclk_core", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(13), 0, GFLAGS),
|
||||
GATE(0, "aclk_gic400", "aclk_core", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(13), 1, GFLAGS),
|
||||
|
||||
GATE(0, "clk_jtag", "jtag_clkin", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(7), 2, GFLAGS),
|
||||
|
||||
/* PD_GPU */
|
||||
COMPOSITE(0, "aclk_gpu_pre", mux_4plls_p, 0,
|
||||
RK3328_CLKSEL_CON(44), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(6), 6, GFLAGS),
|
||||
GATE(ACLK_GPU, "aclk_gpu", "aclk_gpu_pre", CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKGATE_CON(14), 0, GFLAGS),
|
||||
GATE(0, "aclk_gpu_niu", "aclk_gpu_pre", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(14), 1, GFLAGS),
|
||||
|
||||
/* PD_DDR */
|
||||
COMPOSITE(0, "clk_ddr", mux_ddrphy_p, CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKSEL_CON(3), 8, 2, MFLAGS, 0, 3, DFLAGS | CLK_DIVIDER_POWER_OF_TWO,
|
||||
RK3328_CLKGATE_CON(0), 4, GFLAGS),
|
||||
GATE(0, "clk_ddrmsch", "clk_ddr", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(18), 6, GFLAGS),
|
||||
GATE(0, "clk_ddrupctl", "clk_ddr", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(18), 5, GFLAGS),
|
||||
GATE(0, "aclk_ddrupctl", "clk_ddr", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(18), 4, GFLAGS),
|
||||
GATE(0, "clk_ddrmon", "xin24m", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(0), 6, GFLAGS),
|
||||
|
||||
COMPOSITE(PCLK_DDR, "pclk_ddr", mux_2plls_hdmiphy_p, 0,
|
||||
RK3328_CLKSEL_CON(4), 13, 2, MFLAGS, 8, 3, DFLAGS,
|
||||
RK3328_CLKGATE_CON(7), 4, GFLAGS),
|
||||
GATE(0, "pclk_ddrupctl", "pclk_ddr", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(18), 1, GFLAGS),
|
||||
GATE(0, "pclk_ddr_msch", "pclk_ddr", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(18), 2, GFLAGS),
|
||||
GATE(0, "pclk_ddr_mon", "pclk_ddr", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(18), 3, GFLAGS),
|
||||
GATE(0, "pclk_ddrstdby", "pclk_ddr", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(18), 7, GFLAGS),
|
||||
GATE(0, "pclk_ddr_grf", "pclk_ddr", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(18), 9, GFLAGS),
|
||||
|
||||
/*
|
||||
* Clock-Architecture Diagram 3
|
||||
*/
|
||||
|
||||
/* PD_BUS */
|
||||
COMPOSITE(ACLK_BUS_PRE, "aclk_bus_pre", mux_2plls_hdmiphy_p, 0,
|
||||
RK3328_CLKSEL_CON(0), 13, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(8), 0, GFLAGS),
|
||||
COMPOSITE_NOMUX(HCLK_BUS_PRE, "hclk_bus_pre", "aclk_bus_pre", 0,
|
||||
RK3328_CLKSEL_CON(1), 8, 2, DFLAGS,
|
||||
RK3328_CLKGATE_CON(8), 1, GFLAGS),
|
||||
COMPOSITE_NOMUX(PCLK_BUS_PRE, "pclk_bus_pre", "aclk_bus_pre", 0,
|
||||
RK3328_CLKSEL_CON(1), 12, 3, DFLAGS,
|
||||
RK3328_CLKGATE_CON(8), 2, GFLAGS),
|
||||
GATE(0, "pclk_bus", "pclk_bus_pre", 0,
|
||||
RK3328_CLKGATE_CON(8), 3, GFLAGS),
|
||||
GATE(0, "pclk_phy_pre", "pclk_bus_pre", 0,
|
||||
RK3328_CLKGATE_CON(8), 4, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_TSP, "clk_tsp", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(21), 15, 1, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(2), 5, GFLAGS),
|
||||
GATE(0, "clk_hsadc_tsp", "ext_gpio3a2", 0,
|
||||
RK3328_CLKGATE_CON(17), 13, GFLAGS),
|
||||
|
||||
/* PD_I2S */
|
||||
COMPOSITE(0, "clk_i2s0_div", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(6), 15, 1, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3328_CLKGATE_CON(1), 1, GFLAGS),
|
||||
COMPOSITE_FRACMUX(0, "clk_i2s0_frac", "clk_i2s0_div", CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(7), 0,
|
||||
RK3328_CLKGATE_CON(1), 2, GFLAGS,
|
||||
&rk3328_i2s0_fracmux),
|
||||
GATE(SCLK_I2S0, "clk_i2s0", "i2s0_pre", CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKGATE_CON(1), 3, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "clk_i2s1_div", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(8), 15, 1, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3328_CLKGATE_CON(1), 4, GFLAGS),
|
||||
COMPOSITE_FRACMUX(0, "clk_i2s1_frac", "clk_i2s1_div", CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(9), 0,
|
||||
RK3328_CLKGATE_CON(1), 5, GFLAGS,
|
||||
&rk3328_i2s1_fracmux),
|
||||
GATE(SCLK_I2S1, "clk_i2s1", "i2s1_pre", CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKGATE_CON(0), 6, GFLAGS),
|
||||
COMPOSITE_NODIV(SCLK_I2S1_OUT, "i2s1_out", mux_i2s1out_p, 0,
|
||||
RK3328_CLKSEL_CON(8), 12, 1, MFLAGS,
|
||||
RK3328_CLKGATE_CON(1), 7, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "clk_i2s2_div", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(10), 15, 1, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3328_CLKGATE_CON(1), 8, GFLAGS),
|
||||
COMPOSITE_FRACMUX(0, "clk_i2s2_frac", "clk_i2s2_div", CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(11), 0,
|
||||
RK3328_CLKGATE_CON(1), 9, GFLAGS,
|
||||
&rk3328_i2s2_fracmux),
|
||||
GATE(SCLK_I2S2, "clk_i2s2", "i2s2_pre", CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKGATE_CON(1), 10, GFLAGS),
|
||||
COMPOSITE_NODIV(SCLK_I2S2_OUT, "i2s2_out", mux_i2s2out_p, 0,
|
||||
RK3328_CLKSEL_CON(10), 12, 1, MFLAGS,
|
||||
RK3328_CLKGATE_CON(1), 11, GFLAGS),
|
||||
|
||||
COMPOSITE(0, "clk_spdif_div", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(12), 15, 1, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3328_CLKGATE_CON(1), 12, GFLAGS),
|
||||
COMPOSITE_FRACMUX(0, "clk_spdif_frac", "clk_spdif_div", CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(13), 0,
|
||||
RK3328_CLKGATE_CON(1), 13, GFLAGS,
|
||||
&rk3328_spdif_fracmux),
|
||||
|
||||
/* PD_UART */
|
||||
COMPOSITE(0, "clk_uart0_div", mux_2plls_u480m_p, 0,
|
||||
RK3328_CLKSEL_CON(14), 12, 2, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3328_CLKGATE_CON(1), 14, GFLAGS),
|
||||
COMPOSITE(0, "clk_uart1_div", mux_2plls_u480m_p, 0,
|
||||
RK3328_CLKSEL_CON(16), 12, 2, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3328_CLKGATE_CON(2), 0, GFLAGS),
|
||||
COMPOSITE(0, "clk_uart2_div", mux_2plls_u480m_p, 0,
|
||||
RK3328_CLKSEL_CON(18), 12, 2, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3328_CLKGATE_CON(2), 2, GFLAGS),
|
||||
COMPOSITE_FRACMUX(0, "clk_uart0_frac", "clk_uart0_div", CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(15), 0,
|
||||
RK3328_CLKGATE_CON(1), 15, GFLAGS,
|
||||
&rk3328_uart0_fracmux),
|
||||
COMPOSITE_FRACMUX(0, "clk_uart1_frac", "clk_uart1_div", CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(17), 0,
|
||||
RK3328_CLKGATE_CON(2), 1, GFLAGS,
|
||||
&rk3328_uart1_fracmux),
|
||||
COMPOSITE_FRACMUX(0, "clk_uart2_frac", "clk_uart2_div", CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(19), 0,
|
||||
RK3328_CLKGATE_CON(2), 3, GFLAGS,
|
||||
&rk3328_uart2_fracmux),
|
||||
|
||||
/*
|
||||
* Clock-Architecture Diagram 4
|
||||
*/
|
||||
|
||||
COMPOSITE(SCLK_I2C0, "clk_i2c0", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(34), 7, 1, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3328_CLKGATE_CON(2), 9, GFLAGS),
|
||||
COMPOSITE(SCLK_I2C1, "clk_i2c1", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(34), 15, 1, MFLAGS, 8, 7, DFLAGS,
|
||||
RK3328_CLKGATE_CON(2), 10, GFLAGS),
|
||||
COMPOSITE(SCLK_I2C2, "clk_i2c2", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(35), 7, 1, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3328_CLKGATE_CON(2), 11, GFLAGS),
|
||||
COMPOSITE(SCLK_I2C3, "clk_i2c3", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(35), 15, 1, MFLAGS, 8, 7, DFLAGS,
|
||||
RK3328_CLKGATE_CON(2), 12, GFLAGS),
|
||||
COMPOSITE(SCLK_CRYPTO, "clk_crypto", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(20), 7, 1, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3328_CLKGATE_CON(2), 4, GFLAGS),
|
||||
COMPOSITE_NOMUX(SCLK_TSADC, "clk_tsadc", "clk_24m", 0,
|
||||
RK3328_CLKSEL_CON(22), 0, 10, DFLAGS,
|
||||
RK3328_CLKGATE_CON(2), 6, GFLAGS),
|
||||
COMPOSITE_NOMUX(SCLK_SARADC, "clk_saradc", "clk_24m", 0,
|
||||
RK3328_CLKSEL_CON(23), 0, 10, DFLAGS,
|
||||
RK3328_CLKGATE_CON(2), 14, GFLAGS),
|
||||
COMPOSITE(SCLK_SPI, "clk_spi", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(24), 7, 1, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3328_CLKGATE_CON(2), 7, GFLAGS),
|
||||
COMPOSITE(SCLK_PWM, "clk_pwm", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(24), 15, 1, MFLAGS, 8, 7, DFLAGS,
|
||||
RK3328_CLKGATE_CON(2), 8, GFLAGS),
|
||||
COMPOSITE(SCLK_OTP, "clk_otp", mux_2plls_xin24m_p, 0,
|
||||
RK3328_CLKSEL_CON(4), 6, 2, MFLAGS, 0, 6, DFLAGS,
|
||||
RK3328_CLKGATE_CON(3), 8, GFLAGS),
|
||||
COMPOSITE(SCLK_EFUSE, "clk_efuse", mux_2plls_xin24m_p, 0,
|
||||
RK3328_CLKSEL_CON(5), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(2), 13, GFLAGS),
|
||||
COMPOSITE(SCLK_PDM, "clk_pdm", mux_cpll_gpll_apll_p, CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(20), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(2), 15, GFLAGS),
|
||||
|
||||
GATE(SCLK_TIMER0, "sclk_timer0", "xin24m", 0,
|
||||
RK3328_CLKGATE_CON(8), 5, GFLAGS),
|
||||
GATE(SCLK_TIMER1, "sclk_timer1", "xin24m", 0,
|
||||
RK3328_CLKGATE_CON(8), 6, GFLAGS),
|
||||
GATE(SCLK_TIMER2, "sclk_timer2", "xin24m", 0,
|
||||
RK3328_CLKGATE_CON(8), 7, GFLAGS),
|
||||
GATE(SCLK_TIMER3, "sclk_timer3", "xin24m", 0,
|
||||
RK3328_CLKGATE_CON(8), 8, GFLAGS),
|
||||
GATE(SCLK_TIMER4, "sclk_timer4", "xin24m", 0,
|
||||
RK3328_CLKGATE_CON(8), 9, GFLAGS),
|
||||
GATE(SCLK_TIMER5, "sclk_timer5", "xin24m", 0,
|
||||
RK3328_CLKGATE_CON(8), 10, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_WIFI, "clk_wifi", mux_2plls_u480m_p, 0,
|
||||
RK3328_CLKSEL_CON(52), 6, 2, MFLAGS, 0, 6, DFLAGS,
|
||||
RK3328_CLKGATE_CON(0), 10, GFLAGS),
|
||||
|
||||
/*
|
||||
* Clock-Architecture Diagram 5
|
||||
*/
|
||||
|
||||
/* PD_VIDEO */
|
||||
COMPOSITE(ACLK_RKVDEC_PRE, "aclk_rkvdec_pre", mux_4plls_p, 0,
|
||||
RK3328_CLKSEL_CON(48), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(6), 0, GFLAGS),
|
||||
FACTOR_GATE(HCLK_RKVDEC_PRE, "hclk_rkvdec_pre", "aclk_rkvdec_pre", 0, 1, 4,
|
||||
RK3328_CLKGATE_CON(11), 0, GFLAGS),
|
||||
GATE(ACLK_RKVDEC, "aclk_rkvdec", "aclk_rkvdec_pre", CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKGATE_CON(24), 0, GFLAGS),
|
||||
GATE(HCLK_RKVDEC, "hclk_rkvdec", "hclk_rkvdec_pre", CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKGATE_CON(24), 1, GFLAGS),
|
||||
GATE(0, "aclk_rkvdec_niu", "aclk_rkvdec_pre", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(24), 2, GFLAGS),
|
||||
GATE(0, "hclk_rkvdec_niu", "hclk_rkvdec_pre", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(24), 3, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_VDEC_CABAC, "sclk_vdec_cabac", mux_4plls_p, 0,
|
||||
RK3328_CLKSEL_CON(48), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(6), 1, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_VDEC_CORE, "sclk_vdec_core", mux_4plls_p, 0,
|
||||
RK3328_CLKSEL_CON(49), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(6), 2, GFLAGS),
|
||||
|
||||
COMPOSITE(ACLK_VPU_PRE, "aclk_vpu_pre", mux_4plls_p, 0,
|
||||
RK3328_CLKSEL_CON(50), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(6), 5, GFLAGS),
|
||||
FACTOR_GATE(HCLK_VPU_PRE, "hclk_vpu_pre", "aclk_vpu_pre", 0, 1, 4,
|
||||
RK3328_CLKGATE_CON(11), 8, GFLAGS),
|
||||
GATE(ACLK_VPU, "aclk_vpu", "aclk_vpu_pre", CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKGATE_CON(23), 0, GFLAGS),
|
||||
GATE(HCLK_VPU, "hclk_vpu", "hclk_vpu_pre", CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKGATE_CON(23), 1, GFLAGS),
|
||||
GATE(0, "aclk_vpu_niu", "aclk_vpu_pre", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(23), 2, GFLAGS),
|
||||
GATE(0, "hclk_vpu_niu", "hclk_vpu_pre", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(23), 3, GFLAGS),
|
||||
|
||||
COMPOSITE(ACLK_RKVENC, "aclk_rkvenc", mux_4plls_p, 0,
|
||||
RK3328_CLKSEL_CON(51), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(6), 3, GFLAGS),
|
||||
FACTOR_GATE(HCLK_RKVENC, "hclk_rkvenc", "aclk_rkvenc", 0, 1, 4,
|
||||
RK3328_CLKGATE_CON(11), 4, GFLAGS),
|
||||
GATE(0, "aclk_rkvenc_niu", "aclk_rkvenc", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(25), 0, GFLAGS),
|
||||
GATE(0, "hclk_rkvenc_niu", "hclk_rkvenc", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(25), 1, GFLAGS),
|
||||
GATE(ACLK_H265, "aclk_h265", "aclk_rkvenc", 0,
|
||||
RK3328_CLKGATE_CON(25), 0, GFLAGS),
|
||||
GATE(PCLK_H265, "pclk_h265", "hclk_rkvenc", 0,
|
||||
RK3328_CLKGATE_CON(25), 1, GFLAGS),
|
||||
GATE(ACLK_H264, "aclk_h264", "aclk_rkvenc", 0,
|
||||
RK3328_CLKGATE_CON(25), 0, GFLAGS),
|
||||
GATE(HCLK_H264, "hclk_h264", "hclk_rkvenc", 0,
|
||||
RK3328_CLKGATE_CON(25), 1, GFLAGS),
|
||||
GATE(ACLK_AXISRAM, "aclk_axisram", "aclk_rkvenc", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(25), 0, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_VENC_CORE, "sclk_venc_core", mux_4plls_p, 0,
|
||||
RK3328_CLKSEL_CON(51), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(6), 4, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_VENC_DSP, "sclk_venc_dsp", mux_4plls_p, 0,
|
||||
RK3328_CLKSEL_CON(52), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(6), 7, GFLAGS),
|
||||
|
||||
/*
|
||||
* Clock-Architecture Diagram 6
|
||||
*/
|
||||
|
||||
/* PD_VIO */
|
||||
COMPOSITE(ACLK_VIO_PRE, "aclk_vio_pre", mux_4plls_p, 0,
|
||||
RK3328_CLKSEL_CON(37), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(5), 2, GFLAGS),
|
||||
DIV(HCLK_VIO_PRE, "hclk_vio_pre", "aclk_vio_pre", 0,
|
||||
RK3328_CLKSEL_CON(37), 8, 5, DFLAGS),
|
||||
|
||||
COMPOSITE(ACLK_RGA_PRE, "aclk_rga_pre", mux_4plls_p, 0,
|
||||
RK3328_CLKSEL_CON(36), 14, 2, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(5), 0, GFLAGS),
|
||||
COMPOSITE(SCLK_RGA, "clk_rga", mux_4plls_p, 0,
|
||||
RK3328_CLKSEL_CON(36), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(5), 1, GFLAGS),
|
||||
COMPOSITE(ACLK_VOP_PRE, "aclk_vop_pre", mux_4plls_p, 0,
|
||||
RK3328_CLKSEL_CON(39), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(5), 5, GFLAGS),
|
||||
GATE(0, "clk_hdmi_sfc", "xin24m", 0,
|
||||
RK3328_CLKGATE_CON(5), 4, GFLAGS),
|
||||
|
||||
COMPOSITE_NODIV(0, "clk_cif_src", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(42), 7, 1, MFLAGS,
|
||||
RK3328_CLKGATE_CON(5), 3, GFLAGS),
|
||||
COMPOSITE_NOGATE(SCLK_CIF_OUT, "clk_cif_out", mux_sclk_cif_p, CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(42), 5, 1, MFLAGS, 0, 5, DFLAGS),
|
||||
|
||||
COMPOSITE(DCLK_LCDC_SRC, "dclk_lcdc_src", mux_gpll_cpll_p, 0,
|
||||
RK3328_CLKSEL_CON(40), 0, 1, MFLAGS, 8, 8, DFLAGS,
|
||||
RK3328_CLKGATE_CON(5), 6, GFLAGS),
|
||||
DIV(DCLK_HDMIPHY, "dclk_hdmiphy", "dclk_lcdc_src", 0,
|
||||
RK3328_CLKSEL_CON(40), 3, 3, DFLAGS),
|
||||
MUX(DCLK_LCDC, "dclk_lcdc", mux_dclk_lcdc_p, 0,
|
||||
RK3328_CLKSEL_CON(40), 1, 1, MFLAGS),
|
||||
|
||||
/*
|
||||
* Clock-Architecture Diagram 7
|
||||
*/
|
||||
|
||||
/* PD_PERI */
|
||||
GATE(0, "gpll_peri", "gpll", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(4), 0, GFLAGS),
|
||||
GATE(0, "cpll_peri", "cpll", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(4), 1, GFLAGS),
|
||||
GATE(0, "hdmiphy_peri", "hdmiphy", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKGATE_CON(4), 2, GFLAGS),
|
||||
COMPOSITE_NOGATE(ACLK_PERI_PRE, "aclk_peri_pre", mux_aclk_peri_pre_p, 0,
|
||||
RK3328_CLKSEL_CON(28), 6, 2, MFLAGS, 0, 5, DFLAGS),
|
||||
COMPOSITE_NOMUX(PCLK_PERI, "pclk_peri", "aclk_peri_pre", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKSEL_CON(29), 0, 2, DFLAGS,
|
||||
RK3328_CLKGATE_CON(10), 2, GFLAGS),
|
||||
COMPOSITE_NOMUX(HCLK_PERI, "hclk_peri", "aclk_peri_pre", CLK_IGNORE_UNUSED,
|
||||
RK3328_CLKSEL_CON(29), 4, 3, DFLAGS,
|
||||
RK3328_CLKGATE_CON(10), 1, GFLAGS),
|
||||
GATE(ACLK_PERI, "aclk_peri", "aclk_peri_pre", CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKGATE_CON(10), 0, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_SDMMC, "clk_sdmmc", mux_2plls_24m_u480m_p, 0,
|
||||
RK3328_CLKSEL_CON(30), 8, 2, MFLAGS, 0, 8, DFLAGS,
|
||||
RK3328_CLKGATE_CON(4), 3, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_SDIO, "clk_sdio", mux_2plls_24m_u480m_p, 0,
|
||||
RK3328_CLKSEL_CON(31), 8, 2, MFLAGS, 0, 8, DFLAGS,
|
||||
RK3328_CLKGATE_CON(4), 4, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_EMMC, "clk_emmc", mux_2plls_24m_u480m_p, 0,
|
||||
RK3328_CLKSEL_CON(32), 8, 2, MFLAGS, 0, 8, DFLAGS,
|
||||
RK3328_CLKGATE_CON(4), 5, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_SDMMC_EXT, "clk_sdmmc_ext", mux_2plls_24m_u480m_p, 0,
|
||||
RK3328_CLKSEL_CON(43), 8, 2, MFLAGS, 0, 8, DFLAGS,
|
||||
RK3328_CLKGATE_CON(4), 10, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_REF_USB3OTG_SRC, "clk_ref_usb3otg_src", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(45), 7, 1, MFLAGS, 0, 7, DFLAGS,
|
||||
RK3328_CLKGATE_CON(4), 9, GFLAGS),
|
||||
|
||||
MUX(SCLK_REF_USB3OTG, "clk_ref_usb3otg", mux_ref_usb3otg_src_p, CLK_SET_RATE_PARENT,
|
||||
RK3328_CLKSEL_CON(45), 8, 1, MFLAGS),
|
||||
|
||||
GATE(SCLK_USB3OTG_REF, "clk_usb3otg_ref", "xin24m", 0,
|
||||
RK3328_CLKGATE_CON(4), 7, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_USB3OTG_SUSPEND, "clk_usb3otg_suspend", mux_xin24m_32k_p, 0,
|
||||
RK3328_CLKSEL_CON(33), 15, 1, MFLAGS, 0, 10, DFLAGS,
|
||||
RK3328_CLKGATE_CON(4), 8, GFLAGS),
|
||||
|
||||
/*
|
||||
* Clock-Architecture Diagram 8
|
||||
*/
|
||||
|
||||
/* PD_GMAC */
|
||||
COMPOSITE(ACLK_GMAC, "aclk_gmac", mux_2plls_hdmiphy_p, 0,
|
||||
RK3328_CLKSEL_CON(35), 6, 2, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(3), 2, GFLAGS),
|
||||
COMPOSITE_NOMUX(PCLK_GMAC, "pclk_gmac", "aclk_gmac", 0,
|
||||
RK3328_CLKSEL_CON(25), 8, 3, DFLAGS,
|
||||
RK3328_CLKGATE_CON(9), 0, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_MAC2IO_SRC, "clk_mac2io_src", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(27), 7, 1, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(3), 1, GFLAGS),
|
||||
GATE(SCLK_MAC2IO_REF, "clk_mac2io_ref", "clk_mac2io", 0,
|
||||
RK3328_CLKGATE_CON(9), 7, GFLAGS),
|
||||
GATE(SCLK_MAC2IO_RX, "clk_mac2io_rx", "clk_mac2io", 0,
|
||||
RK3328_CLKGATE_CON(9), 4, GFLAGS),
|
||||
GATE(SCLK_MAC2IO_TX, "clk_mac2io_tx", "clk_mac2io", 0,
|
||||
RK3328_CLKGATE_CON(9), 5, GFLAGS),
|
||||
GATE(SCLK_MAC2IO_REFOUT, "clk_mac2io_refout", "clk_mac2io", 0,
|
||||
RK3328_CLKGATE_CON(9), 6, GFLAGS),
|
||||
COMPOSITE(SCLK_MAC2IO_OUT, "clk_mac2io_out", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(27), 15, 1, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(3), 5, GFLAGS),
|
||||
|
||||
COMPOSITE(SCLK_MAC2PHY_SRC, "clk_mac2phy_src", mux_2plls_p, 0,
|
||||
RK3328_CLKSEL_CON(26), 7, 1, MFLAGS, 0, 5, DFLAGS,
|
||||
RK3328_CLKGATE_CON(3), 0, GFLAGS),
|
||||
GATE(SCLK_MAC2PHY_REF, "clk_mac2phy_ref", "clk_mac2phy", 0,
|
||||
RK3328_CLKGATE_CON(9), 3, GFLAGS),
|
||||
GATE(SCLK_MAC2PHY_RXTX, "clk_mac2phy_rxtx", "clk_mac2phy", 0,
|
||||
RK3328_CLKGATE_CON(9), 1, GFLAGS),
|
||||
COMPOSITE_NOMUX(SCLK_MAC2PHY_OUT, "clk_mac2phy_out", "clk_mac2phy", 0,
|
||||
RK3328_CLKSEL_CON(26), 8, 2, DFLAGS,
|
||||
RK3328_CLKGATE_CON(9), 2, GFLAGS),
|
||||
|
||||
FACTOR(0, "xin12m", "xin24m", 0, 1, 2),
|
||||
|
||||
/*
|
||||
* Clock-Architecture Diagram 9
|
||||
*/
|
||||
|
||||
/* PD_VOP */
|
||||
GATE(ACLK_RGA, "aclk_rga", "aclk_rga_pre", 0, RK3328_CLKGATE_CON(21), 10, GFLAGS),
|
||||
GATE(0, "aclk_rga_niu", "aclk_rga_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(22), 3, GFLAGS),
|
||||
GATE(ACLK_VOP, "aclk_vop", "aclk_vop_pre", 0, RK3328_CLKGATE_CON(21), 2, GFLAGS),
|
||||
GATE(0, "aclk_vop_niu", "aclk_vop_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(21), 4, GFLAGS),
|
||||
|
||||
GATE(ACLK_IEP, "aclk_iep", "aclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 6, GFLAGS),
|
||||
GATE(ACLK_CIF, "aclk_cif", "aclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 8, GFLAGS),
|
||||
GATE(ACLK_HDCP, "aclk_hdcp", "aclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 15, GFLAGS),
|
||||
GATE(0, "aclk_vio_niu", "aclk_vio_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(22), 2, GFLAGS),
|
||||
|
||||
GATE(HCLK_VOP, "hclk_vop", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 3, GFLAGS),
|
||||
GATE(0, "hclk_vop_niu", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 5, GFLAGS),
|
||||
GATE(HCLK_IEP, "hclk_iep", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 7, GFLAGS),
|
||||
GATE(HCLK_CIF, "hclk_cif", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 9, GFLAGS),
|
||||
GATE(HCLK_RGA, "hclk_rga", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(21), 11, GFLAGS),
|
||||
GATE(0, "hclk_ahb1tom", "hclk_vio_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(21), 12, GFLAGS),
|
||||
GATE(0, "pclk_vio_h2p", "hclk_vio_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(21), 13, GFLAGS),
|
||||
GATE(0, "hclk_vio_h2p", "hclk_vio_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(21), 14, GFLAGS),
|
||||
GATE(HCLK_HDCP, "hclk_hdcp", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(22), 0, GFLAGS),
|
||||
GATE(HCLK_VIO, "hclk_vio", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(22), 1, GFLAGS),
|
||||
GATE(PCLK_HDMI, "pclk_hdmi", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(22), 4, GFLAGS),
|
||||
GATE(PCLK_HDCP, "pclk_hdcp", "hclk_vio_pre", 0, RK3328_CLKGATE_CON(22), 5, GFLAGS),
|
||||
|
||||
/* PD_PERI */
|
||||
GATE(0, "aclk_peri_noc", "aclk_peri", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(19), 11, GFLAGS),
|
||||
GATE(ACLK_USB3OTG, "aclk_usb3otg", "aclk_peri", 0, RK3328_CLKGATE_CON(19), 4, GFLAGS),
|
||||
|
||||
GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 0, GFLAGS),
|
||||
GATE(HCLK_SDIO, "hclk_sdio", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 1, GFLAGS),
|
||||
GATE(HCLK_EMMC, "hclk_emmc", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 2, GFLAGS),
|
||||
GATE(HCLK_SDMMC_EXT, "hclk_sdmmc_ext", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 15, GFLAGS),
|
||||
GATE(HCLK_HOST0, "hclk_host0", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 6, GFLAGS),
|
||||
GATE(HCLK_HOST0_ARB, "hclk_host0_arb", "hclk_peri", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(19), 7, GFLAGS),
|
||||
GATE(HCLK_OTG, "hclk_otg", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 8, GFLAGS),
|
||||
GATE(HCLK_OTG_PMU, "hclk_otg_pmu", "hclk_peri", 0, RK3328_CLKGATE_CON(19), 9, GFLAGS),
|
||||
GATE(0, "hclk_peri_niu", "hclk_peri", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(19), 12, GFLAGS),
|
||||
GATE(0, "pclk_peri_niu", "hclk_peri", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(19), 13, GFLAGS),
|
||||
|
||||
/* PD_GMAC */
|
||||
GATE(ACLK_MAC2PHY, "aclk_mac2phy", "aclk_gmac", 0, RK3328_CLKGATE_CON(26), 0, GFLAGS),
|
||||
GATE(ACLK_MAC2IO, "aclk_mac2io", "aclk_gmac", 0, RK3328_CLKGATE_CON(26), 2, GFLAGS),
|
||||
GATE(0, "aclk_gmac_niu", "aclk_gmac", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(26), 4, GFLAGS),
|
||||
GATE(PCLK_MAC2PHY, "pclk_mac2phy", "pclk_gmac", 0, RK3328_CLKGATE_CON(26), 1, GFLAGS),
|
||||
GATE(PCLK_MAC2IO, "pclk_mac2io", "pclk_gmac", 0, RK3328_CLKGATE_CON(26), 3, GFLAGS),
|
||||
GATE(0, "pclk_gmac_niu", "pclk_gmac", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(26), 5, GFLAGS),
|
||||
|
||||
/* PD_BUS */
|
||||
GATE(0, "aclk_bus_niu", "aclk_bus_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 12, GFLAGS),
|
||||
GATE(ACLK_DCF, "aclk_dcf", "aclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 11, GFLAGS),
|
||||
GATE(ACLK_TSP, "aclk_tsp", "aclk_bus_pre", 0, RK3328_CLKGATE_CON(17), 12, GFLAGS),
|
||||
GATE(0, "aclk_intmem", "aclk_bus_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 0, GFLAGS),
|
||||
GATE(ACLK_DMAC, "aclk_dmac_bus", "aclk_bus_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 1, GFLAGS),
|
||||
|
||||
GATE(0, "hclk_rom", "hclk_bus_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 2, GFLAGS),
|
||||
GATE(HCLK_I2S0_8CH, "hclk_i2s0_8ch", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 3, GFLAGS),
|
||||
GATE(HCLK_I2S1_8CH, "hclk_i2s1_8ch", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 4, GFLAGS),
|
||||
GATE(HCLK_I2S2_2CH, "hclk_i2s2_2ch", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 5, GFLAGS),
|
||||
GATE(HCLK_SPDIF_8CH, "hclk_spdif_8ch", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 6, GFLAGS),
|
||||
GATE(HCLK_TSP, "hclk_tsp", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(17), 11, GFLAGS),
|
||||
GATE(HCLK_CRYPTO_MST, "hclk_crypto_mst", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 7, GFLAGS),
|
||||
GATE(HCLK_CRYPTO_SLV, "hclk_crypto_slv", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(15), 8, GFLAGS),
|
||||
GATE(0, "hclk_bus_niu", "hclk_bus_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 13, GFLAGS),
|
||||
GATE(HCLK_PDM, "hclk_pdm", "hclk_bus_pre", 0, RK3328_CLKGATE_CON(28), 0, GFLAGS),
|
||||
|
||||
GATE(0, "pclk_bus_niu", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 14, GFLAGS),
|
||||
GATE(0, "pclk_efuse", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 9, GFLAGS),
|
||||
GATE(0, "pclk_otp", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(28), 4, GFLAGS),
|
||||
GATE(PCLK_I2C0, "pclk_i2c0", "pclk_bus", 0, RK3328_CLKGATE_CON(15), 10, GFLAGS),
|
||||
GATE(PCLK_I2C1, "pclk_i2c1", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 0, GFLAGS),
|
||||
GATE(PCLK_I2C2, "pclk_i2c2", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 1, GFLAGS),
|
||||
GATE(PCLK_I2C3, "pclk_i2c3", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 2, GFLAGS),
|
||||
GATE(PCLK_TIMER, "pclk_timer0", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 3, GFLAGS),
|
||||
GATE(0, "pclk_stimer", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 4, GFLAGS),
|
||||
GATE(PCLK_SPI, "pclk_spi", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 5, GFLAGS),
|
||||
GATE(PCLK_PWM, "pclk_rk_pwm", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 6, GFLAGS),
|
||||
GATE(PCLK_GPIO0, "pclk_gpio0", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 7, GFLAGS),
|
||||
GATE(PCLK_GPIO1, "pclk_gpio1", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 8, GFLAGS),
|
||||
GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 9, GFLAGS),
|
||||
GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 10, GFLAGS),
|
||||
GATE(PCLK_UART0, "pclk_uart0", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 11, GFLAGS),
|
||||
GATE(PCLK_UART1, "pclk_uart1", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 12, GFLAGS),
|
||||
GATE(PCLK_UART2, "pclk_uart2", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 13, GFLAGS),
|
||||
GATE(PCLK_TSADC, "pclk_tsadc", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 14, GFLAGS),
|
||||
GATE(PCLK_DCF, "pclk_dcf", "pclk_bus", 0, RK3328_CLKGATE_CON(16), 15, GFLAGS),
|
||||
GATE(PCLK_GRF, "pclk_grf", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 0, GFLAGS),
|
||||
GATE(0, "pclk_cru", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 4, GFLAGS),
|
||||
GATE(0, "pclk_sgrf", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 6, GFLAGS),
|
||||
GATE(0, "pclk_sim", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 10, GFLAGS),
|
||||
GATE(PCLK_SARADC, "pclk_saradc", "pclk_bus", 0, RK3328_CLKGATE_CON(17), 15, GFLAGS),
|
||||
GATE(0, "pclk_pmu", "pclk_bus", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(28), 3, GFLAGS),
|
||||
|
||||
GATE(PCLK_USB3PHY_OTG, "pclk_usb3phy_otg", "pclk_phy_pre", 0, RK3328_CLKGATE_CON(28), 1, GFLAGS),
|
||||
GATE(PCLK_USB3PHY_PIPE, "pclk_usb3phy_pipe", "pclk_phy_pre", 0, RK3328_CLKGATE_CON(28), 2, GFLAGS),
|
||||
GATE(PCLK_USB3_GRF, "pclk_usb3_grf", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 2, GFLAGS),
|
||||
GATE(PCLK_USB2_GRF, "pclk_usb2_grf", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 14, GFLAGS),
|
||||
GATE(0, "pclk_ddrphy", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 13, GFLAGS),
|
||||
GATE(0, "pclk_acodecphy", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 5, GFLAGS),
|
||||
GATE(PCLK_HDMIPHY, "pclk_hdmiphy", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 7, GFLAGS),
|
||||
GATE(0, "pclk_vdacphy", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(17), 8, GFLAGS),
|
||||
GATE(0, "pclk_phy_niu", "pclk_phy_pre", CLK_IGNORE_UNUSED, RK3328_CLKGATE_CON(15), 15, GFLAGS),
|
||||
|
||||
/* PD_MMC */
|
||||
MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "sclk_sdmmc",
|
||||
RK3328_SDMMC_CON0, 1),
|
||||
MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "sclk_sdmmc",
|
||||
RK3328_SDMMC_CON1, 1),
|
||||
|
||||
MMC(SCLK_SDIO_DRV, "sdio_drv", "sclk_sdio",
|
||||
RK3328_SDIO_CON0, 1),
|
||||
MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "sclk_sdio",
|
||||
RK3328_SDIO_CON1, 1),
|
||||
|
||||
MMC(SCLK_EMMC_DRV, "emmc_drv", "sclk_emmc",
|
||||
RK3328_EMMC_CON0, 1),
|
||||
MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "sclk_emmc",
|
||||
RK3328_EMMC_CON1, 1),
|
||||
|
||||
MMC(SCLK_SDMMC_EXT_DRV, "sdmmc_ext_drv", "sclk_sdmmc_ext",
|
||||
RK3328_SDMMC_EXT_CON0, 1),
|
||||
MMC(SCLK_SDMMC_EXT_SAMPLE, "sdmmc_ext_sample", "sclk_sdmmc_ext",
|
||||
RK3328_SDMMC_EXT_CON1, 1),
|
||||
};
|
||||
|
||||
static const char *const rk3328_critical_clocks[] __initconst = {
|
||||
"aclk_bus",
|
||||
"pclk_bus",
|
||||
"hclk_bus",
|
||||
"aclk_peri",
|
||||
"hclk_peri",
|
||||
"pclk_peri",
|
||||
"pclk_dbg",
|
||||
"aclk_core_niu",
|
||||
"aclk_gic400",
|
||||
"aclk_intmem",
|
||||
"hclk_rom",
|
||||
"pclk_grf",
|
||||
"pclk_cru",
|
||||
"pclk_sgrf",
|
||||
"pclk_timer0",
|
||||
"clk_timer0",
|
||||
"pclk_ddr_msch",
|
||||
"pclk_ddr_mon",
|
||||
"pclk_ddr_grf",
|
||||
"clk_ddrupctl",
|
||||
"clk_ddrmsch",
|
||||
"hclk_ahb1tom",
|
||||
"clk_jtag",
|
||||
"pclk_ddrphy",
|
||||
"pclk_pmu",
|
||||
"hclk_otg_pmu",
|
||||
"aclk_rga_niu",
|
||||
"pclk_vio_h2p",
|
||||
"hclk_vio_h2p",
|
||||
};
|
||||
|
||||
static void __init rk3328_clk_init(struct device_node *np)
|
||||
{
|
||||
struct rockchip_clk_provider *ctx;
|
||||
void __iomem *reg_base;
|
||||
|
||||
reg_base = of_iomap(np, 0);
|
||||
if (!reg_base) {
|
||||
pr_err("%s: could not map cru region\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
|
||||
if (IS_ERR(ctx)) {
|
||||
pr_err("%s: rockchip clk init failed\n", __func__);
|
||||
iounmap(reg_base);
|
||||
return;
|
||||
}
|
||||
|
||||
rockchip_clk_register_plls(ctx, rk3328_pll_clks,
|
||||
ARRAY_SIZE(rk3328_pll_clks),
|
||||
RK3328_GRF_SOC_STATUS0);
|
||||
rockchip_clk_register_branches(ctx, rk3328_clk_branches,
|
||||
ARRAY_SIZE(rk3328_clk_branches));
|
||||
rockchip_clk_protect_critical(rk3328_critical_clocks,
|
||||
ARRAY_SIZE(rk3328_critical_clocks));
|
||||
|
||||
rockchip_clk_register_armclk(ctx, ARMCLK, "armclk",
|
||||
mux_armclk_p, ARRAY_SIZE(mux_armclk_p),
|
||||
&rk3328_cpuclk_data, rk3328_cpuclk_rates,
|
||||
ARRAY_SIZE(rk3328_cpuclk_rates));
|
||||
|
||||
rockchip_register_softrst(np, 11, reg_base + RK3328_SOFTRST_CON(0),
|
||||
ROCKCHIP_SOFTRST_HIWORD_MASK);
|
||||
|
||||
rockchip_register_restart_notifier(ctx, RK3328_GLB_SRST_FST, NULL);
|
||||
|
||||
rockchip_clk_of_add_provider(np, ctx);
|
||||
}
|
||||
CLK_OF_DECLARE(rk3328_cru, "rockchip,rk3328-cru", rk3328_clk_init);
|
@ -1132,7 +1132,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = {
|
||||
RK3399_CLKGATE_CON(11), 8, GFLAGS),
|
||||
|
||||
COMPOSITE(PCLK_EDP, "pclk_edp", mux_pll_src_cpll_gpll_p, 0,
|
||||
RK3399_CLKSEL_CON(44), 15, 1, MFLAGS, 8, 5, DFLAGS,
|
||||
RK3399_CLKSEL_CON(44), 15, 1, MFLAGS, 8, 6, DFLAGS,
|
||||
RK3399_CLKGATE_CON(11), 11, GFLAGS),
|
||||
GATE(PCLK_EDP_NOC, "pclk_edp_noc", "pclk_edp", CLK_IGNORE_UNUSED,
|
||||
RK3399_CLKGATE_CON(32), 12, GFLAGS),
|
||||
|
@ -344,7 +344,6 @@ struct rockchip_clk_provider * __init rockchip_clk_init(struct device_node *np,
|
||||
ctx->clk_data.clks = clk_table;
|
||||
ctx->clk_data.clk_num = nr_clks;
|
||||
ctx->cru_node = np;
|
||||
ctx->grf = ERR_PTR(-EPROBE_DEFER);
|
||||
spin_lock_init(&ctx->lock);
|
||||
|
||||
ctx->grf = syscon_regmap_lookup_by_phandle(ctx->cru_node,
|
||||
@ -417,6 +416,13 @@ void __init rockchip_clk_register_branches(
|
||||
list->mux_shift, list->mux_width,
|
||||
list->mux_flags, &ctx->lock);
|
||||
break;
|
||||
case branch_muxgrf:
|
||||
clk = rockchip_clk_register_muxgrf(list->name,
|
||||
list->parent_names, list->num_parents,
|
||||
flags, ctx->grf, list->muxdiv_offset,
|
||||
list->mux_shift, list->mux_width,
|
||||
list->mux_flags);
|
||||
break;
|
||||
case branch_divider:
|
||||
if (list->div_table)
|
||||
clk = clk_register_divider_table(NULL,
|
||||
|
@ -91,6 +91,24 @@ struct clk;
|
||||
#define RK3288_EMMC_CON0 0x218
|
||||
#define RK3288_EMMC_CON1 0x21c
|
||||
|
||||
#define RK3328_PLL_CON(x) RK2928_PLL_CON(x)
|
||||
#define RK3328_CLKSEL_CON(x) ((x) * 0x4 + 0x100)
|
||||
#define RK3328_CLKGATE_CON(x) ((x) * 0x4 + 0x200)
|
||||
#define RK3328_GRFCLKSEL_CON(x) ((x) * 0x4 + 0x100)
|
||||
#define RK3328_GLB_SRST_FST 0x9c
|
||||
#define RK3328_GLB_SRST_SND 0x98
|
||||
#define RK3328_SOFTRST_CON(x) ((x) * 0x4 + 0x300)
|
||||
#define RK3328_MODE_CON 0x80
|
||||
#define RK3328_MISC_CON 0x84
|
||||
#define RK3328_SDMMC_CON0 0x380
|
||||
#define RK3328_SDMMC_CON1 0x384
|
||||
#define RK3328_SDIO_CON0 0x388
|
||||
#define RK3328_SDIO_CON1 0x38c
|
||||
#define RK3328_EMMC_CON0 0x390
|
||||
#define RK3328_EMMC_CON1 0x394
|
||||
#define RK3328_SDMMC_EXT_CON0 0x398
|
||||
#define RK3328_SDMMC_EXT_CON1 0x39C
|
||||
|
||||
#define RK3368_PLL_CON(x) RK2928_PLL_CON(x)
|
||||
#define RK3368_CLKSEL_CON(x) ((x) * 0x4 + 0x100)
|
||||
#define RK3368_CLKGATE_CON(x) ((x) * 0x4 + 0x200)
|
||||
@ -130,6 +148,7 @@ struct clk;
|
||||
enum rockchip_pll_type {
|
||||
pll_rk3036,
|
||||
pll_rk3066,
|
||||
pll_rk3328,
|
||||
pll_rk3399,
|
||||
};
|
||||
|
||||
@ -317,11 +336,17 @@ struct clk *rockchip_clk_register_inverter(const char *name,
|
||||
void __iomem *reg, int shift, int flags,
|
||||
spinlock_t *lock);
|
||||
|
||||
struct clk *rockchip_clk_register_muxgrf(const char *name,
|
||||
const char *const *parent_names, u8 num_parents,
|
||||
int flags, struct regmap *grf, int reg,
|
||||
int shift, int width, int mux_flags);
|
||||
|
||||
#define PNAME(x) static const char *const x[] __initconst
|
||||
|
||||
enum rockchip_clk_branch_type {
|
||||
branch_composite,
|
||||
branch_mux,
|
||||
branch_muxgrf,
|
||||
branch_divider,
|
||||
branch_fraction_divider,
|
||||
branch_gate,
|
||||
@ -551,6 +576,21 @@ struct rockchip_clk_branch {
|
||||
.gate_offset = -1, \
|
||||
}
|
||||
|
||||
#define MUXGRF(_id, cname, pnames, f, o, s, w, mf) \
|
||||
{ \
|
||||
.id = _id, \
|
||||
.branch_type = branch_muxgrf, \
|
||||
.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, \
|
||||
|
@ -5,7 +5,6 @@
|
||||
obj-$(CONFIG_COMMON_CLK) += clk.o clk-pll.o clk-cpu.o
|
||||
obj-$(CONFIG_SOC_EXYNOS3250) += clk-exynos3250.o
|
||||
obj-$(CONFIG_ARCH_EXYNOS4) += clk-exynos4.o
|
||||
obj-$(CONFIG_SOC_EXYNOS4415) += clk-exynos4415.o
|
||||
obj-$(CONFIG_SOC_EXYNOS5250) += clk-exynos5250.o
|
||||
obj-$(CONFIG_SOC_EXYNOS5260) += clk-exynos5260.o
|
||||
obj-$(CONFIG_SOC_EXYNOS5410) += clk-exynos5410.o
|
||||
|
@ -44,7 +44,7 @@ static unsigned long reg_save[][2] = {
|
||||
{ ASS_CLK_GATE, 0 },
|
||||
};
|
||||
|
||||
static int exynos_audss_clk_suspend(void)
|
||||
static int exynos_audss_clk_suspend(struct device *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -54,18 +54,15 @@ static int exynos_audss_clk_suspend(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void exynos_audss_clk_resume(void)
|
||||
static int exynos_audss_clk_resume(struct device *dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(reg_save); i++)
|
||||
writel(reg_save[i][1], reg_base + reg_save[i][0]);
|
||||
}
|
||||
|
||||
static struct syscore_ops exynos_audss_clk_syscore_ops = {
|
||||
.suspend = exynos_audss_clk_suspend,
|
||||
.resume = exynos_audss_clk_resume,
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_PM_SLEEP */
|
||||
|
||||
struct exynos_audss_clk_drvdata {
|
||||
@ -251,9 +248,6 @@ static int exynos_audss_clk_probe(struct platform_device *pdev)
|
||||
goto unregister;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
register_syscore_ops(&exynos_audss_clk_syscore_ops);
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
unregister:
|
||||
@ -267,10 +261,6 @@ unregister:
|
||||
|
||||
static int exynos_audss_clk_remove(struct platform_device *pdev)
|
||||
{
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
unregister_syscore_ops(&exynos_audss_clk_syscore_ops);
|
||||
#endif
|
||||
|
||||
of_clk_del_provider(pdev->dev.of_node);
|
||||
|
||||
exynos_audss_clk_teardown();
|
||||
@ -281,10 +271,16 @@ static int exynos_audss_clk_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops exynos_audss_clk_pm_ops = {
|
||||
SET_LATE_SYSTEM_SLEEP_PM_OPS(exynos_audss_clk_suspend,
|
||||
exynos_audss_clk_resume)
|
||||
};
|
||||
|
||||
static struct platform_driver exynos_audss_clk_driver = {
|
||||
.driver = {
|
||||
.name = "exynos-audss-clk",
|
||||
.of_match_table = exynos_audss_clk_of_match,
|
||||
.pm = &exynos_audss_clk_pm_ops,
|
||||
},
|
||||
.probe = exynos_audss_clk_probe,
|
||||
.remove = exynos_audss_clk_remove,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Common Clock Framework support for Exynos5443 SoC.
|
||||
* Common Clock Framework support for Exynos5433 SoC.
|
||||
*/
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
@ -549,10 +549,10 @@ static const struct samsung_gate_clock top_gate_clks[] __initconst = {
|
||||
29, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_ACLK_BUS0_400, "aclk_bus0_400", "div_aclk_bus0_400",
|
||||
ENABLE_ACLK_TOP, 26,
|
||||
CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0),
|
||||
CLK_IS_CRITICAL | CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_ACLK_BUS1_400, "aclk_bus1_400", "div_aclk_bus1_400",
|
||||
ENABLE_ACLK_TOP, 25,
|
||||
CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0),
|
||||
CLK_IS_CRITICAL | CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_ACLK_IMEM_200, "aclk_imem_200", "div_aclk_imem_266",
|
||||
ENABLE_ACLK_TOP, 24,
|
||||
CLK_IS_CRITICAL | CLK_SET_RATE_PARENT, 0),
|
||||
@ -616,7 +616,7 @@ static const struct samsung_gate_clock top_gate_clks[] __initconst = {
|
||||
|
||||
/* ENABLE_SCLK_TOP_MSCL */
|
||||
GATE(CLK_SCLK_JPEG_MSCL, "sclk_jpeg_mscl", "div_sclk_jpeg",
|
||||
ENABLE_SCLK_TOP_MSCL, 0, 0, 0),
|
||||
ENABLE_SCLK_TOP_MSCL, 0, CLK_SET_RATE_PARENT, 0),
|
||||
|
||||
/* ENABLE_SCLK_TOP_CAM1 */
|
||||
GATE(CLK_SCLK_ISP_SENSOR2, "sclk_isp_sensor2", "div_sclk_isp_sensor2_b",
|
||||
@ -698,7 +698,7 @@ static const struct samsung_gate_clock top_gate_clks[] __initconst = {
|
||||
* ATLAS_PLL & APOLLO_PLL & MEM0_PLL & MEM1_PLL & BUS_PLL & MFC_PLL
|
||||
* & MPHY_PLL & G3D_PLL & DISP_PLL & ISP_PLL
|
||||
*/
|
||||
static const struct samsung_pll_rate_table exynos5443_pll_rates[] __initconst = {
|
||||
static const struct samsung_pll_rate_table exynos5433_pll_rates[] __initconst = {
|
||||
PLL_35XX_RATE(2500000000U, 625, 6, 0),
|
||||
PLL_35XX_RATE(2400000000U, 500, 5, 0),
|
||||
PLL_35XX_RATE(2300000000U, 575, 6, 0),
|
||||
@ -739,7 +739,9 @@ static const struct samsung_pll_rate_table exynos5443_pll_rates[] __initconst =
|
||||
PLL_35XX_RATE(350000000U, 350, 6, 2),
|
||||
PLL_35XX_RATE(333000000U, 222, 4, 2),
|
||||
PLL_35XX_RATE(300000000U, 500, 5, 3),
|
||||
PLL_35XX_RATE(278000000U, 556, 6, 3),
|
||||
PLL_35XX_RATE(266000000U, 532, 6, 3),
|
||||
PLL_35XX_RATE(250000000U, 500, 6, 3),
|
||||
PLL_35XX_RATE(200000000U, 400, 6, 3),
|
||||
PLL_35XX_RATE(166000000U, 332, 6, 3),
|
||||
PLL_35XX_RATE(160000000U, 320, 6, 3),
|
||||
@ -749,7 +751,7 @@ static const struct samsung_pll_rate_table exynos5443_pll_rates[] __initconst =
|
||||
};
|
||||
|
||||
/* AUD_PLL */
|
||||
static const struct samsung_pll_rate_table exynos5443_aud_pll_rates[] __initconst = {
|
||||
static const struct samsung_pll_rate_table exynos5433_aud_pll_rates[] __initconst = {
|
||||
PLL_36XX_RATE(400000000U, 200, 3, 2, 0),
|
||||
PLL_36XX_RATE(393216000U, 197, 3, 2, -25690),
|
||||
PLL_36XX_RATE(384000000U, 128, 2, 2, 0),
|
||||
@ -764,9 +766,9 @@ static const struct samsung_pll_rate_table exynos5443_aud_pll_rates[] __initcons
|
||||
|
||||
static const struct samsung_pll_clock top_pll_clks[] __initconst = {
|
||||
PLL(pll_35xx, CLK_FOUT_ISP_PLL, "fout_isp_pll", "oscclk",
|
||||
ISP_PLL_LOCK, ISP_PLL_CON0, exynos5443_pll_rates),
|
||||
ISP_PLL_LOCK, ISP_PLL_CON0, exynos5433_pll_rates),
|
||||
PLL(pll_36xx, CLK_FOUT_AUD_PLL, "fout_aud_pll", "oscclk",
|
||||
AUD_PLL_LOCK, AUD_PLL_CON0, exynos5443_aud_pll_rates),
|
||||
AUD_PLL_LOCK, AUD_PLL_CON0, exynos5433_aud_pll_rates),
|
||||
};
|
||||
|
||||
static const struct samsung_cmu_info top_cmu_info __initconst = {
|
||||
@ -820,7 +822,7 @@ PNAME(mout_mphy_pll_p) = { "oscclk", "fout_mphy_pll", };
|
||||
|
||||
static const struct samsung_pll_clock cpif_pll_clks[] __initconst = {
|
||||
PLL(pll_35xx, CLK_FOUT_MPHY_PLL, "fout_mphy_pll", "oscclk",
|
||||
MPHY_PLL_LOCK, MPHY_PLL_CON0, exynos5443_pll_rates),
|
||||
MPHY_PLL_LOCK, MPHY_PLL_CON0, exynos5433_pll_rates),
|
||||
};
|
||||
|
||||
static const struct samsung_mux_clock cpif_mux_clks[] __initconst = {
|
||||
@ -1011,13 +1013,13 @@ static const unsigned long mif_clk_regs[] __initconst = {
|
||||
|
||||
static const struct samsung_pll_clock mif_pll_clks[] __initconst = {
|
||||
PLL(pll_35xx, CLK_FOUT_MEM0_PLL, "fout_mem0_pll", "oscclk",
|
||||
MEM0_PLL_LOCK, MEM0_PLL_CON0, exynos5443_pll_rates),
|
||||
MEM0_PLL_LOCK, MEM0_PLL_CON0, exynos5433_pll_rates),
|
||||
PLL(pll_35xx, CLK_FOUT_MEM1_PLL, "fout_mem1_pll", "oscclk",
|
||||
MEM1_PLL_LOCK, MEM1_PLL_CON0, exynos5443_pll_rates),
|
||||
MEM1_PLL_LOCK, MEM1_PLL_CON0, exynos5433_pll_rates),
|
||||
PLL(pll_35xx, CLK_FOUT_BUS_PLL, "fout_bus_pll", "oscclk",
|
||||
BUS_PLL_LOCK, BUS_PLL_CON0, exynos5443_pll_rates),
|
||||
BUS_PLL_LOCK, BUS_PLL_CON0, exynos5433_pll_rates),
|
||||
PLL(pll_35xx, CLK_FOUT_MFC_PLL, "fout_mfc_pll", "oscclk",
|
||||
MFC_PLL_LOCK, MFC_PLL_CON0, exynos5443_pll_rates),
|
||||
MFC_PLL_LOCK, MFC_PLL_CON0, exynos5433_pll_rates),
|
||||
};
|
||||
|
||||
/* list of all parent clock list */
|
||||
@ -1382,7 +1384,7 @@ static const struct samsung_gate_clock mif_gate_clks[] __initconst = {
|
||||
/* ENABLE_ACLK_MIF3 */
|
||||
GATE(CLK_ACLK_BUS2_400, "aclk_bus2_400", "div_aclk_bus2_400",
|
||||
ENABLE_ACLK_MIF3, 4,
|
||||
CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0),
|
||||
CLK_IS_CRITICAL | CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_ACLK_DISP_333, "aclk_disp_333", "div_aclk_disp_333",
|
||||
ENABLE_ACLK_MIF3, 1,
|
||||
CLK_IS_CRITICAL | CLK_SET_RATE_PARENT, 0),
|
||||
@ -2539,7 +2541,7 @@ PNAME(mout_sclk_decon_tv_vclk_b_disp_p) = { "mout_sclk_decon_tv_vclk_a_disp",
|
||||
|
||||
static const struct samsung_pll_clock disp_pll_clks[] __initconst = {
|
||||
PLL(pll_35xx, CLK_FOUT_DISP_PLL, "fout_disp_pll", "oscclk",
|
||||
DISP_PLL_LOCK, DISP_PLL_CON0, exynos5443_pll_rates),
|
||||
DISP_PLL_LOCK, DISP_PLL_CON0, exynos5433_pll_rates),
|
||||
};
|
||||
|
||||
static const struct samsung_fixed_factor_clock disp_fixed_factor_clks[] __initconst = {
|
||||
@ -2559,8 +2561,10 @@ static const struct samsung_fixed_rate_clock disp_fixed_clks[] __initconst = {
|
||||
FRATE(0, "phyclk_mipidphy1_bitclkdiv8_phy", NULL, 0, 188000000),
|
||||
FRATE(0, "phyclk_mipidphy1_rxclkesc0_phy", NULL, 0, 100000000),
|
||||
/* PHY clocks from MIPI_DPHY0 */
|
||||
FRATE(0, "phyclk_mipidphy0_bitclkdiv8_phy", NULL, 0, 188000000),
|
||||
FRATE(0, "phyclk_mipidphy0_rxclkesc0_phy", NULL, 0, 100000000),
|
||||
FRATE(CLK_PHYCLK_MIPIDPHY0_BITCLKDIV8_PHY, "phyclk_mipidphy0_bitclkdiv8_phy",
|
||||
NULL, 0, 188000000),
|
||||
FRATE(CLK_PHYCLK_MIPIDPHY0_RXCLKESC0_PHY, "phyclk_mipidphy0_rxclkesc0_phy",
|
||||
NULL, 0, 100000000),
|
||||
/* PHY clocks from HDMI_PHY */
|
||||
FRATE(CLK_PHYCLK_HDMIPHY_TMDS_CLKO_PHY, "phyclk_hdmiphy_tmds_clko_phy",
|
||||
NULL, 0, 300000000),
|
||||
@ -3224,7 +3228,7 @@ PNAME(mout_g3d_pll_p) = { "oscclk", "fout_g3d_pll", };
|
||||
|
||||
static const struct samsung_pll_clock g3d_pll_clks[] __initconst = {
|
||||
PLL(pll_35xx, CLK_FOUT_G3D_PLL, "fout_g3d_pll", "oscclk",
|
||||
G3D_PLL_LOCK, G3D_PLL_CON0, exynos5443_pll_rates),
|
||||
G3D_PLL_LOCK, G3D_PLL_CON0, exynos5433_pll_rates),
|
||||
};
|
||||
|
||||
static const struct samsung_mux_clock g3d_mux_clks[] __initconst = {
|
||||
@ -3514,7 +3518,7 @@ PNAME(mout_apollo_p) = { "mout_apollo_pll",
|
||||
|
||||
static const struct samsung_pll_clock apollo_pll_clks[] __initconst = {
|
||||
PLL(pll_35xx, CLK_FOUT_APOLLO_PLL, "fout_apollo_pll", "oscclk",
|
||||
APOLLO_PLL_LOCK, APOLLO_PLL_CON0, exynos5443_pll_rates),
|
||||
APOLLO_PLL_LOCK, APOLLO_PLL_CON0, exynos5433_pll_rates),
|
||||
};
|
||||
|
||||
static const struct samsung_mux_clock apollo_mux_clks[] __initconst = {
|
||||
@ -3737,7 +3741,7 @@ PNAME(mout_atlas_p) = { "mout_atlas_pll",
|
||||
|
||||
static const struct samsung_pll_clock atlas_pll_clks[] __initconst = {
|
||||
PLL(pll_35xx, CLK_FOUT_ATLAS_PLL, "fout_atlas_pll", "oscclk",
|
||||
ATLAS_PLL_LOCK, ATLAS_PLL_CON0, exynos5443_pll_rates),
|
||||
ATLAS_PLL_LOCK, ATLAS_PLL_CON0, exynos5433_pll_rates),
|
||||
};
|
||||
|
||||
static const struct samsung_mux_clock atlas_mux_clks[] __initconst = {
|
||||
|
@ -136,11 +136,39 @@ static const struct clk_ops samsung_pll3000_clk_ops = {
|
||||
#define PLL35XX_MDIV_MASK (0x3FF)
|
||||
#define PLL35XX_PDIV_MASK (0x3F)
|
||||
#define PLL35XX_SDIV_MASK (0x7)
|
||||
#define PLL35XX_LOCK_STAT_MASK (0x1)
|
||||
#define PLL35XX_MDIV_SHIFT (16)
|
||||
#define PLL35XX_PDIV_SHIFT (8)
|
||||
#define PLL35XX_SDIV_SHIFT (0)
|
||||
#define PLL35XX_LOCK_STAT_SHIFT (29)
|
||||
#define PLL35XX_ENABLE_SHIFT (31)
|
||||
|
||||
static int samsung_pll35xx_enable(struct clk_hw *hw)
|
||||
{
|
||||
struct samsung_clk_pll *pll = to_clk_pll(hw);
|
||||
u32 tmp;
|
||||
|
||||
tmp = readl_relaxed(pll->con_reg);
|
||||
tmp |= BIT(PLL35XX_ENABLE_SHIFT);
|
||||
writel_relaxed(tmp, pll->con_reg);
|
||||
|
||||
/* wait_lock_time */
|
||||
do {
|
||||
cpu_relax();
|
||||
tmp = readl_relaxed(pll->con_reg);
|
||||
} while (!(tmp & BIT(PLL35XX_LOCK_STAT_SHIFT)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void samsung_pll35xx_disable(struct clk_hw *hw)
|
||||
{
|
||||
struct samsung_clk_pll *pll = to_clk_pll(hw);
|
||||
u32 tmp;
|
||||
|
||||
tmp = readl_relaxed(pll->con_reg);
|
||||
tmp &= ~BIT(PLL35XX_ENABLE_SHIFT);
|
||||
writel_relaxed(tmp, pll->con_reg);
|
||||
}
|
||||
|
||||
static unsigned long samsung_pll35xx_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
@ -210,12 +238,13 @@ static int samsung_pll35xx_set_rate(struct clk_hw *hw, unsigned long drate,
|
||||
(rate->sdiv << PLL35XX_SDIV_SHIFT);
|
||||
writel_relaxed(tmp, pll->con_reg);
|
||||
|
||||
/* wait_lock_time */
|
||||
/* wait_lock_time if enabled */
|
||||
if (tmp & BIT(PLL35XX_ENABLE_SHIFT)) {
|
||||
do {
|
||||
cpu_relax();
|
||||
tmp = readl_relaxed(pll->con_reg);
|
||||
} while (!(tmp & (PLL35XX_LOCK_STAT_MASK
|
||||
<< PLL35XX_LOCK_STAT_SHIFT)));
|
||||
} while (!(tmp & BIT(PLL35XX_LOCK_STAT_SHIFT)));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -223,6 +252,8 @@ static const struct clk_ops samsung_pll35xx_clk_ops = {
|
||||
.recalc_rate = samsung_pll35xx_recalc_rate,
|
||||
.round_rate = samsung_pll_round_rate,
|
||||
.set_rate = samsung_pll35xx_set_rate,
|
||||
.enable = samsung_pll35xx_enable,
|
||||
.disable = samsung_pll35xx_disable,
|
||||
};
|
||||
|
||||
static const struct clk_ops samsung_pll35xx_clk_min_ops = {
|
||||
|
@ -76,7 +76,7 @@ static struct syscore_ops s3c2410_clk_syscore_ops = {
|
||||
.resume = s3c2410_clk_resume,
|
||||
};
|
||||
|
||||
static void s3c2410_clk_sleep_init(void)
|
||||
static void __init s3c2410_clk_sleep_init(void)
|
||||
{
|
||||
s3c2410_save = samsung_clk_alloc_reg_dump(s3c2410_clk_regs,
|
||||
ARRAY_SIZE(s3c2410_clk_regs));
|
||||
@ -90,7 +90,7 @@ static void s3c2410_clk_sleep_init(void)
|
||||
return;
|
||||
}
|
||||
#else
|
||||
static void s3c2410_clk_sleep_init(void) {}
|
||||
static void __init s3c2410_clk_sleep_init(void) {}
|
||||
#endif
|
||||
|
||||
PNAME(fclk_p) = { "mpll", "div_slow" };
|
||||
|
@ -69,7 +69,7 @@ static struct syscore_ops s3c2412_clk_syscore_ops = {
|
||||
.resume = s3c2412_clk_resume,
|
||||
};
|
||||
|
||||
static void s3c2412_clk_sleep_init(void)
|
||||
static void __init s3c2412_clk_sleep_init(void)
|
||||
{
|
||||
s3c2412_save = samsung_clk_alloc_reg_dump(s3c2412_clk_regs,
|
||||
ARRAY_SIZE(s3c2412_clk_regs));
|
||||
@ -83,7 +83,7 @@ static void s3c2412_clk_sleep_init(void)
|
||||
return;
|
||||
}
|
||||
#else
|
||||
static void s3c2412_clk_sleep_init(void) {}
|
||||
static void __init s3c2412_clk_sleep_init(void) {}
|
||||
#endif
|
||||
|
||||
static struct clk_div_table divxti_d[] = {
|
||||
|
@ -89,7 +89,7 @@ static struct syscore_ops s3c2443_clk_syscore_ops = {
|
||||
.resume = s3c2443_clk_resume,
|
||||
};
|
||||
|
||||
static void s3c2443_clk_sleep_init(void)
|
||||
static void __init s3c2443_clk_sleep_init(void)
|
||||
{
|
||||
s3c2443_save = samsung_clk_alloc_reg_dump(s3c2443_clk_regs,
|
||||
ARRAY_SIZE(s3c2443_clk_regs));
|
||||
@ -103,7 +103,7 @@ static void s3c2443_clk_sleep_init(void)
|
||||
return;
|
||||
}
|
||||
#else
|
||||
static void s3c2443_clk_sleep_init(void) {}
|
||||
static void __init s3c2443_clk_sleep_init(void) {}
|
||||
#endif
|
||||
|
||||
PNAME(epllref_p) = { "mpllref", "mpllref", "xti", "ext" };
|
||||
|
@ -121,7 +121,7 @@ static struct syscore_ops s3c64xx_clk_syscore_ops = {
|
||||
.resume = s3c64xx_clk_resume,
|
||||
};
|
||||
|
||||
static void s3c64xx_clk_sleep_init(void)
|
||||
static void __init s3c64xx_clk_sleep_init(void)
|
||||
{
|
||||
s3c64xx_save_common = samsung_clk_alloc_reg_dump(s3c64xx_clk_regs,
|
||||
ARRAY_SIZE(s3c64xx_clk_regs));
|
||||
@ -145,7 +145,7 @@ err_warn:
|
||||
__func__);
|
||||
}
|
||||
#else
|
||||
static void s3c64xx_clk_sleep_init(void) {}
|
||||
static void __init s3c64xx_clk_sleep_init(void) {}
|
||||
#endif
|
||||
|
||||
/* List of parent clocks common for all S3C64xx SoCs. */
|
||||
|
@ -64,6 +64,17 @@ config SUN50I_A64_CCU
|
||||
select SUNXI_CCU_PHASE
|
||||
default ARM64 && ARCH_SUNXI
|
||||
|
||||
config SUN5I_CCU
|
||||
bool "Support for the Allwinner sun5i family CCM"
|
||||
select SUNXI_CCU_DIV
|
||||
select SUNXI_CCU_MULT
|
||||
select SUNXI_CCU_NK
|
||||
select SUNXI_CCU_NKM
|
||||
select SUNXI_CCU_NM
|
||||
select SUNXI_CCU_MP
|
||||
select SUNXI_CCU_PHASE
|
||||
default MACH_SUN5I
|
||||
|
||||
config SUN6I_A31_CCU
|
||||
bool "Support for the Allwinner A31/A31s CCU"
|
||||
select SUNXI_CCU_DIV
|
||||
@ -109,4 +120,25 @@ config SUN8I_H3_CCU
|
||||
select SUNXI_CCU_PHASE
|
||||
default MACH_SUN8I
|
||||
|
||||
config SUN8I_V3S_CCU
|
||||
bool "Support for the Allwinner V3s CCU"
|
||||
select SUNXI_CCU_DIV
|
||||
select SUNXI_CCU_NK
|
||||
select SUNXI_CCU_NKM
|
||||
select SUNXI_CCU_NKMP
|
||||
select SUNXI_CCU_NM
|
||||
select SUNXI_CCU_MP
|
||||
select SUNXI_CCU_PHASE
|
||||
default MACH_SUN8I
|
||||
|
||||
config SUN9I_A80_CCU
|
||||
bool "Support for the Allwinner A80 CCU"
|
||||
select SUNXI_CCU_DIV
|
||||
select SUNXI_CCU_GATE
|
||||
select SUNXI_CCU_NKMP
|
||||
select SUNXI_CCU_NM
|
||||
select SUNXI_CCU_MP
|
||||
select SUNXI_CCU_PHASE
|
||||
default MACH_SUN9I
|
||||
|
||||
endif
|
||||
|
@ -19,7 +19,12 @@ obj-$(CONFIG_SUNXI_CCU_MP) += ccu_mp.o
|
||||
|
||||
# SoC support
|
||||
obj-$(CONFIG_SUN50I_A64_CCU) += ccu-sun50i-a64.o
|
||||
obj-$(CONFIG_SUN5I_CCU) += ccu-sun5i.o
|
||||
obj-$(CONFIG_SUN6I_A31_CCU) += ccu-sun6i-a31.o
|
||||
obj-$(CONFIG_SUN8I_A23_CCU) += ccu-sun8i-a23.o
|
||||
obj-$(CONFIG_SUN8I_A33_CCU) += ccu-sun8i-a33.o
|
||||
obj-$(CONFIG_SUN8I_H3_CCU) += ccu-sun8i-h3.o
|
||||
obj-$(CONFIG_SUN8I_V3S_CCU) += ccu-sun8i-v3s.o
|
||||
obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80.o
|
||||
obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-de.o
|
||||
obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-usb.o
|
||||
|
1022
drivers/clk/sunxi-ng/ccu-sun5i.c
Normal file
1022
drivers/clk/sunxi-ng/ccu-sun5i.c
Normal file
File diff suppressed because it is too large
Load Diff
67
drivers/clk/sunxi-ng/ccu-sun5i.h
Normal file
67
drivers/clk/sunxi-ng/ccu-sun5i.h
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright 2016 Maxime Ripard
|
||||
*
|
||||
* Maxime Ripard <maxime.ripard@free-electrons.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 _CCU_SUN5I_H_
|
||||
#define _CCU_SUN5I_H_
|
||||
|
||||
#include <dt-bindings/clock/sun5i-ccu.h>
|
||||
#include <dt-bindings/reset/sun5i-ccu.h>
|
||||
|
||||
/* The HOSC is exported */
|
||||
#define CLK_PLL_CORE 2
|
||||
#define CLK_PLL_AUDIO_BASE 3
|
||||
#define CLK_PLL_AUDIO 4
|
||||
#define CLK_PLL_AUDIO_2X 5
|
||||
#define CLK_PLL_AUDIO_4X 6
|
||||
#define CLK_PLL_AUDIO_8X 7
|
||||
#define CLK_PLL_VIDEO0 8
|
||||
#define CLK_PLL_VIDEO0_2X 9
|
||||
#define CLK_PLL_VE 10
|
||||
#define CLK_PLL_DDR_BASE 11
|
||||
#define CLK_PLL_DDR 12
|
||||
#define CLK_PLL_DDR_OTHER 13
|
||||
#define CLK_PLL_PERIPH 14
|
||||
#define CLK_PLL_VIDEO1 15
|
||||
#define CLK_PLL_VIDEO1_2X 16
|
||||
|
||||
/* The CPU clock is exported */
|
||||
|
||||
#define CLK_AXI 18
|
||||
#define CLK_AHB 19
|
||||
#define CLK_APB0 20
|
||||
#define CLK_APB1 21
|
||||
#define CLK_DRAM_AXI 22
|
||||
|
||||
/* AHB gates are exported */
|
||||
/* APB0 gates are exported */
|
||||
/* APB1 gates are exported */
|
||||
/* Modules clocks are exported */
|
||||
/* USB clocks are exported */
|
||||
/* GPS clock is exported */
|
||||
/* DRAM gates are exported */
|
||||
/* More display modules clocks are exported */
|
||||
|
||||
#define CLK_TCON_CH1_SCLK 91
|
||||
|
||||
/* The rest of the module clocks are exported */
|
||||
|
||||
#define CLK_MBUS 99
|
||||
|
||||
/* And finally the IEP clock */
|
||||
|
||||
#define CLK_NUMBER (CLK_IEP + 1)
|
||||
|
||||
#endif /* _CCU_SUN5I_H_ */
|
@ -468,8 +468,8 @@ static SUNXI_CCU_MUX_WITH_GATE(daudio0_clk, "daudio0", daudio_parents,
|
||||
static SUNXI_CCU_MUX_WITH_GATE(daudio1_clk, "daudio1", daudio_parents,
|
||||
0x0b4, 16, 2, BIT(31), CLK_SET_RATE_PARENT);
|
||||
|
||||
static SUNXI_CCU_M_WITH_GATE(spdif_clk, "spdif", "pll-audio",
|
||||
0x0c0, 0, 4, BIT(31), CLK_SET_RATE_PARENT);
|
||||
static SUNXI_CCU_MUX_WITH_GATE(spdif_clk, "spdif", daudio_parents,
|
||||
0x0c0, 16, 2, BIT(31), CLK_SET_RATE_PARENT);
|
||||
|
||||
static SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "osc24M",
|
||||
0x0cc, BIT(8), 0);
|
||||
|
@ -170,7 +170,7 @@ static SUNXI_CCU_N_WITH_GATE_LOCK(pll_ddr1_clk, "pll-ddr1",
|
||||
static const char * const cpux_parents[] = { "osc32k", "osc24M",
|
||||
"pll-cpux" , "pll-cpux" };
|
||||
static SUNXI_CCU_MUX(cpux_clk, "cpux", cpux_parents,
|
||||
0x050, 16, 2, CLK_IS_CRITICAL);
|
||||
0x050, 16, 2, CLK_IS_CRITICAL | CLK_SET_RATE_PARENT);
|
||||
|
||||
static SUNXI_CCU_M(axi_clk, "axi", "cpux", 0x050, 0, 2, 0);
|
||||
|
||||
@ -440,7 +440,7 @@ static SUNXI_CCU_M_WITH_GATE(ve_clk, "ve", "pll-ve",
|
||||
0x13c, 16, 3, BIT(31), CLK_SET_RATE_PARENT);
|
||||
|
||||
static SUNXI_CCU_GATE(ac_dig_clk, "ac-dig", "pll-audio",
|
||||
0x140, BIT(31), 0);
|
||||
0x140, BIT(31), CLK_SET_RATE_PARENT);
|
||||
static SUNXI_CCU_GATE(ac_dig_4x_clk, "ac-dig-4x", "pll-audio-4x",
|
||||
0x140, BIT(30), 0);
|
||||
static SUNXI_CCU_GATE(avs_clk, "avs", "osc24M",
|
||||
@ -468,7 +468,7 @@ static SUNXI_CCU_M_WITH_MUX_TABLE_GATE(drc_clk, "drc",
|
||||
0x180, 0, 4, 24, 3, BIT(31), 0);
|
||||
|
||||
static SUNXI_CCU_M_WITH_GATE(gpu_clk, "gpu", "pll-gpu",
|
||||
0x1a0, 0, 3, BIT(31), 0);
|
||||
0x1a0, 0, 3, BIT(31), CLK_SET_RATE_PARENT);
|
||||
|
||||
static const char * const ats_parents[] = { "osc24M", "pll-periph" };
|
||||
static SUNXI_CCU_M_WITH_MUX_GATE(ats_clk, "ats", ats_parents,
|
||||
@ -752,6 +752,13 @@ static const struct sunxi_ccu_desc sun8i_a33_ccu_desc = {
|
||||
.num_resets = ARRAY_SIZE(sun8i_a33_ccu_resets),
|
||||
};
|
||||
|
||||
static struct ccu_mux_nb sun8i_a33_cpu_nb = {
|
||||
.common = &cpux_clk.common,
|
||||
.cm = &cpux_clk.mux,
|
||||
.delay_us = 1, /* > 8 clock cycles at 24 MHz */
|
||||
.bypass_index = 1, /* index of 24 MHz oscillator */
|
||||
};
|
||||
|
||||
static void __init sun8i_a33_ccu_setup(struct device_node *node)
|
||||
{
|
||||
void __iomem *reg;
|
||||
@ -775,6 +782,9 @@ static void __init sun8i_a33_ccu_setup(struct device_node *node)
|
||||
writel(val, reg + SUN8I_A33_PLL_MIPI_REG);
|
||||
|
||||
sunxi_ccu_probe(node, reg, &sun8i_a33_ccu_desc);
|
||||
|
||||
ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk,
|
||||
&sun8i_a33_cpu_nb);
|
||||
}
|
||||
CLK_OF_DECLARE(sun8i_a33_ccu, "allwinner,sun8i-a33-ccu",
|
||||
sun8i_a33_ccu_setup);
|
||||
|
@ -803,6 +803,13 @@ static const struct sunxi_ccu_desc sun8i_h3_ccu_desc = {
|
||||
.num_resets = ARRAY_SIZE(sun8i_h3_ccu_resets),
|
||||
};
|
||||
|
||||
static struct ccu_mux_nb sun8i_h3_cpu_nb = {
|
||||
.common = &cpux_clk.common,
|
||||
.cm = &cpux_clk.mux,
|
||||
.delay_us = 1, /* > 8 clock cycles at 24 MHz */
|
||||
.bypass_index = 1, /* index of 24 MHz oscillator */
|
||||
};
|
||||
|
||||
static void __init sun8i_h3_ccu_setup(struct device_node *node)
|
||||
{
|
||||
void __iomem *reg;
|
||||
@ -821,6 +828,9 @@ static void __init sun8i_h3_ccu_setup(struct device_node *node)
|
||||
writel(val | (3 << 16), reg + SUN8I_H3_PLL_AUDIO_REG);
|
||||
|
||||
sunxi_ccu_probe(node, reg, &sun8i_h3_ccu_desc);
|
||||
|
||||
ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk,
|
||||
&sun8i_h3_cpu_nb);
|
||||
}
|
||||
CLK_OF_DECLARE(sun8i_h3_ccu, "allwinner,sun8i-h3-ccu",
|
||||
sun8i_h3_ccu_setup);
|
||||
|
591
drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
Normal file
591
drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
Normal file
@ -0,0 +1,591 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Icenowy Zheng <icenowy@aosc.xyz>
|
||||
*
|
||||
* Based on ccu-sun8i-h3.c, which is:
|
||||
* Copyright (c) 2016 Maxime Ripard. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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_address.h>
|
||||
|
||||
#include "ccu_common.h"
|
||||
#include "ccu_reset.h"
|
||||
|
||||
#include "ccu_div.h"
|
||||
#include "ccu_gate.h"
|
||||
#include "ccu_mp.h"
|
||||
#include "ccu_mult.h"
|
||||
#include "ccu_nk.h"
|
||||
#include "ccu_nkm.h"
|
||||
#include "ccu_nkmp.h"
|
||||
#include "ccu_nm.h"
|
||||
#include "ccu_phase.h"
|
||||
|
||||
#include "ccu-sun8i-v3s.h"
|
||||
|
||||
static SUNXI_CCU_NKMP_WITH_GATE_LOCK(pll_cpu_clk, "pll-cpu",
|
||||
"osc24M", 0x000,
|
||||
8, 5, /* N */
|
||||
4, 2, /* K */
|
||||
0, 2, /* M */
|
||||
16, 2, /* P */
|
||||
BIT(31), /* gate */
|
||||
BIT(28), /* lock */
|
||||
0);
|
||||
|
||||
/*
|
||||
* The Audio PLL is supposed to have 4 outputs: 3 fixed factors from
|
||||
* the base (2x, 4x and 8x), and one variable divider (the one true
|
||||
* pll audio).
|
||||
*
|
||||
* We don't have any need for the variable divider for now, so we just
|
||||
* hardcode it to match with the clock names
|
||||
*/
|
||||
#define SUN8I_V3S_PLL_AUDIO_REG 0x008
|
||||
|
||||
static SUNXI_CCU_NM_WITH_GATE_LOCK(pll_audio_base_clk, "pll-audio-base",
|
||||
"osc24M", 0x008,
|
||||
8, 7, /* N */
|
||||
0, 5, /* M */
|
||||
BIT(31), /* gate */
|
||||
BIT(28), /* lock */
|
||||
0);
|
||||
|
||||
static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_video_clk, "pll-video",
|
||||
"osc24M", 0x0010,
|
||||
8, 7, /* N */
|
||||
0, 4, /* M */
|
||||
BIT(24), /* frac enable */
|
||||
BIT(25), /* frac select */
|
||||
270000000, /* frac rate 0 */
|
||||
297000000, /* frac rate 1 */
|
||||
BIT(31), /* gate */
|
||||
BIT(28), /* lock */
|
||||
0);
|
||||
|
||||
static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve",
|
||||
"osc24M", 0x0018,
|
||||
8, 7, /* N */
|
||||
0, 4, /* M */
|
||||
BIT(24), /* frac enable */
|
||||
BIT(25), /* frac select */
|
||||
270000000, /* frac rate 0 */
|
||||
297000000, /* frac rate 1 */
|
||||
BIT(31), /* gate */
|
||||
BIT(28), /* lock */
|
||||
0);
|
||||
|
||||
static SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_ddr_clk, "pll-ddr",
|
||||
"osc24M", 0x020,
|
||||
8, 5, /* N */
|
||||
4, 2, /* K */
|
||||
0, 2, /* M */
|
||||
BIT(31), /* gate */
|
||||
BIT(28), /* lock */
|
||||
0);
|
||||
|
||||
static SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(pll_periph0_clk, "pll-periph0",
|
||||
"osc24M", 0x028,
|
||||
8, 5, /* N */
|
||||
4, 2, /* K */
|
||||
BIT(31), /* gate */
|
||||
BIT(28), /* lock */
|
||||
2, /* post-div */
|
||||
0);
|
||||
|
||||
static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_isp_clk, "pll-isp",
|
||||
"osc24M", 0x002c,
|
||||
8, 7, /* N */
|
||||
0, 4, /* M */
|
||||
BIT(24), /* frac enable */
|
||||
BIT(25), /* frac select */
|
||||
270000000, /* frac rate 0 */
|
||||
297000000, /* frac rate 1 */
|
||||
BIT(31), /* gate */
|
||||
BIT(28), /* lock */
|
||||
0);
|
||||
|
||||
static SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(pll_periph1_clk, "pll-periph1",
|
||||
"osc24M", 0x044,
|
||||
8, 5, /* N */
|
||||
4, 2, /* K */
|
||||
BIT(31), /* gate */
|
||||
BIT(28), /* lock */
|
||||
2, /* post-div */
|
||||
0);
|
||||
|
||||
static const char * const cpu_parents[] = { "osc32k", "osc24M",
|
||||
"pll-cpu", "pll-cpu" };
|
||||
static SUNXI_CCU_MUX(cpu_clk, "cpu", cpu_parents,
|
||||
0x050, 16, 2, CLK_IS_CRITICAL);
|
||||
|
||||
static SUNXI_CCU_M(axi_clk, "axi", "cpu", 0x050, 0, 2, 0);
|
||||
|
||||
static const char * const ahb1_parents[] = { "osc32k", "osc24M",
|
||||
"axi", "pll-periph0" };
|
||||
static struct ccu_div ahb1_clk = {
|
||||
.div = _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO),
|
||||
|
||||
.mux = {
|
||||
.shift = 12,
|
||||
.width = 2,
|
||||
|
||||
.variable_prediv = {
|
||||
.index = 3,
|
||||
.shift = 6,
|
||||
.width = 2,
|
||||
},
|
||||
},
|
||||
|
||||
.common = {
|
||||
.reg = 0x054,
|
||||
.features = CCU_FEATURE_VARIABLE_PREDIV,
|
||||
.hw.init = CLK_HW_INIT_PARENTS("ahb1",
|
||||
ahb1_parents,
|
||||
&ccu_div_ops,
|
||||
0),
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_div_table apb1_div_table[] = {
|
||||
{ .val = 0, .div = 2 },
|
||||
{ .val = 1, .div = 2 },
|
||||
{ .val = 2, .div = 4 },
|
||||
{ .val = 3, .div = 8 },
|
||||
{ /* Sentinel */ },
|
||||
};
|
||||
static SUNXI_CCU_DIV_TABLE(apb1_clk, "apb1", "ahb1",
|
||||
0x054, 8, 2, apb1_div_table, 0);
|
||||
|
||||
static const char * const apb2_parents[] = { "osc32k", "osc24M",
|
||||
"pll-periph0", "pll-periph0" };
|
||||
static SUNXI_CCU_MP_WITH_MUX(apb2_clk, "apb2", apb2_parents, 0x058,
|
||||
0, 5, /* M */
|
||||
16, 2, /* P */
|
||||
24, 2, /* mux */
|
||||
0);
|
||||
|
||||
static const char * const ahb2_parents[] = { "ahb1", "pll-periph0" };
|
||||
static const struct ccu_mux_fixed_prediv ahb2_fixed_predivs[] = {
|
||||
{ .index = 1, .div = 2 },
|
||||
};
|
||||
static struct ccu_mux ahb2_clk = {
|
||||
.mux = {
|
||||
.shift = 0,
|
||||
.width = 1,
|
||||
.fixed_predivs = ahb2_fixed_predivs,
|
||||
.n_predivs = ARRAY_SIZE(ahb2_fixed_predivs),
|
||||
},
|
||||
|
||||
.common = {
|
||||
.reg = 0x05c,
|
||||
.features = CCU_FEATURE_FIXED_PREDIV,
|
||||
.hw.init = CLK_HW_INIT_PARENTS("ahb2",
|
||||
ahb2_parents,
|
||||
&ccu_mux_ops,
|
||||
0),
|
||||
},
|
||||
};
|
||||
|
||||
static SUNXI_CCU_GATE(bus_ce_clk, "bus-ce", "ahb1",
|
||||
0x060, BIT(5), 0);
|
||||
static SUNXI_CCU_GATE(bus_dma_clk, "bus-dma", "ahb1",
|
||||
0x060, BIT(6), 0);
|
||||
static SUNXI_CCU_GATE(bus_mmc0_clk, "bus-mmc0", "ahb1",
|
||||
0x060, BIT(8), 0);
|
||||
static SUNXI_CCU_GATE(bus_mmc1_clk, "bus-mmc1", "ahb1",
|
||||
0x060, BIT(9), 0);
|
||||
static SUNXI_CCU_GATE(bus_mmc2_clk, "bus-mmc2", "ahb1",
|
||||
0x060, BIT(10), 0);
|
||||
static SUNXI_CCU_GATE(bus_dram_clk, "bus-dram", "ahb1",
|
||||
0x060, BIT(14), 0);
|
||||
static SUNXI_CCU_GATE(bus_emac_clk, "bus-emac", "ahb2",
|
||||
0x060, BIT(17), 0);
|
||||
static SUNXI_CCU_GATE(bus_hstimer_clk, "bus-hstimer", "ahb1",
|
||||
0x060, BIT(19), 0);
|
||||
static SUNXI_CCU_GATE(bus_spi0_clk, "bus-spi0", "ahb1",
|
||||
0x060, BIT(20), 0);
|
||||
static SUNXI_CCU_GATE(bus_otg_clk, "bus-otg", "ahb1",
|
||||
0x060, BIT(24), 0);
|
||||
static SUNXI_CCU_GATE(bus_ehci0_clk, "bus-ehci0", "ahb1",
|
||||
0x060, BIT(26), 0);
|
||||
static SUNXI_CCU_GATE(bus_ohci0_clk, "bus-ohci0", "ahb1",
|
||||
0x060, BIT(29), 0);
|
||||
|
||||
static SUNXI_CCU_GATE(bus_ve_clk, "bus-ve", "ahb1",
|
||||
0x064, BIT(0), 0);
|
||||
static SUNXI_CCU_GATE(bus_tcon0_clk, "bus-tcon0", "ahb1",
|
||||
0x064, BIT(4), 0);
|
||||
static SUNXI_CCU_GATE(bus_csi_clk, "bus-csi", "ahb1",
|
||||
0x064, BIT(8), 0);
|
||||
static SUNXI_CCU_GATE(bus_de_clk, "bus-de", "ahb1",
|
||||
0x064, BIT(12), 0);
|
||||
|
||||
static SUNXI_CCU_GATE(bus_codec_clk, "bus-codec", "apb1",
|
||||
0x068, BIT(0), 0);
|
||||
static SUNXI_CCU_GATE(bus_pio_clk, "bus-pio", "apb1",
|
||||
0x068, BIT(5), 0);
|
||||
|
||||
static SUNXI_CCU_GATE(bus_i2c0_clk, "bus-i2c0", "apb2",
|
||||
0x06c, BIT(0), 0);
|
||||
static SUNXI_CCU_GATE(bus_i2c1_clk, "bus-i2c1", "apb2",
|
||||
0x06c, BIT(1), 0);
|
||||
static SUNXI_CCU_GATE(bus_uart0_clk, "bus-uart0", "apb2",
|
||||
0x06c, BIT(16), 0);
|
||||
static SUNXI_CCU_GATE(bus_uart1_clk, "bus-uart1", "apb2",
|
||||
0x06c, BIT(17), 0);
|
||||
static SUNXI_CCU_GATE(bus_uart2_clk, "bus-uart2", "apb2",
|
||||
0x06c, BIT(18), 0);
|
||||
|
||||
static SUNXI_CCU_GATE(bus_ephy_clk, "bus-ephy", "ahb1",
|
||||
0x070, BIT(0), 0);
|
||||
static SUNXI_CCU_GATE(bus_dbg_clk, "bus-dbg", "ahb1",
|
||||
0x070, BIT(7), 0);
|
||||
|
||||
static const char * const mod0_default_parents[] = { "osc24M", "pll-periph0",
|
||||
"pll-periph1" };
|
||||
static SUNXI_CCU_MP_WITH_MUX_GATE(mmc0_clk, "mmc0", mod0_default_parents, 0x088,
|
||||
0, 4, /* M */
|
||||
16, 2, /* P */
|
||||
24, 2, /* mux */
|
||||
BIT(31), /* gate */
|
||||
0);
|
||||
|
||||
static SUNXI_CCU_PHASE(mmc0_sample_clk, "mmc0_sample", "mmc0",
|
||||
0x088, 20, 3, 0);
|
||||
static SUNXI_CCU_PHASE(mmc0_output_clk, "mmc0_output", "mmc0",
|
||||
0x088, 8, 3, 0);
|
||||
|
||||
static SUNXI_CCU_MP_WITH_MUX_GATE(mmc1_clk, "mmc1", mod0_default_parents, 0x08c,
|
||||
0, 4, /* M */
|
||||
16, 2, /* P */
|
||||
24, 2, /* mux */
|
||||
BIT(31), /* gate */
|
||||
0);
|
||||
|
||||
static SUNXI_CCU_PHASE(mmc1_sample_clk, "mmc1_sample", "mmc1",
|
||||
0x08c, 20, 3, 0);
|
||||
static SUNXI_CCU_PHASE(mmc1_output_clk, "mmc1_output", "mmc1",
|
||||
0x08c, 8, 3, 0);
|
||||
|
||||
static SUNXI_CCU_MP_WITH_MUX_GATE(mmc2_clk, "mmc2", mod0_default_parents, 0x090,
|
||||
0, 4, /* M */
|
||||
16, 2, /* P */
|
||||
24, 2, /* mux */
|
||||
BIT(31), /* gate */
|
||||
0);
|
||||
|
||||
static SUNXI_CCU_PHASE(mmc2_sample_clk, "mmc2_sample", "mmc2",
|
||||
0x090, 20, 3, 0);
|
||||
static SUNXI_CCU_PHASE(mmc2_output_clk, "mmc2_output", "mmc2",
|
||||
0x090, 8, 3, 0);
|
||||
|
||||
static const char * const ce_parents[] = { "osc24M", "pll-periph0", };
|
||||
|
||||
static SUNXI_CCU_MP_WITH_MUX_GATE(ce_clk, "ce", ce_parents, 0x09c,
|
||||
0, 4, /* M */
|
||||
16, 2, /* P */
|
||||
24, 2, /* mux */
|
||||
BIT(31), /* gate */
|
||||
0);
|
||||
|
||||
static SUNXI_CCU_MP_WITH_MUX_GATE(spi0_clk, "spi0", mod0_default_parents, 0x0a0,
|
||||
0, 4, /* M */
|
||||
16, 2, /* P */
|
||||
24, 2, /* mux */
|
||||
BIT(31), /* gate */
|
||||
0);
|
||||
|
||||
static SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "osc24M",
|
||||
0x0cc, BIT(8), 0);
|
||||
static SUNXI_CCU_GATE(usb_ohci0_clk, "usb-ohci0", "osc24M",
|
||||
0x0cc, BIT(16), 0);
|
||||
|
||||
static const char * const dram_parents[] = { "pll-ddr", "pll-periph0-2x" };
|
||||
static SUNXI_CCU_M_WITH_MUX(dram_clk, "dram", dram_parents,
|
||||
0x0f4, 0, 4, 20, 2, CLK_IS_CRITICAL);
|
||||
|
||||
static SUNXI_CCU_GATE(dram_ve_clk, "dram-ve", "dram",
|
||||
0x100, BIT(0), 0);
|
||||
static SUNXI_CCU_GATE(dram_csi_clk, "dram-csi", "dram",
|
||||
0x100, BIT(1), 0);
|
||||
static SUNXI_CCU_GATE(dram_ehci_clk, "dram-ehci", "dram",
|
||||
0x100, BIT(17), 0);
|
||||
static SUNXI_CCU_GATE(dram_ohci_clk, "dram-ohci", "dram",
|
||||
0x100, BIT(18), 0);
|
||||
|
||||
static const char * const de_parents[] = { "pll-video", "pll-periph0" };
|
||||
static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents,
|
||||
0x104, 0, 4, 24, 2, BIT(31), 0);
|
||||
|
||||
static const char * const tcon_parents[] = { "pll-video" };
|
||||
static SUNXI_CCU_M_WITH_MUX_GATE(tcon_clk, "tcon", tcon_parents,
|
||||
0x118, 0, 4, 24, 3, BIT(31), 0);
|
||||
|
||||
static SUNXI_CCU_GATE(csi_misc_clk, "csi-misc", "osc24M",
|
||||
0x130, BIT(31), 0);
|
||||
|
||||
static const char * const csi_mclk_parents[] = { "osc24M", "pll-video",
|
||||
"pll-periph0", "pll-periph1" };
|
||||
static SUNXI_CCU_M_WITH_MUX_GATE(csi0_mclk_clk, "csi0-mclk", csi_mclk_parents,
|
||||
0x130, 0, 5, 8, 3, BIT(15), 0);
|
||||
|
||||
static const char * const csi1_sclk_parents[] = { "pll-video", "pll-isp" };
|
||||
static SUNXI_CCU_M_WITH_MUX_GATE(csi1_sclk_clk, "csi-sclk", csi1_sclk_parents,
|
||||
0x134, 16, 4, 24, 3, BIT(31), 0);
|
||||
|
||||
static SUNXI_CCU_M_WITH_MUX_GATE(csi1_mclk_clk, "csi-mclk", csi_mclk_parents,
|
||||
0x134, 0, 5, 8, 3, BIT(15), 0);
|
||||
|
||||
static SUNXI_CCU_M_WITH_GATE(ve_clk, "ve", "pll-ve",
|
||||
0x13c, 16, 3, BIT(31), 0);
|
||||
|
||||
static SUNXI_CCU_GATE(ac_dig_clk, "ac-dig", "pll-audio",
|
||||
0x140, BIT(31), CLK_SET_RATE_PARENT);
|
||||
static SUNXI_CCU_GATE(avs_clk, "avs", "osc24M",
|
||||
0x144, BIT(31), 0);
|
||||
|
||||
static const char * const mbus_parents[] = { "osc24M", "pll-periph0-2x",
|
||||
"pll-ddr" };
|
||||
static SUNXI_CCU_M_WITH_MUX_GATE(mbus_clk, "mbus", mbus_parents,
|
||||
0x15c, 0, 3, 24, 2, BIT(31), CLK_IS_CRITICAL);
|
||||
|
||||
static const char * const mipi_csi_parents[] = { "pll-video", "pll-periph0",
|
||||
"pll-isp" };
|
||||
static SUNXI_CCU_M_WITH_MUX_GATE(mipi_csi_clk, "mipi-csi", mipi_csi_parents,
|
||||
0x16c, 0, 3, 24, 2, BIT(31), 0);
|
||||
|
||||
static struct ccu_common *sun8i_v3s_ccu_clks[] = {
|
||||
&pll_cpu_clk.common,
|
||||
&pll_audio_base_clk.common,
|
||||
&pll_video_clk.common,
|
||||
&pll_ve_clk.common,
|
||||
&pll_ddr_clk.common,
|
||||
&pll_periph0_clk.common,
|
||||
&pll_isp_clk.common,
|
||||
&pll_periph1_clk.common,
|
||||
&cpu_clk.common,
|
||||
&axi_clk.common,
|
||||
&ahb1_clk.common,
|
||||
&apb1_clk.common,
|
||||
&apb2_clk.common,
|
||||
&ahb2_clk.common,
|
||||
&bus_ce_clk.common,
|
||||
&bus_dma_clk.common,
|
||||
&bus_mmc0_clk.common,
|
||||
&bus_mmc1_clk.common,
|
||||
&bus_mmc2_clk.common,
|
||||
&bus_dram_clk.common,
|
||||
&bus_emac_clk.common,
|
||||
&bus_hstimer_clk.common,
|
||||
&bus_spi0_clk.common,
|
||||
&bus_otg_clk.common,
|
||||
&bus_ehci0_clk.common,
|
||||
&bus_ohci0_clk.common,
|
||||
&bus_ve_clk.common,
|
||||
&bus_tcon0_clk.common,
|
||||
&bus_csi_clk.common,
|
||||
&bus_de_clk.common,
|
||||
&bus_codec_clk.common,
|
||||
&bus_pio_clk.common,
|
||||
&bus_i2c0_clk.common,
|
||||
&bus_i2c1_clk.common,
|
||||
&bus_uart0_clk.common,
|
||||
&bus_uart1_clk.common,
|
||||
&bus_uart2_clk.common,
|
||||
&bus_ephy_clk.common,
|
||||
&bus_dbg_clk.common,
|
||||
&mmc0_clk.common,
|
||||
&mmc0_sample_clk.common,
|
||||
&mmc0_output_clk.common,
|
||||
&mmc1_clk.common,
|
||||
&mmc1_sample_clk.common,
|
||||
&mmc1_output_clk.common,
|
||||
&mmc2_clk.common,
|
||||
&mmc2_sample_clk.common,
|
||||
&mmc2_output_clk.common,
|
||||
&ce_clk.common,
|
||||
&spi0_clk.common,
|
||||
&usb_phy0_clk.common,
|
||||
&usb_ohci0_clk.common,
|
||||
&dram_clk.common,
|
||||
&dram_ve_clk.common,
|
||||
&dram_csi_clk.common,
|
||||
&dram_ohci_clk.common,
|
||||
&dram_ehci_clk.common,
|
||||
&de_clk.common,
|
||||
&tcon_clk.common,
|
||||
&csi_misc_clk.common,
|
||||
&csi0_mclk_clk.common,
|
||||
&csi1_sclk_clk.common,
|
||||
&csi1_mclk_clk.common,
|
||||
&ve_clk.common,
|
||||
&ac_dig_clk.common,
|
||||
&avs_clk.common,
|
||||
&mbus_clk.common,
|
||||
&mipi_csi_clk.common,
|
||||
};
|
||||
|
||||
/* We hardcode the divider to 4 for now */
|
||||
static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio",
|
||||
"pll-audio-base", 4, 1, CLK_SET_RATE_PARENT);
|
||||
static CLK_FIXED_FACTOR(pll_audio_2x_clk, "pll-audio-2x",
|
||||
"pll-audio-base", 2, 1, CLK_SET_RATE_PARENT);
|
||||
static CLK_FIXED_FACTOR(pll_audio_4x_clk, "pll-audio-4x",
|
||||
"pll-audio-base", 1, 1, CLK_SET_RATE_PARENT);
|
||||
static CLK_FIXED_FACTOR(pll_audio_8x_clk, "pll-audio-8x",
|
||||
"pll-audio-base", 1, 2, CLK_SET_RATE_PARENT);
|
||||
static CLK_FIXED_FACTOR(pll_periph0_2x_clk, "pll-periph0-2x",
|
||||
"pll-periph0", 1, 2, 0);
|
||||
|
||||
static struct clk_hw_onecell_data sun8i_v3s_hw_clks = {
|
||||
.hws = {
|
||||
[CLK_PLL_CPU] = &pll_cpu_clk.common.hw,
|
||||
[CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw,
|
||||
[CLK_PLL_AUDIO] = &pll_audio_clk.hw,
|
||||
[CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw,
|
||||
[CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw,
|
||||
[CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw,
|
||||
[CLK_PLL_VIDEO] = &pll_video_clk.common.hw,
|
||||
[CLK_PLL_VE] = &pll_ve_clk.common.hw,
|
||||
[CLK_PLL_DDR] = &pll_ddr_clk.common.hw,
|
||||
[CLK_PLL_PERIPH0] = &pll_periph0_clk.common.hw,
|
||||
[CLK_PLL_PERIPH0_2X] = &pll_periph0_2x_clk.hw,
|
||||
[CLK_PLL_ISP] = &pll_isp_clk.common.hw,
|
||||
[CLK_PLL_PERIPH1] = &pll_periph1_clk.common.hw,
|
||||
[CLK_CPU] = &cpu_clk.common.hw,
|
||||
[CLK_AXI] = &axi_clk.common.hw,
|
||||
[CLK_AHB1] = &ahb1_clk.common.hw,
|
||||
[CLK_APB1] = &apb1_clk.common.hw,
|
||||
[CLK_APB2] = &apb2_clk.common.hw,
|
||||
[CLK_AHB2] = &ahb2_clk.common.hw,
|
||||
[CLK_BUS_CE] = &bus_ce_clk.common.hw,
|
||||
[CLK_BUS_DMA] = &bus_dma_clk.common.hw,
|
||||
[CLK_BUS_MMC0] = &bus_mmc0_clk.common.hw,
|
||||
[CLK_BUS_MMC1] = &bus_mmc1_clk.common.hw,
|
||||
[CLK_BUS_MMC2] = &bus_mmc2_clk.common.hw,
|
||||
[CLK_BUS_DRAM] = &bus_dram_clk.common.hw,
|
||||
[CLK_BUS_EMAC] = &bus_emac_clk.common.hw,
|
||||
[CLK_BUS_HSTIMER] = &bus_hstimer_clk.common.hw,
|
||||
[CLK_BUS_SPI0] = &bus_spi0_clk.common.hw,
|
||||
[CLK_BUS_OTG] = &bus_otg_clk.common.hw,
|
||||
[CLK_BUS_EHCI0] = &bus_ehci0_clk.common.hw,
|
||||
[CLK_BUS_OHCI0] = &bus_ohci0_clk.common.hw,
|
||||
[CLK_BUS_VE] = &bus_ve_clk.common.hw,
|
||||
[CLK_BUS_TCON0] = &bus_tcon0_clk.common.hw,
|
||||
[CLK_BUS_CSI] = &bus_csi_clk.common.hw,
|
||||
[CLK_BUS_DE] = &bus_de_clk.common.hw,
|
||||
[CLK_BUS_CODEC] = &bus_codec_clk.common.hw,
|
||||
[CLK_BUS_PIO] = &bus_pio_clk.common.hw,
|
||||
[CLK_BUS_I2C0] = &bus_i2c0_clk.common.hw,
|
||||
[CLK_BUS_I2C1] = &bus_i2c1_clk.common.hw,
|
||||
[CLK_BUS_UART0] = &bus_uart0_clk.common.hw,
|
||||
[CLK_BUS_UART1] = &bus_uart1_clk.common.hw,
|
||||
[CLK_BUS_UART2] = &bus_uart2_clk.common.hw,
|
||||
[CLK_BUS_EPHY] = &bus_ephy_clk.common.hw,
|
||||
[CLK_BUS_DBG] = &bus_dbg_clk.common.hw,
|
||||
[CLK_MMC0] = &mmc0_clk.common.hw,
|
||||
[CLK_MMC0_SAMPLE] = &mmc0_sample_clk.common.hw,
|
||||
[CLK_MMC0_OUTPUT] = &mmc0_output_clk.common.hw,
|
||||
[CLK_MMC1] = &mmc1_clk.common.hw,
|
||||
[CLK_MMC1_SAMPLE] = &mmc1_sample_clk.common.hw,
|
||||
[CLK_MMC1_OUTPUT] = &mmc1_output_clk.common.hw,
|
||||
[CLK_CE] = &ce_clk.common.hw,
|
||||
[CLK_SPI0] = &spi0_clk.common.hw,
|
||||
[CLK_USB_PHY0] = &usb_phy0_clk.common.hw,
|
||||
[CLK_USB_OHCI0] = &usb_ohci0_clk.common.hw,
|
||||
[CLK_DRAM] = &dram_clk.common.hw,
|
||||
[CLK_DRAM_VE] = &dram_ve_clk.common.hw,
|
||||
[CLK_DRAM_CSI] = &dram_csi_clk.common.hw,
|
||||
[CLK_DRAM_EHCI] = &dram_ehci_clk.common.hw,
|
||||
[CLK_DRAM_OHCI] = &dram_ohci_clk.common.hw,
|
||||
[CLK_DE] = &de_clk.common.hw,
|
||||
[CLK_TCON0] = &tcon_clk.common.hw,
|
||||
[CLK_CSI_MISC] = &csi_misc_clk.common.hw,
|
||||
[CLK_CSI0_MCLK] = &csi0_mclk_clk.common.hw,
|
||||
[CLK_CSI1_SCLK] = &csi1_sclk_clk.common.hw,
|
||||
[CLK_CSI1_MCLK] = &csi1_mclk_clk.common.hw,
|
||||
[CLK_VE] = &ve_clk.common.hw,
|
||||
[CLK_AC_DIG] = &ac_dig_clk.common.hw,
|
||||
[CLK_AVS] = &avs_clk.common.hw,
|
||||
[CLK_MBUS] = &mbus_clk.common.hw,
|
||||
[CLK_MIPI_CSI] = &mipi_csi_clk.common.hw,
|
||||
},
|
||||
.num = CLK_NUMBER,
|
||||
};
|
||||
|
||||
static struct ccu_reset_map sun8i_v3s_ccu_resets[] = {
|
||||
[RST_USB_PHY0] = { 0x0cc, BIT(0) },
|
||||
|
||||
[RST_MBUS] = { 0x0fc, BIT(31) },
|
||||
|
||||
[RST_BUS_CE] = { 0x2c0, BIT(5) },
|
||||
[RST_BUS_DMA] = { 0x2c0, BIT(6) },
|
||||
[RST_BUS_MMC0] = { 0x2c0, BIT(8) },
|
||||
[RST_BUS_MMC1] = { 0x2c0, BIT(9) },
|
||||
[RST_BUS_MMC2] = { 0x2c0, BIT(10) },
|
||||
[RST_BUS_DRAM] = { 0x2c0, BIT(14) },
|
||||
[RST_BUS_EMAC] = { 0x2c0, BIT(17) },
|
||||
[RST_BUS_HSTIMER] = { 0x2c0, BIT(19) },
|
||||
[RST_BUS_SPI0] = { 0x2c0, BIT(20) },
|
||||
[RST_BUS_OTG] = { 0x2c0, BIT(23) },
|
||||
[RST_BUS_EHCI0] = { 0x2c0, BIT(26) },
|
||||
[RST_BUS_OHCI0] = { 0x2c0, BIT(29) },
|
||||
|
||||
[RST_BUS_VE] = { 0x2c4, BIT(0) },
|
||||
[RST_BUS_TCON0] = { 0x2c4, BIT(3) },
|
||||
[RST_BUS_CSI] = { 0x2c4, BIT(8) },
|
||||
[RST_BUS_DE] = { 0x2c4, BIT(12) },
|
||||
[RST_BUS_DBG] = { 0x2c4, BIT(31) },
|
||||
|
||||
[RST_BUS_EPHY] = { 0x2c8, BIT(2) },
|
||||
|
||||
[RST_BUS_CODEC] = { 0x2d0, BIT(0) },
|
||||
|
||||
[RST_BUS_I2C0] = { 0x2d8, BIT(0) },
|
||||
[RST_BUS_I2C1] = { 0x2d8, BIT(1) },
|
||||
[RST_BUS_UART0] = { 0x2d8, BIT(16) },
|
||||
[RST_BUS_UART1] = { 0x2d8, BIT(17) },
|
||||
[RST_BUS_UART2] = { 0x2d8, BIT(18) },
|
||||
};
|
||||
|
||||
static const struct sunxi_ccu_desc sun8i_v3s_ccu_desc = {
|
||||
.ccu_clks = sun8i_v3s_ccu_clks,
|
||||
.num_ccu_clks = ARRAY_SIZE(sun8i_v3s_ccu_clks),
|
||||
|
||||
.hw_clks = &sun8i_v3s_hw_clks,
|
||||
|
||||
.resets = sun8i_v3s_ccu_resets,
|
||||
.num_resets = ARRAY_SIZE(sun8i_v3s_ccu_resets),
|
||||
};
|
||||
|
||||
static void __init sun8i_v3s_ccu_setup(struct device_node *node)
|
||||
{
|
||||
void __iomem *reg;
|
||||
u32 val;
|
||||
|
||||
reg = of_io_request_and_map(node, 0, of_node_full_name(node));
|
||||
if (IS_ERR(reg)) {
|
||||
pr_err("%s: Could not map the clock registers\n",
|
||||
of_node_full_name(node));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Force the PLL-Audio-1x divider to 4 */
|
||||
val = readl(reg + SUN8I_V3S_PLL_AUDIO_REG);
|
||||
val &= ~GENMASK(19, 16);
|
||||
writel(val | (3 << 16), reg + SUN8I_V3S_PLL_AUDIO_REG);
|
||||
|
||||
sunxi_ccu_probe(node, reg, &sun8i_v3s_ccu_desc);
|
||||
}
|
||||
CLK_OF_DECLARE(sun8i_v3s_ccu, "allwinner,sun8i-v3s-ccu",
|
||||
sun8i_v3s_ccu_setup);
|
63
drivers/clk/sunxi-ng/ccu-sun8i-v3s.h
Normal file
63
drivers/clk/sunxi-ng/ccu-sun8i-v3s.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Icenowy Zheng <icenowy@aosc.xyz>
|
||||
*
|
||||
* Based on ccu-sun8i-h3.h, which is:
|
||||
* Copyright (c) 2016 Maxime Ripard <maxime.ripard@free-electrons.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 _CCU_SUN8I_H3_H_
|
||||
#define _CCU_SUN8I_H3_H_
|
||||
|
||||
#include <dt-bindings/clock/sun8i-v3s-ccu.h>
|
||||
#include <dt-bindings/reset/sun8i-v3s-ccu.h>
|
||||
|
||||
#define CLK_PLL_CPU 0
|
||||
#define CLK_PLL_AUDIO_BASE 1
|
||||
#define CLK_PLL_AUDIO 2
|
||||
#define CLK_PLL_AUDIO_2X 3
|
||||
#define CLK_PLL_AUDIO_4X 4
|
||||
#define CLK_PLL_AUDIO_8X 5
|
||||
#define CLK_PLL_VIDEO 6
|
||||
#define CLK_PLL_VE 7
|
||||
#define CLK_PLL_DDR 8
|
||||
#define CLK_PLL_PERIPH0 9
|
||||
#define CLK_PLL_PERIPH0_2X 10
|
||||
#define CLK_PLL_ISP 11
|
||||
#define CLK_PLL_PERIPH1 12
|
||||
/* Reserve one number for not implemented and not used PLL_DDR1 */
|
||||
|
||||
/* The CPU clock is exported */
|
||||
|
||||
#define CLK_AXI 15
|
||||
#define CLK_AHB1 16
|
||||
#define CLK_APB1 17
|
||||
#define CLK_APB2 18
|
||||
#define CLK_AHB2 19
|
||||
|
||||
/* All the bus gates are exported */
|
||||
|
||||
/* The first bunch of module clocks are exported */
|
||||
|
||||
#define CLK_DRAM 58
|
||||
|
||||
/* All the DRAM gates are exported */
|
||||
|
||||
/* Some more module clocks are exported */
|
||||
|
||||
#define CLK_MBUS 72
|
||||
|
||||
/* And the GPU module clock is exported */
|
||||
|
||||
#define CLK_NUMBER (CLK_MIPI_CSI + 1)
|
||||
|
||||
#endif /* _CCU_SUN8I_H3_H_ */
|
283
drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c
Normal file
283
drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c
Normal file
@ -0,0 +1,283 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Chen-Yu Tsai. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/reset.h>
|
||||
|
||||
#include "ccu_common.h"
|
||||
#include "ccu_div.h"
|
||||
#include "ccu_gate.h"
|
||||
#include "ccu_reset.h"
|
||||
|
||||
#include "ccu-sun9i-a80-de.h"
|
||||
|
||||
static SUNXI_CCU_GATE(fe0_clk, "fe0", "fe0-div",
|
||||
0x00, BIT(0), 0);
|
||||
static SUNXI_CCU_GATE(fe1_clk, "fe1", "fe1-div",
|
||||
0x00, BIT(1), 0);
|
||||
static SUNXI_CCU_GATE(fe2_clk, "fe2", "fe2-div",
|
||||
0x00, BIT(2), 0);
|
||||
static SUNXI_CCU_GATE(iep_deu0_clk, "iep-deu0", "de",
|
||||
0x00, BIT(4), 0);
|
||||
static SUNXI_CCU_GATE(iep_deu1_clk, "iep-deu1", "de",
|
||||
0x00, BIT(5), 0);
|
||||
static SUNXI_CCU_GATE(be0_clk, "be0", "be0-div",
|
||||
0x00, BIT(8), 0);
|
||||
static SUNXI_CCU_GATE(be1_clk, "be1", "be1-div",
|
||||
0x00, BIT(9), 0);
|
||||
static SUNXI_CCU_GATE(be2_clk, "be2", "be2-div",
|
||||
0x00, BIT(10), 0);
|
||||
static SUNXI_CCU_GATE(iep_drc0_clk, "iep-drc0", "de",
|
||||
0x00, BIT(12), 0);
|
||||
static SUNXI_CCU_GATE(iep_drc1_clk, "iep-drc1", "de",
|
||||
0x00, BIT(13), 0);
|
||||
static SUNXI_CCU_GATE(merge_clk, "merge", "de",
|
||||
0x00, BIT(20), 0);
|
||||
|
||||
static SUNXI_CCU_GATE(dram_fe0_clk, "dram-fe0", "sdram",
|
||||
0x04, BIT(0), 0);
|
||||
static SUNXI_CCU_GATE(dram_fe1_clk, "dram-fe1", "sdram",
|
||||
0x04, BIT(1), 0);
|
||||
static SUNXI_CCU_GATE(dram_fe2_clk, "dram-fe2", "sdram",
|
||||
0x04, BIT(2), 0);
|
||||
static SUNXI_CCU_GATE(dram_deu0_clk, "dram-deu0", "sdram",
|
||||
0x04, BIT(4), 0);
|
||||
static SUNXI_CCU_GATE(dram_deu1_clk, "dram-deu1", "sdram",
|
||||
0x04, BIT(5), 0);
|
||||
static SUNXI_CCU_GATE(dram_be0_clk, "dram-be0", "sdram",
|
||||
0x04, BIT(8), 0);
|
||||
static SUNXI_CCU_GATE(dram_be1_clk, "dram-be1", "sdram",
|
||||
0x04, BIT(9), 0);
|
||||
static SUNXI_CCU_GATE(dram_be2_clk, "dram-be2", "sdram",
|
||||
0x04, BIT(10), 0);
|
||||
static SUNXI_CCU_GATE(dram_drc0_clk, "dram-drc0", "sdram",
|
||||
0x04, BIT(12), 0);
|
||||
static SUNXI_CCU_GATE(dram_drc1_clk, "dram-drc1", "sdram",
|
||||
0x04, BIT(13), 0);
|
||||
|
||||
static SUNXI_CCU_GATE(bus_fe0_clk, "bus-fe0", "bus-de",
|
||||
0x08, BIT(0), 0);
|
||||
static SUNXI_CCU_GATE(bus_fe1_clk, "bus-fe1", "bus-de",
|
||||
0x08, BIT(1), 0);
|
||||
static SUNXI_CCU_GATE(bus_fe2_clk, "bus-fe2", "bus-de",
|
||||
0x08, BIT(2), 0);
|
||||
static SUNXI_CCU_GATE(bus_deu0_clk, "bus-deu0", "bus-de",
|
||||
0x08, BIT(4), 0);
|
||||
static SUNXI_CCU_GATE(bus_deu1_clk, "bus-deu1", "bus-de",
|
||||
0x08, BIT(5), 0);
|
||||
static SUNXI_CCU_GATE(bus_be0_clk, "bus-be0", "bus-de",
|
||||
0x08, BIT(8), 0);
|
||||
static SUNXI_CCU_GATE(bus_be1_clk, "bus-be1", "bus-de",
|
||||
0x08, BIT(9), 0);
|
||||
static SUNXI_CCU_GATE(bus_be2_clk, "bus-be2", "bus-de",
|
||||
0x08, BIT(10), 0);
|
||||
static SUNXI_CCU_GATE(bus_drc0_clk, "bus-drc0", "bus-de",
|
||||
0x08, BIT(12), 0);
|
||||
static SUNXI_CCU_GATE(bus_drc1_clk, "bus-drc1", "bus-de",
|
||||
0x08, BIT(13), 0);
|
||||
|
||||
static SUNXI_CCU_M(fe0_div_clk, "fe0-div", "de", 0x20, 0, 4, 0);
|
||||
static SUNXI_CCU_M(fe1_div_clk, "fe1-div", "de", 0x20, 4, 4, 0);
|
||||
static SUNXI_CCU_M(fe2_div_clk, "fe2-div", "de", 0x20, 8, 4, 0);
|
||||
static SUNXI_CCU_M(be0_div_clk, "be0-div", "de", 0x20, 16, 4, 0);
|
||||
static SUNXI_CCU_M(be1_div_clk, "be1-div", "de", 0x20, 20, 4, 0);
|
||||
static SUNXI_CCU_M(be2_div_clk, "be2-div", "de", 0x20, 24, 4, 0);
|
||||
|
||||
static struct ccu_common *sun9i_a80_de_clks[] = {
|
||||
&fe0_clk.common,
|
||||
&fe1_clk.common,
|
||||
&fe2_clk.common,
|
||||
&iep_deu0_clk.common,
|
||||
&iep_deu1_clk.common,
|
||||
&be0_clk.common,
|
||||
&be1_clk.common,
|
||||
&be2_clk.common,
|
||||
&iep_drc0_clk.common,
|
||||
&iep_drc1_clk.common,
|
||||
&merge_clk.common,
|
||||
|
||||
&dram_fe0_clk.common,
|
||||
&dram_fe1_clk.common,
|
||||
&dram_fe2_clk.common,
|
||||
&dram_deu0_clk.common,
|
||||
&dram_deu1_clk.common,
|
||||
&dram_be0_clk.common,
|
||||
&dram_be1_clk.common,
|
||||
&dram_be2_clk.common,
|
||||
&dram_drc0_clk.common,
|
||||
&dram_drc1_clk.common,
|
||||
|
||||
&bus_fe0_clk.common,
|
||||
&bus_fe1_clk.common,
|
||||
&bus_fe2_clk.common,
|
||||
&bus_deu0_clk.common,
|
||||
&bus_deu1_clk.common,
|
||||
&bus_be0_clk.common,
|
||||
&bus_be1_clk.common,
|
||||
&bus_be2_clk.common,
|
||||
&bus_drc0_clk.common,
|
||||
&bus_drc1_clk.common,
|
||||
|
||||
&fe0_div_clk.common,
|
||||
&fe1_div_clk.common,
|
||||
&fe2_div_clk.common,
|
||||
&be0_div_clk.common,
|
||||
&be1_div_clk.common,
|
||||
&be2_div_clk.common,
|
||||
};
|
||||
|
||||
static struct clk_hw_onecell_data sun9i_a80_de_hw_clks = {
|
||||
.hws = {
|
||||
[CLK_FE0] = &fe0_clk.common.hw,
|
||||
[CLK_FE1] = &fe1_clk.common.hw,
|
||||
[CLK_FE2] = &fe2_clk.common.hw,
|
||||
[CLK_IEP_DEU0] = &iep_deu0_clk.common.hw,
|
||||
[CLK_IEP_DEU1] = &iep_deu1_clk.common.hw,
|
||||
[CLK_BE0] = &be0_clk.common.hw,
|
||||
[CLK_BE1] = &be1_clk.common.hw,
|
||||
[CLK_BE2] = &be2_clk.common.hw,
|
||||
[CLK_IEP_DRC0] = &iep_drc0_clk.common.hw,
|
||||
[CLK_IEP_DRC1] = &iep_drc1_clk.common.hw,
|
||||
[CLK_MERGE] = &merge_clk.common.hw,
|
||||
|
||||
[CLK_DRAM_FE0] = &dram_fe0_clk.common.hw,
|
||||
[CLK_DRAM_FE1] = &dram_fe1_clk.common.hw,
|
||||
[CLK_DRAM_FE2] = &dram_fe2_clk.common.hw,
|
||||
[CLK_DRAM_DEU0] = &dram_deu0_clk.common.hw,
|
||||
[CLK_DRAM_DEU1] = &dram_deu1_clk.common.hw,
|
||||
[CLK_DRAM_BE0] = &dram_be0_clk.common.hw,
|
||||
[CLK_DRAM_BE1] = &dram_be1_clk.common.hw,
|
||||
[CLK_DRAM_BE2] = &dram_be2_clk.common.hw,
|
||||
[CLK_DRAM_DRC0] = &dram_drc0_clk.common.hw,
|
||||
[CLK_DRAM_DRC1] = &dram_drc1_clk.common.hw,
|
||||
|
||||
[CLK_BUS_FE0] = &bus_fe0_clk.common.hw,
|
||||
[CLK_BUS_FE1] = &bus_fe1_clk.common.hw,
|
||||
[CLK_BUS_FE2] = &bus_fe2_clk.common.hw,
|
||||
[CLK_BUS_DEU0] = &bus_deu0_clk.common.hw,
|
||||
[CLK_BUS_DEU1] = &bus_deu1_clk.common.hw,
|
||||
[CLK_BUS_BE0] = &bus_be0_clk.common.hw,
|
||||
[CLK_BUS_BE1] = &bus_be1_clk.common.hw,
|
||||
[CLK_BUS_BE2] = &bus_be2_clk.common.hw,
|
||||
[CLK_BUS_DRC0] = &bus_drc0_clk.common.hw,
|
||||
[CLK_BUS_DRC1] = &bus_drc1_clk.common.hw,
|
||||
|
||||
[CLK_FE0_DIV] = &fe0_div_clk.common.hw,
|
||||
[CLK_FE1_DIV] = &fe1_div_clk.common.hw,
|
||||
[CLK_FE2_DIV] = &fe2_div_clk.common.hw,
|
||||
[CLK_BE0_DIV] = &be0_div_clk.common.hw,
|
||||
[CLK_BE1_DIV] = &be1_div_clk.common.hw,
|
||||
[CLK_BE2_DIV] = &be2_div_clk.common.hw,
|
||||
},
|
||||
.num = CLK_NUMBER,
|
||||
};
|
||||
|
||||
static struct ccu_reset_map sun9i_a80_de_resets[] = {
|
||||
[RST_FE0] = { 0x0c, BIT(0) },
|
||||
[RST_FE1] = { 0x0c, BIT(1) },
|
||||
[RST_FE2] = { 0x0c, BIT(2) },
|
||||
[RST_DEU0] = { 0x0c, BIT(4) },
|
||||
[RST_DEU1] = { 0x0c, BIT(5) },
|
||||
[RST_BE0] = { 0x0c, BIT(8) },
|
||||
[RST_BE1] = { 0x0c, BIT(9) },
|
||||
[RST_BE2] = { 0x0c, BIT(10) },
|
||||
[RST_DRC0] = { 0x0c, BIT(12) },
|
||||
[RST_DRC1] = { 0x0c, BIT(13) },
|
||||
[RST_MERGE] = { 0x0c, BIT(20) },
|
||||
};
|
||||
|
||||
static const struct sunxi_ccu_desc sun9i_a80_de_clk_desc = {
|
||||
.ccu_clks = sun9i_a80_de_clks,
|
||||
.num_ccu_clks = ARRAY_SIZE(sun9i_a80_de_clks),
|
||||
|
||||
.hw_clks = &sun9i_a80_de_hw_clks,
|
||||
|
||||
.resets = sun9i_a80_de_resets,
|
||||
.num_resets = ARRAY_SIZE(sun9i_a80_de_resets),
|
||||
};
|
||||
|
||||
static int sun9i_a80_de_clk_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct resource *res;
|
||||
struct clk *bus_clk;
|
||||
struct reset_control *rstc;
|
||||
void __iomem *reg;
|
||||
int ret;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
reg = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(reg))
|
||||
return PTR_ERR(reg);
|
||||
|
||||
bus_clk = devm_clk_get(&pdev->dev, "bus");
|
||||
if (IS_ERR(bus_clk)) {
|
||||
ret = PTR_ERR(bus_clk);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(&pdev->dev, "Couldn't get bus clk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
|
||||
if (IS_ERR(rstc)) {
|
||||
ret = PTR_ERR(rstc);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(&pdev->dev,
|
||||
"Couldn't get reset control: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* The bus clock needs to be enabled for us to access the registers */
|
||||
ret = clk_prepare_enable(bus_clk);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Couldn't enable bus clk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* The reset control needs to be asserted for the controls to work */
|
||||
ret = reset_control_deassert(rstc);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev,
|
||||
"Couldn't deassert reset control: %d\n", ret);
|
||||
goto err_disable_clk;
|
||||
}
|
||||
|
||||
ret = sunxi_ccu_probe(pdev->dev.of_node, reg,
|
||||
&sun9i_a80_de_clk_desc);
|
||||
if (ret)
|
||||
goto err_assert_reset;
|
||||
|
||||
return 0;
|
||||
|
||||
err_assert_reset:
|
||||
reset_control_assert(rstc);
|
||||
err_disable_clk:
|
||||
clk_disable_unprepare(bus_clk);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct of_device_id sun9i_a80_de_clk_ids[] = {
|
||||
{ .compatible = "allwinner,sun9i-a80-de-clks" },
|
||||
{ }
|
||||
};
|
||||
|
||||
static struct platform_driver sun9i_a80_de_clk_driver = {
|
||||
.probe = sun9i_a80_de_clk_probe,
|
||||
.driver = {
|
||||
.name = "sun9i-a80-de-clks",
|
||||
.of_match_table = sun9i_a80_de_clk_ids,
|
||||
},
|
||||
};
|
||||
builtin_platform_driver(sun9i_a80_de_clk_driver);
|
33
drivers/clk/sunxi-ng/ccu-sun9i-a80-de.h
Normal file
33
drivers/clk/sunxi-ng/ccu-sun9i-a80-de.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2016 Chen-Yu Tsai
|
||||
*
|
||||
* Chen-Yu Tsai <wens@csie.org>
|
||||
*
|
||||
* 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 _CCU_SUN9I_A80_DE_H_
|
||||
#define _CCU_SUN9I_A80_DE_H_
|
||||
|
||||
#include <dt-bindings/clock/sun9i-a80-de.h>
|
||||
#include <dt-bindings/reset/sun9i-a80-de.h>
|
||||
|
||||
/* Intermediary clock dividers are not exported */
|
||||
#define CLK_FE0_DIV 31
|
||||
#define CLK_FE1_DIV 32
|
||||
#define CLK_FE2_DIV 33
|
||||
#define CLK_BE0_DIV 34
|
||||
#define CLK_BE1_DIV 35
|
||||
#define CLK_BE2_DIV 36
|
||||
|
||||
#define CLK_NUMBER (CLK_BE2_DIV + 1)
|
||||
|
||||
#endif /* _CCU_SUN9I_A80_DE_H_ */
|
144
drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c
Normal file
144
drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Chen-Yu Tsai. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include "ccu_common.h"
|
||||
#include "ccu_gate.h"
|
||||
#include "ccu_reset.h"
|
||||
|
||||
#include "ccu-sun9i-a80-usb.h"
|
||||
|
||||
static SUNXI_CCU_GATE(bus_hci0_clk, "bus-hci0", "bus-usb", 0x0, BIT(1), 0);
|
||||
static SUNXI_CCU_GATE(usb_ohci0_clk, "usb-ohci0", "osc24M", 0x0, BIT(2), 0);
|
||||
static SUNXI_CCU_GATE(bus_hci1_clk, "bus-hci1", "bus-usb", 0x0, BIT(3), 0);
|
||||
static SUNXI_CCU_GATE(bus_hci2_clk, "bus-hci2", "bus-usb", 0x0, BIT(5), 0);
|
||||
static SUNXI_CCU_GATE(usb_ohci2_clk, "usb-ohci2", "osc24M", 0x0, BIT(6), 0);
|
||||
|
||||
static SUNXI_CCU_GATE(usb0_phy_clk, "usb0-phy", "osc24M", 0x4, BIT(1), 0);
|
||||
static SUNXI_CCU_GATE(usb1_hsic_clk, "usb1-hsic", "osc24M", 0x4, BIT(2), 0);
|
||||
static SUNXI_CCU_GATE(usb1_phy_clk, "usb1-phy", "osc24M", 0x4, BIT(3), 0);
|
||||
static SUNXI_CCU_GATE(usb2_hsic_clk, "usb2-hsic", "osc24M", 0x4, BIT(4), 0);
|
||||
static SUNXI_CCU_GATE(usb2_phy_clk, "usb2-phy", "osc24M", 0x4, BIT(5), 0);
|
||||
static SUNXI_CCU_GATE(usb_hsic_clk, "usb-hsic", "osc24M", 0x4, BIT(10), 0);
|
||||
|
||||
static struct ccu_common *sun9i_a80_usb_clks[] = {
|
||||
&bus_hci0_clk.common,
|
||||
&usb_ohci0_clk.common,
|
||||
&bus_hci1_clk.common,
|
||||
&bus_hci2_clk.common,
|
||||
&usb_ohci2_clk.common,
|
||||
|
||||
&usb0_phy_clk.common,
|
||||
&usb1_hsic_clk.common,
|
||||
&usb1_phy_clk.common,
|
||||
&usb2_hsic_clk.common,
|
||||
&usb2_phy_clk.common,
|
||||
&usb_hsic_clk.common,
|
||||
};
|
||||
|
||||
static struct clk_hw_onecell_data sun9i_a80_usb_hw_clks = {
|
||||
.hws = {
|
||||
[CLK_BUS_HCI0] = &bus_hci0_clk.common.hw,
|
||||
[CLK_USB_OHCI0] = &usb_ohci0_clk.common.hw,
|
||||
[CLK_BUS_HCI1] = &bus_hci1_clk.common.hw,
|
||||
[CLK_BUS_HCI2] = &bus_hci2_clk.common.hw,
|
||||
[CLK_USB_OHCI2] = &usb_ohci2_clk.common.hw,
|
||||
|
||||
[CLK_USB0_PHY] = &usb0_phy_clk.common.hw,
|
||||
[CLK_USB1_HSIC] = &usb1_hsic_clk.common.hw,
|
||||
[CLK_USB1_PHY] = &usb1_phy_clk.common.hw,
|
||||
[CLK_USB2_HSIC] = &usb2_hsic_clk.common.hw,
|
||||
[CLK_USB2_PHY] = &usb2_phy_clk.common.hw,
|
||||
[CLK_USB_HSIC] = &usb_hsic_clk.common.hw,
|
||||
},
|
||||
.num = CLK_NUMBER,
|
||||
};
|
||||
|
||||
static struct ccu_reset_map sun9i_a80_usb_resets[] = {
|
||||
[RST_USB0_HCI] = { 0x0, BIT(17) },
|
||||
[RST_USB1_HCI] = { 0x0, BIT(18) },
|
||||
[RST_USB2_HCI] = { 0x0, BIT(19) },
|
||||
|
||||
[RST_USB0_PHY] = { 0x4, BIT(17) },
|
||||
[RST_USB1_HSIC] = { 0x4, BIT(18) },
|
||||
[RST_USB1_PHY] = { 0x4, BIT(19) },
|
||||
[RST_USB2_HSIC] = { 0x4, BIT(20) },
|
||||
[RST_USB2_PHY] = { 0x4, BIT(21) },
|
||||
};
|
||||
|
||||
static const struct sunxi_ccu_desc sun9i_a80_usb_clk_desc = {
|
||||
.ccu_clks = sun9i_a80_usb_clks,
|
||||
.num_ccu_clks = ARRAY_SIZE(sun9i_a80_usb_clks),
|
||||
|
||||
.hw_clks = &sun9i_a80_usb_hw_clks,
|
||||
|
||||
.resets = sun9i_a80_usb_resets,
|
||||
.num_resets = ARRAY_SIZE(sun9i_a80_usb_resets),
|
||||
};
|
||||
|
||||
static int sun9i_a80_usb_clk_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct resource *res;
|
||||
struct clk *bus_clk;
|
||||
void __iomem *reg;
|
||||
int ret;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
reg = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(reg))
|
||||
return PTR_ERR(reg);
|
||||
|
||||
bus_clk = devm_clk_get(&pdev->dev, "bus");
|
||||
if (IS_ERR(bus_clk)) {
|
||||
ret = PTR_ERR(bus_clk);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(&pdev->dev, "Couldn't get bus clk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* The bus clock needs to be enabled for us to access the registers */
|
||||
ret = clk_prepare_enable(bus_clk);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Couldn't enable bus clk: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = sunxi_ccu_probe(pdev->dev.of_node, reg,
|
||||
&sun9i_a80_usb_clk_desc);
|
||||
if (ret)
|
||||
goto err_disable_clk;
|
||||
|
||||
return 0;
|
||||
|
||||
err_disable_clk:
|
||||
clk_disable_unprepare(bus_clk);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct of_device_id sun9i_a80_usb_clk_ids[] = {
|
||||
{ .compatible = "allwinner,sun9i-a80-usb-clks" },
|
||||
{ }
|
||||
};
|
||||
|
||||
static struct platform_driver sun9i_a80_usb_clk_driver = {
|
||||
.probe = sun9i_a80_usb_clk_probe,
|
||||
.driver = {
|
||||
.name = "sun9i-a80-usb-clks",
|
||||
.of_match_table = sun9i_a80_usb_clk_ids,
|
||||
},
|
||||
};
|
||||
builtin_platform_driver(sun9i_a80_usb_clk_driver);
|
25
drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.h
Normal file
25
drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.h
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2016 Chen-Yu Tsai
|
||||
*
|
||||
* Chen-Yu Tsai <wens@csie.org>
|
||||
*
|
||||
* 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 _CCU_SUN9I_A80_USB_H_
|
||||
#define _CCU_SUN9I_A80_USB_H_
|
||||
|
||||
#include <dt-bindings/clock/sun9i-a80-usb.h>
|
||||
#include <dt-bindings/reset/sun9i-a80-usb.h>
|
||||
|
||||
#define CLK_NUMBER (CLK_USB_HSIC + 1)
|
||||
|
||||
#endif /* _CCU_SUN9I_A80_USB_H_ */
|
1223
drivers/clk/sunxi-ng/ccu-sun9i-a80.c
Normal file
1223
drivers/clk/sunxi-ng/ccu-sun9i-a80.c
Normal file
File diff suppressed because it is too large
Load Diff
57
drivers/clk/sunxi-ng/ccu-sun9i-a80.h
Normal file
57
drivers/clk/sunxi-ng/ccu-sun9i-a80.h
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2016 Chen-Yu Tsai
|
||||
*
|
||||
* Chen-Yu Tsai <wens@csie.org>
|
||||
*
|
||||
* 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 _CCU_SUN9I_A80_H_
|
||||
#define _CCU_SUN9I_A80_H_
|
||||
|
||||
#include <dt-bindings/clock/sun9i-a80-ccu.h>
|
||||
#include <dt-bindings/reset/sun9i-a80-ccu.h>
|
||||
|
||||
#define CLK_PLL_C0CPUX 0
|
||||
#define CLK_PLL_C1CPUX 1
|
||||
|
||||
/* pll-audio and pll-periph0 are exported to the PRCM block */
|
||||
|
||||
#define CLK_PLL_VE 4
|
||||
#define CLK_PLL_DDR 5
|
||||
#define CLK_PLL_VIDEO0 6
|
||||
#define CLK_PLL_VIDEO1 7
|
||||
#define CLK_PLL_GPU 8
|
||||
#define CLK_PLL_DE 9
|
||||
#define CLK_PLL_ISP 10
|
||||
#define CLK_PLL_PERIPH1 11
|
||||
|
||||
/* The CPUX clocks are exported */
|
||||
|
||||
#define CLK_ATB0 14
|
||||
#define CLK_AXI0 15
|
||||
#define CLK_ATB1 16
|
||||
#define CLK_AXI1 17
|
||||
#define CLK_GTBUS 18
|
||||
#define CLK_AHB0 19
|
||||
#define CLK_AHB1 20
|
||||
#define CLK_AHB2 21
|
||||
#define CLK_APB0 22
|
||||
#define CLK_APB1 23
|
||||
#define CLK_CCI400 24
|
||||
#define CLK_ATS 25
|
||||
#define CLK_TRACE 26
|
||||
|
||||
/* module clocks and bus gates exported */
|
||||
|
||||
#define CLK_NUMBER (CLK_BUS_UART5 + 1)
|
||||
|
||||
#endif /* _CCU_SUN9I_A80_H_ */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user