upstream u-boot with additional patches for our devices/boards:
https://lists.denx.de/pipermail/u-boot/2017-March/282789.html (AXP crashes) ;
Gbit ethernet patch for some LIME2 revisions ;
with SPI flash support
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
639 B
29 lines
639 B
/*
|
|
* (C) Copyright 2016
|
|
* Jelle van der Waa <jelle@vdwaa.nl>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
#include <common.h>
|
|
#include <i2c.h>
|
|
#include <sy8106a.h>
|
|
|
|
#define SY8106A_I2C_ADDR 0x65
|
|
#define SY8106A_VOUT1_SEL 1
|
|
#define SY8106A_VOUT1_SEL_ENABLE (1 << 7)
|
|
|
|
static u8 sy8106a_mvolt_to_cfg(int mvolt, int min, int max, int div)
|
|
{
|
|
if (mvolt < min)
|
|
mvolt = min;
|
|
else if (mvolt > max)
|
|
mvolt = max;
|
|
|
|
return (mvolt - min) / div;
|
|
}
|
|
|
|
int sy8106a_set_vout1(unsigned int mvolt)
|
|
{
|
|
u8 data = sy8106a_mvolt_to_cfg(mvolt, 680, 1950, 10) | SY8106A_VOUT1_SEL_ENABLE;
|
|
return i2c_write(SY8106A_I2C_ADDR, SY8106A_VOUT1_SEL, 1, &data, 1);
|
|
}
|
|
|