sbc_init.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (C) 2011-2014 Panasonic Corporation
  3. * Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <asm/io.h>
  9. #include <asm/arch/sbc-regs.h>
  10. #include <asm/arch/sg-regs.h>
  11. void sbc_init(void)
  12. {
  13. #if defined(CONFIG_PFC_MICRO_SUPPORT_CARD)
  14. /*
  15. * Only CS1 is connected to support card.
  16. * BKSZ[1:0] should be set to "01".
  17. */
  18. writel(SBCTRL0_SAVEPIN_PERI_VALUE, SBCTRL10);
  19. writel(SBCTRL1_SAVEPIN_PERI_VALUE, SBCTRL11);
  20. writel(SBCTRL2_SAVEPIN_PERI_VALUE, SBCTRL12);
  21. writel(SBCTRL4_SAVEPIN_PERI_VALUE, SBCTRL14);
  22. if (boot_is_swapped()) {
  23. /*
  24. * Boot Swap On: boot from external NOR/SRAM
  25. * 0x02000000-0x03ffffff is a mirror of 0x00000000-0x01ffffff.
  26. *
  27. * 0x00000000-0x01efffff, 0x02000000-0x03efffff: memory bank
  28. * 0x01f00000-0x01ffffff, 0x03f00000-0x03ffffff: peripherals
  29. */
  30. writel(0x0000bc01, SBBASE0);
  31. } else {
  32. /*
  33. * Boot Swap Off: boot from mask ROM
  34. * 0x00000000-0x01ffffff: mask ROM
  35. * 0x02000000-0x3effffff: memory bank (31MB)
  36. * 0x03f00000-0x3fffffff: peripherals (1MB)
  37. */
  38. writel(0x0000be01, SBBASE0); /* dummy */
  39. writel(0x0200be01, SBBASE1);
  40. }
  41. #elif defined(CONFIG_DCC_MICRO_SUPPORT_CARD)
  42. #if !defined(CONFIG_SPL_BUILD)
  43. /* XECS0: boot/sub memory (boot swap = off/on) */
  44. writel(SBCTRL0_SAVEPIN_MEM_VALUE, SBCTRL00);
  45. writel(SBCTRL1_SAVEPIN_MEM_VALUE, SBCTRL01);
  46. writel(SBCTRL2_SAVEPIN_MEM_VALUE, SBCTRL02);
  47. writel(SBCTRL4_SAVEPIN_MEM_VALUE, SBCTRL04);
  48. #endif
  49. /* XECS1: sub/boot memory (boot swap = off/on) */
  50. writel(SBCTRL0_SAVEPIN_MEM_VALUE, SBCTRL10);
  51. writel(SBCTRL1_SAVEPIN_MEM_VALUE, SBCTRL11);
  52. writel(SBCTRL2_SAVEPIN_MEM_VALUE, SBCTRL12);
  53. writel(SBCTRL4_SAVEPIN_MEM_VALUE, SBCTRL14);
  54. /* XECS3: peripherals */
  55. writel(SBCTRL0_SAVEPIN_PERI_VALUE, SBCTRL30);
  56. writel(SBCTRL1_SAVEPIN_PERI_VALUE, SBCTRL31);
  57. writel(SBCTRL2_SAVEPIN_PERI_VALUE, SBCTRL32);
  58. writel(SBCTRL4_SAVEPIN_PERI_VALUE, SBCTRL34);
  59. writel(0x0000bc01, SBBASE0); /* boot memory */
  60. writel(0x0400bc01, SBBASE1); /* sub memory */
  61. writel(0x0800bf01, SBBASE3); /* peripherals */
  62. #if !defined(CONFIG_SPL_BUILD)
  63. sg_set_pinsel(318, 5); /* PORT22 -> XECS0 */
  64. #endif
  65. sg_set_pinsel(313, 5); /* PORT15 -> XECS3 */
  66. writel(0x00000001, SG_LOADPINCTRL);
  67. #endif /* CONFIG_XXX_MICRO_SUPPORT_CARD */
  68. }