| Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 1 | /* | 
 | 2 |  * linux/arch/arm/mach-omap2/devices.c | 
 | 3 |  * | 
 | 4 |  * OMAP2 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 | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 12 | #include <linux/module.h> | 
 | 13 | #include <linux/kernel.h> | 
 | 14 | #include <linux/init.h> | 
 | 15 | #include <linux/platform_device.h> | 
 | 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 | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 27 | #if 	defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) | 
 | 28 |  | 
 | 29 | #define OMAP2_I2C_BASE2		0x48072000 | 
 | 30 | #define OMAP2_I2C_INT2		57 | 
 | 31 |  | 
 | 32 | static struct resource i2c_resources2[] = { | 
 | 33 | 	{ | 
 | 34 | 		.start		= OMAP2_I2C_BASE2, | 
 | 35 | 		.end		= OMAP2_I2C_BASE2 + 0x3f, | 
 | 36 | 		.flags		= IORESOURCE_MEM, | 
 | 37 | 	}, | 
 | 38 | 	{ | 
 | 39 | 		.start		= OMAP2_I2C_INT2, | 
 | 40 | 		.flags		= IORESOURCE_IRQ, | 
 | 41 | 	}, | 
 | 42 | }; | 
 | 43 |  | 
 | 44 | static struct platform_device omap_i2c_device2 = { | 
 | 45 |         .name           = "i2c_omap", | 
 | 46 |         .id             = 2, | 
| Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 47 | 	.num_resources	= ARRAY_SIZE(i2c_resources2), | 
 | 48 | 	.resource	= i2c_resources2, | 
 | 49 | }; | 
 | 50 |  | 
 | 51 | /* See also arch/arm/plat-omap/devices.c for first I2C on 24xx */ | 
 | 52 | static void omap_init_i2c(void) | 
 | 53 | { | 
 | 54 | 	/* REVISIT: Second I2C not in use on H4? */ | 
 | 55 | 	if (machine_is_omap_h4()) | 
 | 56 | 		return; | 
 | 57 |  | 
 | 58 | 	omap_cfg_reg(J15_24XX_I2C2_SCL); | 
 | 59 | 	omap_cfg_reg(H19_24XX_I2C2_SDA); | 
 | 60 | 	(void) platform_device_register(&omap_i2c_device2); | 
 | 61 | } | 
 | 62 |  | 
 | 63 | #else | 
 | 64 |  | 
 | 65 | static void omap_init_i2c(void) {} | 
 | 66 |  | 
 | 67 | #endif | 
 | 68 |  | 
| Tony Lindgren | 9b6553c | 2006-04-02 17:46:30 +0100 | [diff] [blame] | 69 | #if defined(CONFIG_OMAP_STI) | 
 | 70 |  | 
 | 71 | #define OMAP2_STI_BASE		IO_ADDRESS(0x48068000) | 
 | 72 | #define OMAP2_STI_CHANNEL_BASE	0x54000000 | 
 | 73 | #define OMAP2_STI_IRQ		4 | 
 | 74 |  | 
 | 75 | static struct resource sti_resources[] = { | 
 | 76 | 	{ | 
 | 77 | 		.start		= OMAP2_STI_BASE, | 
 | 78 | 		.end		= OMAP2_STI_BASE + 0x7ff, | 
 | 79 | 		.flags		= IORESOURCE_MEM, | 
 | 80 | 	}, | 
 | 81 | 	{ | 
 | 82 | 		.start		= OMAP2_STI_CHANNEL_BASE, | 
 | 83 | 		.end		= OMAP2_STI_CHANNEL_BASE + SZ_64K - 1, | 
 | 84 | 		.flags		= IORESOURCE_MEM, | 
 | 85 | 	}, | 
 | 86 | 	{ | 
 | 87 | 		.start		= OMAP2_STI_IRQ, | 
 | 88 | 		.flags		= IORESOURCE_IRQ, | 
 | 89 | 	} | 
 | 90 | }; | 
 | 91 |  | 
 | 92 | static struct platform_device sti_device = { | 
 | 93 | 	.name		= "sti", | 
 | 94 | 	.id		= -1, | 
| Tony Lindgren | 9b6553c | 2006-04-02 17:46:30 +0100 | [diff] [blame] | 95 | 	.num_resources	= ARRAY_SIZE(sti_resources), | 
 | 96 | 	.resource	= sti_resources, | 
 | 97 | }; | 
 | 98 |  | 
 | 99 | static inline void omap_init_sti(void) | 
 | 100 | { | 
 | 101 | 	platform_device_register(&sti_device); | 
 | 102 | } | 
 | 103 | #else | 
 | 104 | static inline void omap_init_sti(void) {} | 
 | 105 | #endif | 
 | 106 |  | 
| Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 107 | #if defined(CONFIG_SPI_OMAP24XX) | 
 | 108 |  | 
 | 109 | #include <asm/arch/mcspi.h> | 
 | 110 |  | 
 | 111 | #define OMAP2_MCSPI1_BASE		0x48098000 | 
 | 112 | #define OMAP2_MCSPI2_BASE		0x4809a000 | 
 | 113 |  | 
 | 114 | /* FIXME: use resources instead */ | 
 | 115 |  | 
 | 116 | static struct omap2_mcspi_platform_config omap2_mcspi1_config = { | 
 | 117 | 	.base		= io_p2v(OMAP2_MCSPI1_BASE), | 
 | 118 | 	.num_cs		= 4, | 
 | 119 | }; | 
 | 120 |  | 
 | 121 | struct platform_device omap2_mcspi1 = { | 
 | 122 | 	.name		= "omap2_mcspi", | 
 | 123 | 	.id		= 1, | 
 | 124 | 	.dev		= { | 
 | 125 | 		.platform_data = &omap2_mcspi1_config, | 
 | 126 | 	}, | 
 | 127 | }; | 
 | 128 |  | 
 | 129 | static struct omap2_mcspi_platform_config omap2_mcspi2_config = { | 
 | 130 | 	.base		= io_p2v(OMAP2_MCSPI2_BASE), | 
 | 131 | 	.num_cs		= 2, | 
 | 132 | }; | 
 | 133 |  | 
 | 134 | struct platform_device omap2_mcspi2 = { | 
 | 135 | 	.name		= "omap2_mcspi", | 
 | 136 | 	.id		= 2, | 
 | 137 | 	.dev		= { | 
 | 138 | 		.platform_data = &omap2_mcspi2_config, | 
 | 139 | 	}, | 
 | 140 | }; | 
 | 141 |  | 
 | 142 | static void omap_init_mcspi(void) | 
 | 143 | { | 
 | 144 | 	platform_device_register(&omap2_mcspi1); | 
 | 145 | 	platform_device_register(&omap2_mcspi2); | 
 | 146 | } | 
 | 147 |  | 
 | 148 | #else | 
 | 149 | static inline void omap_init_mcspi(void) {} | 
 | 150 | #endif | 
 | 151 |  | 
| Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 152 | /*-------------------------------------------------------------------------*/ | 
 | 153 |  | 
 | 154 | static int __init omap2_init_devices(void) | 
 | 155 | { | 
 | 156 | 	/* please keep these calls, and their implementations above, | 
 | 157 | 	 * in alphabetical order so they're easier to sort through. | 
 | 158 | 	 */ | 
 | 159 | 	omap_init_i2c(); | 
| Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 160 | 	omap_init_mcspi(); | 
| Tony Lindgren | 9b6553c | 2006-04-02 17:46:30 +0100 | [diff] [blame] | 161 | 	omap_init_sti(); | 
| Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 162 |  | 
 | 163 | 	return 0; | 
 | 164 | } | 
 | 165 | arch_initcall(omap2_init_devices); | 
 | 166 |  |