| 
									
										
										
										
											2008-09-07 23:41:28 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * mach-davinci/devices.c | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * DaVinci platform device setup/initialization | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * 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. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/init.h>
 | 
					
						
							|  |  |  | #include <linux/platform_device.h>
 | 
					
						
							|  |  |  | #include <linux/dma-mapping.h>
 | 
					
						
							|  |  |  | #include <linux/io.h>
 | 
					
						
							| 
									
										
										
										
											2013-07-08 16:01:40 -07:00
										 |  |  | #include <linux/reboot.h>
 | 
					
						
							| 
									
										
										
										
											2008-09-07 23:41:28 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <mach/hardware.h>
 | 
					
						
							| 
									
										
										
										
											2012-08-24 15:11:34 +02:00
										 |  |  | #include <linux/platform_data/i2c-davinci.h>
 | 
					
						
							| 
									
										
											  
											
												[ARM] fix AT91, davinci, h720x, ks8695, msm, mx2, mx3, netx, omap1, omap2, pxa, s3c
arch/arm/mach-at91/at91cap9.c:337: error: 'NR_AIC_IRQS' undeclared here (not in a function)
arch/arm/mach-at91/at91rm9200.c:301: error: 'NR_AIC_IRQS' undeclared here (not in a function)
arch/arm/mach-at91/at91sam9260.c:351: error: 'NR_AIC_IRQS' undeclared here (not in a function)
arch/arm/mach-at91/at91sam9261.c:287: error: 'NR_AIC_IRQS' undeclared here (not in a function)
arch/arm/mach-at91/at91sam9263.c:312: error: 'NR_AIC_IRQS' undeclared here (not in a function)
arch/arm/mach-at91/at91sam9rl.c:304: error: 'NR_AIC_IRQS' undeclared here (not in a function)
arch/arm/mach-h720x/h7202-eval.c:38: error: implicit declaration of function 'IRQ_CHAINED_GPIOB'
arch/arm/mach-ks8695/devices.c:46: error: 'KS8695_IRQ_WAN_RX_STATUS' undeclared here (not in a function)
arch/arm/mach-msm/devices.c:28: error: 'INT_UART1' undeclared here (not in a function)
arch/arm/mach-mx2/devices.c:233: error: 'MXC_GPIO_IRQ_START' undeclared here (not in a function)
arch/arm/mach-mx3/devices.c:128: error: 'MXC_GPIO_IRQ_START' undeclared here (not in a function)
arch/arm/mach-omap1/mcbsp.c:140: error: 'INT_730_McBSP1RX' undeclared here (not in a function)
arch/arm/mach-omap1/mcbsp.c:165: error: 'INT_McBSP1RX' undeclared here (not in a function)
arch/arm/mach-omap1/mcbsp.c:200: error: 'INT_McBSP1RX' undeclared here (not in a function)
arch/arm/mach-omap2/board-apollon.c:286: error: implicit declaration of function 'omap_set_gpio_direction'
arch/arm/mach-omap2/mcbsp.c:154: error: 'INT_24XX_MCBSP1_IRQ_RX' undeclared here (not in a function)
arch/arm/mach-omap2/mcbsp.c:181: error: 'INT_24XX_MCBSP1_IRQ_RX' undeclared here (not in a function)
arch/arm/mach-pxa/e350.c:36: error: 'IRQ_BOARD_START' undeclared here (not in a function)
arch/arm/plat-s3c/dev-i2c0.c:32: error: 'IRQ_IIC' undeclared here (not in a function)
...
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
											
										 
											2009-01-08 10:01:47 +00:00
										 |  |  | #include <mach/irqs.h>
 | 
					
						
							| 
									
										
										
										
											2009-04-14 09:50:37 -05:00
										 |  |  | #include <mach/cputype.h>
 | 
					
						
							|  |  |  | #include <mach/mux.h>
 | 
					
						
							| 
									
										
										
										
											2012-08-24 15:11:34 +02:00
										 |  |  | #include <linux/platform_data/mmc-davinci.h>
 | 
					
						
							| 
									
										
										
										
											2009-04-15 12:40:11 -07:00
										 |  |  | #include <mach/time.h>
 | 
					
						
							| 
									
										
										
										
											2013-03-06 11:15:31 -05:00
										 |  |  | #include <linux/platform_data/edma.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-07 23:41:28 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:36 +05:30
										 |  |  | #include "davinci.h"
 | 
					
						
							| 
									
										
										
										
											2010-02-25 15:36:38 -08:00
										 |  |  | #include "clock.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-14 07:04:16 -05:00
										 |  |  | #define DAVINCI_I2C_BASE	     0x01C21000
 | 
					
						
							| 
									
										
										
										
											2010-04-21 18:11:33 +04:00
										 |  |  | #define DAVINCI_ATA_BASE	     0x01C66000
 | 
					
						
							| 
									
										
										
										
											2009-05-11 15:55:03 -07:00
										 |  |  | #define DAVINCI_MMCSD0_BASE	     0x01E10000
 | 
					
						
							|  |  |  | #define DM355_MMCSD0_BASE	     0x01E11000
 | 
					
						
							|  |  |  | #define DM355_MMCSD1_BASE	     0x01E00000
 | 
					
						
							| 
									
										
										
										
											2009-06-20 13:58:32 -04:00
										 |  |  | #define DM365_MMCSD0_BASE	     0x01D11000
 | 
					
						
							|  |  |  | #define DM365_MMCSD1_BASE	     0x01D00000
 | 
					
						
							| 
									
										
										
										
											2009-04-14 07:04:16 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-06 11:15:31 -05:00
										 |  |  | #define DAVINCI_DMA_MMCRXEVT	26
 | 
					
						
							|  |  |  | #define DAVINCI_DMA_MMCTXEVT	27
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:36 +05:30
										 |  |  | void __iomem  *davinci_sysmod_base; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void davinci_map_sysmod(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	davinci_sysmod_base = ioremap_nocache(DAVINCI_SYSTEM_MODULE_BASE, | 
					
						
							|  |  |  | 					      0x800); | 
					
						
							|  |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Throw a bug since a lot of board initialization code depends | 
					
						
							|  |  |  | 	 * on system module availability. ioremap() failing this early | 
					
						
							|  |  |  | 	 * need careful looking into anyway. | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	BUG_ON(!davinci_sysmod_base); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2011-05-23 21:05:48 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-07 23:41:28 -07:00
										 |  |  | static struct resource i2c_resources[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.start		= DAVINCI_I2C_BASE, | 
					
						
							|  |  |  | 		.end		= DAVINCI_I2C_BASE + 0x40, | 
					
						
							|  |  |  | 		.flags		= IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.start		= IRQ_I2C, | 
					
						
							|  |  |  | 		.flags		= IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device davinci_i2c_device = { | 
					
						
							|  |  |  | 	.name           = "i2c_davinci", | 
					
						
							|  |  |  | 	.id             = 1, | 
					
						
							|  |  |  | 	.num_resources	= ARRAY_SIZE(i2c_resources), | 
					
						
							|  |  |  | 	.resource	= i2c_resources, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void __init davinci_init_i2c(struct davinci_i2c_platform_data *pdata) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-04-14 09:50:37 -05:00
										 |  |  | 	if (cpu_is_davinci_dm644x()) | 
					
						
							|  |  |  | 		davinci_cfg_reg(DM644X_I2C); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-07 23:41:28 -07:00
										 |  |  | 	davinci_i2c_device.dev.platform_data = pdata; | 
					
						
							|  |  |  | 	(void) platform_device_register(&davinci_i2c_device); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-21 18:11:33 +04:00
										 |  |  | static struct resource ide_resources[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.start		= DAVINCI_ATA_BASE, | 
					
						
							|  |  |  | 		.end		= DAVINCI_ATA_BASE + 0x7ff, | 
					
						
							|  |  |  | 		.flags		= IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.start		= IRQ_IDE, | 
					
						
							|  |  |  | 		.end		= IRQ_IDE, | 
					
						
							|  |  |  | 		.flags		= IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static u64 ide_dma_mask = DMA_BIT_MASK(32); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device ide_device = { | 
					
						
							|  |  |  | 	.name           = "palm_bk3710", | 
					
						
							|  |  |  | 	.id             = -1, | 
					
						
							|  |  |  | 	.resource       = ide_resources, | 
					
						
							|  |  |  | 	.num_resources  = ARRAY_SIZE(ide_resources), | 
					
						
							|  |  |  | 	.dev = { | 
					
						
							|  |  |  | 		.dma_mask		= &ide_dma_mask, | 
					
						
							|  |  |  | 		.coherent_dma_mask      = DMA_BIT_MASK(32), | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void __init davinci_init_ide(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (cpu_is_davinci_dm644x()) { | 
					
						
							|  |  |  | 		davinci_cfg_reg(DM644X_HPIEN_DISABLE); | 
					
						
							|  |  |  | 		davinci_cfg_reg(DM644X_ATAEN); | 
					
						
							|  |  |  | 		davinci_cfg_reg(DM644X_HDIREN); | 
					
						
							|  |  |  | 	} else if (cpu_is_davinci_dm646x()) { | 
					
						
							|  |  |  | 		/* IRQ_DM646X_IDE is the same as IRQ_IDE */ | 
					
						
							|  |  |  | 		davinci_cfg_reg(DM646X_ATAEN); | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		WARN_ON(1); | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	platform_device_register(&ide_device); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-01 12:43:44 +05:30
										 |  |  | #if IS_ENABLED(CONFIG_MMC_DAVINCI)
 | 
					
						
							| 
									
										
										
										
											2009-05-11 15:55:03 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-29 18:54:14 +01:00
										 |  |  | static u64 mmcsd0_dma_mask = DMA_BIT_MASK(32); | 
					
						
							| 
									
										
										
										
											2009-05-11 15:55:03 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | static struct resource mmcsd0_resources[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		/* different on dm355 */ | 
					
						
							|  |  |  | 		.start = DAVINCI_MMCSD0_BASE, | 
					
						
							|  |  |  | 		.end   = DAVINCI_MMCSD0_BASE + SZ_4K - 1, | 
					
						
							|  |  |  | 		.flags = IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	/* IRQs:  MMC/SD, then SDIO */ | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.start = IRQ_MMCINT, | 
					
						
							|  |  |  | 		.flags = IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		/* different on dm355 */ | 
					
						
							|  |  |  | 		.start = IRQ_SDIOINT, | 
					
						
							|  |  |  | 		.flags = IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	/* DMA channels: RX, then TX */ | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2009-05-21 07:41:35 -04:00
										 |  |  | 		.start = EDMA_CTLR_CHAN(0, DAVINCI_DMA_MMCRXEVT), | 
					
						
							| 
									
										
										
										
											2009-05-11 15:55:03 -07:00
										 |  |  | 		.flags = IORESOURCE_DMA, | 
					
						
							|  |  |  | 	}, { | 
					
						
							| 
									
										
										
										
											2009-05-21 07:41:35 -04:00
										 |  |  | 		.start = EDMA_CTLR_CHAN(0, DAVINCI_DMA_MMCTXEVT), | 
					
						
							| 
									
										
										
										
											2009-05-11 15:55:03 -07:00
										 |  |  | 		.flags = IORESOURCE_DMA, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device davinci_mmcsd0_device = { | 
					
						
							| 
									
										
										
										
											2013-03-28 18:41:59 +05:30
										 |  |  | 	.name = "dm6441-mmc", | 
					
						
							| 
									
										
										
										
											2009-05-11 15:55:03 -07:00
										 |  |  | 	.id = 0, | 
					
						
							|  |  |  | 	.dev = { | 
					
						
							|  |  |  | 		.dma_mask = &mmcsd0_dma_mask, | 
					
						
							| 
									
										
										
										
											2009-05-29 18:54:14 +01:00
										 |  |  | 		.coherent_dma_mask = DMA_BIT_MASK(32), | 
					
						
							| 
									
										
										
										
											2009-05-11 15:55:03 -07:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	.num_resources = ARRAY_SIZE(mmcsd0_resources), | 
					
						
							|  |  |  | 	.resource = mmcsd0_resources, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-29 18:54:14 +01:00
										 |  |  | static u64 mmcsd1_dma_mask = DMA_BIT_MASK(32); | 
					
						
							| 
									
										
										
										
											2009-05-11 15:55:03 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | static struct resource mmcsd1_resources[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.start = DM355_MMCSD1_BASE, | 
					
						
							|  |  |  | 		.end   = DM355_MMCSD1_BASE + SZ_4K - 1, | 
					
						
							|  |  |  | 		.flags = IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	/* IRQs:  MMC/SD, then SDIO */ | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.start = IRQ_DM355_MMCINT1, | 
					
						
							|  |  |  | 		.flags = IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		.start = IRQ_DM355_SDIOINT1, | 
					
						
							|  |  |  | 		.flags = IORESOURCE_IRQ, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	/* DMA channels: RX, then TX */ | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2009-05-21 07:41:35 -04:00
										 |  |  | 		.start = EDMA_CTLR_CHAN(0, 30),	/* rx */ | 
					
						
							| 
									
										
										
										
											2009-05-11 15:55:03 -07:00
										 |  |  | 		.flags = IORESOURCE_DMA, | 
					
						
							|  |  |  | 	}, { | 
					
						
							| 
									
										
										
										
											2009-05-21 07:41:35 -04:00
										 |  |  | 		.start = EDMA_CTLR_CHAN(0, 31),	/* tx */ | 
					
						
							| 
									
										
										
										
											2009-05-11 15:55:03 -07:00
										 |  |  | 		.flags = IORESOURCE_DMA, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device davinci_mmcsd1_device = { | 
					
						
							| 
									
										
										
										
											2013-03-28 18:41:59 +05:30
										 |  |  | 	.name = "dm6441-mmc", | 
					
						
							| 
									
										
										
										
											2009-05-11 15:55:03 -07:00
										 |  |  | 	.id = 1, | 
					
						
							|  |  |  | 	.dev = { | 
					
						
							|  |  |  | 		.dma_mask = &mmcsd1_dma_mask, | 
					
						
							| 
									
										
										
										
											2009-05-29 18:54:14 +01:00
										 |  |  | 		.coherent_dma_mask = DMA_BIT_MASK(32), | 
					
						
							| 
									
										
										
										
											2009-05-11 15:55:03 -07:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	.num_resources = ARRAY_SIZE(mmcsd1_resources), | 
					
						
							|  |  |  | 	.resource = mmcsd1_resources, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct platform_device	*pdev = NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (WARN_ON(cpu_is_davinci_dm646x())) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* REVISIT: update PINMUX, ARM_IRQMUX, and EDMA_EVTMUX here too;
 | 
					
						
							|  |  |  | 	 * for example if MMCSD1 is used for SDIO, maybe DAT2 is unused. | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * FIXME dm6441 (no MMC/SD), dm357 (one), and dm335 (two) are | 
					
						
							|  |  |  | 	 * not handled right here ... | 
					
						
							|  |  |  | 	 */ | 
					
						
							|  |  |  | 	switch (module) { | 
					
						
							|  |  |  | 	case 1: | 
					
						
							| 
									
										
										
										
											2009-06-20 13:58:32 -04:00
										 |  |  | 		if (cpu_is_davinci_dm355()) { | 
					
						
							|  |  |  | 			/* REVISIT we may not need all these pins if e.g. this
 | 
					
						
							|  |  |  | 			 * is a hard-wired SDIO device... | 
					
						
							|  |  |  | 			 */ | 
					
						
							|  |  |  | 			davinci_cfg_reg(DM355_SD1_CMD); | 
					
						
							|  |  |  | 			davinci_cfg_reg(DM355_SD1_CLK); | 
					
						
							|  |  |  | 			davinci_cfg_reg(DM355_SD1_DATA0); | 
					
						
							|  |  |  | 			davinci_cfg_reg(DM355_SD1_DATA1); | 
					
						
							|  |  |  | 			davinci_cfg_reg(DM355_SD1_DATA2); | 
					
						
							|  |  |  | 			davinci_cfg_reg(DM355_SD1_DATA3); | 
					
						
							|  |  |  | 		} else if (cpu_is_davinci_dm365()) { | 
					
						
							|  |  |  | 			/* Configure pull down control */ | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:36 +05:30
										 |  |  | 			unsigned v; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			v = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_PUPDCTL1)); | 
					
						
							|  |  |  | 			__raw_writel(v & ~0xfc0, | 
					
						
							|  |  |  | 					DAVINCI_SYSMOD_VIRT(SYSMOD_PUPDCTL1)); | 
					
						
							| 
									
										
										
										
											2009-06-20 13:58:32 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			mmcsd1_resources[0].start = DM365_MMCSD1_BASE; | 
					
						
							|  |  |  | 			mmcsd1_resources[0].end = DM365_MMCSD1_BASE + | 
					
						
							|  |  |  | 							SZ_4K - 1; | 
					
						
							| 
									
										
										
										
											2009-08-27 17:06:56 -04:00
										 |  |  | 			mmcsd1_resources[2].start = IRQ_DM365_SDIOINT1; | 
					
						
							| 
									
										
										
										
											2013-03-28 18:41:59 +05:30
										 |  |  | 			davinci_mmcsd1_device.name = "da830-mmc"; | 
					
						
							| 
									
										
										
										
											2009-06-20 13:58:32 -04:00
										 |  |  | 		} else | 
					
						
							| 
									
										
										
										
											2009-05-11 15:55:03 -07:00
										 |  |  | 			break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		pdev = &davinci_mmcsd1_device; | 
					
						
							|  |  |  | 		break; | 
					
						
							|  |  |  | 	case 0: | 
					
						
							|  |  |  | 		if (cpu_is_davinci_dm355()) { | 
					
						
							|  |  |  | 			mmcsd0_resources[0].start = DM355_MMCSD0_BASE; | 
					
						
							|  |  |  | 			mmcsd0_resources[0].end = DM355_MMCSD0_BASE + SZ_4K - 1; | 
					
						
							|  |  |  | 			mmcsd0_resources[2].start = IRQ_DM355_SDIOINT0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			/* expose all 6 MMC0 signals:  CLK, CMD, DATA[0..3] */ | 
					
						
							|  |  |  | 			davinci_cfg_reg(DM355_MMCSD0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			/* enable RX EDMA */ | 
					
						
							|  |  |  | 			davinci_cfg_reg(DM355_EVT26_MMC0_RX); | 
					
						
							| 
									
										
										
										
											2009-06-20 13:58:32 -04:00
										 |  |  | 		} else if (cpu_is_davinci_dm365()) { | 
					
						
							|  |  |  | 			mmcsd0_resources[0].start = DM365_MMCSD0_BASE; | 
					
						
							|  |  |  | 			mmcsd0_resources[0].end = DM365_MMCSD0_BASE + | 
					
						
							|  |  |  | 							SZ_4K - 1; | 
					
						
							|  |  |  | 			mmcsd0_resources[2].start = IRQ_DM365_SDIOINT0; | 
					
						
							| 
									
										
										
										
											2013-03-28 18:41:59 +05:30
										 |  |  | 			davinci_mmcsd0_device.name = "da830-mmc"; | 
					
						
							| 
									
										
										
										
											2009-06-20 13:58:32 -04:00
										 |  |  | 		} else if (cpu_is_davinci_dm644x()) { | 
					
						
							| 
									
										
										
										
											2009-05-11 15:55:03 -07:00
										 |  |  | 			/* REVISIT: should this be in board-init code? */ | 
					
						
							|  |  |  | 			/* Power-on 3.3V IO cells */ | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:36 +05:30
										 |  |  | 			__raw_writel(0, | 
					
						
							|  |  |  | 				DAVINCI_SYSMOD_VIRT(SYSMOD_VDD3P3VPWDN)); | 
					
						
							| 
									
										
										
										
											2009-05-11 15:55:03 -07:00
										 |  |  | 			/*Set up the pull regiter for MMC */ | 
					
						
							|  |  |  | 			davinci_cfg_reg(DM644X_MSTK); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		pdev = &davinci_mmcsd0_device; | 
					
						
							|  |  |  | 		break; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (WARN_ON(!pdev)) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	pdev->dev.platform_data = config; | 
					
						
							|  |  |  | 	platform_device_register(pdev); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-29 16:23:59 -07:00
										 |  |  | /*-------------------------------------------------------------------------*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct resource wdt_resources[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2009-06-03 12:24:50 -07:00
										 |  |  | 		.start	= DAVINCI_WDOG_BASE, | 
					
						
							|  |  |  | 		.end	= DAVINCI_WDOG_BASE + SZ_1K - 1, | 
					
						
							| 
									
										
										
										
											2009-04-29 16:23:59 -07:00
										 |  |  | 		.flags	= IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct platform_device davinci_wdt_device = { | 
					
						
							| 
									
										
										
										
											2013-11-27 15:31:53 +02:00
										 |  |  | 	.name		= "davinci-wdt", | 
					
						
							| 
									
										
										
										
											2009-04-29 16:23:59 -07:00
										 |  |  | 	.id		= -1, | 
					
						
							|  |  |  | 	.num_resources	= ARRAY_SIZE(wdt_resources), | 
					
						
							|  |  |  | 	.resource	= wdt_resources, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-08 16:01:40 -07:00
										 |  |  | void davinci_restart(enum reboot_mode mode, const char *cmd) | 
					
						
							| 
									
										
										
										
											2011-12-05 11:29:46 +01:00
										 |  |  | { | 
					
						
							|  |  |  | 	davinci_watchdog_reset(&davinci_wdt_device); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-26 10:29:43 +05:30
										 |  |  | int davinci_init_wdt(void) | 
					
						
							| 
									
										
										
										
											2009-04-29 16:23:59 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2014-02-26 10:29:43 +05:30
										 |  |  | 	return platform_device_register(&davinci_wdt_device); | 
					
						
							| 
									
										
										
										
											2009-04-29 16:23:59 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-18 10:49:00 +05:30
										 |  |  | static struct platform_device davinci_gpio_device = { | 
					
						
							|  |  |  | 	.name	= "davinci_gpio", | 
					
						
							|  |  |  | 	.id	= -1, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int davinci_gpio_register(struct resource *res, int size, void *pdata) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	davinci_gpio_device.resource = res; | 
					
						
							|  |  |  | 	davinci_gpio_device.num_resources = size; | 
					
						
							|  |  |  | 	davinci_gpio_device.dev.platform_data = pdata; | 
					
						
							|  |  |  | 	return platform_device_register(&davinci_gpio_device); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-29 16:23:59 -07:00
										 |  |  | /*-------------------------------------------------------------------------*/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-17 20:15:21 +00:00
										 |  |  | /*-------------------------------------------------------------------------*/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-15 12:40:11 -07:00
										 |  |  | struct davinci_timer_instance davinci_timer_instance[2] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2010-05-07 17:06:35 -04:00
										 |  |  | 		.base		= DAVINCI_TIMER0_BASE, | 
					
						
							| 
									
										
										
										
											2009-04-15 12:40:11 -07:00
										 |  |  | 		.bottom_irq	= IRQ_TINT0_TINT12, | 
					
						
							|  |  |  | 		.top_irq	= IRQ_TINT0_TINT34, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2010-05-07 17:06:35 -04:00
										 |  |  | 		.base		= DAVINCI_TIMER1_BASE, | 
					
						
							| 
									
										
										
										
											2009-04-15 12:40:11 -07:00
										 |  |  | 		.bottom_irq	= IRQ_TINT1_TINT12, | 
					
						
							|  |  |  | 		.top_irq	= IRQ_TINT1_TINT34, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 |