blob: 601cc9c11b0713e5fd6f5a6321c348546c3b4f85 [file] [log] [blame]
Thomas Gleixnera61127c2019-05-29 16:57:49 -07001// SPDX-License-Identifier: GPL-2.0-only
Dan Williams2492c842007-01-02 13:52:31 -07002/*
3 * platform device definitions for the iop3xx dma/xor engines
4 * Copyright © 2006, Intel Corporation.
Dan Williams2492c842007-01-02 13:52:31 -07005 */
6#include <linux/platform_device.h>
7#include <asm/hardware/iop3xx.h>
8#include <linux/dma-mapping.h>
Arnd Bergmannaad7ad22019-08-09 18:33:18 +02009#include <linux/platform_data/dma-iop32x.h>
Dan Williams2492c842007-01-02 13:52:31 -070010
Dan Williams2492c842007-01-02 13:52:31 -070011#define IRQ_DMA0_EOT IRQ_IOP32X_DMA0_EOT
12#define IRQ_DMA0_EOC IRQ_IOP32X_DMA0_EOC
13#define IRQ_DMA0_ERR IRQ_IOP32X_DMA0_ERR
14
15#define IRQ_DMA1_EOT IRQ_IOP32X_DMA1_EOT
16#define IRQ_DMA1_EOC IRQ_IOP32X_DMA1_EOC
17#define IRQ_DMA1_ERR IRQ_IOP32X_DMA1_ERR
18
19#define IRQ_AA_EOT IRQ_IOP32X_AA_EOT
20#define IRQ_AA_EOC IRQ_IOP32X_AA_EOC
21#define IRQ_AA_ERR IRQ_IOP32X_AA_ERR
Dan Williams2492c842007-01-02 13:52:31 -070022
Dan Williams2492c842007-01-02 13:52:31 -070023/* AAU and DMA Channels */
24static struct resource iop3xx_dma_0_resources[] = {
25 [0] = {
26 .start = IOP3XX_DMA_PHYS_BASE(0),
27 .end = IOP3XX_DMA_UPPER_PA(0),
28 .flags = IORESOURCE_MEM,
29 },
30 [1] = {
31 .start = IRQ_DMA0_EOT,
32 .end = IRQ_DMA0_EOT,
33 .flags = IORESOURCE_IRQ
34 },
35 [2] = {
36 .start = IRQ_DMA0_EOC,
37 .end = IRQ_DMA0_EOC,
38 .flags = IORESOURCE_IRQ
39 },
40 [3] = {
41 .start = IRQ_DMA0_ERR,
42 .end = IRQ_DMA0_ERR,
43 .flags = IORESOURCE_IRQ
44 }
45};
46
47static struct resource iop3xx_dma_1_resources[] = {
48 [0] = {
49 .start = IOP3XX_DMA_PHYS_BASE(1),
50 .end = IOP3XX_DMA_UPPER_PA(1),
51 .flags = IORESOURCE_MEM,
52 },
53 [1] = {
54 .start = IRQ_DMA1_EOT,
55 .end = IRQ_DMA1_EOT,
56 .flags = IORESOURCE_IRQ
57 },
58 [2] = {
59 .start = IRQ_DMA1_EOC,
60 .end = IRQ_DMA1_EOC,
61 .flags = IORESOURCE_IRQ
62 },
63 [3] = {
64 .start = IRQ_DMA1_ERR,
65 .end = IRQ_DMA1_ERR,
66 .flags = IORESOURCE_IRQ
67 }
68};
69
70
71static struct resource iop3xx_aau_resources[] = {
72 [0] = {
73 .start = IOP3XX_AAU_PHYS_BASE,
74 .end = IOP3XX_AAU_UPPER_PA,
75 .flags = IORESOURCE_MEM,
76 },
77 [1] = {
78 .start = IRQ_AA_EOT,
79 .end = IRQ_AA_EOT,
80 .flags = IORESOURCE_IRQ
81 },
82 [2] = {
83 .start = IRQ_AA_EOC,
84 .end = IRQ_AA_EOC,
85 .flags = IORESOURCE_IRQ
86 },
87 [3] = {
88 .start = IRQ_AA_ERR,
89 .end = IRQ_AA_ERR,
90 .flags = IORESOURCE_IRQ
91 }
92};
93
Yang Hongyang284901a2009-04-06 19:01:15 -070094static u64 iop3xx_adma_dmamask = DMA_BIT_MASK(32);
Dan Williams2492c842007-01-02 13:52:31 -070095
96static struct iop_adma_platform_data iop3xx_dma_0_data = {
97 .hw_id = DMA0_ID,
98 .pool_size = PAGE_SIZE,
99};
100
101static struct iop_adma_platform_data iop3xx_dma_1_data = {
102 .hw_id = DMA1_ID,
103 .pool_size = PAGE_SIZE,
104};
105
106static struct iop_adma_platform_data iop3xx_aau_data = {
107 .hw_id = AAU_ID,
108 .pool_size = 3 * PAGE_SIZE,
109};
110
111struct platform_device iop3xx_dma_0_channel = {
112 .name = "iop-adma",
113 .id = 0,
114 .num_resources = 4,
115 .resource = iop3xx_dma_0_resources,
116 .dev = {
117 .dma_mask = &iop3xx_adma_dmamask,
Arnd Bergmann21258012019-03-25 16:50:43 +0100118 .coherent_dma_mask = DMA_BIT_MASK(32),
Dan Williams2492c842007-01-02 13:52:31 -0700119 .platform_data = (void *) &iop3xx_dma_0_data,
120 },
121};
122
123struct platform_device iop3xx_dma_1_channel = {
124 .name = "iop-adma",
125 .id = 1,
126 .num_resources = 4,
127 .resource = iop3xx_dma_1_resources,
128 .dev = {
129 .dma_mask = &iop3xx_adma_dmamask,
Arnd Bergmann21258012019-03-25 16:50:43 +0100130 .coherent_dma_mask = DMA_BIT_MASK(32),
Dan Williams2492c842007-01-02 13:52:31 -0700131 .platform_data = (void *) &iop3xx_dma_1_data,
132 },
133};
134
135struct platform_device iop3xx_aau_channel = {
136 .name = "iop-adma",
137 .id = 2,
138 .num_resources = 4,
139 .resource = iop3xx_aau_resources,
140 .dev = {
141 .dma_mask = &iop3xx_adma_dmamask,
Arnd Bergmann21258012019-03-25 16:50:43 +0100142 .coherent_dma_mask = DMA_BIT_MASK(32),
Dan Williams2492c842007-01-02 13:52:31 -0700143 .platform_data = (void *) &iop3xx_aau_data,
144 },
145};
146
147static int __init iop3xx_adma_cap_init(void)
148{
Dan Williams2492c842007-01-02 13:52:31 -0700149 dma_cap_set(DMA_MEMCPY, iop3xx_dma_0_data.cap_mask);
150 dma_cap_set(DMA_INTERRUPT, iop3xx_dma_0_data.cap_mask);
Dan Williams2492c842007-01-02 13:52:31 -0700151
Dan Williams2492c842007-01-02 13:52:31 -0700152 dma_cap_set(DMA_MEMCPY, iop3xx_dma_1_data.cap_mask);
153 dma_cap_set(DMA_INTERRUPT, iop3xx_dma_1_data.cap_mask);
Dan Williams2492c842007-01-02 13:52:31 -0700154
Dan Williams2492c842007-01-02 13:52:31 -0700155 dma_cap_set(DMA_XOR, iop3xx_aau_data.cap_mask);
Dan Williams2492c842007-01-02 13:52:31 -0700156 dma_cap_set(DMA_INTERRUPT, iop3xx_aau_data.cap_mask);
Dan Williams2492c842007-01-02 13:52:31 -0700157
158 return 0;
159}
160
161arch_initcall(iop3xx_adma_cap_init);