|
@@ -3521,3 +3521,80 @@ int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
|
|
|
mpu_irqs_cnt = _count_mpu_irqs(oh);
|
|
|
for (i = 0; i < mpu_irqs_cnt; i++) {
|
|
|
(res + r)->name = (oh->mpu_irqs + i)->name;
|
|
|
+ (res + r)->start = (oh->mpu_irqs + i)->irq;
|
|
|
+ (res + r)->end = (oh->mpu_irqs + i)->irq;
|
|
|
+ (res + r)->flags = IORESOURCE_IRQ;
|
|
|
+ r++;
|
|
|
+ }
|
|
|
+
|
|
|
+ sdma_reqs_cnt = _count_sdma_reqs(oh);
|
|
|
+ for (i = 0; i < sdma_reqs_cnt; i++) {
|
|
|
+ (res + r)->name = (oh->sdma_reqs + i)->name;
|
|
|
+ (res + r)->start = (oh->sdma_reqs + i)->dma_req;
|
|
|
+ (res + r)->end = (oh->sdma_reqs + i)->dma_req;
|
|
|
+ (res + r)->flags = IORESOURCE_DMA;
|
|
|
+ r++;
|
|
|
+ }
|
|
|
+
|
|
|
+ p = oh->slave_ports.next;
|
|
|
+
|
|
|
+ i = 0;
|
|
|
+ while (i < oh->slaves_cnt) {
|
|
|
+ os = _fetch_next_ocp_if(&p, &i);
|
|
|
+ addr_cnt = _count_ocp_if_addr_spaces(os);
|
|
|
+
|
|
|
+ for (j = 0; j < addr_cnt; j++) {
|
|
|
+ (res + r)->name = (os->addr + j)->name;
|
|
|
+ (res + r)->start = (os->addr + j)->pa_start;
|
|
|
+ (res + r)->end = (os->addr + j)->pa_end;
|
|
|
+ (res + r)->flags = IORESOURCE_MEM;
|
|
|
+ r++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return r;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * omap_hwmod_fill_dma_resources - fill struct resource array with dma data
|
|
|
+ * @oh: struct omap_hwmod *
|
|
|
+ * @res: pointer to the array of struct resource to fill
|
|
|
+ *
|
|
|
+ * Fill the struct resource array @res with dma resource data from the
|
|
|
+ * omap_hwmod @oh. Intended to be called by code that registers
|
|
|
+ * omap_devices. See also omap_hwmod_count_resources(). Returns the
|
|
|
+ * number of array elements filled.
|
|
|
+ */
|
|
|
+int omap_hwmod_fill_dma_resources(struct omap_hwmod *oh, struct resource *res)
|
|
|
+{
|
|
|
+ int i, sdma_reqs_cnt;
|
|
|
+ int r = 0;
|
|
|
+
|
|
|
+ sdma_reqs_cnt = _count_sdma_reqs(oh);
|
|
|
+ for (i = 0; i < sdma_reqs_cnt; i++) {
|
|
|
+ (res + r)->name = (oh->sdma_reqs + i)->name;
|
|
|
+ (res + r)->start = (oh->sdma_reqs + i)->dma_req;
|
|
|
+ (res + r)->end = (oh->sdma_reqs + i)->dma_req;
|
|
|
+ (res + r)->flags = IORESOURCE_DMA;
|
|
|
+ r++;
|
|
|
+ }
|
|
|
+
|
|
|
+ return r;
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * omap_hwmod_get_resource_byname - fetch IP block integration data by name
|
|
|
+ * @oh: struct omap_hwmod * to operate on
|
|
|
+ * @type: one of the IORESOURCE_* constants from include/linux/ioport.h
|
|
|
+ * @name: pointer to the name of the data to fetch (optional)
|
|
|
+ * @rsrc: pointer to a struct resource, allocated by the caller
|
|
|
+ *
|
|
|
+ * Retrieve MPU IRQ, SDMA request line, or address space start/end
|
|
|
+ * data for the IP block pointed to by @oh. The data will be filled
|
|
|
+ * into a struct resource record pointed to by @rsrc. The struct
|
|
|
+ * resource must be allocated by the caller. When @name is non-null,
|
|
|
+ * the data associated with the matching entry in the IRQ/SDMA/address
|
|
|
+ * space hwmod data arrays will be returned. If @name is null, the
|
|
|
+ * first array entry will be returned. Data order is not meaningful
|
|
|
+ * in hwmod data, so callers are strongly encouraged to use a non-null
|
|
|
+ * @name whenever possible to avoid unpredictable effects if hwmod
|