Example #1
0
int board_init (void)
{
	S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();

	/* to reduce PLL lock time, adjust the LOCKTIME register */
	clk_power->LOCKTIME = 0xFFFFFF;
	
        /* FCLK:HCLK:PCLK = 1:4:8 */
	clk_power->CLKDIVN = 0x05;

	/* Change to Asynchronous bus mode */
	__asm__( "mrc p15, 0, r1, c1, c0, 0\n" /* read ctrl register */
		 "orr r1, r1, #0xc0000000\n"   /* Asynchronous */
		 "mcr p15, 0, r1, c1, c0, 0\n" /* write ctrl register */
		 :::"r1"
		 );

	/* configure MPLL */
	clk_power->MPLLCON = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV);

	/* some delay between MPLL and UPLL */
	delay (4000);

	/* configure UPLL */
	clk_power->UPLLCON = ((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV);

	/* some delay between MPLL and UPLL */
	delay (8000);

	/* set up the I/O ports */
	gpio->GPACON = 0x007FFFFF;
	gpio->GPBCON = 0x00044554;
	gpio->GPBUP = 0x000007FF;
	gpio->GPCCON = 0xAAAAAAAA;
	gpio->GPCUP = 0x0000FFFF;
	gpio->GPDCON = 0xAAAAAAAA;
	gpio->GPDUP = 0x0000FFFF;
	gpio->GPECON = 0xAAAAAAAA;
	gpio->GPEUP = 0x0000FFFF;
	gpio->GPFCON = 0x000055AA;
	gpio->GPFUP = 0x000000FF;
	gpio->GPGCON = 0xFF95FFBA;
	gpio->GPGUP = 0x0000FFFF;
	gpio->GPHCON = 0x002AFAAA;
	gpio->GPHUP = 0x000007FF;

	/* arch number of SMDK2410-Board */
	gd->bd->bi_arch_number = MACH_TYPE_MINI2440;

	/* adress of boot parameters */
	gd->bd->bi_boot_params = 0x30000100;

	icache_enable();
	dcache_enable();

	return 0;
}
Example #2
0
int board_init (void)
{
	S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();

        clk_power->CLKDIVN = S3C2410_CLKDIV;

        /* change to asynchronous bus mod */
        __asm__(    "mrc    p15, 0, r1, c1, c0, 0\n"    /* read ctrl register   */  
                    "orr    r1, r1, #0xc0000000\n"      /* Asynchronous         */  
                    "mcr    p15, 0, r1, c1, c0, 0\n"    /* write ctrl register  */  
                    :::"r1"
                    );

	/* to reduce PLL lock time, adjust the LOCKTIME register */
	clk_power->LOCKTIME = 0xFFFFFF;

	/* configure MPLL */
	clk_power->MPLLCON = S3C2410_MPLL_200MHZ;

	/* some delay between MPLL and UPLL */
	delay (4000);

	/* configure UPLL */
	clk_power->UPLLCON = S3C2410_UPLL_48MHZ;

	/* some delay between MPLL and UPLL */
	delay (8000);

	/* set up the I/O ports */
	gpio->GPACON = 0x007FFFFF;
	gpio->GPBCON = 0x00045555;
        gpio->GPBDAT &= (~(1<<6));
	gpio->GPBUP = 0x000007FF;
	gpio->GPCCON = 0xAAAAAAAA;
	gpio->GPCUP = 0x0000FFFF;
	gpio->GPDCON = 0xAAAAAAAA;
	gpio->GPDUP = 0x0000FFFF;
	gpio->GPECON = 0xAAAAAAAA;
	gpio->GPEUP = 0x0000FFFF;
	gpio->GPFCON = 0x000055AA;
	gpio->GPFUP = 0x000000FF;
	gpio->GPGCON = 0xFF95FFBA;
	gpio->GPGUP = 0x0000FFFF;
	gpio->GPHCON = 0x002AFAAA;
	gpio->GPHUP = 0x000007FF;

	/* arch number of SMDK2410-Board */
	gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;

	/* adress of boot parameters */
	gd->bd->bi_boot_params = 0x30000100;

	icache_enable();
	dcache_enable();

	return 0;
}
Example #3
0
int board_nand_init(struct nand_chip *nand)
{
	u_int32_t cfg;
	u_int8_t tacls, twrph0, twrph1;
	S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();

	DEBUGN("board_nand_init()\n");

	clk_power->CLKCON |= (1 << 4);

	/* initialize hardware */
	twrph0 = 3; twrph1 = 0; tacls = 0;

	cfg = S3C2440_NFCONF_TACLS(tacls);
	cfg |= S3C2440_NFCONF_TWRPH0(twrph0);
	cfg |= S3C2440_NFCONF_TWRPH1(twrph1);

	//S3C2440_NFCONT |= S3C2440_NFCONT_ENABLE;
	//S3C2440_NFCONF = cfg;
	S3C2440_NFCONT = 0x1;
	S3C2440_NFCONF = 0x2440;

	/* initialize nand_chip data structure */
	nand->IO_ADDR_R = nand->IO_ADDR_W = (void *)0x4e000010;

	/* read_buf and write_buf are default */
	/* read_byte and write_byte are default */

	/* hwcontrol always must be implemented */
	nand->cmd_ctrl = s3c2440_hwcontrol;

	nand->dev_ready = s3c2440_dev_ready;

#ifdef CONFIG_S3C2440_NAND_HWECC
	nand->ecc.hwctl = s3c2440_nand_enable_hwecc;
	nand->ecc.calculate = s3c2440_nand_calculate_ecc;
	nand->ecc.correct = s3c2440_nand_correct_data;
	nand->ecc.mode = NAND_ECC_HW3_512;
#else
	nand->ecc.mode = NAND_ECC_SOFT;
#endif

#ifdef CONFIG_S3C2440_NAND_BBT
	nand->options = NAND_USE_FLASH_BBT;
#else
	nand->options = 0;
#endif

        DEBUGN("board_nand_init() in cpu/arm920t/s3c24x0/nand.c\n");

	DEBUGN("end of nand_init\n");

	return 0;
}
Example #4
0
int board_init (void)
{
	DECLARE_GLOBAL_DATA_PTR;
	S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();

	/* to reduce PLL lock time, adjust the LOCKTIME register */
	clk_power->LOCKTIME = 0xFFFFFF;

	/* configure MPLL */
	clk_power->MPLLCON = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV);

	/* some delay between MPLL and UPLL */
	delay (4000);

	/* configure UPLL */
	clk_power->UPLLCON = ((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV);

	/* some delay between MPLL and UPLL */
	delay (8000);

	/* set up the I/O ports */
	gpio->GPACON = 0x007FFFFF;
	gpio->GPBCON = 0x00044555;
	gpio->GPBUP = 0x000007FF;
	gpio->GPCCON = 0xAAAAAAAA;
	gpio->GPCUP = 0x0000FFFF;
	gpio->GPDCON = 0xAAAAAAAA;
	gpio->GPDUP = 0x0000FFFF;
	gpio->GPECON = 0xAAAAAAAA;
	gpio->GPEUP = 0x0000FFFF;
	gpio->GPFCON = 0x000055AA;
	gpio->GPFUP = 0x000000FF;
	gpio->GPGCON = 0xFF95FFBA;
	gpio->GPGUP = 0x0000FFFF;
	gpio->GPHCON = 0x002AFAAA;
	gpio->GPHUP = 0x000007FF;

	/* arch number of SMDK2410-Board */
	gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;

	/* adress of boot parameters */
	gd->bd->bi_boot_params = 0x30000100;

	icache_enable();
	dcache_enable();

	return 0;
}
Example #5
0
int board_init (void)
{
	S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
	S3C24X0_MEMCTL * const memctl = S3C24X0_GetBase_MEMCTL();
	unsigned long bus_conf;
	
	/*Buzzer_Stop*/
	gpio->GPBCON &= ~3;			//set GPB0 as output
	gpio->GPBCON |= 1;
	gpio->GPBDAT &= ~1;

	/* to reduce PLL lock time, adjust the LOCKTIME register */
	clk_power->LOCKTIME = 0xFFFFFF;

	/* configure MPLL */
	clk_power->MPLLCON = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV);

	/* some delay between MPLL and UPLL */
	delay (4000);

	/* configure UPLL */
	clk_power->UPLLCON = ((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV);

	/* some delay between MPLL and UPLL */
	delay (8000);

	/* set up the I/O ports */
	gpio->GPACON = 0x007FFFFF;
	gpio->GPBCON = 0x002a9655;
	gpio->GPBUP = 0x000007FF;
	gpio->GPCCON = 0xAAAAAAAA;
	gpio->GPCUP = 0x0000FFFF;
	gpio->GPDCON = 0xAAAAAAAA;
	gpio->GPDUP = 0x0000FFFF;
	gpio->GPECON = 0xAAAAAAAA;
	gpio->GPEUP = 0x0000FFFF;
	gpio->GPFCON = 0x000055AA;
	gpio->GPFUP = 0x000000FF;
	gpio->GPGCON = 0xFD95FFBA;
	gpio->GPGUP = 0x0000FFFF;
#ifdef CONFIG_SERIAL3
	gpio->GPHCON = 0x002AAAAA;
#else
	gpio->GPHCON = 0x002AFAAA;
#endif
	gpio->GPHUP = 0x000007FF;

	gpio->GPJCON = 0x2AAAAAA;

#if 0
	/* USB Device Part */
	/*GPGCON is reset for USB Device */
	gpio->GPGCON = (gpio->GPGCON & ~(3 << 24)) | (1 << 24); /* Output Mode */
	gpio->GPGUP = gpio->GPGUP | ( 1 << 12);			/* Pull up disable */

	gpio->GPGDAT |= ( 1 << 12) ; 
	gpio->GPGDAT &= ~( 1 << 12) ; 
	udelay(20000);
	gpio->GPGDAT |= ( 1 << 12) ; 
#endif
	/*configure for cs8900 chip IO*/
	bus_conf = memctl->BWSCON;
	memctl->BWSCON = (bus_conf & ~0x0000F000) | 0x0000d000;

	/* arch number of AKAE2440-Board */
	gd->bd->bi_arch_number = MACH_TYPE_AKAE2440;

	/* adress of boot parameters */
	gd->bd->bi_boot_params = 0x30000100;

	icache_enable();
	dcache_enable();

	return 0;
}
Example #6
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");
*/
	}
