mirror of
https://gitee.com/open-loongarch/u-boot.git
synced 2026-10-25 12:57:10 +08:00
Update to 2c60245b2bb
1.drivers/mmc:ls_mmc:Enhance compatibiltiy 2.mmc:support HS200 3.support boot abi2.0 kernel(linux 6.9 have be tested) 4.update set_env.sh 5.some bugs fix
This commit is contained in:
@@ -10,10 +10,17 @@
|
|||||||
64bit-bfd := elf64-loongarch
|
64bit-bfd := elf64-loongarch
|
||||||
|
|
||||||
ifdef CONFIG_64BIT
|
ifdef CONFIG_64BIT
|
||||||
PLATFORM_CPPFLAGS += -mabi=lp64
|
ifneq ($(CONFIG_GCC_VERSION), $(firstword $(shell echo "130000 $(CONFIG_GCC_VERSION)" | tr ' ' '\n' | sort -n)))
|
||||||
KBUILD_LDFLAGS += -m $(64bit-emul)
|
PLATFORM_CPPFLAGS += $(call cc-option, -mabi-lp64d)
|
||||||
OBJCOPYFLAGS += -O $(64bit-bfd)
|
PLATFORM_CPPFLAGS += $(call cc-option, -fpermissive)
|
||||||
CONFIG_STANDALONE_LOAD_ADDR ?= 0x9000000080200000
|
PLATFORM_CPPFLAGS += $(call cc-option, -mno-relax)
|
||||||
|
KBUILD_LDFLAGS += --no-warn-rwx-segments
|
||||||
|
else
|
||||||
|
PLATFORM_CPPFLAGS += $(call cc-option, -mabi-lp64)
|
||||||
|
endif
|
||||||
|
KBUILD_LDFLAGS += -m $(64bit-emul)
|
||||||
|
OBJCOPYFLAGS += -O $(64bit-bfd)
|
||||||
|
CONFIG_STANDALONE_LOAD_ADDR ?= 0x9000000080200000
|
||||||
else
|
else
|
||||||
PLATFORM_CPPFLAGS += -mabi=lp32
|
PLATFORM_CPPFLAGS += -mabi=lp32
|
||||||
KBUILD_LDFLAGS += -m $(32bit-emul)
|
KBUILD_LDFLAGS += -m $(32bit-emul)
|
||||||
|
|||||||
+80
-13
@@ -14,6 +14,8 @@
|
|||||||
#include <asm/addrspace.h>
|
#include <asm/addrspace.h>
|
||||||
#include <asm/global_data.h>
|
#include <asm/global_data.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <dm.h>
|
||||||
|
|
||||||
#if defined(CONFIG_LOONGSON_BOOT_FIXUP)
|
#if defined(CONFIG_LOONGSON_BOOT_FIXUP)
|
||||||
extern void *build_boot_param(void);
|
extern void *build_boot_param(void);
|
||||||
@@ -28,6 +30,9 @@ static int linux_argc;
|
|||||||
static char **linux_argv;
|
static char **linux_argv;
|
||||||
static char *linux_argp;
|
static char *linux_argp;
|
||||||
|
|
||||||
|
// 新的传参规范里面无需把 command line 拆开成一个一个 直接字符串传进去就好
|
||||||
|
static char *linux_command_line;
|
||||||
|
|
||||||
static char **linux_env;
|
static char **linux_env;
|
||||||
static char *linux_env_p;
|
static char *linux_env_p;
|
||||||
static int linux_env_idx;
|
static int linux_env_idx;
|
||||||
@@ -256,13 +261,52 @@ static void boot_prep_linux(bootm_headers_t *images)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 判断使用哪种传参方式
|
||||||
|
* 0 代表旧的传参
|
||||||
|
* 1 代表新的传参
|
||||||
|
*/
|
||||||
|
static int judge_boot_param_type(bootm_headers_t *images)
|
||||||
|
{
|
||||||
|
char* kernel_type;
|
||||||
|
kernel_type = image_get_name(images->legacy_hdr_os);
|
||||||
|
|
||||||
|
if (!strncmp(kernel_type, "Linux-5", 7))
|
||||||
|
return 0;
|
||||||
|
else if (!strncmp(kernel_type, "Linux-4", 7))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char* boot_smbios_type2_board_name(void)
|
||||||
|
{
|
||||||
|
struct udevice *dev;
|
||||||
|
ofnode parent_node, node;
|
||||||
|
|
||||||
|
const char* board_name = NULL;
|
||||||
|
uclass_first_device(UCLASS_SYSINFO, &dev);
|
||||||
|
if (dev) {
|
||||||
|
parent_node = dev_read_subnode(dev, "smbios");
|
||||||
|
if (!ofnode_valid(parent_node))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
node = ofnode_find_subnode(parent_node, "baseboard");
|
||||||
|
if (!ofnode_valid(node))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
board_name = ofnode_read_string(node, "product");
|
||||||
|
}
|
||||||
|
return board_name;
|
||||||
|
}
|
||||||
|
|
||||||
static void boot_jump_linux(bootm_headers_t *images)
|
static void boot_jump_linux(bootm_headers_t *images)
|
||||||
{
|
{
|
||||||
typedef void __noreturn (*kernel_entry_t)(int, ulong, ulong, ulong);
|
typedef void __noreturn (*kernel_entry_t)(int, ulong, ulong, ulong);
|
||||||
kernel_entry_t kernel = (kernel_entry_t)map_to_sysmem((void*)images->ep);
|
kernel_entry_t kernel = (kernel_entry_t)map_to_sysmem((void*)images->ep);
|
||||||
#if defined(CONFIG_LOONGSON_BOOT_FIXUP)
|
#if defined(CONFIG_LOONGSON_BOOT_FIXUP)
|
||||||
void *fw_arg2 = NULL, *fw_arg3 = NULL;
|
void *fw_arg2 = NULL, *fw_arg3 = NULL;
|
||||||
void *fdt = NULL, *bootparam = NULL;
|
void *bootparam = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
debug("## Transferring control to Linux (at address %p) ...\n", kernel);
|
debug("## Transferring control to Linux (at address %p) ...\n", kernel);
|
||||||
@@ -277,21 +321,44 @@ static void boot_jump_linux(bootm_headers_t *images)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_LOONGSON_BOOT_FIXUP)
|
#if defined(CONFIG_LOONGSON_BOOT_FIXUP)
|
||||||
fdt = env_get("fdt_addr");
|
bootparam = build_boot_param();
|
||||||
if (fdt) {
|
if (judge_boot_param_type(images)) {
|
||||||
fdt = (void *)simple_strtoul(fdt, NULL, 16);
|
int i;
|
||||||
if (fdt_check_header(fdt)) {
|
const char* board_name;
|
||||||
printf("Warning: invalid device tree. Used linux default dtb\n");
|
// 见于 龙芯CPU统一系统架构规范(LA架构嵌入式系列).pdf 的 4.1 传参约定 一节
|
||||||
fdt = NULL;
|
fw_arg2 = (void*)(*(unsigned long long *)(bootparam + 8));
|
||||||
|
board_name = boot_smbios_type2_board_name();
|
||||||
|
|
||||||
|
// 新的传参规范里面无需把 command line 拆开成一个一个 直接字符串传进去就好
|
||||||
|
// 下标 0 的元素必定为 NULL 无视即可
|
||||||
|
linux_command_line = (char*)calloc(256, sizeof(char));
|
||||||
|
sprintf(linux_command_line, "%s", linux_argv[1]);
|
||||||
|
for (i = 2; i < linux_argc; ++i) {
|
||||||
|
sprintf(linux_command_line, "%s %s", linux_command_line, linux_argv[i]);
|
||||||
}
|
}
|
||||||
|
// 把要匹配的板卡名字放到 command line 里面
|
||||||
|
sprintf(linux_command_line, "%s bp_start=0x%.llx", linux_command_line, (unsigned long long)bootparam);
|
||||||
|
if (board_name)
|
||||||
|
sprintf(linux_command_line, "%s board_name=%s", linux_command_line, board_name);
|
||||||
|
|
||||||
|
kernel(0, (ulong)linux_command_line, (ulong)fw_arg2, (ulong)fw_arg3);
|
||||||
|
} else {
|
||||||
|
void *fdt = NULL;
|
||||||
|
fdt = env_get("fdt_addr");
|
||||||
|
if (fdt) {
|
||||||
|
fdt = (void *)simple_strtoul(fdt, NULL, 16);
|
||||||
|
if (fdt_check_header(fdt)) {
|
||||||
|
printf("Warning: invalid device tree. Used linux default dtb\n");
|
||||||
|
fdt = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fw_arg2 = bootparam;
|
||||||
|
fw_arg3 = fdt;
|
||||||
|
|
||||||
|
kernel(linux_argc, (ulong)linux_argv, (ulong)fw_arg2, (ulong)fw_arg3);
|
||||||
}
|
}
|
||||||
|
|
||||||
bootparam = build_boot_param();
|
|
||||||
fw_arg2 = bootparam;
|
|
||||||
fw_arg3 = fdt;
|
|
||||||
|
|
||||||
kernel(linux_argc, (ulong)linux_argv, (ulong)fw_arg2,
|
|
||||||
(ulong)fw_arg3);
|
|
||||||
#else
|
#else
|
||||||
if (images->ft_len) {
|
if (images->ft_len) {
|
||||||
kernel(-2, (ulong)images->ft_addr, 0, 0);
|
kernel(-2, (ulong)images->ft_addr, 0, 0);
|
||||||
|
|||||||
@@ -55,14 +55,14 @@ void __noreturn board_init_f(ulong dummy)
|
|||||||
ulong new_sp;
|
ulong new_sp;
|
||||||
|
|
||||||
#ifdef DBG_ASM
|
#ifdef DBG_ASM
|
||||||
printstr("Enter board_init_f...\r\n");
|
printf("Enter board_init_f...\r\n");
|
||||||
#endif
|
#endif
|
||||||
spl_mach_init();
|
spl_mach_init();
|
||||||
ret = spl_early_init();
|
ret = spl_early_init();
|
||||||
if (ret) {
|
if (ret) {
|
||||||
debug("spl_early_init() failed: %d\n", ret);
|
debug("spl_early_init() failed: %d\n", ret);
|
||||||
#ifdef DBG_ASM
|
#ifdef DBG_ASM
|
||||||
printstr("spl_early_init() failed.\r\n");
|
printf("spl_early_init() failed.\r\n");
|
||||||
#endif
|
#endif
|
||||||
hang();
|
hang();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,4 +60,8 @@ config LOONGSON_BOARD_MMC_FS
|
|||||||
default n
|
default n
|
||||||
select CMD_UNZIP
|
select CMD_UNZIP
|
||||||
|
|
||||||
|
config LOONGSON_MMC_HIGH_PERFORMANCE
|
||||||
|
bool "Change MMC-PAD to 0x7, will support HS200 mode"
|
||||||
|
default n
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
#include <command.h>
|
||||||
#include <asm/addrspace.h>
|
#include <asm/addrspace.h>
|
||||||
#include <smbios.h>
|
#include <smbios.h>
|
||||||
#include <dm/device.h>
|
#include <dm/device.h>
|
||||||
@@ -19,9 +20,10 @@
|
|||||||
|
|
||||||
#if defined(BOOT_PARAMS_BPI)
|
#if defined(BOOT_PARAMS_BPI)
|
||||||
|
|
||||||
#ifdef ACPI_SUPPORT
|
// 无需一定要有 ACPI
|
||||||
const efi_guid_t smbios_guid = SMBIOS_TABLE_GUID;
|
// #ifdef ACPI_SUPPORT
|
||||||
#endif
|
// const efi_guid_t smbios_guid = SMBIOS_TABLE_GUID;
|
||||||
|
// #endif
|
||||||
|
|
||||||
extern struct efi_system_table systab;
|
extern struct efi_system_table systab;
|
||||||
extern efi_status_t efi_init_systab(void);
|
extern efi_status_t efi_init_systab(void);
|
||||||
@@ -134,13 +136,16 @@ u64 init_vbios(struct boot_params *bp, u64 offset)
|
|||||||
|
|
||||||
void loongson_smbios_init(void)
|
void loongson_smbios_init(void)
|
||||||
{
|
{
|
||||||
|
const efi_guid_t smbios_guid = SMBIOS_TABLE_GUID;
|
||||||
|
|
||||||
write_smbios_table((ulong)SMBIOS_PHYSICAL_ADDRESS);
|
write_smbios_table((ulong)SMBIOS_PHYSICAL_ADDRESS);
|
||||||
|
|
||||||
#ifdef ACPI_SUPPORT
|
// 无需一定要有 ACPI
|
||||||
|
// #ifdef ACPI_SUPPORT
|
||||||
/* And expose them to our EFI payload */
|
/* And expose them to our EFI payload */
|
||||||
return efi_install_configuration_table(&smbios_guid,
|
efi_install_configuration_table(&smbios_guid,
|
||||||
(void *)SMBIOS_PHYSICAL_ADDRESS);
|
(void *)SMBIOS_PHYSICAL_ADDRESS);
|
||||||
#endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ACPI_SUPPORT
|
#ifdef ACPI_SUPPORT
|
||||||
@@ -156,6 +161,24 @@ void loongson_acpi_init(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void loongson_fdt_init(void)
|
||||||
|
{
|
||||||
|
// 新的传参规范里面 可以把 fdt 放在 efi table 里面
|
||||||
|
const efi_guid_t fdt_guid = EFI_FDT_GUID;
|
||||||
|
void* fdt = (void*)env_get("fdt_addr");
|
||||||
|
if (fdt) {
|
||||||
|
fdt = (void *)simple_strtoul(fdt, NULL, 16);
|
||||||
|
if (fdt_check_header(fdt)) {
|
||||||
|
printf("Warning: invalid device tree. Used linux default dtb\n");
|
||||||
|
fdt = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fdt)
|
||||||
|
efi_install_configuration_table(&fdt_guid,
|
||||||
|
(void *)fdt);
|
||||||
|
}
|
||||||
|
|
||||||
int init_boot_param(struct boot_params *bp)
|
int init_boot_param(struct boot_params *bp)
|
||||||
{
|
{
|
||||||
u64 __maybe_unused tab_offset = sizeof(struct boot_params);
|
u64 __maybe_unused tab_offset = sizeof(struct boot_params);
|
||||||
@@ -184,6 +207,7 @@ int init_boot_param(struct boot_params *bp)
|
|||||||
#ifdef ACPI_SUPPORT
|
#ifdef ACPI_SUPPORT
|
||||||
loongson_acpi_init();
|
loongson_acpi_init();
|
||||||
#endif
|
#endif
|
||||||
|
loongson_fdt_init();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ enum efi_table_id {
|
|||||||
MAX_EFI_TABLES,
|
MAX_EFI_TABLES,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 给16个efi table(不够可以加) 目前就 FDT SMBIOS ACPI
|
||||||
|
struct efi_configuration_table efi_tables[16];
|
||||||
|
|
||||||
static struct efi_boot_services efi_boot_services = {
|
static struct efi_boot_services efi_boot_services = {
|
||||||
.hdr = {
|
.hdr = {
|
||||||
.signature = EFI_BOOT_SERVICES_SIGNATURE,
|
.signature = EFI_BOOT_SERVICES_SIGNATURE,
|
||||||
@@ -37,6 +40,14 @@ struct efi_runtime_services efi_runtime_services = {
|
|||||||
|
|
||||||
static u16 firmware_vendor[] = L"LoongSon";
|
static u16 firmware_vendor[] = L"LoongSon";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 由于 EFI 在 uboot 里面只有 x86 做了完善
|
||||||
|
* 所以 这些 efi 的 table 由此处自行实现
|
||||||
|
* 然后由于 tables 这个变量是需要手动赋值的
|
||||||
|
* 以前的 NULL 是会导致写入崩溃的
|
||||||
|
* 所以自行创建 efi_tables
|
||||||
|
*/
|
||||||
|
|
||||||
struct efi_system_table systab = {
|
struct efi_system_table systab = {
|
||||||
.hdr = {
|
.hdr = {
|
||||||
.signature = EFI_SYSTEM_TABLE_SIGNATURE,
|
.signature = EFI_SYSTEM_TABLE_SIGNATURE,
|
||||||
@@ -47,7 +58,7 @@ struct efi_system_table systab = {
|
|||||||
.fw_revision = FW_VERSION << 16 | FW_PATCHLEVEL << 8,
|
.fw_revision = FW_VERSION << 16 | FW_PATCHLEVEL << 8,
|
||||||
.runtime = 0,
|
.runtime = 0,
|
||||||
.nr_tables = 0,
|
.nr_tables = 0,
|
||||||
.tables = NULL,
|
.tables = efi_tables,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ static char *updatemenu_dtb[] = {
|
|||||||
"Update DTB (dtb.bin) to spi flash (by mmc)=loongson_update mmc dtb\0",
|
"Update DTB (dtb.bin) to spi flash (by mmc)=loongson_update mmc dtb\0",
|
||||||
#endif
|
#endif
|
||||||
"Update DTB (dtb.bin) to spi flash (by tftp)=loongson_update tftp dtb\0",
|
"Update DTB (dtb.bin) to spi flash (by tftp)=loongson_update tftp dtb\0",
|
||||||
"Clean DTB parts=sf probe;sf erase dtb 0x10000\0",
|
"Clean DTB parts=mtd erase dtb\0",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -609,6 +609,8 @@ void abort_key_handle_custom(int abort)
|
|||||||
abort_key_try_update_uboot_then_install_system,
|
abort_key_try_update_uboot_then_install_system,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mdelay(2000);
|
||||||
|
|
||||||
if (abort < 0 || abort >= sizeof(func_set) / sizeof(abort_key_handle_func))
|
if (abort < 0 || abort >= sizeof(func_set) / sizeof(abort_key_handle_func))
|
||||||
return;
|
return;
|
||||||
ret = func_set[abort]();
|
ret = func_set[abort]();
|
||||||
|
|||||||
@@ -81,7 +81,13 @@ static void dev_fixup(void)
|
|||||||
|
|
||||||
//enhance the io driving force
|
//enhance the io driving force
|
||||||
val = readl(LS_GENERAL_CFG4);
|
val = readl(LS_GENERAL_CFG4);
|
||||||
|
// MMC 高驱动力下可到 hs200
|
||||||
|
#ifdef CONFIG_LOONGSON_MMC_HIGH_PERFORMANCE
|
||||||
|
val |= (0x3 << PAD_CTRL_DVO) | (0x3 << PAD_CTRL_GMAC) | (0x3 << PAD_CTRL_USB)
|
||||||
|
| (0x7 << PAD_CTRL_EMMC) | (0x7 << PAD_CTRL_SDIO);
|
||||||
|
#else
|
||||||
val |= (0x3 << PAD_CTRL_DVO) | (0x3 << PAD_CTRL_GMAC) | (0x3 << PAD_CTRL_USB);
|
val |= (0x3 << PAD_CTRL_DVO) | (0x3 << PAD_CTRL_GMAC) | (0x3 << PAD_CTRL_USB);
|
||||||
|
#endif
|
||||||
writel(val, LS_GENERAL_CFG4);
|
writel(val, LS_GENERAL_CFG4);
|
||||||
|
|
||||||
// All UARTs in 2 wire mode
|
// All UARTs in 2 wire mode
|
||||||
|
|||||||
+2
-1
@@ -583,7 +583,8 @@ static int cmd_call(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum command_ret_t cmd_process(int flag, int argc, char *const argv[],
|
// enum command_ret_t
|
||||||
|
int cmd_process(int flag, int argc, char *const argv[],
|
||||||
int *repeatable, ulong *ticks)
|
int *repeatable, ulong *ticks)
|
||||||
{
|
{
|
||||||
enum command_ret_t rc = CMD_RET_SUCCESS;
|
enum command_ret_t rc = CMD_RET_SUCCESS;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ CONFIG_CPU_1000MHZ=y
|
|||||||
CONFIG_LOONGSON_RECOVER=y
|
CONFIG_LOONGSON_RECOVER=y
|
||||||
CONFIG_LOONGSON_GENERAL_LOAD=y
|
CONFIG_LOONGSON_GENERAL_LOAD=y
|
||||||
CONFIG_LOONGSON_BOARD_MMC_FS=y
|
CONFIG_LOONGSON_BOARD_MMC_FS=y
|
||||||
|
CONFIG_LOONGSON_MMC_HIGH_PERFORMANCE=y
|
||||||
CONFIG_SPL_PAYLOAD="u-boot.img"
|
CONFIG_SPL_PAYLOAD="u-boot.img"
|
||||||
CONFIG_PHYS_64BIT=y
|
CONFIG_PHYS_64BIT=y
|
||||||
CONFIG_SYS_LOAD_ADDR=0x9000000003000000
|
CONFIG_SYS_LOAD_ADDR=0x9000000003000000
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ CONFIG_CPU_1000MHZ=y
|
|||||||
CONFIG_LOONGSON_RECOVER=y
|
CONFIG_LOONGSON_RECOVER=y
|
||||||
CONFIG_LOONGSON_GENERAL_LOAD=y
|
CONFIG_LOONGSON_GENERAL_LOAD=y
|
||||||
CONFIG_LOONGSON_BOARD_MMC_FS=y
|
CONFIG_LOONGSON_BOARD_MMC_FS=y
|
||||||
|
CONFIG_LOONGSON_MMC_HIGH_PERFORMANCE=y
|
||||||
CONFIG_SPL_PAYLOAD="u-boot.img"
|
CONFIG_SPL_PAYLOAD="u-boot.img"
|
||||||
CONFIG_PHYS_64BIT=y
|
CONFIG_PHYS_64BIT=y
|
||||||
CONFIG_SYS_LOAD_ADDR=0x9000000003000000
|
CONFIG_SYS_LOAD_ADDR=0x9000000003000000
|
||||||
|
|||||||
@@ -290,6 +290,10 @@ static int sdio_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, struct mmc_da
|
|||||||
sdio_writel(host, SDICMDARG, cmd->cmdarg);
|
sdio_writel(host, SDICMDARG, cmd->cmdarg);
|
||||||
sdio_writel(host, SDICMDCON, SDIO_MAKE_CMD(cmd_index, flag));
|
sdio_writel(host, SDICMDCON, SDIO_MAKE_CMD(cmd_index, flag));
|
||||||
|
|
||||||
|
// 部分EMMC芯片需要延迟
|
||||||
|
// 否则指令发送频率一高会有数据传输问题
|
||||||
|
udelay(1);
|
||||||
|
|
||||||
while ((cmd_fin == 0) && timeout--) {
|
while ((cmd_fin == 0) && timeout--) {
|
||||||
sdiintmsk = sdio_readl(host, SDIINTMSK);
|
sdiintmsk = sdio_readl(host, SDIINTMSK);
|
||||||
cmd_fin = SDIO_GET_CMDINT(sdiintmsk);
|
cmd_fin = SDIO_GET_CMDINT(sdiintmsk);
|
||||||
@@ -345,6 +349,7 @@ out:
|
|||||||
sdio_writel(host, SDIINTMSK, (sdiintmsk & 0x1fe));
|
sdio_writel(host, SDIINTMSK, (sdiintmsk & 0x1fe));
|
||||||
|
|
||||||
sdio_writel(host, SDIINTEN, 0x0);
|
sdio_writel(host, SDIINTEN, 0x0);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -248,24 +248,24 @@ void mm_feature_init(struct mc_setting *mc)
|
|||||||
mm_ctrl_info.paster.mc1_row_num = MC1_ROW_NUM;
|
mm_ctrl_info.paster.mc1_row_num = MC1_ROW_NUM;
|
||||||
mm_ctrl_info.paster.mc1_addr_mirror = MC1_ADDR_MIRROR;
|
mm_ctrl_info.paster.mc1_addr_mirror = MC1_ADDR_MIRROR;
|
||||||
mm_ctrl_info.paster.mc1_bg_mirror = MC1_BG_MIRROR;
|
mm_ctrl_info.paster.mc1_bg_mirror = MC1_BG_MIRROR;
|
||||||
mm_ctrl_info.param_reg_array = ¶m_info;
|
mm_ctrl_info.param_reg_array = param_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_mm_ctrl()
|
void print_mm_ctrl(void)
|
||||||
{
|
{
|
||||||
printf("=================================================================================\n");
|
printf("=================================================================================\n");
|
||||||
printf(" mc_type:%u\n", mm_ctrl_info.mc_type);
|
printf(" mc_type:%u\n", mm_ctrl_info.mc_type);
|
||||||
printf(" mc_regs_base:%llu\n", mm_ctrl_info.mc_regs_base);
|
printf(" mc_regs_base:%llu\n", mm_ctrl_info.mc_regs_base);
|
||||||
printf(" cache_mem_base:%llu\n", mm_ctrl_info.cache_mem_base);
|
printf(" cache_mem_base:%llu\n", mm_ctrl_info.cache_mem_base);
|
||||||
printf(" mem_base:%llu\n", mm_ctrl_info.mem_base);
|
printf(" mem_base:%llu\n", mm_ctrl_info.mem_base);
|
||||||
printf(" ddr_freq:%lu\n", mm_ctrl_info.ddr_freq);
|
printf(" ddr_freq:%llu\n", mm_ctrl_info.ddr_freq);
|
||||||
printf(" ddr_freq_2slot:%lu\n", mm_ctrl_info.ddr_freq_2slot);
|
printf(" ddr_freq_2slot:%llu\n", mm_ctrl_info.ddr_freq_2slot);
|
||||||
printf(" dimm_info_in_flash_offset:%lu\n", mm_ctrl_info.dimm_info_in_flash_offset);
|
printf(" dimm_info_in_flash_offset:%llu\n", mm_ctrl_info.dimm_info_in_flash_offset);
|
||||||
printf(" sameba_adj:%lu\n", mm_ctrl_info.sameba_adj);
|
printf(" sameba_adj:%llu\n", mm_ctrl_info.sameba_adj);
|
||||||
printf(" samebg_adj:%lu\n", mm_ctrl_info.samebg_adj);
|
printf(" samebg_adj:%llu\n", mm_ctrl_info.samebg_adj);
|
||||||
printf(" samec_adj:%lu\n", mm_ctrl_info.samec_adj);
|
printf(" samec_adj:%llu\n", mm_ctrl_info.samec_adj);
|
||||||
printf(" samecs_adj:%lu\n", mm_ctrl_info.samecs_adj);
|
printf(" samecs_adj:%llu\n", mm_ctrl_info.samecs_adj);
|
||||||
printf(" diffcs_adj:%lu\n", mm_ctrl_info.diffcs_adj);
|
printf(" diffcs_adj:%llu\n", mm_ctrl_info.diffcs_adj);
|
||||||
printf(" mc_interleave_offset:%llu\n", mm_ctrl_info.mc_interleave_offset);
|
printf(" mc_interleave_offset:%llu\n", mm_ctrl_info.mc_interleave_offset);
|
||||||
printf(" ref_clk:%u\n", mm_ctrl_info.ref_clk);
|
printf(" ref_clk:%u\n", mm_ctrl_info.ref_clk);
|
||||||
printf("node_offset:%u\n", mm_ctrl_info.node_offset);
|
printf("node_offset:%u\n", mm_ctrl_info.node_offset);
|
||||||
|
|||||||
@@ -419,9 +419,12 @@ static int ls_dc_init(struct ls_video_priv *priv)
|
|||||||
|
|
||||||
static int ls_read_edid(struct ls_video_priv *priv, int block, u8 *buf)
|
static int ls_read_edid(struct ls_video_priv *priv, int block, u8 *buf)
|
||||||
{
|
{
|
||||||
|
int ret = 0;
|
||||||
|
#if defined(CONFIG_DM_I2C)
|
||||||
int shift = block * EDID_SIZE;
|
int shift = block * EDID_SIZE;
|
||||||
struct udevice *chip;
|
struct udevice *chip;
|
||||||
int ret;
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_VIDEO_BRIDGE
|
#ifdef CONFIG_VIDEO_BRIDGE
|
||||||
if (priv->conn_type == LS_CONNECTOR_BRIDGE) {
|
if (priv->conn_type == LS_CONNECTOR_BRIDGE) {
|
||||||
ret = video_bridge_read_edid(priv->connector, buf, EDID_SIZE);
|
ret = video_bridge_read_edid(priv->connector, buf, EDID_SIZE);
|
||||||
@@ -441,7 +444,7 @@ static int ls_read_edid(struct ls_video_priv *priv, int block, u8 *buf)
|
|||||||
return dm_i2c_read(chip, shift, buf, EDID_SIZE);
|
return dm_i2c_read(chip, shift, buf, EDID_SIZE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int ls_fill_display_timing_by_name(struct display_timing* timing, char* name);
|
extern int ls_fill_display_timing_by_name(struct display_timing* timing, char* name);
|
||||||
|
|||||||
@@ -124,7 +124,11 @@ PLATFORM_LIBS := $(filter-out %/lib.a, $(filter-out -lgcc, $(PLATFORM_LIBS))) $(
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef CONFIG_LOONGSON_DDR4
|
ifdef CONFIG_LOONGSON_DDR4
|
||||||
PLATFORM_LIBS += -L $(abspath $(srctree)/drivers/ram/loongson/) -lmem_config
|
ifneq ($(CONFIG_GCC_VERSION), $(firstword $(shell echo "130000 $(CONFIG_GCC_VERSION)" | tr ' ' '\n' | sort -n)))
|
||||||
|
PLATFORM_LIBS += $(abspath $(srctree)/drivers/ram/loongson/libmem_config_new_abi.a)
|
||||||
|
else
|
||||||
|
PLATFORM_LIBS += $(abspath $(srctree)/drivers/ram/loongson/libmem_config.a)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
u-boot-spl-init := $(head-y)
|
u-boot-spl-init := $(head-y)
|
||||||
|
|||||||
+40
-31
@@ -1,52 +1,61 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# AUTHOR: maoxiaochuan@loongson.cn
|
|
||||||
# Date: 2021-12-3
|
|
||||||
# ORG: Loongson-GD
|
|
||||||
|
|
||||||
#set -x
|
#set -x
|
||||||
|
|
||||||
function setup_mips_env()
|
abi1_toolchain_list=("/opt/loongson-gnu-toolchain-x86_64-loongarch64-linux-gnu" \
|
||||||
{
|
"/opt/loongson-gnu-toolchain-8.3-x86_64-loongarch64-linux-gnu-rc1.4" \
|
||||||
echo "====>setup env for MIPS..."
|
"/opt/loongson-gnu-toolchain-8.3-x86_64-loongarch64-linux-gnu-rc1.3-1" \
|
||||||
CC_PREFIX=/opt/mips64el-linux-gcc-8.x/host
|
"/opt/loongson-gnu-toolchain-8.3-x86_64-loongarch64-linux-gnu-rc1.2" \
|
||||||
export PATH=$CC_PREFIX/bin:$PATH
|
"/opt/toolchain-loongarch64-linux-gnu-gcc8-host-x86_64-2022-07-18")
|
||||||
export LD_LIBRARY_PATH=$CC_PREFIX/lib:$LD_LIBRARY_PATH
|
|
||||||
export LD_LIBRARY_PATH=$CC_PREFIX/mips64el-buildroot-linux-gnu/lib64:$LD_LIBRARY_PATH
|
|
||||||
|
|
||||||
# CC_PREFIX=/opt/mips-loongson-gcc8-linux-gnu-2021-06-04
|
|
||||||
# export PATH=$CC_PREFIX/bin:$PATH
|
|
||||||
# export LD_LIBRARY_PATH=$CC_PREFIX/lib:$LD_LIBRARY_PATH
|
|
||||||
|
|
||||||
export ARCH=mips
|
|
||||||
# export CROSS_COMPILE=mips-linux-gnu-
|
|
||||||
export CROSS_COMPILE=mips64el-linux-
|
|
||||||
}
|
|
||||||
|
|
||||||
|
abi2_toolchain_list=("/opt/loongarch64-linux-gnu-gcc13.3" \
|
||||||
|
"/opt/loongarch64-linux-gnu-gcc14.2")
|
||||||
|
|
||||||
|
real_target=0
|
||||||
|
real_toolchain=""
|
||||||
|
|
||||||
function setup_loongarch_env()
|
function setup_loongarch_env()
|
||||||
{
|
{
|
||||||
echo "====>setup env for LoongArch..."
|
echo "====>setup env for LoongArch..."
|
||||||
# CC_PREFIX=/opt/toolchain-loongarch64-linux-gnu-gcc8-host-x86_64-2022-07-18
|
CC_PREFIX=$real_toolchain
|
||||||
CC_PREFIX=/opt/loongson-gnu-toolchain-x86_64-loongarch64-linux-gnu
|
export PATH=$PATH:$CC_PREFIX/bin
|
||||||
export PATH=$CC_PREFIX/bin:$PATH
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CC_PREFIX/lib
|
||||||
export LD_LIBRARY_PATH=$CC_PREFIX/lib:$LD_LIBRARY_PATH
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CC_PREFIX/loongarch64-linux-gnu/lib64
|
||||||
export LD_LIBRARY_PATH=$CC_PREFIX/loongarch64-linux-gnu/lib64:$LD_LIBRARY_PATH
|
|
||||||
|
|
||||||
export ARCH=loongarch
|
export ARCH=loongarch
|
||||||
export CROSS_COMPILE=loongarch64-linux-gnu-
|
export CROSS_COMPILE=loongarch64-linux-gnu-
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for i in ${abi1_toolchain_list[*]}
|
||||||
|
do
|
||||||
|
real_toolchain=$i
|
||||||
|
if [ -d $real_toolchain ]; then
|
||||||
|
real_target=1
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
if [ $# -eq 1 ] ; then
|
if [ $# -eq 1 ] ; then
|
||||||
if [ "$1" == "mips" ]; then
|
if [[ "$1" == "abi2" ]]; then
|
||||||
setup_mips_env
|
real_target=0
|
||||||
else
|
real_toolchain=""
|
||||||
setup_loongarch_env
|
for i in ${abi2_toolchain_list[*]}
|
||||||
|
do
|
||||||
|
real_toolchain=$i
|
||||||
|
if [ -d $real_toolchain ]; then
|
||||||
|
real_target=1
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
setup_loongarch_env
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $real_target -eq 0 ]; then
|
||||||
|
echo "没有找到相关工具链的文件夹"
|
||||||
|
fi
|
||||||
|
echo "当前声明的工具链为:"
|
||||||
|
echo $real_toolchain
|
||||||
|
|
||||||
|
setup_loongarch_env
|
||||||
|
|
||||||
#set +x
|
#set +x
|
||||||
|
|||||||
Reference in New Issue
Block a user