Example #1
0
void am33xx_spl_board_init(void)
{
    /* debug print detect status */
    (void)get_board_type(true);

    /* Get the frequency */
    /* dpll_mpu_opp100.m = am335x_get_efuse_mpu_max_freq(cdev); */
    dpll_mpu_opp100.m = MPUPLL_M_1000;

    if (i2c_probe(TPS65217_CHIP_PM))
        return;

    /* Set the USB Current Limit */
    if (tps65217_reg_write(TPS65217_PROT_LEVEL_NONE, TPS65217_POWER_PATH,
                           TPS65217_USB_INPUT_CUR_LIMIT_1800MA,
                           TPS65217_USB_INPUT_CUR_LIMIT_MASK))
        puts("! tps65217_reg_write: could not set USB limit\n");

    /* Set the Core Voltage (DCDC3) to 1.125V */
    if (tps65217_voltage_update(TPS65217_DEFDCDC3,
                                TPS65217_DCDC_VOLT_SEL_1125MV)) {
        puts("! tps65217_reg_write: could not set Core Voltage\n");
        return;
    }

    /* Set CORE Frequencies to OPP100 */
    do_setup_dpll(&dpll_core_regs, &dpll_core_opp100);

    /* Set the MPU Voltage (DCDC2) */
    if (tps65217_voltage_update(TPS65217_DEFDCDC2,
                                TPS65217_DCDC_VOLT_SEL_1325MV)) {
        puts("! tps65217_reg_write: could not set MPU Voltage\n");
        return;
    }

    /*
     * Set LDO3, LDO4 output voltage to 3.3V for Beaglebone.
     * Set LDO3 to 1.8V and LDO4 to 3.3V for Beaglebone Black.
     */
    if (tps65217_reg_write(TPS65217_PROT_LEVEL_2, TPS65217_DEFLS1,
                           TPS65217_LDO_VOLTAGE_OUT_1_8, TPS65217_LDO_MASK))
        puts("! tps65217_reg_write: could not set LDO3\n");

    if (tps65217_reg_write(TPS65217_PROT_LEVEL_2, TPS65217_DEFLS2,
                           TPS65217_LDO_VOLTAGE_OUT_3_3, TPS65217_LDO_MASK))
        puts("! tps65217_reg_write: could not set LDO4\n");

    /* Set MPU Frequency to what we detected now that voltages are set */
    do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
}
Example #2
0
File: board.c Project: sysplay/bbb
void am33xx_spl_board_init(void)
{
	int mpu_vdd;

	/* Get the frequency */
	dpll_mpu_opp100.m = am335x_get_efuse_mpu_max_freq(cdev);

	/* BeagleBone PMIC Code */
	int usb_cur_lim;


	if (i2c_probe(TPS65217_CHIP_PM))
		return;
	/*
	 * Override what we have detected since we know if we have
	 * a Beaglebone Black it supports 1GHz.
	 */
	dpll_mpu_opp100.m = MPUPLL_M_1000;

	/*
	 * Increase USB current limit to 1300mA or 1800mA and set
	 * the MPU voltage controller as needed.
	 */
	usb_cur_lim = TPS65217_USB_INPUT_CUR_LIMIT_1800MA;
	mpu_vdd = TPS65217_DCDC_VOLT_SEL_1325MV;

	if (tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
				TPS65217_POWER_PATH,
				usb_cur_lim,
				TPS65217_USB_INPUT_CUR_LIMIT_MASK))
		puts("tps65217_reg_write failure\n");

	/* Set DCDC3 (CORE) voltage to 1.125V */
	if (tps65217_voltage_update(TPS65217_DEFDCDC3,
				TPS65217_DCDC_VOLT_SEL_1125MV)) {
		puts("tps65217_voltage_update failure\n");
		return;
	}

	/* Set CORE Frequencies to OPP100 */
	do_setup_dpll(&dpll_core_regs, &dpll_core_opp100);

	/* Set DCDC2 (MPU) voltage */
	if (tps65217_voltage_update(TPS65217_DEFDCDC2, mpu_vdd)) {
		puts("tps65217_voltage_update failure\n");
		return;
	}

	/*
	 * Set LDO3 to 1.8V and LDO4 to 3.3V for Beaglebone Black.
	 */
	if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
				TPS65217_DEFLS1,
				TPS65217_LDO_VOLTAGE_OUT_1_8,
				TPS65217_LDO_MASK))
		puts("tps65217_reg_write failure\n");

	if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
				TPS65217_DEFLS2,
				TPS65217_LDO_VOLTAGE_OUT_3_3,
				TPS65217_LDO_MASK))
		puts("tps65217_reg_write failure\n");
	/* Set MPU Frequency to what we detected now that voltages are set */
	do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
}
Example #3
0
void am33xx_spl_board_init(void)
{
	if (!strncmp("A335BONE", header.name, 8)) {
		/* BeagleBone PMIC Code */
		uchar pmic_status_reg;

		if (i2c_probe(TPS65217_CHIP_PM))
			return;

		if (tps65217_reg_read(STATUS, &pmic_status_reg))
			return;

		/* Increase USB current limit to 1300mA */
		if (tps65217_reg_write(PROT_LEVEL_NONE, POWER_PATH,
				       USB_INPUT_CUR_LIMIT_1300MA,
				       USB_INPUT_CUR_LIMIT_MASK))
			printf("tps65217_reg_write failure\n");

		/* Only perform PMIC configurations if board rev > A1 */
		if (!strncmp(header.version, "00A1", 4))
			return;

		/* Set DCDC2 (MPU) voltage to 1.275V */
		if (tps65217_voltage_update(DEFDCDC2,
					     DCDC_VOLT_SEL_1275MV)) {
			printf("tps65217_voltage_update failure\n");
			return;
		}

		/* Set LDO3, LDO4 output voltage to 3.3V */
		if (tps65217_reg_write(PROT_LEVEL_2, DEFLS1,
				       LDO_VOLTAGE_OUT_3_3, LDO_MASK))
			printf("tps65217_reg_write failure\n");

		if (tps65217_reg_write(PROT_LEVEL_2, DEFLS2,
				       LDO_VOLTAGE_OUT_3_3, LDO_MASK))
			printf("tps65217_reg_write failure\n");

		if (!(pmic_status_reg & PWR_SRC_AC_BITMASK)) {
			printf("No AC power, disabling frequency switch\n");
			return;
		}

		/* Set MPU Frequency to 720MHz */
		mpu_pll_config(MPUPLL_M_720);
	} else {
		uchar buf[4];
		/*
		 * EVM PMIC code.  All boards currently want an MPU voltage
		 * of 1.2625V and CORE voltage of 1.1375V to operate at
		 * 720MHz.
		 */
		if (i2c_probe(PMIC_CTRL_I2C_ADDR))
			return;

		/* VDD1/2 voltage selection register access by control i/f */
		if (i2c_read(PMIC_CTRL_I2C_ADDR, PMIC_DEVCTRL_REG, 1, buf, 1))
			return;

		buf[0] |= PMIC_DEVCTRL_REG_SR_CTL_I2C_SEL_CTL_I2C;

		if (i2c_write(PMIC_CTRL_I2C_ADDR, PMIC_DEVCTRL_REG, 1, buf, 1))
			return;

		if (!voltage_update(MPU, PMIC_OP_REG_SEL_1_2_6) &&
				!voltage_update(CORE, PMIC_OP_REG_SEL_1_1_3)) {
			if (board_is_evm_15_or_later())
	 			mpu_pll_config(MPUPLL_M_800);
			else
	 			mpu_pll_config(MPUPLL_M_720);
		}
	}
}
Example #4
0
void pmicsetup(u32 mpupll)
{
	int mpu_vdd;
	int usb_cur_lim;

	if (i2c_probe(TPS65217_CHIP_PM)) {
		puts("PMIC (0x24) not found! skip further initalization.\n");
		return;
	}

	/* Get the frequency which is defined by device fuses */
	dpll_mpu_opp100.m = am335x_get_efuse_mpu_max_freq(cdev);
	printf("detected max. frequency: %d - ", dpll_mpu_opp100.m);

	if (0 != mpupll) {
		dpll_mpu_opp100.m = MPUPLL_M_1000;
		printf("retuning MPU-PLL to: %d MHz.\n", dpll_mpu_opp100.m);
	} else {
		puts("ok.\n");
	}
	/*
	 * Increase USB current limit to 1300mA or 1800mA and set
	 * the MPU voltage controller as needed.
	 */
	if (dpll_mpu_opp100.m == MPUPLL_M_1000) {
		usb_cur_lim = TPS65217_USB_INPUT_CUR_LIMIT_1800MA;
		mpu_vdd = TPS65217_DCDC_VOLT_SEL_1325MV;
	} else {
		usb_cur_lim = TPS65217_USB_INPUT_CUR_LIMIT_1300MA;
		mpu_vdd = TPS65217_DCDC_VOLT_SEL_1275MV;
	}

	if (tps65217_reg_write(TPS65217_PROT_LEVEL_NONE, TPS65217_POWER_PATH,
			       usb_cur_lim, TPS65217_USB_INPUT_CUR_LIMIT_MASK))
		puts("tps65217_reg_write failure\n");

	/* Set DCDC3 (CORE) voltage to 1.125V */
	if (tps65217_voltage_update(TPS65217_DEFDCDC3,
				    TPS65217_DCDC_VOLT_SEL_1125MV)) {
		puts("tps65217_voltage_update failure\n");
		return;
	}

	/* Set CORE Frequencies to OPP100 */
	do_setup_dpll(&dpll_core_regs, &dpll_core_opp100);

	/* Set DCDC2 (MPU) voltage */
	if (tps65217_voltage_update(TPS65217_DEFDCDC2, mpu_vdd)) {
		puts("tps65217_voltage_update failure\n");
		return;
	}

	/* Set LDO3 to 1.8V */
	if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
			       TPS65217_DEFLS1,
			       TPS65217_LDO_VOLTAGE_OUT_1_8,
			       TPS65217_LDO_MASK))
		puts("tps65217_reg_write failure\n");
	/* Set LDO4 to 3.3V */
	if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
			       TPS65217_DEFLS2,
			       TPS65217_LDO_VOLTAGE_OUT_3_3,
			       TPS65217_LDO_MASK))
		puts("tps65217_reg_write failure\n");

	/* Set MPU Frequency to what we detected now that voltages are set */
	do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
	/* Set PWR_EN bit in Status Register */
	tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
			   TPS65217_STATUS, TPS65217_PWR_OFF, TPS65217_PWR_OFF);
}
void am33xx_spl_board_init(void)
{
	struct am335x_baseboard_id header;
	int mpu_vdd;

	if (read_eeprom(&header) < 0)
	{
		puts("Wrong data in EEPROM.\n");
		hang();
	}

	if (!board_is_kalitap(&header) &&
            !board_is_luna(&header)    &&
            !board_is_catchwire(&header))
	{
		puts("Could not get board ID (CatchWire/KaliTAP).\n");
		hang();
 	}

	/* Get the frequency */
	dpll_mpu_opp100.m = am335x_get_efuse_mpu_max_freq(cdev);

	/* BeagleBone and NEWT PMIC Code */
	int usb_cur_lim;

	if (i2c_probe(TPS65217_CHIP_PM))
		return;

	/*
	 * Override what we have detected since we know we have
	 * a CatchWire/KaliTAP that supports 1GHz.
	 */

         dpll_mpu_opp100.m = MPUPLL_M_1000;

	/*
	 * Increase USB current limit to 1300mA or 1800mA and set
	 * the MPU voltage controller as needed.
	 */
	if (dpll_mpu_opp100.m == MPUPLL_M_1000) {
		usb_cur_lim = TPS65217_USB_INPUT_CUR_LIMIT_1800MA;
		mpu_vdd = TPS65217_DCDC_VOLT_SEL_1325MV;
		puts("tps65217_reg_write USB_INPUT_CUR_LIMIT_1800MA\n");
	} else {
		usb_cur_lim = TPS65217_USB_INPUT_CUR_LIMIT_1300MA;
		mpu_vdd = TPS65217_DCDC_VOLT_SEL_1275MV;
		puts("tps65217_reg_write USB_INPUT_CUR_LIMIT_1300MA\n");
	}

	if (tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
			       TPS65217_POWER_PATH,
			       usb_cur_lim,
			       TPS65217_USB_INPUT_CUR_LIMIT_MASK))
	{ 
		puts("tps65217_reg_write POWER_PATH failure\n");
	}
	else
	{
		uchar pmic_power_path_reg = 0;
		puts("tps65217_reg_write POWER_PATH success\n");
                       tps65217_reg_read(TPS65217_POWER_PATH,
				  &pmic_power_path_reg);
		printf("POWER_PATH : 0%02X\n", pmic_power_path_reg); 
	}

	/* Set DCDC3 (CORE) voltage to 1.125V */
	if (tps65217_voltage_update(TPS65217_DEFDCDC3,
				    TPS65217_DCDC_VOLT_SEL_1125MV)) {
		puts("tps65217_voltage_update failure\n");
		return;
	}

	/* Set CORE Frequencies to OPP100 */
	do_setup_dpll(&dpll_core_regs, &dpll_core_opp100);

	/* Set DCDC2 (MPU) voltage */
	if (tps65217_voltage_update(TPS65217_DEFDCDC2, mpu_vdd)) {
		puts("tps65217_voltage_update failure\n");
		return;
	}
	else
	{
		puts("tps65217_voltage_update success\n");
	}

	/*
	 * Set LDO3 to 1.8V and LDO4 to 3.3V for CatchWire/KaliTAP.
	 */
	if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
			       TPS65217_DEFLS1,
			       TPS65217_LDO_VOLTAGE_OUT_1_8,
			       TPS65217_LDO_MASK))
		puts("tps65217_reg_write failure\n");

	if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
			       TPS65217_DEFLS2,
			       TPS65217_LDO_VOLTAGE_OUT_3_3,
			       TPS65217_LDO_MASK))
		puts("tps65217_reg_write failure\n");

	/* Set MPU Frequency to what we detected now that voltages are set */
	do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
}