fix usb uart burn error

This commit is contained in:
hyx 2026-02-06 14:40:37 +08:00
parent 917130bc1a
commit 1515f983ee
11 changed files with 46 additions and 16 deletions

View File

@ -60,6 +60,7 @@ struct down_info{
uint total_len;
uint status;
int comp_status;
int media_type;
};

View File

@ -12,7 +12,7 @@
#define IMG_INVALID 0xFFFFFFFF
#define SPL_DOWN_ADDR 0x40500000
#define SPL_DOWN_ADDR 0x40100000
#define SPL_LOAD_ADDR 0x27000000
#define SPL_NAND_LOCATION_OFFS (0 << 11)
#define SPL_NOR_LOCATION_OFFS (0 << 10)
@ -21,7 +21,7 @@
#define SPL_MAX_SIZE 0x80000
#define HEADER_LEN 0x400
#define UBOOT_DOWN_ADDR 0x40500000
#define UBOOT_DOWN_ADDR 0x40100000
#define UBOOT_LOAD_ADDR 0x41600000
#define UBOOT_NAND_LOCATION_OFFS (128 << 11)
#define UBOOT_NOR_LOCATION_OFFS (32 << 10)
@ -29,9 +29,9 @@
#define UBOOT_SDIO1_LOCATION_OFFS (1024 << 10)
#define UBOOT_MAX_SIZE 0x100000
#define KERNEL_DOWN_ADDR 0x40500000
#define KERNEL_DOWN_ADDR 0x40100000
#define KERNEL_LOAD_ADDR 0x40008000
#define KERNEL_NAND_LOCATION_OFFS (8192 << 11)
#define KERNEL_NAND_LOCATION_OFFS 0x1100000
#define KERNEL_NOR_LOCATION_OFFS (1024 << 10)
#define KERNEL_EMMC_LOCATION_OFFS (6144 << 10)
#define KERNEL_SDIO1_LOCATION_OFFS (2048 << 10)
@ -91,25 +91,25 @@
#define VDSP_SDIO1_LOCATION_OFFS (2048 << 10)
#define VDSP_MAX_SIZE 0x2000000
#define SYSTEM_DOWN_ADDR 0x46000000
#define SYSTEM_DOWN_ADDR 0x40100000
#define SYSTEM_LOAD_ADDR 0x30010000
#define SYSTEM_NAND_LOCATION_OFFS (10752 << 11) // 1500000
#define SYSTEM_NAND_LOCATION_OFFS 0x1900000
#define SYSTEM_NOR_LOCATION_OFFS (64 << 10)
#define SYSTEM_EMMC_LOCATION_OFFS (64 << 10)
#define SYSTEM_SDIO1_LOCATION_OFFS (64 << 10)
#define SYSTEM_MAX_SIZE 0x1800000
#define ROOTFS_DOWN_ADDR 0x46000000
#define ROOTFS_DOWN_ADDR 0x40100000
#define ROOTFS_LOAD_ADDR 0x30010000
#define ROOTFS_NAND_LOCATION_OFFS (23040 << 11) // 2D00000
#define ROOTFS_NAND_LOCATION_OFFS 0x3300000
#define ROOTFS_NOR_LOCATION_OFFS (5120 << 10)
#define ROOTFS_EMMC_LOCATION_OFFS (64 << 10)
#define ROOTFS_SDIO1_LOCATION_OFFS (64 << 10)
#define ROOTFS_MAX_SIZE 0x600000
#define DATA_DOWN_ADDR 0x46000000
#define DATA_DOWN_ADDR 0x40100000
#define DATA_LOAD_ADDR 0x30010000
#define DATA_NAND_LOCATION_OFFS (26112 << 11) // 3300000
#define DATA_NAND_LOCATION_OFFS 0x3d00000
#define DATA_NOR_LOCATION_OFFS (15360 << 10)
#define DATA_EMMC_LOCATION_OFFS (64 << 10)
#define DATA_SDIO1_LOCATION_OFFS (64 << 10)

View File

@ -54,6 +54,7 @@ void usb_down_continue(struct down_info *);
void usb_down_finish(struct down_info *);
void usb_down_execute(struct down_info *);
void usb_xch_baudrate(struct down_info *);
void usb_down_comp_info(struct down_info *info);
void usb_boot(void);
void usb_send_ack(u16 ack);

View File

