aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap_hwmod.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2017-10-10 17:27:26 -0400
committerTony Lindgren <tony@atomide.com>2017-10-10 17:27:26 -0400
commitc2b84a9bb3414cabaa039b8860a694464a0bad06 (patch)
tree947bf0d74636dc0532d254c527c918271f8b6e68 /arch/arm/mach-omap2/omap_hwmod.c
parentfe97874a41bf911350bae6bda7fc044d12c76a4a (diff)
ARM: OMAP2+: Drop omap_hwmod_dma_info
We have all of mach-omap2 booting in device tree only mode now, and this data is populated from device tree. Note that once we have removed support for the omap legacy DMA, we can also drop struct omap_dma_dev_attr. Cc: Lokesh Vutla <lokeshvutla@ti.com> Cc: Paul Walmsley <paul@pwsan.com> Cc: Tero Kristo <t-kristo@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/omap_hwmod.c')
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c119
1 files changed, 3 insertions, 116 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 5a0fbdec339a..29b6c85f6ce8 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1102,29 +1102,6 @@ static int _omap4_wait_target_disable(struct omap_hwmod *oh)
1102} 1102}
1103 1103
1104/** 1104/**
1105 * _count_sdma_reqs - count the number of SDMA request lines associated with @oh
1106 * @oh: struct omap_hwmod *oh
1107 *
1108 * Count and return the number of SDMA request lines associated with
1109 * the hwmod @oh. Used to allocate struct resource data. Returns 0
1110 * if @oh is NULL.
1111 */
1112static int _count_sdma_reqs(struct omap_hwmod *oh)
1113{
1114 struct omap_hwmod_dma_info *ohdi;
1115 int i = 0;
1116
1117 if (!oh || !oh->sdma_reqs)
1118 return 0;
1119
1120 do {
1121 ohdi = &oh->sdma_reqs[i++];
1122 } while (ohdi->dma_req != -1);
1123
1124 return i-1;
1125}
1126
1127/**
1128 * _count_ocp_if_addr_spaces - count the number of address space entries for @oh 1105 * _count_ocp_if_addr_spaces - count the number of address space entries for @oh
1129 * @oh: struct omap_hwmod *oh 1106 * @oh: struct omap_hwmod *oh
1130 * 1107 *
@@ -1148,49 +1125,6 @@ static int _count_ocp_if_addr_spaces(struct omap_hwmod_ocp_if *os)
1148} 1125}
1149 1126
1150/** 1127/**
1151 * _get_sdma_req_by_name - fetch SDMA request line ID by name
1152 * @oh: struct omap_hwmod * to operate on
1153 * @name: pointer to the name of the SDMA request line to fetch (optional)
1154 * @dma: pointer to an unsigned int to store the request line ID to
1155 *
1156 * Retrieve an SDMA request line ID named by @name on the IP block
1157 * pointed to by @oh. The ID will be filled into the address pointed
1158 * to by @dma. When @name is non-null, the request line ID associated
1159 * with the named entry will be returned. If @name is null, the first
1160 * matching entry will be returned. Data order is not meaningful in
1161 * hwmod data, so callers are strongly encouraged to use a non-null
1162 * @name whenever possible to avoid unpredictable effects if hwmod
1163 * data is later added that causes data ordering to change. Returns 0
1164 * upon success or a negative error code upon error.
1165 */
1166static int _get_sdma_req_by_name(struct omap_hwmod *oh, const char *name,
1167 unsigned int *dma)
1168{
1169 int i;
1170 bool found = false;
1171
1172 if (!oh->sdma_reqs)
1173 return -ENOENT;
1174
1175 i = 0;
1176 while (oh->sdma_reqs[i].dma_req != -1) {
1177 if (name == oh->sdma_reqs[i].name ||
1178 !strcmp(name, oh->sdma_reqs[i].name)) {
1179 found = true;
1180 break;
1181 }
1182 i++;
1183 }
1184
1185 if (!found)
1186 return -ENOENT;
1187
1188 *dma = oh->sdma_reqs[i].dma_req;
1189
1190 return 0;
1191}
1192
1193/**
1194 * _get_addr_space_by_name - fetch address space start & end by name 1128 * _get_addr_space_by_name - fetch address space start & end by name
1195 * @oh: struct omap_hwmod * to operate on 1129 * @oh: struct omap_hwmod * to operate on
1196 * @name: pointer to the name of the address space to fetch (optional) 1130 * @name: pointer to the name of the address space to fetch (optional)
@@ -3385,9 +3319,6 @@ int omap_hwmod_count_resources(struct omap_hwmod *oh, unsigned long flags)
3385{ 3319{
3386 int ret = 0; 3320 int ret = 0;
3387 3321
3388 if (flags & IORESOURCE_DMA)
3389 ret += _count_sdma_reqs(oh);
3390
3391 if (flags & IORESOURCE_MEM) { 3322 if (flags & IORESOURCE_MEM) {
3392 struct omap_hwmod_ocp_if *os; 3323 struct omap_hwmod_ocp_if *os;
3393 3324
@@ -3411,19 +3342,10 @@ int omap_hwmod_count_resources(struct omap_hwmod *oh, unsigned long flags)
3411int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res) 3342int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
3412{ 3343{
3413 struct omap_hwmod_ocp_if *os; 3344 struct omap_hwmod_ocp_if *os;
3414 int i, j, sdma_reqs_cnt, addr_cnt; 3345 int j, addr_cnt;
3415 int r = 0; 3346 int r = 0;
3416 3347
3417 /* For each DMA, memory area, fill in array.*/ 3348 /* For each memory area, fill in array.*/
3418
3419 sdma_reqs_cnt = _count_sdma_reqs(oh);
3420 for (i = 0; i < sdma_reqs_cnt; i++) {
3421 (res + r)->name = (oh->sdma_reqs + i)->name;
3422 (res + r)->start = (oh->sdma_reqs + i)->dma_req;
3423 (res + r)->end = (oh->sdma_reqs + i)->dma_req;
3424 (res + r)->flags = IORESOURCE_DMA;
3425 r++;
3426 }
3427 3349
3428 list_for_each_entry(os, &oh->slave_ports, node) { 3350 list_for_each_entry(os, &oh->slave_ports, node) {
3429 addr_cnt = _count_ocp_if_addr_spaces(os); 3351 addr_cnt = _count_ocp_if_addr_spaces(os);
@@ -3441,33 +3363,6 @@ int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
3441} 3363}
3442 3364
3443/** 3365/**
3444 * omap_hwmod_fill_dma_resources - fill struct resource array with dma data
3445 * @oh: struct omap_hwmod *
3446 * @res: pointer to the array of struct resource to fill
3447 *
3448 * Fill the struct resource array @res with dma resource data from the
3449 * omap_hwmod @oh. Intended to be called by code that registers
3450 * omap_devices. See also omap_hwmod_count_resources(). Returns the
3451 * number of array elements filled.
3452 */
3453int omap_hwmod_fill_dma_resources(struct omap_hwmod *oh, struct resource *res)
3454{
3455 int i, sdma_reqs_cnt;
3456 int r = 0;
3457
3458 sdma_reqs_cnt = _count_sdma_reqs(oh);
3459 for (i = 0; i < sdma_reqs_cnt; i++) {
3460 (res + r)->name = (oh->sdma_reqs + i)->name;
3461 (res + r)->start = (oh->sdma_reqs + i)->dma_req;
3462 (res + r)->end = (oh->sdma_reqs + i)->dma_req;
3463 (res + r)->flags = IORESOURCE_DMA;
3464 r++;
3465 }
3466
3467 return r;
3468}
3469
3470/**
3471 * omap_hwmod_get_resource_byname - fetch IP block integration data by name 3366 * omap_hwmod_get_resource_byname - fetch IP block integration data by name
3472 * @oh: struct omap_hwmod * to operate on 3367 * @oh: struct omap_hwmod * to operate on
3473 * @type: one of the IORESOURCE_* constants from include/linux/ioport.h 3368 * @type: one of the IORESOURCE_* constants from include/linux/ioport.h
@@ -3493,20 +3388,12 @@ int omap_hwmod_get_resource_byname(struct omap_hwmod *oh, unsigned int type,
3493 const char *name, struct resource *rsrc) 3388 const char *name, struct resource *rsrc)
3494{ 3389{
3495 int r; 3390 int r;
3496 unsigned int dma;
3497 u32 pa_start, pa_end; 3391 u32 pa_start, pa_end;
3498 3392
3499 if (!oh || !rsrc) 3393 if (!oh || !rsrc)
3500 return -EINVAL; 3394 return -EINVAL;
3501 3395
3502 if (type == IORESOURCE_DMA) { 3396 if (type == IORESOURCE_MEM) {
3503 r = _get_sdma_req_by_name(oh, name, &dma);
3504 if (r)
3505 return r;
3506
3507 rsrc->start = dma;
3508 rsrc->end = dma;
3509 } else if (type == IORESOURCE_MEM) {
3510 r = _get_addr_space_by_name(oh, name, &pa_start, &pa_end); 3397 r = _get_addr_space_by_name(oh, name, &pa_start, &pa_end);
3511 if (r) 3398 if (r)
3512 return r; 3399 return r;