int board_init (void)
{
	S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();

//	/* to reduce PLL lock time, adjust the LOCKTIME register */
//	clk_power->LOCKTIME = 0xFFFFFF;
//
//	/* configure MPLL */
//	clk_power->MPLLCON = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV);
//
//	/* some delay between MPLL and UPLL */
//	delay (4000);
//
//	/* configure UPLL */
//	clk_power->UPLLCON = ((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV);
//
//	/* some delay between MPLL and UPLL */
//	delay (8000);

	/* set up the I/O ports */
	gpio->GPACON = 0x007FFFFF;

#if defined(CONFIG_S3C2440)
	gpio->GPBCON = 0x00295551;
#else
	gpio->GPBCON = 0x00044556;
#endif

	gpio->GPBUP = 0x000007FF;
	gpio->GPCCON = 0xAAAAAAAA;
//	gpio->GPCUP = 0x0000FFFF;
	gpio->GPCUP = 0XFFFFFFFF;
	gpio->GPDCON = 0xAAAAAAAA;
//	gpio->GPDUP = 0x0000FFFF;
	gpio->GPDUP = 0XFFFFFFFF;
	gpio->GPECON = 0xAAAAAAAA;
	gpio->GPEUP = 0x0000FFFF;
	gpio->GPFCON = 0x000055AA;
	gpio->GPFUP = 0x000000FF;
	gpio->GPGCON = 0xFF95FFBA;
	gpio->GPGUP = 0x0000FFFF;
	gpio->GPHCON = 0x002AFAAA;
	gpio->GPHUP = 0x000007FF;

	gpio->GPBDAT = 0X00000000;

	/* Support both s3c2440 and s3c2410 */
	if (0 & ((gpio->GSTATUS1 == 0X32410000) || (gpio->GSTATUS1 == 0X32410002 ))) {
		/* FLCK : HCLK: PCLK = 1:2:4 */
		clk_power->CLKDIVN = S3C2410_CLKDIV;
		/* set cpu async... mode */
		__asm__( "mrc p15, 0, r1, c1, c0, 0\n" /* read ctrl register */
				 "orr r1, r1, #0xc0000000\n"   /* asynchronous */
				 "mcr p15, 0, r1, c1, c0, 0\n" /* write ctrl register */
				 :::"r1"
				);

		/* SET PLL LOCK TIME */
		clk_power->LOCKTIME = 0XFFFFFF;
		
		/* SET MPLL */
		clk_power->MPLLCON = S3C2410_MPLL_200MHZ;

		/* AFTER SET MPLL, DELAY SOME TIME TO SET UPLL */
		delay(4000);

		/* SET UPLL */
		clk_power->UPLLCON = S3C2410_UPLL_48MHZ;

		/* DELAY SOME TIME */
		delay(8000);

		/* MACHINE TYPE ID */
		gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;
	}
Example #8
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");
    }