7 Commits

Author SHA1 Message Date
Han Gao
4b5e417342 riscv: dts: thead: downclock SD card for LPi4A
It's reported that @198MHz some R/W error will happen.

215f2c97bd.patch

Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2024-03-26 13:01:02 +00:00
Han Gao
ce1890d0dc fix: remove find partuuid
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2024-03-24 06:57:04 -05:00
Han Gao
9893f1a2c0 feat: add sdcard boot first
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2024-03-24 06:57:04 -05:00
Haaland Chen
f80c918aa2 configs: meles: use new fdt default name
Since T-HEAD Linux SDK V1.4.2, modified the kernel device tree
naming rules, starting with th1520.

Signed-off-by: Haaland Chen <haaland@milkv.io>
2024-03-21 04:16:26 -05:00
Han Gao
69d7d3cda0 feat: add format swap partition for resume
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2024-01-31 20:52:36 +08:00
Han Gao
4529d8d50f Revert "fix(c9xx): don't flush dcache when invalidating"
This reverts commit adec30ace4.
2024-01-31 16:19:17 +08:00
Han Gao
74eca2553e feat: enable load str firmware
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2024-01-31 16:19:17 +08:00
10 changed files with 32 additions and 10 deletions

View File

@@ -104,6 +104,16 @@ void invalidate_dcache_range(unsigned long start, unsigned long end)
{
register unsigned long i asm("a0") = start & ~(CONFIG_SYS_CACHELINE_SIZE - 1);
for (; i < end; i += CONFIG_SYS_CACHELINE_SIZE)
asm volatile(".long 0x02b5000b"); /* dcache.cipa a0 */
sync_is();
}
void invalid_dcache_range(unsigned long start, unsigned long end)
{
register unsigned long i asm("a0") = start & ~(CONFIG_SYS_CACHELINE_SIZE - 1);
for (; i < end; i += CONFIG_SYS_CACHELINE_SIZE)
asm volatile(".long 0x02a5000b"); /* dcache.ipa a0 */

View File

@@ -43,3 +43,8 @@
/delete-property/ lcd-en-gpios;
/delete-property/ lcd-bias-en-gpios;
};
&sdhci0 {
max-frequency = <35000000>;
status = "okay";
};

View File

@@ -73,6 +73,7 @@ extern ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr,
#endif
extern void flush_dcache_range(unsigned long start, unsigned long end);
extern void invalidate_dcache_range(unsigned long start, unsigned long end);
extern void invalid_dcache_range(unsigned long start, unsigned long end);
#ifdef CONFIG_CMD_MEMTEST
int test_stuck_address(ulv *bufa, ulong count);

View File

@@ -50,6 +50,7 @@ u64 t_end;
extern void flush_dcache_range(unsigned long start, unsigned long end);
extern void invalidate_dcache_range(unsigned long start, unsigned long end);
extern void invalid_dcache_range(unsigned long start, unsigned long end);
extern unsigned long get_ddr_density(void);
extern int riscv_get_time(u64 *time);
@@ -304,7 +305,7 @@ int prbs_test(struct PRBS_ELE *prbs, unsigned int *buf, int pos, bool random_dq,
// compare result
// invalid cache before read
mdelay(100);
invalidate_dcache_range((ulong)buf, (ulong)buf+(bit_len*4*2*2));
invalid_dcache_range((ulong)buf, (ulong)buf+(bit_len*4*2*2));
p1 = buf;
bit_cnt = 0;
for (i = 0; i < bit_len; i++) {

View File

@@ -13,7 +13,7 @@ CONFIG_DDR_BOARD_CONFIG=y
CONFIG_ARCH_RV64I=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_BUILD_TARGET="u-boot-with-spl.bin"
CONFIG_DEFAULT_FDT_FILE="thead/light-milkv-meles.dtb"
CONFIG_DEFAULT_FDT_FILE="thead/th1520-milkv-meles.dtb"
CONFIG_BOARD_LATE_INIT=y
CONFIG_DISPLAY_CPUINFO=y
CONFIG_DISPLAY_BOARDINFO=y

View File

@@ -13,7 +13,7 @@ CONFIG_DDR_BOARD_CONFIG=y
CONFIG_ARCH_RV64I=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_BUILD_TARGET="u-boot-with-spl.bin"
CONFIG_DEFAULT_FDT_FILE="thead/light-milkv-meles.dtb"
CONFIG_DEFAULT_FDT_FILE="thead/th1520-milkv-meles.dtb"
CONFIG_BOARD_LATE_INIT=y
CONFIG_DISPLAY_CPUINFO=y
CONFIG_DISPLAY_BOARDINFO=y

View File

@@ -13,7 +13,7 @@ CONFIG_DDR_BOARD_CONFIG=y
CONFIG_ARCH_RV64I=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_BUILD_TARGET="u-boot-with-spl.bin"
CONFIG_DEFAULT_FDT_FILE="thead/light-milkv-meles-4g.dtb"
CONFIG_DEFAULT_FDT_FILE="thead/th1520-milkv-meles-4g.dtb"
CONFIG_BOARD_LATE_INIT=y
CONFIG_DISPLAY_CPUINFO=y
CONFIG_DISPLAY_BOARDINFO=y

View File

@@ -247,9 +247,10 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
}
} while (!(stat & SDHCI_INT_DATA_END));
#ifdef CONFIG_TARGET_LIGHT_C910
extern void invalid_dcache_range(unsigned long start, unsigned long end);
/*After read ,invalid dcache range again to avoid cache filled during read tranfer*/
if(data->flags == MMC_DATA_READ){
invalidate_dcache_range(host->start_addr,host->start_addr+ROUND(data->blocks*data->blocksize, ARCH_DMA_MINALIGN));
invalid_dcache_range(host->start_addr,host->start_addr+ROUND(data->blocks*data->blocksize, ARCH_DMA_MINALIGN));
}
#endif
return 0;

