2010-09-08 14:25:44 +04:00
/* linux/arch/arm/mach-s5p64x0/dma.c
*
* Copyright ( c ) 2010 Samsung Electronics Co . , Ltd .
* http : //www.samsung.com
*
2010-05-18 06:59:20 +04:00
* Copyright ( C ) 2010 Samsung Electronics Co . Ltd .
* Jaswinder Singh < jassi . brar @ samsung . com >
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 2 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 675 Mass Ave , Cambridge , MA 0213 9 , USA .
2010-09-08 14:25:44 +04:00
*/
2010-05-18 06:59:20 +04:00
# include <linux/dma-mapping.h>
2011-09-02 04:44:39 +04:00
# include <linux/amba/bus.h>
# include <linux/amba/pl330.h>
# include <asm/irq.h>
2010-05-18 06:59:20 +04:00
# include <mach/map.h>
# include <mach/irqs.h>
2010-09-08 14:25:44 +04:00
# include <mach/regs-clock.h>
2011-09-02 04:44:39 +04:00
# include <mach/dma.h>
2010-05-18 06:59:20 +04:00
2011-08-19 21:30:08 +04:00
# include <plat/cpu.h>
2010-09-08 14:25:44 +04:00
# include <plat/devs.h>
2011-09-02 04:44:39 +04:00
# include <plat/irqs.h>
2010-05-18 06:59:20 +04:00
2012-01-21 06:29:30 +04:00
static u8 s5p6440_pdma_peri [ ] = {
2011-10-24 13:45:01 +04:00
DMACH_UART0_RX ,
DMACH_UART0_TX ,
DMACH_UART1_RX ,
DMACH_UART1_TX ,
DMACH_UART2_RX ,
DMACH_UART2_TX ,
DMACH_UART3_RX ,
DMACH_UART3_TX ,
DMACH_MAX ,
DMACH_MAX ,
DMACH_PCM0_TX ,
DMACH_PCM0_RX ,
DMACH_I2S0_TX ,
DMACH_I2S0_RX ,
DMACH_SPI0_TX ,
DMACH_SPI0_RX ,
DMACH_MAX ,
DMACH_MAX ,
DMACH_MAX ,
DMACH_MAX ,
DMACH_SPI1_TX ,
DMACH_SPI1_RX ,
2010-05-18 06:59:20 +04:00
} ;
2012-01-21 06:29:30 +04:00
static struct dma_pl330_platdata s5p6440_pdma_pdata = {
2011-09-02 04:44:39 +04:00
. nr_valid_peri = ARRAY_SIZE ( s5p6440_pdma_peri ) ,
2011-10-24 13:45:01 +04:00
. peri_id = s5p6440_pdma_peri ,
2010-05-18 06:59:20 +04:00
} ;
2012-01-21 06:29:30 +04:00
static u8 s5p6450_pdma_peri [ ] = {
2011-10-24 13:45:01 +04:00
DMACH_UART0_RX ,
DMACH_UART0_TX ,
DMACH_UART1_RX ,
DMACH_UART1_TX ,
DMACH_UART2_RX ,
DMACH_UART2_TX ,
DMACH_UART3_RX ,
DMACH_UART3_TX ,
DMACH_UART4_RX ,
DMACH_UART4_TX ,
DMACH_PCM0_TX ,
DMACH_PCM0_RX ,
DMACH_I2S0_TX ,
DMACH_I2S0_RX ,
DMACH_SPI0_TX ,
DMACH_SPI0_RX ,
DMACH_PCM1_TX ,
DMACH_PCM1_RX ,
DMACH_PCM2_TX ,
DMACH_PCM2_RX ,
DMACH_SPI1_TX ,
DMACH_SPI1_RX ,
DMACH_USI_TX ,
DMACH_USI_RX ,
DMACH_MAX ,
DMACH_I2S1_TX ,
DMACH_I2S1_RX ,
DMACH_I2S2_TX ,
DMACH_I2S2_RX ,
DMACH_PWM ,
DMACH_UART5_RX ,
DMACH_UART5_TX ,
2010-09-08 14:25:44 +04:00
} ;
2012-01-21 06:29:30 +04:00
static struct dma_pl330_platdata s5p6450_pdma_pdata = {
2011-09-02 04:44:39 +04:00
. nr_valid_peri = ARRAY_SIZE ( s5p6450_pdma_peri ) ,
2011-10-24 13:45:01 +04:00
. peri_id = s5p6450_pdma_peri ,
2011-09-02 04:44:39 +04:00
} ;
2012-03-07 15:34:41 +04:00
static AMBA_AHB_DEVICE ( s5p64x0_pdma , " dma-pl330 " , 0x00041330 ,
S5P64X0_PA_PDMA , { IRQ_DMA0 } , NULL ) ;
2010-05-18 06:59:20 +04:00
2010-09-08 14:25:44 +04:00
static int __init s5p64x0_dma_init ( void )
2010-05-18 06:59:20 +04:00
{
2011-10-24 13:45:01 +04:00
if ( soc_is_s5p6450 ( ) ) {
dma_cap_set ( DMA_SLAVE , s5p6450_pdma_pdata . cap_mask ) ;
dma_cap_set ( DMA_CYCLIC , s5p6450_pdma_pdata . cap_mask ) ;
2012-01-20 13:14:40 +04:00
s5p64x0_pdma_device . dev . platform_data = & s5p6450_pdma_pdata ;
2011-10-24 13:45:01 +04:00
} else {
dma_cap_set ( DMA_SLAVE , s5p6440_pdma_pdata . cap_mask ) ;
dma_cap_set ( DMA_CYCLIC , s5p6440_pdma_pdata . cap_mask ) ;
2012-01-20 13:14:40 +04:00
s5p64x0_pdma_device . dev . platform_data = & s5p6440_pdma_pdata ;
2011-10-24 13:45:01 +04:00
}
2010-09-08 14:25:44 +04:00
2012-01-20 13:14:40 +04:00
amba_device_register ( & s5p64x0_pdma_device , & iomem_resource ) ;
2010-05-18 06:59:20 +04:00
return 0 ;
}
2010-09-08 14:25:44 +04:00
arch_initcall ( s5p64x0_dma_init ) ;