예제 #1
0
/*******************************************************
 * Routine: misc_init_r
 * Description: Init ethernet (done here so udelay works)
 ********************************************************/
int misc_init_r(void)
{
#ifdef CONFIG_DRIVER_OMAP34XX_I2C

	unsigned char data;

	i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE);
	twl4030_power_reset_init();
	/* see if we need to activate the power button startup */
	char *s = getenv("pbboot");
	if (s) {
		/* figure out why we have booted */
		i2c_read(0x4b, 0x3a, 1, &data, 1);

		/* if status is non-zero, we didn't transition
		 * from WAIT_ON state
		 */
		if (data) {
			printf("Transitioning to Wait State (%x)\n", data);

			/* clear status */
			data = 0;
			i2c_write(0x4b, 0x3a, 1, &data, 1);

			/* put PM into WAIT_ON state */
			data = 0x01;
			i2c_write(0x4b, 0x46, 1, &data, 1);

			/* no return - wait for power shutdown */
			while (1) {;}
		}
		printf("Transitioning to Active State (%x)\n", data);

		/* turn on long pwr button press reset*/
		data = 0x40;
		i2c_write(0x4b, 0x46, 1, &data, 1);
		printf("Power Button Active\n");
	}
#endif
//&*&*&*20101201_Peter ++
	twl4030_usb_init();
	twl4030_keypad_init();
	twl4030_madc_init();
	twl4030_vadc_onoff(1);
//&*&*&*20101201_Peter --
	dieid_num_r();

	return (0);
}
예제 #2
0
int misc_init_r(void)
{
    DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_DRIVER_OMAP34XX_I2C
	unsigned char data;
   
    printf("Hardware arch: %s rev: %s\n", 
            arch_string(gd->bd->bi_arch_number), 
            rev_string(gd->bd->bi_board_revision));
   	
	extern int twl4030_init_battery_charging(void);

	i2c_init(CFG_I2C_SPEED, CFG_I2C_SLAVE);
	(void) twl4030_usb_init();
	twl4030_power_reset_init();
	/* see if we need to activate the power button startup */
#if defined(CONFIG_3621EVT1A)

	/* turn on long pwr button press reset*/
	data = 0x40;
	i2c_write(0x4b, 0x46, 1, &data, 1);
	printf("Power Button Active\n");



	printf("Keep TP in reset \n");
	gpio_pin_init(46, GPIO_OUTPUT, GPIO_HIGH);

        printf("Keep Audio codec under reset \n");
        gpio_pin_init(37, GPIO_OUTPUT, GPIO_LOW);

        printf("Power on Audio codec\n");
        gpio_pin_init(103, GPIO_OUTPUT, GPIO_HIGH);
      
	printf("Take TP out of reset \n");
	gpio_pin_init(46, GPIO_OUTPUT, GPIO_LOW);

#endif
	char *s = getenv("pbboot");
	if (s) {
		/* figure out why we have booted */
		i2c_read(0x4b, 0x3a, 1, &data, 1);

		/* if status is non-zero, we didn't transition
		 * from WAIT_ON state
		 */
		if (data) {
			printf("Transitioning to Wait State (%x)\n", data);

			/* clear status */
			data = 0;
			i2c_write(0x4b, 0x3a, 1, &data, 1);

			/* put PM into WAIT_ON state */
			data = 0x01;
			i2c_write(0x4b, 0x46, 1, &data, 1);

			/* no return - wait for power shutdown */
			while (1) {;}
		}
		printf("Transitioning to Active State (%x)\n", data);

		/* turn on long pwr button press reset*/
		data = 0x40;
		i2c_write(0x4b, 0x46, 1, &data, 1);
		printf("Power Button Active\n");
	}
#endif

	tps65921_keypad_init();
	dieid_num_r();
	return (0);
}