aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/txx9
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
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')
-rw-r--r--arch/mips/txx9/Kconfig3
-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
-rw-r--r--arch/mips/txx9/rbtx4927/setup.c8
-rw-r--r--arch/mips/txx9/rbtx4938/setup.c2
-rw-r--r--arch/mips/txx9/rbtx4939/setup.c2
8 files changed, 112 insertions, 2 deletions
diff --git a/arch/mips/txx9/Kconfig b/arch/mips/txx9/Kconfig
index 0db7cf38ed8b..852ae4bb7a85 100644
--- a/arch/mips/txx9/Kconfig
+++ b/arch/mips/txx9/Kconfig
@@ -69,6 +69,7 @@ config SOC_TX4927
69 select IRQ_TXX9 69 select IRQ_TXX9
70 select PCI_TX4927 70 select PCI_TX4927
71 select GPIO_TXX9 71 select GPIO_TXX9
72 select HAS_TXX9_ACLC
72 73
73config SOC_TX4938 74config SOC_TX4938
74 bool 75 bool
@@ -78,6 +79,7 @@ config SOC_TX4938
78 select IRQ_TXX9 79 select IRQ_TXX9
79 select PCI_TX4927 80 select PCI_TX4927
80 select GPIO_TXX9 81 select GPIO_TXX9
82 select HAS_TXX9_ACLC
81 83
82config SOC_TX4939 84config SOC_TX4939
83 bool 85 bool
@@ -85,6 +87,7 @@ config SOC_TX4939
85 select HAS_TXX9_SERIAL 87 select HAS_TXX9_SERIAL
86 select HW_HAS_PCI 88 select HW_HAS_PCI
87 select PCI_TX4927 89 select PCI_TX4927
90 select HAS_TXX9_ACLC
88 91
89config TXX9_7SEGLED 92config TXX9_7SEGLED
90 bool 93 bool
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;
diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c
index 332cdbc7fcef..ee468eaee4f7 100644
--- a/arch/mips/txx9/rbtx4927/setup.c
+++ b/arch/mips/txx9/rbtx4927/setup.c
@@ -337,10 +337,14 @@ static void __init rbtx4927_device_init(void)
337 rbtx4927_ne_init(); 337 rbtx4927_ne_init();
338 tx4927_wdt_init(); 338 tx4927_wdt_init();
339 rbtx4927_mtd_init(); 339 rbtx4927_mtd_init();
340 if (TX4927_REV_PCODE() == 0x4927) 340 if (TX4927_REV_PCODE() == 0x4927) {
341 tx4927_dmac_init(2); 341 tx4927_dmac_init(2);
342 else 342 tx4927_aclc_init(0, 1);
343 } else {
343 tx4938_dmac_init(0, 2); 344 tx4938_dmac_init(0, 2);
345 tx4938_aclc_init();
346 }
347 platform_device_register_simple("txx9aclc-generic", -1, NULL, 0);
344 txx9_iocled_init(RBTX4927_LED_ADDR - IO_BASE, -1, 3, 1, "green", NULL); 348 txx9_iocled_init(RBTX4927_LED_ADDR - IO_BASE, -1, 3, 1, "green", NULL);
345 rbtx4927_gpioled_init(); 349 rbtx4927_gpioled_init();
346} 350}
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
index 37c5e3d20287..8da66e956ee6 100644
--- a/arch/mips/txx9/rbtx4938/setup.c
+++ b/arch/mips/txx9/rbtx4938/setup.c
@@ -356,6 +356,8 @@ static void __init rbtx4938_device_init(void)
356 tx4938_ndfmc_init(10, 35); 356 tx4938_ndfmc_init(10, 35);
357 tx4938_ata_init(RBTX4938_IRQ_IOC_ATA, 0, 1); 357 tx4938_ata_init(RBTX4938_IRQ_IOC_ATA, 0, 1);
358 tx4938_dmac_init(0, 2); 358 tx4938_dmac_init(0, 2);
359 tx4938_aclc_init();
360 platform_device_register_simple("txx9aclc-generic", -1, NULL, 0);
359 txx9_iocled_init(RBTX4938_LED_ADDR - IO_BASE, -1, 8, 1, "green", NULL); 361 txx9_iocled_init(RBTX4938_LED_ADDR - IO_BASE, -1, 8, 1, "green", NULL);
360} 362}
361 363
diff --git a/arch/mips/txx9/rbtx4939/setup.c b/arch/mips/txx9/rbtx4939/setup.c
index 91f2ec8fa273..d5ad5abb80da 100644
--- a/arch/mips/txx9/rbtx4939/setup.c
+++ b/arch/mips/txx9/rbtx4939/setup.c
@@ -499,6 +499,8 @@ static void __init rbtx4939_device_init(void)
499 tx4939_ata_init(); 499 tx4939_ata_init();
500 tx4939_rtc_init(); 500 tx4939_rtc_init();
501 tx4939_dmac_init(0, 2); 501 tx4939_dmac_init(0, 2);
502 tx4939_aclc_init();
503 platform_device_register_simple("txx9aclc-generic", -1, NULL, 0);
502} 504}
503 505
504static void __init rbtx4939_setup(void) 506static void __init rbtx4939_setup(void)