board: Add support for the CMF Phone (1)

This device has a broken framebuffer. As such, logs are passed via UART.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
This commit is contained in:
Igor Belwon
2025-08-23 19:23:23 +02:00
parent 191b8d60a8
commit 4d9be0bc55
4 changed files with 111 additions and 0 deletions

View File

@@ -21,6 +21,23 @@ menu "Device Support"
help
Say Y if you want to include support for Pixel 2 XL
config NOTHING_TETRIS
bool "Support for CMF Phone 1"
default n
depends on MT6878
help
Say Y if you want to include support for CMF Phone 1
config NOTHING_TETRIS_DISABLE_WDT
bool "Disable the watchdog timer on startup"
default y
depends on NOTHING_TETRIS
help
Say Y if you want to disable the watchdog timer on startup
on this board. While this is obviously useful for end-users,
developers may want to leave this on to avoid holding down
the power button every time.
config QEMU_BOARD_VIRT
bool "Support for QEMU virt platform (aarch64)"
default n
@@ -157,6 +174,7 @@ menu "Device Specific Addresses"
config PAYLOAD_ENTRY
hex "Payload Entry Address"
default 0x50000000 if NOTHING_TETRIS
default 0x050000000 if SAMSUNG_J4LTE
default 0x090000000 if SAMSUNG_J5LTE
default 0x090000000 if SAMSUNG_GTA4XL
@@ -164,6 +182,7 @@ menu "Device Specific Addresses"
config RAMDISK_ENTRY
hex "Ramdisk Entry Address"
default 0x40000000 if NOTHING_TETRIS
default 0x084000000 if SAMSUNG_GTA4XL
default 0x51100000 if VOLLA_ALGIZ

View File

@@ -1,6 +1,7 @@
lib-$(CONFIG_APPLE_N61AP) += apple/board-n61ap.o
lib-$(CONFIG_AMAZON_PW3) += amazon/board-pw3.o
lib-$(CONFIG_GOOGLE_TAIMEN) += google/board-taimen.o
lib-$(CONFIG_NOTHING_TETRIS) += nothing/board-tetris.o
lib-$(CONFIG_QEMU_BOARD_VIRT) += qemu/board-virt.o
lib-$(CONFIG_SAMSUNG_A105F) += samsung/board-a105f.o
lib-$(CONFIG_SAMSUNG_A127F) += samsung/board-a127f.o

View File

@@ -0,0 +1,80 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2025, Igor Belwon <igor.belwon@mentallysanemainliners.org>
*/
#include <board.h>
#include <drivers/framework.h>
#include <lib/debug.h>
#define UART_BASE 0x11001000
#define UART_LSR_BASE 0x14
#define UART_LSR_DR 0x01 /* Data ready */
#define UART_LSR_THRE 0x20 /* TX holding register empty */
#define WDT_BASE 0x1c00a000
#define WDT_MODE_KEY 0x22000000
#define WDT_MODE_EN (1 << 0)
void uart_putc(char ch)
{
/* wait until TX is ready */
while (!(readl((void *)(UART_BASE + UART_LSR_BASE)) & UART_LSR_THRE))
;
writel(ch, (void *)UART_BASE); // thr is at offset 0x0, which is just uart_base
}
void uart_puts(const char *s)
{
while (*s != '\0') {
uart_putc(*s);
s++;
}
}
void tetris_disable_wdt(void)
{
uint32_t reg;
reg = readl((void*)WDT_BASE);
if (reg & WDT_MODE_EN)
{
reg &= ~WDT_MODE_EN;
reg |= WDT_MODE_KEY;
writel(reg, (void*)WDT_BASE);
printk(KERN_INFO, "%s: disabled watchdog timer.\n", __func__);
}
else
printk(KERN_ERR, "%s: watchdog is already disabled.\n", __func__);
return;
}
int tetris_init(void)
{
return 0;
}
int tetris_drv(void)
{
return 0;
}
int tetris_late_init(void)
{
#ifdef CONFIG_NOTHING_TETRIS_DISABLE_WDT
tetris_disable_wdt();
#endif
return 0;
}
struct board_data board_ops = {
.name = "cmf-phone-1",
.ops = {
.early_init = tetris_init,
.drivers_init = tetris_drv,
.late_init = tetris_late_init,
},
.quirks = 0
};

11
configs/tetris_defconfig Normal file
View File

@@ -0,0 +1,11 @@
CONFIG_POSITION_INDEPENDENT=y
# CONFIG_COMPRESS_GZIP is not set
CONFIG_COMPRESS_LZ4=y
# CONFIG_SIMPLE_FB is not set
CONFIG_UART_DEBUG=y
CONFIG_MT6878=y
CONFIG_NOTHING_TETRIS=y
CONFIG_NOTHING_TETRIS_DISABLE_WDT=y
CONFIG_TEXT_BASE=0x40000000
CONFIG_PAYLOAD_ENTRY=0x60000000
CONFIG_RAMDISK_ENTRY=0x51100000