From a8d847e8b93c3fbe2c5dec651b5d2a2532eb11a2 Mon Sep 17 00:00:00 2001 From: Sota4Ever Date: Tue, 5 Nov 2024 07:14:02 -0500 Subject: [PATCH] board: Add support for r8s (Samsung Galaxy S20 FE) Signed-off-by: Sota4Ever --- board/Kconfig | 13 +++++++++ board/Makefile | 1 + board/samsung/board-r8s.c | 57 +++++++++++++++++++++++++++++++++++++++ configs/r8s_defconfig | 3 +++ 4 files changed, 74 insertions(+) create mode 100644 board/samsung/board-r8s.c create mode 100644 configs/r8s_defconfig diff --git a/board/Kconfig b/board/Kconfig index 4592075..74d692a 100644 --- a/board/Kconfig +++ b/board/Kconfig @@ -6,6 +6,13 @@ menu "Device Support" help Say Y if you want to include support for iPhone 6 + config SAMSUNG_R8S + bool "Support for Samsung Galaxy S20 FE" + default n + depends on EXYNOS_990 + help + Say Y if you want to include support for Samsung Galaxy S20 FE + config SAMSUNG_C1S bool "Support for Samsung Galaxy Note20" default n @@ -86,6 +93,7 @@ menu "Device Specific Addresses" config PAYLOAD_ENTRY hex "Payload Entry Address" default 0x830000000 if APPLE_N61AP + default 0x090000000 if SAMSUNG_R8S default 0x090000000 if SAMSUNG_C1S default 0x050000000 if SAMSUNG_NOBLELTE default 0x090000000 if SAMSUNG_JACKPOTLTE @@ -100,6 +108,7 @@ menu "Device Specific Addresses" config RAMDISK_ENTRY hex "Ramdisk Entry Address" default 0x082000000 if SAMSUNG_DREAMLTE + default 0x084000000 if SAMSUNG_R8S default 0x084000000 if SAMSUNG_C1S default 0x084000000 if SAMSUNG_X1S @@ -107,6 +116,7 @@ menu "Device Specific Addresses" hex "Framebuffer Base Address (for SimpleFB)" depends on SIMPLE_FB default 0x83e900000 if APPLE_N61AP + default 0x0f1000000 if SAMSUNG_R8S default 0x0f1000000 if SAMSUNG_C1S default 0x0e2a00000 if SAMSUNG_NOBLELTE default 0x0ec000000 if SAMSUNG_JACKPOTLTE @@ -122,6 +132,7 @@ menu "Device Specific Addresses" int "Framebuffer Width (for SimpleFB)" depends on SIMPLE_FB default 752 if APPLE_N61AP + default 1080 if SAMSUNG_R8S default 1080 if SAMSUNG_C1S default 1440 if SAMSUNG_NOBLELTE default 1080 if SAMSUNG_JACKPOTLTE @@ -137,6 +148,7 @@ menu "Device Specific Addresses" int "Framebuffer Height (for SimpleFB)" depends on SIMPLE_FB default 1334 if APPLE_N61AP + default 2400 if SAMSUNG_R8S default 2400 if SAMSUNG_C1S default 2560 if SAMSUNG_NOBLELTE default 2220 if SAMSUNG_JACKPOTLTE @@ -152,6 +164,7 @@ menu "Device Specific Addresses" int "Framebuffer Stride (for SimpleFB)" depends on SIMPLE_FB default 4 if APPLE_N61AP + default 4 if SAMSUNG_R8S default 4 if SAMSUNG_C1S default 4 if SAMSUNG_NOBLELTE default 4 if SAMSUNG_JACKPOTLTE diff --git a/board/Makefile b/board/Makefile index 8aff4c7..9fb3ba3 100644 --- a/board/Makefile +++ b/board/Makefile @@ -1,4 +1,5 @@ lib-$(CONFIG_APPLE_N61AP) += apple/board-n61ap.o +lib-$(CONFIG_SAMSUNG_R8S) += samsung/board-r8s.o lib-$(CONFIG_SAMSUNG_C1S) += samsung/board-c1s.o lib-$(CONFIG_SAMSUNG_NOBLELTE) += samsung/board-noblelte.o lib-$(CONFIG_SAMSUNG_JACKPOTLTE) += samsung/board-jackpotlte.o diff --git a/board/samsung/board-r8s.c b/board/samsung/board-r8s.c new file mode 100644 index 0000000..04b3420 --- /dev/null +++ b/board/samsung/board-r8s.c @@ -0,0 +1,57 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) Sota4Ever + * Copyright (c) 2024, Ivaylo Ivanov + */ +#include +#include +#include + +#define DECON_F_BASE 0x19050000 +#define HW_SW_TRIG_CONTROL 0x70 + +void init_board_funcs(void *board) +{ + /* + * Parsing the struct directly without restructing is + * broken as of Sep 29 2024 + */ + struct { + const char *name; + int ops[BOARD_OP_EXIT]; + } *board_restruct = board; + + board_restruct->name = "R8S"; +} + +// Early initialization +int board_init(void) +{ + /* Allow framebuffer to be written to */ + *(int*) (DECON_F_BASE + HW_SW_TRIG_CONTROL) = 0x1281; + return 0; +} + +// Late initialization +int board_late_init(void) +{ + return 0; +} + +int board_driver_setup(void) +{ + struct { + int width; + int height; + int stride; + void *address; + } simplefb_data = { + .width = 1080, + .height = 2400, + .stride = 4, + .address = (void *)0xf1000000 + }; + + REGISTER_DRIVER("simplefb", simplefb_probe, &simplefb_data); + return 0; +} diff --git a/configs/r8s_defconfig b/configs/r8s_defconfig new file mode 100644 index 0000000..4a6454a --- /dev/null +++ b/configs/r8s_defconfig @@ -0,0 +1,3 @@ +CONFIG_CROSS_COMPILE="aarch64-linux-gnu-" +CONFIG_EXYNOS_990=y +CONFIG_SAMSUNG_R8S=y