aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJarkko Nikula <jarkko.nikula@bitmer.com>2011-09-26 03:45:40 -0400
committerTony Lindgren <tony@atomide.com>2011-09-26 20:47:01 -0400
commit1a6458847dd25e7ade3d633e5a374b836e38b9ae (patch)
treea6259345e1207a92e9a5d6f6a78c3fbf8036f10e /arch
parentcdc71514a0f4f3e8c995f18d1119cef01a501dac (diff)
ARM: OMAP: mcbsp: Make wakeup control generic
Currently wakeup control code is compiled only when CONFIG_ARCH_OMAP3 is set even it should be available for CONFIG_ARCH_OMAP4 only builds also. Fix this by making wakeup control generic so that it is executed whenever new feature flag has_wakeup in platform data is set. Currently flag is set for McBSP config types 3 and 4. Remove also old comments about idle mode settings and HW bug workarounds that were not updated during hwmod conversion. Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/mcbsp.c3
-rw-r--r--arch/arm/plat-omap/include/plat/mcbsp.h3
-rw-r--r--arch/arm/plat-omap/mcbsp.c43
3 files changed, 15 insertions, 34 deletions
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 43b9ccffba9e..de3457d750ff 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -141,6 +141,9 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
141 pdata->buffer_size = 0x80; 141 pdata->buffer_size = 0x80;
142 } 142 }
143 143
144 if (oh->class->rev >= MCBSP_CONFIG_TYPE3)
145 pdata->has_wakeup = true;
146
144 oh_device[0] = oh; 147 oh_device[0] = oh;
145 148
146 if (oh->dev_attr) { 149 if (oh->dev_attr) {
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h
index 14bc1cbe43d9..ac48d836ab38 100644
--- a/arch/arm/plat-omap/include/plat/mcbsp.h
+++ b/arch/arm/plat-omap/include/plat/mcbsp.h
@@ -317,6 +317,9 @@ struct omap_mcbsp_platform_data {
317 u16 buffer_size; 317 u16 buffer_size;
318 u8 reg_size; 318 u8 reg_size;
319 u8 reg_step; 319 u8 reg_step;
320
321 /* McBSP platform and instance specific features */
322 bool has_wakeup; /* Wakeup capability */
320}; 323};
321 324
322struct omap_mcbsp_st_data { 325struct omap_mcbsp_st_data {
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 623f2c1e9d4a..0338ad07eb71 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -659,35 +659,7 @@ int omap_mcbsp_get_dma_op_mode(unsigned int id)
659} 659}
660EXPORT_SYMBOL(omap_mcbsp_get_dma_op_mode); 660EXPORT_SYMBOL(omap_mcbsp_get_dma_op_mode);
661 661
662static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp)
663{
664 /*
665 * Enable wakup behavior, smart idle and all wakeups
666 * REVISIT: some wakeups may be unnecessary
667 */
668 if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
669 MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN);
670 }
671}
672
673static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp)
674{
675 /*
676 * Disable wakup behavior, smart idle and all wakeups
677 */
678 if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
679 /*
680 * HW bug workaround - If no_idle mode is taken, we need to
681 * go to smart_idle before going to always_idle, or the
682 * device will not hit retention anymore.
683 */
684
685 MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
686 }
687}
688#else 662#else
689static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp) {}
690static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp) {}
691static inline void omap_st_start(struct omap_mcbsp *mcbsp) {} 663static inline void omap_st_start(struct omap_mcbsp *mcbsp) {}
692static inline void omap_st_stop(struct omap_mcbsp *mcbsp) {} 664static inline void omap_st_stop(struct omap_mcbsp *mcbsp) {}
693#endif 665#endif
@@ -726,8 +698,9 @@ int omap_mcbsp_request(unsigned int id)
726 698
727 pm_runtime_get_sync(mcbsp->dev); 699 pm_runtime_get_sync(mcbsp->dev);
728 700
729 /* Do procedure specific to omap34xx arch, if applicable */ 701 /* Enable wakeup behavior */
730 omap34xx_mcbsp_request(mcbsp); 702 if (mcbsp->pdata->has_wakeup)
703 MCBSP_WRITE(mcbsp, WAKEUPEN, XRDYEN | RRDYEN);
731 704
732 /* 705 /*
733 * Make sure that transmitter, receiver and sample-rate generator are 706 * Make sure that transmitter, receiver and sample-rate generator are
@@ -764,8 +737,9 @@ err_clk_disable:
764 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) 737 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
765 mcbsp->pdata->ops->free(id); 738 mcbsp->pdata->ops->free(id);
766 739
767 /* Do procedure specific to omap34xx arch, if applicable */ 740 /* Disable wakeup behavior */
768 omap34xx_mcbsp_free(mcbsp); 741 if (mcbsp->pdata->has_wakeup)
742 MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
769 743
770 pm_runtime_put_sync(mcbsp->dev); 744 pm_runtime_put_sync(mcbsp->dev);
771 745
@@ -794,8 +768,9 @@ void omap_mcbsp_free(unsigned int id)
794 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free) 768 if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
795 mcbsp->pdata->ops->free(id); 769 mcbsp->pdata->ops->free(id);
796 770
797 /* Do procedure specific to omap34xx arch, if applicable */ 771 /* Disable wakeup behavior */
798 omap34xx_mcbsp_free(mcbsp); 772 if (mcbsp->pdata->has_wakeup)
773 MCBSP_WRITE(mcbsp, WAKEUPEN, 0);
799 774
800 pm_runtime_put_sync(mcbsp->dev); 775 pm_runtime_put_sync(mcbsp->dev);
801 776