|
@@ -412,3 +412,156 @@ static int __init omap_mcspi_init(struct omap_hwmod *oh, void *unused)
|
|
pr_err("Memory allocation for McSPI device failed\n");
|
|
pr_err("Memory allocation for McSPI device failed\n");
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ pdata->num_cs = mcspi_attrib->num_chipselect;
|
|
|
|
+ switch (oh->class->rev) {
|
|
|
|
+ case OMAP2_MCSPI_REV:
|
|
|
|
+ case OMAP3_MCSPI_REV:
|
|
|
|
+ pdata->regs_offset = 0;
|
|
|
|
+ break;
|
|
|
|
+ case OMAP4_MCSPI_REV:
|
|
|
|
+ pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ pr_err("Invalid McSPI Revision value\n");
|
|
|
|
+ kfree(pdata);
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ spi_num++;
|
|
|
|
+ pdev = omap_device_build(name, spi_num, oh, pdata,
|
|
|
|
+ sizeof(*pdata), NULL, 0, 0);
|
|
|
|
+ WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
|
|
|
|
+ name, oh->name);
|
|
|
|
+ kfree(pdata);
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void omap_init_mcspi(void)
|
|
|
|
+{
|
|
|
|
+ omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#else
|
|
|
|
+static inline void omap_init_mcspi(void) {}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * omap_init_rng - bind the RNG hwmod to the RNG omap_device
|
|
|
|
+ *
|
|
|
|
+ * Bind the RNG hwmod to the RNG omap_device. No return value.
|
|
|
|
+ */
|
|
|
|
+static void omap_init_rng(void)
|
|
|
|
+{
|
|
|
|
+ struct omap_hwmod *oh;
|
|
|
|
+ struct platform_device *pdev;
|
|
|
|
+
|
|
|
|
+ oh = omap_hwmod_lookup("rng");
|
|
|
|
+ if (!oh)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ pdev = omap_device_build("omap_rng", -1, oh, NULL, 0, NULL, 0, 0);
|
|
|
|
+ WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE)
|
|
|
|
+
|
|
|
|
+#ifdef CONFIG_ARCH_OMAP2
|
|
|
|
+static struct resource omap2_sham_resources[] = {
|
|
|
|
+ {
|
|
|
|
+ .start = OMAP24XX_SEC_SHA1MD5_BASE,
|
|
|
|
+ .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
|
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .start = 51 + OMAP_INTC_START,
|
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+static int omap2_sham_resources_sz = ARRAY_SIZE(omap2_sham_resources);
|
|
|
|
+#else
|
|
|
|
+#define omap2_sham_resources NULL
|
|
|
|
+#define omap2_sham_resources_sz 0
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#ifdef CONFIG_ARCH_OMAP3
|
|
|
|
+static struct resource omap3_sham_resources[] = {
|
|
|
|
+ {
|
|
|
|
+ .start = OMAP34XX_SEC_SHA1MD5_BASE,
|
|
|
|
+ .end = OMAP34XX_SEC_SHA1MD5_BASE + 0x64,
|
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .start = 49 + OMAP_INTC_START,
|
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .start = OMAP34XX_DMA_SHA1MD5_RX,
|
|
|
|
+ .flags = IORESOURCE_DMA,
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+static int omap3_sham_resources_sz = ARRAY_SIZE(omap3_sham_resources);
|
|
|
|
+#else
|
|
|
|
+#define omap3_sham_resources NULL
|
|
|
|
+#define omap3_sham_resources_sz 0
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+static struct platform_device sham_device = {
|
|
|
|
+ .name = "omap-sham",
|
|
|
|
+ .id = -1,
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static void omap_init_sham(void)
|
|
|
|
+{
|
|
|
|
+ if (cpu_is_omap24xx()) {
|
|
|
|
+ sham_device.resource = omap2_sham_resources;
|
|
|
|
+ sham_device.num_resources = omap2_sham_resources_sz;
|
|
|
|
+ } else if (cpu_is_omap34xx()) {
|
|
|
|
+ sham_device.resource = omap3_sham_resources;
|
|
|
|
+ sham_device.num_resources = omap3_sham_resources_sz;
|
|
|
|
+ } else {
|
|
|
|
+ pr_err("%s: platform not supported\n", __func__);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ platform_device_register(&sham_device);
|
|
|
|
+}
|
|
|
|
+#else
|
|
|
|
+static inline void omap_init_sham(void) { }
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
|
|
|
|
+
|
|
|
|
+#ifdef CONFIG_ARCH_OMAP2
|
|
|
|
+static struct resource omap2_aes_resources[] = {
|
|
|
|
+ {
|
|
|
|
+ .start = OMAP24XX_SEC_AES_BASE,
|
|
|
|
+ .end = OMAP24XX_SEC_AES_BASE + 0x4C,
|
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .start = OMAP24XX_DMA_AES_TX,
|
|
|
|
+ .flags = IORESOURCE_DMA,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .start = OMAP24XX_DMA_AES_RX,
|
|
|
|
+ .flags = IORESOURCE_DMA,
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources);
|
|
|
|
+#else
|
|
|
|
+#define omap2_aes_resources NULL
|
|
|
|
+#define omap2_aes_resources_sz 0
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#ifdef CONFIG_ARCH_OMAP3
|
|
|
|
+static struct resource omap3_aes_resources[] = {
|
|
|
|
+ {
|
|
|
|
+ .start = OMAP34XX_SEC_AES_BASE,
|
|
|
|
+ .end = OMAP34XX_SEC_AES_BASE + 0x4C,
|
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ .start = OMAP34XX_DMA_AES2_TX,
|
|
|
|
+ .flags = IORESOURCE_DMA,
|
|
|
|
+ },
|
|
|
|
+ {
|