aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ep93xx/core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-06-09 06:15:10 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-06-09 06:15:10 -0400
commit6e03a61544c368c2c3ff946c1ce7807e5c36a527 (patch)
tree29253331da9680b5f81ba8715202044f45861666 /arch/arm/mach-ep93xx/core.c
parent9eb34302681d3f6cf0b186aae31ba08cbd5f22fb (diff)
parented67ea82c0d9a163458dc6a69a7a3123db1a8b3b (diff)
Merge branch 'ep93xx' into for-2.6.36
Trivial add/add fixup required in the clock table. Conflicts: arch/arm/mach-ep93xx/clock.c
Diffstat (limited to 'arch/arm/mach-ep93xx/core.c')
-rw-r--r--arch/arm/mach-ep93xx/core.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 9092677f63e..b4ee5409eb7 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -714,6 +714,73 @@ void ep93xx_keypad_release_gpio(struct platform_device *pdev)
714} 714}
715EXPORT_SYMBOL(ep93xx_keypad_release_gpio); 715EXPORT_SYMBOL(ep93xx_keypad_release_gpio);
716 716
717/*************************************************************************
718 * EP93xx I2S audio peripheral handling
719 *************************************************************************/
720static struct resource ep93xx_i2s_resource[] = {
721 {
722 .start = EP93XX_I2S_PHYS_BASE,
723 .end = EP93XX_I2S_PHYS_BASE + 0x100 - 1,
724 .flags = IORESOURCE_MEM,
725 },
726};
727
728static struct platform_device ep93xx_i2s_device = {
729 .name = "ep93xx-i2s",
730 .id = -1,
731 .num_resources = ARRAY_SIZE(ep93xx_i2s_resource),
732 .resource = ep93xx_i2s_resource,
733};
734
735void __init ep93xx_register_i2s(void)
736{
737 platform_device_register(&ep93xx_i2s_device);
738}
739
740#define EP93XX_SYSCON_DEVCFG_I2S_MASK (EP93XX_SYSCON_DEVCFG_I2SONSSP | \
741 EP93XX_SYSCON_DEVCFG_I2SONAC97)
742
743#define EP93XX_I2SCLKDIV_MASK (EP93XX_SYSCON_I2SCLKDIV_ORIDE | \
744 EP93XX_SYSCON_I2SCLKDIV_SPOL)
745
746int ep93xx_i2s_acquire(unsigned i2s_pins, unsigned i2s_config)
747{
748 unsigned val;
749
750 /* Sanity check */
751 if (i2s_pins & ~EP93XX_SYSCON_DEVCFG_I2S_MASK)
752 return -EINVAL;
753 if (i2s_config & ~EP93XX_I2SCLKDIV_MASK)
754 return -EINVAL;
755
756 /* Must have only one of I2SONSSP/I2SONAC97 set */
757 if ((i2s_pins & EP93XX_SYSCON_DEVCFG_I2SONSSP) ==
758 (i2s_pins & EP93XX_SYSCON_DEVCFG_I2SONAC97))
759 return -EINVAL;
760
761 ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_I2S_MASK);
762 ep93xx_devcfg_set_bits(i2s_pins);
763
764 /*
765 * This is potentially racy with the clock api for i2s_mclk, sclk and
766 * lrclk. Since the i2s driver is the only user of those clocks we
767 * rely on it to prevent parallel use of this function and the
768 * clock api for the i2s clocks.
769 */
770 val = __raw_readl(EP93XX_SYSCON_I2SCLKDIV);
771 val &= ~EP93XX_I2SCLKDIV_MASK;
772 val |= i2s_config;
773 ep93xx_syscon_swlocked_write(val, EP93XX_SYSCON_I2SCLKDIV);
774
775 return 0;
776}
777EXPORT_SYMBOL(ep93xx_i2s_acquire);
778
779void ep93xx_i2s_release(void)
780{
781 ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_I2S_MASK);
782}
783EXPORT_SYMBOL(ep93xx_i2s_release);
717 784
718extern void ep93xx_gpio_init(void); 785extern void ep93xx_gpio_init(void);
719 786