| Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 1 | /* | 
 | 2 |  * linux/arch/arm/mach-omap1/devices.c | 
 | 3 |  * | 
 | 4 |  * OMAP1 platform device setup/initialization | 
 | 5 |  * | 
 | 6 |  * This program is free software; you can redistribute it and/or modify | 
 | 7 |  * it under the terms of the GNU General Public License as published by | 
 | 8 |  * the Free Software Foundation; either version 2 of the License, or | 
 | 9 |  * (at your option) any later version. | 
 | 10 |  */ | 
 | 11 |  | 
| Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 12 | #include <linux/module.h> | 
 | 13 | #include <linux/kernel.h> | 
 | 14 | #include <linux/init.h> | 
| Russell King | d052d1b | 2005-10-29 19:07:23 +0100 | [diff] [blame] | 15 | #include <linux/platform_device.h> | 
| Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 16 |  | 
 | 17 | #include <asm/hardware.h> | 
 | 18 | #include <asm/io.h> | 
 | 19 | #include <asm/mach-types.h> | 
 | 20 | #include <asm/mach/map.h> | 
 | 21 |  | 
 | 22 | #include <asm/arch/tc.h> | 
 | 23 | #include <asm/arch/board.h> | 
 | 24 | #include <asm/arch/mux.h> | 
 | 25 | #include <asm/arch/gpio.h> | 
 | 26 |  | 
| Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 27 | #if	defined(CONFIG_OMAP1610_IR) || defined(CONFIG_OMAP161O_IR_MODULE) | 
 | 28 |  | 
 | 29 | static u64 irda_dmamask = 0xffffffff; | 
 | 30 |  | 
 | 31 | static struct platform_device omap1610ir_device = { | 
 | 32 | 	.name = "omap1610-ir", | 
 | 33 | 	.id = -1, | 
 | 34 | 	.dev = { | 
| Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 35 | 		.dma_mask	= &irda_dmamask, | 
 | 36 | 	}, | 
 | 37 | }; | 
 | 38 |  | 
 | 39 | static void omap_init_irda(void) | 
 | 40 | { | 
 | 41 | 	/* FIXME define and use a boot tag, members something like: | 
 | 42 | 	 *  u8		uart;		// uart1, or uart3 | 
 | 43 | 	 * ... but driver only handles uart3 for now | 
 | 44 | 	 *  s16		fir_sel;	// gpio for SIR vs FIR | 
 | 45 | 	 * ... may prefer a callback for SIR/MIR/FIR mode select; | 
 | 46 | 	 * while h2 uses a GPIO, H3 uses a gpio expander | 
 | 47 | 	 */ | 
 | 48 | 	if (machine_is_omap_h2() | 
 | 49 | 			|| machine_is_omap_h3()) | 
 | 50 | 		(void) platform_device_register(&omap1610ir_device); | 
 | 51 | } | 
 | 52 | #else | 
 | 53 | static inline void omap_init_irda(void) {} | 
 | 54 | #endif | 
 | 55 |  | 
 | 56 | /*-------------------------------------------------------------------------*/ | 
 | 57 |  | 
| David Brownell | db68b18 | 2006-12-06 20:38:36 -0800 | [diff] [blame] | 58 | #if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE) | 
| Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 59 |  | 
 | 60 | #define	OMAP_RTC_BASE		0xfffb4800 | 
 | 61 |  | 
 | 62 | static struct resource rtc_resources[] = { | 
 | 63 | 	{ | 
 | 64 | 		.start		= OMAP_RTC_BASE, | 
 | 65 | 		.end		= OMAP_RTC_BASE + 0x5f, | 
 | 66 | 		.flags		= IORESOURCE_MEM, | 
 | 67 | 	}, | 
 | 68 | 	{ | 
 | 69 | 		.start		= INT_RTC_TIMER, | 
 | 70 | 		.flags		= IORESOURCE_IRQ, | 
 | 71 | 	}, | 
 | 72 | 	{ | 
 | 73 | 		.start		= INT_RTC_ALARM, | 
 | 74 | 		.flags		= IORESOURCE_IRQ, | 
 | 75 | 	}, | 
 | 76 | }; | 
 | 77 |  | 
 | 78 | static struct platform_device omap_rtc_device = { | 
 | 79 | 	.name           = "omap_rtc", | 
 | 80 | 	.id             = -1, | 
| Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 81 | 	.num_resources	= ARRAY_SIZE(rtc_resources), | 
 | 82 | 	.resource	= rtc_resources, | 
 | 83 | }; | 
 | 84 |  | 
 | 85 | static void omap_init_rtc(void) | 
 | 86 | { | 
 | 87 | 	(void) platform_device_register(&omap_rtc_device); | 
 | 88 | } | 
 | 89 | #else | 
 | 90 | static inline void omap_init_rtc(void) {} | 
 | 91 | #endif | 
 | 92 |  | 
