Thomas Gleixner | a61127c | 2019-05-29 16:57:49 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 2 | /* |
| 3 | * platform device definitions for the iop3xx dma/xor engines |
| 4 | * Copyright © 2006, Intel Corporation. |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 5 | */ |
| 6 | #include <linux/platform_device.h> |
| 7 | #include <asm/hardware/iop3xx.h> |
| 8 | #include <linux/dma-mapping.h> |
Arnd Bergmann | aad7ad2 | 2019-08-09 18:33:18 +0200 | [diff] [blame^] | 9 | #include <linux/platform_data/dma-iop32x.h> |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 10 | |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 11 | #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 Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 22 | |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 23 | /* AAU and DMA Channels */ |
| 24 | static 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 | |
| 47 | static 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 | |
| 71 | static 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 Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 94 | static u64 iop3xx_adma_dmamask = DMA_BIT_MASK(32); |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 95 | |
| 96 | static struct iop_adma_platform_data iop3xx_dma_0_data = { |
| 97 | .hw_id = DMA0_ID, |
| 98 | .pool_size = PAGE_SIZE, |
| 99 | }; |
| 100 | |
| 101 | static struct iop_adma_platform_data iop3xx_dma_1_data = { |
| 102 | .hw_id = DMA1_ID, |
| 103 | .pool_size = PAGE_SIZE, |
| 104 | }; |
| 105 | |
| 106 | static struct iop_adma_platform_data iop3xx_aau_data = { |
| 107 | .hw_id = AAU_ID, |
| 108 | .pool_size = 3 * PAGE_SIZE, |
| 109 | }; |
| 110 | |
| 111 | struct 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 Bergmann | 2125801 | 2019-03-25 16:50:43 +0100 | [diff] [blame] | 118 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 119 | .platform_data = (void *) &iop3xx_dma_0_data, |
| 120 | }, |
| 121 | }; |
| 122 | |
| 123 | struct 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 Bergmann | 2125801 | 2019-03-25 16:50:43 +0100 | [diff] [blame] | 130 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 131 | .platform_data = (void *) &iop3xx_dma_1_data, |
| 132 | }, |
| 133 | }; |
| 134 | |
| 135 | struct 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 Bergmann | 2125801 | 2019-03-25 16:50:43 +0100 | [diff] [blame] | 142 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 143 | .platform_data = (void *) &iop3xx_aau_data, |
| 144 | }, |
| 145 | }; |
| 146 | |
| 147 | static int __init iop3xx_adma_cap_init(void) |
| 148 | { |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 149 | dma_cap_set(DMA_MEMCPY, iop3xx_dma_0_data.cap_mask); |
| 150 | dma_cap_set(DMA_INTERRUPT, iop3xx_dma_0_data.cap_mask); |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 151 | |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 152 | dma_cap_set(DMA_MEMCPY, iop3xx_dma_1_data.cap_mask); |
| 153 | dma_cap_set(DMA_INTERRUPT, iop3xx_dma_1_data.cap_mask); |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 154 | |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 155 | dma_cap_set(DMA_XOR, iop3xx_aau_data.cap_mask); |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 156 | dma_cap_set(DMA_INTERRUPT, iop3xx_aau_data.cap_mask); |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 157 | |
| 158 | return 0; |
| 159 | } |
| 160 | |
| 161 | arch_initcall(iop3xx_adma_cap_init); |