mirror of
				https://github.com/smaeul/u-boot.git
				synced 2025-11-03 21:48:15 +00:00 
			
		
		
		
	drivers: rtc: max313xx: Fix setting years 2100-2199
An invalid calculation made setting years 2100-2199 impossible. Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz> Cc: Chris Packham <judge.packham@gmail.com> Reviewed-by: Chris Packham <judge.packham@gmail.com>
This commit is contained in:
		
							parent
							
								
									0d837cb075
								
							
						
					
					
						commit
						d86da7e2bd
					
				@ -285,7 +285,7 @@ static int max313xx_set_time(struct udevice *dev, const struct rtc_time *t)
 | 
				
			|||||||
	regs[5] = bin2bcd(t->tm_mon);
 | 
						regs[5] = bin2bcd(t->tm_mon);
 | 
				
			||||||
	regs[6] = bin2bcd((t->tm_year - 2000) % 100);
 | 
						regs[6] = bin2bcd((t->tm_year - 2000) % 100);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((t->tm_year - 2000) >= 200)
 | 
						if (t->tm_year >= 2100)
 | 
				
			||||||
		regs[5] |= FIELD_PREP(MAX313XX_MONTH_CENTURY, 1);
 | 
							regs[5] |= FIELD_PREP(MAX313XX_MONTH_CENTURY, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ret = dm_i2c_write(dev, rtc->chip->sec_reg, regs, 7);
 | 
						ret = dm_i2c_write(dev, rtc->chip->sec_reg, regs, 7);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user