RTC v3020 fixes
PATCH 1/1 RTC v3020 fixes
Signed-off-by Mike Rapoport <[email protected]>
Acked-by Raphael Assenat <[email protected]>
drivers/char/emv3020.c +13 -5
@@ -48,12 +48,16 @@ static void emv3020_set_reg(unsigned char address, unsigned char data) {int i; -for ( i =0 ; i <4 ; i++ ) +for ( i =0 ; i <4 ; i++ ) {writel ((address << (16 -i)),EMV3020_VA_RTC ); +udelay (1 ); + }if ( address <0xe ) -for ( i =0 ; i <8 ; i++) +for ( i =0 ; i <8 ; i++) {writel ((data << (16 -i)),EMV3020_VA_RTC ); +udelay (1 ); + } }static unsigned char emv3020_get_reg (unsigned char address)
@@ -61,12 +65,16 @@ static unsigned char emv3020_get_reg(unsigned char address)unsigned int data=0 ;int i, tmp; -for ( i =0 ; i <4 ; i++ ) +for ( i =0 ; i <4 ; i++ ) {writel ((address << (16 -i)),EMV3020_VA_RTC ); +udelay (1 ); + } +for ( i =0 ; i <8 ; i++ ) { tmp =readl (EMV3020_VA_RTC ); data |= ((tmp &0x10000 ) >> (16 - i)); +udelay (1 ); }return data;
@@ -108,7 +116,7 @@ static int emv3020_rtc_gettime(struct rtc_time *dt)BCD_TO_BIN (dt->tm_min);BCD_TO_BIN (dt->tm_hour);BCD_TO_BIN (dt->tm_mday); -BCD_TO_BIN (dt->tm_mon); +BCD_TO_BIN (dt->tm_mon -1 );BCD_TO_BIN (dt->tm_wday);BCD_TO_BIN (dt->tm_year); dt->tm_year +=100 ;
@@ -148,7 +156,7 @@ static int emv3020_rtc_settime(struct rtc_time *dt)emv3020_set_reg (0x03 , dt->tm_min);emv3020_set_reg (0x04 , dt->tm_hour);emv3020_set_reg (0x05 , dt->tm_mday); -emv3020_set_reg (0x06 , dt->tm_mon); +emv3020_set_reg (0x06 , dt->tm_mon +1 );emv3020_set_reg (0x08 , dt->tm_wday);emv3020_set_reg (0x07 , dt->tm_year);
Hi,
On Thu, 23 Aug 2007, Mike Rapoport wrote:
No changelog for patch ?!
drivers/char/emv3020.c static unsigned char emv3020_get_reg(unsigned char address) · line 72
Quoted 7 lines
drivers/char/emv3020.c +4
-1-for ( i =0 ; i <4 ; i++ ) +for ( i =0 ; i <4 ; i++ ) {writel ((address << (16 -i)),EMV3020_VA_RTC ); +udelay (1 ); + } +
^ Spurious extra newline here.
Review
Quoted 5 lines
(quoted diff) +2
-2- BCD_TO_BIN(dt->tm_mon); + BCD_TO_BIN(dt->tm_mon - 1); - emv3020_set_reg(0x06, dt->tm_mon); + emv3020_set_reg(0x06, dt->tm_mon + 1);
Why? (looks unrelated to the udelay() fixes as well)
Quoted 7 lines · Satyam Sharma
Hi,
On Thu, 23 Aug 2007, Mike Rapoport wrote:
No changelog for patch ?!
Ooops. The wrong file from the wrong place. Sorry for the noise.