aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2009-04-22 11:40:31 -0400
committerRalf Baechle <ralf@linux-mips.org>2009-06-17 06:06:25 -0400
commitf48c8c958a2d39f13dace880d15a6e711aafe577 (patch)
tree0d0c6f4aebca09ce7279a59a25810e9d6e09dd85 /arch
parentea76f0b3759283ec3cc06c86e266bf0fa6a981d2 (diff)
MIPS: TXx9: Add DMAC support
Add platform support for DMAC of TXx9 SoCs. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/include/asm/txx9/dmac.h3
-rw-r--r--arch/mips/include/asm/txx9/tx4927.h2
-rw-r--r--arch/mips/include/asm/txx9/tx4938.h1
-rw-r--r--arch/mips/include/asm/txx9/tx4939.h1
-rw-r--r--arch/mips/txx9/generic/setup.c55
-rw-r--r--arch/mips/txx9/generic/setup_tx4927.c12
-rw-r--r--arch/mips/txx9/generic/setup_tx4938.c21
-rw-r--r--arch/mips/txx9/generic/setup_tx4939.c21
-rw-r--r--arch/mips/txx9/rbtx4927/setup.c4
-rw-r--r--arch/mips/txx9/rbtx4938/setup.c1
-rw-r--r--arch/mips/txx9/rbtx4939/setup.c1
11 files changed, 112 insertions, 10 deletions
diff --git a/arch/mips/include/asm/txx9/dmac.h b/arch/mips/include/asm/txx9/dmac.h
index a87d1c3e4f5b..5e9151fccbb4 100644
--- a/arch/mips/include/asm/txx9/dmac.h
+++ b/arch/mips/include/asm/txx9/dmac.h
@@ -45,4 +45,7 @@ struct txx9dmac_slave {
45 unsigned int reg_width; 45 unsigned int reg_width;
46}; 46};
47 47
48void txx9_dmac_init(int id, unsigned long baseaddr, int irq,
49 const struct txx9dmac_platform_data *pdata);
50
48#endif /* __ASM_TXX9_DMAC_H */ 51#endif /* __ASM_TXX9_DMAC_H */
diff --git a/arch/mips/include/asm/txx9/tx4927.h b/arch/mips/include/asm/txx9/tx4927.h
index 7d813f1cb98d..d92ae07000d3 100644
--- a/arch/mips/include/asm/txx9/tx4927.h
+++ b/arch/mips/include/asm/txx9/tx4927.h
@@ -41,6 +41,7 @@
41 41
42#define TX4927_SDRAMC_REG (TX4927_REG_BASE + 0x8000) 42#define TX4927_SDRAMC_REG (TX4927_REG_BASE + 0x8000)
43#define TX4927_EBUSC_REG (TX4927_REG_BASE + 0x9000) 43#define TX4927_EBUSC_REG (TX4927_REG_BASE + 0x9000)
44#define TX4927_DMA_REG (TX4927_REG_BASE + 0xb000)
44#define TX4927_PCIC_REG (TX4927_REG_BASE + 0xd000) 45#define TX4927_PCIC_REG (TX4927_REG_BASE + 0xd000)
45#define TX4927_CCFG_REG (TX4927_REG_BASE + 0xe000) 46#define TX4927_CCFG_REG (TX4927_REG_BASE + 0xe000)
46#define TX4927_IRC_REG (TX4927_REG_BASE + 0xf600) 47#define TX4927_IRC_REG (TX4927_REG_BASE + 0xf600)
@@ -265,5 +266,6 @@ int tx4927_pciclk66_setup(void);
265void tx4927_setup_pcierr_irq(void); 266void tx4927_setup_pcierr_irq(void);
266void tx4927_irq_init(void); 267void tx4927_irq_init(void);
267void tx4927_mtd_init(int ch); 268void tx4927_mtd_init(int ch);
269void tx4927_dmac_init(int memcpy_chan);
268 270
269#endif /* __ASM_TXX9_TX4927_H */ 271#endif /* __ASM_TXX9_TX4927_H */
diff --git a/arch/mips/include/asm/txx9/tx4938.h b/arch/mips/include/asm/txx9/tx4938.h
index cd8bc2021755..0758a0c411b1 100644
--- a/arch/mips/include/asm/txx9/tx4938.h
+++ b/arch/mips/include/asm/txx9/tx4938.h
@@ -305,5 +305,6 @@ struct tx4938ide_platform_info {
305}; 305};
306 306
307void tx4938_ata_init(unsigned int irq, unsigned int shift, int tune); 307void tx4938_ata_init(unsigned int irq, unsigned int shift, int tune);
308void tx4938_dmac_init(int memcpy_chan0, int memcpy_chan1);
308 309
309#endif 310#endif
diff --git a/arch/mips/include/asm/txx9/tx4939.h b/arch/mips/include/asm/txx9/tx4939.h
index f02c50b3abfb..1be9798a26b5 100644
--- a/arch/mips/include/asm/txx9/tx4939.h
+++ b/arch/mips/include/asm/txx9/tx4939.h
@@ -544,5 +544,6 @@ void tx4939_ata_init(void);
544void tx4939_rtc_init(void); 544void tx4939_rtc_init(void);
545void tx4939_ndfmc_init(unsigned int hold, unsigned int spw, 545void tx4939_ndfmc_init(unsigned int hold, unsigned int spw,
546 unsigned char ch_mask, unsigned char wide_mask); 546 unsigned char ch_mask, unsigned char wide_mask);
547void tx4939_dmac_init(int memcpy_chan0, int memcpy_chan1);
547 548
548#endif /* __ASM_TXX9_TX4939_H */ 549#endif /* __ASM_TXX9_TX4939_H */
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index 8a266c6a3f58..369d8637217d 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -33,6 +33,7 @@
33#include <asm/txx9/pci.h> 33#include <asm/txx9/pci.h>
34#include <asm/txx9tmr.h> 34#include <asm/txx9tmr.h>
35#include <asm/txx9/ndfmc.h> 35#include <asm/txx9/ndfmc.h>
36#include <asm/txx9/dmac.h>
36#ifdef CONFIG_CPU_TX49XX 37#ifdef CONFIG_CPU_TX49XX
37#include <asm/txx9/tx4938.h> 38#include <asm/txx9/tx4938.h>
38#endif 39#endif
@@ -821,3 +822,57 @@ void __init txx9_iocled_init(unsigned long baseaddr,
821{ 822{
822} 823}
823#endif /* CONFIG_LEDS_GPIO */ 824#endif /* CONFIG_LEDS_GPIO */
825
826void __init txx9_dmac_init(int id, unsigned long baseaddr, int irq,
827 const struct txx9dmac_platform_data *pdata)
828{
829#if defined(CONFIG_TXX9_DMAC) || defined(CONFIG_TXX9_DMAC_MODULE)
830 struct resource res[] = {
831 {
832 .start = baseaddr,
833 .end = baseaddr + 0x800 - 1,
834 .flags = IORESOURCE_MEM,
835#ifndef CONFIG_MACH_TX49XX
836 }, {
837 .start = irq,
838 .flags = IORESOURCE_IRQ,
839#endif
840 }
841 };
842#ifdef CONFIG_MACH_TX49XX
843 struct resource chan_res[] = {
844 {
845 .flags = IORESOURCE_IRQ,
846 }
847 };
848#endif
849 struct platform_device *pdev = platform_device_alloc("txx9dmac", id);
850 struct txx9dmac_chan_platform_data cpdata;
851 int i;
852
853 if (!pdev ||
854 platform_device_add_resources(pdev, res, ARRAY_SIZE(res)) ||
855 platform_device_add_data(pdev, pdata, sizeof(*pdata)) ||
856 platform_device_add(pdev)) {
857 platform_device_put(pdev);
858 return;
859 }
860 memset(&cpdata, 0, sizeof(cpdata));
861 cpdata.dmac_dev = pdev;
862 for (i = 0; i < TXX9_DMA_MAX_NR_CHANNELS; i++) {
863#ifdef CONFIG_MACH_TX49XX
864 chan_res[0].start = irq + i;
865#endif
866 pdev = platform_device_alloc("txx9dmac-chan",
867 id * TXX9_DMA_MAX_NR_CHANNELS + i);
868 if (!pdev ||
869#ifdef CONFIG_MACH_TX49XX
870 platform_device_add_resources(pdev, chan_res,
871 ARRAY_SIZE(chan_res)) ||
872#endif
873 platform_device_add_data(pdev, &cpdata, sizeof(cpdata)) ||
874 platform_device_add(pdev))
875 platform_device_put(pdev);
876 }
877#endif
878}
diff --git a/arch/mips/txx9/generic/setup_tx4927.c b/arch/mips/txx9/generic/setup_tx4927.c
index 1093549df1a8..6b681cd7f8fb 100644
--- a/arch/mips/txx9/generic/setup_tx4927.c
+++ b/arch/mips/txx9/generic/setup_tx4927.c
@@ -22,6 +22,7 @@
22#include <asm/txx9tmr.h> 22#include <asm/txx9tmr.h>
23#include <asm/txx9pio.h> 23#include <asm/txx9pio.h>
24#include <asm/txx9/generic.h> 24#include <asm/txx9/generic.h>
25#include <asm/txx9/dmac.h>
25#include <asm/txx9/tx4927.h> 26#include <asm/txx9/tx4927.h>
26 27
27static void __init tx4927_wdr_init(void) 28static void __init tx4927_wdr_init(void)
@@ -253,6 +254,17 @@ void __init tx4927_mtd_init(int ch)
253 txx9_physmap_flash_init(ch, start, size, &pdata); 254 txx9_physmap_flash_init(ch, start, size, &pdata);
254} 255}
255 256
257void __init tx4927_dmac_init(int memcpy_chan)
258{
259 struct txx9dmac_platform_data plat_data = {
260 .memcpy_chan = memcpy_chan,
261 .have_64bit_regs = true,
262 };
263
264 txx9_dmac_init(0, TX4927_DMA_REG & 0xfffffffffULL,
265 TXX9_IRQ_BASE + TX4927_IR_DMA(0), &plat_data);
266}
267
256static void __init tx4927_stop_unused_modules(void) 268static void __init tx4927_stop_unused_modules(void)
257{ 269{
258 __u64 pcfg, rst = 0, ckd = 0; 270 __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 3925219b8973..b2b85293cd44 100644
--- a/arch/mips/txx9/generic/setup_tx4938.c
+++ b/arch/mips/txx9/generic/setup_tx4938.c
@@ -24,6 +24,7 @@
24#include <asm/txx9pio.h> 24#include <asm/txx9pio.h>
25#include <asm/txx9/generic.h> 25#include <asm/txx9/generic.h>
26#include <asm/txx9/ndfmc.h> 26#include <asm/txx9/ndfmc.h>
27#include <asm/txx9/dmac.h>
27#include <asm/txx9/tx4938.h> 28#include <asm/txx9/tx4938.h>
28 29
29static void __init tx4938_wdr_init(void) 30static void __init tx4938_wdr_init(void)
@@ -239,11 +240,6 @@ void __init tx4938_setup(void)
239 for (i = 0; i < TX4938_NR_TMR; i++) 240 for (i = 0; i < TX4938_NR_TMR; i++)
240 txx9_tmr_init(TX4938_TMR_REG(i) & 0xfffffffffULL); 241 txx9_tmr_init(TX4938_TMR_REG(i) & 0xfffffffffULL);
241 242
242 /* DMA */
243 for (i = 0; i < 2; i++)
244 ____raw_writeq(TX4938_DMA_MCR_MSTEN,
245 (void __iomem *)(TX4938_DMA_REG(i) + 0x50));
246
247 /* PIO */ 243 /* PIO */
248 txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO); 244 txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO);
249 __raw_writel(0, &tx4938_pioptr->maskcpu); 245 __raw_writel(0, &tx4938_pioptr->maskcpu);
@@ -403,6 +399,21 @@ void __init tx4938_ndfmc_init(unsigned int hold, unsigned int spw)
403 txx9_ndfmc_init(baseaddr, &plat_data); 399 txx9_ndfmc_init(baseaddr, &plat_data);
404} 400}
405 401
402void __init tx4938_dmac_init(int memcpy_chan0, int memcpy_chan1)
403{
404 struct txx9dmac_platform_data plat_data = {
405 .have_64bit_regs = true,
406 };
407 int i;
408
409 for (i = 0; i < 2; i++) {
410 plat_data.memcpy_chan = i ? memcpy_chan1 : memcpy_chan0;
411 txx9_dmac_init(i, TX4938_DMA_REG(i) & 0xfffffffffULL,
412 TXX9_IRQ_BASE + TX4938_IR_DMA(i, 0),
413 &plat_data);
414 }
415}
416
406static void __init tx4938_stop_unused_modules(void) 417static void __init tx4938_stop_unused_modules(void)
407{ 418{
408 __u64 pcfg, rst = 0, ckd = 0; 419 __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 c2bf150c8838..98effef64fdb 100644
--- a/arch/mips/txx9/generic/setup_tx4939.c
+++ b/arch/mips/txx9/generic/setup_tx4939.c
@@ -28,6 +28,7 @@
28#include <asm/txx9tmr.h> 28#include <asm/txx9tmr.h>
29#include <asm/txx9/generic.h> 29#include <asm/txx9/generic.h>
30#include <asm/txx9/ndfmc.h> 30#include <asm/txx9/ndfmc.h>
31#include <asm/txx9/dmac.h>
31#include <asm/txx9/tx4939.h> 32#include <asm/txx9/tx4939.h>
32 33
33static void __init tx4939_wdr_init(void) 34static void __init tx4939_wdr_init(void)
@@ -259,11 +260,6 @@ void __init tx4939_setup(void)
259 for (i = 0; i < TX4939_NR_TMR; i++) 260 for (i = 0; i < TX4939_NR_TMR; i++)
260 txx9_tmr_init(TX4939_TMR_REG(i) & 0xfffffffffULL); 261 txx9_tmr_init(TX4939_TMR_REG(i) & 0xfffffffffULL);
261 262
262 /* DMA */
263 for (i = 0; i < 2; i++)
264 ____raw_writeq(TX4938_DMA_MCR_MSTEN,
265 (void __iomem *)(TX4939_DMA_REG(i) + 0x50));
266
267 /* set PCIC1 reset (required to prevent hangup on BIST) */ 263 /* set PCIC1 reset (required to prevent hangup on BIST) */
268 txx9_set64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_PCI1RST); 264 txx9_set64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_PCI1RST);
269 pcfg = ____raw_readq(&tx4939_ccfgptr->pcfg); 265 pcfg = ____raw_readq(&tx4939_ccfgptr->pcfg);
@@ -474,6 +470,21 @@ void __init tx4939_ndfmc_init(unsigned int hold, unsigned int spw,
474 txx9_ndfmc_init(TX4939_NDFMC_REG & 0xfffffffffULL, &plat_data); 470 txx9_ndfmc_init(TX4939_NDFMC_REG & 0xfffffffffULL, &plat_data);
475} 471}
476 472
473void __init tx4939_dmac_init(int memcpy_chan0, int memcpy_chan1)
474{
475 struct txx9dmac_platform_data plat_data = {
476 .have_64bit_regs = true,
477 };
478 int i;
479
480 for (i = 0; i < 2; i++) {
481 plat_data.memcpy_chan = i ? memcpy_chan1 : memcpy_chan0;
482 txx9_dmac_init(i, TX4939_DMA_REG(i) & 0xfffffffffULL,
483 TXX9_IRQ_BASE + TX4939_IR_DMA(i, 0),
484 &plat_data);
485 }
486}
487
477static void __init tx4939_stop_unused_modules(void) 488static void __init tx4939_stop_unused_modules(void)
478{ 489{
479 __u64 pcfg, rst = 0, ckd = 0; 490 __u64 pcfg, rst = 0, ckd = 0;
diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c
index 01129a9d50fa..332cdbc7fcef 100644
--- a/arch/mips/txx9/rbtx4927/setup.c
+++ b/arch/mips/txx9/rbtx4927/setup.c
@@ -337,6 +337,10 @@ 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)
341 tx4927_dmac_init(2);
342 else
343 tx4938_dmac_init(0, 2);
340 txx9_iocled_init(RBTX4927_LED_ADDR - IO_BASE, -1, 3, 1, "green", NULL); 344 txx9_iocled_init(RBTX4927_LED_ADDR - IO_BASE, -1, 3, 1, "green", NULL);
341 rbtx4927_gpioled_init(); 345 rbtx4927_gpioled_init();
342} 346}
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
index 65d13df8878a..37c5e3d20287 100644
--- a/arch/mips/txx9/rbtx4938/setup.c
+++ b/arch/mips/txx9/rbtx4938/setup.c
@@ -355,6 +355,7 @@ static void __init rbtx4938_device_init(void)
355 /* TC58DVM82A1FT: tDH=10ns, tWP=tRP=tREADID=35ns */ 355 /* TC58DVM82A1FT: tDH=10ns, tWP=tRP=tREADID=35ns */
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 txx9_iocled_init(RBTX4938_LED_ADDR - IO_BASE, -1, 8, 1, "green", NULL); 359 txx9_iocled_init(RBTX4938_LED_ADDR - IO_BASE, -1, 8, 1, "green", NULL);
359} 360}
360 361
diff --git a/arch/mips/txx9/rbtx4939/setup.c b/arch/mips/txx9/rbtx4939/setup.c
index 4199c6fd4d1d..91f2ec8fa273 100644
--- a/arch/mips/txx9/rbtx4939/setup.c
+++ b/arch/mips/txx9/rbtx4939/setup.c
@@ -498,6 +498,7 @@ static void __init rbtx4939_device_init(void)
498 tx4939_wdt_init(); 498 tx4939_wdt_init();
499 tx4939_ata_init(); 499 tx4939_ata_init();
500 tx4939_rtc_init(); 500 tx4939_rtc_init();
501 tx4939_dmac_init(0, 2);
501} 502}
502 503
503static void __init rbtx4939_setup(void) 504static void __init rbtx4939_setup(void)