omap4-common.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * OMAP4 specific common source file.
  3. *
  4. * Copyright (C) 2010 Texas Instruments, Inc.
  5. * Author:
  6. * Santosh Shilimkar <santosh.shilimkar@ti.com>
  7. *
  8. *
  9. * This program is free software,you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/io.h>
  16. #include <linux/platform_device.h>
  17. #include <asm/hardware/gic.h>
  18. #include <asm/hardware/cache-l2x0.h>
  19. #include <mach/hardware.h>
  20. #include <mach/omap4-common.h>
  21. #ifdef CONFIG_CACHE_L2X0
  22. void __iomem *l2cache_base;
  23. #endif
  24. void __iomem *gic_cpu_base_addr;
  25. void __iomem *gic_dist_base_addr;
  26. void __init gic_init_irq(void)
  27. {
  28. /* Static mapping, never released */
  29. gic_dist_base_addr = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K);
  30. BUG_ON(!gic_dist_base_addr);
  31. gic_dist_init(0, gic_dist_base_addr, 29);
  32. /* Static mapping, never released */
  33. gic_cpu_base_addr = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
  34. BUG_ON(!gic_cpu_base_addr);
  35. gic_cpu_init(0, gic_cpu_base_addr);
  36. }
  37. #ifdef CONFIG_CACHE_L2X0
  38. static void omap4_l2x0_disable(void)
  39. {
  40. /* Disable PL310 L2 Cache controller */
  41. omap_smc1(0x102, 0x0);
  42. }
  43. static int __init omap_l2_cache_init(void)
  44. {
  45. u32 aux_ctrl = 0;
  46. /*
  47. * To avoid code running on other OMAPs in
  48. * multi-omap builds
  49. */
  50. if (!cpu_is_omap44xx())
  51. return -ENODEV;
  52. /* Static mapping, never released */
  53. l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K);
  54. BUG_ON(!l2cache_base);
  55. /* Enable PL310 L2 Cache controller */
  56. omap_smc1(0x102, 0x1);
  57. /*
  58. * 16-way associativity, parity disabled
  59. * Way size - 32KB (es1.0)
  60. * Way size - 64KB (es2.0 +)
  61. */
  62. aux_ctrl = ((1 << L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT) |
  63. (0x1 << 25) |
  64. (0x1 << L2X0_AUX_CTRL_NS_LOCKDOWN_SHIFT) |
  65. (0x1 << L2X0_AUX_CTRL_NS_INT_CTRL_SHIFT));
  66. if (omap_rev() == OMAP4430_REV_ES1_0)
  67. aux_ctrl |= 0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT;
  68. else
  69. aux_ctrl |= 0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT;
  70. l2x0_init(l2cache_base, aux_ctrl, L2X0_AUX_CTRL_MASK);
  71. /*
  72. * Override default outer_cache.disable with a OMAP4
  73. * specific one
  74. */
  75. outer_cache.disable = omap4_l2x0_disable;
  76. return 0;
  77. }
  78. early_initcall(omap_l2_cache_init);
  79. #endif