omap4-common.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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_dist_base_addr;
  25. void __init gic_init_irq(void)
  26. {
  27. void __iomem *gic_cpu_base;
  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. /* Static mapping, never released */
  32. gic_cpu_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
  33. BUG_ON(!gic_cpu_base);
  34. gic_init(0, 29, gic_dist_base_addr, gic_cpu_base);
  35. }
  36. #ifdef CONFIG_CACHE_L2X0
  37. static void omap4_l2x0_disable(void)
  38. {
  39. /* Disable PL310 L2 Cache controller */
  40. omap_smc1(0x102, 0x0);
  41. }
  42. static int __init omap_l2_cache_init(void)
  43. {
  44. /*
  45. * To avoid code running on other OMAPs in
  46. * multi-omap builds
  47. */
  48. if (!cpu_is_omap44xx())
  49. return -ENODEV;
  50. /* Static mapping, never released */
  51. l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K);
  52. BUG_ON(!l2cache_base);
  53. /* Enable PL310 L2 Cache controller */
  54. omap_smc1(0x102, 0x1);
  55. /*
  56. * 16-way associativity, parity disabled
  57. * Way size - 32KB (es1.0)
  58. * Way size - 64KB (es2.0 +)
  59. */
  60. if (omap_rev() == OMAP4430_REV_ES1_0)
  61. l2x0_init(l2cache_base, 0x0e050000, 0xc0000fff);
  62. else
  63. l2x0_init(l2cache_base, 0x0e070000, 0xc0000fff);
  64. /*
  65. * Override default outer_cache.disable with a OMAP4
  66. * specific one
  67. */
  68. outer_cache.disable = omap4_l2x0_disable;
  69. return 0;
  70. }
  71. early_initcall(omap_l2_cache_init);
  72. #endif