mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-13 06:42:56 +00:00
83d290c56f
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
82 lines
1.8 KiB
C
82 lines
1.8 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* (C) Copyright 2011-2013
|
|
* Texas Instruments, <www.ti.com>
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <i2c.h>
|
|
#include <power/tps65910.h>
|
|
|
|
/*
|
|
* tps65910_set_i2c_control() - Set the TPS65910 to be controlled via the I2C
|
|
* interface.
|
|
* @return: 0 on success, not 0 on failure
|
|
*/
|
|
int tps65910_set_i2c_control(void)
|
|
{
|
|
int ret;
|
|
uchar buf;
|
|
|
|
/* VDD1/2 voltage selection register access by control i/f */
|
|
ret = i2c_read(TPS65910_CTRL_I2C_ADDR, TPS65910_DEVCTRL_REG, 1,
|
|
&buf, 1);
|
|
|
|
if (ret)
|
|
return ret;
|
|
|
|
buf |= TPS65910_DEVCTRL_REG_SR_CTL_I2C_SEL_CTL_I2C;
|
|
|
|
return i2c_write(TPS65910_CTRL_I2C_ADDR, TPS65910_DEVCTRL_REG, 1,
|
|
&buf, 1);
|
|
}
|
|
|
|
/*
|
|
* tps65910_voltage_update() - Voltage switching for MPU frequency switching.
|
|
* @module: mpu - 0, core - 1
|
|
* @vddx_op_vol_sel: vdd voltage to set
|
|
* @return: 0 on success, not 0 on failure
|
|
*/
|
|
int tps65910_voltage_update(unsigned int module, unsigned char vddx_op_vol_sel)
|
|
{
|
|
uchar buf;
|
|
unsigned int reg_offset;
|
|
int ret;
|
|
|
|
if (module == MPU)
|
|
reg_offset = TPS65910_VDD1_OP_REG;
|
|
else
|
|
reg_offset = TPS65910_VDD2_OP_REG;
|
|
|
|
/* Select VDDx OP */
|
|
ret = i2c_read(TPS65910_CTRL_I2C_ADDR, reg_offset, 1, &buf, 1);
|
|
if (ret)
|
|
return ret;
|
|
|
|
buf &= ~TPS65910_OP_REG_CMD_MASK;
|
|
|
|
ret = i2c_write(TPS65910_CTRL_I2C_ADDR, reg_offset, 1, &buf, 1);
|
|
if (ret)
|
|
return ret;
|
|
|
|
/* Configure VDDx OP Voltage */
|
|
ret = i2c_read(TPS65910_CTRL_I2C_ADDR, reg_offset, 1, &buf, 1);
|
|
if (ret)
|
|
return ret;
|
|
|
|
buf &= ~TPS65910_OP_REG_SEL_MASK;
|
|
buf |= vddx_op_vol_sel;
|
|
|
|
ret = i2c_write(TPS65910_CTRL_I2C_ADDR, reg_offset, 1, &buf, 1);
|
|
if (ret)
|
|
return ret;
|
|
|
|
ret = i2c_read(TPS65910_CTRL_I2C_ADDR, reg_offset, 1, &buf, 1);
|
|
if (ret)
|
|
return ret;
|
|
|
|
if ((buf & TPS65910_OP_REG_SEL_MASK) != vddx_op_vol_sel)
|
|
return 1;
|
|
|
|
return 0;
|
|
}
|