lowlevel_debug.S 757 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * On-chip UART initializaion for low-level debugging
  3. *
  4. * Copyright (C) 2014 Panasonic Corporation
  5. * Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #include <linux/linkage.h>
  10. #include <asm/arch/sc-regs.h>
  11. #include <asm/arch/sg-regs.h>
  12. #define UART_CLK 73728000
  13. #include <asm/arch/debug-uart.S>
  14. ENTRY(setup_lowlevel_debug)
  15. ldr r0, =SC_CLKCTRL
  16. ldr r1, [r0]
  17. orr r1, r1, #SC_CLKCTRL_CLK_PERI
  18. str r1, [r0]
  19. init_debug_uart r0, r1, r2
  20. /* UART Port 0 */
  21. set_pinsel 127, 0, r0, r1
  22. set_pinsel 128, 0, r0, r1
  23. ldr r0, =SG_LOADPINCTRL
  24. mov r1, #1
  25. str r1, [r0]
  26. ldr r0, =SG_IECTRL
  27. ldr r1, [r0]
  28. orr r1, r1, #1
  29. str r1, [r0]
  30. mov pc, lr
  31. ENDPROC(setup_lowlevel_debug)