sbc_init_3cs.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <linux/io.h>
  8. #include <mach/sbc-regs.h>
  9. #include <mach/sg-regs.h>
  10. void sbc_init(void)
  11. {
  12. /* XECS0: boot/sub memory (boot swap = off/on) */
  13. writel(SBCTRL0_SAVEPIN_MEM_VALUE, SBCTRL00);
  14. writel(SBCTRL1_SAVEPIN_MEM_VALUE, SBCTRL01);
  15. writel(SBCTRL2_SAVEPIN_MEM_VALUE, SBCTRL02);
  16. writel(SBCTRL4_SAVEPIN_MEM_VALUE, SBCTRL04);
  17. /* XECS1: sub/boot memory (boot swap = off/on) */
  18. writel(SBCTRL0_SAVEPIN_MEM_VALUE, SBCTRL10);
  19. writel(SBCTRL1_SAVEPIN_MEM_VALUE, SBCTRL11);
  20. writel(SBCTRL2_SAVEPIN_MEM_VALUE, SBCTRL12);
  21. writel(SBCTRL4_SAVEPIN_MEM_VALUE, SBCTRL14);
  22. /* XECS3: peripherals */
  23. writel(SBCTRL0_SAVEPIN_PERI_VALUE, SBCTRL30);
  24. writel(SBCTRL1_SAVEPIN_PERI_VALUE, SBCTRL31);
  25. writel(SBCTRL2_SAVEPIN_PERI_VALUE, SBCTRL32);
  26. writel(SBCTRL4_SAVEPIN_PERI_VALUE, SBCTRL34);
  27. writel(0x0000bc01, SBBASE0); /* boot memory */
  28. writel(0x0400bc01, SBBASE1); /* sub memory */
  29. writel(0x0800bf01, SBBASE3); /* peripherals */
  30. /* enable access to sub memory when boot swap is on */
  31. if (boot_is_swapped())
  32. sg_set_pinsel(318, 5); /* PORT22 -> XECS0 */
  33. sg_set_pinsel(313, 5); /* PORT15 -> XECS3 */
  34. writel(0x00000001, SG_LOADPINCTRL);
  35. }