forked from Minki/linux
Merge branch 'v3.16-next/clk-samsung' into v3.16-next/cpuidle-exynos
This commit is contained in:
commit
985326c9f6
41
Documentation/devicetree/bindings/clock/exynos3250-clock.txt
Normal file
41
Documentation/devicetree/bindings/clock/exynos3250-clock.txt
Normal file
@ -0,0 +1,41 @@
|
||||
* Samsung Exynos3250 Clock Controller
|
||||
|
||||
The Exynos3250 clock controller generates and supplies clock to various
|
||||
controllers within the Exynos3250 SoC.
|
||||
|
||||
Required Properties:
|
||||
|
||||
- compatible: should be one of the following.
|
||||
- "samsung,exynos3250-cmu" - controller compatible with Exynos3250 SoC.
|
||||
|
||||
- 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/exynos3250.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,exynos3250-cmu";
|
||||
reg = <0x10030000 0x20000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
Example 2: UART controller node that consumes the clock generated by the clock
|
||||
controller. Refer to the standard clock bindings for information
|
||||
about 'clocks' and 'clock-names' property.
|
||||
|
||||
serial@13800000 {
|
||||
compatible = "samsung,exynos4210-uart";
|
||||
reg = <0x13800000 0x100>;
|
||||
interrupts = <0 109 0>;
|
||||
clocks = <&cmu CLK_UART0>, <&cmu CLK_SCLK_UART0>;
|
||||
clock-names = "uart", "clk_uart_baud0";
|
||||
};
|
190
Documentation/devicetree/bindings/clock/exynos5260-clock.txt
Normal file
190
Documentation/devicetree/bindings/clock/exynos5260-clock.txt
Normal file
@ -0,0 +1,190 @@
|
||||
* Samsung Exynos5260 Clock Controller
|
||||
|
||||
Exynos5260 has 13 clock controllers which are instantiated
|
||||
independently from the device-tree. These clock controllers
|
||||
generate and supply clocks to various hardware blocks within
|
||||
the SoC.
|
||||
|
||||
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/exynos5260-clk.h header and can be used in
|
||||
device tree sources.
|
||||
|
||||
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:
|
||||
|
||||
- "fin_pll" - PLL input clock from XXTI
|
||||
- "xrtcxti" - input clock from XRTCXTI
|
||||
- "ioclk_pcm_extclk" - pcm external operation clock
|
||||
- "ioclk_spdif_extclk" - spdif external operation clock
|
||||
- "ioclk_i2s_cdclk" - i2s0 codec clock
|
||||
|
||||
Phy clocks:
|
||||
|
||||
There are several clocks which are generated by specific PHYs.
|
||||
These clocks are fed into the clock controller and then routed to
|
||||
the hardware blocks. These clocks are defined as fixed clocks in the
|
||||
driver with following names:
|
||||
|
||||
- "phyclk_dptx_phy_ch3_txd_clk" - dp phy clock for channel 3
|
||||
- "phyclk_dptx_phy_ch2_txd_clk" - dp phy clock for channel 2
|
||||
- "phyclk_dptx_phy_ch1_txd_clk" - dp phy clock for channel 1
|
||||
- "phyclk_dptx_phy_ch0_txd_clk" - dp phy clock for channel 0
|
||||
- "phyclk_hdmi_phy_tmds_clko" - hdmi phy tmds clock
|
||||
- "phyclk_hdmi_phy_pixel_clko" - hdmi phy pixel clock
|
||||
- "phyclk_hdmi_link_o_tmds_clkhi" - hdmi phy for hdmi link
|
||||
- "phyclk_dptx_phy_o_ref_clk_24m" - dp phy reference clock
|
||||
- "phyclk_dptx_phy_clk_div2"
|
||||
- "phyclk_mipi_dphy_4l_m_rxclkesc0"
|
||||
- "phyclk_usbhost20_phy_phyclock" - usb 2.0 phy clock
|
||||
- "phyclk_usbhost20_phy_freeclk"
|
||||
- "phyclk_usbhost20_phy_clk48mohci"
|
||||
- "phyclk_usbdrd30_udrd30_pipe_pclk"
|
||||
- "phyclk_usbdrd30_udrd30_phyclock" - usb 3.0 phy clock
|
||||
|
||||
Required Properties for Clock Controller:
|
||||
|
||||
- compatible: should be one of the following.
|
||||
1) "samsung,exynos5260-clock-top"
|
||||
2) "samsung,exynos5260-clock-peri"
|
||||
3) "samsung,exynos5260-clock-egl"
|
||||
4) "samsung,exynos5260-clock-kfc"
|
||||
5) "samsung,exynos5260-clock-g2d"
|
||||
6) "samsung,exynos5260-clock-mif"
|
||||
7) "samsung,exynos5260-clock-mfc"
|
||||
8) "samsung,exynos5260-clock-g3d"
|
||||
9) "samsung,exynos5260-clock-fsys"
|
||||
10) "samsung,exynos5260-clock-aud"
|
||||
11) "samsung,exynos5260-clock-isp"
|
||||
12) "samsung,exynos5260-clock-gscl"
|
||||
13) "samsung,exynos5260-clock-disp"
|
||||
|
||||
- reg: physical base address of the controller and the length of
|
||||
memory mapped region.
|
||||
|
||||
- #clock-cells: should be 1.
|
||||
|
||||
- clocks: list of clock identifiers which are fed as the input to
|
||||
the given clock controller. Please refer the next section to find
|
||||
the input clocks for a given controller.
|
||||
|
||||
- clock-names: list of names of clocks which are fed as the input
|
||||
to the given clock controller.
|
||||
|
||||
Input clocks for top clock controller:
|
||||
- fin_pll
|
||||
- dout_mem_pll
|
||||
- dout_bus_pll
|
||||
- dout_media_pll
|
||||
|
||||
Input clocks for peri clock controller:
|
||||
- fin_pll
|
||||
- ioclk_pcm_extclk
|
||||
- ioclk_i2s_cdclk
|
||||
- ioclk_spdif_extclk
|
||||
- phyclk_hdmi_phy_ref_cko
|
||||
- dout_aclk_peri_66
|
||||
- dout_sclk_peri_uart0
|
||||
- dout_sclk_peri_uart1
|
||||
- dout_sclk_peri_uart2
|
||||
- dout_sclk_peri_spi0_b
|
||||
- dout_sclk_peri_spi1_b
|
||||
- dout_sclk_peri_spi2_b
|
||||
- dout_aclk_peri_aud
|
||||
- dout_sclk_peri_spi0_b
|
||||
|
||||
Input clocks for egl clock controller:
|
||||
- fin_pll
|
||||
- dout_bus_pll
|
||||
|
||||
Input clocks for kfc clock controller:
|
||||
- fin_pll
|
||||
- dout_media_pll
|
||||
|
||||
Input clocks for g2d clock controller:
|
||||
- fin_pll
|
||||
- dout_aclk_g2d_333
|
||||
|
||||
Input clocks for mif clock controller:
|
||||
- fin_pll
|
||||
|
||||
Input clocks for mfc clock controller:
|
||||
- fin_pll
|
||||
- dout_aclk_mfc_333
|
||||
|
||||
Input clocks for g3d clock controller:
|
||||
- fin_pll
|
||||
|
||||
Input clocks for fsys clock controller:
|
||||
- fin_pll
|
||||
- phyclk_usbhost20_phy_phyclock
|
||||
- phyclk_usbhost20_phy_freeclk
|
||||
- phyclk_usbhost20_phy_clk48mohci
|
||||
- phyclk_usbdrd30_udrd30_pipe_pclk
|
||||
- phyclk_usbdrd30_udrd30_phyclock
|
||||
- dout_aclk_fsys_200
|
||||
|
||||
Input clocks for aud clock controller:
|
||||
- fin_pll
|
||||
- fout_aud_pll
|
||||
- ioclk_i2s_cdclk
|
||||
- ioclk_pcm_extclk
|
||||
|
||||
Input clocks for isp clock controller:
|
||||
- fin_pll
|
||||
- dout_aclk_isp1_266
|
||||
- dout_aclk_isp1_400
|
||||
- mout_aclk_isp1_266
|
||||
|
||||
Input clocks for gscl clock controller:
|
||||
- fin_pll
|
||||
- dout_aclk_gscl_400
|
||||
- dout_aclk_gscl_333
|
||||
|
||||
Input clocks for disp clock controller:
|
||||
- fin_pll
|
||||
- phyclk_dptx_phy_ch3_txd_clk
|
||||
- phyclk_dptx_phy_ch2_txd_clk
|
||||
- phyclk_dptx_phy_ch1_txd_clk
|
||||
- phyclk_dptx_phy_ch0_txd_clk
|
||||
- phyclk_hdmi_phy_tmds_clko
|
||||
- phyclk_hdmi_phy_ref_clko
|
||||
- phyclk_hdmi_phy_pixel_clko
|
||||
- phyclk_hdmi_link_o_tmds_clkhi
|
||||
- phyclk_mipi_dphy_4l_m_txbyte_clkhs
|
||||
- phyclk_dptx_phy_o_ref_clk_24m
|
||||
- phyclk_dptx_phy_clk_div2
|
||||
- phyclk_mipi_dphy_4l_m_rxclkesc0
|
||||
- phyclk_hdmi_phy_ref_cko
|
||||
- ioclk_spdif_extclk
|
||||
- dout_aclk_peri_aud
|
||||
- dout_aclk_disp_222
|
||||
- dout_sclk_disp_pixel
|
||||
- dout_aclk_disp_333
|
||||
|
||||
Example 1: An example of a clock controller node is listed below.
|
||||
|
||||
clock_mfc: clock-controller@11090000 {
|
||||
compatible = "samsung,exynos5260-clock-mfc";
|
||||
clock = <&fin_pll>, <&clock_top TOP_DOUT_ACLK_MFC_333>;
|
||||
clock-names = "fin_pll", "dout_aclk_mfc_333";
|
||||
reg = <0x11090000 0x10000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
Example 2: UART controller node that consumes the clock generated by the
|
||||
peri clock controller. Refer to the standard clock bindings for
|
||||
information about 'clocks' and 'clock-names' property.
|
||||
|
||||
serial@12C00000 {
|
||||
compatible = "samsung,exynos4210-uart";
|
||||
reg = <0x12C00000 0x100>;
|
||||
interrupts = <0 146 0>;
|
||||
clocks = <&clock_peri PERI_PCLK_UART0>, <&clock_peri PERI_SCLK_UART0>;
|
||||
clock-names = "uart", "clk_uart_baud0";
|
||||
};
|
||||
|
@ -1,12 +1,13 @@
|
||||
* Samsung Exynos5420 Clock Controller
|
||||
|
||||
The Exynos5420 clock controller generates and supplies clock to various
|
||||
controllers within the Exynos5420 SoC.
|
||||
controllers within the Exynos5420 SoC and for the Exynos5800 SoC.
|
||||
|
||||
Required Properties:
|
||||
|
||||
- compatible: should be one of the following.
|
||||
- "samsung,exynos5420-clock" - controller compatible with Exynos5420 SoC.
|
||||
- "samsung,exynos5800-clock" - controller compatible with Exynos5800 SoC.
|
||||
|
||||
- reg: physical base address of the controller and length of memory mapped
|
||||
region.
|
||||
|
@ -0,0 +1,50 @@
|
||||
* Samsung S3C2410 Clock Controller
|
||||
|
||||
The S3C2410 clock controller generates and supplies clock to various controllers
|
||||
within the SoC. The clock binding described here is applicable to the s3c2410,
|
||||
s3c2440 and s3c2442 SoCs in the s3c24x family.
|
||||
|
||||
Required Properties:
|
||||
|
||||
- compatible: should be one of the following.
|
||||
- "samsung,s3c2410-clock" - controller compatible with S3C2410 SoC.
|
||||
- "samsung,s3c2440-clock" - controller compatible with S3C2440 SoC.
|
||||
- "samsung,s3c2442-clock" - controller compatible with S3C2442 SoC.
|
||||
- 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. Some of the clocks are available only
|
||||
on a particular SoC.
|
||||
|
||||
All available clocks are defined as preprocessor macros in
|
||||
dt-bindings/clock/s3c2410.h header and can be used in device
|
||||
tree sources.
|
||||
|
||||
External clocks:
|
||||
|
||||
The xti clock used as input for the plls is generated outside the SoC. It is
|
||||
expected that is are defined using standard clock bindings with a
|
||||
clock-output-names value of "xti".
|
||||
|
||||
Example: Clock controller node:
|
||||
|
||||
clocks: clock-controller@4c000000 {
|
||||
compatible = "samsung,s3c2410-clock";
|
||||
reg = <0x4c000000 0x20>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
Example: UART controller node that consumes the clock generated by the clock
|
||||
controller (refer to the standard clock bindings for information about
|
||||
"clocks" and "clock-names" properties):
|
||||
|
||||
serial@50004000 {
|
||||
compatible = "samsung,s3c2440-uart";
|
||||
reg = <0x50004000 0x4000>;
|
||||
interrupts = <1 23 3 4>, <1 23 4 4>;
|
||||
clock-names = "uart", "clk_uart_baud2";
|
||||
clocks = <&clocks PCLK_UART0>, <&clocks PCLK_UART0>;
|
||||
status = "disabled";
|
||||
};
|
@ -0,0 +1,50 @@
|
||||
* Samsung S3C2412 Clock Controller
|
||||
|
||||
The S3C2412 clock controller generates and supplies clock to various controllers
|
||||
within the SoC. The clock binding described here is applicable to the s3c2412
|
||||
and s3c2413 SoCs in the s3c24x family.
|
||||
|
||||
Required Properties:
|
||||
|
||||
- compatible: should be "samsung,s3c2412-clock"
|
||||
- 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. Some of the clocks are available only
|
||||
on a particular SoC.
|
||||
|
||||
All available clocks are defined as preprocessor macros in
|
||||
dt-bindings/clock/s3c2412.h header and can be used in device
|
||||
tree sources.
|
||||
|
||||
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:
|
||||
- "xti" - crystal input - required,
|
||||
- "ext" - external clock source - optional,
|
||||
|
||||
Example: Clock controller node:
|
||||
|
||||
clocks: clock-controller@4c000000 {
|
||||
compatible = "samsung,s3c2412-clock";
|
||||
reg = <0x4c000000 0x20>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
Example: UART controller node that consumes the clock generated by the clock
|
||||
controller (refer to the standard clock bindings for information about
|
||||
"clocks" and "clock-names" properties):
|
||||
|
||||
serial@50004000 {
|
||||
compatible = "samsung,s3c2412-uart";
|
||||
reg = <0x50004000 0x4000>;
|
||||
interrupts = <1 23 3 4>, <1 23 4 4>;
|
||||
clock-names = "uart", "clk_uart_baud2", "clk_uart_baud3";
|
||||
clocks = <&clocks PCLK_UART0>, <&clocks PCLK_UART0>,
|
||||
<&clocks SCLK_UART>;
|
||||
status = "disabled";
|
||||
};
|
@ -0,0 +1,56 @@
|
||||
* Samsung S3C2443 Clock Controller
|
||||
|
||||
The S3C2443 clock controller generates and supplies clock to various controllers
|
||||
within the SoC. The clock binding described here is applicable to all SoCs in
|
||||
the s3c24x family starting with the s3c2443.
|
||||
|
||||
Required Properties:
|
||||
|
||||
- compatible: should be one of the following.
|
||||
- "samsung,s3c2416-clock" - controller compatible with S3C2416 SoC.
|
||||
- "samsung,s3c2443-clock" - controller compatible with S3C2443 SoC.
|
||||
- "samsung,s3c2450-clock" - controller compatible with S3C2450 SoC.
|
||||
- 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. Some of the clocks are available only
|
||||
on a particular SoC.
|
||||
|
||||
All available clocks are defined as preprocessor macros in
|
||||
dt-bindings/clock/s3c2443.h header and can be used in device
|
||||
tree sources.
|
||||
|
||||
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:
|
||||
- "xti" - crystal input - required,
|
||||
- "ext" - external clock source - optional,
|
||||
- "ext_i2s" - external I2S clock - optional,
|
||||
- "ext_uart" - external uart clock - optional,
|
||||
|
||||
Example: Clock controller node:
|
||||
|
||||
clocks: clock-controller@4c000000 {
|
||||
compatible = "samsung,s3c2416-clock";
|
||||
reg = <0x4c000000 0x40>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
Example: UART controller node that consumes the clock generated by the clock
|
||||
controller (refer to the standard clock bindings for information about
|
||||
"clocks" and "clock-names" properties):
|
||||
|
||||
serial@50004000 {
|
||||
compatible = "samsung,s3c2440-uart";
|
||||
reg = <0x50004000 0x4000>;
|
||||
interrupts = <1 23 3 4>, <1 23 4 4>;
|
||||
clock-names = "uart", "clk_uart_baud2",
|
||||
"clk_uart_baud3";
|
||||
clocks = <&clocks PCLK_UART0>, <&clocks PCLK_UART0>,
|
||||
<&clocks SCLK_UART>;
|
||||
status = "disabled";
|
||||
};
|
@ -754,7 +754,7 @@ config ARCH_S3C64XX
|
||||
select ATAGS
|
||||
select CLKDEV_LOOKUP
|
||||
select CLKSRC_SAMSUNG_PWM
|
||||
select COMMON_CLK
|
||||
select COMMON_CLK_SAMSUNG
|
||||
select CPU_V6K
|
||||
select GENERIC_CLOCKEVENTS
|
||||
select GPIO_SAMSUNG
|
||||
@ -835,7 +835,7 @@ config ARCH_EXYNOS
|
||||
select ARCH_REQUIRE_GPIOLIB
|
||||
select ARCH_SPARSEMEM_ENABLE
|
||||
select ARM_GIC
|
||||
select COMMON_CLK
|
||||
select COMMON_CLK_SAMSUNG
|
||||
select CPU_V7
|
||||
select GENERIC_CLOCKEVENTS
|
||||
select HAVE_S3C2410_I2C if I2C
|
||||
|
@ -594,7 +594,7 @@
|
||||
#size-cells = <0>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&i2c4_hs_bus>;
|
||||
clocks = <&clock CLK_I2C4>;
|
||||
clocks = <&clock CLK_USI0>;
|
||||
clock-names = "hsi2c";
|
||||
status = "disabled";
|
||||
};
|
||||
@ -607,7 +607,7 @@
|
||||
#size-cells = <0>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&i2c5_hs_bus>;
|
||||
clocks = <&clock CLK_I2C5>;
|
||||
clocks = <&clock CLK_USI1>;
|
||||
clock-names = "hsi2c";
|
||||
status = "disabled";
|
||||
};
|
||||
@ -620,7 +620,7 @@
|
||||
#size-cells = <0>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&i2c6_hs_bus>;
|
||||
clocks = <&clock CLK_I2C6>;
|
||||
clocks = <&clock CLK_USI2>;
|
||||
clock-names = "hsi2c";
|
||||
status = "disabled";
|
||||
};
|
||||
@ -633,7 +633,7 @@
|
||||
#size-cells = <0>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&i2c7_hs_bus>;
|
||||
clocks = <&clock CLK_I2C7>;
|
||||
clocks = <&clock CLK_USI3>;
|
||||
clock-names = "hsi2c";
|
||||
status = "disabled";
|
||||
};
|
||||
@ -646,7 +646,7 @@
|
||||
#size-cells = <0>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&i2c8_hs_bus>;
|
||||
clocks = <&clock CLK_I2C8>;
|
||||
clocks = <&clock CLK_USI4>;
|
||||
clock-names = "hsi2c";
|
||||
status = "disabled";
|
||||
};
|
||||
@ -659,7 +659,7 @@
|
||||
#size-cells = <0>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&i2c9_hs_bus>;
|
||||
clocks = <&clock CLK_I2C9>;
|
||||
clocks = <&clock CLK_USI5>;
|
||||
clock-names = "hsi2c";
|
||||
status = "disabled";
|
||||
};
|
||||
@ -672,7 +672,7 @@
|
||||
#size-cells = <0>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&i2c10_hs_bus>;
|
||||
clocks = <&clock CLK_I2C10>;
|
||||
clocks = <&clock CLK_USI6>;
|
||||
clock-names = "hsi2c";
|
||||
status = "disabled";
|
||||
};
|
||||
|
@ -19,6 +19,19 @@
|
||||
reg = <0x30000000 0x4000000>;
|
||||
};
|
||||
|
||||
clocks {
|
||||
compatible = "simple-bus";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
xti: xti {
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <12000000>;
|
||||
clock-output-names = "xti";
|
||||
#clock-cells = <0>;
|
||||
};
|
||||
};
|
||||
|
||||
serial@50000000 {
|
||||
status = "okay";
|
||||
pinctrl-names = "default";
|
||||
|
@ -8,6 +8,7 @@
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <dt-bindings/clock/s3c2443.h>
|
||||
#include "s3c24xx.dtsi"
|
||||
#include "s3c2416-pinctrl.dtsi"
|
||||
|
||||
@ -28,26 +29,53 @@
|
||||
compatible = "samsung,s3c2416-irq";
|
||||
};
|
||||
|
||||
clocks: clock-controller@0x4c000000 {
|
||||
compatible = "samsung,s3c2416-clock";
|
||||
reg = <0x4c000000 0x40>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
pinctrl@56000000 {
|
||||
compatible = "samsung,s3c2416-pinctrl";
|
||||
};
|
||||
|
||||
timer@51000000 {
|
||||
clocks = <&clocks PCLK_PWM>;
|
||||
clock-names = "timers";
|
||||
};
|
||||
|
||||
serial@50000000 {
|
||||
compatible = "samsung,s3c2440-uart";
|
||||
clock-names = "uart", "clk_uart_baud2",
|
||||
"clk_uart_baud3";
|
||||
clocks = <&clocks PCLK_UART0>, <&clocks PCLK_UART0>,
|
||||
<&clocks SCLK_UART>;
|
||||
};
|
||||
|
||||
serial@50004000 {
|
||||
compatible = "samsung,s3c2440-uart";
|
||||
clock-names = "uart", "clk_uart_baud2",
|
||||
"clk_uart_baud3";
|
||||
clocks = <&clocks PCLK_UART1>, <&clocks PCLK_UART1>,
|
||||
<&clocks SCLK_UART>;
|
||||
};
|
||||
|
||||
serial@50008000 {
|
||||
compatible = "samsung,s3c2440-uart";
|
||||
clock-names = "uart", "clk_uart_baud2",
|
||||
"clk_uart_baud3";
|
||||
clocks = <&clocks PCLK_UART2>, <&clocks PCLK_UART2>,
|
||||
<&clocks SCLK_UART>;
|
||||
};
|
||||
|
||||
serial@5000C000 {
|
||||
compatible = "samsung,s3c2440-uart";
|
||||
reg = <0x5000C000 0x4000>;
|
||||
interrupts = <1 18 24 4>, <1 18 25 4>;
|
||||
clock-names = "uart", "clk_uart_baud2",
|
||||
"clk_uart_baud3";
|
||||
clocks = <&clocks PCLK_UART3>, <&clocks PCLK_UART3>,
|
||||
<&clocks SCLK_UART>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -55,6 +83,10 @@
|
||||
compatible = "samsung,s3c6410-sdhci";
|
||||
reg = <0x4AC00000 0x100>;
|
||||
interrupts = <0 0 21 3>;
|
||||
clock-names = "hsmmc", "mmc_busclk.0",
|
||||
"mmc_busclk.2";
|
||||
clocks = <&clocks HCLK_HSMMC0>, <&clocks HCLK_HSMMC0>,
|
||||
<&clocks MUX_HSMMC0>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
@ -62,18 +94,28 @@
|
||||
compatible = "samsung,s3c6410-sdhci";
|
||||
reg = <0x4A800000 0x100>;
|
||||
interrupts = <0 0 20 3>;
|
||||
clock-names = "hsmmc", "mmc_busclk.0",
|
||||
"mmc_busclk.2";
|
||||
clocks = <&clocks HCLK_HSMMC1>, <&clocks HCLK_HSMMC1>,
|
||||
<&clocks MUX_HSMMC1>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
watchdog@53000000 {
|
||||
interrupts = <1 9 27 3>;
|
||||
clocks = <&clocks PCLK_WDT>;
|
||||
clock-names = "watchdog";
|
||||
};
|
||||
|
||||
rtc@57000000 {
|
||||
compatible = "samsung,s3c2416-rtc";
|
||||
clocks = <&clocks PCLK_RTC>;
|
||||
clock-names = "rtc";
|
||||
};
|
||||
|
||||
i2c@54000000 {
|
||||
compatible = "samsung,s3c2440-i2c";
|
||||
clocks = <&clocks PCLK_I2C0>;
|
||||
clock-names = "i2c";
|
||||
};
|
||||
};
|
||||
|
@ -18,6 +18,8 @@ config PLAT_S3C24XX
|
||||
help
|
||||
Base platform code for any Samsung S3C24XX device
|
||||
|
||||
|
||||
|
||||
menu "SAMSUNG S3C24XX SoCs Support"
|
||||
|
||||
comment "S3C24XX SoCs"
|
||||
@ -27,7 +29,7 @@ config CPU_S3C2410
|
||||
default y
|
||||
select CPU_ARM920T
|
||||
select CPU_LLSERIAL_S3C2410
|
||||
select S3C2410_CLOCK
|
||||
select S3C2410_COMMON_CLK
|
||||
select S3C2410_DMA if S3C24XX_DMA
|
||||
select ARM_S3C2410_CPUFREQ if ARM_S3C24XX_CPUFREQ
|
||||
select S3C2410_PM if PM
|
||||
@ -40,6 +42,7 @@ config CPU_S3C2412
|
||||
bool "SAMSUNG S3C2412"
|
||||
select CPU_ARM926T
|
||||
select CPU_LLSERIAL_S3C2440
|
||||
select S3C2412_COMMON_CLK
|
||||
select S3C2412_DMA if S3C24XX_DMA
|
||||
select S3C2412_PM if PM
|
||||
help
|
||||
@ -50,9 +53,8 @@ config CPU_S3C2416
|
||||
select CPU_ARM926T
|
||||
select CPU_LLSERIAL_S3C2440
|
||||
select S3C2416_PM if PM
|
||||
select S3C2443_COMMON
|
||||
select S3C2443_COMMON_CLK
|
||||
select S3C2443_DMA if S3C24XX_DMA
|
||||
select SAMSUNG_CLKSRC
|
||||
help
|
||||
Support for the S3C2416 SoC from the S3C24XX line
|
||||
|
||||
@ -60,7 +62,7 @@ config CPU_S3C2440
|
||||
bool "SAMSUNG S3C2440"
|
||||
select CPU_ARM920T
|
||||
select CPU_LLSERIAL_S3C2440
|
||||
select S3C2410_CLOCK
|
||||
select S3C2410_COMMON_CLK
|
||||
select S3C2410_PM if PM
|
||||
select S3C2440_DMA if S3C24XX_DMA
|
||||
help
|
||||
@ -70,7 +72,7 @@ config CPU_S3C2442
|
||||
bool "SAMSUNG S3C2442"
|
||||
select CPU_ARM920T
|
||||
select CPU_LLSERIAL_S3C2440
|
||||
select S3C2410_CLOCK
|
||||
select S3C2410_COMMON_CLK
|
||||
select S3C2410_DMA if S3C24XX_DMA
|
||||
select S3C2410_PM if PM
|
||||
help
|
||||
@ -85,25 +87,13 @@ config CPU_S3C2443
|
||||
bool "SAMSUNG S3C2443"
|
||||
select CPU_ARM920T
|
||||
select CPU_LLSERIAL_S3C2440
|
||||
select S3C2443_COMMON
|
||||
select S3C2443_COMMON_CLK
|
||||
select S3C2443_DMA if S3C24XX_DMA
|
||||
select SAMSUNG_CLKSRC
|
||||
help
|
||||
Support for the S3C2443 SoC from the S3C24XX line
|
||||
|
||||
# common code
|
||||
|
||||
config S3C2410_CLOCK
|
||||
bool
|
||||
help
|
||||
Clock code for the S3C2410, and similar processors which
|
||||
is currently includes the S3C2410, S3C2440, S3C2442.
|
||||
|
||||
config S3C24XX_DCLK
|
||||
bool
|
||||
help
|
||||
Clock code for supporting DCLK/CLKOUT on S3C24XX architectures
|
||||
|
||||
config S3C24XX_SMDK
|
||||
bool
|
||||
help
|
||||
@ -258,8 +248,8 @@ config ARCH_BAST
|
||||
bool "Simtec Electronics BAST (EB2410ITX)"
|
||||
select ISA
|
||||
select MACH_BAST_IDE
|
||||
select S3C2410_COMMON_DCLK
|
||||
select S3C2410_IOTIMING if ARM_S3C2410_CPUFREQ
|
||||
select S3C24XX_DCLK
|
||||
select S3C24XX_SIMTEC_NOR
|
||||
select S3C24XX_SIMTEC_PM if PM
|
||||
select S3C24XX_SIMTEC_USB
|
||||
@ -340,7 +330,7 @@ config MACH_TCT_HAMMER
|
||||
config MACH_VR1000
|
||||
bool "Thorcom VR1000"
|
||||
select MACH_BAST_IDE
|
||||
select S3C24XX_DCLK
|
||||
select S3C2410_COMMON_DCLK
|
||||
select S3C24XX_SIMTEC_NOR
|
||||
select S3C24XX_SIMTEC_PM if PM
|
||||
select S3C24XX_SIMTEC_USB
|
||||
@ -519,8 +509,8 @@ comment "S3C2440 Boards"
|
||||
config MACH_ANUBIS
|
||||
bool "Simtec Electronics ANUBIS"
|
||||
select HAVE_PATA_PLATFORM
|
||||
select S3C2410_COMMON_DCLK
|
||||
select S3C2440_XTAL_12000000
|
||||
select S3C24XX_DCLK
|
||||
select S3C24XX_SIMTEC_PM if PM
|
||||
select S3C_DEV_USB_HOST
|
||||
help
|
||||
@ -558,9 +548,9 @@ config MACH_NEXCODER_2440
|
||||
|
||||
config MACH_OSIRIS
|
||||
bool "Simtec IM2440D20 (OSIRIS) module"
|
||||
select S3C2410_COMMON_DCLK
|
||||
select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ
|
||||
select S3C2440_XTAL_12000000
|
||||
select S3C24XX_DCLK
|
||||
select S3C24XX_SIMTEC_PM if PM
|
||||
select S3C_DEV_NAND
|
||||
select S3C_DEV_USB_HOST
|
||||
@ -629,9 +619,9 @@ config MACH_RX1950
|
||||
bool "HP iPAQ rx1950"
|
||||
select I2C
|
||||
select PM_H1940 if PM
|
||||
select S3C2410_COMMON_DCLK
|
||||
select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ
|
||||
select S3C2440_XTAL_16934400
|
||||
select S3C24XX_DCLK
|
||||
select S3C24XX_PWM
|
||||
select S3C_DEV_NAND
|
||||
help
|
||||
@ -641,12 +631,6 @@ endif # CPU_S3C2442
|
||||
|
||||
if CPU_S3C2443 || CPU_S3C2416
|
||||
|
||||
config S3C2443_COMMON
|
||||
bool
|
||||
help
|
||||
Common code for the S3C2443 and similar processors, which includes
|
||||
the S3C2416 and S3C2450.
|
||||
|
||||
config S3C2443_DMA
|
||||
bool
|
||||
help
|
||||
|
@ -21,22 +21,22 @@ obj-$(CONFIG_S3C2410_DMA) += dma-s3c2410.o
|
||||
obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o
|
||||
obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o
|
||||
|
||||
obj-$(CONFIG_CPU_S3C2412) += s3c2412.o clock-s3c2412.o
|
||||
obj-$(CONFIG_CPU_S3C2412) += s3c2412.o
|
||||
obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o
|
||||
obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o
|
||||
obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o
|
||||
|
||||
obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock-s3c2416.o
|
||||
obj-$(CONFIG_CPU_S3C2416) += s3c2416.o
|
||||
obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o
|
||||
|
||||
obj-$(CONFIG_CPU_S3C2440) += s3c2440.o clock-s3c2440.o
|
||||
obj-$(CONFIG_CPU_S3C2440) += s3c2440.o
|
||||
obj-$(CONFIG_CPU_S3C2442) += s3c2442.o
|
||||
obj-$(CONFIG_CPU_S3C244X) += s3c244x.o clock-s3c244x.o
|
||||
obj-$(CONFIG_CPU_S3C244X) += s3c244x.o
|
||||
obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o
|
||||
obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o
|
||||
obj-$(CONFIG_S3C2440_PLL_16934400) += pll-s3c2440-16934400.o
|
||||
|
||||
obj-$(CONFIG_CPU_S3C2443) += s3c2443.o clock-s3c2443.o
|
||||
obj-$(CONFIG_CPU_S3C2443) += s3c2443.o
|
||||
|
||||
# PM
|
||||
|
||||
@ -44,16 +44,13 @@ obj-$(CONFIG_PM) += pm.o irq-pm.o sleep.o
|
||||
|
||||
# common code
|
||||
|
||||
obj-$(CONFIG_S3C24XX_DCLK) += clock-dclk.o
|
||||
obj-$(CONFIG_S3C24XX_DMA) += dma.o
|
||||
|
||||
obj-$(CONFIG_S3C2410_CLOCK) += clock-s3c2410.o
|
||||
obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += cpufreq-utils.o
|
||||
|
||||
obj-$(CONFIG_S3C2410_IOTIMING) += iotiming-s3c2410.o
|
||||
obj-$(CONFIG_S3C2412_IOTIMING) += iotiming-s3c2412.o
|
||||
|
||||
obj-$(CONFIG_S3C2443_COMMON) += common-s3c2443.o
|
||||
obj-$(CONFIG_S3C2443_DMA) += dma-s3c2443.o
|
||||
|
||||
#
|
||||
|
@ -1,195 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2008 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
* http://armlinux.simtec.co.uk/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* S3C24XX - definitions for DCLK and CLKOUT registers
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <mach/regs-clock.h>
|
||||
#include <mach/regs-gpio.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/cpu.h>
|
||||
|
||||
/* clocks that could be registered by external code */
|
||||
|
||||
static int s3c24xx_dclk_enable(struct clk *clk, int enable)
|
||||
{
|
||||
unsigned long dclkcon = __raw_readl(S3C24XX_DCLKCON);
|
||||
|
||||
if (enable)
|
||||
dclkcon |= clk->ctrlbit;
|
||||
else
|
||||
dclkcon &= ~clk->ctrlbit;
|
||||
|
||||
__raw_writel(dclkcon, S3C24XX_DCLKCON);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int s3c24xx_dclk_setparent(struct clk *clk, struct clk *parent)
|
||||
{
|
||||
unsigned long dclkcon;
|
||||
unsigned int uclk;
|
||||
|
||||
if (parent == &clk_upll)
|
||||
uclk = 1;
|
||||
else if (parent == &clk_p)
|
||||
uclk = 0;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
clk->parent = parent;
|
||||
|
||||
dclkcon = __raw_readl(S3C24XX_DCLKCON);
|
||||
|
||||
if (clk->ctrlbit == S3C2410_DCLKCON_DCLK0EN) {
|
||||
if (uclk)
|
||||
dclkcon |= S3C2410_DCLKCON_DCLK0_UCLK;
|
||||
else
|
||||
dclkcon &= ~S3C2410_DCLKCON_DCLK0_UCLK;
|
||||
} else {
|
||||
if (uclk)
|
||||
dclkcon |= S3C2410_DCLKCON_DCLK1_UCLK;
|
||||
else
|
||||
dclkcon &= ~S3C2410_DCLKCON_DCLK1_UCLK;
|
||||
}
|
||||
|
||||
__raw_writel(dclkcon, S3C24XX_DCLKCON);
|
||||
|
||||
return 0;
|
||||
}
|
||||
static unsigned long s3c24xx_calc_div(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
unsigned long div;
|
||||
|
||||
if ((rate == 0) || !clk->parent)
|
||||
return 0;
|
||||
|
||||
div = clk_get_rate(clk->parent) / rate;
|
||||
if (div < 2)
|
||||
div = 2;
|
||||
else if (div > 16)
|
||||
div = 16;
|
||||
|
||||
return div;
|
||||
}
|
||||
|
||||
static unsigned long s3c24xx_round_dclk_rate(struct clk *clk,
|
||||
unsigned long rate)
|
||||
{
|
||||
unsigned long div = s3c24xx_calc_div(clk, rate);
|
||||
|
||||
if (div == 0)
|
||||
return 0;
|
||||
|
||||
return clk_get_rate(clk->parent) / div;
|
||||
}
|
||||
|
||||
static int s3c24xx_set_dclk_rate(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
unsigned long mask, data, div = s3c24xx_calc_div(clk, rate);
|
||||
|
||||
if (div == 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (clk == &s3c24xx_dclk0) {
|
||||
mask = S3C2410_DCLKCON_DCLK0_DIV_MASK |
|
||||
S3C2410_DCLKCON_DCLK0_CMP_MASK;
|
||||
data = S3C2410_DCLKCON_DCLK0_DIV(div) |
|
||||
S3C2410_DCLKCON_DCLK0_CMP((div + 1) / 2);
|
||||
} else if (clk == &s3c24xx_dclk1) {
|
||||
mask = S3C2410_DCLKCON_DCLK1_DIV_MASK |
|
||||
S3C2410_DCLKCON_DCLK1_CMP_MASK;
|
||||
data = S3C2410_DCLKCON_DCLK1_DIV(div) |
|
||||
S3C2410_DCLKCON_DCLK1_CMP((div + 1) / 2);
|
||||
} else
|
||||
return -EINVAL;
|
||||
|
||||
clk->rate = clk_get_rate(clk->parent) / div;
|
||||
__raw_writel(((__raw_readl(S3C24XX_DCLKCON) & ~mask) | data),
|
||||
S3C24XX_DCLKCON);
|
||||
return clk->rate;
|
||||
}
|
||||
static int s3c24xx_clkout_setparent(struct clk *clk, struct clk *parent)
|
||||
{
|
||||
unsigned long mask;
|
||||
unsigned long source;
|
||||
|
||||
/* calculate the MISCCR setting for the clock */
|
||||
|
||||
if (parent == &clk_mpll)
|
||||
source = S3C2410_MISCCR_CLK0_MPLL;
|
||||
else if (parent == &clk_upll)
|
||||
source = S3C2410_MISCCR_CLK0_UPLL;
|
||||
else if (parent == &clk_f)
|
||||
source = S3C2410_MISCCR_CLK0_FCLK;
|
||||
else if (parent == &clk_h)
|
||||
source = S3C2410_MISCCR_CLK0_HCLK;
|
||||
else if (parent == &clk_p)
|
||||
source = S3C2410_MISCCR_CLK0_PCLK;
|
||||
else if (clk == &s3c24xx_clkout0 && parent == &s3c24xx_dclk0)
|
||||
source = S3C2410_MISCCR_CLK0_DCLK0;
|
||||
else if (clk == &s3c24xx_clkout1 && parent == &s3c24xx_dclk1)
|
||||
source = S3C2410_MISCCR_CLK0_DCLK0;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
clk->parent = parent;
|
||||
|
||||
if (clk == &s3c24xx_clkout0)
|
||||
mask = S3C2410_MISCCR_CLK0_MASK;
|
||||
else {
|
||||
source <<= 4;
|
||||
mask = S3C2410_MISCCR_CLK1_MASK;
|
||||
}
|
||||
|
||||
s3c2410_modify_misccr(mask, source);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* external clock definitions */
|
||||
|
||||
static struct clk_ops dclk_ops = {
|
||||
.set_parent = s3c24xx_dclk_setparent,
|
||||
.set_rate = s3c24xx_set_dclk_rate,
|
||||
.round_rate = s3c24xx_round_dclk_rate,
|
||||
};
|
||||
|
||||
struct clk s3c24xx_dclk0 = {
|
||||
.name = "dclk0",
|
||||
.ctrlbit = S3C2410_DCLKCON_DCLK0EN,
|
||||
.enable = s3c24xx_dclk_enable,
|
||||
.ops = &dclk_ops,
|
||||
};
|
||||
|
||||
struct clk s3c24xx_dclk1 = {
|
||||
.name = "dclk1",
|
||||
.ctrlbit = S3C2410_DCLKCON_DCLK1EN,
|
||||
.enable = s3c24xx_dclk_enable,
|
||||
.ops = &dclk_ops,
|
||||
};
|
||||
|
||||
static struct clk_ops clkout_ops = {
|
||||
.set_parent = s3c24xx_clkout_setparent,
|
||||
};
|
||||
|
||||
struct clk s3c24xx_clkout0 = {
|
||||
.name = "clkout0",
|
||||
.ops = &clkout_ops,
|
||||
};
|
||||
|
||||
struct clk s3c24xx_clkout1 = {
|
||||
.name = "clkout1",
|
||||
.ops = &clkout_ops,
|
||||
};
|
@ -1,284 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C2410,S3C2440,S3C2442 Clock control support
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/serial_core.h>
|
||||
#include <linux/serial_s3c.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include <mach/hardware.h>
|
||||
#include <mach/regs-clock.h>
|
||||
#include <mach/regs-gpio.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/cpu.h>
|
||||
|
||||
int s3c2410_clkcon_enable(struct clk *clk, int enable)
|
||||
{
|
||||
unsigned int clocks = clk->ctrlbit;
|
||||
unsigned long clkcon;
|
||||
|
||||
clkcon = __raw_readl(S3C2410_CLKCON);
|
||||
|
||||
if (enable)
|
||||
clkcon |= clocks;
|
||||
else
|
||||
clkcon &= ~clocks;
|
||||
|
||||
/* ensure none of the special function bits set */
|
||||
clkcon &= ~(S3C2410_CLKCON_IDLE|S3C2410_CLKCON_POWER);
|
||||
|
||||
__raw_writel(clkcon, S3C2410_CLKCON);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int s3c2410_upll_enable(struct clk *clk, int enable)
|
||||
{
|
||||
unsigned long clkslow = __raw_readl(S3C2410_CLKSLOW);
|
||||
unsigned long orig = clkslow;
|
||||
|
||||
if (enable)
|
||||
clkslow &= ~S3C2410_CLKSLOW_UCLK_OFF;
|
||||
else
|
||||
clkslow |= S3C2410_CLKSLOW_UCLK_OFF;
|
||||
|
||||
__raw_writel(clkslow, S3C2410_CLKSLOW);
|
||||
|
||||
/* if we started the UPLL, then allow to settle */
|
||||
|
||||
if (enable && (orig & S3C2410_CLKSLOW_UCLK_OFF))
|
||||
udelay(200);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* standard clock definitions */
|
||||
|
||||
static struct clk init_clocks_off[] = {
|
||||
{
|
||||
.name = "nand",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2410_CLKCON_NAND,
|
||||
}, {
|
||||
.name = "sdi",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2410_CLKCON_SDI,
|
||||
}, {
|
||||
.name = "adc",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2410_CLKCON_ADC,
|
||||
}, {
|
||||
.name = "i2c",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2410_CLKCON_IIC,
|
||||
}, {
|
||||
.name = "iis",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2410_CLKCON_IIS,
|
||||
}, {
|
||||
.name = "spi",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2410_CLKCON_SPI,
|
||||
}
|
||||
};
|
||||
|
||||
static struct clk clk_lcd = {
|
||||
.name = "lcd",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2410_CLKCON_LCDC,
|
||||
};
|
||||
|
||||
static struct clk clk_gpio = {
|
||||
.name = "gpio",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2410_CLKCON_GPIO,
|
||||
};
|
||||
|
||||
static struct clk clk_usb_host = {
|
||||
.name = "usb-host",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2410_CLKCON_USBH,
|
||||
};
|
||||
|
||||
static struct clk clk_usb_device = {
|
||||
.name = "usb-device",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2410_CLKCON_USBD,
|
||||
};
|
||||
|
||||
static struct clk clk_timers = {
|
||||
.name = "timers",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2410_CLKCON_PWMT,
|
||||
};
|
||||
|
||||
struct clk s3c24xx_clk_uart0 = {
|
||||
.name = "uart",
|
||||
.devname = "s3c2410-uart.0",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2410_CLKCON_UART0,
|
||||
};
|
||||
|
||||
struct clk s3c24xx_clk_uart1 = {
|
||||
.name = "uart",
|
||||
.devname = "s3c2410-uart.1",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2410_CLKCON_UART1,
|
||||
};
|
||||
|
||||
struct clk s3c24xx_clk_uart2 = {
|
||||
.name = "uart",
|
||||
.devname = "s3c2410-uart.2",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2410_CLKCON_UART2,
|
||||
};
|
||||
|
||||
static struct clk clk_rtc = {
|
||||
.name = "rtc",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2410_CLKCON_RTC,
|
||||
};
|
||||
|
||||
static struct clk clk_watchdog = {
|
||||
.name = "watchdog",
|
||||
.parent = &clk_p,
|
||||
.ctrlbit = 0,
|
||||
};
|
||||
|
||||
static struct clk clk_usb_bus_host = {
|
||||
.name = "usb-bus-host",
|
||||
.parent = &clk_usb_bus,
|
||||
};
|
||||
|
||||
static struct clk clk_usb_bus_gadget = {
|
||||
.name = "usb-bus-gadget",
|
||||
.parent = &clk_usb_bus,
|
||||
};
|
||||
|
||||
static struct clk *init_clocks[] = {
|
||||
&clk_lcd,
|
||||
&clk_gpio,
|
||||
&clk_usb_host,
|
||||
&clk_usb_device,
|
||||
&clk_timers,
|
||||
&s3c24xx_clk_uart0,
|
||||
&s3c24xx_clk_uart1,
|
||||
&s3c24xx_clk_uart2,
|
||||
&clk_rtc,
|
||||
&clk_watchdog,
|
||||
&clk_usb_bus_host,
|
||||
&clk_usb_bus_gadget,
|
||||
};
|
||||
|
||||
/* s3c2410_baseclk_add()
|
||||
*
|
||||
* Add all the clocks used by the s3c2410 or compatible CPUs
|
||||
* such as the S3C2440 and S3C2442.
|
||||
*
|
||||
* We cannot use a system device as we are needed before any
|
||||
* of the init-calls that initialise the devices are actually
|
||||
* done.
|
||||
*/
|
||||
|
||||
int __init s3c2410_baseclk_add(void)
|
||||
{
|
||||
unsigned long clkslow = __raw_readl(S3C2410_CLKSLOW);
|
||||
unsigned long clkcon = __raw_readl(S3C2410_CLKCON);
|
||||
struct clk *xtal;
|
||||
int ret;
|
||||
int ptr;
|
||||
|
||||
clk_upll.enable = s3c2410_upll_enable;
|
||||
|
||||
if (s3c24xx_register_clock(&clk_usb_bus) < 0)
|
||||
printk(KERN_ERR "failed to register usb bus clock\n");
|
||||
|
||||
/* register clocks from clock array */
|
||||
|
||||
for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++) {
|
||||
struct clk *clkp = init_clocks[ptr];
|
||||
|
||||
/* ensure that we note the clock state */
|
||||
|
||||
clkp->usage = clkcon & clkp->ctrlbit ? 1 : 0;
|
||||
|
||||
ret = s3c24xx_register_clock(clkp);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "Failed to register clock %s (%d)\n",
|
||||
clkp->name, ret);
|
||||
}
|
||||
}
|
||||
|
||||
/* We must be careful disabling the clocks we are not intending to
|
||||
* be using at boot time, as subsystems such as the LCD which do
|
||||
* their own DMA requests to the bus can cause the system to lockup
|
||||
* if they where in the middle of requesting bus access.
|
||||
*
|
||||
* Disabling the LCD clock if the LCD is active is very dangerous,
|
||||
* and therefore the bootloader should be careful to not enable
|
||||
* the LCD clock if it is not needed.
|
||||
*/
|
||||
|
||||
/* install (and disable) the clocks we do not need immediately */
|
||||
|
||||
s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
|
||||
s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
|
||||
|
||||
/* show the clock-slow value */
|
||||
|
||||
xtal = clk_get(NULL, "xtal");
|
||||
|
||||
printk("CLOCK: Slow mode (%ld.%ld MHz), %s, MPLL %s, UPLL %s\n",
|
||||
print_mhz(clk_get_rate(xtal) /
|
||||
( 2 * S3C2410_CLKSLOW_GET_SLOWVAL(clkslow))),
|
||||
(clkslow & S3C2410_CLKSLOW_SLOW) ? "slow" : "fast",
|
||||
(clkslow & S3C2410_CLKSLOW_MPLL_OFF) ? "off" : "on",
|
||||
(clkslow & S3C2410_CLKSLOW_UCLK_OFF) ? "off" : "on");
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,760 +0,0 @@
|
||||
/* linux/arch/arm/mach-s3c2412/clock.c
|
||||
*
|
||||
* Copyright (c) 2006 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C2412,S3C2413 Clock control support
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/serial_core.h>
|
||||
#include <linux/serial_s3c.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include <mach/hardware.h>
|
||||
#include <mach/regs-clock.h>
|
||||
#include <mach/regs-gpio.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/cpu.h>
|
||||
|
||||
/* We currently have to assume that the system is running
|
||||
* from the XTPll input, and that all ***REFCLKs are being
|
||||
* fed from it, as we cannot read the state of OM[4] from
|
||||
* software.
|
||||
*
|
||||
* It would be possible for each board initialisation to
|
||||
* set the correct muxing at initialisation
|
||||
*/
|
||||
|
||||
static int s3c2412_clkcon_enable(struct clk *clk, int enable)
|
||||
{
|
||||
unsigned int clocks = clk->ctrlbit;
|
||||
unsigned long clkcon;
|
||||
|
||||
clkcon = __raw_readl(S3C2410_CLKCON);
|
||||
|
||||
if (enable)
|
||||
clkcon |= clocks;
|
||||
else
|
||||
clkcon &= ~clocks;
|
||||
|
||||
__raw_writel(clkcon, S3C2410_CLKCON);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int s3c2412_upll_enable(struct clk *clk, int enable)
|
||||
{
|
||||
unsigned long upllcon = __raw_readl(S3C2410_UPLLCON);
|
||||
unsigned long orig = upllcon;
|
||||
|
||||
if (!enable)
|
||||
upllcon |= S3C2412_PLLCON_OFF;
|
||||
else
|
||||
upllcon &= ~S3C2412_PLLCON_OFF;
|
||||
|
||||
__raw_writel(upllcon, S3C2410_UPLLCON);
|
||||
|
||||
/* allow ~150uS for the PLL to settle and lock */
|
||||
|
||||
if (enable && (orig & S3C2412_PLLCON_OFF))
|
||||
udelay(150);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* clock selections */
|
||||
|
||||
static struct clk clk_erefclk = {
|
||||
.name = "erefclk",
|
||||
};
|
||||
|
||||
static struct clk clk_urefclk = {
|
||||
.name = "urefclk",
|
||||
};
|
||||
|
||||
static int s3c2412_setparent_usysclk(struct clk *clk, struct clk *parent)
|
||||
{
|
||||
unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
|
||||
|
||||
if (parent == &clk_urefclk)
|
||||
clksrc &= ~S3C2412_CLKSRC_USYSCLK_UPLL;
|
||||
else if (parent == &clk_upll)
|
||||
clksrc |= S3C2412_CLKSRC_USYSCLK_UPLL;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
clk->parent = parent;
|
||||
|
||||
__raw_writel(clksrc, S3C2412_CLKSRC);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct clk clk_usysclk = {
|
||||
.name = "usysclk",
|
||||
.parent = &clk_xtal,
|
||||
.ops = &(struct clk_ops) {
|
||||
.set_parent = s3c2412_setparent_usysclk,
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk clk_mrefclk = {
|
||||
.name = "mrefclk",
|
||||
.parent = &clk_xtal,
|
||||
};
|
||||
|
||||
static struct clk clk_mdivclk = {
|
||||
.name = "mdivclk",
|
||||
.parent = &clk_xtal,
|
||||
};
|
||||
|
||||
static int s3c2412_setparent_usbsrc(struct clk *clk, struct clk *parent)
|
||||
{
|
||||
unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
|
||||
|
||||
if (parent == &clk_usysclk)
|
||||
clksrc &= ~S3C2412_CLKSRC_USBCLK_HCLK;
|
||||
else if (parent == &clk_h)
|
||||
clksrc |= S3C2412_CLKSRC_USBCLK_HCLK;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
clk->parent = parent;
|
||||
|
||||
__raw_writel(clksrc, S3C2412_CLKSRC);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned long s3c2412_roundrate_usbsrc(struct clk *clk,
|
||||
unsigned long rate)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
int div;
|
||||
|
||||
if (rate > parent_rate)
|
||||
return parent_rate;
|
||||
|
||||
div = parent_rate / rate;
|
||||
if (div > 2)
|
||||
div = 2;
|
||||
|
||||
return parent_rate / div;
|
||||
}
|
||||
|
||||
static unsigned long s3c2412_getrate_usbsrc(struct clk *clk)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
unsigned long div = __raw_readl(S3C2410_CLKDIVN);
|
||||
|
||||
return parent_rate / ((div & S3C2412_CLKDIVN_USB48DIV) ? 2 : 1);
|
||||
}
|
||||
|
||||
static int s3c2412_setrate_usbsrc(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN);
|
||||
|
||||
rate = s3c2412_roundrate_usbsrc(clk, rate);
|
||||
|
||||
if ((parent_rate / rate) == 2)
|
||||
clkdivn |= S3C2412_CLKDIVN_USB48DIV;
|
||||
else
|
||||
clkdivn &= ~S3C2412_CLKDIVN_USB48DIV;
|
||||
|
||||
__raw_writel(clkdivn, S3C2410_CLKDIVN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct clk clk_usbsrc = {
|
||||
.name = "usbsrc",
|
||||
.ops = &(struct clk_ops) {
|
||||
.get_rate = s3c2412_getrate_usbsrc,
|
||||
.set_rate = s3c2412_setrate_usbsrc,
|
||||
.round_rate = s3c2412_roundrate_usbsrc,
|
||||
.set_parent = s3c2412_setparent_usbsrc,
|
||||
},
|
||||
};
|
||||
|
||||
static int s3c2412_setparent_msysclk(struct clk *clk, struct clk *parent)
|
||||
{
|
||||
unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
|
||||
|
||||
if (parent == &clk_mdivclk)
|
||||
clksrc &= ~S3C2412_CLKSRC_MSYSCLK_MPLL;
|
||||
else if (parent == &clk_mpll)
|
||||
clksrc |= S3C2412_CLKSRC_MSYSCLK_MPLL;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
clk->parent = parent;
|
||||
|
||||
__raw_writel(clksrc, S3C2412_CLKSRC);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct clk clk_msysclk = {
|
||||
.name = "msysclk",
|
||||
.ops = &(struct clk_ops) {
|
||||
.set_parent = s3c2412_setparent_msysclk,
|
||||
},
|
||||
};
|
||||
|
||||
static int s3c2412_setparent_armclk(struct clk *clk, struct clk *parent)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned long clkdiv;
|
||||
unsigned long dvs;
|
||||
|
||||
/* Note, we current equate fclk andf msysclk for S3C2412 */
|
||||
|
||||
if (parent == &clk_msysclk || parent == &clk_f)
|
||||
dvs = 0;
|
||||
else if (parent == &clk_h)
|
||||
dvs = S3C2412_CLKDIVN_DVSEN;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
clk->parent = parent;
|
||||
|
||||
/* update this under irq lockdown, clkdivn is not protected
|
||||
* by the clock system. */
|
||||
|
||||
local_irq_save(flags);
|
||||
|
||||
clkdiv = __raw_readl(S3C2410_CLKDIVN);
|
||||
clkdiv &= ~S3C2412_CLKDIVN_DVSEN;
|
||||
clkdiv |= dvs;
|
||||
__raw_writel(clkdiv, S3C2410_CLKDIVN);
|
||||
|
||||
local_irq_restore(flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct clk clk_armclk = {
|
||||
.name = "armclk",
|
||||
.parent = &clk_msysclk,
|
||||
.ops = &(struct clk_ops) {
|
||||
.set_parent = s3c2412_setparent_armclk,
|
||||
},
|
||||
};
|
||||
|
||||
/* these next clocks have an divider immediately after them,
|
||||
* so we can register them with their divider and leave out the
|
||||
* intermediate clock stage
|
||||
*/
|
||||
static unsigned long s3c2412_roundrate_clksrc(struct clk *clk,
|
||||
unsigned long rate)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
int div;
|
||||
|
||||
if (rate > parent_rate)
|
||||
return parent_rate;
|
||||
|
||||
/* note, we remove the +/- 1 calculations as they cancel out */
|
||||
|
||||
div = (rate / parent_rate);
|
||||
|
||||
if (div < 1)
|
||||
div = 1;
|
||||
else if (div > 16)
|
||||
div = 16;
|
||||
|
||||
return parent_rate / div;
|
||||
}
|
||||
|
||||
static int s3c2412_setparent_uart(struct clk *clk, struct clk *parent)
|
||||
{
|
||||
unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
|
||||
|
||||
if (parent == &clk_erefclk)
|
||||
clksrc &= ~S3C2412_CLKSRC_UARTCLK_MPLL;
|
||||
else if (parent == &clk_mpll)
|
||||
clksrc |= S3C2412_CLKSRC_UARTCLK_MPLL;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
clk->parent = parent;
|
||||
|
||||
__raw_writel(clksrc, S3C2412_CLKSRC);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned long s3c2412_getrate_uart(struct clk *clk)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
unsigned long div = __raw_readl(S3C2410_CLKDIVN);
|
||||
|
||||
div &= S3C2412_CLKDIVN_UARTDIV_MASK;
|
||||
div >>= S3C2412_CLKDIVN_UARTDIV_SHIFT;
|
||||
|
||||
return parent_rate / (div + 1);
|
||||
}
|
||||
|
||||
static int s3c2412_setrate_uart(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN);
|
||||
|
||||
rate = s3c2412_roundrate_clksrc(clk, rate);
|
||||
|
||||
clkdivn &= ~S3C2412_CLKDIVN_UARTDIV_MASK;
|
||||
clkdivn |= ((parent_rate / rate) - 1) << S3C2412_CLKDIVN_UARTDIV_SHIFT;
|
||||
|
||||
__raw_writel(clkdivn, S3C2410_CLKDIVN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct clk clk_uart = {
|
||||
.name = "uartclk",
|
||||
.ops = &(struct clk_ops) {
|
||||
.get_rate = s3c2412_getrate_uart,
|
||||
.set_rate = s3c2412_setrate_uart,
|
||||
.set_parent = s3c2412_setparent_uart,
|
||||
.round_rate = s3c2412_roundrate_clksrc,
|
||||
},
|
||||
};
|
||||
|
||||
static int s3c2412_setparent_i2s(struct clk *clk, struct clk *parent)
|
||||
{
|
||||
unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
|
||||
|
||||
if (parent == &clk_erefclk)
|
||||
clksrc &= ~S3C2412_CLKSRC_I2SCLK_MPLL;
|
||||
else if (parent == &clk_mpll)
|
||||
clksrc |= S3C2412_CLKSRC_I2SCLK_MPLL;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
clk->parent = parent;
|
||||
|
||||
__raw_writel(clksrc, S3C2412_CLKSRC);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned long s3c2412_getrate_i2s(struct clk *clk)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
unsigned long div = __raw_readl(S3C2410_CLKDIVN);
|
||||
|
||||
div &= S3C2412_CLKDIVN_I2SDIV_MASK;
|
||||
div >>= S3C2412_CLKDIVN_I2SDIV_SHIFT;
|
||||
|
||||
return parent_rate / (div + 1);
|
||||
}
|
||||
|
||||
static int s3c2412_setrate_i2s(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN);
|
||||
|
||||
rate = s3c2412_roundrate_clksrc(clk, rate);
|
||||
|
||||
clkdivn &= ~S3C2412_CLKDIVN_I2SDIV_MASK;
|
||||
clkdivn |= ((parent_rate / rate) - 1) << S3C2412_CLKDIVN_I2SDIV_SHIFT;
|
||||
|
||||
__raw_writel(clkdivn, S3C2410_CLKDIVN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct clk clk_i2s = {
|
||||
.name = "i2sclk",
|
||||
.ops = &(struct clk_ops) {
|
||||
.get_rate = s3c2412_getrate_i2s,
|
||||
.set_rate = s3c2412_setrate_i2s,
|
||||
.set_parent = s3c2412_setparent_i2s,
|
||||
.round_rate = s3c2412_roundrate_clksrc,
|
||||
},
|
||||
};
|
||||
|
||||
static int s3c2412_setparent_cam(struct clk *clk, struct clk *parent)
|
||||
{
|
||||
unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
|
||||
|
||||
if (parent == &clk_usysclk)
|
||||
clksrc &= ~S3C2412_CLKSRC_CAMCLK_HCLK;
|
||||
else if (parent == &clk_h)
|
||||
clksrc |= S3C2412_CLKSRC_CAMCLK_HCLK;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
clk->parent = parent;
|
||||
|
||||
__raw_writel(clksrc, S3C2412_CLKSRC);
|
||||
return 0;
|
||||
}
|
||||
static unsigned long s3c2412_getrate_cam(struct clk *clk)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
unsigned long div = __raw_readl(S3C2410_CLKDIVN);
|
||||
|
||||
div &= S3C2412_CLKDIVN_CAMDIV_MASK;
|
||||
div >>= S3C2412_CLKDIVN_CAMDIV_SHIFT;
|
||||
|
||||
return parent_rate / (div + 1);
|
||||
}
|
||||
|
||||
static int s3c2412_setrate_cam(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN);
|
||||
|
||||
rate = s3c2412_roundrate_clksrc(clk, rate);
|
||||
|
||||
clkdivn &= ~S3C2412_CLKDIVN_CAMDIV_MASK;
|
||||
clkdivn |= ((parent_rate / rate) - 1) << S3C2412_CLKDIVN_CAMDIV_SHIFT;
|
||||
|
||||
__raw_writel(clkdivn, S3C2410_CLKDIVN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct clk clk_cam = {
|
||||
.name = "camif-upll", /* same as 2440 name */
|
||||
.ops = &(struct clk_ops) {
|
||||
.get_rate = s3c2412_getrate_cam,
|
||||
.set_rate = s3c2412_setrate_cam,
|
||||
.set_parent = s3c2412_setparent_cam,
|
||||
.round_rate = s3c2412_roundrate_clksrc,
|
||||
},
|
||||
};
|
||||
|
||||
/* standard clock definitions */
|
||||
|
||||
static struct clk init_clocks_disable[] = {
|
||||
{
|
||||
.name = "nand",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_NAND,
|
||||
}, {
|
||||
.name = "sdi",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_SDI,
|
||||
}, {
|
||||
.name = "adc",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_ADC,
|
||||
}, {
|
||||
.name = "i2c",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_IIC,
|
||||
}, {
|
||||
.name = "iis",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_IIS,
|
||||
}, {
|
||||
.name = "spi",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_SPI,
|
||||
}
|
||||
};
|
||||
|
||||
static struct clk init_clocks[] = {
|
||||
{
|
||||
.name = "dma.0",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_DMA0,
|
||||
}, {
|
||||
.name = "dma.1",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_DMA1,
|
||||
}, {
|
||||
.name = "dma.2",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_DMA2,
|
||||
}, {
|
||||
.name = "dma.3",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_DMA3,
|
||||
}, {
|
||||
.name = "lcd",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_LCDC,
|
||||
}, {
|
||||
.name = "gpio",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_GPIO,
|
||||
}, {
|
||||
.name = "usb-host",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_USBH,
|
||||
}, {
|
||||
.name = "usb-device",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_USBD,
|
||||
}, {
|
||||
.name = "timers",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_PWMT,
|
||||
}, {
|
||||
.name = "uart",
|
||||
.devname = "s3c2412-uart.0",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_UART0,
|
||||
}, {
|
||||
.name = "uart",
|
||||
.devname = "s3c2412-uart.1",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_UART1,
|
||||
}, {
|
||||
.name = "uart",
|
||||
.devname = "s3c2412-uart.2",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_UART2,
|
||||
}, {
|
||||
.name = "rtc",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_RTC,
|
||||
}, {
|
||||
.name = "watchdog",
|
||||
.parent = &clk_p,
|
||||
.ctrlbit = 0,
|
||||
}, {
|
||||
.name = "usb-bus-gadget",
|
||||
.parent = &clk_usb_bus,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_USB_DEV48,
|
||||
}, {
|
||||
.name = "usb-bus-host",
|
||||
.parent = &clk_usb_bus,
|
||||
.enable = s3c2412_clkcon_enable,
|
||||
.ctrlbit = S3C2412_CLKCON_USB_HOST48,
|
||||
}
|
||||
};
|
||||
|
||||
/* clocks to add where we need to check their parentage */
|
||||
|
||||
struct clk_init {
|
||||
struct clk *clk;
|
||||
unsigned int bit;
|
||||
struct clk *src_0;
|
||||
struct clk *src_1;
|
||||
};
|
||||
|
||||
static struct clk_init clks_src[] __initdata = {
|
||||
{
|
||||
.clk = &clk_usysclk,
|
||||
.bit = S3C2412_CLKSRC_USBCLK_HCLK,
|
||||
.src_0 = &clk_urefclk,
|
||||
.src_1 = &clk_upll,
|
||||
}, {
|
||||
.clk = &clk_i2s,
|
||||
.bit = S3C2412_CLKSRC_I2SCLK_MPLL,
|
||||
.src_0 = &clk_erefclk,
|
||||
.src_1 = &clk_mpll,
|
||||
}, {
|
||||
.clk = &clk_cam,
|
||||
.bit = S3C2412_CLKSRC_CAMCLK_HCLK,
|
||||
.src_0 = &clk_usysclk,
|
||||
.src_1 = &clk_h,
|
||||
}, {
|
||||
.clk = &clk_msysclk,
|
||||
.bit = S3C2412_CLKSRC_MSYSCLK_MPLL,
|
||||
.src_0 = &clk_mdivclk,
|
||||
.src_1 = &clk_mpll,
|
||||
}, {
|
||||
.clk = &clk_uart,
|
||||
.bit = S3C2412_CLKSRC_UARTCLK_MPLL,
|
||||
.src_0 = &clk_erefclk,
|
||||
.src_1 = &clk_mpll,
|
||||
}, {
|
||||
.clk = &clk_usbsrc,
|
||||
.bit = S3C2412_CLKSRC_USBCLK_HCLK,
|
||||
.src_0 = &clk_usysclk,
|
||||
.src_1 = &clk_h,
|
||||
/* here we assume OM[4] select xtal */
|
||||
}, {
|
||||
.clk = &clk_erefclk,
|
||||
.bit = S3C2412_CLKSRC_EREFCLK_EXTCLK,
|
||||
.src_0 = &clk_xtal,
|
||||
.src_1 = &clk_ext,
|
||||
}, {
|
||||
.clk = &clk_urefclk,
|
||||
.bit = S3C2412_CLKSRC_UREFCLK_EXTCLK,
|
||||
.src_0 = &clk_xtal,
|
||||
.src_1 = &clk_ext,
|
||||
},
|
||||
};
|
||||
|
||||
/* s3c2412_clk_initparents
|
||||
*
|
||||
* Initialise the parents for the clocks that we get at start-time
|
||||
*/
|
||||
|
||||
static void __init s3c2412_clk_initparents(void)
|
||||
{
|
||||
unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
|
||||
struct clk_init *cip = clks_src;
|
||||
struct clk *src;
|
||||
int ptr;
|
||||
int ret;
|
||||
|
||||
for (ptr = 0; ptr < ARRAY_SIZE(clks_src); ptr++, cip++) {
|
||||
ret = s3c24xx_register_clock(cip->clk);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "Failed to register clock %s (%d)\n",
|
||||
cip->clk->name, ret);
|
||||
}
|
||||
|
||||
src = (clksrc & cip->bit) ? cip->src_1 : cip->src_0;
|
||||
|
||||
printk(KERN_INFO "%s: parent %s\n", cip->clk->name, src->name);
|
||||
clk_set_parent(cip->clk, src);
|
||||
}
|
||||
}
|
||||
|
||||
/* clocks to add straight away */
|
||||
|
||||
static struct clk *clks[] __initdata = {
|
||||
&clk_ext,
|
||||
&clk_usb_bus,
|
||||
&clk_mrefclk,
|
||||
&clk_armclk,
|
||||
};
|
||||
|
||||
static struct clk_lookup s3c2412_clk_lookup[] = {
|
||||
CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk),
|
||||
CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
|
||||
CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_usysclk),
|
||||
};
|
||||
|
||||
int __init s3c2412_baseclk_add(void)
|
||||
{
|
||||
unsigned long clkcon = __raw_readl(S3C2410_CLKCON);
|
||||
unsigned int dvs;
|
||||
struct clk *clkp;
|
||||
int ret;
|
||||
int ptr;
|
||||
|
||||
clk_upll.enable = s3c2412_upll_enable;
|
||||
clk_usb_bus.parent = &clk_usbsrc;
|
||||
clk_usb_bus.rate = 0x0;
|
||||
|
||||
clk_f.parent = &clk_msysclk;
|
||||
|
||||
s3c2412_clk_initparents();
|
||||
|
||||
for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) {
|
||||
clkp = clks[ptr];
|
||||
|
||||
ret = s3c24xx_register_clock(clkp);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "Failed to register clock %s (%d)\n",
|
||||
clkp->name, ret);
|
||||
}
|
||||
}
|
||||
|
||||
/* set the dvs state according to what we got at boot time */
|
||||
|
||||
dvs = __raw_readl(S3C2410_CLKDIVN) & S3C2412_CLKDIVN_DVSEN;
|
||||
|
||||
if (dvs)
|
||||
clk_armclk.parent = &clk_h;
|
||||
|
||||
printk(KERN_INFO "S3C2412: DVS is %s\n", dvs ? "on" : "off");
|
||||
|
||||
/* ensure usb bus clock is within correct rate of 48MHz */
|
||||
|
||||
if (clk_get_rate(&clk_usb_bus) != (48 * 1000 * 1000)) {
|
||||
printk(KERN_INFO "Warning: USB bus clock not at 48MHz\n");
|
||||
|
||||
/* for the moment, let's use the UPLL, and see if we can
|
||||
* get 48MHz */
|
||||
|
||||
clk_set_parent(&clk_usysclk, &clk_upll);
|
||||
clk_set_parent(&clk_usbsrc, &clk_usysclk);
|
||||
clk_set_rate(&clk_usbsrc, 48*1000*1000);
|
||||
}
|
||||
|
||||
printk("S3C2412: upll %s, %ld.%03ld MHz, usb-bus %ld.%03ld MHz\n",
|
||||
(__raw_readl(S3C2410_UPLLCON) & S3C2412_PLLCON_OFF) ? "off":"on",
|
||||
print_mhz(clk_get_rate(&clk_upll)),
|
||||
print_mhz(clk_get_rate(&clk_usb_bus)));
|
||||
|
||||
/* register clocks from clock array */
|
||||
|
||||
clkp = init_clocks;
|
||||
for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) {
|
||||
/* ensure that we note the clock state */
|
||||
|
||||
clkp->usage = clkcon & clkp->ctrlbit ? 1 : 0;
|
||||
|
||||
ret = s3c24xx_register_clock(clkp);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "Failed to register clock %s (%d)\n",
|
||||
clkp->name, ret);
|
||||
}
|
||||
}
|
||||
|
||||
/* We must be careful disabling the clocks we are not intending to
|
||||
* be using at boot time, as subsystems such as the LCD which do
|
||||
* their own DMA requests to the bus can cause the system to lockup
|
||||
* if they where in the middle of requesting bus access.
|
||||
*
|
||||
* Disabling the LCD clock if the LCD is active is very dangerous,
|
||||
* and therefore the bootloader should be careful to not enable
|
||||
* the LCD clock if it is not needed.
|
||||
*/
|
||||
|
||||
/* install (and disable) the clocks we do not need immediately */
|
||||
|
||||
clkp = init_clocks_disable;
|
||||
for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) {
|
||||
|
||||
ret = s3c24xx_register_clock(clkp);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "Failed to register clock %s (%d)\n",
|
||||
clkp->name, ret);
|
||||
}
|
||||
|
||||
s3c2412_clkcon_enable(clkp, 0);
|
||||
}
|
||||
|
||||
clkdev_add_table(s3c2412_clk_lookup, ARRAY_SIZE(s3c2412_clk_lookup));
|
||||
return 0;
|
||||
}
|
@ -1,171 +0,0 @@
|
||||
/* linux/arch/arm/mach-s3c2416/clock.c
|
||||
*
|
||||
* Copyright (c) 2010 Simtec Electronics
|
||||
* Copyright (c) 2010 Ben Dooks <ben-linux@fluff.org>
|
||||
*
|
||||
* S3C2416 Clock control support
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/clk.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/clock-clksrc.h>
|
||||
#include <plat/cpu.h>
|
||||
|
||||
#include <plat/cpu-freq.h>
|
||||
#include <plat/pll.h>
|
||||
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include <mach/regs-clock.h>
|
||||
#include <mach/regs-s3c2443-clock.h>
|
||||
|
||||
/* armdiv
|
||||
*
|
||||
* this clock is sourced from msysclk and can have a number of
|
||||
* divider values applied to it to then be fed into armclk.
|
||||
* The real clock definition is done in s3c2443-clock.c,
|
||||
* only the armdiv divisor table must be defined here.
|
||||
*/
|
||||
|
||||
static unsigned int armdiv[8] = {
|
||||
[0] = 1,
|
||||
[1] = 2,
|
||||
[2] = 3,
|
||||
[3] = 4,
|
||||
[5] = 6,
|
||||
[7] = 8,
|
||||
};
|
||||
|
||||
static struct clksrc_clk hsspi_eplldiv = {
|
||||
.clk = {
|
||||
.name = "hsspi-eplldiv",
|
||||
.parent = &clk_esysclk.clk,
|
||||
.ctrlbit = (1 << 14),
|
||||
.enable = s3c2443_clkcon_enable_s,
|
||||
},
|
||||
.reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 24 },
|
||||
};
|
||||
|
||||
static struct clk *hsspi_sources[] = {
|
||||
[0] = &hsspi_eplldiv.clk,
|
||||
[1] = NULL, /* to fix */
|
||||
};
|
||||
|
||||
static struct clksrc_clk hsspi_mux = {
|
||||
.clk = {
|
||||
.name = "hsspi-if",
|
||||
},
|
||||
.sources = &(struct clksrc_sources) {
|
||||
.sources = hsspi_sources,
|
||||
.nr_sources = ARRAY_SIZE(hsspi_sources),
|
||||
},
|
||||
.reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 18 },
|
||||
};
|
||||
|
||||
static struct clksrc_clk hsmmc_div[] = {
|
||||
[0] = {
|
||||
.clk = {
|
||||
.name = "hsmmc-div",
|
||||
.devname = "s3c-sdhci.0",
|
||||
.parent = &clk_esysclk.clk,
|
||||
},
|
||||
.reg_div = { .reg = S3C2416_CLKDIV2, .size = 2, .shift = 6 },
|
||||
},
|
||||
[1] = {
|
||||
.clk = {
|
||||
.name = "hsmmc-div",
|
||||
.devname = "s3c-sdhci.1",
|
||||
.parent = &clk_esysclk.clk,
|
||||
},
|
||||
.reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 },
|
||||
},
|
||||
};
|
||||
|
||||
static struct clksrc_clk hsmmc_mux0 = {
|
||||
.clk = {
|
||||
.name = "hsmmc-if",
|
||||
.devname = "s3c-sdhci.0",
|
||||
.ctrlbit = (1 << 6),
|
||||
.enable = s3c2443_clkcon_enable_s,
|
||||
},
|
||||
.sources = &(struct clksrc_sources) {
|
||||
.nr_sources = 2,
|
||||
.sources = (struct clk * []) {
|
||||
[0] = &hsmmc_div[0].clk,
|
||||
[1] = NULL, /* to fix */
|
||||
},
|
||||
},
|
||||
.reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 16 },
|
||||
};
|
||||
|
||||
static struct clksrc_clk hsmmc_mux1 = {
|
||||
.clk = {
|
||||
.name = "hsmmc-if",
|
||||
.devname = "s3c-sdhci.1",
|
||||
.ctrlbit = (1 << 12),
|
||||
.enable = s3c2443_clkcon_enable_s,
|
||||
},
|
||||
.sources = &(struct clksrc_sources) {
|
||||
.nr_sources = 2,
|
||||
.sources = (struct clk * []) {
|
||||
[0] = &hsmmc_div[1].clk,
|
||||
[1] = NULL, /* to fix */
|
||||
},
|
||||
},
|
||||
.reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 17 },
|
||||
};
|
||||
|
||||
static struct clk hsmmc0_clk = {
|
||||
.name = "hsmmc",
|
||||
.devname = "s3c-sdhci.0",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2443_clkcon_enable_h,
|
||||
.ctrlbit = S3C2416_HCLKCON_HSMMC0,
|
||||
};
|
||||
|
||||
static struct clksrc_clk *clksrcs[] __initdata = {
|
||||
&hsspi_eplldiv,
|
||||
&hsspi_mux,
|
||||
&hsmmc_div[0],
|
||||
&hsmmc_div[1],
|
||||
&hsmmc_mux0,
|
||||
&hsmmc_mux1,
|
||||
};
|
||||
|
||||
static struct clk_lookup s3c2416_clk_lookup[] = {
|
||||
CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.0", &hsmmc0_clk),
|
||||
CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &hsmmc_mux0.clk),
|
||||
CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &hsmmc_mux1.clk),
|
||||
/* s3c2443-spi.0 is used on s3c2416 and s3c2450 as well */
|
||||
CLKDEV_INIT("s3c2443-spi.0", "spi_busclk2", &hsspi_mux.clk),
|
||||
};
|
||||
|
||||
void __init s3c2416_init_clocks(int xtal)
|
||||
{
|
||||
u32 epllcon = __raw_readl(S3C2443_EPLLCON);
|
||||
u32 epllcon1 = __raw_readl(S3C2443_EPLLCON+4);
|
||||
int ptr;
|
||||
|
||||
/* s3c2416 EPLL compatible with s3c64xx */
|
||||
clk_epll.rate = s3c_get_pll6553x(xtal, epllcon, epllcon1);
|
||||
|
||||
clk_epll.parent = &clk_epllref.clk;
|
||||
|
||||
s3c2443_common_init_clocks(xtal, s3c2416_get_pll,
|
||||
armdiv, ARRAY_SIZE(armdiv),
|
||||
S3C2416_CLKDIV0_ARMDIV_MASK);
|
||||
|
||||
for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
|
||||
s3c_register_clksrc(clksrcs[ptr], 1);
|
||||
|
||||
s3c24xx_register_clock(&hsmmc0_clk);
|
||||
clkdev_add_table(s3c2416_clk_lookup, ARRAY_SIZE(s3c2416_clk_lookup));
|
||||
|
||||
}
|
@ -1,217 +0,0 @@
|
||||
/* linux/arch/arm/mach-s3c2440/clock.c
|
||||
*
|
||||
* Copyright (c) 2004-2005 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C2440 Clock support
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/serial_core.h>
|
||||
#include <linux/serial_s3c.h>
|
||||
|
||||
#include <mach/hardware.h>
|
||||
#include <linux/atomic.h>
|
||||
#include <asm/irq.h>
|
||||
|
||||
#include <mach/regs-clock.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/cpu.h>
|
||||
|
||||
/* S3C2440 extended clock support */
|
||||
|
||||
static unsigned long s3c2440_camif_upll_round(struct clk *clk,
|
||||
unsigned long rate)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
int div;
|
||||
|
||||
if (rate > parent_rate)
|
||||
return parent_rate;
|
||||
|
||||
/* note, we remove the +/- 1 calculations for the divisor */
|
||||
|
||||
div = (parent_rate / rate) / 2;
|
||||
|
||||
if (div < 1)
|
||||
div = 1;
|
||||
else if (div > 16)
|
||||
div = 16;
|
||||
|
||||
return parent_rate / (div * 2);
|
||||
}
|
||||
|
||||
static int s3c2440_camif_upll_setrate(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
|
||||
|
||||
rate = s3c2440_camif_upll_round(clk, rate);
|
||||
|
||||
camdivn &= ~(S3C2440_CAMDIVN_CAMCLK_SEL | S3C2440_CAMDIVN_CAMCLK_MASK);
|
||||
|
||||
if (rate != parent_rate) {
|
||||
camdivn |= S3C2440_CAMDIVN_CAMCLK_SEL;
|
||||
camdivn |= (((parent_rate / rate) / 2) - 1);
|
||||
}
|
||||
|
||||
__raw_writel(camdivn, S3C2440_CAMDIVN);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned long s3c2440_camif_upll_getrate(struct clk *clk)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
|
||||
|
||||
if (!(camdivn & S3C2440_CAMDIVN_CAMCLK_SEL))
|
||||
return parent_rate;
|
||||
|
||||
camdivn &= S3C2440_CAMDIVN_CAMCLK_MASK;
|
||||
|
||||
return parent_rate / (camdivn + 1) / 2;
|
||||
}
|
||||
|
||||
/* Extra S3C2440 clocks */
|
||||
|
||||
static struct clk s3c2440_clk_cam = {
|
||||
.name = "camif",
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2440_CLKCON_CAMERA,
|
||||
};
|
||||
|
||||
static struct clk s3c2440_clk_cam_upll = {
|
||||
.name = "camif-upll",
|
||||
.ops = &(struct clk_ops) {
|
||||
.set_rate = s3c2440_camif_upll_setrate,
|
||||
.get_rate = s3c2440_camif_upll_getrate,
|
||||
.round_rate = s3c2440_camif_upll_round,
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk s3c2440_clk_ac97 = {
|
||||
.name = "ac97",
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2440_CLKCON_AC97,
|
||||
};
|
||||
|
||||
#define S3C24XX_VA_UART0 (S3C_VA_UART)
|
||||
#define S3C24XX_VA_UART1 (S3C_VA_UART + 0x4000 )
|
||||
#define S3C24XX_VA_UART2 (S3C_VA_UART + 0x8000 )
|
||||
#define S3C24XX_VA_UART3 (S3C_VA_UART + 0xC000 )
|
||||
|
||||
static unsigned long s3c2440_fclk_n_getrate(struct clk *clk)
|
||||
{
|
||||
unsigned long ucon0, ucon1, ucon2, divisor;
|
||||
|
||||
/* the fun of calculating the uart divisors on the s3c2440 */
|
||||
ucon0 = __raw_readl(S3C24XX_VA_UART0 + S3C2410_UCON);
|
||||
ucon1 = __raw_readl(S3C24XX_VA_UART1 + S3C2410_UCON);
|
||||
ucon2 = __raw_readl(S3C24XX_VA_UART2 + S3C2410_UCON);
|
||||
|
||||
ucon0 &= S3C2440_UCON0_DIVMASK;
|
||||
ucon1 &= S3C2440_UCON1_DIVMASK;
|
||||
ucon2 &= S3C2440_UCON2_DIVMASK;
|
||||
|
||||
if (ucon0 != 0)
|
||||
divisor = (ucon0 >> S3C2440_UCON_DIVSHIFT) + 6;
|
||||
else if (ucon1 != 0)
|
||||
divisor = (ucon1 >> S3C2440_UCON_DIVSHIFT) + 21;
|
||||
else if (ucon2 != 0)
|
||||
divisor = (ucon2 >> S3C2440_UCON_DIVSHIFT) + 36;
|
||||
else
|
||||
/* manual calims 44, seems to be 9 */
|
||||
divisor = 9;
|
||||
|
||||
return clk_get_rate(clk->parent) / divisor;
|
||||
}
|
||||
|
||||
static struct clk s3c2440_clk_fclk_n = {
|
||||
.name = "fclk_n",
|
||||
.parent = &clk_f,
|
||||
.ops = &(struct clk_ops) {
|
||||
.get_rate = s3c2440_fclk_n_getrate,
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk_lookup s3c2440_clk_lookup[] = {
|
||||
CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk),
|
||||
CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
|
||||
CLKDEV_INIT(NULL, "clk_uart_baud3", &s3c2440_clk_fclk_n),
|
||||
CLKDEV_INIT("s3c2440-uart.0", "uart", &s3c24xx_clk_uart0),
|
||||
CLKDEV_INIT("s3c2440-uart.1", "uart", &s3c24xx_clk_uart1),
|
||||
CLKDEV_INIT("s3c2440-uart.2", "uart", &s3c24xx_clk_uart2),
|
||||
CLKDEV_INIT("s3c2440-camif", "camera", &s3c2440_clk_cam_upll),
|
||||
};
|
||||
|
||||
static int __init_refok s3c2440_clk_add(struct device *dev, struct subsys_interface *sif)
|
||||
{
|
||||
struct clk *clock_upll;
|
||||
struct clk *clock_h;
|
||||
struct clk *clock_p;
|
||||
|
||||
clock_p = clk_get(NULL, "pclk");
|
||||
clock_h = clk_get(NULL, "hclk");
|
||||
clock_upll = clk_get(NULL, "upll");
|
||||
|
||||
if (IS_ERR(clock_p) || IS_ERR(clock_h) || IS_ERR(clock_upll)) {
|
||||
printk(KERN_ERR "S3C2440: Failed to get parent clocks\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
s3c2440_clk_cam.parent = clock_h;
|
||||
s3c2440_clk_ac97.parent = clock_p;
|
||||
s3c2440_clk_cam_upll.parent = clock_upll;
|
||||
s3c24xx_register_clock(&s3c2440_clk_fclk_n);
|
||||
|
||||
s3c24xx_register_clock(&s3c2440_clk_ac97);
|
||||
s3c24xx_register_clock(&s3c2440_clk_cam);
|
||||
s3c24xx_register_clock(&s3c2440_clk_cam_upll);
|
||||
clkdev_add_table(s3c2440_clk_lookup, ARRAY_SIZE(s3c2440_clk_lookup));
|
||||
|
||||
clk_disable(&s3c2440_clk_ac97);
|
||||
clk_disable(&s3c2440_clk_cam);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct subsys_interface s3c2440_clk_interface = {
|
||||
.name = "s3c2440_clk",
|
||||
.subsys = &s3c2440_subsys,
|
||||
.add_dev = s3c2440_clk_add,
|
||||
};
|
||||
|
||||
static __init int s3c24xx_clk_init(void)
|
||||
{
|
||||
return subsys_interface_register(&s3c2440_clk_interface);
|
||||
}
|
||||
|
||||
arch_initcall(s3c24xx_clk_init);
|
@ -1,212 +0,0 @@
|
||||
/* linux/arch/arm/mach-s3c2443/clock.c
|
||||
*
|
||||
* Copyright (c) 2007, 2010 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C2443 Clock control support
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/serial_core.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <asm/mach/map.h>
|
||||
|
||||
#include <mach/hardware.h>
|
||||
|
||||
#include <mach/regs-s3c2443-clock.h>
|
||||
|
||||
#include <plat/cpu-freq.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/clock-clksrc.h>
|
||||
#include <plat/cpu.h>
|
||||
|
||||
/* We currently have to assume that the system is running
|
||||
* from the XTPll input, and that all ***REFCLKs are being
|
||||
* fed from it, as we cannot read the state of OM[4] from
|
||||
* software.
|
||||
*
|
||||
* It would be possible for each board initialisation to
|
||||
* set the correct muxing at initialisation
|
||||
*/
|
||||
|
||||
/* clock selections */
|
||||
|
||||
/* armdiv
|
||||
*
|
||||
* this clock is sourced from msysclk and can have a number of
|
||||
* divider values applied to it to then be fed into armclk.
|
||||
* The real clock definition is done in s3c2443-clock.c,
|
||||
* only the armdiv divisor table must be defined here.
|
||||
*/
|
||||
|
||||
static unsigned int armdiv[16] = {
|
||||
[S3C2443_CLKDIV0_ARMDIV_1 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 1,
|
||||
[S3C2443_CLKDIV0_ARMDIV_2 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 2,
|
||||
[S3C2443_CLKDIV0_ARMDIV_3 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 3,
|
||||
[S3C2443_CLKDIV0_ARMDIV_4 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 4,
|
||||
[S3C2443_CLKDIV0_ARMDIV_6 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 6,
|
||||
[S3C2443_CLKDIV0_ARMDIV_8 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 8,
|
||||
[S3C2443_CLKDIV0_ARMDIV_12 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 12,
|
||||
[S3C2443_CLKDIV0_ARMDIV_16 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 16,
|
||||
};
|
||||
|
||||
/* hsspi
|
||||
*
|
||||
* high-speed spi clock, sourced from esysclk
|
||||
*/
|
||||
|
||||
static struct clksrc_clk clk_hsspi = {
|
||||
.clk = {
|
||||
.name = "hsspi-if",
|
||||
.parent = &clk_esysclk.clk,
|
||||
.ctrlbit = S3C2443_SCLKCON_HSSPICLK,
|
||||
.enable = s3c2443_clkcon_enable_s,
|
||||
},
|
||||
.reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 4 },
|
||||
};
|
||||
|
||||
|
||||
/* clk_hsmcc_div
|
||||
*
|
||||
* this clock is sourced from epll, and is fed through a divider,
|
||||
* to a mux controlled by sclkcon where either it or a extclk can
|
||||
* be fed to the hsmmc block
|
||||
*/
|
||||
|
||||
static struct clksrc_clk clk_hsmmc_div = {
|
||||
.clk = {
|
||||
.name = "hsmmc-div",
|
||||
.devname = "s3c-sdhci.1",
|
||||
.parent = &clk_esysclk.clk,
|
||||
},
|
||||
.reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 },
|
||||
};
|
||||
|
||||
static int s3c2443_setparent_hsmmc(struct clk *clk, struct clk *parent)
|
||||
{
|
||||
unsigned long clksrc = __raw_readl(S3C2443_SCLKCON);
|
||||
|
||||
clksrc &= ~(S3C2443_SCLKCON_HSMMCCLK_EXT |
|
||||
S3C2443_SCLKCON_HSMMCCLK_EPLL);
|
||||
|
||||
if (parent == &clk_epll)
|
||||
clksrc |= S3C2443_SCLKCON_HSMMCCLK_EPLL;
|
||||
else if (parent == &clk_ext)
|
||||
clksrc |= S3C2443_SCLKCON_HSMMCCLK_EXT;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
if (clk->usage > 0) {
|
||||
__raw_writel(clksrc, S3C2443_SCLKCON);
|
||||
}
|
||||
|
||||
clk->parent = parent;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int s3c2443_enable_hsmmc(struct clk *clk, int enable)
|
||||
{
|
||||
return s3c2443_setparent_hsmmc(clk, clk->parent);
|
||||
}
|
||||
|
||||
static struct clk clk_hsmmc = {
|
||||
.name = "hsmmc-if",
|
||||
.devname = "s3c-sdhci.1",
|
||||
.parent = &clk_hsmmc_div.clk,
|
||||
.enable = s3c2443_enable_hsmmc,
|
||||
.ops = &(struct clk_ops) {
|
||||
.set_parent = s3c2443_setparent_hsmmc,
|
||||
},
|
||||
};
|
||||
|
||||
/* standard clock definitions */
|
||||
|
||||
static struct clk init_clocks_off[] = {
|
||||
{
|
||||
.name = "sdi",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2443_clkcon_enable_p,
|
||||
.ctrlbit = S3C2443_PCLKCON_SDI,
|
||||
}, {
|
||||
.name = "spi",
|
||||
.devname = "s3c2410-spi.0",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2443_clkcon_enable_p,
|
||||
.ctrlbit = S3C2443_PCLKCON_SPI1,
|
||||
}
|
||||
};
|
||||
|
||||
/* clocks to add straight away */
|
||||
|
||||
static struct clksrc_clk *clksrcs[] __initdata = {
|
||||
&clk_hsspi,
|
||||
&clk_hsmmc_div,
|
||||
};
|
||||
|
||||
static struct clk *clks[] __initdata = {
|
||||
&clk_hsmmc,
|
||||
};
|
||||
|
||||
static struct clk_lookup s3c2443_clk_lookup[] = {
|
||||
CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_hsmmc),
|
||||
CLKDEV_INIT("s3c2443-spi.0", "spi_busclk2", &clk_hsspi.clk),
|
||||
};
|
||||
|
||||
void __init s3c2443_init_clocks(int xtal)
|
||||
{
|
||||
unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
|
||||
int ptr;
|
||||
|
||||
clk_epll.rate = s3c2443_get_epll(epllcon, xtal);
|
||||
clk_epll.parent = &clk_epllref.clk;
|
||||
|
||||
s3c2443_common_init_clocks(xtal, s3c2443_get_mpll,
|
||||
armdiv, ARRAY_SIZE(armdiv),
|
||||
S3C2443_CLKDIV0_ARMDIV_MASK);
|
||||
|
||||
s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
|
||||
|
||||
for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
|
||||
s3c_register_clksrc(clksrcs[ptr], 1);
|
||||
|
||||
/* We must be careful disabling the clocks we are not intending to
|
||||
* be using at boot time, as subsystems such as the LCD which do
|
||||
* their own DMA requests to the bus can cause the system to lockup
|
||||
* if they where in the middle of requesting bus access.
|
||||
*
|
||||
* Disabling the LCD clock if the LCD is active is very dangerous,
|
||||
* and therefore the bootloader should be careful to not enable
|
||||
* the LCD clock if it is not needed.
|
||||
*/
|
||||
|
||||
/* install (and disable) the clocks we do not need immediately */
|
||||
|
||||
s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
|
||||
s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
|
||||
clkdev_add_table(s3c2443_clk_lookup, ARRAY_SIZE(s3c2443_clk_lookup));
|
||||
}
|
@ -1,141 +0,0 @@
|
||||
/* linux/arch/arm/plat-s3c24xx/s3c24xx-clock.c
|
||||
*
|
||||
* Copyright (c) 2004-2008 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* S3C2440/S3C2442 Common clock support
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <mach/hardware.h>
|
||||
#include <linux/atomic.h>
|
||||
#include <asm/irq.h>
|
||||
|
||||
#include <mach/regs-clock.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/cpu.h>
|
||||
|
||||
static int s3c2440_setparent_armclk(struct clk *clk, struct clk *parent)
|
||||
{
|
||||
unsigned long camdivn;
|
||||
unsigned long dvs;
|
||||
|
||||
if (parent == &clk_f)
|
||||
dvs = 0;
|
||||
else if (parent == &clk_h)
|
||||
dvs = S3C2440_CAMDIVN_DVSEN;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
clk->parent = parent;
|
||||
|
||||
camdivn = __raw_readl(S3C2440_CAMDIVN);
|
||||
camdivn &= ~S3C2440_CAMDIVN_DVSEN;
|
||||
camdivn |= dvs;
|
||||
__raw_writel(camdivn, S3C2440_CAMDIVN);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct clk clk_arm = {
|
||||
.name = "armclk",
|
||||
.id = -1,
|
||||
.ops = &(struct clk_ops) {
|
||||
.set_parent = s3c2440_setparent_armclk,
|
||||
},
|
||||
};
|
||||
|
||||
static int s3c244x_clk_add(struct device *dev, struct subsys_interface *sif)
|
||||
{
|
||||
unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
|
||||
unsigned long clkdivn;
|
||||
struct clk *clock_upll;
|
||||
int ret;
|
||||
|
||||
printk("S3C244X: Clock Support, DVS %s\n",
|
||||
(camdivn & S3C2440_CAMDIVN_DVSEN) ? "on" : "off");
|
||||
|
||||
clk_arm.parent = (camdivn & S3C2440_CAMDIVN_DVSEN) ? &clk_h : &clk_f;
|
||||
|
||||
ret = s3c24xx_register_clock(&clk_arm);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "S3C24XX: Failed to add armclk (%d)\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
clock_upll = clk_get(NULL, "upll");
|
||||
if (IS_ERR(clock_upll)) {
|
||||
printk(KERN_ERR "S3C244X: Failed to get upll clock\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
/* check rate of UPLL, and if it is near 96MHz, then change
|
||||
* to using half the UPLL rate for the system */
|
||||
|
||||
if (clk_get_rate(clock_upll) > (94 * MHZ)) {
|
||||
clk_usb_bus.rate = clk_get_rate(clock_upll) / 2;
|
||||
|
||||
spin_lock(&clocks_lock);
|
||||
|
||||
clkdivn = __raw_readl(S3C2410_CLKDIVN);
|
||||
clkdivn |= S3C2440_CLKDIVN_UCLK;
|
||||
__raw_writel(clkdivn, S3C2410_CLKDIVN);
|
||||
|
||||
spin_unlock(&clocks_lock);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct subsys_interface s3c2440_clk_interface = {
|
||||
.name = "s3c2440_clk",
|
||||
.subsys = &s3c2440_subsys,
|
||||
.add_dev = s3c244x_clk_add,
|
||||
};
|
||||
|
||||
static int s3c2440_clk_init(void)
|
||||
{
|
||||
return subsys_interface_register(&s3c2440_clk_interface);
|
||||
}
|
||||
|
||||
arch_initcall(s3c2440_clk_init);
|
||||
|
||||
static struct subsys_interface s3c2442_clk_interface = {
|
||||
.name = "s3c2442_clk",
|
||||
.subsys = &s3c2442_subsys,
|
||||
.add_dev = s3c244x_clk_add,
|
||||
};
|
||||
|
||||
static int s3c2442_clk_init(void)
|
||||
{
|
||||
return subsys_interface_register(&s3c2442_clk_interface);
|
||||
}
|
||||
|
||||
arch_initcall(s3c2442_clk_init);
|
@ -1,675 +0,0 @@
|
||||
/*
|
||||
* Common code for SoCs starting with the S3C2443
|
||||
*
|
||||
* Copyright (c) 2007, 2010 Simtec Electronics
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
*
|
||||
* 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/init.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <mach/regs-s3c2443-clock.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/clock-clksrc.h>
|
||||
#include <plat/cpu.h>
|
||||
|
||||
#include <plat/cpu-freq.h>
|
||||
|
||||
|
||||
static int s3c2443_gate(void __iomem *reg, struct clk *clk, int enable)
|
||||
{
|
||||
u32 ctrlbit = clk->ctrlbit;
|
||||
u32 con = __raw_readl(reg);
|
||||
|
||||
if (enable)
|
||||
con |= ctrlbit;
|
||||
else
|
||||
con &= ~ctrlbit;
|
||||
|
||||
__raw_writel(con, reg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int s3c2443_clkcon_enable_h(struct clk *clk, int enable)
|
||||
{
|
||||
return s3c2443_gate(S3C2443_HCLKCON, clk, enable);
|
||||
}
|
||||
|
||||
int s3c2443_clkcon_enable_p(struct clk *clk, int enable)
|
||||
{
|
||||
return s3c2443_gate(S3C2443_PCLKCON, clk, enable);
|
||||
}
|
||||
|
||||
int s3c2443_clkcon_enable_s(struct clk *clk, int enable)
|
||||
{
|
||||
return s3c2443_gate(S3C2443_SCLKCON, clk, enable);
|
||||
}
|
||||
|
||||
/* mpllref is a direct descendant of clk_xtal by default, but it is not
|
||||
* elided as the EPLL can be either sourced by the XTAL or EXTCLK and as
|
||||
* such directly equating the two source clocks is impossible.
|
||||
*/
|
||||
static struct clk clk_mpllref = {
|
||||
.name = "mpllref",
|
||||
.parent = &clk_xtal,
|
||||
};
|
||||
|
||||
static struct clk *clk_epllref_sources[] = {
|
||||
[0] = &clk_mpllref,
|
||||
[1] = &clk_mpllref,
|
||||
[2] = &clk_xtal,
|
||||
[3] = &clk_ext,
|
||||
};
|
||||
|
||||
struct clksrc_clk clk_epllref = {
|
||||
.clk = {
|
||||
.name = "epllref",
|
||||
},
|
||||
.sources = &(struct clksrc_sources) {
|
||||
.sources = clk_epllref_sources,
|
||||
.nr_sources = ARRAY_SIZE(clk_epllref_sources),
|
||||
},
|
||||
.reg_src = { .reg = S3C2443_CLKSRC, .size = 2, .shift = 7 },
|
||||
};
|
||||
|
||||
/* esysclk
|
||||
*
|
||||
* this is sourced from either the EPLL or the EPLLref clock
|
||||
*/
|
||||
|
||||
static struct clk *clk_sysclk_sources[] = {
|
||||
[0] = &clk_epllref.clk,
|
||||
[1] = &clk_epll,
|
||||
};
|
||||
|
||||
struct clksrc_clk clk_esysclk = {
|
||||
.clk = {
|
||||
.name = "esysclk",
|
||||
.parent = &clk_epll,
|
||||
},
|
||||
.sources = &(struct clksrc_sources) {
|
||||
.sources = clk_sysclk_sources,
|
||||
.nr_sources = ARRAY_SIZE(clk_sysclk_sources),
|
||||
},
|
||||
.reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 6 },
|
||||
};
|
||||
|
||||
static unsigned long s3c2443_getrate_mdivclk(struct clk *clk)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
unsigned long div = __raw_readl(S3C2443_CLKDIV0);
|
||||
|
||||
div &= S3C2443_CLKDIV0_EXTDIV_MASK;
|
||||
div >>= (S3C2443_CLKDIV0_EXTDIV_SHIFT-1); /* x2 */
|
||||
|
||||
return parent_rate / (div + 1);
|
||||
}
|
||||
|
||||
static struct clk clk_mdivclk = {
|
||||
.name = "mdivclk",
|
||||
.parent = &clk_mpllref,
|
||||
.ops = &(struct clk_ops) {
|
||||
.get_rate = s3c2443_getrate_mdivclk,
|
||||
},
|
||||
};
|
||||
|
||||
static struct clk *clk_msysclk_sources[] = {
|
||||
[0] = &clk_mpllref,
|
||||
[1] = &clk_mpll,
|
||||
[2] = &clk_mdivclk,
|
||||
[3] = &clk_mpllref,
|
||||
};
|
||||
|
||||
static struct clksrc_clk clk_msysclk = {
|
||||
.clk = {
|
||||
.name = "msysclk",
|
||||
.parent = &clk_xtal,
|
||||
},
|
||||
.sources = &(struct clksrc_sources) {
|
||||
.sources = clk_msysclk_sources,
|
||||
.nr_sources = ARRAY_SIZE(clk_msysclk_sources),
|
||||
},
|
||||
.reg_src = { .reg = S3C2443_CLKSRC, .size = 2, .shift = 3 },
|
||||
};
|
||||
|
||||
/* prediv
|
||||
*
|
||||
* this divides the msysclk down to pass to h/p/etc.
|
||||
*/
|
||||
|
||||
static unsigned long s3c2443_prediv_getrate(struct clk *clk)
|
||||
{
|
||||
unsigned long rate = clk_get_rate(clk->parent);
|
||||
unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
|
||||
|
||||
clkdiv0 &= S3C2443_CLKDIV0_PREDIV_MASK;
|
||||
clkdiv0 >>= S3C2443_CLKDIV0_PREDIV_SHIFT;
|
||||
|
||||
return rate / (clkdiv0 + 1);
|
||||
}
|
||||
|
||||
static struct clk clk_prediv = {
|
||||
.name = "prediv",
|
||||
.parent = &clk_msysclk.clk,
|
||||
.ops = &(struct clk_ops) {
|
||||
.get_rate = s3c2443_prediv_getrate,
|
||||
},
|
||||
};
|
||||
|
||||
/* hclk divider
|
||||
*
|
||||
* divides the prediv and provides the hclk.
|
||||
*/
|
||||
|
||||
static unsigned long s3c2443_hclkdiv_getrate(struct clk *clk)
|
||||
{
|
||||
unsigned long rate = clk_get_rate(clk->parent);
|
||||
unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
|
||||
|
||||
clkdiv0 &= S3C2443_CLKDIV0_HCLKDIV_MASK;
|
||||
|
||||
return rate / (clkdiv0 + 1);
|
||||
}
|
||||
|
||||
static struct clk_ops clk_h_ops = {
|
||||
.get_rate = s3c2443_hclkdiv_getrate,
|
||||
};
|
||||
|
||||
/* pclk divider
|
||||
*
|
||||
* divides the hclk and provides the pclk.
|
||||
*/
|
||||
|
||||
static unsigned long s3c2443_pclkdiv_getrate(struct clk *clk)
|
||||
{
|
||||
unsigned long rate = clk_get_rate(clk->parent);
|
||||
unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
|
||||
|
||||
clkdiv0 = ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 1 : 0);
|
||||
|
||||
return rate / (clkdiv0 + 1);
|
||||
}
|
||||
|
||||
static struct clk_ops clk_p_ops = {
|
||||
.get_rate = s3c2443_pclkdiv_getrate,
|
||||
};
|
||||
|
||||
/* armdiv
|
||||
*
|
||||
* this clock is sourced from msysclk and can have a number of
|
||||
* divider values applied to it to then be fed into armclk.
|
||||
*/
|
||||
|
||||
static unsigned int *armdiv;
|
||||
static int nr_armdiv;
|
||||
static int armdivmask;
|
||||
|
||||
static unsigned long s3c2443_armclk_roundrate(struct clk *clk,
|
||||
unsigned long rate)
|
||||
{
|
||||
unsigned long parent = clk_get_rate(clk->parent);
|
||||
unsigned long calc;
|
||||
unsigned best = 256; /* bigger than any value */
|
||||
unsigned div;
|
||||
int ptr;
|
||||
|
||||
if (!nr_armdiv)
|
||||
return -EINVAL;
|
||||
|
||||
for (ptr = 0; ptr < nr_armdiv; ptr++) {
|
||||
div = armdiv[ptr];
|
||||
if (div) {
|
||||
/* cpufreq provides 266mhz as 266666000 not 266666666 */
|
||||
calc = (parent / div / 1000) * 1000;
|
||||
if (calc <= rate && div < best)
|
||||
best = div;
|
||||
}
|
||||
}
|
||||
|
||||
return parent / best;
|
||||
}
|
||||
|
||||
static unsigned long s3c2443_armclk_getrate(struct clk *clk)
|
||||
{
|
||||
unsigned long rate = clk_get_rate(clk->parent);
|
||||
unsigned long clkcon0;
|
||||
int val;
|
||||
|
||||
if (!nr_armdiv || !armdivmask)
|
||||
return -EINVAL;
|
||||
|
||||
clkcon0 = __raw_readl(S3C2443_CLKDIV0);
|
||||
clkcon0 &= armdivmask;
|
||||
val = clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT;
|
||||
|
||||
return rate / armdiv[val];
|
||||
}
|
||||
|
||||
static int s3c2443_armclk_setrate(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
unsigned long parent = clk_get_rate(clk->parent);
|
||||
unsigned long calc;
|
||||
unsigned div;
|
||||
unsigned best = 256; /* bigger than any value */
|
||||
int ptr;
|
||||
int val = -1;
|
||||
|
||||
if (!nr_armdiv || !armdivmask)
|
||||
return -EINVAL;
|
||||
|
||||
for (ptr = 0; ptr < nr_armdiv; ptr++) {
|
||||
div = armdiv[ptr];
|
||||
if (div) {
|
||||
/* cpufreq provides 266mhz as 266666000 not 266666666 */
|
||||
calc = (parent / div / 1000) * 1000;
|
||||
if (calc <= rate && div < best) {
|
||||
best = div;
|
||||
val = ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (val >= 0) {
|
||||
unsigned long clkcon0;
|
||||
|
||||
clkcon0 = __raw_readl(S3C2443_CLKDIV0);
|
||||
clkcon0 &= ~armdivmask;
|
||||
clkcon0 |= val << S3C2443_CLKDIV0_ARMDIV_SHIFT;
|
||||
__raw_writel(clkcon0, S3C2443_CLKDIV0);
|
||||
}
|
||||
|
||||
return (val == -1) ? -EINVAL : 0;
|
||||
}
|
||||
|
||||
static struct clk clk_armdiv = {
|
||||
.name = "armdiv",
|
||||
.parent = &clk_msysclk.clk,
|
||||
.ops = &(struct clk_ops) {
|
||||
.round_rate = s3c2443_armclk_roundrate,
|
||||
.get_rate = s3c2443_armclk_getrate,
|
||||
.set_rate = s3c2443_armclk_setrate,
|
||||
},
|
||||
};
|
||||
|
||||
/* armclk
|
||||
*
|
||||
* this is the clock fed into the ARM core itself, from armdiv or from hclk.
|
||||
*/
|
||||
|
||||
static struct clk *clk_arm_sources[] = {
|
||||
[0] = &clk_armdiv,
|
||||
[1] = &clk_h,
|
||||
};
|
||||
|
||||
static struct clksrc_clk clk_arm = {
|
||||
.clk = {
|
||||
.name = "armclk",
|
||||
},
|
||||
.sources = &(struct clksrc_sources) {
|
||||
.sources = clk_arm_sources,
|
||||
.nr_sources = ARRAY_SIZE(clk_arm_sources),
|
||||
},
|
||||
.reg_src = { .reg = S3C2443_CLKDIV0, .size = 1, .shift = 13 },
|
||||
};
|
||||
|
||||
/* usbhost
|
||||
*
|
||||
* usb host bus-clock, usually 48MHz to provide USB bus clock timing
|
||||
*/
|
||||
|
||||
static struct clksrc_clk clk_usb_bus_host = {
|
||||
.clk = {
|
||||
.name = "usb-bus-host-parent",
|
||||
.parent = &clk_esysclk.clk,
|
||||
.ctrlbit = S3C2443_SCLKCON_USBHOST,
|
||||
.enable = s3c2443_clkcon_enable_s,
|
||||
},
|
||||
.reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 4 },
|
||||
};
|
||||
|
||||
/* common clksrc clocks */
|
||||
|
||||
static struct clksrc_clk clksrc_clks[] = {
|
||||
{
|
||||
/* camera interface bus-clock, divided down from esysclk */
|
||||
.clk = {
|
||||
.name = "camif-upll", /* same as 2440 name */
|
||||
.parent = &clk_esysclk.clk,
|
||||
.ctrlbit = S3C2443_SCLKCON_CAMCLK,
|
||||
.enable = s3c2443_clkcon_enable_s,
|
||||
},
|
||||
.reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 26 },
|
||||
}, {
|
||||
.clk = {
|
||||
.name = "display-if",
|
||||
.parent = &clk_esysclk.clk,
|
||||
.ctrlbit = S3C2443_SCLKCON_DISPCLK,
|
||||
.enable = s3c2443_clkcon_enable_s,
|
||||
},
|
||||
.reg_div = { .reg = S3C2443_CLKDIV1, .size = 8, .shift = 16 },
|
||||
},
|
||||
};
|
||||
|
||||
static struct clksrc_clk clk_esys_uart = {
|
||||
/* ART baud-rate clock sourced from esysclk via a divisor */
|
||||
.clk = {
|
||||
.name = "uartclk",
|
||||
.parent = &clk_esysclk.clk,
|
||||
},
|
||||
.reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 8 },
|
||||
};
|
||||
|
||||
static struct clk clk_i2s_ext = {
|
||||
.name = "i2s-ext",
|
||||
};
|
||||
|
||||
/* i2s_eplldiv
|
||||
*
|
||||
* This clock is the output from the I2S divisor of ESYSCLK, and is separate
|
||||
* from the mux that comes after it (cannot merge into one single clock)
|
||||
*/
|
||||
|
||||
static struct clksrc_clk clk_i2s_eplldiv = {
|
||||
.clk = {
|
||||
.name = "i2s-eplldiv",
|
||||
.parent = &clk_esysclk.clk,
|
||||
},
|
||||
.reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 12, },
|
||||
};
|
||||
|
||||
/* i2s-ref
|
||||
*
|
||||
* i2s bus reference clock, selectable from external, esysclk or epllref
|
||||
*
|
||||
* Note, this used to be two clocks, but was compressed into one.
|
||||
*/
|
||||
|
||||
static struct clk *clk_i2s_srclist[] = {
|
||||
[0] = &clk_i2s_eplldiv.clk,
|
||||
[1] = &clk_i2s_ext,
|
||||
[2] = &clk_epllref.clk,
|
||||
[3] = &clk_epllref.clk,
|
||||
};
|
||||
|
||||
static struct clksrc_clk clk_i2s = {
|
||||
.clk = {
|
||||
.name = "i2s-if",
|
||||
.ctrlbit = S3C2443_SCLKCON_I2SCLK,
|
||||
.enable = s3c2443_clkcon_enable_s,
|
||||
|
||||
},
|
||||
.sources = &(struct clksrc_sources) {
|
||||
.sources = clk_i2s_srclist,
|
||||
.nr_sources = ARRAY_SIZE(clk_i2s_srclist),
|
||||
},
|
||||
.reg_src = { .reg = S3C2443_CLKSRC, .size = 2, .shift = 14 },
|
||||
};
|
||||
|
||||
static struct clk init_clocks_off[] = {
|
||||
{
|
||||
.name = "iis",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2443_clkcon_enable_p,
|
||||
.ctrlbit = S3C2443_PCLKCON_IIS,
|
||||
}, {
|
||||
.name = "adc",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2443_clkcon_enable_p,
|
||||
.ctrlbit = S3C2443_PCLKCON_ADC,
|
||||
}, {
|
||||
.name = "i2c",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2443_clkcon_enable_p,
|
||||
.ctrlbit = S3C2443_PCLKCON_IIC,
|
||||
}
|
||||
};
|
||||
|
||||
static struct clk init_clocks[] = {
|
||||
{
|
||||
.name = "dma.0",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2443_clkcon_enable_h,
|
||||
.ctrlbit = S3C2443_HCLKCON_DMA0,
|
||||
}, {
|
||||
.name = "dma.1",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2443_clkcon_enable_h,
|
||||
.ctrlbit = S3C2443_HCLKCON_DMA1,
|
||||
}, {
|
||||
.name = "dma.2",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2443_clkcon_enable_h,
|
||||
.ctrlbit = S3C2443_HCLKCON_DMA2,
|
||||
}, {
|
||||
.name = "dma.3",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2443_clkcon_enable_h,
|
||||
.ctrlbit = S3C2443_HCLKCON_DMA3,
|
||||
}, {
|
||||
.name = "dma.4",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2443_clkcon_enable_h,
|
||||
.ctrlbit = S3C2443_HCLKCON_DMA4,
|
||||
}, {
|
||||
.name = "dma.5",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2443_clkcon_enable_h,
|
||||
.ctrlbit = S3C2443_HCLKCON_DMA5,
|
||||
}, {
|
||||
.name = "gpio",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2443_clkcon_enable_p,
|
||||
.ctrlbit = S3C2443_PCLKCON_GPIO,
|
||||
}, {
|
||||
.name = "usb-host",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2443_clkcon_enable_h,
|
||||
.ctrlbit = S3C2443_HCLKCON_USBH,
|
||||
}, {
|
||||
.name = "usb-device",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2443_clkcon_enable_h,
|
||||
.ctrlbit = S3C2443_HCLKCON_USBD,
|
||||
}, {
|
||||
.name = "lcd",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2443_clkcon_enable_h,
|
||||
.ctrlbit = S3C2443_HCLKCON_LCDC,
|
||||
|
||||
}, {
|
||||
.name = "timers",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2443_clkcon_enable_p,
|
||||
.ctrlbit = S3C2443_PCLKCON_PWMT,
|
||||
}, {
|
||||
.name = "cfc",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2443_clkcon_enable_h,
|
||||
.ctrlbit = S3C2443_HCLKCON_CFC,
|
||||
}, {
|
||||
.name = "ssmc",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2443_clkcon_enable_h,
|
||||
.ctrlbit = S3C2443_HCLKCON_SSMC,
|
||||
}, {
|
||||
.name = "uart",
|
||||
.devname = "s3c2440-uart.0",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2443_clkcon_enable_p,
|
||||
.ctrlbit = S3C2443_PCLKCON_UART0,
|
||||
}, {
|
||||
.name = "uart",
|
||||
.devname = "s3c2440-uart.1",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2443_clkcon_enable_p,
|
||||
.ctrlbit = S3C2443_PCLKCON_UART1,
|
||||
}, {
|
||||
.name = "uart",
|
||||
.devname = "s3c2440-uart.2",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2443_clkcon_enable_p,
|
||||
.ctrlbit = S3C2443_PCLKCON_UART2,
|
||||
}, {
|
||||
.name = "uart",
|
||||
.devname = "s3c2440-uart.3",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2443_clkcon_enable_p,
|
||||
.ctrlbit = S3C2443_PCLKCON_UART3,
|
||||
}, {
|
||||
.name = "rtc",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2443_clkcon_enable_p,
|
||||
.ctrlbit = S3C2443_PCLKCON_RTC,
|
||||
}, {
|
||||
.name = "watchdog",
|
||||
.parent = &clk_p,
|
||||
.ctrlbit = S3C2443_PCLKCON_WDT,
|
||||
}, {
|
||||
.name = "ac97",
|
||||
.parent = &clk_p,
|
||||
.ctrlbit = S3C2443_PCLKCON_AC97,
|
||||
}, {
|
||||
.name = "nand",
|
||||
.parent = &clk_h,
|
||||
}, {
|
||||
.name = "usb-bus-host",
|
||||
.parent = &clk_usb_bus_host.clk,
|
||||
}
|
||||
};
|
||||
|
||||
static struct clk hsmmc1_clk = {
|
||||
.name = "hsmmc",
|
||||
.devname = "s3c-sdhci.1",
|
||||
.parent = &clk_h,
|
||||
.enable = s3c2443_clkcon_enable_h,
|
||||
.ctrlbit = S3C2443_HCLKCON_HSMMC,
|
||||
};
|
||||
|
||||
static struct clk hsspi_clk = {
|
||||
.name = "spi",
|
||||
.devname = "s3c2443-spi.0",
|
||||
.parent = &clk_p,
|
||||
.enable = s3c2443_clkcon_enable_p,
|
||||
.ctrlbit = S3C2443_PCLKCON_HSSPI,
|
||||
};
|
||||
|
||||
/* EPLLCON compatible enough to get on/off information */
|
||||
|
||||
void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll)
|
||||
{
|
||||
unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
|
||||
unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON);
|
||||
struct clk *xtal_clk;
|
||||
unsigned long xtal;
|
||||
unsigned long pll;
|
||||
int ptr;
|
||||
|
||||
xtal_clk = clk_get(NULL, "xtal");
|
||||
xtal = clk_get_rate(xtal_clk);
|
||||
clk_put(xtal_clk);
|
||||
|
||||
pll = get_mpll(mpllcon, xtal);
|
||||
clk_msysclk.clk.rate = pll;
|
||||
clk_mpll.rate = pll;
|
||||
|
||||
printk("CPU: MPLL %s %ld.%03ld MHz, cpu %ld.%03ld MHz, mem %ld.%03ld MHz, pclk %ld.%03ld MHz\n",
|
||||
(mpllcon & S3C2443_PLLCON_OFF) ? "off" : "on",
|
||||
print_mhz(pll), print_mhz(clk_get_rate(&clk_armdiv)),
|
||||
print_mhz(clk_get_rate(&clk_h)),
|
||||
print_mhz(clk_get_rate(&clk_p)));
|
||||
|
||||
for (ptr = 0; ptr < ARRAY_SIZE(clksrc_clks); ptr++)
|
||||
s3c_set_clksrc(&clksrc_clks[ptr], true);
|
||||
|
||||
/* ensure usb bus clock is within correct rate of 48MHz */
|
||||
|
||||
if (clk_get_rate(&clk_usb_bus_host.clk) != (48 * 1000 * 1000)) {
|
||||
printk(KERN_INFO "Warning: USB host bus not at 48MHz\n");
|
||||
clk_set_rate(&clk_usb_bus_host.clk, 48*1000*1000);
|
||||
}
|
||||
|
||||
printk("CPU: EPLL %s %ld.%03ld MHz, usb-bus %ld.%03ld MHz\n",
|
||||
(epllcon & S3C2443_PLLCON_OFF) ? "off" : "on",
|
||||
print_mhz(clk_get_rate(&clk_epll)),
|
||||
print_mhz(clk_get_rate(&clk_usb_bus)));
|
||||
}
|
||||
|
||||
static struct clk *clks[] __initdata = {
|
||||
&clk_prediv,
|
||||
&clk_mpllref,
|
||||
&clk_mdivclk,
|
||||
&clk_ext,
|
||||
&clk_epll,
|
||||
&clk_usb_bus,
|
||||
&clk_armdiv,
|
||||
&hsmmc1_clk,
|
||||
&hsspi_clk,
|
||||
};
|
||||
|
||||
static struct clksrc_clk *clksrcs[] __initdata = {
|
||||
&clk_i2s_eplldiv,
|
||||
&clk_i2s,
|
||||
&clk_usb_bus_host,
|
||||
&clk_epllref,
|
||||
&clk_esysclk,
|
||||
&clk_msysclk,
|
||||
&clk_arm,
|
||||
};
|
||||
|
||||
static struct clk_lookup s3c2443_clk_lookup[] = {
|
||||
CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk),
|
||||
CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
|
||||
CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_esys_uart.clk),
|
||||
CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.0", &hsmmc1_clk),
|
||||
CLKDEV_INIT("s3c2443-spi.0", "spi_busclk0", &hsspi_clk),
|
||||
};
|
||||
|
||||
void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,
|
||||
unsigned int *divs, int nr_divs,
|
||||
int divmask)
|
||||
{
|
||||
int ptr;
|
||||
|
||||
armdiv = divs;
|
||||
nr_armdiv = nr_divs;
|
||||
armdivmask = divmask;
|
||||
|
||||
/* s3c2443 parents h clock from prediv */
|
||||
clk_h.parent = &clk_prediv;
|
||||
clk_h.ops = &clk_h_ops;
|
||||
|
||||
/* and p clock from h clock */
|
||||
clk_p.parent = &clk_h;
|
||||
clk_p.ops = &clk_p_ops;
|
||||
|
||||
clk_usb_bus.parent = &clk_usb_bus_host.clk;
|
||||
clk_epll.parent = &clk_epllref.clk;
|
||||
|
||||
s3c24xx_register_baseclocks(xtal);
|
||||
s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
|
||||
|
||||
for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
|
||||
s3c_register_clksrc(clksrcs[ptr], 1);
|
||||
|
||||
s3c_register_clksrc(clksrc_clks, ARRAY_SIZE(clksrc_clks));
|
||||
s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
|
||||
|
||||
/* See s3c2443/etc notes on disabling clocks at init time */
|
||||
s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
|
||||
s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
|
||||
clkdev_add_table(s3c2443_clk_lookup, ARRAY_SIZE(s3c2443_clk_lookup));
|
||||
|
||||
s3c2443_common_setup_clocks(get_mpll);
|
||||
}
|
@ -53,6 +53,7 @@
|
||||
#include <plat/cpu-freq.h>
|
||||
#include <plat/pll.h>
|
||||
#include <plat/pwm-core.h>
|
||||
#include <plat/watchdog-reset.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
@ -73,7 +74,6 @@ static struct cpu_table cpu_ids[] __initdata = {
|
||||
.idcode = 0x32410000,
|
||||
.idmask = 0xffffffff,
|
||||
.map_io = s3c2410_map_io,
|
||||
.init_clocks = s3c2410_init_clocks,
|
||||
.init_uarts = s3c2410_init_uarts,
|
||||
.init = s3c2410_init,
|
||||
.name = name_s3c2410
|
||||
@ -82,7 +82,6 @@ static struct cpu_table cpu_ids[] __initdata = {
|
||||
.idcode = 0x32410002,
|
||||
.idmask = 0xffffffff,
|
||||
.map_io = s3c2410_map_io,
|
||||
.init_clocks = s3c2410_init_clocks,
|
||||
.init_uarts = s3c2410_init_uarts,
|
||||
.init = s3c2410a_init,
|
||||
.name = name_s3c2410a
|
||||
@ -91,7 +90,6 @@ static struct cpu_table cpu_ids[] __initdata = {
|
||||
.idcode = 0x32440000,
|
||||
.idmask = 0xffffffff,
|
||||
.map_io = s3c2440_map_io,
|
||||
.init_clocks = s3c244x_init_clocks,
|
||||
.init_uarts = s3c244x_init_uarts,
|
||||
.init = s3c2440_init,
|
||||
.name = name_s3c2440
|
||||
@ -100,7 +98,6 @@ static struct cpu_table cpu_ids[] __initdata = {
|
||||
.idcode = 0x32440001,
|
||||
.idmask = 0xffffffff,
|
||||
.map_io = s3c2440_map_io,
|
||||
.init_clocks = s3c244x_init_clocks,
|
||||
.init_uarts = s3c244x_init_uarts,
|
||||
.init = s3c2440_init,
|
||||
.name = name_s3c2440a
|
||||
@ -109,7 +106,6 @@ static struct cpu_table cpu_ids[] __initdata = {
|
||||
.idcode = 0x32440aaa,
|
||||
.idmask = 0xffffffff,
|
||||
.map_io = s3c2442_map_io,
|
||||
.init_clocks = s3c244x_init_clocks,
|
||||
.init_uarts = s3c244x_init_uarts,
|
||||
.init = s3c2442_init,
|
||||
.name = name_s3c2442
|
||||
@ -118,7 +114,6 @@ static struct cpu_table cpu_ids[] __initdata = {
|
||||
.idcode = 0x32440aab,
|
||||
.idmask = 0xffffffff,
|
||||
.map_io = s3c2442_map_io,
|
||||
.init_clocks = s3c244x_init_clocks,
|
||||
.init_uarts = s3c244x_init_uarts,
|
||||
.init = s3c2442_init,
|
||||
.name = name_s3c2442b
|
||||
@ -127,7 +122,6 @@ static struct cpu_table cpu_ids[] __initdata = {
|
||||
.idcode = 0x32412001,
|
||||
.idmask = 0xffffffff,
|
||||
.map_io = s3c2412_map_io,
|
||||
.init_clocks = s3c2412_init_clocks,
|
||||
.init_uarts = s3c2412_init_uarts,
|
||||
.init = s3c2412_init,
|
||||
.name = name_s3c2412,
|
||||
@ -136,7 +130,6 @@ static struct cpu_table cpu_ids[] __initdata = {
|
||||
.idcode = 0x32412003,
|
||||
.idmask = 0xffffffff,
|
||||
.map_io = s3c2412_map_io,
|
||||
.init_clocks = s3c2412_init_clocks,
|
||||
.init_uarts = s3c2412_init_uarts,
|
||||
.init = s3c2412_init,
|
||||
.name = name_s3c2412,
|
||||
@ -145,7 +138,6 @@ static struct cpu_table cpu_ids[] __initdata = {
|
||||
.idcode = 0x32450003,
|
||||
.idmask = 0xffffffff,
|
||||
.map_io = s3c2416_map_io,
|
||||
.init_clocks = s3c2416_init_clocks,
|
||||
.init_uarts = s3c2416_init_uarts,
|
||||
.init = s3c2416_init,
|
||||
.name = name_s3c2416,
|
||||
@ -154,7 +146,6 @@ static struct cpu_table cpu_ids[] __initdata = {
|
||||
.idcode = 0x32443001,
|
||||
.idmask = 0xffffffff,
|
||||
.map_io = s3c2443_map_io,
|
||||
.init_clocks = s3c2443_init_clocks,
|
||||
.init_uarts = s3c2443_init_uarts,
|
||||
.init = s3c2443_init,
|
||||
.name = name_s3c2443,
|
||||
@ -316,21 +307,6 @@ struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
|
||||
},
|
||||
};
|
||||
|
||||
/* initialise all the clocks */
|
||||
|
||||
void __init_or_cpufreq s3c24xx_setup_clocks(unsigned long fclk,
|
||||
unsigned long hclk,
|
||||
unsigned long pclk)
|
||||
{
|
||||
clk_upll.rate = s3c24xx_get_pll(__raw_readl(S3C2410_UPLLCON),
|
||||
clk_xtal.rate);
|
||||
|
||||
clk_mpll.rate = fclk;
|
||||
clk_h.rate = hclk;
|
||||
clk_p.rate = pclk;
|
||||
clk_f.rate = fclk;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
|
||||
defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
|
||||
static struct resource s3c2410_dma_resource[] = {
|
||||
@ -534,3 +510,62 @@ struct platform_device s3c2443_device_dma = {
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2410)
|
||||
void __init s3c2410_init_clocks(int xtal)
|
||||
{
|
||||
s3c2410_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
|
||||
samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CPU_S3C2412
|
||||
void __init s3c2412_init_clocks(int xtal)
|
||||
{
|
||||
s3c2412_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CPU_S3C2416
|
||||
void __init s3c2416_init_clocks(int xtal)
|
||||
{
|
||||
s3c2443_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2440)
|
||||
void __init s3c2440_init_clocks(int xtal)
|
||||
{
|
||||
s3c2410_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
|
||||
samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2442)
|
||||
void __init s3c2442_init_clocks(int xtal)
|
||||
{
|
||||
s3c2410_common_clk_init(NULL, xtal, 2, S3C24XX_VA_CLKPWR);
|
||||
samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CPU_S3C2443
|
||||
void __init s3c2443_init_clocks(int xtal)
|
||||
{
|
||||
s3c2443_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2440) || \
|
||||
defined(CONFIG_CPU_S3C2442)
|
||||
static struct resource s3c2410_dclk_resource[] = {
|
||||
[0] = DEFINE_RES_MEM(0x56000084, 0x4),
|
||||
};
|
||||
|
||||
struct platform_device s3c2410_device_dclk = {
|
||||
.name = "s3c2410-dclk",
|
||||
.id = 0,
|
||||
.num_resources = ARRAY_SIZE(s3c2410_dclk_resource),
|
||||
.resource = s3c2410_dclk_resource,
|
||||
};
|
||||
#endif
|
||||
|
@ -67,16 +67,15 @@ extern struct syscore_ops s3c2416_irq_syscore_ops;
|
||||
#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
|
||||
extern void s3c244x_map_io(void);
|
||||
extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no);
|
||||
extern void s3c244x_init_clocks(int xtal);
|
||||
extern void s3c244x_restart(enum reboot_mode mode, const char *cmd);
|
||||
#else
|
||||
#define s3c244x_init_clocks NULL
|
||||
#define s3c244x_init_uarts NULL
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CPU_S3C2440
|
||||
extern int s3c2440_init(void);
|
||||
extern void s3c2440_map_io(void);
|
||||
extern void s3c2440_init_clocks(int xtal);
|
||||
extern void s3c2440_init_irq(void);
|
||||
#else
|
||||
#define s3c2440_init NULL
|
||||
@ -86,6 +85,7 @@ extern void s3c2440_init_irq(void);
|
||||
#ifdef CONFIG_CPU_S3C2442
|
||||
extern int s3c2442_init(void);
|
||||
extern void s3c2442_map_io(void);
|
||||
extern void s3c2442_init_clocks(int xtal);
|
||||
extern void s3c2442_init_irq(void);
|
||||
#else
|
||||
#define s3c2442_init NULL
|
||||
@ -114,4 +114,21 @@ extern struct platform_device s3c2412_device_dma;
|
||||
extern struct platform_device s3c2440_device_dma;
|
||||
extern struct platform_device s3c2443_device_dma;
|
||||
|
||||
extern struct platform_device s3c2410_device_dclk;
|
||||
|
||||
#ifdef CONFIG_S3C2410_COMMON_CLK
|
||||
void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f,
|
||||
int current_soc,
|
||||
void __iomem *reg_base);
|
||||
#endif
|
||||
#ifdef CONFIG_S3C2412_COMMON_CLK
|
||||
void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f,
|
||||
unsigned long ext_f, void __iomem *reg_base);
|
||||
#endif
|
||||
#ifdef CONFIG_S3C2443_COMMON_CLK
|
||||
void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f,
|
||||
int current_soc,
|
||||
void __iomem *reg_base);
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <linux/errno.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/clk.h>
|
||||
|
||||
#include <mach/map.h>
|
||||
#include <mach/regs-clock.h>
|
||||
@ -60,5 +61,6 @@ void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
|
||||
*/
|
||||
void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg)
|
||||
{
|
||||
__raw_writel(cfg->pll.driver_data, S3C2410_MPLLCON);
|
||||
if (!IS_ERR(cfg->mpll))
|
||||
clk_set_rate(cfg->mpll, cfg->pll.frequency);
|
||||
}
|
||||
|
@ -42,24 +42,6 @@
|
||||
#define S3C2410_CLKCON_IIS (1<<17)
|
||||
#define S3C2410_CLKCON_SPI (1<<18)
|
||||
|
||||
/* DCLKCON register addresses in gpio.h */
|
||||
|
||||
#define S3C2410_DCLKCON_DCLK0EN (1<<0)
|
||||
#define S3C2410_DCLKCON_DCLK0_PCLK (0<<1)
|
||||
#define S3C2410_DCLKCON_DCLK0_UCLK (1<<1)
|
||||
#define S3C2410_DCLKCON_DCLK0_DIV(x) (((x) - 1 )<<4)
|
||||
#define S3C2410_DCLKCON_DCLK0_CMP(x) (((x) - 1 )<<8)
|
||||
#define S3C2410_DCLKCON_DCLK0_DIV_MASK ((0xf)<<4)
|
||||
#define S3C2410_DCLKCON_DCLK0_CMP_MASK ((0xf)<<8)
|
||||
|
||||
#define S3C2410_DCLKCON_DCLK1EN (1<<16)
|
||||
#define S3C2410_DCLKCON_DCLK1_PCLK (0<<17)
|
||||
#define S3C2410_DCLKCON_DCLK1_UCLK (1<<17)
|
||||
#define S3C2410_DCLKCON_DCLK1_DIV(x) (((x) - 1) <<20)
|
||||
#define S3C2410_DCLKCON_DCLK1_CMP(x) (((x) - 1) <<24)
|
||||
#define S3C2410_DCLKCON_DCLK1_DIV_MASK ((0xf) <<20)
|
||||
#define S3C2410_DCLKCON_DCLK1_CMP_MASK ((0xf) <<24)
|
||||
|
||||
#define S3C2410_CLKDIVN_PDIVN (1<<0)
|
||||
#define S3C2410_CLKDIVN_HDIVN (1<<1)
|
||||
|
||||
|
@ -457,9 +457,6 @@
|
||||
|
||||
/* miscellaneous control */
|
||||
#define S3C2410_MISCCR S3C2410_GPIOREG(0x80)
|
||||
#define S3C2410_DCLKCON S3C2410_GPIOREG(0x84)
|
||||
|
||||
#define S3C24XX_DCLKCON S3C24XX_GPIOREG2(0x84)
|
||||
|
||||
/* see clock.h for dclk definitions */
|
||||
|
||||
|
@ -161,11 +161,16 @@ static struct platform_device *amlm5900_devices[] __initdata = {
|
||||
static void __init amlm5900_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
|
||||
s3c24xx_init_clocks(0);
|
||||
s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init amlm5900_init_time(void)
|
||||
{
|
||||
s3c2410_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FB_S3C2410
|
||||
static struct s3c2410fb_display __initdata amlm5900_lcd_info = {
|
||||
.width = 160,
|
||||
@ -241,6 +246,6 @@ MACHINE_START(AML_M5900, "AML_M5900")
|
||||
.map_io = amlm5900_map_io,
|
||||
.init_irq = s3c2410_init_irq,
|
||||
.init_machine = amlm5900_init,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = amlm5900_init_time,
|
||||
.restart = s3c2410_restart,
|
||||
MACHINE_END
|
||||
|
@ -46,7 +46,6 @@
|
||||
|
||||
#include <net/ax88796.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/devs.h>
|
||||
#include <plat/cpu.h>
|
||||
#include <linux/platform_data/asoc-s3c24xx_simtec.h>
|
||||
@ -352,6 +351,7 @@ static struct platform_device anubis_device_sm501 = {
|
||||
/* Standard Anubis devices */
|
||||
|
||||
static struct platform_device *anubis_devices[] __initdata = {
|
||||
&s3c2410_device_dclk,
|
||||
&s3c_device_ohci,
|
||||
&s3c_device_wdt,
|
||||
&s3c_device_adc,
|
||||
@ -364,14 +364,6 @@ static struct platform_device *anubis_devices[] __initdata = {
|
||||
&anubis_device_sm501,
|
||||
};
|
||||
|
||||
static struct clk *anubis_clocks[] __initdata = {
|
||||
&s3c24xx_dclk0,
|
||||
&s3c24xx_dclk1,
|
||||
&s3c24xx_clkout0,
|
||||
&s3c24xx_clkout1,
|
||||
&s3c24xx_uclk,
|
||||
};
|
||||
|
||||
/* I2C devices. */
|
||||
|
||||
static struct i2c_board_info anubis_i2c_devs[] __initdata = {
|
||||
@ -394,23 +386,7 @@ static struct s3c24xx_audio_simtec_pdata __initdata anubis_audio = {
|
||||
|
||||
static void __init anubis_map_io(void)
|
||||
{
|
||||
/* initialise the clocks */
|
||||
|
||||
s3c24xx_dclk0.parent = &clk_upll;
|
||||
s3c24xx_dclk0.rate = 12*1000*1000;
|
||||
|
||||
s3c24xx_dclk1.parent = &clk_upll;
|
||||
s3c24xx_dclk1.rate = 24*1000*1000;
|
||||
|
||||
s3c24xx_clkout0.parent = &s3c24xx_dclk0;
|
||||
s3c24xx_clkout1.parent = &s3c24xx_dclk1;
|
||||
|
||||
s3c24xx_uclk.parent = &s3c24xx_clkout1;
|
||||
|
||||
s3c24xx_register_clocks(anubis_clocks, ARRAY_SIZE(anubis_clocks));
|
||||
|
||||
s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
|
||||
s3c24xx_init_clocks(0);
|
||||
s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
|
||||
@ -428,6 +404,12 @@ static void __init anubis_map_io(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void __init anubis_init_time(void)
|
||||
{
|
||||
s3c2440_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init anubis_init(void)
|
||||
{
|
||||
s3c_i2c0_set_platdata(NULL);
|
||||
@ -447,6 +429,6 @@ MACHINE_START(ANUBIS, "Simtec-Anubis")
|
||||
.map_io = anubis_map_io,
|
||||
.init_machine = anubis_init,
|
||||
.init_irq = s3c2440_init_irq,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = anubis_init_time,
|
||||
.restart = s3c244x_restart,
|
||||
MACHINE_END
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/devs.h>
|
||||
#include <plat/cpu.h>
|
||||
#include <linux/platform_data/mmc-s3cmci.h>
|
||||
@ -192,11 +191,16 @@ static struct platform_device *at2440evb_devices[] __initdata = {
|
||||
static void __init at2440evb_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
|
||||
s3c24xx_init_clocks(16934400);
|
||||
s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init at2440evb_init_time(void)
|
||||
{
|
||||
s3c2440_init_clocks(16934400);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init at2440evb_init(void)
|
||||
{
|
||||
s3c24xx_fb_set_platdata(&at2440evb_fb_info);
|
||||
@ -213,6 +217,6 @@ MACHINE_START(AT2440EVB, "AT2440EVB")
|
||||
.map_io = at2440evb_map_io,
|
||||
.init_machine = at2440evb_init,
|
||||
.init_irq = s3c2440_init_irq,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = at2440evb_init_time,
|
||||
.restart = s3c244x_restart,
|
||||
MACHINE_END
|
||||
|
@ -51,7 +51,6 @@
|
||||
#include <mach/regs-lcd.h>
|
||||
#include <mach/gpio-samsung.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/cpu-freq.h>
|
||||
#include <plat/devs.h>
|
||||
@ -523,6 +522,7 @@ static struct s3c_hwmon_pdata bast_hwmon_info = {
|
||||
// cat /sys/devices/platform/s3c24xx-adc/s3c-hwmon/in_0
|
||||
|
||||
static struct platform_device *bast_devices[] __initdata = {
|
||||
&s3c2410_device_dclk,
|
||||
&s3c_device_ohci,
|
||||
&s3c_device_lcd,
|
||||
&s3c_device_wdt,
|
||||
@ -537,14 +537,6 @@ static struct platform_device *bast_devices[] __initdata = {
|
||||
&bast_sio,
|
||||
};
|
||||
|
||||
static struct clk *bast_clocks[] __initdata = {
|
||||
&s3c24xx_dclk0,
|
||||
&s3c24xx_dclk1,
|
||||
&s3c24xx_clkout0,
|
||||
&s3c24xx_clkout1,
|
||||
&s3c24xx_uclk,
|
||||
};
|
||||
|
||||
static struct s3c_cpufreq_board __initdata bast_cpufreq = {
|
||||
.refresh = 7800, /* 7.8usec */
|
||||
.auto_io = 1,
|
||||
@ -558,29 +550,19 @@ static struct s3c24xx_audio_simtec_pdata __initdata bast_audio = {
|
||||
|
||||
static void __init bast_map_io(void)
|
||||
{
|
||||
/* initialise the clocks */
|
||||
|
||||
s3c24xx_dclk0.parent = &clk_upll;
|
||||
s3c24xx_dclk0.rate = 12*1000*1000;
|
||||
|
||||
s3c24xx_dclk1.parent = &clk_upll;
|
||||
s3c24xx_dclk1.rate = 24*1000*1000;
|
||||
|
||||
s3c24xx_clkout0.parent = &s3c24xx_dclk0;
|
||||
s3c24xx_clkout1.parent = &s3c24xx_dclk1;
|
||||
|
||||
s3c24xx_uclk.parent = &s3c24xx_clkout1;
|
||||
|
||||
s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks));
|
||||
|
||||
s3c_hwmon_set_platdata(&bast_hwmon_info);
|
||||
|
||||
s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
|
||||
s3c24xx_init_clocks(0);
|
||||
s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init bast_init_time(void)
|
||||
{
|
||||
s3c2410_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init bast_init(void)
|
||||
{
|
||||
register_syscore_ops(&bast_pm_syscore_ops);
|
||||
@ -608,6 +590,6 @@ MACHINE_START(BAST, "Simtec-BAST")
|
||||
.map_io = bast_map_io,
|
||||
.init_irq = s3c2410_init_irq,
|
||||
.init_machine = bast_init,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = bast_init_time,
|
||||
.restart = s3c2410_restart,
|
||||
MACHINE_END
|
||||
|
@ -501,7 +501,6 @@ static struct platform_device gta02_buttons_device = {
|
||||
static void __init gta02_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
|
||||
s3c24xx_init_clocks(12000000);
|
||||
s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
@ -585,6 +584,11 @@ static void __init gta02_machine_init(void)
|
||||
regulator_has_full_constraints();
|
||||
}
|
||||
|
||||
static void __init gta02_init_time(void)
|
||||
{
|
||||
s3c2442_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
MACHINE_START(NEO1973_GTA02, "GTA02")
|
||||
/* Maintainer: Nelson Castillo <arhuaco@freaks-unidos.net> */
|
||||
@ -592,6 +596,6 @@ MACHINE_START(NEO1973_GTA02, "GTA02")
|
||||
.map_io = gta02_map_io,
|
||||
.init_irq = s3c2442_init_irq,
|
||||
.init_machine = gta02_machine_init,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = gta02_init_time,
|
||||
.restart = s3c244x_restart,
|
||||
MACHINE_END
|
||||
|
@ -57,7 +57,6 @@
|
||||
#include <mach/regs-lcd.h>
|
||||
#include <mach/gpio-samsung.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/devs.h>
|
||||
#include <plat/gpio-cfg.h>
|
||||
@ -646,7 +645,6 @@ static struct platform_device *h1940_devices[] __initdata = {
|
||||
static void __init h1940_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
|
||||
s3c24xx_init_clocks(0);
|
||||
s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
|
||||
@ -662,6 +660,12 @@ static void __init h1940_map_io(void)
|
||||
WARN_ON(gpiochip_add(&h1940_latch_gpiochip));
|
||||
}
|
||||
|
||||
static void __init h1940_init_time(void)
|
||||
{
|
||||
s3c2410_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
/* H1940 and RX3715 need to reserve this for suspend */
|
||||
static void __init h1940_reserve(void)
|
||||
{
|
||||
@ -739,6 +743,6 @@ MACHINE_START(H1940, "IPAQ-H1940")
|
||||
.reserve = h1940_reserve,
|
||||
.init_irq = s3c2410_init_irq,
|
||||
.init_machine = h1940_init,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = h1940_init_time,
|
||||
.restart = s3c2410_restart,
|
||||
MACHINE_END
|
||||
|
@ -507,11 +507,16 @@ static struct syscore_ops jive_pm_syscore_ops = {
|
||||
static void __init jive_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
|
||||
s3c24xx_init_clocks(12000000);
|
||||
s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init jive_init_time(void)
|
||||
{
|
||||
s3c2412_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void jive_power_off(void)
|
||||
{
|
||||
printk(KERN_INFO "powering system down...\n");
|
||||
@ -665,6 +670,6 @@ MACHINE_START(JIVE, "JIVE")
|
||||
.init_irq = s3c2412_init_irq,
|
||||
.map_io = jive_map_io,
|
||||
.init_machine = jive_machine_init,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = jive_init_time,
|
||||
.restart = s3c2412_restart,
|
||||
MACHINE_END
|
||||
|
@ -54,7 +54,6 @@
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
#include <plat/gpio-cfg.h>
|
||||
#include <plat/clock.h>
|
||||
#include <plat/devs.h>
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/samsung-time.h>
|
||||
@ -525,11 +524,16 @@ static struct platform_device *mini2440_devices[] __initdata = {
|
||||
static void __init mini2440_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
|
||||
s3c24xx_init_clocks(12000000);
|
||||
s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init mini2440_init_time(void)
|
||||
{
|
||||
s3c2440_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
/*
|
||||
* mini2440_features string
|
||||
*
|
||||
@ -690,6 +694,6 @@ MACHINE_START(MINI2440, "MINI2440")
|
||||
.map_io = mini2440_map_io,
|
||||
.init_machine = mini2440_init,
|
||||
.init_irq = s3c2440_init_irq,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = mini2440_init_time,
|
||||
.restart = s3c244x_restart,
|
||||
MACHINE_END
|
||||
|
@ -45,7 +45,6 @@
|
||||
|
||||
#include <linux/platform_data/i2c-s3c2410.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/devs.h>
|
||||
#include <linux/platform_data/mmc-s3cmci.h>
|
||||
@ -535,11 +534,16 @@ static void __init n30_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
|
||||
n30_hwinit();
|
||||
s3c24xx_init_clocks(0);
|
||||
s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init n30_init_time(void)
|
||||
{
|
||||
s3c2410_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
/* GPB3 is the line that controls the pull-up for the USB D+ line */
|
||||
|
||||
static void __init n30_init(void)
|
||||
@ -591,7 +595,7 @@ MACHINE_START(N30, "Acer-N30")
|
||||
Ben Dooks <ben-linux@fluff.org>
|
||||
*/
|
||||
.atag_offset = 0x100,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = n30_init_time,
|
||||
.init_machine = n30_init,
|
||||
.init_irq = s3c2410_init_irq,
|
||||
.map_io = n30_map_io,
|
||||
@ -602,7 +606,7 @@ MACHINE_START(N35, "Acer-N35")
|
||||
/* Maintainer: Christer Weinigel <christer@weinigel.se>
|
||||
*/
|
||||
.atag_offset = 0x100,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = n30_init_time,
|
||||
.init_machine = n30_init,
|
||||
.init_irq = s3c2410_init_irq,
|
||||
.map_io = n30_map_io,
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include <linux/platform_data/i2c-s3c2410.h>
|
||||
|
||||
#include <plat/gpio-cfg.h>
|
||||
#include <plat/clock.h>
|
||||
#include <plat/devs.h>
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/samsung-time.h>
|
||||
@ -135,13 +134,18 @@ static void __init nexcoder_sensorboard_init(void)
|
||||
static void __init nexcoder_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc));
|
||||
s3c24xx_init_clocks(0);
|
||||
s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
|
||||
nexcoder_sensorboard_init();
|
||||
}
|
||||
|
||||
static void __init nexcoder_init_time(void)
|
||||
{
|
||||
s3c2440_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init nexcoder_init(void)
|
||||
{
|
||||
s3c_i2c0_set_platdata(NULL);
|
||||
@ -154,6 +158,6 @@ MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440")
|
||||
.map_io = nexcoder_map_io,
|
||||
.init_machine = nexcoder_init,
|
||||
.init_irq = s3c2440_init_irq,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = nexcoder_init_time,
|
||||
.restart = s3c244x_restart,
|
||||
MACHINE_END
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include <linux/mtd/nand_ecc.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/cpu-freq.h>
|
||||
#include <plat/devs.h>
|
||||
@ -344,20 +343,13 @@ static struct i2c_board_info osiris_i2c_devs[] __initdata = {
|
||||
/* Standard Osiris devices */
|
||||
|
||||
static struct platform_device *osiris_devices[] __initdata = {
|
||||
&s3c2410_device_dclk,
|
||||
&s3c_device_i2c0,
|
||||
&s3c_device_wdt,
|
||||
&s3c_device_nand,
|
||||
&osiris_pcmcia,
|
||||
};
|
||||
|
||||
static struct clk *osiris_clocks[] __initdata = {
|
||||
&s3c24xx_dclk0,
|
||||
&s3c24xx_dclk1,
|
||||
&s3c24xx_clkout0,
|
||||
&s3c24xx_clkout1,
|
||||
&s3c24xx_uclk,
|
||||
};
|
||||
|
||||
static struct s3c_cpufreq_board __initdata osiris_cpufreq = {
|
||||
.refresh = 7800, /* refresh period is 7.8usec */
|
||||
.auto_io = 1,
|
||||
@ -368,23 +360,7 @@ static void __init osiris_map_io(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
/* initialise the clocks */
|
||||
|
||||
s3c24xx_dclk0.parent = &clk_upll;
|
||||
s3c24xx_dclk0.rate = 12*1000*1000;
|
||||
|
||||
s3c24xx_dclk1.parent = &clk_upll;
|
||||
s3c24xx_dclk1.rate = 24*1000*1000;
|
||||
|
||||
s3c24xx_clkout0.parent = &s3c24xx_dclk0;
|
||||
s3c24xx_clkout1.parent = &s3c24xx_dclk1;
|
||||
|
||||
s3c24xx_uclk.parent = &s3c24xx_clkout1;
|
||||
|
||||
s3c24xx_register_clocks(osiris_clocks, ARRAY_SIZE(osiris_clocks));
|
||||
|
||||
s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
|
||||
s3c24xx_init_clocks(0);
|
||||
s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
|
||||
@ -408,6 +384,12 @@ static void __init osiris_map_io(void)
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
static void __init osiris_init_time(void)
|
||||
{
|
||||
s3c2440_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init osiris_init(void)
|
||||
{
|
||||
register_syscore_ops(&osiris_pm_syscore_ops);
|
||||
@ -429,6 +411,6 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS")
|
||||
.map_io = osiris_map_io,
|
||||
.init_irq = s3c2440_init_irq,
|
||||
.init_machine = osiris_init,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = osiris_init_time,
|
||||
.restart = s3c244x_restart,
|
||||
MACHINE_END
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include <mach/hardware.h>
|
||||
#include <mach/regs-gpio.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/devs.h>
|
||||
#include <plat/samsung-time.h>
|
||||
@ -100,11 +99,16 @@ static struct platform_device *otom11_devices[] __initdata = {
|
||||
static void __init otom11_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc));
|
||||
s3c24xx_init_clocks(0);
|
||||
s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init otom11_init_time(void)
|
||||
{
|
||||
s3c2410_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init otom11_init(void)
|
||||
{
|
||||
s3c_i2c0_set_platdata(NULL);
|
||||
@ -117,6 +121,6 @@ MACHINE_START(OTOM, "Nex Vision - Otom 1.1")
|
||||
.map_io = otom11_map_io,
|
||||
.init_machine = otom11_init,
|
||||
.init_irq = s3c2410_init_irq,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = otom11_init_time,
|
||||
.restart = s3c2410_restart,
|
||||
MACHINE_END
|
||||
|
@ -304,11 +304,16 @@ __setup("tft=", qt2410_tft_setup);
|
||||
static void __init qt2410_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
|
||||
s3c24xx_init_clocks(12*1000*1000);
|
||||
s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init qt2410_init_time(void)
|
||||
{
|
||||
s3c2410_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init qt2410_machine_init(void)
|
||||
{
|
||||
s3c_nand_set_platdata(&qt2410_nand_info);
|
||||
@ -346,6 +351,6 @@ MACHINE_START(QT2410, "QT2410")
|
||||
.map_io = qt2410_map_io,
|
||||
.init_irq = s3c2410_init_irq,
|
||||
.init_machine = qt2410_machine_init,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = qt2410_init_time,
|
||||
.restart = s3c2410_restart,
|
||||
MACHINE_END
|
||||
|
@ -54,7 +54,6 @@
|
||||
#include <mach/regs-lcd.h>
|
||||
#include <mach/gpio-samsung.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/devs.h>
|
||||
#include <plat/pm.h>
|
||||
@ -710,6 +709,7 @@ static struct i2c_board_info rx1950_i2c_devices[] = {
|
||||
};
|
||||
|
||||
static struct platform_device *rx1950_devices[] __initdata = {
|
||||
&s3c2410_device_dclk,
|
||||
&s3c_device_lcd,
|
||||
&s3c_device_wdt,
|
||||
&s3c_device_i2c0,
|
||||
@ -728,20 +728,9 @@ static struct platform_device *rx1950_devices[] __initdata = {
|
||||
&rx1950_leds,
|
||||
};
|
||||
|
||||
static struct clk *rx1950_clocks[] __initdata = {
|
||||
&s3c24xx_clkout0,
|
||||
&s3c24xx_clkout1,
|
||||
};
|
||||
|
||||
static void __init rx1950_map_io(void)
|
||||
{
|
||||
s3c24xx_clkout0.parent = &clk_h;
|
||||
s3c24xx_clkout1.parent = &clk_f;
|
||||
|
||||
s3c24xx_register_clocks(rx1950_clocks, ARRAY_SIZE(rx1950_clocks));
|
||||
|
||||
s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
|
||||
s3c24xx_init_clocks(16934000);
|
||||
s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
|
||||
@ -754,6 +743,12 @@ static void __init rx1950_map_io(void)
|
||||
s3c_pm_init();
|
||||
}
|
||||
|
||||
static void __init rx1950_init_time(void)
|
||||
{
|
||||
s3c2442_init_clocks(16934000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init rx1950_init_machine(void)
|
||||
{
|
||||
int i;
|
||||
@ -816,6 +811,6 @@ MACHINE_START(RX1950, "HP iPAQ RX1950")
|
||||
.reserve = rx1950_reserve,
|
||||
.init_irq = s3c2442_init_irq,
|
||||
.init_machine = rx1950_init_machine,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = rx1950_init_time,
|
||||
.restart = s3c244x_restart,
|
||||
MACHINE_END
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include <mach/regs-lcd.h>
|
||||
#include <mach/gpio-samsung.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/devs.h>
|
||||
#include <plat/pm.h>
|
||||
@ -179,11 +178,16 @@ static struct platform_device *rx3715_devices[] __initdata = {
|
||||
static void __init rx3715_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
|
||||
s3c24xx_init_clocks(16934000);
|
||||
s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init rx3715_init_time(void)
|
||||
{
|
||||
s3c2440_init_clocks(16934000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
/* H1940 and RX3715 need to reserve this for suspend */
|
||||
static void __init rx3715_reserve(void)
|
||||
{
|
||||
@ -210,6 +214,6 @@ MACHINE_START(RX3715, "IPAQ-RX3715")
|
||||
.reserve = rx3715_reserve,
|
||||
.init_irq = s3c2440_init_irq,
|
||||
.init_machine = rx3715_init_machine,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = rx3715_init_time,
|
||||
.restart = s3c244x_restart,
|
||||
MACHINE_END
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <linux/clocksource.h>
|
||||
#include <linux/irqchip.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/serial_core.h>
|
||||
#include <linux/serial_s3c.h>
|
||||
|
||||
#include <asm/mach/arch.h>
|
||||
@ -29,48 +28,14 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/*
|
||||
* The following lookup table is used to override device names when devices
|
||||
* are registered from device tree. This is temporarily added to enable
|
||||
* device tree support addition for the S3C2416 architecture.
|
||||
*
|
||||
* For drivers that require platform data to be provided from the machine
|
||||
* file, a platform data pointer can also be supplied along with the
|
||||
* devices names. Usually, the platform data elements that cannot be parsed
|
||||
* from the device tree by the drivers (example: function pointers) are
|
||||
* supplied. But it should be noted that this is a temporary mechanism and
|
||||
* at some point, the drivers should be capable of parsing all the platform
|
||||
* data from the device tree.
|
||||
*/
|
||||
static const struct of_dev_auxdata s3c2416_auxdata_lookup[] __initconst = {
|
||||
OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART,
|
||||
"s3c2440-uart.0", NULL),
|
||||
OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0x4000,
|
||||
"s3c2440-uart.1", NULL),
|
||||
OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0x8000,
|
||||
"s3c2440-uart.2", NULL),
|
||||
OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0xC000,
|
||||
"s3c2440-uart.3", NULL),
|
||||
OF_DEV_AUXDATA("samsung,s3c6410-sdhci", S3C_PA_HSMMC0,
|
||||
"s3c-sdhci.0", NULL),
|
||||
OF_DEV_AUXDATA("samsung,s3c6410-sdhci", S3C_PA_HSMMC1,
|
||||
"s3c-sdhci.1", NULL),
|
||||
OF_DEV_AUXDATA("samsung,s3c2440-i2c", S3C_PA_IIC,
|
||||
"s3c2440-i2c.0", NULL),
|
||||
{},
|
||||
};
|
||||
|
||||
static void __init s3c2416_dt_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(NULL, 0);
|
||||
s3c24xx_init_clocks(12000000);
|
||||
}
|
||||
|
||||
static void __init s3c2416_dt_machine_init(void)
|
||||
{
|
||||
of_platform_populate(NULL, of_default_bus_match_table,
|
||||
s3c2416_auxdata_lookup, NULL);
|
||||
|
||||
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
|
||||
s3c_pm_init();
|
||||
}
|
||||
|
||||
@ -86,6 +51,5 @@ DT_MACHINE_START(S3C2416_DT, "Samsung S3C2416 (Flattened Device Tree)")
|
||||
.map_io = s3c2416_dt_map_io,
|
||||
.init_irq = irqchip_init,
|
||||
.init_machine = s3c2416_dt_machine_init,
|
||||
.init_time = clocksource_of_init,
|
||||
.restart = s3c2416_restart,
|
||||
MACHINE_END
|
||||
|
@ -99,11 +99,16 @@ static struct platform_device *smdk2410_devices[] __initdata = {
|
||||
static void __init smdk2410_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
|
||||
s3c24xx_init_clocks(0);
|
||||
s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init smdk2410_init_time(void)
|
||||
{
|
||||
s3c2410_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init smdk2410_init(void)
|
||||
{
|
||||
s3c_i2c0_set_platdata(NULL);
|
||||
@ -118,6 +123,6 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switc
|
||||
.map_io = smdk2410_map_io,
|
||||
.init_irq = s3c2410_init_irq,
|
||||
.init_machine = smdk2410_init,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = smdk2410_init_time,
|
||||
.restart = s3c2410_restart,
|
||||
MACHINE_END
|
||||
|
@ -106,11 +106,16 @@ static void __init smdk2413_fixup(struct tag *tags, char **cmdline,
|
||||
static void __init smdk2413_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
|
||||
s3c24xx_init_clocks(12000000);
|
||||
s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init smdk2413_init_time(void)
|
||||
{
|
||||
s3c2412_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init smdk2413_machine_init(void)
|
||||
{ /* Turn off suspend on both USB ports, and switch the
|
||||
* selectable USB port to USB device mode. */
|
||||
@ -159,6 +164,6 @@ MACHINE_START(SMDK2413, "SMDK2413")
|
||||
.init_irq = s3c2412_init_irq,
|
||||
.map_io = smdk2413_map_io,
|
||||
.init_machine = smdk2413_machine_init,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = smdk2413_init_time,
|
||||
.restart = s3c2412_restart,
|
||||
MACHINE_END
|
||||
|
@ -219,10 +219,15 @@ static struct platform_device *smdk2416_devices[] __initdata = {
|
||||
&s3c2443_device_dma,
|
||||
};
|
||||
|
||||
static void __init smdk2416_init_time(void)
|
||||
{
|
||||
s3c2416_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init smdk2416_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
|
||||
s3c24xx_init_clocks(12000000);
|
||||
s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
@ -257,6 +262,6 @@ MACHINE_START(SMDK2416, "SMDK2416")
|
||||
.init_irq = s3c2416_init_irq,
|
||||
.map_io = smdk2416_map_io,
|
||||
.init_machine = smdk2416_machine_init,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = smdk2416_init_time,
|
||||
.restart = s3c2416_restart,
|
||||
MACHINE_END
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include <mach/fb.h>
|
||||
#include <linux/platform_data/i2c-s3c2410.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/devs.h>
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/samsung-time.h>
|
||||
@ -159,11 +158,16 @@ static struct platform_device *smdk2440_devices[] __initdata = {
|
||||
static void __init smdk2440_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
|
||||
s3c24xx_init_clocks(16934400);
|
||||
s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init smdk2440_init_time(void)
|
||||
{
|
||||
s3c2440_init_clocks(16934400);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init smdk2440_machine_init(void)
|
||||
{
|
||||
s3c24xx_fb_set_platdata(&smdk2440_fb_info);
|
||||
@ -180,6 +184,6 @@ MACHINE_START(S3C2440, "SMDK2440")
|
||||
.init_irq = s3c2440_init_irq,
|
||||
.map_io = smdk2440_map_io,
|
||||
.init_machine = smdk2440_machine_init,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = smdk2440_init_time,
|
||||
.restart = s3c244x_restart,
|
||||
MACHINE_END
|
||||
|
@ -121,11 +121,16 @@ static struct platform_device *smdk2443_devices[] __initdata = {
|
||||
static void __init smdk2443_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc));
|
||||
s3c24xx_init_clocks(12000000);
|
||||
s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init smdk2443_init_time(void)
|
||||
{
|
||||
s3c2443_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init smdk2443_machine_init(void)
|
||||
{
|
||||
s3c_i2c0_set_platdata(NULL);
|
||||
@ -145,6 +150,6 @@ MACHINE_START(SMDK2443, "SMDK2443")
|
||||
.init_irq = s3c2443_init_irq,
|
||||
.map_io = smdk2443_map_io,
|
||||
.init_machine = smdk2443_machine_init,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = smdk2443_init_time,
|
||||
.restart = s3c2443_restart,
|
||||
MACHINE_END
|
||||
|
@ -135,11 +135,16 @@ static struct platform_device *tct_hammer_devices[] __initdata = {
|
||||
static void __init tct_hammer_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
|
||||
s3c24xx_init_clocks(0);
|
||||
s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init tct_hammer_init_time(void)
|
||||
{
|
||||
s3c2410_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init tct_hammer_init(void)
|
||||
{
|
||||
s3c_i2c0_set_platdata(NULL);
|
||||
@ -151,6 +156,6 @@ MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
|
||||
.map_io = tct_hammer_map_io,
|
||||
.init_irq = s3c2410_init_irq,
|
||||
.init_machine = tct_hammer_init,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = tct_hammer_init_time,
|
||||
.restart = s3c2410_restart,
|
||||
MACHINE_END
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include <mach/regs-gpio.h>
|
||||
#include <mach/gpio-samsung.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
#include <plat/cpu.h>
|
||||
#include <plat/devs.h>
|
||||
#include <plat/samsung-time.h>
|
||||
@ -286,6 +285,7 @@ static struct i2c_board_info vr1000_i2c_devs[] __initdata = {
|
||||
/* devices for this board */
|
||||
|
||||
static struct platform_device *vr1000_devices[] __initdata = {
|
||||
&s3c2410_device_dclk,
|
||||
&s3c_device_ohci,
|
||||
&s3c_device_lcd,
|
||||
&s3c_device_wdt,
|
||||
@ -299,14 +299,6 @@ static struct platform_device *vr1000_devices[] __initdata = {
|
||||
&vr1000_led3,
|
||||
};
|
||||
|
||||
static struct clk *vr1000_clocks[] __initdata = {
|
||||
&s3c24xx_dclk0,
|
||||
&s3c24xx_dclk1,
|
||||
&s3c24xx_clkout0,
|
||||
&s3c24xx_clkout1,
|
||||
&s3c24xx_uclk,
|
||||
};
|
||||
|
||||
static void vr1000_power_off(void)
|
||||
{
|
||||
gpio_direction_output(S3C2410_GPB(9), 1);
|
||||
@ -314,29 +306,19 @@ static void vr1000_power_off(void)
|
||||
|
||||
static void __init vr1000_map_io(void)
|
||||
{
|
||||
/* initialise clock sources */
|
||||
|
||||
s3c24xx_dclk0.parent = &clk_upll;
|
||||
s3c24xx_dclk0.rate = 12*1000*1000;
|
||||
|
||||
s3c24xx_dclk1.parent = NULL;
|
||||
s3c24xx_dclk1.rate = 3692307;
|
||||
|
||||
s3c24xx_clkout0.parent = &s3c24xx_dclk0;
|
||||
s3c24xx_clkout1.parent = &s3c24xx_dclk1;
|
||||
|
||||
s3c24xx_uclk.parent = &s3c24xx_clkout1;
|
||||
|
||||
s3c24xx_register_clocks(vr1000_clocks, ARRAY_SIZE(vr1000_clocks));
|
||||
|
||||
pm_power_off = vr1000_power_off;
|
||||
|
||||
s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
|
||||
s3c24xx_init_clocks(0);
|
||||
s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init vr1000_init_time(void)
|
||||
{
|
||||
s3c2410_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init vr1000_init(void)
|
||||
{
|
||||
s3c_i2c0_set_platdata(NULL);
|
||||
@ -357,6 +339,6 @@ MACHINE_START(VR1000, "Thorcom-VR1000")
|
||||
.map_io = vr1000_map_io,
|
||||
.init_machine = vr1000_init,
|
||||
.init_irq = s3c2410_init_irq,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = vr1000_init_time,
|
||||
.restart = s3c2410_restart,
|
||||
MACHINE_END
|
||||
|
@ -142,11 +142,16 @@ static void __init vstms_fixup(struct tag *tags, char **cmdline,
|
||||
static void __init vstms_map_io(void)
|
||||
{
|
||||
s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
|
||||
s3c24xx_init_clocks(12000000);
|
||||
s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
|
||||
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
||||
}
|
||||
|
||||
static void __init vstms_init_time(void)
|
||||
{
|
||||
s3c2412_init_clocks(12000000);
|
||||
samsung_timer_init();
|
||||
}
|
||||
|
||||
static void __init vstms_init(void)
|
||||
{
|
||||
s3c_i2c0_set_platdata(NULL);
|
||||
@ -162,6 +167,6 @@ MACHINE_START(VSTMS, "VSTMS")
|
||||
.init_irq = s3c2412_init_irq,
|
||||
.init_machine = vstms_init,
|
||||
.map_io = vstms_map_io,
|
||||
.init_time = samsung_timer_init,
|
||||
.init_time = vstms_init_time,
|
||||
.restart = s3c2412_restart,
|
||||
MACHINE_END
|
||||
|
@ -51,9 +51,6 @@
|
||||
#define PFX "s3c24xx-pm: "
|
||||
|
||||
static struct sleep_save core_save[] = {
|
||||
SAVE_ITEM(S3C2410_LOCKTIME),
|
||||
SAVE_ITEM(S3C2410_CLKCON),
|
||||
|
||||
/* we restore the timings here, with the proviso that the board
|
||||
* brings the system up in an slower, or equal frequency setting
|
||||
* to the original system.
|
||||
@ -69,18 +66,6 @@ static struct sleep_save core_save[] = {
|
||||
SAVE_ITEM(S3C2410_BANKCON3),
|
||||
SAVE_ITEM(S3C2410_BANKCON4),
|
||||
SAVE_ITEM(S3C2410_BANKCON5),
|
||||
|
||||
#ifndef CONFIG_CPU_FREQ
|
||||
SAVE_ITEM(S3C2410_CLKDIVN),
|
||||
SAVE_ITEM(S3C2410_MPLLCON),
|
||||
SAVE_ITEM(S3C2410_REFRESH),
|
||||
#endif
|
||||
SAVE_ITEM(S3C2410_UPLLCON),
|
||||
SAVE_ITEM(S3C2410_CLKSLOW),
|
||||
};
|
||||
|
||||
static struct sleep_save misc_save[] = {
|
||||
SAVE_ITEM(S3C2410_DCLKCON),
|
||||
};
|
||||
|
||||
/* s3c_pm_check_resume_pin
|
||||
@ -140,12 +125,10 @@ void s3c_pm_configure_extint(void)
|
||||
void s3c_pm_restore_core(void)
|
||||
{
|
||||
s3c_pm_do_restore_core(core_save, ARRAY_SIZE(core_save));
|
||||
s3c_pm_do_restore(misc_save, ARRAY_SIZE(misc_save));
|
||||
}
|
||||
|
||||
void s3c_pm_save_core(void)
|
||||
{
|
||||
s3c_pm_do_save(misc_save, ARRAY_SIZE(misc_save));
|
||||
s3c_pm_do_save(core_save, ARRAY_SIZE(core_save));
|
||||
}
|
||||
|
||||
|
@ -85,62 +85,6 @@ void __init s3c2410_map_io(void)
|
||||
|
||||
void __init_or_cpufreq s3c2410_setup_clocks(void)
|
||||
{
|
||||
struct clk *xtal_clk;
|
||||
unsigned long tmp;
|
||||
unsigned long xtal;
|
||||
unsigned long fclk;
|
||||
unsigned long hclk;
|
||||
unsigned long pclk;
|
||||
|
||||
xtal_clk = clk_get(NULL, "xtal");
|
||||
xtal = clk_get_rate(xtal_clk);
|
||||
clk_put(xtal_clk);
|
||||
|
||||
/* now we've got our machine bits initialised, work out what
|
||||
* clocks we've got */
|
||||
|
||||
fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal);
|
||||
|
||||
tmp = __raw_readl(S3C2410_CLKDIVN);
|
||||
|
||||
/* work out clock scalings */
|
||||
|
||||
hclk = fclk / ((tmp & S3C2410_CLKDIVN_HDIVN) ? 2 : 1);
|
||||
pclk = hclk / ((tmp & S3C2410_CLKDIVN_PDIVN) ? 2 : 1);
|
||||
|
||||
/* print brieft summary of clocks, etc */
|
||||
|
||||
printk("S3C2410: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n",
|
||||
print_mhz(fclk), print_mhz(hclk), print_mhz(pclk));
|
||||
|
||||
/* initialise the clocks here, to allow other things like the
|
||||
* console to use them
|
||||
*/
|
||||
|
||||
s3c24xx_setup_clocks(fclk, hclk, pclk);
|
||||
}
|
||||
|
||||
/* fake ARMCLK for use with cpufreq, etc. */
|
||||
|
||||
static struct clk s3c2410_armclk = {
|
||||
.name = "armclk",
|
||||
.parent = &clk_f,
|
||||
.id = -1,
|
||||
};
|
||||
|
||||
static struct clk_lookup s3c2410_clk_lookup[] = {
|
||||
CLKDEV_INIT(NULL, "clk_uart_baud0", &clk_p),
|
||||
CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk),
|
||||
};
|
||||
|
||||
void __init s3c2410_init_clocks(int xtal)
|
||||
{
|
||||
s3c24xx_register_baseclocks(xtal);
|
||||
s3c2410_setup_clocks();
|
||||
s3c2410_baseclk_add();
|
||||
s3c24xx_register_clock(&s3c2410_armclk);
|
||||
clkdev_add_table(s3c2410_clk_lookup, ARRAY_SIZE(s3c2410_clk_lookup));
|
||||
samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
|
||||
}
|
||||
|
||||
struct bus_type s3c2410_subsys = {
|
||||
|
@ -173,49 +173,6 @@ void __init s3c2412_map_io(void)
|
||||
|
||||
void __init_or_cpufreq s3c2412_setup_clocks(void)
|
||||
{
|
||||
struct clk *xtal_clk;
|
||||
unsigned long tmp;
|
||||
unsigned long xtal;
|
||||
unsigned long fclk;
|
||||
unsigned long hclk;
|
||||
unsigned long pclk;
|
||||
|
||||
xtal_clk = clk_get(NULL, "xtal");
|
||||
xtal = clk_get_rate(xtal_clk);
|
||||
clk_put(xtal_clk);
|
||||
|
||||
/* now we've got our machine bits initialised, work out what
|
||||
* clocks we've got */
|
||||
|
||||
fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal * 2);
|
||||
|
||||
clk_mpll.rate = fclk;
|
||||
|
||||
tmp = __raw_readl(S3C2410_CLKDIVN);
|
||||
|
||||
/* work out clock scalings */
|
||||
|
||||
hclk = fclk / ((tmp & S3C2412_CLKDIVN_HDIVN_MASK) + 1);
|
||||
hclk /= ((tmp & S3C2412_CLKDIVN_ARMDIVN) ? 2 : 1);
|
||||
pclk = hclk / ((tmp & S3C2412_CLKDIVN_PDIVN) ? 2 : 1);
|
||||
|
||||
/* print brieft summary of clocks, etc */
|
||||
|
||||
printk("S3C2412: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n",
|
||||
print_mhz(fclk), print_mhz(hclk), print_mhz(pclk));
|
||||
|
||||
s3c24xx_setup_clocks(fclk, hclk, pclk);
|
||||
}
|
||||
|
||||
void __init s3c2412_init_clocks(int xtal)
|
||||
{
|
||||
/* initialise the clocks here, to allow other things like the
|
||||
* console to use them
|
||||
*/
|
||||
|
||||
s3c24xx_register_baseclocks(xtal);
|
||||
s3c2412_setup_clocks();
|
||||
s3c2412_baseclk_add();
|
||||
}
|
||||
|
||||
/* need to register the subsystem before we actually register the device, and
|
||||
|
@ -53,117 +53,6 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/* S3C2442 extended clock support */
|
||||
|
||||
static unsigned long s3c2442_camif_upll_round(struct clk *clk,
|
||||
unsigned long rate)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
int div;
|
||||
|
||||
if (rate > parent_rate)
|
||||
return parent_rate;
|
||||
|
||||
div = parent_rate / rate;
|
||||
|
||||
if (div == 3)
|
||||
return parent_rate / 3;
|
||||
|
||||
/* note, we remove the +/- 1 calculations for the divisor */
|
||||
|
||||
div /= 2;
|
||||
|
||||
if (div < 1)
|
||||
div = 1;
|
||||
else if (div > 16)
|
||||
div = 16;
|
||||
|
||||
return parent_rate / (div * 2);
|
||||
}
|
||||
|
||||
static int s3c2442_camif_upll_setrate(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
unsigned long parent_rate = clk_get_rate(clk->parent);
|
||||
unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
|
||||
|
||||
rate = s3c2442_camif_upll_round(clk, rate);
|
||||
|
||||
camdivn &= ~S3C2442_CAMDIVN_CAMCLK_DIV3;
|
||||
|
||||
if (rate == parent_rate) {
|
||||
camdivn &= ~S3C2440_CAMDIVN_CAMCLK_SEL;
|
||||
} else if ((parent_rate / rate) == 3) {
|
||||
camdivn |= S3C2440_CAMDIVN_CAMCLK_SEL;
|
||||
camdivn |= S3C2442_CAMDIVN_CAMCLK_DIV3;
|
||||
} else {
|
||||
camdivn &= ~S3C2440_CAMDIVN_CAMCLK_MASK;
|
||||
camdivn |= S3C2440_CAMDIVN_CAMCLK_SEL;
|
||||
camdivn |= (((parent_rate / rate) / 2) - 1);
|
||||
}
|
||||
|
||||
__raw_writel(camdivn, S3C2440_CAMDIVN);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Extra S3C2442 clocks */
|
||||
|
||||
static struct clk s3c2442_clk_cam = {
|
||||
.name = "camif",
|
||||
.id = -1,
|
||||
.enable = s3c2410_clkcon_enable,
|
||||
.ctrlbit = S3C2440_CLKCON_CAMERA,
|
||||
};
|
||||
|
||||
static struct clk s3c2442_clk_cam_upll = {
|
||||
.name = "camif-upll",
|
||||
.id = -1,
|
||||
.ops = &(struct clk_ops) {
|
||||
.set_rate = s3c2442_camif_upll_setrate,
|
||||
.round_rate = s3c2442_camif_upll_round,
|
||||
},
|
||||
};
|
||||
|
||||
static int s3c2442_clk_add(struct device *dev, struct subsys_interface *sif)
|
||||
{
|
||||
struct clk *clock_upll;
|
||||
struct clk *clock_h;
|
||||
struct clk *clock_p;
|
||||
|
||||
clock_p = clk_get(NULL, "pclk");
|
||||
clock_h = clk_get(NULL, "hclk");
|
||||
clock_upll = clk_get(NULL, "upll");
|
||||
|
||||
if (IS_ERR(clock_p) || IS_ERR(clock_h) || IS_ERR(clock_upll)) {
|
||||
printk(KERN_ERR "S3C2442: Failed to get parent clocks\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
s3c2442_clk_cam.parent = clock_h;
|
||||
s3c2442_clk_cam_upll.parent = clock_upll;
|
||||
|
||||
s3c24xx_register_clock(&s3c2442_clk_cam);
|
||||
s3c24xx_register_clock(&s3c2442_clk_cam_upll);
|
||||
|
||||
clk_disable(&s3c2442_clk_cam);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct subsys_interface s3c2442_clk_interface = {
|
||||
.name = "s3c2442_clk",
|
||||
.subsys = &s3c2442_subsys,
|
||||
.add_dev = s3c2442_clk_add,
|
||||
};
|
||||
|
||||
static __init int s3c2442_clk_init(void)
|
||||
{
|
||||
return subsys_interface_register(&s3c2442_clk_interface);
|
||||
}
|
||||
|
||||
arch_initcall(s3c2442_clk_init);
|
||||
|
||||
|
||||
static struct device s3c2442_dev = {
|
||||
.bus = &s3c2442_subsys,
|
||||
};
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include <plat/nand-core.h>
|
||||
#include <plat/watchdog-reset.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "regs-dsc.h"
|
||||
|
||||
static struct map_desc s3c244x_iodesc[] __initdata = {
|
||||
@ -74,67 +75,11 @@ void __init s3c244x_map_io(void)
|
||||
s3c_nand_setname("s3c2440-nand");
|
||||
s3c_device_ts.name = "s3c2440-ts";
|
||||
s3c_device_usbgadget.name = "s3c2440-usbgadget";
|
||||
s3c2410_device_dclk.name = "s3c2440-dclk";
|
||||
}
|
||||
|
||||
void __init_or_cpufreq s3c244x_setup_clocks(void)
|
||||
{
|
||||
struct clk *xtal_clk;
|
||||
unsigned long clkdiv;
|
||||
unsigned long camdiv;
|
||||
unsigned long xtal;
|
||||
unsigned long hclk, fclk, pclk;
|
||||
int hdiv = 1;
|
||||
|
||||
xtal_clk = clk_get(NULL, "xtal");
|
||||
xtal = clk_get_rate(xtal_clk);
|
||||
clk_put(xtal_clk);
|
||||
|
||||
fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal) * 2;
|
||||
|
||||
clkdiv = __raw_readl(S3C2410_CLKDIVN);
|
||||
camdiv = __raw_readl(S3C2440_CAMDIVN);
|
||||
|
||||
/* work out clock scalings */
|
||||
|
||||
switch (clkdiv & S3C2440_CLKDIVN_HDIVN_MASK) {
|
||||
case S3C2440_CLKDIVN_HDIVN_1:
|
||||
hdiv = 1;
|
||||
break;
|
||||
|
||||
case S3C2440_CLKDIVN_HDIVN_2:
|
||||
hdiv = 2;
|
||||
break;
|
||||
|
||||
case S3C2440_CLKDIVN_HDIVN_4_8:
|
||||
hdiv = (camdiv & S3C2440_CAMDIVN_HCLK4_HALF) ? 8 : 4;
|
||||
break;
|
||||
|
||||
case S3C2440_CLKDIVN_HDIVN_3_6:
|
||||
hdiv = (camdiv & S3C2440_CAMDIVN_HCLK3_HALF) ? 6 : 3;
|
||||
break;
|
||||
}
|
||||
|
||||
hclk = fclk / hdiv;
|
||||
pclk = hclk / ((clkdiv & S3C2440_CLKDIVN_PDIVN) ? 2 : 1);
|
||||
|
||||
/* print brief summary of clocks, etc */
|
||||
|
||||
printk("S3C244X: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n",
|
||||
print_mhz(fclk), print_mhz(hclk), print_mhz(pclk));
|
||||
|
||||
s3c24xx_setup_clocks(fclk, hclk, pclk);
|
||||
}
|
||||
|
||||
void __init s3c244x_init_clocks(int xtal)
|
||||
{
|
||||
/* initialise the clocks here, to allow other things like the
|
||||
* console to use them, and to add new ones after the initialisation
|
||||
*/
|
||||
|
||||
s3c24xx_register_baseclocks(xtal);
|
||||
s3c244x_setup_clocks();
|
||||
s3c2410_baseclk_add();
|
||||
samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
|
||||
}
|
||||
|
||||
/* Since the S3C2442 and S3C2440 share items, put both subsystems here */
|
||||
|
@ -119,6 +119,7 @@ struct s3c_plltab {
|
||||
struct s3c_cpufreq_config {
|
||||
struct s3c_freq freq;
|
||||
struct s3c_freq max;
|
||||
struct clk *mpll;
|
||||
struct cpufreq_frequency_table pll;
|
||||
struct s3c_clkdivs divs;
|
||||
struct s3c_cpufreq_info *info; /* for core, not drivers */
|
||||
|
@ -115,3 +115,5 @@ endmenu
|
||||
|
||||
source "drivers/clk/bcm/Kconfig"
|
||||
source "drivers/clk/mvebu/Kconfig"
|
||||
|
||||
source "drivers/clk/samsung/Kconfig"
|
||||
|
@ -41,7 +41,7 @@ obj-$(CONFIG_PLAT_ORION) += mvebu/
|
||||
obj-$(CONFIG_ARCH_MXS) += mxs/
|
||||
obj-$(CONFIG_COMMON_CLK_QCOM) += qcom/
|
||||
obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/
|
||||
obj-$(CONFIG_PLAT_SAMSUNG) += samsung/
|
||||
obj-$(CONFIG_COMMON_CLK_SAMSUNG) += samsung/
|
||||
obj-$(CONFIG_ARCH_SHMOBILE_MULTI) += shmobile/
|
||||
obj-$(CONFIG_ARCH_SIRF) += sirf/
|
||||
obj-$(CONFIG_ARCH_SOCFPGA) += socfpga/
|
||||
|
26
drivers/clk/samsung/Kconfig
Normal file
26
drivers/clk/samsung/Kconfig
Normal file
@ -0,0 +1,26 @@
|
||||
config COMMON_CLK_SAMSUNG
|
||||
bool
|
||||
select COMMON_CLK
|
||||
|
||||
config S3C2410_COMMON_CLK
|
||||
bool
|
||||
select COMMON_CLK_SAMSUNG
|
||||
help
|
||||
Build the s3c2410 clock driver based on the common clock framework.
|
||||
|
||||
config S3C2410_COMMON_DCLK
|
||||
bool
|
||||
select COMMON_CLK_SAMSUNG
|
||||
select REGMAP_MMIO
|
||||
help
|
||||
Temporary symbol to build the dclk driver based on the common clock
|
||||
framework.
|
||||
|
||||
config S3C2412_COMMON_CLK
|
||||
bool
|
||||
select COMMON_CLK_SAMSUNG
|
||||
|
||||
config S3C2443_COMMON_CLK
|
||||
bool
|
||||
select COMMON_CLK_SAMSUNG
|
||||
|
@ -3,9 +3,15 @@
|
||||
#
|
||||
|
||||
obj-$(CONFIG_COMMON_CLK) += clk.o clk-pll.o
|
||||
obj-$(CONFIG_SOC_EXYNOS3250) += clk-exynos3250.o
|
||||
obj-$(CONFIG_ARCH_EXYNOS4) += clk-exynos4.o
|
||||
obj-$(CONFIG_SOC_EXYNOS5250) += clk-exynos5250.o
|
||||
obj-$(CONFIG_SOC_EXYNOS5260) += clk-exynos5260.o
|
||||
obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o
|
||||
obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o
|
||||
obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o
|
||||
obj-$(CONFIG_S3C2410_COMMON_CLK)+= clk-s3c2410.o
|
||||
obj-$(CONFIG_S3C2410_COMMON_DCLK)+= clk-s3c2410-dclk.o
|
||||
obj-$(CONFIG_S3C2412_COMMON_CLK)+= clk-s3c2412.o
|
||||
obj-$(CONFIG_S3C2443_COMMON_CLK)+= clk-s3c2443.o
|
||||
obj-$(CONFIG_ARCH_S3C64XX) += clk-s3c64xx.o
|
||||
|
780
drivers/clk/samsung/clk-exynos3250.c
Normal file
780
drivers/clk/samsung/clk-exynos3250.c
Normal file
@ -0,0 +1,780 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Common Clock Framework support for Exynos3250 SoC.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clkdev.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/syscore_ops.h>
|
||||
|
||||
#include <dt-bindings/clock/exynos3250.h>
|
||||
|
||||
#include "clk.h"
|
||||
#include "clk-pll.h"
|
||||
|
||||
#define SRC_LEFTBUS 0x4200
|
||||
#define DIV_LEFTBUS 0x4500
|
||||
#define GATE_IP_LEFTBUS 0x4800
|
||||
#define SRC_RIGHTBUS 0x8200
|
||||
#define DIV_RIGHTBUS 0x8500
|
||||
#define GATE_IP_RIGHTBUS 0x8800
|
||||
#define GATE_IP_PERIR 0x8960
|
||||
#define MPLL_LOCK 0xc010
|
||||
#define MPLL_CON0 0xc110
|
||||
#define VPLL_LOCK 0xc020
|
||||
#define VPLL_CON0 0xc120
|
||||
#define UPLL_LOCK 0xc030
|
||||
#define UPLL_CON0 0xc130
|
||||
#define SRC_TOP0 0xc210
|
||||
#define SRC_TOP1 0xc214
|
||||
#define SRC_CAM 0xc220
|
||||
#define SRC_MFC 0xc228
|
||||
#define SRC_G3D 0xc22c
|
||||
#define SRC_LCD 0xc234
|
||||
#define SRC_ISP 0xc238
|
||||
#define SRC_FSYS 0xc240
|
||||
#define SRC_PERIL0 0xc250
|
||||
#define SRC_PERIL1 0xc254
|
||||
#define SRC_MASK_TOP 0xc310
|
||||
#define SRC_MASK_CAM 0xc320
|
||||
#define SRC_MASK_LCD 0xc334
|
||||
#define SRC_MASK_ISP 0xc338
|
||||
#define SRC_MASK_FSYS 0xc340
|
||||
#define SRC_MASK_PERIL0 0xc350
|
||||
#define SRC_MASK_PERIL1 0xc354
|
||||
#define DIV_TOP 0xc510
|
||||
#define DIV_CAM 0xc520
|
||||
#define DIV_MFC 0xc528
|
||||
#define DIV_G3D 0xc52c
|
||||
#define DIV_LCD 0xc534
|
||||
#define DIV_ISP 0xc538
|
||||
#define DIV_FSYS0 0xc540
|
||||
#define DIV_FSYS1 0xc544
|
||||
#define DIV_FSYS2 0xc548
|
||||
#define DIV_PERIL0 0xc550
|
||||
#define DIV_PERIL1 0xc554
|
||||
#define DIV_PERIL3 0xc55c
|
||||
#define DIV_PERIL4 0xc560
|
||||
#define DIV_PERIL5 0xc564
|
||||
#define DIV_CAM1 0xc568
|
||||
#define CLKDIV2_RATIO 0xc580
|
||||
#define GATE_SCLK_CAM 0xc820
|
||||
#define GATE_SCLK_MFC 0xc828
|
||||
#define GATE_SCLK_G3D 0xc82c
|
||||
#define GATE_SCLK_LCD 0xc834
|
||||
#define GATE_SCLK_ISP_TOP 0xc838
|
||||
#define GATE_SCLK_FSYS 0xc840
|
||||
#define GATE_SCLK_PERIL 0xc850
|
||||
#define GATE_IP_CAM 0xc920
|
||||
#define GATE_IP_MFC 0xc928
|
||||
#define GATE_IP_G3D 0xc92c
|
||||
#define GATE_IP_LCD 0xc934
|
||||
#define GATE_IP_ISP 0xc938
|
||||
#define GATE_IP_FSYS 0xc940
|
||||
#define GATE_IP_PERIL 0xc950
|
||||
#define GATE_BLOCK 0xc970
|
||||
#define APLL_LOCK 0x14000
|
||||
#define APLL_CON0 0x14100
|
||||
#define SRC_CPU 0x14200
|
||||
#define DIV_CPU0 0x14500
|
||||
#define DIV_CPU1 0x14504
|
||||
|
||||
/* list of PLLs to be registered */
|
||||
enum exynos3250_plls {
|
||||
apll, mpll, vpll, upll,
|
||||
nr_plls
|
||||
};
|
||||
|
||||
static void __iomem *reg_base;
|
||||
|
||||
/*
|
||||
* Support for CMU save/restore across system suspends
|
||||
*/
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static struct samsung_clk_reg_dump *exynos3250_clk_regs;
|
||||
|
||||
static unsigned long exynos3250_cmu_clk_regs[] __initdata = {
|
||||
SRC_LEFTBUS,
|
||||
DIV_LEFTBUS,
|
||||
GATE_IP_LEFTBUS,
|
||||
SRC_RIGHTBUS,
|
||||
DIV_RIGHTBUS,
|
||||
GATE_IP_RIGHTBUS,
|
||||
GATE_IP_PERIR,
|
||||
MPLL_LOCK,
|
||||
MPLL_CON0,
|
||||
VPLL_LOCK,
|
||||
VPLL_CON0,
|
||||
UPLL_LOCK,
|
||||
UPLL_CON0,
|
||||
SRC_TOP0,
|
||||
SRC_TOP1,
|
||||
SRC_CAM,
|
||||
SRC_MFC,
|
||||
SRC_G3D,
|
||||
SRC_LCD,
|
||||
SRC_ISP,
|
||||
SRC_FSYS,
|
||||
SRC_PERIL0,
|
||||
SRC_PERIL1,
|
||||
SRC_MASK_TOP,
|
||||
SRC_MASK_CAM,
|
||||
SRC_MASK_LCD,
|
||||
SRC_MASK_ISP,
|
||||
SRC_MASK_FSYS,
|
||||
SRC_MASK_PERIL0,
|
||||
SRC_MASK_PERIL1,
|
||||
DIV_TOP,
|
||||
DIV_CAM,
|
||||
DIV_MFC,
|
||||
DIV_G3D,
|
||||
DIV_LCD,
|
||||
DIV_ISP,
|
||||
DIV_FSYS0,
|
||||
DIV_FSYS1,
|
||||
DIV_FSYS2,
|
||||
DIV_PERIL0,
|
||||
DIV_PERIL1,
|
||||
DIV_PERIL3,
|
||||
DIV_PERIL4,
|
||||
DIV_PERIL5,
|
||||
DIV_CAM1,
|
||||
CLKDIV2_RATIO,
|
||||
GATE_SCLK_CAM,
|
||||
GATE_SCLK_MFC,
|
||||
GATE_SCLK_G3D,
|
||||
GATE_SCLK_LCD,
|
||||
GATE_SCLK_ISP_TOP,
|
||||
GATE_SCLK_FSYS,
|
||||
GATE_SCLK_PERIL,
|
||||
GATE_IP_CAM,
|
||||
GATE_IP_MFC,
|
||||
GATE_IP_G3D,
|
||||
GATE_IP_LCD,
|
||||
GATE_IP_ISP,
|
||||
GATE_IP_FSYS,
|
||||
GATE_IP_PERIL,
|
||||
GATE_BLOCK,
|
||||
APLL_LOCK,
|
||||
SRC_CPU,
|
||||
DIV_CPU0,
|
||||
DIV_CPU1,
|
||||
};
|
||||
|
||||
static int exynos3250_clk_suspend(void)
|
||||
{
|
||||
samsung_clk_save(reg_base, exynos3250_clk_regs,
|
||||
ARRAY_SIZE(exynos3250_cmu_clk_regs));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void exynos3250_clk_resume(void)
|
||||
{
|
||||
samsung_clk_restore(reg_base, exynos3250_clk_regs,
|
||||
ARRAY_SIZE(exynos3250_cmu_clk_regs));
|
||||
}
|
||||
|
||||
static struct syscore_ops exynos3250_clk_syscore_ops = {
|
||||
.suspend = exynos3250_clk_suspend,
|
||||
.resume = exynos3250_clk_resume,
|
||||
};
|
||||
|
||||
static void exynos3250_clk_sleep_init(void)
|
||||
{
|
||||
exynos3250_clk_regs =
|
||||
samsung_clk_alloc_reg_dump(exynos3250_cmu_clk_regs,
|
||||
ARRAY_SIZE(exynos3250_cmu_clk_regs));
|
||||
if (!exynos3250_clk_regs) {
|
||||
pr_warn("%s: Failed to allocate sleep save data\n", __func__);
|
||||
goto err;
|
||||
}
|
||||
|
||||
register_syscore_ops(&exynos3250_clk_syscore_ops);
|
||||
return;
|
||||
err:
|
||||
kfree(exynos3250_clk_regs);
|
||||
}
|
||||
#else
|
||||
static inline void exynos3250_clk_sleep_init(void) { }
|
||||
#endif
|
||||
|
||||
/* list of all parent clock list */
|
||||
PNAME(mout_vpllsrc_p) = { "fin_pll", };
|
||||
|
||||
PNAME(mout_apll_p) = { "fin_pll", "fout_apll", };
|
||||
PNAME(mout_mpll_p) = { "fin_pll", "fout_mpll", };
|
||||
PNAME(mout_vpll_p) = { "fin_pll", "fout_vpll", };
|
||||
PNAME(mout_upll_p) = { "fin_pll", "fout_upll", };
|
||||
|
||||
PNAME(mout_mpll_user_p) = { "fin_pll", "div_mpll_pre", };
|
||||
PNAME(mout_epll_user_p) = { "fin_pll", "mout_epll", };
|
||||
PNAME(mout_core_p) = { "mout_apll", "mout_mpll_user_c", };
|
||||
PNAME(mout_hpm_p) = { "mout_apll", "mout_mpll_user_c", };
|
||||
|
||||
PNAME(mout_ebi_p) = { "div_aclk_200", "div_aclk_160", };
|
||||
PNAME(mout_ebi_1_p) = { "mout_ebi", "mout_vpll", };
|
||||
|
||||
PNAME(mout_gdl_p) = { "mout_mpll_user_l", };
|
||||
PNAME(mout_gdr_p) = { "mout_mpll_user_r", };
|
||||
|
||||
PNAME(mout_aclk_400_mcuisp_sub_p)
|
||||
= { "fin_pll", "div_aclk_400_mcuisp", };
|
||||
PNAME(mout_aclk_266_0_p) = { "div_mpll_pre", "mout_vpll", };
|
||||
PNAME(mout_aclk_266_1_p) = { "mout_epll_user", };
|
||||
PNAME(mout_aclk_266_p) = { "mout_aclk_266_0", "mout_aclk_266_1", };
|
||||
PNAME(mout_aclk_266_sub_p) = { "fin_pll", "div_aclk_266", };
|
||||
|
||||
PNAME(group_div_mpll_pre_p) = { "div_mpll_pre", };
|
||||
PNAME(group_epll_vpll_p) = { "mout_epll_user", "mout_vpll" };
|
||||
PNAME(group_sclk_p) = { "xxti", "xusbxti",
|
||||
"none", "none",
|
||||
"none", "none", "div_mpll_pre",
|
||||
"mout_epll_user", "mout_vpll", };
|
||||
PNAME(group_sclk_audio_p) = { "audiocdclk", "none",
|
||||
"none", "none",
|
||||
"xxti", "xusbxti",
|
||||
"div_mpll_pre", "mout_epll_user",
|
||||
"mout_vpll", };
|
||||
PNAME(group_sclk_cam_blk_p) = { "xxti", "xusbxti",
|
||||
"none", "none", "none",
|
||||
"none", "div_mpll_pre",
|
||||
"mout_epll_user", "mout_vpll",
|
||||
"div_cam_blk_320", };
|
||||
PNAME(group_sclk_fimd0_p) = { "xxti", "xusbxti",
|
||||
"m_bitclkhsdiv4_2l", "none",
|
||||
"none", "none", "div_mpll_pre",
|
||||
"mout_epll_user", "mout_vpll",
|
||||
"none", "none", "none",
|
||||
"div_lcd_blk_145", };
|
||||
|
||||
PNAME(mout_mfc_p) = { "mout_mfc_0", "mout_mfc_1" };
|
||||
PNAME(mout_g3d_p) = { "mout_g3d_0", "mout_g3d_1" };
|
||||
|
||||
static struct samsung_fixed_factor_clock fixed_factor_clks[] __initdata = {
|
||||
FFACTOR(0, "sclk_mpll_1600", "mout_mpll", 1, 1, 0),
|
||||
FFACTOR(0, "sclk_mpll_mif", "mout_mpll", 1, 2, 0),
|
||||
FFACTOR(0, "sclk_bpll", "fout_bpll", 1, 2, 0),
|
||||
FFACTOR(0, "div_cam_blk_320", "sclk_mpll_1600", 1, 5, 0),
|
||||
FFACTOR(0, "div_lcd_blk_145", "sclk_mpll_1600", 1, 11, 0),
|
||||
|
||||
/* HACK: fin_pll hardcoded to xusbxti until detection is implemented. */
|
||||
FFACTOR(CLK_FIN_PLL, "fin_pll", "xusbxti", 1, 1, 0),
|
||||
};
|
||||
|
||||
static struct samsung_mux_clock mux_clks[] __initdata = {
|
||||
/*
|
||||
* NOTE: Following table is sorted by register address in ascending
|
||||
* order and then bitfield shift in descending order, as it is done
|
||||
* in the User's Manual. When adding new entries, please make sure
|
||||
* that the order is preserved, to avoid merge conflicts and make
|
||||
* further work with defined data easier.
|
||||
*/
|
||||
|
||||
/* SRC_LEFTBUS */
|
||||
MUX(CLK_MOUT_MPLL_USER_L, "mout_mpll_user_l", mout_mpll_user_p,
|
||||
SRC_LEFTBUS, 4, 1),
|
||||
MUX(CLK_MOUT_GDL, "mout_gdl", mout_gdl_p, SRC_LEFTBUS, 0, 1),
|
||||
|
||||
/* SRC_RIGHTBUS */
|
||||
MUX(CLK_MOUT_MPLL_USER_R, "mout_mpll_user_r", mout_mpll_user_p,
|
||||
SRC_RIGHTBUS, 4, 1),
|
||||
MUX(CLK_MOUT_GDR, "mout_gdr", mout_gdr_p, SRC_RIGHTBUS, 0, 1),
|
||||
|
||||
/* SRC_TOP0 */
|
||||
MUX(CLK_MOUT_EBI, "mout_ebi", mout_ebi_p, SRC_TOP0, 28, 1),
|
||||
MUX(CLK_MOUT_ACLK_200, "mout_aclk_200", group_div_mpll_pre_p,SRC_TOP0, 24, 1),
|
||||
MUX(CLK_MOUT_ACLK_160, "mout_aclk_160", group_div_mpll_pre_p, SRC_TOP0, 20, 1),
|
||||
MUX(CLK_MOUT_ACLK_100, "mout_aclk_100", group_div_mpll_pre_p, SRC_TOP0, 16, 1),
|
||||
MUX(CLK_MOUT_ACLK_266_1, "mout_aclk_266_1", mout_aclk_266_1_p, SRC_TOP0, 14, 1),
|
||||
MUX(CLK_MOUT_ACLK_266_0, "mout_aclk_266_0", mout_aclk_266_0_p, SRC_TOP0, 13, 1),
|
||||
MUX(CLK_MOUT_ACLK_266, "mout_aclk_266", mout_aclk_266_p, SRC_TOP0, 12, 1),
|
||||
MUX(CLK_MOUT_VPLL, "mout_vpll", mout_vpll_p, SRC_TOP0, 8, 1),
|
||||
MUX(CLK_MOUT_EPLL_USER, "mout_epll_user", mout_epll_user_p, SRC_TOP0, 4, 1),
|
||||
MUX(CLK_MOUT_EBI_1, "mout_ebi_1", mout_ebi_1_p, SRC_TOP0, 0, 1),
|
||||
|
||||
/* SRC_TOP1 */
|
||||
MUX(CLK_MOUT_UPLL, "mout_upll", mout_upll_p, SRC_TOP1, 28, 1),
|
||||
MUX(CLK_MOUT_ACLK_400_MCUISP_SUB, "mout_aclk_400_mcuisp_sub", mout_aclk_400_mcuisp_sub_p,
|
||||
SRC_TOP1, 24, 1),
|
||||
MUX(CLK_MOUT_ACLK_266_SUB, "mout_aclk_266_sub", mout_aclk_266_sub_p, SRC_TOP1, 20, 1),
|
||||
MUX(CLK_MOUT_MPLL, "mout_mpll", mout_mpll_p, SRC_TOP1, 12, 1),
|
||||
MUX(CLK_MOUT_ACLK_400_MCUISP, "mout_aclk_400_mcuisp", group_div_mpll_pre_p, SRC_TOP1, 8, 1),
|
||||
MUX(CLK_MOUT_VPLLSRC, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP1, 0, 1),
|
||||
|
||||
/* SRC_CAM */
|
||||
MUX(CLK_MOUT_CAM1, "mout_cam1", group_sclk_p, SRC_CAM, 20, 4),
|
||||
MUX(CLK_MOUT_CAM_BLK, "mout_cam_blk", group_sclk_cam_blk_p, SRC_CAM, 0, 4),
|
||||
|
||||
/* SRC_MFC */
|
||||
MUX(CLK_MOUT_MFC, "mout_mfc", mout_mfc_p, SRC_MFC, 8, 1),
|
||||
MUX(CLK_MOUT_MFC_1, "mout_mfc_1", group_epll_vpll_p, SRC_MFC, 4, 1),
|
||||
MUX(CLK_MOUT_MFC_0, "mout_mfc_0", group_div_mpll_pre_p, SRC_MFC, 0, 1),
|
||||
|
||||
/* SRC_G3D */
|
||||
MUX(CLK_MOUT_G3D, "mout_g3d", mout_g3d_p, SRC_G3D, 8, 1),
|
||||
MUX(CLK_MOUT_G3D_1, "mout_g3d_1", group_epll_vpll_p, SRC_G3D, 4, 1),
|
||||
MUX(CLK_MOUT_G3D_0, "mout_g3d_0", group_div_mpll_pre_p, SRC_G3D, 0, 1),
|
||||
|
||||
/* SRC_LCD */
|
||||
MUX(CLK_MOUT_MIPI0, "mout_mipi0", group_sclk_p, SRC_LCD, 12, 4),
|
||||
MUX(CLK_MOUT_FIMD0, "mout_fimd0", group_sclk_fimd0_p, SRC_LCD, 0, 4),
|
||||
|
||||
/* SRC_ISP */
|
||||
MUX(CLK_MOUT_UART_ISP, "mout_uart_isp", group_sclk_p, SRC_ISP, 12, 4),
|
||||
MUX(CLK_MOUT_SPI1_ISP, "mout_spi1_isp", group_sclk_p, SRC_ISP, 8, 4),
|
||||
MUX(CLK_MOUT_SPI0_ISP, "mout_spi0_isp", group_sclk_p, SRC_ISP, 4, 4),
|
||||
|
||||
/* SRC_FSYS */
|
||||
MUX(CLK_MOUT_TSADC, "mout_tsadc", group_sclk_p, SRC_FSYS, 28, 4),
|
||||
MUX(CLK_MOUT_MMC1, "mout_mmc1", group_sclk_p, SRC_FSYS, 4, 3),
|
||||
MUX(CLK_MOUT_MMC0, "mout_mmc0", group_sclk_p, SRC_FSYS, 0, 3),
|
||||
|
||||
/* SRC_PERIL0 */
|
||||
MUX(CLK_MOUT_UART1, "mout_uart1", group_sclk_p, SRC_PERIL0, 4, 4),
|
||||
MUX(CLK_MOUT_UART0, "mout_uart0", group_sclk_p, SRC_PERIL0, 0, 4),
|
||||
|
||||
/* SRC_PERIL1 */
|
||||
MUX(CLK_MOUT_SPI1, "mout_spi1", group_sclk_p, SRC_PERIL1, 20, 4),
|
||||
MUX(CLK_MOUT_SPI0, "mout_spi0", group_sclk_p, SRC_PERIL1, 16, 4),
|
||||
MUX(CLK_MOUT_AUDIO, "mout_audio", group_sclk_audio_p, SRC_PERIL1, 4, 4),
|
||||
|
||||
/* SRC_CPU */
|
||||
MUX(CLK_MOUT_MPLL_USER_C, "mout_mpll_user_c", mout_mpll_user_p,
|
||||
SRC_CPU, 24, 1),
|
||||
MUX(CLK_MOUT_HPM, "mout_hpm", mout_hpm_p, SRC_CPU, 20, 1),
|
||||
MUX(CLK_MOUT_CORE, "mout_core", mout_core_p, SRC_CPU, 16, 1),
|
||||
MUX(CLK_MOUT_APLL, "mout_apll", mout_apll_p, SRC_CPU, 0, 1),
|
||||
};
|
||||
|
||||
static struct samsung_div_clock div_clks[] __initdata = {
|
||||
/*
|
||||
* NOTE: Following table is sorted by register address in ascending
|
||||
* order and then bitfield shift in descending order, as it is done
|
||||
* in the User's Manual. When adding new entries, please make sure
|
||||
* that the order is preserved, to avoid merge conflicts and make
|
||||
* further work with defined data easier.
|
||||
*/
|
||||
|
||||
/* DIV_LEFTBUS */
|
||||
DIV(CLK_DIV_GPL, "div_gpl", "div_gdl", DIV_LEFTBUS, 4, 3),
|
||||
DIV(CLK_DIV_GDL, "div_gdl", "mout_gdl", DIV_LEFTBUS, 0, 4),
|
||||
|
||||
/* DIV_RIGHTBUS */
|
||||
DIV(CLK_DIV_GPR, "div_gpr", "div_gdr", DIV_RIGHTBUS, 4, 3),
|
||||
DIV(CLK_DIV_GDR, "div_gdr", "mout_gdr", DIV_RIGHTBUS, 0, 4),
|
||||
|
||||
/* DIV_TOP */
|
||||
DIV(CLK_DIV_MPLL_PRE, "div_mpll_pre", "sclk_mpll_mif", DIV_TOP, 28, 2),
|
||||
DIV(CLK_DIV_ACLK_400_MCUISP, "div_aclk_400_mcuisp",
|
||||
"mout_aclk_400_mcuisp", DIV_TOP, 24, 3),
|
||||
DIV(CLK_DIV_EBI, "div_ebi", "mout_ebi_1", DIV_TOP, 16, 3),
|
||||
DIV(CLK_DIV_ACLK_200, "div_aclk_200", "mout_aclk_200", DIV_TOP, 12, 3),
|
||||
DIV(CLK_DIV_ACLK_160, "div_aclk_160", "mout_aclk_160", DIV_TOP, 8, 3),
|
||||
DIV(CLK_DIV_ACLK_100, "div_aclk_100", "mout_aclk_100", DIV_TOP, 4, 4),
|
||||
DIV(CLK_DIV_ACLK_266, "div_aclk_266", "mout_aclk_266", DIV_TOP, 0, 3),
|
||||
|
||||
/* DIV_CAM */
|
||||
DIV(CLK_DIV_CAM1, "div_cam1", "mout_cam1", DIV_CAM, 20, 4),
|
||||
DIV(CLK_DIV_CAM_BLK, "div_cam_blk", "mout_cam_blk", DIV_CAM, 0, 4),
|
||||
|
||||
/* DIV_MFC */
|
||||
DIV(CLK_DIV_MFC, "div_mfc", "mout_mfc", DIV_MFC, 0, 4),
|
||||
|
||||
/* DIV_G3D */
|
||||
DIV(CLK_DIV_G3D, "div_g3d", "mout_g3d", DIV_G3D, 0, 4),
|
||||
|
||||
/* DIV_LCD */
|
||||
DIV_F(CLK_DIV_MIPI0_PRE, "div_mipi0_pre", "div_mipi0", DIV_LCD, 20, 4,
|
||||
CLK_SET_RATE_PARENT, 0),
|
||||
DIV(CLK_DIV_MIPI0, "div_mipi0", "mout_mipi0", DIV_LCD, 16, 4),
|
||||
DIV(CLK_DIV_FIMD0, "div_fimd0", "mout_fimd0", DIV_LCD, 0, 4),
|
||||
|
||||
/* DIV_ISP */
|
||||
DIV(CLK_DIV_UART_ISP, "div_uart_isp", "mout_uart_isp", DIV_ISP, 28, 4),
|
||||
DIV_F(CLK_DIV_SPI1_ISP_PRE, "div_spi1_isp_pre", "div_spi1_isp",
|
||||
DIV_ISP, 20, 8, CLK_SET_RATE_PARENT, 0),
|
||||
DIV(CLK_DIV_SPI1_ISP, "div_spi1_isp", "mout_spi1_isp", DIV_ISP, 16, 4),
|
||||
DIV_F(CLK_DIV_SPI0_ISP_PRE, "div_spi0_isp_pre", "div_spi0_isp",
|
||||
DIV_ISP, 8, 8, CLK_SET_RATE_PARENT, 0),
|
||||
DIV(CLK_DIV_SPI0_ISP, "div_spi0_isp", "mout_spi0_isp", DIV_ISP, 0, 4),
|
||||
|
||||
/* DIV_FSYS0 */
|
||||
DIV_F(CLK_DIV_TSADC_PRE, "div_tsadc_pre", "div_tsadc", DIV_FSYS0, 8, 8,
|
||||
CLK_SET_RATE_PARENT, 0),
|
||||
DIV(CLK_DIV_TSADC, "div_tsadc", "mout_tsadc", DIV_FSYS0, 0, 4),
|
||||
|
||||
/* DIV_FSYS1 */
|
||||
DIV_F(CLK_DIV_MMC1_PRE, "div_mmc1_pre", "div_mmc1", DIV_FSYS1, 24, 8,
|
||||
CLK_SET_RATE_PARENT, 0),
|
||||
DIV(CLK_DIV_MMC1, "div_mmc1", "mout_mmc1", DIV_FSYS1, 16, 4),
|
||||
DIV_F(CLK_DIV_MMC0_PRE, "div_mmc0_pre", "div_mmc0", DIV_FSYS1, 8, 8,
|
||||
CLK_SET_RATE_PARENT, 0),
|
||||
DIV(CLK_DIV_MMC0, "div_mmc0", "mout_mmc0", DIV_FSYS1, 0, 4),
|
||||
|
||||
/* DIV_PERIL0 */
|
||||
DIV(CLK_DIV_UART1, "div_uart1", "mout_uart1", DIV_PERIL0, 4, 4),
|
||||
DIV(CLK_DIV_UART0, "div_uart0", "mout_uart0", DIV_PERIL0, 0, 4),
|
||||
|
||||
/* DIV_PERIL1 */
|
||||
DIV_F(CLK_DIV_SPI1_PRE, "div_spi1_pre", "div_spi1", DIV_PERIL1, 24, 8,
|
||||
CLK_SET_RATE_PARENT, 0),
|
||||
DIV(CLK_DIV_SPI1, "div_spi1", "mout_spi1", DIV_PERIL1, 16, 4),
|
||||
DIV_F(CLK_DIV_SPI0_PRE, "div_spi0_pre", "div_spi0", DIV_PERIL1, 8, 8,
|
||||
CLK_SET_RATE_PARENT, 0),
|
||||
DIV(CLK_DIV_SPI0, "div_spi0", "mout_spi0", DIV_PERIL1, 0, 4),
|
||||
|
||||
/* DIV_PERIL4 */
|
||||
DIV(CLK_DIV_PCM, "div_pcm", "div_audio", DIV_PERIL4, 20, 8),
|
||||
DIV(CLK_DIV_AUDIO, "div_audio", "mout_audio", DIV_PERIL4, 16, 4),
|
||||
|
||||
/* DIV_PERIL5 */
|
||||
DIV(CLK_DIV_I2S, "div_i2s", "div_audio", DIV_PERIL5, 8, 6),
|
||||
|
||||
/* DIV_CPU0 */
|
||||
DIV(CLK_DIV_CORE2, "div_core2", "div_core", DIV_CPU0, 28, 3),
|
||||
DIV(CLK_DIV_APLL, "div_apll", "mout_apll", DIV_CPU0, 24, 3),
|
||||
DIV(CLK_DIV_PCLK_DBG, "div_pclk_dbg", "div_core2", DIV_CPU0, 20, 3),
|
||||
DIV(CLK_DIV_ATB, "div_atb", "div_core2", DIV_CPU0, 16, 3),
|
||||
DIV(CLK_DIV_COREM, "div_corem", "div_core2", DIV_CPU0, 4, 3),
|
||||
DIV(CLK_DIV_CORE, "div_core", "mout_core", DIV_CPU0, 0, 3),
|
||||
|
||||
/* DIV_CPU1 */
|
||||
DIV(CLK_DIV_HPM, "div_hpm", "div_copy", DIV_CPU1, 4, 3),
|
||||
DIV(CLK_DIV_COPY, "div_copy", "mout_hpm", DIV_CPU1, 0, 3),
|
||||
};
|
||||
|
||||
static struct samsung_gate_clock gate_clks[] __initdata = {
|
||||
/*
|
||||
* NOTE: Following table is sorted by register address in ascending
|
||||
* order and then bitfield shift in descending order, as it is done
|
||||
* in the User's Manual. When adding new entries, please make sure
|
||||
* that the order is preserved, to avoid merge conflicts and make
|
||||
* further work with defined data easier.
|
||||
*/
|
||||
|
||||
/* GATE_IP_LEFTBUS */
|
||||
GATE(CLK_ASYNC_G3D, "async_g3d", "div_aclk_100", GATE_IP_LEFTBUS, 6,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_ASYNC_MFCL, "async_mfcl", "div_aclk_100", GATE_IP_LEFTBUS, 4,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_PPMULEFT, "ppmuleft", "div_aclk_100", GATE_IP_LEFTBUS, 1,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_GPIO_LEFT, "gpio_left", "div_aclk_100", GATE_IP_LEFTBUS, 0,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
|
||||
/* GATE_IP_RIGHTBUS */
|
||||
GATE(CLK_ASYNC_ISPMX, "async_ispmx", "div_aclk_100",
|
||||
GATE_IP_RIGHTBUS, 9, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_ASYNC_FSYSD, "async_fsysd", "div_aclk_100",
|
||||
GATE_IP_RIGHTBUS, 5, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_ASYNC_LCD0X, "async_lcd0x", "div_aclk_100",
|
||||
GATE_IP_RIGHTBUS, 3, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_ASYNC_CAMX, "async_camx", "div_aclk_100", GATE_IP_RIGHTBUS, 2,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_PPMURIGHT, "ppmuright", "div_aclk_100", GATE_IP_RIGHTBUS, 1,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_GPIO_RIGHT, "gpio_right", "div_aclk_100", GATE_IP_RIGHTBUS, 0,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
|
||||
/* GATE_IP_PERIR */
|
||||
GATE(CLK_MONOCNT, "monocnt", "div_aclk_100", GATE_IP_PERIR, 22,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_TZPC6, "tzpc6", "div_aclk_100", GATE_IP_PERIR, 21,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_PROVISIONKEY1, "provisionkey1", "div_aclk_100",
|
||||
GATE_IP_PERIR, 20, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_PROVISIONKEY0, "provisionkey0", "div_aclk_100",
|
||||
GATE_IP_PERIR, 19, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_CMU_ISPPART, "cmu_isppart", "div_aclk_100", GATE_IP_PERIR, 18,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_TMU_APBIF, "tmu_apbif", "div_aclk_100",
|
||||
GATE_IP_PERIR, 17, 0, 0),
|
||||
GATE(CLK_KEYIF, "keyif", "div_aclk_100", GATE_IP_PERIR, 16, 0, 0),
|
||||
GATE(CLK_RTC, "rtc", "div_aclk_100", GATE_IP_PERIR, 15, 0, 0),
|
||||
GATE(CLK_WDT, "wdt", "div_aclk_100", GATE_IP_PERIR, 14, 0, 0),
|
||||
GATE(CLK_MCT, "mct", "div_aclk_100", GATE_IP_PERIR, 13, 0, 0),
|
||||
GATE(CLK_SECKEY, "seckey", "div_aclk_100", GATE_IP_PERIR, 12,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_TZPC5, "tzpc5", "div_aclk_100", GATE_IP_PERIR, 10,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_TZPC4, "tzpc4", "div_aclk_100", GATE_IP_PERIR, 9,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_TZPC3, "tzpc3", "div_aclk_100", GATE_IP_PERIR, 8,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_TZPC2, "tzpc2", "div_aclk_100", GATE_IP_PERIR, 7,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_TZPC1, "tzpc1", "div_aclk_100", GATE_IP_PERIR, 6,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_TZPC0, "tzpc0", "div_aclk_100", GATE_IP_PERIR, 5,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_CMU_COREPART, "cmu_corepart", "div_aclk_100", GATE_IP_PERIR, 4,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_CMU_TOPPART, "cmu_toppart", "div_aclk_100", GATE_IP_PERIR, 3,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_PMU_APBIF, "pmu_apbif", "div_aclk_100", GATE_IP_PERIR, 2,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_SYSREG, "sysreg", "div_aclk_100", GATE_IP_PERIR, 1,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_CHIP_ID, "chip_id", "div_aclk_100", GATE_IP_PERIR, 0,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
|
||||
/* GATE_SCLK_CAM */
|
||||
GATE(CLK_SCLK_JPEG, "sclk_jpeg", "div_cam_blk",
|
||||
GATE_SCLK_CAM, 8, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_M2MSCALER, "sclk_m2mscaler", "div_cam_blk",
|
||||
GATE_SCLK_CAM, 2, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_GSCALER1, "sclk_gscaler1", "div_cam_blk",
|
||||
GATE_SCLK_CAM, 1, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_GSCALER0, "sclk_gscaler0", "div_cam_blk",
|
||||
GATE_SCLK_CAM, 0, CLK_SET_RATE_PARENT, 0),
|
||||
|
||||
/* GATE_SCLK_MFC */
|
||||
GATE(CLK_SCLK_MFC, "sclk_mfc", "div_mfc",
|
||||
GATE_SCLK_MFC, 0, CLK_SET_RATE_PARENT, 0),
|
||||
|
||||
/* GATE_SCLK_G3D */
|
||||
GATE(CLK_SCLK_G3D, "sclk_g3d", "div_g3d",
|
||||
GATE_SCLK_G3D, 0, CLK_SET_RATE_PARENT, 0),
|
||||
|
||||
/* GATE_SCLK_LCD */
|
||||
GATE(CLK_SCLK_MIPIDPHY2L, "sclk_mipidphy2l", "div_mipi0",
|
||||
GATE_SCLK_LCD, 4, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_MIPI0, "sclk_mipi0", "div_mipi0_pre",
|
||||
GATE_SCLK_LCD, 3, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_FIMD0, "sclk_fimd0", "div_fimd0",
|
||||
GATE_SCLK_LCD, 0, CLK_SET_RATE_PARENT, 0),
|
||||
|
||||
/* GATE_SCLK_ISP_TOP */
|
||||
GATE(CLK_SCLK_CAM1, "sclk_cam1", "div_cam1",
|
||||
GATE_SCLK_ISP_TOP, 4, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_UART_ISP, "sclk_uart_isp", "div_uart_isp",
|
||||
GATE_SCLK_ISP_TOP, 3, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_SPI1_ISP, "sclk_spi1_isp", "div_spi1_isp",
|
||||
GATE_SCLK_ISP_TOP, 2, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_SPI0_ISP, "sclk_spi0_isp", "div_spi0_isp",
|
||||
GATE_SCLK_ISP_TOP, 1, CLK_SET_RATE_PARENT, 0),
|
||||
|
||||
/* GATE_SCLK_FSYS */
|
||||
GATE(CLK_SCLK_UPLL, "sclk_upll", "mout_upll", GATE_SCLK_FSYS, 10, 0, 0),
|
||||
GATE(CLK_SCLK_TSADC, "sclk_tsadc", "div_tsadc_pre",
|
||||
GATE_SCLK_FSYS, 9, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_EBI, "sclk_ebi", "div_ebi",
|
||||
GATE_SCLK_FSYS, 6, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_MMC1, "sclk_mmc1", "div_mmc1_pre",
|
||||
GATE_SCLK_FSYS, 1, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_MMC0, "sclk_mmc0", "div_mmc0_pre",
|
||||
GATE_SCLK_FSYS, 0, CLK_SET_RATE_PARENT, 0),
|
||||
|
||||
/* GATE_SCLK_PERIL */
|
||||
GATE(CLK_SCLK_I2S, "sclk_i2s", "div_i2s",
|
||||
GATE_SCLK_PERIL, 18, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_PCM, "sclk_pcm", "div_pcm",
|
||||
GATE_SCLK_PERIL, 16, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_SPI1, "sclk_spi1", "div_spi1_pre",
|
||||
GATE_SCLK_PERIL, 7, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_SPI0, "sclk_spi0", "div_spi0_pre",
|
||||
GATE_SCLK_PERIL, 6, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_UART1, "sclk_uart1", "div_uart1",
|
||||
GATE_SCLK_PERIL, 1, CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_SCLK_UART0, "sclk_uart0", "div_uart0",
|
||||
GATE_SCLK_PERIL, 0, CLK_SET_RATE_PARENT, 0),
|
||||
|
||||
/* GATE_IP_CAM */
|
||||
GATE(CLK_QEJPEG, "qejpeg", "div_cam_blk_320", GATE_IP_CAM, 19,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_PIXELASYNCM1, "pixelasyncm1", "div_cam_blk_320",
|
||||
GATE_IP_CAM, 18, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_PIXELASYNCM0, "pixelasyncm0", "div_cam_blk_320",
|
||||
GATE_IP_CAM, 17, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_PPMUCAMIF, "ppmucamif", "div_cam_blk_320",
|
||||
GATE_IP_CAM, 16, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_QEM2MSCALER, "qem2mscaler", "div_cam_blk_320",
|
||||
GATE_IP_CAM, 14, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_QEGSCALER1, "qegscaler1", "div_cam_blk_320",
|
||||
GATE_IP_CAM, 13, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_QEGSCALER0, "qegscaler0", "div_cam_blk_320",
|
||||
GATE_IP_CAM, 12, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_SMMUJPEG, "smmujpeg", "div_cam_blk_320",
|
||||
GATE_IP_CAM, 11, 0, 0),
|
||||
GATE(CLK_SMMUM2M2SCALER, "smmum2m2scaler", "div_cam_blk_320",
|
||||
GATE_IP_CAM, 9, 0, 0),
|
||||
GATE(CLK_SMMUGSCALER1, "smmugscaler1", "div_cam_blk_320",
|
||||
GATE_IP_CAM, 8, 0, 0),
|
||||
GATE(CLK_SMMUGSCALER0, "smmugscaler0", "div_cam_blk_320",
|
||||
GATE_IP_CAM, 7, 0, 0),
|
||||
GATE(CLK_JPEG, "jpeg", "div_cam_blk_320", GATE_IP_CAM, 6, 0, 0),
|
||||
GATE(CLK_M2MSCALER, "m2mscaler", "div_cam_blk_320",
|
||||
GATE_IP_CAM, 2, 0, 0),
|
||||
GATE(CLK_GSCALER1, "gscaler1", "div_cam_blk_320", GATE_IP_CAM, 1, 0, 0),
|
||||
GATE(CLK_GSCALER0, "gscaler0", "div_cam_blk_320", GATE_IP_CAM, 0, 0, 0),
|
||||
|
||||
/* GATE_IP_MFC */
|
||||
GATE(CLK_QEMFC, "qemfc", "div_aclk_200", GATE_IP_MFC, 5,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_PPMUMFC_L, "ppmumfc_l", "div_aclk_200", GATE_IP_MFC, 3,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_SMMUMFC_L, "smmumfc_l", "div_aclk_200", GATE_IP_MFC, 1, 0, 0),
|
||||
GATE(CLK_MFC, "mfc", "div_aclk_200", GATE_IP_MFC, 0, 0, 0),
|
||||
|
||||
/* GATE_IP_G3D */
|
||||
GATE(CLK_SMMUG3D, "smmug3d", "div_aclk_200", GATE_IP_G3D, 3, 0, 0),
|
||||
GATE(CLK_QEG3D, "qeg3d", "div_aclk_200", GATE_IP_G3D, 2,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_PPMUG3D, "ppmug3d", "div_aclk_200", GATE_IP_G3D, 1,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_G3D, "g3d", "div_aclk_200", GATE_IP_G3D, 0, 0, 0),
|
||||
|
||||
/* GATE_IP_LCD */
|
||||
GATE(CLK_QE_CH1_LCD, "qe_ch1_lcd", "div_aclk_160", GATE_IP_LCD, 7,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_QE_CH0_LCD, "qe_ch0_lcd", "div_aclk_160", GATE_IP_LCD, 6,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_PPMULCD0, "ppmulcd0", "div_aclk_160", GATE_IP_LCD, 5,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_SMMUFIMD0, "smmufimd0", "div_aclk_160", GATE_IP_LCD, 4, 0, 0),
|
||||
GATE(CLK_DSIM0, "dsim0", "div_aclk_160", GATE_IP_LCD, 3, 0, 0),
|
||||
GATE(CLK_SMIES, "smies", "div_aclk_160", GATE_IP_LCD, 2, 0, 0),
|
||||
GATE(CLK_FIMD0, "fimd0", "div_aclk_160", GATE_IP_LCD, 0, 0, 0),
|
||||
|
||||
/* GATE_IP_ISP */
|
||||
GATE(CLK_CAM1, "cam1", "mout_aclk_266_sub", GATE_IP_ISP, 5, 0, 0),
|
||||
GATE(CLK_UART_ISP_TOP, "uart_isp_top", "mout_aclk_266_sub",
|
||||
GATE_IP_ISP, 3, 0, 0),
|
||||
GATE(CLK_SPI1_ISP_TOP, "spi1_isp_top", "mout_aclk_266_sub",
|
||||
GATE_IP_ISP, 2, 0, 0),
|
||||
GATE(CLK_SPI0_ISP_TOP, "spi0_isp_top", "mout_aclk_266_sub",
|
||||
GATE_IP_ISP, 1, 0, 0),
|
||||
|
||||
/* GATE_IP_FSYS */
|
||||
GATE(CLK_TSADC, "tsadc", "div_aclk_200", GATE_IP_FSYS, 20, 0, 0),
|
||||
GATE(CLK_PPMUFILE, "ppmufile", "div_aclk_200", GATE_IP_FSYS, 17,
|
||||
CLK_IGNORE_UNUSED, 0),
|
||||
GATE(CLK_USBOTG, "usbotg", "div_aclk_200", GATE_IP_FSYS, 13, 0, 0),
|
||||
GATE(CLK_USBHOST, "usbhost", "div_aclk_200", GATE_IP_FSYS, 12, 0, 0),
|
||||
GATE(CLK_SROMC, "sromc", "div_aclk_200", GATE_IP_FSYS, 11, 0, 0),
|
||||
GATE(CLK_SDMMC1, "sdmmc1", "div_aclk_200", GATE_IP_FSYS, 6, 0, 0),
|
||||
GATE(CLK_SDMMC0, "sdmmc0", "div_aclk_200", GATE_IP_FSYS, 5, 0, 0),
|
||||
GATE(CLK_PDMA1, "pdma1", "div_aclk_200", GATE_IP_FSYS, 1, 0, 0),
|
||||
GATE(CLK_PDMA0, "pdma0", "div_aclk_200", GATE_IP_FSYS, 0, 0, 0),
|
||||
|
||||
/* GATE_IP_PERIL */
|
||||
GATE(CLK_PWM, "pwm", "div_aclk_100", GATE_IP_PERIL, 24, 0, 0),
|
||||
GATE(CLK_PCM, "pcm", "div_aclk_100", GATE_IP_PERIL, 23, 0, 0),
|
||||
GATE(CLK_I2S, "i2s", "div_aclk_100", GATE_IP_PERIL, 21, 0, 0),
|
||||
GATE(CLK_SPI1, "spi1", "div_aclk_100", GATE_IP_PERIL, 17, 0, 0),
|
||||
GATE(CLK_SPI0, "spi0", "div_aclk_100", GATE_IP_PERIL, 16, 0, 0),
|
||||
GATE(CLK_I2C7, "i2c7", "div_aclk_100", GATE_IP_PERIL, 13, 0, 0),
|
||||
GATE(CLK_I2C6, "i2c6", "div_aclk_100", GATE_IP_PERIL, 12, 0, 0),
|
||||
GATE(CLK_I2C5, "i2c5", "div_aclk_100", GATE_IP_PERIL, 11, 0, 0),
|
||||
GATE(CLK_I2C4, "i2c4", "div_aclk_100", GATE_IP_PERIL, 10, 0, 0),
|
||||
GATE(CLK_I2C3, "i2c3", "div_aclk_100", GATE_IP_PERIL, 9, 0, 0),
|
||||
GATE(CLK_I2C2, "i2c2", "div_aclk_100", GATE_IP_PERIL, 8, 0, 0),
|
||||
GATE(CLK_I2C1, "i2c1", "div_aclk_100", GATE_IP_PERIL, 7, 0, 0),
|
||||
GATE(CLK_I2C0, "i2c0", "div_aclk_100", GATE_IP_PERIL, 6, 0, 0),
|
||||
GATE(CLK_UART1, "uart1", "div_aclk_100", GATE_IP_PERIL, 1, 0, 0),
|
||||
GATE(CLK_UART0, "uart0", "div_aclk_100", GATE_IP_PERIL, 0, 0, 0),
|
||||
};
|
||||
|
||||
/* APLL & MPLL & BPLL & UPLL */
|
||||
static struct samsung_pll_rate_table exynos3250_pll_rates[] = {
|
||||
PLL_35XX_RATE(1200000000, 400, 4, 1),
|
||||
PLL_35XX_RATE(1100000000, 275, 3, 1),
|
||||
PLL_35XX_RATE(1066000000, 533, 6, 1),
|
||||
PLL_35XX_RATE(1000000000, 250, 3, 1),
|
||||
PLL_35XX_RATE( 960000000, 320, 4, 1),
|
||||
PLL_35XX_RATE( 900000000, 300, 4, 1),
|
||||
PLL_35XX_RATE( 850000000, 425, 6, 1),
|
||||
PLL_35XX_RATE( 800000000, 200, 3, 1),
|
||||
PLL_35XX_RATE( 700000000, 175, 3, 1),
|
||||
PLL_35XX_RATE( 667000000, 667, 12, 1),
|
||||
PLL_35XX_RATE( 600000000, 400, 4, 2),
|
||||
PLL_35XX_RATE( 533000000, 533, 6, 2),
|
||||
PLL_35XX_RATE( 520000000, 260, 3, 2),
|
||||
PLL_35XX_RATE( 500000000, 250, 3, 2),
|
||||
PLL_35XX_RATE( 400000000, 200, 3, 2),
|
||||
PLL_35XX_RATE( 200000000, 200, 3, 3),
|
||||
PLL_35XX_RATE( 100000000, 200, 3, 4),
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
/* VPLL */
|
||||
static struct samsung_pll_rate_table exynos3250_vpll_rates[] = {
|
||||
PLL_36XX_RATE(600000000, 100, 2, 1, 0),
|
||||
PLL_36XX_RATE(533000000, 266, 3, 2, 32768),
|
||||
PLL_36XX_RATE(519230987, 173, 2, 2, 5046),
|
||||
PLL_36XX_RATE(500000000, 250, 3, 2, 0),
|
||||
PLL_36XX_RATE(445500000, 148, 2, 2, 32768),
|
||||
PLL_36XX_RATE(445055007, 148, 2, 2, 23047),
|
||||
PLL_36XX_RATE(400000000, 200, 3, 2, 0),
|
||||
PLL_36XX_RATE(371250000, 123, 2, 2, 49152),
|
||||
PLL_36XX_RATE(370878997, 185, 3, 2, 28803),
|
||||
PLL_36XX_RATE(340000000, 170, 3, 2, 0),
|
||||
PLL_36XX_RATE(335000015, 111, 2, 2, 43691),
|
||||
PLL_36XX_RATE(333000000, 111, 2, 2, 0),
|
||||
PLL_36XX_RATE(330000000, 110, 2, 2, 0),
|
||||
PLL_36XX_RATE(320000015, 106, 2, 2, 43691),
|
||||
PLL_36XX_RATE(300000000, 100, 2, 2, 0),
|
||||
PLL_36XX_RATE(275000000, 275, 3, 3, 0),
|
||||
PLL_36XX_RATE(222750000, 148, 2, 3, 32768),
|
||||
PLL_36XX_RATE(222528007, 148, 2, 3, 23069),
|
||||
PLL_36XX_RATE(160000000, 160, 3, 3, 0),
|
||||
PLL_36XX_RATE(148500000, 99, 2, 3, 0),
|
||||
PLL_36XX_RATE(148352005, 98, 2, 3, 59070),
|
||||
PLL_36XX_RATE(108000000, 144, 2, 4, 0),
|
||||
PLL_36XX_RATE( 74250000, 99, 2, 4, 0),
|
||||
PLL_36XX_RATE( 74176002, 98, 3, 4, 59070),
|
||||
PLL_36XX_RATE( 54054000, 216, 3, 5, 14156),
|
||||
PLL_36XX_RATE( 54000000, 144, 2, 5, 0),
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static struct samsung_pll_clock exynos3250_plls[nr_plls] __initdata = {
|
||||
[apll] = PLL(pll_35xx, CLK_FOUT_APLL, "fout_apll", "fin_pll",
|
||||
APLL_LOCK, APLL_CON0, NULL),
|
||||
[mpll] = PLL(pll_35xx, CLK_FOUT_MPLL, "fout_mpll", "fin_pll",
|
||||
MPLL_LOCK, MPLL_CON0, NULL),
|
||||
[vpll] = PLL(pll_36xx, CLK_FOUT_VPLL, "fout_vpll", "fin_pll",
|
||||
VPLL_LOCK, VPLL_CON0, NULL),
|
||||
[upll] = PLL(pll_35xx, CLK_FOUT_UPLL, "fout_upll", "fin_pll",
|
||||
UPLL_LOCK, UPLL_CON0, NULL),
|
||||
};
|
||||
|
||||
static void __init exynos3250_cmu_init(struct device_node *np)
|
||||
{
|
||||
struct samsung_clk_provider *ctx;
|
||||
|
||||
reg_base = of_iomap(np, 0);
|
||||
if (!reg_base)
|
||||
panic("%s: failed to map registers\n", __func__);
|
||||
|
||||
ctx = samsung_clk_init(np, reg_base, CLK_NR_CLKS);
|
||||
if (!ctx)
|
||||
panic("%s: unable to allocate context.\n", __func__);
|
||||
|
||||
samsung_clk_register_fixed_factor(ctx, fixed_factor_clks,
|
||||
ARRAY_SIZE(fixed_factor_clks));
|
||||
|
||||
exynos3250_plls[apll].rate_table = exynos3250_pll_rates;
|
||||
exynos3250_plls[mpll].rate_table = exynos3250_pll_rates;
|
||||
exynos3250_plls[vpll].rate_table = exynos3250_vpll_rates;
|
||||
exynos3250_plls[upll].rate_table = exynos3250_pll_rates;
|
||||
|
||||
samsung_clk_register_pll(ctx, exynos3250_plls,
|
||||
ARRAY_SIZE(exynos3250_plls), reg_base);
|
||||
|
||||
samsung_clk_register_mux(ctx, mux_clks, ARRAY_SIZE(mux_clks));
|
||||
samsung_clk_register_div(ctx, div_clks, ARRAY_SIZE(div_clks));
|
||||
samsung_clk_register_gate(ctx, gate_clks, ARRAY_SIZE(gate_clks));
|
||||
|
||||
exynos3250_clk_sleep_init();
|
||||
}
|
||||
CLK_OF_DECLARE(exynos3250_cmu, "samsung,exynos3250-cmu", exynos3250_cmu_init);
|
@ -428,7 +428,7 @@ static struct samsung_fixed_rate_clock exynos4_fixed_rate_ext_clks[] __initdata
|
||||
/* fixed rate clocks generated inside the soc */
|
||||
static struct samsung_fixed_rate_clock exynos4_fixed_rate_clks[] __initdata = {
|
||||
FRATE(0, "sclk_hdmi24m", NULL, CLK_IS_ROOT, 24000000),
|
||||
FRATE(0, "sclk_hdmiphy", NULL, CLK_IS_ROOT, 27000000),
|
||||
FRATE(CLK_SCLK_HDMIPHY, "sclk_hdmiphy", NULL, CLK_IS_ROOT, 27000000),
|
||||
FRATE(0, "sclk_usbphy0", NULL, CLK_IS_ROOT, 48000000),
|
||||
};
|
||||
|
||||
@ -903,7 +903,7 @@ static struct samsung_gate_clock exynos4x12_gate_clks[] __initdata = {
|
||||
GATE(CLK_AUDSS, "audss", "sclk_epll", E4X12_GATE_IP_MAUDIO, 0, 0, 0),
|
||||
GATE(CLK_MDNIE0, "mdnie0", "aclk160", GATE_IP_LCD0, 2, 0, 0),
|
||||
GATE(CLK_ROTATOR, "rotator", "aclk200", E4X12_GATE_IP_IMAGE, 1, 0, 0),
|
||||
GATE(CLK_MDMA2, "mdma2", "aclk200", E4X12_GATE_IP_IMAGE, 2, 0, 0),
|
||||
GATE(CLK_MDMA, "mdma", "aclk200", E4X12_GATE_IP_IMAGE, 2, 0, 0),
|
||||
GATE(CLK_SMMU_MDMA, "smmu_mdma", "aclk200", E4X12_GATE_IP_IMAGE, 5, 0,
|
||||
0),
|
||||
GATE(CLK_MIPI_HSI, "mipi_hsi", "aclk133", GATE_IP_FSYS, 10, 0, 0),
|
||||
@ -1043,7 +1043,7 @@ static unsigned long exynos4_get_xom(void)
|
||||
return xom;
|
||||
}
|
||||
|
||||
static void __init exynos4_clk_register_finpll(void)
|
||||
static void __init exynos4_clk_register_finpll(struct samsung_clk_provider *ctx)
|
||||
{
|
||||
struct samsung_fixed_rate_clock fclk;
|
||||
struct clk *clk;
|
||||
@ -1066,7 +1066,7 @@ static void __init exynos4_clk_register_finpll(void)
|
||||
fclk.parent_name = NULL;
|
||||
fclk.flags = CLK_IS_ROOT;
|
||||
fclk.fixed_rate = finpll_f;
|
||||
samsung_clk_register_fixed_rate(&fclk, 1);
|
||||
samsung_clk_register_fixed_rate(ctx, &fclk, 1);
|
||||
|
||||
}
|
||||
|
||||
@ -1176,22 +1176,25 @@ static struct samsung_pll_clock exynos4x12_plls[nr_plls] __initdata = {
|
||||
static void __init exynos4_clk_init(struct device_node *np,
|
||||
enum exynos4_soc soc)
|
||||
{
|
||||
struct samsung_clk_provider *ctx;
|
||||
exynos4_soc = soc;
|
||||
|
||||
reg_base = of_iomap(np, 0);
|
||||
if (!reg_base)
|
||||
panic("%s: failed to map registers\n", __func__);
|
||||
|
||||
samsung_clk_init(np, reg_base, CLK_NR_CLKS);
|
||||
ctx = samsung_clk_init(np, reg_base, CLK_NR_CLKS);
|
||||
if (!ctx)
|
||||
panic("%s: unable to allocate context.\n", __func__);
|
||||
|
||||
samsung_clk_of_register_fixed_ext(exynos4_fixed_rate_ext_clks,
|
||||
samsung_clk_of_register_fixed_ext(ctx, exynos4_fixed_rate_ext_clks,
|
||||
ARRAY_SIZE(exynos4_fixed_rate_ext_clks),
|
||||
ext_clk_match);
|
||||
|
||||
exynos4_clk_register_finpll();
|
||||
exynos4_clk_register_finpll(ctx);
|
||||
|
||||
if (exynos4_soc == EXYNOS4210) {
|
||||
samsung_clk_register_mux(exynos4210_mux_early,
|
||||
samsung_clk_register_mux(ctx, exynos4210_mux_early,
|
||||
ARRAY_SIZE(exynos4210_mux_early));
|
||||
|
||||
if (_get_rate("fin_pll") == 24000000) {
|
||||
@ -1205,7 +1208,7 @@ static void __init exynos4_clk_init(struct device_node *np,
|
||||
exynos4210_plls[vpll].rate_table =
|
||||
exynos4210_vpll_rates;
|
||||
|
||||
samsung_clk_register_pll(exynos4210_plls,
|
||||
samsung_clk_register_pll(ctx, exynos4210_plls,
|
||||
ARRAY_SIZE(exynos4210_plls), reg_base);
|
||||
} else {
|
||||
if (_get_rate("fin_pll") == 24000000) {
|
||||
@ -1217,42 +1220,42 @@ static void __init exynos4_clk_init(struct device_node *np,
|
||||
exynos4x12_vpll_rates;
|
||||
}
|
||||
|
||||
samsung_clk_register_pll(exynos4x12_plls,
|
||||
samsung_clk_register_pll(ctx, exynos4x12_plls,
|
||||
ARRAY_SIZE(exynos4x12_plls), reg_base);
|
||||
}
|
||||
|
||||
samsung_clk_register_fixed_rate(exynos4_fixed_rate_clks,
|
||||
samsung_clk_register_fixed_rate(ctx, exynos4_fixed_rate_clks,
|
||||
ARRAY_SIZE(exynos4_fixed_rate_clks));
|
||||
samsung_clk_register_mux(exynos4_mux_clks,
|
||||
samsung_clk_register_mux(ctx, exynos4_mux_clks,
|
||||
ARRAY_SIZE(exynos4_mux_clks));
|
||||
samsung_clk_register_div(exynos4_div_clks,
|
||||
samsung_clk_register_div(ctx, exynos4_div_clks,
|
||||
ARRAY_SIZE(exynos4_div_clks));
|
||||
samsung_clk_register_gate(exynos4_gate_clks,
|
||||
samsung_clk_register_gate(ctx, exynos4_gate_clks,
|
||||
ARRAY_SIZE(exynos4_gate_clks));
|
||||
|
||||
if (exynos4_soc == EXYNOS4210) {
|
||||
samsung_clk_register_fixed_rate(exynos4210_fixed_rate_clks,
|
||||
samsung_clk_register_fixed_rate(ctx, exynos4210_fixed_rate_clks,
|
||||
ARRAY_SIZE(exynos4210_fixed_rate_clks));
|
||||
samsung_clk_register_mux(exynos4210_mux_clks,
|
||||
samsung_clk_register_mux(ctx, exynos4210_mux_clks,
|
||||
ARRAY_SIZE(exynos4210_mux_clks));
|
||||
samsung_clk_register_div(exynos4210_div_clks,
|
||||
samsung_clk_register_div(ctx, exynos4210_div_clks,
|
||||
ARRAY_SIZE(exynos4210_div_clks));
|
||||
samsung_clk_register_gate(exynos4210_gate_clks,
|
||||
samsung_clk_register_gate(ctx, exynos4210_gate_clks,
|
||||
ARRAY_SIZE(exynos4210_gate_clks));
|
||||
samsung_clk_register_alias(exynos4210_aliases,
|
||||
samsung_clk_register_alias(ctx, exynos4210_aliases,
|
||||
ARRAY_SIZE(exynos4210_aliases));
|
||||
} else {
|
||||
samsung_clk_register_mux(exynos4x12_mux_clks,
|
||||
samsung_clk_register_mux(ctx, exynos4x12_mux_clks,
|
||||
ARRAY_SIZE(exynos4x12_mux_clks));
|
||||
samsung_clk_register_div(exynos4x12_div_clks,
|
||||
samsung_clk_register_div(ctx, exynos4x12_div_clks,
|
||||
ARRAY_SIZE(exynos4x12_div_clks));
|
||||
samsung_clk_register_gate(exynos4x12_gate_clks,
|
||||
samsung_clk_register_gate(ctx, exynos4x12_gate_clks,
|
||||
ARRAY_SIZE(exynos4x12_gate_clks));
|
||||
samsung_clk_register_alias(exynos4x12_aliases,
|
||||
samsung_clk_register_alias(ctx, exynos4x12_aliases,
|
||||
ARRAY_SIZE(exynos4x12_aliases));
|
||||
}
|
||||
|
||||
samsung_clk_register_alias(exynos4_aliases,
|
||||
samsung_clk_register_alias(ctx, exynos4_aliases,
|
||||
ARRAY_SIZE(exynos4_aliases));
|
||||
|
||||
exynos4_clk_sleep_init();
|
||||
|
@ -37,6 +37,7 @@
|
||||
#define VPLL_CON0 0x10140
|
||||
#define GPLL_CON0 0x10150
|
||||
#define SRC_TOP0 0x10210
|
||||
#define SRC_TOP1 0x10214
|
||||
#define SRC_TOP2 0x10218
|
||||
#define SRC_TOP3 0x1021c
|
||||
#define SRC_GSCL 0x10220
|
||||
@ -71,6 +72,7 @@
|
||||
#define GATE_IP_GSCL 0x10920
|
||||
#define GATE_IP_DISP1 0x10928
|
||||
#define GATE_IP_MFC 0x1092c
|
||||
#define GATE_IP_G3D 0x10930
|
||||
#define GATE_IP_GEN 0x10934
|
||||
#define GATE_IP_FSYS 0x10944
|
||||
#define GATE_IP_PERIC 0x10950
|
||||
@ -100,6 +102,7 @@ static unsigned long exynos5250_clk_regs[] __initdata = {
|
||||
DIV_CPU0,
|
||||
SRC_CORE1,
|
||||
SRC_TOP0,
|
||||
SRC_TOP1,
|
||||
SRC_TOP2,
|
||||
SRC_TOP3,
|
||||
SRC_GSCL,
|
||||
@ -133,6 +136,7 @@ static unsigned long exynos5250_clk_regs[] __initdata = {
|
||||
DIV_PERIC5,
|
||||
GATE_IP_GSCL,
|
||||
GATE_IP_MFC,
|
||||
GATE_IP_G3D,
|
||||
GATE_IP_GEN,
|
||||
GATE_IP_FSYS,
|
||||
GATE_IP_PERIC,
|
||||
@ -189,10 +193,12 @@ PNAME(mout_vpllsrc_p) = { "fin_pll", "sclk_hdmi27m" };
|
||||
PNAME(mout_vpll_p) = { "mout_vpllsrc", "fout_vpll" };
|
||||
PNAME(mout_cpll_p) = { "fin_pll", "fout_cpll" };
|
||||
PNAME(mout_epll_p) = { "fin_pll", "fout_epll" };
|
||||
PNAME(mout_gpll_p) = { "fin_pll", "fout_gpll" };
|
||||
PNAME(mout_mpll_user_p) = { "fin_pll", "mout_mpll" };
|
||||
PNAME(mout_bpll_user_p) = { "fin_pll", "mout_bpll" };
|
||||
PNAME(mout_aclk166_p) = { "mout_cpll", "mout_mpll_user" };
|
||||
PNAME(mout_aclk200_p) = { "mout_mpll_user", "mout_bpll_user" };
|
||||
PNAME(mout_aclk400_p) = { "mout_aclk400_g3d_mid", "mout_gpll" };
|
||||
PNAME(mout_aclk200_sub_p) = { "fin_pll", "div_aclk200" };
|
||||
PNAME(mout_aclk266_sub_p) = { "fin_pll", "div_aclk266" };
|
||||
PNAME(mout_aclk333_sub_p) = { "fin_pll", "div_aclk333" };
|
||||
@ -273,12 +279,16 @@ static struct samsung_mux_clock exynos5250_mux_clks[] __initdata = {
|
||||
MUX(0, "mout_aclk166", mout_aclk166_p, SRC_TOP0, 8, 1),
|
||||
MUX(0, "mout_aclk200", mout_aclk200_p, SRC_TOP0, 12, 1),
|
||||
MUX(0, "mout_aclk333", mout_aclk166_p, SRC_TOP0, 16, 1),
|
||||
MUX(0, "mout_aclk400_g3d_mid", mout_aclk200_p, SRC_TOP0, 20, 1),
|
||||
|
||||
MUX(0, "mout_aclk400_g3d", mout_aclk400_p, SRC_TOP1, 28, 1),
|
||||
|
||||
MUX(0, "mout_cpll", mout_cpll_p, SRC_TOP2, 8, 1),
|
||||
MUX(0, "mout_epll", mout_epll_p, SRC_TOP2, 12, 1),
|
||||
MUX(0, "mout_vpll", mout_vpll_p, SRC_TOP2, 16, 1),
|
||||
MUX(0, "mout_mpll_user", mout_mpll_user_p, SRC_TOP2, 20, 1),
|
||||
MUX(0, "mout_bpll_user", mout_bpll_user_p, SRC_TOP2, 24, 1),
|
||||
MUX(CLK_MOUT_GPLL, "mout_gpll", mout_gpll_p, SRC_TOP2, 28, 1),
|
||||
|
||||
MUX(0, "mout_aclk200_disp1_sub", mout_aclk200_sub_p, SRC_TOP3, 4, 1),
|
||||
MUX(0, "mout_aclk266_gscl_sub", mout_aclk266_sub_p, SRC_TOP3, 8, 1),
|
||||
@ -351,6 +361,8 @@ static struct samsung_div_clock exynos5250_div_clks[] __initdata = {
|
||||
DIV(0, "div_aclk200", "mout_aclk200", DIV_TOP0, 12, 3),
|
||||
DIV(0, "div_aclk266", "mout_mpll_user", DIV_TOP0, 16, 3),
|
||||
DIV(0, "div_aclk333", "mout_aclk333", DIV_TOP0, 20, 3),
|
||||
DIV(0, "div_aclk400_g3d", "mout_aclk400_g3d", DIV_TOP0,
|
||||
24, 3),
|
||||
|
||||
DIV(0, "div_aclk66_pre", "mout_mpll_user", DIV_TOP1, 24, 3),
|
||||
|
||||
@ -428,6 +440,7 @@ static struct samsung_gate_clock exynos5250_gate_clks[] __initdata = {
|
||||
* CMU_ACP
|
||||
*/
|
||||
GATE(CLK_MDMA0, "mdma0", "div_aclk266", GATE_IP_ACP, 1, 0, 0),
|
||||
GATE(CLK_SSS, "sss", "div_aclk266", GATE_IP_ACP, 2, 0, 0),
|
||||
GATE(CLK_G2D, "g2d", "div_aclk200", GATE_IP_ACP, 3, 0, 0),
|
||||
GATE(CLK_SMMU_MDMA0, "smmu_mdma0", "div_aclk266", GATE_IP_ACP, 5, 0, 0),
|
||||
|
||||
@ -533,7 +546,8 @@ static struct samsung_gate_clock exynos5250_gate_clks[] __initdata = {
|
||||
0),
|
||||
GATE(CLK_SMMU_MFCL, "smmu_mfcl", "mout_aclk333_sub", GATE_IP_MFC, 2, 0,
|
||||
0),
|
||||
|
||||
GATE(CLK_G3D, "g3d", "div_aclk400_g3d", GATE_IP_G3D, 0,
|
||||
CLK_SET_RATE_PARENT, 0),
|
||||
GATE(CLK_ROTATOR, "rotator", "div_aclk266", GATE_IP_GEN, 1, 0, 0),
|
||||
GATE(CLK_JPEG, "jpeg", "div_aclk166", GATE_IP_GEN, 2, 0, 0),
|
||||
GATE(CLK_MDMA1, "mdma1", "div_aclk266", GATE_IP_GEN, 4, 0, 0),
|
||||
@ -686,6 +700,8 @@ static struct of_device_id ext_clk_match[] __initdata = {
|
||||
/* register exynox5250 clocks */
|
||||
static void __init exynos5250_clk_init(struct device_node *np)
|
||||
{
|
||||
struct samsung_clk_provider *ctx;
|
||||
|
||||
if (np) {
|
||||
reg_base = of_iomap(np, 0);
|
||||
if (!reg_base)
|
||||
@ -694,11 +710,13 @@ static void __init exynos5250_clk_init(struct device_node *np)
|
||||
panic("%s: unable to determine soc\n", __func__);
|
||||
}
|
||||
|
||||
samsung_clk_init(np, reg_base, CLK_NR_CLKS);
|
||||
samsung_clk_of_register_fixed_ext(exynos5250_fixed_rate_ext_clks,
|
||||
ctx = samsung_clk_init(np, reg_base, CLK_NR_CLKS);
|
||||
if (!ctx)
|
||||
panic("%s: unable to allocate context.\n", __func__);
|
||||
samsung_clk_of_register_fixed_ext(ctx, exynos5250_fixed_rate_ext_clks,
|
||||
ARRAY_SIZE(exynos5250_fixed_rate_ext_clks),
|
||||
ext_clk_match);
|
||||
samsung_clk_register_mux(exynos5250_pll_pmux_clks,
|
||||
samsung_clk_register_mux(ctx, exynos5250_pll_pmux_clks,
|
||||
ARRAY_SIZE(exynos5250_pll_pmux_clks));
|
||||
|
||||
if (_get_rate("fin_pll") == 24 * MHZ) {
|
||||
@ -709,17 +727,18 @@ static void __init exynos5250_clk_init(struct device_node *np)
|
||||
if (_get_rate("mout_vpllsrc") == 24 * MHZ)
|
||||
exynos5250_plls[vpll].rate_table = vpll_24mhz_tbl;
|
||||
|
||||
samsung_clk_register_pll(exynos5250_plls, ARRAY_SIZE(exynos5250_plls),
|
||||
reg_base);
|
||||
samsung_clk_register_fixed_rate(exynos5250_fixed_rate_clks,
|
||||
samsung_clk_register_pll(ctx, exynos5250_plls,
|
||||
ARRAY_SIZE(exynos5250_plls),
|
||||
reg_base);
|
||||
samsung_clk_register_fixed_rate(ctx, exynos5250_fixed_rate_clks,
|
||||
ARRAY_SIZE(exynos5250_fixed_rate_clks));
|
||||
samsung_clk_register_fixed_factor(exynos5250_fixed_factor_clks,
|
||||
samsung_clk_register_fixed_factor(ctx, exynos5250_fixed_factor_clks,
|
||||
ARRAY_SIZE(exynos5250_fixed_factor_clks));
|
||||
samsung_clk_register_mux(exynos5250_mux_clks,
|
||||
samsung_clk_register_mux(ctx, exynos5250_mux_clks,
|
||||
ARRAY_SIZE(exynos5250_mux_clks));
|
||||
samsung_clk_register_div(exynos5250_div_clks,
|
||||
samsung_clk_register_div(ctx, exynos5250_div_clks,
|
||||
ARRAY_SIZE(exynos5250_div_clks));
|
||||
samsung_clk_register_gate(exynos5250_gate_clks,
|
||||
samsung_clk_register_gate(ctx, exynos5250_gate_clks,
|
||||
ARRAY_SIZE(exynos5250_gate_clks));
|
||||
|
||||
exynos5250_clk_sleep_init();
|
||||
|
1980
drivers/clk/samsung/clk-exynos5260.c
Normal file
1980
drivers/clk/samsung/clk-exynos5260.c
Normal file
File diff suppressed because it is too large
Load Diff
459
drivers/clk/samsung/clk-exynos5260.h
Normal file
459
drivers/clk/samsung/clk-exynos5260.h
Normal file
@ -0,0 +1,459 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
|
||||
* Author: Rahul Sharma <rahul.sharma@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Common Clock Framework support for Exynos5260 SoC.
|
||||
*/
|
||||
|
||||
#ifndef __CLK_EXYNOS5260_H
|
||||
#define __CLK_EXYNOS5260_H
|
||||
|
||||
/*
|
||||
*Registers for CMU_AUD
|
||||
*/
|
||||
#define MUX_SEL_AUD 0x0200
|
||||
#define MUX_ENABLE_AUD 0x0300
|
||||
#define MUX_STAT_AUD 0x0400
|
||||
#define MUX_IGNORE_AUD 0x0500
|
||||
#define DIV_AUD0 0x0600
|
||||
#define DIV_AUD1 0x0604
|
||||
#define DIV_STAT_AUD0 0x0700
|
||||
#define DIV_STAT_AUD1 0x0704
|
||||
#define EN_ACLK_AUD 0x0800
|
||||
#define EN_PCLK_AUD 0x0900
|
||||
#define EN_SCLK_AUD 0x0a00
|
||||
#define EN_IP_AUD 0x0b00
|
||||
|
||||
/*
|
||||
*Registers for CMU_DISP
|
||||
*/
|
||||
#define MUX_SEL_DISP0 0x0200
|
||||
#define MUX_SEL_DISP1 0x0204
|
||||
#define MUX_SEL_DISP2 0x0208
|
||||
#define MUX_SEL_DISP3 0x020C
|
||||
#define MUX_SEL_DISP4 0x0210
|
||||
#define MUX_ENABLE_DISP0 0x0300
|
||||
#define MUX_ENABLE_DISP1 0x0304
|
||||
#define MUX_ENABLE_DISP2 0x0308
|
||||
#define MUX_ENABLE_DISP3 0x030c
|
||||
#define MUX_ENABLE_DISP4 0x0310
|
||||
#define MUX_STAT_DISP0 0x0400
|
||||
#define MUX_STAT_DISP1 0x0404
|
||||
#define MUX_STAT_DISP2 0x0408
|
||||
#define MUX_STAT_DISP3 0x040c
|
||||
#define MUX_STAT_DISP4 0x0410
|
||||
#define MUX_IGNORE_DISP0 0x0500
|
||||
#define MUX_IGNORE_DISP1 0x0504
|
||||
#define MUX_IGNORE_DISP2 0x0508
|
||||
#define MUX_IGNORE_DISP3 0x050c
|
||||
#define MUX_IGNORE_DISP4 0x0510
|
||||
#define DIV_DISP 0x0600
|
||||
#define DIV_STAT_DISP 0x0700
|
||||
#define EN_ACLK_DISP 0x0800
|
||||
#define EN_PCLK_DISP 0x0900
|
||||
#define EN_SCLK_DISP0 0x0a00
|
||||
#define EN_SCLK_DISP1 0x0a04
|
||||
#define EN_IP_DISP 0x0b00
|
||||
#define EN_IP_DISP_BUS 0x0b04
|
||||
|
||||
|
||||
/*
|
||||
*Registers for CMU_EGL
|
||||
*/
|
||||
#define EGL_PLL_LOCK 0x0000
|
||||
#define EGL_DPLL_LOCK 0x0004
|
||||
#define EGL_PLL_CON0 0x0100
|
||||
#define EGL_PLL_CON1 0x0104
|
||||
#define EGL_PLL_FREQ_DET 0x010c
|
||||
#define EGL_DPLL_CON0 0x0110
|
||||
#define EGL_DPLL_CON1 0x0114
|
||||
#define EGL_DPLL_FREQ_DET 0x011c
|
||||
#define MUX_SEL_EGL 0x0200
|
||||
#define MUX_ENABLE_EGL 0x0300
|
||||
#define MUX_STAT_EGL 0x0400
|
||||
#define DIV_EGL 0x0600
|
||||
#define DIV_EGL_PLL_FDET 0x0604
|
||||
#define DIV_STAT_EGL 0x0700
|
||||
#define DIV_STAT_EGL_PLL_FDET 0x0704
|
||||
#define EN_ACLK_EGL 0x0800
|
||||
#define EN_PCLK_EGL 0x0900
|
||||
#define EN_SCLK_EGL 0x0a00
|
||||
#define EN_IP_EGL 0x0b00
|
||||
#define CLKOUT_CMU_EGL 0x0c00
|
||||
#define CLKOUT_CMU_EGL_DIV_STAT 0x0c04
|
||||
#define ARMCLK_STOPCTRL 0x1000
|
||||
#define EAGLE_EMA_CTRL 0x1008
|
||||
#define EAGLE_EMA_STATUS 0x100c
|
||||
#define PWR_CTRL 0x1020
|
||||
#define PWR_CTRL2 0x1024
|
||||
#define CLKSTOP_CTRL 0x1028
|
||||
#define INTR_SPREAD_EN 0x1080
|
||||
#define INTR_SPREAD_USE_STANDBYWFI 0x1084
|
||||
#define INTR_SPREAD_BLOCKING_DURATION 0x1088
|
||||
#define CMU_EGL_SPARE0 0x2000
|
||||
#define CMU_EGL_SPARE1 0x2004
|
||||
#define CMU_EGL_SPARE2 0x2008
|
||||
#define CMU_EGL_SPARE3 0x200c
|
||||
#define CMU_EGL_SPARE4 0x2010
|
||||
|
||||
/*
|
||||
*Registers for CMU_FSYS
|
||||
*/
|
||||
|
||||
#define MUX_SEL_FSYS0 0x0200
|
||||
#define MUX_SEL_FSYS1 0x0204
|
||||
#define MUX_ENABLE_FSYS0 0x0300
|
||||
#define MUX_ENABLE_FSYS1 0x0304
|
||||
#define MUX_STAT_FSYS0 0x0400
|
||||
#define MUX_STAT_FSYS1 0x0404
|
||||
#define MUX_IGNORE_FSYS0 0x0500
|
||||
#define MUX_IGNORE_FSYS1 0x0504
|
||||
#define EN_ACLK_FSYS 0x0800
|
||||
#define EN_ACLK_FSYS_SECURE_RTIC 0x0804
|
||||
#define EN_ACLK_FSYS_SECURE_SMMU_RTIC 0x0808
|
||||
#define EN_PCLK_FSYS 0x0900
|
||||
#define EN_SCLK_FSYS 0x0a00
|
||||
#define EN_IP_FSYS 0x0b00
|
||||
#define EN_IP_FSYS_SECURE_RTIC 0x0b04
|
||||
#define EN_IP_FSYS_SECURE_SMMU_RTIC 0x0b08
|
||||
|
||||
/*
|
||||
*Registers for CMU_G2D
|
||||
*/
|
||||
|
||||
#define MUX_SEL_G2D 0x0200
|
||||
#define MUX_ENABLE_G2D 0x0300
|
||||
#define MUX_STAT_G2D 0x0400
|
||||
#define DIV_G2D 0x0600
|
||||
#define DIV_STAT_G2D 0x0700
|
||||
#define EN_ACLK_G2D 0x0800
|
||||
#define EN_ACLK_G2D_SECURE_SSS 0x0804
|
||||
#define EN_ACLK_G2D_SECURE_SLIM_SSS 0x0808
|
||||
#define EN_ACLK_G2D_SECURE_SMMU_SLIM_SSS 0x080c
|
||||
#define EN_ACLK_G2D_SECURE_SMMU_SSS 0x0810
|
||||
#define EN_ACLK_G2D_SECURE_SMMU_MDMA 0x0814
|
||||
#define EN_ACLK_G2D_SECURE_SMMU_G2D 0x0818
|
||||
#define EN_PCLK_G2D 0x0900
|
||||
#define EN_PCLK_G2D_SECURE_SMMU_SLIM_SSS 0x0904
|
||||
#define EN_PCLK_G2D_SECURE_SMMU_SSS 0x0908
|
||||
#define EN_PCLK_G2D_SECURE_SMMU_MDMA 0x090c
|
||||
#define EN_PCLK_G2D_SECURE_SMMU_G2D 0x0910
|
||||
#define EN_IP_G2D 0x0b00
|
||||
#define EN_IP_G2D_SECURE_SSS 0x0b04
|
||||
#define EN_IP_G2D_SECURE_SLIM_SSS 0x0b08
|
||||
#define EN_IP_G2D_SECURE_SMMU_SLIM_SSS 0x0b0c
|
||||
#define EN_IP_G2D_SECURE_SMMU_SSS 0x0b10
|
||||
#define EN_IP_G2D_SECURE_SMMU_MDMA 0x0b14
|
||||
#define EN_IP_G2D_SECURE_SMMU_G2D 0x0b18
|
||||
|
||||
/*
|
||||
*Registers for CMU_G3D
|
||||
*/
|
||||
|
||||
#define G3D_PLL_LOCK 0x0000
|
||||
#define G3D_PLL_CON0 0x0100
|
||||
#define G3D_PLL_CON1 0x0104
|
||||
#define G3D_PLL_FDET 0x010c
|
||||
#define MUX_SEL_G3D 0x0200
|
||||
#define MUX_EN_G3D 0x0300
|
||||
#define MUX_STAT_G3D 0x0400
|
||||
#define MUX_IGNORE_G3D 0x0500
|
||||
#define DIV_G3D 0x0600
|
||||
#define DIV_G3D_PLL_FDET 0x0604
|
||||
#define DIV_STAT_G3D 0x0700
|
||||
#define DIV_STAT_G3D_PLL_FDET 0x0704
|
||||
#define EN_ACLK_G3D 0x0800
|
||||
#define EN_PCLK_G3D 0x0900
|
||||
#define EN_SCLK_G3D 0x0a00
|
||||
#define EN_IP_G3D 0x0b00
|
||||
#define CLKOUT_CMU_G3D 0x0c00
|
||||
#define CLKOUT_CMU_G3D_DIV_STAT 0x0c04
|
||||
#define G3DCLK_STOPCTRL 0x1000
|
||||
#define G3D_EMA_CTRL 0x1008
|
||||
#define G3D_EMA_STATUS 0x100c
|
||||
|
||||
/*
|
||||
*Registers for CMU_GSCL
|
||||
*/
|
||||
|
||||
#define MUX_SEL_GSCL 0x0200
|
||||
#define MUX_EN_GSCL 0x0300
|
||||
#define MUX_STAT_GSCL 0x0400
|
||||
#define MUX_IGNORE_GSCL 0x0500
|
||||
#define DIV_GSCL 0x0600
|
||||
#define DIV_STAT_GSCL 0x0700
|
||||
#define EN_ACLK_GSCL 0x0800
|
||||
#define EN_ACLK_GSCL_FIMC 0x0804
|
||||
#define EN_ACLK_GSCL_SECURE_SMMU_GSCL0 0x0808
|
||||
#define EN_ACLK_GSCL_SECURE_SMMU_GSCL1 0x080c
|
||||
#define EN_ACLK_GSCL_SECURE_SMMU_MSCL0 0x0810
|
||||
#define EN_ACLK_GSCL_SECURE_SMMU_MSCL1 0x0814
|
||||
#define EN_PCLK_GSCL 0x0900
|
||||
#define EN_PCLK_GSCL_FIMC 0x0904
|
||||
#define EN_PCLK_GSCL_SECURE_SMMU_GSCL0 0x0908
|
||||
#define EN_PCLK_GSCL_SECURE_SMMU_GSCL1 0x090c
|
||||
#define EN_PCLK_GSCL_SECURE_SMMU_MSCL0 0x0910
|
||||
#define EN_PCLK_GSCL_SECURE_SMMU_MSCL1 0x0914
|
||||
#define EN_SCLK_GSCL 0x0a00
|
||||
#define EN_SCLK_GSCL_FIMC 0x0a04
|
||||
#define EN_IP_GSCL 0x0b00
|
||||
#define EN_IP_GSCL_FIMC 0x0b04
|
||||
#define EN_IP_GSCL_SECURE_SMMU_GSCL0 0x0b08
|
||||
#define EN_IP_GSCL_SECURE_SMMU_GSCL1 0x0b0c
|
||||
#define EN_IP_GSCL_SECURE_SMMU_MSCL0 0x0b10
|
||||
#define EN_IP_GSCL_SECURE_SMMU_MSCL1 0x0b14
|
||||
|
||||
/*
|
||||
*Registers for CMU_ISP
|
||||
*/
|
||||
#define MUX_SEL_ISP0 0x0200
|
||||
#define MUX_SEL_ISP1 0x0204
|
||||
#define MUX_ENABLE_ISP0 0x0300
|
||||
#define MUX_ENABLE_ISP1 0x0304
|
||||
#define MUX_STAT_ISP0 0x0400
|
||||
#define MUX_STAT_ISP1 0x0404
|
||||
#define MUX_IGNORE_ISP0 0x0500
|
||||
#define MUX_IGNORE_ISP1 0x0504
|
||||
#define DIV_ISP 0x0600
|
||||
#define DIV_STAT_ISP 0x0700
|
||||
#define EN_ACLK_ISP0 0x0800
|
||||
#define EN_ACLK_ISP1 0x0804
|
||||
#define EN_PCLK_ISP0 0x0900
|
||||
#define EN_PCLK_ISP1 0x0904
|
||||
#define EN_SCLK_ISP 0x0a00
|
||||
#define EN_IP_ISP0 0x0b00
|
||||
#define EN_IP_ISP1 0x0b04
|
||||
|
||||
/*
|
||||
*Registers for CMU_KFC
|
||||
*/
|
||||
#define KFC_PLL_LOCK 0x0000
|
||||
#define KFC_PLL_CON0 0x0100
|
||||
#define KFC_PLL_CON1 0x0104
|
||||
#define KFC_PLL_FDET 0x010c
|
||||
#define MUX_SEL_KFC0 0x0200
|
||||
#define MUX_SEL_KFC2 0x0208
|
||||
#define MUX_ENABLE_KFC0 0x0300
|
||||
#define MUX_ENABLE_KFC2 0x0308
|
||||
#define MUX_STAT_KFC0 0x0400
|
||||
#define MUX_STAT_KFC2 0x0408
|
||||
#define DIV_KFC 0x0600
|
||||
#define DIV_KFC_PLL_FDET 0x0604
|
||||
#define DIV_STAT_KFC 0x0700
|
||||
#define DIV_STAT_KFC_PLL_FDET 0x0704
|
||||
#define EN_ACLK_KFC 0x0800
|
||||
#define EN_PCLK_KFC 0x0900
|
||||
#define EN_SCLK_KFC 0x0a00
|
||||
#define EN_IP_KFC 0x0b00
|
||||
#define CLKOUT_CMU_KFC 0x0c00
|
||||
#define CLKOUT_CMU_KFC_DIV_STAT 0x0c04
|
||||
#define ARMCLK_STOPCTRL_KFC 0x1000
|
||||
#define ARM_EMA_CTRL 0x1008
|
||||
#define ARM_EMA_STATUS 0x100c
|
||||
#define PWR_CTRL_KFC 0x1020
|
||||
#define PWR_CTRL2_KFC 0x1024
|
||||
#define CLKSTOP_CTRL_KFC 0x1028
|
||||
#define INTR_SPREAD_ENABLE_KFC 0x1080
|
||||
#define INTR_SPREAD_USE_STANDBYWFI_KFC 0x1084
|
||||
#define INTR_SPREAD_BLOCKING_DURATION_KFC 0x1088
|
||||
#define CMU_KFC_SPARE0 0x2000
|
||||
#define CMU_KFC_SPARE1 0x2004
|
||||
#define CMU_KFC_SPARE2 0x2008
|
||||
#define CMU_KFC_SPARE3 0x200c
|
||||
#define CMU_KFC_SPARE4 0x2010
|
||||
|
||||
/*
|
||||
*Registers for CMU_MFC
|
||||
*/
|
||||
#define MUX_SEL_MFC 0x0200
|
||||
#define MUX_ENABLE_MFC 0x0300
|
||||
#define MUX_STAT_MFC 0x0400
|
||||
#define DIV_MFC 0x0600
|
||||
#define DIV_STAT_MFC 0x0700
|
||||
#define EN_ACLK_MFC 0x0800
|
||||
#define EN_ACLK_SECURE_SMMU2_MFC 0x0804
|
||||
#define EN_PCLK_MFC 0x0900
|
||||
#define EN_PCLK_SECURE_SMMU2_MFC 0x0904
|
||||
#define EN_IP_MFC 0x0b00
|
||||
#define EN_IP_MFC_SECURE_SMMU2_MFC 0x0b04
|
||||
|
||||
/*
|
||||
*Registers for CMU_MIF
|
||||
*/
|
||||
#define MEM_PLL_LOCK 0x0000
|
||||
#define BUS_PLL_LOCK 0x0004
|
||||
#define MEDIA_PLL_LOCK 0x0008
|
||||
#define MEM_PLL_CON0 0x0100
|
||||
#define MEM_PLL_CON1 0x0104
|
||||
#define MEM_PLL_FDET 0x010c
|
||||
#define BUS_PLL_CON0 0x0110
|
||||
#define BUS_PLL_CON1 0x0114
|
||||
#define BUS_PLL_FDET 0x011c
|
||||
#define MEDIA_PLL_CON0 0x0120
|
||||
#define MEDIA_PLL_CON1 0x0124
|
||||
#define MEDIA_PLL_FDET 0x012c
|
||||
#define MUX_SEL_MIF 0x0200
|
||||
#define MUX_ENABLE_MIF 0x0300
|
||||
#define MUX_STAT_MIF 0x0400
|
||||
#define MUX_IGNORE_MIF 0x0500
|
||||
#define DIV_MIF 0x0600
|
||||
#define DIV_MIF_PLL_FDET 0x0604
|
||||
#define DIV_STAT_MIF 0x0700
|
||||
#define DIV_STAT_MIF_PLL_FDET 0x0704
|
||||
#define EN_ACLK_MIF 0x0800
|
||||
#define EN_ACLK_MIF_SECURE_DREX1_TZ 0x0804
|
||||
#define EN_ACLK_MIF_SECURE_DREX0_TZ 0x0808
|
||||
#define EN_ACLK_MIF_SECURE_INTMEM 0x080c
|
||||
#define EN_PCLK_MIF 0x0900
|
||||
#define EN_PCLK_MIF_SECURE_MONOCNT 0x0904
|
||||
#define EN_PCLK_MIF_SECURE_RTC_APBIF 0x0908
|
||||
#define EN_PCLK_MIF_SECURE_DREX1_TZ 0x090c
|
||||
#define EN_PCLK_MIF_SECURE_DREX0_TZ 0x0910
|
||||
#define EN_SCLK_MIF 0x0a00
|
||||
#define EN_IP_MIF 0x0b00
|
||||
#define EN_IP_MIF_SECURE_MONOCNT 0x0b04
|
||||
#define EN_IP_MIF_SECURE_RTC_APBIF 0x0b08
|
||||
#define EN_IP_MIF_SECURE_DREX1_TZ 0x0b0c
|
||||
#define EN_IP_MIF_SECURE_DREX0_TZ 0x0b10
|
||||
#define EN_IP_MIF_SECURE_INTEMEM 0x0b14
|
||||
#define CLKOUT_CMU_MIF_DIV_STAT 0x0c04
|
||||
#define DREX_FREQ_CTRL 0x1000
|
||||
#define PAUSE 0x1004
|
||||
#define DDRPHY_LOCK_CTRL 0x1008
|
||||
#define CLKOUT_CMU_MIF 0xcb00
|
||||
|
||||
/*
|
||||
*Registers for CMU_PERI
|
||||
*/
|
||||
#define MUX_SEL_PERI 0x0200
|
||||
#define MUX_SEL_PERI1 0x0204
|
||||
#define MUX_ENABLE_PERI 0x0300
|
||||
#define MUX_ENABLE_PERI1 0x0304
|
||||
#define MUX_STAT_PERI 0x0400
|
||||
#define MUX_STAT_PERI1 0x0404
|
||||
#define MUX_IGNORE_PERI 0x0500
|
||||
#define MUX_IGNORE_PERI1 0x0504
|
||||
#define DIV_PERI 0x0600
|
||||
#define DIV_STAT_PERI 0x0700
|
||||
#define EN_PCLK_PERI0 0x0800
|
||||
#define EN_PCLK_PERI1 0x0804
|
||||
#define EN_PCLK_PERI2 0x0808
|
||||
#define EN_PCLK_PERI3 0x080c
|
||||
#define EN_PCLK_PERI_SECURE_CHIPID 0x0810
|
||||
#define EN_PCLK_PERI_SECURE_PROVKEY0 0x0814
|
||||
#define EN_PCLK_PERI_SECURE_PROVKEY1 0x0818
|
||||
#define EN_PCLK_PERI_SECURE_SECKEY 0x081c
|
||||
#define EN_PCLK_PERI_SECURE_ANTIRBKCNT 0x0820
|
||||
#define EN_PCLK_PERI_SECURE_TOP_RTC 0x0824
|
||||
#define EN_PCLK_PERI_SECURE_TZPC 0x0828
|
||||
#define EN_SCLK_PERI 0x0a00
|
||||
#define EN_SCLK_PERI_SECURE_TOP_RTC 0x0a04
|
||||
#define EN_IP_PERI0 0x0b00
|
||||
#define EN_IP_PERI1 0x0b04
|
||||
#define EN_IP_PERI2 0x0b08
|
||||
#define EN_IP_PERI_SECURE_CHIPID 0x0b0c
|
||||
#define EN_IP_PERI_SECURE_PROVKEY0 0x0b10
|
||||
#define EN_IP_PERI_SECURE_PROVKEY1 0x0b14
|
||||
#define EN_IP_PERI_SECURE_SECKEY 0x0b18
|
||||
#define EN_IP_PERI_SECURE_ANTIRBKCNT 0x0b1c
|
||||
#define EN_IP_PERI_SECURE_TOP_RTC 0x0b20
|
||||
#define EN_IP_PERI_SECURE_TZPC 0x0b24
|
||||
|
||||
/*
|
||||
*Registers for CMU_TOP
|
||||
*/
|
||||
#define DISP_PLL_LOCK 0x0000
|
||||
#define AUD_PLL_LOCK 0x0004
|
||||
#define DISP_PLL_CON0 0x0100
|
||||
#define DISP_PLL_CON1 0x0104
|
||||
#define DISP_PLL_FDET 0x0108
|
||||
#define AUD_PLL_CON0 0x0110
|
||||
#define AUD_PLL_CON1 0x0114
|
||||
#define AUD_PLL_CON2 0x0118
|
||||
#define AUD_PLL_FDET 0x011c
|
||||
#define MUX_SEL_TOP_PLL0 0x0200
|
||||
#define MUX_SEL_TOP_MFC 0x0204
|
||||
#define MUX_SEL_TOP_G2D 0x0208
|
||||
#define MUX_SEL_TOP_GSCL 0x020c
|
||||
#define MUX_SEL_TOP_ISP10 0x0214
|
||||
#define MUX_SEL_TOP_ISP11 0x0218
|
||||
#define MUX_SEL_TOP_DISP0 0x021c
|
||||
#define MUX_SEL_TOP_DISP1 0x0220
|
||||
#define MUX_SEL_TOP_BUS 0x0224
|
||||
#define MUX_SEL_TOP_PERI0 0x0228
|
||||
#define MUX_SEL_TOP_PERI1 0x022c
|
||||
#define MUX_SEL_TOP_FSYS 0x0230
|
||||
#define MUX_ENABLE_TOP_PLL0 0x0300
|
||||
#define MUX_ENABLE_TOP_MFC 0x0304
|
||||
#define MUX_ENABLE_TOP_G2D 0x0308
|
||||
#define MUX_ENABLE_TOP_GSCL 0x030c
|
||||
#define MUX_ENABLE_TOP_ISP10 0x0314
|
||||
#define MUX_ENABLE_TOP_ISP11 0x0318
|
||||
#define MUX_ENABLE_TOP_DISP0 0x031c
|
||||
#define MUX_ENABLE_TOP_DISP1 0x0320
|
||||
#define MUX_ENABLE_TOP_BUS 0x0324
|
||||
#define MUX_ENABLE_TOP_PERI0 0x0328
|
||||
#define MUX_ENABLE_TOP_PERI1 0x032c
|
||||
#define MUX_ENABLE_TOP_FSYS 0x0330
|
||||
#define MUX_STAT_TOP_PLL0 0x0400
|
||||
#define MUX_STAT_TOP_MFC 0x0404
|
||||
#define MUX_STAT_TOP_G2D 0x0408
|
||||
#define MUX_STAT_TOP_GSCL 0x040c
|
||||
#define MUX_STAT_TOP_ISP10 0x0414
|
||||
#define MUX_STAT_TOP_ISP11 0x0418
|
||||
#define MUX_STAT_TOP_DISP0 0x041c
|
||||
#define MUX_STAT_TOP_DISP1 0x0420
|
||||
#define MUX_STAT_TOP_BUS 0x0424
|
||||
#define MUX_STAT_TOP_PERI0 0x0428
|
||||
#define MUX_STAT_TOP_PERI1 0x042c
|
||||
#define MUX_STAT_TOP_FSYS 0x0430
|
||||
#define MUX_IGNORE_TOP_PLL0 0x0500
|
||||
#define MUX_IGNORE_TOP_MFC 0x0504
|
||||
#define MUX_IGNORE_TOP_G2D 0x0508
|
||||
#define MUX_IGNORE_TOP_GSCL 0x050c
|
||||
#define MUX_IGNORE_TOP_ISP10 0x0514
|
||||
#define MUX_IGNORE_TOP_ISP11 0x0518
|
||||
#define MUX_IGNORE_TOP_DISP0 0x051c
|
||||
#define MUX_IGNORE_TOP_DISP1 0x0520
|
||||
#define MUX_IGNORE_TOP_BUS 0x0524
|
||||
#define MUX_IGNORE_TOP_PERI0 0x0528
|
||||
#define MUX_IGNORE_TOP_PERI1 0x052c
|
||||
#define MUX_IGNORE_TOP_FSYS 0x0530
|
||||
#define DIV_TOP_G2D_MFC 0x0600
|
||||
#define DIV_TOP_GSCL_ISP0 0x0604
|
||||
#define DIV_TOP_ISP10 0x0608
|
||||
#define DIV_TOP_ISP11 0x060c
|
||||
#define DIV_TOP_DISP 0x0610
|
||||
#define DIV_TOP_BUS 0x0614
|
||||
#define DIV_TOP_PERI0 0x0618
|
||||
#define DIV_TOP_PERI1 0x061c
|
||||
#define DIV_TOP_PERI2 0x0620
|
||||
#define DIV_TOP_FSYS0 0x0624
|
||||
#define DIV_TOP_FSYS1 0x0628
|
||||
#define DIV_TOP_HPM 0x062c
|
||||
#define DIV_TOP_PLL_FDET 0x0630
|
||||
#define DIV_STAT_TOP_G2D_MFC 0x0700
|
||||
#define DIV_STAT_TOP_GSCL_ISP0 0x0704
|
||||
#define DIV_STAT_TOP_ISP10 0x0708
|
||||
#define DIV_STAT_TOP_ISP11 0x070c
|
||||
#define DIV_STAT_TOP_DISP 0x0710
|
||||
#define DIV_STAT_TOP_BUS 0x0714
|
||||
#define DIV_STAT_TOP_PERI0 0x0718
|
||||
#define DIV_STAT_TOP_PERI1 0x071c
|
||||
#define DIV_STAT_TOP_PERI2 0x0720
|
||||
#define DIV_STAT_TOP_FSYS0 0x0724
|
||||
#define DIV_STAT_TOP_FSYS1 0x0728
|
||||
#define DIV_STAT_TOP_HPM 0x072c
|
||||
#define DIV_STAT_TOP_PLL_FDET 0x0730
|
||||
#define EN_ACLK_TOP 0x0800
|
||||
#define EN_SCLK_TOP 0x0a00
|
||||
#define EN_IP_TOP 0x0b00
|
||||
#define CLKOUT_CMU_TOP 0x0c00
|
||||
#define CLKOUT_CMU_TOP_DIV_STAT 0x0c04
|
||||
|
||||
#endif /*__CLK_EXYNOS5260_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -93,6 +93,7 @@ static struct of_device_id ext_clk_match[] __initdata = {
|
||||
static void __init exynos5440_clk_init(struct device_node *np)
|
||||
{
|
||||
void __iomem *reg_base;
|
||||
struct samsung_clk_provider *ctx;
|
||||
|
||||
reg_base = of_iomap(np, 0);
|
||||
if (!reg_base) {
|
||||
@ -101,22 +102,25 @@ static void __init exynos5440_clk_init(struct device_node *np)
|
||||
return;
|
||||
}
|
||||
|
||||
samsung_clk_init(np, reg_base, CLK_NR_CLKS);
|
||||
samsung_clk_of_register_fixed_ext(exynos5440_fixed_rate_ext_clks,
|
||||
ctx = samsung_clk_init(np, reg_base, CLK_NR_CLKS);
|
||||
if (!ctx)
|
||||
panic("%s: unable to allocate context.\n", __func__);
|
||||
|
||||
samsung_clk_of_register_fixed_ext(ctx, exynos5440_fixed_rate_ext_clks,
|
||||
ARRAY_SIZE(exynos5440_fixed_rate_ext_clks), ext_clk_match);
|
||||
|
||||
samsung_clk_register_pll2550x("cplla", "xtal", reg_base + 0x1c, 0x10);
|
||||
samsung_clk_register_pll2550x("cpllb", "xtal", reg_base + 0x20, 0x10);
|
||||
|
||||
samsung_clk_register_fixed_rate(exynos5440_fixed_rate_clks,
|
||||
samsung_clk_register_fixed_rate(ctx, exynos5440_fixed_rate_clks,
|
||||
ARRAY_SIZE(exynos5440_fixed_rate_clks));
|
||||
samsung_clk_register_fixed_factor(exynos5440_fixed_factor_clks,
|
||||
samsung_clk_register_fixed_factor(ctx, exynos5440_fixed_factor_clks,
|
||||
ARRAY_SIZE(exynos5440_fixed_factor_clks));
|
||||
samsung_clk_register_mux(exynos5440_mux_clks,
|
||||
samsung_clk_register_mux(ctx, exynos5440_mux_clks,
|
||||
ARRAY_SIZE(exynos5440_mux_clks));
|
||||
samsung_clk_register_div(exynos5440_div_clks,
|
||||
samsung_clk_register_div(ctx, exynos5440_div_clks,
|
||||
ARRAY_SIZE(exynos5440_div_clks));
|
||||
samsung_clk_register_gate(exynos5440_gate_clks,
|
||||
samsung_clk_register_gate(ctx, exynos5440_gate_clks,
|
||||
ARRAY_SIZE(exynos5440_gate_clks));
|
||||
|
||||
pr_info("Exynos5440: arm_clk = %ldHz\n", _get_rate("arm_clk"));
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/hrtimer.h>
|
||||
#include <linux/delay.h>
|
||||
#include "clk.h"
|
||||
#include "clk-pll.h"
|
||||
|
||||
@ -58,6 +59,72 @@ static long samsung_pll_round_rate(struct clk_hw *hw,
|
||||
return rate_table[i - 1].rate;
|
||||
}
|
||||
|
||||
/*
|
||||
* PLL2126 Clock Type
|
||||
*/
|
||||
|
||||
#define PLL2126_MDIV_MASK (0xff)
|
||||
#define PLL2126_PDIV_MASK (0x3f)
|
||||
#define PLL2126_SDIV_MASK (0x3)
|
||||
#define PLL2126_MDIV_SHIFT (16)
|
||||
#define PLL2126_PDIV_SHIFT (8)
|
||||
#define PLL2126_SDIV_SHIFT (0)
|
||||
|
||||
static unsigned long samsung_pll2126_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct samsung_clk_pll *pll = to_clk_pll(hw);
|
||||
u32 pll_con, mdiv, pdiv, sdiv;
|
||||
u64 fvco = parent_rate;
|
||||
|
||||
pll_con = __raw_readl(pll->con_reg);
|
||||
mdiv = (pll_con >> PLL2126_MDIV_SHIFT) & PLL2126_MDIV_MASK;
|
||||
pdiv = (pll_con >> PLL2126_PDIV_SHIFT) & PLL2126_PDIV_MASK;
|
||||
sdiv = (pll_con >> PLL2126_SDIV_SHIFT) & PLL2126_SDIV_MASK;
|
||||
|
||||
fvco *= (mdiv + 8);
|
||||
do_div(fvco, (pdiv + 2) << sdiv);
|
||||
|
||||
return (unsigned long)fvco;
|
||||
}
|
||||
|
||||
static const struct clk_ops samsung_pll2126_clk_ops = {
|
||||
.recalc_rate = samsung_pll2126_recalc_rate,
|
||||
};
|
||||
|
||||
/*
|
||||
* PLL3000 Clock Type
|
||||
*/
|
||||
|
||||
#define PLL3000_MDIV_MASK (0xff)
|
||||
#define PLL3000_PDIV_MASK (0x3)
|
||||
#define PLL3000_SDIV_MASK (0x3)
|
||||
#define PLL3000_MDIV_SHIFT (16)
|
||||
#define PLL3000_PDIV_SHIFT (8)
|
||||
#define PLL3000_SDIV_SHIFT (0)
|
||||
|
||||
static unsigned long samsung_pll3000_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct samsung_clk_pll *pll = to_clk_pll(hw);
|
||||
u32 pll_con, mdiv, pdiv, sdiv;
|
||||
u64 fvco = parent_rate;
|
||||
|
||||
pll_con = __raw_readl(pll->con_reg);
|
||||
mdiv = (pll_con >> PLL3000_MDIV_SHIFT) & PLL3000_MDIV_MASK;
|
||||
pdiv = (pll_con >> PLL3000_PDIV_SHIFT) & PLL3000_PDIV_MASK;
|
||||
sdiv = (pll_con >> PLL3000_SDIV_SHIFT) & PLL3000_SDIV_MASK;
|
||||
|
||||
fvco *= (2 * (mdiv + 8));
|
||||
do_div(fvco, pdiv << sdiv);
|
||||
|
||||
return (unsigned long)fvco;
|
||||
}
|
||||
|
||||
static const struct clk_ops samsung_pll3000_clk_ops = {
|
||||
.recalc_rate = samsung_pll3000_recalc_rate,
|
||||
};
|
||||
|
||||
/*
|
||||
* PLL35xx Clock Type
|
||||
*/
|
||||
@ -564,7 +631,9 @@ static const struct clk_ops samsung_pll46xx_clk_min_ops = {
|
||||
#define PLL6552_PDIV_MASK 0x3f
|
||||
#define PLL6552_SDIV_MASK 0x7
|
||||
#define PLL6552_MDIV_SHIFT 16
|
||||
#define PLL6552_MDIV_SHIFT_2416 14
|
||||
#define PLL6552_PDIV_SHIFT 8
|
||||
#define PLL6552_PDIV_SHIFT_2416 5
|
||||
#define PLL6552_SDIV_SHIFT 0
|
||||
|
||||
static unsigned long samsung_pll6552_recalc_rate(struct clk_hw *hw,
|
||||
@ -575,8 +644,13 @@ static unsigned long samsung_pll6552_recalc_rate(struct clk_hw *hw,
|
||||
u64 fvco = parent_rate;
|
||||
|
||||
pll_con = __raw_readl(pll->con_reg);
|
||||
mdiv = (pll_con >> PLL6552_MDIV_SHIFT) & PLL6552_MDIV_MASK;
|
||||
pdiv = (pll_con >> PLL6552_PDIV_SHIFT) & PLL6552_PDIV_MASK;
|
||||
if (pll->type == pll_6552_s3c2416) {
|
||||
mdiv = (pll_con >> PLL6552_MDIV_SHIFT_2416) & PLL6552_MDIV_MASK;
|
||||
pdiv = (pll_con >> PLL6552_PDIV_SHIFT_2416) & PLL6552_PDIV_MASK;
|
||||
} else {
|
||||
mdiv = (pll_con >> PLL6552_MDIV_SHIFT) & PLL6552_MDIV_MASK;
|
||||
pdiv = (pll_con >> PLL6552_PDIV_SHIFT) & PLL6552_PDIV_MASK;
|
||||
}
|
||||
sdiv = (pll_con >> PLL6552_SDIV_SHIFT) & PLL6552_SDIV_MASK;
|
||||
|
||||
fvco *= mdiv;
|
||||
@ -627,6 +701,169 @@ static const struct clk_ops samsung_pll6553_clk_ops = {
|
||||
.recalc_rate = samsung_pll6553_recalc_rate,
|
||||
};
|
||||
|
||||
/*
|
||||
* PLL Clock Type of S3C24XX before S3C2443
|
||||
*/
|
||||
|
||||
#define PLLS3C2410_MDIV_MASK (0xff)
|
||||
#define PLLS3C2410_PDIV_MASK (0x1f)
|
||||
#define PLLS3C2410_SDIV_MASK (0x3)
|
||||
#define PLLS3C2410_MDIV_SHIFT (12)
|
||||
#define PLLS3C2410_PDIV_SHIFT (4)
|
||||
#define PLLS3C2410_SDIV_SHIFT (0)
|
||||
|
||||
#define PLLS3C2410_ENABLE_REG_OFFSET 0x10
|
||||
|
||||
static unsigned long samsung_s3c2410_pll_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct samsung_clk_pll *pll = to_clk_pll(hw);
|
||||
u32 pll_con, mdiv, pdiv, sdiv;
|
||||
u64 fvco = parent_rate;
|
||||
|
||||
pll_con = __raw_readl(pll->con_reg);
|
||||
mdiv = (pll_con >> PLLS3C2410_MDIV_SHIFT) & PLLS3C2410_MDIV_MASK;
|
||||
pdiv = (pll_con >> PLLS3C2410_PDIV_SHIFT) & PLLS3C2410_PDIV_MASK;
|
||||
sdiv = (pll_con >> PLLS3C2410_SDIV_SHIFT) & PLLS3C2410_SDIV_MASK;
|
||||
|
||||
fvco *= (mdiv + 8);
|
||||
do_div(fvco, (pdiv + 2) << sdiv);
|
||||
|
||||
return (unsigned int)fvco;
|
||||
}
|
||||
|
||||
static unsigned long samsung_s3c2440_mpll_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct samsung_clk_pll *pll = to_clk_pll(hw);
|
||||
u32 pll_con, mdiv, pdiv, sdiv;
|
||||
u64 fvco = parent_rate;
|
||||
|
||||
pll_con = __raw_readl(pll->con_reg);
|
||||
mdiv = (pll_con >> PLLS3C2410_MDIV_SHIFT) & PLLS3C2410_MDIV_MASK;
|
||||
pdiv = (pll_con >> PLLS3C2410_PDIV_SHIFT) & PLLS3C2410_PDIV_MASK;
|
||||
sdiv = (pll_con >> PLLS3C2410_SDIV_SHIFT) & PLLS3C2410_SDIV_MASK;
|
||||
|
||||
fvco *= (2 * (mdiv + 8));
|
||||
do_div(fvco, (pdiv + 2) << sdiv);
|
||||
|
||||
return (unsigned int)fvco;
|
||||
}
|
||||
|
||||
static int samsung_s3c2410_pll_set_rate(struct clk_hw *hw, unsigned long drate,
|
||||
unsigned long prate)
|
||||
{
|
||||
struct samsung_clk_pll *pll = to_clk_pll(hw);
|
||||
const struct samsung_pll_rate_table *rate;
|
||||
u32 tmp;
|
||||
|
||||
/* Get required rate settings from table */
|
||||
rate = samsung_get_pll_settings(pll, drate);
|
||||
if (!rate) {
|
||||
pr_err("%s: Invalid rate : %lu for pll clk %s\n", __func__,
|
||||
drate, __clk_get_name(hw->clk));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
tmp = __raw_readl(pll->con_reg);
|
||||
|
||||
/* Change PLL PMS values */
|
||||
tmp &= ~((PLLS3C2410_MDIV_MASK << PLLS3C2410_MDIV_SHIFT) |
|
||||
(PLLS3C2410_PDIV_MASK << PLLS3C2410_PDIV_SHIFT) |
|
||||
(PLLS3C2410_SDIV_MASK << PLLS3C2410_SDIV_SHIFT));
|
||||
tmp |= (rate->mdiv << PLLS3C2410_MDIV_SHIFT) |
|
||||
(rate->pdiv << PLLS3C2410_PDIV_SHIFT) |
|
||||
(rate->sdiv << PLLS3C2410_SDIV_SHIFT);
|
||||
__raw_writel(tmp, pll->con_reg);
|
||||
|
||||
/* Time to settle according to the manual */
|
||||
udelay(300);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int samsung_s3c2410_pll_enable(struct clk_hw *hw, int bit, bool enable)
|
||||
{
|
||||
struct samsung_clk_pll *pll = to_clk_pll(hw);
|
||||
u32 pll_en = __raw_readl(pll->lock_reg + PLLS3C2410_ENABLE_REG_OFFSET);
|
||||
u32 pll_en_orig = pll_en;
|
||||
|
||||
if (enable)
|
||||
pll_en &= ~BIT(bit);
|
||||
else
|
||||
pll_en |= BIT(bit);
|
||||
|
||||
__raw_writel(pll_en, pll->lock_reg + PLLS3C2410_ENABLE_REG_OFFSET);
|
||||
|
||||
/* if we started the UPLL, then allow to settle */
|
||||
if (enable && (pll_en_orig & BIT(bit)))
|
||||
udelay(300);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int samsung_s3c2410_mpll_enable(struct clk_hw *hw)
|
||||
{
|
||||
return samsung_s3c2410_pll_enable(hw, 5, true);
|
||||
}
|
||||
|
||||
static void samsung_s3c2410_mpll_disable(struct clk_hw *hw)
|
||||
{
|
||||
samsung_s3c2410_pll_enable(hw, 5, false);
|
||||
}
|
||||
|
||||
static int samsung_s3c2410_upll_enable(struct clk_hw *hw)
|
||||
{
|
||||
return samsung_s3c2410_pll_enable(hw, 7, true);
|
||||
}
|
||||
|
||||
static void samsung_s3c2410_upll_disable(struct clk_hw *hw)
|
||||
{
|
||||
samsung_s3c2410_pll_enable(hw, 7, false);
|
||||
}
|
||||
|
||||
static const struct clk_ops samsung_s3c2410_mpll_clk_min_ops = {
|
||||
.recalc_rate = samsung_s3c2410_pll_recalc_rate,
|
||||
.enable = samsung_s3c2410_mpll_enable,
|
||||
.disable = samsung_s3c2410_mpll_disable,
|
||||
};
|
||||
|
||||
static const struct clk_ops samsung_s3c2410_upll_clk_min_ops = {
|
||||
.recalc_rate = samsung_s3c2410_pll_recalc_rate,
|
||||
.enable = samsung_s3c2410_upll_enable,
|
||||
.disable = samsung_s3c2410_upll_disable,
|
||||
};
|
||||
|
||||
static const struct clk_ops samsung_s3c2440_mpll_clk_min_ops = {
|
||||
.recalc_rate = samsung_s3c2440_mpll_recalc_rate,
|
||||
.enable = samsung_s3c2410_mpll_enable,
|
||||
.disable = samsung_s3c2410_mpll_disable,
|
||||
};
|
||||
|
||||
static const struct clk_ops samsung_s3c2410_mpll_clk_ops = {
|
||||
.recalc_rate = samsung_s3c2410_pll_recalc_rate,
|
||||
.enable = samsung_s3c2410_mpll_enable,
|
||||
.disable = samsung_s3c2410_mpll_disable,
|
||||
.round_rate = samsung_pll_round_rate,
|
||||
.set_rate = samsung_s3c2410_pll_set_rate,
|
||||
};
|
||||
|
||||
static const struct clk_ops samsung_s3c2410_upll_clk_ops = {
|
||||
.recalc_rate = samsung_s3c2410_pll_recalc_rate,
|
||||
.enable = samsung_s3c2410_upll_enable,
|
||||
.disable = samsung_s3c2410_upll_disable,
|
||||
.round_rate = samsung_pll_round_rate,
|
||||
.set_rate = samsung_s3c2410_pll_set_rate,
|
||||
};
|
||||
|
||||
static const struct clk_ops samsung_s3c2440_mpll_clk_ops = {
|
||||
.recalc_rate = samsung_s3c2440_mpll_recalc_rate,
|
||||
.enable = samsung_s3c2410_mpll_enable,
|
||||
.disable = samsung_s3c2410_mpll_disable,
|
||||
.round_rate = samsung_pll_round_rate,
|
||||
.set_rate = samsung_s3c2410_pll_set_rate,
|
||||
};
|
||||
|
||||
/*
|
||||
* PLL2550x Clock Type
|
||||
*/
|
||||
@ -710,8 +947,206 @@ struct clk * __init samsung_clk_register_pll2550x(const char *name,
|
||||
return clk;
|
||||
}
|
||||
|
||||
static void __init _samsung_clk_register_pll(struct samsung_pll_clock *pll_clk,
|
||||
void __iomem *base)
|
||||
/*
|
||||
* PLL2550xx Clock Type
|
||||
*/
|
||||
|
||||
/* Maximum lock time can be 270 * PDIV cycles */
|
||||
#define PLL2550XX_LOCK_FACTOR 270
|
||||
|
||||
#define PLL2550XX_M_MASK 0x3FF
|
||||
#define PLL2550XX_P_MASK 0x3F
|
||||
#define PLL2550XX_S_MASK 0x7
|
||||
#define PLL2550XX_LOCK_STAT_MASK 0x1
|
||||
#define PLL2550XX_M_SHIFT 9
|
||||
#define PLL2550XX_P_SHIFT 3
|
||||
#define PLL2550XX_S_SHIFT 0
|
||||
#define PLL2550XX_LOCK_STAT_SHIFT 21
|
||||
|
||||
static unsigned long samsung_pll2550xx_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct samsung_clk_pll *pll = to_clk_pll(hw);
|
||||
u32 mdiv, pdiv, sdiv, pll_con;
|
||||
u64 fvco = parent_rate;
|
||||
|
||||
pll_con = __raw_readl(pll->con_reg);
|
||||
mdiv = (pll_con >> PLL2550XX_M_SHIFT) & PLL2550XX_M_MASK;
|
||||
pdiv = (pll_con >> PLL2550XX_P_SHIFT) & PLL2550XX_P_MASK;
|
||||
sdiv = (pll_con >> PLL2550XX_S_SHIFT) & PLL2550XX_S_MASK;
|
||||
|
||||
fvco *= mdiv;
|
||||
do_div(fvco, (pdiv << sdiv));
|
||||
|
||||
return (unsigned long)fvco;
|
||||
}
|
||||
|
||||
static inline bool samsung_pll2550xx_mp_change(u32 mdiv, u32 pdiv, u32 pll_con)
|
||||
{
|
||||
u32 old_mdiv, old_pdiv;
|
||||
|
||||
old_mdiv = (pll_con >> PLL2550XX_M_SHIFT) & PLL2550XX_M_MASK;
|
||||
old_pdiv = (pll_con >> PLL2550XX_P_SHIFT) & PLL2550XX_P_MASK;
|
||||
|
||||
return mdiv != old_mdiv || pdiv != old_pdiv;
|
||||
}
|
||||
|
||||
static int samsung_pll2550xx_set_rate(struct clk_hw *hw, unsigned long drate,
|
||||
unsigned long prate)
|
||||
{
|
||||
struct samsung_clk_pll *pll = to_clk_pll(hw);
|
||||
const struct samsung_pll_rate_table *rate;
|
||||
u32 tmp;
|
||||
|
||||
/* Get required rate settings from table */
|
||||
rate = samsung_get_pll_settings(pll, drate);
|
||||
if (!rate) {
|
||||
pr_err("%s: Invalid rate : %lu for pll clk %s\n", __func__,
|
||||
drate, __clk_get_name(hw->clk));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
tmp = __raw_readl(pll->con_reg);
|
||||
|
||||
if (!(samsung_pll2550xx_mp_change(rate->mdiv, rate->pdiv, tmp))) {
|
||||
/* If only s change, change just s value only*/
|
||||
tmp &= ~(PLL2550XX_S_MASK << PLL2550XX_S_SHIFT);
|
||||
tmp |= rate->sdiv << PLL2550XX_S_SHIFT;
|
||||
__raw_writel(tmp, pll->con_reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Set PLL lock time. */
|
||||
__raw_writel(rate->pdiv * PLL2550XX_LOCK_FACTOR, pll->lock_reg);
|
||||
|
||||
/* Change PLL PMS values */
|
||||
tmp &= ~((PLL2550XX_M_MASK << PLL2550XX_M_SHIFT) |
|
||||
(PLL2550XX_P_MASK << PLL2550XX_P_SHIFT) |
|
||||
(PLL2550XX_S_MASK << PLL2550XX_S_SHIFT));
|
||||
tmp |= (rate->mdiv << PLL2550XX_M_SHIFT) |
|
||||
(rate->pdiv << PLL2550XX_P_SHIFT) |
|
||||
(rate->sdiv << PLL2550XX_S_SHIFT);
|
||||
__raw_writel(tmp, pll->con_reg);
|
||||
|
||||
/* wait_lock_time */
|
||||
do {
|
||||
cpu_relax();
|
||||
tmp = __raw_readl(pll->con_reg);
|
||||
} while (!(tmp & (PLL2550XX_LOCK_STAT_MASK
|
||||
<< PLL2550XX_LOCK_STAT_SHIFT)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clk_ops samsung_pll2550xx_clk_ops = {
|
||||
.recalc_rate = samsung_pll2550xx_recalc_rate,
|
||||
.round_rate = samsung_pll_round_rate,
|
||||
.set_rate = samsung_pll2550xx_set_rate,
|
||||
};
|
||||
|
||||
static const struct clk_ops samsung_pll2550xx_clk_min_ops = {
|
||||
.recalc_rate = samsung_pll2550xx_recalc_rate,
|
||||
};
|
||||
|
||||
/*
|
||||
* PLL2650XX Clock Type
|
||||
*/
|
||||
|
||||
/* Maximum lock time can be 3000 * PDIV cycles */
|
||||
#define PLL2650XX_LOCK_FACTOR 3000
|
||||
|
||||
#define PLL2650XX_MDIV_SHIFT 9
|
||||
#define PLL2650XX_PDIV_SHIFT 3
|
||||
#define PLL2650XX_SDIV_SHIFT 0
|
||||
#define PLL2650XX_KDIV_SHIFT 0
|
||||
#define PLL2650XX_MDIV_MASK 0x1ff
|
||||
#define PLL2650XX_PDIV_MASK 0x3f
|
||||
#define PLL2650XX_SDIV_MASK 0x7
|
||||
#define PLL2650XX_KDIV_MASK 0xffff
|
||||
#define PLL2650XX_PLL_ENABLE_SHIFT 23
|
||||
#define PLL2650XX_PLL_LOCKTIME_SHIFT 21
|
||||
#define PLL2650XX_PLL_FOUTMASK_SHIFT 31
|
||||
|
||||
static unsigned long samsung_pll2650xx_recalc_rate(struct clk_hw *hw,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct samsung_clk_pll *pll = to_clk_pll(hw);
|
||||
u32 mdiv, pdiv, sdiv, pll_con0, pll_con2;
|
||||
s16 kdiv;
|
||||
u64 fvco = parent_rate;
|
||||
|
||||
pll_con0 = __raw_readl(pll->con_reg);
|
||||
pll_con2 = __raw_readl(pll->con_reg + 8);
|
||||
mdiv = (pll_con0 >> PLL2650XX_MDIV_SHIFT) & PLL2650XX_MDIV_MASK;
|
||||
pdiv = (pll_con0 >> PLL2650XX_PDIV_SHIFT) & PLL2650XX_PDIV_MASK;
|
||||
sdiv = (pll_con0 >> PLL2650XX_SDIV_SHIFT) & PLL2650XX_SDIV_MASK;
|
||||
kdiv = (s16)(pll_con2 & PLL2650XX_KDIV_MASK);
|
||||
|
||||
fvco *= (mdiv << 16) + kdiv;
|
||||
do_div(fvco, (pdiv << sdiv));
|
||||
fvco >>= 16;
|
||||
|
||||
return (unsigned long)fvco;
|
||||
}
|
||||
|
||||
static int samsung_pll2650xx_set_rate(struct clk_hw *hw, unsigned long drate,
|
||||
unsigned long parent_rate)
|
||||
{
|
||||
struct samsung_clk_pll *pll = to_clk_pll(hw);
|
||||
u32 tmp, pll_con0, pll_con2;
|
||||
const struct samsung_pll_rate_table *rate;
|
||||
|
||||
rate = samsung_get_pll_settings(pll, drate);
|
||||
if (!rate) {
|
||||
pr_err("%s: Invalid rate : %lu for pll clk %s\n", __func__,
|
||||
drate, __clk_get_name(hw->clk));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
pll_con0 = __raw_readl(pll->con_reg);
|
||||
pll_con2 = __raw_readl(pll->con_reg + 8);
|
||||
|
||||
/* Change PLL PMS values */
|
||||
pll_con0 &= ~(PLL2650XX_MDIV_MASK << PLL2650XX_MDIV_SHIFT |
|
||||
PLL2650XX_PDIV_MASK << PLL2650XX_PDIV_SHIFT |
|
||||
PLL2650XX_SDIV_MASK << PLL2650XX_SDIV_SHIFT);
|
||||
pll_con0 |= rate->mdiv << PLL2650XX_MDIV_SHIFT;
|
||||
pll_con0 |= rate->pdiv << PLL2650XX_PDIV_SHIFT;
|
||||
pll_con0 |= rate->sdiv << PLL2650XX_SDIV_SHIFT;
|
||||
pll_con0 |= 1 << PLL2650XX_PLL_ENABLE_SHIFT;
|
||||
pll_con0 |= 1 << PLL2650XX_PLL_FOUTMASK_SHIFT;
|
||||
|
||||
pll_con2 &= ~(PLL2650XX_KDIV_MASK << PLL2650XX_KDIV_SHIFT);
|
||||
pll_con2 |= ((~(rate->kdiv) + 1) & PLL2650XX_KDIV_MASK)
|
||||
<< PLL2650XX_KDIV_SHIFT;
|
||||
|
||||
/* Set PLL lock time. */
|
||||
__raw_writel(PLL2650XX_LOCK_FACTOR * rate->pdiv, pll->lock_reg);
|
||||
|
||||
__raw_writel(pll_con0, pll->con_reg);
|
||||
__raw_writel(pll_con2, pll->con_reg + 8);
|
||||
|
||||
do {
|
||||
tmp = __raw_readl(pll->con_reg);
|
||||
} while (!(tmp & (0x1 << PLL2650XX_PLL_LOCKTIME_SHIFT)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct clk_ops samsung_pll2650xx_clk_ops = {
|
||||
.recalc_rate = samsung_pll2650xx_recalc_rate,
|
||||
.set_rate = samsung_pll2650xx_set_rate,
|
||||
.round_rate = samsung_pll_round_rate,
|
||||
};
|
||||
|
||||
static const struct clk_ops samsung_pll2650xx_clk_min_ops = {
|
||||
.recalc_rate = samsung_pll2650xx_recalc_rate,
|
||||
};
|
||||
|
||||
static void __init _samsung_clk_register_pll(struct samsung_clk_provider *ctx,
|
||||
struct samsung_pll_clock *pll_clk,
|
||||
void __iomem *base)
|
||||
{
|
||||
struct samsung_clk_pll *pll;
|
||||
struct clk *clk;
|
||||
@ -746,6 +1181,12 @@ static void __init _samsung_clk_register_pll(struct samsung_pll_clock *pll_clk,
|
||||
}
|
||||
|
||||
switch (pll_clk->type) {
|
||||
case pll_2126:
|
||||
init.ops = &samsung_pll2126_clk_ops;
|
||||
break;
|
||||
case pll_3000:
|
||||
init.ops = &samsung_pll3000_clk_ops;
|
||||
break;
|
||||
/* clk_ops for 35xx and 2550 are similar */
|
||||
case pll_35xx:
|
||||
case pll_2550:
|
||||
@ -773,6 +1214,7 @@ static void __init _samsung_clk_register_pll(struct samsung_pll_clock *pll_clk,
|
||||
init.ops = &samsung_pll36xx_clk_ops;
|
||||
break;
|
||||
case pll_6552:
|
||||
case pll_6552_s3c2416:
|
||||
init.ops = &samsung_pll6552_clk_ops;
|
||||
break;
|
||||
case pll_6553:
|
||||
@ -786,6 +1228,36 @@ static void __init _samsung_clk_register_pll(struct samsung_pll_clock *pll_clk,
|
||||
else
|
||||
init.ops = &samsung_pll46xx_clk_ops;
|
||||
break;
|
||||
case pll_s3c2410_mpll:
|
||||
if (!pll->rate_table)
|
||||
init.ops = &samsung_s3c2410_mpll_clk_min_ops;
|
||||
else
|
||||
init.ops = &samsung_s3c2410_mpll_clk_ops;
|
||||
break;
|
||||
case pll_s3c2410_upll:
|
||||
if (!pll->rate_table)
|
||||
init.ops = &samsung_s3c2410_upll_clk_min_ops;
|
||||
else
|
||||
init.ops = &samsung_s3c2410_upll_clk_ops;
|
||||
break;
|
||||
case pll_s3c2440_mpll:
|
||||
if (!pll->rate_table)
|
||||
init.ops = &samsung_s3c2440_mpll_clk_min_ops;
|
||||
else
|
||||
init.ops = &samsung_s3c2440_mpll_clk_ops;
|
||||
break;
|
||||
case pll_2550xx:
|
||||
if (!pll->rate_table)
|
||||
init.ops = &samsung_pll2550xx_clk_min_ops;
|
||||
else
|
||||
init.ops = &samsung_pll2550xx_clk_ops;
|
||||
break;
|
||||
case pll_2650xx:
|
||||
if (!pll->rate_table)
|
||||
init.ops = &samsung_pll2650xx_clk_min_ops;
|
||||
else
|
||||
init.ops = &samsung_pll2650xx_clk_ops;
|
||||
break;
|
||||
default:
|
||||
pr_warn("%s: Unknown pll type for pll clk %s\n",
|
||||
__func__, pll_clk->name);
|
||||
@ -804,7 +1276,7 @@ static void __init _samsung_clk_register_pll(struct samsung_pll_clock *pll_clk,
|
||||
return;
|
||||
}
|
||||
|
||||
samsung_clk_add_lookup(clk, pll_clk->id);
|
||||
samsung_clk_add_lookup(ctx, clk, pll_clk->id);
|
||||
|
||||
if (!pll_clk->alias)
|
||||
return;
|
||||
@ -815,11 +1287,12 @@ static void __init _samsung_clk_register_pll(struct samsung_pll_clock *pll_clk,
|
||||
__func__, pll_clk->name, ret);
|
||||
}
|
||||
|
||||
void __init samsung_clk_register_pll(struct samsung_pll_clock *pll_list,
|
||||
unsigned int nr_pll, void __iomem *base)
|
||||
void __init samsung_clk_register_pll(struct samsung_clk_provider *ctx,
|
||||
struct samsung_pll_clock *pll_list,
|
||||
unsigned int nr_pll, void __iomem *base)
|
||||
{
|
||||
int cnt;
|
||||
|
||||
for (cnt = 0; cnt < nr_pll; cnt++)
|
||||
_samsung_clk_register_pll(&pll_list[cnt], base);
|
||||
_samsung_clk_register_pll(ctx, &pll_list[cnt], base);
|
||||
}
|
||||
|
@ -13,6 +13,8 @@
|
||||
#define __SAMSUNG_CLK_PLL_H
|
||||
|
||||
enum samsung_pll_type {
|
||||
pll_2126,
|
||||
pll_3000,
|
||||
pll_35xx,
|
||||
pll_36xx,
|
||||
pll_2550,
|
||||
@ -24,7 +26,13 @@ enum samsung_pll_type {
|
||||
pll_4650,
|
||||
pll_4650c,
|
||||
pll_6552,
|
||||
pll_6552_s3c2416,
|
||||
pll_6553,
|
||||
pll_s3c2410_mpll,
|
||||
pll_s3c2410_upll,
|
||||
pll_s3c2440_mpll,
|
||||
pll_2550xx,
|
||||
pll_2650xx,
|
||||
};
|
||||
|
||||
#define PLL_35XX_RATE(_rate, _m, _p, _s) \
|
||||
|
440
drivers/clk/samsung/clk-s3c2410-dclk.c
Normal file
440
drivers/clk/samsung/clk-s3c2410-dclk.c
Normal file
@ -0,0 +1,440 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Common Clock Framework support for s3c24xx external clock output.
|
||||
*/
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/module.h>
|
||||
#include "clk.h"
|
||||
|
||||
/* legacy access to misccr, until dt conversion is finished */
|
||||
#include <mach/hardware.h>
|
||||
#include <mach/regs-gpio.h>
|
||||
|
||||
#define MUX_DCLK0 0
|
||||
#define MUX_DCLK1 1
|
||||
#define DIV_DCLK0 2
|
||||
#define DIV_DCLK1 3
|
||||
#define GATE_DCLK0 4
|
||||
#define GATE_DCLK1 5
|
||||
#define MUX_CLKOUT0 6
|
||||
#define MUX_CLKOUT1 7
|
||||
#define DCLK_MAX_CLKS (MUX_CLKOUT1 + 1)
|
||||
|
||||
enum supported_socs {
|
||||
S3C2410,
|
||||
S3C2412,
|
||||
S3C2440,
|
||||
S3C2443,
|
||||
};
|
||||
|
||||
struct s3c24xx_dclk_drv_data {
|
||||
const char **clkout0_parent_names;
|
||||
int clkout0_num_parents;
|
||||
const char **clkout1_parent_names;
|
||||
int clkout1_num_parents;
|
||||
const char **mux_parent_names;
|
||||
int mux_num_parents;
|
||||
};
|
||||
|
||||
/*
|
||||
* Clock for output-parent selection in misccr
|
||||
*/
|
||||
|
||||
struct s3c24xx_clkout {
|
||||
struct clk_hw hw;
|
||||
u32 mask;
|
||||
u8 shift;
|
||||
};
|
||||
|
||||
#define to_s3c24xx_clkout(_hw) container_of(_hw, struct s3c24xx_clkout, hw)
|
||||
|
||||
static u8 s3c24xx_clkout_get_parent(struct clk_hw *hw)
|
||||
{
|
||||
struct s3c24xx_clkout *clkout = to_s3c24xx_clkout(hw);
|
||||
int num_parents = __clk_get_num_parents(hw->clk);
|
||||
u32 val;
|
||||
|
||||
val = readl_relaxed(S3C24XX_MISCCR) >> clkout->shift;
|
||||
val >>= clkout->shift;
|
||||
val &= clkout->mask;
|
||||
|
||||
if (val >= num_parents)
|
||||
return -EINVAL;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
static int s3c24xx_clkout_set_parent(struct clk_hw *hw, u8 index)
|
||||
{
|
||||
struct s3c24xx_clkout *clkout = to_s3c24xx_clkout(hw);
|
||||
int ret = 0;
|
||||
|
||||
s3c2410_modify_misccr((clkout->mask << clkout->shift),
|
||||
(index << clkout->shift));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const struct clk_ops s3c24xx_clkout_ops = {
|
||||
.get_parent = s3c24xx_clkout_get_parent,
|
||||
.set_parent = s3c24xx_clkout_set_parent,
|
||||
.determine_rate = __clk_mux_determine_rate,
|
||||
};
|
||||
|
||||
struct clk *s3c24xx_register_clkout(struct device *dev, const char *name,
|
||||
const char **parent_names, u8 num_parents,
|
||||
u8 shift, u32 mask)
|
||||
{
|
||||
struct s3c24xx_clkout *clkout;
|
||||
struct clk *clk;
|
||||
struct clk_init_data init;
|
||||
|
||||
/* allocate the clkout */
|
||||
clkout = kzalloc(sizeof(*clkout), GFP_KERNEL);
|
||||
if (!clkout)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
init.name = name;
|
||||
init.ops = &s3c24xx_clkout_ops;
|
||||
init.flags = CLK_IS_BASIC;
|
||||
init.parent_names = parent_names;
|
||||
init.num_parents = num_parents;
|
||||
|
||||
clkout->shift = shift;
|
||||
clkout->mask = mask;
|
||||
clkout->hw.init = &init;
|
||||
|
||||
clk = clk_register(dev, &clkout->hw);
|
||||
|
||||
return clk;
|
||||
}
|
||||
|
||||
/*
|
||||
* dclk and clkout init
|
||||
*/
|
||||
|
||||
struct s3c24xx_dclk {
|
||||
struct device *dev;
|
||||
void __iomem *base;
|
||||
struct clk_onecell_data clk_data;
|
||||
struct notifier_block dclk0_div_change_nb;
|
||||
struct notifier_block dclk1_div_change_nb;
|
||||
spinlock_t dclk_lock;
|
||||
unsigned long reg_save;
|
||||
};
|
||||
|
||||
#define to_s3c24xx_dclk0(x) \
|
||||
container_of(x, struct s3c24xx_dclk, dclk0_div_change_nb)
|
||||
|
||||
#define to_s3c24xx_dclk1(x) \
|
||||
container_of(x, struct s3c24xx_dclk, dclk1_div_change_nb)
|
||||
|
||||
PNAME(dclk_s3c2410_p) = { "pclk", "uclk" };
|
||||
PNAME(clkout0_s3c2410_p) = { "mpll", "upll", "fclk", "hclk", "pclk",
|
||||
"gate_dclk0" };
|
||||
PNAME(clkout1_s3c2410_p) = { "mpll", "upll", "fclk", "hclk", "pclk",
|
||||
"gate_dclk1" };
|
||||
|
||||
PNAME(clkout0_s3c2412_p) = { "mpll", "upll", "rtc_clkout",
|
||||
"hclk", "pclk", "gate_dclk0" };
|
||||
PNAME(clkout1_s3c2412_p) = { "xti", "upll", "fclk", "hclk", "pclk",
|
||||
"gate_dclk1" };
|
||||
|
||||
PNAME(clkout0_s3c2440_p) = { "xti", "upll", "fclk", "hclk", "pclk",
|
||||
"gate_dclk0" };
|
||||
PNAME(clkout1_s3c2440_p) = { "mpll", "upll", "rtc_clkout",
|
||||
"hclk", "pclk", "gate_dclk1" };
|
||||
|
||||
PNAME(dclk_s3c2443_p) = { "pclk", "epll" };
|
||||
PNAME(clkout0_s3c2443_p) = { "xti", "epll", "armclk", "hclk", "pclk",
|
||||
"gate_dclk0" };
|
||||
PNAME(clkout1_s3c2443_p) = { "dummy", "epll", "rtc_clkout",
|
||||
"hclk", "pclk", "gate_dclk1" };
|
||||
|
||||
#define DCLKCON_DCLK_DIV_MASK 0xf
|
||||
#define DCLKCON_DCLK0_DIV_SHIFT 4
|
||||
#define DCLKCON_DCLK0_CMP_SHIFT 8
|
||||
#define DCLKCON_DCLK1_DIV_SHIFT 20
|
||||
#define DCLKCON_DCLK1_CMP_SHIFT 24
|
||||
|
||||
static void s3c24xx_dclk_update_cmp(struct s3c24xx_dclk *s3c24xx_dclk,
|
||||
int div_shift, int cmp_shift)
|
||||
{
|
||||
unsigned long flags = 0;
|
||||
u32 dclk_con, div, cmp;
|
||||
|
||||
spin_lock_irqsave(&s3c24xx_dclk->dclk_lock, flags);
|
||||
|
||||
dclk_con = readl_relaxed(s3c24xx_dclk->base);
|
||||
|
||||
div = ((dclk_con >> div_shift) & DCLKCON_DCLK_DIV_MASK) + 1;
|
||||
cmp = ((div + 1) / 2) - 1;
|
||||
|
||||
dclk_con &= ~(DCLKCON_DCLK_DIV_MASK << cmp_shift);
|
||||
dclk_con |= (cmp << cmp_shift);
|
||||
|
||||
writel_relaxed(dclk_con, s3c24xx_dclk->base);
|
||||
|
||||
spin_unlock_irqrestore(&s3c24xx_dclk->dclk_lock, flags);
|
||||
}
|
||||
|
||||
static int s3c24xx_dclk0_div_notify(struct notifier_block *nb,
|
||||
unsigned long event, void *data)
|
||||
{
|
||||
struct s3c24xx_dclk *s3c24xx_dclk = to_s3c24xx_dclk0(nb);
|
||||
|
||||
if (event == POST_RATE_CHANGE) {
|
||||
s3c24xx_dclk_update_cmp(s3c24xx_dclk,
|
||||
DCLKCON_DCLK0_DIV_SHIFT, DCLKCON_DCLK0_CMP_SHIFT);
|
||||
}
|
||||
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
static int s3c24xx_dclk1_div_notify(struct notifier_block *nb,
|
||||
unsigned long event, void *data)
|
||||
{
|
||||
struct s3c24xx_dclk *s3c24xx_dclk = to_s3c24xx_dclk1(nb);
|
||||
|
||||
if (event == POST_RATE_CHANGE) {
|
||||
s3c24xx_dclk_update_cmp(s3c24xx_dclk,
|
||||
DCLKCON_DCLK1_DIV_SHIFT, DCLKCON_DCLK1_CMP_SHIFT);
|
||||
}
|
||||
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int s3c24xx_dclk_suspend(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct s3c24xx_dclk *s3c24xx_dclk = platform_get_drvdata(pdev);
|
||||
|
||||
s3c24xx_dclk->reg_save = readl_relaxed(s3c24xx_dclk->base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int s3c24xx_dclk_resume(struct device *dev)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct s3c24xx_dclk *s3c24xx_dclk = platform_get_drvdata(pdev);
|
||||
|
||||
writel_relaxed(s3c24xx_dclk->reg_save, s3c24xx_dclk->base);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(s3c24xx_dclk_pm_ops,
|
||||
s3c24xx_dclk_suspend, s3c24xx_dclk_resume);
|
||||
|
||||
static int s3c24xx_dclk_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct s3c24xx_dclk *s3c24xx_dclk;
|
||||
struct resource *mem;
|
||||
struct clk **clk_table;
|
||||
struct s3c24xx_dclk_drv_data *dclk_variant;
|
||||
int ret, i;
|
||||
|
||||
s3c24xx_dclk = devm_kzalloc(&pdev->dev, sizeof(*s3c24xx_dclk),
|
||||
GFP_KERNEL);
|
||||
if (!s3c24xx_dclk)
|
||||
return -ENOMEM;
|
||||
|
||||
s3c24xx_dclk->dev = &pdev->dev;
|
||||
platform_set_drvdata(pdev, s3c24xx_dclk);
|
||||
spin_lock_init(&s3c24xx_dclk->dclk_lock);
|
||||
|
||||
clk_table = devm_kzalloc(&pdev->dev,
|
||||
sizeof(struct clk *) * DCLK_MAX_CLKS,
|
||||
GFP_KERNEL);
|
||||
if (!clk_table)
|
||||
return -ENOMEM;
|
||||
|
||||
s3c24xx_dclk->clk_data.clks = clk_table;
|
||||
s3c24xx_dclk->clk_data.clk_num = DCLK_MAX_CLKS;
|
||||
|
||||
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
s3c24xx_dclk->base = devm_ioremap_resource(&pdev->dev, mem);
|
||||
if (IS_ERR(s3c24xx_dclk->base))
|
||||
return PTR_ERR(s3c24xx_dclk->base);
|
||||
|
||||
dclk_variant = (struct s3c24xx_dclk_drv_data *)
|
||||
platform_get_device_id(pdev)->driver_data;
|
||||
|
||||
|
||||
clk_table[MUX_DCLK0] = clk_register_mux(&pdev->dev, "mux_dclk0",
|
||||
dclk_variant->mux_parent_names,
|
||||
dclk_variant->mux_num_parents, 0,
|
||||
s3c24xx_dclk->base, 1, 1, 0,
|
||||
&s3c24xx_dclk->dclk_lock);
|
||||
clk_table[MUX_DCLK1] = clk_register_mux(&pdev->dev, "mux_dclk1",
|
||||
dclk_variant->mux_parent_names,
|
||||
dclk_variant->mux_num_parents, 0,
|
||||
s3c24xx_dclk->base, 17, 1, 0,
|
||||
&s3c24xx_dclk->dclk_lock);
|
||||
|
||||
clk_table[DIV_DCLK0] = clk_register_divider(&pdev->dev, "div_dclk0",
|
||||
"mux_dclk0", 0, s3c24xx_dclk->base,
|
||||
4, 4, 0, &s3c24xx_dclk->dclk_lock);
|
||||
clk_table[DIV_DCLK1] = clk_register_divider(&pdev->dev, "div_dclk1",
|
||||
"mux_dclk1", 0, s3c24xx_dclk->base,
|
||||
20, 4, 0, &s3c24xx_dclk->dclk_lock);
|
||||
|
||||
clk_table[GATE_DCLK0] = clk_register_gate(&pdev->dev, "gate_dclk0",
|
||||
"div_dclk0", CLK_SET_RATE_PARENT,
|
||||
s3c24xx_dclk->base, 0, 0,
|
||||
&s3c24xx_dclk->dclk_lock);
|
||||
clk_table[GATE_DCLK1] = clk_register_gate(&pdev->dev, "gate_dclk1",
|
||||
"div_dclk1", CLK_SET_RATE_PARENT,
|
||||
s3c24xx_dclk->base, 16, 0,
|
||||
&s3c24xx_dclk->dclk_lock);
|
||||
|
||||
clk_table[MUX_CLKOUT0] = s3c24xx_register_clkout(&pdev->dev,
|
||||
"clkout0", dclk_variant->clkout0_parent_names,
|
||||
dclk_variant->clkout0_num_parents, 4, 7);
|
||||
clk_table[MUX_CLKOUT1] = s3c24xx_register_clkout(&pdev->dev,
|
||||
"clkout1", dclk_variant->clkout1_parent_names,
|
||||
dclk_variant->clkout1_num_parents, 8, 7);
|
||||
|
||||
for (i = 0; i < DCLK_MAX_CLKS; i++)
|
||||
if (IS_ERR(clk_table[i])) {
|
||||
dev_err(&pdev->dev, "clock %d failed to register\n", i);
|
||||
ret = PTR_ERR(clk_table[i]);
|
||||
goto err_clk_register;
|
||||
}
|
||||
|
||||
ret = clk_register_clkdev(clk_table[MUX_DCLK0], "dclk0", NULL);
|
||||
if (!ret)
|
||||
ret = clk_register_clkdev(clk_table[MUX_DCLK1], "dclk1", NULL);
|
||||
if (!ret)
|
||||
ret = clk_register_clkdev(clk_table[MUX_CLKOUT0],
|
||||
"clkout0", NULL);
|
||||
if (!ret)
|
||||
ret = clk_register_clkdev(clk_table[MUX_CLKOUT1],
|
||||
"clkout1", NULL);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "failed to register aliases, %d\n", ret);
|
||||
goto err_clk_register;
|
||||
}
|
||||
|
||||
s3c24xx_dclk->dclk0_div_change_nb.notifier_call =
|
||||
s3c24xx_dclk0_div_notify;
|
||||
|
||||
s3c24xx_dclk->dclk1_div_change_nb.notifier_call =
|
||||
s3c24xx_dclk1_div_notify;
|
||||
|
||||
ret = clk_notifier_register(clk_table[DIV_DCLK0],
|
||||
&s3c24xx_dclk->dclk0_div_change_nb);
|
||||
if (ret)
|
||||
goto err_clk_register;
|
||||
|
||||
ret = clk_notifier_register(clk_table[DIV_DCLK1],
|
||||
&s3c24xx_dclk->dclk1_div_change_nb);
|
||||
if (ret)
|
||||
goto err_dclk_notify;
|
||||
|
||||
return 0;
|
||||
|
||||
err_dclk_notify:
|
||||
clk_notifier_unregister(clk_table[DIV_DCLK0],
|
||||
&s3c24xx_dclk->dclk0_div_change_nb);
|
||||
err_clk_register:
|
||||
for (i = 0; i < DCLK_MAX_CLKS; i++)
|
||||
if (clk_table[i] && !IS_ERR(clk_table[i]))
|
||||
clk_unregister(clk_table[i]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int s3c24xx_dclk_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct s3c24xx_dclk *s3c24xx_dclk = platform_get_drvdata(pdev);
|
||||
struct clk **clk_table = s3c24xx_dclk->clk_data.clks;
|
||||
int i;
|
||||
|
||||
clk_notifier_unregister(clk_table[DIV_DCLK1],
|
||||
&s3c24xx_dclk->dclk1_div_change_nb);
|
||||
clk_notifier_unregister(clk_table[DIV_DCLK0],
|
||||
&s3c24xx_dclk->dclk0_div_change_nb);
|
||||
|
||||
for (i = 0; i < DCLK_MAX_CLKS; i++)
|
||||
clk_unregister(clk_table[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct s3c24xx_dclk_drv_data dclk_variants[] = {
|
||||
[S3C2410] = {
|
||||
.clkout0_parent_names = clkout0_s3c2410_p,
|
||||
.clkout0_num_parents = ARRAY_SIZE(clkout0_s3c2410_p),
|
||||
.clkout1_parent_names = clkout1_s3c2410_p,
|
||||
.clkout1_num_parents = ARRAY_SIZE(clkout1_s3c2410_p),
|
||||
.mux_parent_names = dclk_s3c2410_p,
|
||||
.mux_num_parents = ARRAY_SIZE(dclk_s3c2410_p),
|
||||
},
|
||||
[S3C2412] = {
|
||||
.clkout0_parent_names = clkout0_s3c2412_p,
|
||||
.clkout0_num_parents = ARRAY_SIZE(clkout0_s3c2412_p),
|
||||
.clkout1_parent_names = clkout1_s3c2412_p,
|
||||
.clkout1_num_parents = ARRAY_SIZE(clkout1_s3c2412_p),
|
||||
.mux_parent_names = dclk_s3c2410_p,
|
||||
.mux_num_parents = ARRAY_SIZE(dclk_s3c2410_p),
|
||||
},
|
||||
[S3C2440] = {
|
||||
.clkout0_parent_names = clkout0_s3c2440_p,
|
||||
.clkout0_num_parents = ARRAY_SIZE(clkout0_s3c2440_p),
|
||||
.clkout1_parent_names = clkout1_s3c2440_p,
|
||||
.clkout1_num_parents = ARRAY_SIZE(clkout1_s3c2440_p),
|
||||
.mux_parent_names = dclk_s3c2410_p,
|
||||
.mux_num_parents = ARRAY_SIZE(dclk_s3c2410_p),
|
||||
},
|
||||
[S3C2443] = {
|
||||
.clkout0_parent_names = clkout0_s3c2443_p,
|
||||
.clkout0_num_parents = ARRAY_SIZE(clkout0_s3c2443_p),
|
||||
.clkout1_parent_names = clkout1_s3c2443_p,
|
||||
.clkout1_num_parents = ARRAY_SIZE(clkout1_s3c2443_p),
|
||||
.mux_parent_names = dclk_s3c2443_p,
|
||||
.mux_num_parents = ARRAY_SIZE(dclk_s3c2443_p),
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device_id s3c24xx_dclk_driver_ids[] = {
|
||||
{
|
||||
.name = "s3c2410-dclk",
|
||||
.driver_data = (kernel_ulong_t)&dclk_variants[S3C2410],
|
||||
}, {
|
||||
.name = "s3c2412-dclk",
|
||||
.driver_data = (kernel_ulong_t)&dclk_variants[S3C2412],
|
||||
}, {
|
||||
.name = "s3c2440-dclk",
|
||||
.driver_data = (kernel_ulong_t)&dclk_variants[S3C2440],
|
||||
}, {
|
||||
.name = "s3c2443-dclk",
|
||||
.driver_data = (kernel_ulong_t)&dclk_variants[S3C2443],
|
||||
},
|
||||
{ }
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(platform, s3c24xx_dclk_driver_ids);
|
||||
|
||||
static struct platform_driver s3c24xx_dclk_driver = {
|
||||
.driver = {
|
||||
.name = "s3c24xx-dclk",
|
||||
.owner = THIS_MODULE,
|
||||
.pm = &s3c24xx_dclk_pm_ops,
|
||||
},
|
||||
.probe = s3c24xx_dclk_probe,
|
||||
.remove = s3c24xx_dclk_remove,
|
||||
.id_table = s3c24xx_dclk_driver_ids,
|
||||
};
|
||||
module_platform_driver(s3c24xx_dclk_driver);
|
||||
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>");
|
||||
MODULE_DESCRIPTION("Driver for the S3C24XX external clock outputs");
|
482
drivers/clk/samsung/clk-s3c2410.c
Normal file
482
drivers/clk/samsung/clk-s3c2410.c
Normal file
@ -0,0 +1,482 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Common Clock Framework support for S3C2410 and following SoCs.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clkdev.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/syscore_ops.h>
|
||||
|
||||
#include <dt-bindings/clock/s3c2410.h>
|
||||
|
||||
#include "clk.h"
|
||||
#include "clk-pll.h"
|
||||
|
||||
#define LOCKTIME 0x00
|
||||
#define MPLLCON 0x04
|
||||
#define UPLLCON 0x08
|
||||
#define CLKCON 0x0c
|
||||
#define CLKSLOW 0x10
|
||||
#define CLKDIVN 0x14
|
||||
#define CAMDIVN 0x18
|
||||
|
||||
/* the soc types */
|
||||
enum supported_socs {
|
||||
S3C2410,
|
||||
S3C2440,
|
||||
S3C2442,
|
||||
};
|
||||
|
||||
/* list of PLLs to be registered */
|
||||
enum s3c2410_plls {
|
||||
mpll, upll,
|
||||
};
|
||||
|
||||
static void __iomem *reg_base;
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static struct samsung_clk_reg_dump *s3c2410_save;
|
||||
|
||||
/*
|
||||
* list of controller registers to be saved and restored during a
|
||||
* suspend/resume cycle.
|
||||
*/
|
||||
static unsigned long s3c2410_clk_regs[] __initdata = {
|
||||
LOCKTIME,
|
||||
MPLLCON,
|
||||
UPLLCON,
|
||||
CLKCON,
|
||||
CLKSLOW,
|
||||
CLKDIVN,
|
||||
CAMDIVN,
|
||||
};
|
||||
|
||||
static int s3c2410_clk_suspend(void)
|
||||
{
|
||||
samsung_clk_save(reg_base, s3c2410_save,
|
||||
ARRAY_SIZE(s3c2410_clk_regs));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void s3c2410_clk_resume(void)
|
||||
{
|
||||
samsung_clk_restore(reg_base, s3c2410_save,
|
||||
ARRAY_SIZE(s3c2410_clk_regs));
|
||||
}
|
||||
|
||||
static struct syscore_ops s3c2410_clk_syscore_ops = {
|
||||
.suspend = s3c2410_clk_suspend,
|
||||
.resume = s3c2410_clk_resume,
|
||||
};
|
||||
|
||||
static void s3c2410_clk_sleep_init(void)
|
||||
{
|
||||
s3c2410_save = samsung_clk_alloc_reg_dump(s3c2410_clk_regs,
|
||||
ARRAY_SIZE(s3c2410_clk_regs));
|
||||
if (!s3c2410_save) {
|
||||
pr_warn("%s: failed to allocate sleep save data, no sleep support!\n",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
|
||||
register_syscore_ops(&s3c2410_clk_syscore_ops);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
static void s3c2410_clk_sleep_init(void) {}
|
||||
#endif
|
||||
|
||||
PNAME(fclk_p) = { "mpll", "div_slow" };
|
||||
|
||||
struct samsung_mux_clock s3c2410_common_muxes[] __initdata = {
|
||||
MUX(FCLK, "fclk", fclk_p, CLKSLOW, 4, 1),
|
||||
};
|
||||
|
||||
static struct clk_div_table divslow_d[] = {
|
||||
{ .val = 0, .div = 1 },
|
||||
{ .val = 1, .div = 2 },
|
||||
{ .val = 2, .div = 4 },
|
||||
{ .val = 3, .div = 6 },
|
||||
{ .val = 4, .div = 8 },
|
||||
{ .val = 5, .div = 10 },
|
||||
{ .val = 6, .div = 12 },
|
||||
{ .val = 7, .div = 14 },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
struct samsung_div_clock s3c2410_common_dividers[] __initdata = {
|
||||
DIV_T(0, "div_slow", "xti", CLKSLOW, 0, 3, divslow_d),
|
||||
DIV(PCLK, "pclk", "hclk", CLKDIVN, 0, 1),
|
||||
};
|
||||
|
||||
struct samsung_gate_clock s3c2410_common_gates[] __initdata = {
|
||||
GATE(PCLK_SPI, "spi", "pclk", CLKCON, 18, 0, 0),
|
||||
GATE(PCLK_I2S, "i2s", "pclk", CLKCON, 17, 0, 0),
|
||||
GATE(PCLK_I2C, "i2c", "pclk", CLKCON, 16, 0, 0),
|
||||
GATE(PCLK_ADC, "adc", "pclk", CLKCON, 15, 0, 0),
|
||||
GATE(PCLK_RTC, "rtc", "pclk", CLKCON, 14, 0, 0),
|
||||
GATE(PCLK_GPIO, "gpio", "pclk", CLKCON, 13, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(PCLK_UART2, "uart2", "pclk", CLKCON, 12, 0, 0),
|
||||
GATE(PCLK_UART1, "uart1", "pclk", CLKCON, 11, 0, 0),
|
||||
GATE(PCLK_UART0, "uart0", "pclk", CLKCON, 10, 0, 0),
|
||||
GATE(PCLK_SDI, "sdi", "pclk", CLKCON, 9, 0, 0),
|
||||
GATE(PCLK_PWM, "pwm", "pclk", CLKCON, 8, 0, 0),
|
||||
GATE(HCLK_USBD, "usb-device", "hclk", CLKCON, 7, 0, 0),
|
||||
GATE(HCLK_USBH, "usb-host", "hclk", CLKCON, 6, 0, 0),
|
||||
GATE(HCLK_LCD, "lcd", "hclk", CLKCON, 5, 0, 0),
|
||||
GATE(HCLK_NAND, "nand", "hclk", CLKCON, 4, 0, 0),
|
||||
};
|
||||
|
||||
/* should be added _after_ the soc-specific clocks are created */
|
||||
struct samsung_clock_alias s3c2410_common_aliases[] __initdata = {
|
||||
ALIAS(PCLK_I2C, "s3c2410-i2c.0", "i2c"),
|
||||
ALIAS(PCLK_ADC, NULL, "adc"),
|
||||
ALIAS(PCLK_RTC, NULL, "rtc"),
|
||||
ALIAS(PCLK_PWM, NULL, "timers"),
|
||||
ALIAS(HCLK_LCD, NULL, "lcd"),
|
||||
ALIAS(HCLK_USBD, NULL, "usb-device"),
|
||||
ALIAS(HCLK_USBH, NULL, "usb-host"),
|
||||
ALIAS(UCLK, NULL, "usb-bus-host"),
|
||||
ALIAS(UCLK, NULL, "usb-bus-gadget"),
|
||||
ALIAS(ARMCLK, NULL, "armclk"),
|
||||
ALIAS(UCLK, NULL, "uclk"),
|
||||
ALIAS(HCLK, NULL, "hclk"),
|
||||
ALIAS(MPLL, NULL, "mpll"),
|
||||
ALIAS(FCLK, NULL, "fclk"),
|
||||
};
|
||||
|
||||
/* S3C2410 specific clocks */
|
||||
|
||||
static struct samsung_pll_rate_table pll_s3c2410_12mhz_tbl[] __initdata = {
|
||||
/* sorted in descending order */
|
||||
/* 2410A extras */
|
||||
PLL_35XX_RATE(270000000, 127, 1, 1),
|
||||
PLL_35XX_RATE(268000000, 126, 1, 1),
|
||||
PLL_35XX_RATE(266000000, 125, 1, 1),
|
||||
PLL_35XX_RATE(226000000, 105, 1, 1),
|
||||
PLL_35XX_RATE(210000000, 132, 2, 1),
|
||||
/* 2410 common */
|
||||
PLL_35XX_RATE(203000000, 161, 3, 1),
|
||||
PLL_35XX_RATE(192000000, 88, 1, 1),
|
||||
PLL_35XX_RATE(186000000, 85, 1, 1),
|
||||
PLL_35XX_RATE(180000000, 82, 1, 1),
|
||||
PLL_35XX_RATE(170000000, 77, 1, 1),
|
||||
PLL_35XX_RATE(158000000, 71, 1, 1),
|
||||
PLL_35XX_RATE(152000000, 68, 1, 1),
|
||||
PLL_35XX_RATE(147000000, 90, 2, 1),
|
||||
PLL_35XX_RATE(135000000, 82, 2, 1),
|
||||
PLL_35XX_RATE(124000000, 116, 1, 2),
|
||||
PLL_35XX_RATE(118000000, 150, 2, 2),
|
||||
PLL_35XX_RATE(113000000, 105, 1, 2),
|
||||
PLL_35XX_RATE(101000000, 127, 2, 2),
|
||||
PLL_35XX_RATE(90000000, 112, 2, 2),
|
||||
PLL_35XX_RATE(85000000, 105, 2, 2),
|
||||
PLL_35XX_RATE(79000000, 71, 1, 2),
|
||||
PLL_35XX_RATE(68000000, 82, 2, 2),
|
||||
PLL_35XX_RATE(56000000, 142, 2, 3),
|
||||
PLL_35XX_RATE(48000000, 120, 2, 3),
|
||||
PLL_35XX_RATE(51000000, 161, 3, 3),
|
||||
PLL_35XX_RATE(45000000, 82, 1, 3),
|
||||
PLL_35XX_RATE(34000000, 82, 2, 3),
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
static struct samsung_pll_clock s3c2410_plls[] __initdata = {
|
||||
[mpll] = PLL(pll_s3c2410_mpll, MPLL, "mpll", "xti",
|
||||
LOCKTIME, MPLLCON, NULL),
|
||||
[upll] = PLL(pll_s3c2410_upll, UPLL, "upll", "xti",
|
||||
LOCKTIME, UPLLCON, NULL),
|
||||
};
|
||||
|
||||
struct samsung_div_clock s3c2410_dividers[] __initdata = {
|
||||
DIV(HCLK, "hclk", "mpll", CLKDIVN, 1, 1),
|
||||
};
|
||||
|
||||
struct samsung_fixed_factor_clock s3c2410_ffactor[] __initdata = {
|
||||
/*
|
||||
* armclk is directly supplied by the fclk, without
|
||||
* switching possibility like on the s3c244x below.
|
||||
*/
|
||||
FFACTOR(ARMCLK, "armclk", "fclk", 1, 1, 0),
|
||||
|
||||
/* uclk is fed from the unmodified upll */
|
||||
FFACTOR(UCLK, "uclk", "upll", 1, 1, 0),
|
||||
};
|
||||
|
||||
struct samsung_clock_alias s3c2410_aliases[] __initdata = {
|
||||
ALIAS(PCLK_UART0, "s3c2410-uart.0", "uart"),
|
||||
ALIAS(PCLK_UART1, "s3c2410-uart.1", "uart"),
|
||||
ALIAS(PCLK_UART2, "s3c2410-uart.2", "uart"),
|
||||
ALIAS(PCLK_UART0, "s3c2410-uart.0", "clk_uart_baud0"),
|
||||
ALIAS(PCLK_UART1, "s3c2410-uart.1", "clk_uart_baud0"),
|
||||
ALIAS(PCLK_UART2, "s3c2410-uart.2", "clk_uart_baud0"),
|
||||
ALIAS(UCLK, NULL, "clk_uart_baud1"),
|
||||
};
|
||||
|
||||
/* S3C244x specific clocks */
|
||||
|
||||
static struct samsung_pll_rate_table pll_s3c244x_12mhz_tbl[] __initdata = {
|
||||
/* sorted in descending order */
|
||||
PLL_35XX_RATE(400000000, 0x5c, 1, 1),
|
||||
PLL_35XX_RATE(390000000, 0x7a, 2, 1),
|
||||
PLL_35XX_RATE(380000000, 0x57, 1, 1),
|
||||
PLL_35XX_RATE(370000000, 0xb1, 4, 1),
|
||||
PLL_35XX_RATE(360000000, 0x70, 2, 1),
|
||||
PLL_35XX_RATE(350000000, 0xa7, 4, 1),
|
||||
PLL_35XX_RATE(340000000, 0x4d, 1, 1),
|
||||
PLL_35XX_RATE(330000000, 0x66, 2, 1),
|
||||
PLL_35XX_RATE(320000000, 0x98, 4, 1),
|
||||
PLL_35XX_RATE(310000000, 0x93, 4, 1),
|
||||
PLL_35XX_RATE(300000000, 0x75, 3, 1),
|
||||
PLL_35XX_RATE(240000000, 0x70, 1, 2),
|
||||
PLL_35XX_RATE(230000000, 0x6b, 1, 2),
|
||||
PLL_35XX_RATE(220000000, 0x66, 1, 2),
|
||||
PLL_35XX_RATE(210000000, 0x84, 2, 2),
|
||||
PLL_35XX_RATE(200000000, 0x5c, 1, 2),
|
||||
PLL_35XX_RATE(190000000, 0x57, 1, 2),
|
||||
PLL_35XX_RATE(180000000, 0x70, 2, 2),
|
||||
PLL_35XX_RATE(170000000, 0x4d, 1, 2),
|
||||
PLL_35XX_RATE(160000000, 0x98, 4, 2),
|
||||
PLL_35XX_RATE(150000000, 0x75, 3, 2),
|
||||
PLL_35XX_RATE(120000000, 0x70, 1, 3),
|
||||
PLL_35XX_RATE(110000000, 0x66, 1, 3),
|
||||
PLL_35XX_RATE(100000000, 0x5c, 1, 3),
|
||||
PLL_35XX_RATE(90000000, 0x70, 2, 3),
|
||||
PLL_35XX_RATE(80000000, 0x98, 4, 3),
|
||||
PLL_35XX_RATE(75000000, 0x75, 3, 3),
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
static struct samsung_pll_clock s3c244x_common_plls[] __initdata = {
|
||||
[mpll] = PLL(pll_s3c2440_mpll, MPLL, "mpll", "xti",
|
||||
LOCKTIME, MPLLCON, NULL),
|
||||
[upll] = PLL(pll_s3c2410_upll, UPLL, "upll", "xti",
|
||||
LOCKTIME, UPLLCON, NULL),
|
||||
};
|
||||
|
||||
PNAME(hclk_p) = { "fclk", "div_hclk_2", "div_hclk_4", "div_hclk_3" };
|
||||
PNAME(armclk_p) = { "fclk", "hclk" };
|
||||
|
||||
struct samsung_mux_clock s3c244x_common_muxes[] __initdata = {
|
||||
MUX(HCLK, "hclk", hclk_p, CLKDIVN, 1, 2),
|
||||
MUX(ARMCLK, "armclk", armclk_p, CAMDIVN, 12, 1),
|
||||
};
|
||||
|
||||
struct samsung_fixed_factor_clock s3c244x_common_ffactor[] __initdata = {
|
||||
FFACTOR(0, "div_hclk_2", "fclk", 1, 2, 0),
|
||||
FFACTOR(0, "ff_cam", "div_cam", 2, 1, CLK_SET_RATE_PARENT),
|
||||
};
|
||||
|
||||
static struct clk_div_table div_hclk_4_d[] = {
|
||||
{ .val = 0, .div = 4 },
|
||||
{ .val = 1, .div = 8 },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
static struct clk_div_table div_hclk_3_d[] = {
|
||||
{ .val = 0, .div = 3 },
|
||||
{ .val = 1, .div = 6 },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
struct samsung_div_clock s3c244x_common_dividers[] __initdata = {
|
||||
DIV(UCLK, "uclk", "upll", CLKDIVN, 3, 1),
|
||||
DIV(0, "div_hclk", "fclk", CLKDIVN, 1, 1),
|
||||
DIV_T(0, "div_hclk_4", "fclk", CAMDIVN, 9, 1, div_hclk_4_d),
|
||||
DIV_T(0, "div_hclk_3", "fclk", CAMDIVN, 8, 1, div_hclk_3_d),
|
||||
DIV(0, "div_cam", "upll", CAMDIVN, 0, 3),
|
||||
};
|
||||
|
||||
struct samsung_gate_clock s3c244x_common_gates[] __initdata = {
|
||||
GATE(HCLK_CAM, "cam", "hclk", CLKCON, 19, 0, 0),
|
||||
};
|
||||
|
||||
struct samsung_clock_alias s3c244x_common_aliases[] __initdata = {
|
||||
ALIAS(PCLK_UART0, "s3c2440-uart.0", "uart"),
|
||||
ALIAS(PCLK_UART1, "s3c2440-uart.1", "uart"),
|
||||
ALIAS(PCLK_UART2, "s3c2440-uart.2", "uart"),
|
||||
ALIAS(PCLK_UART0, "s3c2440-uart.0", "clk_uart_baud2"),
|
||||
ALIAS(PCLK_UART1, "s3c2440-uart.1", "clk_uart_baud2"),
|
||||
ALIAS(PCLK_UART2, "s3c2440-uart.2", "clk_uart_baud2"),
|
||||
ALIAS(HCLK_CAM, NULL, "camif"),
|
||||
ALIAS(CAMIF, NULL, "camif-upll"),
|
||||
};
|
||||
|
||||
/* S3C2440 specific clocks */
|
||||
|
||||
PNAME(s3c2440_camif_p) = { "upll", "ff_cam" };
|
||||
|
||||
struct samsung_mux_clock s3c2440_muxes[] __initdata = {
|
||||
MUX(CAMIF, "camif", s3c2440_camif_p, CAMDIVN, 4, 1),
|
||||
};
|
||||
|
||||
struct samsung_gate_clock s3c2440_gates[] __initdata = {
|
||||
GATE(PCLK_AC97, "ac97", "pclk", CLKCON, 20, 0, 0),
|
||||
};
|
||||
|
||||
/* S3C2442 specific clocks */
|
||||
|
||||
struct samsung_fixed_factor_clock s3c2442_ffactor[] __initdata = {
|
||||
FFACTOR(0, "upll_3", "upll", 1, 3, 0),
|
||||
};
|
||||
|
||||
PNAME(s3c2442_camif_p) = { "upll", "ff_cam", "upll", "upll_3" };
|
||||
|
||||
struct samsung_mux_clock s3c2442_muxes[] __initdata = {
|
||||
MUX(CAMIF, "camif", s3c2442_camif_p, CAMDIVN, 4, 2),
|
||||
};
|
||||
|
||||
/*
|
||||
* fixed rate clocks generated outside the soc
|
||||
* Only necessary until the devicetree-move is complete
|
||||
*/
|
||||
#define XTI 1
|
||||
struct samsung_fixed_rate_clock s3c2410_common_frate_clks[] __initdata = {
|
||||
FRATE(XTI, "xti", NULL, CLK_IS_ROOT, 0),
|
||||
};
|
||||
|
||||
static void __init s3c2410_common_clk_register_fixed_ext(
|
||||
struct samsung_clk_provider *ctx,
|
||||
unsigned long xti_f)
|
||||
{
|
||||
struct samsung_clock_alias xti_alias = ALIAS(XTI, NULL, "xtal");
|
||||
|
||||
s3c2410_common_frate_clks[0].fixed_rate = xti_f;
|
||||
samsung_clk_register_fixed_rate(ctx, s3c2410_common_frate_clks,
|
||||
ARRAY_SIZE(s3c2410_common_frate_clks));
|
||||
|
||||
samsung_clk_register_alias(ctx, &xti_alias, 1);
|
||||
}
|
||||
|
||||
void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f,
|
||||
int current_soc,
|
||||
void __iomem *base)
|
||||
{
|
||||
struct samsung_clk_provider *ctx;
|
||||
reg_base = base;
|
||||
|
||||
if (np) {
|
||||
reg_base = of_iomap(np, 0);
|
||||
if (!reg_base)
|
||||
panic("%s: failed to map registers\n", __func__);
|
||||
}
|
||||
|
||||
ctx = samsung_clk_init(np, reg_base, NR_CLKS);
|
||||
if (!ctx)
|
||||
panic("%s: unable to allocate context.\n", __func__);
|
||||
|
||||
/* Register external clocks only in non-dt cases */
|
||||
if (!np)
|
||||
s3c2410_common_clk_register_fixed_ext(ctx, xti_f);
|
||||
|
||||
if (current_soc == 2410) {
|
||||
if (_get_rate("xti") == 12 * MHZ) {
|
||||
s3c2410_plls[mpll].rate_table = pll_s3c2410_12mhz_tbl;
|
||||
s3c2410_plls[upll].rate_table = pll_s3c2410_12mhz_tbl;
|
||||
}
|
||||
|
||||
/* Register PLLs. */
|
||||
samsung_clk_register_pll(ctx, s3c2410_plls,
|
||||
ARRAY_SIZE(s3c2410_plls), reg_base);
|
||||
|
||||
} else { /* S3C2440, S3C2442 */
|
||||
if (_get_rate("xti") == 12 * MHZ) {
|
||||
/*
|
||||
* plls follow different calculation schemes, with the
|
||||
* upll following the same scheme as the s3c2410 plls
|
||||
*/
|
||||
s3c244x_common_plls[mpll].rate_table =
|
||||
pll_s3c244x_12mhz_tbl;
|
||||
s3c244x_common_plls[upll].rate_table =
|
||||
pll_s3c2410_12mhz_tbl;
|
||||
}
|
||||
|
||||
/* Register PLLs. */
|
||||
samsung_clk_register_pll(ctx, s3c244x_common_plls,
|
||||
ARRAY_SIZE(s3c244x_common_plls), reg_base);
|
||||
}
|
||||
|
||||
/* Register common internal clocks. */
|
||||
samsung_clk_register_mux(ctx, s3c2410_common_muxes,
|
||||
ARRAY_SIZE(s3c2410_common_muxes));
|
||||
samsung_clk_register_div(ctx, s3c2410_common_dividers,
|
||||
ARRAY_SIZE(s3c2410_common_dividers));
|
||||
samsung_clk_register_gate(ctx, s3c2410_common_gates,
|
||||
ARRAY_SIZE(s3c2410_common_gates));
|
||||
|
||||
if (current_soc == S3C2440 || current_soc == S3C2442) {
|
||||
samsung_clk_register_div(ctx, s3c244x_common_dividers,
|
||||
ARRAY_SIZE(s3c244x_common_dividers));
|
||||
samsung_clk_register_gate(ctx, s3c244x_common_gates,
|
||||
ARRAY_SIZE(s3c244x_common_gates));
|
||||
samsung_clk_register_mux(ctx, s3c244x_common_muxes,
|
||||
ARRAY_SIZE(s3c244x_common_muxes));
|
||||
samsung_clk_register_fixed_factor(ctx, s3c244x_common_ffactor,
|
||||
ARRAY_SIZE(s3c244x_common_ffactor));
|
||||
}
|
||||
|
||||
/* Register SoC-specific clocks. */
|
||||
switch (current_soc) {
|
||||
case S3C2410:
|
||||
samsung_clk_register_div(ctx, s3c2410_dividers,
|
||||
ARRAY_SIZE(s3c2410_dividers));
|
||||
samsung_clk_register_fixed_factor(ctx, s3c2410_ffactor,
|
||||
ARRAY_SIZE(s3c2410_ffactor));
|
||||
samsung_clk_register_alias(ctx, s3c2410_aliases,
|
||||
ARRAY_SIZE(s3c2410_common_aliases));
|
||||
break;
|
||||
case S3C2440:
|
||||
samsung_clk_register_mux(ctx, s3c2440_muxes,
|
||||
ARRAY_SIZE(s3c2440_muxes));
|
||||
samsung_clk_register_gate(ctx, s3c2440_gates,
|
||||
ARRAY_SIZE(s3c2440_gates));
|
||||
break;
|
||||
case S3C2442:
|
||||
samsung_clk_register_mux(ctx, s3c2442_muxes,
|
||||
ARRAY_SIZE(s3c2442_muxes));
|
||||
samsung_clk_register_fixed_factor(ctx, s3c2442_ffactor,
|
||||
ARRAY_SIZE(s3c2442_ffactor));
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register common aliases at the end, as some of the aliased clocks
|
||||
* are SoC specific.
|
||||
*/
|
||||
samsung_clk_register_alias(ctx, s3c2410_common_aliases,
|
||||
ARRAY_SIZE(s3c2410_common_aliases));
|
||||
|
||||
if (current_soc == S3C2440 || current_soc == S3C2442) {
|
||||
samsung_clk_register_alias(ctx, s3c244x_common_aliases,
|
||||
ARRAY_SIZE(s3c244x_common_aliases));
|
||||
}
|
||||
|
||||
s3c2410_clk_sleep_init();
|
||||
}
|
||||
|
||||
static void __init s3c2410_clk_init(struct device_node *np)
|
||||
{
|
||||
s3c2410_common_clk_init(np, 0, S3C2410, 0);
|
||||
}
|
||||
CLK_OF_DECLARE(s3c2410_clk, "samsung,s3c2410-clock", s3c2410_clk_init);
|
||||
|
||||
static void __init s3c2440_clk_init(struct device_node *np)
|
||||
{
|
||||
s3c2410_common_clk_init(np, 0, S3C2440, 0);
|
||||
}
|
||||
CLK_OF_DECLARE(s3c2440_clk, "samsung,s3c2440-clock", s3c2440_clk_init);
|
||||
|
||||
static void __init s3c2442_clk_init(struct device_node *np)
|
||||
{
|
||||
s3c2410_common_clk_init(np, 0, S3C2442, 0);
|
||||
}
|
||||
CLK_OF_DECLARE(s3c2442_clk, "samsung,s3c2442-clock", s3c2442_clk_init);
|
274
drivers/clk/samsung/clk-s3c2412.c
Normal file
274
drivers/clk/samsung/clk-s3c2412.c
Normal file
@ -0,0 +1,274 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Common Clock Framework support for S3C2412 and S3C2413.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clkdev.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/syscore_ops.h>
|
||||
|
||||
#include <dt-bindings/clock/s3c2412.h>
|
||||
|
||||
#include "clk.h"
|
||||
#include "clk-pll.h"
|
||||
|
||||
#define LOCKTIME 0x00
|
||||
#define MPLLCON 0x04
|
||||
#define UPLLCON 0x08
|
||||
#define CLKCON 0x0c
|
||||
#define CLKDIVN 0x14
|
||||
#define CLKSRC 0x1c
|
||||
|
||||
/* list of PLLs to be registered */
|
||||
enum s3c2412_plls {
|
||||
mpll, upll,
|
||||
};
|
||||
|
||||
static void __iomem *reg_base;
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static struct samsung_clk_reg_dump *s3c2412_save;
|
||||
|
||||
/*
|
||||
* list of controller registers to be saved and restored during a
|
||||
* suspend/resume cycle.
|
||||
*/
|
||||
static unsigned long s3c2412_clk_regs[] __initdata = {
|
||||
LOCKTIME,
|
||||
MPLLCON,
|
||||
UPLLCON,
|
||||
CLKCON,
|
||||
CLKDIVN,
|
||||
CLKSRC,
|
||||
};
|
||||
|
||||
static int s3c2412_clk_suspend(void)
|
||||
{
|
||||
samsung_clk_save(reg_base, s3c2412_save,
|
||||
ARRAY_SIZE(s3c2412_clk_regs));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void s3c2412_clk_resume(void)
|
||||
{
|
||||
samsung_clk_restore(reg_base, s3c2412_save,
|
||||
ARRAY_SIZE(s3c2412_clk_regs));
|
||||
}
|
||||
|
||||
static struct syscore_ops s3c2412_clk_syscore_ops = {
|
||||
.suspend = s3c2412_clk_suspend,
|
||||
.resume = s3c2412_clk_resume,
|
||||
};
|
||||
|
||||
static void s3c2412_clk_sleep_init(void)
|
||||
{
|
||||
s3c2412_save = samsung_clk_alloc_reg_dump(s3c2412_clk_regs,
|
||||
ARRAY_SIZE(s3c2412_clk_regs));
|
||||
if (!s3c2412_save) {
|
||||
pr_warn("%s: failed to allocate sleep save data, no sleep support!\n",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
|
||||
register_syscore_ops(&s3c2412_clk_syscore_ops);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
static void s3c2412_clk_sleep_init(void) {}
|
||||
#endif
|
||||
|
||||
static struct clk_div_table divxti_d[] = {
|
||||
{ .val = 0, .div = 1 },
|
||||
{ .val = 1, .div = 2 },
|
||||
{ .val = 2, .div = 4 },
|
||||
{ .val = 3, .div = 6 },
|
||||
{ .val = 4, .div = 8 },
|
||||
{ .val = 5, .div = 10 },
|
||||
{ .val = 6, .div = 12 },
|
||||
{ .val = 7, .div = 14 },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
struct samsung_div_clock s3c2412_dividers[] __initdata = {
|
||||
DIV_T(0, "div_xti", "xti", CLKSRC, 0, 3, divxti_d),
|
||||
DIV(0, "div_cam", "mux_cam", CLKDIVN, 16, 4),
|
||||
DIV(0, "div_i2s", "mux_i2s", CLKDIVN, 12, 4),
|
||||
DIV(0, "div_uart", "mux_uart", CLKDIVN, 8, 4),
|
||||
DIV(0, "div_usb", "mux_usb", CLKDIVN, 6, 1),
|
||||
DIV(0, "div_hclk_half", "hclk", CLKDIVN, 5, 1),
|
||||
DIV(ARMDIV, "armdiv", "msysclk", CLKDIVN, 3, 1),
|
||||
DIV(PCLK, "pclk", "hclk", CLKDIVN, 2, 1),
|
||||
DIV(HCLK, "hclk", "armdiv", CLKDIVN, 0, 2),
|
||||
};
|
||||
|
||||
struct samsung_fixed_factor_clock s3c2412_ffactor[] __initdata = {
|
||||
FFACTOR(0, "ff_hclk", "hclk", 2, 1, CLK_SET_RATE_PARENT),
|
||||
};
|
||||
|
||||
/*
|
||||
* The first two use the OM[4] setting, which is not readable from
|
||||
* software, so assume it is set to xti.
|
||||
*/
|
||||
PNAME(erefclk_p) = { "xti", "xti", "xti", "ext" };
|
||||
PNAME(urefclk_p) = { "xti", "xti", "xti", "ext" };
|
||||
|
||||
PNAME(camclk_p) = { "usysclk", "hclk" };
|
||||
PNAME(usbclk_p) = { "usysclk", "hclk" };
|
||||
PNAME(i2sclk_p) = { "erefclk", "mpll" };
|
||||
PNAME(uartclk_p) = { "erefclk", "mpll" };
|
||||
PNAME(usysclk_p) = { "urefclk", "upll" };
|
||||
PNAME(msysclk_p) = { "mdivclk", "mpll" };
|
||||
PNAME(mdivclk_p) = { "xti", "div_xti" };
|
||||
PNAME(armclk_p) = { "armdiv", "hclk" };
|
||||
|
||||
struct samsung_mux_clock s3c2412_muxes[] __initdata = {
|
||||
MUX(0, "erefclk", erefclk_p, CLKSRC, 14, 2),
|
||||
MUX(0, "urefclk", urefclk_p, CLKSRC, 12, 2),
|
||||
MUX(0, "mux_cam", camclk_p, CLKSRC, 11, 1),
|
||||
MUX(0, "mux_usb", usbclk_p, CLKSRC, 10, 1),
|
||||
MUX(0, "mux_i2s", i2sclk_p, CLKSRC, 9, 1),
|
||||
MUX(0, "mux_uart", uartclk_p, CLKSRC, 8, 1),
|
||||
MUX(USYSCLK, "usysclk", usysclk_p, CLKSRC, 5, 1),
|
||||
MUX(MSYSCLK, "msysclk", msysclk_p, CLKSRC, 4, 1),
|
||||
MUX(MDIVCLK, "mdivclk", mdivclk_p, CLKSRC, 3, 1),
|
||||
MUX(ARMCLK, "armclk", armclk_p, CLKDIVN, 4, 1),
|
||||
};
|
||||
|
||||
static struct samsung_pll_clock s3c2412_plls[] __initdata = {
|
||||
[mpll] = PLL(pll_s3c2440_mpll, MPLL, "mpll", "xti",
|
||||
LOCKTIME, MPLLCON, NULL),
|
||||
[upll] = PLL(pll_s3c2410_upll, UPLL, "upll", "urefclk",
|
||||
LOCKTIME, UPLLCON, NULL),
|
||||
};
|
||||
|
||||
struct samsung_gate_clock s3c2412_gates[] __initdata = {
|
||||
GATE(PCLK_WDT, "wdt", "pclk", CLKCON, 28, 0, 0),
|
||||
GATE(PCLK_SPI, "spi", "pclk", CLKCON, 27, 0, 0),
|
||||
GATE(PCLK_I2S, "i2s", "pclk", CLKCON, 26, 0, 0),
|
||||
GATE(PCLK_I2C, "i2c", "pclk", CLKCON, 25, 0, 0),
|
||||
GATE(PCLK_ADC, "adc", "pclk", CLKCON, 24, 0, 0),
|
||||
GATE(PCLK_RTC, "rtc", "pclk", CLKCON, 23, 0, 0),
|
||||
GATE(PCLK_GPIO, "gpio", "pclk", CLKCON, 22, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(PCLK_UART2, "uart2", "pclk", CLKCON, 21, 0, 0),
|
||||
GATE(PCLK_UART1, "uart1", "pclk", CLKCON, 20, 0, 0),
|
||||
GATE(PCLK_UART0, "uart0", "pclk", CLKCON, 19, 0, 0),
|
||||
GATE(PCLK_SDI, "sdi", "pclk", CLKCON, 18, 0, 0),
|
||||
GATE(PCLK_PWM, "pwm", "pclk", CLKCON, 17, 0, 0),
|
||||
GATE(PCLK_USBD, "usb-device", "pclk", CLKCON, 16, 0, 0),
|
||||
GATE(SCLK_CAM, "sclk_cam", "div_cam", CLKCON, 15, 0, 0),
|
||||
GATE(SCLK_UART, "sclk_uart", "div_uart", CLKCON, 14, 0, 0),
|
||||
GATE(SCLK_I2S, "sclk_i2s", "div_i2s", CLKCON, 13, 0, 0),
|
||||
GATE(SCLK_USBH, "sclk_usbh", "div_usb", CLKCON, 12, 0, 0),
|
||||
GATE(SCLK_USBD, "sclk_usbd", "div_usb", CLKCON, 11, 0, 0),
|
||||
GATE(HCLK_HALF, "hclk_half", "div_hclk_half", CLKCON, 10, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(HCLK_X2, "hclkx2", "ff_hclk", CLKCON, 9, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(HCLK_SDRAM, "sdram", "hclk", CLKCON, 8, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(HCLK_USBH, "usb-host", "hclk", CLKCON, 6, 0, 0),
|
||||
GATE(HCLK_LCD, "lcd", "hclk", CLKCON, 5, 0, 0),
|
||||
GATE(HCLK_NAND, "nand", "hclk", CLKCON, 4, 0, 0),
|
||||
GATE(HCLK_DMA3, "dma3", "hclk", CLKCON, 3, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(HCLK_DMA2, "dma2", "hclk", CLKCON, 2, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(HCLK_DMA1, "dma1", "hclk", CLKCON, 1, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(HCLK_DMA0, "dma0", "hclk", CLKCON, 0, CLK_IGNORE_UNUSED, 0),
|
||||
};
|
||||
|
||||
struct samsung_clock_alias s3c2412_aliases[] __initdata = {
|
||||
ALIAS(PCLK_UART0, "s3c2412-uart.0", "uart"),
|
||||
ALIAS(PCLK_UART1, "s3c2412-uart.1", "uart"),
|
||||
ALIAS(PCLK_UART2, "s3c2412-uart.2", "uart"),
|
||||
ALIAS(PCLK_UART0, "s3c2412-uart.0", "clk_uart_baud2"),
|
||||
ALIAS(PCLK_UART1, "s3c2412-uart.1", "clk_uart_baud2"),
|
||||
ALIAS(PCLK_UART2, "s3c2412-uart.2", "clk_uart_baud2"),
|
||||
ALIAS(SCLK_UART, NULL, "clk_uart_baud3"),
|
||||
ALIAS(PCLK_I2C, "s3c2410-i2c.0", "i2c"),
|
||||
ALIAS(PCLK_ADC, NULL, "adc"),
|
||||
ALIAS(PCLK_RTC, NULL, "rtc"),
|
||||
ALIAS(PCLK_PWM, NULL, "timers"),
|
||||
ALIAS(HCLK_LCD, NULL, "lcd"),
|
||||
ALIAS(PCLK_USBD, NULL, "usb-device"),
|
||||
ALIAS(SCLK_USBD, NULL, "usb-bus-gadget"),
|
||||
ALIAS(HCLK_USBH, NULL, "usb-host"),
|
||||
ALIAS(SCLK_USBH, NULL, "usb-bus-host"),
|
||||
ALIAS(ARMCLK, NULL, "armclk"),
|
||||
ALIAS(HCLK, NULL, "hclk"),
|
||||
ALIAS(MPLL, NULL, "mpll"),
|
||||
ALIAS(MSYSCLK, NULL, "fclk"),
|
||||
};
|
||||
|
||||
/*
|
||||
* fixed rate clocks generated outside the soc
|
||||
* Only necessary until the devicetree-move is complete
|
||||
*/
|
||||
#define XTI 1
|
||||
struct samsung_fixed_rate_clock s3c2412_common_frate_clks[] __initdata = {
|
||||
FRATE(XTI, "xti", NULL, CLK_IS_ROOT, 0),
|
||||
FRATE(0, "ext", NULL, CLK_IS_ROOT, 0),
|
||||
};
|
||||
|
||||
static void __init s3c2412_common_clk_register_fixed_ext(
|
||||
struct samsung_clk_provider *ctx,
|
||||
unsigned long xti_f, unsigned long ext_f)
|
||||
{
|
||||
/* xtal alias is necessary for the current cpufreq driver */
|
||||
struct samsung_clock_alias xti_alias = ALIAS(XTI, NULL, "xtal");
|
||||
|
||||
s3c2412_common_frate_clks[0].fixed_rate = xti_f;
|
||||
s3c2412_common_frate_clks[1].fixed_rate = ext_f;
|
||||
samsung_clk_register_fixed_rate(ctx, s3c2412_common_frate_clks,
|
||||
ARRAY_SIZE(s3c2412_common_frate_clks));
|
||||
|
||||
samsung_clk_register_alias(ctx, &xti_alias, 1);
|
||||
}
|
||||
|
||||
void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f,
|
||||
unsigned long ext_f, void __iomem *base)
|
||||
{
|
||||
struct samsung_clk_provider *ctx;
|
||||
reg_base = base;
|
||||
|
||||
if (np) {
|
||||
reg_base = of_iomap(np, 0);
|
||||
if (!reg_base)
|
||||
panic("%s: failed to map registers\n", __func__);
|
||||
}
|
||||
|
||||
ctx = samsung_clk_init(np, reg_base, NR_CLKS);
|
||||
if (!ctx)
|
||||
panic("%s: unable to allocate context.\n", __func__);
|
||||
|
||||
/* Register external clocks only in non-dt cases */
|
||||
if (!np)
|
||||
s3c2412_common_clk_register_fixed_ext(ctx, xti_f, ext_f);
|
||||
|
||||
/* Register PLLs. */
|
||||
samsung_clk_register_pll(ctx, s3c2412_plls, ARRAY_SIZE(s3c2412_plls),
|
||||
reg_base);
|
||||
|
||||
/* Register common internal clocks. */
|
||||
samsung_clk_register_mux(ctx, s3c2412_muxes, ARRAY_SIZE(s3c2412_muxes));
|
||||
samsung_clk_register_div(ctx, s3c2412_dividers,
|
||||
ARRAY_SIZE(s3c2412_dividers));
|
||||
samsung_clk_register_gate(ctx, s3c2412_gates,
|
||||
ARRAY_SIZE(s3c2412_gates));
|
||||
samsung_clk_register_fixed_factor(ctx, s3c2412_ffactor,
|
||||
ARRAY_SIZE(s3c2412_ffactor));
|
||||
samsung_clk_register_alias(ctx, s3c2412_aliases,
|
||||
ARRAY_SIZE(s3c2412_aliases));
|
||||
|
||||
s3c2412_clk_sleep_init();
|
||||
}
|
||||
|
||||
static void __init s3c2412_clk_init(struct device_node *np)
|
||||
{
|
||||
s3c2412_common_clk_init(np, 0, 0, 0);
|
||||
}
|
||||
CLK_OF_DECLARE(s3c2412_clk, "samsung,s3c2412-clock", s3c2412_clk_init);
|
466
drivers/clk/samsung/clk-s3c2443.c
Normal file
466
drivers/clk/samsung/clk-s3c2443.c
Normal file
@ -0,0 +1,466 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Common Clock Framework support for S3C2443 and following SoCs.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clkdev.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/syscore_ops.h>
|
||||
|
||||
#include <dt-bindings/clock/s3c2443.h>
|
||||
|
||||
#include "clk.h"
|
||||
#include "clk-pll.h"
|
||||
|
||||
/* S3C2416 clock controller register offsets */
|
||||
#define LOCKCON0 0x00
|
||||
#define LOCKCON1 0x04
|
||||
#define MPLLCON 0x10
|
||||
#define EPLLCON 0x18
|
||||
#define EPLLCON_K 0x1C
|
||||
#define CLKSRC 0x20
|
||||
#define CLKDIV0 0x24
|
||||
#define CLKDIV1 0x28
|
||||
#define CLKDIV2 0x2C
|
||||
#define HCLKCON 0x30
|
||||
#define PCLKCON 0x34
|
||||
#define SCLKCON 0x38
|
||||
|
||||
/* the soc types */
|
||||
enum supported_socs {
|
||||
S3C2416,
|
||||
S3C2443,
|
||||
S3C2450,
|
||||
};
|
||||
|
||||
/* list of PLLs to be registered */
|
||||
enum s3c2443_plls {
|
||||
mpll, epll,
|
||||
};
|
||||
|
||||
static void __iomem *reg_base;
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static struct samsung_clk_reg_dump *s3c2443_save;
|
||||
|
||||
/*
|
||||
* list of controller registers to be saved and restored during a
|
||||
* suspend/resume cycle.
|
||||
*/
|
||||
static unsigned long s3c2443_clk_regs[] __initdata = {
|
||||
LOCKCON0,
|
||||
LOCKCON1,
|
||||
MPLLCON,
|
||||
EPLLCON,
|
||||
EPLLCON_K,
|
||||
CLKSRC,
|
||||
CLKDIV0,
|
||||
CLKDIV1,
|
||||
CLKDIV2,
|
||||
PCLKCON,
|
||||
HCLKCON,
|
||||
SCLKCON,
|
||||
};
|
||||
|
||||
static int s3c2443_clk_suspend(void)
|
||||
{
|
||||
samsung_clk_save(reg_base, s3c2443_save,
|
||||
ARRAY_SIZE(s3c2443_clk_regs));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void s3c2443_clk_resume(void)
|
||||
{
|
||||
samsung_clk_restore(reg_base, s3c2443_save,
|
||||
ARRAY_SIZE(s3c2443_clk_regs));
|
||||
}
|
||||
|
||||
static struct syscore_ops s3c2443_clk_syscore_ops = {
|
||||
.suspend = s3c2443_clk_suspend,
|
||||
.resume = s3c2443_clk_resume,
|
||||
};
|
||||
|
||||
static void s3c2443_clk_sleep_init(void)
|
||||
{
|
||||
s3c2443_save = samsung_clk_alloc_reg_dump(s3c2443_clk_regs,
|
||||
ARRAY_SIZE(s3c2443_clk_regs));
|
||||
if (!s3c2443_save) {
|
||||
pr_warn("%s: failed to allocate sleep save data, no sleep support!\n",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
|
||||
register_syscore_ops(&s3c2443_clk_syscore_ops);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
static void s3c2443_clk_sleep_init(void) {}
|
||||
#endif
|
||||
|
||||
PNAME(epllref_p) = { "mpllref", "mpllref", "xti", "ext" };
|
||||
PNAME(esysclk_p) = { "epllref", "epll" };
|
||||
PNAME(mpllref_p) = { "xti", "mdivclk" };
|
||||
PNAME(msysclk_p) = { "mpllref", "mpll" };
|
||||
PNAME(armclk_p) = { "armdiv" , "hclk" };
|
||||
PNAME(i2s0_p) = { "div_i2s0", "ext_i2s", "epllref", "epllref" };
|
||||
|
||||
struct samsung_mux_clock s3c2443_common_muxes[] __initdata = {
|
||||
MUX(0, "epllref", epllref_p, CLKSRC, 7, 2),
|
||||
MUX(ESYSCLK, "esysclk", esysclk_p, CLKSRC, 6, 1),
|
||||
MUX(0, "mpllref", mpllref_p, CLKSRC, 3, 1),
|
||||
MUX_A(MSYSCLK, "msysclk", msysclk_p, CLKSRC, 4, 1, "msysclk"),
|
||||
MUX_A(ARMCLK, "armclk", armclk_p, CLKDIV0, 13, 1, "armclk"),
|
||||
MUX(0, "mux_i2s0", i2s0_p, CLKSRC, 14, 2),
|
||||
};
|
||||
|
||||
static struct clk_div_table hclk_d[] = {
|
||||
{ .val = 0, .div = 1 },
|
||||
{ .val = 1, .div = 2 },
|
||||
{ .val = 3, .div = 4 },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
static struct clk_div_table mdivclk_d[] = {
|
||||
{ .val = 0, .div = 1 },
|
||||
{ .val = 1, .div = 3 },
|
||||
{ .val = 2, .div = 5 },
|
||||
{ .val = 3, .div = 7 },
|
||||
{ .val = 4, .div = 9 },
|
||||
{ .val = 5, .div = 11 },
|
||||
{ .val = 6, .div = 13 },
|
||||
{ .val = 7, .div = 15 },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
struct samsung_div_clock s3c2443_common_dividers[] __initdata = {
|
||||
DIV_T(0, "mdivclk", "xti", CLKDIV0, 6, 3, mdivclk_d),
|
||||
DIV(0, "prediv", "msysclk", CLKDIV0, 4, 2),
|
||||
DIV_T(HCLK, "hclk", "prediv", CLKDIV0, 0, 2, hclk_d),
|
||||
DIV(PCLK, "pclk", "hclk", CLKDIV0, 2, 1),
|
||||
DIV(0, "div_hsspi0_epll", "esysclk", CLKDIV1, 24, 2),
|
||||
DIV(0, "div_fimd", "esysclk", CLKDIV1, 16, 8),
|
||||
DIV(0, "div_i2s0", "esysclk", CLKDIV1, 12, 4),
|
||||
DIV(0, "div_uart", "esysclk", CLKDIV1, 8, 4),
|
||||
DIV(0, "div_hsmmc1", "esysclk", CLKDIV1, 6, 2),
|
||||
DIV(0, "div_usbhost", "esysclk", CLKDIV1, 4, 2),
|
||||
};
|
||||
|
||||
struct samsung_gate_clock s3c2443_common_gates[] __initdata = {
|
||||
GATE(SCLK_HSMMC_EXT, "sclk_hsmmcext", "ext", SCLKCON, 13, 0, 0),
|
||||
GATE(SCLK_HSMMC1, "sclk_hsmmc1", "div_hsmmc1", SCLKCON, 12, 0, 0),
|
||||
GATE(SCLK_FIMD, "sclk_fimd", "div_fimd", SCLKCON, 10, 0, 0),
|
||||
GATE(SCLK_I2S0, "sclk_i2s0", "mux_i2s0", SCLKCON, 9, 0, 0),
|
||||
GATE(SCLK_UART, "sclk_uart", "div_uart", SCLKCON, 8, 0, 0),
|
||||
GATE(SCLK_USBH, "sclk_usbhost", "div_usbhost", SCLKCON, 1, 0, 0),
|
||||
GATE(HCLK_DRAM, "dram", "hclk", HCLKCON, 19, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(HCLK_SSMC, "ssmc", "hclk", HCLKCON, 18, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(HCLK_HSMMC1, "hsmmc1", "hclk", HCLKCON, 16, 0, 0),
|
||||
GATE(HCLK_USBD, "usb-device", "hclk", HCLKCON, 12, 0, 0),
|
||||
GATE(HCLK_USBH, "usb-host", "hclk", HCLKCON, 11, 0, 0),
|
||||
GATE(HCLK_LCD, "lcd", "hclk", HCLKCON, 9, 0, 0),
|
||||
GATE(HCLK_DMA5, "dma5", "hclk", HCLKCON, 5, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(HCLK_DMA4, "dma4", "hclk", HCLKCON, 4, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(HCLK_DMA3, "dma3", "hclk", HCLKCON, 3, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(HCLK_DMA2, "dma2", "hclk", HCLKCON, 2, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(HCLK_DMA1, "dma1", "hclk", HCLKCON, 1, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(HCLK_DMA0, "dma0", "hclk", HCLKCON, 0, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(PCLK_GPIO, "gpio", "pclk", PCLKCON, 13, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(PCLK_RTC, "rtc", "pclk", PCLKCON, 12, 0, 0),
|
||||
GATE(PCLK_WDT, "wdt", "pclk", PCLKCON, 11, 0, 0),
|
||||
GATE(PCLK_PWM, "pwm", "pclk", PCLKCON, 10, 0, 0),
|
||||
GATE(PCLK_I2S0, "i2s0", "pclk", PCLKCON, 9, 0, 0),
|
||||
GATE(PCLK_AC97, "ac97", "pclk", PCLKCON, 8, 0, 0),
|
||||
GATE(PCLK_ADC, "adc", "pclk", PCLKCON, 7, 0, 0),
|
||||
GATE(PCLK_SPI0, "spi0", "pclk", PCLKCON, 6, 0, 0),
|
||||
GATE(PCLK_I2C0, "i2c0", "pclk", PCLKCON, 4, 0, 0),
|
||||
GATE(PCLK_UART3, "uart3", "pclk", PCLKCON, 3, 0, 0),
|
||||
GATE(PCLK_UART2, "uart2", "pclk", PCLKCON, 2, 0, 0),
|
||||
GATE(PCLK_UART1, "uart1", "pclk", PCLKCON, 1, 0, 0),
|
||||
GATE(PCLK_UART0, "uart0", "pclk", PCLKCON, 0, 0, 0),
|
||||
};
|
||||
|
||||
struct samsung_clock_alias s3c2443_common_aliases[] __initdata = {
|
||||
ALIAS(HCLK, NULL, "hclk"),
|
||||
ALIAS(HCLK_SSMC, NULL, "nand"),
|
||||
ALIAS(PCLK_UART0, "s3c2440-uart.0", "uart"),
|
||||
ALIAS(PCLK_UART1, "s3c2440-uart.1", "uart"),
|
||||
ALIAS(PCLK_UART2, "s3c2440-uart.2", "uart"),
|
||||
ALIAS(PCLK_UART3, "s3c2440-uart.3", "uart"),
|
||||
ALIAS(PCLK_UART0, "s3c2440-uart.0", "clk_uart_baud2"),
|
||||
ALIAS(PCLK_UART1, "s3c2440-uart.1", "clk_uart_baud2"),
|
||||
ALIAS(PCLK_UART2, "s3c2440-uart.2", "clk_uart_baud2"),
|
||||
ALIAS(PCLK_UART3, "s3c2440-uart.3", "clk_uart_baud2"),
|
||||
ALIAS(SCLK_UART, NULL, "clk_uart_baud3"),
|
||||
ALIAS(PCLK_PWM, NULL, "timers"),
|
||||
ALIAS(PCLK_RTC, NULL, "rtc"),
|
||||
ALIAS(PCLK_WDT, NULL, "watchdog"),
|
||||
ALIAS(PCLK_ADC, NULL, "adc"),
|
||||
ALIAS(PCLK_I2C0, "s3c2410-i2c.0", "i2c"),
|
||||
ALIAS(HCLK_USBD, NULL, "usb-device"),
|
||||
ALIAS(HCLK_USBH, NULL, "usb-host"),
|
||||
ALIAS(SCLK_USBH, NULL, "usb-bus-host"),
|
||||
ALIAS(PCLK_SPI0, "s3c2443-spi.0", "spi"),
|
||||
ALIAS(PCLK_SPI0, "s3c2443-spi.0", "spi_busclk0"),
|
||||
ALIAS(HCLK_HSMMC1, "s3c-sdhci.1", "hsmmc"),
|
||||
ALIAS(HCLK_HSMMC1, "s3c-sdhci.1", "mmc_busclk.0"),
|
||||
ALIAS(PCLK_I2S0, "samsung-i2s.0", "iis"),
|
||||
ALIAS(SCLK_I2S0, NULL, "i2s-if"),
|
||||
ALIAS(HCLK_LCD, NULL, "lcd"),
|
||||
ALIAS(SCLK_FIMD, NULL, "sclk_fimd"),
|
||||
};
|
||||
|
||||
/* S3C2416 specific clocks */
|
||||
|
||||
static struct samsung_pll_clock s3c2416_pll_clks[] __initdata = {
|
||||
[mpll] = PLL(pll_6552_s3c2416, 0, "mpll", "mpllref",
|
||||
LOCKCON0, MPLLCON, NULL),
|
||||
[epll] = PLL(pll_6553, 0, "epll", "epllref",
|
||||
LOCKCON1, EPLLCON, NULL),
|
||||
};
|
||||
|
||||
PNAME(s3c2416_hsmmc0_p) = { "sclk_hsmmc0", "sclk_hsmmcext" };
|
||||
PNAME(s3c2416_hsmmc1_p) = { "sclk_hsmmc1", "sclk_hsmmcext" };
|
||||
PNAME(s3c2416_hsspi0_p) = { "hsspi0_epll", "hsspi0_mpll" };
|
||||
|
||||
static struct clk_div_table armdiv_s3c2416_d[] = {
|
||||
{ .val = 0, .div = 1 },
|
||||
{ .val = 1, .div = 2 },
|
||||
{ .val = 2, .div = 3 },
|
||||
{ .val = 3, .div = 4 },
|
||||
{ .val = 5, .div = 6 },
|
||||
{ .val = 7, .div = 8 },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
struct samsung_div_clock s3c2416_dividers[] __initdata = {
|
||||
DIV_T(ARMDIV, "armdiv", "msysclk", CLKDIV0, 9, 3, armdiv_s3c2416_d),
|
||||
DIV(0, "div_hsspi0_mpll", "msysclk", CLKDIV2, 0, 4),
|
||||
DIV(0, "div_hsmmc0", "esysclk", CLKDIV2, 6, 2),
|
||||
};
|
||||
|
||||
struct samsung_mux_clock s3c2416_muxes[] __initdata = {
|
||||
MUX(MUX_HSMMC0, "mux_hsmmc0", s3c2416_hsmmc0_p, CLKSRC, 16, 1),
|
||||
MUX(MUX_HSMMC1, "mux_hsmmc1", s3c2416_hsmmc1_p, CLKSRC, 17, 1),
|
||||
MUX(MUX_HSSPI0, "mux_hsspi0", s3c2416_hsspi0_p, CLKSRC, 18, 1),
|
||||
};
|
||||
|
||||
struct samsung_gate_clock s3c2416_gates[] __initdata = {
|
||||
GATE(0, "hsspi0_mpll", "div_hsspi0_mpll", SCLKCON, 19, 0, 0),
|
||||
GATE(0, "hsspi0_epll", "div_hsspi0_epll", SCLKCON, 14, 0, 0),
|
||||
GATE(0, "sclk_hsmmc0", "div_hsmmc0", SCLKCON, 6, 0, 0),
|
||||
GATE(HCLK_2D, "2d", "hclk", HCLKCON, 20, 0, 0),
|
||||
GATE(HCLK_HSMMC0, "hsmmc0", "hclk", HCLKCON, 15, 0, 0),
|
||||
GATE(HCLK_IROM, "irom", "hclk", HCLKCON, 13, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(PCLK_PCM, "pcm", "pclk", PCLKCON, 19, 0, 0),
|
||||
};
|
||||
|
||||
struct samsung_clock_alias s3c2416_aliases[] __initdata = {
|
||||
ALIAS(HCLK_HSMMC0, "s3c-sdhci.0", "hsmmc"),
|
||||
ALIAS(HCLK_HSMMC0, "s3c-sdhci.0", "mmc_busclk.0"),
|
||||
ALIAS(MUX_HSMMC0, "s3c-sdhci.0", "mmc_busclk.2"),
|
||||
ALIAS(MUX_HSMMC1, "s3c-sdhci.1", "mmc_busclk.2"),
|
||||
ALIAS(MUX_HSSPI0, "s3c2443-spi.0", "spi_busclk2"),
|
||||
ALIAS(ARMDIV, NULL, "armdiv"),
|
||||
};
|
||||
|
||||
/* S3C2443 specific clocks */
|
||||
|
||||
static struct samsung_pll_clock s3c2443_pll_clks[] __initdata = {
|
||||
[mpll] = PLL(pll_3000, 0, "mpll", "mpllref",
|
||||
LOCKCON0, MPLLCON, NULL),
|
||||
[epll] = PLL(pll_2126, 0, "epll", "epllref",
|
||||
LOCKCON1, EPLLCON, NULL),
|
||||
};
|
||||
|
||||
static struct clk_div_table armdiv_s3c2443_d[] = {
|
||||
{ .val = 0, .div = 1 },
|
||||
{ .val = 8, .div = 2 },
|
||||
{ .val = 2, .div = 3 },
|
||||
{ .val = 9, .div = 4 },
|
||||
{ .val = 10, .div = 6 },
|
||||
{ .val = 11, .div = 8 },
|
||||
{ .val = 13, .div = 12 },
|
||||
{ .val = 15, .div = 16 },
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
|
||||
struct samsung_div_clock s3c2443_dividers[] __initdata = {
|
||||
DIV_T(ARMDIV, "armdiv", "msysclk", CLKDIV0, 9, 4, armdiv_s3c2443_d),
|
||||
DIV(0, "div_cam", "esysclk", CLKDIV1, 26, 4),
|
||||
};
|
||||
|
||||
struct samsung_gate_clock s3c2443_gates[] __initdata = {
|
||||
GATE(SCLK_HSSPI0, "sclk_hsspi0", "div_hsspi0_epll", SCLKCON, 14, 0, 0),
|
||||
GATE(SCLK_CAM, "sclk_cam", "div_cam", SCLKCON, 11, 0, 0),
|
||||
GATE(HCLK_CFC, "cfc", "hclk", HCLKCON, 17, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(HCLK_CAM, "cam", "hclk", HCLKCON, 8, 0, 0),
|
||||
GATE(PCLK_SPI1, "spi1", "pclk", PCLKCON, 15, 0, 0),
|
||||
GATE(PCLK_SDI, "sdi", "pclk", PCLKCON, 5, 0, 0),
|
||||
};
|
||||
|
||||
struct samsung_clock_alias s3c2443_aliases[] __initdata = {
|
||||
ALIAS(SCLK_HSSPI0, "s3c2443-spi.0", "spi_busclk2"),
|
||||
ALIAS(SCLK_HSMMC1, "s3c-sdhci.1", "mmc_busclk.2"),
|
||||
ALIAS(SCLK_CAM, NULL, "camif-upll"),
|
||||
ALIAS(PCLK_SPI1, "s3c2410-spi.0", "spi"),
|
||||
ALIAS(PCLK_SDI, NULL, "sdi"),
|
||||
ALIAS(HCLK_CFC, NULL, "cfc"),
|
||||
ALIAS(ARMDIV, NULL, "armdiv"),
|
||||
};
|
||||
|
||||
/* S3C2450 specific clocks */
|
||||
|
||||
PNAME(s3c2450_cam_p) = { "div_cam", "hclk" };
|
||||
PNAME(s3c2450_hsspi1_p) = { "hsspi1_epll", "hsspi1_mpll" };
|
||||
PNAME(i2s1_p) = { "div_i2s1", "ext_i2s", "epllref", "epllref" };
|
||||
|
||||
struct samsung_div_clock s3c2450_dividers[] __initdata = {
|
||||
DIV(0, "div_cam", "esysclk", CLKDIV1, 26, 4),
|
||||
DIV(0, "div_hsspi1_epll", "esysclk", CLKDIV2, 24, 2),
|
||||
DIV(0, "div_hsspi1_mpll", "msysclk", CLKDIV2, 16, 4),
|
||||
DIV(0, "div_i2s1", "esysclk", CLKDIV2, 12, 4),
|
||||
};
|
||||
|
||||
struct samsung_mux_clock s3c2450_muxes[] __initdata = {
|
||||
MUX(0, "mux_cam", s3c2450_cam_p, CLKSRC, 20, 1),
|
||||
MUX(MUX_HSSPI1, "mux_hsspi1", s3c2450_hsspi1_p, CLKSRC, 19, 1),
|
||||
MUX(0, "mux_i2s1", i2s1_p, CLKSRC, 12, 2),
|
||||
};
|
||||
|
||||
struct samsung_gate_clock s3c2450_gates[] __initdata = {
|
||||
GATE(SCLK_I2S1, "sclk_i2s1", "div_i2s1", SCLKCON, 5, 0, 0),
|
||||
GATE(HCLK_CFC, "cfc", "hclk", HCLKCON, 17, 0, 0),
|
||||
GATE(HCLK_CAM, "cam", "hclk", HCLKCON, 8, 0, 0),
|
||||
GATE(HCLK_DMA7, "dma7", "hclk", HCLKCON, 7, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(HCLK_DMA6, "dma6", "hclk", HCLKCON, 6, CLK_IGNORE_UNUSED, 0),
|
||||
GATE(PCLK_I2S1, "i2s1", "pclk", PCLKCON, 17, 0, 0),
|
||||
GATE(PCLK_I2C1, "i2c1", "pclk", PCLKCON, 16, 0, 0),
|
||||
GATE(PCLK_SPI1, "spi1", "pclk", PCLKCON, 14, 0, 0),
|
||||
};
|
||||
|
||||
struct samsung_clock_alias s3c2450_aliases[] __initdata = {
|
||||
ALIAS(PCLK_SPI1, "s3c2443-spi.1", "spi"),
|
||||
ALIAS(PCLK_SPI1, "s3c2443-spi.1", "spi_busclk0"),
|
||||
ALIAS(MUX_HSSPI1, "s3c2443-spi.1", "spi_busclk2"),
|
||||
ALIAS(PCLK_I2C1, "s3c2410-i2c.1", "i2c"),
|
||||
};
|
||||
|
||||
/*
|
||||
* fixed rate clocks generated outside the soc
|
||||
* Only necessary until the devicetree-move is complete
|
||||
*/
|
||||
struct samsung_fixed_rate_clock s3c2443_common_frate_clks[] __initdata = {
|
||||
FRATE(0, "xti", NULL, CLK_IS_ROOT, 0),
|
||||
FRATE(0, "ext", NULL, CLK_IS_ROOT, 0),
|
||||
FRATE(0, "ext_i2s", NULL, CLK_IS_ROOT, 0),
|
||||
FRATE(0, "ext_uart", NULL, CLK_IS_ROOT, 0),
|
||||
};
|
||||
|
||||
static void __init s3c2443_common_clk_register_fixed_ext(
|
||||
struct samsung_clk_provider *ctx, unsigned long xti_f)
|
||||
{
|
||||
s3c2443_common_frate_clks[0].fixed_rate = xti_f;
|
||||
samsung_clk_register_fixed_rate(ctx, s3c2443_common_frate_clks,
|
||||
ARRAY_SIZE(s3c2443_common_frate_clks));
|
||||
}
|
||||
|
||||
void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f,
|
||||
int current_soc,
|
||||
void __iomem *base)
|
||||
{
|
||||
struct samsung_clk_provider *ctx;
|
||||
reg_base = base;
|
||||
|
||||
if (np) {
|
||||
reg_base = of_iomap(np, 0);
|
||||
if (!reg_base)
|
||||
panic("%s: failed to map registers\n", __func__);
|
||||
}
|
||||
|
||||
ctx = samsung_clk_init(np, reg_base, NR_CLKS);
|
||||
if (!ctx)
|
||||
panic("%s: unable to allocate context.\n", __func__);
|
||||
|
||||
/* Register external clocks only in non-dt cases */
|
||||
if (!np)
|
||||
s3c2443_common_clk_register_fixed_ext(ctx, xti_f);
|
||||
|
||||
/* Register PLLs. */
|
||||
if (current_soc == S3C2416 || current_soc == S3C2450)
|
||||
samsung_clk_register_pll(ctx, s3c2416_pll_clks,
|
||||
ARRAY_SIZE(s3c2416_pll_clks), reg_base);
|
||||
else
|
||||
samsung_clk_register_pll(ctx, s3c2443_pll_clks,
|
||||
ARRAY_SIZE(s3c2443_pll_clks), reg_base);
|
||||
|
||||
/* Register common internal clocks. */
|
||||
samsung_clk_register_mux(ctx, s3c2443_common_muxes,
|
||||
ARRAY_SIZE(s3c2443_common_muxes));
|
||||
samsung_clk_register_div(ctx, s3c2443_common_dividers,
|
||||
ARRAY_SIZE(s3c2443_common_dividers));
|
||||
samsung_clk_register_gate(ctx, s3c2443_common_gates,
|
||||
ARRAY_SIZE(s3c2443_common_gates));
|
||||
samsung_clk_register_alias(ctx, s3c2443_common_aliases,
|
||||
ARRAY_SIZE(s3c2443_common_aliases));
|
||||
|
||||
/* Register SoC-specific clocks. */
|
||||
switch (current_soc) {
|
||||
case S3C2450:
|
||||
samsung_clk_register_div(ctx, s3c2450_dividers,
|
||||
ARRAY_SIZE(s3c2450_dividers));
|
||||
samsung_clk_register_mux(ctx, s3c2450_muxes,
|
||||
ARRAY_SIZE(s3c2450_muxes));
|
||||
samsung_clk_register_gate(ctx, s3c2450_gates,
|
||||
ARRAY_SIZE(s3c2450_gates));
|
||||
samsung_clk_register_alias(ctx, s3c2450_aliases,
|
||||
ARRAY_SIZE(s3c2450_aliases));
|
||||
/* fall through, as s3c2450 extends the s3c2416 clocks */
|
||||
case S3C2416:
|
||||
samsung_clk_register_div(ctx, s3c2416_dividers,
|
||||
ARRAY_SIZE(s3c2416_dividers));
|
||||
samsung_clk_register_mux(ctx, s3c2416_muxes,
|
||||
ARRAY_SIZE(s3c2416_muxes));
|
||||
samsung_clk_register_gate(ctx, s3c2416_gates,
|
||||
ARRAY_SIZE(s3c2416_gates));
|
||||
samsung_clk_register_alias(ctx, s3c2416_aliases,
|
||||
ARRAY_SIZE(s3c2416_aliases));
|
||||
break;
|
||||
case S3C2443:
|
||||
samsung_clk_register_div(ctx, s3c2443_dividers,
|
||||
ARRAY_SIZE(s3c2443_dividers));
|
||||
samsung_clk_register_gate(ctx, s3c2443_gates,
|
||||
ARRAY_SIZE(s3c2443_gates));
|
||||
samsung_clk_register_alias(ctx, s3c2443_aliases,
|
||||
ARRAY_SIZE(s3c2443_aliases));
|
||||
break;
|
||||
}
|
||||
|
||||
s3c2443_clk_sleep_init();
|
||||
}
|
||||
|
||||
static void __init s3c2416_clk_init(struct device_node *np)
|
||||
{
|
||||
s3c2443_common_clk_init(np, 0, S3C2416, 0);
|
||||
}
|
||||
CLK_OF_DECLARE(s3c2416_clk, "samsung,s3c2416-clock", s3c2416_clk_init);
|
||||
|
||||
static void __init s3c2443_clk_init(struct device_node *np)
|
||||
{
|
||||
s3c2443_common_clk_init(np, 0, S3C2443, 0);
|
||||
}
|
||||
CLK_OF_DECLARE(s3c2443_clk, "samsung,s3c2443-clock", s3c2443_clk_init);
|
||||
|
||||
static void __init s3c2450_clk_init(struct device_node *np)
|
||||
{
|
||||
s3c2443_common_clk_init(np, 0, S3C2450, 0);
|
||||
}
|
||||
CLK_OF_DECLARE(s3c2450_clk, "samsung,s3c2450-clock", s3c2450_clk_init);
|
@ -442,12 +442,14 @@ static struct samsung_clock_alias s3c6410_clock_aliases[] = {
|
||||
ALIAS(MEM0_SROM, NULL, "srom"),
|
||||
};
|
||||
|
||||
static void __init s3c64xx_clk_register_fixed_ext(unsigned long fin_pll_f,
|
||||
unsigned long xusbxti_f)
|
||||
static void __init s3c64xx_clk_register_fixed_ext(
|
||||
struct samsung_clk_provider *ctx,
|
||||
unsigned long fin_pll_f,
|
||||
unsigned long xusbxti_f)
|
||||
{
|
||||
s3c64xx_fixed_rate_ext_clks[0].fixed_rate = fin_pll_f;
|
||||
s3c64xx_fixed_rate_ext_clks[1].fixed_rate = xusbxti_f;
|
||||
samsung_clk_register_fixed_rate(s3c64xx_fixed_rate_ext_clks,
|
||||
samsung_clk_register_fixed_rate(ctx, s3c64xx_fixed_rate_ext_clks,
|
||||
ARRAY_SIZE(s3c64xx_fixed_rate_ext_clks));
|
||||
}
|
||||
|
||||
@ -456,6 +458,8 @@ void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
|
||||
unsigned long xusbxti_f, bool s3c6400,
|
||||
void __iomem *base)
|
||||
{
|
||||
struct samsung_clk_provider *ctx;
|
||||
|
||||
reg_base = base;
|
||||
is_s3c6400 = s3c6400;
|
||||
|
||||
@ -465,48 +469,50 @@ void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
|
||||
panic("%s: failed to map registers\n", __func__);
|
||||
}
|
||||
|
||||
samsung_clk_init(np, reg_base, NR_CLKS);
|
||||
ctx = samsung_clk_init(np, reg_base, NR_CLKS);
|
||||
if (!ctx)
|
||||
panic("%s: unable to allocate context.\n", __func__);
|
||||
|
||||
/* Register external clocks. */
|
||||
if (!np)
|
||||
s3c64xx_clk_register_fixed_ext(xtal_f, xusbxti_f);
|
||||
s3c64xx_clk_register_fixed_ext(ctx, xtal_f, xusbxti_f);
|
||||
|
||||
/* Register PLLs. */
|
||||
samsung_clk_register_pll(s3c64xx_pll_clks,
|
||||
samsung_clk_register_pll(ctx, s3c64xx_pll_clks,
|
||||
ARRAY_SIZE(s3c64xx_pll_clks), reg_base);
|
||||
|
||||
/* Register common internal clocks. */
|
||||
samsung_clk_register_fixed_rate(s3c64xx_fixed_rate_clks,
|
||||
samsung_clk_register_fixed_rate(ctx, s3c64xx_fixed_rate_clks,
|
||||
ARRAY_SIZE(s3c64xx_fixed_rate_clks));
|
||||
samsung_clk_register_mux(s3c64xx_mux_clks,
|
||||
samsung_clk_register_mux(ctx, s3c64xx_mux_clks,
|
||||
ARRAY_SIZE(s3c64xx_mux_clks));
|
||||
samsung_clk_register_div(s3c64xx_div_clks,
|
||||
samsung_clk_register_div(ctx, s3c64xx_div_clks,
|
||||
ARRAY_SIZE(s3c64xx_div_clks));
|
||||
samsung_clk_register_gate(s3c64xx_gate_clks,
|
||||
samsung_clk_register_gate(ctx, s3c64xx_gate_clks,
|
||||
ARRAY_SIZE(s3c64xx_gate_clks));
|
||||
|
||||
/* Register SoC-specific clocks. */
|
||||
if (is_s3c6400) {
|
||||
samsung_clk_register_mux(s3c6400_mux_clks,
|
||||
samsung_clk_register_mux(ctx, s3c6400_mux_clks,
|
||||
ARRAY_SIZE(s3c6400_mux_clks));
|
||||
samsung_clk_register_div(s3c6400_div_clks,
|
||||
samsung_clk_register_div(ctx, s3c6400_div_clks,
|
||||
ARRAY_SIZE(s3c6400_div_clks));
|
||||
samsung_clk_register_gate(s3c6400_gate_clks,
|
||||
samsung_clk_register_gate(ctx, s3c6400_gate_clks,
|
||||
ARRAY_SIZE(s3c6400_gate_clks));
|
||||
samsung_clk_register_alias(s3c6400_clock_aliases,
|
||||
samsung_clk_register_alias(ctx, s3c6400_clock_aliases,
|
||||
ARRAY_SIZE(s3c6400_clock_aliases));
|
||||
} else {
|
||||
samsung_clk_register_mux(s3c6410_mux_clks,
|
||||
samsung_clk_register_mux(ctx, s3c6410_mux_clks,
|
||||
ARRAY_SIZE(s3c6410_mux_clks));
|
||||
samsung_clk_register_div(s3c6410_div_clks,
|
||||
samsung_clk_register_div(ctx, s3c6410_div_clks,
|
||||
ARRAY_SIZE(s3c6410_div_clks));
|
||||
samsung_clk_register_gate(s3c6410_gate_clks,
|
||||
samsung_clk_register_gate(ctx, s3c6410_gate_clks,
|
||||
ARRAY_SIZE(s3c6410_gate_clks));
|
||||
samsung_clk_register_alias(s3c6410_clock_aliases,
|
||||
samsung_clk_register_alias(ctx, s3c6410_clock_aliases,
|
||||
ARRAY_SIZE(s3c6410_clock_aliases));
|
||||
}
|
||||
|
||||
samsung_clk_register_alias(s3c64xx_clock_aliases,
|
||||
samsung_clk_register_alias(ctx, s3c64xx_clock_aliases,
|
||||
ARRAY_SIZE(s3c64xx_clock_aliases));
|
||||
s3c64xx_clk_sleep_init();
|
||||
|
||||
|
@ -14,13 +14,6 @@
|
||||
#include <linux/syscore_ops.h>
|
||||
#include "clk.h"
|
||||
|
||||
static DEFINE_SPINLOCK(lock);
|
||||
static struct clk **clk_table;
|
||||
static void __iomem *reg_base;
|
||||
#ifdef CONFIG_OF
|
||||
static struct clk_onecell_data clk_data;
|
||||
#endif
|
||||
|
||||
void samsung_clk_save(void __iomem *base,
|
||||
struct samsung_clk_reg_dump *rd,
|
||||
unsigned int num_regs)
|
||||
@ -55,40 +48,58 @@ struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump(
|
||||
}
|
||||
|
||||
/* setup the essentials required to support clock lookup using ccf */
|
||||
void __init samsung_clk_init(struct device_node *np, void __iomem *base,
|
||||
unsigned long nr_clks)
|
||||
struct samsung_clk_provider *__init samsung_clk_init(struct device_node *np,
|
||||
void __iomem *base, unsigned long nr_clks)
|
||||
{
|
||||
reg_base = base;
|
||||
struct samsung_clk_provider *ctx;
|
||||
struct clk **clk_table;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
clk_table = kzalloc(sizeof(struct clk *) * nr_clks, GFP_KERNEL);
|
||||
ctx = kzalloc(sizeof(struct samsung_clk_provider), GFP_KERNEL);
|
||||
if (!ctx)
|
||||
panic("could not allocate clock provider context.\n");
|
||||
|
||||
clk_table = kcalloc(nr_clks, sizeof(struct clk *), GFP_KERNEL);
|
||||
if (!clk_table)
|
||||
panic("could not allocate clock lookup table\n");
|
||||
|
||||
if (!np)
|
||||
return;
|
||||
for (i = 0; i < nr_clks; ++i)
|
||||
clk_table[i] = ERR_PTR(-ENOENT);
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
clk_data.clks = clk_table;
|
||||
clk_data.clk_num = nr_clks;
|
||||
of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
|
||||
#endif
|
||||
ctx->reg_base = base;
|
||||
ctx->clk_data.clks = clk_table;
|
||||
ctx->clk_data.clk_num = nr_clks;
|
||||
spin_lock_init(&ctx->lock);
|
||||
|
||||
if (!np)
|
||||
return ctx;
|
||||
|
||||
ret = of_clk_add_provider(np, of_clk_src_onecell_get,
|
||||
&ctx->clk_data);
|
||||
if (ret)
|
||||
panic("could not register clock provide\n");
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
/* add a clock instance to the clock lookup table used for dt based lookup */
|
||||
void samsung_clk_add_lookup(struct clk *clk, unsigned int id)
|
||||
void samsung_clk_add_lookup(struct samsung_clk_provider *ctx, struct clk *clk,
|
||||
unsigned int id)
|
||||
{
|
||||
if (clk_table && id)
|
||||
clk_table[id] = clk;
|
||||
if (ctx->clk_data.clks && id)
|
||||
ctx->clk_data.clks[id] = clk;
|
||||
}
|
||||
|
||||
/* register a list of aliases */
|
||||
void __init samsung_clk_register_alias(struct samsung_clock_alias *list,
|
||||
unsigned int nr_clk)
|
||||
void __init samsung_clk_register_alias(struct samsung_clk_provider *ctx,
|
||||
struct samsung_clock_alias *list,
|
||||
unsigned int nr_clk)
|
||||
{
|
||||
struct clk *clk;
|
||||
unsigned int idx, ret;
|
||||
|
||||
if (!clk_table) {
|
||||
if (!ctx->clk_data.clks) {
|
||||
pr_err("%s: clock table missing\n", __func__);
|
||||
return;
|
||||
}
|
||||
@ -100,7 +111,7 @@ void __init samsung_clk_register_alias(struct samsung_clock_alias *list,
|
||||
continue;
|
||||
}
|
||||
|
||||
clk = clk_table[list->id];
|
||||
clk = ctx->clk_data.clks[list->id];
|
||||
if (!clk) {
|
||||
pr_err("%s: failed to find clock %d\n", __func__,
|
||||
list->id);
|
||||
@ -115,7 +126,7 @@ void __init samsung_clk_register_alias(struct samsung_clock_alias *list,
|
||||
}
|
||||
|
||||
/* register a list of fixed clocks */
|
||||
void __init samsung_clk_register_fixed_rate(
|
||||
void __init samsung_clk_register_fixed_rate(struct samsung_clk_provider *ctx,
|
||||
struct samsung_fixed_rate_clock *list, unsigned int nr_clk)
|
||||
{
|
||||
struct clk *clk;
|
||||
@ -130,7 +141,7 @@ void __init samsung_clk_register_fixed_rate(
|
||||
continue;
|
||||
}
|
||||
|
||||
samsung_clk_add_lookup(clk, list->id);
|
||||
samsung_clk_add_lookup(ctx, clk, list->id);
|
||||
|
||||
/*
|
||||
* Unconditionally add a clock lookup for the fixed rate clocks.
|
||||
@ -144,7 +155,7 @@ void __init samsung_clk_register_fixed_rate(
|
||||
}
|
||||
|
||||
/* register a list of fixed factor clocks */
|
||||
void __init samsung_clk_register_fixed_factor(
|
||||
void __init samsung_clk_register_fixed_factor(struct samsung_clk_provider *ctx,
|
||||
struct samsung_fixed_factor_clock *list, unsigned int nr_clk)
|
||||
{
|
||||
struct clk *clk;
|
||||
@ -159,28 +170,30 @@ void __init samsung_clk_register_fixed_factor(
|
||||
continue;
|
||||
}
|
||||
|
||||
samsung_clk_add_lookup(clk, list->id);
|
||||
samsung_clk_add_lookup(ctx, clk, list->id);
|
||||
}
|
||||
}
|
||||
|
||||
/* register a list of mux clocks */
|
||||
void __init samsung_clk_register_mux(struct samsung_mux_clock *list,
|
||||
unsigned int nr_clk)
|
||||
void __init samsung_clk_register_mux(struct samsung_clk_provider *ctx,
|
||||
struct samsung_mux_clock *list,
|
||||
unsigned int nr_clk)
|
||||
{
|
||||
struct clk *clk;
|
||||
unsigned int idx, ret;
|
||||
|
||||
for (idx = 0; idx < nr_clk; idx++, list++) {
|
||||
clk = clk_register_mux(NULL, list->name, list->parent_names,
|
||||
list->num_parents, list->flags, reg_base + list->offset,
|
||||
list->shift, list->width, list->mux_flags, &lock);
|
||||
list->num_parents, list->flags,
|
||||
ctx->reg_base + list->offset,
|
||||
list->shift, list->width, list->mux_flags, &ctx->lock);
|
||||
if (IS_ERR(clk)) {
|
||||
pr_err("%s: failed to register clock %s\n", __func__,
|
||||
list->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
samsung_clk_add_lookup(clk, list->id);
|
||||
samsung_clk_add_lookup(ctx, clk, list->id);
|
||||
|
||||
/* register a clock lookup only if a clock alias is specified */
|
||||
if (list->alias) {
|
||||
@ -194,8 +207,9 @@ void __init samsung_clk_register_mux(struct samsung_mux_clock *list,
|
||||
}
|
||||
|
||||
/* register a list of div clocks */
|
||||
void __init samsung_clk_register_div(struct samsung_div_clock *list,
|
||||
unsigned int nr_clk)
|
||||
void __init samsung_clk_register_div(struct samsung_clk_provider *ctx,
|
||||
struct samsung_div_clock *list,
|
||||
unsigned int nr_clk)
|
||||
{
|
||||
struct clk *clk;
|
||||
unsigned int idx, ret;
|
||||
@ -203,22 +217,22 @@ void __init samsung_clk_register_div(struct samsung_div_clock *list,
|
||||
for (idx = 0; idx < nr_clk; idx++, list++) {
|
||||
if (list->table)
|
||||
clk = clk_register_divider_table(NULL, list->name,
|
||||
list->parent_name, list->flags,
|
||||
reg_base + list->offset, list->shift,
|
||||
list->width, list->div_flags,
|
||||
list->table, &lock);
|
||||
list->parent_name, list->flags,
|
||||
ctx->reg_base + list->offset,
|
||||
list->shift, list->width, list->div_flags,
|
||||
list->table, &ctx->lock);
|
||||
else
|
||||
clk = clk_register_divider(NULL, list->name,
|
||||
list->parent_name, list->flags,
|
||||
reg_base + list->offset, list->shift,
|
||||
list->width, list->div_flags, &lock);
|
||||
list->parent_name, list->flags,
|
||||
ctx->reg_base + list->offset, list->shift,
|
||||
list->width, list->div_flags, &ctx->lock);
|
||||
if (IS_ERR(clk)) {
|
||||
pr_err("%s: failed to register clock %s\n", __func__,
|
||||
list->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
samsung_clk_add_lookup(clk, list->id);
|
||||
samsung_clk_add_lookup(ctx, clk, list->id);
|
||||
|
||||
/* register a clock lookup only if a clock alias is specified */
|
||||
if (list->alias) {
|
||||
@ -232,16 +246,17 @@ void __init samsung_clk_register_div(struct samsung_div_clock *list,
|
||||
}
|
||||
|
||||
/* register a list of gate clocks */
|
||||
void __init samsung_clk_register_gate(struct samsung_gate_clock *list,
|
||||
unsigned int nr_clk)
|
||||
void __init samsung_clk_register_gate(struct samsung_clk_provider *ctx,
|
||||
struct samsung_gate_clock *list,
|
||||
unsigned int nr_clk)
|
||||
{
|
||||
struct clk *clk;
|
||||
unsigned int idx, ret;
|
||||
|
||||
for (idx = 0; idx < nr_clk; idx++, list++) {
|
||||
clk = clk_register_gate(NULL, list->name, list->parent_name,
|
||||
list->flags, reg_base + list->offset,
|
||||
list->bit_idx, list->gate_flags, &lock);
|
||||
list->flags, ctx->reg_base + list->offset,
|
||||
list->bit_idx, list->gate_flags, &ctx->lock);
|
||||
if (IS_ERR(clk)) {
|
||||
pr_err("%s: failed to register clock %s\n", __func__,
|
||||
list->name);
|
||||
@ -257,7 +272,7 @@ void __init samsung_clk_register_gate(struct samsung_gate_clock *list,
|
||||
__func__, list->alias);
|
||||
}
|
||||
|
||||
samsung_clk_add_lookup(clk, list->id);
|
||||
samsung_clk_add_lookup(ctx, clk, list->id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,21 +281,21 @@ void __init samsung_clk_register_gate(struct samsung_gate_clock *list,
|
||||
* tree and register it
|
||||
*/
|
||||
#ifdef CONFIG_OF
|
||||
void __init samsung_clk_of_register_fixed_ext(
|
||||
void __init samsung_clk_of_register_fixed_ext(struct samsung_clk_provider *ctx,
|
||||
struct samsung_fixed_rate_clock *fixed_rate_clk,
|
||||
unsigned int nr_fixed_rate_clk,
|
||||
struct of_device_id *clk_matches)
|
||||
{
|
||||
const struct of_device_id *match;
|
||||
struct device_node *np;
|
||||
struct device_node *clk_np;
|
||||
u32 freq;
|
||||
|
||||
for_each_matching_node_and_match(np, clk_matches, &match) {
|
||||
if (of_property_read_u32(np, "clock-frequency", &freq))
|
||||
for_each_matching_node_and_match(clk_np, clk_matches, &match) {
|
||||
if (of_property_read_u32(clk_np, "clock-frequency", &freq))
|
||||
continue;
|
||||
fixed_rate_clk[(u32)match->data].fixed_rate = freq;
|
||||
fixed_rate_clk[(unsigned long)match->data].fixed_rate = freq;
|
||||
}
|
||||
samsung_clk_register_fixed_rate(fixed_rate_clk, nr_fixed_rate_clk);
|
||||
samsung_clk_register_fixed_rate(ctx, fixed_rate_clk, nr_fixed_rate_clk);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -21,6 +21,18 @@
|
||||
#include <linux/of_address.h>
|
||||
#include "clk-pll.h"
|
||||
|
||||
/**
|
||||
* struct samsung_clk_provider: information about clock provider
|
||||
* @reg_base: virtual address for the register base.
|
||||
* @clk_data: holds clock related data like clk* and number of clocks.
|
||||
* @lock: maintains exclusion bwtween callbacks for a given clock-provider.
|
||||
*/
|
||||
struct samsung_clk_provider {
|
||||
void __iomem *reg_base;
|
||||
struct clk_onecell_data clk_data;
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct samsung_clock_alias: information about mux clock
|
||||
* @id: platform specific id of the clock.
|
||||
@ -312,40 +324,52 @@ struct samsung_pll_clock {
|
||||
__PLL(_typ, _id, NULL, _name, _pname, CLK_GET_RATE_NOCACHE, \
|
||||
_lock, _con, _rtable, _alias)
|
||||
|
||||
extern void __init samsung_clk_init(struct device_node *np, void __iomem *base,
|
||||
unsigned long nr_clks);
|
||||
extern struct samsung_clk_provider *__init samsung_clk_init(
|
||||
struct device_node *np, void __iomem *base,
|
||||
unsigned long nr_clks);
|
||||
extern void __init samsung_clk_of_register_fixed_ext(
|
||||
struct samsung_fixed_rate_clock *fixed_rate_clk,
|
||||
unsigned int nr_fixed_rate_clk,
|
||||
struct of_device_id *clk_matches);
|
||||
struct samsung_clk_provider *ctx,
|
||||
struct samsung_fixed_rate_clock *fixed_rate_clk,
|
||||
unsigned int nr_fixed_rate_clk,
|
||||
struct of_device_id *clk_matches);
|
||||
|
||||
extern void samsung_clk_add_lookup(struct clk *clk, unsigned int id);
|
||||
extern void samsung_clk_add_lookup(struct samsung_clk_provider *ctx,
|
||||
struct clk *clk, unsigned int id);
|
||||
|
||||
extern void samsung_clk_register_alias(struct samsung_clock_alias *list,
|
||||
unsigned int nr_clk);
|
||||
extern void samsung_clk_register_alias(struct samsung_clk_provider *ctx,
|
||||
struct samsung_clock_alias *list,
|
||||
unsigned int nr_clk);
|
||||
extern void __init samsung_clk_register_fixed_rate(
|
||||
struct samsung_fixed_rate_clock *clk_list, unsigned int nr_clk);
|
||||
struct samsung_clk_provider *ctx,
|
||||
struct samsung_fixed_rate_clock *clk_list,
|
||||
unsigned int nr_clk);
|
||||
extern void __init samsung_clk_register_fixed_factor(
|
||||
struct samsung_fixed_factor_clock *list, unsigned int nr_clk);
|
||||
extern void __init samsung_clk_register_mux(struct samsung_mux_clock *clk_list,
|
||||
unsigned int nr_clk);
|
||||
extern void __init samsung_clk_register_div(struct samsung_div_clock *clk_list,
|
||||
unsigned int nr_clk);
|
||||
extern void __init samsung_clk_register_gate(
|
||||
struct samsung_gate_clock *clk_list, unsigned int nr_clk);
|
||||
extern void __init samsung_clk_register_pll(struct samsung_pll_clock *pll_list,
|
||||
unsigned int nr_clk, void __iomem *base);
|
||||
struct samsung_clk_provider *ctx,
|
||||
struct samsung_fixed_factor_clock *list,
|
||||
unsigned int nr_clk);
|
||||
extern void __init samsung_clk_register_mux(struct samsung_clk_provider *ctx,
|
||||
struct samsung_mux_clock *clk_list,
|
||||
unsigned int nr_clk);
|
||||
extern void __init samsung_clk_register_div(struct samsung_clk_provider *ctx,
|
||||
struct samsung_div_clock *clk_list,
|
||||
unsigned int nr_clk);
|
||||
extern void __init samsung_clk_register_gate(struct samsung_clk_provider *ctx,
|
||||
struct samsung_gate_clock *clk_list,
|
||||
unsigned int nr_clk);
|
||||
extern void __init samsung_clk_register_pll(struct samsung_clk_provider *ctx,
|
||||
struct samsung_pll_clock *pll_list,
|
||||
unsigned int nr_clk, void __iomem *base);
|
||||
|
||||
extern unsigned long _get_rate(const char *clk_name);
|
||||
|
||||
extern void samsung_clk_save(void __iomem *base,
|
||||
struct samsung_clk_reg_dump *rd,
|
||||
unsigned int num_regs);
|
||||
struct samsung_clk_reg_dump *rd,
|
||||
unsigned int num_regs);
|
||||
extern void samsung_clk_restore(void __iomem *base,
|
||||
const struct samsung_clk_reg_dump *rd,
|
||||
unsigned int num_regs);
|
||||
const struct samsung_clk_reg_dump *rd,
|
||||
unsigned int num_regs);
|
||||
extern struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump(
|
||||
const unsigned long *rdump,
|
||||
unsigned long nr_rdump);
|
||||
const unsigned long *rdump,
|
||||
unsigned long nr_rdump);
|
||||
|
||||
#endif /* __SAMSUNG_CLK_H */
|
||||
|
@ -141,6 +141,7 @@ static int s3c_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg)
|
||||
|
||||
static void s3c_cpufreq_setfvco(struct s3c_cpufreq_config *cfg)
|
||||
{
|
||||
cfg->mpll = _clk_mpll;
|
||||
(cfg->info->set_fvco)(cfg);
|
||||
}
|
||||
|
||||
|
258
include/dt-bindings/clock/exynos3250.h
Normal file
258
include/dt-bindings/clock/exynos3250.h
Normal file
@ -0,0 +1,258 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
|
||||
* Author: Tomasz Figa <t.figa@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Device Tree binding constants for Samsung Exynos3250 clock controllers.
|
||||
*/
|
||||
|
||||
#ifndef _DT_BINDINGS_CLOCK_SAMSUNG_EXYNOS3250_CLOCK_H
|
||||
#define _DT_BINDINGS_CLOCK_SAMSUNG_EXYNOS3250_CLOCK_H
|
||||
|
||||
/*
|
||||
* Let each exported clock get a unique index, which is used on DT-enabled
|
||||
* platforms to lookup the clock from a clock specifier. These indices are
|
||||
* therefore considered an ABI and so must not be changed. This implies
|
||||
* that new clocks should be added either in free spaces between clock groups
|
||||
* or at the end.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Main CMU
|
||||
*/
|
||||
|
||||
#define CLK_OSCSEL 1
|
||||
#define CLK_FIN_PLL 2
|
||||
#define CLK_FOUT_APLL 3
|
||||
#define CLK_FOUT_VPLL 4
|
||||
#define CLK_FOUT_UPLL 5
|
||||
#define CLK_FOUT_MPLL 6
|
||||
|
||||
/* Muxes */
|
||||
#define CLK_MOUT_MPLL_USER_L 16
|
||||
#define CLK_MOUT_GDL 17
|
||||
#define CLK_MOUT_MPLL_USER_R 18
|
||||
#define CLK_MOUT_GDR 19
|
||||
#define CLK_MOUT_EBI 20
|
||||
#define CLK_MOUT_ACLK_200 21
|
||||
#define CLK_MOUT_ACLK_160 22
|
||||
#define CLK_MOUT_ACLK_100 23
|
||||
#define CLK_MOUT_ACLK_266_1 24
|
||||
#define CLK_MOUT_ACLK_266_0 25
|
||||
#define CLK_MOUT_ACLK_266 26
|
||||
#define CLK_MOUT_VPLL 27
|
||||
#define CLK_MOUT_EPLL_USER 28
|
||||
#define CLK_MOUT_EBI_1 29
|
||||
#define CLK_MOUT_UPLL 30
|
||||
#define CLK_MOUT_ACLK_400_MCUISP_SUB 31
|
||||
#define CLK_MOUT_MPLL 32
|
||||
#define CLK_MOUT_ACLK_400_MCUISP 33
|
||||
#define CLK_MOUT_VPLLSRC 34
|
||||
#define CLK_MOUT_CAM1 35
|
||||
#define CLK_MOUT_CAM_BLK 36
|
||||
#define CLK_MOUT_MFC 37
|
||||
#define CLK_MOUT_MFC_1 38
|
||||
#define CLK_MOUT_MFC_0 39
|
||||
#define CLK_MOUT_G3D 40
|
||||
#define CLK_MOUT_G3D_1 41
|
||||
#define CLK_MOUT_G3D_0 42
|
||||
#define CLK_MOUT_MIPI0 43
|
||||
#define CLK_MOUT_FIMD0 44
|
||||
#define CLK_MOUT_UART_ISP 45
|
||||
#define CLK_MOUT_SPI1_ISP 46
|
||||
#define CLK_MOUT_SPI0_ISP 47
|
||||
#define CLK_MOUT_TSADC 48
|
||||
#define CLK_MOUT_MMC1 49
|
||||
#define CLK_MOUT_MMC0 50
|
||||
#define CLK_MOUT_UART1 51
|
||||
#define CLK_MOUT_UART0 52
|
||||
#define CLK_MOUT_SPI1 53
|
||||
#define CLK_MOUT_SPI0 54
|
||||
#define CLK_MOUT_AUDIO 55
|
||||
#define CLK_MOUT_MPLL_USER_C 56
|
||||
#define CLK_MOUT_HPM 57
|
||||
#define CLK_MOUT_CORE 58
|
||||
#define CLK_MOUT_APLL 59
|
||||
#define CLK_MOUT_ACLK_266_SUB 60
|
||||
|
||||
/* Dividers */
|
||||
#define CLK_DIV_GPL 64
|
||||
#define CLK_DIV_GDL 65
|
||||
#define CLK_DIV_GPR 66
|
||||
#define CLK_DIV_GDR 67
|
||||
#define CLK_DIV_MPLL_PRE 68
|
||||
#define CLK_DIV_ACLK_400_MCUISP 69
|
||||
#define CLK_DIV_EBI 70
|
||||
#define CLK_DIV_ACLK_200 71
|
||||
#define CLK_DIV_ACLK_160 72
|
||||
#define CLK_DIV_ACLK_100 73
|
||||
#define CLK_DIV_ACLK_266 74
|
||||
#define CLK_DIV_CAM1 75
|
||||
#define CLK_DIV_CAM_BLK 76
|
||||
#define CLK_DIV_MFC 77
|
||||
#define CLK_DIV_G3D 78
|
||||
#define CLK_DIV_MIPI0_PRE 79
|
||||
#define CLK_DIV_MIPI0 80
|
||||
#define CLK_DIV_FIMD0 81
|
||||
#define CLK_DIV_UART_ISP 82
|
||||
#define CLK_DIV_SPI1_ISP_PRE 83
|
||||
#define CLK_DIV_SPI1_ISP 84
|
||||
#define CLK_DIV_SPI0_ISP_PRE 85
|
||||
#define CLK_DIV_SPI0_ISP 86
|
||||
#define CLK_DIV_TSADC_PRE 87
|
||||
#define CLK_DIV_TSADC 88
|
||||
#define CLK_DIV_MMC1_PRE 89
|
||||
#define CLK_DIV_MMC1 90
|
||||
#define CLK_DIV_MMC0_PRE 91
|
||||
#define CLK_DIV_MMC0 92
|
||||
#define CLK_DIV_UART1 93
|
||||
#define CLK_DIV_UART0 94
|
||||
#define CLK_DIV_SPI1_PRE 95
|
||||
#define CLK_DIV_SPI1 96
|
||||
#define CLK_DIV_SPI0_PRE 97
|
||||
#define CLK_DIV_SPI0 98
|
||||
#define CLK_DIV_PCM 99
|
||||
#define CLK_DIV_AUDIO 100
|
||||
#define CLK_DIV_I2S 101
|
||||
#define CLK_DIV_CORE2 102
|
||||
#define CLK_DIV_APLL 103
|
||||
#define CLK_DIV_PCLK_DBG 104
|
||||
#define CLK_DIV_ATB 105
|
||||
#define CLK_DIV_COREM 106
|
||||
#define CLK_DIV_CORE 107
|
||||
#define CLK_DIV_HPM 108
|
||||
#define CLK_DIV_COPY 109
|
||||
|
||||
/* Gates */
|
||||
#define CLK_ASYNC_G3D 128
|
||||
#define CLK_ASYNC_MFCL 129
|
||||
#define CLK_PPMULEFT 130
|
||||
#define CLK_GPIO_LEFT 131
|
||||
#define CLK_ASYNC_ISPMX 132
|
||||
#define CLK_ASYNC_FSYSD 133
|
||||
#define CLK_ASYNC_LCD0X 134
|
||||
#define CLK_ASYNC_CAMX 135
|
||||
#define CLK_PPMURIGHT 136
|
||||
#define CLK_GPIO_RIGHT 137
|
||||
#define CLK_MONOCNT 138
|
||||
#define CLK_TZPC6 139
|
||||
#define CLK_PROVISIONKEY1 140
|
||||
#define CLK_PROVISIONKEY0 141
|
||||
#define CLK_CMU_ISPPART 142
|
||||
#define CLK_TMU_APBIF 143
|
||||
#define CLK_KEYIF 144
|
||||
#define CLK_RTC 145
|
||||
#define CLK_WDT 146
|
||||
#define CLK_MCT 147
|
||||
#define CLK_SECKEY 148
|
||||
#define CLK_TZPC5 149
|
||||
#define CLK_TZPC4 150
|
||||
#define CLK_TZPC3 151
|
||||
#define CLK_TZPC2 152
|
||||
#define CLK_TZPC1 153
|
||||
#define CLK_TZPC0 154
|
||||
#define CLK_CMU_COREPART 155
|
||||
#define CLK_CMU_TOPPART 156
|
||||
#define CLK_PMU_APBIF 157
|
||||
#define CLK_SYSREG 158
|
||||
#define CLK_CHIP_ID 159
|
||||
#define CLK_QEJPEG 160
|
||||
#define CLK_PIXELASYNCM1 161
|
||||
#define CLK_PIXELASYNCM0 162
|
||||
#define CLK_PPMUCAMIF 163
|
||||
#define CLK_QEM2MSCALER 164
|
||||
#define CLK_QEGSCALER1 165
|
||||
#define CLK_QEGSCALER0 166
|
||||
#define CLK_SMMUJPEG 167
|
||||
#define CLK_SMMUM2M2SCALER 168
|
||||
#define CLK_SMMUGSCALER1 169
|
||||
#define CLK_SMMUGSCALER0 170
|
||||
#define CLK_JPEG 171
|
||||
#define CLK_M2MSCALER 172
|
||||
#define CLK_GSCALER1 173
|
||||
#define CLK_GSCALER0 174
|
||||
#define CLK_QEMFC 175
|
||||
#define CLK_PPMUMFC_L 176
|
||||
#define CLK_SMMUMFC_L 177
|
||||
#define CLK_MFC 178
|
||||
#define CLK_SMMUG3D 179
|
||||
#define CLK_QEG3D 180
|
||||
#define CLK_PPMUG3D 181
|
||||
#define CLK_G3D 182
|
||||
#define CLK_QE_CH1_LCD 183
|
||||
#define CLK_QE_CH0_LCD 184
|
||||
#define CLK_PPMULCD0 185
|
||||
#define CLK_SMMUFIMD0 186
|
||||
#define CLK_DSIM0 187
|
||||
#define CLK_FIMD0 188
|
||||
#define CLK_CAM1 189
|
||||
#define CLK_UART_ISP_TOP 190
|
||||
#define CLK_SPI1_ISP_TOP 191
|
||||
#define CLK_SPI0_ISP_TOP 192
|
||||
#define CLK_TSADC 193
|
||||
#define CLK_PPMUFILE 194
|
||||
#define CLK_USBOTG 195
|
||||
#define CLK_USBHOST 196
|
||||
#define CLK_SROMC 197
|
||||
#define CLK_SDMMC1 198
|
||||
#define CLK_SDMMC0 199
|
||||
#define CLK_PDMA1 200
|
||||
#define CLK_PDMA0 201
|
||||
#define CLK_PWM 202
|
||||
#define CLK_PCM 203
|
||||
#define CLK_I2S 204
|
||||
#define CLK_SPI1 205
|
||||
#define CLK_SPI0 206
|
||||
#define CLK_I2C7 207
|
||||
#define CLK_I2C6 208
|
||||
#define CLK_I2C5 209
|
||||
#define CLK_I2C4 210
|
||||
#define CLK_I2C3 211
|
||||
#define CLK_I2C2 212
|
||||
#define CLK_I2C1 213
|
||||
#define CLK_I2C0 214
|
||||
#define CLK_UART1 215
|
||||
#define CLK_UART0 216
|
||||
#define CLK_BLOCK_LCD 217
|
||||
#define CLK_BLOCK_G3D 218
|
||||
#define CLK_BLOCK_MFC 219
|
||||
#define CLK_BLOCK_CAM 220
|
||||
#define CLK_SMIES 221
|
||||
|
||||
/* Special clocks */
|
||||
#define CLK_SCLK_JPEG 224
|
||||
#define CLK_SCLK_M2MSCALER 225
|
||||
#define CLK_SCLK_GSCALER1 226
|
||||
#define CLK_SCLK_GSCALER0 227
|
||||
#define CLK_SCLK_MFC 228
|
||||
#define CLK_SCLK_G3D 229
|
||||
#define CLK_SCLK_MIPIDPHY2L 230
|
||||
#define CLK_SCLK_MIPI0 231
|
||||
#define CLK_SCLK_FIMD0 232
|
||||
#define CLK_SCLK_CAM1 233
|
||||
#define CLK_SCLK_UART_ISP 234
|
||||
#define CLK_SCLK_SPI1_ISP 235
|
||||
#define CLK_SCLK_SPI0_ISP 236
|
||||
#define CLK_SCLK_UPLL 237
|
||||
#define CLK_SCLK_TSADC 238
|
||||
#define CLK_SCLK_EBI 239
|
||||
#define CLK_SCLK_MMC1 240
|
||||
#define CLK_SCLK_MMC0 241
|
||||
#define CLK_SCLK_I2S 242
|
||||
#define CLK_SCLK_PCM 243
|
||||
#define CLK_SCLK_SPI1 244
|
||||
#define CLK_SCLK_SPI0 245
|
||||
#define CLK_SCLK_UART1 246
|
||||
#define CLK_SCLK_UART0 247
|
||||
|
||||
/*
|
||||
* Total number of clocks of main CMU.
|
||||
* NOTE: Must be equal to last clock ID increased by one.
|
||||
*/
|
||||
#define CLK_NR_CLKS 248
|
||||
|
||||
#endif /* _DT_BINDINGS_CLOCK_SAMSUNG_EXYNOS3250_CLOCK_H */
|
@ -33,6 +33,7 @@
|
||||
#define CLK_MOUT_MPLL_USER_C 18 /* Exynos4x12 only */
|
||||
#define CLK_MOUT_CORE 19
|
||||
#define CLK_MOUT_APLL 20
|
||||
#define CLK_SCLK_HDMIPHY 22
|
||||
|
||||
/* gate for special clocks (sclk) */
|
||||
#define CLK_SCLK_FIMC0 128
|
||||
@ -181,7 +182,6 @@
|
||||
#define CLK_KEYIF 347
|
||||
#define CLK_AUDSS 348
|
||||
#define CLK_MIPI_HSI 349 /* Exynos4210 only */
|
||||
#define CLK_MDMA2 350 /* Exynos4210 only */
|
||||
#define CLK_PIXELASYNCM0 351
|
||||
#define CLK_PIXELASYNCM1 352
|
||||
#define CLK_FIMC_LITE0 353 /* Exynos4x12 only */
|
||||
|
@ -150,11 +150,14 @@
|
||||
#define CLK_G2D 345
|
||||
#define CLK_MDMA0 346
|
||||
#define CLK_SMMU_MDMA0 347
|
||||
#define CLK_SSS 348
|
||||
#define CLK_G3D 349
|
||||
|
||||
/* mux clocks */
|
||||
#define CLK_MOUT_HDMI 1024
|
||||
#define CLK_MOUT_GPLL 1025
|
||||
|
||||
/* must be greater than maximal clock id */
|
||||
#define CLK_NR_CLKS 1025
|
||||
#define CLK_NR_CLKS 1026
|
||||
|
||||
#endif /* _DT_BINDINGS_CLOCK_EXYNOS_5250_H */
|
||||
|
469
include/dt-bindings/clock/exynos5260-clk.h
Normal file
469
include/dt-bindings/clock/exynos5260-clk.h
Normal file
@ -0,0 +1,469 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Samsung Electronics Co., Ltd.
|
||||
* Author: Rahul Sharma <rahul.sharma@samsung.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Provides Constants for Exynos5260 clocks.
|
||||
*/
|
||||
|
||||
#ifndef _DT_BINDINGS_CLK_EXYNOS5260_H
|
||||
#define _DT_BINDINGS_CLK_EXYNOS5260_H
|
||||
|
||||
/* Clock names: <cmu><type><IP> */
|
||||
|
||||
/* List Of Clocks For CMU_TOP */
|
||||
|
||||
#define TOP_FOUT_DISP_PLL 1
|
||||
#define TOP_FOUT_AUD_PLL 2
|
||||
#define TOP_MOUT_AUDTOP_PLL_USER 3
|
||||
#define TOP_MOUT_AUD_PLL 4
|
||||
#define TOP_MOUT_DISP_PLL 5
|
||||
#define TOP_MOUT_BUSTOP_PLL_USER 6
|
||||
#define TOP_MOUT_MEMTOP_PLL_USER 7
|
||||
#define TOP_MOUT_MEDIATOP_PLL_USER 8
|
||||
#define TOP_MOUT_DISP_DISP_333 9
|
||||
#define TOP_MOUT_ACLK_DISP_333 10
|
||||
#define TOP_MOUT_DISP_DISP_222 11
|
||||
#define TOP_MOUT_ACLK_DISP_222 12
|
||||
#define TOP_MOUT_DISP_MEDIA_PIXEL 13
|
||||
#define TOP_MOUT_FIMD1 14
|
||||
#define TOP_MOUT_SCLK_PERI_SPI0_CLK 15
|
||||
#define TOP_MOUT_SCLK_PERI_SPI1_CLK 16
|
||||
#define TOP_MOUT_SCLK_PERI_SPI2_CLK 17
|
||||
#define TOP_MOUT_SCLK_PERI_UART0_UCLK 18
|
||||
#define TOP_MOUT_SCLK_PERI_UART2_UCLK 19
|
||||
#define TOP_MOUT_SCLK_PERI_UART1_UCLK 20
|
||||
#define TOP_MOUT_BUS4_BUSTOP_100 21
|
||||
#define TOP_MOUT_BUS4_BUSTOP_400 22
|
||||
#define TOP_MOUT_BUS3_BUSTOP_100 23
|
||||
#define TOP_MOUT_BUS3_BUSTOP_400 24
|
||||
#define TOP_MOUT_BUS2_BUSTOP_400 25
|
||||
#define TOP_MOUT_BUS2_BUSTOP_100 26
|
||||
#define TOP_MOUT_BUS1_BUSTOP_100 27
|
||||
#define TOP_MOUT_BUS1_BUSTOP_400 28
|
||||
#define TOP_MOUT_SCLK_FSYS_USB 29
|
||||
#define TOP_MOUT_SCLK_FSYS_MMC0_SDCLKIN_A 30
|
||||
#define TOP_MOUT_SCLK_FSYS_MMC1_SDCLKIN_A 31
|
||||
#define TOP_MOUT_SCLK_FSYS_MMC2_SDCLKIN_A 32
|
||||
#define TOP_MOUT_SCLK_FSYS_MMC0_SDCLKIN_B 33
|
||||
#define TOP_MOUT_SCLK_FSYS_MMC1_SDCLKIN_B 34
|
||||
#define TOP_MOUT_SCLK_FSYS_MMC2_SDCLKIN_B 35
|
||||
#define TOP_MOUT_ACLK_ISP1_266 36
|
||||
#define TOP_MOUT_ISP1_MEDIA_266 37
|
||||
#define TOP_MOUT_ACLK_ISP1_400 38
|
||||
#define TOP_MOUT_ISP1_MEDIA_400 39
|
||||
#define TOP_MOUT_SCLK_ISP1_SPI0 40
|
||||
#define TOP_MOUT_SCLK_ISP1_SPI1 41
|
||||
#define TOP_MOUT_SCLK_ISP1_UART 42
|
||||
#define TOP_MOUT_SCLK_ISP1_SENSOR2 43
|
||||
#define TOP_MOUT_SCLK_ISP1_SENSOR1 44
|
||||
#define TOP_MOUT_SCLK_ISP1_SENSOR0 45
|
||||
#define TOP_MOUT_ACLK_MFC_333 46
|
||||
#define TOP_MOUT_MFC_BUSTOP_333 47
|
||||
#define TOP_MOUT_ACLK_G2D_333 48
|
||||
#define TOP_MOUT_G2D_BUSTOP_333 49
|
||||
#define TOP_MOUT_ACLK_GSCL_FIMC 50
|
||||
#define TOP_MOUT_GSCL_BUSTOP_FIMC 51
|
||||
#define TOP_MOUT_ACLK_GSCL_333 52
|
||||
#define TOP_MOUT_GSCL_BUSTOP_333 53
|
||||
#define TOP_MOUT_ACLK_GSCL_400 54
|
||||
#define TOP_MOUT_M2M_MEDIATOP_400 55
|
||||
#define TOP_DOUT_ACLK_MFC_333 56
|
||||
#define TOP_DOUT_ACLK_G2D_333 57
|
||||
#define TOP_DOUT_SCLK_ISP1_SENSOR2_A 58
|
||||
#define TOP_DOUT_SCLK_ISP1_SENSOR1_A 59
|
||||
#define TOP_DOUT_SCLK_ISP1_SENSOR0_A 60
|
||||
#define TOP_DOUT_ACLK_GSCL_FIMC 61
|
||||
#define TOP_DOUT_ACLK_GSCL_400 62
|
||||
#define TOP_DOUT_ACLK_GSCL_333 63
|
||||
#define TOP_DOUT_SCLK_ISP1_SPI0_B 64
|
||||
#define TOP_DOUT_SCLK_ISP1_SPI0_A 65
|
||||
#define TOP_DOUT_ACLK_ISP1_400 66
|
||||
#define TOP_DOUT_ACLK_ISP1_266 67
|
||||
#define TOP_DOUT_SCLK_ISP1_UART 68
|
||||
#define TOP_DOUT_SCLK_ISP1_SPI1_B 69
|
||||
#define TOP_DOUT_SCLK_ISP1_SPI1_A 70
|
||||
#define TOP_DOUT_SCLK_ISP1_SENSOR2_B 71
|
||||
#define TOP_DOUT_SCLK_ISP1_SENSOR1_B 72
|
||||
#define TOP_DOUT_SCLK_ISP1_SENSOR0_B 73
|
||||
#define TOP_DOUTTOP__SCLK_HPM_TARGETCLK 74
|
||||
#define TOP_DOUT_SCLK_DISP_PIXEL 75
|
||||
#define TOP_DOUT_ACLK_DISP_222 76
|
||||
#define TOP_DOUT_ACLK_DISP_333 77
|
||||
#define TOP_DOUT_ACLK_BUS4_100 78
|
||||
#define TOP_DOUT_ACLK_BUS4_400 79
|
||||
#define TOP_DOUT_ACLK_BUS3_100 80
|
||||
#define TOP_DOUT_ACLK_BUS3_400 81
|
||||
#define TOP_DOUT_ACLK_BUS2_100 82
|
||||
#define TOP_DOUT_ACLK_BUS2_400 83
|
||||
#define TOP_DOUT_ACLK_BUS1_100 84
|
||||
#define TOP_DOUT_ACLK_BUS1_400 85
|
||||
#define TOP_DOUT_SCLK_PERI_SPI1_B 86
|
||||
#define TOP_DOUT_SCLK_PERI_SPI1_A 87
|
||||
#define TOP_DOUT_SCLK_PERI_SPI0_B 88
|
||||
#define TOP_DOUT_SCLK_PERI_SPI0_A 89
|
||||
#define TOP_DOUT_SCLK_PERI_UART0 90
|
||||
#define TOP_DOUT_SCLK_PERI_UART2 91
|
||||
#define TOP_DOUT_SCLK_PERI_UART1 92
|
||||
#define TOP_DOUT_SCLK_PERI_SPI2_B 93
|
||||
#define TOP_DOUT_SCLK_PERI_SPI2_A 94
|
||||
#define TOP_DOUT_ACLK_PERI_AUD 95
|
||||
#define TOP_DOUT_ACLK_PERI_66 96
|
||||
#define TOP_DOUT_SCLK_FSYS_MMC0_SDCLKIN_B 97
|
||||
#define TOP_DOUT_SCLK_FSYS_MMC0_SDCLKIN_A 98
|
||||
#define TOP_DOUT_SCLK_FSYS_USBDRD30_SUSPEND_CLK 99
|
||||
#define TOP_DOUT_ACLK_FSYS_200 100
|
||||
#define TOP_DOUT_SCLK_FSYS_MMC2_SDCLKIN_B 101
|
||||
#define TOP_DOUT_SCLK_FSYS_MMC2_SDCLKIN_A 102
|
||||
#define TOP_DOUT_SCLK_FSYS_MMC1_SDCLKIN_B 103
|
||||
#define TOP_DOUT_SCLK_FSYS_MMC1_SDCLKIN_A 104
|
||||
#define TOP_SCLK_FIMD1 105
|
||||
#define TOP_SCLK_MMC2 106
|
||||
#define TOP_SCLK_MMC1 107
|
||||
#define TOP_SCLK_MMC0 108
|
||||
#define PHYCLK_DPTX_PHY_CH3_TXD_CLK 109
|
||||
#define PHYCLK_DPTX_PHY_CH2_TXD_CLK 110
|
||||
#define PHYCLK_DPTX_PHY_CH1_TXD_CLK 111
|
||||
#define PHYCLK_DPTX_PHY_CH0_TXD_CLK 112
|
||||
#define phyclk_hdmi_phy_tmds_clko 113
|
||||
#define PHYCLK_HDMI_PHY_PIXEL_CLKO 114
|
||||
#define PHYCLK_HDMI_LINK_O_TMDS_CLKHI 115
|
||||
#define PHYCLK_MIPI_DPHY_4L_M_TXBYTECLKHS 116
|
||||
#define PHYCLK_DPTX_PHY_O_REF_CLK_24M 117
|
||||
#define PHYCLK_DPTX_PHY_CLK_DIV2 118
|
||||
#define PHYCLK_MIPI_DPHY_4L_M_RXCLKESC0 119
|
||||
#define PHYCLK_USBHOST20_PHY_PHYCLOCK 120
|
||||
#define PHYCLK_USBHOST20_PHY_FREECLK 121
|
||||
#define PHYCLK_USBHOST20_PHY_CLK48MOHCI 122
|
||||
#define PHYCLK_USBDRD30_UDRD30_PIPE_PCLK 123
|
||||
#define PHYCLK_USBDRD30_UDRD30_PHYCLOCK 124
|
||||
#define TOP_NR_CLK 125
|
||||
|
||||
|
||||
/* List Of Clocks For CMU_EGL */
|
||||
|
||||
#define EGL_FOUT_EGL_PLL 1
|
||||
#define EGL_FOUT_EGL_DPLL 2
|
||||
#define EGL_MOUT_EGL_B 3
|
||||
#define EGL_MOUT_EGL_PLL 4
|
||||
#define EGL_DOUT_EGL_PLL 5
|
||||
#define EGL_DOUT_EGL_PCLK_DBG 6
|
||||
#define EGL_DOUT_EGL_ATCLK 7
|
||||
#define EGL_DOUT_PCLK_EGL 8
|
||||
#define EGL_DOUT_ACLK_EGL 9
|
||||
#define EGL_DOUT_EGL2 10
|
||||
#define EGL_DOUT_EGL1 11
|
||||
#define EGL_NR_CLK 12
|
||||
|
||||
|
||||
/* List Of Clocks For CMU_KFC */
|
||||
|
||||
#define KFC_FOUT_KFC_PLL 1
|
||||
#define KFC_MOUT_KFC_PLL 2
|
||||
#define KFC_MOUT_KFC 3
|
||||
#define KFC_DOUT_KFC_PLL 4
|
||||
#define KFC_DOUT_PCLK_KFC 5
|
||||
#define KFC_DOUT_ACLK_KFC 6
|
||||
#define KFC_DOUT_KFC_PCLK_DBG 7
|
||||
#define KFC_DOUT_KFC_ATCLK 8
|
||||
#define KFC_DOUT_KFC2 9
|
||||
#define KFC_DOUT_KFC1 10
|
||||
#define KFC_NR_CLK 11
|
||||
|
||||
|
||||
/* List Of Clocks For CMU_MIF */
|
||||
|
||||
#define MIF_FOUT_MEM_PLL 1
|
||||
#define MIF_FOUT_MEDIA_PLL 2
|
||||
#define MIF_FOUT_BUS_PLL 3
|
||||
#define MIF_MOUT_CLK2X_PHY 4
|
||||
#define MIF_MOUT_MIF_DREX2X 5
|
||||
#define MIF_MOUT_CLKM_PHY 6
|
||||
#define MIF_MOUT_MIF_DREX 7
|
||||
#define MIF_MOUT_MEDIA_PLL 8
|
||||
#define MIF_MOUT_BUS_PLL 9
|
||||
#define MIF_MOUT_MEM_PLL 10
|
||||
#define MIF_DOUT_ACLK_BUS_100 11
|
||||
#define MIF_DOUT_ACLK_BUS_200 12
|
||||
#define MIF_DOUT_ACLK_MIF_466 13
|
||||
#define MIF_DOUT_CLK2X_PHY 14
|
||||
#define MIF_DOUT_CLKM_PHY 15
|
||||
#define MIF_DOUT_BUS_PLL 16
|
||||
#define MIF_DOUT_MEM_PLL 17
|
||||
#define MIF_DOUT_MEDIA_PLL 18
|
||||
#define MIF_CLK_LPDDR3PHY_WRAP1 19
|
||||
#define MIF_CLK_LPDDR3PHY_WRAP0 20
|
||||
#define MIF_CLK_MONOCNT 21
|
||||
#define MIF_CLK_MIF_RTC 22
|
||||
#define MIF_CLK_DREX1 23
|
||||
#define MIF_CLK_DREX0 24
|
||||
#define MIF_CLK_INTMEM 25
|
||||
#define MIF_SCLK_LPDDR3PHY_WRAP_U1 26
|
||||
#define MIF_SCLK_LPDDR3PHY_WRAP_U0 27
|
||||
#define MIF_NR_CLK 28
|
||||
|
||||
|
||||
/* List Of Clocks For CMU_G3D */
|
||||
|
||||
#define G3D_FOUT_G3D_PLL 1
|
||||
#define G3D_MOUT_G3D_PLL 2
|
||||
#define G3D_DOUT_PCLK_G3D 3
|
||||
#define G3D_DOUT_ACLK_G3D 4
|
||||
#define G3D_CLK_G3D_HPM 5
|
||||
#define G3D_CLK_G3D 6
|
||||
#define G3D_NR_CLK 7
|
||||
|
||||
|
||||
/* List Of Clocks For CMU_AUD */
|
||||
|
||||
#define AUD_MOUT_SCLK_AUD_PCM 1
|
||||
#define AUD_MOUT_SCLK_AUD_I2S 2
|
||||
#define AUD_MOUT_AUD_PLL_USER 3
|
||||
#define AUD_DOUT_ACLK_AUD_131 4
|
||||
#define AUD_DOUT_SCLK_AUD_UART 5
|
||||
#define AUD_DOUT_SCLK_AUD_PCM 6
|
||||
#define AUD_DOUT_SCLK_AUD_I2S 7
|
||||
#define AUD_CLK_AUD_UART 8
|
||||
#define AUD_CLK_PCM 9
|
||||
#define AUD_CLK_I2S 10
|
||||
#define AUD_CLK_DMAC 11
|
||||
#define AUD_CLK_SRAMC 12
|
||||
#define AUD_SCLK_AUD_UART 13
|
||||
#define AUD_SCLK_PCM 14
|
||||
#define AUD_SCLK_I2S 15
|
||||
#define AUD_NR_CLK 16
|
||||
|
||||
|
||||
/* List Of Clocks For CMU_MFC */
|
||||
|
||||
#define MFC_MOUT_ACLK_MFC_333_USER 1
|
||||
#define MFC_DOUT_PCLK_MFC_83 2
|
||||
#define MFC_CLK_MFC 3
|
||||
#define MFC_CLK_SMMU2_MFCM1 4
|
||||
#define MFC_CLK_SMMU2_MFCM0 5
|
||||
#define MFC_NR_CLK 6
|
||||
|
||||
|
||||
/* List Of Clocks For CMU_GSCL */
|
||||
|
||||
#define GSCL_MOUT_ACLK_CSIS 1
|
||||
#define GSCL_MOUT_ACLK_GSCL_FIMC_USER 2
|
||||
#define GSCL_MOUT_ACLK_M2M_400_USER 3
|
||||
#define GSCL_MOUT_ACLK_GSCL_333_USER 4
|
||||
#define GSCL_DOUT_ACLK_CSIS_200 5
|
||||
#define GSCL_DOUT_PCLK_M2M_100 6
|
||||
#define GSCL_CLK_PIXEL_GSCL1 7
|
||||
#define GSCL_CLK_PIXEL_GSCL0 8
|
||||
#define GSCL_CLK_MSCL1 9
|
||||
#define GSCL_CLK_MSCL0 10
|
||||
#define GSCL_CLK_GSCL1 11
|
||||
#define GSCL_CLK_GSCL0 12
|
||||
#define GSCL_CLK_FIMC_LITE_D 13
|
||||
#define GSCL_CLK_FIMC_LITE_B 14
|
||||
#define GSCL_CLK_FIMC_LITE_A 15
|
||||
#define GSCL_CLK_CSIS1 16
|
||||
#define GSCL_CLK_CSIS0 17
|
||||
#define GSCL_CLK_SMMU3_LITE_D 18
|
||||
#define GSCL_CLK_SMMU3_LITE_B 19
|
||||
#define GSCL_CLK_SMMU3_LITE_A 20
|
||||
#define GSCL_CLK_SMMU3_GSCL0 21
|
||||
#define GSCL_CLK_SMMU3_GSCL1 22
|
||||
#define GSCL_CLK_SMMU3_MSCL0 23
|
||||
#define GSCL_CLK_SMMU3_MSCL1 24
|
||||
#define GSCL_SCLK_CSIS1_WRAP 25
|
||||
#define GSCL_SCLK_CSIS0_WRAP 26
|
||||
#define GSCL_NR_CLK 27
|
||||
|
||||
|
||||
/* List Of Clocks For CMU_FSYS */
|
||||
|
||||
#define FSYS_MOUT_PHYCLK_USBHOST20_PHYCLK_USER 1
|
||||
#define FSYS_MOUT_PHYCLK_USBHOST20_FREECLK_USER 2
|
||||
#define FSYS_MOUT_PHYCLK_USBHOST20_CLK48MOHCI_USER 3
|
||||
#define FSYS_MOUT_PHYCLK_USBDRD30_PIPE_PCLK_USER 4
|
||||
#define FSYS_MOUT_PHYCLK_USBDRD30_PHYCLOCK_USER 5
|
||||
#define FSYS_CLK_TSI 6
|
||||
#define FSYS_CLK_USBLINK 7
|
||||
#define FSYS_CLK_USBHOST20 8
|
||||
#define FSYS_CLK_USBDRD30 9
|
||||
#define FSYS_CLK_SROMC 10
|
||||
#define FSYS_CLK_PDMA 11
|
||||
#define FSYS_CLK_MMC2 12
|
||||
#define FSYS_CLK_MMC1 13
|
||||
#define FSYS_CLK_MMC0 14
|
||||
#define FSYS_CLK_RTIC 15
|
||||
#define FSYS_CLK_SMMU_RTIC 16
|
||||
#define FSYS_PHYCLK_USBDRD30 17
|
||||
#define FSYS_PHYCLK_USBHOST20 18
|
||||
#define FSYS_NR_CLK 19
|
||||
|
||||
|
||||
/* List Of Clocks For CMU_PERI */
|
||||
|
||||
#define PERI_MOUT_SCLK_SPDIF 1
|
||||
#define PERI_MOUT_SCLK_I2SCOD 2
|
||||
#define PERI_MOUT_SCLK_PCM 3
|
||||
#define PERI_DOUT_I2S 4
|
||||
#define PERI_DOUT_PCM 5
|
||||
#define PERI_CLK_WDT_KFC 6
|
||||
#define PERI_CLK_WDT_EGL 7
|
||||
#define PERI_CLK_HSIC3 8
|
||||
#define PERI_CLK_HSIC2 9
|
||||
#define PERI_CLK_HSIC1 10
|
||||
#define PERI_CLK_HSIC0 11
|
||||
#define PERI_CLK_PCM 12
|
||||
#define PERI_CLK_MCT 13
|
||||
#define PERI_CLK_I2S 14
|
||||
#define PERI_CLK_I2CHDMI 15
|
||||
#define PERI_CLK_I2C7 16
|
||||
#define PERI_CLK_I2C6 17
|
||||
#define PERI_CLK_I2C5 18
|
||||
#define PERI_CLK_I2C4 19
|
||||
#define PERI_CLK_I2C9 20
|
||||
#define PERI_CLK_I2C8 21
|
||||
#define PERI_CLK_I2C11 22
|
||||
#define PERI_CLK_I2C10 23
|
||||
#define PERI_CLK_HDMICEC 24
|
||||
#define PERI_CLK_EFUSE_WRITER 25
|
||||
#define PERI_CLK_ABB 26
|
||||
#define PERI_CLK_UART2 27
|
||||
#define PERI_CLK_UART1 28
|
||||
#define PERI_CLK_UART0 29
|
||||
#define PERI_CLK_ADC 30
|
||||
#define PERI_CLK_TMU4 31
|
||||
#define PERI_CLK_TMU3 32
|
||||
#define PERI_CLK_TMU2 33
|
||||
#define PERI_CLK_TMU1 34
|
||||
#define PERI_CLK_TMU0 35
|
||||
#define PERI_CLK_SPI2 36
|
||||
#define PERI_CLK_SPI1 37
|
||||
#define PERI_CLK_SPI0 38
|
||||
#define PERI_CLK_SPDIF 39
|
||||
#define PERI_CLK_PWM 40
|
||||
#define PERI_CLK_UART4 41
|
||||
#define PERI_CLK_CHIPID 42
|
||||
#define PERI_CLK_PROVKEY0 43
|
||||
#define PERI_CLK_PROVKEY1 44
|
||||
#define PERI_CLK_SECKEY 45
|
||||
#define PERI_CLK_TOP_RTC 46
|
||||
#define PERI_CLK_TZPC10 47
|
||||
#define PERI_CLK_TZPC9 48
|
||||
#define PERI_CLK_TZPC8 49
|
||||
#define PERI_CLK_TZPC7 50
|
||||
#define PERI_CLK_TZPC6 51
|
||||
#define PERI_CLK_TZPC5 52
|
||||
#define PERI_CLK_TZPC4 53
|
||||
#define PERI_CLK_TZPC3 54
|
||||
#define PERI_CLK_TZPC2 55
|
||||
#define PERI_CLK_TZPC1 56
|
||||
#define PERI_CLK_TZPC0 57
|
||||
#define PERI_SCLK_UART2 58
|
||||
#define PERI_SCLK_UART1 59
|
||||
#define PERI_SCLK_UART0 60
|
||||
#define PERI_SCLK_SPI2 61
|
||||
#define PERI_SCLK_SPI1 62
|
||||
#define PERI_SCLK_SPI0 63
|
||||
#define PERI_SCLK_SPDIF 64
|
||||
#define PERI_SCLK_I2S 65
|
||||
#define PERI_SCLK_PCM1 66
|
||||
#define PERI_NR_CLK 67
|
||||
|
||||
|
||||
/* List Of Clocks For CMU_DISP */
|
||||
|
||||
#define DISP_MOUT_SCLK_HDMI_SPDIF 1
|
||||
#define DISP_MOUT_SCLK_HDMI_PIXEL 2
|
||||
#define DISP_MOUT_PHYCLK_MIPI_DPHY_4LMRXCLK_ESC0_USER 3
|
||||
#define DISP_MOUT_PHYCLK_HDMI_PHY_TMDS_CLKO_USER 4
|
||||
#define DISP_MOUT_PHYCLK_HDMI_PHY_REF_CLKO_USER 5
|
||||
#define DISP_MOUT_HDMI_PHY_PIXEL 6
|
||||
#define DISP_MOUT_PHYCLK_HDMI_LINK_O_TMDS_CLKHI_USER 7
|
||||
#define DISP_MOUT_PHYCLK_MIPI_DPHY_4L_M_TXBYTE_CLKHS 8
|
||||
#define DISP_MOUT_PHYCLK_DPTX_PHY_O_REF_CLK_24M_USER 9
|
||||
#define DISP_MOUT_PHYCLK_DPTX_PHY_CLK_DIV2_USER 10
|
||||
#define DISP_MOUT_PHYCLK_DPTX_PHY_CH3_TXD_CLK_USER 11
|
||||
#define DISP_MOUT_PHYCLK_DPTX_PHY_CH2_TXD_CLK_USER 12
|
||||
#define DISP_MOUT_PHYCLK_DPTX_PHY_CH1_TXD_CLK_USER 13
|
||||
#define DISP_MOUT_PHYCLK_DPTX_PHY_CH0_TXD_CLK_USER 14
|
||||
#define DISP_MOUT_ACLK_DISP_222_USER 15
|
||||
#define DISP_MOUT_SCLK_DISP_PIXEL_USER 16
|
||||
#define DISP_MOUT_ACLK_DISP_333_USER 17
|
||||
#define DISP_DOUT_SCLK_HDMI_PHY_PIXEL_CLKI 18
|
||||
#define DISP_DOUT_SCLK_FIMD1_EXTCLKPLL 19
|
||||
#define DISP_DOUT_PCLK_DISP_111 20
|
||||
#define DISP_CLK_SMMU_TV 21
|
||||
#define DISP_CLK_SMMU_FIMD1M1 22
|
||||
#define DISP_CLK_SMMU_FIMD1M0 23
|
||||
#define DISP_CLK_PIXEL_MIXER 24
|
||||
#define DISP_CLK_PIXEL_DISP 25
|
||||
#define DISP_CLK_MIXER 26
|
||||
#define DISP_CLK_MIPIPHY 27
|
||||
#define DISP_CLK_HDMIPHY 28
|
||||
#define DISP_CLK_HDMI 29
|
||||
#define DISP_CLK_FIMD1 30
|
||||
#define DISP_CLK_DSIM1 31
|
||||
#define DISP_CLK_DPPHY 32
|
||||
#define DISP_CLK_DP 33
|
||||
#define DISP_SCLK_PIXEL 34
|
||||
#define DISP_MOUT_HDMI_PHY_PIXEL_USER 35
|
||||
#define DISP_NR_CLK 36
|
||||
|
||||
|
||||
/* List Of Clocks For CMU_G2D */
|
||||
|
||||
#define G2D_MOUT_ACLK_G2D_333_USER 1
|
||||
#define G2D_DOUT_PCLK_G2D_83 2
|
||||
#define G2D_CLK_SMMU3_JPEG 3
|
||||
#define G2D_CLK_MDMA 4
|
||||
#define G2D_CLK_JPEG 5
|
||||
#define G2D_CLK_G2D 6
|
||||
#define G2D_CLK_SSS 7
|
||||
#define G2D_CLK_SLIM_SSS 8
|
||||
#define G2D_CLK_SMMU_SLIM_SSS 9
|
||||
#define G2D_CLK_SMMU_SSS 10
|
||||
#define G2D_CLK_SMMU_MDMA 11
|
||||
#define G2D_CLK_SMMU3_G2D 12
|
||||
#define G2D_NR_CLK 13
|
||||
|
||||
|
||||
/* List Of Clocks For CMU_ISP */
|
||||
|
||||
#define ISP_MOUT_ISP_400_USER 1
|
||||
#define ISP_MOUT_ISP_266_USER 2
|
||||
#define ISP_DOUT_SCLK_MPWM 3
|
||||
#define ISP_DOUT_CA5_PCLKDBG 4
|
||||
#define ISP_DOUT_CA5_ATCLKIN 5
|
||||
#define ISP_DOUT_PCLK_ISP_133 6
|
||||
#define ISP_DOUT_PCLK_ISP_66 7
|
||||
#define ISP_CLK_GIC 8
|
||||
#define ISP_CLK_WDT 9
|
||||
#define ISP_CLK_UART 10
|
||||
#define ISP_CLK_SPI1 11
|
||||
#define ISP_CLK_SPI0 12
|
||||
#define ISP_CLK_SMMU_SCALERP 13
|
||||
#define ISP_CLK_SMMU_SCALERC 14
|
||||
#define ISP_CLK_SMMU_ISPCX 15
|
||||
#define ISP_CLK_SMMU_ISP 16
|
||||
#define ISP_CLK_SMMU_FD 17
|
||||
#define ISP_CLK_SMMU_DRC 18
|
||||
#define ISP_CLK_PWM 19
|
||||
#define ISP_CLK_MTCADC 20
|
||||
#define ISP_CLK_MPWM 21
|
||||
#define ISP_CLK_MCUCTL 22
|
||||
#define ISP_CLK_I2C1 23
|
||||
#define ISP_CLK_I2C0 24
|
||||
#define ISP_CLK_FIMC_SCALERP 25
|
||||
#define ISP_CLK_FIMC_SCALERC 26
|
||||
#define ISP_CLK_FIMC 27
|
||||
#define ISP_CLK_FIMC_FD 28
|
||||
#define ISP_CLK_FIMC_DRC 29
|
||||
#define ISP_CLK_CA5 30
|
||||
#define ISP_SCLK_SPI0_EXT 31
|
||||
#define ISP_SCLK_SPI1_EXT 32
|
||||
#define ISP_SCLK_UART_EXT 33
|
||||
#define ISP_NR_CLK 34
|
||||
|
||||
#endif
|
@ -58,6 +58,9 @@
|
||||
#define CLK_SCLK_GSCL_WA 156
|
||||
#define CLK_SCLK_GSCL_WB 157
|
||||
#define CLK_SCLK_HDMIPHY 158
|
||||
#define CLK_MAU_EPLL 159
|
||||
#define CLK_SCLK_HSIC_12M 160
|
||||
#define CLK_SCLK_MPHY_IXTAL24 161
|
||||
|
||||
/* gate clocks */
|
||||
#define CLK_ACLK66_PERIC 256
|
||||
@ -69,10 +72,10 @@
|
||||
#define CLK_I2C1 262
|
||||
#define CLK_I2C2 263
|
||||
#define CLK_I2C3 264
|
||||
#define CLK_I2C4 265
|
||||
#define CLK_I2C5 266
|
||||
#define CLK_I2C6 267
|
||||
#define CLK_I2C7 268
|
||||
#define CLK_USI0 265
|
||||
#define CLK_USI1 266
|
||||
#define CLK_USI2 267
|
||||
#define CLK_USI3 268
|
||||
#define CLK_I2C_HDMI 269
|
||||
#define CLK_TSADC 270
|
||||
#define CLK_SPI0 271
|
||||
@ -85,9 +88,9 @@
|
||||
#define CLK_PCM2 278
|
||||
#define CLK_PWM 279
|
||||
#define CLK_SPDIF 280
|
||||
#define CLK_I2C8 281
|
||||
#define CLK_I2C9 282
|
||||
#define CLK_I2C10 283
|
||||
#define CLK_USI4 281
|
||||
#define CLK_USI5 282
|
||||
#define CLK_USI6 283
|
||||
#define CLK_ACLK66_PSGEN 300
|
||||
#define CLK_CHIPID 301
|
||||
#define CLK_SYSREG 302
|
||||
@ -140,7 +143,8 @@
|
||||
#define CLK_HDMI 413
|
||||
#define CLK_ACLK300_DISP1 420
|
||||
#define CLK_FIMD1 421
|
||||
#define CLK_SMMU_FIMD1 422
|
||||
#define CLK_SMMU_FIMD1M0 422
|
||||
#define CLK_SMMU_FIMD1M1 423
|
||||
#define CLK_ACLK166 430
|
||||
#define CLK_MIXER 431
|
||||
#define CLK_ACLK266 440
|
||||
@ -152,6 +156,7 @@
|
||||
#define CLK_JPEG 451
|
||||
#define CLK_JPEG2 452
|
||||
#define CLK_SMMU_JPEG 453
|
||||
#define CLK_SMMU_JPEG2 454
|
||||
#define CLK_ACLK300_GSCL 460
|
||||
#define CLK_SMMU_GSCL0 461
|
||||
#define CLK_SMMU_GSCL1 462
|
||||
@ -159,7 +164,7 @@
|
||||
#define CLK_GSCL_WB 464
|
||||
#define CLK_GSCL0 465
|
||||
#define CLK_GSCL1 466
|
||||
#define CLK_CLK_3AA 467
|
||||
#define CLK_FIMC_3AA 467
|
||||
#define CLK_ACLK266_G2D 470
|
||||
#define CLK_SSS 471
|
||||
#define CLK_SLIM_SSS 472
|
||||
@ -172,12 +177,32 @@
|
||||
#define CLK_SMMU_FIMCL1 493
|
||||
#define CLK_SMMU_FIMCL3 494
|
||||
#define CLK_FIMC_LITE3 495
|
||||
#define CLK_FIMC_LITE0 496
|
||||
#define CLK_FIMC_LITE1 497
|
||||
#define CLK_ACLK_G3D 500
|
||||
#define CLK_G3D 501
|
||||
#define CLK_SMMU_MIXER 502
|
||||
#define CLK_SMMU_G2D 503
|
||||
#define CLK_SMMU_MDMA0 504
|
||||
#define CLK_MC 505
|
||||
#define CLK_TOP_RTC 506
|
||||
#define CLK_SCLK_UART_ISP 510
|
||||
#define CLK_SCLK_SPI0_ISP 511
|
||||
#define CLK_SCLK_SPI1_ISP 512
|
||||
#define CLK_SCLK_PWM_ISP 513
|
||||
#define CLK_SCLK_ISP_SENSOR0 514
|
||||
#define CLK_SCLK_ISP_SENSOR1 515
|
||||
#define CLK_SCLK_ISP_SENSOR2 516
|
||||
#define CLK_ACLK432_SCALER 517
|
||||
#define CLK_ACLK432_CAM 518
|
||||
#define CLK_ACLK_FL1550_CAM 519
|
||||
#define CLK_ACLK550_CAM 520
|
||||
|
||||
/* mux clocks */
|
||||
#define CLK_MOUT_HDMI 640
|
||||
#define CLK_MOUT_G3D 641
|
||||
#define CLK_MOUT_VPLL 642
|
||||
#define CLK_MOUT_MAUDIO0 643
|
||||
|
||||
/* divider clocks */
|
||||
#define CLK_DOUT_PIXEL 768
|
||||
|
62
include/dt-bindings/clock/s3c2410.h
Normal file
62
include/dt-bindings/clock/s3c2410.h
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Device Tree binding constants clock controllers of Samsung S3C2410 and later.
|
||||
*/
|
||||
|
||||
#ifndef _DT_BINDINGS_CLOCK_SAMSUNG_S3C2410_CLOCK_H
|
||||
#define _DT_BINDINGS_CLOCK_SAMSUNG_S3C2410_CLOCK_H
|
||||
|
||||
/*
|
||||
* Let each exported clock get a unique index, which is used on DT-enabled
|
||||
* platforms to lookup the clock from a clock specifier. These indices are
|
||||
* therefore considered an ABI and so must not be changed. This implies
|
||||
* that new clocks should be added either in free spaces between clock groups
|
||||
* or at the end.
|
||||
*/
|
||||
|
||||
/* Core clocks. */
|
||||
|
||||
/* id 1 is reserved */
|
||||
#define MPLL 2
|
||||
#define UPLL 3
|
||||
#define FCLK 4
|
||||
#define HCLK 5
|
||||
#define PCLK 6
|
||||
#define UCLK 7
|
||||
#define ARMCLK 8
|
||||
|
||||
/* pclk-gates */
|
||||
#define PCLK_UART0 16
|
||||
#define PCLK_UART1 17
|
||||
#define PCLK_UART2 18
|
||||
#define PCLK_I2C 19
|
||||
#define PCLK_SDI 20
|
||||
#define PCLK_SPI 21
|
||||
#define PCLK_ADC 22
|
||||
#define PCLK_AC97 23
|
||||
#define PCLK_I2S 24
|
||||
#define PCLK_PWM 25
|
||||
#define PCLK_RTC 26
|
||||
#define PCLK_GPIO 27
|
||||
|
||||
|
||||
/* hclk-gates */
|
||||
#define HCLK_LCD 32
|
||||
#define HCLK_USBH 33
|
||||
#define HCLK_USBD 34
|
||||
#define HCLK_NAND 35
|
||||
#define HCLK_CAM 36
|
||||
|
||||
|
||||
#define CAMIF 40
|
||||
|
||||
|
||||
/* Total number of clocks. */
|
||||
#define NR_CLKS (CAMIF + 1)
|
||||
|
||||
#endif /* _DT_BINDINGS_CLOCK_SAMSUNG_S3C2443_CLOCK_H */
|
73
include/dt-bindings/clock/s3c2412.h
Normal file
73
include/dt-bindings/clock/s3c2412.h
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Device Tree binding constants clock controllers of Samsung S3C2412.
|
||||
*/
|
||||
|
||||
#ifndef _DT_BINDINGS_CLOCK_SAMSUNG_S3C2412_CLOCK_H
|
||||
#define _DT_BINDINGS_CLOCK_SAMSUNG_S3C2412_CLOCK_H
|
||||
|
||||
/*
|
||||
* Let each exported clock get a unique index, which is used on DT-enabled
|
||||
* platforms to lookup the clock from a clock specifier. These indices are
|
||||
* therefore considered an ABI and so must not be changed. This implies
|
||||
* that new clocks should be added either in free spaces between clock groups
|
||||
* or at the end.
|
||||
*/
|
||||
|
||||
/* Core clocks. */
|
||||
|
||||
/* id 1 is reserved */
|
||||
#define MPLL 2
|
||||
#define UPLL 3
|
||||
#define MDIVCLK 4
|
||||
#define MSYSCLK 5
|
||||
#define USYSCLK 6
|
||||
#define HCLK 7
|
||||
#define PCLK 8
|
||||
#define ARMDIV 9
|
||||
#define ARMCLK 10
|
||||
|
||||
|
||||
/* Special clocks */
|
||||
#define SCLK_CAM 16
|
||||
#define SCLK_UART 17
|
||||
#define SCLK_I2S 18
|
||||
#define SCLK_USBD 19
|
||||
#define SCLK_USBH 20
|
||||
|
||||
/* pclk-gates */
|
||||
#define PCLK_WDT 32
|
||||
#define PCLK_SPI 33
|
||||
#define PCLK_I2S 34
|
||||
#define PCLK_I2C 35
|
||||
#define PCLK_ADC 36
|
||||
#define PCLK_RTC 37
|
||||
#define PCLK_GPIO 38
|
||||
#define PCLK_UART2 39
|
||||
#define PCLK_UART1 40
|
||||
#define PCLK_UART0 41
|
||||
#define PCLK_SDI 42
|
||||
#define PCLK_PWM 43
|
||||
#define PCLK_USBD 44
|
||||
|
||||
/* hclk-gates */
|
||||
#define HCLK_HALF 48
|
||||
#define HCLK_X2 49
|
||||
#define HCLK_SDRAM 50
|
||||
#define HCLK_USBH 51
|
||||
#define HCLK_LCD 52
|
||||
#define HCLK_NAND 53
|
||||
#define HCLK_DMA3 54
|
||||
#define HCLK_DMA2 55
|
||||
#define HCLK_DMA1 56
|
||||
#define HCLK_DMA0 57
|
||||
|
||||
/* Total number of clocks. */
|
||||
#define NR_CLKS (HCLK_DMA0 + 1)
|
||||
|
||||
#endif /* _DT_BINDINGS_CLOCK_SAMSUNG_S3C2412_CLOCK_H */
|
92
include/dt-bindings/clock/s3c2443.h
Normal file
92
include/dt-bindings/clock/s3c2443.h
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Device Tree binding constants clock controllers of Samsung S3C2443 and later.
|
||||
*/
|
||||
|
||||
#ifndef _DT_BINDINGS_CLOCK_SAMSUNG_S3C2443_CLOCK_H
|
||||
#define _DT_BINDINGS_CLOCK_SAMSUNG_S3C2443_CLOCK_H
|
||||
|
||||
/*
|
||||
* Let each exported clock get a unique index, which is used on DT-enabled
|
||||
* platforms to lookup the clock from a clock specifier. These indices are
|
||||
* therefore considered an ABI and so must not be changed. This implies
|
||||
* that new clocks should be added either in free spaces between clock groups
|
||||
* or at the end.
|
||||
*/
|
||||
|
||||
/* Core clocks. */
|
||||
#define MSYSCLK 1
|
||||
#define ESYSCLK 2
|
||||
#define ARMDIV 3
|
||||
#define ARMCLK 4
|
||||
#define HCLK 5
|
||||
#define PCLK 6
|
||||
|
||||
/* Special clocks */
|
||||
#define SCLK_HSSPI0 16
|
||||
#define SCLK_FIMD 17
|
||||
#define SCLK_I2S0 18
|
||||
#define SCLK_I2S1 19
|
||||
#define SCLK_HSMMC1 20
|
||||
#define SCLK_HSMMC_EXT 21
|
||||
#define SCLK_CAM 22
|
||||
#define SCLK_UART 23
|
||||
#define SCLK_USBH 24
|
||||
|
||||
/* Muxes */
|
||||
#define MUX_HSSPI0 32
|
||||
#define MUX_HSSPI1 33
|
||||
#define MUX_HSMMC0 34
|
||||
#define MUX_HSMMC1 35
|
||||
|
||||
/* hclk-gates */
|
||||
#define HCLK_DMA0 48
|
||||
#define HCLK_DMA1 49
|
||||
#define HCLK_DMA2 50
|
||||
#define HCLK_DMA3 51
|
||||
#define HCLK_DMA4 52
|
||||
#define HCLK_DMA5 53
|
||||
#define HCLK_DMA6 54
|
||||
#define HCLK_DMA7 55
|
||||
#define HCLK_CAM 56
|
||||
#define HCLK_LCD 57
|
||||
#define HCLK_USBH 58
|
||||
#define HCLK_USBD 59
|
||||
#define HCLK_IROM 60
|
||||
#define HCLK_HSMMC0 61
|
||||
#define HCLK_HSMMC1 62
|
||||
#define HCLK_CFC 63
|
||||
#define HCLK_SSMC 64
|
||||
#define HCLK_DRAM 65
|
||||
#define HCLK_2D 66
|
||||
|
||||
/* pclk-gates */
|
||||
#define PCLK_UART0 72
|
||||
#define PCLK_UART1 73
|
||||
#define PCLK_UART2 74
|
||||
#define PCLK_UART3 75
|
||||
#define PCLK_I2C0 76
|
||||
#define PCLK_SDI 77
|
||||
#define PCLK_SPI0 78
|
||||
#define PCLK_ADC 79
|
||||
#define PCLK_AC97 80
|
||||
#define PCLK_I2S0 81
|
||||
#define PCLK_PWM 82
|
||||
#define PCLK_WDT 83
|
||||
#define PCLK_RTC 84
|
||||
#define PCLK_GPIO 85
|
||||
#define PCLK_SPI1 86
|
||||
#define PCLK_CHIPID 87
|
||||
#define PCLK_I2C1 88
|
||||
#define PCLK_I2S1 89
|
||||
#define PCLK_PCM 90
|
||||
|
||||
/* Total number of clocks. */
|
||||
#define NR_CLKS (PCLK_PCM + 1)
|
||||
|
||||
#endif /* _DT_BINDINGS_CLOCK_SAMSUNG_S3C2443_CLOCK_H */
|
Loading…
Reference in New Issue
Block a user