blob: 598182bd534ff1db2800a0c316021807c8108f12 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/*******************************************************************************
2 * Copyright (C) 2016, ZIXC Corporation.
3 *
4 * File Name:cmd_ram_start.c
5 * File Mark:
6 * Description:
7 * Others:
8 * Version: 1.0
9 * Author: zangxiaofeng
10 * Date: 2013-4-22
11 * History 1:
12 * Date:
13 * Version:
14 * Author:
15 * Modification:
16 * History 2:
17 ********************************************************************************/
18
19
20/****************************************************************************
21* Include files
22****************************************************************************/
23#include <common.h>
24#include <command.h>
25#include <net.h>
26#include <jffs2/load_kernel.h>
27#include "downloader_nand.h"
28#include "downloader_config.h"
29#include "downloader_serial.h"
30#include <asm/arch/cpu.h>
31#include <asm/io.h>
32
33
34static is_flush = 0;
35extern char *tsp_console_buffer;
36extern uint32_t arm_ps_ep;
37/****************************************************************************
38* Global Function Prototypes
39****************************************************************************/
40int start_core(uchar *core_name, unsigned int addr);
41
42
43/*******************************************************************************
44 * Function:do_ram_start
45 * Description:
46 * Parameters:
47 * Input:
48 *
49 * Output:
50 *
51 * Returns:
52 *
53 *
54 * Others:
55 ********************************************************************************/
56int do_ram_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
57{
58 char *ack = tsp_console_buffer;
59 unsigned int i = 0;
60 unsigned int addr = 0;
61
62 if(argc < 1)
63 {
64 return cmd_usage(cmdtp);
65 }
66
67 sprintf(ack,"OKAY ram_start");
68 downloader_serial_write(ack, strlen(ack)+1);
69 for(i=1; i<argc; i=i+2)
70 {
71 addr = (unsigned int)simple_strtoul (argv[i+1], NULL, 16);
72 printf("core is %s, addr is %x\n",(uchar *)argv[i],addr);
73 start_core((uchar *)argv[i], addr);
74 }
75 hang();
76 return 0;
77}
78
79U_BOOT_CMD(
80 ram_start, CONFIG_SYS_MAXARGS, 0, do_ram_start,
81 "ram_start: ram_start",
82 ""
83);
84
85 int start_core(uchar *core_name, unsigned int addr)
86{
87 char *ack = tsp_console_buffer;
88
89 if(strcmp((const char *)core_name,"ps") == 0)
90 {
91 if(addr != 0xffffffff)
92 {
93 /* д PS Ìø×ªÆô¶¯´úÂë */
94
95 /* flush d-cache */
96 if( is_flush != 1 )
97 {
98 is_flush = 1;
99 cleanup_before_linux();
100 }
101 arm_ps_ep = addr;
102 /* ÊÍ·ÅÆô¶¯ ARM_PS */
103 printf("Starting the arm_ps ...\n");
104 start_arm_ps();
105 }
106 else
107 {
108 printf("No Starting the arm_ps ...\n");
109 }
110 }
111 else if (strcmp((const char *)core_name,"phy") == 0)
112 {
113 if(addr != 0xffffffff)
114 {
115 /* д PHY Ìø×ªÆô¶¯´úÂë */
116
117 /* flush d-cache */
118 /*if( is_flush != 1 )
119 {
120 is_flush = 1;
121 cleanup_before_linux();
122 }*/
123 //load_zsp_image(addr);
124 /* ÊÍ·ÅÆô¶¯ ARM_PHY */
125
126 printf("Starting the arm_phy ...\n");
127 }
128 else
129 {
130 printf("No Starting the arm_phy ...\n");
131 }
132 }
133 else
134 {
135 sprintf(ack,"FAIL INVILID CORE NAME");
136 downloader_serial_write(ack, strlen(ack)+1);
137 return -1;
138 }
139 return 0;
140}
141