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/kernel.h> |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/platform_device.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 15 | #include <linux/io.h> |
Kevin Hilman | 917fa28 | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 16 | #include <linux/clk.h> |
Varadarajan, Charulatha | f2ce623 | 2010-09-23 20:02:42 +0530 | [diff] [blame] | 17 | #include <linux/err.h> |
Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 18 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 19 | #include <mach/hardware.h> |
Will Deacon | 8834133 | 2010-04-09 13:54:43 +0100 | [diff] [blame] | 20 | #include <mach/irqs.h> |
Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 21 | #include <asm/mach-types.h> |
| 22 | #include <asm/mach/map.h> |
Will Deacon | 8834133 | 2010-04-09 13:54:43 +0100 | [diff] [blame] | 23 | #include <asm/pmu.h> |
Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 24 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 25 | #include <plat/tc.h> |
| 26 | #include <plat/board.h> |
Jarkko Nikula | a09f73f | 2010-10-04 15:04:53 +0300 | [diff] [blame] | 27 | #include <plat/mcbsp.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 28 | #include <mach/gpio.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 29 | #include <plat/mmc.h> |
Dmitry Kasatkin | ee5500c | 2010-05-03 11:10:03 +0800 | [diff] [blame] | 30 | #include <plat/dma.h> |
Varadarajan, Charulatha | f2ce623 | 2010-09-23 20:02:42 +0530 | [diff] [blame] | 31 | #include <plat/omap_hwmod.h> |
| 32 | #include <plat/omap_device.h> |
Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 33 | |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 34 | #include "mux.h" |
Paul Walmsley | 4814ced | 2010-10-08 11:40:20 -0600 | [diff] [blame] | 35 | #include "control.h" |
Paul Walmsley | 81fbc5ef | 2010-12-21 19:56:17 -0700 | [diff] [blame^] | 36 | #include "wd_timer.h" |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 37 | |
Tony Lindgren | 828c707 | 2009-03-23 18:23:49 -0700 | [diff] [blame] | 38 | #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE) |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 39 | |
Tony Lindgren | 828c707 | 2009-03-23 18:23:49 -0700 | [diff] [blame] | 40 | static struct resource cam_resources[] = { |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 41 | { |
Tony Lindgren | 828c707 | 2009-03-23 18:23:49 -0700 | [diff] [blame] | 42 | .start = OMAP24XX_CAMERA_BASE, |
| 43 | .end = OMAP24XX_CAMERA_BASE + 0xfff, |
| 44 | .flags = IORESOURCE_MEM, |
| 45 | }, |
| 46 | { |
| 47 | .start = INT_24XX_CAM_IRQ, |
| 48 | .flags = IORESOURCE_IRQ, |
| 49 | } |
| 50 | }; |
| 51 | |
| 52 | static struct platform_device omap_cam_device = { |
| 53 | .name = "omap24xxcam", |
| 54 | .id = -1, |
| 55 | .num_resources = ARRAY_SIZE(cam_resources), |
| 56 | .resource = cam_resources, |
| 57 | }; |
| 58 | |
| 59 | static inline void omap_init_camera(void) |
| 60 | { |
| 61 | platform_device_register(&omap_cam_device); |
| 62 | } |
| 63 | |
| 64 | #elif defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) |
| 65 | |
| 66 | static struct resource omap3isp_resources[] = { |
| 67 | { |
| 68 | .start = OMAP3430_ISP_BASE, |
| 69 | .end = OMAP3430_ISP_END, |
| 70 | .flags = IORESOURCE_MEM, |
| 71 | }, |
| 72 | { |
| 73 | .start = OMAP3430_ISP_CBUFF_BASE, |
| 74 | .end = OMAP3430_ISP_CBUFF_END, |
| 75 | .flags = IORESOURCE_MEM, |
| 76 | }, |
| 77 | { |
| 78 | .start = OMAP3430_ISP_CCP2_BASE, |
| 79 | .end = OMAP3430_ISP_CCP2_END, |
| 80 | .flags = IORESOURCE_MEM, |
| 81 | }, |
| 82 | { |
| 83 | .start = OMAP3430_ISP_CCDC_BASE, |
| 84 | .end = OMAP3430_ISP_CCDC_END, |
| 85 | .flags = IORESOURCE_MEM, |
| 86 | }, |
| 87 | { |
| 88 | .start = OMAP3430_ISP_HIST_BASE, |
| 89 | .end = OMAP3430_ISP_HIST_END, |
| 90 | .flags = IORESOURCE_MEM, |
| 91 | }, |
| 92 | { |
| 93 | .start = OMAP3430_ISP_H3A_BASE, |
| 94 | .end = OMAP3430_ISP_H3A_END, |
| 95 | .flags = IORESOURCE_MEM, |
| 96 | }, |
| 97 | { |
| 98 | .start = OMAP3430_ISP_PREV_BASE, |
| 99 | .end = OMAP3430_ISP_PREV_END, |
| 100 | .flags = IORESOURCE_MEM, |
| 101 | }, |
| 102 | { |
| 103 | .start = OMAP3430_ISP_RESZ_BASE, |
| 104 | .end = OMAP3430_ISP_RESZ_END, |
| 105 | .flags = IORESOURCE_MEM, |
| 106 | }, |
| 107 | { |
| 108 | .start = OMAP3430_ISP_SBL_BASE, |
| 109 | .end = OMAP3430_ISP_SBL_END, |
| 110 | .flags = IORESOURCE_MEM, |
| 111 | }, |
| 112 | { |
| 113 | .start = OMAP3430_ISP_CSI2A_BASE, |
| 114 | .end = OMAP3430_ISP_CSI2A_END, |
| 115 | .flags = IORESOURCE_MEM, |
| 116 | }, |
| 117 | { |
| 118 | .start = OMAP3430_ISP_CSI2PHY_BASE, |
| 119 | .end = OMAP3430_ISP_CSI2PHY_END, |
| 120 | .flags = IORESOURCE_MEM, |
| 121 | }, |
| 122 | { |
| 123 | .start = INT_34XX_CAM_IRQ, |
| 124 | .flags = IORESOURCE_IRQ, |
| 125 | } |
| 126 | }; |
| 127 | |
| 128 | static struct platform_device omap3isp_device = { |
| 129 | .name = "omap3isp", |
| 130 | .id = -1, |
| 131 | .num_resources = ARRAY_SIZE(omap3isp_resources), |
| 132 | .resource = omap3isp_resources, |
| 133 | }; |
| 134 | |
| 135 | static inline void omap_init_camera(void) |
| 136 | { |
| 137 | platform_device_register(&omap3isp_device); |
| 138 | } |
| 139 | #else |
| 140 | static inline void omap_init_camera(void) |
| 141 | { |
| 142 | } |
| 143 | #endif |
| 144 | |
Hiroshi DOYU | 6c20a68 | 2009-03-23 18:07:23 -0700 | [diff] [blame] | 145 | #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE) |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 146 | |
C A Subramaniam | 454bf34 | 2009-11-22 10:11:18 -0800 | [diff] [blame] | 147 | #define MBOX_REG_SIZE 0x120 |
Hiroshi DOYU | 6c20a68 | 2009-03-23 18:07:23 -0700 | [diff] [blame] | 148 | |
C A Subramaniam | 454bf34 | 2009-11-22 10:11:18 -0800 | [diff] [blame] | 149 | #ifdef CONFIG_ARCH_OMAP2 |
Tony Lindgren | d10f2b6 | 2010-02-12 12:26:47 -0800 | [diff] [blame] | 150 | static struct resource omap2_mbox_resources[] = { |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 151 | { |
Hiroshi DOYU | 6c20a68 | 2009-03-23 18:07:23 -0700 | [diff] [blame] | 152 | .start = OMAP24XX_MAILBOX_BASE, |
| 153 | .end = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1, |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 154 | .flags = IORESOURCE_MEM, |
| 155 | }, |
| 156 | { |
| 157 | .start = INT_24XX_MAIL_U0_MPU, |
| 158 | .flags = IORESOURCE_IRQ, |
Felipe Contreras | 1f2c4df | 2010-06-11 15:51:44 +0000 | [diff] [blame] | 159 | .name = "dsp", |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 160 | }, |
| 161 | { |
| 162 | .start = INT_24XX_MAIL_U3_MPU, |
| 163 | .flags = IORESOURCE_IRQ, |
Felipe Contreras | 1f2c4df | 2010-06-11 15:51:44 +0000 | [diff] [blame] | 164 | .name = "iva", |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 165 | }, |
| 166 | }; |
Tony Lindgren | d10f2b6 | 2010-02-12 12:26:47 -0800 | [diff] [blame] | 167 | static int omap2_mbox_resources_sz = ARRAY_SIZE(omap2_mbox_resources); |
| 168 | #else |
| 169 | #define omap2_mbox_resources NULL |
| 170 | #define omap2_mbox_resources_sz 0 |
C A Subramaniam | 454bf34 | 2009-11-22 10:11:18 -0800 | [diff] [blame] | 171 | #endif |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 172 | |
C A Subramaniam | 454bf34 | 2009-11-22 10:11:18 -0800 | [diff] [blame] | 173 | #ifdef CONFIG_ARCH_OMAP3 |
Tony Lindgren | d10f2b6 | 2010-02-12 12:26:47 -0800 | [diff] [blame] | 174 | static struct resource omap3_mbox_resources[] = { |
Hiroshi DOYU | 6c20a68 | 2009-03-23 18:07:23 -0700 | [diff] [blame] | 175 | { |
| 176 | .start = OMAP34XX_MAILBOX_BASE, |
| 177 | .end = OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1, |
| 178 | .flags = IORESOURCE_MEM, |
| 179 | }, |
| 180 | { |
| 181 | .start = INT_24XX_MAIL_U0_MPU, |
| 182 | .flags = IORESOURCE_IRQ, |
Felipe Contreras | 1f2c4df | 2010-06-11 15:51:44 +0000 | [diff] [blame] | 183 | .name = "dsp", |
Hiroshi DOYU | 6c20a68 | 2009-03-23 18:07:23 -0700 | [diff] [blame] | 184 | }, |
| 185 | }; |
Tony Lindgren | d10f2b6 | 2010-02-12 12:26:47 -0800 | [diff] [blame] | 186 | static int omap3_mbox_resources_sz = ARRAY_SIZE(omap3_mbox_resources); |
| 187 | #else |
| 188 | #define omap3_mbox_resources NULL |
| 189 | #define omap3_mbox_resources_sz 0 |
C A Subramaniam | 454bf34 | 2009-11-22 10:11:18 -0800 | [diff] [blame] | 190 | #endif |
| 191 | |
| 192 | #ifdef CONFIG_ARCH_OMAP4 |
| 193 | |
| 194 | #define OMAP4_MBOX_REG_SIZE 0x130 |
Tony Lindgren | d10f2b6 | 2010-02-12 12:26:47 -0800 | [diff] [blame] | 195 | static struct resource omap4_mbox_resources[] = { |
C A Subramaniam | 454bf34 | 2009-11-22 10:11:18 -0800 | [diff] [blame] | 196 | { |
| 197 | .start = OMAP44XX_MAILBOX_BASE, |
| 198 | .end = OMAP44XX_MAILBOX_BASE + |
| 199 | OMAP4_MBOX_REG_SIZE - 1, |
| 200 | .flags = IORESOURCE_MEM, |
| 201 | }, |
| 202 | { |
Santosh Shilimkar | 5772ca7 | 2010-02-18 03:14:12 +0530 | [diff] [blame] | 203 | .start = OMAP44XX_IRQ_MAIL_U0, |
C A Subramaniam | 454bf34 | 2009-11-22 10:11:18 -0800 | [diff] [blame] | 204 | .flags = IORESOURCE_IRQ, |
Felipe Contreras | 1f2c4df | 2010-06-11 15:51:44 +0000 | [diff] [blame] | 205 | .name = "mbox", |
C A Subramaniam | 454bf34 | 2009-11-22 10:11:18 -0800 | [diff] [blame] | 206 | }, |
| 207 | }; |
Tony Lindgren | d10f2b6 | 2010-02-12 12:26:47 -0800 | [diff] [blame] | 208 | static int omap4_mbox_resources_sz = ARRAY_SIZE(omap4_mbox_resources); |
| 209 | #else |
| 210 | #define omap4_mbox_resources NULL |
| 211 | #define omap4_mbox_resources_sz 0 |
C A Subramaniam | 454bf34 | 2009-11-22 10:11:18 -0800 | [diff] [blame] | 212 | #endif |
Hiroshi DOYU | 6c20a68 | 2009-03-23 18:07:23 -0700 | [diff] [blame] | 213 | |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 214 | static struct platform_device mbox_device = { |
Felipe Contreras | d742709 | 2010-06-11 15:51:48 +0000 | [diff] [blame] | 215 | .name = "omap-mailbox", |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 216 | .id = -1, |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 217 | }; |
| 218 | |
| 219 | static inline void omap_init_mbox(void) |
| 220 | { |
Tony Lindgren | d10f2b6 | 2010-02-12 12:26:47 -0800 | [diff] [blame] | 221 | if (cpu_is_omap24xx()) { |
| 222 | mbox_device.resource = omap2_mbox_resources; |
| 223 | mbox_device.num_resources = omap2_mbox_resources_sz; |
| 224 | } else if (cpu_is_omap34xx()) { |
| 225 | mbox_device.resource = omap3_mbox_resources; |
| 226 | mbox_device.num_resources = omap3_mbox_resources_sz; |
| 227 | } else if (cpu_is_omap44xx()) { |
| 228 | mbox_device.resource = omap4_mbox_resources; |
| 229 | mbox_device.num_resources = omap4_mbox_resources_sz; |
Hiroshi DOYU | 6c20a68 | 2009-03-23 18:07:23 -0700 | [diff] [blame] | 230 | } else { |
| 231 | pr_err("%s: platform not supported\n", __func__); |
| 232 | return; |
| 233 | } |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 234 | platform_device_register(&mbox_device); |
| 235 | } |
| 236 | #else |
| 237 | static inline void omap_init_mbox(void) { } |
Hiroshi DOYU | 6c20a68 | 2009-03-23 18:07:23 -0700 | [diff] [blame] | 238 | #endif /* CONFIG_OMAP_MBOX_FWK */ |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 239 | |
Tony Lindgren | 9b6553c | 2006-04-02 17:46:30 +0100 | [diff] [blame] | 240 | static inline void omap_init_sti(void) {} |
Tony Lindgren | 9b6553c | 2006-04-02 17:46:30 +0100 | [diff] [blame] | 241 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 242 | #if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE) |
| 243 | |
| 244 | static struct platform_device omap_pcm = { |
| 245 | .name = "omap-pcm-audio", |
| 246 | .id = -1, |
| 247 | }; |
| 248 | |
| 249 | /* |
| 250 | * OMAP2420 has 2 McBSP ports |
| 251 | * OMAP2430 has 5 McBSP ports |
| 252 | * OMAP3 has 5 McBSP ports |
| 253 | * OMAP4 has 4 McBSP ports |
| 254 | */ |
| 255 | OMAP_MCBSP_PLATFORM_DEVICE(1); |
| 256 | OMAP_MCBSP_PLATFORM_DEVICE(2); |
| 257 | OMAP_MCBSP_PLATFORM_DEVICE(3); |
| 258 | OMAP_MCBSP_PLATFORM_DEVICE(4); |
| 259 | OMAP_MCBSP_PLATFORM_DEVICE(5); |
| 260 | |
| 261 | static void omap_init_audio(void) |
| 262 | { |
| 263 | platform_device_register(&omap_mcbsp1); |
| 264 | platform_device_register(&omap_mcbsp2); |
| 265 | if (cpu_is_omap243x() || cpu_is_omap34xx() || cpu_is_omap44xx()) { |
| 266 | platform_device_register(&omap_mcbsp3); |
| 267 | platform_device_register(&omap_mcbsp4); |
| 268 | } |
| 269 | if (cpu_is_omap243x() || cpu_is_omap34xx()) |
| 270 | platform_device_register(&omap_mcbsp5); |
| 271 | |
| 272 | platform_device_register(&omap_pcm); |
| 273 | } |
| 274 | |
| 275 | #else |
| 276 | static inline void omap_init_audio(void) {} |
| 277 | #endif |
| 278 | |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 279 | #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE) |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 280 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 281 | #include <plat/mcspi.h> |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 282 | |
| 283 | #define OMAP2_MCSPI1_BASE 0x48098000 |
| 284 | #define OMAP2_MCSPI2_BASE 0x4809a000 |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 285 | #define OMAP2_MCSPI3_BASE 0x480b8000 |
| 286 | #define OMAP2_MCSPI4_BASE 0x480ba000 |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 287 | |
Syed Rafiuddin | 7869c0b | 2009-09-22 16:46:18 -0700 | [diff] [blame] | 288 | #define OMAP4_MCSPI1_BASE 0x48098100 |
| 289 | #define OMAP4_MCSPI2_BASE 0x4809a100 |
| 290 | #define OMAP4_MCSPI3_BASE 0x480b8100 |
| 291 | #define OMAP4_MCSPI4_BASE 0x480ba100 |
| 292 | |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 293 | static struct omap2_mcspi_platform_config omap2_mcspi1_config = { |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 294 | .num_cs = 4, |
| 295 | }; |
| 296 | |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 297 | static struct resource omap2_mcspi1_resources[] = { |
| 298 | { |
| 299 | .start = OMAP2_MCSPI1_BASE, |
| 300 | .end = OMAP2_MCSPI1_BASE + 0xff, |
| 301 | .flags = IORESOURCE_MEM, |
| 302 | }, |
| 303 | }; |
| 304 | |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 305 | static struct platform_device omap2_mcspi1 = { |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 306 | .name = "omap2_mcspi", |
| 307 | .id = 1, |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 308 | .num_resources = ARRAY_SIZE(omap2_mcspi1_resources), |
| 309 | .resource = omap2_mcspi1_resources, |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 310 | .dev = { |
| 311 | .platform_data = &omap2_mcspi1_config, |
| 312 | }, |
| 313 | }; |
| 314 | |
| 315 | static struct omap2_mcspi_platform_config omap2_mcspi2_config = { |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 316 | .num_cs = 2, |
| 317 | }; |
| 318 | |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 319 | static struct resource omap2_mcspi2_resources[] = { |
| 320 | { |
| 321 | .start = OMAP2_MCSPI2_BASE, |
| 322 | .end = OMAP2_MCSPI2_BASE + 0xff, |
| 323 | .flags = IORESOURCE_MEM, |
| 324 | }, |
| 325 | }; |
| 326 | |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 327 | static struct platform_device omap2_mcspi2 = { |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 328 | .name = "omap2_mcspi", |
| 329 | .id = 2, |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 330 | .num_resources = ARRAY_SIZE(omap2_mcspi2_resources), |
| 331 | .resource = omap2_mcspi2_resources, |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 332 | .dev = { |
| 333 | .platform_data = &omap2_mcspi2_config, |
| 334 | }, |
| 335 | }; |
| 336 | |
Syed Rafiuddin | 7869c0b | 2009-09-22 16:46:18 -0700 | [diff] [blame] | 337 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \ |
| 338 | defined(CONFIG_ARCH_OMAP4) |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 339 | static struct omap2_mcspi_platform_config omap2_mcspi3_config = { |
| 340 | .num_cs = 2, |
| 341 | }; |
| 342 | |
| 343 | static struct resource omap2_mcspi3_resources[] = { |
| 344 | { |
| 345 | .start = OMAP2_MCSPI3_BASE, |
| 346 | .end = OMAP2_MCSPI3_BASE + 0xff, |
| 347 | .flags = IORESOURCE_MEM, |
| 348 | }, |
| 349 | }; |
| 350 | |
| 351 | static struct platform_device omap2_mcspi3 = { |
| 352 | .name = "omap2_mcspi", |
| 353 | .id = 3, |
| 354 | .num_resources = ARRAY_SIZE(omap2_mcspi3_resources), |
| 355 | .resource = omap2_mcspi3_resources, |
| 356 | .dev = { |
| 357 | .platform_data = &omap2_mcspi3_config, |
| 358 | }, |
| 359 | }; |
| 360 | #endif |
| 361 | |
Syed Rafiuddin | 7869c0b | 2009-09-22 16:46:18 -0700 | [diff] [blame] | 362 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 363 | static struct omap2_mcspi_platform_config omap2_mcspi4_config = { |
| 364 | .num_cs = 1, |
| 365 | }; |
| 366 | |
| 367 | static struct resource omap2_mcspi4_resources[] = { |
| 368 | { |
| 369 | .start = OMAP2_MCSPI4_BASE, |
| 370 | .end = OMAP2_MCSPI4_BASE + 0xff, |
| 371 | .flags = IORESOURCE_MEM, |
| 372 | }, |
| 373 | }; |
| 374 | |
| 375 | static struct platform_device omap2_mcspi4 = { |
| 376 | .name = "omap2_mcspi", |
| 377 | .id = 4, |
| 378 | .num_resources = ARRAY_SIZE(omap2_mcspi4_resources), |
| 379 | .resource = omap2_mcspi4_resources, |
| 380 | .dev = { |
| 381 | .platform_data = &omap2_mcspi4_config, |
| 382 | }, |
| 383 | }; |
| 384 | #endif |
| 385 | |
Tony Lindgren | af41a12 | 2009-09-24 16:23:05 -0700 | [diff] [blame] | 386 | #ifdef CONFIG_ARCH_OMAP4 |
| 387 | static inline void omap4_mcspi_fixup(void) |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 388 | { |
Tony Lindgren | af41a12 | 2009-09-24 16:23:05 -0700 | [diff] [blame] | 389 | omap2_mcspi1_resources[0].start = OMAP4_MCSPI1_BASE; |
| 390 | omap2_mcspi1_resources[0].end = OMAP4_MCSPI1_BASE + 0xff; |
| 391 | omap2_mcspi2_resources[0].start = OMAP4_MCSPI2_BASE; |
| 392 | omap2_mcspi2_resources[0].end = OMAP4_MCSPI2_BASE + 0xff; |
| 393 | omap2_mcspi3_resources[0].start = OMAP4_MCSPI3_BASE; |
| 394 | omap2_mcspi3_resources[0].end = OMAP4_MCSPI3_BASE + 0xff; |
| 395 | omap2_mcspi4_resources[0].start = OMAP4_MCSPI4_BASE; |
| 396 | omap2_mcspi4_resources[0].end = OMAP4_MCSPI4_BASE + 0xff; |
| 397 | } |
| 398 | #else |
| 399 | static inline void omap4_mcspi_fixup(void) |
| 400 | { |
| 401 | } |
| 402 | #endif |
| 403 | |
Syed Rafiuddin | 7869c0b | 2009-09-22 16:46:18 -0700 | [diff] [blame] | 404 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \ |
| 405 | defined(CONFIG_ARCH_OMAP4) |
Tony Lindgren | af41a12 | 2009-09-24 16:23:05 -0700 | [diff] [blame] | 406 | static inline void omap2_mcspi3_init(void) |
| 407 | { |
| 408 | platform_device_register(&omap2_mcspi3); |
| 409 | } |
| 410 | #else |
| 411 | static inline void omap2_mcspi3_init(void) |
| 412 | { |
| 413 | } |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 414 | #endif |
Tony Lindgren | af41a12 | 2009-09-24 16:23:05 -0700 | [diff] [blame] | 415 | |
Syed Rafiuddin | 7869c0b | 2009-09-22 16:46:18 -0700 | [diff] [blame] | 416 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) |
Tony Lindgren | af41a12 | 2009-09-24 16:23:05 -0700 | [diff] [blame] | 417 | static inline void omap2_mcspi4_init(void) |
| 418 | { |
| 419 | platform_device_register(&omap2_mcspi4); |
| 420 | } |
| 421 | #else |
| 422 | static inline void omap2_mcspi4_init(void) |
| 423 | { |
| 424 | } |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 425 | #endif |
Tony Lindgren | af41a12 | 2009-09-24 16:23:05 -0700 | [diff] [blame] | 426 | |
| 427 | static void omap_init_mcspi(void) |
| 428 | { |
| 429 | if (cpu_is_omap44xx()) |
| 430 | omap4_mcspi_fixup(); |
| 431 | |
| 432 | platform_device_register(&omap2_mcspi1); |
| 433 | platform_device_register(&omap2_mcspi2); |
| 434 | |
| 435 | if (cpu_is_omap2430() || cpu_is_omap343x() || cpu_is_omap44xx()) |
| 436 | omap2_mcspi3_init(); |
| 437 | |
| 438 | if (cpu_is_omap343x() || cpu_is_omap44xx()) |
| 439 | omap2_mcspi4_init(); |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 440 | } |
| 441 | |
| 442 | #else |
| 443 | static inline void omap_init_mcspi(void) {} |
| 444 | #endif |
| 445 | |
Will Deacon | 8834133 | 2010-04-09 13:54:43 +0100 | [diff] [blame] | 446 | static struct resource omap2_pmu_resource = { |
| 447 | .start = 3, |
| 448 | .end = 3, |
| 449 | .flags = IORESOURCE_IRQ, |
| 450 | }; |
| 451 | |
| 452 | static struct resource omap3_pmu_resource = { |
| 453 | .start = INT_34XX_BENCH_MPU_EMUL, |
| 454 | .end = INT_34XX_BENCH_MPU_EMUL, |
| 455 | .flags = IORESOURCE_IRQ, |
| 456 | }; |
| 457 | |
| 458 | static struct platform_device omap_pmu_device = { |
| 459 | .name = "arm-pmu", |
| 460 | .id = ARM_PMU_DEVICE_CPU, |
| 461 | .num_resources = 1, |
| 462 | }; |
| 463 | |
| 464 | static void omap_init_pmu(void) |
| 465 | { |
| 466 | if (cpu_is_omap24xx()) |
| 467 | omap_pmu_device.resource = &omap2_pmu_resource; |
| 468 | else if (cpu_is_omap34xx()) |
| 469 | omap_pmu_device.resource = &omap3_pmu_resource; |
| 470 | else |
| 471 | return; |
| 472 | |
| 473 | platform_device_register(&omap_pmu_device); |
| 474 | } |
| 475 | |
| 476 | |
Dmitry Kasatkin | ee5500c | 2010-05-03 11:10:03 +0800 | [diff] [blame] | 477 | #if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE) |
| 478 | |
Dmitry Kasatkin | edc774e | 2010-05-14 14:45:08 +1000 | [diff] [blame] | 479 | #ifdef CONFIG_ARCH_OMAP2 |
Dmitry Kasatkin | ee5500c | 2010-05-03 11:10:03 +0800 | [diff] [blame] | 480 | static struct resource omap2_sham_resources[] = { |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 481 | { |
| 482 | .start = OMAP24XX_SEC_SHA1MD5_BASE, |
| 483 | .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64, |
| 484 | .flags = IORESOURCE_MEM, |
| 485 | }, |
| 486 | { |
| 487 | .start = INT_24XX_SHA1MD5, |
| 488 | .flags = IORESOURCE_IRQ, |
| 489 | } |
| 490 | }; |
Dmitry Kasatkin | ee5500c | 2010-05-03 11:10:03 +0800 | [diff] [blame] | 491 | static int omap2_sham_resources_sz = ARRAY_SIZE(omap2_sham_resources); |
| 492 | #else |
| 493 | #define omap2_sham_resources NULL |
| 494 | #define omap2_sham_resources_sz 0 |
| 495 | #endif |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 496 | |
Dmitry Kasatkin | edc774e | 2010-05-14 14:45:08 +1000 | [diff] [blame] | 497 | #ifdef CONFIG_ARCH_OMAP3 |
Dmitry Kasatkin | ee5500c | 2010-05-03 11:10:03 +0800 | [diff] [blame] | 498 | static struct resource omap3_sham_resources[] = { |
| 499 | { |
| 500 | .start = OMAP34XX_SEC_SHA1MD5_BASE, |
| 501 | .end = OMAP34XX_SEC_SHA1MD5_BASE + 0x64, |
| 502 | .flags = IORESOURCE_MEM, |
| 503 | }, |
| 504 | { |
| 505 | .start = INT_34XX_SHA1MD52_IRQ, |
| 506 | .flags = IORESOURCE_IRQ, |
| 507 | }, |
| 508 | { |
| 509 | .start = OMAP34XX_DMA_SHA1MD5_RX, |
| 510 | .flags = IORESOURCE_DMA, |
| 511 | } |
| 512 | }; |
| 513 | static int omap3_sham_resources_sz = ARRAY_SIZE(omap3_sham_resources); |
| 514 | #else |
| 515 | #define omap3_sham_resources NULL |
| 516 | #define omap3_sham_resources_sz 0 |
| 517 | #endif |
| 518 | |
| 519 | static struct platform_device sham_device = { |
| 520 | .name = "omap-sham", |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 521 | .id = -1, |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 522 | }; |
| 523 | |
Dmitry Kasatkin | ee5500c | 2010-05-03 11:10:03 +0800 | [diff] [blame] | 524 | static void omap_init_sham(void) |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 525 | { |
Dmitry Kasatkin | ee5500c | 2010-05-03 11:10:03 +0800 | [diff] [blame] | 526 | if (cpu_is_omap24xx()) { |
| 527 | sham_device.resource = omap2_sham_resources; |
| 528 | sham_device.num_resources = omap2_sham_resources_sz; |
| 529 | } else if (cpu_is_omap34xx()) { |
| 530 | sham_device.resource = omap3_sham_resources; |
| 531 | sham_device.num_resources = omap3_sham_resources_sz; |
| 532 | } else { |
| 533 | pr_err("%s: platform not supported\n", __func__); |
| 534 | return; |
| 535 | } |
| 536 | platform_device_register(&sham_device); |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 537 | } |
| 538 | #else |
Dmitry Kasatkin | ee5500c | 2010-05-03 11:10:03 +0800 | [diff] [blame] | 539 | static inline void omap_init_sham(void) { } |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 540 | #endif |
| 541 | |
Dmitry Kasatkin | b744c67 | 2010-09-03 19:13:55 +0800 | [diff] [blame] | 542 | #if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE) |
| 543 | |
Dmitry Kasatkin | 82a0c14 | 2010-08-20 13:44:46 +0000 | [diff] [blame] | 544 | #ifdef CONFIG_ARCH_OMAP2 |
Dmitry Kasatkin | b744c67 | 2010-09-03 19:13:55 +0800 | [diff] [blame] | 545 | static struct resource omap2_aes_resources[] = { |
| 546 | { |
| 547 | .start = OMAP24XX_SEC_AES_BASE, |
| 548 | .end = OMAP24XX_SEC_AES_BASE + 0x4C, |
| 549 | .flags = IORESOURCE_MEM, |
| 550 | }, |
| 551 | { |
| 552 | .start = OMAP24XX_DMA_AES_TX, |
| 553 | .flags = IORESOURCE_DMA, |
| 554 | }, |
| 555 | { |
| 556 | .start = OMAP24XX_DMA_AES_RX, |
| 557 | .flags = IORESOURCE_DMA, |
| 558 | } |
| 559 | }; |
| 560 | static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources); |
| 561 | #else |
| 562 | #define omap2_aes_resources NULL |
| 563 | #define omap2_aes_resources_sz 0 |
| 564 | #endif |
| 565 | |
Dmitry Kasatkin | 82a0c14 | 2010-08-20 13:44:46 +0000 | [diff] [blame] | 566 | #ifdef CONFIG_ARCH_OMAP3 |
Dmitry Kasatkin | b744c67 | 2010-09-03 19:13:55 +0800 | [diff] [blame] | 567 | static struct resource omap3_aes_resources[] = { |
| 568 | { |
| 569 | .start = OMAP34XX_SEC_AES_BASE, |
| 570 | .end = OMAP34XX_SEC_AES_BASE + 0x4C, |
| 571 | .flags = IORESOURCE_MEM, |
| 572 | }, |
| 573 | { |
| 574 | .start = OMAP34XX_DMA_AES2_TX, |
| 575 | .flags = IORESOURCE_DMA, |
| 576 | }, |
| 577 | { |
| 578 | .start = OMAP34XX_DMA_AES2_RX, |
| 579 | .flags = IORESOURCE_DMA, |
| 580 | } |
| 581 | }; |
| 582 | static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources); |
| 583 | #else |
| 584 | #define omap3_aes_resources NULL |
| 585 | #define omap3_aes_resources_sz 0 |
| 586 | #endif |
| 587 | |
| 588 | static struct platform_device aes_device = { |
| 589 | .name = "omap-aes", |
| 590 | .id = -1, |
| 591 | }; |
| 592 | |
| 593 | static void omap_init_aes(void) |
| 594 | { |
| 595 | if (cpu_is_omap24xx()) { |
| 596 | aes_device.resource = omap2_aes_resources; |
| 597 | aes_device.num_resources = omap2_aes_resources_sz; |
| 598 | } else if (cpu_is_omap34xx()) { |
| 599 | aes_device.resource = omap3_aes_resources; |
| 600 | aes_device.num_resources = omap3_aes_resources_sz; |
| 601 | } else { |
| 602 | pr_err("%s: platform not supported\n", __func__); |
| 603 | return; |
| 604 | } |
| 605 | platform_device_register(&aes_device); |
| 606 | } |
| 607 | |
| 608 | #else |
| 609 | static inline void omap_init_aes(void) { } |
| 610 | #endif |
| 611 | |
Tony Lindgren | d887466 | 2008-12-10 17:37:16 -0800 | [diff] [blame] | 612 | /*-------------------------------------------------------------------------*/ |
| 613 | |
kishore kadiyala | 82cf818 | 2009-09-22 16:45:25 -0700 | [diff] [blame] | 614 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) |
Kevin Hilman | 917fa28 | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 615 | |
| 616 | #define MMCHS_SYSCONFIG 0x0010 |
| 617 | #define MMCHS_SYSCONFIG_SWRESET (1 << 1) |
| 618 | #define MMCHS_SYSSTATUS 0x0014 |
| 619 | #define MMCHS_SYSSTATUS_RESETDONE (1 << 0) |
| 620 | |
| 621 | static struct platform_device dummy_pdev = { |
| 622 | .dev = { |
| 623 | .bus = &platform_bus_type, |
| 624 | }, |
| 625 | }; |
| 626 | |
| 627 | /** |
| 628 | * omap_hsmmc_reset() - Full reset of each HS-MMC controller |
| 629 | * |
| 630 | * Ensure that each MMC controller is fully reset. Controllers |
| 631 | * left in an unknown state (by bootloader) may prevent retention |
| 632 | * or OFF-mode. This is especially important in cases where the |
| 633 | * MMC driver is not enabled, _or_ built as a module. |
| 634 | * |
| 635 | * In order for reset to work, interface, functional and debounce |
| 636 | * clocks must be enabled. The debounce clock comes from func_32k_clk |
| 637 | * and is not under SW control, so we only enable i- and f-clocks. |
| 638 | **/ |
| 639 | static void __init omap_hsmmc_reset(void) |
| 640 | { |
Tony Lindgren | 4323e9f | 2010-02-12 12:26:48 -0800 | [diff] [blame] | 641 | u32 i, nr_controllers; |
Aaro Koskinen | 434c23a | 2010-12-20 18:48:15 -0800 | [diff] [blame] | 642 | struct clk *iclk, *fclk; |
Tony Lindgren | 4323e9f | 2010-02-12 12:26:48 -0800 | [diff] [blame] | 643 | |
| 644 | if (cpu_is_omap242x()) |
| 645 | return; |
| 646 | |
| 647 | nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC : |
kishore kadiyala | 82cf818 | 2009-09-22 16:45:25 -0700 | [diff] [blame] | 648 | (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC); |
Kevin Hilman | 917fa28 | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 649 | |
| 650 | for (i = 0; i < nr_controllers; i++) { |
| 651 | u32 v, base = 0; |
Kevin Hilman | 917fa28 | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 652 | struct device *dev = &dummy_pdev.dev; |
| 653 | |
| 654 | switch (i) { |
| 655 | case 0: |
| 656 | base = OMAP2_MMC1_BASE; |
| 657 | break; |
| 658 | case 1: |
| 659 | base = OMAP2_MMC2_BASE; |
| 660 | break; |
| 661 | case 2: |
| 662 | base = OMAP3_MMC3_BASE; |
| 663 | break; |
kishore kadiyala | 82cf818 | 2009-09-22 16:45:25 -0700 | [diff] [blame] | 664 | case 3: |
| 665 | if (!cpu_is_omap44xx()) |
| 666 | return; |
| 667 | base = OMAP4_MMC4_BASE; |
| 668 | break; |
| 669 | case 4: |
| 670 | if (!cpu_is_omap44xx()) |
| 671 | return; |
| 672 | base = OMAP4_MMC5_BASE; |
| 673 | break; |
Kevin Hilman | 917fa28 | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 674 | } |
| 675 | |
kishore kadiyala | 82cf818 | 2009-09-22 16:45:25 -0700 | [diff] [blame] | 676 | if (cpu_is_omap44xx()) |
| 677 | base += OMAP4_MMC_REG_OFFSET; |
| 678 | |
Kevin Hilman | 917fa28 | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 679 | dummy_pdev.id = i; |
Russell King | 1e98ffa | 2009-01-19 18:56:17 +0000 | [diff] [blame] | 680 | dev_set_name(&dummy_pdev.dev, "mmci-omap-hs.%d", i); |
Russell King | 6f7607c | 2009-01-28 10:22:50 +0000 | [diff] [blame] | 681 | iclk = clk_get(dev, "ick"); |
Aaro Koskinen | 434c23a | 2010-12-20 18:48:15 -0800 | [diff] [blame] | 682 | if (IS_ERR(iclk)) |
| 683 | goto err1; |
| 684 | if (clk_enable(iclk)) |
| 685 | goto err2; |
Kevin Hilman | 917fa28 | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 686 | |
Russell King | 6f7607c | 2009-01-28 10:22:50 +0000 | [diff] [blame] | 687 | fclk = clk_get(dev, "fck"); |
Aaro Koskinen | 434c23a | 2010-12-20 18:48:15 -0800 | [diff] [blame] | 688 | if (IS_ERR(fclk)) |
| 689 | goto err3; |
| 690 | if (clk_enable(fclk)) |
| 691 | goto err4; |
Kevin Hilman | 917fa28 | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 692 | |
| 693 | omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG); |
| 694 | v = omap_readl(base + MMCHS_SYSSTATUS); |
| 695 | while (!(omap_readl(base + MMCHS_SYSSTATUS) & |
| 696 | MMCHS_SYSSTATUS_RESETDONE)) |
| 697 | cpu_relax(); |
| 698 | |
Aaro Koskinen | 434c23a | 2010-12-20 18:48:15 -0800 | [diff] [blame] | 699 | clk_disable(fclk); |
| 700 | clk_put(fclk); |
| 701 | clk_disable(iclk); |
| 702 | clk_put(iclk); |
Kevin Hilman | 917fa28 | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 703 | } |
Aaro Koskinen | 434c23a | 2010-12-20 18:48:15 -0800 | [diff] [blame] | 704 | return; |
| 705 | |
| 706 | err4: |
| 707 | clk_put(fclk); |
| 708 | err3: |
| 709 | clk_disable(iclk); |
| 710 | err2: |
| 711 | clk_put(iclk); |
| 712 | err1: |
| 713 | printk(KERN_WARNING "%s: Unable to enable clocks for MMC%d, " |
| 714 | "cannot reset.\n", __func__, i); |
Kevin Hilman | 917fa28 | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 715 | } |
| 716 | #else |
| 717 | static inline void omap_hsmmc_reset(void) {} |
| 718 | #endif |
| 719 | |
Tony Lindgren | d887466 | 2008-12-10 17:37:16 -0800 | [diff] [blame] | 720 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \ |
| 721 | defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE) |
| 722 | |
| 723 | static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller, |
| 724 | int controller_nr) |
| 725 | { |
stanley.miao | ed8303fc | 2010-05-13 12:39:30 +0000 | [diff] [blame] | 726 | if ((mmc_controller->slots[0].switch_pin > 0) && \ |
| 727 | (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES)) |
| 728 | omap_mux_init_gpio(mmc_controller->slots[0].switch_pin, |
| 729 | OMAP_PIN_INPUT_PULLUP); |
| 730 | if ((mmc_controller->slots[0].gpio_wp > 0) && \ |
| 731 | (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES)) |
| 732 | omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp, |
| 733 | OMAP_PIN_INPUT_PULLUP); |
| 734 | |
Tony Lindgren | d887466 | 2008-12-10 17:37:16 -0800 | [diff] [blame] | 735 | if (cpu_is_omap2420() && controller_nr == 0) { |
Tony Lindgren | f99bf16 | 2010-07-05 16:31:40 +0300 | [diff] [blame] | 736 | omap_mux_init_signal("sdmmc_cmd", 0); |
| 737 | omap_mux_init_signal("sdmmc_clki", 0); |
| 738 | omap_mux_init_signal("sdmmc_clko", 0); |
| 739 | omap_mux_init_signal("sdmmc_dat0", 0); |
| 740 | omap_mux_init_signal("sdmmc_dat_dir0", 0); |
| 741 | omap_mux_init_signal("sdmmc_cmd_dir", 0); |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 742 | if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) { |
Tony Lindgren | f99bf16 | 2010-07-05 16:31:40 +0300 | [diff] [blame] | 743 | omap_mux_init_signal("sdmmc_dat1", 0); |
| 744 | omap_mux_init_signal("sdmmc_dat2", 0); |
| 745 | omap_mux_init_signal("sdmmc_dat3", 0); |
| 746 | omap_mux_init_signal("sdmmc_dat_dir1", 0); |
| 747 | omap_mux_init_signal("sdmmc_dat_dir2", 0); |
| 748 | omap_mux_init_signal("sdmmc_dat_dir3", 0); |
Tony Lindgren | d887466 | 2008-12-10 17:37:16 -0800 | [diff] [blame] | 749 | } |
| 750 | |
| 751 | /* |
| 752 | * Use internal loop-back in MMC/SDIO Module Input Clock |
| 753 | * selection |
| 754 | */ |
| 755 | if (mmc_controller->slots[0].internal_clock) { |
| 756 | u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); |
| 757 | v |= (1 << 24); |
| 758 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); |
| 759 | } |
| 760 | } |
Vikram Pandita | 57b9daa | 2009-08-28 11:24:11 -0700 | [diff] [blame] | 761 | |
Madhu | 4596d14 | 2009-11-22 10:11:06 -0800 | [diff] [blame] | 762 | if (cpu_is_omap34xx()) { |
Vikram Pandita | 57b9daa | 2009-08-28 11:24:11 -0700 | [diff] [blame] | 763 | if (controller_nr == 0) { |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 764 | omap_mux_init_signal("sdmmc1_clk", |
| 765 | OMAP_PIN_INPUT_PULLUP); |
| 766 | omap_mux_init_signal("sdmmc1_cmd", |
| 767 | OMAP_PIN_INPUT_PULLUP); |
| 768 | omap_mux_init_signal("sdmmc1_dat0", |
| 769 | OMAP_PIN_INPUT_PULLUP); |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 770 | if (mmc_controller->slots[0].caps & |
| 771 | (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) { |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 772 | omap_mux_init_signal("sdmmc1_dat1", |
| 773 | OMAP_PIN_INPUT_PULLUP); |
| 774 | omap_mux_init_signal("sdmmc1_dat2", |
| 775 | OMAP_PIN_INPUT_PULLUP); |
| 776 | omap_mux_init_signal("sdmmc1_dat3", |
| 777 | OMAP_PIN_INPUT_PULLUP); |
Vikram Pandita | 57b9daa | 2009-08-28 11:24:11 -0700 | [diff] [blame] | 778 | } |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 779 | if (mmc_controller->slots[0].caps & |
| 780 | MMC_CAP_8_BIT_DATA) { |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 781 | omap_mux_init_signal("sdmmc1_dat4", |
| 782 | OMAP_PIN_INPUT_PULLUP); |
| 783 | omap_mux_init_signal("sdmmc1_dat5", |
| 784 | OMAP_PIN_INPUT_PULLUP); |
| 785 | omap_mux_init_signal("sdmmc1_dat6", |
| 786 | OMAP_PIN_INPUT_PULLUP); |
| 787 | omap_mux_init_signal("sdmmc1_dat7", |
| 788 | OMAP_PIN_INPUT_PULLUP); |
Vikram Pandita | 57b9daa | 2009-08-28 11:24:11 -0700 | [diff] [blame] | 789 | } |
| 790 | } |
| 791 | if (controller_nr == 1) { |
| 792 | /* MMC2 */ |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 793 | omap_mux_init_signal("sdmmc2_clk", |
| 794 | OMAP_PIN_INPUT_PULLUP); |
| 795 | omap_mux_init_signal("sdmmc2_cmd", |
| 796 | OMAP_PIN_INPUT_PULLUP); |
| 797 | omap_mux_init_signal("sdmmc2_dat0", |
| 798 | OMAP_PIN_INPUT_PULLUP); |
Vikram Pandita | 57b9daa | 2009-08-28 11:24:11 -0700 | [diff] [blame] | 799 | |
| 800 | /* |
| 801 | * For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed |
| 802 | * in the board-*.c files |
| 803 | */ |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 804 | if (mmc_controller->slots[0].caps & |
| 805 | (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) { |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 806 | omap_mux_init_signal("sdmmc2_dat1", |
| 807 | OMAP_PIN_INPUT_PULLUP); |
| 808 | omap_mux_init_signal("sdmmc2_dat2", |
| 809 | OMAP_PIN_INPUT_PULLUP); |
| 810 | omap_mux_init_signal("sdmmc2_dat3", |
| 811 | OMAP_PIN_INPUT_PULLUP); |
Vikram Pandita | 57b9daa | 2009-08-28 11:24:11 -0700 | [diff] [blame] | 812 | } |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 813 | if (mmc_controller->slots[0].caps & |
| 814 | MMC_CAP_8_BIT_DATA) { |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 815 | omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4", |
| 816 | OMAP_PIN_INPUT_PULLUP); |
| 817 | omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5", |
| 818 | OMAP_PIN_INPUT_PULLUP); |
| 819 | omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6", |
| 820 | OMAP_PIN_INPUT_PULLUP); |
| 821 | omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7", |
| 822 | OMAP_PIN_INPUT_PULLUP); |
Madhu | 4679232 | 2009-11-22 10:11:08 -0800 | [diff] [blame] | 823 | } |
Vikram Pandita | 57b9daa | 2009-08-28 11:24:11 -0700 | [diff] [blame] | 824 | } |
| 825 | |
| 826 | /* |
| 827 | * For MMC3 the pins need to be muxed in the board-*.c files |
| 828 | */ |
| 829 | } |
Tony Lindgren | d887466 | 2008-12-10 17:37:16 -0800 | [diff] [blame] | 830 | } |
| 831 | |
| 832 | void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data, |
| 833 | int nr_controllers) |
| 834 | { |
| 835 | int i; |
Tony Lindgren | 0dffb5c | 2009-01-29 08:57:16 -0800 | [diff] [blame] | 836 | char *name; |
Tony Lindgren | d887466 | 2008-12-10 17:37:16 -0800 | [diff] [blame] | 837 | |
| 838 | for (i = 0; i < nr_controllers; i++) { |
| 839 | unsigned long base, size; |
| 840 | unsigned int irq = 0; |
| 841 | |
| 842 | if (!mmc_data[i]) |
| 843 | continue; |
| 844 | |
| 845 | omap2_mmc_mux(mmc_data[i], i); |
| 846 | |
| 847 | switch (i) { |
| 848 | case 0: |
| 849 | base = OMAP2_MMC1_BASE; |
| 850 | irq = INT_24XX_MMC_IRQ; |
| 851 | break; |
| 852 | case 1: |
| 853 | base = OMAP2_MMC2_BASE; |
| 854 | irq = INT_24XX_MMC2_IRQ; |
| 855 | break; |
| 856 | case 2: |
kishore kadiyala | 82cf818 | 2009-09-22 16:45:25 -0700 | [diff] [blame] | 857 | if (!cpu_is_omap44xx() && !cpu_is_omap34xx()) |
Tony Lindgren | d887466 | 2008-12-10 17:37:16 -0800 | [diff] [blame] | 858 | return; |
| 859 | base = OMAP3_MMC3_BASE; |
| 860 | irq = INT_34XX_MMC3_IRQ; |
| 861 | break; |
kishore kadiyala | 82cf818 | 2009-09-22 16:45:25 -0700 | [diff] [blame] | 862 | case 3: |
| 863 | if (!cpu_is_omap44xx()) |
| 864 | return; |
kishore kadiyala | 91a0b08 | 2010-10-01 16:35:28 -0700 | [diff] [blame] | 865 | base = OMAP4_MMC4_BASE; |
Santosh Shilimkar | 5772ca7 | 2010-02-18 03:14:12 +0530 | [diff] [blame] | 866 | irq = OMAP44XX_IRQ_MMC4; |
kishore kadiyala | 82cf818 | 2009-09-22 16:45:25 -0700 | [diff] [blame] | 867 | break; |
| 868 | case 4: |
| 869 | if (!cpu_is_omap44xx()) |
| 870 | return; |
kishore kadiyala | 91a0b08 | 2010-10-01 16:35:28 -0700 | [diff] [blame] | 871 | base = OMAP4_MMC5_BASE; |
kishore kadiyala | 9df76b7 | 2010-04-21 18:19:37 +0000 | [diff] [blame] | 872 | irq = OMAP44XX_IRQ_MMC5; |
kishore kadiyala | 82cf818 | 2009-09-22 16:45:25 -0700 | [diff] [blame] | 873 | break; |
Tony Lindgren | d887466 | 2008-12-10 17:37:16 -0800 | [diff] [blame] | 874 | default: |
| 875 | continue; |
| 876 | } |
| 877 | |
Tony Lindgren | 0dffb5c | 2009-01-29 08:57:16 -0800 | [diff] [blame] | 878 | if (cpu_is_omap2420()) { |
Tony Lindgren | d887466 | 2008-12-10 17:37:16 -0800 | [diff] [blame] | 879 | size = OMAP2420_MMC_SIZE; |
Tony Lindgren | 0dffb5c | 2009-01-29 08:57:16 -0800 | [diff] [blame] | 880 | name = "mmci-omap"; |
kishore kadiyala | 82cf818 | 2009-09-22 16:45:25 -0700 | [diff] [blame] | 881 | } else if (cpu_is_omap44xx()) { |
kishore kadiyala | 91a0b08 | 2010-10-01 16:35:28 -0700 | [diff] [blame] | 882 | if (i < 3) |
Santosh Shilimkar | 5772ca7 | 2010-02-18 03:14:12 +0530 | [diff] [blame] | 883 | irq += OMAP44XX_IRQ_GIC_START; |
kishore kadiyala | 82cf818 | 2009-09-22 16:45:25 -0700 | [diff] [blame] | 884 | size = OMAP4_HSMMC_SIZE; |
| 885 | name = "mmci-omap-hs"; |
Tony Lindgren | 0dffb5c | 2009-01-29 08:57:16 -0800 | [diff] [blame] | 886 | } else { |
kishore kadiyala | 82cf818 | 2009-09-22 16:45:25 -0700 | [diff] [blame] | 887 | size = OMAP3_HSMMC_SIZE; |
Tony Lindgren | 0dffb5c | 2009-01-29 08:57:16 -0800 | [diff] [blame] | 888 | name = "mmci-omap-hs"; |
| 889 | } |
| 890 | omap_mmc_add(name, i, base, size, irq, mmc_data[i]); |
Tony Lindgren | d887466 | 2008-12-10 17:37:16 -0800 | [diff] [blame] | 891 | }; |
| 892 | } |
| 893 | |
| 894 | #endif |
| 895 | |
| 896 | /*-------------------------------------------------------------------------*/ |
| 897 | |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 898 | #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE) |
| 899 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430) |
| 900 | #define OMAP_HDQ_BASE 0x480B2000 |
| 901 | #endif |
| 902 | static struct resource omap_hdq_resources[] = { |
| 903 | { |
| 904 | .start = OMAP_HDQ_BASE, |
| 905 | .end = OMAP_HDQ_BASE + 0x1C, |
| 906 | .flags = IORESOURCE_MEM, |
| 907 | }, |
| 908 | { |
| 909 | .start = INT_24XX_HDQ_IRQ, |
| 910 | .flags = IORESOURCE_IRQ, |
| 911 | }, |
| 912 | }; |
| 913 | static struct platform_device omap_hdq_dev = { |
| 914 | .name = "omap_hdq", |
| 915 | .id = 0, |
| 916 | .dev = { |
| 917 | .platform_data = NULL, |
| 918 | }, |
| 919 | .num_resources = ARRAY_SIZE(omap_hdq_resources), |
| 920 | .resource = omap_hdq_resources, |
| 921 | }; |
| 922 | static inline void omap_hdq_init(void) |
| 923 | { |
| 924 | (void) platform_device_register(&omap_hdq_dev); |
| 925 | } |
| 926 | #else |
| 927 | static inline void omap_hdq_init(void) {} |
| 928 | #endif |
| 929 | |
Vaibhav Hiremath | b227358 | 2010-05-10 14:29:14 -0700 | [diff] [blame] | 930 | /*---------------------------------------------------------------------------*/ |
| 931 | |
| 932 | #if defined(CONFIG_VIDEO_OMAP2_VOUT) || \ |
| 933 | defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE) |
| 934 | #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) |
| 935 | static struct resource omap_vout_resource[3 - CONFIG_FB_OMAP2_NUM_FBS] = { |
| 936 | }; |
| 937 | #else |
| 938 | static struct resource omap_vout_resource[2] = { |
| 939 | }; |
| 940 | #endif |
| 941 | |
| 942 | static struct platform_device omap_vout_device = { |
| 943 | .name = "omap_vout", |
| 944 | .num_resources = ARRAY_SIZE(omap_vout_resource), |
| 945 | .resource = &omap_vout_resource[0], |
| 946 | .id = -1, |
| 947 | }; |
| 948 | static void omap_init_vout(void) |
| 949 | { |
| 950 | if (platform_device_register(&omap_vout_device) < 0) |
| 951 | printk(KERN_ERR "Unable to register OMAP-VOUT device\n"); |
| 952 | } |
| 953 | #else |
| 954 | static inline void omap_init_vout(void) {} |
| 955 | #endif |
| 956 | |
Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 957 | /*-------------------------------------------------------------------------*/ |
| 958 | |
Charulatha V | 20252d4 | 2010-10-08 10:23:06 -0700 | [diff] [blame] | 959 | static int omap2_disable_wdt(struct omap_hwmod *oh, void *unused) |
| 960 | { |
Paul Walmsley | 81fbc5ef | 2010-12-21 19:56:17 -0700 | [diff] [blame^] | 961 | return omap2_wd_timer_disable(oh); |
Charulatha V | 20252d4 | 2010-10-08 10:23:06 -0700 | [diff] [blame] | 962 | } |
| 963 | |
| 964 | static void __init omap_disable_wdt(void) |
| 965 | { |
| 966 | if (cpu_class_is_omap2()) |
| 967 | omap_hwmod_for_each_by_class("wd_timer", |
Paul Walmsley | 81fbc5ef | 2010-12-21 19:56:17 -0700 | [diff] [blame^] | 968 | omap2_disable_wdt, NULL); |
Charulatha V | 20252d4 | 2010-10-08 10:23:06 -0700 | [diff] [blame] | 969 | return; |
| 970 | } |
| 971 | |
Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 972 | static int __init omap2_init_devices(void) |
| 973 | { |
Paul Walmsley | 81fbc5ef | 2010-12-21 19:56:17 -0700 | [diff] [blame^] | 974 | /* |
| 975 | * please keep these calls, and their implementations above, |
Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 976 | * in alphabetical order so they're easier to sort through. |
| 977 | */ |
Charulatha V | 20252d4 | 2010-10-08 10:23:06 -0700 | [diff] [blame] | 978 | omap_disable_wdt(); |
Kevin Hilman | 917fa28 | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 979 | omap_hsmmc_reset(); |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 980 | omap_init_audio(); |
Tony Lindgren | 828c707 | 2009-03-23 18:23:49 -0700 | [diff] [blame] | 981 | omap_init_camera(); |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 982 | omap_init_mbox(); |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 983 | omap_init_mcspi(); |
Will Deacon | 8834133 | 2010-04-09 13:54:43 +0100 | [diff] [blame] | 984 | omap_init_pmu(); |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 985 | omap_hdq_init(); |
Tony Lindgren | 9b6553c | 2006-04-02 17:46:30 +0100 | [diff] [blame] | 986 | omap_init_sti(); |
Dmitry Kasatkin | ee5500c | 2010-05-03 11:10:03 +0800 | [diff] [blame] | 987 | omap_init_sham(); |
Dmitry Kasatkin | b744c67 | 2010-09-03 19:13:55 +0800 | [diff] [blame] | 988 | omap_init_aes(); |
Vaibhav Hiremath | b227358 | 2010-05-10 14:29:14 -0700 | [diff] [blame] | 989 | omap_init_vout(); |
Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 990 | |
| 991 | return 0; |
| 992 | } |
| 993 | arch_initcall(omap2_init_devices); |
Varadarajan, Charulatha | f2ce623 | 2010-09-23 20:02:42 +0530 | [diff] [blame] | 994 | |
| 995 | #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE) |
| 996 | struct omap_device_pm_latency omap_wdt_latency[] = { |
| 997 | [0] = { |
| 998 | .deactivate_func = omap_device_idle_hwmods, |
| 999 | .activate_func = omap_device_enable_hwmods, |
| 1000 | .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, |
| 1001 | }, |
| 1002 | }; |
| 1003 | |
| 1004 | static int __init omap_init_wdt(void) |
| 1005 | { |
| 1006 | int id = -1; |
| 1007 | struct omap_device *od; |
| 1008 | struct omap_hwmod *oh; |
| 1009 | char *oh_name = "wd_timer2"; |
| 1010 | char *dev_name = "omap_wdt"; |
| 1011 | |
| 1012 | if (!cpu_class_is_omap2()) |
| 1013 | return 0; |
| 1014 | |
| 1015 | oh = omap_hwmod_lookup(oh_name); |
| 1016 | if (!oh) { |
| 1017 | pr_err("Could not look up wd_timer%d hwmod\n", id); |
| 1018 | return -EINVAL; |
| 1019 | } |
| 1020 | |
| 1021 | od = omap_device_build(dev_name, id, oh, NULL, 0, |
| 1022 | omap_wdt_latency, |
| 1023 | ARRAY_SIZE(omap_wdt_latency), 0); |
| 1024 | WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n", |
| 1025 | dev_name, oh->name); |
| 1026 | return 0; |
| 1027 | } |
| 1028 | subsys_initcall(omap_init_wdt); |
| 1029 | #endif |