diff --git a/board/Kconfig b/board/Kconfig index 8fd68091..c6fbb00f 100644 --- a/board/Kconfig +++ b/board/Kconfig @@ -439,6 +439,13 @@ menu "Device Support" Redmi 9A, Redmi 9I, Redmi 9AT, Redmi 10A, Redmi 9A Sport, Redmi 9I Sport, Poco C3, Poco C31, Redmi 9C, Redmi 9C NFC, Redmi 9 India, Redmi 9 Active. + config XIAOMI_MERLINX + bool "Support for Redmi Note 9" + default n + depends on MT6768 + help + Say Y if you want to include support for Redmi Note 9 + config XIAOMI_CAMELLIA bool "Support for Xiaomi Poco M3 Pro 5G" default n diff --git a/board/Makefile b/board/Makefile index 067b749e..3f2aa820 100644 --- a/board/Makefile +++ b/board/Makefile @@ -59,6 +59,7 @@ lib-$(CONFIG_XIAOMI_BEGONIA) += xiaomi/board-begonia.o lib-$(CONFIG_XIAOMI_BLOSSOM) += xiaomi/board-blossom.o lib-$(CONFIG_XIAOMI_CAMELLIA) += xiaomi/board-camellia.o lib-$(CONFIG_XIAOMI_GINKGO) += xiaomi/board-ginkgo.o +lib-$(CONFIG_XIAOMI_MERLINX) += xiaomi/board-merlinx.o lib-$(CONFIG_XIAOMI_MOON) += xiaomi/board-moon.o lib-$(CONFIG_XIAOMI_NEZHA) += xiaomi/board-nezha.o lib-$(CONFIG_XIAOMI_SHENNONG) += xiaomi/board-shennong.o diff --git a/board/xiaomi/board-merlinx.c b/board/xiaomi/board-merlinx.c new file mode 100644 index 00000000..f3037be0 --- /dev/null +++ b/board/xiaomi/board-merlinx.c @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2026 Ryo "evilMyQueen" Yamada + * Copyright (c) 2026 knukima + */ + +/* + * This is a uniLoader board for xiaomi-merlinx (Redmi Note 9) + * Tested on engineering fw (Android 10) and on V13.0.2.0.SJOMIXM (Android 12) + * + * Based on the xiaomi-blossom board + */ + +#include +#include +#include +#include +#include +#include + +#define UART_BASE 0x11002000 +#define UART_LSR_BASE 0x14 +#define UART_LSR_DR 0x01 /* Data ready */ +#define UART_LSR_THRE 0x20 /* TX holding register empty */ + +#ifdef CONFIG_EARLYCON +void uart_putc(char ch) +{ + while (!(readl((void *)(UART_BASE + UART_LSR_BASE)) & UART_LSR_THRE)) + ; + + writel((unsigned int)(unsigned char)ch, (void *)UART_BASE); +} + +void uart_puts(const char *s) +{ + while (*s != '\0') { + if (*s == '\n') + uart_putc('\r'); + uart_putc(*s); + s++; + } +} +#endif + +static struct video_info merlinx_fb = { + .format = FB_FORMAT_ARGB8888, + .width = 1088, // the screen width is 1080px. Use 1088 for lines so they align to 4352 bytes + .height = 2340, + .stride = 4, + .address = (void *)0x7dcb0000 +}; + +static const struct device merlinx_devices[] = { + { "simplefb", &merlinx_fb, "fb" }, +}; + +struct board_data board_ops = { + .name = "xiaomi-merlinx", + .devices = merlinx_devices, + .num_devices = ARRAY_SIZE(merlinx_devices), + .quirks = 0 +}; diff --git a/configs/merlinx_defconfig b/configs/merlinx_defconfig new file mode 100644 index 00000000..64649046 --- /dev/null +++ b/configs/merlinx_defconfig @@ -0,0 +1,8 @@ +CONFIG_COMPRESS_GZIP=n +CONFIG_EARLYCON=y +CONFIG_SIMPLE_FB=y +CONFIG_MT6768=y +CONFIG_XIAOMI_MERLINX=y +CONFIG_TEXT_BASE=0x40080000 +CONFIG_RAMDISK_ENTRY=0x51100000 +CONFIG_PAYLOAD_ENTRY=0x60000000 \ No newline at end of file