board_bcm281xx.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (C) 2012-2013 Broadcom Corporation
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation version 2.
  7. *
  8. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
  9. * kind, whether express or implied; without even the implied warranty
  10. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #include <linux/of_platform.h>
  14. #include <linux/init.h>
  15. #include <linux/device.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/clocksource.h>
  18. #include <asm/mach/arch.h>
  19. #include <asm/mach/time.h>
  20. #include <asm/hardware/cache-l2x0.h>
  21. #include "bcm_kona_smc.h"
  22. #include "kona.h"
  23. static int __init kona_l2_cache_init(void)
  24. {
  25. if (!IS_ENABLED(CONFIG_CACHE_L2X0))
  26. return 0;
  27. bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0);
  28. /*
  29. * The aux_val and aux_mask have no effect since L2 cache is already
  30. * enabled. Pass 0s for aux_val and 1s for aux_mask for default value.
  31. */
  32. l2x0_of_init(0, ~0);
  33. return 0;
  34. }
  35. static void bcm_board_setup_restart(void)
  36. {
  37. struct device_node *np;
  38. np = of_find_compatible_node(NULL, NULL, "brcm,bcm11351");
  39. if (np) {
  40. if (of_device_is_available(np))
  41. bcm_kona_setup_restart();
  42. of_node_put(np);
  43. }
  44. /* Restart setup for other boards goes here */
  45. }
  46. static void __init board_init(void)
  47. {
  48. of_platform_populate(NULL, of_default_bus_match_table, NULL,
  49. &platform_bus);
  50. bcm_kona_smc_init();
  51. bcm_board_setup_restart();
  52. kona_l2_cache_init();
  53. }
  54. static const char * const bcm11351_dt_compat[] = { "brcm,bcm11351", NULL, };
  55. DT_MACHINE_START(BCM11351_DT, "Broadcom Application Processor")
  56. .init_time = clocksource_of_init,
  57. .init_machine = board_init,
  58. .restart = bcm_kona_restart,
  59. .dt_compat = bcm11351_dt_compat,
  60. MACHINE_END