@ -49,6 +49,7 @@ const usb_pfunc usb_pftbl[] =
usb_down_finish,
usb_down_execute,
usb_xch_baudrate,
usb_down_comp_info,
};
const u16 usb_func_list[] =
{
@ -58,6 +59,7 @@ const u16 usb_func_list[] =
USB_FUNC_FINISH,
USB_FUNC_EXEC,
USB_FUNC_XCH,
USB_FUNC_COMP_INFO,
};
void usb_down_connect(struct down_info *info)
@ -71,16 +73,23 @@ void usb_down_connect(struct down_info *info)
void usb_down_start(struct down_info *info)
{
int id_media=0;
if(info->status != USB_STATUS_CONNECTED)
return;
#ifdef CONFIG_SDL_BUILD
info->imageid = swab32(*((uint *)&info->rcv[4]));
id_media = swab32(*((uint *)&info->rcv[4]));
info->imageid = (id_media>>16) & 0xff;
printf("info->imageid = 0x%lx\r\n", info->imageid);
info->media_type = id_media & 0xff;
printf("info->media_type = 0x%x\r\n", info->media_type);
info->address = MapTbl[info->imageid].downaddr;
printf("info->address = 0x%lx\r\n", info->address);
#else
info->address = swab32(*((uint *)&info->rcv[4]));
#endif
info->total_len = swab32(*((u32 *)&info->rcv[8]));
printf("info->total_len = 0x%x\r\n", info->total_len);
info->cur_len = 0;
if(info->total_len > DownLoad_Max_Size)
@ -96,11 +105,14 @@ void usb_down_continue(struct down_info *info)
{
u16 len;
printf("usb_down_continue\r\n");
if(info->status != USB_STATUS_CONTINUE)
return;
len = swab16(*((u16 *)&info->rcv[2]));
printf("len = 0x%x\r\n", len);
info->cur_len += len;
printf("info->cur_len = 0x%x\r\n", info->cur_len);
if(info->cur_len <= DownLoad_Max_Size)
{
memcpy((void *)info->address,&(info->rcv[4]),len);
@ -114,6 +126,7 @@ void usb_down_continue(struct down_info *info)
void usb_down_finish(struct down_info *info)
{
printf("usb_down_finish\r\n");
if(info->status != USB_STATUS_CONTINUE)
return;
if(info->total_len == info->cur_len)
@ -124,7 +137,15 @@ void usb_down_finish(struct down_info *info)
else
usb_send_ack(USB_PTC_NACK);
}
void usb_down_comp_info(struct down_info *info)
{
if(!info->comp_status)
usb_complete_info(INFO_OK);
else
usb_complete_info(INFO_OTHER);
}
void usb_down_execute(struct down_info *info)
{
u32 addr = 0;
@ -291,6 +312,7 @@ void usb_boot(void)
u32 func;
u8 idx = 0;
#ifdef CONFIG_SDL_BUILD
printf("usb_boot,d_info.status = %d\r\n", d_info.status);
while(d_info.status != USB_STATUS_FINISH)
#else
while(d_info.status != USB_STATUS_EXECUTE)
@ -300,6 +322,7 @@ void usb_boot(void)
usb_rcv_data(d_info.rcv);
ret = usb_crc_check(d_info.rcv);
func = (d_info.rcv[0] << 8) + d_info.rcv[1];
printf("func = 0x%x\r\n", func);
ret &= usb_lookfor_func(func, &idx);
if(ret == false)
{

View File

@ -87,7 +87,7 @@ int spi_nand_program_image(u32 dest, u32 len, u8 *buf)
u32 length = (64<<11);
u8 *buf_tmp;
buf_tmp = buf + 0x500000;
buf_tmp = buf + 0x1800000;
mtd = get_nand_dev_by_index(0);
chip = mtd_to_nand(mtd);
@ -211,17 +211,17 @@ void board_init_r(gd_t *gd, ulong dest_addr)
{
if(strap_sts & 0x1){ //uart download
uart_boot(uart_port);
d_info = get_cur_downinfo();
}
else{
usb_boot();
if(strap_sts & 0x2) //boot1 0: nor 1:nand
d_info = get_cur_downinfo();
if(d_info->media_type == 0x2)
nvm_mod = BOOT_DEVICE_NAND ;
else
nvm_mod = BOOT_DEVICE_NOR;
}
d_info = get_cur_downinfo();
switch(nvm_mod)
{
case BOOT_DEVICE_NAND:

View File

@ -0,0 +1,5 @@
cp ../out/qm10xd_linux/qmimages/u-boot.bin .
cp ../out/qm10xd_linux/qmimages/u-boot-spl-header.img .
cp ../out/qm10xd_linux/qmimages/zImage-dtb .
cp ../out/qm10xd_linux/qmimages/bsp/pdl/u-boot-pdl-header.img .
cp ../out/qm10xd_linux/qmimages/bsp/boot/u-boot-sdl.bin .

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.