diff options
Diffstat (limited to 'arch/arm/mach-mxs/clock-mx28.c')
| -rw-r--r-- | arch/arm/mach-mxs/clock-mx28.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c index da6e4aad177c..df0ad3ce234b 100644 --- a/arch/arm/mach-mxs/clock-mx28.c +++ b/arch/arm/mach-mxs/clock-mx28.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
| 23 | #include <linux/jiffies.h> | 23 | #include <linux/jiffies.h> |
| 24 | #include <linux/clkdev.h> | 24 | #include <linux/clkdev.h> |
| 25 | #include <linux/spinlock.h> | ||
| 25 | 26 | ||
| 26 | #include <asm/clkdev.h> | 27 | #include <asm/clkdev.h> |
| 27 | #include <asm/div64.h> | 28 | #include <asm/div64.h> |
| @@ -29,6 +30,7 @@ | |||
| 29 | #include <mach/mx28.h> | 30 | #include <mach/mx28.h> |
| 30 | #include <mach/common.h> | 31 | #include <mach/common.h> |
| 31 | #include <mach/clock.h> | 32 | #include <mach/clock.h> |
| 33 | #include <mach/digctl.h> | ||
| 32 | 34 | ||
| 33 | #include "regs-clkctrl-mx28.h" | 35 | #include "regs-clkctrl-mx28.h" |
| 34 | 36 | ||
| @@ -43,6 +45,33 @@ static struct clk emi_clk; | |||
| 43 | static struct clk saif0_clk; | 45 | static struct clk saif0_clk; |
| 44 | static struct clk saif1_clk; | 46 | static struct clk saif1_clk; |
| 45 | static struct clk clk32k_clk; | 47 | static struct clk clk32k_clk; |
| 48 | static DEFINE_SPINLOCK(clkmux_lock); | ||
| 49 | |||
| 50 | /* | ||
| 51 | * HW_SAIF_CLKMUX_SEL: | ||
| 52 | * DIRECT(0x0): SAIF0 clock pins selected for SAIF0 input clocks, and SAIF1 | ||
| 53 | * clock pins selected for SAIF1 input clocks. | ||
| 54 | * CROSSINPUT(0x1): SAIF1 clock inputs selected for SAIF0 input clocks, and | ||
| 55 | * SAIF0 clock inputs selected for SAIF1 input clocks. | ||
| 56 | * EXTMSTR0(0x2): SAIF0 clock pin selected for both SAIF0 and SAIF1 input | ||
| 57 | * clocks. | ||
| 58 | * EXTMSTR1(0x3): SAIF1 clock pin selected for both SAIF0 and SAIF1 input | ||
| 59 | * clocks. | ||
| 60 | */ | ||
| 61 | int mxs_saif_clkmux_select(unsigned int clkmux) | ||
| 62 | { | ||
| 63 | if (clkmux > 0x3) | ||
| 64 | return -EINVAL; | ||
| 65 | |||
| 66 | spin_lock(&clkmux_lock); | ||
| 67 | __raw_writel(BM_DIGCTL_CTRL_SAIF_CLKMUX, | ||
| 68 | DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_CLR_ADDR); | ||
| 69 | __raw_writel(clkmux << BP_DIGCTL_CTRL_SAIF_CLKMUX, | ||
| 70 | DIGCTRL_BASE_ADDR + HW_DIGCTL_CTRL + MXS_SET_ADDR); | ||
| 71 | spin_unlock(&clkmux_lock); | ||
| 72 | |||
| 73 | return 0; | ||
| 74 | } | ||
| 46 | 75 | ||
| 47 | static int _raw_clk_enable(struct clk *clk) | 76 | static int _raw_clk_enable(struct clk *clk) |
| 48 | { | 77 | { |
| @@ -785,6 +814,15 @@ int __init mx28_clocks_init(void) | |||
| 785 | clk_set_parent(&saif0_clk, &pll0_clk); | 814 | clk_set_parent(&saif0_clk, &pll0_clk); |
| 786 | clk_set_parent(&saif1_clk, &pll0_clk); | 815 | clk_set_parent(&saif1_clk, &pll0_clk); |
| 787 | 816 | ||
| 817 | /* | ||
| 818 | * Set an initial clock rate for the saif internal logic to work | ||
| 819 | * properly. This is important when working in EXTMASTER mode that | ||
| 820 | * uses the other saif's BITCLK&LRCLK but it still needs a basic | ||
| 821 | * clock which should be fast enough for the internal logic. | ||
| 822 | */ | ||
| 823 | clk_set_rate(&saif0_clk, 24000000); | ||
| 824 | clk_set_rate(&saif1_clk, 24000000); | ||
| 825 | |||
| 788 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); | 826 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); |
| 789 | 827 | ||
| 790 | mxs_timer_init(&clk32k_clk, MX28_INT_TIMER0); | 828 | mxs_timer_init(&clk32k_clk, MX28_INT_TIMER0); |
