summaryrefslogtreecommitdiffstats
path: root/arch/mips/mach-ath79
diff options
context:
space:
mode:
authorAntony Pavlov <antonynpavlov@gmail.com>2015-11-03 08:23:51 +0300
committerSascha Hauer <s.hauer@pengutronix.de>2015-11-03 08:25:56 +0100
commit82bd8277f211ef01bd5484fec058d1ae94b012a2 (patch)
treefa7b1440ff458e36c6a731425532e63cecd0fc3c /arch/mips/mach-ath79
parent61163945cfec8c88d9d77e6c53b76a91760fa07f (diff)
downloadbarebox-82bd8277f211ef01bd5484fec058d1ae94b012a2.tar.gz
barebox-82bd8277f211ef01bd5484fec058d1ae94b012a2.tar.xz
MIPS: ath79: add debug_ll_ar9331_init macro
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/mips/mach-ath79')
-rw-r--r--arch/mips/mach-ath79/include/mach/debug_ll.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/mips/mach-ath79/include/mach/debug_ll.h b/arch/mips/mach-ath79/include/mach/debug_ll.h
index d3813afb7d..e0c3f797b2 100644
--- a/arch/mips/mach-ath79/include/mach/debug_ll.h
+++ b/arch/mips/mach-ath79/include/mach/debug_ll.h
@@ -63,6 +63,35 @@ static inline void PUTC_LL(int ch)
* Macros for use in assembly language code
*/
+#define AR933X_UART_CS_REG 0x04
+#define UART_CS_REG ((KSEG1 | AR933X_UART_BASE) | AR933X_UART_CS_REG)
+#define AR933X_UART_CS_IF_MODE_S 2
+#define AR933X_UART_CS_IF_MODE_DCE 2
+#define AR933X_UART_CS_TX_READY_ORIDE BIT(7)
+#define AR933X_UART_CS_RX_READY_ORIDE BIT(8)
+
+/*
+ * simple uart clock setup
+ * from u-boot_mod/u-boot/cpu/mips/ar7240/hornet_serial.c
+ */
+#define BAUD_CLOCK 25000000
+#define CLOCK_SCALE ((BAUD_CLOCK / (16 * CONFIG_BAUDRATE)) - 1)
+#define CLOCK_STEP 0x2000
+
+#define AR933X_UART_CLOCK_REG 0x08
+#define CLOCK_REG ((KSEG1 | AR933X_UART_BASE) | AR933X_UART_CLOCK_REG)
+
+.macro debug_ll_ar9331_init
+#ifdef CONFIG_DEBUG_LL
+
+ pbl_reg_writel ((AR933X_UART_CS_IF_MODE_DCE << AR933X_UART_CS_IF_MODE_S) \
+ | AR933X_UART_CS_TX_READY_ORIDE \
+ | AR933X_UART_CS_RX_READY_ORIDE), UART_CS_REG
+ pbl_reg_writel ((CLOCK_SCALE << 16) | CLOCK_STEP), CLOCK_REG
+
+#endif /* CONFIG_DEBUG_LL */
+.endm
+
/*
* output a character in a0
*/