All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: qemu-devel@nongnu.org
Cc: Takashi Yoshii <yoshii.takashi@renesas.com>,
	Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
Subject: Re: [Qemu-devel]  [PATCH] SH7750/51: add register BCR3, NCR4, PCR, RTCOR, RTCNT, RTCSR, SDMR2, SDMR3 and fix BCR2 support
Date: Sun, 14 Dec 2008 15:51:45 +0100	[thread overview]
Message-ID: <20081214145145.GC18560@game.jcrosoft.org> (raw)
In-Reply-To: <4944EFFE.1050604@juno.dti.ne.jp>

> >  
> > -
> > +static int inline is_sh7751r_cpu(SH7750State * s)
> > +{
> > +	return (s->cpu->id & (SH_CPU_SH7751R));
> > +}
> >  /**********************************************************************
> >   I/O ports
> >  **********************************************************************/
> > @@ -212,8 +219,17 @@ static uint32_t sh7750_mem_readw(void *opaque, target_phys_addr_t addr)
> >      switch (addr) {
> >      case SH7750_BCR2_A7:
> >  	return s->bcr2;
> > +    case SH7750_BCR3_A7:
> > +	if(is_sh7751r_cpu(s)) {
> > +	    return s->bcr3;
> > +	} else {
> > +	    error_access("word read", addr);
> > +	    assert(0);
> > +	}
> 
> BCR3 exists not only for SH7751R, but also SH7750.
> I think is_shh751r_cpu() check and error handling
> should be removed to simplify the differcence.
as write in the SH7751r datasheet

Bus Control Register 3 (BCR3) (SH7751R Only)
Bus Control Register 4 (BCR4) (SH7751R Only)

That's why I've add the check
> 
> >      case SH7750_FRQCR_A7:
> >  	return 0;
> > +    case SH7750_PCR_A7:
> > +	return s->pcr;
> >      case SH7750_RFCR_A7:
> >  	fprintf(stderr,
> >  		"Read access to refresh count register, incrementing\n");
> > @@ -222,6 +238,11 @@ static uint32_t sh7750_mem_readw(void *opaque, target_phys_addr_t addr)
> >  	return porta_lines(s);
> >      case SH7750_PDTRB_A7:
> >  	return portb_lines(s);
> > +    case SH7750_RTCOR_A7:
> > +    case SH7750_RTCNT_A7:
> > +    case SH7750_RTCSR_A7:
> > +	ignore_access("word read", addr);
> > +	return 0;
> >      case 0x1fd00000:
> >          return s->icr;
> >      default:
> > @@ -238,6 +259,12 @@ static uint32_t sh7750_mem_readl(void *opaque, target_phys_addr_t addr)
> >      case SH7750_BCR1_A7:
> >  	return s->bcr1;
> >      case SH7750_BCR4_A7:
> > +	if(is_sh7751r_cpu(s)) {
> > +	    return s->bcr4;
> > +	} else {
> > +	    error_access("long read", addr);
> > +	    assert(0);
> > +	}
> 
> For BCR4, same as above.
> 
> >      case SH7750_WCR1_A7:
> >      case SH7750_WCR2_A7:
> >      case SH7750_WCR3_A7:
> > @@ -274,9 +301,17 @@ static uint32_t sh7750_mem_readl(void *opaque, target_phys_addr_t addr)
> >      }
> >  }
> >  
> > +#define is_in_sdrmx(a, x) (a >= SH7750_SDMR ## x ## _A7 \
> > +			&& a <= (SH7750_SDMR ## x ## _A7 + SH7750_SDMR ## x ## _REGNB))
> >  static void sh7750_mem_writeb(void *opaque, target_phys_addr_t addr,
> >  			      uint32_t mem_value)
> >  {
> > +
> > +    if (is_in_sdrmx(addr, 2) || is_in_sdrmx(addr, 3)) {
> > +	ignore_access("word write", addr);
> > +	return;
> > +    }
> > +
> 
> SRMR2 and SDMR3 region overlaps with the PRECHARGE0/1 register.
> If you introduce them, PRECHARGE0/1 register should be removed.
> # U-Boot does not seem to touch these regions.  Does it?
IIRC no I'll check it
> 
> Compared to 'if' statement, 'switch-case' might be more easy to
> understand, like as follows.
>   case SH7750_SDMR2 ... SH7750_SDMR2 + SDMR2_REGNB
ok evenif it's a gcc only extension

Best Regards,
J.

  reply	other threads:[~2008-12-14 14:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-05 11:49 [Qemu-devel] [PATCH] SH7750/51: add register BCR3, NCR4, PCR, RTCOR, RTCNT, RTCSR, SDMR2, SDMR3 and fix BCR2 support Jean-Christophe PLAGNIOL-VILLARD
2008-12-14 11:37 ` Shin-ichiro KAWASAKI
2008-12-14 14:51   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2008-12-14 15:36     ` Shin-ichiro KAWASAKI
2008-12-14 16:37       ` Jean-Christophe PLAGNIOL-VILLARD
2008-12-14 17:24         ` Thiemo Seufer
2008-12-15  0:37           ` Shin-ichiro KAWASAKI
2008-12-15  1:08             ` Thiemo Seufer
2008-12-14 17:28       ` Aurelien Jarno
2008-12-17  9:18         ` [Qemu-devel] [PATCH V2] SH7750/51: add register BCR3, BCR4, " Jean-Christophe PLAGNIOL-VILLARD
2008-12-18 15:51           ` Aurelien Jarno
2008-12-18 21:47             ` [U-Boot] [PATCH V3] " Jean-Christophe PLAGNIOL-VILLARD
2008-12-18 21:50               ` Jean-Christophe PLAGNIOL-VILLARD
2008-12-18 21:49             ` [Qemu-devel] " Jean-Christophe PLAGNIOL-VILLARD
2008-12-18 23:33               ` [Qemu-devel] [PATCH V4] " Jean-Christophe PLAGNIOL-VILLARD
2009-02-07 15:19                 ` Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081214145145.GC18560@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=iwamatsu.nobuhiro@renesas.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yoshii.takashi@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.