Kukjin Kim | f1fee58 | 2010-09-08 19:25:44 +0900 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s5p64x0/dma.c |
| 2 | * |
| 3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. |
| 4 | * http://www.samsung.com |
| 5 | * |
| 6 | * Copyright (C) 2010 Samsung Electronics Co. Ltd. |
| 7 | * Jaswinder Singh <jassi.brar@samsung.com> |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 22 | */ |
| 23 | |
| 24 | #include <linux/platform_device.h> |
| 25 | #include <linux/dma-mapping.h> |
| 26 | |
| 27 | #include <mach/map.h> |
| 28 | #include <mach/irqs.h> |
| 29 | #include <mach/regs-clock.h> |
| 30 | |
Kukjin Kim | a3d9358 | 2011-08-20 02:30:08 +0900 | [diff] [blame^] | 31 | #include <plat/cpu.h> |
Kukjin Kim | f1fee58 | 2010-09-08 19:25:44 +0900 | [diff] [blame] | 32 | #include <plat/devs.h> |
| 33 | #include <plat/s3c-pl330-pdata.h> |
| 34 | |
| 35 | static u64 dma_dmamask = DMA_BIT_MASK(32); |
| 36 | |
| 37 | static struct resource s5p64x0_pdma_resource[] = { |
| 38 | [0] = { |
| 39 | .start = S5P64X0_PA_PDMA, |
| 40 | .end = S5P64X0_PA_PDMA + SZ_4K, |
| 41 | .flags = IORESOURCE_MEM, |
| 42 | }, |
| 43 | [1] = { |
| 44 | .start = IRQ_DMA0, |
| 45 | .end = IRQ_DMA0, |
| 46 | .flags = IORESOURCE_IRQ, |
| 47 | }, |
| 48 | }; |
| 49 | |
| 50 | static struct s3c_pl330_platdata s5p6440_pdma_pdata = { |
| 51 | .peri = { |
| 52 | [0] = DMACH_UART0_RX, |
| 53 | [1] = DMACH_UART0_TX, |
| 54 | [2] = DMACH_UART1_RX, |
| 55 | [3] = DMACH_UART1_TX, |
| 56 | [4] = DMACH_UART2_RX, |
| 57 | [5] = DMACH_UART2_TX, |
| 58 | [6] = DMACH_UART3_RX, |
| 59 | [7] = DMACH_UART3_TX, |
| 60 | [8] = DMACH_MAX, |
| 61 | [9] = DMACH_MAX, |
| 62 | [10] = DMACH_PCM0_TX, |
| 63 | [11] = DMACH_PCM0_RX, |
| 64 | [12] = DMACH_I2S0_TX, |
| 65 | [13] = DMACH_I2S0_RX, |
| 66 | [14] = DMACH_SPI0_TX, |
| 67 | [15] = DMACH_SPI0_RX, |
| 68 | [16] = DMACH_MAX, |
| 69 | [17] = DMACH_MAX, |
| 70 | [18] = DMACH_MAX, |
| 71 | [19] = DMACH_MAX, |
| 72 | [20] = DMACH_SPI1_TX, |
| 73 | [21] = DMACH_SPI1_RX, |
| 74 | [22] = DMACH_MAX, |
| 75 | [23] = DMACH_MAX, |
| 76 | [24] = DMACH_MAX, |
| 77 | [25] = DMACH_MAX, |
| 78 | [26] = DMACH_MAX, |
| 79 | [27] = DMACH_MAX, |
| 80 | [28] = DMACH_MAX, |
| 81 | [29] = DMACH_PWM, |
| 82 | [30] = DMACH_MAX, |
| 83 | [31] = DMACH_MAX, |
| 84 | }, |
| 85 | }; |
| 86 | |
| 87 | static struct s3c_pl330_platdata s5p6450_pdma_pdata = { |
| 88 | .peri = { |
| 89 | [0] = DMACH_UART0_RX, |
| 90 | [1] = DMACH_UART0_TX, |
| 91 | [2] = DMACH_UART1_RX, |
| 92 | [3] = DMACH_UART1_TX, |
| 93 | [4] = DMACH_UART2_RX, |
| 94 | [5] = DMACH_UART2_TX, |
| 95 | [6] = DMACH_UART3_RX, |
| 96 | [7] = DMACH_UART3_TX, |
| 97 | [8] = DMACH_UART4_RX, |
| 98 | [9] = DMACH_UART4_TX, |
| 99 | [10] = DMACH_PCM0_TX, |
| 100 | [11] = DMACH_PCM0_RX, |
| 101 | [12] = DMACH_I2S0_TX, |
| 102 | [13] = DMACH_I2S0_RX, |
| 103 | [14] = DMACH_SPI0_TX, |
| 104 | [15] = DMACH_SPI0_RX, |
| 105 | [16] = DMACH_PCM1_TX, |
| 106 | [17] = DMACH_PCM1_RX, |
| 107 | [18] = DMACH_PCM2_TX, |
| 108 | [19] = DMACH_PCM2_RX, |
| 109 | [20] = DMACH_SPI1_TX, |
| 110 | [21] = DMACH_SPI1_RX, |
| 111 | [22] = DMACH_USI_TX, |
| 112 | [23] = DMACH_USI_RX, |
| 113 | [24] = DMACH_MAX, |
| 114 | [25] = DMACH_I2S1_TX, |
| 115 | [26] = DMACH_I2S1_RX, |
| 116 | [27] = DMACH_I2S2_TX, |
| 117 | [28] = DMACH_I2S2_RX, |
| 118 | [29] = DMACH_PWM, |
| 119 | [30] = DMACH_UART5_RX, |
| 120 | [31] = DMACH_UART5_TX, |
| 121 | }, |
| 122 | }; |
| 123 | |
| 124 | static struct platform_device s5p64x0_device_pdma = { |
| 125 | .name = "s3c-pl330", |
Seungwhan Youn | 9d59c17 | 2010-10-19 18:42:34 +0900 | [diff] [blame] | 126 | .id = -1, |
Kukjin Kim | f1fee58 | 2010-09-08 19:25:44 +0900 | [diff] [blame] | 127 | .num_resources = ARRAY_SIZE(s5p64x0_pdma_resource), |
| 128 | .resource = s5p64x0_pdma_resource, |
| 129 | .dev = { |
| 130 | .dma_mask = &dma_dmamask, |
| 131 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 132 | }, |
| 133 | }; |
| 134 | |
| 135 | static int __init s5p64x0_dma_init(void) |
| 136 | { |
Kukjin Kim | a3d9358 | 2011-08-20 02:30:08 +0900 | [diff] [blame^] | 137 | if (soc_is_s5p6450()) |
Kukjin Kim | f1fee58 | 2010-09-08 19:25:44 +0900 | [diff] [blame] | 138 | s5p64x0_device_pdma.dev.platform_data = &s5p6450_pdma_pdata; |
| 139 | else |
| 140 | s5p64x0_device_pdma.dev.platform_data = &s5p6440_pdma_pdata; |
| 141 | |
| 142 | platform_device_register(&s5p64x0_device_pdma); |
| 143 | |
| 144 | return 0; |
| 145 | } |
| 146 | arch_initcall(s5p64x0_dma_init); |