]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM: uniphier: unify low-level debug init code
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 21 Sep 2015 15:27:37 +0000 (00:27 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 24 Sep 2015 15:27:53 +0000 (00:27 +0900)
Move init code of low-level debug into a single file.
This is helpful to create an image that runs on multiple SoCs.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
arch/arm/mach-uniphier/Makefile
arch/arm/mach-uniphier/debug_ll.S [new file with mode: 0644]
arch/arm/mach-uniphier/include/mach/debug-uart.S [deleted file]
arch/arm/mach-uniphier/lowlevel_init.S
arch/arm/mach-uniphier/ph1-ld4/Makefile
arch/arm/mach-uniphier/ph1-ld4/lowlevel_debug.S [deleted file]
arch/arm/mach-uniphier/ph1-pro4/Makefile
arch/arm/mach-uniphier/ph1-pro4/lowlevel_debug.S [deleted file]
arch/arm/mach-uniphier/ph1-sld3/Makefile
arch/arm/mach-uniphier/ph1-sld3/lowlevel_debug.S [deleted file]
arch/arm/mach-uniphier/ph1-sld8/lowlevel_debug.S [deleted file]

index d30cc27009bda9d52065a28d82b0f48b9cbd05af..5c2ccbd7a88fad661f930b33d75a8a0dfc6def02 100644 (file)
@@ -10,6 +10,8 @@ obj-y += spl.o
 obj-y += memconf.o
 obj-y += ddrphy_training.o
 
+obj-$(CONFIG_DEBUG_LL) += debug_ll.o
+
 else
 
 obj-y += late_lowlevel_init.o
diff --git a/arch/arm/mach-uniphier/debug_ll.S b/arch/arm/mach-uniphier/debug_ll.S
new file mode 100644 (file)
index 0000000..d5ccad3
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * On-chip UART initializaion for low-level debugging
+ *
+ * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <linux/serial_reg.h>
+#include <linux/linkage.h>
+#include <mach/bcu-regs.h>
+#include <mach/sc-regs.h>
+#include <mach/sg-regs.h>
+
+#if !defined(CONFIG_DEBUG_SEMIHOSTING)
+#include CONFIG_DEBUG_LL_INCLUDE
+#endif
+
+#define BAUDRATE               115200
+#define DIV_ROUND(x, d)                (((x) + ((d) / 2)) / (d))
+
+ENTRY(debug_ll_init)
+       ldr             r0, =SG_REVISION
+       ldr             r1, [r0]
+       and             r1, r1, #SG_REVISION_TYPE_MASK
+       mov             r1, r1, lsr #SG_REVISION_TYPE_SHIFT
+
+#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD3)
+#define PH1_SLD3_UART_CLK              36864000
+       cmp             r1, #0x25
+       bne             ph1_sld3_end
+
+       sg_set_pinsel   64, 1, 4, 4, r0, r1     @ TXD0 -> TXD0
+
+       ldr             r0, =BCSCR5
+       ldr             r1, =0x24440000
+       str             r1, [r0]
+
+       ldr             r0, =SC_CLKCTRL
+       ldr             r1, [r0]
+       orr             r1, r1, #SC_CLKCTRL_CEN_PERI
+       str             r1, [r0]
+
+       ldr             r3, =DIV_ROUND(PH1_SLD3_UART_CLK, 16 * BAUDRATE)
+
+       b               init_uart
+ph1_sld3_end:
+#endif
+#if defined(CONFIG_ARCH_UNIPHIER_PH1_LD4)
+#define PH1_LD4_UART_CLK               36864000
+       cmp             r1, #0x26
+       bne             ph1_ld4_end
+
+       ldr             r0, =SG_IECTRL
+       ldr             r1, [r0]
+       orr             r1, r1, #1
+       str             r1, [r0]
+
+       sg_set_pinsel   88, 1, 8, 4, r0, r1     @ HSDOUT6 -> TXD0
+
+       ldr             r3, =DIV_ROUND(PH1_LD4_UART_CLK, 16 * BAUDRATE)
+
+       b               init_uart
+ph1_ld4_end:
+#endif
+#if defined(CONFIG_ARCH_UNIPHIER_PH1_PRO4)
+#define PH1_PRO4_UART_CLK              73728000
+       cmp             r1, #0x28
+       bne             ph1_pro4_end
+
+       sg_set_pinsel   128, 0, 4, 8, r0, r1    @ TXD0 -> TXD0
+
+       ldr             r0, =SG_LOADPINCTRL
+       mov             r1, #1
+       str             r1, [r0]
+
+       ldr             r0, =SC_CLKCTRL
+       ldr             r1, [r0]
+       orr             r1, r1, #SC_CLKCTRL_CEN_PERI
+       str             r1, [r0]
+
+       ldr             r3, =DIV_ROUND(PH1_PRO4_UART_CLK, 16 * BAUDRATE)
+
+       b               init_uart
+ph1_pro4_end:
+#endif
+#if defined(CONFIG_ARCH_UNIPHIER_PH1_SLD8)
+#define PH1_SLD8_UART_CLK              80000000
+       cmp             r1, #0x29
+       bne             ph1_sld8_end
+
+       ldr             r0, =SG_IECTRL
+       ldr             r1, [r0]
+       orr             r1, r1, #1
+       str             r1, [r0]
+
+       sg_set_pinsel   70, 3, 8, 4, r0, r1     @ HSDOUT0 -> TXD0
+
+       ldr             r3, =DIV_ROUND(PH1_SLD8_UART_CLK, 16 * BAUDRATE)
+
+       b               init_uart
+ph1_sld8_end:
+#endif
+
+init_uart:
+       addruart        r0, r1, r2
+       mov             r1, #UART_LCR_WLEN8 << 8
+       str             r1, [r0, #0x10]
+       str             r3, [r0, #0x24]
+
+       mov             pc, lr
+ENDPROC(debug_ll_init)
diff --git a/arch/arm/mach-uniphier/include/mach/debug-uart.S b/arch/arm/mach-uniphier/include/mach/debug-uart.S
deleted file mode 100644 (file)
index d2b431f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <linux/serial_reg.h>
-
-#if !defined(CONFIG_DEBUG_SEMIHOSTING)
-#include CONFIG_DEBUG_LL_INCLUDE
-#endif
-
-#define BAUDRATE               115200
-#define DIV_ROUND(x, d)                (((x) + ((d) / 2)) / (d))
-#define DIVISOR                        DIV_ROUND(UART_CLK, 16 * BAUDRATE)
-
-       .macro          init_debug_uart, ra, rb, rc
-       addruart        \ra, \rb, \rc
-       mov             \rb, #UART_LCR_WLEN8 << 8
-       str             \rb, [\ra, #0x10]
-       ldr             \rb, =DIVISOR
-       str             \rb, [\ra, #0x24]
-       .endm
index 9259bafed03f0606e3c5bf1ab06a034b5c48c762..66cad42ddeb5190cca42e1bd8c4f13645f7254d8 100644 (file)
@@ -27,7 +27,7 @@ ENTRY(lowlevel_init)
        mcr     p15, 0, r0, c1, c0, 0
 
 #ifdef CONFIG_DEBUG_LL
-       bl      setup_lowlevel_debug
+       bl      debug_ll_init
 #endif
 
        /*
index 4a2c944aeef911bd99736041482f848fa53e39ec..4b9fe91fb034f4bc9b8dc11afc862b3f7d28068d 100644 (file)
@@ -3,7 +3,6 @@
 #
 
 ifdef CONFIG_SPL_BUILD
-obj-$(CONFIG_DEBUG_LL) += lowlevel_debug.o
 obj-y += bcu_init.o pll_init.o early_clkrst_init.o \
        pll_spectrum.o umc_init.o ddrphy_init.o
 obj-$(CONFIG_MICRO_SUPPORT_CARD) += sbc_init.o
diff --git a/arch/arm/mach-uniphier/ph1-ld4/lowlevel_debug.S b/arch/arm/mach-uniphier/ph1-ld4/lowlevel_debug.S
deleted file mode 100644 (file)
index c0f14e0..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * On-chip UART initializaion for low-level debugging
- *
- * Copyright (C) 2014 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <linux/linkage.h>
-#include <mach/sg-regs.h>
-
-#define UART_CLK               36864000
-#include <mach/debug-uart.S>
-
-ENTRY(setup_lowlevel_debug)
-               ldr             r0, =SG_IECTRL
-               ldr             r1, [r0]
-               orr             r1, r1, #1
-               str             r1, [r0]
-
-               /* UART Port 0 */
-               sg_set_pinsel   85, 1, 8, 4, r0, r1
-               sg_set_pinsel   88, 1, 8, 4, r0, r1
-
-               init_debug_uart r0, r1, r2
-
-               mov             pc, lr
-ENDPROC(setup_lowlevel_debug)
index a52b5aa55653b5f7e3d307f0e1ba6d4ef7a50578..e8b2c9e8ac2ef3291268c6058bf88ce2f910d1d1 100644 (file)
@@ -3,7 +3,6 @@
 #
 
 ifdef CONFIG_SPL_BUILD
-obj-$(CONFIG_DEBUG_LL) += lowlevel_debug.o
 obj-y += pll_init.o early_clkrst_init.o \
        pll_spectrum.o umc_init.o ddrphy_init.o
 obj-$(CONFIG_MICRO_SUPPORT_CARD) += sbc_init.o
diff --git a/arch/arm/mach-uniphier/ph1-pro4/lowlevel_debug.S b/arch/arm/mach-uniphier/ph1-pro4/lowlevel_debug.S
deleted file mode 100644 (file)
index 56f3851..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * On-chip UART initializaion for low-level debugging
- *
- * Copyright (C) 2014 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <linux/linkage.h>
-#include <mach/sc-regs.h>
-#include <mach/sg-regs.h>
-
-#define UART_CLK               73728000
-#include <mach/debug-uart.S>
-
-ENTRY(setup_lowlevel_debug)
-               /* UART Port 0 */
-               sg_set_pinsel   127, 0, 4, 8, r0, r1
-               sg_set_pinsel   128, 0, 4, 8, r0, r1
-
-               ldr             r0, =SG_LOADPINCTRL
-               mov             r1, #1
-               str             r1, [r0]
-
-               ldr             r0, =SC_CLKCTRL
-               ldr             r1, [r0]
-               orr             r1, r1, #SC_CLKCTRL_CEN_PERI
-               str             r1, [r0]
-
-               init_debug_uart r0, r1, r2
-
-               mov             pc, lr
-ENDPROC(setup_lowlevel_debug)
index e3cb39fa50d93bb4ce5d9fb55be098ffd8c947ba..48a3756c1d0b39e9a7a40d162812498ab3ffe5e4 100644 (file)
@@ -3,7 +3,6 @@
 #
 
 ifdef CONFIG_SPL_BUILD
-obj-$(CONFIG_DEBUG_LL) += lowlevel_debug.o
 obj-y += bcu_init.o memconf.o sg_init.o pll_init.o early_clkrst_init.o \
        early_pinctrl.o pll_spectrum.o umc_init.o
 obj-$(CONFIG_MICRO_SUPPORT_CARD) += sbc_init.o
diff --git a/arch/arm/mach-uniphier/ph1-sld3/lowlevel_debug.S b/arch/arm/mach-uniphier/ph1-sld3/lowlevel_debug.S
deleted file mode 100644 (file)
index f4eccb4..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * On-chip UART initializaion for low-level debugging
- *
- * Copyright (C) 2014-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <linux/linkage.h>
-#include <mach/bcu-regs.h>
-#include <mach/sc-regs.h>
-#include <mach/sg-regs.h>
-
-#define UART_CLK               36864000
-#include <mach/debug-uart.S>
-
-ENTRY(setup_lowlevel_debug)
-               sg_set_pinsel   63, 0, 4, 4, r0, r1
-               sg_set_pinsel   64, 1, 4, 4, r0, r1
-
-               ldr             r0, =BCSCR5
-               ldr             r1, =0x24440000
-               str             r1, [r0]
-
-               ldr             r0, =SC_CLKCTRL
-               ldr             r1, [r0]
-               orr             r1, r1, #SC_CLKCTRL_CEN_PERI
-               str             r1, [r0]
-
-               init_debug_uart r0, r1, r2
-
-               mov             pc, lr
-ENDPROC(setup_lowlevel_debug)
diff --git a/arch/arm/mach-uniphier/ph1-sld8/lowlevel_debug.S b/arch/arm/mach-uniphier/ph1-sld8/lowlevel_debug.S
deleted file mode 100644 (file)
index 571ce60..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * On-chip UART initializaion for low-level debugging
- *
- * Copyright (C) 2014 Panasonic Corporation
- *   Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <linux/linkage.h>
-#include <mach/sg-regs.h>
-
-#define UART_CLK               80000000
-#include <mach/debug-uart.S>
-
-ENTRY(setup_lowlevel_debug)
-               ldr             r0, =SG_IECTRL
-               ldr             r1, [r0]
-               orr             r1, r1, #1
-               str             r1, [r0]
-
-               /* UART Port 0 */
-               sg_set_pinsel   70, 3, 8, 4, r0, r1
-               sg_set_pinsel   71, 3, 8, 4, r0, r1
-
-               init_debug_uart r0, r1, r2
-
-               mov             pc, lr
-ENDPROC(setup_lowlevel_debug)