View File

@@ -906,7 +906,8 @@ static void dwc3_ep0_xfer_complete(struct dwc3 *dwc,
dep->resource_index = 0;
dwc->setup_packet_pending = false;
#ifdef CONFIG_TARGET_LIGHT_C910
invalidate_dcache_range((unsigned long)dwc->ctrl_req, (dmaaddr_t)dwc->ctrl_req + ROUND(sizeof(*dwc->ctrl_req), CACHELINE_SIZE));
extern void invalid_dcache_range(unsigned long start, unsigned long end);
invalid_dcache_range((unsigned long)dwc->ctrl_req, (dmaaddr_t)dwc->ctrl_req + ROUND(sizeof(*dwc->ctrl_req), CACHELINE_SIZE));
#endif
switch (dwc->ep0state) {

View File

@@ -151,16 +151,19 @@
ENV_STR_BOARD \
"kernel_addr_r=0x00200000\0" \
"kdump_buf=180M\0" \
"mmcdev=0\0" \
"mmcbootpart=2\0" \
"default_mmcdev=1\0" \
"mmc_select=if test -e mmc ${default_mmcdev}:${mmcbootpart} ${boot_conf_file}; then mmcdev=1; else mmcdev=0; fi;\0" \
"boot_conf_file=/extlinux/extlinux.conf\0" \
"uuid_rootfsA=80a5a8e9-c744-491a-93c1-4f4194fd690a\0" \
"partitions=name=table,size=2031KB;name=boot,size=500MiB,type=boot;name=root,size=-,type=linux,uuid=${uuid_rootfsA}\0" \
"uuid_swap=5ebcaaf0-e098-43b9-beef-1f8deedd135e\0" \
"partitions=name=table,size=2031KB;name=boot,size=500MiB,type=boot;name=swap,size=4096MiB,type=swap,uuid=${uuid_swap};name=root,size=-,type=linux,uuid=${uuid_rootfsA}\0" \
"gpt_partition=gpt write mmc ${mmcdev} $partitions\0" \
"load_aon=load mmc ${mmcdev}:${mmcbootpart} $fwaddr light_aon_fpga.bin;cp.b $fwaddr $aon_ram_addr $filesize\0" \
"load_c906_audio=load mmc ${mmcdev}:${mmcbootpart} $fwaddr light_c906_audio.bin;cp.b $fwaddr $audio_ram_addr $filesize\0" \
"finduuid=part uuid mmc ${mmcdev}:${mmcpart} uuid\0" \
"bootcmd_load=run findpart;run load_aon;run load_c906_audio; load mmc ${mmcdev}:${mmcbootpart} $opensbi_addr fw_dynamic.bin\0" \
"load_str=load mmc ${mmcdev}:${mmcbootpart} $fwaddr str.bin;cp.b $fwaddr $str_ram_addr $filesize\0" \
"load_opensbi=load mmc ${mmcdev}:${mmcbootpart} $opensbi_addr fw_dynamic.bin\0" \
"bootcmd_load=run mmc_select; run load_aon; run load_c906_audio; run load_str; run load_opensbi\0" \
"bootcmd=run bootcmd_load; bootslave; sysboot mmc ${mmcdev}:${mmcbootpart} any $boot_conf_addr_r $boot_conf_file;\0" \
"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
"\0"