aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/txx9/generic/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/txx9/generic/setup.c')
-rw-r--r--arch/mips/txx9/generic/setup.c55
1 files changed, 55 insertions, 0 deletions
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}