diff options
author | Shawn Guo <shawn.guo@freescale.com> | 2011-10-16 20:42:16 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-10-18 06:42:57 -0400 |
commit | 73d2b4cdfc09a7a858b3ea1f32f6218b21439b96 (patch) | |
tree | d17b0b7514f39b11fd1e0e7d3719f58736e5fb00 /arch/arm/mach-mx5/clock-mx51-mx53.c | |
parent | 976d167615b64e14bc1491ca51d424e2ba9a5e84 (diff) |
arm/mx5: add device tree support for imx53 boards
It adds device tree support for imx53 boards.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx5/clock-mx51-mx53.c')
-rw-r--r-- | arch/arm/mach-mx5/clock-mx51-mx53.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c index f7bf996f463b..d9b03d4dba6d 100644 --- a/arch/arm/mach-mx5/clock-mx51-mx53.c +++ b/arch/arm/mach-mx5/clock-mx51-mx53.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/clk.h> | 15 | #include <linux/clk.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/clkdev.h> | 17 | #include <linux/clkdev.h> |
18 | #include <linux/of.h> | ||
18 | 19 | ||
19 | #include <asm/div64.h> | 20 | #include <asm/div64.h> |
20 | 21 | ||
@@ -1609,3 +1610,33 @@ int __init mx53_clocks_init(unsigned long ckil, unsigned long osc, | |||
1609 | MX53_INT_GPT); | 1610 | MX53_INT_GPT); |
1610 | return 0; | 1611 | return 0; |
1611 | } | 1612 | } |
1613 | |||
1614 | static void __init clk_get_freq_dt(unsigned long *ckil, unsigned long *osc, | ||
1615 | unsigned long *ckih1, unsigned long *ckih2) | ||
1616 | { | ||
1617 | struct device_node *np; | ||
1618 | |||
1619 | /* retrieve the freqency of fixed clocks from device tree */ | ||
1620 | for_each_compatible_node(np, NULL, "fixed-clock") { | ||
1621 | u32 rate; | ||
1622 | if (of_property_read_u32(np, "clock-frequency", &rate)) | ||
1623 | continue; | ||
1624 | |||
1625 | if (of_device_is_compatible(np, "fsl,imx-ckil")) | ||
1626 | *ckil = rate; | ||
1627 | else if (of_device_is_compatible(np, "fsl,imx-osc")) | ||
1628 | *osc = rate; | ||
1629 | else if (of_device_is_compatible(np, "fsl,imx-ckih1")) | ||
1630 | *ckih1 = rate; | ||
1631 | else if (of_device_is_compatible(np, "fsl,imx-ckih2")) | ||
1632 | *ckih2 = rate; | ||
1633 | } | ||
1634 | } | ||
1635 | |||
1636 | int __init mx53_clocks_init_dt(void) | ||
1637 | { | ||
1638 | unsigned long ckil, osc, ckih1, ckih2; | ||
1639 | |||
1640 | clk_get_freq_dt(&ckil, &osc, &ckih1, &ckih2); | ||
1641 | return mx53_clocks_init(ckil, osc, ckih1, ckih2); | ||
1642 | } | ||