aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/image/lzma-loader/src/board-mt7621.c
diff options
context:
space:
mode:
authorTobias Schramm <tobleminer@gmail.com>2018-05-03 16:27:10 +0200
committerMathias Kresin <dev@kresin.me>2018-06-21 06:54:42 +0200
commit4fa85a625f33c4602511dc5b2ee406329bf289c2 (patch)
treea28624cd04306a658a29f972e5760154fee2fee1 /target/linux/ramips/image/lzma-loader/src/board-mt7621.c
parentfeb0a0bf22143326b3b3515ab0bb4682194dc75a (diff)
downloadupstream-4fa85a625f33c4602511dc5b2ee406329bf289c2.tar.gz
upstream-4fa85a625f33c4602511dc5b2ee406329bf289c2.tar.bz2
upstream-4fa85a625f33c4602511dc5b2ee406329bf289c2.zip
ramips: Add support for mt7621 to lzma-loader
Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
Diffstat (limited to 'target/linux/ramips/image/lzma-loader/src/board-mt7621.c')
-rw-r--r--target/linux/ramips/image/lzma-loader/src/board-mt7621.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/target/linux/ramips/image/lzma-loader/src/board-mt7621.c b/target/linux/ramips/image/lzma-loader/src/board-mt7621.c
new file mode 100644
index 0000000000..b90b2ed89f
--- /dev/null
+++ b/target/linux/ramips/image/lzma-loader/src/board-mt7621.c
@@ -0,0 +1,39 @@
+/*
+ * Arch specific code for mt7621 based boards, based on code for Ralink boards
+ *
+ * Copyright (C) 2018 Tobias Schramm <tobleminer@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+#include "config.h"
+
+#define READREG(r) *(volatile uint32_t *)(r)
+#define WRITEREG(r,v) *(volatile uint32_t *)(r) = v
+
+#define KSEG1ADDR(_x) (((_x) & 0x1fffffff) | 0xa0000000)
+
+#define UART_BASE 0xBE000C00
+
+#define UART_TBR_OFFSET 0x00
+#define UART_LSR_OFFSET 0x14
+
+#define UART_LSR_TEMT (1 << 6)
+
+#define UART_READ(r) READREG(UART_BASE + (r))
+#define UART_WRITE(r,v) WRITEREG(UART_BASE + (r), (v))
+
+void board_putc(int ch)
+{
+ while (((UART_READ(UART_LSR_OFFSET)) & UART_LSR_TEMT) == 0);
+ UART_WRITE(UART_TBR_OFFSET, ch);
+ while (((UART_READ(UART_LSR_OFFSET)) & UART_LSR_TEMT) == 0);
+}
+
+void board_init(void)
+{
+}