aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ep93xx
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-07 20:07:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-07 20:07:31 -0400
commitfaa38b5e0e092914764cdba9f83d31a3f794d182 (patch)
treeb3e5921bdc36378033b4910eb4f29cb0dfc486e0 /arch/arm/mach-ep93xx
parent78417334b5cb6e1f915b8fdcc4fce3f1a1b4420c (diff)
parent74bf40f0793fed9e01eb6164c2ce63e8c27ca205 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (214 commits) ALSA: hda - Add pin-fix for HP dc5750 ALSA: als4000: Fix potentially invalid DMA mode setup ALSA: als4000: enable burst mode ALSA: hda - Fix initial capsrc selection in patch_alc269() ASoC: TWL4030: Capture route runtime DAPM ordering fix ALSA: hda - Add PC-beep whitelist for an Intel board ALSA: hda - More relax for pending period handling ALSA: hda - Define AC_FMT_* constants ALSA: hda - Fix beep frequency on IDT 92HD73xx and 92HD71Bxx codecs ALSA: hda - Add support for HDMI HBR passthrough ALSA: hda - Set Stream Type in Stream Format according to AES0 ALSA: hda - Fix Thinkpad X300 so SPDIF is not exposed ALSA: hda - FIX to not expose SPDIF on Thinkpad X301, since it does not have the ability to use SPDIF ASoC: wm9081: fix resource reclaim in wm9081_register error path ASoC: wm8978: fix a memory leak if a wm8978_register fail ASoC: wm8974: fix a memory leak if another WM8974 is registered ASoC: wm8961: fix resource reclaim in wm8961_register error path ASoC: wm8955: fix resource reclaim in wm8955_register error path ASoC: wm8940: fix a memory leak if wm8940_register return error ASoC: wm8904: fix resource reclaim in wm8904_register error path ...
Diffstat (limited to 'arch/arm/mach-ep93xx')
-rw-r--r--arch/arm/mach-ep93xx/clock.c67
-rw-r--r--arch/arm/mach-ep93xx/core.c67
-rw-r--r--arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h10
-rw-r--r--arch/arm/mach-ep93xx/include/mach/platform.h3
-rw-r--r--arch/arm/mach-ep93xx/snappercl15.c1
5 files changed, 147 insertions, 1 deletions
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index 7f3039761d9..8bf3cec98cf 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -43,7 +43,8 @@ static unsigned long get_uart_rate(struct clk *clk);
43 43
44static int set_keytchclk_rate(struct clk *clk, unsigned long rate); 44static int set_keytchclk_rate(struct clk *clk, unsigned long rate);
45static int set_div_rate(struct clk *clk, unsigned long rate); 45static int set_div_rate(struct clk *clk, unsigned long rate);
46 46static int set_i2s_sclk_rate(struct clk *clk, unsigned long rate);
47static int set_i2s_lrclk_rate(struct clk *clk, unsigned long rate);
47 48
48static struct clk clk_xtali = { 49static struct clk clk_xtali = {
49 .rate = EP93XX_EXT_CLK_RATE, 50 .rate = EP93XX_EXT_CLK_RATE,
@@ -112,6 +113,29 @@ static struct clk clk_video = {
112 .set_rate = set_div_rate, 113 .set_rate = set_div_rate,
113}; 114};
114 115
116static struct clk clk_i2s_mclk = {
117 .sw_locked = 1,
118 .enable_reg = EP93XX_SYSCON_I2SCLKDIV,
119 .enable_mask = EP93XX_SYSCON_CLKDIV_ENABLE,
120 .set_rate = set_div_rate,
121};
122
123static struct clk clk_i2s_sclk = {
124 .sw_locked = 1,
125 .parent = &clk_i2s_mclk,
126 .enable_reg = EP93XX_SYSCON_I2SCLKDIV,
127 .enable_mask = EP93XX_SYSCON_I2SCLKDIV_SENA,
128 .set_rate = set_i2s_sclk_rate,
129};
130
131static struct clk clk_i2s_lrclk = {
132 .sw_locked = 1,
133 .parent = &clk_i2s_sclk,
134 .enable_reg = EP93XX_SYSCON_I2SCLKDIV,
135 .enable_mask = EP93XX_SYSCON_I2SCLKDIV_SENA,
136 .set_rate = set_i2s_lrclk_rate,
137};
138
115/* DMA Clocks */ 139/* DMA Clocks */
116static struct clk clk_m2p0 = { 140static struct clk clk_m2p0 = {
117 .parent = &clk_h, 141 .parent = &clk_h,
@@ -191,6 +215,9 @@ static struct clk_lookup clocks[] = {
191 INIT_CK("ep93xx-keypad", NULL, &clk_keypad), 215 INIT_CK("ep93xx-keypad", NULL, &clk_keypad),
192 INIT_CK("ep93xx-fb", NULL, &clk_video), 216 INIT_CK("ep93xx-fb", NULL, &clk_video),
193 INIT_CK("ep93xx-spi.0", NULL, &clk_spi), 217 INIT_CK("ep93xx-spi.0", NULL, &clk_spi),
218 INIT_CK("ep93xx-i2s", "mclk", &clk_i2s_mclk),
219 INIT_CK("ep93xx-i2s", "sclk", &clk_i2s_sclk),
220 INIT_CK("ep93xx-i2s", "lrclk", &clk_i2s_lrclk),
194 INIT_CK(NULL, "pwm_clk", &clk_pwm), 221 INIT_CK(NULL, "pwm_clk", &clk_pwm),
195 INIT_CK(NULL, "m2p0", &clk_m2p0), 222 INIT_CK(NULL, "m2p0", &clk_m2p0),
196 INIT_CK(NULL, "m2p1", &clk_m2p1), 223 INIT_CK(NULL, "m2p1", &clk_m2p1),
@@ -401,6 +428,44 @@ static int set_div_rate(struct clk *clk, unsigned long rate)
401 return 0; 428 return 0;
402} 429}
403 430
431static int set_i2s_sclk_rate(struct clk *clk, unsigned long rate)
432{
433 unsigned val = __raw_readl(clk->enable_reg);
434
435 if (rate == clk_i2s_mclk.rate / 2)
436 ep93xx_syscon_swlocked_write(val & ~EP93XX_I2SCLKDIV_SDIV,
437 clk->enable_reg);
438 else if (rate == clk_i2s_mclk.rate / 4)
439 ep93xx_syscon_swlocked_write(val | EP93XX_I2SCLKDIV_SDIV,
440 clk->enable_reg);
441 else
442 return -EINVAL;
443
444 clk_i2s_sclk.rate = rate;
445 return 0;
446}
447
448static int set_i2s_lrclk_rate(struct clk *clk, unsigned long rate)
449{
450 unsigned val = __raw_readl(clk->enable_reg) &
451 ~EP93XX_I2SCLKDIV_LRDIV_MASK;
452
453 if (rate == clk_i2s_sclk.rate / 32)
454 ep93xx_syscon_swlocked_write(val | EP93XX_I2SCLKDIV_LRDIV32,
455 clk->enable_reg);
456 else if (rate == clk_i2s_sclk.rate / 64)
457 ep93xx_syscon_swlocked_write(val | EP93XX_I2SCLKDIV_LRDIV64,
458 clk->enable_reg);
459 else if (rate == clk_i2s_sclk.rate / 128)
460 ep93xx_syscon_swlocked_write(val | EP93XX_I2SCLKDIV_LRDIV128,
461 clk->enable_reg);
462 else
463 return -EINVAL;
464
465 clk_i2s_lrclk.rate = rate;
466 return 0;
467}
468
404int clk_set_rate(struct clk *clk, unsigned long rate) 469int clk_set_rate(struct clk *clk, unsigned long rate)
405{ 470{
406 if (clk->set_rate) 471 if (clk->set_rate)
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 8e37a045188..4cb55d3902f 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -758,6 +758,73 @@ void ep93xx_keypad_release_gpio(struct platform_device *pdev)
758} 758}
759EXPORT_SYMBOL(ep93xx_keypad_release_gpio); 759EXPORT_SYMBOL(ep93xx_keypad_release_gpio);
760 760
761/*************************************************************************
762 * EP93xx I2S audio peripheral handling
763 *************************************************************************/
764static struct resource ep93xx_i2s_resource[] = {
765 {
766 .start = EP93XX_I2S_PHYS_BASE,
767 .end = EP93XX_I2S_PHYS_BASE + 0x100 - 1,
768 .flags = IORESOURCE_MEM,
769 },
770};
771
772static struct platform_device ep93xx_i2s_device = {
773 .name = "ep93xx-i2s",
774 .id = -1,
775 .num_resources = ARRAY_SIZE(ep93xx_i2s_resource),
776 .resource = ep93xx_i2s_resource,
777};
778
779void __init ep93xx_register_i2s(void)
780{
781 platform_device_register(&ep93xx_i2s_device);
782}
783
784#define EP93XX_SYSCON_DEVCFG_I2S_MASK (EP93XX_SYSCON_DEVCFG_I2SONSSP | \
785 EP93XX_SYSCON_DEVCFG_I2SONAC97)
786
787#define EP93XX_I2SCLKDIV_MASK (EP93XX_SYSCON_I2SCLKDIV_ORIDE | \
788 EP93XX_SYSCON_I2SCLKDIV_SPOL)
789
790int ep93xx_i2s_acquire(unsigned i2s_pins, unsigned i2s_config)
791{
792 unsigned val;
793
794 /* Sanity check */
795 if (i2s_pins & ~EP93XX_SYSCON_DEVCFG_I2S_MASK)
796 return -EINVAL;
797 if (i2s_config & ~EP93XX_I2SCLKDIV_MASK)
798 return -EINVAL;
799
800 /* Must have only one of I2SONSSP/I2SONAC97 set */
801 if ((i2s_pins & EP93XX_SYSCON_DEVCFG_I2SONSSP) ==
802 (i2s_pins & EP93XX_SYSCON_DEVCFG_I2SONAC97))
803 return -EINVAL;
804
805 ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_I2S_MASK);
806 ep93xx_devcfg_set_bits(i2s_pins);
807
808 /*
809 * This is potentially racy with the clock api for i2s_mclk, sclk and
810 * lrclk. Since the i2s driver is the only user of those clocks we
811 * rely on it to prevent parallel use of this function and the
812 * clock api for the i2s clocks.
813 */
814 val = __raw_readl(EP93XX_SYSCON_I2SCLKDIV);
815 val &= ~EP93XX_I2SCLKDIV_MASK;
816 val |= i2s_config;
817 ep93xx_syscon_swlocked_write(val, EP93XX_SYSCON_I2SCLKDIV);
818
819 return 0;
820}
821EXPORT_SYMBOL(ep93xx_i2s_acquire);
822
823void ep93xx_i2s_release(void)
824{
825 ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_I2S_MASK);
826}
827EXPORT_SYMBOL(ep93xx_i2s_release);
761 828
762extern void ep93xx_gpio_init(void); 829extern void ep93xx_gpio_init(void);
763 830
diff --git a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
index b1e096f0c2d..c54b3e56ba6 100644
--- a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
+++ b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
@@ -93,6 +93,7 @@
93/* APB peripherals */ 93/* APB peripherals */
94#define EP93XX_TIMER_BASE EP93XX_APB_IOMEM(0x00010000) 94#define EP93XX_TIMER_BASE EP93XX_APB_IOMEM(0x00010000)
95 95
96#define EP93XX_I2S_PHYS_BASE EP93XX_APB_PHYS(0x00020000)
96#define EP93XX_I2S_BASE EP93XX_APB_IOMEM(0x00020000) 97#define EP93XX_I2S_BASE EP93XX_APB_IOMEM(0x00020000)
97 98
98#define EP93XX_SECURITY_BASE EP93XX_APB_IOMEM(0x00030000) 99#define EP93XX_SECURITY_BASE EP93XX_APB_IOMEM(0x00030000)
@@ -194,6 +195,15 @@
194#define EP93XX_SYSCON_CLKDIV_ESEL (1<<14) 195#define EP93XX_SYSCON_CLKDIV_ESEL (1<<14)
195#define EP93XX_SYSCON_CLKDIV_PSEL (1<<13) 196#define EP93XX_SYSCON_CLKDIV_PSEL (1<<13)
196#define EP93XX_SYSCON_CLKDIV_PDIV_SHIFT 8 197#define EP93XX_SYSCON_CLKDIV_PDIV_SHIFT 8
198#define EP93XX_SYSCON_I2SCLKDIV EP93XX_SYSCON_REG(0x8c)
199#define EP93XX_SYSCON_I2SCLKDIV_SENA (1<<31)
200#define EP93XX_SYSCON_I2SCLKDIV_ORIDE (1<<29)
201#define EP93XX_SYSCON_I2SCLKDIV_SPOL (1<<19)
202#define EP93XX_I2SCLKDIV_SDIV (1 << 16)
203#define EP93XX_I2SCLKDIV_LRDIV32 (0 << 17)
204#define EP93XX_I2SCLKDIV_LRDIV64 (1 << 17)
205#define EP93XX_I2SCLKDIV_LRDIV128 (2 << 17)
206#define EP93XX_I2SCLKDIV_LRDIV_MASK (3 << 17)
197#define EP93XX_SYSCON_KEYTCHCLKDIV EP93XX_SYSCON_REG(0x90) 207#define EP93XX_SYSCON_KEYTCHCLKDIV EP93XX_SYSCON_REG(0x90)
198#define EP93XX_SYSCON_KEYTCHCLKDIV_TSEN (1<<31) 208#define EP93XX_SYSCON_KEYTCHCLKDIV_TSEN (1<<31)
199#define EP93XX_SYSCON_KEYTCHCLKDIV_ADIV (1<<16) 209#define EP93XX_SYSCON_KEYTCHCLKDIV_ADIV (1<<16)
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h
index a6c09176334..3330b36d79e 100644
--- a/arch/arm/mach-ep93xx/include/mach/platform.h
+++ b/arch/arm/mach-ep93xx/include/mach/platform.h
@@ -58,6 +58,9 @@ void ep93xx_pwm_release_gpio(struct platform_device *pdev);
58void ep93xx_register_keypad(struct ep93xx_keypad_platform_data *data); 58void ep93xx_register_keypad(struct ep93xx_keypad_platform_data *data);
59int ep93xx_keypad_acquire_gpio(struct platform_device *pdev); 59int ep93xx_keypad_acquire_gpio(struct platform_device *pdev);
60void ep93xx_keypad_release_gpio(struct platform_device *pdev); 60void ep93xx_keypad_release_gpio(struct platform_device *pdev);
61void ep93xx_register_i2s(void);
62int ep93xx_i2s_acquire(unsigned i2s_pins, unsigned i2s_config);
63void ep93xx_i2s_release(void);
61 64
62void ep93xx_init_devices(void); 65void ep93xx_init_devices(void);
63extern struct sys_timer ep93xx_timer; 66extern struct sys_timer ep93xx_timer;
diff --git a/arch/arm/mach-ep93xx/snappercl15.c b/arch/arm/mach-ep93xx/snappercl15.c
index 38deaee4039..a12c8930129 100644
--- a/arch/arm/mach-ep93xx/snappercl15.c
+++ b/arch/arm/mach-ep93xx/snappercl15.c
@@ -157,6 +157,7 @@ static void __init snappercl15_init_machine(void)
157 ep93xx_register_i2c(&snappercl15_i2c_gpio_data, snappercl15_i2c_data, 157 ep93xx_register_i2c(&snappercl15_i2c_gpio_data, snappercl15_i2c_data,
158 ARRAY_SIZE(snappercl15_i2c_data)); 158 ARRAY_SIZE(snappercl15_i2c_data));
159 ep93xx_register_fb(&snappercl15_fb_info); 159 ep93xx_register_fb(&snappercl15_fb_info);
160 ep93xx_register_i2s();
160 platform_device_register(&snappercl15_nand_device); 161 platform_device_register(&snappercl15_nand_device);
161} 162}
162 163