mirror of
https://github.com/ivoszbg/uniLoader.git
synced 2024-11-10 06:00:07 +00:00
.: Multiple changes
arch: Implement ARM32 support soc: Implement ARM32 support for MSM8916 board: Implement ARM32 support for Samsung Galaxy J5 2015 include: main: Revert built-in memcpy, rearrange and add support for writel lib: simplefb: Make the clear screen function usable Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com> Cc: Efim Girjeu <efimgirjeu@gmail.com>
This commit is contained in:
parent
c4044f40fa
commit
ed98b5d900
12
arch/arm/Start.S
Normal file
12
arch/arm/Start.S
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
ldr r0, =dtb
|
||||||
|
ldr r1, =kernel
|
||||||
|
b main
|
||||||
|
|
||||||
|
.global load_kernel
|
||||||
|
load_kernel:
|
||||||
|
bx r4
|
29
arch/arm/linker.lds.S
Normal file
29
arch/arm/linker.lds.S
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
ENTRY(_start);
|
||||||
|
|
||||||
|
OUTPUT_FORMAT("elf32-littlearm")
|
||||||
|
OUTPUT_ARCH(arm)
|
||||||
|
TARGET(binary)
|
||||||
|
|
||||||
|
INPUT(KERNEL_PATH)
|
||||||
|
INPUT(DTB_PATH)
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
. = 0x80008000;
|
||||||
|
|
||||||
|
.boot : {
|
||||||
|
arch/arm/Start.o
|
||||||
|
}
|
||||||
|
|
||||||
|
.dtb ALIGN(0x1000) : {
|
||||||
|
dtb = .;
|
||||||
|
DTB_PATH
|
||||||
|
}
|
||||||
|
|
||||||
|
.kernel ALIGN(0x1000) : {
|
||||||
|
kernel = .;
|
||||||
|
KERNEL_PATH
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel_size = SIZEOF(.kernel);
|
||||||
|
}
|
@ -42,6 +42,12 @@ menu "Device Support"
|
|||||||
help
|
help
|
||||||
Say Y if you want to include support for Samsung Galaxy S9
|
Say Y if you want to include support for Samsung Galaxy S9
|
||||||
|
|
||||||
|
config SAMSUNG_J5LTE
|
||||||
|
bool "Support for Samsung Galaxy J5 2015"
|
||||||
|
default n
|
||||||
|
depends on QC32_8916
|
||||||
|
help
|
||||||
|
Say Y if you want to include arm32 support for Samsung Galaxy J5 2015
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
menu "Device Specific Addresses"
|
menu "Device Specific Addresses"
|
||||||
@ -54,6 +60,7 @@ menu "Device Specific Addresses"
|
|||||||
default 0x090000000 if SAMSUNG_ZEROFLTE
|
default 0x090000000 if SAMSUNG_ZEROFLTE
|
||||||
default 0x090000000 if SAMSUNG_DREAMLTE
|
default 0x090000000 if SAMSUNG_DREAMLTE
|
||||||
default 0x090000000 if SAMSUNG_STARLTE
|
default 0x090000000 if SAMSUNG_STARLTE
|
||||||
|
default 0x090000000 if SAMSUNG_J5LTE
|
||||||
|
|
||||||
config FRAMEBUFFER_BASE
|
config FRAMEBUFFER_BASE
|
||||||
hex "Framebuffer Base Address (for SimpleFB)"
|
hex "Framebuffer Base Address (for SimpleFB)"
|
||||||
@ -64,6 +71,7 @@ menu "Device Specific Addresses"
|
|||||||
default 0x0e2a00000 if SAMSUNG_ZEROFLTE
|
default 0x0e2a00000 if SAMSUNG_ZEROFLTE
|
||||||
default 0x0cc000000 if SAMSUNG_DREAMLTE
|
default 0x0cc000000 if SAMSUNG_DREAMLTE
|
||||||
default 0x0cc000000 if SAMSUNG_STARLTE
|
default 0x0cc000000 if SAMSUNG_STARLTE
|
||||||
|
default 0x08e000000 if SAMSUNG_J5LTE
|
||||||
|
|
||||||
config FRAMEBUFFER_WIDTH
|
config FRAMEBUFFER_WIDTH
|
||||||
int "Framebuffer Width (for SimpleFB)"
|
int "Framebuffer Width (for SimpleFB)"
|
||||||
@ -74,6 +82,7 @@ menu "Device Specific Addresses"
|
|||||||
default 1440 if SAMSUNG_ZEROFLTE
|
default 1440 if SAMSUNG_ZEROFLTE
|
||||||
default 1440 if SAMSUNG_DREAMLTE
|
default 1440 if SAMSUNG_DREAMLTE
|
||||||
default 1440 if SAMSUNG_STARLTE
|
default 1440 if SAMSUNG_STARLTE
|
||||||
|
default 720 if SAMSUNG_J5LTE
|
||||||
|
|
||||||
config FRAMEBUFFER_HEIGHT
|
config FRAMEBUFFER_HEIGHT
|
||||||
int "Framebuffer Height (for SimpleFB)"
|
int "Framebuffer Height (for SimpleFB)"
|
||||||
@ -84,6 +93,7 @@ menu "Device Specific Addresses"
|
|||||||
default 2560 if SAMSUNG_ZEROFLTE
|
default 2560 if SAMSUNG_ZEROFLTE
|
||||||
default 2960 if SAMSUNG_DREAMLTE
|
default 2960 if SAMSUNG_DREAMLTE
|
||||||
default 2960 if SAMSUNG_STARLTE
|
default 2960 if SAMSUNG_STARLTE
|
||||||
|
default 1280 if SAMSUNG_J5LTE
|
||||||
|
|
||||||
config FRAMEBUFFER_STRIDE
|
config FRAMEBUFFER_STRIDE
|
||||||
int "Framebuffer Stride (for SimpleFB)"
|
int "Framebuffer Stride (for SimpleFB)"
|
||||||
@ -94,5 +104,6 @@ menu "Device Specific Addresses"
|
|||||||
default 4 if SAMSUNG_ZEROFLTE
|
default 4 if SAMSUNG_ZEROFLTE
|
||||||
default 4 if SAMSUNG_DREAMLTE
|
default 4 if SAMSUNG_DREAMLTE
|
||||||
default 4 if SAMSUNG_STARLTE
|
default 4 if SAMSUNG_STARLTE
|
||||||
|
default 4 if SAMSUNG_J5LTE
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@ -4,3 +4,4 @@ lib-$(CONFIG_SAMSUNG_JACKPOTLTE) += samsung/board-jackpotlte.o
|
|||||||
lib-$(CONFIG_SAMSUNG_ZEROFLTE) += samsung/board-zeroflte.o
|
lib-$(CONFIG_SAMSUNG_ZEROFLTE) += samsung/board-zeroflte.o
|
||||||
lib-$(CONFIG_SAMSUNG_DREAMLTE) += samsung/board-dreamlte.o
|
lib-$(CONFIG_SAMSUNG_DREAMLTE) += samsung/board-dreamlte.o
|
||||||
lib-$(CONFIG_SAMSUNG_STARLTE) += samsung/board-starlte.o
|
lib-$(CONFIG_SAMSUNG_STARLTE) += samsung/board-starlte.o
|
||||||
|
lib-$(CONFIG_SAMSUNG_J5LTE) += samsung/board-j5lte.o
|
||||||
|
26
board/samsung/board-j5lte.c
Normal file
26
board/samsung/board-j5lte.c
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <main.h>
|
||||||
|
|
||||||
|
#define PIPE_SSPP_SRC_FORMAT 0x30
|
||||||
|
#define PIPE_SSPP_SRC_UNPACK_PATTERN 0x34
|
||||||
|
#define PIPE_BASE 0x1A15000
|
||||||
|
#define PIPE_SSPP_SRC_YSTRIDE 0x24
|
||||||
|
|
||||||
|
#define MDP_CTL_0_BASE 0x1A02000
|
||||||
|
#define CTL_FLUSH 0x18
|
||||||
|
|
||||||
|
void board_init(void) {
|
||||||
|
/* TODO: Doesn't really work :P */
|
||||||
|
writel(0x000236FF, PIPE_BASE + PIPE_SSPP_SRC_FORMAT);
|
||||||
|
writel(0x03020001, PIPE_BASE + PIPE_SSPP_SRC_UNPACK_PATTERN);
|
||||||
|
writel(720 * 4, MDP_CTL_0_BASE + CTL_FLUSH);
|
||||||
|
writel((1 << (0)), PIPE_BASE + PIPE_SSPP_SRC_YSTRIDE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reboot(void) {
|
||||||
|
writel(0x0, 0x004AB000);
|
||||||
|
}
|
3
configs/j5lte_defconfig
Normal file
3
configs/j5lte_defconfig
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
CONFIG_CROSS_COMPILE="arm-none-eabi-"
|
||||||
|
CONFIG_SAMSUNG_J5LTE=y
|
||||||
|
CONFIG_QC32_8916=y
|
@ -13,37 +13,17 @@ extern void load_kernel(void* dtb, void* x1, void* x2, void* x3, void* kernel);
|
|||||||
extern void soc_init(void);
|
extern void soc_init(void);
|
||||||
extern void board_init(void);
|
extern void board_init(void);
|
||||||
|
|
||||||
|
extern void clean_fb(volatile char *fb, int width, int height, int stride);
|
||||||
extern void printk(char *text);
|
extern void printk(char *text);
|
||||||
|
|
||||||
#ifndef __has_builtin
|
extern void writel(unsigned int value, void* address);
|
||||||
#define __has_builtin(x) 0
|
#ifdef __aarch64__
|
||||||
|
/* Define our own 128 bit memcpy */
|
||||||
|
extern void memcpy(void *dest, void *src, size_t size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __has_builtin(__builtin_memcpy)
|
#ifdef __arm__
|
||||||
void memcpy(void *dest, void *src, size_t size) {
|
extern void memcpy (char* src, char* dest, size_t len);
|
||||||
__builtin_memcpy(dest, src, size);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#ifdef __aarch64__
|
|
||||||
/* Define our own 128 bit memcpy */
|
|
||||||
void memcpy(void *dest, void *src, size_t size)
|
|
||||||
{
|
|
||||||
unsigned __int128 *src2 = src;
|
|
||||||
unsigned __int128 *dest2 = dest;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < size / 16; i++)
|
|
||||||
dest2[i] = src2[i];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __arm__
|
|
||||||
void memcpy (char* src, char* dest, size_t len) {
|
|
||||||
for (size_t i = 0; i < len; i++)
|
|
||||||
dest[i] = src[i];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // MAIN_H_
|
#endif // MAIN_H_
|
||||||
|
9
include/soc/msm8916.h
Normal file
9
include/soc/msm8916.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MSM8916_H_ /* Include guard */
|
||||||
|
#define MSM8916_H_
|
||||||
|
|
||||||
|
#endif // MSM8916_H_
|
@ -3,6 +3,16 @@
|
|||||||
* Copyright (c) 2022, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
|
* Copyright (c) 2022, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
|
||||||
*/
|
*/
|
||||||
#include <lib/debug.h>
|
#include <lib/debug.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
/* TODO: Import libc */
|
||||||
|
void writel(unsigned int value, void* address) {
|
||||||
|
// Cast the address pointer to a 32-bit unsigned integer pointer
|
||||||
|
volatile unsigned int* ptr = (volatile unsigned int*)address;
|
||||||
|
|
||||||
|
// Write the value to the memory location
|
||||||
|
*ptr = value;
|
||||||
|
}
|
||||||
|
|
||||||
void printk(char *text) {
|
void printk(char *text) {
|
||||||
#ifdef CONFIG_SIMPLE_FB
|
#ifdef CONFIG_SIMPLE_FB
|
||||||
@ -16,3 +26,22 @@ void printk(char *text) {
|
|||||||
debug_linecount++;
|
debug_linecount++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __aarch64__
|
||||||
|
/* Define our own 128 bit memcpy */
|
||||||
|
void memcpy(void *dest, void *src, size_t size)
|
||||||
|
{
|
||||||
|
unsigned __int128 *src2 = src;
|
||||||
|
unsigned __int128 *dest2 = dest;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < size / 16; i++)
|
||||||
|
dest2[i] = src2[i];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __arm__
|
||||||
|
void memcpy (char* src, char* dest, size_t len) {
|
||||||
|
for (size_t i = 0; i < len; i++)
|
||||||
|
dest[i] = src[i];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <lib/simplefb.h>
|
#include <lib/simplefb.h>
|
||||||
#include <lib/font.h>
|
#include <lib/font.h>
|
||||||
|
|
||||||
void clean_fb(volatile char *fb, char *text, int width, int height, int stride) {
|
void clean_fb(volatile char *fb, int width, int height, int stride) {
|
||||||
for (volatile char *addr = fb; addr < fb + (width * height * stride); addr += stride)
|
for (volatile char *addr = fb; addr < fb + (width * height * stride); addr += stride)
|
||||||
*(int*) (addr) = 0x0;
|
*(int*) (addr) = 0x0;
|
||||||
}
|
}
|
||||||
|
15
main/main.c
15
main/main.c
@ -6,9 +6,12 @@
|
|||||||
#include <main.h>
|
#include <main.h>
|
||||||
|
|
||||||
void main(void* dt, void* kernel) {
|
void main(void* dt, void* kernel) {
|
||||||
/* C entry */
|
|
||||||
|
|
||||||
/* Initialize SoC and Board specific peripherals/quirks */
|
/* Initialize SoC and Board specific peripherals/quirks */
|
||||||
|
|
||||||
|
/* TODO: Find a better way to make this more universal (since devices like arm64 Samsung Galaxies enable FB after soc_init) */
|
||||||
|
#ifdef CONFIG_SIMPLE_FB
|
||||||
|
clean_fb((char*)CONFIG_FRAMEBUFFER_BASE, CONFIG_FRAMEBUFFER_WIDTH, CONFIG_FRAMEBUFFER_HEIGHT, CONFIG_FRAMEBUFFER_STRIDE);
|
||||||
|
#endif
|
||||||
soc_init();
|
soc_init();
|
||||||
printk("soc_init() passed!");
|
printk("soc_init() passed!");
|
||||||
|
|
||||||
@ -17,6 +20,10 @@ void main(void* dt, void* kernel) {
|
|||||||
|
|
||||||
/* Copy kernel to memory and boot */
|
/* Copy kernel to memory and boot */
|
||||||
printk("Booting linux...");
|
printk("Booting linux...");
|
||||||
__builtin_memcpy((void*)CONFIG_PAYLOAD_ENTRY, kernel, (unsigned long) &kernel_size);
|
|
||||||
load_kernel(dt, 0, 0, 0, (void*)CONFIG_PAYLOAD_ENTRY);
|
memcpy((void*)CONFIG_PAYLOAD_ENTRY, kernel, (unsigned long) &kernel_size);
|
||||||
|
load_kernel(dt, 0, 0, 0, (void*)CONFIG_PAYLOAD_ENTRY);
|
||||||
|
|
||||||
|
/* We shouldn't get there */
|
||||||
|
while(1) {}
|
||||||
}
|
}
|
||||||
|
11
soc/Kconfig
11
soc/Kconfig
@ -6,6 +6,10 @@ config EXYNOS
|
|||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config QUALCOMM
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "SoC Support"
|
prompt "SoC Support"
|
||||||
|
|
||||||
@ -43,5 +47,12 @@ choice
|
|||||||
select EXYNOS
|
select EXYNOS
|
||||||
help
|
help
|
||||||
Say Y if your device uses Samsung Exynos9810 SoC
|
Say Y if your device uses Samsung Exynos9810 SoC
|
||||||
|
|
||||||
|
config QC32_8916
|
||||||
|
bool "Support for QUALCOMM MSM8916"
|
||||||
|
default n
|
||||||
|
select QUALCOMM
|
||||||
|
help
|
||||||
|
Say Y if your device uses this Qualcomm SoC
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
|
@ -3,3 +3,4 @@ lib-$(CONFIG_EXYNOS_7420) += exynos/exynos7420.o
|
|||||||
lib-$(CONFIG_EXYNOS_7885) += exynos/exynos7885.o
|
lib-$(CONFIG_EXYNOS_7885) += exynos/exynos7885.o
|
||||||
lib-$(CONFIG_EXYNOS_8895) += exynos/exynos8895.o
|
lib-$(CONFIG_EXYNOS_8895) += exynos/exynos8895.o
|
||||||
lib-$(CONFIG_EXYNOS_9810) += exynos/exynos9810.o
|
lib-$(CONFIG_EXYNOS_9810) += exynos/exynos9810.o
|
||||||
|
lib-$(CONFIG_QC32_8916) += qualcomm/msm8916.o
|
||||||
|
10
soc/qualcomm/msm8916.c
Normal file
10
soc/qualcomm/msm8916.c
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <soc/msm8916.h>
|
||||||
|
|
||||||
|
void soc_init(void) {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user