Exemplo n.º 1
0
void usb_init_slave(void)
{
	struct s3c24x0_gpio * const gpioregs = s3c24x0_get_base_gpio();
	char *mode;

	udelay(100000);

	Isr_Init();

   writel((readl(&gpioregs->MISCCR) & ~((1<<3) | (1<<13))), &gpioregs->MISCCR); 
// USBD is selected instead of USBH1 
// USB port 1 is enabled.
//
//  USBD should be initialized first of all.
//
	isUsbdSetConfiguration=0;

	UsbdMain(); 
	udelay(100000);
    
    writel((readl(&gpioregs->GPCDAT) | (1<<5)), &gpioregs->GPCDAT); 
 /* enable USB Device, thisway.diy */
#if USBDMA
	mode="DMA";
#else
	mode="Int";
#endif
	download_run=0; //The default menu is the Download & Run mode.
	printf("USB slave is enable!\n");
}
Exemplo n.º 2
0
void usb_init_slave(void)
{
	struct s3c24x0_gpio * const gpioregs = s3c24x0_get_base_gpio();
	char *mode;

	udelay(100000);

	Isr_Init();

   writel((readl(&gpioregs->misccr) & ~((1<<3) | (1<<13))), &gpioregs->misccr); 
// USBD is selected instead of USBH1 
// USB port 1 is enabled.
//
//  USBD should be initialized first of all.
//
	isUsbdSetConfiguration=0;

	UsbdMain(); 
	udelay(100000);
    
    writel((readl(&gpioregs->gpcdat) | (1<<5)), &gpioregs->gpcdat); 
 /* enable USB Device, thisway.diy */
#if USBDMA
	mode="DMA";
#else
	mode="Int";
#endif
	download_run=0; //The default menu is the Download & Run mode.
	printf("\n");
	printf("+------------------------------------------------------------+\n");
	printf("| S3C2440A USB Downloader (Port from tekkamanninja 2012 Aug) |\n");
	printf("+------------------------------------------------------------+\n");
	printf("USB: IN_ENDPOINT:1 OUT_ENDPOINT:3\n");
	printf("FORMAT: <ADDR(DATA):4>+<SIZE(n+10):4>+<DATA:n>+<CS:2>\n");
	printf("NOTE: Power off/on or press the reset button for 1 sec\n");
	printf("      in order to get a valid USB device address.\n");
	printf("\n");
}
Exemplo n.º 3
0
void usb_init_slave(void)
{
	char *mode;
	int i;
	U8 key;
	U32 mpll_val, upll_val, divn_upll=0;
	extern int bBootFrmNORFlash(void);

	/* start add by ll ,replace the Port_Init() */
	gpioregs = S3C24X0_GetBase_GPIO();
	gpioregs->GPGCON = 0xfd95ffba;	/* thisway.diy, GPG12-->OUTPUT, GPG9-->OUTPUT for FS2410, as USB Device enable */
	gpioregs->GPGUP  = 0xffff;	// The pull up function is disabled GPG[15:0]
	gpioregs->GPGDAT &= ~(1<<12);	/* disable USB Device, enable later, thisway.diy */
	/* end ll */

	clk_powerregs = S3C24X0_GetBase_CLOCK_POWER();

	usbdevregs = S3C24X0_GetBase_USB_DEVICE();
	dmaregs = S3C24X0_GetBase_DMAS();

	udelay(100000);
#if 0
	// USB device detection control
	rGPGCON &= ~(3<<24);
	rGPGCON |=  (1<<24); // output
	rGPGUP  |=  (1<<12); // pullup disable
	rGPGDAT |=  (1<<12); // output
#endif

	//ChangeUPllValue(60,4,2);		// 48MHz
	//for(i=0; i<7; i++);
	//ChangeClockDivider(13,12);
	//ChangeMPllValue(97,1,2);		//296Mhz

	Isr_Init();


	gpioregs->MISCCR=gpioregs->MISCCR&~(1<<3); // USBD is selected instead of USBH1
	gpioregs->MISCCR=gpioregs->MISCCR&~(1<<13); // USB port 1 is enabled.

//
//  USBD should be initialized first of all.
//
	isUsbdSetConfiguration=0;

#if 0
	UsbdMain();
	MMU_Init(); //MMU should be reconfigured or turned off for the debugger,
	//After downloading, MMU should be turned off for the MMU based program,such as WinCE.
#else
//thisway.diy	MMU_EnableICache();
	UsbdMain();
	udelay(100000);
	gpioregs->GPGDAT |= ((1<<9) | (1<<12));  /* enable USB Device, thisway.diy */
	gpioregs->GPBDAT |= (1<<9);   /* enable USB Device, thisway.diy */
	gpioregs->GPCDAT |= (1<<5);   /* enable USB Device, thisway.diy */
#endif

#if USBDMA
	mode="DMA";
#else
	mode="Int";
#endif

	// CLKOUT0/1 select.
	//printf("CLKOUT0:MPLL in, CLKOUT1:RTC clock.\n");
	//Clk0_Enable(0);	// 0:MPLLin, 1:UPLL, 2:FCLK, 3:HCLK, 4:PCLK, 5:DCLK0
	//Clk1_Enable(2);	// 0:MPLLout, 1:UPLL, 2:RTC, 3:HCLK, 4:PCLK, 5:DCLK1
//	Clk0_Disable();
//	Clk1_Disable();

	mpll_val = clk_powerregs->MPLLCON;
	upll_val = clk_powerregs->UPLLCON;


	if (0) //(!bBootFrmNORFlash())
	{
		S3C24X0_INTERRUPT * intregs;
		intregs = S3C24X0_GetBase_INTERRUPT();
		printf("UPLLVal [M:%xh,P:%xh,S:%xh]\n", (upll_val&(0xff<<12))>>12,(upll_val&(0x3f<<4))>>4,(upll_val&0x3));
		printf("MPLLVal [M:%xh,P:%xh,S:%xh]\n", (mpll_val&(0xff<<12))>>12,(mpll_val&(0x3f<<4))>>4,(mpll_val&0x3));
		printf("CLKDIVN:%xh\n", clk_powerregs->CLKDIVN);

			intregs->INTSUBMSK = 0x3ff;
			gpioregs->GPBDAT = 0x740;
			gpioregs->GPCDAT = 0x20;
			gpioregs->GPGDAT = 0xba2c;

		printf("\nINTMOD = %x\n", intregs->INTMOD);
		printf("INTMSK = %x\n", intregs->INTMSK);
		printf("INTSUBMSK = %x\n", intregs->INTSUBMSK);

		printf("\nGPBCON = %x\n", gpioregs->GPBCON);
		printf("GPBDAT = %x\n", gpioregs->GPBDAT);
		printf("GPCCON = %x\n", gpioregs->GPCCON);
		printf("GPCDAT = %x\n", gpioregs->GPCDAT);
		printf("GPGCON = %x\n", gpioregs->GPGCON);
		printf("GPGDAT = %x\n", gpioregs->GPGDAT);
/*
		printf("\n\n");
		printf("+---------------------------------------------+\n");
		printf("| S3C2440A USB Downloader ver R0.03 2004 Jan  |\n");
		printf("+---------------------------------------------+\n");
	//	printf("FCLK=%4.1fMHz,%s mode\n",FCLK/1000000.,mode);
		printf("USB: IN_ENDPOINT:1 OUT_ENDPOINT:3\n");
		printf("FORMAT: <ADDR(DATA):4>+<SIZE(n+10):4>+<DATA:n>+<CS:2>\n");
		printf("NOTE: Power off/on or press the reset button for 1 sec\n");
		printf("	  in order to get a valid USB device address.\n");
		printf("\n");
*/
	}
Exemplo n.º 4
0
void usb_init(void)
{
	char *mode;
	int i;
	U8 key;
	U32 mpll_val, upll_val, divn_upll=0;
    extern int bBootFrmNORFlash(void);

    Port_Init();

    clk_powerregs = S3C24X0_GetBase_CLOCK_POWER();

    usbdevregs = S3C24X0_GetBase_USB_DEVICE();
    dmaregs = S3C24X0_GetBase_DMAS();

    udelay(100000);
#if 0	
	// USB device detection control
	rGPGCON &= ~(3<<24);
	rGPGCON |=  (1<<24); // output
	rGPGUP  |=  (1<<12); // pullup disable
	rGPGDAT |=  (1<<12); // output	
#endif

	//ChangeUPllValue(60,4,2);		// 48MHz
	//for(i=0; i<7; i++);
	//ChangeClockDivider(13,12);
	//ChangeMPllValue(97,1,2);		//296Mhz

	Isr_Init();


	gpioregs->MISCCR=gpioregs->MISCCR&~(1<<3); // USBD is selected instead of USBH1 
	gpioregs->MISCCR=gpioregs->MISCCR&~(1<<13); // USB port 1 is enabled.

//
//  USBD should be initialized first of all.
//
	isUsbdSetConfiguration=0;

#if 0
	UsbdMain(); 
	MMU_Init(); //MMU should be reconfigured or turned off for the debugger, 
	//After downloading, MMU should be turned off for the MMU based program,such as WinCE.	
#else
//mike.arm9    MMU_EnableICache();  
	UsbdMain(); 
    udelay(100000);
    gpioregs->GPGDAT |= (1<<12);  /* enable USB Device, mike.arm9 */
    gpioregs->GPBDAT |= (1<<9);   /* enable USB Device, mike.arm9 */
    gpioregs->GPCDAT |= (1<<5);   /* enable USB Device, mike.arm9 */
#endif

#if USBDMA
	mode="DMA";
#else
	mode="Int";
#endif

	// CLKOUT0/1 select.
	//printf("CLKOUT0:MPLL in, CLKOUT1:RTC clock.\n");
	//Clk0_Enable(0);	// 0:MPLLin, 1:UPLL, 2:FCLK, 3:HCLK, 4:PCLK, 5:DCLK0
	//Clk1_Enable(2);	// 0:MPLLout, 1:UPLL, 2:RTC, 3:HCLK, 4:PCLK, 5:DCLK1	
//	Clk0_Disable();
//	Clk1_Disable();
	
	mpll_val = clk_powerregs->MPLLCON;
	upll_val = clk_powerregs->UPLLCON; 


    if (1) //(!bBootFrmNORFlash())
    {
    	printf("UPLLVal [M:%xh,P:%xh,S:%xh]\n", (upll_val&(0xff<<12))>>12,(upll_val&(0x3f<<4))>>4,(upll_val&0x3));
    	printf("MPLLVal [M:%xh,P:%xh,S:%xh]\n", (mpll_val&(0xff<<12))>>12,(mpll_val&(0x3f<<4))>>4,(mpll_val&0x3));
    	printf("CLKDIVN:%xh\n", clk_powerregs->CLKDIVN);

    	printf("\n\n");
    	printf("+---------------------------------------------+\n");
    	printf("| S3C2440A USB Downloader ver R0.03 2004 Jan  |\n");
    	printf("+---------------------------------------------+\n");
    //	printf("FCLK=%4.1fMHz,%s mode\n",FCLK/1000000.,mode); 
    	printf("USB: IN_ENDPOINT:1 OUT_ENDPOINT:3\n"); 
    	printf("FORMAT: <ADDR(DATA):4>+<SIZE(n+10):4>+<DATA:n>+<CS:2>\n");
    	printf("NOTE: Power off/on or press the reset button for 1 sec\n");
    	printf("      in order to get a valid USB device address.\n");
    	printf("\n");
    }