Kukjin Kim | 7d30e8b | 2011-02-14 16:33:10 +0900 | [diff] [blame] | 1 | /* linux/arch/arm/mach-exynos4/dma.c |
| 2 | * |
| 3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. |
| 4 | * http://www.samsung.com |
| 5 | * |
Jassi Brar | 8b0ae0b | 2010-11-19 08:49:43 +0900 | [diff] [blame] | 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 | |
Jassi Brar | 8b0ae0b | 2010-11-19 08:49:43 +0900 | [diff] [blame] | 24 | #include <linux/dma-mapping.h> |
Boojin Kim | bf856fb | 2011-09-02 09:44:36 +0900 | [diff] [blame] | 25 | #include <linux/amba/bus.h> |
| 26 | #include <linux/amba/pl330.h> |
Thomas Abraham | fca3de6 | 2011-10-24 13:57:43 +0200 | [diff] [blame] | 27 | #include <linux/of.h> |
Jassi Brar | 8b0ae0b | 2010-11-19 08:49:43 +0900 | [diff] [blame] | 28 | |
Boojin Kim | bf856fb | 2011-09-02 09:44:36 +0900 | [diff] [blame] | 29 | #include <asm/irq.h> |
Jassi Brar | 8b0ae0b | 2010-11-19 08:49:43 +0900 | [diff] [blame] | 30 | #include <plat/devs.h> |
| 31 | #include <plat/irqs.h> |
| 32 | |
| 33 | #include <mach/map.h> |
| 34 | #include <mach/irqs.h> |
Boojin Kim | bf856fb | 2011-09-02 09:44:36 +0900 | [diff] [blame] | 35 | #include <mach/dma.h> |
Jassi Brar | 8b0ae0b | 2010-11-19 08:49:43 +0900 | [diff] [blame] | 36 | |
| 37 | static u64 dma_dmamask = DMA_BIT_MASK(32); |
| 38 | |
Thomas Abraham | e1cd845 | 2011-10-24 11:43:22 +0200 | [diff] [blame] | 39 | u8 pdma0_peri[] = { |
| 40 | DMACH_PCM0_RX, |
| 41 | DMACH_PCM0_TX, |
| 42 | DMACH_PCM2_RX, |
| 43 | DMACH_PCM2_TX, |
| 44 | DMACH_MSM_REQ0, |
| 45 | DMACH_MSM_REQ2, |
| 46 | DMACH_SPI0_RX, |
| 47 | DMACH_SPI0_TX, |
| 48 | DMACH_SPI2_RX, |
| 49 | DMACH_SPI2_TX, |
| 50 | DMACH_I2S0S_TX, |
| 51 | DMACH_I2S0_RX, |
| 52 | DMACH_I2S0_TX, |
| 53 | DMACH_I2S2_RX, |
| 54 | DMACH_I2S2_TX, |
| 55 | DMACH_UART0_RX, |
| 56 | DMACH_UART0_TX, |
| 57 | DMACH_UART2_RX, |
| 58 | DMACH_UART2_TX, |
| 59 | DMACH_UART4_RX, |
| 60 | DMACH_UART4_TX, |
| 61 | DMACH_SLIMBUS0_RX, |
| 62 | DMACH_SLIMBUS0_TX, |
| 63 | DMACH_SLIMBUS2_RX, |
| 64 | DMACH_SLIMBUS2_TX, |
| 65 | DMACH_SLIMBUS4_RX, |
| 66 | DMACH_SLIMBUS4_TX, |
| 67 | DMACH_AC97_MICIN, |
| 68 | DMACH_AC97_PCMIN, |
| 69 | DMACH_AC97_PCMOUT, |
Jassi Brar | 8b0ae0b | 2010-11-19 08:49:43 +0900 | [diff] [blame] | 70 | }; |
| 71 | |
Boojin Kim | bf856fb | 2011-09-02 09:44:36 +0900 | [diff] [blame] | 72 | struct dma_pl330_platdata exynos4_pdma0_pdata = { |
| 73 | .nr_valid_peri = ARRAY_SIZE(pdma0_peri), |
Thomas Abraham | e1cd845 | 2011-10-24 11:43:22 +0200 | [diff] [blame] | 74 | .peri_id = pdma0_peri, |
Jassi Brar | 8b0ae0b | 2010-11-19 08:49:43 +0900 | [diff] [blame] | 75 | }; |
| 76 | |
Russell King | 75c0696 | 2012-01-20 09:14:40 +0000 | [diff] [blame] | 77 | AMBA_AHB_DEVICE(exynos4_pdma0, "dma-pl330.0", 0x00041330, EXYNOS4_PA_PDMA0, |
| 78 | {IRQ_PDMA0}, &exynos4_pdma0_pdata); |
Jassi Brar | 8b0ae0b | 2010-11-19 08:49:43 +0900 | [diff] [blame] | 79 | |
Thomas Abraham | e1cd845 | 2011-10-24 11:43:22 +0200 | [diff] [blame] | 80 | u8 pdma1_peri[] = { |
| 81 | DMACH_PCM0_RX, |
| 82 | DMACH_PCM0_TX, |
| 83 | DMACH_PCM1_RX, |
| 84 | DMACH_PCM1_TX, |
| 85 | DMACH_MSM_REQ1, |
| 86 | DMACH_MSM_REQ3, |
| 87 | DMACH_SPI1_RX, |
| 88 | DMACH_SPI1_TX, |
| 89 | DMACH_I2S0S_TX, |
| 90 | DMACH_I2S0_RX, |
| 91 | DMACH_I2S0_TX, |
| 92 | DMACH_I2S1_RX, |
| 93 | DMACH_I2S1_TX, |
| 94 | DMACH_UART0_RX, |
| 95 | DMACH_UART0_TX, |
| 96 | DMACH_UART1_RX, |
| 97 | DMACH_UART1_TX, |
| 98 | DMACH_UART3_RX, |
| 99 | DMACH_UART3_TX, |
| 100 | DMACH_SLIMBUS1_RX, |
| 101 | DMACH_SLIMBUS1_TX, |
| 102 | DMACH_SLIMBUS3_RX, |
| 103 | DMACH_SLIMBUS3_TX, |
| 104 | DMACH_SLIMBUS5_RX, |
| 105 | DMACH_SLIMBUS5_TX, |
Jassi Brar | 8b0ae0b | 2010-11-19 08:49:43 +0900 | [diff] [blame] | 106 | }; |
| 107 | |
Boojin Kim | bf856fb | 2011-09-02 09:44:36 +0900 | [diff] [blame] | 108 | struct dma_pl330_platdata exynos4_pdma1_pdata = { |
| 109 | .nr_valid_peri = ARRAY_SIZE(pdma1_peri), |
Thomas Abraham | e1cd845 | 2011-10-24 11:43:22 +0200 | [diff] [blame] | 110 | .peri_id = pdma1_peri, |
Jassi Brar | 8b0ae0b | 2010-11-19 08:49:43 +0900 | [diff] [blame] | 111 | }; |
| 112 | |
Russell King | 75c0696 | 2012-01-20 09:14:40 +0000 | [diff] [blame] | 113 | AMBA_AHB_DEVICE(exynos4_pdma1, "dma-pl330.1", 0x00041330, EXYNOS4_PA_PDMA1, |
| 114 | {IRQ_PDMA1}, &exynos4_pdma1_pdata); |
Jassi Brar | 8b0ae0b | 2010-11-19 08:49:43 +0900 | [diff] [blame] | 115 | |
Kukjin Kim | 7d30e8b | 2011-02-14 16:33:10 +0900 | [diff] [blame] | 116 | static int __init exynos4_dma_init(void) |
Jassi Brar | 8b0ae0b | 2010-11-19 08:49:43 +0900 | [diff] [blame] | 117 | { |
Thomas Abraham | fca3de6 | 2011-10-24 13:57:43 +0200 | [diff] [blame] | 118 | if (of_have_populated_dt()) |
| 119 | return 0; |
| 120 | |
Thomas Abraham | e1cd845 | 2011-10-24 11:43:22 +0200 | [diff] [blame] | 121 | dma_cap_set(DMA_SLAVE, exynos4_pdma0_pdata.cap_mask); |
| 122 | dma_cap_set(DMA_CYCLIC, exynos4_pdma0_pdata.cap_mask); |
Russell King | 75c0696 | 2012-01-20 09:14:40 +0000 | [diff] [blame] | 123 | amba_device_register(&exynos4_pdma0_device, &iomem_resource); |
Thomas Abraham | e1cd845 | 2011-10-24 11:43:22 +0200 | [diff] [blame] | 124 | |
| 125 | dma_cap_set(DMA_SLAVE, exynos4_pdma1_pdata.cap_mask); |
| 126 | dma_cap_set(DMA_CYCLIC, exynos4_pdma1_pdata.cap_mask); |
Russell King | 75c0696 | 2012-01-20 09:14:40 +0000 | [diff] [blame] | 127 | amba_device_register(&exynos4_pdma1_device, &iomem_resource); |
Jassi Brar | 8b0ae0b | 2010-11-19 08:49:43 +0900 | [diff] [blame] | 128 | |
| 129 | return 0; |
| 130 | } |
Kukjin Kim | 7d30e8b | 2011-02-14 16:33:10 +0900 | [diff] [blame] | 131 | arch_initcall(exynos4_dma_init); |