71 lines
1.6 KiB
C
71 lines
1.6 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|||
|
|
/*
|
||
|
|
* Copyright 2023 Unisoc(Shanghai) Technologies Co., Ltd
|
||
|
|
*
|
||
|
|
* This program is free software; you can redistribute it and/or modify
|
||
|
|
* it under the terms of the GNU General Public License as published by
|
||
|
|
* the Free Software Foundation; version 2.
|
||
|
|
*
|
||
|
|
* This program is distributed in the hope that it will be useful,
|
||
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||
|
|
* See the GNU General Public License for more details.
|
||
|
|
*/
|
||
|
|
|
||
|
|
#include <common.h>
|
||
|
|
#include <command.h>
|
||
|
|
#include <boot_mode.h>
|
||
|
|
#include <lcd.h>
|
||
|
|
#include <vibra_common.h>
|
||
|
|
#include <logo_bin.h>
|
||
|
|
#include <sprd_splash.h>
|
||
|
|
#include <sprd_common.h>
|
||
|
|
#include <linux/delay.h>
|
||
|
|
#include "../test/memtest/memtest_interface.h"
|
||
|
|
|
||
|
|
static int do_memtest(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
|
||
|
|
{
|
||
|
|
static int once = 1;
|
||
|
|
ulong start_ads;
|
||
|
|
ulong test_len;
|
||
|
|
|
||
|
|
debugf("enter memtest\n");
|
||
|
|
if (once) {
|
||
|
|
once = 0;
|
||
|
|
#ifdef CONFIG_SPLASH_SCREEN
|
||
|
|
drv_lcd_init();
|
||
|
|
lcd_splash(LOGO_PART);
|
||
|
|
lcd_enable();
|
||
|
|
enable_vibra(true);
|
||
|
|
|
||
|
|
set_backlight(BACKLIGHT_ON);
|
||
|
|
mdelay(400);
|
||
|
|
enable_vibra(false);
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
|
||
|
|
enable_vibra(true);
|
||
|
|
mdelay(400);
|
||
|
|
enable_vibra(false);
|
||
|
|
|
||
|
|
if (argc == 1) {
|
||
|
|
ddr_memtester(0);
|
||
|
|
} else if (argc == 2) {
|
||
|
|
ddr_region_printf();
|
||
|
|
} else if (argc == 3) {
|
||
|
|
if (strict_strtoul(argv[1], 16, &start_ads) < 0)
|
||
|
|
return CMD_RET_USAGE;
|
||
|
|
|
||
|
|
if (strict_strtoul(argv[2], 16, &test_len) < 0)
|
||
|
|
return CMD_RET_USAGE;
|
||
|
|
|
||
|
|
ddr_manual_memtester(start_ads, test_len);
|
||
|
|
}
|
||
|
|
|
||
|
|
return CMD_RET_SUCCESS;
|
||
|
|
}
|
||
|
|
|
||
|
|
U_BOOT_CMD(memtest, 5, 0, do_memtest,
|
||
|
|
"RAM read/write test",
|
||
|
|
"memtest <start_address> <len>");
|