Example #1
0
/*
*******************************************************************************
*                     usb_op_clock
*
* Description:
*    void
*
* Parameters:
*    void
*
* Return value:
*    void
*
* note:
*    void
*
*******************************************************************************
*/
int usb_close_clock(void)
{
    u32 reg_value = 0;

    /* AHB reset */
    reg_value = readl(SUNXI_CCM_BASE + 0x2C0);
    reg_value &= ~(1 << 24);
    writel(reg_value, (SUNXI_CCM_BASE + 0x2C0));
    __msdelay(10);

    //关usb ahb时钟
	reg_value = readl(SUNXI_CCM_BASE + 0x60);
	reg_value &= ~(1 << 24);
	writel(reg_value, (SUNXI_CCM_BASE + 0x60));
    //等sie的时钟变稳
	__msdelay(10);

	//关USB phy时钟
	reg_value = readl(SUNXI_CCM_BASE + 0xcc);
	reg_value &= ~((1 << 0) | (1 << 8));
	writel(reg_value, (SUNXI_CCM_BASE + 0xcc));
	__msdelay(10);

	return 0;
}
Example #2
0
/*
*******************************************************************************
*                     usb_open_clock
*
* Description:
*    void
*
* Parameters:
*    void
*
* Return value:
*    void
*
* note:
*    void
*
*******************************************************************************
*/
int usb_open_clock(void)
{
    u32 reg_value = 0;

	//Enable module clock for USB phy0
	reg_value = readl(SUNXI_CCM_BASE + 0xcc);
	reg_value |= (1 << 0) | (1 << 8);
	writel(reg_value, (SUNXI_CCM_BASE + 0xcc));
	//delay some time
	__msdelay(10);

    //Gating AHB clock for USB_phy0
	reg_value = readl(SUNXI_CCM_BASE + 0x60);
	reg_value |= (1 << 24);
	writel(reg_value, (SUNXI_CCM_BASE + 0x60));

    //delay to wati SIE stable
	__msdelay(10);

    /* AHB reset */
    reg_value = readl(SUNXI_CCM_BASE + 0x2C0);
    reg_value |= (1 << 24);
    writel(reg_value, (SUNXI_CCM_BASE + 0x2C0));
    __msdelay(10);

	return 0;
}
static int board_probe_power_level(void)
{
	int power_status;
	int power_start;

	//清除power按键
	axp_probe_key();
	//获取电源状态
	power_status = axp_get_power_vol_level();
	debug("power status = %d\n", power_status);
	if(power_status == BATTERY_RATIO_TOO_LOW_WITHOUT_DCIN)
	{
		tick_printf("battery power is low without no dc or ac, should be set off\n");
		sunxi_bmp_display("bat\\low_pwr.bmp");
		__msdelay(3000);

		return -1;
	}
	power_start = 0;
	//power_start的含义
	//0: 不允许插火牛直接开机,必须通过判断:满足以下条件可以直接开机:长按power按键,前次是系统状态,如果电池电量过低,则不允许开机
	//1: 任意状态下,允许插火牛直接开机,同时要求电池电量足够高
	//2: 不允许插火牛直接开机,必须通过判断:满足以下条件可以直接开机:长按power按键,前次是系统状态,不要求电池电量
	//3: 任意状态下,允许插火牛直接开机,不要求电池电量
	script_parser_fetch(PMU_SCRIPT_NAME, "power_start", &power_start, 1);
	debug("power start cause = %d\n", power_start);
	if(power_status == BATTERY_RATIO_TOO_LOW_WITH_DCIN)//低电,同时带外部电源状态下
	{
		if(!(power_start & 0x02))	//需要判断当前电池电量,要求power_start的第1bit的值为0
		{							//此种情况下,直接关机
			tick_printf("battery low power with dc or ac, should charge longer\n");
			sunxi_bmp_display("bat\\bempty.bmp");
			__msdelay(3000);

			return -2;
		}
		else
		{
			if(power_start == 3)	//不需要判断当前电池电量,如果为3,则进入系统,如果为0,则进行后续判断
			{
				return 0;
			}
		}
	}
	else							//电池电量足够情况下,或者没有电池
	{
		if(power_start & 0x01)		//如果第0bit的值为1,则进入系统
		{
			return 0;
		}
	}

	return 1;
}
Example #4
0
void set_cpus_i2c_clock(void)
{
    int reg_value = 0;
        reg_value = readl(R_PRCE_APB0_RESET);
        reg_value |= 0x01 << 6;
        writel(reg_value,R_PRCE_APB0_RESET);
        __msdelay(1);
        reg_value = readl(R_PRCM_APB0_GATING);
        reg_value |= 0x01 << 6;
        writel(reg_value,R_PRCM_APB0_GATING);
        __msdelay(1);
        
}
Example #5
0
static int mmc_clk_io_onoff(int sdc_no, int onoff, const normal_gpio_cfg *gpio_info, int offset)
{
	unsigned int rval;
	struct sunxi_mmc_host* mmchost = &mmc_host[sdc_no];

	if(sdc_no == 0)
	{
		/*
			1. change the initial status of gpio-f;
			2. change the bias voltage of gpio-f to 3.0V
		*/
		*(volatile unsigned int *)(0x06000800 + 0xB4) = 0x111111; //CFG0
		*(volatile unsigned int *)(0x06000800 + 0xD0) = 0x555; //PULL0
		*(volatile unsigned int *)(0x06000800 + 0xC4) = 0x3F; //DATA
		__msdelay(5);
		*(volatile unsigned int *)(0x06000800 + 0xC4) = 0x0;
		__msdelay(5);
		*(volatile unsigned int *)(0x06000800 + 0xC4) = 0x3F;
		__msdelay(5);

		*(volatile unsigned int *)(0x06000800 + 0x314) = 0xA; //BIAS

		boot_set_gpio((void *)gpio_info, 8, 1);
	}
	else // if(sdc_no == 2)
	{
		boot_set_gpio((void *)(gpio_info + offset), 8, 1);
	}
	/* config ahb clock */
	rval = readl(mmchost->hclkbase);
	rval |= (1 << 8);
	writel(rval, mmchost->hclkbase);

	rval = readl(mmchost->hclkrst);
	rval |= (1 << 8);
	writel(rval, mmchost->hclkrst);

	rval = readl(mmchost->commreg);
	rval |= (1<<16)|(1<<18);
	writel(rval, mmchost->commreg);
	/* config mod clock */
	writel(0x80000000, mmchost->mclkbase);
	mmchost->mclk = 24000000;
	dumphex32("ccmu", (char*)CCMM_REGS_BASE, 0x100);
	dumphex32("gpio", (char*)PIOC_REGS_BASE, 0x100);
	dumphex32("mmc", (char*)mmchost->reg, 0x100);

	return 0;
}
Example #6
0
/*
************************************************************************************************************
*
*                                             function
*
*    name          :
*
*    parmeters     :
*
*    return        :
*
*    note          :
*
*
************************************************************************************************************
*/
int board_display_wait_lcd_open(void)
{
	int ret;
	int timedly = 5000;
	int check_time = timedly/50;
	uint arg[4] = { 0 };

	do
	{
    	ret = disp_ioctl(NULL, DISP_CMD_LCD_CHECK_OPEN_FINISH, (void*)arg);
		if(ret == 1)		//open already
		{
			break;
		}
		else if(ret == -1)  //open falied
		{
			return -1;
		}
		__msdelay(50);
		check_time --;
		if(check_time <= 0)
		{
			return -1;
		}
	}
	while(1);

	return 0;
}
Example #7
0
static int 	board_probe_battery_exist(void)		//获取电池状态
{
	int counter;
	int dc_exist, bat_exist;

	counter = 4;
	do
	{
		dc_exist = 0;
		bat_exist = 0;
		axp_power_get_dcin_battery_exist(&dc_exist, &bat_exist);
		printf("bat_exist=%d\n", bat_exist);
		if(bat_exist == -1)
		{
			printf("bat is unknown\n");
			__msdelay(500);
		}
		else
		{
			break;
		}
	}
	while(counter --);

	return bat_exist;
}
Example #8
0
void set_debugmode_flag(void)
{
        char c = 0;
        int i = 0;
        for(i = 0;i < 3;i++)
        {
                __msdelay(10);
                if(sunxi_serial_tstc())
                {
                        printf("key press :");
                        c = sunxi_serial_getc();
                        printf("0x%x   \n",c);
                        break;
                }
        }
        if(c  == 's')
        {
                debug_mode = 1;
                return ;
        }
	if(toc0_config->debug_mode)
		debug_mode = 1;
	else
		debug_mode = 0;
	return ;

}
/*
************************************************************************************************************
*
*                                             function
*
*    name          :	一键恢复的按键检测
*
*    parmeters     :
*
*    return        :
*
*    note          :	[email protected]
*
*
************************************************************************************************************
*/
int check_boot_recovery_key(void)
{
	user_gpio_set_t     gpio_recovery;
	__u32			    gpio_hd;
	int					gpio_value = 0;
	int ret;

	ret = script_parser_fetch("system", "recovery_key", (int *)&gpio_recovery, sizeof(user_gpio_set_t)/4);
        if (!ret)
	{
		gpio_recovery.mul_sel = 0;		//强制设置成输入
		gpio_hd = gpio_request(&gpio_recovery, 1);
		if (gpio_hd)
		{
			int k;
			gpio_value = 0;
			for(k=0;k<4;k++)
			{
				gpio_value += gpio_read_one_pin_value(gpio_hd, 0);
				__msdelay(5);
			}
			if (!gpio_value)
			{
				printf("set to recovery\n");
				return 0;
			}
		}
	}
	return 1;
}
Example #10
0
int mmc_send_status(struct mmc *mmc, int timeout)
{
	struct mmc_cmd cmd;
	int err;

	cmd.cmdidx = MMC_CMD_SEND_STATUS;
	cmd.resp_type = MMC_RSP_R1;
	cmd.cmdarg = mmc->rca << 16;
	cmd.flags = 0;

	do {
		err = mmc_send_cmd(mmc, &cmd, NULL);
		if (err){
			mmcinfo("mmc %d Send status failed\n",mmc->control_num);
			return err;
		}
		else if (cmd.response[0] & MMC_STATUS_RDY_FOR_DATA)
			break;

		__msdelay(1);

		if (cmd.response[0] & MMC_STATUS_MASK) {
			mmcinfo("mmc %d Status Error: 0x%08X\n",mmc->control_num, cmd.response[0]);
			return COMM_ERR;
		}
	} while (timeout--);

	if (!timeout) {
		mmcinfo("mmc %d Timeout waiting card ready\n",mmc->control_num);
		return TIMEOUT;
	}

	return 0;
}
Example #11
0
/*
************************************************************************************************************
*
*                                             function
*
*    name          :
*
*    parmeters     :
*
*    return        :
*
*    note          :
*
*
************************************************************************************************************
*/
int main(void)
{
	__s32 dram_size=0;

	timer_init();
	//serial init
	sunxi_serial_init(fes1_head.prvt_head.uart_port, (void *)fes1_head.prvt_head.uart_ctrl, 2);
	set_pll();

	//enable gpio gate
	set_gpio_gate();
	//dram init
	printf("beign to init dram\n");
#ifdef FPGA_PLATFORM
	dram_size = mctl_init((void *)fes1_head.prvt_head.dram_para);
#else
	dram_size = init_DRAM(0, (void *)fes1_head.prvt_head.dram_para);
#endif
	
	if (dram_size)
	{
		note_dram_log(1);
		printf("init dram ok\n");
	}
	else
	{
		note_dram_log(0);
		printf("init dram fail\n");
	}

	__msdelay(10);

	return dram_size;
}
Example #12
0
/*
************************************************************************************************************
*
*                                             function
*
*    name          :
*
*    parmeters     :
*
*    return        :
*
*    note          :
*
*
************************************************************************************************************
*/
int board_display_wait_lcd_close(void)
{
	int ret;
	int timedly = 5000;
	int check_time = timedly/50;
	uint arg[4] = { 0 };
	uint cmd = 0;

#if defined(CONFIG_VIDEO_SUNXI_V3)
	cmd = DISP_LCD_CHECK_CLOSE_FINISH;
#else
	cmd = DISP_CMD_LCD_CHECK_CLOSE_FINISH;
#endif
	do
	{
    	ret = disp_ioctl(NULL, cmd, (void*)arg);
		if(ret == 1)		//open already
		{
			break;
		}
		else if(ret == -1)  //open falied
		{
			return -1;
		}
		__msdelay(50);
		check_time --;
		if(check_time <= 0)
		{
			return -1;
		}
	}
	while(1);

	return 0;
}
Example #13
0
int check_boot_recovery_key(void)
{
	user_gpio_set_t	gpio_recovery;
	__u32 gpio_hd;
	int ret;
	int gpio_value = 0;
	int used = 0;
	int mode = 0;

	if(uboot_spare_head.boot_data.work_mode != WORK_MODE_BOOT)
	{
		return 0;
	}
	
	ret = script_parser_fetch("recovery_para", "used", (int *)&used, sizeof(int) / 4);
	if (ret || !used)
	{
		printf("[recovery] no use\n");
		return 0;
	}
	ret = script_parser_fetch("recovery_para", "recovery_key", (int *)&gpio_recovery, sizeof(user_gpio_set_t) / 4);
  if (!ret)
	{
		gpio_recovery.mul_sel = 0;		//强制设置成输入
		gpio_hd = gpio_request(&gpio_recovery, 1);
		if (gpio_hd)
		{
			int time;
			gpio_value = 0;
			for(time = 0; time < 4; time++)
			{
				gpio_value += gpio_read_one_pin_value(gpio_hd, 0);
				__msdelay(5);
			}
			if (!gpio_value)
			{
				script_parser_fetch("recovery_para", "mode", (int *)&mode, sizeof(int) / 4);
				if (mode == ONEKEY_USB_RECOVERY)
				{
					printf("set to one key usb recovery\n");
					write_usb_recovery_to_misc();
				}
				else if (mode == ONEKEY_SPRITE_RECOVERY)
				{
					printf("set to one key sprite recovery\n");
					setenv("bootcmd", "sprite_recovery");
				}
				else
				{
					printf("[recovery] no option for one key recovery's mode\n");
				}
			}
		}
	}
	return 0;
}
Example #14
0
/*
*******************************************************************************
*                     __boot
*
* Description:
*    void
*
* Parameters:
*    void
*
* Return value:
*    void
*
* note:
*    void
*
*******************************************************************************
*/
static void __boot(void)
{
	char  response[68];

	if(all_download_bytes > CFG_FASTBOOT_MKBOOTIMAGE_PAGE_SIZE)
	{
		char start[32];
		char *bootm[3] = { "bootm", NULL, NULL, };
		char *go[3]    = { "go",    NULL, NULL, };

		struct fastboot_boot_img_hdr *fb_hdr =
			(struct fastboot_boot_img_hdr *) trans_data.base_recv_buffer;

		/* Skip the mkbootimage header */
		image_header_t *hdr =
			(image_header_t *)
			&trans_data.base_recv_buffer[CFG_FASTBOOT_MKBOOTIMAGE_PAGE_SIZE];

		bootm[1] = go[1] = start;
		sprintf(start, "0x%x", (uint)hdr);

		printf("start addr %s\n", start);
		/* Execution should jump to kernel so send the response
		   now and wait a bit.  */
		sprintf(response, "OKAY");
//		fastboot_tx_status(response, strlen(response));
		__msdelay (1000); /* 1 sec */

		if (ntohl(hdr->ih_magic) == IH_MAGIC) {
			/* Looks like a kernel.. */
			printf ("Booting kernel..\n");

			/*
			 * Check if the user sent a bootargs down.
			 * If not, do not override what is already there
			 */
			if (strlen ((char *) &fb_hdr->cmdline[0])) {
				printf("Image has cmdline:");
				printf("%s\n", &fb_hdr->cmdline[0]);
				setenv ("bootargs", (char *) &fb_hdr->cmdline[0]);
			}
			do_bootm (NULL, 0, 2, bootm);
		} else {
			/* Raw image, maybe another uboot */
			printf ("Booting raw image..\n");

			do_go (NULL, 0, 2, go);
		}
		printf ("ERROR : bootting failed\n");
		printf ("You should reset the board\n");
	}
	else
	{
		sprintf(response, "FAILinvalid boot image");
	}
}
Example #15
0
int check_physical_key_early(void)
{
	user_gpio_set_t	gpio_recovery;
	__u32 gpio_hd;
	int ret;
	int gpio_value = 0;
	int used = 0;
	int mode = 0;

	if(uboot_spare_head.boot_data.work_mode != WORK_MODE_BOOT)
	{
		return 0;
	}

	ret = script_parser_fetch("recovery_para", "used", (int *)&used, sizeof(int) / 4);
	if (ret || !used)
	{
		printf("[recovery] no use\n");
		return 0;
	}
	ret = script_parser_fetch("recovery_para", "recovery_key", (int *)&gpio_recovery, sizeof(user_gpio_set_t) / 4);
  if (!ret)
	{
		gpio_recovery.mul_sel = 0;		//强制设置成输入
		gpio_hd = gpio_request(&gpio_recovery, 1);
		if (gpio_hd)
		{
			int time;
			gpio_value = 0;
			for(time = 0; time < 4; time++)
			{
				gpio_value += gpio_read_one_pin_value(gpio_hd, 0);
				__msdelay(5);
			}
			if (!gpio_value)
			{
				printf("[box recovery] find the key\n");
				script_parser_fetch("recovery_para", "mode", (int *)&mode, sizeof(int) / 4);
				if (mode == ONEKEY_USB_RECOVERY_MODE)
				{
					gd->key_pressd_value = USB_RECOVERY_KEY_VALUE;
				}
				else if (mode == ONEKEY_SPRITE_RECOVERY_MODE)
				{
					gd->key_pressd_value = SPRITE_RECOVERY_KEY_VALUE;
					uboot_spare_head.boot_data.work_mode = WORK_MODE_SPRITE_RECOVERY;
				}
				else
				{
					printf("[recovery] no option for one key recovery's mode (%d)\n", mode);
				}
			}
		}
	}
	return 0;
}
Example #16
0
/*
************************************************************************************************************
*
*                                             function
*
*    name          :
*
*    parmeters     :
*
*    return        :
*
*    note          :
*
*
************************************************************************************************************
*/
static int boot0_clear_env(void)
{

	reset_pll();
	mmu_turn_off();

	__msdelay(10);

	return 0;
}
Example #17
0
void set_i2c_clock(void)
{
    int reg_value = 0;

#if !defined(CONFIG_ARCH_SUN5I)||!defined(CONFIG_ARCH_SUN7I)	
    /* reset i2c clock    */
    /* reset apb2 twi0*/
        reg_value = readl(CCMU_BUS_SOFT_RST_REG4);
        reg_value |= 0x01 << bus_num;
        writel(reg_value, CCMU_BUS_SOFT_RST_REG4);
	__msdelay(1);
#endif
	reg_value = readl(CCMU_BUS_CLK_GATING_REG3);
	reg_value &= ~(1<<bus_num);
	writel(reg_value,CCMU_BUS_CLK_GATING_REG3);
	__msdelay(1);
	reg_value |= (1 << bus_num);
	writel(reg_value,CCMU_BUS_CLK_GATING_REG3);

}
Example #18
0
/*
*******************************************************************************
*                     __fastboot_reboot
*
* Description:
*    void
*
* Parameters:
*    void
*
* Return value:
*    void
*
* note:
*    void
*
*******************************************************************************
*/
static int __fastboot_reboot(int word_mode)
{
	char response[8];

	sprintf(response,"OKAY");
	__sunxi_fastboot_send_status(response, strlen(response));
	__msdelay(1000); /* 1 sec */

	sunxi_board_restart(word_mode);

	return 0;
}
Example #19
0
void hdmi_delay_ms(__u32 ms)
{
#if defined(__LINUX_PLAT__)
	u32 timeout = ms*HZ/1000;

	set_current_state(TASK_INTERRUPTIBLE);
	schedule_timeout(timeout);
#elif defined(__UBOOT_OSAL__)
    __msdelay(ms);
#endif
	return ;
}
Example #20
0
static int mmc_core_init(struct mmc *mmc)
{
	struct sunxi_mmc_host* mmchost = (struct sunxi_mmc_host *)mmc->priv;
	/* Reset controller */
	writel(0x7, &mmchost->reg->gctrl);
	while(readl(&mmchost->reg->gctrl)&0x7);
	/* release eMMC reset signal */
	writel(1, &mmchost->reg->hwrst);
	writel(0, &mmchost->reg->hwrst);
	__msdelay(1);
	writel(1, &mmchost->reg->hwrst);
	return 0;
}
Example #21
0
/*
**********************************************************************************************************************
*                                               i2c_init
*
* Description:
*
* Arguments  :
*
* Returns    :    none
*
* Notes      :    none
*
**********************************************************************************************************************
*/
void i2c_exit(void)
{
#ifndef  CONFIG_CPUS_I2C
	int reg_value = 0;
	reg_value = readl(CCMU_BUS_CLK_GATING_REG3);
	reg_value &= ~(1<<bus_num);
	writel(reg_value,CCMU_BUS_CLK_GATING_REG3);
#else
	int reg_value = 0;
	reg_value = *((unsigned int *)(R_PRCE_APB0_RESET));
	reg_value &= ~(0x01 << 6);
	*((unsigned int *)(R_PRCE_APB0_RESET)) = reg_value;
	__msdelay(1);
	reg_value = *((unsigned int *)(R_PRCM_APB0_GATING));
	reg_value &= ~(0x01 << 6);
	*((unsigned int *)(R_PRCM_APB0_GATING)) = reg_value;
	__msdelay(1);

#endif

 return ;
}/*
Example #22
0
int mmc_go_idle(struct mmc* mmc)
{
	struct mmc_cmd cmd;
	int err;

	__msdelay(1);

	cmd.cmdidx = MMC_CMD_GO_IDLE_STATE;
	cmd.cmdarg = 0;
	cmd.resp_type = MMC_RSP_NONE;
	cmd.flags = 0;

	err = mmc_send_cmd(mmc, &cmd, NULL);

	if (err){
		mmcinfo("mmc %d go idle failed\n",mmc->control_num);
		return err;
	}

	__msdelay(2);

	return 0;
}
Example #23
0
void DSI_delay_ms(__u32	ms)
{
#ifdef __LINUX_PLAT__
	__u32 timeout =	ms*HZ/1000;

	set_current_state(TASK_INTERRUPTIBLE);
	schedule_timeout(timeout);
#endif
#ifdef __BOOT_OSAL__
	wBoot_timer_delay(ms);//assume cpu runs	at 1000Mhz,10 clock	one	cycle
#endif
#ifdef __UBOOT_OSAL__
	__msdelay(ms);
#endif
}
__s32 disp_mipipll_init(void)
{
    MipiPllCtl = (__ccmu_mipi_pll_reg0040_t *)0x01c20040;
    MipipllBias = (__ccmu_mipi_pll_bias_reg0240_t *)0x01c20240;
    MipiPllCtl->PLLEn = 0;
    MipiPllCtl->Ldo1En = 0;
    MipiPllCtl->Ldo2En = 0;
    MipiPllCtl->Ldo1En = 1;
    MipiPllCtl->Ldo2En = 1;
    MipiPllCtl->PllSrc = 0; //pll3
    MipipllBias->pllvdd_ldo_out_ctrl = 0x7; //1.45v
    __msdelay(2);
    MipiPllCtl->PLLEn = 1;

	return 0;
}
Example #25
0
/*
************************************************************************************************************
*
*                                             function
*
*    name          :	sprite_cartoon_screen_set
*
*    parmeters     :
*
*    return        :
*
*    note          :
*
*
************************************************************************************************************
*/
int sprite_cartoon_screen_set(void)
{
#ifdef CONFIG_FPGA
    return 0;
#else
	/* 初始化图形参数 */
	sprite_source.screen_width  = borad_display_get_screen_width(); 
	sprite_source.screen_height = borad_display_get_screen_height();

	if((sprite_source.screen_width < 40) || (sprite_source.screen_height < 40))
	{
		printf("sunxi cartoon error: invalid screen width or height\n");

		return -1;
	}
	sprite_source.screen_size   = sprite_source.screen_width * sprite_source.screen_height * 4;
    sprite_source.screen_buf 	= malloc(sprite_source.screen_size);
	sprite_source.color         = SPRITE_CARTOON_GUI_GREEN;

    if(!sprite_source.screen_buf)
    {
        return -1;
    }
    memset(sprite_source.screen_buf, 0, sprite_source.screen_size);

	board_display_framebuffer_set(sprite_source.screen_width, sprite_source.screen_height, 32, (void *)sprite_source.screen_buf);
#if defined(CONFIG_VIDEO_SUNXI_V3)
				disp_layer_config *layer_para;
				layer_para = (disp_layer_config *)gd->layer_para;
				layer_para->info.alpha_mode = 0;
				board_display_layer_para_set();
#elif defined(CONFIG_VIDEO_SUNXI_V2)
				disp_layer_info *layer_para;
				layer_para = (disp_layer_info *)gd->layer_para;
				layer_para->alpha_mode = 0;
#else
				__disp_layer_info_t *layer_para;
				layer_para = (__disp_layer_info_t *)gd->layer_para;
				layer_para->alpha_en = 0;
#endif
				__msdelay(5);
    return 0;
#endif
}
Example #26
0
void fes1_entry(void)
{
	cpu_init_s();
	timer_init();

    UART_open( fes1_head.prvt_head.uart_port, (void *)fes1_head.prvt_head.uart_ctrl, 24*1000*1000 );
	UART_printf2("begin init dram\n");
	if(init_DRAM(0, (void *)fes1_head.prvt_head.dram_para))
	{
		note_dram_log();
		UART_printf2("init dram ok\n");
	}
	else
	{
	    UART_printf2("init dram fail\n");
	}
	__msdelay(10);

    return;
}
Example #27
0
/*
************************************************************************************************************
*
*                                             function
*
*    name          :
*
*    parmeters     :
*
*    return        :
*
*    note          :
*
*
************************************************************************************************************
*/
int main(void)
{
	__s32 dram_size=0;

	timer_init();
#ifdef 	CONFIG_ARCH_SUN9IW1P1
	if(readl(CCM_PLL1_C0_CTRL))
	{
		set_pll();
	}
#elif  defined(CONFIG_ARCH_SUN8IW6P1)
	if(readl(CCMU_PLL_C0CPUX_CTRL_REG))
	{
		set_pll();
	}
#else
	set_pll();
#endif
	//serial init
	sunxi_serial_init(fes1_head.prvt_head.uart_port, (void *)fes1_head.prvt_head.uart_ctrl, 2);
	//enable gpio gate
	set_gpio_gate();
	//dram init
	printf("beign to init dram\n");
	dram_size = init_DRAM(0, (void *)fes1_head.prvt_head.dram_para);
	if (dram_size)
	{
		note_dram_log(1);
		printf("init dram ok\n");
	}
	else
	{
		note_dram_log(0);
		printf("init dram fail\n");
	}

	__msdelay(10);

	return dram_size;
}
static int mmc_update_clk(struct sunxi_mmc_host* mmchost)
{
	struct mmc_reg_v4p1 *reg = (struct mmc_reg_v4p1 *)mmchost->reg;
	unsigned int cmd;
	unsigned timeout = 1000;

	writel(readl(&reg->clkcr)|(0x1<<31), &reg->clkcr);

	cmd = (1U << 31) | (1 << 21) | (1 << 13);
  	writel(cmd, &reg->cmd);
	while((readl(&reg->cmd)&0x80000000) && --timeout){
		__msdelay(1);
	}
	if (!timeout){
		MMCINFO("mmc %d update clk failed\n",mmchost->mmc_no);
		dumphex32("mmc", (char*)reg, 0x100);
		return -1;
	}
	writel(readl(&reg->clkcr) & (~(0x1<<31)), &reg->clkcr);
	writel(readl(&reg->rint), &reg->rint);
	return 0;
}
Example #29
0
/*
**********************************************************************************************************************
*                                               i2c_init
*
* Description:
*
* Arguments  :
*
* Returns    :    none
*
* Notes      :    none
*
**********************************************************************************************************************
*/
void i2c_exit(uint bus_id)
{
	bus_id = bus_id;
#if defined(CONFIG_ARCH_SUN9IW1P1)
	uint reg_value = 0;
	reg_value = *((unsigned int *)CCM_APB1_GATE0_CTRL);
	reg_value &= ~(0x01 << bus_id);
	*((unsigned int *)CCM_APB1_GATE0_CTRL) = reg_value ;
#else
#if defined(CONFIG_ARCH_SUN8IW6P1)
	uint reg_value = 0;
	reg_value = *((unsigned int *)CCMU_BUS_CLK_GATING_REG3);
	reg_value &= ~(0x01 << bus_id);
	*((unsigned int *)CCMU_BUS_CLK_GATING_REG3) = reg_value ;
#else
	struct sunxi_ccm_reg *ccm_reg = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
	/* close i2c clock    */
	ccm_reg->apb1_gate &= ~1;
#endif

#endif
	__msdelay(1);
	return ;
}
Example #30
0
/**
*
*SUSB_Dev_Core_Rest - Issues core soft reset and PHY reset
*
*@hUSB:USBC_open_otg获得的句柄, 记录了USBC所需要的一些关键数据
*
*/
void SUSB_Dev_Core_Rest(void)
{
 	__u32 reg = 0;

 	/*Put Core in Reset*/
	reg = readl(SUSB_GCTL);
	reg |= SUSB_GCTL_CORESOFTRESET;
	writel(reg, SUSB_GCTL);

 	/*Assert USB3 PHY reset*/
	reg = readl(SUSB_GUSB3PIPECTL(0));
	reg |= SUSB_GUSB3PIPECTL_PHYSOFTRST;
	writel(reg, SUSB_GUSB3PIPECTL(0));

 	/*Assert USB2 PHY reset*/
	reg = readl(SUSB_GUSB2PHYCFG(0));
	reg |= SUSB_GUSB2PHYCFG_PHYSOFTRST;
	writel(reg, SUSB_GUSB2PHYCFG(0));

  	__msdelay(10);

 	/*Clear USB3 PHY reset*/
	reg = readl(SUSB_GUSB3PIPECTL(0));
	reg &= ~SUSB_GUSB3PIPECTL_PHYSOFTRST;
	writel(reg, SUSB_GUSB3PIPECTL(0));

 	/*Clear USB2 PHY reset*/
	reg = readl(SUSB_GUSB2PHYCFG(0));
	reg &= ~SUSB_GUSB2PHYCFG_PHYSOFTRST;
	writel(reg, SUSB_GUSB2PHYCFG(0));

 	/*Clear the Core Reset*/
	reg = readl(SUSB_GCTL);
	reg &= ~SUSB_GCTL_CORESOFTRESET;
	writel(reg, SUSB_GCTL);
}