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 | */ |
Russell King | 2f8163b | 2011-07-26 10:53:52 +0100 | [diff] [blame] | 11 | #include <linux/gpio.h> |
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> |
Charulatha V | 1a5d819 | 2011-02-02 17:52:14 +0530 | [diff] [blame] | 18 | #include <linux/slab.h> |
Benoit Cousson | ad8dfac | 2011-08-12 13:48:47 +0200 | [diff] [blame] | 19 | #include <linux/of.h> |
Matt Porter | 484202f | 2012-09-17 16:26:11 -0700 | [diff] [blame] | 20 | #include <linux/pinctrl/machine.h> |
Suman Anna | b8a7cf8 | 2013-01-28 17:21:58 -0600 | [diff] [blame] | 21 | #include <linux/platform_data/mailbox-omap.h> |
Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 22 | |
Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 23 | #include <asm/mach-types.h> |
| 24 | #include <asm/mach/map.h> |
| 25 | |
Tony Lindgren | 45c3eb7 | 2012-11-30 08:41:50 -0800 | [diff] [blame] | 26 | #include <linux/omap-dma.h> |
Tony Lindgren | 2a296c8 | 2012-10-02 17:41:35 -0700 | [diff] [blame] | 27 | |
Tony Lindgren | ee0839c | 2012-02-24 10:34:35 -0800 | [diff] [blame] | 28 | #include "iomap.h" |
Tony Lindgren | 2a296c8 | 2012-10-02 17:41:35 -0700 | [diff] [blame] | 29 | #include "omap_hwmod.h" |
Tony Lindgren | 25c7d49 | 2012-10-02 17:25:48 -0700 | [diff] [blame] | 30 | #include "omap_device.h" |
Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 31 | |
Tony Lindgren | 7d7e1eb | 2012-08-27 17:43:01 -0700 | [diff] [blame] | 32 | #include "soc.h" |
| 33 | #include "common.h" |
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" |
Laurent Pinchart | a11f670 | 2009-12-14 08:09:07 -0300 | [diff] [blame] | 36 | #include "devices.h" |
Archit Taneja | 576e5bd | 2013-09-16 12:48:31 +0530 | [diff] [blame] | 37 | #include "display.h" |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 38 | |
sricharan | 0abcf61 | 2011-02-08 14:10:45 +0530 | [diff] [blame] | 39 | #define L3_MODULES_MAX_LEN 12 |
sricharan | a4dc616 | 2011-03-09 16:00:29 +0530 | [diff] [blame] | 40 | #define L3_MODULES 3 |
sricharan | 0abcf61 | 2011-02-08 14:10:45 +0530 | [diff] [blame] | 41 | |
| 42 | static int __init omap3_l3_init(void) |
| 43 | { |
sricharan | 0abcf61 | 2011-02-08 14:10:45 +0530 | [diff] [blame] | 44 | struct omap_hwmod *oh; |
Kevin Hilman | 3528c58 | 2011-07-21 13:48:45 -0700 | [diff] [blame] | 45 | struct platform_device *pdev; |
sricharan | 0abcf61 | 2011-02-08 14:10:45 +0530 | [diff] [blame] | 46 | char oh_name[L3_MODULES_MAX_LEN]; |
| 47 | |
| 48 | /* |
| 49 | * To avoid code running on other OMAPs in |
| 50 | * multi-omap builds |
| 51 | */ |
Tony Lindgren | aa25729c | 2014-11-05 09:21:23 -0800 | [diff] [blame] | 52 | if (!(cpu_is_omap34xx()) || of_have_populated_dt()) |
sricharan | 0abcf61 | 2011-02-08 14:10:45 +0530 | [diff] [blame] | 53 | return -ENODEV; |
| 54 | |
Paul Walmsley | eeb3711 | 2012-04-13 06:34:32 -0600 | [diff] [blame] | 55 | snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main"); |
sricharan | 0abcf61 | 2011-02-08 14:10:45 +0530 | [diff] [blame] | 56 | |
| 57 | oh = omap_hwmod_lookup(oh_name); |
| 58 | |
| 59 | if (!oh) |
| 60 | pr_err("could not look up %s\n", oh_name); |
| 61 | |
Paul Walmsley | c1d1cd5 | 2013-01-26 00:48:53 -0700 | [diff] [blame] | 62 | pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0); |
sricharan | 0abcf61 | 2011-02-08 14:10:45 +0530 | [diff] [blame] | 63 | |
Kevin Hilman | 3528c58 | 2011-07-21 13:48:45 -0700 | [diff] [blame] | 64 | WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); |
sricharan | 0abcf61 | 2011-02-08 14:10:45 +0530 | [diff] [blame] | 65 | |
Nicholas Krause | e44be50 | 2015-05-20 15:32:26 -0400 | [diff] [blame] | 66 | return PTR_ERR_OR_ZERO(pdev); |
sricharan | 0abcf61 | 2011-02-08 14:10:45 +0530 | [diff] [blame] | 67 | } |
Tony Lindgren | b76c8b1 | 2013-01-11 11:24:18 -0800 | [diff] [blame] | 68 | omap_postcore_initcall(omap3_l3_init); |
sricharan | 0abcf61 | 2011-02-08 14:10:45 +0530 | [diff] [blame] | 69 | |
Ohad Ben-Cohen | 1a51a0c | 2012-01-11 15:28:11 +0200 | [diff] [blame] | 70 | #if defined(CONFIG_IOMMU_API) |
| 71 | |
Tony Lindgren | 2ab7c84 | 2012-11-02 12:24:14 -0700 | [diff] [blame] | 72 | #include <linux/platform_data/iommu-omap.h> |
Ohad Ben-Cohen | 1a51a0c | 2012-01-11 15:28:11 +0200 | [diff] [blame] | 73 | |
Tony Lindgren | 828c707 | 2009-03-23 18:23:49 -0700 | [diff] [blame] | 74 | static struct resource omap3isp_resources[] = { |
| 75 | { |
| 76 | .start = OMAP3430_ISP_BASE, |
Sakari Ailus | 8644cdf | 2015-03-25 19:57:35 -0300 | [diff] [blame] | 77 | .end = OMAP3430_ISP_BASE + 0x12fc, |
Tony Lindgren | 828c707 | 2009-03-23 18:23:49 -0700 | [diff] [blame] | 78 | .flags = IORESOURCE_MEM, |
| 79 | }, |
| 80 | { |
Sakari Ailus | 8644cdf | 2015-03-25 19:57:35 -0300 | [diff] [blame] | 81 | .start = OMAP3430_ISP_BASE2, |
| 82 | .end = OMAP3430_ISP_BASE2 + 0x0600, |
Tony Lindgren | 828c707 | 2009-03-23 18:23:49 -0700 | [diff] [blame] | 83 | .flags = IORESOURCE_MEM, |
| 84 | }, |
| 85 | { |
Tony Lindgren | 7d7e1eb | 2012-08-27 17:43:01 -0700 | [diff] [blame] | 86 | .start = 24 + OMAP_INTC_START, |
Tony Lindgren | 828c707 | 2009-03-23 18:23:49 -0700 | [diff] [blame] | 87 | .flags = IORESOURCE_IRQ, |
| 88 | } |
| 89 | }; |
| 90 | |
| 91 | static struct platform_device omap3isp_device = { |
| 92 | .name = "omap3isp", |
| 93 | .id = -1, |
| 94 | .num_resources = ARRAY_SIZE(omap3isp_resources), |
| 95 | .resource = omap3isp_resources, |
| 96 | }; |
| 97 | |
Ohad Ben-Cohen | c8eaab3 | 2011-09-23 16:44:57 +0300 | [diff] [blame] | 98 | static struct omap_iommu_arch_data omap3_isp_iommu = { |
Omar Ramirez Luna | 72b15b6 | 2012-11-19 19:05:50 -0600 | [diff] [blame] | 99 | .name = "mmu_isp", |
Ohad Ben-Cohen | c8eaab3 | 2011-09-23 16:44:57 +0300 | [diff] [blame] | 100 | }; |
| 101 | |
Laurent Pinchart | a11f670 | 2009-12-14 08:09:07 -0300 | [diff] [blame] | 102 | int omap3_init_camera(struct isp_platform_data *pdata) |
Tony Lindgren | 828c707 | 2009-03-23 18:23:49 -0700 | [diff] [blame] | 103 | { |
Suman Anna | 0ac4f03 | 2014-03-05 18:24:12 -0600 | [diff] [blame] | 104 | if (of_have_populated_dt()) |
| 105 | omap3_isp_iommu.name = "480bd400.mmu"; |
| 106 | |
Laurent Pinchart | a11f670 | 2009-12-14 08:09:07 -0300 | [diff] [blame] | 107 | omap3isp_device.dev.platform_data = pdata; |
Ohad Ben-Cohen | c8eaab3 | 2011-09-23 16:44:57 +0300 | [diff] [blame] | 108 | omap3isp_device.dev.archdata.iommu = &omap3_isp_iommu; |
| 109 | |
Laurent Pinchart | a11f670 | 2009-12-14 08:09:07 -0300 | [diff] [blame] | 110 | return platform_device_register(&omap3isp_device); |
Tony Lindgren | 828c707 | 2009-03-23 18:23:49 -0700 | [diff] [blame] | 111 | } |
Tony Lindgren | 828c707 | 2009-03-23 18:23:49 -0700 | [diff] [blame] | 112 | |
Ohad Ben-Cohen | 1a51a0c | 2012-01-11 15:28:11 +0200 | [diff] [blame] | 113 | #else /* !CONFIG_IOMMU_API */ |
| 114 | |
| 115 | int omap3_init_camera(struct isp_platform_data *pdata) |
| 116 | { |
| 117 | return 0; |
| 118 | } |
| 119 | |
| 120 | #endif |
| 121 | |
Suman Anna | c869c75 | 2013-03-12 17:55:29 -0500 | [diff] [blame] | 122 | #if defined(CONFIG_OMAP2PLUS_MBOX) || defined(CONFIG_OMAP2PLUS_MBOX_MODULE) |
Kevin Hilman | 9cf793f | 2012-02-20 09:43:30 -0800 | [diff] [blame] | 123 | static inline void __init omap_init_mbox(void) |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 124 | { |
Felipe Contreras | 69dbf85 | 2011-02-24 12:51:33 -0800 | [diff] [blame] | 125 | struct omap_hwmod *oh; |
Kevin Hilman | 3528c58 | 2011-07-21 13:48:45 -0700 | [diff] [blame] | 126 | struct platform_device *pdev; |
Suman Anna | b8a7cf8 | 2013-01-28 17:21:58 -0600 | [diff] [blame] | 127 | struct omap_mbox_pdata *pdata; |
Felipe Contreras | 69dbf85 | 2011-02-24 12:51:33 -0800 | [diff] [blame] | 128 | |
| 129 | oh = omap_hwmod_lookup("mailbox"); |
| 130 | if (!oh) { |
| 131 | pr_err("%s: unable to find hwmod\n", __func__); |
Hiroshi DOYU | 6c20a68 | 2009-03-23 18:07:23 -0700 | [diff] [blame] | 132 | return; |
| 133 | } |
Suman Anna | b8a7cf8 | 2013-01-28 17:21:58 -0600 | [diff] [blame] | 134 | if (!oh->dev_attr) { |
| 135 | pr_err("%s: hwmod doesn't have valid attrs\n", __func__); |
| 136 | return; |
| 137 | } |
Felipe Contreras | 69dbf85 | 2011-02-24 12:51:33 -0800 | [diff] [blame] | 138 | |
Suman Anna | b8a7cf8 | 2013-01-28 17:21:58 -0600 | [diff] [blame] | 139 | pdata = (struct omap_mbox_pdata *)oh->dev_attr; |
| 140 | pdev = omap_device_build("omap-mailbox", -1, oh, pdata, sizeof(*pdata)); |
Kevin Hilman | 3528c58 | 2011-07-21 13:48:45 -0700 | [diff] [blame] | 141 | WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n", |
| 142 | __func__, PTR_ERR(pdev)); |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 143 | } |
| 144 | #else |
| 145 | static inline void omap_init_mbox(void) { } |
Suman Anna | c869c75 | 2013-03-12 17:55:29 -0500 | [diff] [blame] | 146 | #endif /* CONFIG_OMAP2PLUS_MBOX */ |
Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 147 | |
Tony Lindgren | 9b6553c | 2006-04-02 17:46:30 +0100 | [diff] [blame] | 148 | static inline void omap_init_sti(void) {} |
Tony Lindgren | 9b6553c | 2006-04-02 17:46:30 +0100 | [diff] [blame] | 149 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 150 | #if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE) |
| 151 | |
| 152 | static struct platform_device omap_pcm = { |
| 153 | .name = "omap-pcm-audio", |
| 154 | .id = -1, |
| 155 | }; |
| 156 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 157 | static void omap_init_audio(void) |
| 158 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 159 | platform_device_register(&omap_pcm); |
| 160 | } |
| 161 | |
| 162 | #else |
| 163 | static inline void omap_init_audio(void) {} |
| 164 | #endif |
| 165 | |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 166 | #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE) |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 167 | |
Arnd Bergmann | 2203747 | 2012-08-24 15:21:06 +0200 | [diff] [blame] | 168 | #include <linux/platform_data/spi-omap2-mcspi.h> |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 169 | |
Kevin Hilman | 9cf793f | 2012-02-20 09:43:30 -0800 | [diff] [blame] | 170 | static int __init omap_mcspi_init(struct omap_hwmod *oh, void *unused) |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 171 | { |
Kevin Hilman | 3528c58 | 2011-07-21 13:48:45 -0700 | [diff] [blame] | 172 | struct platform_device *pdev; |
Charulatha V | 1a5d819 | 2011-02-02 17:52:14 +0530 | [diff] [blame] | 173 | char *name = "omap2_mcspi"; |
| 174 | struct omap2_mcspi_platform_config *pdata; |
| 175 | static int spi_num; |
| 176 | struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr; |
Tony Lindgren | af41a12 | 2009-09-24 16:23:05 -0700 | [diff] [blame] | 177 | |
Charulatha V | 1a5d819 | 2011-02-02 17:52:14 +0530 | [diff] [blame] | 178 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); |
| 179 | if (!pdata) { |
| 180 | pr_err("Memory allocation for McSPI device failed\n"); |
| 181 | return -ENOMEM; |
| 182 | } |
Tony Lindgren | af41a12 | 2009-09-24 16:23:05 -0700 | [diff] [blame] | 183 | |
Charulatha V | 1a5d819 | 2011-02-02 17:52:14 +0530 | [diff] [blame] | 184 | pdata->num_cs = mcspi_attrib->num_chipselect; |
| 185 | switch (oh->class->rev) { |
| 186 | case OMAP2_MCSPI_REV: |
| 187 | case OMAP3_MCSPI_REV: |
| 188 | pdata->regs_offset = 0; |
| 189 | break; |
| 190 | case OMAP4_MCSPI_REV: |
| 191 | pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET; |
| 192 | break; |
| 193 | default: |
| 194 | pr_err("Invalid McSPI Revision value\n"); |
Julia Lawall | e0feca89 | 2011-12-23 18:39:31 +0100 | [diff] [blame] | 195 | kfree(pdata); |
Charulatha V | 1a5d819 | 2011-02-02 17:52:14 +0530 | [diff] [blame] | 196 | return -EINVAL; |
| 197 | } |
| 198 | |
| 199 | spi_num++; |
Paul Walmsley | c1d1cd5 | 2013-01-26 00:48:53 -0700 | [diff] [blame] | 200 | pdev = omap_device_build(name, spi_num, oh, pdata, sizeof(*pdata)); |
Kevin Hilman | 3528c58 | 2011-07-21 13:48:45 -0700 | [diff] [blame] | 201 | WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n", |
Charulatha V | 1a5d819 | 2011-02-02 17:52:14 +0530 | [diff] [blame] | 202 | name, oh->name); |
| 203 | kfree(pdata); |
| 204 | return 0; |
Tony Lindgren | af41a12 | 2009-09-24 16:23:05 -0700 | [diff] [blame] | 205 | } |
Tony Lindgren | af41a12 | 2009-09-24 16:23:05 -0700 | [diff] [blame] | 206 | |
| 207 | static void omap_init_mcspi(void) |
| 208 | { |
Charulatha V | 1a5d819 | 2011-02-02 17:52:14 +0530 | [diff] [blame] | 209 | omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL); |
Juha Yrjola | ed7eb9d | 2006-06-26 16:16:10 -0700 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | #else |
| 213 | static inline void omap_init_mcspi(void) {} |
| 214 | #endif |
| 215 | |
Paul Walmsley | 4848d46 | 2012-09-23 17:28:27 -0600 | [diff] [blame] | 216 | /** |
| 217 | * omap_init_rng - bind the RNG hwmod to the RNG omap_device |
| 218 | * |
| 219 | * Bind the RNG hwmod to the RNG omap_device. No return value. |
| 220 | */ |
| 221 | static void omap_init_rng(void) |
| 222 | { |
| 223 | struct omap_hwmod *oh; |
| 224 | struct platform_device *pdev; |
| 225 | |
| 226 | oh = omap_hwmod_lookup("rng"); |
| 227 | if (!oh) |
| 228 | return; |
| 229 | |
Paul Walmsley | c1d1cd5 | 2013-01-26 00:48:53 -0700 | [diff] [blame] | 230 | pdev = omap_device_build("omap_rng", -1, oh, NULL, 0); |
Paul Walmsley | 4848d46 | 2012-09-23 17:28:27 -0600 | [diff] [blame] | 231 | WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n"); |
| 232 | } |
Will Deacon | 8834133 | 2010-04-09 13:54:43 +0100 | [diff] [blame] | 233 | |
Mark A. Greer | 26f88e6 | 2013-03-18 10:06:32 -0600 | [diff] [blame] | 234 | static void __init omap_init_sham(void) |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 235 | { |
Mark A. Greer | 8c7bb57 | 2013-03-18 10:06:33 -0600 | [diff] [blame] | 236 | struct omap_hwmod *oh; |
| 237 | struct platform_device *pdev; |
Mark A. Greer | e569e99 | 2013-03-30 15:49:19 -0600 | [diff] [blame] | 238 | |
Mark A. Greer | 8c7bb57 | 2013-03-18 10:06:33 -0600 | [diff] [blame] | 239 | oh = omap_hwmod_lookup("sham"); |
| 240 | if (!oh) |
| 241 | return; |
Mark A. Greer | e569e99 | 2013-03-30 15:49:19 -0600 | [diff] [blame] | 242 | |
Mark A. Greer | 8c7bb57 | 2013-03-18 10:06:33 -0600 | [diff] [blame] | 243 | pdev = omap_device_build("omap-sham", -1, oh, NULL, 0); |
| 244 | WARN(IS_ERR(pdev), "Can't build omap_device for omap-sham\n"); |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 245 | } |
Tony Lindgren | 646e3ed | 2008-10-06 15:49:36 +0300 | [diff] [blame] | 246 | |
Mark A. Greer | 14ae556 | 2012-12-21 09:28:10 -0700 | [diff] [blame] | 247 | static void __init omap_init_aes(void) |
Dmitry Kasatkin | b744c67 | 2010-09-03 19:13:55 +0800 | [diff] [blame] | 248 | { |
Mark A. Greer | 77e2fd8 | 2012-12-21 09:28:11 -0700 | [diff] [blame] | 249 | struct omap_hwmod *oh; |
| 250 | struct platform_device *pdev; |
Mark A. Greer | 660ffd6 | 2012-12-21 09:28:09 -0700 | [diff] [blame] | 251 | |
Mark A. Greer | 77e2fd8 | 2012-12-21 09:28:11 -0700 | [diff] [blame] | 252 | oh = omap_hwmod_lookup("aes"); |
| 253 | if (!oh) |
| 254 | return; |
Mark A. Greer | 660ffd6 | 2012-12-21 09:28:09 -0700 | [diff] [blame] | 255 | |
Mark A. Greer | 77e2fd8 | 2012-12-21 09:28:11 -0700 | [diff] [blame] | 256 | pdev = omap_device_build("omap-aes", -1, oh, NULL, 0); |
| 257 | WARN(IS_ERR(pdev), "Can't build omap_device for omap-aes\n"); |
Dmitry Kasatkin | b744c67 | 2010-09-03 19:13:55 +0800 | [diff] [blame] | 258 | } |
| 259 | |
Tony Lindgren | d887466 | 2008-12-10 17:37:16 -0800 | [diff] [blame] | 260 | /*-------------------------------------------------------------------------*/ |
| 261 | |
Vaibhav Hiremath | b227358 | 2010-05-10 14:29:14 -0700 | [diff] [blame] | 262 | #if defined(CONFIG_VIDEO_OMAP2_VOUT) || \ |
| 263 | defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE) |
| 264 | #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) |
| 265 | static struct resource omap_vout_resource[3 - CONFIG_FB_OMAP2_NUM_FBS] = { |
| 266 | }; |
| 267 | #else |
| 268 | static struct resource omap_vout_resource[2] = { |
| 269 | }; |
| 270 | #endif |
| 271 | |
| 272 | static struct platform_device omap_vout_device = { |
| 273 | .name = "omap_vout", |
| 274 | .num_resources = ARRAY_SIZE(omap_vout_resource), |
| 275 | .resource = &omap_vout_resource[0], |
| 276 | .id = -1, |
| 277 | }; |
Archit Taneja | 576e5bd | 2013-09-16 12:48:31 +0530 | [diff] [blame] | 278 | |
| 279 | int __init omap_init_vout(void) |
Vaibhav Hiremath | b227358 | 2010-05-10 14:29:14 -0700 | [diff] [blame] | 280 | { |
Archit Taneja | 576e5bd | 2013-09-16 12:48:31 +0530 | [diff] [blame] | 281 | return platform_device_register(&omap_vout_device); |
Vaibhav Hiremath | b227358 | 2010-05-10 14:29:14 -0700 | [diff] [blame] | 282 | } |
| 283 | #else |
Archit Taneja | 576e5bd | 2013-09-16 12:48:31 +0530 | [diff] [blame] | 284 | int __init omap_init_vout(void) { return 0; } |
Vaibhav Hiremath | b227358 | 2010-05-10 14:29:14 -0700 | [diff] [blame] | 285 | #endif |
| 286 | |
Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 287 | /*-------------------------------------------------------------------------*/ |
| 288 | |
| 289 | static int __init omap2_init_devices(void) |
| 290 | { |
Matt Porter | 484202f | 2012-09-17 16:26:11 -0700 | [diff] [blame] | 291 | /* Enable dummy states for those platforms without pinctrl support */ |
| 292 | if (!of_have_populated_dt()) |
| 293 | pinctrl_provide_dummies(); |
| 294 | |
Paul Walmsley | 81fbc5ef | 2010-12-21 19:56:17 -0700 | [diff] [blame] | 295 | /* |
| 296 | * please keep these calls, and their implementations above, |
Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 297 | * in alphabetical order so they're easier to sort through. |
| 298 | */ |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 299 | omap_init_audio(); |
Benoit Cousson | efcf1e5 | 2012-01-20 14:15:58 +0100 | [diff] [blame] | 300 | /* If dtb is there, the devices will be created dynamically */ |
Peter Ujfalusi | 259bd6c | 2012-05-02 15:23:18 +0300 | [diff] [blame] | 301 | if (!of_have_populated_dt()) { |
Suman Anna | dbd5f46 | 2014-07-11 16:44:40 -0500 | [diff] [blame] | 302 | omap_init_mbox(); |
Benoit Cousson | efcf1e5 | 2012-01-20 14:15:58 +0100 | [diff] [blame] | 303 | omap_init_mcspi(); |
Mark A. Greer | 114d7a8 | 2013-03-18 10:06:33 -0600 | [diff] [blame] | 304 | omap_init_sham(); |
Mark A. Greer | 53335ac | 2012-12-21 09:28:12 -0700 | [diff] [blame] | 305 | omap_init_aes(); |
Lokesh Vutla | 674ee08 | 2013-08-05 20:17:22 +0530 | [diff] [blame] | 306 | omap_init_rng(); |
Peter Ujfalusi | 259bd6c | 2012-05-02 15:23:18 +0300 | [diff] [blame] | 307 | } |
Tony Lindgren | 9b6553c | 2006-04-02 17:46:30 +0100 | [diff] [blame] | 308 | omap_init_sti(); |
Tony Lindgren | 1dbae81 | 2005-11-10 14:26:51 +0000 | [diff] [blame] | 309 | |
| 310 | return 0; |
| 311 | } |
Tony Lindgren | b76c8b1 | 2013-01-11 11:24:18 -0800 | [diff] [blame] | 312 | omap_arch_initcall(omap2_init_devices); |
Tony Lindgren | a861280 | 2014-11-20 12:45:43 -0800 | [diff] [blame] | 313 | |
| 314 | static int __init omap_gpmc_init(void) |
| 315 | { |
| 316 | struct omap_hwmod *oh; |
| 317 | struct platform_device *pdev; |
| 318 | char *oh_name = "gpmc"; |
| 319 | |
| 320 | /* |
| 321 | * if the board boots up with a populated DT, do not |
| 322 | * manually add the device from this initcall |
| 323 | */ |
| 324 | if (of_have_populated_dt()) |
| 325 | return -ENODEV; |
| 326 | |
| 327 | oh = omap_hwmod_lookup(oh_name); |
| 328 | if (!oh) { |
| 329 | pr_err("Could not look up %s\n", oh_name); |
| 330 | return -ENODEV; |
| 331 | } |
| 332 | |
| 333 | pdev = omap_device_build("omap-gpmc", -1, oh, NULL, 0); |
| 334 | WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); |
| 335 | |
Nicholas Krause | e44be50 | 2015-05-20 15:32:26 -0400 | [diff] [blame] | 336 | return PTR_ERR_OR_ZERO(pdev); |
Tony Lindgren | a861280 | 2014-11-20 12:45:43 -0800 | [diff] [blame] | 337 | } |
| 338 | omap_postcore_initcall(omap_gpmc_init); |