mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-19 05:31:32 +00:00
rtc: rx8025: revise single register write to use offset
Writing of individual registers was not functioning correctly as a 0 'offset' byte under DM-managed I2C was being appended in front of register we wanted to access. Signed-off-by: Mathew McBride <matt@traverse.com.au>
This commit is contained in:
parent
771fc0c079
commit
701c04f331
1 changed files with 7 additions and 4 deletions
|
@ -214,11 +214,14 @@ static int rx8025_rtc_reset(struct udevice *dev)
|
||||||
*/
|
*/
|
||||||
static int rtc_write(struct udevice *dev, uchar reg, uchar val)
|
static int rtc_write(struct udevice *dev, uchar reg, uchar val)
|
||||||
{
|
{
|
||||||
uchar buf[2];
|
/* The RX8025/RX8035 uses the top 4 bits of the
|
||||||
buf[0] = reg << 4;
|
* 'offset' byte as the start register address,
|
||||||
buf[1] = val;
|
* and the bottom 4 bits as a 'transfer' mode setting
|
||||||
|
* (only applicable for reads)
|
||||||
|
*/
|
||||||
|
u8 offset = (reg << 4);
|
||||||
|
|
||||||
if (dm_i2c_write(dev, 0, buf, 2)) {
|
if (dm_i2c_reg_write(dev, offset, val)) {
|
||||||
printf("Error writing to RTC\n");
|
printf("Error writing to RTC\n");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue