aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory CLEMENT <gregory.clement@free-electrons.com>2012-10-01 05:56:42 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-10-18 05:57:36 -0400
commit6248d0602f9932a437070dda598b7973b8770384 (patch)
treedb1dbb8bd536cba68672b8ca13f75d02b9f5db8a
parentddffeb8c4d0331609ef2581d84de4d763607bd37 (diff)
ARM: 7545/1: cache-l2x0: make outer_cache_fns a field of l2x0_of_data
Instead of having multiple functions belonging to outer_cache and filling this structure on the fly, use a outer_cache_fns field inside l2x0_of_data and just memcopy it into outer_cache depending of the type of the l2x0 cache. For non DT case, the former code was kept. [rmk: fixed a style issue] Tested-and-Reviewed-by: Yehuda Yitschak <yehuday@marvell.com> Tested-and-Reviewed-by: Lior Amsalem <alior@marvell.com> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mm/cache-l2x0.c55
1 files changed, 40 insertions, 15 deletions
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 8a97e6443c62..db55d18691ed 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -39,9 +39,11 @@ struct l2x0_regs l2x0_saved_regs;
39struct l2x0_of_data { 39struct l2x0_of_data {
40 void (*setup)(const struct device_node *, u32 *, u32 *); 40 void (*setup)(const struct device_node *, u32 *, u32 *);
41 void (*save)(void); 41 void (*save)(void);
42 void (*resume)(void); 42 struct outer_cache_fns outer_cache;
43}; 43};
44 44
45static bool of_init = false;
46
45static inline void cache_wait_way(void __iomem *reg, unsigned long mask) 47static inline void cache_wait_way(void __iomem *reg, unsigned long mask)
46{ 48{
47 /* wait for cache operation by line or way to complete */ 49 /* wait for cache operation by line or way to complete */
@@ -380,13 +382,15 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
380 /* Save the value for resuming. */ 382 /* Save the value for resuming. */
381 l2x0_saved_regs.aux_ctrl = aux; 383 l2x0_saved_regs.aux_ctrl = aux;
382 384
383 outer_cache.inv_range = l2x0_inv_range; 385 if (!of_init) {
384 outer_cache.clean_range = l2x0_clean_range; 386 outer_cache.inv_range = l2x0_inv_range;
385 outer_cache.flush_range = l2x0_flush_range; 387 outer_cache.clean_range = l2x0_clean_range;
386 outer_cache.sync = l2x0_cache_sync; 388 outer_cache.flush_range = l2x0_flush_range;
387 outer_cache.flush_all = l2x0_flush_all; 389 outer_cache.sync = l2x0_cache_sync;
388 outer_cache.inv_all = l2x0_inv_all; 390 outer_cache.flush_all = l2x0_flush_all;
389 outer_cache.disable = l2x0_disable; 391 outer_cache.inv_all = l2x0_inv_all;
392 outer_cache.disable = l2x0_disable;
393 }
390 394
391 printk(KERN_INFO "%s cache controller enabled\n", type); 395 printk(KERN_INFO "%s cache controller enabled\n", type);
392 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", 396 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n",
@@ -537,15 +541,34 @@ static void pl310_resume(void)
537} 541}
538 542
539static const struct l2x0_of_data pl310_data = { 543static const struct l2x0_of_data pl310_data = {
540 pl310_of_setup, 544 .setup = pl310_of_setup,
541 pl310_save, 545 .save = pl310_save,
542 pl310_resume, 546 .outer_cache = {
547 .resume = pl310_resume,
548 .inv_range = l2x0_inv_range,
549 .clean_range = l2x0_clean_range,
550 .flush_range = l2x0_flush_range,
551 .sync = l2x0_cache_sync,
552 .flush_all = l2x0_flush_all,
553 .inv_all = l2x0_inv_all,
554 .disable = l2x0_disable,
555 .set_debug = pl310_set_debug,
556 },
543}; 557};
544 558
545static const struct l2x0_of_data l2x0_data = { 559static const struct l2x0_of_data l2x0_data = {
546 l2x0_of_setup, 560 .setup = l2x0_of_setup,
547 NULL, 561 .save = NULL,
548 l2x0_resume, 562 .outer_cache = {
563 .resume = l2x0_resume,
564 .inv_range = l2x0_inv_range,
565 .clean_range = l2x0_clean_range,
566 .flush_range = l2x0_flush_range,
567 .sync = l2x0_cache_sync,
568 .flush_all = l2x0_flush_all,
569 .inv_all = l2x0_inv_all,
570 .disable = l2x0_disable,
571 },
549}; 572};
550 573
551static const struct of_device_id l2x0_ids[] __initconst = { 574static const struct of_device_id l2x0_ids[] __initconst = {
@@ -585,9 +608,11 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask)
585 if (data->save) 608 if (data->save)
586 data->save(); 609 data->save();
587 610
611 of_init = true;
588 l2x0_init(l2x0_base, aux_val, aux_mask); 612 l2x0_init(l2x0_base, aux_val, aux_mask);
589 613
590 outer_cache.resume = data->resume; 614 memcpy(&outer_cache, &data->outer_cache, sizeof(outer_cache));
615
591 return 0; 616 return 0;
592} 617}
593#endif 618#endif