| Tony Lindgren | 9b6553c | 2006-04-02 17:46:30 +0100 | [diff] [blame] | 93 | #if defined(CONFIG_OMAP_STI) | 
 | 94 |  | 
 | 95 | #define OMAP1_STI_BASE		IO_ADDRESS(0xfffea000) | 
 | 96 | #define OMAP1_STI_CHANNEL_BASE	(OMAP1_STI_BASE + 0x400) | 
 | 97 |  | 
 | 98 | static struct resource sti_resources[] = { | 
 | 99 | 	{ | 
 | 100 | 		.start		= OMAP1_STI_BASE, | 
 | 101 | 		.end		= OMAP1_STI_BASE + SZ_1K - 1, | 
 | 102 | 		.flags		= IORESOURCE_MEM, | 
 | 103 | 	}, | 
 | 104 | 	{ | 
 | 105 | 		.start		= OMAP1_STI_CHANNEL_BASE, | 
 | 106 | 		.end		= OMAP1_STI_CHANNEL_BASE + SZ_1K - 1, | 
 | 107 | 		.flags		= IORESOURCE_MEM, | 
 | 108 | 	}, | 
 | 109 | 	{ | 
 | 110 | 		.start		= INT_1610_STI, | 
 | 111 | 		.flags		= IORESOURCE_IRQ, | 
 | 112 | 	} | 
 | 113 | }; | 
 | 114 |  | 
 | 115 | static struct platform_device sti_device = { | 
 | 116 | 	.name		= "sti", | 
 | 117 | 	.id		= -1, | 
| Tony Lindgren | 9b6553c | 2006-04-02 17:46:30 +0100 | [diff] [blame] | 118 | 	.num_resources	= ARRAY_SIZE(sti_resources), | 
 | 119 | 	.resource	= sti_resources, | 
 | 120 | }; | 
 | 121 |  | 
 | 122 | static inline void omap_init_sti(void) | 
 | 123 | { | 
 | 124 | 	platform_device_register(&sti_device); | 
 | 125 | } | 
 | 126 | #else | 
 | 127 | static inline void omap_init_sti(void) {} | 
 | 128 | #endif | 
| Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 129 |  | 
 | 130 | /*-------------------------------------------------------------------------*/ | 
 | 131 |  | 
 | 132 | /* | 
 | 133 |  * This gets called after board-specific INIT_MACHINE, and initializes most | 
 | 134 |  * on-chip peripherals accessible on this board (except for few like USB): | 
 | 135 |  * | 
 | 136 |  *  (a) Does any "standard config" pin muxing needed.  Board-specific | 
 | 137 |  *	code will have muxed GPIO pins and done "nonstandard" setup; | 
 | 138 |  *	that code could live in the boot loader. | 
 | 139 |  *  (b) Populating board-specific platform_data with the data drivers | 
 | 140 |  *	rely on to handle wiring variations. | 
 | 141 |  *  (c) Creating platform devices as meaningful on this board and | 
 | 142 |  *	with this kernel configuration. | 
 | 143 |  * | 
 | 144 |  * Claiming GPIOs, and setting their direction and initial values, is the | 
 | 145 |  * responsibility of the device drivers.  So is responding to probe(). | 
 | 146 |  * | 
 | 147 |  * Board-specific knowlege like creating devices or pin setup is to be | 
 | 148 |  * kept out of drivers as much as possible.  In particular, pin setup | 
 | 149 |  * may be handled by the boot loader, and drivers should expect it will | 
 | 150 |  * normally have been done by the time they're probed. | 
 | 151 |  */ | 
| Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 152 | static int __init omap1_init_devices(void) | 
| Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 153 | { | 
 | 154 | 	/* please keep these calls, and their implementations above, | 
 | 155 | 	 * in alphabetical order so they're easier to sort through. | 
 | 156 | 	 */ | 
| Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 157 | 	omap_init_irda(); | 
| Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 158 | 	omap_init_rtc(); | 
| Tony Lindgren | 9b6553c | 2006-04-02 17:46:30 +0100 | [diff] [blame] | 159 | 	omap_init_sti(); | 
| Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 160 |  | 
 | 161 | 	return 0; | 
 | 162 | } | 
| Tony Lindgren | 3179a01 | 2005-11-10 14:26:48 +0000 | [diff] [blame] | 163 | arch_initcall(omap1_init_devices); | 
| Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 164 |  |