mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-22 12:54:59 +02:00
make the usbboot detect the target cpu type by usb id
Signed-off-by: Xiangfu Liu <xiangfu@sharism.cc>
This commit is contained in:
parent
d0db32762f
commit
046a7e7cbd
@ -126,22 +126,30 @@ int boot(char *stage1_path, char *stage2_path){
|
||||
|
||||
status = usb_get_ingenic_cpu(&ingenic_dev);
|
||||
switch (status) {
|
||||
case 1: /* Jz4740v1 */
|
||||
case JZ4740V1:
|
||||
status = 0;
|
||||
hand.fw_args.cpu_id = 0x4740;
|
||||
break;
|
||||
case 2: /* Jz4750v1 */
|
||||
case JZ4750V1:
|
||||
status = 0;
|
||||
hand.fw_args.cpu_id = 0x4750;
|
||||
break;
|
||||
case 3: /* Boot4740 */
|
||||
case JZ4760V1:
|
||||
status = 0;
|
||||
hand.fw_args.cpu_id = 0x4760;
|
||||
break;
|
||||
case BOOT4740:
|
||||
status = 1;
|
||||
hand.fw_args.cpu_id = 0x4740;
|
||||
break;
|
||||
case 4: /* Boot4750 */
|
||||
case BOOT4750:
|
||||
status = 1;
|
||||
hand.fw_args.cpu_id = 0x4750;
|
||||
break;
|
||||
case BOOT4760:
|
||||
status = 1;
|
||||
hand.fw_args.cpu_id = 0x4760;
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
@ -240,7 +248,7 @@ int nand_program_check(struct nand_in *nand_in,
|
||||
#endif
|
||||
|
||||
int cpu = usb_get_ingenic_cpu(&ingenic_dev);
|
||||
if (cpu != BOOT4740 && cpu != BOOT4750) {
|
||||
if (cpu != BOOT4740 && cpu != BOOT4750 && cpu != BOOT4760) {
|
||||
printf(" Device unboot! Boot it first!\n");
|
||||
goto err;
|
||||
}
|
||||
|
@ -25,37 +25,6 @@
|
||||
|
||||
extern unsigned int total_size;
|
||||
|
||||
int hand_init_def(struct hand *hand)
|
||||
{
|
||||
/* nand flash info */
|
||||
/* hand.nand_start=0; */ /* important !!!! */
|
||||
hand->pt = JZ4740; /* cpu type */
|
||||
hand->nand_bw = 8;
|
||||
hand->nand_rc = 3;
|
||||
hand->nand_ps = 2048;
|
||||
hand->nand_os = 64;
|
||||
hand->nand_ppb = 64;
|
||||
hand->nand_eccpos = 6;
|
||||
hand->nand_bbpage = 0;
|
||||
hand->nand_bbpos = 0;
|
||||
hand->nand_force_erase = 0;
|
||||
/* hand.nand_ids=0; */ /* vendor_id & device_id */
|
||||
hand->fw_args.cpu_id = 0x4740;
|
||||
hand->fw_args.ext_clk = 12;
|
||||
hand->fw_args.cpu_speed = 225 / hand->fw_args.ext_clk;
|
||||
hand->fw_args.phm_div = 3;
|
||||
hand->fw_args.use_uart = 0;
|
||||
hand->fw_args.boudrate = 57600;
|
||||
hand->fw_args.bus_width = 0;
|
||||
hand->fw_args.bank_num = 1;
|
||||
hand->fw_args.row_addr = 13;
|
||||
hand->fw_args.col_addr = 9;
|
||||
hand->fw_args.is_mobile = 0;
|
||||
hand->fw_args.is_busshare = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int check_dump_cfg(struct hand *hand)
|
||||
{
|
||||
printf("Now checking whether all configure args valid:");
|
||||
@ -149,8 +118,6 @@ int parse_configure(struct hand *hand, char * file_path)
|
||||
return -1;
|
||||
}
|
||||
|
||||
hand_init_def(hand);
|
||||
|
||||
cfg_opt_t opts[] = {
|
||||
CFG_INT("BOUDRATE", 57600, CFGF_NONE),
|
||||
CFG_INT("EXTCLK", 0, CFGF_NONE),
|
||||
@ -226,7 +193,6 @@ int parse_configure(struct hand *hand, char * file_path)
|
||||
|
||||
cfg_free(cfg);
|
||||
|
||||
hand->fw_args.cpu_id = 0x4740;
|
||||
if (hand->fw_args.bus_width == 32)
|
||||
hand->fw_args.bus_width = 0;
|
||||
else
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "ingenic_usb.h"
|
||||
|
||||
extern unsigned int total_size;
|
||||
extern struct hand hand;
|
||||
|
||||
static int get_ingenic_device(struct ingenic_dev *ingenic_dev)
|
||||
{
|
||||
@ -38,8 +39,10 @@ static int get_ingenic_device(struct ingenic_dev *ingenic_dev)
|
||||
usb_dev = usb_dev->next) {
|
||||
|
||||
if ((usb_dev->descriptor.idVendor == VENDOR_ID) &&
|
||||
(usb_dev->descriptor.idProduct == PRODUCT_ID)) {
|
||||
(usb_dev->descriptor.idProduct == PRODUCT_ID_4740 ||
|
||||
usb_dev->descriptor.idProduct == PRODUCT_ID_4760)) {
|
||||
ingenic_dev->usb_dev = usb_dev;
|
||||
hand.fw_args.cpu_id = usb_dev->descriptor.idProduct;
|
||||
count++;
|
||||
}
|
||||
|
||||
@ -168,8 +171,10 @@ int usb_get_ingenic_cpu(struct ingenic_dev *ingenic_dev)
|
||||
|
||||
if (!strcmp(ingenic_dev->cpu_info_buff,"JZ4740V1")) return JZ4740V1;
|
||||
if (!strcmp(ingenic_dev->cpu_info_buff,"JZ4750V1")) return JZ4750V1;
|
||||
if (!strcmp(ingenic_dev->cpu_info_buff,"JZ4760V1")) return JZ4760V1;
|
||||
if (!strcmp(ingenic_dev->cpu_info_buff,"Boot4740")) return BOOT4740;
|
||||
if (!strcmp(ingenic_dev->cpu_info_buff,"Boot4750")) return BOOT4750;
|
||||
if (!strcmp(ingenic_dev->cpu_info_buff,"Boot4760")) return BOOT4760;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -39,8 +39,10 @@
|
||||
|
||||
#define JZ4740V1 1
|
||||
#define JZ4750V1 2
|
||||
#define BOOT4740 3
|
||||
#define BOOT4750 4
|
||||
#define JZ4760V1 3
|
||||
#define BOOT4740 4
|
||||
#define BOOT4750 5
|
||||
#define BOOT4760 6
|
||||
|
||||
#define STAGE_ADDR_MSB(addr) ((addr) >> 16)
|
||||
#define STAGE_ADDR_LSB(addr) ((addr) & 0xffff)
|
||||
@ -49,7 +51,9 @@
|
||||
#define USB_TIMEOUT 5000
|
||||
|
||||
#define VENDOR_ID 0x601a
|
||||
#define PRODUCT_ID 0x4740
|
||||
#define PRODUCT_ID_4740 0x4740
|
||||
#define PRODUCT_ID_4750 0x4750
|
||||
#define PRODUCT_ID_4760 0x4760
|
||||
|
||||
#define STAGE1_FILE_PATH (DATADIR "xburst_stage1.bin")
|
||||
#define STAGE2_FILE_PATH (DATADIR "xburst_stage2.bin")
|
||||
|
Loading…
Reference in New Issue
Block a user