diff mbox series

[10/14] timer: ds1338 remove vestige of un-modeled OSF

Message ID 20180705182001.16537-11-mdavidsaver@gmail.com
State New
Headers show
Series Generalize Dallas/Maxim I2C RTC devices v3 | expand

Commit Message

Michael Davidsaver July 5, 2018, 6:19 p.m. UTC
Oscillator stop has never been modeled, so the
Oscillator Stop Flag can never be set.

Signed-off-by: Michael Davidsaver <mdavidsaver@gmail.com>
---
 hw/timer/ds-rtc.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

Comments

David Gibson July 16, 2018, 4:26 a.m. UTC | #1
On Thu, Jul 05, 2018 at 11:19:57AM -0700, Michael Davidsaver wrote:
> Oscillator stop has never been modeled, so the
> Oscillator Stop Flag can never be set.
> 
> Signed-off-by: Michael Davidsaver <mdavidsaver@gmail.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/timer/ds-rtc.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/hw/timer/ds-rtc.c b/hw/timer/ds-rtc.c
> index 3c5781d53c..126566ce1f 100644
> --- a/hw/timer/ds-rtc.c
> +++ b/hw/timer/ds-rtc.c
> @@ -21,8 +21,6 @@
>   */
>  #define NVRAM_SIZE 64
>  
> -#define CTRL_OSF   0x20
> -
>  #define TYPE_DSRTC "ds1338"
>  #define DSRTC(obj) OBJECT_CHECK(DSRTCState, (obj), TYPE_DSRTC)
>  
> @@ -216,13 +214,11 @@ static int dsrtc_send(I2CSlave *i2c, uint8_t data)
>      if (s->ptr == R_CTRL) {
>          /* Control register. */
>  
> -        /* Ensure bits 2, 3 and 6 will read back as zero. */
> -        data &= 0xB3;
> -
> -        /* Attempting to write the OSF flag to logic 1 leaves the
> -           value unchanged. */
> -        data = (data & ~CTRL_OSF) | (data & s->nvram[s->ptr] & CTRL_OSF);
> -
> +        /* Allow guest to set no-op controls for clock out pin and
> +         * rate select.  Ignore write 1 to clear OSF.  We don't model
> +         * oscillator stop, so it is never set.
> +         */
> +        data = data & 0x93;
>      }
>      s->nvram[s->ptr] = data;
>      if (s->ptr <= R_YEAR) {
diff mbox series

Patch

diff --git a/hw/timer/ds-rtc.c b/hw/timer/ds-rtc.c
index 3c5781d53c..126566ce1f 100644
--- a/hw/timer/ds-rtc.c
+++ b/hw/timer/ds-rtc.c
@@ -21,8 +21,6 @@ 
  */
 #define NVRAM_SIZE 64
 
-#define CTRL_OSF   0x20
-
 #define TYPE_DSRTC "ds1338"
 #define DSRTC(obj) OBJECT_CHECK(DSRTCState, (obj), TYPE_DSRTC)
 
@@ -216,13 +214,11 @@  static int dsrtc_send(I2CSlave *i2c, uint8_t data)
     if (s->ptr == R_CTRL) {
         /* Control register. */
 
-        /* Ensure bits 2, 3 and 6 will read back as zero. */
-        data &= 0xB3;
-
-        /* Attempting to write the OSF flag to logic 1 leaves the
-           value unchanged. */
-        data = (data & ~CTRL_OSF) | (data & s->nvram[s->ptr] & CTRL_OSF);
-
+        /* Allow guest to set no-op controls for clock out pin and
+         * rate select.  Ignore write 1 to clear OSF.  We don't model
+         * oscillator stop, so it is never set.
+         */
+        data = data & 0x93;
     }
     s->nvram[s->ptr] = data;
     if (s->ptr <= R_YEAR) {