#include "../drivers/mmc/card_sdio.h"
#include "thor_mode.h"
#include "tizen_misc.h"
+#include "calibration_detect.h"
#ifdef THOR_DEBUG
#define thor_debug(fmt, arg...) printf(fmt, ## arg)
struct thor_part_info part_info;
static char f_name[F_NAME_BUF_SIZE];
+extern void MMU_DisableIDCM(void);
+extern void draw_progress(int per);
+extern int32 USB_WriteEx(uint8 *pBuf,uint32 len);
+extern int USB_ReadEx(unsigned char *pBuf, int len);
+extern void thor_USB_Init(void);
+extern int thor_usb_is_connected(void);
+extern unsigned int thor_get_part_info(struct thor_part_info *part_info, const char *name);
+extern int thor_save_env(char *str);
+
static void thor_clear_part_info(void)
{
part_info.offset = 0;
unsigned int write_ofs = 0;
int ret;
- int count = 0;
int download_done = 0;
int usb_pkt_cnt = 0;
int per = 0;
while (!download_done) {
dn_addr = download_addr + buffered;
- ret = USB_ReadEx((char *) dn_addr, THOR_PACKET_SIZE);
+ ret = USB_ReadEx((unsigned char *) dn_addr, THOR_PACKET_SIZE);
if (ret <= 0)
return ret;
buffered += ret;
return -EINVAL;
}
#endif
- ret = Emmc_Write(PARTITION_USER, part_info.offset + write_ofs, count, download_addr);
+ ret = Emmc_Write(PARTITION_USER, part_info.offset + write_ofs, count, (uint8 *)download_addr);
if (!ret)
return -EIO;
static long long int process_rqt_download(const struct rqt_box *rqt)
{
struct rsp_box *rsp = &rsp_buf;
- static long long int left, ret_head;
int file_type, ret = 0;
memset(rsp, 0, sizeof(struct rsp_box));
while (1) {
if (thor_usb_is_connected()) {
ret = USB_ReadEx(thor_rx_data_buf, strlen("THOR"));
- if (!strncmp(thor_rx_data_buf, "THOR", strlen("THOR")))
+ if (!strncmp((char *)thor_rx_data_buf, "THOR", strlen("THOR")))
{
- USB_WriteEx("ROHT", strlen("ROHT"));
+ USB_WriteEx((uint8 *)"ROHT", strlen("ROHT"));
goto retry;
}
ret = USB_ReadEx(thor_rx_data_buf + strlen("THOR"), sizeof(thor_rx_data_buf) - strlen("THOR"));
puts("TIZEN \"THOR\" Downloader\n");
thor_mode();
+
+ return 0;
}
U_BOOT_CMD(thordown, 1, 1, do_thor_down,
#include <asm/arch/sci_types.h>
#include <linux/usb/ch9.h>
#include <linux/usb/cdc.h>
+#include <linux/usb/gadget.h>
#include <linux/byteorder/little_endian.h>
+#include <linux/string.h>
#define THOR_VENDOR_NUM 0x04E8
#define THOR_PRODUCT_NUM 0x685D
.bRESERVED = 0x00,
};
-static char thor_device_qualifer_desc_buf[sizeof(struct usb_qualifier_descriptor)] __align(32);
-
unsigned char g_USB_Other_Speed_ConfigDescr[] __align(32) =
{
0x09,0x07,0x43,0x00,0x02,0x01,0x00,0xC0,
int check_usb_reconnected = 0;
extern void usb_power_on(void);
+extern void usb_power_off(void);
+extern unsigned char *thor_get_device_desc(unsigned int speed);
+extern unsigned char *thor_get_config_desc(unsigned int speed);
+extern unsigned char *thor_get_string_desc(unsigned char index);
+extern unsigned char *thor_get_qualifer_desc(void);
+extern unsigned char *thor_get_other_speed_config_desc(void);
extern void Dcache_InvalRegion(unsigned int addr, unsigned int length);
extern void Dcache_CleanRegion(unsigned int addr, unsigned int length);
/*****************************************************************************/
PUBLIC void usb_set_feature (void)
{
- volatile USB_DCFG_U *dcfg_ptr = (volatile USB_DCFG_U *) USB_DCFG;
volatile USB_DCTL_U *dctl_ptr = (volatile USB_DCTL_U *) USB_DCTL;
- USB_REQUEST_1_U *request1;
USB_REQUEST_2_U *request2;
- USB_REQUEST_1_U request1_u;
USB_REQUEST_2_U request2_u;
- request1_u.dwValue = s_setup_packet[0];
request2_u.dwValue = s_setup_packet[1];
- request1= &request1_u;
request2= &request2_u;
EPI0_config (0x0, 0x1, FALSE, NULL);
{
volatile USB_INTSTS_U *usb_int_ptr = (USB_INTSTS_U *) USB_GINTSTS;
volatile USB_INTSTS_U usb_int;
- uint32 i=0;
- char string[64] ={0,};
usb_int.dwValue = usb_int_ptr->dwValue;
// in endpoint interrupt
{
volatile USB_DOEPINT_U *doepint_ptr = (USB_DOEPINT_U *) USB_DOEPINT (EP_OUT);
volatile USB_DOEPTSIZ_U *doeptsiz_ptr = (USB_DOEPTSIZ_U *) USB_DOEPTSIZ (EP_OUT);
- int i;
if(recv_length == 0)
{
// Note:
/*****************************************************************************/
+__align(64) unsigned char sprd_thor_setup_buf[512] = {0,};
+
+static int s_usb_connected = 0;
+
+extern int thor_handle(void);
+
+void sprd_usb_thor_start(void)
+{
+ g_usb_status = USB_STARTED;
+
+ do {
+ if (s_usb_connected == 0) {
+ USB_ReadEx_Internal(sprd_thor_setup_buf, sizeof(sprd_thor_setup_buf));
+
+ if (g_usb_status == USB_DETACHED_AFTER_USB_MODE_START)
+ return;
+
+ if (!strncmp((char *)sprd_thor_setup_buf, "THOR", strlen("THOR")))
+ {
+ usb_debug("- thor is connected!\n");
+ USB_WriteEx((uint8 *)"ROHT", strlen("ROHT"));
+ usb_debug("thor Setup Complete\n");
+ s_usb_connected = 1;
+ break;
+ } else{
+ usb_debug("thor_seup error - Not receiving THOR\n");
+ s_usb_connected = 0;
+ }
+ }
+ } while(1);
+
+ thor_handle();
+
+ usb_debug("%s : exit \n", __func__);
+ return;
+}
+
/* Enter point */
void thor_USB_Init(void)
{
usb_debug("%s : enter\n", __func__);
- unsigned int len = 0;
usb_power_on();
usb_core_init();
usb_power_off();
}
-__align(64) unsigned char sprd_thor_setup_buf[512] = {0,};
-
-static int s_usb_connected = 0;
-
/************************************************
*
* Register call back function for v3_protocol.
}
#endif
-extern int thor_handle(void);
-
-void sprd_usb_thor_start()
-{
- g_usb_status = USB_STARTED;
-
- do {
- if (s_usb_connected == 0) {
- USB_ReadEx_Internal(sprd_thor_setup_buf, sizeof(sprd_thor_setup_buf));
-
- if (g_usb_status == USB_DETACHED_AFTER_USB_MODE_START)
- return -1;
-
- if (!strncmp(sprd_thor_setup_buf, "THOR", strlen("THOR")))
- {
- usb_debug("- thor is connected!\n");
- USB_WriteEx("ROHT", strlen("ROHT"));
- usb_debug("thor Setup Complete\n");
- s_usb_connected = 1;
- break;
- } else{
- usb_debug("thor_seup error - Not receiving THOR\n");
- s_usb_connected = 0;
- }
- }
- } while(1);
-
- thor_handle();
-
- usb_debug("%s : exit \n", __func__);
- return 0;
-}
-
void disconnect_usb(void)
{
s_usb_connected = 0;