Lines Matching +full:cache +full:- +full:sets

5  * SPDX-License-Identifier:	GPL-2.0+
13 /* Cache maintenance operation registers */
48 INVALIDATE_POU, /* i-cache invalidate by address */
49 INVALIDATE_POC, /* d-cache invalidate by address */
50 INVALIDATE_SET_WAY, /* d-cache invalidate by sets/ways */
51 FLUSH_POU, /* d-cache clean by address to the PoU */
52 FLUSH_POC, /* d-cache clean by address to the PoC */
53 FLUSH_SET_WAY, /* d-cache clean by sets/ways */
54 FLUSH_INVAL_POC, /* d-cache clean & invalidate by addr to PoC */
55 FLUSH_INVAL_SET_WAY, /* d-cache clean & invalidate by set/ways */
61 u32 sets; member
64 static void get_cache_ways_sets(struct dcache_config *cache) in get_cache_ways_sets() argument
68 cache->ways = (cache_size_id & MASK_NUM_WAYS) >> NUM_WAYS_SHIFT; in get_cache_ways_sets()
69 cache->sets = (cache_size_id & MASK_NUM_SETS) >> NUM_SETS_SHIFT; in get_cache_ways_sets()
73 * Return the io register to perform required cache action like clean or clean
74 * & invalidate by sets/ways.
93 * Return the io register to perform required cache action like clean or clean
124 /* Make sure cache selection is effective for next memory access */ in get_cline_size()
130 debug("cache line size is %d\n", size); in get_cline_size()
135 /* Perform the action like invalidate/clean on a range of cache addresses */
145 return -EINVAL; in action_cache_range()
151 /* Cache line size is minium size for the cache action */ in action_cache_range()
153 /* Align start address to cache line boundary */ in action_cache_range()
154 start_addr &= ~(cline_size - 1); in action_cache_range()
155 debug("total size for cache action = %llx\n", size); in action_cache_range()
158 size -= cline_size; in action_cache_range()
162 /* Make sure cache action is effective for next memory access */ in action_cache_range()
165 debug("cache action on range done\n"); in action_cache_range()
173 struct dcache_config cache; in action_dcache_all() local
179 return -EINVAL; in action_dcache_all()
182 /* Make sure cache selection is effective for next memory access */ in action_dcache_all()
185 get_cache_ways_sets(&cache); /* Get number of ways & sets */ in action_dcache_all()
186 debug("cache: ways= %d, sets= %d\n", cache.ways + 1, cache.sets + 1); in action_dcache_all()
187 for (i = cache.sets; i >= 0; i--) { in action_dcache_all()
188 for (j = cache.ways; j >= 0; j--) { in action_dcache_all()
194 /* Make sure cache action is effective for next memory access */ in action_dcache_all()
203 if (dcache_status()) /* return if cache already enabled */ in dcache_enable()
207 printf("ERR: D-cache not enabled\n"); in dcache_enable()
211 setbits_le32(&V7M_SCB->ccr, BIT(V7M_CCR_DCACHE)); in dcache_enable()
213 /* Make sure cache action is effective for next memory access */ in dcache_enable()
223 /* if dcache is enabled-> dcache disable & then flush */ in dcache_disable()
225 printf("ERR: D-cache not flushed\n"); in dcache_disable()
229 clrbits_le32(&V7M_SCB->ccr, BIT(V7M_CCR_DCACHE)); in dcache_disable()
231 /* Make sure cache action is effective for next memory access */ in dcache_disable()
238 return (readl(&V7M_SCB->ccr) & BIT(V7M_CCR_DCACHE)) != 0; in dcache_status()
243 if (action_cache_range(INVALIDATE_POC, start, stop - start)) { in invalidate_dcache_range()
244 printf("ERR: D-cache not invalidated\n"); in invalidate_dcache_range()
251 if (action_cache_range(FLUSH_POC, start, stop - start)) { in flush_dcache_range()
252 printf("ERR: D-cache not flushed\n"); in flush_dcache_range()
259 printf("ERR: D-cache not flushed\n"); in flush_dcache_all()
267 printf("ERR: D-cache not invalidated\n"); in invalidate_dcache_all()
302 /* Make sure cache action is effective for next memory access */ in invalidate_icache_all()
313 setbits_le32(&V7M_SCB->ccr, BIT(V7M_CCR_ICACHE)); in icache_enable()
315 /* Make sure cache action is effective for next memory access */ in icache_enable()
322 return (readl(&V7M_SCB->ccr) & BIT(V7M_CCR_ICACHE)) != 0; in icache_status()
331 clrbits_le32(&V7M_SCB->ccr, BIT(V7M_CCR_ICACHE)); in icache_disable()
332 isb(); /* subsequent instructions fetch see cache disable effect */ in icache_disable()