12 #include <linux/kernel.h>
18 #include <linux/slab.h>
39 #define L3_MODULES_MAX_LEN 12
42 static int __init omap3_l3_init(
void)
60 pr_err(
"could not look up %s\n", oh_name);
65 WARN(IS_ERR(pdev),
"could not build omap_device for %s\n", oh_name);
67 return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
71 static int __init omap4_l3_init(
void)
79 if (of_have_populated_dt())
94 pr_err(
"could not look up %s\n", oh_name);
100 WARN(IS_ERR(pdev),
"could not build omap_device for %s\n", oh_name);
102 return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
106 #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
108 static struct resource omap2cam_resources[] = {
121 .
name =
"omap24xxcam",
123 .num_resources =
ARRAY_SIZE(omap2cam_resources),
124 .resource = omap2cam_resources,
128 #if defined(CONFIG_IOMMU_API)
132 static struct resource omap3isp_resources[] = {
212 .num_resources =
ARRAY_SIZE(omap3isp_resources),
213 .resource = omap3isp_resources,
222 omap3isp_device.
dev.platform_data =
pdata;
223 omap3isp_device.
dev.archdata.iommu = &omap3_isp_iommu;
237 static inline void omap_init_camera(
void)
239 #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
251 unsigned int id = -1;
252 char *oh_name =
"kbd";
253 char *
name =
"omap4-keypad";
257 pr_err(
"Could not look up %s\n", oh_name);
261 keypad_data = sdp4430_keypad_data;
267 WARN(1,
"Can't build omap_device for %s:%s.\n",
269 return PTR_ERR(pdev);
276 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
277 static inline void __init omap_init_mbox(
void)
284 pr_err(
"%s: unable to find hwmod\n", __func__);
289 WARN(IS_ERR(pdev),
"%s: could not build device, err %ld\n",
290 __func__, PTR_ERR(pdev));
293 static inline void omap_init_mbox(
void) { }
296 static inline void omap_init_sti(
void) {}
298 #if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
301 .
name =
"omap-pcm-audio",
305 static void omap_init_audio(
void)
311 static inline void omap_init_audio(
void) {}
314 #if defined(CONFIG_SND_OMAP_SOC_MCPDM) || \
315 defined(CONFIG_SND_OMAP_SOC_MCPDM_MODULE)
317 static void __init omap_init_mcpdm(
void)
329 WARN(IS_ERR(pdev),
"Can't build omap_device for omap-mcpdm.\n");
332 static inline void omap_init_mcpdm(
void) {}
335 #if defined(CONFIG_SND_OMAP_SOC_DMIC) || \
336 defined(CONFIG_SND_OMAP_SOC_DMIC_MODULE)
338 static void __init omap_init_dmic(
void)
345 pr_err(
"Could not look up dmic hw_mod\n");
350 WARN(IS_ERR(pdev),
"Can't build omap_device for omap-dmic.\n");
353 static inline void omap_init_dmic(
void) {}
356 #if defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI) || \
357 defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI_MODULE)
360 .
name =
"omap-hdmi-audio",
364 static void __init omap_init_hdmi_audio(
void)
378 "Can't build omap_device for omap-hdmi-audio-dai.\n");
383 static inline void omap_init_hdmi_audio(
void) {}
386 #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
393 char *
name =
"omap2_mcspi";
400 pr_err(
"Memory allocation for McSPI device failed\n");
405 switch (oh->
class->rev) {
414 pr_err(
"Invalid McSPI Revision value\n");
421 sizeof(*pdata),
NULL, 0, 0);
422 WARN(IS_ERR(pdev),
"Can't build omap_device for %s:%s\n",
428 static void omap_init_mcspi(
void)
434 static inline void omap_init_mcspi(
void) {}
442 static void omap_init_rng(
void)
452 WARN(IS_ERR(pdev),
"Can't build omap_device for omap_rng\n");
455 #if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE)
457 #ifdef CONFIG_ARCH_OMAP2
458 static struct resource omap2_sham_resources[] = {
469 static int omap2_sham_resources_sz =
ARRAY_SIZE(omap2_sham_resources);
471 #define omap2_sham_resources NULL
472 #define omap2_sham_resources_sz 0
475 #ifdef CONFIG_ARCH_OMAP3
476 static struct resource omap3_sham_resources[] = {
491 static int omap3_sham_resources_sz =
ARRAY_SIZE(omap3_sham_resources);
493 #define omap3_sham_resources NULL
494 #define omap3_sham_resources_sz 0
502 static void omap_init_sham(
void)
505 sham_device.
resource = omap2_sham_resources;
508 sham_device.
resource = omap3_sham_resources;
511 pr_err(
"%s: platform not supported\n", __func__);
517 static inline void omap_init_sham(
void) { }
520 #if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
522 #ifdef CONFIG_ARCH_OMAP2
523 static struct resource omap2_aes_resources[] = {
538 static int omap2_aes_resources_sz =
ARRAY_SIZE(omap2_aes_resources);
540 #define omap2_aes_resources NULL
541 #define omap2_aes_resources_sz 0
544 #ifdef CONFIG_ARCH_OMAP3
545 static struct resource omap3_aes_resources[] = {
560 static int omap3_aes_resources_sz =
ARRAY_SIZE(omap3_aes_resources);
562 #define omap3_aes_resources NULL
563 #define omap3_aes_resources_sz 0
571 static void omap_init_aes(
void)
574 aes_device.
resource = omap2_aes_resources;
577 aes_device.
resource = omap3_aes_resources;
580 pr_err(
"%s: platform not supported\n", __func__);
587 static inline void omap_init_aes(
void) { }
592 #if defined(CONFIG_VIDEO_OMAP2_VOUT) || \
593 defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE)
594 #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
595 static struct resource omap_vout_resource[3 - CONFIG_FB_OMAP2_NUM_FBS] = {
598 static struct resource omap_vout_resource[2] = {
604 .num_resources =
ARRAY_SIZE(omap_vout_resource),
605 .resource = &omap_vout_resource[0],
608 static void omap_init_vout(
void)
614 static inline void omap_init_vout(
void) {}
617 #if defined(CONFIG_OMAP_OCP2SCP) || defined(CONFIG_OMAP_OCP2SCP_MODULE)
630 static void omap_init_ocp2scp(
void)
634 int bus_id = -1, dev_cnt = 0,
i;
636 const char *oh_name, *
name;
642 oh_name =
"ocp2scp_usb_phy";
643 name =
"omap-ocp2scp";
647 pr_err(
"%s: could not find omap_hwmod for %s\n", __func__,
654 pr_err(
"%s: No memory for ocp2scp pdata\n", __func__);
659 dev_cnt = count_ocp2scp_devices(ocp2scp_dev);
662 pr_err(
"%s: No devices connected to ocp2scp\n", __func__);
670 pr_err(
"%s: No memory for ocp2scp pdata devices\n", __func__);
675 for (i = 0; i <
dev_cnt; i++, ocp2scp_dev++)
676 pdata->
devices[i] = ocp2scp_dev;
683 pr_err(
"Could not build omap_device for %s %s\n",
691 static inline void omap_init_ocp2scp(
void) { }
696 static int __init omap2_init_devices(
void)
699 if (!of_have_populated_dt())
708 omap_init_hdmi_audio();
711 if (!of_have_populated_dt()) {
727 #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
728 static int __init omap_init_wdt(
void)
733 char *oh_name =
"wd_timer2";
734 char *dev_name =
"omap_wdt";
741 pr_err(
"Could not look up wd_timer%d hwmod\n",
id);
746 WARN(IS_ERR(pdev),
"Can't build omap_device for %s:%s.\n",