diff options
Diffstat (limited to 'arch/arm/mach-omap2/devices.c')
-rw-r--r-- | arch/arm/mach-omap2/devices.c | 175 |
1 files changed, 0 insertions, 175 deletions
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 473951203104..93057fb65f44 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
@@ -36,130 +36,6 @@ | |||
36 | #define L3_MODULES_MAX_LEN 12 | 36 | #define L3_MODULES_MAX_LEN 12 |
37 | #define L3_MODULES 3 | 37 | #define L3_MODULES 3 |
38 | 38 | ||
39 | static int __init omap3_l3_init(void) | ||
40 | { | ||
41 | struct omap_hwmod *oh; | ||
42 | struct platform_device *pdev; | ||
43 | char oh_name[L3_MODULES_MAX_LEN]; | ||
44 | |||
45 | /* | ||
46 | * To avoid code running on other OMAPs in | ||
47 | * multi-omap builds | ||
48 | */ | ||
49 | if (!(cpu_is_omap34xx()) || of_have_populated_dt()) | ||
50 | return -ENODEV; | ||
51 | |||
52 | snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main"); | ||
53 | |||
54 | oh = omap_hwmod_lookup(oh_name); | ||
55 | |||
56 | if (!oh) | ||
57 | pr_err("could not look up %s\n", oh_name); | ||
58 | |||
59 | pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0); | ||
60 | |||
61 | WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); | ||
62 | |||
63 | return PTR_ERR_OR_ZERO(pdev); | ||
64 | } | ||
65 | omap_postcore_initcall(omap3_l3_init); | ||
66 | |||
67 | static inline void omap_init_sti(void) {} | ||
68 | |||
69 | #if IS_ENABLED(CONFIG_SPI_OMAP24XX) | ||
70 | |||
71 | #include <linux/platform_data/spi-omap2-mcspi.h> | ||
72 | |||
73 | static int __init omap_mcspi_init(struct omap_hwmod *oh, void *unused) | ||
74 | { | ||
75 | struct platform_device *pdev; | ||
76 | char *name = "omap2_mcspi"; | ||
77 | struct omap2_mcspi_platform_config *pdata; | ||
78 | static int spi_num; | ||
79 | struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr; | ||
80 | |||
81 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); | ||
82 | if (!pdata) { | ||
83 | pr_err("Memory allocation for McSPI device failed\n"); | ||
84 | return -ENOMEM; | ||
85 | } | ||
86 | |||
87 | pdata->num_cs = mcspi_attrib->num_chipselect; | ||
88 | switch (oh->class->rev) { | ||
89 | case OMAP2_MCSPI_REV: | ||
90 | case OMAP3_MCSPI_REV: | ||
91 | pdata->regs_offset = 0; | ||
92 | break; | ||
93 | case OMAP4_MCSPI_REV: | ||
94 | pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET; | ||
95 | break; | ||
96 | default: | ||
97 | pr_err("Invalid McSPI Revision value\n"); | ||
98 | kfree(pdata); | ||
99 | return -EINVAL; | ||
100 | } | ||
101 | |||
102 | spi_num++; | ||
103 | pdev = omap_device_build(name, spi_num, oh, pdata, sizeof(*pdata)); | ||
104 | WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n", | ||
105 | name, oh->name); | ||
106 | kfree(pdata); | ||
107 | return 0; | ||
108 | } | ||
109 | |||
110 | static void omap_init_mcspi(void) | ||
111 | { | ||
112 | omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL); | ||
113 | } | ||
114 | |||
115 | #else | ||
116 | static inline void omap_init_mcspi(void) {} | ||
117 | #endif | ||
118 | |||
119 | /** | ||
120 | * omap_init_rng - bind the RNG hwmod to the RNG omap_device | ||
121 | * | ||
122 | * Bind the RNG hwmod to the RNG omap_device. No return value. | ||
123 | */ | ||
124 | static void __init omap_init_rng(void) | ||
125 | { | ||
126 | struct omap_hwmod *oh; | ||
127 | struct platform_device *pdev; | ||
128 | |||
129 | oh = omap_hwmod_lookup("rng"); | ||
130 | if (!oh) | ||
131 | return; | ||
132 | |||
133 | pdev = omap_device_build("omap_rng", -1, oh, NULL, 0); | ||
134 | WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n"); | ||
135 | } | ||
136 | |||
137 | static void __init omap_init_sham(void) | ||
138 | { | ||
139 | struct omap_hwmod *oh; | ||
140 | struct platform_device *pdev; | ||
141 | |||
142 | oh = omap_hwmod_lookup("sham"); | ||
143 | if (!oh) | ||
144 | return; | ||
145 | |||
146 | pdev = omap_device_build("omap-sham", -1, oh, NULL, 0); | ||
147 | WARN(IS_ERR(pdev), "Can't build omap_device for omap-sham\n"); | ||
148 | } | ||
149 | |||
150 | static void __init omap_init_aes(void) | ||
151 | { | ||
152 | struct omap_hwmod *oh; | ||
153 | struct platform_device *pdev; | ||
154 | |||
155 | oh = omap_hwmod_lookup("aes"); | ||
156 | if (!oh) | ||
157 | return; | ||
158 | |||
159 | pdev = omap_device_build("omap-aes", -1, oh, NULL, 0); | ||
160 | WARN(IS_ERR(pdev), "Can't build omap_device for omap-aes\n"); | ||
161 | } | ||
162 | |||
163 | /*-------------------------------------------------------------------------*/ | 39 | /*-------------------------------------------------------------------------*/ |
164 | 40 | ||
165 | #if IS_ENABLED(CONFIG_VIDEO_OMAP2_VOUT) | 41 | #if IS_ENABLED(CONFIG_VIDEO_OMAP2_VOUT) |
@@ -185,54 +61,3 @@ int __init omap_init_vout(void) | |||
185 | #else | 61 | #else |
186 | int __init omap_init_vout(void) { return 0; } | 62 | int __init omap_init_vout(void) { return 0; } |
187 | #endif | 63 | #endif |
188 | |||
189 | /*-------------------------------------------------------------------------*/ | ||
190 | |||
191 | static int __init omap2_init_devices(void) | ||
192 | { | ||
193 | /* Enable dummy states for those platforms without pinctrl support */ | ||
194 | if (!of_have_populated_dt()) | ||
195 | pinctrl_provide_dummies(); | ||
196 | |||
197 | /* If dtb is there, the devices will be created dynamically */ | ||
198 | if (!of_have_populated_dt()) { | ||
199 | /* | ||
200 | * please keep these calls, and their implementations above, | ||
201 | * in alphabetical order so they're easier to sort through. | ||
202 | */ | ||
203 | omap_init_mcspi(); | ||
204 | omap_init_sham(); | ||
205 | omap_init_aes(); | ||
206 | omap_init_rng(); | ||
207 | } | ||
208 | omap_init_sti(); | ||
209 | |||
210 | return 0; | ||
211 | } | ||
212 | omap_arch_initcall(omap2_init_devices); | ||
213 | |||
214 | static int __init omap_gpmc_init(void) | ||
215 | { | ||
216 | struct omap_hwmod *oh; | ||
217 | struct platform_device *pdev; | ||
218 | char *oh_name = "gpmc"; | ||
219 | |||
220 | /* | ||
221 | * if the board boots up with a populated DT, do not | ||
222 | * manually add the device from this initcall | ||
223 | */ | ||
224 | if (of_have_populated_dt()) | ||
225 | return -ENODEV; | ||
226 | |||
227 | oh = omap_hwmod_lookup(oh_name); | ||
228 | if (!oh) { | ||
229 | pr_err("Could not look up %s\n", oh_name); | ||
230 | return -ENODEV; | ||
231 | } | ||
232 | |||
233 | pdev = omap_device_build("omap-gpmc", -1, oh, NULL, 0); | ||
234 | WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); | ||
235 | |||
236 | return PTR_ERR_OR_ZERO(pdev); | ||
237 | } | ||
238 | omap_postcore_initcall(omap_gpmc_init); | ||