aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/txx9/generic
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2009-05-19 09:12:22 -0400
committerRalf Baechle <ralf@linux-mips.org>2009-06-17 06:06:25 -0400
commit742cd5867b2ef7ce865d7ab67574c4e3aa1fb155 (patch)
treeb167001ac5f1c165ff29b4cacd16db94f50c7b77 /arch/mips/txx9/generic
parente8635b484f644c7873e6091f15330c49396f2cbc (diff)
MIPS: TXx9: Add ACLC support
Add platform support for ACLC of TXx9 SoCs. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/txx9/generic')
-rw-r--r--arch/mips/txx9/generic/setup.c36
-rw-r--r--arch/mips/txx9/generic/setup_tx4927.c43
-rw-r--r--arch/mips/txx9/generic/setup_tx4938.c11
-rw-r--r--arch/mips/txx9/generic/setup_tx4939.c9
4 files changed, 99 insertions, 0 deletions
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index 369d8637217d..7f9101257615 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -876,3 +876,39 @@ void __init txx9_dmac_init(int id, unsigned long baseaddr, int irq,
876 } 876 }
877#endif 877#endif
878} 878}
879
880void __init txx9_aclc_init(unsigned long baseaddr, int irq,
881 unsigned int dmac_id,
882 unsigned int dma_chan_out,
883 unsigned int dma_chan_in)
884{
885#if defined(CONFIG_SND_SOC_TXX9ACLC) || \
886 defined(CONFIG_SND_SOC_TXX9ACLC_MODULE)
887 unsigned int dma_base = dmac_id * TXX9_DMA_MAX_NR_CHANNELS;
888 struct resource res[] = {
889 {
890 .start = baseaddr,
891 .end = baseaddr + 0x100 - 1,
892 .flags = IORESOURCE_MEM,
893 }, {
894 .start = irq,
895 .flags = IORESOURCE_IRQ,
896 }, {
897 .name = "txx9dmac-chan",
898 .start = dma_base + dma_chan_out,
899 .flags = IORESOURCE_DMA,
900 }, {
901 .name = "txx9dmac-chan",
902 .start = dma_base + dma_chan_in,
903 .flags = IORESOURCE_DMA,
904 }
905 };
906 struct platform_device *pdev =
907 platform_device_alloc("txx9aclc-ac97", -1);
908
909 if (!pdev ||
910 platform_device_add_resources(pdev, res, ARRAY_SIZE(res)) ||
911 platform_device_add(pdev))
912 platform_device_put(pdev);
913#endif
914}
diff --git a/arch/mips/txx9/generic/setup_tx4927.c b/arch/mips/txx9/generic/setup_tx4927.c
index 6b681cd7f8fb..3418b2a90f7e 100644
--- a/arch/mips/txx9/generic/setup_tx4927.c
+++ b/arch/mips/txx9/generic/setup_tx4927.c
@@ -265,6 +265,49 @@ void __init tx4927_dmac_init(int memcpy_chan)
265 TXX9_IRQ_BASE + TX4927_IR_DMA(0), &plat_data); 265 TXX9_IRQ_BASE + TX4927_IR_DMA(0), &plat_data);
266} 266}
267 267
268void __init tx4927_aclc_init(unsigned int dma_chan_out,
269 unsigned int dma_chan_in)
270{
271 u64 pcfg = __raw_readq(&tx4927_ccfgptr->pcfg);
272 __u64 dmasel_mask = 0, dmasel = 0;
273 unsigned long flags;
274
275 if (!(pcfg & TX4927_PCFG_SEL2))
276 return;
277 /* setup DMASEL (playback:ACLC ch0, capture:ACLC ch1) */
278 switch (dma_chan_out) {
279 case 0:
280 dmasel_mask |= TX4927_PCFG_DMASEL0_MASK;
281 dmasel |= TX4927_PCFG_DMASEL0_ACL0;
282 break;
283 case 2:
284 dmasel_mask |= TX4927_PCFG_DMASEL2_MASK;
285 dmasel |= TX4927_PCFG_DMASEL2_ACL0;
286 break;
287 default:
288 return;
289 }
290 switch (dma_chan_in) {
291 case 1:
292 dmasel_mask |= TX4927_PCFG_DMASEL1_MASK;
293 dmasel |= TX4927_PCFG_DMASEL1_ACL1;
294 break;
295 case 3:
296 dmasel_mask |= TX4927_PCFG_DMASEL3_MASK;
297 dmasel |= TX4927_PCFG_DMASEL3_ACL1;
298 break;
299 default:
300 return;
301 }
302 local_irq_save(flags);
303 txx9_clear64(&tx4927_ccfgptr->pcfg, dmasel_mask);
304 txx9_set64(&tx4927_ccfgptr->pcfg, dmasel);
305 local_irq_restore(flags);
306 txx9_aclc_init(TX4927_ACLC_REG & 0xfffffffffULL,
307 TXX9_IRQ_BASE + TX4927_IR_ACLC,
308 0, dma_chan_out, dma_chan_in);
309}
310
268static void __init tx4927_stop_unused_modules(void) 311static void __init tx4927_stop_unused_modules(void)
269{ 312{
270 __u64 pcfg, rst = 0, ckd = 0; 313 __u64 pcfg, rst = 0, ckd = 0;
diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c
index b2b85293cd44..4dfdb52e8665 100644
--- a/arch/mips/txx9/generic/setup_tx4938.c
+++ b/arch/mips/txx9/generic/setup_tx4938.c
@@ -414,6 +414,17 @@ void __init tx4938_dmac_init(int memcpy_chan0, int memcpy_chan1)
414 } 414 }
415} 415}
416 416
417void __init tx4938_aclc_init(void)
418{
419 u64 pcfg = __raw_readq(&tx4938_ccfgptr->pcfg);
420
421 if ((pcfg & TX4938_PCFG_SEL2) &&
422 !(pcfg & TX4938_PCFG_ETH0_SEL))
423 txx9_aclc_init(TX4938_ACLC_REG & 0xfffffffffULL,
424 TXX9_IRQ_BASE + TX4938_IR_ACLC,
425 1, 0, 1);
426}
427
417static void __init tx4938_stop_unused_modules(void) 428static void __init tx4938_stop_unused_modules(void)
418{ 429{
419 __u64 pcfg, rst = 0, ckd = 0; 430 __u64 pcfg, rst = 0, ckd = 0;
diff --git a/arch/mips/txx9/generic/setup_tx4939.c b/arch/mips/txx9/generic/setup_tx4939.c
index 98effef64fdb..71396863f54e 100644
--- a/arch/mips/txx9/generic/setup_tx4939.c
+++ b/arch/mips/txx9/generic/setup_tx4939.c
@@ -485,6 +485,15 @@ void __init tx4939_dmac_init(int memcpy_chan0, int memcpy_chan1)
485 } 485 }
486} 486}
487 487
488void __init tx4939_aclc_init(void)
489{
490 u64 pcfg = __raw_readq(&tx4939_ccfgptr->pcfg);
491
492 if ((pcfg & TX4939_PCFG_I2SMODE_MASK) == TX4939_PCFG_I2SMODE_ACLC)
493 txx9_aclc_init(TX4939_ACLC_REG & 0xfffffffffULL,
494 TXX9_IRQ_BASE + TX4939_IR_ACLC, 1, 0, 1);
495}
496
488static void __init tx4939_stop_unused_modules(void) 497static void __init tx4939_stop_unused_modules(void)
489{ 498{
490 __u64 pcfg, rst = 0, ckd = 0; 499 __u64 pcfg, rst = 0, ckd = 0;